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