xref: /trunk/main/sfx2/source/bastyp/progress.cxx (revision d91b741f1e44bf860b73c598e45198aefbdc7ebf)
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 
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_uInt32 Get10ThSec();  // must match the definition in sfxbasecontroller.cxx
114                                  // (sal_uInt32); sal_uIntPtr diverges from it on x64
115 
116 // -----------------------------------------------------------------------
117 
118 void SfxProgress_Impl::Enable_Impl( sal_Bool bEnable )
119 {
120     SfxObjectShell* pDoc = bAllDocs ? NULL : (SfxObjectShell*) xObjSh;
121     SfxViewFrame *pFrame= SfxViewFrame::GetFirst(pDoc);
122     while ( pFrame )
123     {
124         pFrame->Enable(bEnable);
125         pFrame->GetDispatcher()->Lock( !bEnable );
126         pFrame = SfxViewFrame::GetNext(*pFrame, pDoc);
127     }
128 
129     if ( pView )
130     {
131         pView->Enable( bEnable );
132         pView->GetDispatcher()->Lock( !bEnable );
133     }
134 
135     if ( !pDoc )
136         SFX_APP()->GetAppDispatcher_Impl()->Lock( !bEnable );
137 }
138 
139 // -----------------------------------------------------------------------
140 
141 SfxProgress_Impl::SfxProgress_Impl( const String &/*rTitle*/ )
142     :   pActiveProgress( 0 )
143 {
144 }
145 
146 // -----------------------------------------------------------------------
147 
148 SfxProgress::SfxProgress
149 (
150     SfxObjectShell* pObjSh, /* SfxObjectShell, an der die Aktion ausgeführt
151                                wird. Kann NULL sein, dann wird die Applikation
152                                verwendet */
153 
154     const String&   rText,  /* Text, der in der Statuszeile vor den Statusmonitor
155                                erscheint */
156 
157     sal_uIntPtr         nRange, /* Maximalwert des Bereiches */
158 
159     sal_Bool            bAll    /* alle Dokumente oder nur das Dokument des ViewFrames
160                                disablen (sal_False) */
161     ,sal_Bool           bWait   /* initial den Wait-Pointer aktivieren (sal_True) */
162 )
163 
164 /*  [Beschreibung]
165 
166     Der Konstruktor der Klasse SfxProgress schaltet den als Parameter
167     übergebenen SfxObjectShell und SfxViewFrames, welche dieses Dokument
168     anzeigen in einen Progress-Mode. D.h. solange eine dieser SfxViewFrame
169     Instanzen aktiv ist, ist der dazugehörige SfxDispatcher und das
170     dazugehörige Window disabled. In der Statuszeile wird ein Balken zur
171     Fortschritts-Anzeige angezeigt.
172 */
173 
174 :   pImp( new SfxProgress_Impl( rText ) ),
175     nVal(0),
176     bSuspended(sal_True)
177 {
178     pImp->bRunning = sal_True;
179     pImp->bAllowRescheduling = Application::IsInExecute();
180 
181     pImp->xObjSh = pObjSh;
182     pImp->aText = rText;
183     pImp->nMax = nRange;
184     pImp->bLocked = sal_False;
185     pImp->bWaitMode = bWait;
186     pImp->bIsStatusText = sal_False;
187     pImp->nCreate = Get10ThSec();
188     pImp->nNextReschedule = pImp->nCreate;
189     DBG( DbgOutf( "SfxProgress: created for '%s' at %luds",
190                   rText.GetBuffer(), pImp->nCreate ) );
191     pImp->bAllDocs = bAll;
192     pImp->pWorkWin = 0;
193     pImp->pView = 0;
194 
195     pImp->pActiveProgress = GetActiveProgress( pObjSh );
196     if ( pObjSh )
197         pObjSh->SetProgress_Impl(this);
198     else if( !pImp->pActiveProgress )
199         SFX_APP()->SetProgress_Impl(this);
200     Resume();
201 }
202 
203 // -----------------------------------------------------------------------
204 
205 SfxProgress::~SfxProgress()
206 
207 /*  [Beschreibung]
208 
209     Der Destruktor der Klasse SfxProgress restauriert den alten Zustand;
210     die Dokumente werden wieder freigeschaltet und die Statuszeile zeigt
211     wieder Items an.
212 */
213 
214 {
215     Stop();
216     if ( pImp->xStatusInd.is() )
217         pImp->xStatusInd->end();
218 
219     if( pImp->bIsStatusText == sal_True )
220         GetpApp()->HideStatusText( );
221     delete pImp;
222 }
223 
224 // -----------------------------------------------------------------------
225 
226 void SfxProgress::Stop()
227 
228 /*  [Beschreibung]
229 
230     Vorzeitiges Beenden des <SfxProgress>.
231 */
232 
233 {
234     if( pImp->pActiveProgress )
235     {
236         if ( pImp->xObjSh.Is() && pImp->xObjSh->GetProgress() == this )
237             pImp->xObjSh->SetProgress_Impl(0);
238         return;
239     }
240 
241     if ( !pImp->bRunning )
242         return;
243     pImp->bRunning = sal_False;
244     DBG( DbgOutf( "SfxProgress: destroyed at %luds", Get10ThSec() ) );
245 
246     Suspend();
247     if ( pImp->xObjSh.Is() )
248         pImp->xObjSh->SetProgress_Impl(0);
249     else
250         SFX_APP()->SetProgress_Impl(0);
251     if ( pImp->bLocked )
252         pImp->Enable_Impl(sal_True);
253 }
254 
255 // -----------------------------------------------------------------------
256 
257 void SfxProgress::SetText
258 (
259     const String&   /*  neuer Text */
260 )
261 
262 /*  [Beschreibung]
263 
264     Ändert den Text, der links neben dem Fortschritts-Balken
265     angezeigt wird.
266 */
267 
268 {
269     if( pImp->pActiveProgress ) return;
270     if ( pImp->xStatusInd.is() )
271     {
272         pImp->xStatusInd->reset();
273         pImp->xStatusInd->start( pImp->aText, pImp->nMax );
274     }
275 }
276 
277 // -----------------------------------------------------------------------
278 
279 const String& SfxProgress::GetStateText_Impl() const
280 {
281     return pImp->aStateText;
282 }
283 
284 // -----------------------------------------------------------------------
285 /*
286 IMPL_STATIC_LINK( SfxProgress, SetStateHdl, PlugInLoadStatus*, pStatus )
287 {
288     INetRequest* pReq = 0;
289     const INetHint *pHint = PTR_CAST( INetHint, pStatus->pHint );
290     pReq = PTR_CAST( INetRequest, pStatus->pBC );
291 
292     String aString;
293     if( pReq )
294         aString = SfxMedium::GetStatusString( pHint->GetId(), pReq, pHint );
295     if( aString.Len() )
296     {
297         GetpApp()->ShowStatusText( aString );
298         if( pThis )
299             pThis->pImp->bIsStatusText = sal_True;
300     }
301     return 0;
302 }
303 */
304 
305 // -----------------------------------------------------------------------
306 
307 // muss in AppDaten
308 static sal_uIntPtr nLastTime = 0;
309 
310 long TimeOut_Impl( void*, void* pArgV )
311 {
312     Timer *pArg = (Timer*)pArgV;
313     if( Time::GetSystemTicks() - nLastTime > 3000 )
314     {
315         GetpApp()->HideStatusText();
316         nLastTime = 0;
317         delete pArg;
318     }
319     else pArg->Start();
320     return 0;
321 }
322 
323 // -----------------------------------------------------------------------
324 
325 sal_Bool SfxProgress::SetStateText
326 (
327     sal_uLong           nNewVal,    /* neuer Wert für die Fortschritts-Anzeige */
328     const String&   rNewVal,    /* Status als Text */
329     sal_uLong           nNewRange   /* neuer Maximalwert, 0 für Beibehaltung des alten */
330 )
331 
332 {
333     pImp->aStateText = rNewVal;
334     return SetState( nNewVal, nNewRange );
335 }
336 
337 // -----------------------------------------------------------------------
338 
339 sal_Bool SfxProgress::SetState
340 (
341     sal_uLong   nNewVal,    /* neuer Wert für die Fortschritts-Anzeige */
342 
343     sal_uLong   nNewRange   /* neuer Maximalwert, 0 für Beibehaltung des alten */
344 )
345 /*  [Beschreibung]
346 
347     Setzen des aktuellen Status; nach einem zeitlichen Versatz
348     wird Reschedule aufgerufen.
349 
350 
351     [Rückgabewert]
352 
353     sal_Bool                TRUE
354                         Fortfahren mit der Aktion
355 
356                         FALSE
357                         Abbrechen der Aktion
358 */
359 
360 {
361     // wurde via Stop-Button angehalten?
362 //  if ( pImp->IsCancelled() )
363 //      return sal_False;
364 
365     if( pImp->pActiveProgress ) return sal_True;
366 
367     // neuen Wert übernehmen
368     sal_Bool bOver=sal_False;
369     nVal = nNewVal;
370 
371     // neuer Range?
372     if ( nNewRange && nNewRange != pImp->nMax )
373     {
374         DBG( DbgOutf( "SfxProgress: range changed from %lu to %lu",
375                       pImp->nMax, nNewRange ) );
376         pImp->nMax = nNewRange;
377         bOver = sal_True;
378     }
379 
380     if ( !pImp->xStatusInd.is() )
381     {
382         // get the active ViewFrame of the document this progress is working on
383         // if it doesn't work on a document, take the current ViewFrame
384         SfxObjectShell* pObjSh = pImp->xObjSh;
385         pImp->pView = SfxViewFrame::Current();
386         DBG_ASSERT( pImp->pView || pObjSh, "Can't make progress bar!");
387         if ( pObjSh && ( !pImp->pView || pObjSh != pImp->pView->GetObjectShell() ) )
388         {
389             // current document does not belong to current ViewFrame; take its first visible ViewFrame
390             SfxViewFrame* pDocView = SfxViewFrame::GetFirst( pObjSh );
391             if ( pDocView )
392                 pImp->pView = pDocView;
393             else
394             {
395                 // don't show status indicator for hidden documents (only valid while loading)
396                 SfxMedium* pMedium = pObjSh->GetMedium();
397                 SFX_ITEMSET_ARG( pMedium->GetItemSet(), pHiddenItem, SfxBoolItem, SID_HIDDEN, sal_False );
398                 if ( !pHiddenItem || !pHiddenItem->GetValue() )
399                 {
400                     // not in a view, perhaps it's just loading
401                     //SfxFrame* pFrame = pMedium->GetLoadTargetFrame();
402                     //if ( pFrame && pFrame->GetCurrentViewFrame() )
403                     //{
404                         // recycling frame
405                         //pImp->pView = pFrame->GetCurrentViewFrame();
406                     //}
407                     //else
408                     {
409                         SFX_ITEMSET_ARG( pMedium->GetItemSet(), pIndicatorItem, SfxUnoAnyItem, SID_PROGRESS_STATUSBAR_CONTROL, sal_False );
410                         Reference< XStatusIndicator > xInd;
411                         if ( pIndicatorItem && (pIndicatorItem->GetValue()>>=xInd) )
412                             pImp->xStatusInd = xInd;
413                     }
414                 }
415             }
416         }
417         else if ( pImp->pView )
418         {
419             pImp->pWorkWin = SFX_APP()->GetWorkWindow_Impl( pImp->pView );
420             if ( pImp->pWorkWin )
421                 pImp->xStatusInd = pImp->pWorkWin->GetStatusIndicator();
422         }
423 
424         if ( pImp->xStatusInd.is() )
425         {
426             pImp->xStatusInd->start( pImp->aText, pImp->nMax );
427             pImp->pView = NULL;
428         }
429     }
430 
431     if ( pImp->xStatusInd.is() )
432     {
433         pImp->xStatusInd->setValue( nNewVal );
434     }
435 
436     return sal_True;
437 }
438 
439 // -----------------------------------------------------------------------
440 
441 void SfxProgress::Resume()
442 
443 /*  [Beschreibung]
444 
445     Nimmt die Anzeige des Status nach einer Unterbrechung wieder auf.
446 
447     [Querverweise]
448     <SfxProgress::Suspend()>
449 */
450 
451 {
452     if( pImp->pActiveProgress ) return;
453     if ( bSuspended )
454     {
455         DBG( DbgOutf( "SfxProgress: resumed" ) );
456         if ( pImp->xStatusInd.is() )
457         {
458             pImp->xStatusInd->start( pImp->aText, pImp->nMax );
459             pImp->xStatusInd->setValue( nVal );
460         }
461 
462         if ( pImp->bWaitMode )
463         {
464             if ( pImp->xObjSh.Is() && !pImp->bAllDocs )
465             {
466                 for ( SfxViewFrame *pFrame = SfxViewFrame::GetFirst(pImp->xObjSh);
467                         pFrame;
468                         pFrame = SfxViewFrame::GetNext( *pFrame, pImp->xObjSh ) )
469                     pFrame->GetWindow().EnterWait();
470             }
471         }
472 
473         if ( pImp->xObjSh )
474         {
475             SfxViewFrame *pFrame = SfxViewFrame::GetFirst(pImp->xObjSh);
476             if ( pFrame )
477                 pFrame->GetBindings().ENTERREGISTRATIONS();
478         }
479 
480         bSuspended = sal_False;
481     }
482 }
483 
484 // -----------------------------------------------------------------------
485 
486 void SfxProgress::Suspend()
487 
488 /*  [Beschreibung]
489 
490     Unterbricht die Anzeige des Status
491 
492     [Querverweise]
493     <SfxProgress::Resume()>
494 */
495 
496 {
497     if( pImp->pActiveProgress ) return;
498     if ( !bSuspended )
499     {
500         DBG( DbgOutf( "SfxProgress: suspended" ) );
501         bSuspended = sal_True;
502 
503         if ( pImp->xStatusInd.is() )
504         {
505             pImp->xStatusInd->reset();
506         }
507 
508         if ( pImp->xObjSh.Is() && !pImp->bAllDocs )
509         {
510             for ( SfxViewFrame *pFrame =
511                     SfxViewFrame::GetFirst(pImp->xObjSh);
512                     pFrame;
513                     pFrame = SfxViewFrame::GetNext( *pFrame, pImp->xObjSh ) )
514                 pFrame->GetWindow().LeaveWait();
515         }
516         if ( pImp->xObjSh.Is() )
517         {
518             SfxViewFrame *pFrame = SfxViewFrame::GetFirst(pImp->xObjSh);
519             if ( pFrame )
520                 pFrame->GetBindings().LEAVEREGISTRATIONS();
521         }
522     }
523 }
524 
525 // -----------------------------------------------------------------------
526 
527 void SfxProgress::Lock()
528 {
529     if( pImp->pActiveProgress ) return;
530     // kein Reschedule bei Embedded-Objekten,
531     // da wir gegen das OLE Protokoll wehrlos sind
532     if ( !pImp->xObjSh.Is() )
533     {
534         for ( SfxObjectShell *pDocSh = SfxObjectShell::GetFirst();
535               pDocSh;
536               pDocSh = SfxObjectShell::GetNext(*pDocSh) )
537         {
538             SfxObjectCreateMode eMode = pDocSh->GetCreateMode();
539             if ( ( eMode == SFX_CREATE_MODE_EMBEDDED ) ||
540                  ( eMode == SFX_CREATE_MODE_PREVIEW ) )
541             {
542                 DBG( DbgOutf( "SfxProgress: not locked because EMBEDDED/PREVIEW found" ) );
543                 pImp->bAllowRescheduling = sal_False;
544             }
545         }
546     }
547     else
548     {
549         SfxObjectCreateMode eMode = pImp->xObjSh->GetCreateMode();
550         if ( ( eMode == SFX_CREATE_MODE_EMBEDDED ) ||
551              ( eMode == SFX_CREATE_MODE_PREVIEW ) )
552         {
553             DBG( DbgOutf( "SfxProgress: not locked because ObjectShell is EMBEDDED/PREVIEW" ) );
554             pImp->bAllowRescheduling = sal_False;
555         }
556     }
557 
558     pImp->Enable_Impl( sal_False );
559 
560     DBG( DbgOutf( "SfxProgress: locked" ) );
561     pImp->bLocked = sal_True;
562 }
563 
564 // -----------------------------------------------------------------------
565 
566 void SfxProgress::UnLock()
567 {
568     if( pImp->pActiveProgress ) return;
569     if ( !pImp->bLocked )
570         return;
571 
572     DBG( DbgOutf( "SfxProgress: unlocked" ) );
573     pImp->bLocked = sal_False;
574     pImp->Enable_Impl(sal_True);
575 }
576 
577 // -----------------------------------------------------------------------
578 
579 void SfxProgress::Reschedule()
580 
581 /*  [Beschreibung]
582 
583     Reschedule von außen rufbar
584 
585 */
586 
587 {
588     SFX_STACK(SfxProgress::Reschedule);
589 
590     if( pImp->pActiveProgress ) return;
591     SfxApplication* pApp = SFX_APP();
592     if ( pImp->bLocked && 0 == pApp->Get_Impl()->nRescheduleLocks )
593     {
594         DBG_ASSERTWARNING( pApp->IsInAsynchronCall_Impl(),
595                             "Reschedule in synchron-call-stack" );
596 
597         SfxAppData_Impl *pAppData = pApp->Get_Impl();
598         ++pAppData->nInReschedule;
599         Application::Reschedule();
600         --pAppData->nInReschedule;
601     }
602 }
603 
604 // -----------------------------------------------------------------------
605 
606 void SfxProgress::SetWaitMode
607 (
608     sal_Bool    bWait       /*  TRUE
609                             Wartecursor wird verwendet
610 
611                             FALSE
612                             Es wird kein Wartecursor verwendet */
613 )
614 
615 /*  [Beschreibung]
616 
617     Wartecursor-Modus umschalten.
618 
619 */
620 
621 {
622     if( pImp->pActiveProgress ) return;
623     if ( !bSuspended && pImp->bWaitMode != bWait )
624     {
625         if ( bWait )
626         {
627             if ( pImp->xObjSh.Is() && !pImp->bAllDocs )
628             {
629                 for ( SfxViewFrame *pFrame =
630                         SfxViewFrame::GetFirst(pImp->xObjSh);
631                         pFrame;
632                         pFrame = SfxViewFrame::GetNext( *pFrame, pImp->xObjSh ) )
633                     pFrame->GetWindow().EnterWait();
634             }
635         }
636         else
637         {
638             if ( pImp->xObjSh.Is() && !pImp->bAllDocs )
639             {
640                 for ( SfxViewFrame *pFrame =
641                         SfxViewFrame::GetFirst(pImp->xObjSh);
642                         pFrame;
643                         pFrame = SfxViewFrame::GetNext( *pFrame, pImp->xObjSh ) )
644                     pFrame->GetWindow().LeaveWait();
645             }
646         }
647     }
648 
649     pImp->bWaitMode = bWait;
650 }
651 
652 // -----------------------------------------------------------------------
653 
654 sal_Bool SfxProgress::GetWaitMode() const
655 
656 /*  [Beschreibung]
657 
658     Wartecursor-Modus abfragen.
659 
660 */
661 
662 {
663     return pImp->bWaitMode;
664 }
665 
666 // -----------------------------------------------------------------------
667 
668 SfxProgress* SfxProgress::GetActiveProgress
669 (
670     SfxObjectShell* pDocSh    /*  <SfxObjectShell>, die nach einem laufenden
671                                     <SfxProgress> gefragt werden soll, oder
672                                     0, wenn ein für die gesamte Applikation
673                                     laufender SfxProgress erfragt werden soll.
674                                     Der Pointer braucht nur zum Zeitpunkt des
675                                     Aufrufs gültig zu sein. */
676 )
677 
678 /*  [Beschreibung]
679 
680     Mit dieser Methode kann erfragt werden, ob und welcher <SfxProgress>-
681     für eine bestimmte Instanz von SfxObjectShell oder gar die gesamte
682     Applikation zur Zeit aktiv ist. Dies kann z.B. zum Abfangen von
683     Time-Out-Events etc. verwendet werden.
684 
685     Anstelle eines Pointer auf den SfxProgress der SfxObjectShell wird
686     ggf. der auf den SfxProgress der Applikation geliefert, mit der
687     Abfrage 'SfxProgress::GetActiveProgress(pMyDocSh)' wird also
688     insofern vorhanden der SfxProgress von 'pMyDocSh' geliefert,
689     sonst der SfxProgress der Applikation bzw. ein 0-Pointer.
690 
691 
692     [Anmerkung]
693 
694     Läuft kein SfxProgress an der Applikation und ebenfalls keiner an
695     der angegebenen SfxObjectShell, dann wird immer 0 zurückgeliefert,
696     auch wenn an einer anderen SfxObjectShell ein SfxProgress läuft.
697 
698 
699     [Querverweise]
700 
701     <SfxApplication::GetProgress()const>
702     <SfxObjectShell::GetProgress()const>
703 */
704 
705 {
706     if ( !SfxApplication::Get() )
707         return 0;
708 
709     SfxProgress *pProgress = 0;
710     if ( pDocSh )
711         pProgress = pDocSh->GetProgress();
712     if ( !pProgress )
713         pProgress = SFX_APP()->GetProgress();
714     return pProgress;
715 }
716 
717 // -----------------------------------------------------------------------
718 
719 void SfxProgress::EnterLock()
720 {
721     SFX_APP()->Get_Impl()->nRescheduleLocks++;
722 }
723 
724 // -----------------------------------------------------------------------
725 
726 void SfxProgress::LeaveLock()
727 {
728     SfxAppData_Impl *pImp = SFX_APP()->Get_Impl();
729     DBG_ASSERT( 0 != pImp->nRescheduleLocks, "SFxProgress::LeaveLock but no locks" );
730     pImp->nRescheduleLocks--;
731 }
732 
733 // -----------------------------------------------------------------------
734 
735 FASTBOOL SfxProgress::StatusBarManagerGone_Impl
736 (
737     SfxStatusBarManager *   // dieser <SfxStatusBarManager> wird zerstört
738 )
739 
740 /*  [Beschreibung]
741 
742     Interne Methode zum Benachrichtigen des SfxProgress, dass der angegebene
743     SfxStatusBarManger zerstört wird. Damit der Progress ihn loslassen
744     kann.
745 */
746 
747 {
748     return sal_True;
749 }
750 
751 /* vim: set noet sw=4 ts=4: */
752