diff options
34 files changed, 133 insertions, 116 deletions
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx index eec6e5722d2d..7f849724ad46 100644 --- a/sw/inc/docsh.hxx +++ b/sw/inc/docsh.hxx @@ -280,12 +280,6 @@ public: sal_Int16 GetUpdateDocMode() const {return nUpdateDocMode;} - //Activate wait cursor for all windows of this document - //Optionally all dispatcher could be Locked - //Usually locking should be done using the class: SwWaitObject! - void EnterWait( sal_Bool bLockDispatcher ); - void LeaveWait( sal_Bool bLockDispatcher ); - void ToggleBrowserMode(sal_Bool bOn, SwView* pView); sal_uLong LoadStylesFromFile( const String& rURL, SwgReaderOption& rOpt, diff --git a/sw/inc/swwait.hxx b/sw/inc/swwait.hxx index 78c48ade99a4..c6c78a65f711 100644 --- a/sw/inc/swwait.hxx +++ b/sw/inc/swwait.hxx @@ -26,15 +26,28 @@ #include <tools/solar.h> #include "swdllapi.h" +#include <hash_set> + class SwDocShell; +class SfxDispatcher; class SW_DLLPUBLIC SwWait { - SwDocShell &rDoc; - sal_Bool bLock; public: - SwWait( SwDocShell &rDocShell, sal_Bool bLockDispatcher ); + // Activate wait cursor for all windows of given document <rDocShell> + // Optional all dispatcher could be Locked + SwWait( + SwDocShell &rDocShell, + const bool bLockUnlockDispatcher ); ~SwWait(); + +private: + void EnterWaitAndLockDispatcher(); + void LeaveWaitAndUnlockDispatcher(); + + SwDocShell& mrDoc; + const bool mbLockUnlockDispatcher; + std::unordered_set< SfxDispatcher* > mpLockedDispatchers; }; #endif diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index 7af17f8eb325..cceb3891e223 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -646,7 +646,7 @@ void SwDoc::PrtDataChanged() pSh->GetViewOptions()->IsPrtFormat() ) { if ( GetDocShell() ) - pWait = new SwWait( *GetDocShell(), sal_True ); + pWait = new SwWait( *GetDocShell(), true ); pTmpRoot->StartAllAction(); bEndAction = sal_True; diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index 1a24737b01a0..d56748ae1c20 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -2683,7 +2683,7 @@ void SwEditShell::AutoFormat( const SvxSwAutoFmtFlags* pAFlags ) { aAFFlags = *pAFlags; if( !aAFFlags.bAFmtByInput ) - pWait = new SwWait( *GetDoc()->GetDocShell(), sal_True ); + pWait = new SwWait( *GetDoc()->GetDocShell(), true ); } SwPaM* pCrsr = GetCrsr(); diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx index 4e73db63c612..8c4053db1327 100644 --- a/sw/source/core/edit/edtab.cxx +++ b/sw/source/core/edit/edtab.cxx @@ -131,7 +131,7 @@ sal_Bool SwEditShell::TextToTable( const SwInsertTableOptions& rInsTblOpts, sal_Int16 eAdj, const SwTableAutoFmt* pTAFmt ) { - SwWait aWait( *GetDoc()->GetDocShell(), sal_True ); + SwWait aWait( *GetDoc()->GetDocShell(), true ); sal_Bool bRet = sal_False; StartAllAction(); FOREACHPAM_START(this) @@ -145,7 +145,7 @@ sal_Bool SwEditShell::TextToTable( const SwInsertTableOptions& rInsTblOpts, sal_Bool SwEditShell::TableToText( sal_Unicode cCh ) { - SwWait aWait( *GetDoc()->GetDocShell(), sal_True ); + SwWait aWait( *GetDoc()->GetDocShell(), true ); sal_Bool bRet = sal_False; SwPaM* pCrsr = GetCrsr(); const SwTableNode* pTblNd = diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index 04b1074cadba..f27dfeca8a37 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -106,7 +106,7 @@ TblWait::TblWait( sal_uInt16 nCnt, SwFrm *pFrm, SwDocShell &rDocShell, sal_uInt1 sal_Bool bWait = 20 < nCnt || 20 < nCnt2 || (pFrm && 20 < pFrm->ImplFindTabFrm()->GetTable()->GetTabLines().Count()); if( bWait ) - pWait = new SwWait( rDocShell, sal_True ); + pWait = new SwWait( rDocShell, true ); } @@ -1145,7 +1145,7 @@ void SwFEShell::SetRowsToRepeat( sal_uInt16 nSet ) SwTabFrm *pTab = pFrm ? pFrm->FindTabFrm() : 0; if( pTab && pTab->GetTable()->GetRowsToRepeat() != nSet ) { - SwWait aWait( *GetDoc()->GetDocShell(), sal_True ); + SwWait aWait( *GetDoc()->GetDocShell(), true ); SET_CURR_SHELL( this ); StartAllAction(); GetDoc()->SetRowsToRepeat( *pTab->GetTable(), nSet ); diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index cbc8da04ab1c..4df850e7b73f 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -167,7 +167,7 @@ void SwLayAction::CheckWaitCrsr() if ( !IsWait() && IsWaitAllowed() && IsPaint() && ((Ticks() - GetStartTicks()) >= CLOCKS_PER_SEC/2) ) { - pWait = new SwWait( *pRoot->GetFmt()->GetDoc()->GetDocShell(), sal_True ); + pWait = new SwWait( *pRoot->GetFmt()->GetDoc()->GetDocShell(), true ); } } diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index cc8907728927..05ebb4378cd9 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -806,7 +806,7 @@ void ViewShell::SetParaSpaceMax( bool bNew ) IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); if( pIDSA->get(IDocumentSettingAccess::PARA_SPACE_MAX) != bNew ) { - SwWait aWait( *GetDoc()->GetDocShell(), sal_True ); + SwWait aWait( *GetDoc()->GetDocShell(), true ); pIDSA->set(IDocumentSettingAccess::PARA_SPACE_MAX, bNew ); const sal_uInt8 nInv = INV_PRTAREA | INV_TABLE | INV_SECTION; lcl_InvalidateAllCntnt( *this, nInv ); @@ -818,7 +818,7 @@ void ViewShell::SetParaSpaceMaxAtPages( bool bNew ) IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); if( pIDSA->get(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES) != bNew ) { - SwWait aWait( *GetDoc()->GetDocShell(), sal_True ); + SwWait aWait( *GetDoc()->GetDocShell(), true ); pIDSA->set(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES, bNew ); const sal_uInt8 nInv = INV_PRTAREA | INV_TABLE | INV_SECTION; lcl_InvalidateAllCntnt( *this, nInv ); @@ -830,7 +830,7 @@ void ViewShell::SetTabCompat( bool bNew ) IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); if( pIDSA->get(IDocumentSettingAccess::TAB_COMPAT) != bNew ) { - SwWait aWait( *GetDoc()->GetDocShell(), sal_True ); + SwWait aWait( *GetDoc()->GetDocShell(), true ); pIDSA->set(IDocumentSettingAccess::TAB_COMPAT, bNew ); const sal_uInt8 nInv = INV_PRTAREA | INV_SIZE | INV_TABLE | INV_SECTION; lcl_InvalidateAllCntnt( *this, nInv ); @@ -842,7 +842,7 @@ void ViewShell::SetAddExtLeading( bool bNew ) IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); if ( pIDSA->get(IDocumentSettingAccess::ADD_EXT_LEADING) != bNew ) { - SwWait aWait( *GetDoc()->GetDocShell(), sal_True ); + SwWait aWait( *GetDoc()->GetDocShell(), true ); pIDSA->set(IDocumentSettingAccess::ADD_EXT_LEADING, bNew ); SdrModel* pTmpDrawModel = getIDocumentDrawModelAccess()->GetDrawModel(); if ( pTmpDrawModel ) @@ -857,7 +857,7 @@ void ViewShell::SetUseVirDev( bool bNewVirtual ) IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); if ( pIDSA->get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE) != bNewVirtual ) { - SwWait aWait( *GetDoc()->GetDocShell(), sal_True ); + SwWait aWait( *GetDoc()->GetDocShell(), true ); // this sets the flag at the document and calls PrtDataChanged IDocumentDeviceAccess* pIDDA = getIDocumentDeviceAccess(); pIDDA->setReferenceDeviceType( bNewVirtual, true ); @@ -871,7 +871,7 @@ void ViewShell::SetAddParaSpacingToTableCells( bool _bAddParaSpacingToTableCells IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); if ( pIDSA->get(IDocumentSettingAccess::ADD_PARA_SPACING_TO_TABLE_CELLS) != _bAddParaSpacingToTableCells ) { - SwWait aWait( *GetDoc()->GetDocShell(), sal_True ); + SwWait aWait( *GetDoc()->GetDocShell(), true ); pIDSA->set(IDocumentSettingAccess::ADD_PARA_SPACING_TO_TABLE_CELLS, _bAddParaSpacingToTableCells ); const sal_uInt8 nInv = INV_PRTAREA; lcl_InvalidateAllCntnt( *this, nInv ); @@ -885,7 +885,7 @@ void ViewShell::SetUseFormerLineSpacing( bool _bUseFormerLineSpacing ) IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); if ( pIDSA->get(IDocumentSettingAccess::OLD_LINE_SPACING) != _bUseFormerLineSpacing ) { - SwWait aWait( *GetDoc()->GetDocShell(), sal_True ); + SwWait aWait( *GetDoc()->GetDocShell(), true ); pIDSA->set(IDocumentSettingAccess::OLD_LINE_SPACING, _bUseFormerLineSpacing ); const sal_uInt8 nInv = INV_PRTAREA; lcl_InvalidateAllCntnt( *this, nInv ); @@ -898,7 +898,7 @@ void ViewShell::SetUseFormerObjectPositioning( bool _bUseFormerObjPos ) IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); if ( pIDSA->get(IDocumentSettingAccess::USE_FORMER_OBJECT_POS) != _bUseFormerObjPos ) { - SwWait aWait( *GetDoc()->GetDocShell(), sal_True ); + SwWait aWait( *GetDoc()->GetDocShell(), true ); pIDSA->set(IDocumentSettingAccess::USE_FORMER_OBJECT_POS, _bUseFormerObjPos ); lcl_InvalidateAllObjPos( *this ); } @@ -910,7 +910,7 @@ void ViewShell::SetConsiderWrapOnObjPos( bool _bConsiderWrapOnObjPos ) IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); if ( pIDSA->get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION) != _bConsiderWrapOnObjPos ) { - SwWait aWait( *GetDoc()->GetDocShell(), sal_True ); + SwWait aWait( *GetDoc()->GetDocShell(), true ); pIDSA->set(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION, _bConsiderWrapOnObjPos ); lcl_InvalidateAllObjPos( *this ); } @@ -922,7 +922,7 @@ void ViewShell::SetUseFormerTextWrapping( bool _bUseFormerTextWrapping ) IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); if ( pIDSA->get(IDocumentSettingAccess::USE_FORMER_TEXT_WRAPPING) != _bUseFormerTextWrapping ) { - SwWait aWait( *GetDoc()->GetDocShell(), sal_True ); + SwWait aWait( *GetDoc()->GetDocShell(), true ); pIDSA->set(IDocumentSettingAccess::USE_FORMER_TEXT_WRAPPING, _bUseFormerTextWrapping ); const sal_uInt8 nInv = INV_PRTAREA | INV_SIZE | INV_TABLE | INV_SECTION; lcl_InvalidateAllCntnt( *this, nInv ); @@ -936,7 +936,7 @@ void ViewShell::SetDoNotJustifyLinesWithManualBreak( bool _bDoNotJustifyLinesWit IDocumentSettingAccess* pIDSA = getIDocumentSettingAccess(); if ( pIDSA->get(IDocumentSettingAccess::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK) != _bDoNotJustifyLinesWithManualBreak ) { - SwWait aWait( *GetDoc()->GetDocShell(), sal_True ); + SwWait aWait( *GetDoc()->GetDocShell(), true ); pIDSA->set(IDocumentSettingAccess::DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK, _bDoNotJustifyLinesWithManualBreak ); const sal_uInt8 nInv = INV_PRTAREA | INV_SIZE | INV_TABLE | INV_SECTION; lcl_InvalidateAllCntnt( *this, nInv ); @@ -955,7 +955,7 @@ void ViewShell::SetDoNotJustifyLinesWithManualBreak( bool _bDoNotJustifyLinesWit void ViewShell::Reformat() { - SwWait aWait( *GetDoc()->GetDocShell(), sal_True ); + SwWait aWait( *GetDoc()->GetDocShell(), true ); // Wir gehen auf Nummer sicher: // Wir muessen die alten Fontinformationen wegschmeissen, @@ -997,7 +997,7 @@ void ViewShell::Reformat() void ViewShell::CalcLayout() { SET_CURR_SHELL( this ); - SwWait aWait( *GetDoc()->GetDocShell(), sal_True ); + SwWait aWait( *GetDoc()->GetDocShell(), true ); //Cache vorbereiten und restaurieren, damit er nicht versaut wird. SwSaveSetLRUOfst aSaveLRU( *SwTxtFrm::GetTxtCache(), diff --git a/sw/source/ui/app/appenv.cxx b/sw/source/ui/app/appenv.cxx index fdf71015a08a..24b5365f5b5d 100644 --- a/sw/source/ui/app/appenv.cxx +++ b/sw/source/ui/app/appenv.cxx @@ -252,7 +252,7 @@ static sal_uInt16 nTitleNo = 0; if (nMode == ENV_NEWDOC || nMode == ENV_INSERT) { - SwWait aWait( (SwDocShell&)*xDocSh, sal_True ); + SwWait aWait( (SwDocShell&)*xDocSh, true ); // Dialog auslesen, Item in Config speichern const SwEnvItem& rItem = pItem ? *pItem : (const SwEnvItem&) pDlg->GetOutputItemSet()->Get(FN_ENVELOP); diff --git a/sw/source/ui/app/applab.cxx b/sw/source/ui/app/applab.cxx index 2d3886a9e48b..5eb0b9641b28 100644 --- a/sw/source/ui/app/applab.cxx +++ b/sw/source/ui/app/applab.cxx @@ -239,7 +239,7 @@ static sal_uInt16 nBCTitleNo = 0; { // block for locks the dispatcher!! - SwWait aWait( (SwDocShell&)*xDocSh, sal_True ); + SwWait aWait( (SwDocShell&)*xDocSh, true ); SET_CURR_SHELL(pSh); pSh->SetLabelDoc(rItem.bSynchron); diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx index ce028e6598d2..16e07a192370 100644 --- a/sw/source/ui/app/docsh.cxx +++ b/sw/source/ui/app/docsh.cxx @@ -244,7 +244,7 @@ sal_Bool SwDocShell::ConvertFrom( SfxMedium& rMedium ) return sal_False; // #129881# return if no reader is found SotStorageRef pStg=pRead->getSotStorageRef(); // #i45333# save sot storage ref in case of recursive calls - SwWait aWait( *this, sal_True ); + SwWait aWait( *this, true ); // SfxProgress unterdruecken, wenn man Embedded ist SW_MOD()->SetEmbeddedLoadSave( @@ -307,7 +307,7 @@ sal_Bool SwDocShell::Save() //#i3370# remove quick help to prevent saving of autocorrection suggestions if(pView) pView->GetEditWin().StopQuickHelp(); - SwWait aWait( *this, sal_True ); + SwWait aWait( *this, true ); CalcLayoutForOLEObjects(); // format for OLE objets // --> OD 2006-03-17 #i62875# @@ -416,7 +416,7 @@ sal_Bool SwDocShell::SaveAs( SfxMedium& rMedium ) } } } - SwWait aWait( *this, sal_True ); + SwWait aWait( *this, true ); //#i3370# remove quick help to prevent saving of autocorrection suggestions if(pView) pView->GetEditWin().StopQuickHelp(); @@ -746,7 +746,7 @@ sal_Bool SwDocShell::ConvertTo( SfxMedium& rMedium ) //Keine View also das ganze Dokument! if ( pWrtShell ) { - SwWait aWait( *this, sal_True ); + SwWait aWait( *this, true ); // --> OD 2009-12-31 #i106906# const sal_Bool bFormerLockView = pWrtShell->IsViewLocked(); pWrtShell->LockView( sal_True ); diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx index 9a94f89ae875..e39f19fb8c38 100644 --- a/sw/source/ui/app/docsh2.cxx +++ b/sw/source/ui/app/docsh2.cxx @@ -244,8 +244,6 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) { if( !pDoc ) { -//MA: Kommt bei der OLE-Registration vor! -// ASSERT( !this, "DocShell ist nicht richtig initialisiert!" ); return ; } @@ -261,18 +259,16 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) // swithc for more actions switch( ((SfxSimpleHint&) rHint).GetId() ) { - case SFX_HINT_TITLECHANGED: - if( GetMedium() ) - nAction = 2; + case SFX_HINT_TITLECHANGED: + if( GetMedium() ) + nAction = 2; break; } } else if( rHint.ISA(SfxEventHint) && ((SfxEventHint&) rHint).GetEventId() == SFX_EVENT_LOADFINISHED ) { - // --> OD 2004-12-03 #i38126# - own action id nAction = 3; - // <-- } if( nAction ) @@ -289,31 +285,25 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) case 2: pDoc->GetSysFldType( RES_FILENAMEFLD )->UpdateFlds(); break; - // --> OD 2004-12-03 #i38126# - own action for event LOADFINISHED - // in order to avoid a modified document. - // --> OD 2005-02-01 #i41679# - Also for the instance of <SwDoc> - // it has to be assured, that it's not modified. + + // own action for event LOADFINISHED in order to avoid a modified document. + // Also for the instance of <SwDoc> it has to be assured, that it's not modified. // Perform the same as for action id 1, but disable <SetModified>. case 3: { const bool bResetModified = IsEnableSetModified(); if ( bResetModified ) EnableSetModified( sal_False ); - // --> OD 2005-02-01 #i41679# const bool bIsDocModified = pDoc->IsModified(); - // <-- pDoc->DocInfoChgd( ); - // --> OD 2005-02-01 #i41679# if ( !bIsDocModified ) pDoc->ResetModified(); - // <-- if ( bResetModified ) EnableSetModified( sal_True ); } break; - // <-- } if( pWrtShell ) @@ -1445,7 +1435,7 @@ void SwDocShell::Execute(SfxRequest& rReq) { if( PrepareClose( sal_False ) ) { - SwWait aWait( *this, sal_True ); + SwWait aWait( *this, true ); //bDone = bCreateHtml //#outline level,removed by zhaojianwei // ? pDoc->GenerateHTMLDoc( aFileName, pSplitColl ) diff --git a/sw/source/ui/app/docshini.cxx b/sw/source/ui/app/docshini.cxx index 2a82ba24574e..c217d4491010 100644 --- a/sw/source/ui/app/docshini.cxx +++ b/sw/source/ui/app/docshini.cxx @@ -567,7 +567,7 @@ sal_Bool SwDocShell::Load( SfxMedium& rMedium ) nUpdateDocMode = pUpdateDocItem ? pUpdateDocItem->GetValue() : document::UpdateDocMode::NO_UPDATE; } - SwWait aWait( *this, sal_True ); + SwWait aWait( *this, true ); sal_uInt32 nErr = ERR_SWG_READ_ERROR; switch( GetCreateMode() ) { @@ -684,7 +684,7 @@ sal_Bool SwDocShell::LoadFrom( SfxMedium& rMedium ) if ( xAccess->hasByName( aStreamName ) && rMedium.GetStorage()->isStreamElement( aStreamName ) ) { // Das Laden - SwWait aWait( *this, sal_True ); + SwWait aWait( *this, true ); { ASSERT( !mxBasePool.is(), "wer hat seinen Pool nicht zerstoert?" ); mxBasePool = new SwDocStyleSheetPool( *pDoc, SFX_CREATE_MODE_ORGANIZER == GetCreateMode() ); diff --git a/sw/source/ui/app/swwait.cxx b/sw/source/ui/app/swwait.cxx index 356b486ff5d7..4d554f76a439 100644 --- a/sw/source/ui/app/swwait.cxx +++ b/sw/source/ui/app/swwait.cxx @@ -24,48 +24,69 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" +#include <swwait.hxx> +#include <docsh.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/dispatch.hxx> #include <vcl/window.hxx> -#include <docsh.hxx> -#include <swwait.hxx> -void SwDocShell::EnterWait( sal_Bool bLockDispatcher ) +SwWait::SwWait( + SwDocShell &rDocShell, + const bool bLockUnlockDispatcher ) + : mrDoc ( rDocShell ) + , mbLockUnlockDispatcher( bLockUnlockDispatcher ) + , mpLockedDispatchers() +{ + EnterWaitAndLockDispatcher(); +} + +SwWait::~SwWait() +{ + LeaveWaitAndUnlockDispatcher(); +} + +void SwWait::EnterWaitAndLockDispatcher() { - SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, sal_False ); + SfxViewFrame *pFrame = SfxViewFrame::GetFirst( &mrDoc, sal_False ); while ( pFrame ) { pFrame->GetWindow().EnterWait(); - if ( bLockDispatcher ) - pFrame->GetDispatcher()->Lock( sal_True ); - pFrame = SfxViewFrame::GetNext( *pFrame, this, sal_False ); + if ( mbLockUnlockDispatcher ) + { + // do not look already locked dispatchers + SfxDispatcher* pDispatcher = pFrame->GetDispatcher(); + if ( !pDispatcher->IsLocked() ) + { + pDispatcher->Lock( sal_True ); + mpLockedDispatchers.insert( pDispatcher ); + } + } + + pFrame = SfxViewFrame::GetNext( *pFrame, &mrDoc, sal_False ); } } -void SwDocShell::LeaveWait( sal_Bool bLockDispatcher ) +void SwWait::LeaveWaitAndUnlockDispatcher() { - SfxViewFrame *pFrame = SfxViewFrame::GetFirst( this, sal_False ); + SfxViewFrame *pFrame = SfxViewFrame::GetFirst( &mrDoc, sal_False ); while ( pFrame ) { pFrame->GetWindow().LeaveWait(); - if ( bLockDispatcher ) - pFrame->GetDispatcher()->Lock( sal_False ); - pFrame = SfxViewFrame::GetNext( *pFrame, this, sal_False ); - } -} - -SwWait::SwWait( SwDocShell &rDocShell, sal_Bool bLockDispatcher ) : - rDoc ( rDocShell ), - bLock( bLockDispatcher ) -{ - rDoc.EnterWait( bLock ); -} + if ( mbLockUnlockDispatcher ) + { + // only unlock dispatchers which had been locked + SfxDispatcher* pDispatcher = pFrame->GetDispatcher(); + if ( mpLockedDispatchers.find( pDispatcher ) != mpLockedDispatchers.end() ) + { + mpLockedDispatchers.erase( pDispatcher ); + pDispatcher->Lock( sal_False ); + } + } -SwWait::~SwWait() -{ - rDoc.LeaveWait( bLock ); + pFrame = SfxViewFrame::GetNext( *pFrame, &mrDoc, sal_False ); + } } diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index b208eff96053..7b3dd1cc0df3 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -1223,7 +1223,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection, break; if( 10 == i ) - pWait = ::std::auto_ptr<SwWait>(new SwWait( *pView->GetDocShell(), sal_True )); + pWait = ::std::auto_ptr<SwWait>(new SwWait( *pView->GetDocShell(), true )); } rSh.MoveTable( GetfnTableCurr(), GetfnTableStart() ); @@ -1455,7 +1455,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection, rSh.SwEditShell::SplitNode(); if( 10 == i ) - pWait = ::std::auto_ptr<SwWait>(new SwWait( *pView->GetDocShell(), sal_True )); + pWait = ::std::auto_ptr<SwWait>(new SwWait( *pView->GetDocShell(), true )); } if( !bSetCrsr && pMark != NULL) diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx index e33ee9d03d84..353fe300008a 100644 --- a/sw/source/ui/dbui/dbmgr.cxx +++ b/sw/source/ui/dbui/dbmgr.cxx @@ -504,7 +504,7 @@ void SwNewDBMgr::ImportFromConnection( SwWrtShell* pSh ) ImportDBEntry(pSh); if( 10 == ++i ) - pWait = new SwWait( *pSh->GetView().GetDocShell(), sal_True); + pWait = new SwWait( *pSh->GetView().GetDocShell(), true ); } while(ToNextMergeRecord()); } diff --git a/sw/source/ui/dialog/docstdlg.cxx b/sw/source/ui/dialog/docstdlg.cxx index eb2d51aab5e3..cc446c9aa3a8 100644 --- a/sw/source/ui/dialog/docstdlg.cxx +++ b/sw/source/ui/dialog/docstdlg.cxx @@ -166,7 +166,7 @@ void SwDocStatPage::Update() ASSERT( pSh, "Shell not found" ); - SwWait aWait( *pSh->GetDoc()->GetDocShell(), sal_True ); + SwWait aWait( *pSh->GetDoc()->GetDocShell(), true ); pSh->StartAction(); aDocStat = pSh->GetDoc()->GetDocStat(); pSh->GetDoc()->UpdateDocStat( aDocStat ); diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx index 6b5d98b5bd29..4317410817b7 100644 --- a/sw/source/ui/dochdl/swdtflvr.cxx +++ b/sw/source/ui/dochdl/swdtflvr.cxx @@ -831,7 +831,7 @@ int SwTransferable::PrepareForCopy( sal_Bool bIsCut ) { SwWait *pWait = 0; if( pWrtShell->ShouldWait() ) - pWait = new SwWait( *pWrtShell->GetView().GetDocShell(), sal_True ); + pWait = new SwWait( *pWrtShell->GetView().GetDocShell(), true ); pClpDocFac = new SwDocFac; @@ -996,7 +996,7 @@ int SwTransferable::CalculateAndCopy() { if(!pWrtShell) return 0; - SwWait aWait( *pWrtShell->GetView().GetDocShell(), sal_True ); + SwWait aWait( *pWrtShell->GetView().GetDocShell(), true ); String aStr( pWrtShell->Calculate() ); @@ -1018,7 +1018,7 @@ int SwTransferable::CopyGlossary( SwTextBlocks& rGlossary, { if(!pWrtShell) return 0; - SwWait aWait( *pWrtShell->GetView().GetDocShell(), sal_True ); + SwWait aWait( *pWrtShell->GetView().GetDocShell(), true ); pClpDocFac = new SwDocFac; SwDoc *const pCDoc = lcl_GetDoc(*pClpDocFac); @@ -1163,8 +1163,7 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, const Point* pPt, sal_Int8 nDropAction, sal_Bool bPasteSelection ) { - SwWait aWait( *rSh.GetView(). - GetDocShell(), sal_False ); + SwWait aWait( *rSh.GetView().GetDocShell(), false ); SwTrnsfrActionAndUndo* pAction = 0; SwModule* pMod = SW_MOD(); @@ -2854,7 +2853,7 @@ int SwTransferable::PasteFormat( SwWrtShell& rSh, TransferableDataHelper& rData, sal_uLong nFormat ) { - SwWait aWait( *rSh.GetView().GetDocShell(), sal_False ); + SwWait aWait( *rSh.GetView().GetDocShell(), false ); int nRet = 0; sal_uLong nPrivateFmt = FORMAT_PRIVATE; diff --git a/sw/source/ui/envelp/envlop1.cxx b/sw/source/ui/envelp/envlop1.cxx index d382b951b5dd..9dd43a2d9d89 100644 --- a/sw/source/ui/envelp/envlop1.cxx +++ b/sw/source/ui/envelp/envlop1.cxx @@ -281,7 +281,7 @@ SwEnvPage::~SwEnvPage() IMPL_LINK( SwEnvPage, DatabaseHdl, ListBox *, pListBox ) { - SwWait aWait( *pSh->GetView().GetDocShell(), sal_True ); + SwWait aWait( *pSh->GetView().GetDocShell(), true ); if (pListBox == &aDatabaseLB) { diff --git a/sw/source/ui/index/toxmgr.cxx b/sw/source/ui/index/toxmgr.cxx index e1f519beac06..7f7410d5bd97 100644 --- a/sw/source/ui/index/toxmgr.cxx +++ b/sw/source/ui/index/toxmgr.cxx @@ -293,7 +293,7 @@ sal_Bool SwTOXMgr::UpdateOrInsertTOX(const SwTOXDescription& rDesc, SwTOXBase** ppBase, const SfxItemSet* pSet) { - SwWait aWait( *pSh->GetView().GetDocShell(), sal_True ); + SwWait aWait( *pSh->GetView().GetDocShell(), true ); sal_Bool bRet = sal_True; const SwTOXBase* pCurTOX = ppBase && *ppBase ? *ppBase : GetCurTOX(); SwTOXBase* pTOX = (SwTOXBase*)pCurTOX; diff --git a/sw/source/ui/lingu/hyp.cxx b/sw/source/ui/lingu/hyp.cxx index f0660c47784f..35cbff56ad23 100644 --- a/sw/source/ui/lingu/hyp.cxx +++ b/sw/source/ui/lingu/hyp.cxx @@ -96,7 +96,7 @@ sal_Bool SwHyphWrapper::SpellContinue() if( bAutomatic ) { PSH->StartAllAction(); - pWait = new SwWait( *pView->GetDocShell(), sal_True ); + pWait = new SwWait( *pView->GetDocShell(), true ); } uno::Reference< uno::XInterface > xHyphWord = bInSelection ? diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index 2c1d2d212414..10a53cf75ed0 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -1091,7 +1091,7 @@ sal_Bool SwGlTreeListBox::NotifyMoving( SvLBoxEntry* pTarget, if(pDestParent != pSrcParent) { SwGlossaryDlg* pDlg = (SwGlossaryDlg*)Window::GetParent(); - SwWait aWait( *pDlg->pSh->GetView().GetDocShell(), sal_True ); + SwWait aWait( *pDlg->pSh->GetView().GetDocShell(), true ); GroupUserData* pGroupData = (GroupUserData*)pSrcParent->GetUserData(); String sSourceGroup(pGroupData->sGroupName); @@ -1139,7 +1139,7 @@ sal_Bool SwGlTreeListBox::NotifyCopying( SvLBoxEntry* pTarget, if(pDestParent != pSrcParent) { SwGlossaryDlg* pDlg = (SwGlossaryDlg*)Window::GetParent(); - SwWait aWait( *pDlg->pSh->GetView().GetDocShell(), sal_True ); + SwWait aWait( *pDlg->pSh->GetView().GetDocShell(), true ); GroupUserData* pGroupData = (GroupUserData*)pSrcParent->GetUserData(); String sSourceGroup(pGroupData->sGroupName); diff --git a/sw/source/ui/misc/redlndlg.cxx b/sw/source/ui/misc/redlndlg.cxx index eb275d3ed375..11b75fc13a18 100644 --- a/sw/source/ui/misc/redlndlg.cxx +++ b/sw/source/ui/misc/redlndlg.cxx @@ -145,7 +145,7 @@ void SwModelessRedlineAcceptDlg::Activate() if (pChildWin->GetOldDocShell() != pDocSh) { // Dok-Wechsel - SwWait aWait( *pDocSh, sal_False ); + SwWait aWait( *pDocSh, false ); SwWrtShell* pSh = pView->GetWrtShellPtr(); pChildWin->SetOldDocShell(pDocSh); // Rekursion vermeiden (durch Modified-Hdl) @@ -310,7 +310,7 @@ SwRedlineAcceptDlg::~SwRedlineAcceptDlg() void SwRedlineAcceptDlg::Init(sal_uInt16 nStart) { - SwWait aWait( *::GetActiveView()->GetDocShell(), sal_False ); + SwWait aWait( *::GetActiveView()->GetDocShell(), false ); pTable->SetUpdateMode(sal_False); aUsedSeqNo.Remove((sal_uInt16)0, aUsedSeqNo.Count()); @@ -480,7 +480,7 @@ void SwRedlineAcceptDlg::Activate() return; SwView *pView = ::GetActiveView(); - SwWait aWait( *pView->GetDocShell(), sal_False ); + SwWait aWait( *pView->GetDocShell(), false ); aUsedSeqNo.Remove((sal_uInt16)0, aUsedSeqNo.Count()); @@ -922,7 +922,7 @@ void SwRedlineAcceptDlg::CallAcceptReject( sal_Bool bSelect, sal_Bool bAccept ) if( !bAccept ) FnAccRej = &SwEditShell::RejectRedline; - SwWait aWait( *pSh->GetView().GetDocShell(), sal_True ); + SwWait aWait( *pSh->GetView().GetDocShell(), true ); pSh->StartAction(); // #111827# @@ -1328,7 +1328,7 @@ IMPL_LINK( SwRedlineAcceptDlg, CommandHdl, void*, EMPTYARG ) if (pTable->GetSortedCol() == nSortMode) bSortDir = !pTable->GetSortDirection(); - SwWait aWait( *::GetActiveView()->GetDocShell(), sal_False ); + SwWait aWait( *::GetActiveView()->GetDocShell(), false ); pTable->SortByCol(nSortMode, bSortDir); if (nSortMode == 0xffff) Init(); // Alles neu fuellen diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx index c2d459ec40f9..83039362e96a 100644 --- a/sw/source/ui/misc/srtdlg.cxx +++ b/sw/source/ui/misc/srtdlg.cxx @@ -392,7 +392,7 @@ void SwSortDlg::Apply() sal_Bool bRet; { - SwWait aWait( *rSh.GetView().GetDocShell(), sal_True ); + SwWait aWait( *rSh.GetView().GetDocShell(), true ); rSh.StartAllAction(); if( 0 != (bRet = rSh.Sort( aOptions ))) rSh.SetModified(); diff --git a/sw/source/ui/shells/annotsh.cxx b/sw/source/ui/shells/annotsh.cxx index 6e8ce45b26f3..d9b4e2a3fd95 100644 --- a/sw/source/ui/shells/annotsh.cxx +++ b/sw/source/ui/shells/annotsh.cxx @@ -455,7 +455,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) SwDocStat aCurr; SwDocStat aDocStat( rSh.getIDocumentStatistics()->GetDocStat() ); { - SwWait aWait( *rView.GetDocShell(), sal_True ); + SwWait aWait( *rView.GetDocShell(), true ); rSh.StartAction(); rSh.CountWords( aCurr ); rSh.UpdateDocStat( aDocStat ); diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx index 950ce0e1c5a7..79aace381f2b 100644 --- a/sw/source/ui/shells/basesh.cxx +++ b/sw/source/ui/shells/basesh.cxx @@ -647,7 +647,7 @@ void SwBaseShell::Execute(SfxRequest &rReq) break; case FN_UPDATE_CHARTS: { - SwWait aWait( *rView.GetDocShell(), sal_True ); + SwWait aWait( *rView.GetDocShell(), true ); rSh.UpdateAllCharts(); } break; @@ -752,7 +752,7 @@ void SwBaseShell::Execute(SfxRequest &rReq) if ( (!rSh.IsSelFrmMode() || nSelType & nsSelectionType::SEL_GRF) && nGalleryItemType == com::sun::star::gallery::GalleryItemType::GRAPHIC ) { - SwWait aWait( *rView.GetDocShell(), sal_True ); + SwWait aWait( *rView.GetDocShell(), true ); String aGrfName, aFltName; const Graphic aGrf( pGalleryItem->GetGraphic() ); diff --git a/sw/source/ui/shells/drawsh.cxx b/sw/source/ui/shells/drawsh.cxx index e77f2931aa93..9718653ef7a2 100644 --- a/sw/source/ui/shells/drawsh.cxx +++ b/sw/source/ui/shells/drawsh.cxx @@ -340,7 +340,7 @@ void SwDrawShell::Execute(SfxRequest &rReq) SwDocStat aCurr; SwDocStat aDocStat( rSh.getIDocumentStatistics()->GetDocStat() ); { - SwWait aWait( *GetView().GetDocShell(), sal_True ); + SwWait aWait( *GetView().GetDocShell(), true ); rSh.StartAction(); rSh.CountWords( aCurr ); rSh.UpdateDocStat( aDocStat ); diff --git a/sw/source/ui/shells/drwtxtex.cxx b/sw/source/ui/shells/drwtxtex.cxx index c6c780a45344..63657ef9903d 100644 --- a/sw/source/ui/shells/drwtxtex.cxx +++ b/sw/source/ui/shells/drwtxtex.cxx @@ -418,7 +418,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) SwDocStat aCurr; SwDocStat aDocStat( rSh.getIDocumentStatistics()->GetDocStat() ); { - SwWait aWait( *GetView().GetDocShell(), sal_True ); + SwWait aWait( *GetView().GetDocShell(), true ); rSh.StartAction(); rSh.CountWords( aCurr ); rSh.UpdateDocStat( aDocStat ); diff --git a/sw/source/ui/shells/frmsh.cxx b/sw/source/ui/shells/frmsh.cxx index b854bd63ead7..b520a1273f0b 100644 --- a/sw/source/ui/shells/frmsh.cxx +++ b/sw/source/ui/shells/frmsh.cxx @@ -282,7 +282,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) SwDocStat aCurr; SwDocStat aDocStat( rSh.getIDocumentStatistics()->GetDocStat() ); { - SwWait aWait( *GetView().GetDocShell(), sal_True ); + SwWait aWait( *GetView().GetDocShell(), true ); rSh.StartAction(); rSh.CountWords( aCurr ); rSh.UpdateDocStat( aDocStat ); diff --git a/sw/source/ui/shells/grfsh.cxx b/sw/source/ui/shells/grfsh.cxx index b6ffc2dcd54e..2ec894b605e4 100644 --- a/sw/source/ui/shells/grfsh.cxx +++ b/sw/source/ui/shells/grfsh.cxx @@ -321,7 +321,7 @@ void SwGrfShell::Execute(SfxRequest &rReq) if( sGrfNm.Len() ) { SwDocShell* pDocSh = GetView().GetDocShell(); - SwWait aWait( *pDocSh, sal_True ); + SwWait aWait( *pDocSh, true ); SfxMedium* pMedium = pDocSh->GetMedium(); INetURLObject aAbs; if( pMedium ) diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx index bd47adbfc555..b67d2b23fb7d 100644 --- a/sw/source/ui/shells/textsh1.cxx +++ b/sw/source/ui/shells/textsh1.cxx @@ -1358,7 +1358,7 @@ void SwTextShell::Execute(SfxRequest &rReq) SwDocStat aCurr; SwDocStat aDocStat( rSh.getIDocumentStatistics()->GetDocStat() ); { - SwWait aWait( *GetView().GetDocShell(), sal_True ); + SwWait aWait( *GetView().GetDocShell(), true ); rSh.StartAction(); rSh.CountWords( aCurr ); rSh.UpdateDocStat( aDocStat ); diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx index 4630ce7becfa..6835b5b8d007 100644 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -209,7 +209,7 @@ int SwView::InsertGraphic( const String &rPath, const String &rFilter, sal_Bool bLink, GraphicFilter *pFlt, Graphic* pPreviewGrf, sal_Bool bRule ) { - SwWait aWait( *GetDocShell(), sal_True ); + SwWait aWait( *GetDocShell(), true ); Graphic aGrf; int nRes = GRFILTER_OK; @@ -2146,7 +2146,7 @@ long SwView::InsertMedium( sal_uInt16 nSlotId, SfxMedium* pMedium, sal_Int16 nVe sal_uLong nErrno; { //Scope for SwWait-Object, to be able to execute slots //outside this scope. - SwWait aWait( *GetDocShell(), sal_True ); + SwWait aWait( *GetDocShell(), true ); pWrtShell->StartAllAction(); if ( pWrtShell->HasSelection() ) pWrtShell->DelRight(); // Selektionen loeschen @@ -2206,7 +2206,7 @@ extern int lcl_FindDocShell( SfxObjectShellRef& xDocSh, SfxObjectShellLock& xLoc sFltNm, nVersion, pDocSh ); if( nRet ) { - SwWait aWait( *GetDocShell(), sal_True ); + SwWait aWait( *GetDocShell(), true ); pWrtShell->StartAllAction(); pWrtShell->EnterStdMode(); // Selektionen loeschen diff --git a/sw/source/ui/uiview/viewling.cxx b/sw/source/ui/uiview/viewling.cxx index 15540559e382..79ed5972d5dc 100644 --- a/sw/source/ui/uiview/viewling.cxx +++ b/sw/source/ui/uiview/viewling.cxx @@ -626,7 +626,7 @@ void SwView::StartThesaurus() { // create dialog { //Scope for SwWait-Object - SwWait aWait( *GetDocShell(), sal_True ); + SwWait aWait( *GetDocShell(), true ); // load library with dialog only on demand ... SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); pDlg = pFact->CreateThesaurusDialog( &GetEditWin(), xThes, aTmp, eLang ); diff --git a/sw/source/ui/uiview/viewsrch.cxx b/sw/source/ui/uiview/viewsrch.cxx index 28274ea0e459..c3fb70e94b6f 100644 --- a/sw/source/ui/uiview/viewsrch.cxx +++ b/sw/source/ui/uiview/viewsrch.cxx @@ -335,7 +335,7 @@ void SwView::ExecSearch(SfxRequest& rReq, sal_Bool bNoMessage) sal_uLong nFound; { //Scope for SwWait-Object - SwWait aWait( *GetDocShell(), sal_True ); + SwWait aWait( *GetDocShell(), true ); pWrtShell->StartAllAction(); nFound = FUNC_Search( aOpts ); pWrtShell->EndAllAction(); @@ -479,7 +479,7 @@ sal_Bool SwView::SearchAndWrap(sal_Bool bApi) if (!pSrchItem->GetSelection()) (pWrtShell->*pWrtShell->fnKillSel)(0, sal_False); - SwWait *pWait = new SwWait( *GetDocShell(), sal_True ); + SwWait *pWait = new SwWait( *GetDocShell(), true ); if( FUNC_Search( aOpts ) ) { bFound = sal_True; @@ -546,7 +546,7 @@ sal_Bool SwView::SearchAndWrap(sal_Bool bApi) } pWrtShell->StartAllAction(); pWrtShell->Pop(sal_False); - pWait = new SwWait( *GetDocShell(), sal_True ); + pWait = new SwWait( *GetDocShell(), true ); sal_Bool bSrchBkwrd = DOCPOS_START == aOpts.eEnd; @@ -578,7 +578,7 @@ sal_Bool SwView::SearchAndWrap(sal_Bool bApi) sal_Bool SwView::SearchAll(sal_uInt16* pFound) { - SwWait aWait( *GetDocShell(), sal_True ); + SwWait aWait( *GetDocShell(), true ); pWrtShell->StartAllAction(); SwSearchOptions aOpts( pWrtShell, pSrchItem->GetBackward() ); @@ -607,7 +607,7 @@ sal_Bool SwView::SearchAll(sal_uInt16* pFound) void SwView::Replace() { - SwWait aWait( *GetDocShell(), sal_True ); + SwWait aWait( *GetDocShell(), true ); pWrtShell->StartAllAction(); |