| progress.cxx (d119d52d) | progress.cxx (aac4b212) |
|---|---|
| 1/************************************************************** | 1/************************************************************** |
| 2 * | 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 | 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 * | 10 * |
| 11 * http://www.apache.org/licenses/LICENSE-2.0 | 11 * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 * | 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. | 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 * | 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> --- 42 unchanged lines hidden (view full) --- 70 aNumber += String::CreateFromInt32( nArg ); 71 aNumber += ' '; 72 aNumber += SfxResId( STR_BYTES ); 73 } 74} 75 76struct SfxProgress_Impl 77{ | 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> --- 42 unchanged lines hidden (view full) --- 70 aNumber += String::CreateFromInt32( nArg ); 71 aNumber += ' '; 72 aNumber += SfxResId( STR_BYTES ); 73 } 74} 75 76struct SfxProgress_Impl 77{ |
| 78 Reference < XStatusIndicator > xStatusInd; 79 String aText, aStateText; | 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; | 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; | 87 sal_Bool bIsStatusText; |
| 88 | 88 |
| 89 SfxProgress* pActiveProgress; | 89 SfxProgress* pActiveProgress; |
| 90 SfxObjectShellRef xObjSh; 91 SfxWorkWindow* pWorkWin; | 90 SfxObjectShellRef xObjSh; 91 SfxWorkWindow* pWorkWin; |
| 92 SfxViewFrame* pView; | 92 SfxViewFrame* pView; |
| 93 94 SfxProgress_Impl( const String& ); | 93 94 SfxProgress_Impl( const String& ); |
| 95 void Enable_Impl( sal_Bool ); | 95 void Enable_Impl( sal_Bool ); |
| 96 97}; 98 99//======================================================================== 100 101#define TIMEOUT_PROGRESS 5L /* 10th s */ 102#define MAXPERCENT_PROGRESS 33 103 --- 7 unchanged lines hidden (view full) --- 111 112//======================================================================== 113extern sal_uIntPtr Get10ThSec(); 114 115// ----------------------------------------------------------------------- 116 117void SfxProgress_Impl::Enable_Impl( sal_Bool bEnable ) 118{ | 96 97}; 98 99//======================================================================== 100 101#define TIMEOUT_PROGRESS 5L /* 10th s */ 102#define MAXPERCENT_PROGRESS 33 103 --- 7 unchanged lines hidden (view full) --- 111 112//======================================================================== 113extern sal_uIntPtr Get10ThSec(); 114 115// ----------------------------------------------------------------------- 116 117void SfxProgress_Impl::Enable_Impl( sal_Bool bEnable ) 118{ |
| 119 SfxObjectShell* pDoc = bAllDocs ? NULL : (SfxObjectShell*) xObjSh; | 119 SfxObjectShell* pDoc = bAllDocs ? NULL : (SfxObjectShell*) xObjSh; |
| 120 SfxViewFrame *pFrame= SfxViewFrame::GetFirst(pDoc); 121 while ( pFrame ) 122 { 123 pFrame->Enable(bEnable); | 120 SfxViewFrame *pFrame= SfxViewFrame::GetFirst(pDoc); 121 while ( pFrame ) 122 { 123 pFrame->Enable(bEnable); |
| 124 pFrame->GetDispatcher()->Lock( !bEnable ); | 124 pFrame->GetDispatcher()->Lock( !bEnable ); |
| 125 pFrame = SfxViewFrame::GetNext(*pFrame, pDoc); 126 } 127 | 125 pFrame = SfxViewFrame::GetNext(*pFrame, pDoc); 126 } 127 |
| 128 if ( pView ) 129 { 130 pView->Enable( bEnable ); 131 pView->GetDispatcher()->Lock( !bEnable ); 132 } | 128 if ( pView ) 129 { 130 pView->Enable( bEnable ); 131 pView->GetDispatcher()->Lock( !bEnable ); 132 } |
| 133 134 if ( !pDoc ) | 133 134 if ( !pDoc ) |
| 135 SFX_APP()->GetAppDispatcher_Impl()->Lock( !bEnable ); | 135 SFX_APP()->GetAppDispatcher_Impl()->Lock( !bEnable ); |
| 136} 137 138// ----------------------------------------------------------------------- 139 140SfxProgress_Impl::SfxProgress_Impl( const String &/*rTitle*/ ) | 136} 137 138// ----------------------------------------------------------------------- 139 140SfxProgress_Impl::SfxProgress_Impl( const String &/*rTitle*/ ) |
| 141 : pActiveProgress( 0 ) | 141 : pActiveProgress( 0 ) |
| 142{ 143} 144 145// ----------------------------------------------------------------------- 146 147SfxProgress::SfxProgress 148( | 142{ 143} 144 145// ----------------------------------------------------------------------- 146 147SfxProgress::SfxProgress 148( |
| 149 SfxObjectShell* pObjSh, /* SfxObjectShell, an der die Aktion ausgef"uhrt | 149 SfxObjectShell* pObjSh, /* SfxObjectShell, an der die Aktion ausgeführt |
| 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 | 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 | 166 übergebenen SfxObjectShell und SfxViewFrames, welche dieses Dokument |
| 167 anzeigen in einen Progress-Mode. D.h. solange eine dieser SfxViewFrame | 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 | 168 Instanzen aktiv ist, ist der dazugehörige SfxDispatcher und das 169 dazugehörige 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; --- 6 unchanged lines hidden (view full) --- 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; | 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; --- 6 unchanged lines hidden (view full) --- 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; | 192 pImp->pView = 0; |
| 193 194 pImp->pActiveProgress = GetActiveProgress( pObjSh ); 195 if ( pObjSh ) 196 pObjSh->SetProgress_Impl(this); 197 else if( !pImp->pActiveProgress ) | 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); | 198 SFX_APP()->SetProgress_Impl(this); |
| 199 Resume(); 200} 201 202// ----------------------------------------------------------------------- 203 204SfxProgress::~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(); | 199 Resume(); 200} 201 202// ----------------------------------------------------------------------- 203 204SfxProgress::~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(); | 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 225void SfxProgress::Stop() 226 227/* [Beschreibung] 228 229 Vorzeitiges Beenden des <SfxProgress>. 230*/ 231 232{ | 217 218 if( pImp->bIsStatusText == sal_True ) 219 GetpApp()->HideStatusText( ); 220 delete pImp; 221} 222 223// ----------------------------------------------------------------------- 224 225void 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 } | 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 | 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); | 249 SFX_APP()->SetProgress_Impl(0); |
| 250 if ( pImp->bLocked ) | 250 if ( pImp->bLocked ) |
| 251 pImp->Enable_Impl(sal_True); | 251 pImp->Enable_Impl(sal_True); |
| 252} 253 254// ----------------------------------------------------------------------- 255 256void SfxProgress::SetText 257( 258 const String& /* neuer Text */ 259) 260 261/* [Beschreibung] 262 | 252} 253 254// ----------------------------------------------------------------------- 255 256void SfxProgress::SetText 257( 258 const String& /* neuer Text */ 259) 260 261/* [Beschreibung] 262 |
| 263 "Andert den Text, der links neben dem Fortschritts-Balken | 263 Ändert den Text, der links neben dem Fortschritts-Balken |
| 264 angezeigt wird. 265*/ 266 267{ 268 if( pImp->pActiveProgress ) return; | 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 } | 269 if ( pImp->xStatusInd.is() ) 270 { 271 pImp->xStatusInd->reset(); 272 pImp->xStatusInd->start( pImp->aText, pImp->nMax ); 273 } |
| 274} 275 276// ----------------------------------------------------------------------- 277 278const String& SfxProgress::GetStateText_Impl() const 279{ 280 return pImp->aStateText; 281} --- 21 unchanged lines hidden (view full) --- 303 304// ----------------------------------------------------------------------- 305 306// muss in AppDaten 307static sal_uIntPtr nLastTime = 0; 308 309long TimeOut_Impl( void*, void* pArgV ) 310{ | 274} 275 276// ----------------------------------------------------------------------- 277 278const String& SfxProgress::GetStateText_Impl() const 279{ 280 return pImp->aStateText; 281} --- 21 unchanged lines hidden (view full) --- 303 304// ----------------------------------------------------------------------- 305 306// muss in AppDaten 307static sal_uIntPtr nLastTime = 0; 308 309long TimeOut_Impl( void*, void* pArgV ) 310{ |
| 311 Timer *pArg = (Timer*)pArgV; | 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 324sal_Bool SfxProgress::SetStateText 325( | 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 324sal_Bool SfxProgress::SetStateText 325( |
| 326 sal_uLong nNewVal, /* neuer Wert f"ur die Fortschritts-Anzeige */ | 326 sal_uLong nNewVal, /* neuer Wert für die Fortschritts-Anzeige */ |
| 327 const String& rNewVal, /* Status als Text */ | 327 const String& rNewVal, /* Status als Text */ |
| 328 sal_uLong nNewRange /* neuer Maximalwert, 0 f"ur Beibehaltung des alten */ | 328 sal_uLong nNewRange /* neuer Maximalwert, 0 für Beibehaltung des alten */ |
| 329) 330 331{ 332 pImp->aStateText = rNewVal; 333 return SetState( nNewVal, nNewRange ); 334} 335 336// ----------------------------------------------------------------------- 337 338sal_Bool SfxProgress::SetState 339( | 329) 330 331{ 332 pImp->aStateText = rNewVal; 333 return SetState( nNewVal, nNewRange ); 334} 335 336// ----------------------------------------------------------------------- 337 338sal_Bool SfxProgress::SetState 339( |
| 340 sal_uLong nNewVal, /* neuer Wert f"ur die Fortschritts-Anzeige */ | 340 sal_uLong nNewVal, /* neuer Wert für die Fortschritts-Anzeige */ |
| 341 | 341 |
| 342 sal_uLong nNewRange /* neuer Maximalwert, 0 f"ur Beibehaltung des alten */ | 342 sal_uLong nNewRange /* neuer Maximalwert, 0 für Beibehaltung des alten */ |
| 343) 344/* [Beschreibung] 345 346 Setzen des aktuellen Status; nach einem zeitlichen Versatz 347 wird Reschedule aufgerufen. 348 349 | 343) 344/* [Beschreibung] 345 346 Setzen des aktuellen Status; nach einem zeitlichen Versatz 347 wird Reschedule aufgerufen. 348 349 |
| 350 [R"uckgabewert] | 350 [Rückgabewert] |
| 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 | 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 | 366 // neuen Wert übernehmen |
| 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 | 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() ) | 379 if ( !pImp->xStatusInd.is() ) |
| 380 { | 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 } | 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 its 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 | 422 |
| 423 if ( pImp->xStatusInd.is() ) 424 { 425 pImp->xStatusInd->start( pImp->aText, pImp->nMax ); 426 pImp->pView = NULL; 427 } | 423 if ( pImp->xStatusInd.is() ) 424 { 425 pImp->xStatusInd->start( pImp->aText, pImp->nMax ); 426 pImp->pView = NULL; 427 } |
| 428 } 429 | 428 } 429 |
| 430 if ( pImp->xStatusInd.is() ) 431 { 432 pImp->xStatusInd->setValue( nNewVal ); 433 } | 430 if ( pImp->xStatusInd.is() ) 431 { 432 pImp->xStatusInd->setValue( nNewVal ); 433 } |
| 434 435 return sal_True; 436} 437 438// ----------------------------------------------------------------------- 439 440void SfxProgress::Resume() 441 --- 5 unchanged lines hidden (view full) --- 447 <SfxProgress::Suspend()> 448*/ 449 450{ 451 if( pImp->pActiveProgress ) return; 452 if ( bSuspended ) 453 { 454 DBG( DbgOutf( "SfxProgress: resumed" ) ); | 434 435 return sal_True; 436} 437 438// ----------------------------------------------------------------------- 439 440void SfxProgress::Resume() 441 --- 5 unchanged lines hidden (view full) --- 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 } | 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 { | 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(); | 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 --- 9 unchanged lines hidden (view full) --- 494 495{ 496 if( pImp->pActiveProgress ) return; 497 if ( !bSuspended ) 498 { 499 DBG( DbgOutf( "SfxProgress: suspended" ) ); 500 bSuspended = sal_True; 501 | 477 } 478 479 bSuspended = sal_False; 480 } 481} 482 483// ----------------------------------------------------------------------- 484 --- 9 unchanged lines hidden (view full) --- 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 } | 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); | 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(); | 518 if ( pFrame ) 519 pFrame->GetBindings().LEAVEREGISTRATIONS(); |
| 520 } 521 } 522} 523 524// ----------------------------------------------------------------------- 525 526void SfxProgress::Lock() 527{ --- 21 unchanged lines hidden (view full) --- 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 | 520 } 521 } 522} 523 524// ----------------------------------------------------------------------- 525 526void SfxProgress::Lock() 527{ --- 21 unchanged lines hidden (view full) --- 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 ); | 557 pImp->Enable_Impl( sal_False ); |
| 558 559 DBG( DbgOutf( "SfxProgress: locked" ) ); 560 pImp->bLocked = sal_True; 561} 562 563// ----------------------------------------------------------------------- 564 565void 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; | 558 559 DBG( DbgOutf( "SfxProgress: locked" ) ); 560 pImp->bLocked = sal_True; 561} 562 563// ----------------------------------------------------------------------- 564 565void 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); | 573 pImp->Enable_Impl(sal_True); |
| 574} 575 576// ----------------------------------------------------------------------- 577 578void SfxProgress::Reschedule() 579 580/* [Beschreibung] 581 | 574} 575 576// ----------------------------------------------------------------------- 577 578void SfxProgress::Reschedule() 579 580/* [Beschreibung] 581 |
| 582 Reschedule von au"sen rufbar | 582 Reschedule von außen rufbar |
| 583 584*/ 585 586{ 587 SFX_STACK(SfxProgress::Reschedule); 588 589 if( pImp->pActiveProgress ) return; | 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 ) | 590 SfxApplication* pApp = SFX_APP(); 591 if ( pImp->bLocked && 0 == pApp->Get_Impl()->nRescheduleLocks ) |
| 592 { | 592 { |
| 593 DBG_ASSERTWARNING( pApp->IsInAsynchronCall_Impl(), | 593 DBG_ASSERTWARNING( pApp->IsInAsynchronCall_Impl(), |
| 594 "Reschedule in synchron-call-stack" ); 595 | 594 "Reschedule in synchron-call-stack" ); 595 |
| 596 SfxAppData_Impl *pAppData = pApp->Get_Impl(); | 596 SfxAppData_Impl *pAppData = pApp->Get_Impl(); |
| 597 ++pAppData->nInReschedule; 598 Application::Reschedule(); 599 --pAppData->nInReschedule; 600 } 601} 602 603// ----------------------------------------------------------------------- 604 --- 58 unchanged lines hidden (view full) --- 663} 664 665// ----------------------------------------------------------------------- 666 667SfxProgress* SfxProgress::GetActiveProgress 668( 669 SfxObjectShell* pDocSh /* <SfxObjectShell>, die nach einem laufenden 670 <SfxProgress> gefragt werden soll, oder | 597 ++pAppData->nInReschedule; 598 Application::Reschedule(); 599 --pAppData->nInReschedule; 600 } 601} 602 603// ----------------------------------------------------------------------- 604 --- 58 unchanged lines hidden (view full) --- 663} 664 665// ----------------------------------------------------------------------- 666 667SfxProgress* 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 | 671 0, wenn ein für die gesamte Applikation |
| 672 laufender SfxProgress erfragt werden soll. 673 Der Pointer braucht nur zum Zeitpunkt des | 672 laufender SfxProgress erfragt werden soll. 673 Der Pointer braucht nur zum Zeitpunkt des |
| 674 Aufrufs g"ultig zu sein. */ | 674 Aufrufs gültig zu sein. */ |
| 675) 676 677/* [Beschreibung] 678 679 Mit dieser Methode kann erfragt werden, ob und welcher <SfxProgress>- | 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 | 680 für 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 | 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. | 693 Läuft kein SfxProgress an der Applikation und ebenfalls keiner an 694 der angegebenen SfxObjectShell, dann wird immer 0 zurückgeliefert, 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{ | 696 697 698 [Querverweise] 699 700 <SfxApplication::GetProgress()const> 701 <SfxObjectShell::GetProgress()const> 702*/ 703 704{ |
| 705 if ( !SfxApplication::Get() ) 706 return 0; | 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} --- 13 unchanged lines hidden (view full) --- 728 DBG_ASSERT( 0 != pImp->nRescheduleLocks, "SFxProgress::LeaveLock but no locks" ); 729 pImp->nRescheduleLocks--; 730} 731 732// ----------------------------------------------------------------------- 733 734FASTBOOL SfxProgress::StatusBarManagerGone_Impl 735( | 707 708 SfxProgress *pProgress = 0; 709 if ( pDocSh ) 710 pProgress = pDocSh->GetProgress(); 711 if ( !pProgress ) 712 pProgress = SFX_APP()->GetProgress(); 713 return pProgress; 714} --- 13 unchanged lines hidden (view full) --- 728 DBG_ASSERT( 0 != pImp->nRescheduleLocks, "SFxProgress::LeaveLock but no locks" ); 729 pImp->nRescheduleLocks--; 730} 731 732// ----------------------------------------------------------------------- 733 734FASTBOOL SfxProgress::StatusBarManagerGone_Impl 735( |
| 736 SfxStatusBarManager * // dieser <SfxStatusBarManager> wird zerst"ort | 736 SfxStatusBarManager * // dieser <SfxStatusBarManager> wird zerstört |
| 737) 738 739/* [Beschreibung] 740 | 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 | 741 Interne Methode zum Benachrichtigen des SfxProgress, dass der angegebene 742 SfxStatusBarManger zerstört wird. Damit der Progress ihn loslassen |
| 743 kann. 744*/ 745 746{ 747 return sal_True; 748} 749 | 743 kann. 744*/ 745 746{ 747 return sal_True; 748} 749 |
| 750/* vim: set noet sw=4 ts=4: */ |
|