diff options
-rw-r--r-- | sw/inc/crsrsh.hxx | 4 | ||||
-rw-r--r-- | sw/inc/editsh.hxx | 4 | ||||
-rw-r--r-- | sw/inc/viewsh.hxx | 21 | ||||
-rw-r--r-- | sw/source/core/edit/edws.cxx | 22 | ||||
-rw-r--r-- | sw/source/core/view/viewsh.cxx | 94 |
5 files changed, 59 insertions, 86 deletions
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 2fc9598401cc..08aae0878d93 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -367,9 +367,9 @@ public: inline SwPaM* GetStackCursor() const; // start parenthesing, hide SV-Cursor and selected areas - SW_DLLPUBLIC void StartAction(); + SW_DLLPUBLIC virtual void StartAction() override; // end parenthesing, show SV-Cursor and selected areas - SW_DLLPUBLIC void EndAction( const bool bIdleEnd = false ); + SW_DLLPUBLIC virtual void EndAction(const bool bIdleEnd = false) override; // basic cursor travelling tools::Long GetUpDownX() const { return m_nUpDownX; } diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index 5a16812e89da..9d3a54c076b9 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -616,10 +616,6 @@ public: SW_DLLPUBLIC void Redo(sal_uInt16 const nCount = 1); void Repeat(sal_uInt16 const nCount); - /// For all views of this document. - SW_DLLPUBLIC void StartAllAction(); - SW_DLLPUBLIC void EndAllAction(); - /// To enable set up of StartActions and EndActions. SW_DLLPUBLIC virtual void CalcLayout() override; diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index e438a891490f..b75ff5009d83 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -219,14 +219,18 @@ public: void InitPrt( OutputDevice *pOutDev ); // Bracketing of actions belonging together. - inline void StartAction(); + virtual void StartAction(); SW_DLLPUBLIC void ImplStartAction(); - inline void EndAction( const bool bIdleEnd = false ); + virtual void EndAction(const bool bIdleEnd = false); SW_DLLPUBLIC void ImplEndAction( const bool bIdleEnd ); sal_uInt16 ActionCount() const { return mnStartAction; } bool ActionPend() const { return mnStartAction != 0; } bool IsInEndAction() const { return mbInEndAction; } + /// For all views of this document. + SW_DLLPUBLIC void StartAllAction(); + SW_DLLPUBLIC void EndAllAction(); + // The ActionCount for all Shells is temporarily set to zero and then // restored at the RootFrame via UNO. void SetRestoreActions(sal_uInt16 nSet); @@ -638,19 +642,6 @@ inline void SwViewShell::ResetInvalidRect() maInvalidRect.Clear(); } -inline void SwViewShell::StartAction() -{ - if ( !mnStartAction++ ) - ImplStartAction(); -} - -inline void SwViewShell::EndAction( const bool bIdleEnd ) -{ - if( 0 == (mnStartAction - 1) ) - ImplEndAction( bIdleEnd ); - --mnStartAction; -} - inline void SwViewShell::LockPaint(LockPaintReason eReason) { maLockPaintReasons.push_back(eReason); diff --git a/sw/source/core/edit/edws.cxx b/sw/source/core/edit/edws.cxx index 667254e4b97e..84f5d2666b9c 100644 --- a/sw/source/core/edit/edws.cxx +++ b/sw/source/core/edit/edws.cxx @@ -83,28 +83,6 @@ void SwEditShell::SetUndoNoResetModified() GetDoc()->GetIDocumentUndoRedo().SetUndoNoResetModified(); } -void SwEditShell::StartAllAction() -{ - for(SwViewShell& rCurrentShell : GetRingContainer()) - { - if (SwEditShell* pEditShell = dynamic_cast<SwEditShell*>(&rCurrentShell)) - pEditShell->StartAction(); - else - rCurrentShell.StartAction(); - } -} - -void SwEditShell::EndAllAction() -{ - for(SwViewShell& rCurrentShell : GetRingContainer()) - { - if( auto pEditShell = dynamic_cast<SwEditShell *>(&rCurrentShell)) - pEditShell->EndAction(); - else - rCurrentShell.EndAction(); - } -} - void SwEditShell::CalcLayout() { StartAllAction(); diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index b3a2ac110944..ac448193b367 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -264,6 +264,35 @@ void SwViewShell::DLPostPaint2(bool bPaintFormLayer) } // end of Pre/PostPaints +void SwViewShell::StartAllAction() +{ + for (SwViewShell & rCurrentShell : GetRingContainer()) + { + rCurrentShell.StartAction(); + } +} + +void SwViewShell::EndAllAction() +{ + for (SwViewShell & rCurrentShell : GetRingContainer()) + { + rCurrentShell.EndAction(); + } +} + +void SwViewShell::StartAction() +{ + if (!mnStartAction++) + ImplStartAction(); +} + +void SwViewShell::EndAction(const bool bIdleEnd) +{ + if (0 == (mnStartAction - 1)) + ImplEndAction(bIdleEnd); + --mnStartAction; +} + void SwViewShell::ImplEndAction( const bool bIdleEnd ) { // Nothing to do for the printer? @@ -668,9 +697,9 @@ void SwViewShell::MakeVisible( const SwRect &rRect ) tools::Long nOldH; do{ nOldH = pRoot->getFrameArea().Height(); - StartAction(); + SwViewShell::StartAction(); ScrollMDI( this, rRect, USHRT_MAX, USHRT_MAX ); - EndAction(); + SwViewShell::EndAction(); // DO NOT call virtual here! } while( nOldH != pRoot->getFrameArea().Height() && nLoopCnt-- ); } #if OSL_DEBUG_LEVEL > 0 @@ -730,18 +759,11 @@ void SwViewShell::UpdateFields(bool bCloseDB, bool bSetModified) { CurrShell aCurr( this ); - auto pCursorShell = dynamic_cast<SwCursorShell*>( this ); - if ( pCursorShell ) - pCursorShell->StartAction(); - else - StartAction(); + StartAction(); GetDoc()->getIDocumentFieldsAccess().UpdateFields(bCloseDB, bSetModified); - if ( pCursorShell ) - pCursorShell->EndAction(); - else - EndAction(); + EndAction(); } void SwViewShell::UpdateOleObjectPreviews() @@ -836,16 +858,9 @@ void SwViewShell::LayoutIdle() static void lcl_InvalidateAllContent( SwViewShell& rSh, SwInvalidateFlags nInv ) { - auto pCursorShell = dynamic_cast<SwCursorShell*>( &rSh); - if ( pCursorShell ) - pCursorShell->StartAction(); - else - rSh.StartAction(); + rSh.StartAction(); rSh.GetLayout()->InvalidateAllContent( nInv ); - if ( pCursorShell ) - pCursorShell->EndAction(); - else - rSh.EndAction(); + rSh.EndAction(); rSh.GetDoc()->getIDocumentState().SetModified(); } @@ -856,18 +871,11 @@ static void lcl_InvalidateAllContent( SwViewShell& rSh, SwInvalidateFlags nInv ) */ static void lcl_InvalidateAllObjPos( SwViewShell &_rSh ) { - auto pCursorShell = dynamic_cast<SwCursorShell*>( &_rSh); - if ( pCursorShell ) - pCursorShell->StartAction(); - else - _rSh.StartAction(); + _rSh.StartAction(); _rSh.GetLayout()->InvalidateAllObjPos(); - if ( pCursorShell ) - pCursorShell->EndAction(); - else - _rSh.EndAction(); + _rSh.EndAction(); _rSh.GetDoc()->getIDocumentState().SetModified(); } @@ -1044,14 +1052,14 @@ void SwViewShell::SetEmptyDbFieldHidesPara(bool bEmptyDbFieldHidesPara) SwWait aWait(*GetDoc()->GetDocShell(), true); rIDSA.set(DocumentSettingId::EMPTY_DB_FIELD_HIDES_PARA, bEmptyDbFieldHidesPara); - StartAction(); + SwViewShell::StartAction(); GetDoc()->getIDocumentState().SetModified(); for (auto const & pFieldType : *GetDoc()->getIDocumentFieldsAccess().GetFieldTypes()) { if(pFieldType->Which() == SwFieldIds::Database) pFieldType->UpdateFields(); } - EndAction(); + SwViewShell::EndAction(); } void SwViewShell::SetNoGapAfterNoteNumber(bool bNew) @@ -1108,9 +1116,9 @@ void SwViewShell::SetContinuousEndnotes(bool bContinuousEndnotes) { SwWait aWait(*GetDoc()->GetDocShell(), true); rIDSA.set(DocumentSettingId::CONTINUOUS_ENDNOTES, bContinuousEndnotes); - StartAction(); + SwViewShell::StartAction(); GetLayout()->RemoveFootnotes(/*pPage=*/nullptr, /*pPageOnly=*/false, /*bEndNotes=*/true); - EndAction(); + SwViewShell::EndAction(); GetDoc()->getIDocumentState().SetModified(); } } @@ -1154,9 +1162,9 @@ void SwViewShell::Reformat() if( GetLayout()->IsCallbackActionEnabled() ) { - StartAction(); + SwViewShell::StartAction(); GetLayout()->InvalidateAllContent( SwInvalidateFlags::Size | SwInvalidateFlags::Pos | SwInvalidateFlags::PrtArea ); - EndAction(); + SwViewShell::EndAction(); } } @@ -2241,7 +2249,7 @@ void SwViewShell::InvalidateLayout( bool bSizeChanged ) } LockPaint(LockPaintReason::InvalidateLayout); - StartAction(); + SwViewShell::StartAction(); SwPageFrame *pPg = static_cast<SwPageFrame*>(GetLayout()->Lower()); do @@ -2268,7 +2276,7 @@ void SwViewShell::InvalidateLayout( bool bSizeChanged ) SwFrame::CheckPageDescs( static_cast<SwPageFrame*>(GetLayout()->Lower()) ); - EndAction(); + SwViewShell::EndAction(); UnlockPaint(); } @@ -2317,7 +2325,7 @@ SfxItemPool& SwViewShell::GetAttrPool() void SwViewShell::ApplyViewOptions( const SwViewOption &rOpt ) { for(SwViewShell& rSh : GetRingContainer()) - rSh.StartAction(); + rSh.SwViewShell::StartAction(); ImplApplyViewOptions( rOpt ); @@ -2337,7 +2345,7 @@ void SwViewShell::ApplyViewOptions( const SwViewOption &rOpt ) // End of disabled multiple window for(SwViewShell& rSh : GetRingContainer()) - rSh.EndAction(); + rSh.SwViewShell::EndAction(); } static bool @@ -2525,9 +2533,9 @@ void SwViewShell::ImplApplyViewOptions( const SwViewOption &rOpt ) { // Nothing helps, we need to send all ContentFrames a // Prepare, we format anew: - StartAction(); + SwViewShell::StartAction(); Reformat(); - EndAction(); + SwViewShell::EndAction(); } if (isToggleFieldNames) @@ -2595,11 +2603,11 @@ void SwViewShell::SetReadonlyOption(bool bSet) if( bReformat ) { - StartAction(); + SwViewShell::StartAction(); Reformat(); if ( GetWin() && !comphelper::LibreOfficeKit::isActive() ) GetWin()->Invalidate(); - EndAction(); + SwViewShell::EndAction(); } else if ( GetWin() && !comphelper::LibreOfficeKit::isActive() ) GetWin()->Invalidate(); |