xref: /aoo42x/main/sfx2/source/bastyp/progress.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sfx2.hxx"
30 
31 #include <sfx2/progress.hxx>
32 #include <com/sun/star/uno/Reference.hxx>
33 #include <com/sun/star/task/XStatusIndicatorFactory.hpp>
34 
35 #ifndef _SBX_HXX //autogen
36 #include <basic/sbx.hxx>
37 #endif
38 
39 #include <svl/eitem.hxx>
40 #include <tools/time.hxx>
41 
42 // wg. nRescheduleLocks
43 #include "appdata.hxx"
44 #include <sfx2/request.hxx>
45 #include <sfx2/frame.hxx>
46 #include <sfx2/viewfrm.hxx>
47 #include <sfx2/viewsh.hxx>
48 #include <sfx2/objsh.hxx>
49 #include <sfx2/app.hxx>
50 #include <sfx2/dispatch.hxx>
51 #include "sfxtypes.hxx"
52 #include <sfx2/docfile.hxx>
53 #include "workwin.hxx"
54 #include "sfx2/sfxresid.hxx"
55 #include "bastyp.hrc"
56 #include <sfx2/msg.hxx>
57 
58 #include <time.h>
59 
60 using namespace ::com::sun::star::uno;
61 using namespace ::com::sun::star::frame;
62 using namespace ::com::sun::star::task;
63 
64 void AddNumber_Impl( String& aNumber, sal_uInt32 nArg )
65 {
66 	if ( nArg >= 10240 )
67 	{
68 		aNumber += String::CreateFromInt32( (sal_uInt16)( ( nArg + 512 ) / 1024 ) );
69 		aNumber += ' ';
70 		aNumber += SfxResId( STR_KB );
71 	}
72 	else
73 	{
74 		aNumber += String::CreateFromInt32( nArg );
75 		aNumber += ' ';
76 		aNumber += SfxResId( STR_BYTES );
77 	}
78 }
79 
80 struct SfxProgress_Impl
81 {
82     Reference < XStatusIndicator > xStatusInd;
83     String                  aText, aStateText;
84 	sal_uIntPtr					nMax;
85 	clock_t 				nCreate;
86 	clock_t					nNextReschedule;
87 	sal_Bool					bLocked, bAllDocs;
88 	sal_Bool					bWaitMode;
89 	sal_Bool					bAllowRescheduling;
90 	sal_Bool					bRunning;
91 	sal_Bool                    bIsStatusText;
92 
93 	SfxProgress*            pActiveProgress;
94 	SfxObjectShellRef		xObjSh;
95 	SfxWorkWindow*			pWorkWin;
96     SfxViewFrame*           pView;
97 
98 							SfxProgress_Impl( const String& );
99     void                    Enable_Impl( sal_Bool );
100 
101 };
102 
103 //========================================================================
104 
105 #define TIMEOUT_PROGRESS	 	 5L	/* 10th s */
106 #define MAXPERCENT_PROGRESS		33
107 
108 #define TIMEOUT_RESCHEDULE 		10L	/* 10th s */
109 #define MAXPERCENT_RESCHEDULE 	50
110 
111 #define Progress
112 #include "sfxslots.hxx"
113 
114 #define aTypeLibInfo aProgressTypeLibImpl
115 
116 //========================================================================
117 extern sal_uIntPtr Get10ThSec();
118 
119 // -----------------------------------------------------------------------
120 
121 void SfxProgress_Impl::Enable_Impl( sal_Bool bEnable )
122 {
123     SfxObjectShell* pDoc = bAllDocs ? NULL : (SfxObjectShell*) xObjSh;
124 	SfxViewFrame *pFrame= SfxViewFrame::GetFirst(pDoc);
125 	while ( pFrame )
126 	{
127 		pFrame->Enable(bEnable);
128         pFrame->GetDispatcher()->Lock( !bEnable );
129 		pFrame = SfxViewFrame::GetNext(*pFrame, pDoc);
130 	}
131 
132     if ( pView )
133     {
134         pView->Enable( bEnable );
135         pView->GetDispatcher()->Lock( !bEnable );
136     }
137 
138 	if ( !pDoc )
139         SFX_APP()->GetAppDispatcher_Impl()->Lock( !bEnable );
140 }
141 
142 // -----------------------------------------------------------------------
143 
144 SfxProgress_Impl::SfxProgress_Impl( const String &/*rTitle*/ )
145     :   pActiveProgress( 0 )
146 {
147 }
148 
149 // -----------------------------------------------------------------------
150 
151 SfxProgress::SfxProgress
152 (
153 	SfxObjectShell*	pObjSh, /* SfxObjectShell, an der die Aktion ausgef"uhrt
154 							   wird. Kann NULL sein, dann wird die Applikation
155 							   verwendet */
156 
157 	const String&	rText,	/* Text, der in der Statuszeile vor den Statusmonitor
158 							   erscheint */
159 
160 	sal_uIntPtr			nRange, /* Maximalwert des Bereiches */
161 
162 	sal_Bool			bAll    /* alle Dokumente oder nur das Dokument des ViewFrames
163 							   disablen (sal_False) */
164 	,sal_Bool			bWait   /* initial den Wait-Pointer aktivieren (sal_True) */
165 )
166 
167 /*	[Beschreibung]
168 
169 	Der Konstruktor der Klasse SfxProgress schaltet den als Parameter
170 	"ubergebenen SfxObjectShell und SfxViewFrames, welche dieses Dokument
171 	anzeigen in einen Progress-Mode. D.h. solange eine dieser SfxViewFrame
172 	Instanzen aktiv ist, ist der dazugeh"orige SfxDispatcher und das
173 	dazugeh"orige Window disabled. In der Statuszeile wird ein Balken zur
174 	Fortschritts-Anzeige angezeigt.
175 */
176 
177 :	pImp( new SfxProgress_Impl( rText ) ),
178 	nVal(0),
179 	bSuspended(sal_True)
180 {
181 	pImp->bRunning = sal_True;
182 	pImp->bAllowRescheduling = Application::IsInExecute();;
183 
184 	pImp->xObjSh = pObjSh;
185 	pImp->aText = rText;
186 	pImp->nMax = nRange;
187 	pImp->bLocked = sal_False;
188 	pImp->bWaitMode = bWait;
189 	pImp->bIsStatusText = sal_False;
190 	pImp->nCreate = Get10ThSec();
191 	pImp->nNextReschedule = pImp->nCreate;
192 	DBG( DbgOutf( "SfxProgress: created for '%s' at %luds",
193 				  rText.GetBuffer(), pImp->nCreate ) );
194 	pImp->bAllDocs = bAll;
195 	pImp->pWorkWin = 0;
196     pImp->pView = 0;
197 
198 	pImp->pActiveProgress = GetActiveProgress( pObjSh );
199 	if ( pObjSh )
200 		pObjSh->SetProgress_Impl(this);
201 	else if( !pImp->pActiveProgress )
202         SFX_APP()->SetProgress_Impl(this);
203 	Resume();
204 }
205 
206 // -----------------------------------------------------------------------
207 
208 SfxProgress::~SfxProgress()
209 
210 /*	[Beschreibung]
211 
212 	Der Destruktor der Klasse SfxProgress restauriert den alten Zustand;
213 	die Dokumente werden wieder freigeschaltet und die Statuszeile zeigt
214 	wieder Items an.
215 */
216 
217 {
218 	Stop();
219     if ( pImp->xStatusInd.is() )
220         pImp->xStatusInd->end();
221 
222 	if( pImp->bIsStatusText == sal_True )
223 		GetpApp()->HideStatusText( );
224 	delete pImp;
225 }
226 
227 // -----------------------------------------------------------------------
228 
229 void SfxProgress::Stop()
230 
231 /*	[Beschreibung]
232 
233 	Vorzeitiges Beenden des <SfxProgress>.
234 */
235 
236 {
237     if( pImp->pActiveProgress )
238     {
239         if ( pImp->xObjSh.Is() && pImp->xObjSh->GetProgress() == this )
240             pImp->xObjSh->SetProgress_Impl(0);
241         return;
242     }
243 
244 	if ( !pImp->bRunning )
245 		return;
246 	pImp->bRunning = sal_False;
247 	DBG( DbgOutf( "SfxProgress: destroyed at %luds", Get10ThSec() ) );
248 
249 	Suspend();
250 	if ( pImp->xObjSh.Is() )
251 		pImp->xObjSh->SetProgress_Impl(0);
252 	else
253         SFX_APP()->SetProgress_Impl(0);
254 	if ( pImp->bLocked )
255         pImp->Enable_Impl(sal_True);
256 }
257 
258 // -----------------------------------------------------------------------
259 
260 void SfxProgress::SetText
261 (
262 	const String&	/*	neuer Text */
263 )
264 
265 /*	[Beschreibung]
266 
267 	"Andert den Text, der links neben dem Fortschritts-Balken
268 	angezeigt wird.
269 */
270 
271 {
272 	if( pImp->pActiveProgress ) return;
273     if ( pImp->xStatusInd.is() )
274     {
275         pImp->xStatusInd->reset();
276         pImp->xStatusInd->start( pImp->aText, pImp->nMax );
277     }
278 }
279 
280 // -----------------------------------------------------------------------
281 
282 const String& SfxProgress::GetStateText_Impl() const
283 {
284 	return pImp->aStateText;
285 }
286 
287 // -----------------------------------------------------------------------
288 /*
289 IMPL_STATIC_LINK( SfxProgress, SetStateHdl, PlugInLoadStatus*, pStatus )
290 {
291 	INetRequest* pReq = 0;
292 	const INetHint *pHint = PTR_CAST( INetHint, pStatus->pHint );
293 	pReq = PTR_CAST( INetRequest, pStatus->pBC );
294 
295 	String aString;
296 	if( pReq )
297 		aString = SfxMedium::GetStatusString( pHint->GetId(), pReq, pHint );
298 	if( aString.Len() )
299 	{
300 		GetpApp()->ShowStatusText( aString );
301 		if( pThis )
302 			pThis->pImp->bIsStatusText = sal_True;
303 	}
304 	return 0;
305 }
306 */
307 
308 // -----------------------------------------------------------------------
309 
310 // muss in AppDaten
311 static sal_uIntPtr nLastTime = 0;
312 
313 long TimeOut_Impl( void*, void* pArgV )
314 {
315     Timer *pArg = (Timer*)pArgV;
316 	if( Time::GetSystemTicks() - nLastTime > 3000 )
317 	{
318 		GetpApp()->HideStatusText();
319 		nLastTime = 0;
320 		delete pArg;
321 	}
322 	else pArg->Start();
323 	return 0;
324 }
325 
326 // -----------------------------------------------------------------------
327 
328 sal_Bool SfxProgress::SetStateText
329 (
330 	sal_uLong			nNewVal,	/* neuer Wert f"ur die Fortschritts-Anzeige */
331 	const String&	rNewVal,	/* Status als Text */
332 	sal_uLong			nNewRange	/* neuer Maximalwert, 0 f"ur Beibehaltung des alten */
333 )
334 
335 {
336 	pImp->aStateText = rNewVal;
337 	return SetState( nNewVal, nNewRange );
338 }
339 
340 // -----------------------------------------------------------------------
341 
342 sal_Bool SfxProgress::SetState
343 (
344 	sal_uLong	nNewVal,	/* neuer Wert f"ur die Fortschritts-Anzeige */
345 
346 	sal_uLong	nNewRange	/* neuer Maximalwert, 0 f"ur Beibehaltung des alten */
347 )
348 /*	[Beschreibung]
349 
350 	Setzen des aktuellen Status; nach einem zeitlichen Versatz
351 	wird Reschedule aufgerufen.
352 
353 
354 	[R"uckgabewert]
355 
356 	sal_Bool				TRUE
357 						Fortfahren mit der Aktion
358 
359 						FALSE
360 						Abbrechen der Aktion
361 */
362 
363 {
364 	// wurde via Stop-Button angehalten?
365 //	if ( pImp->IsCancelled() )
366 //		return sal_False;
367 
368 	if( pImp->pActiveProgress ) return sal_True;
369 
370 	// neuen Wert "ubernehmen
371 	sal_Bool bOver=sal_False;
372 	nVal = nNewVal;
373 
374 	// neuer Range?
375 	if ( nNewRange && nNewRange != pImp->nMax )
376 	{
377 		DBG( DbgOutf( "SfxProgress: range changed from %lu to %lu",
378 					  pImp->nMax, nNewRange ) );
379 		pImp->nMax = nNewRange;
380 		bOver = sal_True;
381 	}
382 
383     if ( !pImp->xStatusInd.is() )
384 	{
385         // get the active ViewFrame of the document this progress is working on
386         // if it doesn't work on a document, take the current ViewFrame
387         SfxObjectShell* pObjSh = pImp->xObjSh;
388         pImp->pView = SfxViewFrame::Current();
389         DBG_ASSERT( pImp->pView || pObjSh, "Can't make progress bar!");
390         if ( pObjSh && ( !pImp->pView || pObjSh != pImp->pView->GetObjectShell() ) )
391         {
392             // current document does not belong to current ViewFrame; take it's first visible ViewFrame
393             SfxViewFrame* pDocView = SfxViewFrame::GetFirst( pObjSh );
394             if ( pDocView )
395                 pImp->pView = pDocView;
396             else
397             {
398                 // don't show status indicator for hidden documents (only valid while loading)
399                 SfxMedium* pMedium = pObjSh->GetMedium();
400                 SFX_ITEMSET_ARG( pMedium->GetItemSet(), pHiddenItem, SfxBoolItem, SID_HIDDEN, sal_False );
401                 if ( !pHiddenItem || !pHiddenItem->GetValue() )
402                 {
403                     // not in a view, perhaps it's just loading
404                     //SfxFrame* pFrame = pMedium->GetLoadTargetFrame();
405                     //if ( pFrame && pFrame->GetCurrentViewFrame() )
406                     //{
407                         // recycling frame
408                         //pImp->pView = pFrame->GetCurrentViewFrame();
409                     //}
410                     //else
411                     {
412                         SFX_ITEMSET_ARG( pMedium->GetItemSet(), pIndicatorItem, SfxUnoAnyItem, SID_PROGRESS_STATUSBAR_CONTROL, sal_False );
413                         Reference< XStatusIndicator > xInd;
414                         if ( pIndicatorItem && (pIndicatorItem->GetValue()>>=xInd) )
415                             pImp->xStatusInd = xInd;
416                     }
417                 }
418             }
419         }
420         else if ( pImp->pView )
421         {
422             pImp->pWorkWin = SFX_APP()->GetWorkWindow_Impl( pImp->pView );
423             if ( pImp->pWorkWin )
424                 pImp->xStatusInd = pImp->pWorkWin->GetStatusIndicator();
425         }
426 
427         if ( pImp->xStatusInd.is() )
428         {
429             pImp->xStatusInd->start( pImp->aText, pImp->nMax );
430             pImp->pView = NULL;
431         }
432 	}
433 
434     if ( pImp->xStatusInd.is() )
435     {
436         pImp->xStatusInd->setValue( nNewVal );
437     }
438 
439 	return sal_True;
440 }
441 
442 // -----------------------------------------------------------------------
443 
444 void SfxProgress::Resume()
445 
446 /*	[Beschreibung]
447 
448 	Nimmt die Anzeige des Status nach einer Unterbrechung wieder auf.
449 
450 	[Querverweise]
451 	<SfxProgress::Suspend()>
452 */
453 
454 {
455 	if( pImp->pActiveProgress ) return;
456 	if ( bSuspended )
457 	{
458 		DBG( DbgOutf( "SfxProgress: resumed" ) );
459         if ( pImp->xStatusInd.is() )
460         {
461             pImp->xStatusInd->start( pImp->aText, pImp->nMax );
462             pImp->xStatusInd->setValue( nVal );
463         }
464 
465 		if ( pImp->bWaitMode )
466 		{
467 			if ( pImp->xObjSh.Is() && !pImp->bAllDocs )
468 			{
469 				for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(pImp->xObjSh);
470 						pFrame;
471 						pFrame = SfxViewFrame::GetNext( *pFrame, pImp->xObjSh ) )
472 					pFrame->GetWindow().EnterWait();
473 			}
474 		}
475 
476 		if ( pImp->xObjSh )
477 		{
478             SfxViewFrame *pFrame = SfxViewFrame::GetFirst(pImp->xObjSh);
479             if ( pFrame )
480                 pFrame->GetBindings().ENTERREGISTRATIONS();
481 		}
482 
483 		bSuspended = sal_False;
484 	}
485 }
486 
487 // -----------------------------------------------------------------------
488 
489 void SfxProgress::Suspend()
490 
491 /*	[Beschreibung]
492 
493 	Unterbricht die Anzeige des Status
494 
495 	[Querverweise]
496 	<SfxProgress::Resume()>
497 */
498 
499 {
500 	if( pImp->pActiveProgress ) return;
501 	if ( !bSuspended )
502 	{
503 		DBG( DbgOutf( "SfxProgress: suspended" ) );
504 		bSuspended = sal_True;
505 
506         if ( pImp->xStatusInd.is() )
507         {
508             pImp->xStatusInd->reset();
509         }
510 
511 		if ( pImp->xObjSh.Is() && !pImp->bAllDocs )
512 		{
513 			for ( SfxViewFrame *pFrame =
514 					SfxViewFrame::GetFirst(pImp->xObjSh);
515 					pFrame;
516 					pFrame = SfxViewFrame::GetNext( *pFrame, pImp->xObjSh ) )
517 				pFrame->GetWindow().LeaveWait();
518 		}
519 		if ( pImp->xObjSh.Is() )
520 		{
521 			SfxViewFrame *pFrame = SfxViewFrame::GetFirst(pImp->xObjSh);
522             if ( pFrame )
523                 pFrame->GetBindings().LEAVEREGISTRATIONS();
524 		}
525 	}
526 }
527 
528 // -----------------------------------------------------------------------
529 
530 void SfxProgress::Lock()
531 {
532 	if( pImp->pActiveProgress ) return;
533 	// kein Reschedule bei Embedded-Objekten,
534 	// da wir gegen das OLE Protokoll wehrlos sind
535 	if ( !pImp->xObjSh.Is() )
536 	{
537 		for ( SfxObjectShell *pDocSh = SfxObjectShell::GetFirst();
538 			  pDocSh;
539 			  pDocSh = SfxObjectShell::GetNext(*pDocSh) )
540 		{
541 			SfxObjectCreateMode eMode = pDocSh->GetCreateMode();
542 			if ( ( eMode == SFX_CREATE_MODE_EMBEDDED ) ||
543 				 ( eMode == SFX_CREATE_MODE_PREVIEW ) )
544 			{
545 				DBG( DbgOutf( "SfxProgress: not locked because EMBEDDED/PREVIEW found" ) );
546 				pImp->bAllowRescheduling = sal_False;
547 			}
548 		}
549 	}
550 	else
551 	{
552 		SfxObjectCreateMode eMode = pImp->xObjSh->GetCreateMode();
553 		if ( ( eMode == SFX_CREATE_MODE_EMBEDDED ) ||
554 			 ( eMode == SFX_CREATE_MODE_PREVIEW ) )
555 		{
556 			DBG( DbgOutf( "SfxProgress: not locked because ObjectShell is EMBEDDED/PREVIEW" ) );
557 			pImp->bAllowRescheduling = sal_False;
558 		}
559 	}
560 
561     pImp->Enable_Impl( sal_False );
562 
563 	DBG( DbgOutf( "SfxProgress: locked" ) );
564 	pImp->bLocked = sal_True;
565 }
566 
567 // -----------------------------------------------------------------------
568 
569 void SfxProgress::UnLock()
570 {
571 	if( pImp->pActiveProgress ) return;
572 	if ( !pImp->bLocked )
573 		return;
574 
575 	DBG( DbgOutf( "SfxProgress: unlocked" ) );
576 	pImp->bLocked = sal_False;
577     pImp->Enable_Impl(sal_True);
578 }
579 
580 // -----------------------------------------------------------------------
581 
582 void SfxProgress::Reschedule()
583 
584 /*	[Beschreibung]
585 
586 	Reschedule von au"sen rufbar
587 
588 */
589 
590 {
591 	SFX_STACK(SfxProgress::Reschedule);
592 
593 	if( pImp->pActiveProgress ) return;
594     SfxApplication* pApp = SFX_APP();
595     if ( pImp->bLocked && 0 == pApp->Get_Impl()->nRescheduleLocks )
596 	{
597         DBG_ASSERTWARNING( pApp->IsInAsynchronCall_Impl(),
598 							"Reschedule in synchron-call-stack" );
599 
600         SfxAppData_Impl *pAppData = pApp->Get_Impl();
601 		++pAppData->nInReschedule;
602 		Application::Reschedule();
603 		--pAppData->nInReschedule;
604 	}
605 }
606 
607 // -----------------------------------------------------------------------
608 
609 void SfxProgress::SetWaitMode
610 (
611 	sal_Bool	bWait		/*	TRUE
612 							Wartecursor wird verwendet
613 
614 							FALSE
615 							Es wird kein Wartecursor verwendet */
616 )
617 
618 /*	[Beschreibung]
619 
620 	Wartecursor-Modus umschalten.
621 
622 */
623 
624 {
625 	if( pImp->pActiveProgress ) return;
626 	if ( !bSuspended && pImp->bWaitMode != bWait )
627 	{
628 		if ( bWait )
629 		{
630 			if ( pImp->xObjSh.Is() && !pImp->bAllDocs )
631 			{
632 				for ( SfxViewFrame *pFrame =
633 						SfxViewFrame::GetFirst(pImp->xObjSh);
634 						pFrame;
635 						pFrame = SfxViewFrame::GetNext( *pFrame, pImp->xObjSh ) )
636 					pFrame->GetWindow().EnterWait();
637 			}
638 		}
639 		else
640 		{
641 			if ( pImp->xObjSh.Is() && !pImp->bAllDocs )
642 			{
643 				for ( SfxViewFrame *pFrame =
644 						SfxViewFrame::GetFirst(pImp->xObjSh);
645 						pFrame;
646 						pFrame = SfxViewFrame::GetNext( *pFrame, pImp->xObjSh ) )
647 					pFrame->GetWindow().LeaveWait();
648 			}
649 		}
650 	}
651 
652 	pImp->bWaitMode = bWait;
653 }
654 
655 // -----------------------------------------------------------------------
656 
657 sal_Bool SfxProgress::GetWaitMode() const
658 
659 /*	[Beschreibung]
660 
661 	Wartecursor-Modus abfragen.
662 
663 */
664 
665 {
666 	return pImp->bWaitMode;
667 }
668 
669 // -----------------------------------------------------------------------
670 
671 SfxProgress* SfxProgress::GetActiveProgress
672 (
673 	SfxObjectShell* pDocSh	  /*  <SfxObjectShell>, die nach einem laufenden
674 									<SfxProgress> gefragt werden soll, oder
675 									0, wenn ein f"ur die gesamte Applikation
676 									laufender SfxProgress erfragt werden soll.
677 									Der Pointer braucht nur zum Zeitpunkt des
678 									Aufrufs g"ultig zu sein. */
679 )
680 
681 /*	[Beschreibung]
682 
683 	Mit dieser Methode kann erfragt werden, ob und welcher <SfxProgress>-
684 	f"ur eine bestimmte Instanz von SfxObjectShell oder gar die gesamte
685 	Applikation zur Zeit aktiv ist. Dies kann z.B. zum Abfangen von
686 	Time-Out-Events etc. verwendet werden.
687 
688 	Anstelle eines Pointer auf den SfxProgress der SfxObjectShell wird
689 	ggf. der auf den SfxProgress der Applikation geliefert, mit der
690 	Abfrage 'SfxProgress::GetActiveProgress(pMyDocSh)' wird also
691 	insofern vorhanden der SfxProgress von 'pMyDocSh' geliefert,
692 	sonst der SfxProgress der Applikation bzw. ein 0-Pointer.
693 
694 
695 	[Anmerkung]
696 
697 	"auft kein SfxProgress an der Applikation und ebenfalls keiner an
698 	der angegebenen SfxObjectShell, dann wird immer 0 zur"uckgeliefert,
699 	auch wenn an einer anderen SfxObjectShell ein SfxProgress l"uft.
700 
701 
702 	[Querverweise]
703 
704 	<SfxApplication::GetProgress()const>
705 	<SfxObjectShell::GetProgress()const>
706 */
707 
708 {
709     if ( !SfxApplication::Get() )
710         return 0;
711 
712 	SfxProgress *pProgress = 0;
713 	if ( pDocSh )
714 		pProgress = pDocSh->GetProgress();
715 	if ( !pProgress )
716 		pProgress = SFX_APP()->GetProgress();
717 	return pProgress;
718 }
719 
720 // -----------------------------------------------------------------------
721 
722 void SfxProgress::EnterLock()
723 {
724 	SFX_APP()->Get_Impl()->nRescheduleLocks++;
725 }
726 
727 // -----------------------------------------------------------------------
728 
729 void SfxProgress::LeaveLock()
730 {
731 	SfxAppData_Impl *pImp = SFX_APP()->Get_Impl();
732 	DBG_ASSERT( 0 != pImp->nRescheduleLocks, "SFxProgress::LeaveLock but no locks" );
733 	pImp->nRescheduleLocks--;
734 }
735 
736 // -----------------------------------------------------------------------
737 
738 FASTBOOL SfxProgress::StatusBarManagerGone_Impl
739 (
740 	SfxStatusBarManager	*	// dieser <SfxStatusBarManager> wird zerst"ort
741 )
742 
743 /*	[Beschreibung]
744 
745 	Interne Methode zum Benachrichtigen des SfxProgress, da\s der angegebene
746 	SfxStatusBarManger zerst"ort wird. Damit der Progress ihn loslassen
747 	kann.
748 */
749 
750 {
751 	return sal_True;
752 }
753 
754