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