diff options
Diffstat (limited to 'sw')
102 files changed, 1419 insertions, 1352 deletions
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 33233d11d6a5..55a1225b6e10 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -34,7 +34,6 @@ #include <IDocumentDeviceAccess.hxx> #include <IDocumentMarkAccess.hxx> #include <IDocumentRedlineAccess.hxx> -#include <IDocumentUndoRedo.hxx> #include <IDocumentLinksAdministration.hxx> #include <IDocumentFieldsAccess.hxx> #include <IDocumentContentOperations.hxx> @@ -188,9 +187,6 @@ class SwTextBlocks; class SwTxtFmtColl; class SwTxtFmtColls; class SwURLStateChanged; -class SwUndo; -class SwUndoIds; -class SwUndoIter; class SwUnoCrsr; class SwUnoCrsrTbl; class ViewShell; @@ -220,6 +216,7 @@ class SwPrintData; class SwRenderData; class SwPageFrm; class SwViewOption; +class IDocumentUndoRedo; namespace sw { namespace mark { class MarkManager; @@ -262,7 +259,6 @@ class SW_DLLPUBLIC SwDoc : public IDocumentSettingAccess, public IDocumentDeviceAccess, public IDocumentRedlineAccess, - public IDocumentUndoRedo, public IDocumentLinksAdministration, public IDocumentFieldsAccess, public IDocumentContentOperations, @@ -800,32 +796,9 @@ public: /** IDocumentUndoRedo */ - virtual void SetUndoNoResetModified(); - virtual bool IsUndoNoResetModified() const; - virtual void DoUndo(bool bUn); - virtual bool DoesUndo() const; - virtual void DoGroupUndo(bool bUn); - virtual bool DoesGroupUndo() const; - virtual bool Undo(SwUndoIter& ); - virtual SwUndoId StartUndo(SwUndoId eUndoId, const SwRewriter * pRewriter); - virtual SwUndoId EndUndo(SwUndoId eUndoId, const SwRewriter * pRewriter); - virtual void DelAllUndoObj(); - virtual SwUndoId GetUndoIds(String* pStr, SwUndoIds *pUndoIds) const; - virtual String GetUndoIdsStr(String* pStr, SwUndoIds *pUndoIds) const; - virtual bool HasUndoId(SwUndoId eId) const; - virtual const SwNodes* GetUndoNds() const; - virtual SwUndo* RemoveLastUndo(SwUndoId eUndoId); - virtual bool HasTooManyUndos() const; - virtual bool Redo(SwUndoIter&); - virtual SwUndoId GetRedoIds(String* pStr, SwUndoIds *pRedoIds) const; - virtual String GetRedoIdsStr(String* pStr, SwUndoIds *pRedoIds) const; - virtual bool Repeat(SwUndoIter&, sal_uInt16 nRepeatCnt); - virtual SwUndoId GetRepeatIds(String* pStr, SwUndoIds *pRedoIds) const; - virtual String GetRepeatIdsStr(String* pStr, SwUndoIds *pRedoIds) const; - virtual void AppendUndo(SwUndo*); - virtual void ClearRedo(); - virtual void setUndoNoModifiedPosition( SwUndoNoModifiedPosition ); - virtual SwUndoNoModifiedPosition getUndoNoModifiedPosition() const; + IDocumentUndoRedo & GetIDocumentUndoRedo(); + IDocumentUndoRedo const& GetIDocumentUndoRedo() const; + virtual SwNodes const* GetUndoNds() const; /** abfragen/setzen der Anzahl von wiederherstellbaren Undo-Actions */ static sal_uInt16 GetUndoActionCount(); diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx index 11060352b6c3..f5b65e2021c1 100644 --- a/sw/source/core/crsr/bookmrk.cxx +++ b/sw/source/core/crsr/bookmrk.cxx @@ -31,6 +31,7 @@ #include <bookmrk.hxx> #include <IDocumentMarkAccess.hxx> +#include <IDocumentUndoRedo.hxx> #include <doc.hxx> #include <errhdl.hxx> #include <ndtxt.hxx> @@ -85,7 +86,7 @@ namespace const sal_Unicode ch_end=pEndTxtNode->GetTxt().GetChar(rEnd.nContent.GetIndex()-1); SwPaM aStartPaM(rStart); SwPaM aEndPaM(rEnd); - io_pDoc->StartUndo(UNDO_UI_REPLACE, NULL); + io_pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_UI_REPLACE, NULL); if(ch_start != aStartMark) { io_pDoc->InsertString(aStartPaM, aStartMark); @@ -94,7 +95,7 @@ namespace { io_pDoc->InsertString(aEndPaM, aEndMark); } - io_pDoc->EndUndo(UNDO_UI_REPLACE, NULL); + io_pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_UI_REPLACE, NULL); }; } @@ -231,10 +232,11 @@ namespace sw { namespace mark void Bookmark::InitDoc(SwDoc* const io_pDoc) { - if(io_pDoc->DoesUndo()) + if (io_pDoc->GetIDocumentUndoRedo().DoesUndo()) { - io_pDoc->ClearRedo(); - io_pDoc->AppendUndo(new SwUndoInsBookmark(*this)); + io_pDoc->GetIDocumentUndoRedo().ClearRedo(); + io_pDoc->GetIDocumentUndoRedo().AppendUndo( + new SwUndoInsBookmark(*this)); } io_pDoc->SetModified(); } diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index e16207f03fa0..2b8a7ba91bdf 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -37,6 +37,7 @@ #include <svx/svdobj.hxx> #include <crsrsh.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <pagefrm.hxx> #include <cntfrm.hxx> #include <rootfrm.hxx> @@ -1705,7 +1706,8 @@ BOOL SwCrsrShell::GetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode, SET_CURR_SHELL( this ); BOOL bRet = FALSE; - if( !IsTableMode() && !HasSelection() && GetDoc()->DoesUndo() ) + if (!IsTableMode() && !HasSelection() + && GetDoc()->GetIDocumentUndoRedo().DoesUndo()) { Point aPt( rPt ); SwPosition aPos( *pCurCrsr->GetPoint() ); @@ -1730,7 +1732,8 @@ BOOL SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode ) SET_CURR_SHELL( this ); BOOL bRet = FALSE; - if( !IsTableMode() && !HasSelection() && GetDoc()->DoesUndo() ) + if (!IsTableMode() && !HasSelection() + && GetDoc()->GetIDocumentUndoRedo().DoesUndo()) { Point aPt( rPt ); SwPosition aPos( *pCurCrsr->GetPoint() ); @@ -1754,7 +1757,7 @@ BOOL SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode ) pCNd && pCNd->Len() ) nUndoId = UNDO_EMPTY; - GetDoc()->StartUndo( nUndoId, NULL ); + GetDoc()->GetIDocumentUndoRedo().StartUndo( nUndoId, NULL ); SwTxtFmtColl* pNextFmt = 0; SwTxtNode* pTNd = pCNd->GetTxtNode(); @@ -1860,7 +1863,7 @@ BOOL SwCrsrShell::SetShadowCrsrPos( const Point& rPt, SwFillMode eFillMode ) break; } - GetDoc()->EndUndo( nUndoId, NULL ); + GetDoc()->GetIDocumentUndoRedo().EndUndo( nUndoId, NULL ); EndAction(); bRet = TRUE; diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx index be581b17735d..96fdd9dfa0a1 100644 --- a/sw/source/core/crsr/findattr.cxx +++ b/sw/source/core/crsr/findattr.cxx @@ -45,6 +45,7 @@ #include <fchrfmt.hxx> #include <charfmt.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <swcrsr.hxx> #include <editsh.hxx> #include <ndtxt.hxx> @@ -1287,9 +1288,11 @@ ULONG SwCursor::Find( const SfxItemSet& rSet, BOOL bNoCollections, BOOL bReplace = ( pSearchOpt && ( pSearchOpt->replaceString.getLength() || !rSet.Count() ) ) || (pReplSet && pReplSet->Count()); - BOOL bSttUndo = pDoc->DoesUndo() && bReplace; - if( bSttUndo ) - pDoc->StartUndo( UNDO_REPLACE, NULL ); + bool const bStartUndo = pDoc->GetIDocumentUndoRedo().DoesUndo() && bReplace; + if (bStartUndo) + { + pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_REPLACE, NULL ); + } SwFindParaAttr aSwFindParaAttr( rSet, bNoCollections, pSearchOpt, pReplSet, *this ); @@ -1299,8 +1302,10 @@ ULONG SwCursor::Find( const SfxItemSet& rSet, BOOL bNoCollections, if( nRet && bReplace ) pDoc->SetModified(); - if( bSttUndo ) - pDoc->EndUndo( UNDO_REPLACE, NULL ); + if (bStartUndo) + { + pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_REPLACE, NULL ); + } return nRet; } diff --git a/sw/source/core/crsr/findcoll.cxx b/sw/source/core/crsr/findcoll.cxx index 4bb594ceb4ca..53b0ae54549e 100644 --- a/sw/source/core/crsr/findcoll.cxx +++ b/sw/source/core/crsr/findcoll.cxx @@ -28,16 +28,15 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" +#include <tools/resid.hxx> #include <swcrsr.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <pamtyp.hxx> #include <swundo.hxx> #include <undobj.hxx> -#ifndef _COMCORE_HRC #include <comcore.hrc> -#endif -#include <tools/resid.hxx> //------------------ Methoden der CrsrShell --------------------------- @@ -91,15 +90,17 @@ ULONG SwCursor::Find( const SwTxtFmtColl& rFmtColl, Link aLnk( pDoc->GetOle2Link() ); pDoc->SetOle2Link( Link() ); - BOOL bSttUndo = pDoc->DoesUndo() && pReplFmtColl; - if( bSttUndo ) + bool const bStartUndo = + pDoc->GetIDocumentUndoRedo().DoesUndo() && pReplFmtColl; + if (bStartUndo) { SwRewriter aRewriter; aRewriter.AddRule(UNDO_ARG1, rFmtColl.GetName()); aRewriter.AddRule(UNDO_ARG2, SW_RES(STR_YIELDS)); aRewriter.AddRule(UNDO_ARG3, pReplFmtColl->GetName()); - pDoc->StartUndo( UNDO_UI_REPLACE_STYLE, &aRewriter ); + pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_UI_REPLACE_STYLE, + &aRewriter ); } SwFindParaFmtColl aSwFindParaFmtColl( rFmtColl, pReplFmtColl, *this ); @@ -110,8 +111,10 @@ ULONG SwCursor::Find( const SwTxtFmtColl& rFmtColl, if( nRet && pReplFmtColl ) pDoc->SetModified(); - if( bSttUndo ) - pDoc->EndUndo( UNDO_UI_REPLACE_STYLE, NULL ); + if (bStartUndo) + { + pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_UI_REPLACE_STYLE, NULL ); + } return nRet; } diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index ed4bcc089957..5cc9da2984d9 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -27,15 +27,17 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <com/sun/star/util/SearchOptions.hpp> #include <com/sun/star/util/SearchFlags.hpp> - - #define _SVSTDARR_USHORTS #define _SVSTDARR_ULONGS #include <svl/svstdarr.hxx> + #include <vcl/svapp.hxx> +#include <vcl/window.hxx> + #include <txatritr.hxx> #include <fldbas.hxx> #include <fmtfld.hxx> @@ -43,6 +45,7 @@ #include <txtfld.hxx> #include <swcrsr.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <pamtyp.hxx> #include <ndtxt.hxx> #include <swundo.hxx> @@ -51,7 +54,6 @@ #include <docsh.hxx> #include <PostItMgr.hxx> #include <viewsh.hxx> -#include <vcl/window.hxx> using namespace ::com::sun::star; using namespace util; @@ -643,9 +645,11 @@ ULONG SwCursor::Find( const SearchOptions& rSearchOpt, BOOL bSearchInNotes, Link aLnk( pDoc->GetOle2Link() ); pDoc->SetOle2Link( Link() ); - BOOL bSttUndo = pDoc->DoesUndo() && bReplace; - if( bSttUndo ) - pDoc->StartUndo( UNDO_REPLACE, NULL ); + bool const bStartUndo = pDoc->GetIDocumentUndoRedo().DoesUndo() && bReplace; + if (bStartUndo) + { + pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_REPLACE, NULL ); + } BOOL bSearchSel = 0 != (rSearchOpt.searchFlag & SearchFlags::REG_NOT_BEGINOFLINE); if( bSearchSel ) @@ -656,8 +660,10 @@ ULONG SwCursor::Find( const SearchOptions& rSearchOpt, BOOL bSearchInNotes, if( nRet && bReplace ) pDoc->SetModified(); - if( bSttUndo ) - pDoc->EndUndo( UNDO_REPLACE, NULL ); + if (bStartUndo) + { + pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_REPLACE, NULL ); + } return nRet; } diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 7637df0a67b4..082e61e3347c 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -43,6 +43,7 @@ #include <swcrsr.hxx> #include <unocrsr.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docary.hxx> #include <ndtxt.hxx> #include <section.hxx> @@ -58,9 +59,7 @@ #include <crsskip.hxx> #include <vcl/msgbox.hxx> #include <mdiexp.hxx> // ...Percent() -#ifndef _STATSTR_HRC #include <statstr.hrc> // ResId fuer Statusleiste -#endif #include <redline.hxx> // SwRedline @@ -743,7 +742,7 @@ ULONG lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurCrsr, BOOL bInReadOnly, BOOL& bCancel ) { SwDoc* pDoc = pCurCrsr->GetDoc(); - BOOL bDoesUndo = pDoc->DoesUndo(); + bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); int nFndRet = 0; ULONG nFound = 0; int bSrchBkwrd = fnMove == fnMoveBackward, bEnde = FALSE; @@ -806,14 +805,15 @@ ULONG lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurCrsr, break; } - if( coSrchRplcThreshold == nFound && pDoc->DoesUndo() + if ((coSrchRplcThreshold == nFound) + && pDoc->GetIDocumentUndoRedo().DoesUndo() && rParas.IsReplaceMode()) { short nRet = pCurCrsr->MaxReplaceArived(); if( RET_YES == nRet ) { - pDoc->DelAllUndoObj(); - pDoc->DoUndo( FALSE ); + pDoc->GetIDocumentUndoRedo().DelAllUndoObj(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); } else { @@ -858,7 +858,7 @@ ULONG lcl_FindSelection( SwFindParas& rParas, SwCursor* pCurCrsr, pFndRing = pCurCrsr->Create(); delete pPHdl; - pDoc->DoUndo( bDoesUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); return nFound; } diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index eb264fa00b23..61381de595f8 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -679,14 +679,14 @@ bool SwDoc::SplitNode( const SwPosition &rPos, bool bChkTableStart ) } SwUndoSplitNode* pUndo = 0; - if ( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); // einfuegen vom Undo-Object, z.Z. nur beim TextNode if( pNode->IsTxtNode() ) { pUndo = new SwUndoSplitNode( this, rPos, bChkTableStart ); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } } @@ -810,10 +810,10 @@ bool SwDoc::AppendTxtNode( SwPosition& rPos ) rPos.nNode++; rPos.nContent.Assign( pCurNode, 0 ); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoInsert( rPos.nNode )); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo( new SwUndoInsert( rPos.nNode ) ); } if( IsRedlineOn() || (!IsIgnoreRedline() && pRedlineTbl->Count() )) @@ -834,9 +834,9 @@ bool SwDoc::AppendTxtNode( SwPosition& rPos ) bool SwDoc::InsertString( const SwPaM &rRg, const String &rStr, const enum InsertFlags nInsertMode ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); } const SwPosition& rPos = *rRg.GetPoint(); @@ -858,15 +858,16 @@ bool SwDoc::InsertString( const SwPaM &rRg, const String &rStr, SwDataChanged aTmp( rRg, 0 ); - if( !DoesUndo() || !DoesGroupUndo() ) + if (!GetIDocumentUndoRedo().DoesUndo() || + !GetIDocumentUndoRedo().DoesGroupUndo()) { pNode->InsertText( rStr, rPos.nContent, nInsertMode ); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndoInsert * const pUndo( new SwUndoInsert( rPos.nNode, rPos.nContent.GetIndex(), rStr.Len(), nInsertMode)); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } } else @@ -905,7 +906,7 @@ bool SwDoc::InsertString( const SwPaM &rRg, const String &rStr, { pUndo = new SwUndoInsert( rPos.nNode, nInsPos, 0, nInsertMode, !rCC.isLetterNumeric( rStr, 0 ) ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } pNode->InsertText( rStr, rPos.nContent, nInsertMode ); @@ -918,7 +919,7 @@ bool SwDoc::InsertString( const SwPaM &rRg, const String &rStr, { pUndo = new SwUndoInsert( rPos.nNode, nInsPos, 1, nInsertMode, !rCC.isLetterNumeric( rStr, i ) ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } } } @@ -1997,7 +1998,7 @@ void SwDoc::ResetModified() // it is correct. In this case we reset the modified flag. if ( 0 != pDocStat->nChar ) pDocStat->bModified = FALSE; - setUndoNoModifiedPosition(0/*FIXME*/); + GetIDocumentUndoRedo().setUndoNoModifiedPosition(0/*FIXME*/); if( nCall && aOle2Link.IsSet() ) { mbInCallModified = TRUE; @@ -2016,10 +2017,10 @@ void SwDoc::ReRead( SwPaM& rPam, const String& rGrfName, || rPam.GetPoint()->nNode.GetIndex() == rPam.GetMark()->nNode.GetIndex() ) && 0 != ( pGrfNd = rPam.GetPoint()->nNode.GetNode().GetGrfNode() ) ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoReRead( rPam, *pGrfNd ) ); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo(new SwUndoReRead(rPam, *pGrfNd)); } // Weil nicht bekannt ist, ob sich die Grafik spiegeln laesst, @@ -2234,7 +2235,7 @@ void SwDoc::Summary( SwDoc* pExtDoc, BYTE nLevel, BYTE nPara, BOOL bImpress ) BOOL SwDoc::RemoveInvisibleContent() { BOOL bRet = FALSE; - StartUndo( UNDO_UI_DELETE_INVISIBLECNTNT, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_UI_DELETE_INVISIBLECNTNT, NULL ); { SwTxtNode* pTxtNd; @@ -2398,7 +2399,7 @@ BOOL SwDoc::RemoveInvisibleContent() if( bRet ) SetModified(); - EndUndo( UNDO_UI_DELETE_INVISIBLECNTNT, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_UI_DELETE_INVISIBLECNTNT, NULL ); return bRet; } /*-- 25.08.2010 14:18:12--------------------------------------------------- @@ -2456,7 +2457,7 @@ BOOL SwDoc::ConvertFieldsToText() { BOOL bRet = FALSE; LockExpFlds(); - StartUndo( UNDO_UI_REPLACE, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_UI_REPLACE, NULL ); const SwFldTypes* pMyFldTypes = GetFldTypes(); sal_uInt16 nCount = pMyFldTypes->Count(); @@ -2526,7 +2527,7 @@ BOOL SwDoc::ConvertFieldsToText() if( bRet ) SetModified(); - EndUndo( UNDO_UI_REPLACE, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_UI_REPLACE, NULL ); UnlockExpFlds(); return bRet; @@ -2593,8 +2594,8 @@ bool SwDoc::EmbedAllLinks() const ::sfx2::SvBaseLinks& rLinks = rLnkMgr.GetLinks(); if( rLinks.Count() ) { - BOOL bDoesUndo = DoesUndo(); - DoUndo( FALSE ); + bool const bDoesUndo = GetIDocumentUndoRedo().DoesUndo(); + GetIDocumentUndoRedo().DoUndo(false); ::sfx2::SvBaseLink* pLnk = 0; while( 0 != (pLnk = lcl_FindNextRemovableLink( rLinks, rLnkMgr ) ) ) @@ -2610,8 +2611,8 @@ bool SwDoc::EmbedAllLinks() bRet = TRUE; } - DelAllUndoObj(); - DoUndo( bDoesUndo ); + GetIDocumentUndoRedo().DelAllUndoObj(); + GetIDocumentUndoRedo().DoUndo(bDoesUndo); SetModified(); } return bRet; @@ -2650,26 +2651,26 @@ void SwDoc::AppendUndoForInsertFromDB( const SwPaM& rPam, BOOL bIsTable ) { SwUndoCpyTbl* pUndo = new SwUndoCpyTbl; pUndo->SetTableSttIdx( pTblNd->GetIndex() ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } } else if( rPam.HasMark() ) { SwUndoCpyDoc* pUndo = new SwUndoCpyDoc( rPam ); pUndo->SetInsertRange( rPam, FALSE ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } } void SwDoc::ChgTOX(SwTOXBase & rTOX, const SwTOXBase & rNew) { - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { - DelAllUndoObj(); + GetIDocumentUndoRedo().DelAllUndoObj(); SwUndo * pUndo = new SwUndoTOXChange(&rTOX, rNew); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } rTOX = rNew; diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index 170193778421..4bc934978d6b 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -37,6 +37,7 @@ #include <editeng/boxitem.hxx> #include <editeng/udlnitem.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docary.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -1216,14 +1217,14 @@ BOOL SwCompareLine::ChangesInLine( const SwCompareLine& rLine, if( nStt != nSEnd ) { { - BOOL bUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + bool const bUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); SwPaM aCpyPam( rSrcNd, nStt ); aCpyPam.SetMark(); aCpyPam.GetPoint()->nContent = nSEnd; aCpyPam.GetDoc()->CopyRange( aCpyPam, *aPam.GetPoint(), false ); - pDoc->DoUndo( bUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); } SwPaM* pTmp = new SwPaM( *aPam.GetPoint(), rpDelRing ); @@ -1494,8 +1495,11 @@ void SwCompareData::SetRedlinesToDoc( BOOL bUseDocInfo ) rDoc.DeleteRedline( *pTmp, false, USHRT_MAX ); - if( rDoc.DoesUndo() ) - rDoc.AppendUndo( new SwUndoCompDoc( *pTmp, FALSE )); + if (rDoc.GetIDocumentUndoRedo().DoesUndo()) + { + SwUndo *const pUndo(new SwUndoCompDoc( *pTmp, FALSE )) ; + rDoc.GetIDocumentUndoRedo().AppendUndo(pUndo); + } rDoc.AppendRedline( new SwRedline( aRedlnData, *pTmp ), true ); } while( pDelRing != ( pTmp = (SwPaM*)pTmp->GetNext() )); @@ -1560,8 +1564,11 @@ void SwCompareData::SetRedlinesToDoc( BOOL bUseDocInfo ) do { if( rDoc.AppendRedline( new SwRedline( aRedlnData, *pTmp ), true) && - rDoc.DoesUndo() ) - rDoc.AppendUndo( new SwUndoCompDoc( *pTmp, TRUE )); + rDoc.GetIDocumentUndoRedo().DoesUndo()) + { + SwUndo *const pUndo(new SwUndoCompDoc( *pTmp, TRUE )); + rDoc.GetIDocumentUndoRedo().AppendUndo(pUndo); + } } while( pInsRing != ( pTmp = (SwPaM*)pTmp->GetNext() )); } } @@ -1578,7 +1585,7 @@ long SwDoc::CompareDoc( const SwDoc& rDoc ) long nRet = 0; - StartUndo(UNDO_EMPTY, NULL); + GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); BOOL bDocWasModified = IsModified(); SwDoc& rSrcDoc = (SwDoc&)rDoc; BOOL bSrcModified = rSrcDoc.IsModified(); @@ -1609,14 +1616,12 @@ long SwDoc::CompareDoc( const SwDoc& rDoc ) if( !bSrcModified ) rSrcDoc.ResetModified(); - EndUndo(UNDO_EMPTY, NULL); + GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); return nRet; } -typedef void (SwDoc::*FNInsUndo)( SwUndo* ); - class _SaveMergeRedlines : public Ring { const SwRedline* pSrcRedl; @@ -1624,7 +1629,7 @@ class _SaveMergeRedlines : public Ring public: _SaveMergeRedlines( const SwNode& rDstNd, const SwRedline& rSrcRedl, Ring* pRing ); - USHORT InsertRedline( FNInsUndo pFn ); + USHORT InsertRedline(); SwRedline* GetDestRedline() { return pDestRedl; } }; @@ -1655,7 +1660,7 @@ _SaveMergeRedlines::_SaveMergeRedlines( const SwNode& rDstNd, } } -USHORT _SaveMergeRedlines::InsertRedline( FNInsUndo pFn ) +USHORT _SaveMergeRedlines::InsertRedline() { USHORT nIns = 0; SwDoc* pDoc = pDestRedl->GetDoc(); @@ -1663,8 +1668,8 @@ USHORT _SaveMergeRedlines::InsertRedline( FNInsUndo pFn ) if( nsRedlineType_t::REDLINE_INSERT == pDestRedl->GetType() ) { // der Teil wurde eingefuegt, also kopiere ihn aus dem SourceDoc - BOOL bUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + bool const bUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); SwNodeIndex aSaveNd( pDestRedl->GetPoint()->nNode, -1 ); xub_StrLen nSaveCnt = pDestRedl->GetPoint()->nContent.GetIndex(); @@ -1677,7 +1682,7 @@ USHORT _SaveMergeRedlines::InsertRedline( FNInsUndo pFn ) *pDestRedl->GetPoint(), false ); pDoc->SetRedlineMode_intern( eOld ); - pDoc->DoUndo( bUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); pDestRedl->SetMark(); aSaveNd++; @@ -1739,13 +1744,16 @@ USHORT _SaveMergeRedlines::InsertRedline( FNInsUndo pFn ) pCpyRedl->SetMark(); *pCpyRedl->GetPoint() = *pRStt; - SwUndoCompDoc* pUndo = pDoc->DoesUndo() + SwUndoCompDoc *const pUndo = + (pDoc->GetIDocumentUndoRedo().DoesUndo()) ? new SwUndoCompDoc( *pCpyRedl ) : 0; // now modify doc: append redline, undo (and count) pDoc->AppendRedline( pCpyRedl, true ); if( pUndo ) - (pDoc->*pFn)( pUndo ); + { + pDoc->GetIDocumentUndoRedo().AppendUndo(pUndo); + } ++nIns; *pDStt = *pREnd; @@ -1772,12 +1780,15 @@ USHORT _SaveMergeRedlines::InsertRedline( FNInsUndo pFn ) if( pDestRedl ) { - SwUndoCompDoc* pUndo = pDoc->DoesUndo() ? new SwUndoCompDoc( *pDestRedl ) : 0; + SwUndoCompDoc *const pUndo = (pDoc->GetIDocumentUndoRedo().DoesUndo()) + ? new SwUndoCompDoc( *pDestRedl ) : 0; // now modify doc: append redline, undo (and count) bool bRedlineAccepted = pDoc->AppendRedline( pDestRedl, true ); if( pUndo ) - (pDoc->*pFn)( pUndo ); + { + pDoc->GetIDocumentUndoRedo().AppendUndo( pUndo ); + } ++nIns; // if AppendRedline has deleted our redline, we may not keep a @@ -1796,7 +1807,7 @@ long SwDoc::MergeDoc( const SwDoc& rDoc ) long nRet = 0; - StartUndo(UNDO_EMPTY, NULL); + GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); SwDoc& rSrcDoc = (SwDoc&)rDoc; BOOL bSrcModified = rSrcDoc.IsModified(); @@ -1853,7 +1864,7 @@ long SwDoc::MergeDoc( const SwDoc& rDoc ) _SaveMergeRedlines* pTmp = pRing; do { - nRet += pTmp->InsertRedline( &SwDoc::AppendUndo ); + nRet += pTmp->InsertRedline(); } while( pRing != ( pTmp = (_SaveMergeRedlines*)pTmp->GetNext() )); while( pRing != pRing->GetNext() ) @@ -1868,7 +1879,7 @@ long SwDoc::MergeDoc( const SwDoc& rDoc ) SetRedlineMode((RedlineMode_t)(nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE)); - EndUndo(UNDO_EMPTY, NULL); + GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); return nRet; } diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index 0b56578e0536..df9e03bdd3af 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <hintids.hxx> #include <vcl/virdev.hxx> #include <svx/svdmodel.hxx> @@ -48,6 +49,7 @@ #include <ndole.hxx> #include <mdiexp.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docary.hxx> #include <pagefrm.hxx> //Fuer DelPageDesc #include <rootfrm.hxx> //Fuer DelPageDesc @@ -55,9 +57,7 @@ #include <frmtool.hxx> #include <pagedesc.hxx> #include <poolfmt.hxx> -#ifndef _DOCSH_HXX #include <docsh.hxx> -#endif #include <ndindex.hxx> #include <ftnidx.hxx> #include <fmtftn.hxx> @@ -69,9 +69,7 @@ #include <swwait.hxx> #include <GetMetricVal.hxx> #include <unotools/syslocale.hxx> -#ifndef _STATSTR_HRC #include <statstr.hrc> -#endif #include <SwUndoPageDesc.hxx> @@ -203,11 +201,12 @@ void SwDoc::ChgPageDesc( USHORT i, const SwPageDesc &rChged ) SwPageDesc *pDesc = aPageDescs[i]; - BOOL bDoesUndo = DoesUndo(); - if (DoesUndo()) + bool const bDoesUndo = GetIDocumentUndoRedo().DoesUndo(); + if (bDoesUndo) { - AppendUndo(new SwUndoPageDesc(*pDesc, rChged, this)); - DoUndo(FALSE); + SwUndo *const pUndo(new SwUndoPageDesc(*pDesc, rChged, this)); + GetIDocumentUndoRedo().AppendUndo(pUndo); + GetIDocumentUndoRedo().DoUndo(false); } //Als erstes wird ggf. gespiegelt. @@ -426,13 +425,13 @@ void SwDoc::ChgPageDesc( USHORT i, const SwPageDesc &rChged ) } SetModified(); - DoUndo(bDoesUndo); + GetIDocumentUndoRedo().DoUndo(bDoesUndo); // #i46909# no undo if header or footer changed if( bHeaderFooterChanged ) { - ClearRedo(); - DelAllUndoObj(); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().DelAllUndoObj(); } } @@ -570,9 +569,10 @@ void SwDoc::DelPageDesc( USHORT i, BOOL bBroadcast ) SFX_STYLESHEET_ERASED); // <- #116530# - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { - AppendUndo(new SwUndoPageDescDelete(*pDel, this)); + SwUndo *const pUndo(new SwUndoPageDescDelete(*pDel, this)); + GetIDocumentUndoRedo().AppendUndo(pUndo); } PreDelPageDesc(pDel); // #i7983# @@ -629,8 +629,11 @@ USHORT SwDoc::MakePageDesc( const String &rName, const SwPageDesc *pCpy, SFX_STYLESHEET_CREATED); // <- #116530# - if (DoesUndo()) - AppendUndo(new SwUndoPageDescCreate(pNew, this)); // #116530# + if (GetIDocumentUndoRedo().DoesUndo()) + { + // #116530# + GetIDocumentUndoRedo().AppendUndo(new SwUndoPageDescCreate(pNew, this)); + } SetModified(); return (aPageDescs.Count()-1); diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx index 1a10428d5a58..1dd1fc0d414e 100644 --- a/sw/source/core/doc/docdraw.cxx +++ b/sw/source/core/doc/docdraw.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <hintids.hxx> #include <rtl/logfile.hxx> #include <vcl/outdev.hxx> @@ -49,6 +50,7 @@ #include <viewimp.hxx> #include <swhints.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docsh.hxx> #include <rootfrm.hxx> //Damit der RootDtor gerufen wird. #include <poolfmt.hxx> @@ -227,7 +229,7 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView ) SwDrawContact *pMyContact = (SwDrawContact*)GetUserCall(pObj); const SwFmtAnchor aAnch( pMyContact->GetFmt()->GetAnchor() ); - SwUndoDrawGroup* pUndo = !DoesUndo() + SwUndoDrawGroup *const pUndo = (!GetIDocumentUndoRedo().DoesUndo()) ? 0 : new SwUndoDrawGroup( (USHORT)rMrkList.GetMarkCount() ); @@ -303,14 +305,16 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView ) if( pUndo ) { pUndo->SetGroupFmt( pFmt ); - ClearRedo(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } } else { - if ( DoesUndo() ) - ClearRedo(); + if (GetIDocumentUndoRedo().DoesUndo()) + { + GetIDocumentUndoRedo().ClearRedo(); + } rDrawView.GroupMarked(); ASSERT( rMrkList.GetMarkCount() == 1, "GroupMarked more or none groups." ); @@ -322,9 +326,11 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView ) void SwDoc::UnGroupSelection( SdrView& rDrawView ) { - const int bUndo = DoesUndo(); + bool const bUndo = GetIDocumentUndoRedo().DoesUndo(); if( bUndo ) - ClearRedo(); + { + GetIDocumentUndoRedo().ClearRedo(); + } // OD 30.06.2003 #108784# - replace marked 'virtual' drawing objects by // the corresponding 'master' drawing objects. @@ -358,7 +364,7 @@ void SwDoc::UnGroupSelection( SdrView& rDrawView ) if( bUndo ) { pUndo = new SwUndoDrawUnGroup( (SdrObjGroup*)pObj ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } for ( USHORT i2 = 0; i2 < pLst->GetObjCount(); ++i2 ) @@ -403,7 +409,7 @@ void SwDoc::UnGroupSelection( SdrView& rDrawView ) if( bUndo ) { pUndo = new SwUndoDrawUnGroupConnectToLayout(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } while ( pFmtsAndObjs[i].size() > 0 ) @@ -442,7 +448,7 @@ BOOL SwDoc::DeleteSelection( SwDrawView& rDrawView ) const SdrMarkList &rMrkList = rDrawView.GetMarkedObjectList(); if( rMrkList.GetMarkCount() ) { - StartUndo(UNDO_EMPTY, NULL); + GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); USHORT i; BOOL bDelMarked = TRUE; @@ -483,7 +489,9 @@ BOOL SwDoc::DeleteSelection( SwDrawView& rDrawView ) SdrObject *pObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj(); if( !pObj->GetUpGroup() ) { - SwUndoDrawDelete* pUndo = !DoesUndo() ? 0 + SwUndoDrawDelete *const pUndo = + (!GetIDocumentUndoRedo().DoesUndo()) + ? 0 : new SwUndoDrawDelete( (USHORT)rMrkList.GetMarkCount() ); //ContactObjekte vernichten, Formate sicherstellen. @@ -516,13 +524,15 @@ BOOL SwDoc::DeleteSelection( SwDrawView& rDrawView ) } if( pUndo ) - AppendUndo( pUndo ); + { + GetIDocumentUndoRedo().AppendUndo( pUndo ); + } } bCallBase = TRUE; } SetModified(); - EndUndo(UNDO_EMPTY, NULL); + GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); } return bCallBase; @@ -625,7 +635,7 @@ void SwDoc::InitDrawModel() //Seite. pDrawModel = new SwDrawDocument( this ); - pDrawModel->EnableUndo( DoesUndo() ); + pDrawModel->EnableUndo( GetIDocumentUndoRedo().DoesUndo() ); String sLayerNm; sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Hell" )); diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 65b4b603bd80..c79e6acfa9ce 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -774,8 +774,10 @@ bool SwDoc::Overwrite( const SwPaM &rRg, const String &rStr ) if(!pNode) return sal_False; - if( DoesUndo() ) - ClearRedo(); + if (GetIDocumentUndoRedo().DoesUndo()) + { + GetIDocumentUndoRedo().ClearRedo(); + } sal_uInt16 nOldAttrCnt = pNode->GetpSwpHints() ? pNode->GetpSwpHints()->Count() : 0; @@ -799,10 +801,10 @@ bool SwDoc::Overwrite( const SwPaM &rRg, const String &rStr ) lcl_SkipAttr( pNode, rIdx, nStart ); } c = rStr.GetChar( nCnt ); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { bool bMerged(false); - if (DoesGroupUndo()) + if (GetIDocumentUndoRedo().DoesGroupUndo()) { pUndo = GetUndoManager().GetLastUndo(); if (pUndo && (UNDO_OVERWRITE == pUndo->GetId())) @@ -814,7 +816,8 @@ bool SwDoc::Overwrite( const SwPaM &rRg, const String &rStr ) } if (!bMerged) { - AppendUndo( new SwUndoOverwrite( this, rPt, c )); + SwUndo *const pUndoOW( new SwUndoOverwrite(this, rPt, c) ); + GetIDocumentUndoRedo().AppendUndo(pUndoOW); } } else @@ -847,7 +850,8 @@ bool SwDoc::Overwrite( const SwPaM &rRg, const String &rStr ) } } - if( !DoesUndo() && !IsIgnoreRedline() && GetRedlineTbl().Count() ) + if (!GetIDocumentUndoRedo().DoesUndo() && + !IsIgnoreRedline() && GetRedlineTbl().Count()) { SwPaM aPam( rPt.nNode, nStart, rPt.nNode, rPt.nContent.GetIndex() ); DeleteRedline( aPam, true, USHRT_MAX ); @@ -915,15 +919,15 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags ) // in a particular order, and presence of bookmarks // will change this order. Hence, we delete bookmarks // here without undo. - BOOL bDoesUndo = DoesUndo(); - DoUndo( FALSE ); + bool const bDoesUndo = GetIDocumentUndoRedo().DoesUndo(); + GetIDocumentUndoRedo().DoUndo(false); _DelBookmarks( pStt->nNode, pEnd->nNode, NULL, &pStt->nContent, &pEnd->nContent); - DoUndo( bDoesUndo ); + GetIDocumentUndoRedo().DoUndo(bDoesUndo); } @@ -932,9 +936,9 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags ) // falls Undo eingeschaltet, erzeuge das UndoMove-Objekt SwUndoMove * pUndoMove = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); pUndoMove = new SwUndoMove( rPaM, rPos ); pUndoMove->SetMoveRedlines( eMvFlags == DOC_MOVEREDLINES ); } @@ -1031,7 +1035,7 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags ) rPaM.SetMark(); // um den neuen Bereich eine Sel. aufspannen pTNd = aSavePam.GetNode()->GetTxtNode(); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { // korrigiere erstmal den Content vom SavePam if( bNullCntnt ) @@ -1075,7 +1079,7 @@ bool SwDoc::MoveRange( SwPaM& rPaM, SwPosition& rPos, SwMoveFlags eMvFlags ) // zwischen SPoint und GetMark steht jetzt der neu eingefuegte Bereich pUndoMove->SetDestRange( aSavePam, *rPaM.GetPoint(), bJoin, bCorrSavePam ); - AppendUndo( pUndoMove ); + GetIDocumentUndoRedo().AppendUndo( pUndoMove ); } else { @@ -1158,11 +1162,15 @@ bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos, SwFtnIdxs aTmpFntIdx; SwUndoMove* pUndo = 0; - if( (DOC_CREATEUNDOOBJ & eMvFlags ) && DoesUndo() ) + if ((DOC_CREATEUNDOOBJ & eMvFlags ) && GetIDocumentUndoRedo().DoesUndo()) + { pUndo = new SwUndoMove( this, rRange, rPos ); + } else + { bUpdateFtn = lcl_SaveFtn( rRange.aStart, rRange.aEnd, rPos, GetFtnIdxs(), aTmpFntIdx ); + } _SaveRedlines aSaveRedl( 0, 4 ); SvPtrarr aSavRedlInsPosArr( 0, 4 ); @@ -1252,9 +1260,9 @@ bool SwDoc::MoveNodeRange( SwNodeRange& rRange, SwNodeIndex& rPos, if( pUndo ) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); pUndo->SetDestRange( aIdx, rPos, *pSaveInsPos ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } if( pSaveInsPos ) @@ -1365,8 +1373,8 @@ void lcl_JoinText( SwPaM& rPam, sal_Bool bJoinPrev ) // falls PageBreaks geloescht / gesetzt werden, darf das // nicht in die Undo-History aufgenommen werden !! // (das loeschen vom Node geht auch am Undo vorbei !!!) - sal_Bool bDoUndo = pDoc->DoesUndo(); - pDoc->DoUndo( sal_False ); + bool const bDoUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); /* PageBreaks, PageDesc, ColumnBreaks */ // Sollte an der Logik zum Kopieren der PageBreak's ... @@ -1418,7 +1426,7 @@ void lcl_JoinText( SwPaM& rPam, sal_Bool bJoinPrev ) if( aBkmkArr.Count() ) ::_RestoreCntntIdx( pDoc, aBkmkArr, aIdx.GetIndex() ); - pDoc->DoUndo( bDoUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bDoUndo); // falls der uebergebene PaM nicht im Crsr-Ring steht, // gesondert behandeln (z.B. Aufruf aus dem Auto-Format) @@ -1562,16 +1570,17 @@ bool SwDoc::DeleteAndJoinWithRedlineImpl( SwPaM & rPam, const bool ) SwUndoRedlineDelete* pUndo = 0; RedlineMode_t eOld = GetRedlineMode(); checkRedlining(eOld); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); //JP 06.01.98: MUSS noch optimiert werden!!! SetRedlineMode( (RedlineMode_t)(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE )); - StartUndo(UNDO_EMPTY, NULL); - AppendUndo( pUndo = new SwUndoRedlineDelete( rPam, UNDO_DELETE )); + GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); + pUndo = new SwUndoRedlineDelete( rPam, UNDO_DELETE ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } if( *rPam.GetPoint() != *rPam.GetMark() ) AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_DELETE, rPam ), true); @@ -1579,11 +1588,11 @@ bool SwDoc::DeleteAndJoinWithRedlineImpl( SwPaM & rPam, const bool ) if( pUndo ) { - EndUndo(UNDO_EMPTY, NULL); + GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); // ??? why the hell is the AppendUndo not below the // CanGrouping, so this hideous cleanup wouldn't be necessary? // bah, this is redlining, probably changing this would break it... - if (DoesGroupUndo()) + if (GetIDocumentUndoRedo().DoesGroupUndo()) { SwUndo *const pLastUndo( GetUndoManager().GetLastUndo() ); if (pLastUndo && @@ -1596,15 +1605,15 @@ bool SwDoc::DeleteAndJoinWithRedlineImpl( SwPaM & rPam, const bool ) ->CanGrouping( *pUndo ); if (bMerged) { - bool const bUndo( DoesUndo() ); - DoUndo( false ); + bool const bUndo( GetIDocumentUndoRedo().DoesUndo() ); + GetIDocumentUndoRedo().DoUndo(false); SwUndo const*const pDeleted = GetUndoManager().RemoveLastUndo(UNDO_REDLINE); OSL_ENSURE(pDeleted == pUndo, "DeleteAndJoinWithRedlineImpl: " "undo removed is not undo inserted?"); delete pDeleted; - DoUndo( bUndo ); + GetIDocumentUndoRedo().DoUndo(bUndo); } } } @@ -1703,11 +1712,11 @@ bool SwDoc::DeleteRangeImplImpl(SwPaM & rPam) } - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); bool bMerged(false); - if (DoesGroupUndo()) + if (GetIDocumentUndoRedo().DoesGroupUndo()) { SwUndo *const pLastUndo( GetUndoManager().GetLastUndo() ); if (pLastUndo && (UNDO_DELETE == pLastUndo->GetId())) @@ -1719,7 +1728,7 @@ bool SwDoc::DeleteRangeImplImpl(SwPaM & rPam) } if (!bMerged) { - AppendUndo( new SwUndoDelete( rPam ) ); + GetIDocumentUndoRedo().AppendUndo( new SwUndoDelete( rPam ) ); } SetModified(); @@ -2343,9 +2352,9 @@ bool SwDoc::ReplaceRangeImpl( SwPaM& rPam, const String& rStr, { RedlineMode_t eOld = GetRedlineMode(); checkRedlining(eOld); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - StartUndo(UNDO_EMPTY, NULL); + GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); // Bug 68584 - if any Redline will change (split!) the node const ::sw::mark::IMark* pBkmk = getIDocumentMarkAccess()->makeMark( aDelPam, ::rtl::OUString(), IDocumentMarkAccess::UNO_BOOKMARK ); @@ -2425,15 +2434,19 @@ bool SwDoc::ReplaceRangeImpl( SwPaM& rPam, const String& rStr, InsertItemSet( aTmpRange, aSet, 0 ); } - if( DoesUndo() ) - AppendUndo( new SwUndoRedlineDelete( aDelPam, UNDO_REPLACE )); + if (GetIDocumentUndoRedo().DoesUndo()) + { + SwUndo *const pUndoRD = + new SwUndoRedlineDelete( aDelPam, UNDO_REPLACE ); + GetIDocumentUndoRedo().AppendUndo(pUndoRD); + } AppendRedline( new SwRedline( nsRedlineType_t::REDLINE_DELETE, aDelPam ), true); *rPam.GetMark() = *aDelPam.GetMark(); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { *aDelPam.GetPoint() = *rPam.GetPoint(); - EndUndo(UNDO_EMPTY, NULL); + GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); // Bug 68584 - if any Redline will change (split!) the node const ::sw::mark::IMark* pBkmk = getIDocumentMarkAccess()->makeMark( aDelPam, ::rtl::OUString(), IDocumentMarkAccess::UNO_BOOKMARK ); @@ -2460,9 +2473,10 @@ SetRedlineMode( eOld ); DeleteRedline( aDelPam, true, USHRT_MAX ); SwUndoReplace* pUndoRpl = 0; - if( DoesUndo() ) + bool const bDoesUndo = GetIDocumentUndoRedo().DoesUndo(); + if (bDoesUndo) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); SwUndo *const pLastUndo( GetUndoManager().GetLastUndo() ); if (pLastUndo && @@ -2473,10 +2487,10 @@ SetRedlineMode( eOld ); if (!pUndoRpl || pUndoRpl->IsFull()) { pUndoRpl = new SwUndoReplace(); - AppendUndo( pUndoRpl ); + GetIDocumentUndoRedo().AppendUndo(pUndoRpl); } pUndoRpl->AddEntry( aDelPam, sRepl, bRegExReplace ); - DoUndo( sal_False ); + GetIDocumentUndoRedo().DoUndo(false); } if( aDelPam.GetPoint() != pStt ) @@ -2531,7 +2545,7 @@ SetRedlineMode( eOld ); if( pUndoRpl ) { pUndoRpl->SetEntryEnd( rPam ); - DoUndo( sal_True ); + GetIDocumentUndoRedo().DoUndo(bDoesUndo); } } } @@ -2600,7 +2614,7 @@ bool SwDoc::DelFullPara( SwPaM& rPam ) } } - sal_Bool bDoesUndo = DoesUndo(); + bool const bDoesUndo = GetIDocumentUndoRedo().DoesUndo(); if( bDoesUndo ) { if( !rPam.HasMark() ) @@ -2615,7 +2629,7 @@ bool SwDoc::DelFullPara( SwPaM& rPam ) pTmpNode = rPam.GetMark()->nNode.GetNode().GetCntntNode(); rPam.GetMark()->nContent.Assign( pTmpNode, 0 ); - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); SwPaM aDelPam( *rPam.GetMark(), *rPam.GetPoint() ); { @@ -2632,7 +2646,7 @@ bool SwDoc::DelFullPara( SwPaM& rPam ) *rPam.GetPoint() = *aDelPam.GetPoint(); pUndo->SetPgBrkFlags( bSavePageBreak, bSavePageDesc ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } else { @@ -2690,11 +2704,9 @@ void SwDoc::TransliterateText( const SwPaM& rPaM, utl::TransliterationWrapper& rTrans ) { - SwUndoTransliterate* pUndo; - if( DoesUndo() ) - pUndo = new SwUndoTransliterate( rPaM, rTrans ); - else - pUndo = 0; + SwUndoTransliterate *const pUndo = (GetIDocumentUndoRedo().DoesUndo()) + ? new SwUndoTransliterate( rPaM, rTrans ) + : 0; const SwPosition* pStt = rPaM.Start(), * pEnd = rPaM.End(); @@ -2752,8 +2764,8 @@ void SwDoc::TransliterateText( { if( pUndo->HasData() ) { - ClearRedo(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo(pUndo); } else delete pUndo; diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index 7e18e990d070..a54db564a315 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -43,6 +43,7 @@ #include <unotools/charclass.hxx> #include <unotools/transliterationwrapper.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <cntfrm.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -69,9 +70,7 @@ #include <authfld.hxx> #include <txtinet.hxx> #include <fmtcntnt.hxx> -#ifndef _POOLFMT_HRC #include <poolfmt.hrc> // fuer InitFldTypes -#endif #include <SwUndoField.hxx> @@ -2725,13 +2724,14 @@ bool SwDoc::UpdateFld(SwTxtFld * pDstTxtFld, SwField & rSrcFld, if (pDstFld->GetTyp()->Which() == rSrcFld.GetTyp()->Which()) { - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwPosition aPosition( pDstTxtFld->GetTxtNode() ); aPosition.nContent = *pDstTxtFld->GetStart(); - AppendUndo(new SwUndoFieldFromDoc(aPosition, *pDstFld, rSrcFld, - pMsgHnt, bUpdateFlds)); + SwUndo *const pUndo( new SwUndoFieldFromDoc( + aPosition, *pDstFld, rSrcFld, pMsgHnt, bUpdateFlds) ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } // Das gefundene Feld wird angepasst ... @@ -2818,8 +2818,12 @@ bool SwDoc::PutValueToField(const SwPosition & rPos, SwField * pField = GetField(rPos); - if (DoesUndo() && pField->QueryValue(aOldVal, nWhich)) - AppendUndo(new SwUndoFieldFromAPI(rPos, aOldVal, rVal, nWhich)); + if (GetIDocumentUndoRedo().DoesUndo() && + pField->QueryValue(aOldVal, nWhich)) + { + SwUndo *const pUndo(new SwUndoFieldFromAPI(rPos, aOldVal, rVal, nWhich)); + GetIDocumentUndoRedo().AppendUndo(pUndo); + } return pField->PutValue(rVal, nWhich); } diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx index 68c525ad74e1..c0b75f5da5b4 100644 --- a/sw/source/core/doc/docfly.cxx +++ b/sw/source/core/doc/docfly.cxx @@ -28,7 +28,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include <hintids.hxx> #include <svl/itemiter.hxx> #include <svx/svdobj.hxx> @@ -43,6 +42,7 @@ #include <ndgrf.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <ndindex.hxx> #include <docary.hxx> #include <fmtcntnt.hxx> @@ -395,16 +395,16 @@ BOOL SwDoc::SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet ) return FALSE; ::std::auto_ptr<SwUndoFmtAttrHelper> pSaveUndo; - const bool bDoesUndo = DoesUndo(); + bool const bDoesUndo = GetIDocumentUndoRedo().DoesUndo(); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); pSaveUndo.reset( new SwUndoFmtAttrHelper( rFlyFmt ) ); // --> FME 2004-10-13 #i32968# // Inserting columns in the frame causes MakeFrmFmt to put two // objects of type SwUndoFrmFmt on the undo stack. We don't want them. - DoUndo( FALSE ); + GetIDocumentUndoRedo().DoUndo(false); // <-- } @@ -457,12 +457,12 @@ BOOL SwDoc::SetFlyFrmAttr( SwFrmFmt& rFlyFmt, SfxItemSet& rSet ) if ( pSaveUndo.get() ) { // --> FME 2004-10-13 #i32968# - DoUndo( bDoesUndo ); + GetIDocumentUndoRedo().DoUndo(bDoesUndo); // <-- if ( pSaveUndo->GetUndo() ) { - AppendUndo( pSaveUndo->ReleaseUndo() ); + GetIDocumentUndoRedo().AppendUndo( pSaveUndo->ReleaseUndo() ); } } @@ -483,10 +483,10 @@ void SwDoc::SetFlyFrmTitle( SwFlyFrmFmt& rFlyFrmFmt, const bool bFormerIsNoDrawUndoObj( IsNoDrawUndoObj() ); SetNoDrawUndoObj( true ); - if ( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoFlyStrAttr( rFlyFrmFmt, + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo( new SwUndoFlyStrAttr( rFlyFrmFmt, UNDO_FLYFRMFMT_TITLE, rFlyFrmFmt.GetObjTitle(), sNewTitle ) ); @@ -510,10 +510,10 @@ void SwDoc::SetFlyFrmDescription( SwFlyFrmFmt& rFlyFrmFmt, const bool bFormerIsNoDrawUndoObj( IsNoDrawUndoObj() ); SetNoDrawUndoObj( true ); - if ( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoFlyStrAttr( rFlyFrmFmt, + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo( new SwUndoFlyStrAttr( rFlyFrmFmt, UNDO_FLYFRMFMT_DESCRIPTION, rFlyFrmFmt.GetObjDescription(), sNewDescription ) ); @@ -544,14 +544,16 @@ BOOL SwDoc::SetFrmFmtToFly( SwFrmFmt& rFmt, SwFrmFmt& rNewFmt, const SwFmtHoriOrient aHori( rFmt.GetHoriOrient() ); SwUndoSetFlyFmt* pUndo = 0; - if( DoesUndo() ) + bool const bUndo = GetIDocumentUndoRedo().DoesUndo(); + if (bUndo) { - ClearRedo(); - AppendUndo( pUndo = new SwUndoSetFlyFmt( rFmt, rNewFmt ) ); + GetIDocumentUndoRedo().ClearRedo(); + pUndo = new SwUndoSetFlyFmt( rFmt, rNewFmt ); + GetIDocumentUndoRedo().AppendUndo(pUndo); // --> FME 2004-10-13 #i32968# // Inserting columns in the section causes MakeFrmFmt to put two // objects of type SwUndoFrmFmt on the undo stack. We don't want them. - DoUndo( FALSE ); + GetIDocumentUndoRedo().DoUndo(false); // <-- } @@ -621,10 +623,10 @@ BOOL SwDoc::SetFrmFmtToFly( SwFrmFmt& rFmt, SwFrmFmt& rNewFmt, SetModified(); - // --> FME 2004-10-13 #i32968# if ( pUndo ) - DoUndo( TRUE ); - // <-- + { + GetIDocumentUndoRedo().DoUndo(bUndo); + } return bChgAnchor; } @@ -660,7 +662,7 @@ sal_Bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, return false; } - StartUndo( UNDO_INSATTR, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_INSATTR, NULL ); BOOL bUnmark = FALSE; for ( USHORT i = 0; i < _rMrkList.GetMarkCount(); ++i ) @@ -891,7 +893,7 @@ sal_Bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, } } - EndUndo( UNDO_END, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); SetModified(); return bUnmark; @@ -1007,7 +1009,7 @@ int SwDoc::Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest ) int nErr = Chainable( rSource, rDest ); if ( !nErr ) { - StartUndo( UNDO_CHAINE, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_CHAINE, NULL ); SwFlyFrmFmt& rDestFmt = (SwFlyFrmFmt&)rDest; @@ -1041,7 +1043,7 @@ int SwDoc::Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest ) } SetAttr( aSet, rSource ); - EndUndo( UNDO_CHAINE, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_CHAINE, NULL ); } return nErr; } @@ -1053,14 +1055,14 @@ void SwDoc::Unchain( SwFrmFmt &rFmt ) SwFmtChain aChain( rFmt.GetChain() ); if ( aChain.GetNext() ) { - StartUndo( UNDO_UNCHAIN, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_UNCHAIN, NULL ); SwFrmFmt *pFollow = aChain.GetNext(); aChain.SetNext( 0 ); SetAttr( aChain, rFmt ); aChain = pFollow->GetChain(); aChain.SetPrev( 0 ); SetAttr( aChain, *pFollow ); - EndUndo( UNDO_UNCHAIN, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_UNCHAIN, NULL ); } } diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index eba51c0354f8..f78f364dc662 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -54,6 +54,7 @@ #include <fmtcntnt.hxx> #include <frmatr.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <rootfrm.hxx> #include <pagefrm.hxx> #include <hints.hxx> // fuer SwHyphenBug (in SetDefault) @@ -357,12 +358,12 @@ void SwDoc::RstTxtAttrs(const SwPaM &rRg, BOOL bInclRefToxMark ) { SwHistory* pHst = 0; SwDataChanged aTmp( rRg, 0 ); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); SwUndoResetAttr* pUndo = new SwUndoResetAttr( rRg, RES_CHRFMT ); pHst = &pUndo->GetHistory(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End(); ParaRstFmt aPara( pStt, pEnd, pHst ); @@ -441,9 +442,9 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, } // <-- SwHistory* pHst = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); SwUndoResetAttr* pUndo = new SwUndoResetAttr( rRg, static_cast<USHORT>(bTxtAttr ? RES_CONDTXTFMTCOLL : RES_TXTFMTCOLL )); if( pAttrs && pAttrs->Count() ) @@ -451,7 +452,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg, pUndo->SetAttrs( *pAttrs ); } pHst = &pUndo->GetHistory(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } const SwPosition *pStt = pPam->Start(), *pEnd = pPam->End(); @@ -1125,9 +1126,9 @@ bool SwDoc::InsertPoolItem( const SwPaM &rRg, const SfxPoolItem &rHt, { SwDataChanged aTmp( rRg, 0 ); SwUndoAttr* pUndoAttr = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); pUndoAttr = new SwUndoAttr( rRg, rHt, nFlags ); } @@ -1135,8 +1136,10 @@ bool SwDoc::InsertPoolItem( const SwPaM &rRg, const SfxPoolItem &rHt, aSet.Put( rHt ); bool bRet = lcl_InsAttr( this, rRg, aSet, nFlags, pUndoAttr ); - if( DoesUndo() ) - AppendUndo( pUndoAttr ); + if (GetIDocumentUndoRedo().DoesUndo()) + { + GetIDocumentUndoRedo().AppendUndo( pUndoAttr ); + } if( bRet ) SetModified(); @@ -1148,16 +1151,18 @@ bool SwDoc::InsertItemSet ( const SwPaM &rRg, const SfxItemSet &rSet, { SwDataChanged aTmp( rRg, 0 ); SwUndoAttr* pUndoAttr = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); pUndoAttr = new SwUndoAttr( rRg, rSet, nFlags ); } bool bRet = lcl_InsAttr( this, rRg, rSet, nFlags, pUndoAttr ); - if( DoesUndo() ) - AppendUndo( pUndoAttr ); + if (GetIDocumentUndoRedo().DoesUndo()) + { + GetIDocumentUndoRedo().AppendUndo( pUndoAttr ); + } if( bRet ) SetModified(); @@ -1179,14 +1184,14 @@ void SwDoc::SetAttr( const SfxPoolItem& rAttr, SwFmt& rFmt ) // das alte in die Undo-History aufgenommen void SwDoc::SetAttr( const SfxItemSet& rSet, SwFmt& rFmt ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); SwUndoFmtAttrHelper aTmp( rFmt ); rFmt.SetFmtAttr( rSet ); if ( aTmp.GetUndo() ) { - AppendUndo( aTmp.ReleaseUndo() ); + GetIDocumentUndoRedo().AppendUndo( aTmp.ReleaseUndo() ); } } else @@ -1200,16 +1205,18 @@ void SwDoc::SetAttr( const SfxItemSet& rSet, SwFmt& rFmt ) void SwDoc::ResetAttrAtFormat( const USHORT nWhichId, SwFmt& rChangedFormat ) { - SwUndo* pUndo = 0; - if ( DoesUndo() ) - pUndo = new SwUndoFmtResetAttr( rChangedFormat, nWhichId ); + SwUndo *const pUndo = (GetIDocumentUndoRedo().DoesUndo()) + ? new SwUndoFmtResetAttr( rChangedFormat, nWhichId ) + : 0; const BOOL bAttrReset = rChangedFormat.ResetFmtAttr( nWhichId ); if ( bAttrReset ) { if ( pUndo ) - AppendUndo( pUndo ); + { + GetIDocumentUndoRedo().AppendUndo( pUndo ); + } SetModified(); } @@ -1326,10 +1333,10 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) if( aNew.Count() && aCallMod.GetDepends() ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoDefaultAttr( aOld ) ); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo( new SwUndoDefaultAttr( aOld ) ); } const SfxPoolItem* pTmpItem; @@ -1396,12 +1403,12 @@ void SwDoc::DelCharFmt(USHORT nFmt, BOOL bBroadcast) BroadcastStyleOperation(pDel->GetName(), SFX_STYLE_FAMILY_CHAR, SFX_STYLESHEET_ERASED); - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = new SwUndoCharFmtDelete(pDel, this); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } pCharFmtTbl->DeleteAndDestroy(nFmt); @@ -1438,11 +1445,11 @@ void SwDoc::DelFrmFmt( SwFrmFmt *pFmt, BOOL bBroadcast ) SFX_STYLE_FAMILY_FRAME, SFX_STYLESHEET_ERASED); - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = new SwUndoFrmFmtDelete(pFmt, this); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } pFrmFmtTbl->DeleteAndDestroy( nPos ); @@ -1548,11 +1555,11 @@ SwFrmFmt *SwDoc::MakeFrmFmt(const String &rFmtName, BroadcastStyleOperation(rFmtName, SFX_STYLE_FAMILY_PARA, SFX_STYLESHEET_CREATED); - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = new SwUndoFrmFmtCreate(pFmt, pDerivedFrom, this); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } } @@ -1581,11 +1588,11 @@ SwCharFmt *SwDoc::MakeCharFmt( const String &rFmtName, pFmt->SetAuto( FALSE ); SetModified(); - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = new SwUndoCharFmtCreate(pFmt, pDerivedFrom, this); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } if (bBroadcast) @@ -1624,11 +1631,11 @@ SwTxtFmtColl* SwDoc::MakeTxtFmtColl( const String &rFmtName, pFmtColl->SetAuto( FALSE ); SetModified(); - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = new SwUndoTxtFmtCollCreate(pFmtColl, pDerivedFrom, this); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } if (bBroadcast) @@ -1693,12 +1700,12 @@ void SwDoc::DelTxtFmtColl(USHORT nFmtColl, BOOL bBroadcast) BroadcastStyleOperation(pDel->GetName(), SFX_STYLE_FAMILY_PARA, SFX_STYLESHEET_ERASED); - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndoTxtFmtCollDelete * pUndo = new SwUndoTxtFmtCollDelete(pDel, this); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } // Die FmtColl austragen @@ -1807,16 +1814,16 @@ BOOL SwDoc::SetTxtFmtColl( const SwPaM &rRg, SwHistory* pHst = 0; BOOL bRet = TRUE; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); // --> OD 2008-04-15 #refactorlists# SwUndoFmtColl* pUndo = new SwUndoFmtColl( rRg, pFmt, bReset, bResetListAttrs ); // <-- pHst = pUndo->GetHistory(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } ParaRstFmt aPara( pStt, pEnd, pHst ); @@ -2261,8 +2268,8 @@ void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc, void SwDoc::ReplaceStyles( SwDoc& rSource ) { - BOOL bIsUndo = DoesUndo(); - DoUndo( FALSE ); + bool const bIsUndo = GetIDocumentUndoRedo().DoesUndo(); + GetIDocumentUndoRedo().DoUndo(false); CopyFmtArr( *rSource.pCharFmtTbl, *pCharFmtTbl, &SwDoc::_MakeCharFmt, *pDfltCharFmt ); @@ -2315,13 +2322,13 @@ void SwDoc::ReplaceStyles( SwDoc& rSource ) if( bIsUndo ) { - // es wurde am Nodes-Array gedreht! - ClearRedo(); - DelAllUndoObj(); + // nodes array was modified! + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().DelAllUndoObj(); } SetModified(); - DoUndo( bIsUndo ); + GetIDocumentUndoRedo().DoUndo(bIsUndo); } SwFmt* SwDoc::FindFmtByName( const SvPtrarr& rFmtArr, @@ -2343,13 +2350,13 @@ SwFmt* SwDoc::FindFmtByName( const SvPtrarr& rFmtArr, void SwDoc::MoveLeftMargin( const SwPaM& rPam, BOOL bRight, BOOL bModulus ) { SwHistory* pHistory = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); SwUndoMoveLeftMargin* pUndo = new SwUndoMoveLeftMargin( rPam, bRight, bModulus ); pHistory = &pUndo->GetHistory(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } const SvxTabStopItem& rTabItem = (SvxTabStopItem&)GetDefault( RES_PARATR_TABSTOP ); @@ -2409,10 +2416,10 @@ BOOL SwDoc::DontExpandFmt( const SwPosition& rPos, BOOL bFlag ) if( pTxtNd ) { bRet = pTxtNd->DontExpandFmt( rPos.nContent, bFlag ); - if( bRet && DoesUndo() ) + if( bRet && GetIDocumentUndoRedo().DoesUndo() ) { - ClearRedo(); - AppendUndo( new SwUndoDontExpandFmt( rPos )); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo( new SwUndoDontExpandFmt(rPos) ); } } return bRet; @@ -2560,7 +2567,7 @@ void SwDoc::SetFmtItemByAutoFmt( const SwPaM& rPam, const SfxItemSet& rSet ) void SwDoc::ChgFmt(SwFmt & rFmt, const SfxItemSet & rSet) { - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { // copying <rSet> to <aSet> SfxItemSet aSet(rSet); @@ -2588,7 +2595,7 @@ void SwDoc::ChgFmt(SwFmt & rFmt, const SfxItemSet & rSet) SwUndo * pUndo = new SwUndoFmtAttr(aOldSet, rFmt); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } rFmt.SetFmtAttr(rSet); @@ -2599,7 +2606,7 @@ void SwDoc::RenameFmt(SwFmt & rFmt, const String & sNewName, { SfxStyleFamily eFamily = SFX_STYLE_FAMILY_ALL; - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = NULL; @@ -2623,7 +2630,9 @@ void SwDoc::RenameFmt(SwFmt & rFmt, const String & sNewName, } if (pUndo) - AppendUndo(pUndo); + { + GetIDocumentUndoRedo().AppendUndo(pUndo); + } } rFmt.SetName(sNewName); diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx index 306f7b3dfcc8..65ed0fa94714 100644 --- a/sw/source/core/doc/docftn.cxx +++ b/sw/source/core/doc/docftn.cxx @@ -39,6 +39,7 @@ #include <undobj.hxx> #include <rolbck.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <ndtxt.hxx> #include <poolfmt.hxx> #include <ftninfo.hxx> @@ -259,10 +260,10 @@ void SwDoc::SetFtnInfo(const SwFtnInfo& rInfo) { const SwFtnInfo &rOld = GetFtnInfo(); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoFootNoteInfo( rOld ) ); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo( new SwUndoFootNoteInfo(rOld) ); } BOOL bFtnPos = rInfo.ePos != rOld.ePos; @@ -326,10 +327,11 @@ void SwDoc::SetEndNoteInfo(const SwEndNoteInfo& rInfo) { if( !(GetEndNoteInfo() == rInfo) ) { - if( DoesUndo() ) + if(GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoEndNoteInfo( GetEndNoteInfo() ) ); + GetIDocumentUndoRedo().ClearRedo(); + SwUndo *const pUndo( new SwUndoEndNoteInfo( GetEndNoteInfo() ) ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } BOOL bNumChg = rInfo.nFtnOffset != GetEndNoteInfo().nFtnOffset; @@ -403,9 +405,9 @@ bool SwDoc::SetCurFtn( const SwPaM& rPam, const String& rNumStr, rFtnArr.SeekEntry( pStt->nNode, &nPos ); SwUndoChangeFootNote* pUndo = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); pUndo = new SwUndoChangeFootNote( rPam, rNumStr, nNumber, bIsEndNote ); } @@ -479,8 +481,8 @@ bool SwDoc::SetCurFtn( const SwPaM& rPam, const String& rNumStr, { if( pUndo ) { - ClearRedo(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo(pUndo); } if ( bTypeChgd ) diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx index 30a385442fc0..c1fc9014533a 100644 --- a/sw/source/core/doc/docglbl.cxx +++ b/sw/source/core/doc/docglbl.cxx @@ -43,6 +43,7 @@ #include <fmtinfmt.hxx> #include <fmtanchr.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docary.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -181,7 +182,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, return FALSE; // Undo/Redline aufjedenfall abschalten - DoUndo( FALSE ); + GetIDocumentUndoRedo().DoUndo(false); SetRedlineMode_intern( (RedlineMode_t)(GetRedlineMode() & ~nsRedlineMode_t::REDLINE_ON)); String sExt( pFilter->GetSuffixes().GetToken(0, ',') ); @@ -542,7 +543,7 @@ BOOL SwDoc::SplitDoc( USHORT eDocType, const String& rPath, int nOutlineLevel ) return FALSE; // Undo/Redline aufjedenfall abschalten - DoUndo( FALSE ); + GetIDocumentUndoRedo().DoUndo(false); SetRedlineMode_intern( (RedlineMode_t)(GetRedlineMode() & ~nsRedlineMode_t::REDLINE_ON)); String sExt( pFilter->GetSuffixes().GetToken(0, ',') ); diff --git a/sw/source/core/doc/docglos.cxx b/sw/source/core/doc/docglos.cxx index 8395c358c495..3a7ac788f04d 100644 --- a/sw/source/core/doc/docglos.cxx +++ b/sw/source/core/doc/docglos.cxx @@ -28,8 +28,13 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" +#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> +#include <com/sun/star/document/XDocumentProperties.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertySetInfo.hpp> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <shellio.hxx> #include <pam.hxx> #include <swundo.hxx> @@ -38,11 +43,6 @@ #include <crsrsh.hxx> #include <docsh.hxx> -#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> -#include <com/sun/star/document/XDocumentProperties.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/beans/XPropertySetInfo.hpp> - using namespace ::com::sun::star; @@ -160,7 +160,7 @@ BOOL SwDoc::InsertGlossary( SwTextBlocks& rBlock, const String& rEntry, pCntntNd = aCpyPam.GetCntntNode(); aCpyPam.GetPoint()->nContent.Assign( pCntntNd, pCntntNd->Len() ); - StartUndo( UNDO_INSGLOSSARY, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_INSGLOSSARY, NULL ); SwPaM *_pStartCrsr = &rPaM, *__pStartCrsr = _pStartCrsr; do { @@ -187,7 +187,7 @@ BOOL SwDoc::InsertGlossary( SwTextBlocks& rBlock, const String& rEntry, pShell->SaveTblBoxCntnt( &rInsPos ); } while( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != __pStartCrsr ); - EndUndo( UNDO_INSGLOSSARY, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_INSGLOSSARY, NULL ); UnlockExpFlds(); if( !IsExpFldsLocked() ) diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 168a9361da62..0ddeb814ca8b 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -75,6 +75,7 @@ #include <ndnotxt.hxx> #include <ndole.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <rootfrm.hxx> #include <pagefrm.hxx> #include <cntfrm.hxx> @@ -197,10 +198,11 @@ SwFrmFmt *SwDoc::MakeLayoutFmt( RndStdIds eRequest, const SfxItemSet* pSet ) if( pSet ) // noch ein paar Attribute setzen ? pFmt->SetFmtAttr( *pSet ); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoInsLayFmt( pFmt,0,0 )); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo( + new SwUndoInsLayFmt(pFmt, 0, 0)); } } break; @@ -253,7 +255,7 @@ void SwDoc::DelLayoutFmt( SwFrmFmt *pFmt ) } const SwNodeIndex* pCntIdx = pFmt->GetCntnt().GetCntntIdx(); - if( pCntIdx && !DoesUndo() ) + if (pCntIdx && !GetIDocumentUndoRedo().DoesUndo()) { //Verbindung abbauen, falls es sich um ein OLE-Objekt handelt. SwOLENode* pOLENd = GetNodes()[ pCntIdx->GetIndex()+1 ]->GetOLENode(); @@ -295,11 +297,11 @@ void SwDoc::DelLayoutFmt( SwFrmFmt *pFmt ) // erstmal sind nur Fly's Undofaehig const sal_uInt16 nWh = pFmt->Which(); - if( DoesUndo() && (RES_FLYFRMFMT == nWh || RES_DRAWFRMFMT == nWh) ) + if (GetIDocumentUndoRedo().DoesUndo() && + (RES_FLYFRMFMT == nWh || RES_DRAWFRMFMT == nWh)) { - // erstmal werden alle Undo - Objecte geloescht. - ClearRedo(); - AppendUndo( new SwUndoDelLayFmt( pFmt )); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo( new SwUndoDelLayFmt( pFmt )); } else { @@ -494,10 +496,10 @@ SwFrmFmt *SwDoc::CopyLayoutFmt( const SwFrmFmt& rSource, } } - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoInsLayFmt( pDest,0,0 )); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo(new SwUndoInsLayFmt(pDest,0,0)); } // sorge dafuer das auch Fly's in Fly's kopiert werden @@ -536,10 +538,10 @@ SwFrmFmt *SwDoc::CopyLayoutFmt( const SwFrmFmt& rSource, else pDest->SetFmtAttr( rNewAnchor ); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoInsLayFmt( pDest,0,0 )); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo(new SwUndoInsLayFmt(pDest,0,0)); } } @@ -729,12 +731,13 @@ SwFlyFrmFmt* SwDoc::_MakeFlySection( const SwPosition& rAnchPos, if( GetRootFrm() ) pFmt->MakeFrms(); // ??? - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); ULONG nNodeIdx = rAnchPos.nNode.GetIndex(); xub_StrLen nCntIdx = rAnchPos.nContent.GetIndex(); - AppendUndo( new SwUndoInsLayFmt( pFmt, nNodeIdx, nCntIdx )); + GetIDocumentUndoRedo().AppendUndo( + new SwUndoInsLayFmt( pFmt, nNodeIdx, nCntIdx )); } SetModified(); @@ -803,7 +806,7 @@ SwFlyFrmFmt* SwDoc::MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet, { SwFmtAnchor& rAnch = (SwFmtAnchor&)rSet.Get( RES_ANCHOR ); - StartUndo( UNDO_INSLAYFMT, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_INSLAYFMT, NULL ); SwFlyFrmFmt* pFmt = MakeFlySection( rAnch.GetAnchorId(), rPam.GetPoint(), &rSet, pParent ); @@ -871,8 +874,11 @@ SwFlyFrmFmt* SwDoc::MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet, GetNodes().Delete( aIndex, 1 ); //JP erstmal ein Hack, solange keine Flys/Headers/Footers Undofaehig sind -if( DoesUndo() ) // werden erstmal alle Undo - Objecte geloescht. - DelAllUndoObj(); +// werden erstmal alle Undo - Objecte geloescht. +if( GetIDocumentUndoRedo().DoesUndo() ) +{ + GetIDocumentUndoRedo().DelAllUndoObj(); +} } else @@ -889,9 +895,9 @@ if( DoesUndo() ) // werden erstmal alle Undo - Objecte geloescht. // copy all Pams and then delete all SwPaM* pTmp = (SwPaM*)&rPam; BOOL bOldFlag = mbCopyIsMove; - bool bOldUndo = DoesUndo(); + bool const bOldUndo = GetIDocumentUndoRedo().DoesUndo(); mbCopyIsMove = TRUE; - DoUndo(false); + GetIDocumentUndoRedo().DoUndo(false); do { if( pTmp->HasMark() && *pTmp->GetPoint() != *pTmp->GetMark() ) @@ -901,7 +907,7 @@ if( DoesUndo() ) // werden erstmal alle Undo - Objecte geloescht. pTmp = static_cast<SwPaM*>(pTmp->GetNext()); } while ( &rPam != pTmp ); mbCopyIsMove = bOldFlag; - DoUndo(bOldUndo); + GetIDocumentUndoRedo().DoUndo(bOldUndo); pTmp = (SwPaM*)&rPam; do { @@ -918,7 +924,7 @@ if( DoesUndo() ) // werden erstmal alle Undo - Objecte geloescht. SetModified(); - EndUndo( UNDO_INSLAYFMT, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_INSLAYFMT, NULL ); return pFmt; } @@ -1017,10 +1023,10 @@ SwDrawFrmFmt* SwDoc::Insert( const SwPaM &rRg, // <-- } - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoInsLayFmt( pFmt,0,0 )); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo( new SwUndoInsLayFmt(pFmt, 0, 0) ); } SetModified(); @@ -1232,14 +1238,14 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co const String& rCharacterStyle, const sal_Bool bCpyBrd ) { - sal_Bool bWasUndo = DoesUndo(); + bool const bWasUndo = GetIDocumentUndoRedo().DoesUndo(); SwUndoInsertLabel* pUndo = 0; if( bWasUndo ) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); pUndo = new SwUndoInsertLabel( eType, rTxt, rSeparator, rNumberingSeparator, bBefore, nId, rCharacterStyle, bCpyBrd ); - DoUndo( sal_False ); + GetIDocumentUndoRedo().DoUndo(false); } sal_Bool bTable = sal_False; //Um etwas Code zu sparen. @@ -1530,10 +1536,14 @@ SwFlyFrmFmt* SwDoc::InsertLabel( const SwLabelType eType, const String &rTxt, co } if( pUndo ) - AppendUndo( pUndo ); + { + GetIDocumentUndoRedo().AppendUndo(pUndo); + } else - DelAllUndoObj(); - DoUndo( bWasUndo ); + { + GetIDocumentUndoRedo().DelAllUndoObj(); + } + GetIDocumentUndoRedo().DoUndo(bWasUndo); return pNewFmt; } @@ -1565,15 +1575,15 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel( const String &rTxt, if( !pOldFmt ) return 0; - sal_Bool bWasUndo = DoesUndo(); + bool const bWasUndo = GetIDocumentUndoRedo().DoesUndo(); sal_Bool bWasNoDrawUndo = IsNoDrawUndoObj(); SwUndoInsertLabel* pUndo = 0; if( bWasUndo ) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); pUndo = new SwUndoInsertLabel( LTYPE_DRAW, rTxt, rSeparator, rNumberSeparator, sal_False, nId, rCharacterStyle, sal_False ); - DoUndo( sal_False ); + GetIDocumentUndoRedo().DoUndo(false); SetNoDrawUndoObj( sal_True ); } @@ -1801,12 +1811,14 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel( const String &rTxt, if( pUndo ) { - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); SetNoDrawUndoObj( bWasNoDrawUndo ); } else - DelAllUndoObj(); - DoUndo( bWasUndo ); + { + GetIDocumentUndoRedo().DelAllUndoObj(); + } + GetIDocumentUndoRedo().DoUndo(bWasUndo); return pNewFmt; } diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 88876a7c6951..b3580fc48317 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -519,7 +519,7 @@ SwDoc::~SwDoc() // turn off Undo so the footnote attributes don't mess with // the footnote nodes - DoUndo(false); + GetIDocumentUndoRedo().DoUndo(false); mbDtor = TRUE; DELETEZ( pLayout ); @@ -788,9 +788,9 @@ SfxObjectShell* SwDoc::GetPersist() const void SwDoc::ClearDoc() { - bool const bOldUndo = DoesUndo(); - DelAllUndoObj(); - DoUndo(false); + bool const bOldUndo = GetIDocumentUndoRedo().DoesUndo(); + GetIDocumentUndoRedo().DelAllUndoObj(); + GetIDocumentUndoRedo().DoUndo(false); // Undo-Benachrichtigung vom Draw abschalten if( pDrawModel ) @@ -902,7 +902,7 @@ void SwDoc::ClearDoc() // delete now the dummy pagedesc DelPageDesc( nDummyPgDsc ); - DoUndo(bOldUndo); + GetIDocumentUndoRedo().DoUndo(bOldUndo); } void SwDoc::SetPreViewPrtData( const SwPagePreViewPrtData* pNew ) @@ -1069,6 +1069,17 @@ SwDoc::GetUndoManager() const return *m_pUndoManager; } +IDocumentUndoRedo & +SwDoc::GetIDocumentUndoRedo() +{ + return *m_pUndoManager; +} + +IDocumentUndoRedo const& +SwDoc::GetIDocumentUndoRedo() const +{ + return *m_pUndoManager; +} void SwDoc::InitTOXTypes() { @@ -1182,7 +1193,7 @@ void SwDoc::Paste( const SwDoc& rSource ) aCpyPam.SetMark(); aCpyPam.Move( fnMoveForward, fnGoDoc ); - this->StartUndo( UNDO_INSGLOSSARY, NULL ); + this->GetIDocumentUndoRedo().StartUndo( UNDO_INSGLOSSARY, NULL ); this->LockExpFlds(); { @@ -1236,7 +1247,7 @@ void SwDoc::Paste( const SwDoc& rSource ) } } - this->EndUndo( UNDO_INSGLOSSARY, NULL ); + this->GetIDocumentUndoRedo().EndUndo( UNDO_INSGLOSSARY, NULL ); UnlockExpFlds(); UpdateFlds(NULL, false); diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 6ba37816b0dc..7d6985bc491c 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <hintids.hxx> #include <tools/date.hxx> #include <tools/time.hxx> @@ -35,6 +36,7 @@ #include <ftninfo.hxx> #include <ftnidx.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <pam.hxx> #include <ndtxt.hxx> #include <doctxm.hxx> // pTOXBaseRing @@ -49,9 +51,7 @@ #include <txtfrm.hxx> #include <pamtyp.hxx> #include <redline.hxx> -#ifndef _COMCORE_HRC #include <comcore.hrc> -#endif #include <editeng/adjitem.hxx> #include <editeng/frmdiritem.hxx> #include <frmatr.hxx> @@ -371,11 +371,12 @@ BOOL SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset ) return FALSE; /* <-- #i13747 # */ - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - StartUndo(UNDO_OUTLINE_LR, NULL); - AppendUndo( new SwUndoOutlineLeftRight( rPam, nOffset ) ); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().StartUndo(UNDO_OUTLINE_LR, NULL); + SwUndo *const pUndoOLR( new SwUndoOutlineLeftRight( rPam, nOffset ) ); + GetIDocumentUndoRedo().AppendUndo(pUndoOLR); } // 2. allen Nodes die neue Vorlage zuweisen @@ -417,8 +418,10 @@ BOOL SwDoc::OutlineUpDown( const SwPaM& rPam, short nOffset ) n++; // Undo ??? } - if (DoesUndo()) - EndUndo(UNDO_OUTLINE_LR, NULL); + if (GetIDocumentUndoRedo().DoesUndo()) + { + GetIDocumentUndoRedo().EndUndo(UNDO_OUTLINE_LR, NULL); + } ChkCondColls(); SetModified(); @@ -976,11 +979,13 @@ void SwDoc::SetNumRule( const SwPaM& rPam, const bool bResetIndentAttrs ) { SwUndoInsNum * pUndo = NULL; - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - StartUndo( UNDO_INSNUM, NULL ); // Klammerung fuer die Attribute! - AppendUndo( pUndo = new SwUndoInsNum( rPam, rRule ) ); + GetIDocumentUndoRedo().ClearRedo(); + // Start/End for attributes! + GetIDocumentUndoRedo().StartUndo( UNDO_INSNUM, NULL ); + pUndo = new SwUndoInsNum( rPam, rRule ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } SwNumRule * pNew = FindNumRulePtr( rRule.GetName() ); @@ -1112,8 +1117,10 @@ void SwDoc::SetNumRule( const SwPaM& rPam, } // <-- - if (DoesUndo()) - EndUndo( UNDO_INSNUM, NULL ); + if (GetIDocumentUndoRedo().DoesUndo()) + { + GetIDocumentUndoRedo().EndUndo( UNDO_INSNUM, NULL ); + } SetModified(); } @@ -1158,10 +1165,11 @@ void SwDoc::SetNumRuleStart( const SwPosition& rPos, BOOL bFlag ) const SwNumRule* pRule = pTxtNd->GetNumRule(); if( pRule && !bFlag != !pTxtNd->IsListRestart()) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoNumRuleStart( rPos, bFlag )); + GetIDocumentUndoRedo().ClearRedo(); + SwUndo *const pUndo( new SwUndoNumRuleStart(rPos, bFlag) ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } pTxtNd->SetListRestart(bFlag ? true : false); @@ -1193,10 +1201,11 @@ void SwDoc::SetNodeNumStart( const SwPosition& rPos, USHORT nStt ) if ( !pTxtNd->HasAttrListRestartValue() || pTxtNd->GetAttrListRestartValue() != nStt ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoNumRuleStart( rPos, nStt )); + GetIDocumentUndoRedo().ClearRedo(); + SwUndo *const pUndo( new SwUndoNumRuleStart(rPos, nStt) ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } pTxtNd->SetAttrListRestartValue( nStt ); @@ -1222,12 +1231,11 @@ BOOL SwDoc::DelNumRule( const String& rName, BOOL bBroadcast ) if( USHRT_MAX != nPos && !IsUsed( *(*pNumRuleTbl)[ nPos ] )) { - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = new SwUndoNumruleDelete(*(*pNumRuleTbl)[nPos], this); - - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } if (bBroadcast) @@ -1279,12 +1287,12 @@ void SwDoc::ChgNumRuleFmts( const SwNumRule& rRule, const String * pName ) if( pRule ) { SwUndoInsNum* pUndo = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); pUndo = new SwUndoInsNum( *pRule, rRule ); pUndo->GetHistory(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } ::lcl_ChgNumRule( *this, rRule ); @@ -1303,11 +1311,10 @@ sal_Bool SwDoc::RenameNumRule(const String & rOldName, const String & rNewName, if (pNumRule) { - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = new SwUndoNumruleRename(rOldName, rNewName, this); - - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } // --> OD 2008-02-19 #refactorlists# @@ -1390,11 +1397,13 @@ BOOL SwDoc::ReplaceNumRule( const SwPosition& rPos, { // --> OD 2008-02-19 #refactorlists# SwUndoInsNum* pUndo = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - StartUndo( UNDO_START, NULL ); // Klammerung fuer die Attribute! - AppendUndo( pUndo = new SwUndoInsNum( rPos, *pNewRule, rOldRule ) ); + GetIDocumentUndoRedo().ClearRedo(); + // Start/End for attributes! + GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); + pUndo = new SwUndoInsNum( rPos, *pNewRule, rOldRule ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } // --> OD 2008-02-19 #refactorlists# @@ -1477,7 +1486,7 @@ BOOL SwDoc::ReplaceNumRule( const SwPosition& rPos, pTxtNd->NumRuleChgd(); } } - EndUndo( UNDO_END, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); SetModified(); bRet = TRUE; // #106897# @@ -1615,10 +1624,11 @@ void SwDoc::DelNumRules( const SwPaM& rPam ) } SwUndoDelNum* pUndo; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( pUndo = new SwUndoDelNum( rPam ) ); + GetIDocumentUndoRedo().ClearRedo(); + pUndo = new SwUndoDelNum( rPam ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } else pUndo = 0; @@ -2003,10 +2013,11 @@ BOOL SwDoc::NumUpDown( const SwPaM& rPam, BOOL bDown ) if( bRet ) { /* <-- #i24560# */ - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoNumUpDown( rPam, nDiff ) ); + GetIDocumentUndoRedo().ClearRedo(); + SwUndo *const pUndo( new SwUndoNumUpDown(rPam, nDiff) ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } String sNumRule; @@ -2233,7 +2244,7 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) if( !pOwnRedl ) { - StartUndo( UNDO_START, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); // zuerst das Insert, dann das Loeschen SwPosition aInsPos( aIdx ); @@ -2308,12 +2319,13 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) RedlineMode_t eOld = GetRedlineMode(); checkRedlining(eOld); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { //JP 06.01.98: MUSS noch optimiert werden!!! SetRedlineMode( (RedlineMode_t)(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_INSERT | nsRedlineMode_t::REDLINE_SHOW_DELETE)); - AppendUndo( new SwUndoRedlineDelete( aPam, UNDO_DELETE )); + SwUndo *const pUndo(new SwUndoRedlineDelete(aPam, UNDO_DELETE)); + GetIDocumentUndoRedo().AppendUndo(pUndo); } SwRedline* pNewRedline = new SwRedline( nsRedlineType_t::REDLINE_DELETE, aPam ); @@ -2328,7 +2340,7 @@ BOOL SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, BOOL bIsOutlMv ) //JP 06.01.98: MUSS noch optimiert werden!!! SetRedlineMode( eOld ); - EndUndo( UNDO_END, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); SetModified(); return TRUE; @@ -2351,7 +2363,7 @@ SetRedlineMode( eOld ); SwUndoMoveNum* pUndo = 0; ULONG nMoved = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { pUndo = new SwUndoMoveNum( rPam, nOffset, bIsOutlMv ); nMoved = rPam.End()->nNode.GetIndex() - rPam.Start()->nNode.GetIndex() + 1; @@ -2362,13 +2374,13 @@ SetRedlineMode( eOld ); if( pUndo ) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); // i57907: Under circumstances (sections at the end of a chapter) // the rPam.Start() is not moved to the new position. // But aIdx should be at the new end position and as long as the number of moved paragraphs // is nMoved, I know, where the new position is. pUndo->SetStartNode( aIdx.GetIndex() - nMoved ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo(pUndo); } if( pOwnRedl ) @@ -2410,12 +2422,12 @@ BOOL SwDoc::NumOrNoNum( const SwNodeIndex& rIdx, BOOL bDel ) bResult = TRUE; - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndoNumOrNoNum * pUndo = new SwUndoNumOrNoNum(rIdx, bOldNum, bNewNum); - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } } else if (bDel && pTxtNd->GetNumRule(FALSE) && @@ -2529,11 +2541,10 @@ USHORT SwDoc::MakeNumRule( const String &rName, AddNumRule(pNew); // #i36749# - if (DoesUndo()) + if (GetIDocumentUndoRedo().DoesUndo()) { SwUndo * pUndo = new SwUndoNumruleCreate(pNew, this); - - AppendUndo(pUndo); + GetIDocumentUndoRedo().AppendUndo(pUndo); } if (bBroadcast) diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 9997eabd79c3..f070d6bce103 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -31,15 +31,14 @@ #include <hintids.hxx> #include <tools/shl.hxx> -#ifndef _SFX_ITEMITER_HXX //autogen #include <svl/itemiter.hxx> -#endif #include <sfx2/app.hxx> #include <editeng/colritem.hxx> #include <editeng/udlnitem.hxx> #include <editeng/crsditem.hxx> #include <swmodule.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docary.hxx> #include <ndtxt.hxx> #include <redline.hxx> @@ -1398,13 +1397,13 @@ bool SwDoc::DeleteRedline( const SwPaM& rRange, bool bSaveInUndo, BOOL bChg = FALSE; - if( bSaveInUndo && DoesUndo() ) + if (bSaveInUndo && GetIDocumentUndoRedo().DoesUndo()) { SwUndoRedline* pUndo = new SwUndoRedline( UNDO_REDLINE, rRange ); if( pUndo->GetRedlSaveCount() ) { - ClearRedo(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo(pUndo); } else delete pUndo; @@ -2089,13 +2088,13 @@ bool SwDoc::AcceptRedline( USHORT nPos, bool bCallDelete ) SwRedline* pTmp = (*pRedlineTbl)[ nPos ]; if( pTmp->HasMark() && pTmp->IsVisible() ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { // #111827# SwRewriter aRewriter; aRewriter.AddRule(UNDO_ARG1, pTmp->GetDescr()); - StartUndo( UNDO_ACCEPT_REDLINE, &aRewriter); + GetIDocumentUndoRedo().StartUndo(UNDO_ACCEPT_REDLINE, &aRewriter); } int nLoopCnt = 2; @@ -2103,8 +2102,11 @@ bool SwDoc::AcceptRedline( USHORT nPos, bool bCallDelete ) do { - if( DoesUndo() ) - AppendUndo( new SwUndoAcceptRedline( *pTmp )); + if (GetIDocumentUndoRedo().DoesUndo()) + { + SwUndo *const pUndo( new SwUndoAcceptRedline(*pTmp) ); + GetIDocumentUndoRedo().AppendUndo(pUndo); + } bRet |= lcl_AcceptRedline( *pRedlineTbl, nPos, bCallDelete ); @@ -2133,8 +2135,10 @@ bool SwDoc::AcceptRedline( USHORT nPos, bool bCallDelete ) SetModified(); } - if( DoesUndo() ) - EndUndo( UNDO_ACCEPT_REDLINE, NULL ); + if (GetIDocumentUndoRedo().DoesUndo()) + { + GetIDocumentUndoRedo().EndUndo( UNDO_ACCEPT_REDLINE, NULL ); + } } return bRet; } @@ -2152,10 +2156,10 @@ bool SwDoc::AcceptRedline( const SwPaM& rPam, bool bCallDelete ) SwPaM aPam( *rPam.GetMark(), *rPam.GetPoint() ); lcl_AdjustRedlineRange( aPam ); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - StartUndo( UNDO_ACCEPT_REDLINE, NULL ); - AppendUndo( new SwUndoAcceptRedline( aPam )); + GetIDocumentUndoRedo().StartUndo( UNDO_ACCEPT_REDLINE, NULL ); + GetIDocumentUndoRedo().AppendUndo( new SwUndoAcceptRedline( aPam )); } // #111827# @@ -2166,7 +2170,7 @@ bool SwDoc::AcceptRedline( const SwPaM& rPam, bool bCallDelete ) CompressRedlines(); SetModified(); } - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { // #111827# String aTmpStr; @@ -2180,7 +2184,7 @@ bool SwDoc::AcceptRedline( const SwPaM& rPam, bool bCallDelete ) SwRewriter aRewriter; aRewriter.AddRule(UNDO_ARG1, aTmpStr); - EndUndo( UNDO_ACCEPT_REDLINE, &aRewriter ); + GetIDocumentUndoRedo().EndUndo( UNDO_ACCEPT_REDLINE, &aRewriter ); } return nRet != 0; } @@ -2197,13 +2201,13 @@ bool SwDoc::RejectRedline( USHORT nPos, bool bCallDelete ) SwRedline* pTmp = (*pRedlineTbl)[ nPos ]; if( pTmp->HasMark() && pTmp->IsVisible() ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { // #111827# SwRewriter aRewriter; aRewriter.AddRule(UNDO_ARG1, pTmp->GetDescr()); - StartUndo( UNDO_REJECT_REDLINE, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_REJECT_REDLINE, NULL ); } int nLoopCnt = 2; @@ -2211,8 +2215,11 @@ bool SwDoc::RejectRedline( USHORT nPos, bool bCallDelete ) do { - if( DoesUndo() ) - AppendUndo( new SwUndoRejectRedline( *pTmp )); + if (GetIDocumentUndoRedo().DoesUndo()) + { + SwUndo *const pUndo( new SwUndoRejectRedline( *pTmp ) ); + GetIDocumentUndoRedo().AppendUndo(pUndo); + } bRet |= lcl_RejectRedline( *pRedlineTbl, nPos, bCallDelete ); @@ -2241,8 +2248,10 @@ bool SwDoc::RejectRedline( USHORT nPos, bool bCallDelete ) SetModified(); } - if( DoesUndo() ) - EndUndo( UNDO_REJECT_REDLINE, NULL ); + if (GetIDocumentUndoRedo().DoesUndo()) + { + GetIDocumentUndoRedo().EndUndo( UNDO_REJECT_REDLINE, NULL ); + } } return bRet; } @@ -2260,10 +2269,10 @@ bool SwDoc::RejectRedline( const SwPaM& rPam, bool bCallDelete ) SwPaM aPam( *rPam.GetMark(), *rPam.GetPoint() ); lcl_AdjustRedlineRange( aPam ); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - StartUndo( UNDO_REJECT_REDLINE, NULL ); - AppendUndo( new SwUndoRejectRedline( aPam )); + GetIDocumentUndoRedo().StartUndo( UNDO_REJECT_REDLINE, NULL ); + GetIDocumentUndoRedo().AppendUndo( new SwUndoRejectRedline(aPam) ); } // #111827# @@ -2274,7 +2283,7 @@ bool SwDoc::RejectRedline( const SwPaM& rPam, bool bCallDelete ) CompressRedlines(); SetModified(); } - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { // #111827# String aTmpStr; @@ -2288,7 +2297,7 @@ bool SwDoc::RejectRedline( const SwPaM& rPam, bool bCallDelete ) SwRewriter aRewriter; aRewriter.AddRule(UNDO_ARG1, aTmpStr); - EndUndo( UNDO_REJECT_REDLINE, &aRewriter ); + GetIDocumentUndoRedo().EndUndo( UNDO_REJECT_REDLINE, &aRewriter ); } return nRet != 0; @@ -3148,8 +3157,8 @@ void SwRedline::Show( USHORT nLoop ) SwDoc* pDoc = GetDoc(); RedlineMode_t eOld = pDoc->GetRedlineMode(); pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE)); - BOOL bUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + bool const bUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); switch( GetType() ) { @@ -3171,7 +3180,7 @@ void SwRedline::Show( USHORT nLoop ) break; } pDoc->SetRedlineMode_intern( eOld ); - pDoc->DoUndo( bUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); } } @@ -3180,8 +3189,8 @@ void SwRedline::Hide( USHORT nLoop ) SwDoc* pDoc = GetDoc(); RedlineMode_t eOld = pDoc->GetRedlineMode(); pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE)); - BOOL bUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + bool const bUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); switch( GetType() ) { @@ -3210,7 +3219,7 @@ void SwRedline::Hide( USHORT nLoop ) break; } pDoc->SetRedlineMode_intern( eOld ); - pDoc->DoUndo( bUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); } void SwRedline::ShowOriginal( USHORT nLoop ) @@ -3220,8 +3229,8 @@ void SwRedline::ShowOriginal( USHORT nLoop ) SwRedlineData* pCur; pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE)); - BOOL bUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + bool const bUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); // bestimme den Type, ist der erste auf Stack for( pCur = pRedlineData; pCur->pNext; ) @@ -3254,7 +3263,7 @@ void SwRedline::ShowOriginal( USHORT nLoop ) break; } pDoc->SetRedlineMode_intern( eOld ); - pDoc->DoUndo( bUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); } diff --git a/sw/source/core/doc/docruby.cxx b/sw/source/core/doc/docruby.cxx index 4a707e1fb1af..6f343c26410c 100644 --- a/sw/source/core/doc/docruby.cxx +++ b/sw/source/core/doc/docruby.cxx @@ -28,18 +28,16 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include <string.h> // fuer strchr() -#include <hintids.hxx> -#ifndef _COM_SUN_STAR_I18N_UNICODETYPE_HDL #include <com/sun/star/i18n/UnicodeType.hdl> -#endif -#ifndef _COM_SUN_STAR_I18N_WORDTYPE_HDL #include <com/sun/star/i18n/WordType.hdl> -#endif + #include <unotools/charclass.hxx> + +#include <hintids.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docary.hxx> #include <mvsave.hxx> // Strukturen zum Sichern beim Move/Delete #include <ndtxt.hxx> @@ -112,7 +110,7 @@ USHORT SwDoc::FillRubyList( const SwPaM& rPam, SwRubyList& rList, USHORT SwDoc::SetRubyList( const SwPaM& rPam, const SwRubyList& rList, USHORT nMode ) { - StartUndo( UNDO_SETRUBYATTR, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_SETRUBYATTR, NULL ); SvUShortsSort aDelArr; aDelArr.Insert( RES_TXTATR_CJK_RUBY ); @@ -193,7 +191,7 @@ USHORT SwDoc::SetRubyList( const SwPaM& rPam, const SwRubyList& rList, } while( 30 > rList.Count() && (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != __pStartCrsr ); - EndUndo( UNDO_SETRUBYATTR, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_SETRUBYATTR, NULL ); return nListEntry; } diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx index 8923b5322998..cb61218055bd 100644 --- a/sw/source/core/doc/docsort.cxx +++ b/sw/source/core/doc/docsort.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <hintids.hxx> #include <rtl/math.hxx> #include <unotools/collatorwrapper.hxx> @@ -39,6 +40,7 @@ #include <fmtanchr.hxx> #include <frmfmt.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <node.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -357,9 +359,11 @@ BOOL SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) return FALSE; } - BOOL bUndo = DoesUndo(); + bool const bUndo = GetIDocumentUndoRedo().DoesUndo(); if( bUndo ) - StartUndo( UNDO_START, NULL ); + { + GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); + } SwPaM* pRedlPam = 0; SwUndoRedlineSort* pRedlUndo = 0; @@ -377,7 +381,7 @@ BOOL SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) if( bUndo ) { pRedlUndo = new SwUndoRedlineSort( *pRedlPam,rOpt ); - DoUndo( FALSE ); + GetIDocumentUndoRedo().DoUndo(false); } // erst den Bereich kopieren, dann SwNodeIndex aEndIdx( pEnd->nNode, 1 ); @@ -430,9 +434,12 @@ BOOL SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) SwNodeRange aRg( aStart, aStart ); if( bUndo && !pRedlUndo ) - AppendUndo( pUndoSort = new SwUndoSort( rPaM, rOpt ) ); + { + pUndoSort = new SwUndoSort(rPaM, rOpt); + GetIDocumentUndoRedo().AppendUndo(pUndoSort); + } - DoUndo( FALSE ); + GetIDocumentUndoRedo().DoUndo(false); for ( USHORT n = 0; n < aSortArr.Count(); ++n ) { @@ -458,7 +465,7 @@ BOOL SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) if( pRedlUndo ) { pRedlUndo->SetSaveRange( *pRedlPam ); - AppendUndo( pRedlUndo ); + GetIDocumentUndoRedo().AppendUndo( pRedlUndo ); } // nBeg is start of sorted range @@ -495,9 +502,11 @@ BOOL SwDoc::SortText(const SwPaM& rPaM, const SwSortOptions& rOpt) delete pRedlPam, pRedlPam = 0; } - DoUndo( bUndo ); + GetIDocumentUndoRedo().DoUndo( bUndo ); if( bUndo ) - EndUndo( UNDO_END, NULL ); + { + GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); + } return TRUE; } @@ -576,16 +585,16 @@ BOOL SwDoc::SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt) // ? TL_CHART2: ? // Redo loeschen bevor Undo - BOOL bUndo = DoesUndo(); + bool const bUndo = GetIDocumentUndoRedo().DoesUndo(); SwUndoSort* pUndoSort = 0; if(bUndo) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); pUndoSort = new SwUndoSort( rBoxes[0]->GetSttIdx(), rBoxes[rBoxes.Count()-1]->GetSttIdx(), *pTblNd, rOpt, aFlatBox.HasItemSets() ); - AppendUndo(pUndoSort); - DoUndo(FALSE); + GetIDocumentUndoRedo().AppendUndo(pUndoSort); + GetIDocumentUndoRedo().DoUndo(false); } // SchluesselElemente einsortieren @@ -631,8 +640,7 @@ BOOL SwDoc::SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt) aSortList.DeleteAndDestroy( 0, aSortList.Count() ); SwSortElement::Finit(); - // Undo wieder aktivieren - DoUndo(bUndo); + GetIDocumentUndoRedo().DoUndo(bUndo); SetModified(); return TRUE; diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index e144c47ee9a1..cd3edbf35db7 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -49,6 +49,7 @@ #include <frmatr.hxx> #include <pagedesc.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <pagefrm.hxx> #include <ndtxt.hxx> #include <swtable.hxx> @@ -188,14 +189,14 @@ void SwDoc::DeleteTOXMark( const SwTOXMark* pTOXMark ) SwTxtNode& rTxtNd = const_cast<SwTxtNode&>(pTxtTOXMark->GetTxtNode()); ASSERT( rTxtNd.GetpSwpHints(), "kann nicht geloescht werden" ); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - // fuers Undo die Attribute sichern - ClearRedo(); + // save attributes for Undo + GetIDocumentUndoRedo().ClearRedo(); SwUndoResetAttr* pUndo = new SwUndoResetAttr( SwPosition( rTxtNd, SwIndex( &rTxtNd, *pTxtTOXMark->GetStart() ) ), RES_TXTATR_TOXMARK ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); SwRegHistory aRHst( rTxtNd, &pUndo->GetHistory() ); rTxtNd.GetpSwpHints()->Register( &aRHst ); @@ -203,7 +204,7 @@ void SwDoc::DeleteTOXMark( const SwTOXMark* pTOXMark ) rTxtNd.DeleteAttribute( const_cast<SwTxtTOXMark*>(pTxtTOXMark) ); - if ( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { if( rTxtNd.GetpSwpHints() ) rTxtNd.GetpSwpHints()->DeRegister(); @@ -364,7 +365,7 @@ const SwTOXBaseSection* SwDoc::InsertTableOf( const SwPosition& rPos, const SfxItemSet* pSet, BOOL bExpand ) { - StartUndo( UNDO_INSTOX, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_INSTOX, NULL ); String sSectNm( rTOX.GetTOXName() ); sSectNm = GetUniqueTOXBaseName( *rTOX.GetTOXType(), &sSectNm ); @@ -406,7 +407,7 @@ sNm.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "_Head" )); } } - EndUndo( UNDO_INSTOX, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_INSTOX, NULL ); return pNewSection; } @@ -548,7 +549,7 @@ BOOL SwDoc::DeleteTOX( const SwTOXBase& rTOXBase, BOOL bDelNodes ) SwSectionFmt* pFmt = rTOXSect.GetFmt(); if( pFmt ) { - StartUndo( UNDO_CLEARTOXRANGE, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_CLEARTOXRANGE, NULL ); /* Save the start node of the TOX' section. */ SwSectionNode * pMyNode = pFmt->GetSectionNode(); @@ -620,7 +621,7 @@ BOOL SwDoc::DeleteTOX( const SwTOXBase& rTOXBase, BOOL bDelNodes ) DelSectionFmt( pFmt, bDelNodes ); - EndUndo( UNDO_CLEARTOXRANGE, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_CLEARTOXRANGE, NULL ); bRet = TRUE; } diff --git a/sw/source/core/doc/extinput.cxx b/sw/source/core/doc/extinput.cxx index f627870932f9..ebc5a66b7694 100644 --- a/sw/source/core/doc/extinput.cxx +++ b/sw/source/core/doc/extinput.cxx @@ -28,19 +28,23 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" +#include <com/sun/star/i18n/ScriptType.hpp> + +#include <editeng/langitem.hxx> +#include <editeng/scripttypeitem.hxx> -#include <hintids.hxx> #include <vcl/keycodes.hxx> #include <vcl/cmdevt.hxx> + +#include <hintids.hxx> #include <extinput.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <index.hxx> #include <ndtxt.hxx> #include <txtfrm.hxx> #include <swundo.hxx> -#include <editeng/langitem.hxx> -#include <editeng/scripttypeitem.hxx> -#include <com/sun/star/i18n/ScriptType.hpp> + using namespace ::com::sun::star; @@ -106,12 +110,14 @@ SwExtTextInput::~SwExtTextInput() if( bInsText ) { rIdx = nSttCnt; - pDoc->StartUndo( UNDO_OVERWRITE, NULL ); + pDoc->GetIDocumentUndoRedo().StartUndo( + UNDO_OVERWRITE, NULL ); pDoc->Overwrite( *this, sTxt.Copy( 0, sOverwriteText.Len() )); pDoc->InsertString( *this, sTxt.Copy( sOverwriteText.Len() ) ); - pDoc->EndUndo( UNDO_OVERWRITE, NULL ); + pDoc->GetIDocumentUndoRedo().EndUndo( + UNDO_OVERWRITE, NULL ); } } else diff --git a/sw/source/core/doc/poolfmt.cxx b/sw/source/core/doc/poolfmt.cxx index e5cfc065db2a..cbe594dc93aa 100644 --- a/sw/source/core/doc/poolfmt.cxx +++ b/sw/source/core/doc/poolfmt.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <hintids.hxx> #include <i18npool/mslangid.hxx> #include <unotools/localedatawrapper.hxx> @@ -54,6 +55,7 @@ #include <editeng/scriptspaceitem.hxx> #include <viewopt.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <fmtanchr.hxx> #include <fmtornt.hxx> #include <fmtsrnd.hxx> @@ -67,9 +69,7 @@ #include <fmtcol.hxx> #include <ndtxt.hxx> #include <fmtline.hxx> -#ifndef _POOLFMT_HRC #include <poolfmt.hrc> -#endif #include <GetMetricVal.hxx> #include <numrule.hxx> @@ -1164,8 +1164,8 @@ SwFmt* SwDoc::GetFmtFromPool( USHORT nId ) { BOOL bIsModified = IsModified(); - BOOL bDoesUndo = DoesUndo(); - DoUndo(FALSE); + bool const bDoesUndo = GetIDocumentUndoRedo().DoesUndo(); + GetIDocumentUndoRedo().DoUndo(false); switch (nId & (COLL_GET_RANGE_BITS + POOLGRP_NOCOLLID) ) { case POOLGRP_CHARFMT: @@ -1180,7 +1180,7 @@ SwFmt* SwDoc::GetFmtFromPool( USHORT nId ) break; } - DoUndo(bDoesUndo); + GetIDocumentUndoRedo().DoUndo(bDoesUndo); if( !bIsModified ) ResetModified(); @@ -1486,10 +1486,10 @@ SwPageDesc* SwDoc::GetPageDescFromPool( sal_uInt16 nId, bool bRegardLanguage ) { BOOL bIsModified = IsModified(); - BOOL bDoesUndo = DoesUndo(); - DoUndo(FALSE); + bool const bDoesUndo = GetIDocumentUndoRedo().DoesUndo(); + GetIDocumentUndoRedo().DoUndo(false); n = MakePageDesc( aNm, 0, bRegardLanguage ); - DoUndo(bDoesUndo); + GetIDocumentUndoRedo().DoUndo(bDoesUndo); pNewPgDsc = aPageDescs[ n ]; pNewPgDsc->SetPoolFmtId( nId ); diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx index e19e60e645df..93053c64d658 100644 --- a/sw/source/core/doc/tblcpy.cxx +++ b/sw/source/core/doc/tblcpy.cxx @@ -35,6 +35,7 @@ #include <svl/zforlist.hxx> #include <frmfmt.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <cntfrm.hxx> #include <pam.hxx> #include <swtable.hxx> @@ -558,9 +559,9 @@ void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox, if( pUndo ) pUndo->AddBoxBefore( *pDstBox, bDelCntnt ); - BOOL bUndo = pDoc->DoesUndo(); + bool const bUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); bool bUndoRedline = pUndo && pDoc->IsRedlineOn(); - pDoc->DoUndo( FALSE ); + pDoc->GetIDocumentUndoRedo().DoUndo(false); SwNodeIndex aSavePos( aInsIdx, -1 ); if( pRg.get() ) @@ -686,7 +687,7 @@ void lcl_CpyBox( const SwTable& rCpyTbl, const SwTableBox* pCpyBox, } } - pDoc->DoUndo( bUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); } BOOL SwTable::InsNewTable( const SwTable& rCpyTbl, const SwSelBoxes& rSelBoxes, diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx index 9c2ce7af3139..98f8d6345762 100644 --- a/sw/source/core/docnode/ndcopy.cxx +++ b/sw/source/core/docnode/ndcopy.cxx @@ -28,16 +28,15 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" +#include <editeng/brkitem.hxx> #define _ZFORLIST_DECLARE_TABLE #include <hintids.hxx> - - -#include <editeng/brkitem.hxx> #include <fmtpdsc.hxx> #include <fmtanchr.hxx> #include <fmtcntnt.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <pam.hxx> #include <ndtxt.hxx> #include <fldbas.hxx> @@ -142,8 +141,8 @@ namespace const SwDoc* pSrcDoc = rPam.GetDoc(); SwDoc* pDestDoc = rCpyPam.GetDoc(); const IDocumentMarkAccess* const pSrcMarkAccess = pSrcDoc->getIDocumentMarkAccess(); - bool bDoesUndo = pDestDoc->DoesUndo(); - pDestDoc->DoUndo(false); + bool const bDoesUndo = pDestDoc->GetIDocumentUndoRedo().DoesUndo(); + pDestDoc->GetIDocumentUndoRedo().DoUndo(false); const SwPosition &rStt = *rPam.Start(), &rEnd = *rPam.End(); SwPosition* pCpyStt = rCpyPam.Start(); @@ -209,7 +208,7 @@ namespace pNewMetadatable->RegisterAsCopyOf(*pMetadatable); } } - pDestDoc->DoUndo(bDoesUndo); + pDestDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); } } @@ -647,8 +646,8 @@ void lcl_DeleteRedlines( const SwPaM& rPam, SwPaM& rCpyPam ) RedlineMode_t eOld = pDestDoc->GetRedlineMode(); pDestDoc->SetRedlineMode_intern( (RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE)); - BOOL bDoesUndo = pDestDoc->DoesUndo(); - pDestDoc->DoUndo( FALSE ); + bool const bDoesUndo = pDestDoc->GetIDocumentUndoRedo().DoesUndo(); + pDestDoc->GetIDocumentUndoRedo().DoUndo(false); do { pDestDoc->DeleteAndJoin( *(SwPaM*)pDelPam->GetNext() ); @@ -658,7 +657,7 @@ void lcl_DeleteRedlines( const SwPaM& rPam, SwPaM& rCpyPam ) } while( TRUE ); delete pDelPam; - pDestDoc->DoUndo( bDoesUndo ); + pDestDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); pDestDoc->SetRedlineMode_intern( eOld ); } } @@ -737,8 +736,8 @@ SwDoc::CopyRange( SwPaM& rPam, SwPosition& rPos, const bool bCopyAll ) const "please tell me what you did to get here!"); pDoc->SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE)); - BOOL bDoUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); // Auf jedenfall Undo abschalten + bool const bDoUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); // undo must be turned off // dann kopiere den Bereich im unteren DokumentBereich, // (mit Start/End-Nodes geklammert) und verschiebe diese // dann an die gewuenschte Stelle. @@ -747,7 +746,7 @@ SwDoc::CopyRange( SwPaM& rPam, SwPosition& rPos, const bool bCopyAll ) const SwPaM aPam( rPos ); // UndoBereich sichern if( bDoUndo ) { - pDoc->ClearRedo(); + pDoc->GetIDocumentUndoRedo().ClearRedo(); pUndo = new SwUndoCpyDoc( aPam ); } @@ -775,11 +774,11 @@ SwDoc::CopyRange( SwPaM& rPam, SwPosition& rPos, const bool bCopyAll ) const pDoc->DeleteSection( pNode ); // Bereich wieder loeschen // falls Undo eingeschaltet ist, so speicher den eingefuegten Bereich - pDoc->DoUndo( bDoUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bDoUndo); if( bDoUndo ) { pUndo->SetInsertRange( aPam ); - pDoc->AppendUndo( pUndo ); + pDoc->GetIDocumentUndoRedo().AppendUndo(pUndo); } if( pRedlineRange ) @@ -889,11 +888,11 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos, SwTblNumFmtMerge aTNFM( *this, *pDoc ); - if( pDoc->DoesUndo() ) + if (pDoc->GetIDocumentUndoRedo().DoesUndo()) { - pDoc->ClearRedo(); + pDoc->GetIDocumentUndoRedo().ClearRedo(); pUndo = new SwUndoCpyDoc( aCpyPam ); - pDoc->AppendUndo( pUndo ); + pDoc->GetIDocumentUndoRedo().AppendUndo( pUndo ); } RedlineMode_t eOld = pDoc->GetRedlineMode(); @@ -976,10 +975,11 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos, else if( !bOneNode || bColumnSel ) { xub_StrLen nCntntEnd = pEnd->nContent.GetIndex(); - BOOL bDoesUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + bool const bDoesUndo = + pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); pDoc->SplitNode( rPos, false ); - pDoc->DoUndo( bDoesUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); if( bCanMoveBack && rPos == *aCpyPam.GetPoint() ) { @@ -1106,10 +1106,10 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos, // splitte den TextNode, bei dem Eingefuegt wird. xub_StrLen nCntntEnd = pEnd->nContent.GetIndex(); - BOOL bDoesUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); pDoc->SplitNode( rPos, false ); - pDoc->DoUndo( bDoesUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); if( bCanMoveBack && rPos == *aCpyPam.GetPoint() ) { @@ -1285,8 +1285,10 @@ bool SwDoc::CopyImpl( SwPaM& rPam, SwPosition& rPos, lcl_DeleteRedlines( rPam, aCpyPam ); // falls Undo eingeschaltet ist, so speicher den eingefuegten Bereich - if( pDoc->DoesUndo() ) + if (pDoc->GetIDocumentUndoRedo().DoesUndo()) + { pUndo->SetInsertRange( aCpyPam, TRUE, bStartIsTxtNode ); + } if( pCpyRange ) { @@ -1350,10 +1352,10 @@ void SwDoc::CopyWithFlyInFly( const SwNodeRange& rRg, const xub_StrLen nEndConte #endif // Undo abschalten - BOOL bUndo = pDest->DoesUndo(); - pDest->DoUndo( FALSE ); + bool const bUndo = pDest->GetIDocumentUndoRedo().DoesUndo(); + pDest->GetIDocumentUndoRedo().DoUndo(false); CopyFlyInFlyImpl( rRg, nEndContentIndex, aSavePos, bCopyFlyAtFly ); - pDest->DoUndo( bUndo ); + pDest->GetIDocumentUndoRedo().DoUndo(bUndo); SwNodeRange aCpyRange( aSavePos, rInsPos ); diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx index 306560272c6f..197674d4663b 100644 --- a/sw/source/core/docnode/ndsect.cxx +++ b/sw/source/core/docnode/ndsect.cxx @@ -38,6 +38,7 @@ #include <txtftn.hxx> #include <fmtclds.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <rootfrm.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -58,9 +59,7 @@ #include <node2lay.hxx> #include <doctxm.hxx> #include <fmtftntx.hxx> -#ifndef _COMCORE_HRC #include <comcore.hrc> -#endif // --> OD 2005-12-01 #i27138# #include <viewsh.hxx> #include <txtfrm.hxx> @@ -188,12 +187,13 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData, } SwUndoInsSection* pUndoInsSect = 0; - if( DoesUndo() ) + bool const bUndo(GetIDocumentUndoRedo().DoesUndo()); + if (bUndo) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); pUndoInsSect = new SwUndoInsSection(rRange, rNewData, pAttr, pTOXBase); - AppendUndo( pUndoInsSect ); - DoUndo( FALSE ); + GetIDocumentUndoRedo().AppendUndo( pUndoInsSect ); + GetIDocumentUndoRedo().DoUndo(false); } SwSectionFmt* const pFmt = MakeSectionFmt( 0 ); @@ -374,7 +374,7 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData, { pUndoInsSect->SetSectNdPos( pNewSectNode->GetIndex() ); pUndoInsSect->SetUpdtFtnFlag( bUpdateFtn ); - DoUndo( TRUE ); + GetIDocumentUndoRedo().DoUndo(bUndo); } if (rNewData.IsLinkType()) @@ -527,7 +527,7 @@ void SwDoc::DelSectionFmt( SwSectionFmt *pFmt, BOOL bDelNodes ) { USHORT nPos = pSectionFmtTbl->GetPos( pFmt ); - StartUndo(UNDO_DELSECTION, NULL); + GetIDocumentUndoRedo().StartUndo(UNDO_DELSECTION, NULL); if( USHRT_MAX != nPos ) { @@ -541,24 +541,24 @@ void SwDoc::DelSectionFmt( SwSectionFmt *pFmt, BOOL bDelNodes ) const SwSectionNode* pSectNd; - if( DoesUndo() ) + if( GetIDocumentUndoRedo().DoesUndo() ) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); if( bDelNodes && pIdx && &GetNodes() == &pIdx->GetNodes() && 0 != (pSectNd = pIdx->GetNode().GetSectionNode() )) { SwNodeIndex aUpdIdx( *pIdx ); - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); SwPaM aPaM( *pSectNd->EndOfSectionNode(), *pSectNd ); - AppendUndo( new SwUndoDelete( aPaM )); + GetIDocumentUndoRedo().AppendUndo( new SwUndoDelete( aPaM )); if( pFtnEndAtTxtEnd ) GetFtnIdxs().UpdateFtn( aUpdIdx ); SetModified(); //#126178# start/end undo have to be pairs! - EndUndo(UNDO_DELSECTION, NULL); + GetIDocumentUndoRedo().EndUndo(UNDO_DELSECTION, NULL); return ; } - AppendUndo( MakeUndoDelSection( *pFmt ) ); + GetIDocumentUndoRedo().AppendUndo( MakeUndoDelSection( *pFmt ) ); } else if( bDelNodes && pIdx && &GetNodes() == &pIdx->GetNodes() && 0 != (pSectNd = pIdx->GetNode().GetSectionNode() )) @@ -569,7 +569,7 @@ void SwDoc::DelSectionFmt( SwSectionFmt *pFmt, BOOL bDelNodes ) GetFtnIdxs().UpdateFtn( aUpdIdx ); SetModified(); //#126178# start/end undo have to be pairs! - EndUndo(UNDO_DELSECTION, NULL); + GetIDocumentUndoRedo().EndUndo(UNDO_DELSECTION, NULL); return ; } @@ -613,7 +613,7 @@ void SwDoc::DelSectionFmt( SwSectionFmt *pFmt, BOOL bDelNodes ) //FEATURE::CONDCOLL } - EndUndo(UNDO_DELSECTION, NULL); + GetIDocumentUndoRedo().EndUndo(UNDO_DELSECTION, NULL); SetModified(); } @@ -651,22 +651,23 @@ void SwDoc::UpdateSection(sal_uInt16 const nPos, SwSectionData & rNewData, if( bOnlyAttrChg ) { - const BOOL bDoesUndo = DoesUndo(); - if( DoesUndo() ) + bool const bDoesUndo = GetIDocumentUndoRedo().DoesUndo(); + if (bDoesUndo) { - ClearRedo(); - AppendUndo( MakeUndoUpdateSection( *pFmt, true ) ); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo( + MakeUndoUpdateSection( *pFmt, true ) ); // --> FME 2004-10-13 #i32968# // Inserting columns in the section causes MakeFrmFmt to put two // objects of type SwUndoFrmFmt on the undo stack. We don't want them. - DoUndo( FALSE ); + GetIDocumentUndoRedo().DoUndo(false); // <-- } pFmt->SetFmtAttr( *pAttr ); SetModified(); // --> FME 2004-10-13 #i32968# - DoUndo( bDoesUndo ); + GetIDocumentUndoRedo().DoUndo( bDoesUndo ); // <-- } return; @@ -692,15 +693,15 @@ void SwDoc::UpdateSection(sal_uInt16 const nPos, SwSectionData & rNewData, } } - const BOOL bDoesUndo = DoesUndo(); - if( DoesUndo() ) + bool const bDoesUndo = GetIDocumentUndoRedo().DoesUndo(); + if (bDoesUndo) { - ClearRedo(); - AppendUndo( MakeUndoUpdateSection( *pFmt, false ) ); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo(MakeUndoUpdateSection(*pFmt, false)); // --> FME 2004-10-13 #i32968# // Inserting columns in the section causes MakeFrmFmt to put two // objects of type SwUndoFrmFmt on the undo stack. We don't want them. - DoUndo( FALSE ); + GetIDocumentUndoRedo().DoUndo(false); // <-- } @@ -772,7 +773,7 @@ void SwDoc::UpdateSection(sal_uInt16 const nPos, SwSectionData & rNewData, SetModified(); // --> FME 2004-10-13 #i32968# - DoUndo( bDoesUndo ); + GetIDocumentUndoRedo().DoUndo(bDoesUndo); // <-- } @@ -1097,7 +1098,6 @@ SwSectionNode::~SwSectionNode() pLast = aIter++; } } - SwDoc* pDoc = GetDoc(); SwSectionFmt* pFmt = m_pSection->GetFmt(); if( pFmt ) @@ -1108,12 +1108,6 @@ SwSectionNode::~SwSectionNode() pFmt->ResetFmtAttr( RES_CNTNT ); pFmt->UnlockModify(); } - - BOOL bUndo = pDoc->DoesUndo(); - // verhinder beim Loeschen aus der Undo/Redo-History einen rekursiven Aufruf - if( bUndo && &pDoc->GetNodes() != &GetNodes() ) - pDoc->DoUndo( FALSE ); - pDoc->DoUndo( bUndo ); } diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 588ef88f7740..dc517e1a88ca 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -30,9 +30,6 @@ #include <com/sun/star/chart2/XChartDocument.hpp> -#ifdef WTC -#define private public -#endif #include <hintids.hxx> #include <editeng/lrspitem.hxx> @@ -53,6 +50,7 @@ #include <pagefrm.hxx> #include <tabcol.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <cntfrm.hxx> #include <pam.hxx> #include <swcrsr.hxx> @@ -83,9 +81,7 @@ #include <section.hxx> #include <frmtool.hxx> #include <node2lay.hxx> -#ifndef _COMCORE_HRC #include <comcore.hrc> -#endif #include "docsh.hxx" #include <tabcol.hxx> #include <unochart.hxx> @@ -137,7 +133,7 @@ public: lcl_DelRedlines::lcl_DelRedlines( SwPaM & rPam) : pDoc( rPam.GetDoc() ) { - pDoc->StartUndo(UNDO_EMPTY, NULL); + pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); if( !pDoc->IsIgnoreRedline() && pDoc->GetRedlineTbl().Count() ) pDoc->AcceptRedline( rPam, true ); } @@ -390,10 +386,11 @@ const SwTable* SwDoc::InsertTable( const SwInsertTableOptions& rInsTblOpts, String aTblName = GetUniqueTblName(); - if( DoesUndo() ) + if( GetIDocumentUndoRedo().DoesUndo() ) { - ClearRedo(); - AppendUndo( new SwUndoInsTbl( rPos, nCols, nRows, static_cast<USHORT>(eAdjust), + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo( + new SwUndoInsTbl( rPos, nCols, nRows, static_cast<USHORT>(eAdjust), rInsTblOpts, pTAFmt, pColArr, aTblName)); } @@ -692,15 +689,15 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, #endif SwUndoTxtToTbl* pUndo = 0; - if( DoesUndo() ) + if( GetIDocumentUndoRedo().DoesUndo() ) { - StartUndo( UNDO_TEXTTOTABLE, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_TEXTTOTABLE, NULL ); pUndo = new SwUndoTxtToTbl( aOriginal, rInsTblOpts, cCh, static_cast<USHORT>(eAdjust), pTAFmt ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); // das Splitten vom TextNode nicht in die Undohistory aufnehmen - DoUndo( FALSE ); + GetIDocumentUndoRedo().DoUndo( false ); } ::PaMCorrAbs( aOriginal, *pEnd ); @@ -739,7 +736,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, // Wir gehen jetzt immer ueber die Upper, um die Tabelle einzufuegen: SwNode2Layout aNode2Layout( aRg.aStart.GetNode() ); - DoUndo( 0 != pUndo ); + GetIDocumentUndoRedo().DoUndo( 0 != pUndo ); // dann erstelle die Box/Line/Table-Struktur SwTableBoxFmt* pBoxFmt = MakeTableBoxFmt(); @@ -916,7 +913,9 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTblOpts, } if( pUndo ) - EndUndo( UNDO_TEXTTOTABLE, NULL ); + { + GetIDocumentUndoRedo().EndUndo( UNDO_TEXTTOTABLE, NULL ); + } SetModified(); SetFieldsDirty(true, NULL, 0); @@ -1146,15 +1145,16 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > lcl_DelRedlines aDelRedl( aOriginal ); #endif - SwUndoTxtToTbl* pUndo = 0; - if( DoesUndo() ) +// SwUndoTxtToTbl* pUndo = 0; + bool const bUndo(GetIDocumentUndoRedo().DoesUndo()); + if (bUndo) { -// StartUndo( UNDO_TEXTTOTABLE ); +// GetIDocumentUndoRedo().StartUndo( UNDO_TEXTTOTABLE ); // pUndo = new SwUndoTxtToTbl( aOriginal, rInsTblOpts, cCh, eAdjust, pTAFmt ); -// AppendUndo( pUndo ); +// GetIDocumentUndoRedo().AppendUndo(pUndo); // das Splitten vom TextNode nicht in die Undohistory aufnehmen - DoUndo( FALSE ); + GetIDocumentUndoRedo().DoUndo(false); } ::PaMCorrAbs( aOriginal, *pEnd ); @@ -1193,7 +1193,7 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > // Wir gehen jetzt immer ueber die Upper, um die Tabelle einzufuegen: SwNode2Layout aNode2Layout( aRg.aStart.GetNode() ); - DoUndo( 0 != pUndo ); + GetIDocumentUndoRedo().DoUndo(bUndo); // dann erstelle die Box/Line/Table-Struktur SwTableBoxFmt* pBoxFmt = MakeTableBoxFmt(); @@ -1264,7 +1264,7 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > } // if( pUndo ) -// EndUndo( UNDO_TEXTTOTABLE ); +// GetIDocumentUndoRedo().EndUndo( UNDO_TEXTTOTABLE ); SetModified(); SetFieldsDirty( true, NULL, 0 ); @@ -1530,9 +1530,9 @@ BOOL SwDoc::TableToText( const SwTableNode* pTblNd, sal_Unicode cCh ) SwNodeRange aRg( *pTblNd, 0, *pTblNd->EndOfSectionNode() ); SwUndoTblToTxt* pUndo = 0; SwNodeRange* pUndoRg = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); pUndoRg = new SwNodeRange( aRg.aStart, -1, aRg.aEnd, +1 ); pUndo = new SwUndoTblToTxt( pTblNd->GetTable(), cCh ); } @@ -1547,7 +1547,7 @@ BOOL SwDoc::TableToText( const SwTableNode* pTblNd, sal_Unicode cCh ) pUndoRg->aStart++; pUndoRg->aEnd--; pUndo->SetRange( *pUndoRg ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo(pUndo); delete pUndoRg; } @@ -1802,9 +1802,10 @@ BOOL SwDoc::InsertCol( const SwSelBoxes& rBoxes, USHORT nCnt, BOOL bBehind ) SwTableSortBoxes aTmpLst( 0, 5 ); SwUndoTblNdsChg* pUndo = 0; - if( DoesUndo() ) + bool const bUndo(GetIDocumentUndoRedo().DoesUndo()); + if (bUndo) { - DoUndo( FALSE ); + GetIDocumentUndoRedo().DoUndo(false); pUndo = new SwUndoTblNdsChg( UNDO_TABLE_INSCOL, rBoxes, *pTblNd, 0, 0, nCnt, bBehind, FALSE ); aTmpLst.Insert( &rTbl.GetTabSortBoxes(), 0, rTbl.GetTabSortBoxes().Count() ); @@ -1824,12 +1825,12 @@ BOOL SwDoc::InsertCol( const SwSelBoxes& rBoxes, USHORT nCnt, BOOL bBehind ) if( pUndo ) { - DoUndo( TRUE ); + GetIDocumentUndoRedo().DoUndo(bUndo); if( bRet ) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); pUndo->SaveNewBoxes( *pTblNd, aTmpLst ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } else delete pUndo; @@ -1867,9 +1868,10 @@ BOOL SwDoc::InsertRow( const SwSelBoxes& rBoxes, USHORT nCnt, BOOL bBehind ) SwTableSortBoxes aTmpLst( 0, 5 ); SwUndoTblNdsChg* pUndo = 0; - if( DoesUndo() ) + bool const bUndo(GetIDocumentUndoRedo().DoesUndo()); + if (bUndo) { - DoUndo( FALSE ); + GetIDocumentUndoRedo().DoUndo(false); pUndo = new SwUndoTblNdsChg( UNDO_TABLE_INSROW,rBoxes, *pTblNd, 0, 0, nCnt, bBehind, FALSE ); aTmpLst.Insert( &rTbl.GetTabSortBoxes(), 0, rTbl.GetTabSortBoxes().Count() ); @@ -1889,12 +1891,12 @@ BOOL SwDoc::InsertRow( const SwSelBoxes& rBoxes, USHORT nCnt, BOOL bBehind ) if( pUndo ) { - DoUndo( TRUE ); + GetIDocumentUndoRedo().DoUndo(bUndo); if( bRet ) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); pUndo->SaveNewBoxes( *pTblNd, aTmpLst ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } else delete pUndo; @@ -2004,9 +2006,9 @@ BOOL SwDoc::DeleteRow( const SwCursor& rCursor ) // dann loesche doch die Zeilen - StartUndo(UNDO_ROW_DELETE, NULL); + GetIDocumentUndoRedo().StartUndo(UNDO_ROW_DELETE, NULL); BOOL bResult = DeleteRowCol( aBoxes ); - EndUndo(UNDO_ROW_DELETE, NULL); + GetIDocumentUndoRedo().EndUndo(UNDO_ROW_DELETE, NULL); return bResult; } @@ -2030,9 +2032,9 @@ BOOL SwDoc::DeleteCol( const SwCursor& rCursor ) } // dann loesche doch die Spalten - StartUndo(UNDO_COL_DELETE, NULL); + GetIDocumentUndoRedo().StartUndo(UNDO_COL_DELETE, NULL); BOOL bResult = DeleteRowCol( aBoxes, true ); - EndUndo(UNDO_COL_DELETE, NULL); + GetIDocumentUndoRedo().EndUndo(UNDO_COL_DELETE, NULL); return bResult; } @@ -2107,9 +2109,9 @@ BOOL SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn ) // kein Fly ?? also Kopf- oder Fusszeile: dann immer einen // TextNode ueberig lassen. aIdx++; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); SwPaM aPaM( *pTblNd->EndOfSectionNode(), aIdx.GetNode() ); if( bNewTxtNd ) @@ -2165,7 +2167,7 @@ BOOL SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn ) pUndo->SetTblDelLastNd(); pUndo->SetPgBrkFlags( bSavePageBreak, bSavePageDesc ); pUndo->SetTableName(pTblNd->GetTable().GetFrmFmt()->GetName()); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } else { @@ -2212,9 +2214,10 @@ BOOL SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn ) } SwUndoTblNdsChg* pUndo = 0; - if( DoesUndo() ) + bool const bUndo(GetIDocumentUndoRedo().DoesUndo()); + if (bUndo) { - DoUndo( FALSE ); + GetIDocumentUndoRedo().DoUndo(false); pUndo = new SwUndoTblNdsChg( UNDO_TABLE_DELBOX, aSelBoxes, *pTblNd, nMin, nMax, 0, FALSE, FALSE ); } @@ -2240,11 +2243,11 @@ BOOL SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn ) if( pUndo ) { - DoUndo( TRUE ); + GetIDocumentUndoRedo().DoUndo(bUndo); if( bRet ) { - ClearRedo(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } else delete pUndo; @@ -2276,10 +2279,10 @@ BOOL SwDoc::SplitTbl( const SwSelBoxes& rBoxes, sal_Bool bVert, USHORT nCnt, SvULongs aNdsCnts; SwTableSortBoxes aTmpLst( 0, 5 ); SwUndoTblNdsChg* pUndo = 0; - BOOL bDoUndo = DoesUndo(); + bool const bDoUndo = GetIDocumentUndoRedo().DoesUndo(); if( bDoUndo ) { - DoUndo( FALSE ); + GetIDocumentUndoRedo().DoUndo(false); pUndo = new SwUndoTblNdsChg( UNDO_TABLE_SPLIT, rBoxes, *pTblNd, 0, 0, nCnt, bVert, bSameHeight ); @@ -2311,17 +2314,17 @@ BOOL SwDoc::SplitTbl( const SwSelBoxes& rBoxes, sal_Bool bVert, USHORT nCnt, SetFieldsDirty( true, NULL, 0 ); } - DoUndo( bDoUndo ); + GetIDocumentUndoRedo().DoUndo( bDoUndo ); if( pUndo ) { if( bRet ) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); if( bVert ) pUndo->SaveNewBoxes( *pTblNd, aTmpLst ); else pUndo->SaveNewBoxes( *pTblNd, aTmpLst, rBoxes, aNdsCnts ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } else delete pUndo; @@ -2350,7 +2353,7 @@ USHORT SwDoc::MergeTbl( SwPaM& rPam ) } // --> FME 2004-10-08 #i33394# - StartUndo( UNDO_TABLE_MERGE, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_TABLE_MERGE, NULL ); // <-- #ifdef DEL_TABLE_REDLINES @@ -2360,9 +2363,9 @@ USHORT SwDoc::MergeTbl( SwPaM& rPam ) RedlineMode_t eOld = GetRedlineMode(); SetRedlineMode_intern((RedlineMode_t)(eOld | nsRedlineMode_t::REDLINE_IGNORE)); - SwUndoTblMerge* pUndo = 0; - if( DoesUndo() ) - pUndo = new SwUndoTblMerge( rPam ); + SwUndoTblMerge *const pUndo( (GetIDocumentUndoRedo().DoesUndo()) + ? new SwUndoTblMerge( rPam ) + : 0 ); // lasse ueber das Layout die Boxen suchen SwSelBoxes aBoxes; @@ -2375,9 +2378,10 @@ USHORT SwDoc::MergeTbl( SwPaM& rPam ) if( pUndo ) { delete pUndo; - if( UNDO_REDLINE == GetUndoIds(NULL, NULL) ) + if (UNDO_REDLINE == GetIDocumentUndoRedo().GetUndoIds(NULL, NULL)) { - SwUndoRedline* pU = (SwUndoRedline*)RemoveLastUndo( UNDO_REDLINE ); + SwUndoRedline *const pU = static_cast<SwUndoRedline*>( + GetIDocumentUndoRedo().RemoveLastUndo(UNDO_REDLINE)); if( pU->GetRedlSaveCount() ) { SwUndoIter aUndoIter( &rPam, UNDO_REDLINE ); @@ -2418,7 +2422,9 @@ USHORT SwDoc::MergeTbl( SwPaM& rPam ) SetModified(); SetFieldsDirty( true, NULL, 0 ); if( pUndo ) - AppendUndo( pUndo ); + { + GetIDocumentUndoRedo().AppendUndo( pUndo ); + } } else if( pUndo ) delete pUndo; @@ -2429,7 +2435,7 @@ USHORT SwDoc::MergeTbl( SwPaM& rPam ) ::ClearFEShellTabCols(); SetRedlineMode_intern( eOld ); } - EndUndo( UNDO_TABLE_MERGE, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_TABLE_MERGE, NULL ); return nRet; } @@ -2929,7 +2935,7 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, BOOL bCurColOnly, const SwCursor* GetTabRows( aOld, 0, pBoxFrm ); - StartUndo( UNDO_TABLE_ATTR, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_TABLE_ATTR, NULL ); // check for differences between aOld and rNew: const USHORT nCount = rNew.Count(); @@ -3012,7 +3018,7 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, BOOL bCurColOnly, const SwCursor* } } - EndUndo( UNDO_TABLE_ATTR, NULL ); + GetIDocumentUndoRedo().EndUndo( UNDO_TABLE_ATTR, NULL ); ::ClearFEShellTabCols(); } @@ -3023,10 +3029,11 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, BOOL bCurColOnly, const SwCursor* void SwDoc::SetTabCols(SwTable& rTab, const SwTabCols &rNew, const SwTabCols &rOld, const SwTableBox *pStart, BOOL bCurRowOnly ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoAttrTbl( *rTab.GetTableNode(), TRUE )); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo( + new SwUndoAttrTbl( *rTab.GetTableNode(), TRUE )); } rTab.SetTabCols( rNew, rOld, pStart, bCurRowOnly ); ::ClearFEShellTabCols(); @@ -3038,10 +3045,11 @@ void SwDoc::SetRowsToRepeat( SwTable &rTable, USHORT nSet ) if( nSet == rTable.GetRowsToRepeat() ) return; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoTblHeadline( rTable, rTable.GetRowsToRepeat() , nSet) ); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo( + new SwUndoTblHeadline(rTable, rTable.GetRowsToRepeat(), nSet) ); } SwMsgPoolItem aChg( RES_TBLHEADLINECHG ); @@ -3249,8 +3257,10 @@ BOOL SwDoc::SplitTable( const SwPosition& rPos, USHORT eHdlnMode, SwTableFmlUpdate aMsgHnt( &rTbl ); SwHistory aHistory; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) + { aMsgHnt.pHistory = &aHistory; + } { ULONG nSttIdx = pNd->FindTableBoxStartNode()->GetIndex(); @@ -3287,10 +3297,12 @@ BOOL SwDoc::SplitTable( const SwPosition& rPos, USHORT eHdlnMode, { SwSaveRowSpan* pSaveRowSp = pNew->GetTable().CleanUpTopRowSpan( rTbl.GetTabLines().Count() ); SwUndoSplitTbl* pUndo = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( pUndo = new SwUndoSplitTbl( *pNew, pSaveRowSp, eHdlnMode, bCalcNewSize )); + GetIDocumentUndoRedo().ClearRedo(); + pUndo = new SwUndoSplitTbl( + *pNew, pSaveRowSp, eHdlnMode, bCalcNewSize); + GetIDocumentUndoRedo().AppendUndo(pUndo); if( aHistory.Count() ) pUndo->SaveFormula( aHistory ); } @@ -3612,11 +3624,11 @@ BOOL SwDoc::MergeTable( const SwPosition& rPos, BOOL bWithPrev, USHORT nMode ) // beide Tabellen vorhanden, also kanns losgehen SwUndoMergeTbl* pUndo = 0; SwHistory* pHistory = 0; - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( pUndo = new SwUndoMergeTbl( *pTblNd, *pDelTblNd, - bWithPrev, nMode )); + GetIDocumentUndoRedo().ClearRedo(); + pUndo = new SwUndoMergeTbl( *pTblNd, *pDelTblNd, bWithPrev, nMode ); + GetIDocumentUndoRedo().AppendUndo(pUndo); pHistory = new SwHistory; } @@ -3873,11 +3885,13 @@ BOOL SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& rNe // Undo abschalten, Attribute werden sich vorher gemerkt SwUndoTblAutoFmt* pUndo = 0; - if( DoesUndo() ) + bool const bUndo(GetIDocumentUndoRedo().DoesUndo()); + if (bUndo) { - ClearRedo(); - AppendUndo( pUndo = new SwUndoTblAutoFmt( *pTblNd, rNew ) ); - DoUndo( FALSE ); + GetIDocumentUndoRedo().ClearRedo(); + pUndo = new SwUndoTblAutoFmt( *pTblNd, rNew ); + GetIDocumentUndoRedo().AppendUndo(pUndo); + GetIDocumentUndoRedo().DoUndo(false); } _SetAFmtTabPara aPara( rNew ); @@ -3909,7 +3923,9 @@ BOOL SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& rNe } if( pUndo ) - DoUndo( TRUE ); + { + GetIDocumentUndoRedo().DoUndo(bUndo); + } SetModified(); SetFieldsDirty( true, NULL, 0 ); @@ -4062,6 +4078,7 @@ BOOL SwDoc::SetColRowWidthHeight( SwTableBox& rAktBox, USHORT eType, aMsgHnt.eFlags = TBL_BOXPTR; UpdateTblFlds( &aMsgHnt ); + bool const bUndo(GetIDocumentUndoRedo().DoesUndo()); BOOL bRet = FALSE; switch( eType & 0xff ) { @@ -4072,7 +4089,7 @@ BOOL SwDoc::SetColRowWidthHeight( SwTableBox& rAktBox, USHORT eType, { bRet = pTblNd->GetTable().SetColWidth( rAktBox, eType, nAbsDiff, nRelDiff, - DoesUndo() ? &pUndo : 0 ); + (bUndo) ? &pUndo : 0 ); } break; case nsTblChgWidthHeightType::WH_ROW_TOP: @@ -4081,15 +4098,15 @@ BOOL SwDoc::SetColRowWidthHeight( SwTableBox& rAktBox, USHORT eType, case nsTblChgWidthHeightType::WH_CELL_BOTTOM: bRet = pTblNd->GetTable().SetRowHeight( rAktBox, eType, nAbsDiff, nRelDiff, - DoesUndo() ? &pUndo : 0 ); + (bUndo) ? &pUndo : 0 ); break; } if( pUndo ) { - ClearRedo(); - AppendUndo( pUndo ); - DoUndo( TRUE ); // im SetColWidth kann es abgeschaltet werden! + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo( pUndo ); + GetIDocumentUndoRedo().DoUndo(bUndo); // SetColWidth can turn it off } if( bRet ) @@ -4123,9 +4140,9 @@ void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, BOOL bCallUpdate ) bChgd = FALSE; else { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - StartUndo( UNDO_TABLE_AUTOFMT, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_TABLE_AUTOFMT, NULL ); pUndo = new SwUndoTblNumFmt( rBox ); pUndo->SetNumFmt( nFmtIdx, fNumber ); } @@ -4198,9 +4215,9 @@ void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, BOOL bCallUpdate ) SFX_ITEM_SET == pBoxFmt->GetItemState( RES_BOXATR_VALUE, FALSE, &pValueItem )) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - StartUndo( UNDO_TABLE_AUTOFMT, NULL ); + GetIDocumentUndoRedo().StartUndo( UNDO_TABLE_AUTOFMT, NULL ); pUndo = new SwUndoTblNumFmt( rBox ); } @@ -4231,8 +4248,8 @@ void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, BOOL bCallUpdate ) if( pUndo ) { pUndo->SetBox( rBox ); - AppendUndo( pUndo ); - EndUndo( UNDO_END, NULL ); + GetIDocumentUndoRedo().AppendUndo(pUndo); + GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); } const SwTableNode* pTblNd = rBox.GetSttNd()->FindTableNode(); @@ -4252,10 +4269,10 @@ void SwDoc::ChkBoxNumFmt( SwTableBox& rBox, BOOL bCallUpdate ) void SwDoc::SetTblBoxFormulaAttrs( SwTableBox& rBox, const SfxItemSet& rSet ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoTblNumFmt( rBox, &rSet ) ); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo( new SwUndoTblNumFmt(rBox, &rSet) ); } SwFrmFmt* pBoxFmt = rBox.ClaimFrmFmt(); @@ -4291,10 +4308,10 @@ void SwDoc::ClearBoxNumAttrs( const SwNodeIndex& rNode ) SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_FORMULA, FALSE ) || SFX_ITEM_SET == rSet.GetItemState( RES_BOXATR_VALUE, FALSE )) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoTblNumFmt( *pBox ) ); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo(new SwUndoTblNumFmt(*pBox)); } SwFrmFmt* pBoxFmt = pBox->ClaimFrmFmt(); @@ -4333,14 +4350,15 @@ BOOL SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes, SwTableNode* pInsTblNd = GetNodes()[ rInsPos.nNode ]->FindTableNode(); + bool const bUndo( GetIDocumentUndoRedo().DoesUndo() ); if( !pCpyTbl && !pInsTblNd ) { SwUndoCpyTbl* pUndo = 0; - if( DoesUndo() ) + if (bUndo) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); pUndo = new SwUndoCpyTbl; - DoUndo( FALSE ); + GetIDocumentUndoRedo().DoUndo(false); } bRet = pSrcTblNd->GetTable().MakeCopy( this, rInsPos, rBoxes, @@ -4354,9 +4372,9 @@ BOOL SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes, pInsTblNd = GetNodes()[ rInsPos.nNode.GetIndex() - 1 ]->FindTableNode(); pUndo->SetTableSttIdx( pInsTblNd->GetIndex() ); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } - DoUndo( TRUE ); + GetIDocumentUndoRedo().DoUndo(bUndo); } } else @@ -4368,11 +4386,11 @@ BOOL SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes, nsRedlineMode_t::REDLINE_SHOW_DELETE)); SwUndoTblCpyTbl* pUndo = 0; - if( DoesUndo() ) + if (bUndo) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); pUndo = new SwUndoTblCpyTbl; - DoUndo( FALSE ); + GetIDocumentUndoRedo().DoUndo(false); } SwDoc* pCpyDoc = (SwDoc*)pSrcTblNd->GetDoc(); @@ -4396,7 +4414,7 @@ BOOL SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes, if( pUndo ) { - DoUndo( TRUE ); + GetIDocumentUndoRedo().DoUndo(bUndo); delete pUndo; } return FALSE; @@ -4455,8 +4473,10 @@ BOOL SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes, if( !bRet && pUndo->IsEmpty() ) delete pUndo; else - AppendUndo( pUndo ); - DoUndo( TRUE ); + { + GetIDocumentUndoRedo().AppendUndo(pUndo); + } + GetIDocumentUndoRedo().DoUndo(bUndo); } if( bCorrPos ) @@ -4480,8 +4500,9 @@ BOOL SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes, BOOL SwDoc::_UnProtectTblCells( SwTable& rTbl ) { BOOL bChgd = FALSE; - SwUndoAttrTbl* pUndo = DoesUndo() ? new SwUndoAttrTbl( *rTbl.GetTableNode() ) - : 0; + SwUndoAttrTbl *const pUndo = (GetIDocumentUndoRedo().DoesUndo()) + ? new SwUndoAttrTbl( *rTbl.GetTableNode() ) + : 0; SwTableSortBoxes& rSrtBox = rTbl.GetTabSortBoxes(); for( USHORT i = rSrtBox.Count(); i; ) @@ -4498,8 +4519,8 @@ BOOL SwDoc::_UnProtectTblCells( SwTable& rTbl ) { if( bChgd ) { - ClearRedo(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } else delete pUndo; @@ -4527,7 +4548,7 @@ BOOL SwDoc::UnProtectCells( const SwSelBoxes& rBoxes ) BOOL bChgd = FALSE; if( rBoxes.Count() ) { - SwUndoAttrTbl* pUndo = DoesUndo() + SwUndoAttrTbl *const pUndo = (GetIDocumentUndoRedo().DoesUndo()) ? new SwUndoAttrTbl( *rBoxes[0]->GetSttNd()->FindTableNode() ) : 0; @@ -4556,8 +4577,8 @@ BOOL SwDoc::UnProtectCells( const SwSelBoxes& rBoxes ) { if( bChgd ) { - ClearRedo(); - AppendUndo( pUndo ); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo( pUndo ); } else delete pUndo; @@ -4568,7 +4589,7 @@ BOOL SwDoc::UnProtectCells( const SwSelBoxes& rBoxes ) BOOL SwDoc::UnProtectTbls( const SwPaM& rPam ) { - StartUndo(UNDO_EMPTY, NULL); + GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); BOOL bChgd = FALSE, bHasSel = rPam.HasMark() || rPam.GetNext() != (SwPaM*)&rPam; @@ -4602,7 +4623,7 @@ BOOL SwDoc::UnProtectTbls( const SwPaM& rPam ) bChgd |= _UnProtectTblCells( *pTbl ); } - EndUndo(UNDO_EMPTY, NULL); + GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); if( bChgd ) SetModified(); diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index c561f10d0a3f..87d875986f14 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -29,10 +29,6 @@ #include "precompiled_sw.hxx" -#ifdef WTC -#define private public -#endif - #include "hintids.hxx" #include <editeng/lrspitem.hxx> #include <editeng/boxitem.hxx> @@ -49,7 +45,8 @@ #include <cntfrm.hxx> #include <txtfrm.hxx> #include <svx/svxids.hrc> -#include "doc.hxx" +#include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include "pam.hxx" #include "swcrsr.hxx" #include "viscrs.hxx" @@ -337,10 +334,10 @@ void SwDoc::SetRowSplit( const SwCursor& rCursor, const SwFmtRowSplit &rNew ) if( aRowArr.Count() ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoAttrTbl( *pTblNd )); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo(new SwUndoAttrTbl(*pTblNd)); } SvPtrarr aFmtCmp( Max( BYTE(255), BYTE(aRowArr.Count()) ), 255 ); @@ -398,10 +395,10 @@ void SwDoc::SetRowHeight( const SwCursor& rCursor, const SwFmtFrmSize &rNew ) if( aRowArr.Count() ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoAttrTbl( *pTblNd )); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo(new SwUndoAttrTbl(*pTblNd)); } SvPtrarr aFmtCmp( Max( BYTE(255), BYTE(aRowArr.Count()) ), 255 ); @@ -472,10 +469,11 @@ BOOL SwDoc::BalanceRowHeight( const SwCursor& rCursor, BOOL bTstOnly ) } SwFmtFrmSize aNew( ATT_MIN_SIZE, 0, nHeight ); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoAttrTbl( *pTblNd )); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo( + new SwUndoAttrTbl(*pTblNd)); } SvPtrarr aFmtCmp( Max( BYTE(255), BYTE(aRowArr.Count()) ), 255 ); @@ -504,10 +502,10 @@ void SwDoc::SetRowBackground( const SwCursor& rCursor, const SvxBrushItem &rNew if( aRowArr.Count() ) { - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoAttrTbl( *pTblNd )); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo(new SwUndoAttrTbl(*pTblNd)); } SvPtrarr aFmtCmp( Max( BYTE(255), BYTE(aRowArr.Count()) ), 255 ); @@ -600,10 +598,10 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet ) if( aUnions.Count() ) { SwTable& rTable = pTblNd->GetTable(); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoAttrTbl( *pTblNd )); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo( new SwUndoAttrTbl(*pTblNd) ); } SvPtrarr aFmtCmp( 255, 255 ); @@ -849,10 +847,10 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor, if( aUnions.Count() ) { SwTable& rTable = pTblNd->GetTable(); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoAttrTbl( *pTblNd )); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo(new SwUndoAttrTbl(*pTblNd)); } for( USHORT i = 0; i < aUnions.Count(); ++i ) @@ -1132,10 +1130,10 @@ void SwDoc::SetBoxAttr( const SwCursor& rCursor, const SfxPoolItem &rNew ) if( pTblNd && ::lcl_GetBoxSel( rCursor, aBoxes, TRUE ) ) { SwTable& rTable = pTblNd->GetTable(); - if( DoesUndo() ) + if (GetIDocumentUndoRedo().DoesUndo()) { - ClearRedo(); - AppendUndo( new SwUndoAttrTbl( *pTblNd )); + GetIDocumentUndoRedo().ClearRedo(); + GetIDocumentUndoRedo().AppendUndo( new SwUndoAttrTbl(*pTblNd) ); } SvPtrarr aFmtCmp( Max( BYTE(255), BYTE(aBoxes.Count()) ), 255 ); diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index 1d387df76063..04a12ee68cfd 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -29,8 +29,10 @@ #include "precompiled_sw.hxx" #include <stdlib.h> + #include <node.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <pam.hxx> #include <txtfld.hxx> #include <fmtfld.hxx> @@ -1841,10 +1843,10 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes ) if( rNodes.IsDocNodes() ) { SwDoc* const pInsDoc = pDestNd->GetDoc(); - const bool bIsUndo = pInsDoc->DoesUndo(); - pInsDoc->DoUndo( false ); + bool const bIsUndo(pInsDoc->GetIDocumentUndoRedo().DoesUndo()); + pInsDoc->GetIDocumentUndoRedo().DoUndo(false); pInsDoc->SplitNode( rPos, false ); - pInsDoc->DoUndo( bIsUndo ); + pInsDoc->GetIDocumentUndoRedo().DoUndo(bIsUndo); } else { @@ -1872,10 +1874,10 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes ) if( bCopyCollFmt ) { SwDoc* const pInsDoc = pDestNd->GetDoc(); - const bool bIsUndo = pInsDoc->DoesUndo(); - pInsDoc->DoUndo( false ); + bool const bIsUndo( pInsDoc->GetIDocumentUndoRedo().DoesUndo() ); + pInsDoc->GetIDocumentUndoRedo().DoUndo(false); pSrcNd->CopyCollFmt( *pDestNd ); - pInsDoc->DoUndo( bIsUndo ); + pInsDoc->GetIDocumentUndoRedo().DoUndo(bIsUndo); bCopyCollFmt = FALSE; } @@ -1911,10 +1913,11 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes ) if( rNodes.IsDocNodes() ) { SwDoc* const pInsDoc = pDestNd->GetDoc(); - const bool bIsUndo = pInsDoc->DoesUndo(); - pInsDoc->DoUndo( false ); + bool const bIsUndo = + pInsDoc->GetIDocumentUndoRedo().DoesUndo(); + pInsDoc->GetIDocumentUndoRedo().DoUndo(false); pInsDoc->SplitNode( rPos, false ); - pInsDoc->DoUndo( bIsUndo ); + pInsDoc->GetIDocumentUndoRedo().DoUndo(bIsUndo); } else { @@ -1966,10 +1969,10 @@ void SwNodes::MoveRange( SwPaM & rPam, SwPosition & rPos, SwNodes& rNodes ) if( bCopyCollFmt ) { SwDoc* const pInsDoc = pDestNd->GetDoc(); - const bool bIsUndo = pInsDoc->DoesUndo(); - pInsDoc->DoUndo( false ); + bool const bIsUndo(pInsDoc->GetIDocumentUndoRedo().DoesUndo()); + pInsDoc->GetIDocumentUndoRedo().DoUndo(false); pEndSrcNd->CopyCollFmt( *pDestNd ); - pInsDoc->DoUndo( bIsUndo ); + pInsDoc->GetIDocumentUndoRedo().DoUndo(bIsUndo); } } } diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 2d54cb88f2e6..a2252e1c61b3 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -28,8 +28,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include <stdlib.h> + #include <hintids.hxx> #include <svl/intitem.hxx> #include <svl/stritem.hxx> @@ -46,6 +46,7 @@ #include <fmtpdsc.hxx> #include <errhdl.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <node.hxx> #include <pam.hxx> #include <frmtool.hxx> @@ -274,10 +275,10 @@ SwSection::~SwSection() { // Bug: 28191 - nicht ins Undo aufnehmen, sollte schon vorher // geschehen sein!! - BOOL bUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + bool const bUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); pDoc->DelSectionFmt( pFmt ); // und loeschen - pDoc->DoUndo( bUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); } } if (m_RefObj.Is()) @@ -1444,8 +1445,8 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType, // <-- // Undo immer abschalten - BOOL bWasUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + bool const bWasUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); BOOL bWasVisibleLinks = pDoc->IsVisibleLinks(); pDoc->SetVisibleLinks( FALSE ); @@ -1681,9 +1682,9 @@ void SwIntrnlSectRefLink::DataChanged( const String& rMimeType, } - // Alle UndoActions entfernen und Undo wieder einschalten - pDoc->DelAllUndoObj(); - pDoc->DoUndo( bWasUndo ); + // remove all undo actions and turn undo on again + pDoc->GetIDocumentUndoRedo().DelAllUndoObj(); + pDoc->GetIDocumentUndoRedo().DoUndo(bWasUndo); pDoc->SetVisibleLinks( bWasVisibleLinks ); pDoc->UnlockExpFlds(); diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx index 441b474c6b27..2142053586d2 100644 --- a/sw/source/core/draw/dview.cxx +++ b/sw/source/core/draw/dview.cxx @@ -52,6 +52,7 @@ #include <ndole.hxx> #include <fmtanchr.hxx> #include "shellres.hxx" +#include <IDocumentUndoRedo.hxx> // #i7672# #include <editeng/outliner.hxx> @@ -1085,7 +1086,7 @@ void SwDrawView::DeleteMarked() SwDoc* pDoc = Imp().GetShell()->GetDoc(); if ( pDoc->GetRootFrm() ) pDoc->GetRootFrm()->StartAllAction(); - pDoc->StartUndo(UNDO_EMPTY, NULL); + pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); // OD 18.06.2003 #108784# - replace marked <SwDrawVirtObj>-objects by its // reference objects. { @@ -1104,7 +1105,7 @@ void SwDrawView::DeleteMarked() FmFormView::DeleteMarked(); ::FrameNotify( Imp().GetShell(), FLY_DRAG_END ); } - pDoc->EndUndo(UNDO_EMPTY, NULL); + pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); if( pDoc->GetRootFrm() ) pDoc->GetRootFrm()->EndAllAction(); } diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index 639bab3c10c5..d0f625c3fd9a 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -36,7 +36,11 @@ #include <hintids.hxx> #include <svl/svstdarr.hxx> + #include <unotools/charclass.hxx> + +#include <vcl/msgbox.hxx> + #include <editeng/boxitem.hxx> #include <editeng/lrspitem.hxx> #include <editeng/brkitem.hxx> @@ -46,12 +50,13 @@ #include <editeng/langitem.hxx> #include <editeng/cscoitem.hxx> #include <editeng/unolingu.hxx> - #include <editeng/acorrcfg.hxx> + #include <swwait.hxx> #include <fmtpdsc.hxx> #include <fmtanchr.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docary.hxx> #include <editsh.hxx> #include <index.hxx> @@ -72,13 +77,8 @@ #include <frmatr.hxx> #include <charatr.hxx> #include <mdiexp.hxx> -#ifndef _STATSTR_HRC #include <statstr.hrc> -#endif -#ifndef _COMCORE_HRC #include <comcore.hrc> -#endif -#include <vcl/msgbox.hxx> #include <numrule.hxx> using namespace ::com::sun::star; @@ -2253,7 +2253,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, pDoc->SetRedlineMode( eRedlMode ); // save undo state (might be turned off) - sal_Bool bUndoState = pDoc->DoesUndo(); + bool const bUndoState = pDoc->GetIDocumentUndoRedo().DoesUndo(); // wenn mehrere Zeilen, dann erstmal nicht mit // dem nachfolgenden Absatz zusammenfassen. @@ -2273,7 +2273,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, { // #95884# limit redline array size to prevent overflow and to conserve // memory - if( pDoc->HasTooManyUndos() ) + if (pDoc->GetIDocumentUndoRedo().HasTooManyUndos()) { DBG_ASSERT( bUndoState, "undo overflow without undo?" ); @@ -2299,8 +2299,8 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, if( nResult == RET_YES ) { // turn off undo and continue - pDoc->DoUndo( sal_False ); - pDoc->DelAllUndoObj(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); + pDoc->GetIDocumentUndoRedo().DelAllUndoObj(); } else if( nResult == RET_NO ) { @@ -2709,7 +2709,7 @@ SwAutoFormat::SwAutoFormat( SwEditShell* pEdShell, SvxSwAutoFmtFlags& rFlags, pDoc->SetRedlineMode( eOldMode ); // restore undo (in case it has been changed) - pDoc->DoUndo( bUndoState ); + pDoc->GetIDocumentUndoRedo().DoUndo(bUndoState); // Prozent-Anzeige wieder abschalten if( !aFlags.bAFmtByInput ) diff --git a/sw/source/core/edit/edatmisc.cxx b/sw/source/core/edit/edatmisc.cxx index 6fda3a164c32..ede8dfc415dc 100644 --- a/sw/source/core/edit/edatmisc.cxx +++ b/sw/source/core/edit/edatmisc.cxx @@ -28,9 +28,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include <editsh.hxx> #include <doc.hxx> // fuer aNodes +#include <IDocumentUndoRedo.hxx> #include <pam.hxx> // fuer SwPaM #include <edimp.hxx> // fuer MACROS #include <swundo.hxx> // fuer die UndoIds @@ -49,7 +49,9 @@ void SwEditShell::ResetAttr( const SvUShortsSort* pAttrs ) StartAllAction(); BOOL bUndoGroup = GetCrsr()->GetNext() != GetCrsr(); if( bUndoGroup ) - GetDoc()->StartUndo(UNDO_RESETATTR, NULL); + { + GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_RESETATTR, NULL); + } FOREACHPAM_START(this) // if ( PCURCRSR->HasMark() ) @@ -57,7 +59,9 @@ void SwEditShell::ResetAttr( const SvUShortsSort* pAttrs ) FOREACHPAM_END() if( bUndoGroup ) - GetDoc()->EndUndo(UNDO_RESETATTR, NULL); + { + GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_RESETATTR, NULL); + } CallChgLnk(); EndAllAction(); } @@ -133,7 +137,7 @@ void SwEditShell::SetAttr( const SfxPoolItem& rHint, USHORT nFlags ) if( pCrsr->GetNext() != pCrsr ) // Ring von Cursorn { BOOL bIsTblMode = IsTableMode(); - GetDoc()->StartUndo(UNDO_INSATTR, NULL); + GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_INSATTR, NULL); FOREACHPAM_START(this) if( PCURCRSR->HasMark() && ( bIsTblMode || @@ -143,7 +147,7 @@ void SwEditShell::SetAttr( const SfxPoolItem& rHint, USHORT nFlags ) } FOREACHPAM_END() - GetDoc()->EndUndo(UNDO_INSATTR, NULL); + GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_INSATTR, NULL); } else { @@ -163,7 +167,7 @@ void SwEditShell::SetAttr( const SfxItemSet& rSet, USHORT nFlags ) if( pCrsr->GetNext() != pCrsr ) // Ring von Cursorn { BOOL bIsTblMode = IsTableMode(); - GetDoc()->StartUndo(UNDO_INSATTR, NULL); + GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_INSATTR, NULL); FOREACHPAM_START(this) if( PCURCRSR->HasMark() && ( bIsTblMode || @@ -173,7 +177,7 @@ void SwEditShell::SetAttr( const SfxItemSet& rSet, USHORT nFlags ) } FOREACHPAM_END() - GetDoc()->EndUndo(UNDO_INSATTR, NULL); + GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_INSATTR, NULL); } else { diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx index a996ed802a42..94af09755280 100644 --- a/sw/source/core/edit/eddel.cxx +++ b/sw/source/core/edit/eddel.cxx @@ -31,6 +31,7 @@ #include <hintids.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <editsh.hxx> #include <cntfrm.hxx> #include <pam.hxx> @@ -68,7 +69,7 @@ void SwEditShell::DeleteSel( SwPaM& rPam, BOOL* pUndo ) // in Tabellen das Undo gruppieren if( pUndo && !*pUndo ) { - GetDoc()->StartUndo( UNDO_START, NULL ); + GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); *pUndo = TRUE; } SwPaM aDelPam( *rPam.Start() ); @@ -129,7 +130,7 @@ long SwEditShell::Delete() SwRewriter aRewriter; aRewriter.AddRule(UNDO_ARG1, String(SW_RES(STR_MULTISEL))); - GetDoc()->StartUndo( UNDO_DELETE, &aRewriter ); + GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_DELETE, &aRewriter); } FOREACHPAM_START(this) @@ -138,7 +139,9 @@ long SwEditShell::Delete() // falls eine Undo-Klammerung, dann hier beenden if( bUndo ) - GetDoc()->EndUndo( UNDO_DELETE, NULL ); + { + GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_DELETE, NULL ); + } EndAllAction(); nRet = 1; } @@ -207,7 +210,7 @@ long SwEditShell::Copy( SwEditShell* pDestShell ) // For block selection this list is filled with the insert positions std::list< boost::shared_ptr<SwPosition> >::iterator pNextInsert = aInsertList.begin(); - pDestShell->GetDoc()->StartUndo( UNDO_START, NULL ); + pDestShell->GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); FOREACHPAM_START(this) if( !pPos ) @@ -289,7 +292,7 @@ long SwEditShell::Copy( SwEditShell* pDestShell ) #endif // Undo-Klammerung hier beenden - pDestShell->GetDoc()->EndUndo( UNDO_END, NULL ); + pDestShell->GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); pDestShell->EndAllAction(); pDestShell->SaveTblBoxCntnt( pDestShell->GetCrsr()->GetPoint() ); @@ -312,7 +315,7 @@ BOOL SwEditShell::Replace( const String& rNewStr, BOOL bRegExpRplc ) if( !HasReadonlySel() ) { StartAllAction(); - GetDoc()->StartUndo(UNDO_EMPTY, NULL); + GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); FOREACHPAM_START(this) if( PCURCRSR->HasMark() && *PCURCRSR->GetMark() != *PCURCRSR->GetPoint() ) @@ -324,7 +327,7 @@ BOOL SwEditShell::Replace( const String& rNewStr, BOOL bRegExpRplc ) FOREACHPAM_END() // Undo-Klammerung hier beenden - GetDoc()->EndUndo(UNDO_EMPTY, NULL); + GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); EndAllAction(); } return bRet; diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index c3dc53f1ba26..f333e51c812c 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -33,6 +33,7 @@ #include <editeng/brkitem.hxx> #include <editsh.hxx> #include <doc.hxx> // fuer SwTxtFmtColls +#include <IDocumentUndoRedo.hxx> #include <edimp.hxx> // fuer MACROS #include <ndtxt.hxx> #include <paratr.hxx> @@ -77,7 +78,7 @@ void SwEditShell::SetTxtFmtColl( SwTxtFmtColl *pFmt, SwRewriter aRewriter; aRewriter.AddRule(UNDO_ARG1, pLocal->GetName()); - GetDoc()->StartUndo(UNDO_SETFMTCOLL, &aRewriter); + GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_SETFMTCOLL, &aRewriter); FOREACHPAM_START(this) if( !PCURCRSR->HasReadonlySel( @@ -87,7 +88,7 @@ void SwEditShell::SetTxtFmtColl( SwTxtFmtColl *pFmt, GetDoc()->SetTxtFmtColl( *PCURCRSR, pLocal, true, bResetListAttrs ); FOREACHPAM_END() - GetDoc()->EndUndo(UNDO_SETFMTCOLL, NULL); + GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_SETFMTCOLL, NULL); EndAllAction(); } // <-- diff --git a/sw/source/core/edit/edglbldc.cxx b/sw/source/core/edit/edglbldc.cxx index 6f884f244326..1dc91c3e4bda 100644 --- a/sw/source/core/edit/edglbldc.cxx +++ b/sw/source/core/edit/edglbldc.cxx @@ -28,8 +28,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <editsh.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -52,7 +52,9 @@ void SwEditShell::SetGlblDocSaveLinks( BOOL bFlag ) { getIDocumentSettingAccess()->set(IDocumentSettingAccess::GLOBAL_DOCUMENT_SAVE_LINKS, bFlag); if( !GetDoc()->IsModified() ) // Bug 57028 - GetDoc()->SetUndoNoResetModified(); + { + GetDoc()->GetIDocumentUndoRedo().SetUndoNoResetModified(); + } GetDoc()->SetModified(); } @@ -169,7 +171,7 @@ BOOL SwEditShell::InsertGlobalDocContent( const SwGlblDocContent& rInsPos, else { bEndUndo = TRUE; - pMyDoc->StartUndo( UNDO_START, NULL ); + pMyDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); rPos.nNode--; pMyDoc->AppendTxtNode( rPos ); pCrsr->SetMark(); @@ -178,7 +180,9 @@ BOOL SwEditShell::InsertGlobalDocContent( const SwGlblDocContent& rInsPos, InsertSection( rNew ); if( bEndUndo ) - pMyDoc->EndUndo( UNDO_END, NULL ); + { + pMyDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); + } EndAllAction(); return TRUE; @@ -209,7 +213,7 @@ BOOL SwEditShell::InsertGlobalDocContent( const SwGlblDocContent& rInsPos, else { bEndUndo = TRUE; - pMyDoc->StartUndo( UNDO_START, NULL ); + pMyDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); rPos.nNode--; pMyDoc->AppendTxtNode( rPos ); } @@ -217,7 +221,9 @@ BOOL SwEditShell::InsertGlobalDocContent( const SwGlblDocContent& rInsPos, InsertTableOf( rTOX ); if( bEndUndo ) - pMyDoc->EndUndo( UNDO_END, NULL ); + { + pMyDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); + } EndAllAction(); return TRUE; diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx index 7a143a2d29d9..4dbe56523482 100644 --- a/sw/source/core/edit/editsh.cxx +++ b/sw/source/core/edit/editsh.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <hintids.hxx> #include <tools/list.hxx> #include <tools/urlobj.hxx> @@ -41,6 +42,7 @@ #include <frmfmt.hxx> #include <charfmt.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docary.hxx> #include <editsh.hxx> #include <frame.hxx> @@ -201,7 +203,7 @@ void SwEditShell::Overwrite(const String &rStr) long SwEditShell::SplitNode( BOOL bAutoFormat, BOOL bCheckTableStart ) { StartAllAction(); - GetDoc()->StartUndo(UNDO_EMPTY, NULL); + GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); FOREACHPAM_START(this) // eine Tabellen Zelle wird jetzt zu einer normalen Textzelle! @@ -209,7 +211,7 @@ long SwEditShell::SplitNode( BOOL bAutoFormat, BOOL bCheckTableStart ) GetDoc()->SplitNode( *PCURCRSR->GetPoint(), bCheckTableStart ); FOREACHPAM_END() - GetDoc()->EndUndo(UNDO_EMPTY, NULL); + GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); if( bAutoFormat ) AutoFmtBySplitNode(); @@ -227,14 +229,14 @@ sal_Bool SwEditShell::AppendTxtNode() { sal_Bool bRet = sal_False; StartAllAction(); - GetDoc()->StartUndo(UNDO_EMPTY, NULL); + GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); FOREACHPAM_START(this) GetDoc()->ClearBoxNumAttrs( PCURCRSR->GetPoint()->nNode ); bRet = GetDoc()->AppendTxtNode( *PCURCRSR->GetPoint()) || bRet; FOREACHPAM_END() - GetDoc()->EndUndo(UNDO_EMPTY, NULL); + GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); ClearTblBoxCntnt(); @@ -752,7 +754,7 @@ BOOL SwEditShell::InsertURL( const SwFmtINetFmt& rFmt, const String& rStr, BOOL if( !rFmt.GetValue().Len() || ( !rStr.Len() && !HasSelection() ) ) return FALSE; StartAllAction(); - GetDoc()->StartUndo( UNDO_UI_INSERT_URLTXT, NULL); + GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_UI_INSERT_URLTXT, NULL); BOOL bInsTxt = TRUE; if( rStr.Len() ) @@ -796,7 +798,7 @@ BOOL SwEditShell::InsertURL( const SwFmtINetFmt& rFmt, const String& rStr, BOOL ClearMark(); if( bInsTxt ) DontExpandFmt(); - GetDoc()->EndUndo( UNDO_UI_INSERT_URLTXT, NULL ); + GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_UI_INSERT_URLTXT, NULL ); EndAllAction(); return TRUE; } @@ -1169,14 +1171,14 @@ void SwEditShell::TransliterateText( sal_uInt32 nType ) SwPaM* pCrsr = GetCrsr(); if( pCrsr->GetNext() != pCrsr ) { - GetDoc()->StartUndo(UNDO_EMPTY, NULL); + GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); FOREACHPAM_START( this ) if( PCURCRSR->HasMark() ) GetDoc()->TransliterateText( *PCURCRSR, aTrans ); FOREACHPAM_END() - GetDoc()->EndUndo(UNDO_EMPTY, NULL); + GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); } else GetDoc()->TransliterateText( *pCrsr, aTrans ); diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx index c9ab4a591383..24057039e1ef 100644 --- a/sw/source/core/edit/edlingu.cxx +++ b/sw/source/core/edit/edlingu.cxx @@ -35,9 +35,7 @@ #include <unoflatpara.hxx> -#ifndef _COMCORE_HRC #include <comcore.hrc> -#endif #include <hintids.hxx> #include <linguistic/lngprops.hxx> #include <vcl/msgbox.hxx> @@ -49,6 +47,7 @@ #include <charatr.hxx> #include <editsh.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <rootfrm.hxx> // SwRootFrm #include <pam.hxx> #include <swundo.hxx> // fuer die UndoIds @@ -57,9 +56,7 @@ #include <viscrs.hxx> // SwShellCrsr #include <SwGrammarMarkUp.hxx> // SwWrongList #include <mdiexp.hxx> // Statusanzeige -#ifndef _STATSTR_HRC #include <statstr.hrc> // StatLine-String -#endif #include <cntfrm.hxx> #include <crsskip.hxx> #include <splargs.hxx> @@ -1334,7 +1331,7 @@ void SwEditShell::ApplyChangedSentence(const ::svx::SpellPortions& rNewPortions, // iterate over the new portions, beginning at the end to take advantage of the previously // saved content positions - pDoc->StartUndo( UNDO_OVERWRITE, NULL ); + pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_OVERWRITE, NULL ); StartAction(); SwPaM *pCrsr = GetCrsr(); @@ -1463,7 +1460,7 @@ void SwEditShell::ApplyChangedSentence(const ::svx::SpellPortions& rNewPortions, // set continuation position for spell/grammar checking to the end of this sentence pSpellIter->SetCurr( new SwPosition( *pCrsr->Start() ) ); - pDoc->EndUndo( UNDO_OVERWRITE, NULL ); + pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_OVERWRITE, NULL ); EndAction(); } } diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx index ea1088f36f69..f5b2ef0fb2b9 100644 --- a/sw/source/core/edit/ednumber.cxx +++ b/sw/source/core/edit/ednumber.cxx @@ -33,6 +33,7 @@ #include <editsh.hxx> #include <edimp.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <ndtxt.hxx> #include <paratr.hxx> #include <swundo.hxx> @@ -153,12 +154,12 @@ BOOL SwEditShell::NoNum() SwPaM* pCrsr = GetCrsr(); if( pCrsr->GetNext() != pCrsr ) // Mehrfachselektion ? { - GetDoc()->StartUndo( UNDO_START, NULL ); + GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); SwPamRanges aRangeArr( *pCrsr ); SwPaM aPam( *pCrsr->GetPoint() ); for( USHORT n = 0; n < aRangeArr.Count(); ++n ) bRet = bRet && GetDoc()->NoNum( aRangeArr.SetPam( n, aPam )); - GetDoc()->EndUndo( UNDO_END, NULL ); + GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); } else bRet = GetDoc()->NoNum( *pCrsr ); @@ -217,14 +218,14 @@ void SwEditShell::DelNumRules() SwPaM* pCrsr = GetCrsr(); if( pCrsr->GetNext() != pCrsr ) // Mehrfachselektion ? { - GetDoc()->StartUndo( UNDO_START, NULL ); + GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); SwPamRanges aRangeArr( *pCrsr ); SwPaM aPam( *pCrsr->GetPoint() ); for( USHORT n = 0; n < aRangeArr.Count(); ++n ) { GetDoc()->DelNumRules( aRangeArr.SetPam( n, aPam ) ); } - GetDoc()->EndUndo( UNDO_END, NULL ); + GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); } else GetDoc()->DelNumRules( *pCrsr ); @@ -255,12 +256,12 @@ BOOL SwEditShell::NumUpDown( BOOL bDown ) bRet = GetDoc()->NumUpDown( *pCrsr, bDown ); else { - GetDoc()->StartUndo( UNDO_START, NULL ); + GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); SwPamRanges aRangeArr( *pCrsr ); SwPaM aPam( *pCrsr->GetPoint() ); for( USHORT n = 0; n < aRangeArr.Count(); ++n ) bRet = bRet && GetDoc()->NumUpDown( aRangeArr.SetPam( n, aPam ), bDown ); - GetDoc()->EndUndo( UNDO_END, NULL ); + GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); } GetDoc()->SetModified(); @@ -517,13 +518,13 @@ BOOL SwEditShell::OutlineUpDown( short nOffset ) bRet = GetDoc()->OutlineUpDown( *pCrsr, nOffset ); else { - GetDoc()->StartUndo( UNDO_START, NULL ); + GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); SwPamRanges aRangeArr( *pCrsr ); SwPaM aPam( *pCrsr->GetPoint() ); for( USHORT n = 0; n < aRangeArr.Count(); ++n ) bRet = bRet && GetDoc()->OutlineUpDown( aRangeArr.SetPam( n, aPam ), nOffset ); - GetDoc()->EndUndo( UNDO_END, NULL ); + GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); } GetDoc()->SetModified(); EndAllAction(); @@ -698,10 +699,11 @@ void SwEditShell::SetCurNumRule( const SwNumRule& rRule, { StartAllAction(); + GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); + SwPaM* pCrsr = GetCrsr(); if( pCrsr->GetNext() != pCrsr ) // Mehrfachselektion ? { - GetDoc()->StartUndo( UNDO_START, NULL ); SwPamRanges aRangeArr( *pCrsr ); SwPaM aPam( *pCrsr->GetPoint() ); for( USHORT n = 0; n < aRangeArr.Count(); ++n ) @@ -715,21 +717,17 @@ void SwEditShell::SetCurNumRule( const SwNumRule& rRule, // <-- GetDoc()->SetCounted( aPam, true ); } - GetDoc()->EndUndo( UNDO_END, NULL ); } else { - GetDoc()->StartUndo( UNDO_START, NULL ); - // --> OD 2008-02-08 #newlistlevelattrs# // --> OD 2008-03-17 #refactorlists# GetDoc()->SetNumRule( *pCrsr, rRule, bCreateNewList, sContinuedListId, sal_True, bResetIndentAttrs ); GetDoc()->SetCounted( *pCrsr, true ); - - GetDoc()->EndUndo( UNDO_END, NULL ); } + GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); EndAllAction(); } @@ -761,12 +759,12 @@ void SwEditShell::SetNumRuleStart( BOOL bFlag ) SwPaM* pCrsr = GetCrsr(); if( pCrsr->GetNext() != pCrsr ) // Mehrfachselektion ? { - GetDoc()->StartUndo( UNDO_START, NULL ); + GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); SwPamRanges aRangeArr( *pCrsr ); SwPaM aPam( *pCrsr->GetPoint() ); for( USHORT n = 0; n < aRangeArr.Count(); ++n ) GetDoc()->SetNumRuleStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), bFlag ); - GetDoc()->EndUndo( UNDO_END, NULL ); + GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); } else GetDoc()->SetNumRuleStart( *pCrsr->GetPoint(), bFlag ); @@ -790,12 +788,12 @@ void SwEditShell::SetNodeNumStart( USHORT nStt ) SwPaM* pCrsr = GetCrsr(); if( pCrsr->GetNext() != pCrsr ) // Mehrfachselektion ? { - GetDoc()->StartUndo( UNDO_START, NULL ); + GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); SwPamRanges aRangeArr( *pCrsr ); SwPaM aPam( *pCrsr->GetPoint() ); for( USHORT n = 0; n < aRangeArr.Count(); ++n ) GetDoc()->SetNodeNumStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), nStt ); - GetDoc()->EndUndo( UNDO_END, NULL ); + GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); } else GetDoc()->SetNodeNumStart( *pCrsr->GetPoint(), nStt ); diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx index ba3c2e9c7966..d8352e9bce81 100644 --- a/sw/source/core/edit/edsect.cxx +++ b/sw/source/core/edit/edsect.cxx @@ -28,9 +28,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - -#include <doc.hxx> #include <editsh.hxx> +#include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <pam.hxx> #include <docary.hxx> #include <swundo.hxx> // fuer die UndoIds @@ -50,7 +50,7 @@ SwEditShell::InsertSection( if( !IsTableMode() ) { StartAllAction(); - GetDoc()->StartUndo( UNDO_INSSECTION, NULL ); + GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_INSSECTION, NULL ); FOREACHPAM_START(this) SwSection const*const pNew = @@ -59,8 +59,7 @@ SwEditShell::InsertSection( pRet = pNew; FOREACHPAM_END() - // Undo-Klammerung hier beenden - GetDoc()->EndUndo( UNDO_INSSECTION, NULL ); + GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_INSSECTION, NULL ); EndAllAction(); } return pRet; diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx index 76a37e4e8627..d363b0ac845a 100644 --- a/sw/source/core/edit/edtab.cxx +++ b/sw/source/core/edit/edtab.cxx @@ -35,9 +35,7 @@ #define _SVSTDARR_ULONGS #include <svl/svstdarr.hxx> -#ifndef _APP_HXX //autogen #include <vcl/svapp.hxx> -#endif #include <vcl/window.hxx> #include <editeng/boxitem.hxx> #include <swwait.hxx> @@ -45,6 +43,7 @@ #include <frmatr.hxx> #include <editsh.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <cntfrm.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -259,7 +258,9 @@ void SwEditShell::SetTblChgMode( TblChgMode eMode ) { ((SwTable&)pTblNd->GetTable()).SetTblChgMode( eMode ); if( !GetDoc()->IsModified() ) // Bug 57028 - GetDoc()->SetUndoNoResetModified(); + { + GetDoc()->GetIDocumentUndoRedo().SetUndoNoResetModified(); + } GetDoc()->SetModified(); } } @@ -331,10 +332,10 @@ void SwEditShell::SetTblBoxFormulaAttrs( const SfxItemSet& rSet ) ClearTblBoxCntnt(); StartAllAction(); - GetDoc()->StartUndo( UNDO_START, NULL ); + GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); for( USHORT n = 0; n < aBoxes.Count(); ++n ) GetDoc()->SetTblBoxFormulaAttrs( *aBoxes[ n ], rSet ); - GetDoc()->EndUndo( UNDO_END, NULL ); + GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); EndAllAction(); } @@ -407,11 +408,11 @@ BOOL SwEditShell::SplitTable( USHORT eMode ) if( pCrsr->GetNode()->FindTableNode() ) { StartAllAction(); - GetDoc()->StartUndo(UNDO_EMPTY, NULL); + GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); bRet = GetDoc()->SplitTable( *pCrsr->GetPoint(), eMode, TRUE ); - GetDoc()->EndUndo(UNDO_EMPTY, NULL); + GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); ClearFEShellTabCols(); EndAllAction(); } @@ -425,11 +426,11 @@ BOOL SwEditShell::MergeTable( BOOL bWithPrev, USHORT nMode ) if( pCrsr->GetNode()->FindTableNode() ) { StartAllAction(); - GetDoc()->StartUndo(UNDO_EMPTY, NULL); + GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); bRet = GetDoc()->MergeTable( *pCrsr->GetPoint(), bWithPrev, nMode ); - GetDoc()->EndUndo(UNDO_EMPTY, NULL); + GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_EMPTY, NULL); ClearFEShellTabCols(); EndAllAction(); } diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx index b1188588fe4d..f718fef947e2 100644 --- a/sw/source/core/edit/edtox.cxx +++ b/sw/source/core/edit/edtox.cxx @@ -27,21 +27,27 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <com/sun/star/util/SearchOptions.hpp> #include <com/sun/star/util/SearchFlags.hpp> #include <com/sun/star/i18n/TransliterationModules.hpp> - #include <tools/urlobj.hxx> -#include <svtools/txtcmp.hxx> -#ifndef SVTOOLS_FSTATHELPER_HXX + #include <svl/fstathelper.hxx> -#endif + +#include <svtools/txtcmp.hxx> + #include <sfx2/docfile.hxx> -#include "editeng/unolingu.hxx" + +#include <xmloff/odffields.hxx> + +#include <editeng/unolingu.hxx> + #include <swtypes.hxx> #include <editsh.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <pam.hxx> #include <viewopt.hxx> #include <ndtxt.hxx> @@ -54,11 +60,8 @@ #include <doctxm.hxx> #include <docary.hxx> #include <mdiexp.hxx> -#ifndef _STATSTR_HRC #include <statstr.hrc> -#endif #include <bookmrk.hxx> -#include <xmloff/odffields.hxx> using namespace ::com::sun::star; @@ -211,7 +214,7 @@ BOOL SwEditShell::UpdateTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet ) ::StartProgress( STR_STATSTR_TOX_UPDATE, 0, 0, pDocSh ); ::SetProgressText( STR_STATSTR_TOX_UPDATE, pDocSh ); - pMyDoc->StartUndo(UNDO_TOXCHANGE, NULL); + pMyDoc->GetIDocumentUndoRedo().StartUndo(UNDO_TOXCHANGE, NULL); // Verzeichnisrumpf erzeugen pTOX->Update(pSet); @@ -226,7 +229,7 @@ BOOL SwEditShell::UpdateTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet ) // Seitennummern eintragen pTOX->UpdatePageNum(); - pMyDoc->EndUndo(UNDO_TOXCHANGE, NULL); + pMyDoc->GetIDocumentUndoRedo().EndUndo(UNDO_TOXCHANGE, NULL); ::EndProgress( pDocSh ); EndAllAction(); diff --git a/sw/source/core/edit/edundo.cxx b/sw/source/core/edit/edundo.cxx index a27b09f5d4ff..71dfaf4c0da3 100644 --- a/sw/source/core/edit/edundo.cxx +++ b/sw/source/core/edit/edundo.cxx @@ -28,11 +28,12 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include <svx/svdview.hxx> + #include <editsh.hxx> #include <fesh.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <pam.hxx> #include <undobj.hxx> #include <swundo.hxx> @@ -54,9 +55,9 @@ BOOL SwEditShell::Undo( SwUndoId nUndoId, USHORT nCnt ) // #105332# current undo state was not saved BOOL bRet = FALSE; - BOOL bSaveDoesUndo = GetDoc()->DoesUndo(); + bool const bSaveDoesUndo = GetDoc()->GetIDocumentUndoRedo().DoesUndo(); - GetDoc()->DoUndo( FALSE ); + GetDoc()->GetIDocumentUndoRedo().DoUndo(false); StartAllAction(); { // eigentlich muesste ja nur der aktuelle Cursor berarbeitet @@ -69,7 +70,8 @@ BOOL SwEditShell::Undo( SwUndoId nUndoId, USHORT nCnt ) // JP 02.04.98: Cursor merken - beim Auto-Format/-Korrektur // soll dieser wieder an die Position - SwUndoId nLastUndoId = GetDoc()->GetUndoIds(NULL, NULL); + SwUndoId const nLastUndoId = + GetDoc()->GetIDocumentUndoRedo().GetUndoIds(NULL, NULL); BOOL bRestoreCrsr = 1 == nCnt && ( UNDO_AUTOFORMAT == nLastUndoId || UNDO_AUTOCORRECT == nLastUndoId ); Push(); @@ -85,7 +87,8 @@ BOOL SwEditShell::Undo( SwUndoId nUndoId, USHORT nCnt ) { do { - bRet = GetDoc()->Undo( aUndoIter ) || bRet; + bRet = GetDoc()->GetIDocumentUndoRedo().Undo( aUndoIter ) + || bRet; if( !aUndoIter.IsNextUndo() ) break; @@ -135,7 +138,7 @@ BOOL SwEditShell::Undo( SwUndoId nUndoId, USHORT nCnt ) EndAllAction(); // #105332# undo state was not restored but set to FALSE everytime - GetDoc()->DoUndo( bSaveDoesUndo ); + GetDoc()->GetIDocumentUndoRedo().DoUndo(bSaveDoesUndo); return bRet; } @@ -146,9 +149,9 @@ USHORT SwEditShell::Redo( USHORT nCnt ) BOOL bRet = FALSE; // #105332# undo state was not saved - BOOL bSaveDoesUndo = GetDoc()->DoesUndo(); + bool const bSaveDoesUndo = GetDoc()->GetIDocumentUndoRedo().DoesUndo(); - GetDoc()->DoUndo( FALSE ); + GetDoc()->GetIDocumentUndoRedo().DoUndo(false); StartAllAction(); { @@ -171,7 +174,8 @@ USHORT SwEditShell::Redo( USHORT nCnt ) { do { - bRet = GetDoc()->Redo( aUndoIter ) || bRet; + bRet = GetDoc()->GetIDocumentUndoRedo().Redo( aUndoIter ) + || bRet; if( !aUndoIter.IsNextUndo() ) break; @@ -222,7 +226,7 @@ USHORT SwEditShell::Redo( USHORT nCnt ) EndAllAction(); // #105332# undo state was not restored but set FALSE everytime - GetDoc()->DoUndo( bSaveDoesUndo ); + GetDoc()->GetIDocumentUndoRedo().DoUndo(bSaveDoesUndo); return bRet; } @@ -235,7 +239,8 @@ USHORT SwEditShell::Repeat( USHORT nCount ) StartAllAction(); SwUndoIter aUndoIter( GetCrsr(), UNDO_EMPTY ); - bRet = GetDoc()->Repeat( aUndoIter, nCount ) || bRet; + bRet = GetDoc()->GetIDocumentUndoRedo().Repeat( aUndoIter, nCount ) + || bRet; EndAllAction(); return bRet; diff --git a/sw/source/core/edit/edws.cxx b/sw/source/core/edit/edws.cxx index 81088bcc0e56..88c6575a4c2d 100644 --- a/sw/source/core/edit/edws.cxx +++ b/sw/source/core/edit/edws.cxx @@ -28,12 +28,11 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - - - #include <vcl/window.hxx> + #include <editsh.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <pam.hxx> #include <docary.hxx> #include <acorrect.hxx> @@ -59,7 +58,7 @@ SwEditShell::SwEditShell( SwEditShell& rEdSH, Window *pWindow ) SwEditShell::SwEditShell( SwDoc& rDoc, Window *pWindow, const SwViewOption *pOptions ) : SwCrsrShell( rDoc, pWindow, pOptions ) { - GetDoc()->DoUndo(true); + GetDoc()->GetIDocumentUndoRedo().DoUndo(true); } @@ -98,7 +97,7 @@ void SwEditShell::ResetModified() void SwEditShell::SetUndoNoResetModified() { GetDoc()->SetModified(); - GetDoc()->SetUndoNoResetModified(); + GetDoc()->GetIDocumentUndoRedo().SetUndoNoResetModified(); } /****************************************************************************** @@ -261,24 +260,24 @@ void SwEditShell::InsertTOXType(const SwTOXType& rTyp) void SwEditShell::DoUndo( sal_Bool bOn ) -{ GetDoc()->DoUndo( bOn ); } +{ GetDoc()->GetIDocumentUndoRedo().DoUndo( bOn ); } sal_Bool SwEditShell::DoesUndo() const -{ return GetDoc()->DoesUndo(); } +{ return GetDoc()->GetIDocumentUndoRedo().DoesUndo(); } void SwEditShell::DoGroupUndo( sal_Bool bOn ) -{ GetDoc()->DoGroupUndo( bOn ); } +{ GetDoc()->GetIDocumentUndoRedo().DoGroupUndo( bOn ); } sal_Bool SwEditShell::DoesGroupUndo() const -{ return GetDoc()->DoesGroupUndo(); } +{ return GetDoc()->GetIDocumentUndoRedo().DoesGroupUndo(); } void SwEditShell::DelAllUndoObj() { - GetDoc()->DelAllUndoObj(); + GetDoc()->GetIDocumentUndoRedo().DelAllUndoObj(); } // Zusammenfassen von Kontinuierlichen Insert/Delete/Overwrite von @@ -289,44 +288,44 @@ void SwEditShell::DelAllUndoObj() SwUndoId SwEditShell::StartUndo( SwUndoId eUndoId, const SwRewriter *pRewriter ) -{ return GetDoc()->StartUndo( eUndoId, pRewriter ); } +{ return GetDoc()->GetIDocumentUndoRedo().StartUndo( eUndoId, pRewriter ); } // schliesst Klammerung der nUndoId, nicht vom UI benutzt SwUndoId SwEditShell::EndUndo(SwUndoId eUndoId, const SwRewriter *pRewriter) -{ return GetDoc()->EndUndo(eUndoId, pRewriter); } +{ return GetDoc()->GetIDocumentUndoRedo().EndUndo(eUndoId, pRewriter); } // liefert die Id der letzten undofaehigen Aktion zurueck // fuellt ggf. VARARR mit sdbcx::User-UndoIds SwUndoId SwEditShell::GetUndoIds(String* pStr,SwUndoIds *pUndoIds) const -{ return GetDoc()->GetUndoIds(pStr,pUndoIds); } +{ return GetDoc()->GetIDocumentUndoRedo().GetUndoIds(pStr,pUndoIds); } String SwEditShell::GetUndoIdsStr(String* pStr,SwUndoIds *pUndoIds) const -{ return GetDoc()->GetUndoIdsStr(pStr,pUndoIds); } +{ return GetDoc()->GetIDocumentUndoRedo().GetUndoIdsStr(pStr,pUndoIds); } // liefert die Id der letzten Redofaehigen Aktion zurueck // fuellt ggf. VARARR mit RedoIds SwUndoId SwEditShell::GetRedoIds(String* pStr,SwUndoIds *pRedoIds) const -{ return GetDoc()->GetRedoIds(pStr,pRedoIds); } +{ return GetDoc()->GetIDocumentUndoRedo().GetRedoIds(pStr,pRedoIds); } String SwEditShell::GetRedoIdsStr(String* pStr,SwUndoIds *pRedoIds) const -{ return GetDoc()->GetRedoIdsStr(pStr,pRedoIds); } +{ return GetDoc()->GetIDocumentUndoRedo().GetRedoIdsStr(pStr,pRedoIds); } // liefert die Id der letzten Repeatfaehigen Aktion zurueck // fuellt ggf. VARARR mit RedoIds SwUndoId SwEditShell::GetRepeatIds(String* pStr, SwUndoIds *pRedoIds) const -{ return GetDoc()->GetRepeatIds(pStr,pRedoIds); } +{ return GetDoc()->GetIDocumentUndoRedo().GetRepeatIds(pStr,pRedoIds); } String SwEditShell::GetRepeatIdsStr(String* pStr, SwUndoIds *pRedoIds) const -{ return GetDoc()->GetRepeatIdsStr(pStr,pRedoIds); } +{ return GetDoc()->GetIDocumentUndoRedo().GetRepeatIdsStr(pStr,pRedoIds); } diff --git a/sw/source/core/fields/usrfld.cxx b/sw/source/core/fields/usrfld.cxx index ccb10ca03ee1..c745538d2013 100644 --- a/sw/source/core/fields/usrfld.cxx +++ b/sw/source/core/fields/usrfld.cxx @@ -28,16 +28,16 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include <svl/zforlist.hxx> #include <svl/zformat.hxx> -#include <svx/svdmodel.hxx> +#include <svx/svdmodel.hxx> #include <calbck.hxx> #include <calc.hxx> #include <usrfld.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <editsh.hxx> #include <dpage.hxx> #include <unofldmid.h> @@ -302,7 +302,9 @@ void SwUserFieldType::SetContent( const String& rStr, sal_uInt32 nFmt ) sal_Bool bModified = GetDoc()->IsModified(); GetDoc()->SetModified(); if( !bModified ) // Bug 57028 - GetDoc()->SetUndoNoResetModified(); + { + GetDoc()->GetIDocumentUndoRedo().SetUndoNoResetModified(); + } } } diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index 79a2b64433d9..cde9ee26adbc 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -68,6 +68,7 @@ #include <txtflcnt.hxx> #include <fesh.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <rootfrm.hxx> #include <ndtxt.hxx> #include <pam.hxx> @@ -104,7 +105,7 @@ BOOL SwFEShell::Copy( SwDoc* pClpDoc, const String* pNewClpTxt ) { ASSERT( pClpDoc, "kein Clipboard-Dokument" ); - pClpDoc->DoUndo( FALSE ); // immer auf FALSE !! + pClpDoc->GetIDocumentUndoRedo().DoUndo(false); // always false! // steht noch Inhalt im ClpDocument, dann muss dieser geloescht werden SwNodeIndex aSttIdx( pClpDoc->GetNodes().GetEndOfExtras(), 2 ); @@ -733,7 +734,7 @@ BOOL SwFEShell::Paste( SwDoc* pClpDoc, BOOL bIncludingPageFrames ) BOOL bRet = TRUE, bDelTbl = TRUE; StartAllAction(); - GetDoc()->StartUndo( UNDO_INSGLOSSARY, NULL ); + GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_INSGLOSSARY, NULL ); GetDoc()->LockExpFlds(); // When the clipboard content has been created by a rectangular selection @@ -1112,7 +1113,7 @@ BOOL SwFEShell::Paste( SwDoc* pClpDoc, BOOL bIncludingPageFrames ) FOREACHPAM_END() } - GetDoc()->EndUndo( UNDO_INSGLOSSARY, NULL ); + GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_INSGLOSSARY, NULL ); // wurden neue Tabellenformeln eingefuegt ? if( pTblFldTyp->GetDepends() ) diff --git a/sw/source/core/frmedt/fedesc.cxx b/sw/source/core/frmedt/fedesc.cxx index fe73c36016a0..db428be133d6 100644 --- a/sw/source/core/frmedt/fedesc.cxx +++ b/sw/source/core/frmedt/fedesc.cxx @@ -28,11 +28,12 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" +#include <tools/ref.hxx> #include <hintids.hxx> -#include <tools/ref.hxx> #include <fesh.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <pagefrm.hxx> #include <rootfrm.hxx> #include <cntfrm.hxx> @@ -42,6 +43,7 @@ #include <tabfrm.hxx> #include <edimp.hxx> #include <SwStyleNameMapper.hxx> + /************************************************************************* |* |* SwFEShell::GetPageDescCnt() @@ -144,11 +146,11 @@ void SwFEShell::ChgPageDesc( USHORT i, const SwPageDesc &rChged ) SET_CURR_SHELL( this ); //Fix i64842: because Undo has a very special way to handle header/footer content // we have to copy the page descriptor before calling ChgPageDesc. - const sal_Bool bDoesUndo( GetDoc()->DoesUndo() ); + bool const bDoesUndo( GetDoc()->GetIDocumentUndoRedo().DoesUndo() ); SwPageDesc aDesc( rChged ); - GetDoc()->DoUndo( sal_False ); + GetDoc()->GetIDocumentUndoRedo().DoUndo(false); GetDoc()->CopyPageDesc(rChged, aDesc); - GetDoc()->DoUndo( bDoesUndo ); + GetDoc()->GetIDocumentUndoRedo().DoUndo(bDoesUndo); GetDoc()->ChgPageDesc( i, aDesc ); EndAllActionAndCall(); } diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index e4d4f2e9b399..dd9b8d9f08ed 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -55,6 +55,7 @@ #include <viewimp.hxx> #include <viscrs.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <dview.hxx> #include <dflyobj.hxx> #include <dcontact.hxx> @@ -707,7 +708,7 @@ const SwFrmFmt *SwFEShell::NewFlyFrm( const SfxItemSet& rSet, sal_Bool bAnchVali SwFlyFrmFmt *pRet; if( bMoveCntnt ) { - GetDoc()->StartUndo( UNDO_INSLAYFMT, NULL ); + GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_INSLAYFMT, NULL ); SwFmtAnchor* pOldAnchor = 0; sal_Bool bHOriChgd = sal_False, bVOriChgd = sal_False; SwFmtVertOrient aOldV; @@ -765,9 +766,14 @@ const SwFrmFmt *SwFEShell::NewFlyFrm( const SfxItemSet& rSet, sal_Bool bAnchVali // das verschieben von TabelleSelektion ist noch nicht // Undofaehig - also darf das UmAnkern auch nicht // aufgezeichnet werden. - sal_Bool bDoesUndo = GetDoc()->DoesUndo(); - if( bDoesUndo && UNDO_INSLAYFMT == GetDoc()->GetUndoIds(NULL, NULL) ) - GetDoc()->DoUndo( sal_False ); + bool const bDoesUndo = + GetDoc()->GetIDocumentUndoRedo().DoesUndo(); + if (bDoesUndo && + (UNDO_INSLAYFMT == + GetDoc()->GetIDocumentUndoRedo().GetUndoIds(NULL, NULL))) + { + GetDoc()->GetIDocumentUndoRedo().DoUndo(false); + } ((SfxItemSet&)rSet).Put( *pOldAnchor ); @@ -777,11 +783,11 @@ const SwFrmFmt *SwFEShell::NewFlyFrm( const SfxItemSet& rSet, sal_Bool bAnchVali ((SfxItemSet&)rSet).Put( aOldV ); GetDoc()->SetFlyFrmAttr( *pRet, (SfxItemSet&)rSet ); - GetDoc()->DoUndo( bDoesUndo ); + GetDoc()->GetIDocumentUndoRedo().DoUndo(bDoesUndo); } delete pOldAnchor; } - GetDoc()->EndUndo( UNDO_INSLAYFMT, NULL ); + GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_INSLAYFMT, NULL ); } else /* #109161# If called from a shell try to propagate an diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index af95f9e7b276..c345991cb422 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -28,15 +28,17 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" -#include <hintids.hxx> #include <editeng/boxitem.hxx> #include <editeng/protitem.hxx> + +#include <hintids.hxx> #include <fmtanchr.hxx> #include <fmtfsize.hxx> #include <frmatr.hxx> #include <tblsel.hxx> #include <crsrsh.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docary.hxx> #include <pam.hxx> #include <ndtxt.hxx> @@ -1449,11 +1451,16 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, SwNodeIndex aSttNdIdx( *rPt.pSelBox->GetSttNd(), 1 ); // ein Node muss in der Box erhalten bleiben (sonst wird beim // Move die gesamte Section geloescht) + bool const bUndo(pDoc->GetIDocumentUndoRedo().DoesUndo()); if( pUndo ) - pDoc->DoUndo( FALSE ); + { + pDoc->GetIDocumentUndoRedo().DoUndo(false); + } pDoc->AppendTxtNode( *aPam.GetPoint() ); if( pUndo ) - pDoc->DoUndo( TRUE ); + { + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); + } SwNodeRange aRg( aSttNdIdx, aPam.GetPoint()->nNode ); rInsPosNd++; if( pUndo ) diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 37ec80632153..0c55f85b9a0b 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -78,6 +78,7 @@ #include <tgrditem.hxx> #include <hfspacingitem.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <pagefrm.hxx> #include <rootfrm.hxx> #include <cntfrm.hxx> @@ -106,9 +107,7 @@ #include <cmdid.h> #include <unomid.h> -#ifndef _COMCORE_HRC #include <comcore.hrc> -#endif #include <svx/svdundo.hxx> // #111827# // OD 2004-05-24 #i28701# #include <sortedobjs.hxx> @@ -244,14 +243,16 @@ void DelHFFormat( SwClient *pToRemove, SwFrmFmt *pFmt ) // beim Loeschen von Header/Footer-Formaten IMMER das Undo // abschalten! (Bug 31069) - sal_Bool bDoesUndo = pDoc->DoesUndo(); - pDoc->DoUndo( sal_False ); + bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); ASSERT( pNode, "Ein grosses Problem." ); pDoc->DeleteSection( pNode ); if( bDoesUndo ) - pDoc->DoUndo( sal_True ); + { + pDoc->GetIDocumentUndoRedo().DoUndo(true); + } } delete pFmt; } diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index 4d9b654fb79c..ba3652bd0d20 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -27,13 +27,15 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <tools/bigint.hxx> #include "pagefrm.hxx" #include "rootfrm.hxx" #include "cntfrm.hxx" #include "flyfrm.hxx" #include "txtfrm.hxx" -#include "doc.hxx" +#include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include "viewsh.hxx" #include "viewimp.hxx" #include "pam.hxx" @@ -1370,7 +1372,7 @@ void SwFlyAtCntFrm::SetAbsPos( const Point &rNew ) nX = rNew.X() - pFrm->Frm().Left() - nBaseOfstForFly; } } - GetFmt()->GetDoc()->StartUndo( UNDO_START, NULL ); + GetFmt()->GetDoc()->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); if( pCnt != GetAnchorFrm() || ( IsAutoPos() && pCnt->IsTxtFrm() && GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::HTML_MODE)) ) @@ -1421,7 +1423,7 @@ void SwFlyAtCntFrm::SetAbsPos( const Point &rNew ) const Point aRelPos = bVert ? Point( -nY, nX ) : Point( nX, nY ); ChgRelPos( aRelPos ); - GetFmt()->GetDoc()->EndUndo( UNDO_END, NULL ); + GetFmt()->GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); if ( pOldPage != FindPageFrm() ) ::Notify_Background( GetVirtDrawObj(), pOldPage, aOld, PREP_FLY_LEAVE, diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx index 358b00e12ca1..73cff76dcbd9 100644 --- a/sw/source/core/swg/SwXMLTextBlocks.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks.cxx @@ -28,7 +28,6 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/embed/XTransactedObject.hpp> #include <tools/urlobj.hxx> @@ -39,9 +38,8 @@ #include <comphelper/storagehelper.hxx> #include <doc.hxx> -#ifndef _DOCSH_HXX +#include <IDocumentUndoRedo.hxx> #include <docsh.hxx> -#endif #include <pam.hxx> #include <swblocks.hxx> #include <ndtxt.hxx> @@ -81,7 +79,7 @@ SwXMLTextBlocks::SwXMLTextBlocks( const String& rFile ) pDoc = pDocSh->GetDoc(); xDocShellRef = pDocSh; pDoc->SetOle2Link( Link() ); - pDoc->DoUndo( FALSE ); // always FALSE + pDoc->GetIDocumentUndoRedo().DoUndo(false); pDoc->acquire(); uno::Reference< embed::XStorage > refStg; if( !aDateModified.GetDate() || !aTimeModified.GetTime() ) @@ -124,7 +122,7 @@ SwXMLTextBlocks::SwXMLTextBlocks( const uno::Reference < embed::XStorage >& rStg pDoc = pDocSh->GetDoc(); xDocShellRef = pDocSh; pDoc->SetOle2Link( Link() ); - pDoc->DoUndo( FALSE ); + pDoc->GetIDocumentUndoRedo().DoUndo(false); pDoc->acquire(); InitBlockMode ( rStg ); diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx index de76b856cda7..59b3240c7cbd 100644 --- a/sw/source/core/table/swnewtable.cxx +++ b/sw/source/core/table/swnewtable.cxx @@ -39,6 +39,7 @@ #include <cellfrm.hxx> #include <fmtfsize.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <vector> #include <set> #include <list> @@ -897,11 +898,16 @@ bool SwTable::PrepareMerge( const SwPaM& rPam, SwSelBoxes& rBoxes, USHORT nL = pCNd ? pCNd->Len() : 0; aPam.GetPoint()->nContent.Assign( pCNd, nL ); SwNodeIndex aSttNdIdx( *pBox->GetSttNd(), 1 ); + bool const bUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); if( pUndo ) - pDoc->DoUndo( FALSE ); + { + pDoc->GetIDocumentUndoRedo().DoUndo(false); + } pDoc->AppendTxtNode( *aPam.GetPoint() ); if( pUndo ) - pDoc->DoUndo( TRUE ); + { + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); + } SwNodeRange aRg( aSttNdIdx, aPam.GetPoint()->nNode ); if( pUndo ) pUndo->MoveBoxCntnt( pDoc, aRg, rInsPosNd ); diff --git a/sw/source/core/txtnode/atrflyin.cxx b/sw/source/core/txtnode/atrflyin.cxx index 02da2c32be8a..6609830b6282 100644 --- a/sw/source/core/txtnode/atrflyin.cxx +++ b/sw/source/core/txtnode/atrflyin.cxx @@ -28,11 +28,10 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - - #include "hintids.hxx" #include "cntfrm.hxx" // _GetFly #include "doc.hxx" +#include <IDocumentUndoRedo.hxx> #include "pam.hxx" // fuer SwTxtFlyCnt #include "flyfrm.hxx" // fuer SwTxtFlyCnt #include "ndtxt.hxx" // SwFlyFrmFmt @@ -117,9 +116,9 @@ void SwTxtFlyCnt::CopyFlyFmt( SwDoc* pDoc ) // In CopyLayoutFmt (siehe doclay.cxx) wird das FlyFrmFmt erzeugt // und der Inhalt dupliziert. - // fuers kopieren vom Attribut das Undo immer abschalten - BOOL bUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + // disable undo while copying attribute + bool const bUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); SwFmtAnchor aAnchor( pFmt->GetAnchor() ); if ((FLY_AT_PAGE != aAnchor.GetAnchorId()) && (pDoc != pFmt->GetDoc())) // different documents? @@ -146,7 +145,7 @@ void SwTxtFlyCnt::CopyFlyFmt( SwDoc* pDoc ) } SwFrmFmt* pNew = pDoc->CopyLayoutFmt( *pFmt, aAnchor, false, false ); - pDoc->DoUndo( bUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); ((SwFmtFlyCnt&)GetFlyCnt()).SetFlyFmt( pNew ); } @@ -193,16 +192,17 @@ void SwTxtFlyCnt::SetAnchor( const SwTxtNode *pNode ) // stehen wir noch im falschen Dokument ? if( pDoc != pFmt->GetDoc() ) { - // fuers kopieren vom Attribut das Undo immer abschalten - BOOL bUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + // disable undo while copying attribute + bool const bUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); SwFrmFmt* pNew = pDoc->CopyLayoutFmt( *pFmt, aAnchor, false, false ); - pDoc->DoUndo( bUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); - bUndo = pFmt->GetDoc()->DoesUndo(); - pFmt->GetDoc()->DoUndo( FALSE ); + bool const bFmtDocUndo = + pFmt->GetDoc()->GetIDocumentUndoRedo().DoesUndo(); + pFmt->GetDoc()->GetIDocumentUndoRedo().DoUndo(false); pFmt->GetDoc()->DelLayoutFmt( pFmt ); - pFmt->GetDoc()->DoUndo( bUndo ); + pFmt->GetDoc()->GetIDocumentUndoRedo().DoUndo(bFmtDocUndo); ((SwFmtFlyCnt&)GetFlyCnt()).SetFlyFmt( pNew ); } else if( pNode->GetpSwpHints() && diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 4d56942ecef4..4e6e625512c9 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -65,6 +65,7 @@ #include <fmtmeta.hxx> #include <breakit.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <errhdl.hxx> #include <fldbas.hxx> #include <pam.hxx> @@ -1318,11 +1319,12 @@ bool SwTxtNode::InsertHint( SwTxtAttr * const pAttr, const SetAttrMode nMode ) SwIndex aTmpIdx( this, *pAttr->GetStart() ); Update( aTmpIdx, 1, TRUE ); } - // Format loeschen nicht ins Undo aufnehmen!! - BOOL bUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + // do not record deletion of Format! + bool const bUndo = + pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); DestroyAttr( pAttr ); - pDoc->DoUndo( bUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); return false; } } diff --git a/sw/source/core/undo/SwUndoField.cxx b/sw/source/core/undo/SwUndoField.cxx index 8a3c6c507c93..bef1093c98e7 100644 --- a/sw/source/core/undo/SwUndoField.cxx +++ b/sw/source/core/undo/SwUndoField.cxx @@ -27,10 +27,13 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <tools/rtti.hxx> + #include <SwUndoField.hxx> #include <swundo.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <txtfld.hxx> #include <fldbas.hxx> #include <ndtxt.hxx> @@ -90,11 +93,11 @@ void SwUndoFieldFromDoc::Undo( SwUndoIter& ) if (pField) { - BOOL bUndo = pDoc->DoesUndo(); + bool const bUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); - pDoc->DoUndo(FALSE); + pDoc->GetIDocumentUndoRedo().DoUndo(false); pDoc->UpdateFld(pTxtFld, *pOldField, pHnt, bUpdate); - pDoc->DoUndo(bUndo); + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); } } @@ -105,15 +108,15 @@ void SwUndoFieldFromDoc::Redo( SwUndoIter& ) if (pField) { - BOOL bUndo = pDoc->DoesUndo(); + bool const bUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); - pDoc->DoUndo(FALSE); + pDoc->GetIDocumentUndoRedo().DoUndo(false); pDoc->UpdateFld(pTxtFld, *pNewField, pHnt, bUpdate); SwFmtFld* pDstFmtFld = (SwFmtFld*)&pTxtFld->GetFld(); if ( pDoc->GetFldType(RES_POSTITFLD, aEmptyStr,false) == pDstFmtFld->GetFld()->GetTyp() ) pDoc->GetDocShell()->Broadcast( SwFmtFldHint( pDstFmtFld, SWFMTFLD_INSERTED ) ); - pDoc->DoUndo(bUndo); + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); } } diff --git a/sw/source/core/undo/SwUndoFmt.cxx b/sw/source/core/undo/SwUndoFmt.cxx index f3b2fe4d1a25..c5dc57c7c5eb 100644 --- a/sw/source/core/undo/SwUndoFmt.cxx +++ b/sw/source/core/undo/SwUndoFmt.cxx @@ -29,6 +29,8 @@ #include "precompiled_sw.hxx" #include <tools/resid.hxx> +#include <tools/string.hxx> + #include <poolfmt.hxx> #include <charfmt.hxx> #include <frmfmt.hxx> @@ -37,8 +39,8 @@ #include <swundo.hxx> #include <undobj.hxx> #include <fmtcol.hxx> -#include <tools/string.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <comcore.hrc> SwUndoFmtCreate::SwUndoFmtCreate @@ -70,20 +72,19 @@ void SwUndoFmtCreate::Undo(SwUndoIter &) nId = pNew->GetPoolFmtId() & COLL_GET_RANGE_BITS; bAuto = pNew->IsAuto(); - BOOL bDoesUndo = pDoc->DoesUndo(); - - pDoc->DoUndo(FALSE); + bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); Delete(); - pDoc->DoUndo(bDoesUndo); + pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); } } } void SwUndoFmtCreate::Redo(SwUndoIter &) { - BOOL bDoesUndo = pDoc->DoesUndo(); + bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); - pDoc->DoUndo(FALSE); + pDoc->GetIDocumentUndoRedo().DoUndo(false); SwFmt * pDerivedFrom = Find(sDerivedFrom); SwFmt * pFmt = Create(pDerivedFrom); @@ -100,7 +101,7 @@ void SwUndoFmtCreate::Redo(SwUndoIter &) else pNew = NULL; - pDoc->DoUndo(bDoesUndo); + pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); } SwRewriter SwUndoFmtCreate::GetRewriter() const @@ -132,9 +133,9 @@ SwUndoFmtDelete::~SwUndoFmtDelete() void SwUndoFmtDelete::Undo(SwUndoIter &) { - BOOL bDoesUndo = pDoc->DoesUndo(); + bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); - pDoc->DoUndo(FALSE); + pDoc->GetIDocumentUndoRedo().DoUndo(false); SwFmt * pDerivedFrom = Find(sDerivedFrom); @@ -150,7 +151,7 @@ void SwUndoFmtDelete::Undo(SwUndoIter &) } - pDoc->DoUndo(bDoesUndo); + pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); } void SwUndoFmtDelete::Redo(SwUndoIter &) @@ -159,11 +160,11 @@ void SwUndoFmtDelete::Redo(SwUndoIter &) if (pOld) { - BOOL bDoesUndo = pDoc->DoesUndo(); + bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); - pDoc->DoUndo(FALSE); + pDoc->GetIDocumentUndoRedo().DoUndo(false); Delete(pOld); - pDoc->DoUndo(bDoesUndo); + pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); } } @@ -196,11 +197,10 @@ void SwUndoRenameFmt::Undo(SwUndoIter &) if (pFmt) { - BOOL bDoesUndo = pDoc->DoesUndo(); - - pDoc->DoUndo(FALSE); + bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); pDoc->RenameFmt(*pFmt, sOldName, TRUE); - pDoc->DoUndo(bDoesUndo); + pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); } } @@ -210,11 +210,10 @@ void SwUndoRenameFmt::Redo(SwUndoIter &) if (pFmt) { - BOOL bDoesUndo = pDoc->DoesUndo(); - - pDoc->DoUndo(FALSE); + bool bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); pDoc->RenameFmt(*pFmt, sNewName, TRUE); - pDoc->DoUndo(bDoesUndo); + pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); } } @@ -401,9 +400,8 @@ SwUndoNumruleCreate::SwUndoNumruleCreate(const SwNumRule * _pNew, void SwUndoNumruleCreate::Undo(SwUndoIter &) { - BOOL bDoesUndo = pDoc->DoesUndo(); - - pDoc->DoUndo(FALSE); + bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); if (! bInitialized) { @@ -412,16 +410,15 @@ void SwUndoNumruleCreate::Undo(SwUndoIter &) } pDoc->DelNumRule(aNew.GetName(), TRUE); - pDoc->DoUndo(bDoesUndo); + pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); } void SwUndoNumruleCreate::Redo(SwUndoIter &) { - BOOL bDoesUndo = pDoc->DoesUndo(); - - pDoc->DoUndo(FALSE); + bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); pDoc->MakeNumRule(aNew.GetName(), &aNew, TRUE); - pDoc->DoUndo(bDoesUndo); + pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); } SwRewriter SwUndoNumruleCreate::GetRewriter() const @@ -447,20 +444,18 @@ SwUndoNumruleDelete::SwUndoNumruleDelete(const SwNumRule & rRule, void SwUndoNumruleDelete::Undo(SwUndoIter &) { - BOOL bDoesUndo = pDoc->DoesUndo(); - - pDoc->DoUndo(FALSE); + bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); pDoc->MakeNumRule(aOld.GetName(), &aOld, TRUE); - pDoc->DoUndo(bDoesUndo); + pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); } void SwUndoNumruleDelete::Redo(SwUndoIter &) { - BOOL bDoesUndo = pDoc->DoesUndo(); - - pDoc->DoUndo(FALSE); + bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); pDoc->DelNumRule(aOld.GetName(), TRUE); - pDoc->DoUndo(bDoesUndo); + pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); } SwRewriter SwUndoNumruleDelete::GetRewriter() const @@ -482,20 +477,18 @@ SwUndoNumruleRename::SwUndoNumruleRename(const String & _aOldName, void SwUndoNumruleRename::Undo(SwUndoIter &) { - BOOL bDoesUndo = pDoc->DoesUndo(); - - pDoc->DoUndo(FALSE); + bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); pDoc->RenameNumRule(aNewName, aOldName, TRUE); - pDoc->DoUndo(bDoesUndo); + pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); } void SwUndoNumruleRename::Redo(SwUndoIter &) { - BOOL bDoesUndo = pDoc->DoesUndo(); - - pDoc->DoUndo(FALSE); + bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); pDoc->RenameNumRule(aOldName, aNewName, TRUE); - pDoc->DoUndo(bDoesUndo); + pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); } SwRewriter SwUndoNumruleRename::GetRewriter() const diff --git a/sw/source/core/undo/SwUndoPageDesc.cxx b/sw/source/core/undo/SwUndoPageDesc.cxx index 9a395375eabe..d05197585086 100644 --- a/sw/source/core/undo/SwUndoPageDesc.cxx +++ b/sw/source/core/undo/SwUndoPageDesc.cxx @@ -30,6 +30,7 @@ #include <tools/resid.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <swundo.hxx> #include <pagedesc.hxx> #include <SwUndoPageDesc.hxx> @@ -327,28 +328,26 @@ void SwUndoPageDesc::ExchangeContentNodes( SwPageDesc& rSource, SwPageDesc &rDes void SwUndoPageDesc::Undo(SwUndoIter &) { - BOOL bUndo = pDoc->DoesUndo(); - - pDoc->DoUndo(FALSE); + bool const bUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); // Move (header/footer)content node responsibility from new page descriptor to old one again. if( bExchange ) ExchangeContentNodes( (SwPageDesc&)aNew, (SwPageDesc&)aOld ); pDoc->ChgPageDesc(aOld.GetName(), aOld); - pDoc->DoUndo(bUndo); + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); } void SwUndoPageDesc::Redo(SwUndoIter &) { - BOOL bUndo = pDoc->DoesUndo(); - - pDoc->DoUndo(FALSE); + bool const bUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); // Move (header/footer)content node responsibility from old page descriptor to new one again. if( bExchange ) ExchangeContentNodes( (SwPageDesc&)aOld, (SwPageDesc&)aNew ); pDoc->ChgPageDesc(aNew.GetName(), aNew); - pDoc->DoUndo(bUndo); + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); } void SwUndoPageDesc::Repeat(SwUndoIter &) @@ -381,9 +380,8 @@ SwUndoPageDescCreate::~SwUndoPageDescCreate() void SwUndoPageDescCreate::Undo(SwUndoIter &) { - BOOL bUndo = pDoc->DoesUndo(); - - pDoc->DoUndo(FALSE); + bool const bUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); // -> #116530# if (pDesc) @@ -394,20 +392,19 @@ void SwUndoPageDescCreate::Undo(SwUndoIter &) // <- #116530# pDoc->DelPageDesc(aNew.GetName(), TRUE); - pDoc->DoUndo(bUndo); + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); } void SwUndoPageDescCreate::Redo(SwUndoIter &) { - BOOL bUndo = pDoc->DoesUndo(); - - pDoc->DoUndo(FALSE); + bool bUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); SwPageDesc aPageDesc = aNew; pDoc->MakePageDesc(aNew.GetName(), &aPageDesc, FALSE, TRUE); // #116530# - pDoc->DoUndo(bUndo); + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); } void SwUndoPageDescCreate::Repeat(SwUndoIter & rIt) @@ -441,22 +438,20 @@ SwUndoPageDescDelete::~SwUndoPageDescDelete() void SwUndoPageDescDelete::Undo(SwUndoIter &) { - BOOL bUndo = pDoc->DoesUndo(); - - pDoc->DoUndo(FALSE); + bool const bUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); SwPageDesc aPageDesc = aOld; pDoc->MakePageDesc(aOld.GetName(), &aPageDesc, FALSE, TRUE); // #116530# - pDoc->DoUndo(bUndo); + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); } void SwUndoPageDescDelete::Redo(SwUndoIter &) { - BOOL bUndo = pDoc->DoesUndo(); - - pDoc->DoUndo(FALSE); + bool const bUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); pDoc->DelPageDesc(aOld.GetName(), TRUE); // #116530# - pDoc->DoUndo(bUndo); + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); } void SwUndoPageDescDelete::Repeat(SwUndoIter & rIt) diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx index 0bc82fa7a7f4..71284f6d0c8f 100644 --- a/sw/source/core/undo/docundo.cxx +++ b/sw/source/core/undo/docundo.cxx @@ -117,36 +117,6 @@ void SwDoc::SetNoDrawUndoObj( bool const bFlag ) GetUndoManager().SetNoDrawUndoObj(bFlag); } -void SwDoc::SetUndoNoResetModified() -{ - GetUndoManager().SetUndoNoResetModified(); -} - -bool SwDoc::IsUndoNoResetModified() const -{ - return GetUndoManager().IsUndoNoResetModified(); -} - -void SwDoc::DoUndo(bool bUn) -{ - GetUndoManager().DoUndo(bUn); -} - -bool SwDoc::DoesUndo() const -{ - return GetUndoManager().DoesUndo(); -} - -void SwDoc::DoGroupUndo(bool bUn) -{ - GetUndoManager().DoGroupUndo(bUn); -} - -bool SwDoc::DoesGroupUndo() const -{ - return GetUndoManager().DoesGroupUndo(); -} - sal_uInt16 SwDoc::GetUndoActionCount() { return ::sw::UndoManager::GetUndoActionCount(); @@ -157,107 +127,11 @@ void SwDoc::SetUndoActionCount( sal_uInt16 nNew ) ::sw::UndoManager::SetUndoActionCount(nNew); } -void SwDoc::AppendUndo( SwUndo* pUndo ) -{ - GetUndoManager().AppendUndo(pUndo); -} - -void SwDoc::ClearRedo() -{ - GetUndoManager().ClearRedo(); -} - -void SwDoc::DelAllUndoObj() -{ - GetUndoManager().DelAllUndoObj(); -} - -void SwDoc::setUndoNoModifiedPosition( SwUndoNoModifiedPosition nNew ) -{ - return GetUndoManager().setUndoNoModifiedPosition(nNew); -} - -SwUndoNoModifiedPosition SwDoc::getUndoNoModifiedPosition() const -{ - return GetUndoManager().getUndoNoModifiedPosition(); -} - -bool SwDoc::HasUndoId(SwUndoId eId) const -{ - return GetUndoManager().HasUndoId(eId); -} - -bool SwDoc::Undo( SwUndoIter& rUndoIter ) -{ - return GetUndoManager().Undo(rUndoIter); -} - -SwUndoId SwDoc::StartUndo( SwUndoId eUndoId, const SwRewriter * pRewriter ) -{ - return GetUndoManager().StartUndo(eUndoId, pRewriter); -} - -SwUndoId SwDoc::EndUndo(SwUndoId eUndoId, const SwRewriter * pRewriter) -{ - return GetUndoManager().EndUndo(eUndoId, pRewriter); -} - -String SwDoc::GetUndoIdsStr( String* pStr, SwUndoIds *pUndoIds) const -{ - return GetUndoManager().GetUndoIdsStr(pStr, pUndoIds); -} - sal_Bool SwDoc::RestoreInvisibleContent() { return GetUndoManager().RestoreInvisibleContent(); } -SwUndoId SwDoc::GetUndoIds( String* pStr, SwUndoIds *pUndoIds) const -{ - return GetUndoManager().GetUndoIds(pStr, pUndoIds); -} - -bool SwDoc::HasTooManyUndos() const -{ - return GetUndoManager().HasTooManyUndos(); -} - -bool SwDoc::Redo( SwUndoIter& rUndoIter ) -{ - return GetUndoManager().Redo(rUndoIter); -} - -String SwDoc::GetRedoIdsStr( String* pStr, SwUndoIds *pRedoIds ) const -{ - - return GetUndoManager().GetRedoIdsStr(pStr, pRedoIds); -} - -SwUndoId SwDoc::GetRedoIds( String* pStr, SwUndoIds *pRedoIds ) const -{ - return GetUndoManager().GetRedoIds(pStr, pRedoIds); -} - -bool SwDoc::Repeat( SwUndoIter& rUndoIter, sal_uInt16 nRepeatCnt ) -{ - return GetUndoManager().Repeat(rUndoIter, nRepeatCnt); -} - -String SwDoc::GetRepeatIdsStr(String* pStr, SwUndoIds *pRepeatIds) const -{ - return GetUndoManager().GetRepeatIdsStr(pStr, pRepeatIds); -} - -SwUndoId SwDoc::GetRepeatIds(String* pStr, SwUndoIds *pRepeatIds) const -{ - return GetUndoManager().GetRepeatIds(pStr, pRepeatIds); -} - -SwUndo* SwDoc::RemoveLastUndo( SwUndoId eUndoId ) -{ - return GetUndoManager().RemoveLastUndo(eUndoId); -} - // UndoManager /////////////////////////////////////////////////////////// namespace sw { diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index d9a0cc8514a4..1add1fac5172 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -28,9 +28,13 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" +#include <tools/resid.hxx> -#include <hintids.hxx> #include <svl/itemiter.hxx> + +#include <editeng/brkitem.hxx> + +#include <hintids.hxx> #include <fmtftn.hxx> #include <fchrfmt.hxx> #include <fmtflcnt.hxx> @@ -47,6 +51,7 @@ #include <frmfmt.hxx> #include <ftnidx.hxx> #include <doc.hxx> // SwDoc.GetNodes() +#include <IDocumentUndoRedo.hxx> #include <docary.hxx> #include <ndtxt.hxx> // SwTxtNode #include <paratr.hxx> // @@ -59,14 +64,8 @@ #include <undobj.hxx> // fuer UndoDelete #include <IMark.hxx> // fuer SwBookmark #include <charfmt.hxx> // #i27615# -#ifndef _COMCORE_HRC #include <comcore.hrc> -#endif -#include <tools/resid.hxx> -#ifndef _UNDO_HRC #include <undo.hrc> -#endif -#include <editeng/brkitem.hxx> #include <bookmrk.hxx> SV_IMPL_PTRARR( SwpHstry, SwHistoryHintPtr) @@ -626,8 +625,8 @@ SwHistoryBookmark::SwHistoryBookmark( void SwHistoryBookmark::SetInDoc( SwDoc* pDoc, bool ) { - bool bDoesUndo = pDoc->DoesUndo(); - pDoc->DoUndo(false); + bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); SwNodes& rNds = pDoc->GetNodes(); IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); @@ -698,7 +697,7 @@ void SwHistoryBookmark::SetInDoc( SwDoc* pDoc, bool ) } } } - pDoc->DoUndo(bDoesUndo); + pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); } @@ -793,8 +792,8 @@ SwHistorySetAttrSet::SwHistorySetAttrSet( const SfxItemSet& rSet, void SwHistorySetAttrSet::SetInDoc( SwDoc* pDoc, bool ) { - BOOL bDoesUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); SwNode * pNode = pDoc->GetNodes()[ m_nNodeIndex ]; if ( pNode->IsCntntNode() ) @@ -816,7 +815,7 @@ void SwHistorySetAttrSet::SetInDoc( SwDoc* pDoc, bool ) } } - pDoc->DoUndo( bDoesUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); } /*************************************************************************/ @@ -879,8 +878,8 @@ SwHistoryResetAttrSet::SwHistoryResetAttrSet( const SfxItemSet& rSet, void SwHistoryResetAttrSet::SetInDoc( SwDoc* pDoc, bool ) { - BOOL bDoesUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); SwCntntNode * pCntntNd = pDoc->GetNodes()[ m_nNodeIndex ]->GetCntntNode(); ASSERT( pCntntNd, "SwHistoryResetAttrSet: no CntntNode" ); @@ -907,7 +906,7 @@ void SwHistoryResetAttrSet::SetInDoc( SwDoc* pDoc, bool ) } } - pDoc->DoUndo( bDoesUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); } @@ -927,8 +926,8 @@ SwHistoryChangeFlyAnchor::SwHistoryChangeFlyAnchor( SwFrmFmt& rFmt ) void SwHistoryChangeFlyAnchor::SetInDoc( SwDoc* pDoc, bool ) { - BOOL bDoesUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); USHORT nPos = pDoc->GetSpzFrmFmts()->GetPos( &m_rFmt ); if ( USHRT_MAX != nPos ) // Format does still exist @@ -956,7 +955,7 @@ void SwHistoryChangeFlyAnchor::SetInDoc( SwDoc* pDoc, bool ) m_rFmt.SetFmtAttr( aTmp ); } - pDoc->DoUndo( bDoesUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); } diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx index e3b54c59b142..c02a1a03b879 100644 --- a/sw/source/core/undo/unattr.cxx +++ b/sw/source/core/undo/unattr.cxx @@ -47,6 +47,7 @@ #include <fmtcntnt.hxx> #include <ftnidx.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docary.hxx> #include <swundo.hxx> // fuer die UndoIds #include <pam.hxx> @@ -1143,14 +1144,14 @@ SwUndoMoveLeftMargin::~SwUndoMoveLeftMargin() void SwUndoMoveLeftMargin::Undo( SwUndoIter& rIter ) { SwDoc* pDoc = &rIter.GetDoc(); - BOOL bUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + bool const bUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); // restore old values m_pHistory->TmpRollback( pDoc, 0 ); m_pHistory->SetTmpEnd( m_pHistory->Count() ); - pDoc->DoUndo( bUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); SetPaM( rIter ); } @@ -1192,8 +1193,8 @@ void SwUndoChangeFootNote::Undo( SwUndoIter& rIter ) SwDoc& rDoc = rIter.GetDoc(); SetPaM( rIter ); - BOOL bUndo = rDoc.DoesUndo(); - rDoc.DoUndo( FALSE ); + bool const bUndo = rDoc.GetIDocumentUndoRedo().DoesUndo(); + rDoc.GetIDocumentUndoRedo().DoUndo(false); m_pHistory->TmpRollback( &rDoc, 0 ); m_pHistory->SetTmpEnd( m_pHistory->Count() ); @@ -1201,7 +1202,7 @@ void SwUndoChangeFootNote::Undo( SwUndoIter& rIter ) rDoc.GetFtnIdxs().UpdateAllFtn(); SetPaM( rIter ); - rDoc.DoUndo( bUndo ); + rDoc.GetIDocumentUndoRedo().DoUndo(bUndo); } void SwUndoChangeFootNote::Redo( SwUndoIter& rIter ) diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx index ef39a4e18950..09b1b8c0cd90 100644 --- a/sw/source/core/undo/undel.cxx +++ b/sw/source/core/undo/undel.cxx @@ -36,6 +36,7 @@ #include <frmfmt.hxx> #include <fmtanchr.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <swtable.hxx> #include <swundo.hxx> // fuer die UndoIds #include <pam.hxx> @@ -147,10 +148,10 @@ SwUndoDelete::SwUndoDelete( SwPaM& rPam, BOOL bFullPara, BOOL bCalledByTblCpy ) DelCntntIndex( *rPam.GetMark(), *rPam.GetPoint(), DelCntntType(nsDelCntntType::DELCNT_ALL | nsDelCntntType::DELCNT_CHKNOCNTNT) ); - BOOL bDoesUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); _DelBookmarks(pStt->nNode, pEnd->nNode); - pDoc->DoUndo( bDoesUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); } else DelCntntIndex( *rPam.GetMark(), *rPam.GetPoint() ); @@ -253,11 +254,12 @@ SwUndoDelete::SwUndoDelete( SwPaM& rPam, BOOL bFullPara, BOOL bCalledByTblCpy ) ++nReplaceDummy; SwNodeRange aMvRg( *pEndTxtNd, 0, *pEndTxtNd, 1 ); SwPosition aSplitPos( *pEndTxtNd ); - BOOL bDoesUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + bool const bDoesUndo = + pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); pDoc->SplitNode( aSplitPos, false ); rDocNds._MoveNodes( aMvRg, rDocNds, aRg.aEnd, TRUE ); - pDoc->DoUndo( bDoesUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); aRg.aEnd--; } else @@ -279,11 +281,12 @@ SwUndoDelete::SwUndoDelete( SwPaM& rPam, BOOL bFullPara, BOOL bCalledByTblCpy ) { SwNodeRange aMvRg( *pSttTxtNd, 0, *pSttTxtNd, 1 ); SwPosition aSplitPos( *pSttTxtNd ); - BOOL bDoesUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + bool const bDoesUndo = + pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); pDoc->SplitNode( aSplitPos, false ); rDocNds._MoveNodes( aMvRg, rDocNds, aRg.aStart, TRUE ); - pDoc->DoUndo( bDoesUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); aRg.aStart--; } } @@ -651,8 +654,8 @@ void lcl_ReAnchorAtCntntFlyFrames( const SwSpzFrmFmts& rSpzArr, SwPosition &rPos void SwUndoDelete::Undo( SwUndoIter& rUndoIter ) { SwDoc* pDoc = &rUndoIter.GetDoc(); - BOOL bUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + bool const bUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); ULONG nCalcStt = nSttNode - nNdDiff; @@ -854,7 +857,7 @@ void SwUndoDelete::Undo( SwUndoIter& rUndoIter ) if( pRedlSaveData ) SetSaveData( *pDoc, *pRedlSaveData ); - pDoc->DoUndo( bUndo ); // Undo wieder einschalten + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); SetPaM( rUndoIter, TRUE ); } @@ -988,8 +991,8 @@ void SwUndoDelete::Repeat( SwUndoIter& rUndoIter ) SwPaM& rPam = *rUndoIter.pAktPam; SwDoc& rDoc = *rPam.GetDoc(); - BOOL bGroupUndo = rDoc.DoesGroupUndo(); - rDoc.DoGroupUndo( FALSE ); + bool const bGroupUndo = rDoc.GetIDocumentUndoRedo().DoesGroupUndo(); + rDoc.GetIDocumentUndoRedo().DoGroupUndo(false); if( !rPam.HasMark() ) { rPam.SetMark(); @@ -999,7 +1002,7 @@ void SwUndoDelete::Repeat( SwUndoIter& rUndoIter ) rDoc.DelFullPara( rPam ); else rDoc.DeleteAndJoin( rPam ); - rDoc.DoGroupUndo( bGroupUndo ); + rDoc.GetIDocumentUndoRedo().DoGroupUndo(bGroupUndo); rUndoIter.pLastUndoObj = this; } diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index 1a71a705b2fb..205a0cecb091 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -34,6 +34,7 @@ #include <ftnidx.hxx> #include <frmfmt.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docary.hxx> #include <swundo.hxx> // fuer die UndoIds #include <pam.hxx> @@ -45,12 +46,8 @@ #include <mvsave.hxx> #include <redline.hxx> #include <crossrefbookmark.hxx> -#ifndef _UNDO_HRC #include <undo.hrc> -#endif -#ifndef _COMCORE_HRC #include <comcore.hrc> -#endif #include <docsh.hxx> class SwRedlineSaveData : public SwUndRng, public SwRedlineData, @@ -289,8 +286,8 @@ void SwUndoSaveCntnt::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx, SwIndex* pCntIdx, ULONG* pEndNdIdx, xub_StrLen* pEndCntIdx ) { SwDoc& rDoc = *rPaM.GetDoc(); - BOOL bUndo = rDoc.DoesUndo(); - rDoc.DoUndo( FALSE ); + bool const bUndo = rDoc.GetIDocumentUndoRedo().DoesUndo(); + rDoc.GetIDocumentUndoRedo().DoUndo(false); SwNoTxtNode* pCpyNd = rPaM.GetNode()->GetNoTxtNode(); @@ -372,7 +369,7 @@ void SwUndoSaveCntnt::MoveToUndoNds( SwPaM& rPaM, SwNodeIndex* pNodeIdx, pCntIdx->Assign( 0, 0 ); } - rDoc.DoUndo( bUndo ); + rDoc.GetIDocumentUndoRedo().DoUndo(bUndo); } void SwUndoSaveCntnt::MoveFromUndoNds( SwDoc& rDoc, ULONG nNodeIdx, @@ -384,8 +381,8 @@ void SwUndoSaveCntnt::MoveFromUndoNds( SwDoc& rDoc, ULONG nNodeIdx, if( nNodeIdx == rNds.GetEndOfPostIts().GetIndex() ) return; // nichts gespeichert - BOOL bUndo = rDoc.DoesUndo(); - rDoc.DoUndo( FALSE ); + bool const bUndo = rDoc.GetIDocumentUndoRedo().DoesUndo(); + rDoc.GetIDocumentUndoRedo().DoUndo(false); SwPaM aPaM( rInsPos ); if( pEndNdIdx ) // dann hole aus diesem den Bereich @@ -441,7 +438,7 @@ void SwUndoSaveCntnt::MoveFromUndoNds( SwDoc& rDoc, ULONG nNodeIdx, ASSERT( FALSE, "was ist es denn nun?" ); } - rDoc.DoUndo( bUndo ); + rDoc.GetIDocumentUndoRedo().DoUndo(bUndo); } // diese beiden Methoden bewegen den Point vom Pam zurueck/vor. Damit @@ -501,8 +498,8 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark, SwDoc* pDoc = rMark.nNode.GetNode().GetDoc(); - BOOL bDoesUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); // 1. Fussnoten if( nsDelCntntType::DELCNT_FTN & nDelCntntType ) @@ -814,7 +811,7 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark, } } - pDoc->DoUndo( bDoesUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bDoesUndo); } diff --git a/sw/source/core/undo/undraw.cxx b/sw/source/core/undo/undraw.cxx index 980496cfd518..bababb4fc425 100644 --- a/sw/source/core/undo/undraw.cxx +++ b/sw/source/core/undo/undraw.cxx @@ -41,6 +41,7 @@ #include <txtflcnt.hxx> #include <frmfmt.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docary.hxx> #include <frame.hxx> #include <swundo.hxx> // fuer die UndoIds @@ -76,15 +77,16 @@ IMPL_LINK( SwDoc, AddDrawUndo, SdrUndoAction *, pUndo ) String sComment( pUndo->GetComment() ); #endif - if( DoesUndo() && !IsNoDrawUndoObj() ) + if (GetIDocumentUndoRedo().DoesUndo() && + !IsNoDrawUndoObj()) { - ClearRedo(); + GetIDocumentUndoRedo().ClearRedo(); const SdrMarkList* pMarkList = 0; ViewShell* pSh = GetRootFrm() ? GetRootFrm()->GetCurrShell() : 0; if( pSh && pSh->HasDrawView() ) pMarkList = &pSh->GetDrawView()->GetMarkedObjectList(); - AppendUndo( new SwSdrUndo( pUndo, pMarkList ) ); + GetIDocumentUndoRedo().AppendUndo( new SwSdrUndo(pUndo, pMarkList) ); } else delete pUndo; diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx index dd95d06a34b1..052223e986d9 100644 --- a/sw/source/core/undo/unins.cxx +++ b/sw/source/core/undo/unins.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <hintids.hxx> #include <unotools/charclass.hxx> #include <sot/storage.hxx> @@ -38,6 +39,7 @@ #include <fmtanchr.hxx> #include <frmfmt.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <swundo.hxx> // fuer die UndoIds #include <pam.hxx> #include <ndtxt.hxx> @@ -430,11 +432,11 @@ void SwUndoInsert::Repeat( SwUndoIter& rUndoIter ) else { String aTxt( ((SwTxtNode*)pCNd)->GetTxt() ); - BOOL bGroupUndo = rDoc.DoesGroupUndo(); - rDoc.DoGroupUndo( FALSE ); + bool const bGroupUndo = rDoc.GetIDocumentUndoRedo().DoesGroupUndo(); + rDoc.GetIDocumentUndoRedo().DoGroupUndo(false); rDoc.InsertString( *rUndoIter.pAktPam, aTxt.Copy( nCntnt - nLen, nLen ) ); - rDoc.DoGroupUndo( bGroupUndo ); + rDoc.GetIDocumentUndoRedo().DoGroupUndo(bGroupUndo); } break; case ND_GRFNODE: @@ -765,8 +767,8 @@ void _UnReplaceData::Undo( SwUndoIter& rIter ) void _UnReplaceData::Redo( SwUndoIter& rIter ) { SwDoc& rDoc = rIter.GetDoc(); - BOOL bUndo = rDoc.DoesUndo(); - rDoc.DoUndo( FALSE ); + bool const bUndo = rDoc.GetIDocumentUndoRedo().DoesUndo(); + rDoc.GetIDocumentUndoRedo().DoUndo(false); SwPaM& rPam = *rIter.pAktPam; rPam.DeleteMark(); @@ -805,7 +807,7 @@ void _UnReplaceData::Redo( SwUndoIter& rIter ) rDoc.ReplaceRange( rPam, m_sIns, m_bRegExp ); rPam.DeleteMark(); - rDoc.DoUndo( bUndo ); + rDoc.GetIDocumentUndoRedo().DoUndo(bUndo); } void _UnReplaceData::SetEnd( const SwPaM& rPam ) diff --git a/sw/source/core/undo/unmove.cxx b/sw/source/core/undo/unmove.cxx index 4c5fbca4085c..b4e3c93720b9 100644 --- a/sw/source/core/undo/unmove.cxx +++ b/sw/source/core/undo/unmove.cxx @@ -28,8 +28,8 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <pam.hxx> #include <swundo.hxx> // fuer die UndoIds #include <ndtxt.hxx> @@ -190,8 +190,8 @@ void SwUndoMove::SetDestRange( const SwNodeIndex& rStt, void SwUndoMove::Undo( SwUndoIter& rUndoIter ) { SwDoc* pDoc = &rUndoIter.GetDoc(); - BOOL bUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + bool const bUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); // Block, damit aus diesem gesprungen werden kann do { @@ -276,7 +276,7 @@ void SwUndoMove::Undo( SwUndoIter& rUndoIter ) pHistory->SetTmpEnd( pHistory->Count() ); } - pDoc->DoUndo( bUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); // setze noch den Cursor auf den Undo-Bereich if( !bMoveRange ) diff --git a/sw/source/core/undo/unnum.cxx b/sw/source/core/undo/unnum.cxx index 8cf782e85b53..101265c541a0 100644 --- a/sw/source/core/undo/unnum.cxx +++ b/sw/source/core/undo/unnum.cxx @@ -32,6 +32,7 @@ #include <hintids.hxx> #include <editeng/lrspitem.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <swundo.hxx> // fuer die UndoIds #include <pam.hxx> #include <ndtxt.hxx> @@ -93,8 +94,8 @@ void SwUndoInsNum::Undo( SwUndoIter& rUndoIter ) if( nSttNode ) SetPaM( rUndoIter ); - BOOL bUndo = rDoc.DoesUndo(); - rDoc.DoUndo( FALSE ); + bool const bUndo = rDoc.GetIDocumentUndoRedo().DoesUndo(); + rDoc.GetIDocumentUndoRedo().DoUndo(false); if( pOldNumRule ) rDoc.ChgNumRuleFmts( *pOldNumRule ); @@ -136,7 +137,7 @@ void SwUndoInsNum::Undo( SwUndoIter& rUndoIter ) if( nSttNode ) SetPaM( rUndoIter ); - rDoc.DoUndo( bUndo ); + rDoc.GetIDocumentUndoRedo().DoUndo(bUndo); } @@ -219,8 +220,8 @@ void SwUndoDelNum::Undo( SwUndoIter& rUndoIter ) SwDoc& rDoc = rUndoIter.GetDoc(); SetPaM( rUndoIter ); - BOOL bUndo = rDoc.DoesUndo(); - rDoc.DoUndo( FALSE ); + bool const bUndo = rDoc.GetIDocumentUndoRedo().DoesUndo(); + rDoc.GetIDocumentUndoRedo().DoUndo(false); pHistory->TmpRollback( &rDoc, 0 ); pHistory->SetTmpEnd( pHistory->Count() ); @@ -236,7 +237,7 @@ void SwUndoDelNum::Undo( SwUndoIter& rUndoIter ) } SetPaM( rUndoIter ); - rDoc.DoUndo( bUndo ); + rDoc.GetIDocumentUndoRedo().DoUndo(bUndo); } diff --git a/sw/source/core/undo/unovwr.cxx b/sw/source/core/undo/unovwr.cxx index 91549c84a57e..5a623cb599d9 100644 --- a/sw/source/core/undo/unovwr.cxx +++ b/sw/source/core/undo/unovwr.cxx @@ -28,11 +28,15 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" +#include <tools/resid.hxx> #include <unotools/charclass.hxx> #include <unotools/transliterationwrapper.hxx> + #include <comphelper/processfactory.hxx> + #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <swundo.hxx> // fuer die UndoIds #include <pam.hxx> #include <ndtxt.hxx> @@ -41,7 +45,6 @@ #include <acorrect.hxx> #include <docary.hxx> -#include <tools/resid.hxx> #include <comcore.hrc> // #111827# #include <undo.hrc> @@ -275,10 +278,10 @@ void SwUndoOverwrite::Repeat( SwUndoIter& rUndoIter ) SwDoc& rDoc = *pAktPam->GetDoc(); - BOOL bGroupUndo = rDoc.DoesGroupUndo(); - rDoc.DoGroupUndo( FALSE ); + bool const bGroupUndo = rDoc.GetIDocumentUndoRedo().DoesGroupUndo(); + rDoc.GetIDocumentUndoRedo().DoGroupUndo(false); rDoc.Overwrite( *pAktPam, aInsStr.GetChar( 0 )); - rDoc.DoGroupUndo( bGroupUndo ); + rDoc.GetIDocumentUndoRedo().DoGroupUndo(bGroupUndo); for( xub_StrLen n = 1; n < aInsStr.Len(); ++n ) rDoc.Overwrite( *pAktPam, aInsStr.GetChar( n ) ); } @@ -383,8 +386,8 @@ SwUndoTransliterate::~SwUndoTransliterate() void SwUndoTransliterate::Undo( SwUndoIter& rUndoIter ) { SwDoc& rDoc = rUndoIter.GetDoc(); - BOOL bUndo = rDoc.DoesUndo(); - rDoc.DoUndo( FALSE ); + bool const bUndo = rDoc.GetIDocumentUndoRedo().DoesUndo(); + rDoc.GetIDocumentUndoRedo().DoUndo(false); // since the changes were added to the vector from the end of the string/node towards // the start, we need to revert them from the start towards the end now to keep the @@ -393,7 +396,7 @@ void SwUndoTransliterate::Undo( SwUndoIter& rUndoIter ) for (sal_Int32 i = aChanges.size() - 1; i >= 0; --i) aChanges[i]->SetChangeAtNode( rDoc ); - rDoc.DoUndo( bUndo ); + rDoc.GetIDocumentUndoRedo().DoUndo(bUndo); SetPaM( rUndoIter, TRUE ); } diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index 9a654170187a..e78ae9766015 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -34,6 +34,7 @@ #include <fmtornt.hxx> #include <fmtpdsc.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <editsh.hxx> #include <docary.hxx> #include <ndtxt.hxx> @@ -1956,7 +1957,8 @@ void SwUndoTblNdsChg::Redo( SwUndoIter& rUndoIter ) TblChgMode eOldMode = rTbl.GetTblChgMode(); rTbl.SetTblChgMode( (TblChgMode)nCount ); - rDoc.DoUndo( TRUE ); // wir brauchen die SaveSections! + // need the SaveSections! + rDoc.GetIDocumentUndoRedo().DoUndo( true ); SwUndoTblNdsChg* pUndo = 0; switch( nSetColType & 0xff ) @@ -1984,7 +1986,7 @@ void SwUndoTblNdsChg::Redo( SwUndoIter& rUndoIter ) delete pUndo; } - rDoc.DoUndo( FALSE ); + rDoc.GetIDocumentUndoRedo().DoUndo( false ); rTbl.SetTblChgMode( eOldMode ); } @@ -2192,13 +2194,13 @@ void SwUndoTblMerge::MoveBoxCntnt( SwDoc* pDoc, SwNodeRange& rRg, SwNodeIndex& r { SwNodeIndex aTmp( rRg.aStart, -1 ), aTmp2( rPos, -1 ); SwUndoMove* pUndo = new SwUndoMove( pDoc, rRg, rPos ); - sal_Bool bDoesUndo = pDoc->DoesUndo(); - pDoc->DoUndo( sal_False ); + bool const bDoesUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); pDoc->MoveNodeRange( rRg, rPos, (pSaveTbl->IsNewModel()) ? IDocumentContentOperations::DOC_NO_DELFRMS : IDocumentContentOperations::DOC_MOVEDEFAULT ); if( bDoesUndo ) - pDoc->DoUndo( sal_True ); + pDoc->GetIDocumentUndoRedo().DoUndo(true); aTmp++; aTmp2++; pUndo->SetDestRange( aTmp2, rPos, aTmp ); diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx index e9e7ce1e0e02..3a86ca7668af 100644 --- a/sw/source/core/undo/untblk.cxx +++ b/sw/source/core/undo/untblk.cxx @@ -28,11 +28,11 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include <hintids.hxx> #include <fmtanchr.hxx> #include <frmfmt.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docary.hxx> #include <swundo.hxx> // fuer die UndoIds #include <pam.hxx> @@ -176,8 +176,8 @@ void SwUndoInserts::Undo( SwUndoIter& rUndoIter ) SwPaM * pPam = rUndoIter.pAktPam; SwDoc* pDoc = pPam->GetDoc(); SetPaM( rUndoIter ); - BOOL bUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + bool const bUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); if( IDocumentRedlineAccess::IsRedlineOn( GetRedlineMode() )) pDoc->DeleteRedline( *pPam, true, USHRT_MAX ); @@ -269,7 +269,7 @@ void SwUndoInserts::Undo( SwUndoIter& rUndoIter ) } } - pDoc->DoUndo( bUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); if( pPam != rUndoIter.pAktPam ) delete pPam; } diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx index 590ddb6e803e..a1487c19151b 100644 --- a/sw/source/core/unocore/unobkm.cxx +++ b/sw/source/core/unocore/unobkm.cxx @@ -40,11 +40,10 @@ #include <IMark.hxx> #include <crossrefbookmark.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docary.hxx> #include <swundo.hxx> -#ifndef _COMCORE_HRC #include <comcore.hrc> -#endif #include <undobj.hxx> #include <docsh.hxx> @@ -376,9 +375,10 @@ throw (uno::RuntimeException) aRewriter.AddRule(UNDO_ARG2, SW_RES(STR_YIELDS)); aRewriter.AddRule(UNDO_ARG3, lcl_QuoteName(rName)); - m_pImpl->m_pDoc->StartUndo(UNDO_BOOKMARK_RENAME, &aRewriter); + m_pImpl->m_pDoc->GetIDocumentUndoRedo().StartUndo( + UNDO_BOOKMARK_RENAME, &aRewriter); pMarkAccess->renameMark(m_pImpl->m_pRegisteredBookmark, rName); - m_pImpl->m_pDoc->EndUndo(UNDO_BOOKMARK_RENAME, NULL); + m_pImpl->m_pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_BOOKMARK_RENAME, 0); } OUString SAL_CALL diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 92a33da130fe..e1c0ff743ad8 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -43,6 +43,7 @@ #include <unoframe.hxx> #include <unocrsr.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <IDocumentRedlineAccess.hxx> #include <fmtftn.hxx> #include <fmtpdsc.hxx> @@ -708,7 +709,7 @@ void setNumberingProperty(const Any& rValue, SwPaM& rPam) if( rPam.GetNext() != &rPam ) // Mehrfachselektion ? { - pDoc->StartUndo( UNDO_START, NULL ); + pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); SwPamRanges aRangeArr( rPam ); SwPaM aPam( *rPam.GetPoint() ); for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n ) @@ -718,7 +719,7 @@ void setNumberingProperty(const Any& rValue, SwPaM& rPam) pDoc->SetNumRule( aRangeArr.SetPam( n, aPam ), aRule, false ); // <-- } - pDoc->EndUndo( UNDO_END, NULL ); + pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); } else { @@ -805,12 +806,12 @@ void resetCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry, SwPaM& rPa if( rPam.GetNext() != &rPam ) // Mehrfachselektion ? { - pDoc->StartUndo( UNDO_START, NULL ); + pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); SwPamRanges aRangeArr( rPam ); SwPaM aPam( *rPam.GetPoint() ); for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n ) pDoc->SetNodeNumStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), 1 ); - pDoc->EndUndo( UNDO_END, NULL ); + pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); } else pDoc->SetNodeNumStart( *rPam.GetPoint(), 0 ); diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index ab5d68910769..005ead8cddd1 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -42,6 +42,7 @@ #include <svx/svditer.hxx> #include <swunohelper.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <fmtcntnt.hxx> #include <fmtflcnt.hxx> #include <txtatr.hxx> @@ -866,7 +867,7 @@ uno::Reference< drawing::XShapeGroup > SwXDrawPage::group(const uno::Reference< if( !bFlyInCnt ) { UnoActionContext aContext(pDoc); - pDoc->StartUndo( UNDO_START, NULL ); + pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); SwDrawContact* pContact = pDoc->GroupSelection( *pPage->GetDrawView() ); pDoc->ChgAnchor( @@ -880,7 +881,7 @@ uno::Reference< drawing::XShapeGroup > SwXDrawPage::group(const uno::Reference< uno::Reference< uno::XInterface > xInt = pPage->GetInterface( pContact->GetMaster() ); xRet = uno::Reference< drawing::XShapeGroup >(xInt, uno::UNO_QUERY); } - pDoc->EndUndo( UNDO_END, NULL ); + pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); } } pPage->RemovePageView(); @@ -903,13 +904,13 @@ void SwXDrawPage::ungroup(const uno::Reference< drawing::XShapeGroup > & xShapeG { pPage->PreUnGroup(xShapeGroup); UnoActionContext aContext(pDoc); - pDoc->StartUndo( UNDO_START, NULL ); + pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); pDoc->UnGroupSelection( *pPage->GetDrawView() ); pDoc->ChgAnchor( pPage->GetDrawView()->GetMarkedObjectList(), FLY_AT_PARA/*int eAnchorId*/, sal_True, sal_False ); - pDoc->EndUndo( UNDO_END, NULL ); + pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); } pPage->RemovePageView(); } diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 3a3df506b457..024db8270b05 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -45,6 +45,7 @@ #include <memory> #include <hints.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docsh.hxx> #include <editsh.hxx> #include <swcli.hxx> @@ -2311,7 +2312,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan // xIPObj->OnDocumentPrinterChanged( pDoc->getPrinter( false ) ); UnoActionContext aAction(pDoc); - pDoc->StartUndo(UNDO_INSERT, NULL); + pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL); if(!bSizeFound) { //TODO/LATER: from where do I get a ViewAspect? And how do I transport it to the OLENode? @@ -2358,7 +2359,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan pFmt2 = pDoc->Insert(aPam, xObjRef, &aFrmSet, NULL, NULL ); ASSERT( pFmt2, "Doc->Insert(notxt) failed." ); - pDoc->EndUndo(UNDO_INSERT, NULL); + pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL); pFmt2->Add(this); if(sName.Len()) pDoc->SetFlyName((SwFlyFrmFmt&)*pFmt2, sName); @@ -2368,11 +2369,11 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan { ::rtl::OUString sStreamName; (*pStreamName) >>= sStreamName; - pDoc->StartUndo(UNDO_INSERT, NULL); + pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL); SwFlyFrmFmt* pFrmFmt = 0; pFrmFmt = pDoc->InsertOLE( aPam, sStreamName, embed::Aspects::MSOLE_CONTENT, &aFrmSet, NULL, NULL ); - pDoc->EndUndo(UNDO_INSERT, NULL); + pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL); pFrmFmt->Add(this); if(sName.Len()) pDoc->SetFlyName((SwFlyFrmFmt&)*pFrmFmt, sName); diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index f572b5f3e91c..73f5c9736018 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -40,6 +40,7 @@ #include <IMark.hxx> #include <frmfmt.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <istyleaccess.hxx> #include <ndtxt.hxx> #include <ndnotxt.hxx> @@ -66,9 +67,7 @@ #include <fmtfld.hxx> #include <fmtpdsc.hxx> #include <pagedesc.hxx> -#ifndef _POOLFMT_HRC #include <poolfmt.hrc> -#endif #include <poolfmt.hxx> #include <edimp.hxx> #include <fchrfmt.hxx> @@ -350,13 +349,13 @@ throw (lang::IllegalArgumentException) SwTxtFmtColl *const pLocal = pStyle->GetCollection(); UnoActionContext aAction(pDoc); - pDoc->StartUndo( UNDO_START, NULL ); + pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); SwPaM *pTmpCrsr = &rPaM; do { pDoc->SetTxtFmtColl(*pTmpCrsr, pLocal); pTmpCrsr = static_cast<SwPaM*>(pTmpCrsr->GetNext()); } while ( pTmpCrsr != &rPaM ); - pDoc->EndUndo( UNDO_END, NULL ); + pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); } /* -----------------06.07.98 07:38------------------- @@ -427,7 +426,7 @@ lcl_SetNodeNumStart(SwPaM & rCrsr, uno::Any const& rValue) if( rCrsr.GetNext() != &rCrsr ) // Mehrfachselektion ? { - pDoc->StartUndo( UNDO_START, NULL ); + pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); SwPamRanges aRangeArr( rCrsr ); SwPaM aPam( *rCrsr.GetPoint() ); for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n ) @@ -436,7 +435,7 @@ lcl_SetNodeNumStart(SwPaM & rCrsr, uno::Any const& rValue) pDoc->SetNodeNumStart(*aRangeArr.SetPam( n, aPam ).GetPoint(), nStt ); } - pDoc->EndUndo( UNDO_END, NULL); + pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); } else { @@ -457,7 +456,7 @@ lcl_setCharFmtSequence(SwPaM & rPam, uno::Any const& rValue) for (sal_Int32 nStyle = 0; nStyle < aCharStyles.getLength(); nStyle++) { uno::Any aStyle; - rPam.GetDoc()->StartUndo(UNDO_START, NULL); + rPam.GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_START, NULL); aStyle <<= aCharStyles.getConstArray()[nStyle]; // create a local set and apply each format directly SfxItemSet aSet(rPam.GetDoc()->GetAttrPool(), @@ -468,7 +467,7 @@ lcl_setCharFmtSequence(SwPaM & rPam, uno::Any const& rValue) SwUnoCursorHelper::SetCrsrAttr(rPam, aSet, (nStyle) ? nsSetAttrMode::SETATTR_DONTREPLACE : nsSetAttrMode::SETATTR_DEFAULT); - rPam.GetDoc()->EndUndo(UNDO_START, NULL); + rPam.GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_START, NULL); } return true; } @@ -931,7 +930,7 @@ void SwXTextCursor::DeleteAndInsert(const ::rtl::OUString& rText, SwDoc* pDoc = pUnoCrsr->GetDoc(); UnoActionContext aAction(pDoc); const xub_StrLen nTxtLen = rText.getLength(); - pDoc->StartUndo(UNDO_INSERT, NULL); + pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL); SwCursor * pCurrent = pUnoCrsr; do { @@ -953,7 +952,7 @@ void SwXTextCursor::DeleteAndInsert(const ::rtl::OUString& rText, } pCurrent = static_cast<SwCursor *>(pCurrent->GetNext()); } while (pCurrent != pUnoCrsr); - pDoc->EndUndo(UNDO_INSERT, NULL); + pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL); } } diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index d9334e97c841..0a6b5d1cfce4 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -37,6 +37,7 @@ #include <bookmrk.hxx> #include <frmfmt.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <ndtxt.hxx> #include <ndnotxt.hxx> #include <unocrsr.hxx> @@ -357,7 +358,7 @@ void SwUnoCursorHelper::SetCrsrAttr(SwPaM & rPam, UnoActionContext aAction(pDoc); if (rPam.GetNext() != &rPam) // Ring of Cursors { - pDoc->StartUndo(UNDO_INSATTR, NULL); + pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSATTR, NULL); SwPaM *pCurrent = &rPam; do @@ -371,7 +372,7 @@ void SwUnoCursorHelper::SetCrsrAttr(SwPaM & rPam, pCurrent= static_cast<SwPaM *>(pCurrent->GetNext()); } while (pCurrent != &rPam); - pDoc->EndUndo(UNDO_INSATTR, NULL); + pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSATTR, NULL); } else { @@ -923,7 +924,7 @@ throw (uno::RuntimeException) if (GetPositions(aCursor)) { UnoActionContext aAction(& m_pImpl->m_rDoc); - m_pImpl->m_rDoc.StartUndo(UNDO_INSERT, NULL); + m_pImpl->m_rDoc.GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL); if (aCursor.HasMark()) { m_pImpl->m_rDoc.DeleteAndJoin(aCursor); @@ -938,7 +939,7 @@ throw (uno::RuntimeException) aCursor.Left(rText.getLength(), CRSR_SKIP_CHARS, FALSE, FALSE); } SetPositions(aCursor); - m_pImpl->m_rDoc.EndUndo(UNDO_INSERT, NULL); + m_pImpl->m_rDoc.GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL); } } @@ -1794,7 +1795,7 @@ void SwUnoCursorHelper::SetString(SwCursor & rCursor, const OUString& rString) // Start/EndAction SwDoc *const pDoc = rCursor.GetDoc(); UnoActionContext aAction(pDoc); - pDoc->StartUndo(UNDO_INSERT, NULL); + pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL); if (rCursor.HasMark()) { pDoc->DeleteAndJoin(rCursor); @@ -1809,7 +1810,7 @@ void SwUnoCursorHelper::SetString(SwCursor & rCursor, const OUString& rString) SwUnoCursorHelper::SelectPam(rCursor, true); rCursor.Left(rString.getLength(), CRSR_SKIP_CHARS, FALSE, FALSE); } - pDoc->EndUndo(UNDO_INSERT, NULL); + pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL); } /****************************************************************** diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx index 2810b500ea4b..b8d1e3318ddf 100644 --- a/sw/source/core/unocore/unosect.cxx +++ b/sw/source/core/unocore/unosect.cxx @@ -50,6 +50,7 @@ #include <unocrsr.hxx> #include <section.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docsh.hxx> #include <sfx2/docfile.hxx> #include <docary.hxx> @@ -327,7 +328,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) //das muss jetzt sal_True liefern ::sw::XTextRangeToSwPaM(aPam, xTextRange); UnoActionContext aCont(pDoc); - pDoc->StartUndo( UNDO_INSSECTION, NULL ); + pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_INSSECTION, NULL ); if (!m_pImpl->m_sName.getLength()) { @@ -456,7 +457,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) } // Undo-Klammerung hier beenden - pDoc->EndUndo( UNDO_INSSECTION, NULL ); + pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_INSSECTION, NULL ); m_pImpl->m_pProps.reset(); m_pImpl->m_bIsDescriptor = false; } diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index ae23406c04ce..67d7049f27cd 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -47,6 +47,7 @@ #include <editeng/paperinf.hxx> #include <pagedesc.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docary.hxx> #include <charfmt.hxx> #include <cmdid.h> @@ -3397,15 +3398,15 @@ void SAL_CALL SwXPageStyle::SetPropertyValues_Impl( } if(aBaseImpl.HasItemSet()) { - BOOL bDoesUndo = GetDoc()->DoesUndo(); + bool const bDoesUndo = GetDoc()->GetIDocumentUndoRedo().DoesUndo(); if( bDoesUndo ) { // Fix i64460: as long as Undo of page styles with header/footer causes trouble... - GetDoc()->DelAllUndoObj(); - GetDoc()->DoUndo( FALSE ); + GetDoc()->GetIDocumentUndoRedo().DelAllUndoObj(); + GetDoc()->GetIDocumentUndoRedo().DoUndo(false); } aBaseImpl.mxNewBase->SetItemSet(aBaseImpl.GetItemSet()); - GetDoc()->DoUndo( bDoesUndo ); + GetDoc()->GetIDocumentUndoRedo().DoUndo(bDoesUndo); } } diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 5669ec8e6b99..270a102950d9 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -45,6 +45,7 @@ #include <hints.hxx> #include <swtblfmt.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <shellres.hxx> #include <docary.hxx> #include <ndole.hxx> @@ -2505,7 +2506,7 @@ void SwXTextTable::attachToRange(const uno::Reference< text::XTextRange > & xTex { UnoActionContext aCont( pDoc ); - pDoc->StartUndo(UNDO_EMPTY, NULL); + pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL); const SwTable *pTable = 0; if( 0 != aPam.Start()->nContent.GetIndex() ) { @@ -2564,9 +2565,8 @@ void SwXTextTable::attachToRange(const uno::Reference< text::XTextRange > & xTex bIsDescriptor = sal_False; DELETEZ(pTableProps); } - pDoc->EndUndo( UNDO_END, NULL ); + pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL ); } - } else throw lang::IllegalArgumentException(); @@ -3417,7 +3417,7 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, SwDoc* pDoc = pFmt->GetDoc(); SwTable* pTable = SwTable::FindTable( pFmt ); SwTableLines &rLines = pTable->GetTabLines(); - pDoc->StartUndo(UNDO_START, NULL); + pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_START, NULL); for(sal_uInt16 i = 0; i < rLines.Count(); i++) { SwTableLine* pLine = rLines.GetObject(i); @@ -3447,7 +3447,7 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, } } } - pDoc->EndUndo(UNDO_END, NULL); + pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_END, NULL); } break; case FN_UNO_TABLE_COLUMN_SEPARATORS: diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 3ddcfc1d2ed7..28612af3ccfd 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -28,6 +28,10 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" +#include <stdlib.h> + +#include <memory> +#include <iostream> #include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include <com/sun/star/text/ControlCharacter.hpp> @@ -63,6 +67,7 @@ #include <docsh.hxx> #include <docary.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <redline.hxx> #include <swundo.hxx> #include <section.hxx> @@ -72,10 +77,7 @@ #include <crsskip.hxx> #include <ndtxt.hxx> -#include <memory> -#include <stdlib.h> -#include <iostream> using namespace ::com::sun::star; using ::rtl::OUString; @@ -404,12 +406,11 @@ throw (uno::RuntimeException) // so the text is inserted before UnoActionContext aContext(GetDoc()); SwPaM aInsertPam(*pPam->Start()); - const sal_Bool bGroupUndo = GetDoc()->DoesGroupUndo(); - GetDoc()->DoGroupUndo(sal_False); - + bool const bGroupUndo(GetDoc()->GetIDocumentUndoRedo().DoesGroupUndo()); + GetDoc()->GetIDocumentUndoRedo().DoGroupUndo(false); SwUnoCursorHelper::DocInsertStringSplitCR( *GetDoc(), aInsertPam, rString, bForceExpandHints ); - GetDoc()->DoGroupUndo(bGroupUndo); + GetDoc()->GetIDocumentUndoRedo().DoGroupUndo(bGroupUndo); } } @@ -991,7 +992,7 @@ SwXText::setString(const OUString& rString) throw (uno::RuntimeException) throw uno::RuntimeException(); } - GetDoc()->StartUndo(UNDO_START, NULL); + GetDoc()->GetIDocumentUndoRedo().StartUndo(UNDO_START, NULL); //insert an empty paragraph at the start and at the end to ensure that //all tables and sections can be removed by the selecting text::XTextCursor if (CURSOR_META != m_pImpl->m_eType) @@ -1029,14 +1030,14 @@ SwXText::setString(const OUString& rString) throw (uno::RuntimeException) const uno::Reference< text::XTextCursor > xRet = CreateCursor(); if(!xRet.is()) { - GetDoc()->EndUndo(UNDO_END, NULL); + GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_END, NULL); uno::RuntimeException aRuntime; aRuntime.Message = C2U(cInvalidObject); throw aRuntime; } xRet->gotoEnd(sal_True); xRet->setString(rString); - GetDoc()->EndUndo(UNDO_END, NULL); + GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_END, NULL); } //FIXME why is CheckForOwnMember duplicated in some insert methods? @@ -1373,7 +1374,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) bool bIllegalException = false; bool bRuntimeException = false; ::rtl::OUString sMessage; - m_pDoc->StartUndo(UNDO_START , NULL); + m_pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_START , NULL); // find end node, go backward - don't skip tables because the new // paragraph has to be the last node //aPam.Move( fnMoveBackward, fnGoNode ); @@ -1425,11 +1426,11 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) } } } - m_pDoc->EndUndo(UNDO_END, NULL); + m_pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_END, NULL); if (bIllegalException || bRuntimeException) { SwUndoIter aUndoIter( &aPam, UNDO_EMPTY ); - m_pDoc->Undo(aUndoIter); + m_pDoc->GetIDocumentUndoRedo().Undo(aUndoIter); if (bIllegalException) { lang::IllegalArgumentException aEx; @@ -1483,7 +1484,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) bool bIllegalException = false; bool bRuntimeException = false; ::rtl::OUString sMessage; - m_pImpl->m_pDoc->StartUndo(UNDO_INSERT, NULL); + m_pImpl->m_pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL); // SwPaM aPam(*pStartNode->EndOfSectionNode()); //aPam.Move( fnMoveBackward, fnGoNode ); @@ -1538,11 +1539,11 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) } } } - m_pImpl->m_pDoc->EndUndo(UNDO_INSERT, NULL); + m_pImpl->m_pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL); if (bIllegalException || bRuntimeException) { SwUndoIter aUndoIter( pCursor, UNDO_EMPTY ); - m_pImpl->m_pDoc->Undo(aUndoIter); + m_pImpl->m_pDoc->GetIDocumentUndoRedo().Undo(aUndoIter); if (bIllegalException) { lang::IllegalArgumentException aEx; @@ -1584,7 +1585,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) } uno::Reference< text::XTextRange > xRet; - m_pImpl->m_pDoc->StartUndo(UNDO_INSERT, NULL); + m_pImpl->m_pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL); // find end node, go backward - don't skip tables because the // new paragraph has to be the last node SwPaM aPam(*pStartNode->EndOfSectionNode()); @@ -1619,7 +1620,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) throw uno::RuntimeException(); } } - m_pImpl->m_pDoc->EndUndo(UNDO_INSERT, NULL); + m_pImpl->m_pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL); return xRet; } @@ -1666,7 +1667,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) pEndRange->Invalidate(); } - m_pImpl->m_pDoc->StartUndo( UNDO_START, NULL ); + m_pImpl->m_pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL ); bool bIllegalException = false; bool bRuntimeException = false; ::rtl::OUString sMessage; @@ -1817,11 +1818,11 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) } } - m_pImpl->m_pDoc->EndUndo(UNDO_END, NULL); + m_pImpl->m_pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_END, NULL); if (bIllegalException || bRuntimeException) { SwUndoIter aUndoIter( &aStartPam, UNDO_EMPTY ); - m_pImpl->m_pDoc->Undo(aUndoIter); + m_pImpl->m_pDoc->GetIDocumentUndoRedo().Undo(aUndoIter); if (bIllegalException) { lang::IllegalArgumentException aEx; @@ -2302,7 +2303,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException) if(bExcept) { SwUndoIter aUndoIter( &aLastPaM, UNDO_EMPTY ); - m_pImpl->m_pDoc->Undo(aUndoIter); + m_pImpl->m_pDoc->GetIDocumentUndoRedo().Undo(aUndoIter); throw lang::IllegalArgumentException(); } diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 0bbfc70d5a22..54a3f82e901a 100755..100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -2731,7 +2731,10 @@ const IDocumentFieldsAccess* ViewShell::getIDocumentFieldsAccess() const { retur IDocumentContentOperations* ViewShell::getIDocumentContentOperations() { return pDoc; } IDocumentStylePoolAccess* ViewShell::getIDocumentStylePoolAccess() { return pDoc; } const IDocumentStatistics* ViewShell::getIDocumentStatistics() const { return pDoc; } -IDocumentUndoRedo* ViewShell::getIDocumentUndoRedoAccess() { return pDoc; } + +IDocumentUndoRedo* ViewShell::getIDocumentUndoRedoAccess() +{ return &pDoc->GetIDocumentUndoRedo(); } + // --> OD 2007-11-14 #i83479# const IDocumentListItems* ViewShell::getIDocumentListItemsAccess() const { diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx index adf37dd11f22..209730ff59dd 100644 --- a/sw/source/core/view/vnew.cxx +++ b/sw/source/core/view/vnew.cxx @@ -32,9 +32,8 @@ #include <sfx2/printer.hxx> #include <rtl/logfile.hxx> #include <doc.hxx> -#ifndef _DOCSH_HXX +#include <IDocumentUndoRedo.hxx> #include <docsh.hxx> -#endif #include <viewsh.hxx> #include <rootfrm.hxx> #include <viewimp.hxx> @@ -220,7 +219,8 @@ ViewShell::ViewShell( SwDoc& rDocument, Window *pWindow, //In Init wird ein Standard-FrmFmt angelegt. // --> OD 2005-02-11 #i38810# - if ( !pDoc->IsUndoNoResetModified() && !bIsDocModified ) + if ( !pDoc->GetIDocumentUndoRedo().IsUndoNoResetModified() + && !bIsDocModified ) // <-- { pDoc->ResetModified(); @@ -293,8 +293,10 @@ ViewShell::ViewShell( ViewShell& rShell, Window *pWindow, SetHiddenFlag( !pOpt->IsShowHiddenField() ); // in Init wird ein Standard-FrmFmt angelegt - if( !bModified && !pDoc->IsUndoNoResetModified() ) + if( !bModified && !pDoc->GetIDocumentUndoRedo().IsUndoNoResetModified() ) + { pDoc->ResetModified(); + } //Format-Cache erweitern. if ( SwTxtFrm::GetTxtCache()->GetCurMax() < 2550 ) diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 83e0289e6082..5f6dc3e75e65 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -60,6 +60,7 @@ #include <pagefrm.hxx> #include <cntfrm.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <wdocsh.hxx> #include <fesh.hxx> #include <pam.hxx> @@ -270,10 +271,10 @@ void ViewShell::ChgAllPageOrientation( USHORT eOri ) if( rOld.GetLandscape() != bNewOri ) { SwPageDesc aNew( rOld ); - const sal_Bool bDoesUndo( GetDoc()->DoesUndo() ); - GetDoc()->DoUndo( sal_False ); + const bool bDoesUndo( GetDoc()->GetIDocumentUndoRedo().DoesUndo() ); + GetDoc()->GetIDocumentUndoRedo().DoUndo(false); GetDoc()->CopyPageDesc(rOld, aNew); - GetDoc()->DoUndo( bDoesUndo ); + GetDoc()->GetIDocumentUndoRedo().DoUndo(bDoesUndo); aNew.SetLandscape( bNewOri ); SwFrmFmt& rFmt = aNew.GetMaster(); SwFmtFrmSize aSz( rFmt.GetFrmSize() ); @@ -313,10 +314,10 @@ void ViewShell::ChgAllPageSize( Size &rSz ) { const SwPageDesc &rOld = const_cast<const SwDoc *>(pMyDoc)->GetPageDesc( i ); SwPageDesc aNew( rOld ); - const sal_Bool bDoesUndo( GetDoc()->DoesUndo() ); - GetDoc()->DoUndo( sal_False ); + const bool bDoesUndo( GetDoc()->GetIDocumentUndoRedo().DoesUndo() ); + GetDoc()->GetIDocumentUndoRedo().DoUndo(false); GetDoc()->CopyPageDesc( rOld, aNew ); - GetDoc()->DoUndo( bDoesUndo ); + GetDoc()->GetIDocumentUndoRedo().DoUndo(bDoesUndo); SwFrmFmt& rPgFmt = aNew.GetMaster(); Size aSz( rSz ); const BOOL bOri = aNew.GetLandscape(); diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index 963c5c847500..eb97f08c52c6 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <hintids.hxx> #include <tools/date.hxx> #include <tools/time.hxx> @@ -46,6 +47,7 @@ #include <swtypes.hxx> #include <shellio.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <pam.hxx> #include <editsh.hxx> #include <undobj.hxx> // fuer Undo Insert-Dokument @@ -131,7 +133,7 @@ ULONG SwReader::Read( const Reader& rOptions ) SwUndoInsDoc* pUndo = 0; BOOL bReadPageDescs = FALSE; - BOOL bDocUndo = pDoc->DoesUndo(); + bool const bDocUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); BOOL bSaveUndo = bDocUndo && pCrsr; if( bSaveUndo ) { @@ -139,15 +141,15 @@ ULONG SwReader::Read( const Reader& rOptions ) if( 0 != ( bReadPageDescs = po->aOpt.IsPageDescs() ) ) { bSaveUndo = FALSE; - pDoc->DelAllUndoObj(); + pDoc->GetIDocumentUndoRedo().DelAllUndoObj(); } else { - pDoc->ClearRedo(); - pDoc->StartUndo( UNDO_INSDOKUMENT, NULL ); + pDoc->GetIDocumentUndoRedo().ClearRedo(); + pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_INSDOKUMENT, NULL ); } } - pDoc->DoUndo( FALSE ); + pDoc->GetIDocumentUndoRedo().DoUndo(false); SwNodeIndex aSplitIdx( pDoc->GetNodes() ); @@ -270,7 +272,8 @@ ULONG SwReader::Read( const Reader& rOptions ) if( bSaveUndo ) { pDoc->SetRedlineMode_intern( eOld ); - pDoc->AppendUndo( new SwUndoInsLayFmt( pFrmFmt,0,0 ) ); + pDoc->GetIDocumentUndoRedo().AppendUndo( + new SwUndoInsLayFmt( pFrmFmt,0,0 ) ); pDoc->SetRedlineMode_intern( nsRedlineMode_t::REDLINE_IGNORE ); } if( pFrmFmt->GetDepends() ) @@ -314,7 +317,7 @@ ULONG SwReader::Read( const Reader& rOptions ) { pDoc->SetRedlineMode_intern( eOld ); pUndo->SetInsertRange( *pUndoPam, FALSE ); - pDoc->AppendUndo( pUndo ); + pDoc->GetIDocumentUndoRedo().AppendUndo( pUndo ); pDoc->SetRedlineMode_intern( nsRedlineMode_t::REDLINE_IGNORE ); } @@ -349,14 +352,16 @@ ULONG SwReader::Read( const Reader& rOptions ) pDoc->SetAllUniqueFlyNames(); if( bReadPageDescs ) - pDoc->DoUndo( TRUE ); + { + pDoc->GetIDocumentUndoRedo().DoUndo(true); + } else { - pDoc->DoUndo( bDocUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bDocUndo); if( bSaveUndo ) { pDoc->SetRedlineMode_intern( eOld ); - pDoc->EndUndo( UNDO_INSDOKUMENT, NULL ); + pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_INSDOKUMENT, NULL ); pDoc->SetRedlineMode_intern( nsRedlineMode_t::REDLINE_IGNORE ); } } @@ -535,7 +540,8 @@ SwDoc* Reader::GetTemplateDoc() { pTemplate = pDocSh->GetDoc(); pTemplate->SetOle2Link( Link() ); - pTemplate->DoUndo( FALSE ); // always FALSE + // always FALSE + pTemplate->GetIDocumentUndoRedo().DoUndo( false ); pTemplate->set(IDocumentSettingAccess::BROWSE_MODE, bTmplBrowseMode ); pTemplate->RemoveAllFmtLanguageDependencies(); diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 230da033d50c..606b98486b13 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -87,6 +87,7 @@ #include <docary.hxx> #include <docstat.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <pam.hxx> #include <ndtxt.hxx> #include <mdiexp.hxx> // ...Percent() @@ -109,9 +110,7 @@ #include <sfx2/viewfrm.hxx> -#ifndef _STATSTR_HRC #include <statstr.hrc> // ResId fuer Statusleiste -#endif #include <swerror.h> #define FONTSIZE_MASK 7 @@ -631,8 +630,8 @@ void __EXPORT SwHTMLParser::Continue( int nToken ) pDoc->SetOle2Link( Link() ); BOOL bModified = pDoc->IsModified(); - BOOL bWasUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + bool const bWasUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); // Wenn der Import abgebrochen wird, kein Continue mehr rufen. // Falls ein Pending-Stack existiert aber durch einen Aufruf @@ -889,8 +888,8 @@ if( pSttNdIdx->GetIndex()+1 == pPam->GetBound( FALSE ).nNode.GetIndex() ) { if( bWasUndo ) { - pDoc->DelAllUndoObj(); - pDoc->DoUndo( TRUE ); + pDoc->GetIDocumentUndoRedo().DelAllUndoObj(); + pDoc->GetIDocumentUndoRedo().DoUndo(true); } else if( !pInitVSh ) { @@ -900,7 +899,9 @@ if( pSttNdIdx->GetIndex()+1 == pPam->GetBound( FALSE ).nNode.GetIndex() ) // wir muessen das Undo noch anschalten. ViewShell *pTmpVSh = CheckActionViewShell(); if( pTmpVSh ) - pDoc->DoUndo( TRUE ); + { + pDoc->GetIDocumentUndoRedo().DoUndo(true); + } } pDoc->SetOle2Link( aOLELink ); @@ -951,7 +952,7 @@ void SwHTMLParser::DocumentDetected() CallEndAction( TRUE, TRUE ); - pDoc->DoUndo( FALSE ); + pDoc->GetIDocumentUndoRedo().DoUndo(false); // Durch das DocumentDetected wurde im allgemeinen eine // ViewShell angelegt. Es kann aber auch sein, dass sie // erst spaeter angelegt wird, naemlich dann, wenn die UI diff --git a/sw/source/ui/app/apphdl.cxx b/sw/source/ui/app/apphdl.cxx index 653208aaf250..84fe6705212a 100644 --- a/sw/source/ui/app/apphdl.cxx +++ b/sw/source/ui/app/apphdl.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <hintids.hxx> #include <tools/urlobj.hxx> @@ -71,9 +72,7 @@ #include <srcview.hxx> #include <wrtsh.hxx> #include <docsh.hxx> -#ifndef _CMDID_H #include <cmdid.h> // Funktion-Ids -#endif #include <initui.hxx> #include <uitool.hxx> #include <swmodule.hxx> @@ -83,13 +82,12 @@ #include <gloslst.hxx> // SwGlossaryList #include <glosdoc.hxx> // SwGlossaryList #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <cfgitems.hxx> #include <prtopt.hxx> #include <modcfg.hxx> #include <globals.h> // globale Konstanten z.B. -#ifndef _APP_HRC #include <app.hrc> -#endif #include <fontcfg.hxx> #include <barcfg.hxx> #include <uinums.hxx> @@ -813,7 +811,7 @@ void SwModule::ConfigurationChanged( utl::ConfigurationBroadcaster* pBrdCst, sal SwDocShell* pDocShell = (SwDocShell*)SfxObjectShell::GetFirst(&aType); while( pDocShell ) { - pDocShell->GetDoc()->DoUndo( bUndo ); + pDocShell->GetDoc()->GetIDocumentUndoRedo().DoUndo(bUndo); pDocShell = (SwDocShell*)SfxObjectShell::GetNext(*pDocShell, &aType); } } diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx index 9508c4c17864..be28c23064fc 100644 --- a/sw/source/ui/app/docsh.cxx +++ b/sw/source/ui/app/docsh.cxx @@ -81,6 +81,7 @@ #include <shellio.hxx> // I/O #include <docstyle.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <docstat.hxx> #include <pagedesc.hxx> #include <pview.hxx> @@ -508,7 +509,8 @@ sal_Bool SwDocShell::SaveAs( SfxMedium& rMedium ) // Modified-Flag merken und erhalten ohne den Link zu Callen // (fuer OLE; nach Anweisung von MM) BOOL bIsModified = pDoc->IsModified(); - SwUndoNoModifiedPosition aOldPos = pDoc->getUndoNoModifiedPosition(); + SwUndoNoModifiedPosition const aOldPos = + pDoc->GetIDocumentUndoRedo().getUndoNoModifiedPosition(); Link aOldOLELnk( pDoc->GetOle2Link() ); pDoc->SetOle2Link( Link() ); @@ -535,7 +537,7 @@ sal_Bool SwDocShell::SaveAs( SfxMedium& rMedium ) if( bIsModified ) { pDoc->SetModified(); - pDoc->setUndoNoModifiedPosition( aOldPos ); + pDoc->GetIDocumentUndoRedo().setUndoNoModifiedPosition(aOldPos); } pDoc->SetOle2Link( aOldOLELnk ); diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx index 5bbc29aab2ee..c386ccaf552e 100644 --- a/sw/source/ui/app/docsh2.cxx +++ b/sw/source/ui/app/docsh2.cxx @@ -44,9 +44,7 @@ #include <svl/zformat.hxx> #include <unotools/pathoptions.hxx> #include <svtools/transfer.hxx> -#ifndef _SFXSIDS_HRC //autogen #include <sfx2/dialogs.hrc> -#endif #include <sfx2/dinfdlg.hxx> #include <sfx2/request.hxx> #include <sfx2/dispatch.hxx> @@ -57,9 +55,7 @@ #include <svtools/sfxecode.hxx> #include <sfx2/docfile.hxx> #include <sfx2/docfilt.hxx> -#ifndef _SVX_SVXIDS_HRC //autogen #include <svx/svxids.hrc> -#endif #include <svx/drawitem.hxx> #include <editeng/svxacorr.hxx> #include <editeng/langitem.hxx> @@ -86,6 +82,7 @@ #include <redlndlg.hxx> #include <docstyle.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <pagedesc.hxx> #include <shellio.hxx> #include <pview.hxx> @@ -103,15 +100,9 @@ #include <cmdid.h> #include <globals.h> #include <helpid.h> -#ifndef _APP_HRC #include <app.hrc> -#endif -#ifndef _POOLFMT_HRC #include <poolfmt.hrc> -#endif -#ifndef _GLOBALS_HRC #include <globals.hrc> -#endif #include <com/sun/star/ui/dialogs/XFilePicker.hpp> #include <com/sun/star/ui/dialogs/XFilterManager.hpp> #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> @@ -342,8 +333,8 @@ BOOL SwDocShell::Insert( SfxObjectShell &rSource, // --> OD 2005-05-10 #i48949# - actions aren't undoable. Thus, allow no undo // actions // Note: The undo action stack is cleared at the end of this method. - bool bDoesUndo( GetDoc()->DoesUndo() ); - GetDoc()->DoUndo( sal_False ); + bool const bDoesUndo( GetDoc()->GetIDocumentUndoRedo().DoesUndo() ); + GetDoc()->GetIDocumentUndoRedo().DoUndo(false); // <-- BOOL bRet = FALSE; @@ -544,9 +535,9 @@ BOOL SwDocShell::Insert( SfxObjectShell &rSource, // the document node array. Thus, clear the undo action stack. if ( bDoesUndo ) { - GetDoc()->DelAllUndoObj(); + GetDoc()->GetIDocumentUndoRedo().DelAllUndoObj(); } - GetDoc()->DoUndo( bDoesUndo ); + GetDoc()->GetIDocumentUndoRedo().DoUndo(bDoesUndo); // <-- return bRet; @@ -1637,7 +1628,9 @@ void SwDocShell::SetModified( BOOL bSet ) BOOL bOld = pDoc->IsModified(); pDoc->SetModified(); if( !bOld ) - pDoc->SetUndoNoResetModified(); + { + pDoc->GetIDocumentUndoRedo().SetUndoNoResetModified(); + } } else pDoc->ResetModified(); diff --git a/sw/source/ui/app/docst.cxx b/sw/source/ui/app/docst.cxx index d06ab31b7478..0871be898729 100644 --- a/sw/source/ui/app/docst.cxx +++ b/sw/source/ui/app/docst.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/container/XNameAccess.hpp> @@ -62,7 +63,8 @@ #include "cmdid.h" #include "globals.hrc" #include "viewopt.hxx" -#include "doc.hxx" +#include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include "swstyle.h" #include "frmfmt.hxx" #include "charfmt.hxx" @@ -751,7 +753,9 @@ USHORT SwDocShell::Edit( const String &rName, const String &rParent, USHORT nFam pDoc->SetModified(); if( !bModified ) // Bug 57028 - pDoc->SetUndoNoResetModified(); + { + pDoc->GetIDocumentUndoRedo().SetUndoNoResetModified(); + } GetWrtShell()->EndAllAction(); } @@ -762,7 +766,7 @@ USHORT SwDocShell::Edit( const String &rName, const String &rParent, USHORT nFam // #116530# //pBasePool->Erase( &aTmp ); GetWrtShell()->Undo(UNDO_EMPTY, 1); - pDoc->ClearRedo(); + pDoc->GetIDocumentUndoRedo().ClearRedo(); } if( !bModified ) @@ -814,7 +818,9 @@ USHORT SwDocShell::Edit( const String &rName, const String &rParent, USHORT nFam pDoc->SetModified(); if( !bModified ) // Bug 57028 - pDoc->SetUndoNoResetModified(); + { + pDoc->GetIDocumentUndoRedo().SetUndoNoResetModified(); + } GetWrtShell()->EndAllAction(); } @@ -1200,7 +1206,7 @@ USHORT SwDocShell::MakeByExample( const String &rName, USHORT nFamily, rDest.SetPoolHlpFileId( nHFId ); // werden Kopf-/Fusszeilen angelegt, so gibt es kein Undo mehr! - pCurrWrtShell->GetDoc()->DelAllUndoObj(); + pCurrWrtShell->GetDoc()->GetIDocumentUndoRedo().DelAllUndoObj(); pCurrWrtShell->EndAllAction(); } @@ -1274,7 +1280,7 @@ void SwDocShell::_LoadStyles( SfxObjectShell& rSource, BOOL bPreserveCurrentDocu { // die View wird spaeter angelegt, ueberschreibt aber das // Modify-Flag. Per Undo ist sowieso nichts mehr zu machen - pDoc->SetUndoNoResetModified(); + pDoc->GetIDocumentUndoRedo().SetUndoNoResetModified(); } } } diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx index b0b81c5df6e4..1ae3e2c3518c 100644 --- a/sw/source/ui/app/docstyle.cxx +++ b/sw/source/ui/app/docstyle.cxx @@ -54,6 +54,7 @@ #include <docary.hxx> #include <ccoll.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <cmdid.h> #include <swstyle.h> #include <app.hrc> @@ -844,11 +845,11 @@ BOOL SwDocStyleSheet::SetName( const String& rStr) String aOldName(aPageDesc.GetName()); aPageDesc.SetName( rStr ); - BOOL bDoesUndo = rDoc.DoesUndo(); + bool const bDoesUndo = rDoc.GetIDocumentUndoRedo().DoesUndo(); - rDoc.DoUndo(aOldName.Len() > 0); + rDoc.GetIDocumentUndoRedo().DoUndo(aOldName.Len() > 0); rDoc.ChgPageDesc(aOldName, aPageDesc); - rDoc.DoUndo(bDoesUndo); + rDoc.GetIDocumentUndoRedo().DoUndo(bDoesUndo); // <- #116530# rDoc.SetModified(); @@ -1140,11 +1141,11 @@ void SwDocStyleSheet::SetItemSet( const SfxItemSet& rSet, ASSERT( &rSet != &aCoreSet, "SetItemSet mit eigenem Set ist nicht erlaubt" ); // --> OD 2008-02-12 #newlistlevelattrs# - if ( rDoc.DoesUndo() ) + if (rDoc.GetIDocumentUndoRedo().DoesUndo()) { SwRewriter aRewriter; aRewriter.AddRule( UNDO_ARG1, GetName() ); - rDoc.StartUndo( UNDO_INSFMTATTR, &aRewriter ); + rDoc.GetIDocumentUndoRedo().StartUndo( UNDO_INSFMTATTR, &aRewriter ); } // <-- @@ -1310,10 +1311,10 @@ void SwDocStyleSheet::SetItemSet( const SfxItemSet& rSet, pNewDsc = new SwPageDesc( *pDesc ); // --> OD 2005-05-09 #i48949# - no undo actions for the // copy of the page style - const sal_Bool bDoesUndo( rDoc.DoesUndo() ); - rDoc.DoUndo( sal_False ); + bool const bUndo(rDoc.GetIDocumentUndoRedo().DoesUndo()); + rDoc.GetIDocumentUndoRedo().DoUndo(false); rDoc.CopyPageDesc(*pDesc, *pNewDsc); // #i7983# - rDoc.DoUndo( bDoesUndo ); + rDoc.GetIDocumentUndoRedo().DoUndo(bUndo); // <-- pFmt = &pNewDsc->GetMaster(); @@ -1409,9 +1410,9 @@ void SwDocStyleSheet::SetItemSet( const SfxItemSet& rSet, } // --> OD 2008-02-12 #newlistlevelattrs# - if ( rDoc.DoesUndo() ) + if (rDoc.GetIDocumentUndoRedo().DoesUndo()) { - rDoc.EndUndo( UNDO_INSFMTATTR, NULL ); + rDoc.GetIDocumentUndoRedo().EndUndo( UNDO_INSFMTATTR, NULL ); } // <-- } diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx index 4a0c9c2a6b25..b1f3bd899018 100644 --- a/sw/source/ui/config/optload.cxx +++ b/sw/source/ui/config/optload.cxx @@ -34,13 +34,9 @@ #include <tools/shl.hxx> #include <swtypes.hxx> -#ifndef _HELPID_H #include <helpid.h> -#endif #include <uiitems.hxx> -#ifndef _MODCFG_HXX #include <modcfg.hxx> -#endif #include "swmodule.hxx" #include "usrpref.hxx" #include "wrtsh.hxx" @@ -65,9 +61,7 @@ #include <sot/clsids.hxx> #include <unotools/configmgr.hxx> #include <docsh.hxx> -#ifndef _CONFIG_HRC #include <config.hrc> -#endif #include <SwStyleNameMapper.hxx> #include <numrule.hxx> #include <SwNodeNum.hxx> diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx index 8220c7ee2c8d..baf13fbd607d 100644 --- a/sw/source/ui/dochdl/swdtflvr.cxx +++ b/sw/source/ui/dochdl/swdtflvr.cxx @@ -88,6 +88,7 @@ #include <shellio.hxx> #include <ddefld.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <pagedesc.hxx> #include <IMark.hxx> #include <docary.hxx> @@ -3797,8 +3798,8 @@ void SwTrnsfrDdeLink::Disconnect( BOOL bRemoveDataAdvise ) if( bDelBookmrk && refObj.Is() && FindDocShell() ) { SwDoc* pDoc = pDocShell->GetDoc(); - BOOL bUndo = pDoc->DoesUndo(); - pDoc->DoUndo( FALSE ); + bool const bUndo = pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); // --> OD, CD, OS 2005-11-25 #i58448# Link aSavedOle2Link( pDoc->GetOle2Link() ); @@ -3815,7 +3816,7 @@ void SwTrnsfrDdeLink::Disconnect( BOOL bRemoveDataAdvise ) pDoc->SetOle2Link( aSavedOle2Link ); // <-- - pDoc->DoUndo( bUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); bDelBookmrk = FALSE; } diff --git a/sw/source/ui/docvw/AnnotationWin.cxx b/sw/source/ui/docvw/AnnotationWin.cxx index 08fb91dcc3c6..52b1821d5a8b 100644 --- a/sw/source/ui/docvw/AnnotationWin.cxx +++ b/sw/source/ui/docvw/AnnotationWin.cxx @@ -28,7 +28,6 @@ * ************************************************************************/ - #include "precompiled_sw.hxx" #include <AnnotationWin.hxx> @@ -62,8 +61,10 @@ #include <wrtsh.hxx> #include <docsh.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <SwUndoField.hxx> + namespace sw { namespace annotation { SwAnnotationWin::SwAnnotationWin( SwEditWin& rEditWin, @@ -116,7 +117,8 @@ void SwAnnotationWin::UpdateData() SwField* pOldField = mpFld->Copy(); mpFld->SetPar2(Engine()->GetEditEngine().GetText()); mpFld->SetTextObject(Engine()->CreateParaObject()); - DocView().GetDocShell()->GetDoc()->AppendUndo(new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true)); + DocView().GetDocShell()->GetDoc()->GetIDocumentUndoRedo().AppendUndo( + new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true)); delete pOldField; // so we get a new layout of notes (anchor position is still the same and we would otherwise not get one) Mgr().SetLayout(); @@ -246,7 +248,8 @@ void SwAnnotationWin::InitAnswer(OutlinerParaObject* pText) SwField* pOldField = mpFld->Copy(); mpFld->SetPar2(Engine()->GetEditEngine().GetText()); mpFld->SetTextObject(Engine()->CreateParaObject()); - DocView().GetDocShell()->GetDoc()->AppendUndo(new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true)); + DocView().GetDocShell()->GetDoc()->GetIDocumentUndoRedo().AppendUndo( + new SwUndoFieldFromDoc(aPosition, *pOldField, *mpFld, 0, true)); delete pOldField; Engine()->SetModifyHdl( LINK( this, SwAnnotationWin, ModifyHdl ) ); Engine()->ClearModifyFlag(); diff --git a/sw/source/ui/index/toxmgr.cxx b/sw/source/ui/index/toxmgr.cxx index 8564000d26ac..e23073053e54 100644 --- a/sw/source/ui/index/toxmgr.cxx +++ b/sw/source/ui/index/toxmgr.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <wrtsh.hxx> #include <shellres.hxx> #include <swwait.hxx> @@ -34,10 +35,9 @@ #include <toxmgr.hxx> #include <crsskip.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <swundo.hxx> -#ifndef _GLOBALS_HRC #include <globals.hrc> -#endif /*-------------------------------------------------------------------- Beschreibung: Handhabung der Verzeichnisse durch TOXMgr @@ -450,12 +450,14 @@ BOOL SwTOXMgr::UpdateOrInsertTOX(const SwTOXDescription& rDesc, { SwDoc * pDoc = pSh->GetDoc(); - if (pDoc->DoesUndo()) + if (pDoc->GetIDocumentUndoRedo().DoesUndo()) { if (pNewTOX != NULL) - pDoc->DelAllUndoObj(); + { + pDoc->GetIDocumentUndoRedo().DelAllUndoObj(); + } - pDoc->StartUndo(UNDO_TOXCHANGE, NULL); + pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_TOXCHANGE, NULL); } if (pNewTOX != NULL) // => pTOX != NULL @@ -463,12 +465,14 @@ BOOL SwTOXMgr::UpdateOrInsertTOX(const SwTOXDescription& rDesc, bRet = pSh->UpdateTableOf(*pTOX, pSet); - if (pDoc->DoesUndo()) + if (pDoc->GetIDocumentUndoRedo().DoesUndo()) { - pDoc->EndUndo(UNDO_TOXCHANGE, NULL); + pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_TOXCHANGE, NULL); if (pNewTOX == NULL) - pDoc->DelAllUndoObj(); + { + pDoc->GetIDocumentUndoRedo().DelAllUndoObj(); + } } } diff --git a/sw/source/ui/misc/glshell.cxx b/sw/source/ui/misc/glshell.cxx index 4d93f8d7542f..9c70ef06e58a 100644 --- a/sw/source/ui/misc/glshell.cxx +++ b/sw/source/ui/misc/glshell.cxx @@ -49,18 +49,13 @@ #include <view.hxx> #include <glshell.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <glosdoc.hxx> #include <shellio.hxx> #include <initui.hxx> // fuer ::GetGlossaries() -#ifndef _CMDID_H #include <cmdid.h> -#endif -#ifndef _SWERROR_H #include <swerror.h> -#endif -#ifndef _MISC_HRC #include <misc.hrc> -#endif #define SwWebGlosDocShell @@ -311,8 +306,9 @@ SwDocShellRef SwGlossaries::EditGroupDoc( const String& rGroup, const String& rS aDocTitle += ' '; aDocTitle += sLongName; - BOOL bDoesUndo = xDocSh->GetDoc()->DoesUndo(); - xDocSh->GetDoc()->DoUndo( FALSE ); + bool const bDoesUndo = + xDocSh->GetDoc()->GetIDocumentUndoRedo().DoesUndo(); + xDocSh->GetDoc()->GetIDocumentUndoRedo().DoUndo( false ); xDocSh->GetWrtShell()->InsertGlossary( *pGroup, rShortName ); if( !xDocSh->GetDoc()->getPrinter( false ) ) @@ -340,7 +336,7 @@ SwDocShellRef SwGlossaries::EditGroupDoc( const String& rGroup, const String& rS catch( uno::Exception& ) {} - xDocSh->GetDoc()->DoUndo( bDoesUndo ); + xDocSh->GetDoc()->GetIDocumentUndoRedo().DoUndo( bDoesUndo ); xDocSh->GetDoc()->ResetModified(); if ( bShow ) pFrame->GetFrame().Appear(); diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx index b1fd76c63aff..1b3858fbda2d 100644 --- a/sw/source/ui/uiview/view.cxx +++ b/sw/source/ui/uiview/view.cxx @@ -75,12 +75,12 @@ #include <beziersh.hxx> #include <globdoc.hxx> #include <scroll.hxx> -#include <globdoc.hxx> #include <navipi.hxx> #include <gloshdl.hxx> #include <usrpref.hxx> #include <srcview.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <drawdoc.hxx> #include <wdocsh.hxx> #include <wview.hxx> @@ -1021,7 +1021,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) // so setze das Modified NICHT zurueck. // --> OD 2005-02-11 #i38810# - no reset of modified state, if document // was already modified. - if ( !pWrtShell->GetDoc()->IsUndoNoResetModified() && + if (!pWrtShell->GetDoc()->GetIDocumentUndoRedo().IsUndoNoResetModified() && ( !pFirst || pFirst == pVFrame ) && !bIsDocModified ) // <-- diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx index eeab95b5bccd..7ef9d587af48 100644 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -86,6 +86,7 @@ #include <uivwimp.hxx> #include <docsh.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <wrtsh.hxx> #include <viewopt.hxx> #include <basesh.hxx> @@ -2105,10 +2106,11 @@ long SwView::InsertMedium( USHORT nSlotId, SfxMedium* pMedium, INT16 nVersion ) } else { - sal_Bool bUndo = pDoc->DoesUndo(); - pDoc->DoUndo( sal_False ); + bool const bUndo = + pDoc->GetIDocumentUndoRedo().DoesUndo(); + pDoc->GetIDocumentUndoRedo().DoUndo(false); nErrno = pDocSh->InsertFrom( *pMedium ) ? 0 : ERR_SWG_READ_ERROR; - pDoc->DoUndo( bUndo ); + pDoc->GetIDocumentUndoRedo().DoUndo(bUndo); } } @@ -2125,7 +2127,9 @@ long SwView::InsertMedium( USHORT nSlotId, SfxMedium* pMedium, INT16 nVersion ) { // Disable Undo for .sdw (136991) or // if the number of page styles with header/footer has changed (#i67305) if( !pRead || nUndoCheck != lcl_PageDescWithHeader( *pDoc ) ) - pDoc->DelAllUndoObj(); + { + pDoc->GetIDocumentUndoRedo().DelAllUndoObj(); + } } pWrtShell->EndAllAction(); diff --git a/sw/source/ui/wrtsh/wrtsh2.cxx b/sw/source/ui/wrtsh/wrtsh2.cxx index 0e51cd4c756c..9d93b7a81d1e 100644 --- a/sw/source/ui/wrtsh/wrtsh2.cxx +++ b/sw/source/ui/wrtsh/wrtsh2.cxx @@ -51,6 +51,7 @@ #include <reffld.hxx> #include <swundo.hxx> #include <doc.hxx> +#include <IDocumentUndoRedo.hxx> #include <viewopt.hxx> // SwViewOptions #include <frmfmt.hxx> // fuer UpdateTable #include <swtable.hxx> // fuer UpdateTable @@ -229,10 +230,11 @@ BOOL SwWrtShell::UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet) if (pSet == NULL) { - SwDoc * _pDoc = GetDoc(); - - if (_pDoc != NULL) - _pDoc->DelAllUndoObj(); + SwDoc *const pDoc_ = GetDoc(); + if (pDoc_) + { + pDoc_->GetIDocumentUndoRedo().DelAllUndoObj(); + } } } |