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 <algorithm>
21 : #include <helper/statusindicatorfactory.hxx>
22 : #include <helper/statusindicator.hxx>
23 : #include <helper/vclstatusindicator.hxx>
24 : #include <threadhelp/lockhelper.hxx>
25 : #include <services.h>
26 : #include <properties.h>
27 :
28 : #include <com/sun/star/awt/Rectangle.hpp>
29 :
30 : #include <com/sun/star/awt/XControl.hpp>
31 : #include <com/sun/star/awt/XLayoutConstrains.hpp>
32 : #include <com/sun/star/awt/DeviceInfo.hpp>
33 : #include <com/sun/star/awt/PosSize.hpp>
34 : #include <com/sun/star/awt/WindowAttribute.hpp>
35 : #include <com/sun/star/awt/XTopWindow.hpp>
36 : #include <com/sun/star/awt/XWindow2.hpp>
37 : #include <com/sun/star/beans/XPropertySet.hpp>
38 : #include <com/sun/star/frame/XLayoutManager2.hpp>
39 :
40 : #include <toolkit/helper/vclunohelper.hxx>
41 :
42 : #include <comphelper/sequenceashashmap.hxx>
43 : #include <unotools/mediadescriptor.hxx>
44 : #include <vcl/svapp.hxx>
45 : #include <osl/mutex.hxx>
46 : #include <rtl/ref.hxx>
47 :
48 : #include <officecfg/Office/Common.hxx>
49 :
50 : namespace framework{
51 :
52 : sal_Int32 StatusIndicatorFactory::m_nInReschedule = 0; /// static counter for rescheduling
53 : const char PROGRESS_RESOURCE[] = "private:resource/progressbar/progressbar";
54 :
55 2077 : StatusIndicatorFactory::StatusIndicatorFactory(const css::uno::Reference< css::uno::XComponentContext >& xContext)
56 : : m_xContext (xContext )
57 : , m_pWakeUp (0 )
58 : , m_bAllowReschedule (false)
59 : , m_bAllowParentShow (false)
60 2077 : , m_bDisableReschedule(false)
61 : {
62 2077 : }
63 :
64 6192 : StatusIndicatorFactory::~StatusIndicatorFactory()
65 : {
66 2064 : impl_stopWakeUpThread();
67 4128 : }
68 :
69 2077 : void SAL_CALL StatusIndicatorFactory::initialize(const css::uno::Sequence< css::uno::Any >& lArguments)
70 : throw(css::uno::Exception ,
71 : css::uno::RuntimeException, std::exception)
72 : {
73 2077 : if (lArguments.getLength() > 0) {
74 2077 : osl::MutexGuard g(m_mutex);
75 :
76 4154 : css::uno::Reference< css::frame::XFrame > xTmpFrame;
77 4154 : css::uno::Reference< css::awt::XWindow > xTmpWindow;
78 2077 : bool b1 = lArguments[0] >>= xTmpFrame;
79 2077 : bool b2 = lArguments[0] >>= xTmpWindow;
80 2077 : if (lArguments.getLength() == 3 && b1) {
81 : // it's the first service constructor "createWithFrame"
82 2077 : m_xFrame = xTmpFrame;
83 2077 : lArguments[1] >>= m_bDisableReschedule;
84 2077 : lArguments[2] >>= m_bAllowParentShow;
85 0 : } else if (lArguments.getLength() == 3 && b2) {
86 : // it's the second service constructor "createWithWindow"
87 0 : m_xPluggWindow = xTmpWindow;
88 0 : lArguments[1] >>= m_bDisableReschedule;
89 0 : lArguments[2] >>= m_bAllowParentShow;
90 : } else {
91 : // it's an old-style initialisation using properties
92 0 : ::comphelper::SequenceAsHashMap lArgs(lArguments);
93 :
94 0 : m_xFrame = lArgs.getUnpackedValueOrDefault("Frame" , css::uno::Reference< css::frame::XFrame >());
95 0 : m_xPluggWindow = lArgs.getUnpackedValueOrDefault("Window" , css::uno::Reference< css::awt::XWindow >() );
96 0 : m_bAllowParentShow = lArgs.getUnpackedValueOrDefault("AllowParentShow" , sal_False );
97 0 : m_bDisableReschedule = lArgs.getUnpackedValueOrDefault("DisableReschedule", sal_False );
98 2077 : }
99 : }
100 :
101 2077 : impl_createProgress();
102 2077 : }
103 :
104 2057 : css::uno::Reference< css::task::XStatusIndicator > SAL_CALL StatusIndicatorFactory::createStatusIndicator()
105 : throw(css::uno::RuntimeException, std::exception)
106 : {
107 2057 : StatusIndicator* pIndicator = new StatusIndicator(this);
108 2057 : css::uno::Reference< css::task::XStatusIndicator > xIndicator(static_cast< ::cppu::OWeakObject* >(pIndicator), css::uno::UNO_QUERY_THROW);
109 :
110 2057 : return xIndicator;
111 : }
112 :
113 44792 : void SAL_CALL StatusIndicatorFactory::update()
114 : throw(css::uno::RuntimeException, std::exception)
115 : {
116 44792 : osl::MutexGuard g(m_mutex);
117 44792 : m_bAllowReschedule = true;
118 44792 : }
119 :
120 1328 : void StatusIndicatorFactory::start(const css::uno::Reference< css::task::XStatusIndicator >& xChild,
121 : const OUString& sText ,
122 : sal_Int32 nRange)
123 : {
124 : // SAFE -> ----------------------------------
125 1328 : osl::ClearableMutexGuard aWriteLock(m_mutex);
126 :
127 : // create new info structure for this child or move it to the front of our stack
128 1328 : IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild);
129 1328 : if (pItem != m_aStack.end())
130 22 : m_aStack.erase(pItem);
131 2656 : IndicatorInfo aInfo(xChild, sText, nRange);
132 1328 : m_aStack.push_back (aInfo );
133 :
134 1328 : m_xActiveChild = xChild;
135 2656 : css::uno::Reference< css::task::XStatusIndicator > xProgress = m_xProgress;
136 :
137 1328 : aWriteLock.clear();
138 : // <- SAFE ----------------------------------
139 :
140 1328 : implts_makeParentVisibleIfAllowed();
141 :
142 1328 : if (xProgress.is())
143 1328 : xProgress->start(sText, nRange);
144 :
145 1328 : impl_startWakeUpThread();
146 2656 : impl_reschedule(true);
147 1328 : }
148 :
149 168 : void StatusIndicatorFactory::reset(const css::uno::Reference< css::task::XStatusIndicator >& xChild)
150 : {
151 : // SAFE -> ----------------------------------
152 168 : osl::ClearableMutexGuard aReadLock(m_mutex);
153 :
154 : // reset the internal info structure related to this child
155 168 : IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild);
156 168 : if (pItem != m_aStack.end())
157 : {
158 168 : pItem->m_nValue = 0;
159 168 : pItem->m_sText = OUString();
160 : }
161 :
162 336 : css::uno::Reference< css::task::XStatusIndicator > xActive = m_xActiveChild;
163 336 : css::uno::Reference< css::task::XStatusIndicator > xProgress = m_xProgress;
164 :
165 168 : aReadLock.clear();
166 : // <- SAFE ----------------------------------
167 :
168 : // not the top most child => dont change UI
169 : // But dont forget Reschedule!
170 168 : if (
171 336 : (xChild == xActive) &&
172 168 : (xProgress.is() )
173 : )
174 168 : xProgress->reset();
175 :
176 336 : impl_reschedule(true);
177 168 : }
178 :
179 546 : void StatusIndicatorFactory::end(const css::uno::Reference< css::task::XStatusIndicator >& xChild)
180 : {
181 : // SAFE -> ----------------------------------
182 546 : osl::ClearableMutexGuard aWriteLock(m_mutex);
183 :
184 : // remove this child from our stack
185 546 : IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild);
186 546 : if (pItem != m_aStack.end())
187 512 : m_aStack.erase(pItem);
188 :
189 : // activate next child ... or finish the progress if there is no further one.
190 546 : m_xActiveChild.clear();
191 1092 : OUString sText;
192 546 : sal_Int32 nValue = 0;
193 546 : IndicatorStack::reverse_iterator pNext = m_aStack.rbegin();
194 546 : if (pNext != m_aStack.rend())
195 : {
196 0 : m_xActiveChild = pNext->m_xIndicator;
197 0 : sText = pNext->m_sText;
198 0 : nValue = pNext->m_nValue;
199 : }
200 :
201 1092 : css::uno::Reference< css::task::XStatusIndicator > xActive = m_xActiveChild;
202 1092 : css::uno::Reference< css::task::XStatusIndicator > xProgress = m_xProgress;
203 :
204 546 : aWriteLock.clear();
205 : // <- SAFE ----------------------------------
206 :
207 546 : if (xActive.is())
208 : {
209 : // There is at least one further child indicator.
210 : // Actualize our progress, so it shows these values from now.
211 0 : if (xProgress.is())
212 : {
213 0 : xProgress->setText (sText );
214 0 : xProgress->setValue(nValue);
215 : }
216 : }
217 : else
218 : {
219 : // Our stack is empty. No further child exists.
220 : // Se we must "end" our progress really
221 546 : if (xProgress.is())
222 546 : xProgress->end();
223 : // Now hide the progress bar again.
224 546 : impl_hideProgress();
225 :
226 546 : impl_stopWakeUpThread();
227 : }
228 :
229 1092 : impl_reschedule(true);
230 546 : }
231 :
232 0 : void StatusIndicatorFactory::setText(const css::uno::Reference< css::task::XStatusIndicator >& xChild,
233 : const OUString& sText )
234 : {
235 : // SAFE -> ----------------------------------
236 0 : osl::ClearableMutexGuard aWriteLock(m_mutex);
237 :
238 0 : IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild);
239 0 : if (pItem != m_aStack.end())
240 0 : pItem->m_sText = sText;
241 :
242 0 : css::uno::Reference< css::task::XStatusIndicator > xActive = m_xActiveChild;
243 0 : css::uno::Reference< css::task::XStatusIndicator > xProgress = m_xProgress;
244 :
245 0 : aWriteLock.clear();
246 : // SAFE -> ----------------------------------
247 :
248 : // paint only the top most indicator
249 : // but dont forget to Reschedule!
250 0 : if (
251 0 : (xChild == xActive) &&
252 0 : (xProgress.is() )
253 : )
254 : {
255 0 : xProgress->setText(sText);
256 : }
257 :
258 0 : impl_reschedule(true);
259 0 : }
260 :
261 20890 : void StatusIndicatorFactory::setValue( const css::uno::Reference< css::task::XStatusIndicator >& xChild ,
262 : sal_Int32 nValue )
263 : {
264 : // SAFE -> ----------------------------------
265 20890 : osl::ClearableMutexGuard aWriteLock(m_mutex);
266 :
267 20890 : sal_Int32 nOldValue = 0;
268 20890 : IndicatorStack::iterator pItem = ::std::find(m_aStack.begin(), m_aStack.end(), xChild);
269 20890 : if (pItem != m_aStack.end())
270 : {
271 20890 : nOldValue = pItem->m_nValue;
272 20890 : pItem->m_nValue = nValue;
273 : }
274 :
275 41780 : css::uno::Reference< css::task::XStatusIndicator > xActive = m_xActiveChild;
276 41780 : css::uno::Reference< css::task::XStatusIndicator > xProgress = m_xProgress;
277 :
278 20890 : aWriteLock.clear();
279 : // SAFE -> ----------------------------------
280 :
281 20890 : if (
282 41780 : (xChild == xActive) &&
283 40022 : (nOldValue != nValue ) &&
284 19132 : (xProgress.is() )
285 : )
286 : {
287 19132 : xProgress->setValue(nValue);
288 : }
289 :
290 41780 : impl_reschedule(false);
291 20890 : }
292 :
293 1328 : void StatusIndicatorFactory::implts_makeParentVisibleIfAllowed()
294 : {
295 : // SAFE -> ----------------------------------
296 1328 : osl::ClearableMutexGuard aReadLock(m_mutex);
297 :
298 1328 : if (!m_bAllowParentShow)
299 0 : return;
300 :
301 2607 : css::uno::Reference< css::frame::XFrame > xFrame (m_xFrame.get() , css::uno::UNO_QUERY);
302 2607 : css::uno::Reference< css::awt::XWindow > xPluggWindow(m_xPluggWindow.get(), css::uno::UNO_QUERY);
303 2607 : css::uno::Reference< css::uno::XComponentContext > xContext( m_xContext);
304 :
305 1328 : aReadLock.clear();
306 : // <- SAFE ----------------------------------
307 :
308 2607 : css::uno::Reference< css::awt::XWindow > xParentWindow;
309 1328 : if (xFrame.is())
310 1328 : xParentWindow = xFrame->getContainerWindow();
311 : else
312 0 : xParentWindow = xPluggWindow;
313 :
314 : // dont disturb user in case he put the loading document into the background!
315 : // Supress any setVisible() or toFront() call in case the initial show was
316 : // already made.
317 2607 : css::uno::Reference< css::awt::XWindow2 > xVisibleCheck(xParentWindow, css::uno::UNO_QUERY);
318 1328 : bool bIsVisible = false;
319 1328 : if (xVisibleCheck.is())
320 1328 : bIsVisible = xVisibleCheck->isVisible();
321 :
322 1328 : if (bIsVisible)
323 : {
324 49 : impl_showProgress();
325 49 : return;
326 : }
327 :
328 : // Check if the layout manager has been set to invisible state. It this case we are also
329 : // not allowed to set the frame visible!
330 2558 : css::uno::Reference< css::beans::XPropertySet > xPropSet(xFrame, css::uno::UNO_QUERY);
331 1279 : if (xPropSet.is())
332 : {
333 1279 : css::uno::Reference< css::frame::XLayoutManager2 > xLayoutManager;
334 1279 : xPropSet->getPropertyValue(FRAME_PROPNAME_LAYOUTMANAGER) >>= xLayoutManager;
335 1279 : if (xLayoutManager.is())
336 : {
337 1279 : if ( !xLayoutManager->isVisible() )
338 0 : return;
339 1279 : }
340 : }
341 :
342 : // Ok the window should be made visible ... because it isnt currently visible.
343 : // BUT ..!
344 : // We need a Hack for our applications: They get her progress from the frame directly
345 : // on saving documents. Because there is no progress set on the MediaDescriptor.
346 : // But that's wrong. In case the document was opened hidden, they should not use any progress .-(
347 : // They only possible workaround: dont show the parent window here, if the document was opened hidden.
348 1279 : bool bHiddenDoc = false;
349 1279 : if (xFrame.is())
350 : {
351 1279 : css::uno::Reference< css::frame::XController > xController;
352 2558 : css::uno::Reference< css::frame::XModel > xModel;
353 1279 : xController = xFrame->getController();
354 1279 : if (xController.is())
355 0 : xModel = xController->getModel();
356 1279 : if (xModel.is())
357 : {
358 0 : utl::MediaDescriptor lDocArgs(xModel->getArgs());
359 : bHiddenDoc = lDocArgs.getUnpackedValueOrDefault(
360 0 : utl::MediaDescriptor::PROP_HIDDEN(),
361 0 : sal_False);
362 1279 : }
363 : }
364 :
365 1279 : if (bHiddenDoc)
366 0 : return;
367 :
368 : // OK: The document was not opened in hidden mode ...
369 : // and the window isnt already visible.
370 : // Show it and bring it to front.
371 : // But before we have to be sure, that our internal used helper progress
372 : // is visible too.
373 1279 : impl_showProgress();
374 :
375 2558 : SolarMutexGuard aSolarGuard;
376 1279 : Window* pWindow = VCLUnoHelper::GetWindow(xParentWindow);
377 1279 : if ( pWindow )
378 : {
379 1279 : bool bForceFrontAndFocus(officecfg::Office::Common::View::NewDocumentHandling::ForceFocusAndToFront::get(xContext));
380 1279 : pWindow->Show(true, bForceFrontAndFocus ? SHOW_FOREGROUNDTASK : 0 );
381 1279 : }
382 :
383 : }
384 :
385 2077 : void StatusIndicatorFactory::impl_createProgress()
386 : {
387 : // SAFE -> ----------------------------------
388 2077 : osl::ClearableMutexGuard aReadLock(m_mutex);
389 :
390 4154 : css::uno::Reference< css::frame::XFrame > xFrame (m_xFrame.get() , css::uno::UNO_QUERY);
391 4154 : css::uno::Reference< css::awt::XWindow > xWindow(m_xPluggWindow.get(), css::uno::UNO_QUERY);
392 :
393 2077 : aReadLock.clear();
394 : // <- SAFE ----------------------------------
395 :
396 4154 : css::uno::Reference< css::task::XStatusIndicator > xProgress;
397 :
398 2077 : if (xWindow.is())
399 : {
400 : // use vcl based progress implementation in plugged mode
401 0 : VCLStatusIndicator* pVCLProgress = new VCLStatusIndicator(xWindow);
402 0 : xProgress = css::uno::Reference< css::task::XStatusIndicator >(static_cast< css::task::XStatusIndicator* >(pVCLProgress), css::uno::UNO_QUERY);
403 : }
404 2077 : else if (xFrame.is())
405 : {
406 : // use frame layouted progress implementation
407 2077 : css::uno::Reference< css::beans::XPropertySet > xPropSet(xFrame, css::uno::UNO_QUERY);
408 2077 : if (xPropSet.is())
409 : {
410 2077 : css::uno::Reference< css::frame::XLayoutManager2 > xLayoutManager;
411 2077 : xPropSet->getPropertyValue(FRAME_PROPNAME_LAYOUTMANAGER) >>= xLayoutManager;
412 2077 : if (xLayoutManager.is())
413 : {
414 2077 : xLayoutManager->lock();
415 2077 : OUString sPROGRESS_RESOURCE(PROGRESS_RESOURCE);
416 2077 : xLayoutManager->createElement( sPROGRESS_RESOURCE );
417 2077 : xLayoutManager->hideElement( sPROGRESS_RESOURCE );
418 :
419 4154 : css::uno::Reference< css::ui::XUIElement > xProgressBar = xLayoutManager->getElement(sPROGRESS_RESOURCE);
420 2077 : if (xProgressBar.is())
421 2077 : xProgress = css::uno::Reference< css::task::XStatusIndicator >(xProgressBar->getRealInterface(), css::uno::UNO_QUERY);
422 4154 : xLayoutManager->unlock();
423 2077 : }
424 2077 : }
425 : }
426 :
427 4154 : osl::MutexGuard g(m_mutex);
428 4154 : m_xProgress = xProgress;
429 2077 : }
430 :
431 1328 : void StatusIndicatorFactory::impl_showProgress()
432 : {
433 : // SAFE -> ----------------------------------
434 1328 : osl::ClearableMutexGuard aReadLock(m_mutex);
435 :
436 2656 : css::uno::Reference< css::frame::XFrame > xFrame (m_xFrame.get() , css::uno::UNO_QUERY);
437 2656 : css::uno::Reference< css::awt::XWindow > xWindow(m_xPluggWindow.get(), css::uno::UNO_QUERY);
438 :
439 1328 : aReadLock.clear();
440 : // <- SAFE ----------------------------------
441 :
442 2656 : css::uno::Reference< css::task::XStatusIndicator > xProgress;
443 :
444 1328 : if (xFrame.is())
445 : {
446 : // use frame layouted progress implementation
447 1328 : css::uno::Reference< css::beans::XPropertySet > xPropSet(xFrame, css::uno::UNO_QUERY);
448 1328 : if (xPropSet.is())
449 : {
450 1328 : css::uno::Reference< css::frame::XLayoutManager2 > xLayoutManager;
451 1328 : xPropSet->getPropertyValue(FRAME_PROPNAME_LAYOUTMANAGER) >>= xLayoutManager;
452 1328 : if (xLayoutManager.is())
453 : {
454 : // Be sure that we have always a progress. It can be that our frame
455 : // was recycled and therefore the progress was destroyed!
456 : // CreateElement does nothing if there is already a valid progress.
457 1328 : OUString sPROGRESS_RESOURCE(PROGRESS_RESOURCE);
458 1328 : xLayoutManager->createElement( sPROGRESS_RESOURCE );
459 1328 : xLayoutManager->showElement( sPROGRESS_RESOURCE );
460 :
461 2656 : css::uno::Reference< css::ui::XUIElement > xProgressBar = xLayoutManager->getElement(sPROGRESS_RESOURCE);
462 1328 : if (xProgressBar.is())
463 2656 : xProgress = css::uno::Reference< css::task::XStatusIndicator >(xProgressBar->getRealInterface(), css::uno::UNO_QUERY);
464 1328 : }
465 : }
466 :
467 2656 : osl::MutexGuard g(m_mutex);
468 2656 : m_xProgress = xProgress;
469 1328 : }
470 1328 : }
471 :
472 546 : void StatusIndicatorFactory::impl_hideProgress()
473 : {
474 : // SAFE -> ----------------------------------
475 546 : osl::ClearableMutexGuard aReadLock(m_mutex);
476 :
477 1092 : css::uno::Reference< css::frame::XFrame > xFrame (m_xFrame.get() , css::uno::UNO_QUERY);
478 1092 : css::uno::Reference< css::awt::XWindow > xWindow(m_xPluggWindow.get(), css::uno::UNO_QUERY);
479 :
480 546 : aReadLock.clear();
481 : // <- SAFE ----------------------------------
482 :
483 546 : if (xFrame.is())
484 : {
485 : // use frame layouted progress implementation
486 546 : css::uno::Reference< css::beans::XPropertySet > xPropSet(xFrame, css::uno::UNO_QUERY);
487 546 : if (xPropSet.is())
488 : {
489 546 : css::uno::Reference< css::frame::XLayoutManager2 > xLayoutManager;
490 546 : xPropSet->getPropertyValue(FRAME_PROPNAME_LAYOUTMANAGER) >>= xLayoutManager;
491 546 : if (xLayoutManager.is())
492 546 : xLayoutManager->hideElement( OUString(PROGRESS_RESOURCE) );
493 546 : }
494 546 : }
495 546 : }
496 :
497 22932 : void StatusIndicatorFactory::impl_reschedule(bool bForce)
498 : {
499 : // SAFE ->
500 22932 : osl::ClearableMutexGuard aReadLock(m_mutex);
501 22932 : if (m_bDisableReschedule)
502 0 : return;
503 22932 : aReadLock.clear();
504 : // <- SAFE
505 :
506 22932 : bool bReschedule = bForce;
507 22932 : if (!bReschedule)
508 : {
509 20890 : osl::MutexGuard g(m_mutex);
510 20890 : bReschedule = m_bAllowReschedule;
511 20890 : m_bAllowReschedule = false;
512 : }
513 :
514 22932 : if (!bReschedule)
515 18092 : return;
516 :
517 : // SAFE ->
518 9680 : osl::ResettableMutexGuard aGlobalLock(LockHelper::getGlobalLock());
519 :
520 4840 : if (m_nInReschedule == 0)
521 : {
522 4840 : ++m_nInReschedule;
523 4840 : aGlobalLock.clear();
524 : // <- SAFE
525 :
526 : {
527 4840 : SolarMutexGuard g;
528 4840 : Application::Reschedule(true);
529 : }
530 :
531 : // SAFE ->
532 4840 : aGlobalLock.reset();
533 4840 : --m_nInReschedule;
534 4840 : }
535 : }
536 :
537 1328 : void StatusIndicatorFactory::impl_startWakeUpThread()
538 : {
539 1328 : osl::MutexGuard g(m_mutex);
540 :
541 1328 : if (m_bDisableReschedule)
542 1328 : return;
543 :
544 1328 : if (!m_pWakeUp)
545 : {
546 1306 : m_pWakeUp = new WakeUpThread(this);
547 1306 : m_pWakeUp->create();
548 1328 : }
549 : }
550 :
551 2610 : void StatusIndicatorFactory::impl_stopWakeUpThread()
552 : {
553 2610 : osl::MutexGuard g(m_mutex);
554 2610 : if (m_pWakeUp)
555 : {
556 : // Thread kill itself after terminate()!
557 1306 : m_pWakeUp->terminate();
558 1306 : m_pWakeUp = 0;
559 2610 : }
560 2610 : }
561 :
562 : } // namespace framework
563 :
564 : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
565 2077 : com_sun_star_comp_framework_StatusIndicatorFactory_get_implementation(
566 : css::uno::XComponentContext *context,
567 : css::uno::Sequence<css::uno::Any> const &)
568 : {
569 2077 : return cppu::acquire(new framework::StatusIndicatorFactory(context));
570 : }
571 :
572 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|