diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-12-06 16:26:01 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-12-07 01:09:04 -0500 |
commit | 1b6e9f9dfc538841a873774428628124cbdc4fd8 (patch) | |
tree | bcb3c09914c81696b21cc7d69be755123e209733 | |
parent | c0533a4694e63959bc198dfb190511a223d521c0 (diff) |
Pimplize SfxUndoActions.
Change-Id: I35ef457111f4cf8b811a4ee8bb676421746e1d9d
-rw-r--r-- | include/svl/undo.hxx | 37 | ||||
-rw-r--r-- | svl/source/undo/undo.cxx | 54 |
2 files changed, 66 insertions, 25 deletions
diff --git a/include/svl/undo.hxx b/include/svl/undo.hxx index f18ae84863e9..5aed21a5e189 100644 --- a/include/svl/undo.hxx +++ b/include/svl/undo.hxx @@ -99,38 +99,25 @@ struct MarkedUndoAction class SfxUndoActions { -private: - ::std::vector< MarkedUndoAction > m_aActions; + struct Impl; + Impl* mpImpl; public: - SfxUndoActions() - { - } + SfxUndoActions(); + SfxUndoActions( const SfxUndoActions& r ); + ~SfxUndoActions(); - bool empty() const { return m_aActions.empty(); } - size_t size() const { return m_aActions.size(); } + bool empty() const; + size_t size() const; - const MarkedUndoAction& operator[]( size_t i ) const { return m_aActions[i]; } - MarkedUndoAction& operator[]( size_t i ) { return m_aActions[i]; } + const MarkedUndoAction& operator[]( size_t i ) const; + MarkedUndoAction& operator[]( size_t i ); - void Remove( size_t i_pos ) - { - m_aActions.erase( m_aActions.begin() + i_pos ); - } - - void Remove( size_t i_pos, size_t i_count ) - { - m_aActions.erase( m_aActions.begin() + i_pos, m_aActions.begin() + i_pos + i_count ); - } - - void Insert( SfxUndoAction* i_action, size_t i_pos ) - { - m_aActions.insert( m_aActions.begin() + i_pos, MarkedUndoAction( i_action ) ); - } + 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 ); }; - - /** do not make use of these implementation details, unless you really really have to! */ struct SVL_DLLPUBLIC SfxUndoArray diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx index f3f855c55968..514e842d765f 100644 --- a/svl/source/undo/undo.cxx +++ b/svl/source/undo/undo.cxx @@ -135,6 +135,60 @@ bool SfxUndoAction::CanRepeat(SfxRepeatTarget&) const return true; } +struct SfxUndoActions::Impl +{ + std::vector<MarkedUndoAction> maActions; +}; + +SfxUndoActions::SfxUndoActions() : mpImpl(new Impl) {} + +SfxUndoActions::SfxUndoActions( const SfxUndoActions& r ) : + mpImpl(new Impl) +{ + mpImpl->maActions = r.mpImpl->maActions; +} + +SfxUndoActions::~SfxUndoActions() +{ + delete mpImpl; +} + +bool SfxUndoActions::empty() const +{ + return mpImpl->maActions.empty(); +} + +size_t SfxUndoActions::size() const +{ + return mpImpl->maActions.size(); +} + +const MarkedUndoAction& SfxUndoActions::operator[]( size_t i ) const +{ + return mpImpl->maActions[i]; +} + +MarkedUndoAction& SfxUndoActions::operator[]( size_t i ) +{ + return mpImpl->maActions[i]; +} + +void SfxUndoActions::Remove( size_t i_pos ) +{ + mpImpl->maActions.erase( mpImpl->maActions.begin() + i_pos ); +} + +void SfxUndoActions::Remove( size_t i_pos, size_t i_count ) +{ + mpImpl->maActions.erase( + mpImpl->maActions.begin() + i_pos, mpImpl->maActions.begin() + i_pos + i_count); +} + +void SfxUndoActions::Insert( SfxUndoAction* i_action, size_t i_pos ) +{ + mpImpl->maActions.insert( + mpImpl->maActions.begin() + i_pos, MarkedUndoAction( i_action ) ); +} typedef ::std::vector< SfxUndoListener* > UndoListeners; |