Kaydet (Commit) 1b6e9f9d authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Pimplize SfxUndoActions.

Change-Id: I35ef457111f4cf8b811a4ee8bb676421746e1d9d
üst c0533a46
...@@ -99,38 +99,25 @@ struct MarkedUndoAction ...@@ -99,38 +99,25 @@ struct MarkedUndoAction
class SfxUndoActions class SfxUndoActions
{ {
private: struct Impl;
::std::vector< MarkedUndoAction > m_aActions; Impl* mpImpl;
public: public:
SfxUndoActions() SfxUndoActions();
{ SfxUndoActions( const SfxUndoActions& r );
} ~SfxUndoActions();
bool empty() const { return m_aActions.empty(); } bool empty() const;
size_t size() const { return m_aActions.size(); } size_t size() const;
const MarkedUndoAction& operator[]( size_t i ) const { return m_aActions[i]; } const MarkedUndoAction& operator[]( size_t i ) const;
MarkedUndoAction& operator[]( size_t i ) { return m_aActions[i]; } MarkedUndoAction& operator[]( size_t i );
void Remove( size_t i_pos ) void Remove( size_t i_pos );
{ void Remove( size_t i_pos, size_t i_count );
m_aActions.erase( m_aActions.begin() + i_pos ); void Insert( SfxUndoAction* i_action, size_t 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 ) );
}
}; };
/** do not make use of these implementation details, unless you /** do not make use of these implementation details, unless you
really really have to! */ really really have to! */
struct SVL_DLLPUBLIC SfxUndoArray struct SVL_DLLPUBLIC SfxUndoArray
......
...@@ -135,6 +135,60 @@ bool SfxUndoAction::CanRepeat(SfxRepeatTarget&) const ...@@ -135,6 +135,60 @@ bool SfxUndoAction::CanRepeat(SfxRepeatTarget&) const
return true; 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; typedef ::std::vector< SfxUndoListener* > UndoListeners;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment