Apache OpenOffice (AOO) Bugzilla – Issue 114888
simplify Undo by using an UndoSuppressor class
Last modified: 2011-02-08 13:07:56 UTC
There is the idea: namespace sw { namespace undo { class UndoSuppresor { public: UndoSuppresor(IDocumentUndoRedo* io_pUndoRedo) : m_pUndoRedo(io_pUndoRedo) , m_bOldState(io_pUndoRedo->DoesUndo()) { m_pUndoRedo->DoUndo(false); }; ~UndoSuppresor() { m_pUndoRedo->DoUndo(m_bOldState); }; private: IDocumentUndoRedo* const m_pUndoRedo; const bool m_bOldState; } instead of writing: BOOL bUndo = pDoc->DoesUndo(); pDoc->DoUndo(false); ... something ... pDoc->DoUndo(bUndo); one would write: { UndoSuppresor(p_Doc); ... something ... }
reassigning to mst, he would steal the issue from me if I wouldnt anyway ...
fixed in CWS undoapi. there is a UndoGuard, GroupUndoGuard and DrawUndoGuard.
.