diff options
author | Noel Grandin <noel@peralex.com> | 2016-05-27 14:07:12 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-05-30 06:34:32 +0000 |
commit | 3e9e667af2d8d307844b29d608b377a04b6bb139 (patch) | |
tree | f08ebf65eff11bdaae295b17af86fb8558ca0552 | |
parent | 12868914a39b0e8fb32f63d1307c1bb1c535fb9c (diff) |
loplugin:unusedmethods SfxLinkUndoAction
Change-Id: I1ad7c2452dd9bc80e7404f41484b9667adbcfa7b
Reviewed-on: https://gerrit.libreoffice.org/25542
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r-- | include/svl/undo.hxx | 51 | ||||
-rw-r--r-- | sc/source/ui/inc/undobase.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/inc/undodraw.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/undo/undobase.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/undo/undodraw.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/view/outlview.cxx | 41 | ||||
-rw-r--r-- | svl/source/undo/undo.cxx | 102 |
7 files changed, 0 insertions, 214 deletions
diff --git a/include/svl/undo.hxx b/include/svl/undo.hxx index 72cb5023865a..8c54c08d4309 100644 --- a/include/svl/undo.hxx +++ b/include/svl/undo.hxx @@ -41,19 +41,12 @@ public: }; -class SfxLinkUndoAction; - class SVL_DLLPUBLIC SfxUndoAction { -private: - SfxLinkUndoAction* mpSfxLinkUndoAction; - public: SfxUndoAction(); virtual ~SfxUndoAction(); - virtual void SetLinkToSfxLinkUndoAction(SfxLinkUndoAction* pSfxLinkUndoAction); - virtual void Undo(); virtual void UndoWithContext( SfxUndoContext& i_context ); virtual void Redo(); @@ -299,8 +292,6 @@ namespace svl { namespace undo { namespace impl struct SfxUndoManager_Data; class SVL_DLLPUBLIC SfxUndoManager : public ::svl::IUndoManager { - friend class SfxLinkUndoAction; - std::unique_ptr< SfxUndoManager_Data > m_xData; public: @@ -392,48 +383,6 @@ private: friend class ::svl::undo::impl::LockGuard; }; - -class SVL_DLLPUBLIC SfxLinkUndoAction : public SfxUndoAction - -/* [Explanation] - - SfxLinkUndoAction is used to link two SfxUndoManager. The Undo/Redos inserted - in the first SfxUndoManager redirect their Undo/Redo to the second. With this it - does not matter, if the undo/redo initially was on the first or the second. - - After inserting SfxLinkUndoAction on the first SfxUndoManager, you have to - insert it on the second as well. While the second SfxUndoManager is steered - from the first, you must not insert neither Actions nor issue a undo/redo - command to the second, while it is steered by the first. -*/ - -{ -private: - friend class SfxUndoAction; - void LinkedSfxUndoActionDestructed(const SfxUndoAction& rCandidate); - -public: - SfxLinkUndoAction(::svl::IUndoManager *pManager); - virtual ~SfxLinkUndoAction(); - - virtual void Undo() override; - virtual void Redo() override; - virtual bool CanRepeat(SfxRepeatTarget& r) const override; - - virtual void Repeat(SfxRepeatTarget&r) override; - - virtual OUString GetComment() const override; - virtual OUString GetRepeatComment(SfxRepeatTarget&r) const override; - virtual sal_uInt16 GetId() const override; - - SfxUndoAction* GetAction() const { return pAction; } - -protected: - ::svl::IUndoManager* pUndoManager; - SfxUndoAction* pAction; - -}; - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/undobase.hxx b/sc/source/ui/inc/undobase.hxx index 192f47e077a0..95fed6c2d475 100644 --- a/sc/source/ui/inc/undobase.hxx +++ b/sc/source/ui/inc/undobase.hxx @@ -172,8 +172,6 @@ public: SfxUndoAction* GetWrappedUndo() { return pWrappedUndo; } void ForgetWrappedUndo(); - virtual void SetLinkToSfxLinkUndoAction(SfxLinkUndoAction* pSfxLinkUndoAction) override; - virtual void Undo() override; virtual void Redo() override; virtual void Repeat(SfxRepeatTarget& rTarget) override; diff --git a/sc/source/ui/inc/undodraw.hxx b/sc/source/ui/inc/undodraw.hxx index 103b01514609..1572abd857d0 100644 --- a/sc/source/ui/inc/undodraw.hxx +++ b/sc/source/ui/inc/undodraw.hxx @@ -38,8 +38,6 @@ public: SfxUndoAction* GetDrawUndo() { return pDrawUndo; } void ForgetDrawUndo(); - virtual void SetLinkToSfxLinkUndoAction(SfxLinkUndoAction* pSfxLinkUndoAction) override; - virtual void Undo() override; virtual void Redo() override; virtual void Repeat(SfxRepeatTarget& rTarget) override; diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx index 792cde5a05a2..b5a7e694c553 100644 --- a/sc/source/ui/undo/undobase.cxx +++ b/sc/source/ui/undo/undobase.cxx @@ -598,14 +598,6 @@ sal_uInt16 ScUndoWrapper::GetId() const return 0; } -void ScUndoWrapper::SetLinkToSfxLinkUndoAction(SfxLinkUndoAction* pSfxLinkUndoAction) -{ - if (pWrappedUndo) - pWrappedUndo->SetLinkToSfxLinkUndoAction(pSfxLinkUndoAction); - else - SetLinkToSfxLinkUndoAction(pSfxLinkUndoAction); -} - bool ScUndoWrapper::Merge( SfxUndoAction* pNextAction ) { if (pWrappedUndo) diff --git a/sc/source/ui/undo/undodraw.cxx b/sc/source/ui/undo/undodraw.cxx index 5645afb09406..89359ffbc6b1 100644 --- a/sc/source/ui/undo/undodraw.cxx +++ b/sc/source/ui/undo/undodraw.cxx @@ -62,14 +62,6 @@ sal_uInt16 ScUndoDraw::GetId() const return 0; } -void ScUndoDraw::SetLinkToSfxLinkUndoAction(SfxLinkUndoAction* pSfxLinkUndoAction) -{ - if (pDrawUndo) - pDrawUndo->SetLinkToSfxLinkUndoAction(pSfxLinkUndoAction); - else - SetLinkToSfxLinkUndoAction(pSfxLinkUndoAction); -} - bool ScUndoDraw::Merge( SfxUndoAction* pNextAction ) { if (pDrawUndo) diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx index 94fac3d302a3..7b184a29b38c 100644 --- a/sd/source/ui/view/outlview.cxx +++ b/sd/source/ui/view/outlview.cxx @@ -1568,47 +1568,6 @@ void OutlineView::TryToMergeUndoActions() pListAction->aUndoActions.Remove(nEditPos); delete pEditUndo; - // now check if we also can merge the draw undo actions - ::svl::IUndoManager* pDocUndoManager = mpDocSh->GetUndoManager(); - if( pDocUndoManager && ( pListAction->aUndoActions.size() == 1 )) - { - SfxLinkUndoAction* pLinkAction = dynamic_cast< SfxLinkUndoAction* >( pListAction->aUndoActions.GetUndoAction(0) ); - SfxLinkUndoAction* pPrevLinkAction = nullptr; - - if( pLinkAction ) - { - nAction = pPrevListAction->aUndoActions.size(); - while( !pPrevLinkAction && nAction ) - pPrevLinkAction = dynamic_cast< SfxLinkUndoAction* >(pPrevListAction->aUndoActions.GetUndoAction(--nAction)); - } - - if( pLinkAction && pPrevLinkAction && - ( pLinkAction->GetAction() == pDocUndoManager->GetUndoAction() ) && - ( pPrevLinkAction->GetAction() == pDocUndoManager->GetUndoAction(1) ) ) - { - SfxListUndoAction* pSourceList = dynamic_cast< SfxListUndoAction* >(pLinkAction->GetAction()); - SfxListUndoAction* pDestinationList = dynamic_cast< SfxListUndoAction* >(pPrevLinkAction->GetAction()); - - if( pSourceList && pDestinationList ) - { - sal_uInt16 nCount = pSourceList->aUndoActions.size(); - sal_uInt16 nDestAction = pDestinationList->aUndoActions.size(); - while( nCount-- ) - { - SfxUndoAction* pTemp = pSourceList->aUndoActions.GetUndoAction(0); - pSourceList->aUndoActions.Remove(0); - pDestinationList->aUndoActions.Insert( pTemp, nDestAction++ ); - } - pDestinationList->nCurUndoAction = pDestinationList->aUndoActions.size(); - - pListAction->aUndoActions.Remove(0); - delete pLinkAction; - - pDocUndoManager->RemoveLastUndoAction(); - } - } - } - if ( !pListAction->aUndoActions.empty() ) { // now we have to move all remaining doc undo actions from the top undo diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx index 58320a1e2744..57d654d92f77 100644 --- a/svl/source/undo/undo.cxx +++ b/svl/source/undo/undo.cxx @@ -45,24 +45,12 @@ SfxUndoContext::~SfxUndoContext() } -void SfxUndoAction::SetLinkToSfxLinkUndoAction(SfxLinkUndoAction* pSfxLinkUndoAction) -{ - mpSfxLinkUndoAction = pSfxLinkUndoAction; -} - - SfxUndoAction::~SfxUndoAction() { - if(mpSfxLinkUndoAction) - { - mpSfxLinkUndoAction->LinkedSfxUndoActionDestructed(*this); - mpSfxLinkUndoAction = nullptr; - } } SfxUndoAction::SfxUndoAction() -: mpSfxLinkUndoAction(nullptr) { } @@ -1396,90 +1384,6 @@ void SfxListUndoAction::dumpAsXml(xmlTextWriterPtr pWriter) const xmlTextWriterEndElement(pWriter); } -/** - * Creates a LinkAction which points to another UndoManager. - * Gets that UndoManagers current Action and sets it as that UndoManager's - * associated Action. - */ -SfxLinkUndoAction::SfxLinkUndoAction(::svl::IUndoManager *pManager) -{ - pUndoManager = pManager; - SfxUndoManager* pUndoManagerImplementation = dynamic_cast< SfxUndoManager* >( pManager ); - ENSURE_OR_THROW( pUndoManagerImplementation != nullptr, "unsupported undo manager implementation!" ); - - // yes, this cast is dirty. But reaching into the SfxUndoManager's implementation, - // directly accessing its internal stack, and tampering with an action on that stack - // is dirty, too. - if ( pManager->GetMaxUndoActionCount() ) - { - size_t nPos = pManager->GetUndoActionCount()-1; - pAction = pUndoManagerImplementation->m_xData->pActUndoArray->aUndoActions[nPos].pAction; - pAction->SetLinkToSfxLinkUndoAction(this); - } - else - pAction = nullptr; -} - - -void SfxLinkUndoAction::Undo() -{ - if ( pAction ) - pUndoManager->Undo(); -} - - -void SfxLinkUndoAction::Redo() -{ - if ( pAction ) - pUndoManager->Redo(); -} - - -bool SfxLinkUndoAction::CanRepeat(SfxRepeatTarget& r) const -{ - return pAction && pAction->CanRepeat(r); -} - - -void SfxLinkUndoAction::Repeat(SfxRepeatTarget&r) -{ - if ( pAction && pAction->CanRepeat( r ) ) - pAction->Repeat( r ); -} - - -OUString SfxLinkUndoAction::GetComment() const -{ - if ( pAction ) - return pAction->GetComment(); - return OUString(); -} - - -OUString SfxLinkUndoAction::GetRepeatComment(SfxRepeatTarget&r) const -{ - if ( pAction ) - return pAction->GetRepeatComment(r); - return OUString(); -} - - -SfxLinkUndoAction::~SfxLinkUndoAction() -{ - if( pAction ) - pAction->SetLinkToSfxLinkUndoAction(nullptr); -} - - -void SfxLinkUndoAction::LinkedSfxUndoActionDestructed(const SfxUndoAction& rCandidate) -{ - assert(nullptr != pAction); - assert(pAction == &rCandidate && "Oops, the destroyed and linked UndoActions differ (!)"); - (void)rCandidate; - pAction = nullptr; -} - - SfxUndoArray::~SfxUndoArray() { while ( !aUndoActions.empty() ) @@ -1490,10 +1394,4 @@ SfxUndoArray::~SfxUndoArray() } } - -sal_uInt16 SfxLinkUndoAction::GetId() const -{ - return pAction ? pAction->GetId() : 0; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |