diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-12-07 01:07:02 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-12-07 01:09:05 -0500 |
commit | 9dd8413a61301305d1bafacc5d3511cf3c3129e2 (patch) | |
tree | f508e8ad890789445ca29dbd86316ff4ecaebe6d | |
parent | f28ee9e4004ebf51332a998638aea779e07f6450 (diff) |
Forward-declare MarkedUndoAction.
Change-Id: I1c36077cada47bacfb8436cf3fb659e47d02da60
-rw-r--r-- | include/svl/undo.hxx | 22 | ||||
-rw-r--r-- | include/svx/svddrag.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/inc/sdundogr.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/outlview.cxx | 14 | ||||
-rw-r--r-- | svl/source/undo/undo.cxx | 22 | ||||
-rw-r--r-- | sw/source/core/docnode/nodedump.cxx | 2 |
6 files changed, 39 insertions, 25 deletions
diff --git a/include/svl/undo.hxx b/include/svl/undo.hxx index d63a69b950f7..24fcbbc60110 100644 --- a/include/svl/undo.hxx +++ b/include/svl/undo.hxx @@ -25,10 +25,9 @@ #include <boost/scoped_ptr.hpp> -#include <vector> #include <limits> - +struct MarkedUndoAction; class SVL_DLLPUBLIC SfxRepeatTarget { @@ -84,21 +83,7 @@ private: typedef sal_Int32 UndoStackMark; #define MARK_INVALID ::std::numeric_limits< UndoStackMark >::max() - - -struct MarkedUndoAction -{ - SfxUndoAction* pAction; - ::std::vector< UndoStackMark > aMarks; - - MarkedUndoAction( SfxUndoAction* i_action ) - :pAction( i_action ) - ,aMarks() - { - } -}; - -class SfxUndoActions +class SVL_DLLPUBLIC SfxUndoActions { struct Impl; Impl* mpImpl; @@ -114,6 +99,9 @@ public: const MarkedUndoAction& operator[]( size_t i ) const; MarkedUndoAction& operator[]( size_t i ); + const SfxUndoAction* GetUndoAction( size_t i ) const; + SfxUndoAction* GetUndoAction( size_t i ); + void Remove( size_t i_pos ); void Remove( size_t i_pos, size_t i_count ); void Insert( SfxUndoAction* i_action, size_t i_pos ); diff --git a/include/svx/svddrag.hxx b/include/svx/svddrag.hxx index fd43db2bf1d7..b622999d889f 100644 --- a/include/svx/svddrag.hxx +++ b/include/svx/svddrag.hxx @@ -25,6 +25,8 @@ #include <tools/fract.hxx> #include <svx/svxdllapi.h> +#include <vector> + // Status information for specialized object dragging. In order for the model // to stay status free, the status data is kept on the View // and handed over to the object at the appropriate time as a parameter. diff --git a/sd/source/ui/inc/sdundogr.hxx b/sd/source/ui/inc/sdundogr.hxx index efb4a2a63dee..47ae4694a04e 100644 --- a/sd/source/ui/inc/sdundogr.hxx +++ b/sd/source/ui/inc/sdundogr.hxx @@ -24,6 +24,8 @@ #include "sdundo.hxx" #include "sddllapi.h" +#include <vector> + class SD_DLLPUBLIC SdUndoGroup : public SdUndoAction { std::vector<SdUndoAction*> aCtn; diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx index c901efb10601..fa50067bfe32 100644 --- a/sd/source/ui/view/outlview.cxx +++ b/sd/source/ui/view/outlview.cxx @@ -1590,7 +1590,7 @@ void OutlineView::TryToMergeUndoActions() EditUndo* pEditUndo = 0; while( !pEditUndo && nAction ) { - pEditUndo = dynamic_cast< EditUndo* >(pListAction->aUndoActions[--nAction].pAction); + pEditUndo = dynamic_cast< EditUndo* >(pListAction->aUndoActions.GetUndoAction(--nAction)); } sal_uInt16 nEditPos = nAction; // we need this later to remove the merged undo actions @@ -1598,7 +1598,7 @@ void OutlineView::TryToMergeUndoActions() // make sure it is the only EditUndo action in the top undo list while( pEditUndo && nAction ) { - if( dynamic_cast< EditUndo* >(pListAction->aUndoActions[--nAction].pAction) ) + if( dynamic_cast< EditUndo* >(pListAction->aUndoActions.GetUndoAction(--nAction)) ) pEditUndo = 0; } @@ -1610,7 +1610,7 @@ void OutlineView::TryToMergeUndoActions() nAction = pPrevListAction->aUndoActions.size(); EditUndo* pPrevEditUndo = 0; while( !pPrevEditUndo && nAction ) - pPrevEditUndo = dynamic_cast< EditUndo* >(pPrevListAction->aUndoActions[--nAction].pAction); + pPrevEditUndo = dynamic_cast< EditUndo* >(pPrevListAction->aUndoActions.GetUndoAction(--nAction)); if( pPrevEditUndo && pPrevEditUndo->Merge( pEditUndo ) ) { @@ -1627,14 +1627,14 @@ void OutlineView::TryToMergeUndoActions() ::svl::IUndoManager* pDocUndoManager = mpDocSh->GetUndoManager(); if( pDocUndoManager && ( pListAction->aUndoActions.size() == 1 )) { - SfxLinkUndoAction* pLinkAction = dynamic_cast< SfxLinkUndoAction* >( pListAction->aUndoActions[0].pAction ); + SfxLinkUndoAction* pLinkAction = dynamic_cast< SfxLinkUndoAction* >( pListAction->aUndoActions.GetUndoAction(0) ); SfxLinkUndoAction* pPrevLinkAction = 0; if( pLinkAction ) { nAction = pPrevListAction->aUndoActions.size(); while( !pPrevLinkAction && nAction ) - pPrevLinkAction = dynamic_cast< SfxLinkUndoAction* >(pPrevListAction->aUndoActions[--nAction].pAction); + pPrevLinkAction = dynamic_cast< SfxLinkUndoAction* >(pPrevListAction->aUndoActions.GetUndoAction(--nAction)); } if( pLinkAction && pPrevLinkAction && @@ -1650,7 +1650,7 @@ void OutlineView::TryToMergeUndoActions() sal_uInt16 nDestAction = pDestinationList->aUndoActions.size(); while( nCount-- ) { - SfxUndoAction* pTemp = pSourceList->aUndoActions[0].pAction; + SfxUndoAction* pTemp = pSourceList->aUndoActions.GetUndoAction(0); pSourceList->aUndoActions.Remove(0); pDestinationList->aUndoActions.Insert( pTemp, nDestAction++ ); } @@ -1673,7 +1673,7 @@ void OutlineView::TryToMergeUndoActions() size_t nDestAction = pPrevListAction->aUndoActions.size(); while( nCount-- ) { - SfxUndoAction* pTemp = pListAction->aUndoActions[0].pAction; + SfxUndoAction* pTemp = pListAction->aUndoActions.GetUndoAction(0); pListAction->aUndoActions.Remove(0); if( pTemp ) pPrevListAction->aUndoActions.Insert( pTemp, nDestAction++ ); diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx index 011bd17e7103..772dd43af580 100644 --- a/svl/source/undo/undo.cxx +++ b/svl/source/undo/undo.cxx @@ -135,6 +135,18 @@ bool SfxUndoAction::CanRepeat(SfxRepeatTarget&) const return true; } +struct MarkedUndoAction +{ + SfxUndoAction* pAction; + ::std::vector< UndoStackMark > aMarks; + + MarkedUndoAction( SfxUndoAction* i_action ) + :pAction( i_action ) + ,aMarks() + { + } +}; + struct SfxUndoActions::Impl { std::vector<MarkedUndoAction> maActions; @@ -173,6 +185,16 @@ MarkedUndoAction& SfxUndoActions::operator[]( size_t i ) return mpImpl->maActions[i]; } +const SfxUndoAction* SfxUndoActions::GetUndoAction( size_t i ) const +{ + return mpImpl->maActions[i].pAction; +} + +SfxUndoAction* SfxUndoActions::GetUndoAction( size_t i ) +{ + return mpImpl->maActions[i].pAction; +} + void SfxUndoActions::Remove( size_t i_pos ) { mpImpl->maActions.erase( mpImpl->maActions.begin() + i_pos ); diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx index 6007a3fec151..f0be0e27f263 100644 --- a/sw/source/core/docnode/nodedump.cxx +++ b/sw/source/core/docnode/nodedump.cxx @@ -1024,7 +1024,7 @@ void lcl_dumpSfxUndoAction(WriterHelper& writer, SfxUndoAction* pAction) writer.startElement("list"); writer.writeFormatAttribute("size", TMP_FORMAT, pList->aUndoActions.size()); for (size_t i = 0; i < pList->aUndoActions.size(); ++i) - lcl_dumpSfxUndoAction(writer, pList->aUndoActions[i].pAction); + lcl_dumpSfxUndoAction(writer, pList->aUndoActions.GetUndoAction(i)); writer.endElement(); } |