1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 //____________________________________________________________________________________________________________
25 //	my own includes
26 //____________________________________________________________________________________________________________
27 
28 #include "progressmonitor.hxx"
29 
30 //____________________________________________________________________________________________________________
31 //	includes of other projects
32 //____________________________________________________________________________________________________________
33 #include <com/sun/star/awt/GradientStyle.hpp>
34 #include <com/sun/star/awt/RasterOperation.hpp>
35 #include <com/sun/star/awt/Gradient.hpp>
36 #include <com/sun/star/awt/XGraphics.hpp>
37 #include <com/sun/star/awt/PosSize.hpp>
38 #include <cppuhelper/typeprovider.hxx>
39 #include <tools/debug.hxx>
40 #include <tools/solar.h>
41 
42 //____________________________________________________________________________________________________________
43 //	includes of my project
44 //____________________________________________________________________________________________________________
45 #include "progressbar.hxx"
46 
47 //____________________________________________________________________________________________________________
48 //	namespace
49 //____________________________________________________________________________________________________________
50 
51 using namespace	::cppu					;
52 using namespace	::osl					;
53 using namespace	::rtl					;
54 using namespace	::com::sun::star::uno	;
55 using namespace	::com::sun::star::lang	;
56 using namespace	::com::sun::star::awt	;
57 
58 namespace unocontrols{
59 
60 //____________________________________________________________________________________________________________
61 //	construct/destruct
62 //____________________________________________________________________________________________________________
63 
ProgressMonitor(const Reference<XMultiServiceFactory> & xFactory)64 ProgressMonitor::ProgressMonitor( const Reference< XMultiServiceFactory >& xFactory )
65 	: BaseContainerControl	( xFactory	)
66 {
67 	// Its not allowed to work with member in this method (refcounter !!!)
68 	// But with a HACK (++refcount) its "OK" :-(
69 	++m_refCount ;
70 
71 	// Create instances for fixedtext, button and progress ...
72 	m_xTopic_Top	= Reference< XFixedText > 		( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_SERVICENAME	) ), UNO_QUERY ) ;
73 	m_xText_Top		= Reference< XFixedText > 		( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_SERVICENAME	) ), UNO_QUERY ) ;
74 	m_xTopic_Bottom	= Reference< XFixedText > 		( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_SERVICENAME	) ), UNO_QUERY ) ;
75 	m_xText_Bottom	= Reference< XFixedText > 		( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_SERVICENAME	) ), UNO_QUERY ) ;
76 	m_xButton		= Reference< XButton > 			( xFactory->createInstance ( OUString::createFromAscii( BUTTON_SERVICENAME		) ), UNO_QUERY ) ;
77 	m_xProgressBar	= Reference< XProgressBar >  	( xFactory->createInstance ( OUString::createFromAscii( SERVICENAME_PROGRESSBAR	) ), UNO_QUERY ) ;
78 
79 	// ... cast controls to Reference< XControl >  (for "setModel"!) ...
80 	Reference< XControl > 	xRef_Topic_Top		( m_xTopic_Top	  , UNO_QUERY ) ;
81 	Reference< XControl > 	xRef_Text_Top		( m_xText_Top	  , UNO_QUERY ) ;
82 	Reference< XControl > 	xRef_Topic_Bottom	( m_xTopic_Bottom , UNO_QUERY ) ;
83 	Reference< XControl > 	xRef_Text_Bottom	( m_xText_Bottom  , UNO_QUERY ) ;
84 	Reference< XControl > 	xRef_Button			( m_xButton		  , UNO_QUERY ) ;
85 	Reference< XControl > 	xRef_ProgressBar	( m_xProgressBar  , UNO_QUERY ) ;
86 
87 	// ... set models ...
88 	xRef_Topic_Top->setModel		( Reference< XControlModel >  ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_MODELNAME	) ), UNO_QUERY ) ) ;
89 	xRef_Text_Top->setModel			( Reference< XControlModel >  ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_MODELNAME	) ), UNO_QUERY ) ) ;
90 	xRef_Topic_Bottom->setModel		( Reference< XControlModel >  ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_MODELNAME	) ), UNO_QUERY ) ) ;
91 	xRef_Text_Bottom->setModel		( Reference< XControlModel >  ( xFactory->createInstance ( OUString::createFromAscii( FIXEDTEXT_MODELNAME	) ), UNO_QUERY ) ) ;
92 	xRef_Button->setModel			( Reference< XControlModel >  ( xFactory->createInstance ( OUString::createFromAscii( BUTTON_MODELNAME		) ), UNO_QUERY ) ) ;
93 	// ProgressBar has no model !!!
94 
95 	// ... and add controls to basecontainercontrol!
96 	addControl ( OUString::createFromAscii( CONTROLNAME_TEXT		) , xRef_Topic_Top   	) ;
97 	addControl ( OUString::createFromAscii( CONTROLNAME_TEXT		) , xRef_Text_Top	   	) ;
98 	addControl ( OUString::createFromAscii( CONTROLNAME_TEXT		) , xRef_Topic_Bottom	) ;
99 	addControl ( OUString::createFromAscii( CONTROLNAME_TEXT		) , xRef_Text_Bottom	) ;
100 	addControl ( OUString::createFromAscii( CONTROLNAME_BUTTON		) , xRef_Button			) ;
101 	addControl ( OUString::createFromAscii( CONTROLNAME_PROGRESSBAR	) , xRef_ProgressBar 	) ;
102 
103 	// FixedText make it automaticly visible by himself ... but not the progressbar !!!
104 	// it must be set explicitly
105 	Reference< XWindow > xWindowRef_ProgressBar( m_xProgressBar, UNO_QUERY );
106 	xWindowRef_ProgressBar->setVisible( sal_True );
107 
108 	// Reset to defaults !!!
109 	// (progressbar take automaticly its own defaults)
110 	m_xButton->setLabel			( OUString::createFromAscii( DEFAULT_BUTTONLABEL	) ) ;
111 	m_xTopic_Top->setText		( OUString::createFromAscii( DEFAULT_TOPIC			) ) ;
112 	m_xText_Top->setText		( OUString::createFromAscii( DEFAULT_TEXT			) ) ;
113 	m_xTopic_Bottom->setText	( OUString::createFromAscii( DEFAULT_TOPIC			) ) ;
114 	m_xText_Bottom->setText		( OUString::createFromAscii( DEFAULT_TEXT			) ) ;
115 
116 	--m_refCount ;
117 
118 	// Initialize info lists for fixedtext's
119 	m_pTextlist_Top		= new IMPL_Textlist ;
120 	m_pTextlist_Bottom	= new IMPL_Textlist ;
121 }
122 
~ProgressMonitor()123 ProgressMonitor::~ProgressMonitor()
124 {
125 	impl_cleanMemory () ;
126 }
127 
128 //____________________________________________________________________________________________________________
129 //	XInterface
130 //____________________________________________________________________________________________________________
131 
queryInterface(const Type & rType)132 Any SAL_CALL ProgressMonitor::queryInterface( const Type& rType ) throw( RuntimeException )
133 {
134 	// Attention:
135 	//	Don't use mutex or guard in this method!!! Is a method of XInterface.
136 	Any aReturn ;
137 	Reference< XInterface > xDel = BaseContainerControl::impl_getDelegator();
138 	if ( xDel.is() )
139 	{
140 		// If an delegator exist, forward question to his queryInterface.
141 		// Delegator will ask his own queryAggregation!
142 		aReturn = xDel->queryInterface( rType );
143 	}
144 	else
145 	{
146 		// If an delegator unknown, forward question to own queryAggregation.
147 		aReturn = queryAggregation( rType );
148 	}
149 
150 	return aReturn ;
151 }
152 
153 //____________________________________________________________________________________________________________
154 //	XInterface
155 //____________________________________________________________________________________________________________
156 
acquire()157 void SAL_CALL ProgressMonitor::acquire() throw()
158 {
159 	// Attention:
160 	//	Don't use mutex or guard in this method!!! Is a method of XInterface.
161 
162 	// Forward to baseclass
163 	BaseControl::acquire();
164 }
165 
166 //____________________________________________________________________________________________________________
167 //	XInterface
168 //____________________________________________________________________________________________________________
169 
release()170 void SAL_CALL ProgressMonitor::release() throw()
171 {
172 	// Attention:
173 	//	Don't use mutex or guard in this method!!! Is a method of XInterface.
174 
175 	// Forward to baseclass
176 	BaseControl::release();
177 }
178 
179 //____________________________________________________________________________________________________________
180 //	XTypeProvider
181 //____________________________________________________________________________________________________________
182 
getTypes()183 Sequence< Type > SAL_CALL ProgressMonitor::getTypes() throw( RuntimeException )
184 {
185 	// Optimize this method !
186 	// We initialize a static variable only one time. And we don't must use a mutex at every call!
187 	// For the first call; pTypeCollection is NULL - for the second call pTypeCollection is different from NULL!
188 	static OTypeCollection* pTypeCollection = NULL ;
189 
190 	if ( pTypeCollection == NULL )
191 	{
192 		// Ready for multithreading; get global mutex for first call of this method only! see before
193 		MutexGuard aGuard( Mutex::getGlobalMutex() );
194 
195 		// Control these pointer again ... it can be, that another instance will be faster then these!
196 		if ( pTypeCollection == NULL )
197 		{
198 			// Create a static typecollection ...
199 			static OTypeCollection aTypeCollection	(	::getCppuType(( const Reference< XLayoutConstrains	>*)NULL )	,
200 												  		::getCppuType(( const Reference< XButton			>*)NULL )	,
201 												  		::getCppuType(( const Reference< XProgressMonitor	>*)NULL )	,
202 														BaseContainerControl::getTypes()
203 													);
204 			// ... and set his address to static pointer!
205 			pTypeCollection = &aTypeCollection ;
206 		}
207 	}
208 
209 	return pTypeCollection->getTypes();
210 }
211 
212 //____________________________________________________________________________________________________________
213 //	XAggregation
214 //____________________________________________________________________________________________________________
215 
queryAggregation(const Type & aType)216 Any SAL_CALL ProgressMonitor::queryAggregation( const Type& aType ) throw( RuntimeException )
217 {
218 	// Ask for my own supported interfaces ...
219 	// Attention: XTypeProvider and XInterface are supported by OComponentHelper!
220 	Any aReturn	( ::cppu::queryInterface(	aType					   					,
221 									   		static_cast< XLayoutConstrains*	> ( this )	,
222 									   		static_cast< XButton*			> ( this )	,
223 									   		static_cast< XProgressMonitor*	> ( this )
224 										)
225 				);
226 
227 	// If searched interface not supported by this class ...
228 	if ( aReturn.hasValue() == sal_False )
229 	{
230 		// ... ask baseclasses.
231 		aReturn = BaseControl::queryAggregation( aType );
232 	}
233 
234 	return aReturn ;
235 }
236 
237 //____________________________________________________________________________________________________________
238 //	XProgressMonitor
239 //____________________________________________________________________________________________________________
240 
addText(const OUString & rTopic,const OUString & rText,sal_Bool bbeforeProgress)241 void SAL_CALL ProgressMonitor::addText( const OUString& rTopic, const OUString& rText, sal_Bool bbeforeProgress ) throw( RuntimeException )
242 {
243 	// Safe impossible cases
244 	// Check valid call of this method.
245 	DBG_ASSERT ( impl_debug_checkParameter ( rTopic, rText, bbeforeProgress )	, "ProgressMonitor::addText()\nCall without valid parameters!\n") ;
246 	DBG_ASSERT ( !(impl_searchTopic ( rTopic, bbeforeProgress ) != NULL )		, "ProgresMonitor::addText()\nThe text already exist.\n"		) ;
247 
248 	// Do nothing (in Release), if topic already exist.
249 	if ( impl_searchTopic ( rTopic, bbeforeProgress ) != NULL )
250 	{
251 		return ;
252 	}
253 
254 	// Else ... take memory for new item ...
255 	IMPL_TextlistItem*	pTextItem = new IMPL_TextlistItem ;
256 
257 	if ( pTextItem != NULL )
258 	{
259 		// Set values ...
260 		pTextItem->sTopic	= rTopic ;
261 		pTextItem->sText	= rText	;
262 
263 		// Ready for multithreading
264 		MutexGuard aGuard ( m_aMutex ) ;
265 
266 		// ... and insert it in right list.
267 		if ( bbeforeProgress == sal_True )
268 		{
269 			m_pTextlist_Top->Insert    ( pTextItem, LIST_APPEND ) ;
270 		}
271 		else
272 		{
273 			m_pTextlist_Bottom->Insert ( pTextItem, LIST_APPEND ) ;
274 		}
275 	}
276 
277 	// ... update window
278 	impl_rebuildFixedText	() ;
279 	impl_recalcLayout		() ;
280 }
281 
282 //____________________________________________________________________________________________________________
283 //	XProgressMonitor
284 //____________________________________________________________________________________________________________
285 
removeText(const OUString & rTopic,sal_Bool bbeforeProgress)286 void SAL_CALL ProgressMonitor::removeText ( const OUString& rTopic, sal_Bool bbeforeProgress ) throw( RuntimeException )
287 {
288 	// Safe impossible cases
289 	// Check valid call of this method.
290 	DBG_ASSERT ( impl_debug_checkParameter ( rTopic, bbeforeProgress ), "ProgressMonitor::removeText()\nCall without valid parameters!\n" ) ;
291 
292 	// Search the topic ...
293 	IMPL_TextlistItem* pSearchItem = impl_searchTopic ( rTopic, bbeforeProgress ) ;
294 
295 	if ( pSearchItem != NULL )
296 	{
297 		// Ready for multithreading
298 		MutexGuard aGuard ( m_aMutex ) ;
299 
300 		// ... delete item from right list ...
301 		if ( bbeforeProgress == sal_True )
302 		{
303 			m_pTextlist_Top->Remove	   ( pSearchItem ) ;
304 		}
305 		else
306 		{
307 			m_pTextlist_Bottom->Remove ( pSearchItem ) ;
308 		}
309 
310 		delete pSearchItem ;
311 
312 		// ... and update window.
313 		impl_rebuildFixedText	() ;
314 		impl_recalcLayout		() ;
315 	}
316 }
317 
318 //____________________________________________________________________________________________________________
319 //	XProgressMonitor
320 //____________________________________________________________________________________________________________
321 
updateText(const OUString & rTopic,const OUString & rText,sal_Bool bbeforeProgress)322 void SAL_CALL ProgressMonitor::updateText ( const OUString& rTopic, const OUString& rText, sal_Bool bbeforeProgress ) throw( RuntimeException )
323 {
324 	// Safe impossible cases
325 	// Check valid call of this method.
326 	DBG_ASSERT ( impl_debug_checkParameter ( rTopic, rText, bbeforeProgress ), "ProgressMonitor::updateText()\nCall without valid parameters!\n" ) ;
327 
328 	// Search topic ...
329 	IMPL_TextlistItem* pSearchItem = impl_searchTopic ( rTopic, bbeforeProgress ) ;
330 
331 	if ( pSearchItem != NULL )
332 	{
333 		// Ready for multithreading
334 		MutexGuard aGuard ( m_aMutex ) ;
335 
336 		// ... update text ...
337 		pSearchItem->sText = rText ;
338 
339 		// ... and update window.
340 		impl_rebuildFixedText	() ;
341 		impl_recalcLayout		() ;
342 	}
343 }
344 
345 //____________________________________________________________________________________________________________
346 //	XProgressBar
347 //____________________________________________________________________________________________________________
348 
setForegroundColor(sal_Int32 nColor)349 void SAL_CALL ProgressMonitor::setForegroundColor ( sal_Int32 nColor ) throw( RuntimeException )
350 {
351 	// Ready for multithreading
352 	MutexGuard aGuard ( m_aMutex ) ;
353 
354 	if ( m_xProgressBar.is () )
355 	{
356 		m_xProgressBar->setForegroundColor ( nColor ) ;
357 	}
358 }
359 
360 //____________________________________________________________________________________________________________
361 //	XProgressBar
362 //____________________________________________________________________________________________________________
363 
setBackgroundColor(sal_Int32 nColor)364 void SAL_CALL ProgressMonitor::setBackgroundColor ( sal_Int32 nColor ) throw( RuntimeException )
365 {
366 	// Ready for multithreading
367 	MutexGuard aGuard ( m_aMutex ) ;
368 
369 	if ( m_xProgressBar.is () )
370 	{
371 		m_xProgressBar->setBackgroundColor ( nColor ) ;
372 	}
373 }
374 
375 //____________________________________________________________________________________________________________
376 //	XProgressBar
377 //____________________________________________________________________________________________________________
378 
setValue(sal_Int32 nValue)379 void SAL_CALL ProgressMonitor::setValue ( sal_Int32 nValue ) throw( RuntimeException )
380 {
381 	// Ready for multithreading
382 	MutexGuard aGuard ( m_aMutex ) ;
383 
384 	if ( m_xProgressBar.is () )
385 	{
386 		m_xProgressBar->setValue ( nValue ) ;
387 	}
388 }
389 
390 //____________________________________________________________________________________________________________
391 //	XProgressBar
392 //____________________________________________________________________________________________________________
393 
setRange(sal_Int32 nMin,sal_Int32 nMax)394 void SAL_CALL ProgressMonitor::setRange ( sal_Int32 nMin, sal_Int32 nMax ) throw( RuntimeException )
395 {
396 	// Ready for multithreading
397 	MutexGuard aGuard ( m_aMutex ) ;
398 
399 	if ( m_xProgressBar.is () )
400 	{
401 		m_xProgressBar->setRange ( nMin, nMax ) ;
402 	}
403 }
404 
405 //____________________________________________________________________________________________________________
406 //	XProgressBar
407 //____________________________________________________________________________________________________________
408 
getValue()409 sal_Int32 SAL_CALL ProgressMonitor::getValue () throw( RuntimeException )
410 {
411 	// Ready for multithreading
412 	MutexGuard aGuard ( m_aMutex ) ;
413 
414 	if (m_xProgressBar.is())
415 	{
416 		return m_xProgressBar->getValue () ;
417 	}
418 
419 	return 0 ;
420 }
421 
422 //____________________________________________________________________________________________________________
423 //	XButton
424 //____________________________________________________________________________________________________________
425 
addActionListener(const Reference<XActionListener> & rListener)426 void SAL_CALL ProgressMonitor::addActionListener ( const Reference< XActionListener > & rListener ) throw( RuntimeException )
427 {
428 	// Ready for multithreading
429 	MutexGuard aGuard ( m_aMutex ) ;
430 
431 	if ( m_xButton.is () )
432 	{
433 		m_xButton->addActionListener ( rListener ) ;
434 	}
435 }
436 
437 //____________________________________________________________________________________________________________
438 //	XButton
439 //____________________________________________________________________________________________________________
440 
removeActionListener(const Reference<XActionListener> & rListener)441 void SAL_CALL ProgressMonitor::removeActionListener ( const Reference< XActionListener > & rListener ) throw( RuntimeException )
442 {
443 	// Ready for multithreading
444 	MutexGuard aGuard ( m_aMutex ) ;
445 
446 	if ( m_xButton.is () )
447 	{
448 		m_xButton->removeActionListener ( rListener ) ;
449 	}
450 }
451 
452 //____________________________________________________________________________________________________________
453 //	XButton
454 //____________________________________________________________________________________________________________
455 
setLabel(const OUString & rLabel)456 void SAL_CALL ProgressMonitor::setLabel ( const OUString& rLabel ) throw( RuntimeException )
457 {
458 	// Ready for multithreading
459 	MutexGuard aGuard ( m_aMutex ) ;
460 
461 	if ( m_xButton.is () )
462 	{
463 		m_xButton->setLabel ( rLabel ) ;
464 	}
465 }
466 
467 //____________________________________________________________________________________________________________
468 //	XButton
469 //____________________________________________________________________________________________________________
470 
setActionCommand(const OUString & rCommand)471 void SAL_CALL ProgressMonitor::setActionCommand ( const OUString& rCommand ) throw( RuntimeException )
472 {
473 	// Ready for multithreading
474 	MutexGuard aGuard ( m_aMutex ) ;
475 
476 	if ( m_xButton.is () )
477 	{
478 		m_xButton->setActionCommand ( rCommand ) ;
479 	}
480 }
481 
482 //____________________________________________________________________________________________________________
483 //	XLayoutConstrains
484 //____________________________________________________________________________________________________________
485 
getMinimumSize()486 Size SAL_CALL ProgressMonitor::getMinimumSize () throw( RuntimeException )
487 {
488 	return Size (DEFAULT_WIDTH, DEFAULT_HEIGHT) ;
489 }
490 
491 //____________________________________________________________________________________________________________
492 //	XLayoutConstrains
493 //____________________________________________________________________________________________________________
494 
getPreferredSize()495 Size SAL_CALL ProgressMonitor::getPreferredSize () throw( RuntimeException )
496 {
497 	// Ready for multithreading
498 	ClearableMutexGuard aGuard ( m_aMutex ) ;
499 
500 	// get information about required place of child controls
501 	Reference< XLayoutConstrains > 	xTopicLayout_Top		( m_xTopic_Top		, UNO_QUERY ) ;
502 	Reference< XLayoutConstrains > 	xTopicLayout_Bottom		( m_xTopic_Bottom	, UNO_QUERY ) ;
503 	Reference< XLayoutConstrains > 	xButtonLayout			( m_xButton			, UNO_QUERY ) ;
504 	Reference< XWindow > 			xProgressBarWindow		( m_xProgressBar	, UNO_QUERY ) ;
505 
506 	Size		aTopicSize_Top		=	xTopicLayout_Top->getPreferredSize			();
507 	Size		aTopicSize_Bottom	=	xTopicLayout_Bottom->getPreferredSize		();
508 	Size		aButtonSize			=	xButtonLayout->getPreferredSize		 		();
509 	Rectangle	aTempRectangle		=	xProgressBarWindow->getPosSize				();
510 	Size		aProgressBarSize	=	Size( aTempRectangle.Width, aTempRectangle.Height );
511 
512 	aGuard.clear () ;
513 
514 	// calc preferred size of progressmonitor
515 	sal_Int32	nWidth	=	0 ;
516 	sal_Int32	nHeight	=	0 ;
517 
518 	nWidth	 =	3 * FREEBORDER			;
519 	nWidth	+=	aProgressBarSize.Width	;
520 
521 	nHeight	 =	6 * FREEBORDER			;
522 	nHeight	+=	aTopicSize_Top.Height	;
523 	nHeight	+=	aProgressBarSize.Height	;
524 	nHeight	+=	aTopicSize_Bottom.Height;
525 	nHeight	+=	2						;	// 1 for black line, 1 for white line = 3D-Line!
526 	nHeight	+=	aButtonSize.Height		;
527 
528 	// norm to minimum
529 	if ( nWidth<DEFAULT_WIDTH )
530 	{
531 		nWidth = DEFAULT_WIDTH ;
532 	}
533 	if ( nHeight<DEFAULT_HEIGHT )
534 	{
535 		nHeight = DEFAULT_HEIGHT ;
536 	}
537 
538 	// return to caller
539 	return Size ( nWidth, nHeight ) ;
540 }
541 
542 //____________________________________________________________________________________________________________
543 //	XLayoutConstrains
544 //____________________________________________________________________________________________________________
545 
calcAdjustedSize(const Size &)546 Size SAL_CALL ProgressMonitor::calcAdjustedSize ( const Size& /*rNewSize*/ ) throw( RuntimeException )
547 {
548 	return getPreferredSize () ;
549 }
550 
551 //____________________________________________________________________________________________________________
552 //	XControl
553 //____________________________________________________________________________________________________________
554 
createPeer(const Reference<XToolkit> & rToolkit,const Reference<XWindowPeer> & rParent)555 void SAL_CALL ProgressMonitor::createPeer ( const Reference< XToolkit > & rToolkit, const Reference< XWindowPeer > & rParent	) throw( RuntimeException )
556 {
557 	if (!getPeer().is())
558 	{
559 		BaseContainerControl::createPeer ( rToolkit, rParent ) ;
560 
561 		// If user forget to call "setPosSize()", we have still a correct size.
562 		// And a "MinimumSize" IS A "MinimumSize"!
563 		// We change not the position of control at this point.
564 		Size aDefaultSize = getMinimumSize () ;
565 		setPosSize ( 0, 0, aDefaultSize.Width, aDefaultSize.Height, PosSize::SIZE ) ;
566 	}
567 }
568 
569 //____________________________________________________________________________________________________________
570 //	XControl
571 //____________________________________________________________________________________________________________
572 
setModel(const Reference<XControlModel> &)573 sal_Bool SAL_CALL ProgressMonitor::setModel ( const Reference< XControlModel > & /*rModel*/ ) throw( RuntimeException )
574 {
575 	// We have no model.
576 	return sal_False ;
577 }
578 
579 //____________________________________________________________________________________________________________
580 //	XControl
581 //____________________________________________________________________________________________________________
582 
getModel()583 Reference< XControlModel > SAL_CALL ProgressMonitor::getModel () throw( RuntimeException )
584 {
585 	// We have no model.
586 	// return (XControlModel*)this ;
587 	return Reference< XControlModel >  () ;
588 }
589 
590 //____________________________________________________________________________________________________________
591 //	XComponent
592 //____________________________________________________________________________________________________________
593 
dispose()594 void SAL_CALL ProgressMonitor::dispose () throw( RuntimeException )
595 {
596 	// Ready for multithreading
597 	MutexGuard aGuard ( m_aMutex ) ;
598 
599 	// "removeControl()" control the state of a reference
600 	Reference< XControl >  xRef_Topic_Top		( m_xTopic_Top		, UNO_QUERY ) ;
601 	Reference< XControl >  xRef_Text_Top		( m_xText_Top		, UNO_QUERY ) ;
602 	Reference< XControl >  xRef_Topic_Bottom	( m_xTopic_Bottom	, UNO_QUERY ) ;
603 	Reference< XControl >  xRef_Text_Bottom		( m_xText_Bottom	, UNO_QUERY ) ;
604 	Reference< XControl >  xRef_Button			( m_xButton			, UNO_QUERY ) ;
605 	Reference< XControl >  xRef_ProgressBar		( m_xProgressBar	, UNO_QUERY ) ;
606 
607 	removeControl ( xRef_Topic_Top	  	) ;
608 	removeControl ( xRef_Text_Top	  	) ;
609 	removeControl ( xRef_Topic_Bottom 	) ;
610 	removeControl ( xRef_Text_Bottom	) ;
611 	removeControl ( xRef_Button 		) ;
612 	removeControl ( xRef_ProgressBar	) ;
613 
614 	// do'nt use "...->clear ()" or "... = XFixedText ()"
615 	// when other hold a reference at this object !!!
616 	xRef_Topic_Top->dispose 	() ;
617 	xRef_Text_Top->dispose 		() ;
618 	xRef_Topic_Bottom->dispose 	() ;
619 	xRef_Text_Bottom->dispose 	() ;
620 	xRef_Button->dispose		() ;
621 	xRef_ProgressBar->dispose	() ;
622 
623 	BaseContainerControl::dispose () ;
624 }
625 
626 //____________________________________________________________________________________________________________
627 //	XWindow
628 //____________________________________________________________________________________________________________
629 
setPosSize(sal_Int32 nX,sal_Int32 nY,sal_Int32 nWidth,sal_Int32 nHeight,sal_Int16 nFlags)630 void SAL_CALL ProgressMonitor::setPosSize ( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 nFlags ) throw( RuntimeException )
631 {
632 	Rectangle	aBasePosSize = getPosSize () ;
633 	BaseContainerControl::setPosSize (nX, nY, nWidth, nHeight, nFlags) ;
634 
635 	// if position or size changed
636 	if (
637 		( nWidth  != aBasePosSize.Width	) ||
638 		( nHeight != aBasePosSize.Height)
639 	   )
640 	{
641 		// calc new layout for controls
642 		impl_recalcLayout () ;
643 		// clear background (!)
644 		// [Childs was repainted in "recalcLayout" by setPosSize() automaticly!]
645 		getPeer()->invalidate(2);
646 		// and repaint the control
647 		impl_paint ( 0, 0, impl_getGraphicsPeer() ) ;
648 	}
649 }
650 
651 //____________________________________________________________________________________________________________
652 //	impl but public method to register service
653 //____________________________________________________________________________________________________________
654 
impl_getStaticSupportedServiceNames()655 const Sequence< OUString > ProgressMonitor::impl_getStaticSupportedServiceNames()
656 {
657 	MutexGuard aGuard( Mutex::getGlobalMutex() );
658     Sequence< OUString > seqServiceNames( 1 );
659     seqServiceNames.getArray() [0] = OUString::createFromAscii( SERVICENAME_PROGRESSMONITOR );
660     return seqServiceNames ;
661 }
662 
663 //____________________________________________________________________________________________________________
664 //	impl but public method to register service
665 //____________________________________________________________________________________________________________
666 
impl_getStaticImplementationName()667 const OUString ProgressMonitor::impl_getStaticImplementationName()
668 {
669 	return OUString::createFromAscii( IMPLEMENTATIONNAME_PROGRESSMONITOR );
670 }
671 
672 //____________________________________________________________________________________________________________
673 //	protected method
674 //____________________________________________________________________________________________________________
675 
impl_paint(sal_Int32 nX,sal_Int32 nY,const Reference<XGraphics> & rGraphics)676 void ProgressMonitor::impl_paint ( sal_Int32 nX, sal_Int32 nY, const Reference< XGraphics > & rGraphics )
677 {
678 	if (rGraphics.is())
679 	{
680 		// Ready for multithreading
681 		MutexGuard aGuard ( m_aMutex ) ;
682 
683 		// paint shadowed border around the progressmonitor
684 		rGraphics->setLineColor ( LINECOLOR_SHADOW																) ;
685 		rGraphics->drawLine		( impl_getWidth()-1, impl_getHeight()-1, impl_getWidth()-1, nY 					) ;
686 		rGraphics->drawLine		( impl_getWidth()-1, impl_getHeight()-1, nX		   		  , impl_getHeight()-1	) ;
687 
688 		rGraphics->setLineColor ( LINECOLOR_BRIGHT							) ;
689 		rGraphics->drawLine		( nX, nY, impl_getWidth(), nY 				) ;
690 		rGraphics->drawLine		( nX, nY, nX		  	 , impl_getHeight()	) ;
691 
692 		// Paint 3D-line
693 		rGraphics->setLineColor ( LINECOLOR_SHADOW	) ;
694 		rGraphics->drawLine		( m_a3DLine.X, m_a3DLine.Y, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y ) ;
695 
696 		rGraphics->setLineColor ( LINECOLOR_BRIGHT	) ;
697 		rGraphics->drawLine		( m_a3DLine.X, m_a3DLine.Y+1, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y+1 ) ;
698 	}
699 }
700 
701 //____________________________________________________________________________________________________________
702 //	private method
703 //____________________________________________________________________________________________________________
704 
impl_recalcLayout()705 void ProgressMonitor::impl_recalcLayout ()
706 {
707 	sal_Int32	nX_Button				;
708 	sal_Int32	nY_Button				;
709 	sal_Int32	nWidth_Button			;
710 	sal_Int32	nHeight_Button			;
711 
712 	sal_Int32	nX_ProgressBar			;
713 	sal_Int32	nY_ProgressBar			;
714 	sal_Int32	nWidth_ProgressBar		;
715 	sal_Int32	nHeight_ProgressBar		;
716 
717 	sal_Int32	nX_3DLine				;
718 	sal_Int32	nY_3DLine				;
719 	sal_Int32	nWidth_3DLine			;
720 	sal_Int32	nHeight_3DLine			;
721 
722 	sal_Int32	nX_Text_Top				;
723 	sal_Int32	nY_Text_Top				;
724 	sal_Int32	nWidth_Text_Top			;
725 	sal_Int32	nHeight_Text_Top		;
726 
727 	sal_Int32	nX_Topic_Top	 		;
728 	sal_Int32	nY_Topic_Top	 		;
729 	sal_Int32	nWidth_Topic_Top 		;
730 	sal_Int32	nHeight_Topic_Top		;
731 
732 	sal_Int32	nX_Text_Bottom			;
733 	sal_Int32	nY_Text_Bottom			;
734 	sal_Int32	nWidth_Text_Bottom		;
735 	sal_Int32	nHeight_Text_Bottom		;
736 
737 	sal_Int32	nX_Topic_Bottom	 		;
738 	sal_Int32	nY_Topic_Bottom	 		;
739 	sal_Int32	nWidth_Topic_Bottom 	;
740 	sal_Int32	nHeight_Topic_Bottom	;
741 
742 	// Ready for multithreading
743 	MutexGuard aGuard ( m_aMutex ) ;
744 
745 	// get information about required place of child controls
746 	Reference< XLayoutConstrains > 	xTopicLayout_Top	( m_xTopic_Top		, UNO_QUERY ) ;
747 	Reference< XLayoutConstrains > 	xTextLayout_Top		( m_xText_Top		, UNO_QUERY ) ;
748 	Reference< XLayoutConstrains > 	xTopicLayout_Bottom	( m_xTopic_Bottom	, UNO_QUERY ) ;
749 	Reference< XLayoutConstrains > 	xTextLayout_Bottom	( m_xText_Bottom	, UNO_QUERY ) ;
750 	Reference< XLayoutConstrains > 	xButtonLayout		( m_xButton			, UNO_QUERY ) ;
751 
752 	Size	aTopicSize_Top		=	xTopicLayout_Top->getPreferredSize		() ;
753 	Size	aTextSize_Top		=	xTextLayout_Top->getPreferredSize		() ;
754 	Size	aTopicSize_Bottom	=	xTopicLayout_Bottom->getPreferredSize	() ;
755 	Size	aTextSize_Bottom	=	xTextLayout_Bottom->getPreferredSize	() ;
756 	Size	aButtonSize			=	xButtonLayout->getPreferredSize		 	() ;
757 
758 	// calc position and size of child controls
759 	// Button has preferred size!
760 	nWidth_Button			=	aButtonSize.Width												;
761 	nHeight_Button			=	aButtonSize.Height												;
762 
763 	// Left column before progressbar has preferred size and fixed position.
764 	// But "Width" is oriented on left column below progressbar to!!! "max(...)"
765 	nX_Topic_Top			=	FREEBORDER														;
766 	nY_Topic_Top			=	FREEBORDER														;
767 	nWidth_Topic_Top		=	Max ( aTopicSize_Top.Width, aTopicSize_Bottom.Width )			;
768 	nHeight_Topic_Top		=	aTopicSize_Top.Height											;
769 
770 	// Right column before progressbar has relativ position to left column ...
771 	// ... and a size as rest of dialog size!
772 	nX_Text_Top				=	nX_Topic_Top+nWidth_Topic_Top+FREEBORDER						;
773 	nY_Text_Top				=	nY_Topic_Top													;
774 	nWidth_Text_Top			=	Max ( aTextSize_Top.Width, aTextSize_Bottom.Width )				;
775 	// Fix size of this column to minimum!
776 	sal_Int32 nSummaryWidth = nWidth_Text_Top+nWidth_Topic_Top+(3*FREEBORDER) ;
777 	if ( nSummaryWidth < DEFAULT_WIDTH )
778 		nWidth_Text_Top		=	DEFAULT_WIDTH-nWidth_Topic_Top-(3*FREEBORDER);
779 	// Fix size of column to maximum!
780 	if ( nSummaryWidth > impl_getWidth() )
781 		nWidth_Text_Top		=	impl_getWidth()-nWidth_Topic_Top-(3*FREEBORDER)					;
782 	nHeight_Text_Top		=	nHeight_Topic_Top												;
783 
784 	// Position of progressbar is relativ to columns before.
785 	// Progressbar.Width  = Dialog.Width !!!
786 	// Progressbar.Height = Button.Height
787 	nX_ProgressBar			=	nX_Topic_Top													;
788 	nY_ProgressBar			=	nY_Topic_Top+nHeight_Topic_Top+FREEBORDER						;
789 	nWidth_ProgressBar		=	FREEBORDER+nWidth_Topic_Top+nWidth_Text_Top						;
790 	nHeight_ProgressBar		=	nHeight_Button													;
791 
792 	// Oriented by left column before progressbar.
793 	nX_Topic_Bottom			=	nX_Topic_Top													;
794 	nY_Topic_Bottom			=	nY_ProgressBar+nHeight_ProgressBar+FREEBORDER					;
795 	nWidth_Topic_Bottom		=	nWidth_Topic_Top												;
796 	nHeight_Topic_Bottom	=	aTopicSize_Bottom.Height										;
797 
798 	// Oriented by right column before progressbar.
799 	nX_Text_Bottom			=	nX_Topic_Bottom+nWidth_Topic_Bottom+FREEBORDER					;
800 	nY_Text_Bottom			=	nY_Topic_Bottom													;
801 	nWidth_Text_Bottom		=	nWidth_Text_Top													;
802 	nHeight_Text_Bottom		=	nHeight_Topic_Bottom											;
803 
804 	// Oriented by progressbar.
805 	nX_3DLine				=	nX_Topic_Top													;
806 	nY_3DLine				=	nY_Topic_Bottom+nHeight_Topic_Bottom+(FREEBORDER/2)				;
807 	nWidth_3DLine			=	nWidth_ProgressBar												;
808 	nHeight_3DLine			=	1																;	// Height for ONE line ! (But we paint two lines!)
809 
810 	// Oriented by progressbar.
811 	nX_Button				=	nX_ProgressBar+nWidth_ProgressBar-nWidth_Button					;
812 	nY_Button				=	nY_Topic_Bottom+nHeight_Topic_Bottom+FREEBORDER					;
813 
814 	// Calc offsets to center controls
815 	sal_Int32	nDx	;
816 	sal_Int32	nDy	;
817 
818 	nDx	=	( (2*FREEBORDER)+nWidth_ProgressBar																) ;
819 	nDy	=	( (6*FREEBORDER)+nHeight_Topic_Top+nHeight_ProgressBar+nHeight_Topic_Bottom+2+nHeight_Button	) ;
820 
821 	// At this point use original dialog size to center controls!
822 	nDx	=	(impl_getWidth ()/2)-(nDx/2)	;
823 	nDy	=	(impl_getHeight()/2)-(nDy/2)	;
824 
825 	if ( nDx<0 )
826 	{
827 		nDx=0 ;
828 	}
829 	if ( nDy<0 )
830 	{
831 		nDy=0 ;
832 	}
833 
834 	// Set new position and size on all controls
835 	Reference< XWindow >  xRef_Topic_Top		( m_xTopic_Top		, UNO_QUERY ) ;
836 	Reference< XWindow >  xRef_Text_Top			( m_xText_Top 		, UNO_QUERY ) ;
837 	Reference< XWindow >  xRef_Topic_Bottom		( m_xTopic_Bottom	, UNO_QUERY ) ;
838 	Reference< XWindow >  xRef_Text_Bottom		( m_xText_Bottom 	, UNO_QUERY ) ;
839 	Reference< XWindow >  xRef_Button			( m_xButton			, UNO_QUERY ) ;
840 	Reference< XWindow >  xRef_ProgressBar		( m_xProgressBar	, UNO_QUERY ) ;
841 
842 	xRef_Topic_Top->setPosSize		( nDx+nX_Topic_Top		, nDy+nY_Topic_Top		, nWidth_Topic_Top		, nHeight_Topic_Top	  	, 15 ) ;
843 	xRef_Text_Top->setPosSize		( nDx+nX_Text_Top		, nDy+nY_Text_Top		, nWidth_Text_Top		, nHeight_Text_Top		, 15 ) ;
844 	xRef_Topic_Bottom->setPosSize	( nDx+nX_Topic_Bottom	, nDy+nY_Topic_Bottom	, nWidth_Topic_Bottom	, nHeight_Topic_Bottom	, 15 ) ;
845 	xRef_Text_Bottom->setPosSize	( nDx+nX_Text_Bottom	, nDy+nY_Text_Bottom	, nWidth_Text_Bottom	, nHeight_Text_Bottom	, 15 ) ;
846 	xRef_Button->setPosSize			( nDx+nX_Button	 		, nDy+nY_Button	 		, nWidth_Button	 		, nHeight_Button	 	, 15 ) ;
847 	xRef_ProgressBar->setPosSize	( nDx+nX_ProgressBar	, nDy+nY_ProgressBar	, nWidth_ProgressBar	, nHeight_ProgressBar	, 15 ) ;
848 
849 	m_a3DLine.X			= nDx+nX_Topic_Top											;
850 	m_a3DLine.Y			= nDy+nY_Topic_Bottom+nHeight_Topic_Bottom+(FREEBORDER/2)	;
851 	m_a3DLine.Width		= nWidth_ProgressBar										;
852 	m_a3DLine.Height	= nHeight_ProgressBar										;
853 
854 	// All childcontrols make an implicit repaint in setPosSize()!
855 	// Make it also for this 3D-line ...
856 	Reference< XGraphics >  xGraphics = impl_getGraphicsPeer () ;
857 
858 	xGraphics->setLineColor ( LINECOLOR_SHADOW	) ;
859 	xGraphics->drawLine		( m_a3DLine.X, m_a3DLine.Y, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y ) ;
860 
861 	xGraphics->setLineColor ( LINECOLOR_BRIGHT	) ;
862 	xGraphics->drawLine		( m_a3DLine.X, m_a3DLine.Y+1, m_a3DLine.X+m_a3DLine.Width, m_a3DLine.Y+1 ) ;
863 }
864 
865 //____________________________________________________________________________________________________________
866 //	private method
867 //____________________________________________________________________________________________________________
868 
impl_rebuildFixedText()869 void ProgressMonitor::impl_rebuildFixedText ()
870 {
871 	// Ready for multithreading
872 	MutexGuard aGuard ( m_aMutex ) ;
873 
874 	// Rebuild fixedtext before progress
875 
876 	// Rebuild left site of text
877 	if (m_xTopic_Top.is())
878 	{
879 		OUString		aCollectString	;
880 
881 		// Collect all topics from list and format text.
882 		// "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!!
883 		for ( sal_uInt32 n=0; n<m_pTextlist_Top->Count(); ++n )
884 		{
885 			IMPL_TextlistItem* pSearchItem = m_pTextlist_Top->GetObject (n) ;
886 			aCollectString	+=	pSearchItem->sTopic ;
887 			aCollectString	+=	OUString::createFromAscii("\n")			    ;
888 		}
889 		aCollectString	+=	OUString::createFromAscii("\0")	;	// It's better :-)
890 
891 		m_xTopic_Top->setText ( aCollectString ) ;
892 	}
893 
894 	// Rebuild right site of text
895 	if (m_xText_Top.is())
896 	{
897 		OUString		aCollectString	;
898 
899 		// Collect all topics from list and format text.
900 		// "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!!
901 		for ( sal_uInt32 n=0; n<m_pTextlist_Top->Count(); ++n )
902 		{
903 			IMPL_TextlistItem* pSearchItem = m_pTextlist_Top->GetObject (n) ;
904 			aCollectString	+=	pSearchItem->sText ;
905 			aCollectString	+=	OUString::createFromAscii("\n")			   ;
906 		}
907 		aCollectString	+=	OUString::createFromAscii("\0")	;	// It's better :-)
908 
909 		m_xText_Top->setText ( aCollectString ) ;
910 	}
911 
912 	// Rebuild fixedtext below progress
913 
914 	// Rebuild left site of text
915 	if (m_xTopic_Bottom.is())
916 	{
917 		OUString		aCollectString	;
918 
919 		// Collect all topics from list and format text.
920 		// "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!!
921 		for ( sal_uInt32 n=0; n<m_pTextlist_Bottom->Count(); ++n )
922 		{
923 			IMPL_TextlistItem* pSearchItem = m_pTextlist_Bottom->GetObject (n) ;
924 			aCollectString	+=	pSearchItem->sTopic ;
925 			aCollectString	+=	OUString::createFromAscii("\n")			    ;
926 		}
927 		aCollectString	+=	OUString::createFromAscii("\0")	;	// It's better :-)
928 
929 		m_xTopic_Bottom->setText ( aCollectString ) ;
930 	}
931 
932 	// Rebuild right site of text
933 	if (m_xText_Bottom.is())
934 	{
935 		OUString		aCollectString	;
936 
937 		// Collect all topics from list and format text.
938 		// "\n" MUST BE at the end of line!!! => Else ... topic and his text are not in the same line!!!
939 		for ( sal_uInt32 n=0; n<m_pTextlist_Bottom->Count(); ++n )
940 		{
941 			IMPL_TextlistItem* pSearchItem = m_pTextlist_Bottom->GetObject (n) ;
942 			aCollectString	+=	pSearchItem->sText ;
943 			aCollectString	+=	OUString::createFromAscii("\n")			   ;
944 		}
945 		aCollectString	+=	OUString::createFromAscii("\0")	;	// It's better :-)
946 
947 		m_xText_Bottom->setText ( aCollectString ) ;
948 	}
949 }
950 
951 //____________________________________________________________________________________________________________
952 //	private method
953 //____________________________________________________________________________________________________________
954 
impl_cleanMemory()955 void ProgressMonitor::impl_cleanMemory ()
956 {
957 	// Ready for multithreading
958 	MutexGuard aGuard ( m_aMutex ) ;
959 
960 	// Delete all of lists.
961 
962 	sal_uInt32 nPosition ;
963 
964 	for ( nPosition = 0; nPosition < m_pTextlist_Top->Count () ; ++nPosition )
965 	{
966 		IMPL_TextlistItem* pSearchItem = m_pTextlist_Top->GetObject ( nPosition ) ;
967 		delete pSearchItem ;
968 	}
969 	m_pTextlist_Top->Clear () ;
970 	delete m_pTextlist_Top ;
971 
972 	for ( nPosition = 0; nPosition < m_pTextlist_Bottom->Count () ; ++nPosition )
973 	{
974 		IMPL_TextlistItem* pSearchItem = m_pTextlist_Bottom->GetObject ( nPosition ) ;
975 		delete pSearchItem ;
976 	}
977 	m_pTextlist_Bottom->Clear () ;
978 	delete m_pTextlist_Bottom ;
979 }
980 
981 //____________________________________________________________________________________________________________
982 //	private method
983 //____________________________________________________________________________________________________________
984 
impl_searchTopic(const OUString & rTopic,sal_Bool bbeforeProgress)985 IMPL_TextlistItem* ProgressMonitor::impl_searchTopic ( const OUString& rTopic, sal_Bool bbeforeProgress	)
986 {
987 	// Get right textlist for following operations.
988 	IMPL_Textlist* pTextList ;
989 
990 	// Ready for multithreading
991 	ClearableMutexGuard aGuard ( m_aMutex ) ;
992 
993 	if ( bbeforeProgress == sal_True )
994 	{
995 		pTextList = m_pTextlist_Top    ;
996 	}
997 	else
998 	{
999 		pTextList = m_pTextlist_Bottom ;
1000 	}
1001 
1002 	// Switch off guard.
1003 	aGuard.clear () ;
1004 
1005 	// Search the topic in textlist.
1006 	sal_uInt32	nPosition	=	0					;
1007 	sal_uInt32	nCount		=	pTextList->Count ()	;
1008 
1009 	for ( nPosition = 0; nPosition < nCount ; ++nPosition )
1010 	{
1011 		IMPL_TextlistItem* pSearchItem = pTextList->GetObject ( nPosition ) ;
1012 
1013 		if ( pSearchItem->sTopic == rTopic )
1014 		{
1015 			// We have found this topic ... return a valid pointer.
1016 			return pSearchItem ;
1017 		}
1018 	}
1019 
1020 	// We have'nt found this topic ... return a nonvalid pointer.
1021 	return NULL ;
1022 }
1023 
1024 //____________________________________________________________________________________________________________
1025 //	debug methods
1026 //____________________________________________________________________________________________________________
1027 
1028 #ifdef DBG_UTIL
1029 
1030 // addText, updateText
impl_debug_checkParameter(const OUString & rTopic,const OUString & rText,sal_Bool)1031 sal_Bool ProgressMonitor::impl_debug_checkParameter ( const OUString& rTopic, const OUString& rText, sal_Bool /*bbeforeProgress*/ )
1032 {
1033 	// Check "rTopic"
1034 	if ( &rTopic		==	NULL	) return sal_False ;	// NULL-pointer for reference ???!!!
1035 	if ( rTopic.getLength ()	<	1		) return sal_False ;	// ""
1036 
1037 	// Check "rText"
1038 	if ( &rText			==	NULL	) return sal_False ;	// NULL-pointer for reference ???!!!
1039 	if ( rText.getLength ()	<	1		) return sal_False ;	// ""
1040 
1041 	// "bbeforeProgress" is valid in everyway!
1042 
1043 	// Parameter OK ... return sal_True.
1044 	return sal_True ;
1045 }
1046 
1047 // removeText
impl_debug_checkParameter(const OUString & rTopic,sal_Bool)1048 sal_Bool ProgressMonitor::impl_debug_checkParameter ( const OUString& rTopic, sal_Bool /*bbeforeProgress*/ )
1049 {
1050 	// Check "rTopic"
1051 	if ( &rTopic		==	NULL	) return sal_False ;	// NULL-pointer for reference ???!!!
1052 	if ( rTopic.getLength ()	<	1		) return sal_False ;	// ""
1053 
1054 	// "bbeforeProgress" is valid in everyway!
1055 
1056 	// Parameter OK ... return sal_True.
1057 	return sal_True ;
1058 }
1059 
1060 #endif	// #ifdef DBG_UTIL
1061 
1062 }	// namespace unocontrols
1063