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