diff options
author | Michael Stahl <mst@openoffice.org> | 2011-01-20 19:19:11 +0100 |
---|---|---|
committer | Michael Stahl <mst@openoffice.org> | 2011-01-20 19:19:11 +0100 |
commit | 8bc2019cab507472a0412f47cea6e740ec697818 (patch) | |
tree | d9be3cb1b4cc1235e38d9aea82f78de426b62cfd /sw/source | |
parent | d9e7a76273396527d29503a66ed514e2a0199ceb (diff) |
undoapi: fix regression: undo comments with un-rewritten arguments:
various EndUndo() calls undo SwRewriter applications done at StartUndo().
EndUndo() should only be called with a real ID if a comment should
be generated from the ID that should become the list action comment.
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/crsr/findcoll.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/doc/docredln.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/edit/eddel.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/edit/edfcol.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/undo/docundo.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/unocore/unobkm.cxx | 3 | ||||
-rw-r--r-- | sw/source/ui/app/docst.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/app/docstyle.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/dochdl/swdtflvr.cxx | 8 | ||||
-rw-r--r-- | sw/source/ui/docvw/PostItMgr.cxx | 4 | ||||
-rw-r--r-- | sw/source/ui/lingu/olmenu.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/misc/redlndlg.cxx | 4 | ||||
-rw-r--r-- | sw/source/ui/ribbar/drawbase.cxx | 4 | ||||
-rw-r--r-- | sw/source/ui/shells/drwbassh.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/shells/textsh.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/uiview/view2.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/uiview/viewsrch.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/utlui/content.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/wrtsh/wrtsh1.cxx | 4 | ||||
-rw-r--r-- | sw/source/ui/wrtsh/wrtsh2.cxx | 2 |
20 files changed, 35 insertions, 26 deletions
diff --git a/sw/source/core/crsr/findcoll.cxx b/sw/source/core/crsr/findcoll.cxx index 18381bcbc854..ed8fb97e9b54 100644 --- a/sw/source/core/crsr/findcoll.cxx +++ b/sw/source/core/crsr/findcoll.cxx @@ -113,7 +113,7 @@ ULONG SwCursor::Find( const SwTxtFmtColl& rFmtColl, if (bStartUndo) { - pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_UI_REPLACE_STYLE, NULL ); + pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_END, 0); } return nRet; } diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 895a1142b9ac..809e560dce21 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -2138,7 +2138,7 @@ bool SwDoc::AcceptRedline( USHORT nPos, bool bCallDelete ) if (GetIDocumentUndoRedo().DoesUndo()) { - GetIDocumentUndoRedo().EndUndo( UNDO_ACCEPT_REDLINE, NULL ); + GetIDocumentUndoRedo().EndUndo(UNDO_END, 0); } } return bRet; @@ -2208,7 +2208,7 @@ bool SwDoc::RejectRedline( USHORT nPos, bool bCallDelete ) SwRewriter aRewriter; aRewriter.AddRule(UNDO_ARG1, pTmp->GetDescr()); - GetIDocumentUndoRedo().StartUndo( UNDO_REJECT_REDLINE, NULL ); + GetIDocumentUndoRedo().StartUndo(UNDO_REJECT_REDLINE, &aRewriter); } int nLoopCnt = 2; @@ -2251,7 +2251,7 @@ bool SwDoc::RejectRedline( USHORT nPos, bool bCallDelete ) if (GetIDocumentUndoRedo().DoesUndo()) { - GetIDocumentUndoRedo().EndUndo( UNDO_REJECT_REDLINE, NULL ); + GetIDocumentUndoRedo().EndUndo(UNDO_END, 0); } } return bRet; diff --git a/sw/source/core/edit/eddel.cxx b/sw/source/core/edit/eddel.cxx index 8f94d301c09e..ef4362e2a9fd 100644 --- a/sw/source/core/edit/eddel.cxx +++ b/sw/source/core/edit/eddel.cxx @@ -139,7 +139,7 @@ long SwEditShell::Delete() // falls eine Undo-Klammerung, dann hier beenden if( bUndo ) { - GetDoc()->GetIDocumentUndoRedo().EndUndo( UNDO_DELETE, NULL ); + GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_END, 0); } EndAllAction(); nRet = 1; diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index dffc2035e77e..fb430aa053ab 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -88,7 +88,7 @@ void SwEditShell::SetTxtFmtColl( SwTxtFmtColl *pFmt, GetDoc()->SetTxtFmtColl( *PCURCRSR, pLocal, true, bResetListAttrs ); FOREACHPAM_END() - GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_SETFMTCOLL, NULL); + GetDoc()->GetIDocumentUndoRedo().EndUndo(UNDO_SETFMTCOLL, &aRewriter); EndAllAction(); } // <-- diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx index b9578126a0af..3dce09e66fa9 100644 --- a/sw/source/core/undo/docundo.cxx +++ b/sw/source/core/undo/docundo.cxx @@ -233,6 +233,8 @@ UndoManager::EndUndo(SwUndoId const i_eUndoId, SwRewriter const*const pRewriter) SwUndoId const eUndoId( ((0 == i_eUndoId) || (UNDO_START == i_eUndoId)) ? UNDO_END : i_eUndoId ); + OSL_ENSURE(!((UNDO_END == eUndoId) && pRewriter), + "EndUndo(): no Undo ID, but rewriter given?"); SfxUndoAction *const pLastUndo( (0 == SfxUndoManager::GetUndoActionCount(CurrentLevel)) @@ -252,6 +254,8 @@ UndoManager::EndUndo(SwUndoId const i_eUndoId, SwRewriter const*const pRewriter) { if (UNDO_END != eUndoId) { + OSL_ENSURE(pListAction->GetId() == eUndoId, + "EndUndo(): given ID different from StartUndo()"); // comment set by caller of EndUndo String comment = String(SW_RES(UNDO_BASE + eUndoId)); if (pRewriter) diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx index fc66416ad45f..7a67b7748c97 100644 --- a/sw/source/core/unocore/unobkm.cxx +++ b/sw/source/core/unocore/unobkm.cxx @@ -378,7 +378,8 @@ throw (uno::RuntimeException) m_pImpl->m_pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_BOOKMARK_RENAME, &aRewriter); pMarkAccess->renameMark(m_pImpl->m_pRegisteredBookmark, rName); - m_pImpl->m_pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_BOOKMARK_RENAME, 0); + m_pImpl->m_pDoc->GetIDocumentUndoRedo().EndUndo( + UNDO_BOOKMARK_RENAME, &aRewriter); } OUString SAL_CALL diff --git a/sw/source/ui/app/docst.cxx b/sw/source/ui/app/docst.cxx index 0e05e1893d11..60206f764663 100644 --- a/sw/source/ui/app/docst.cxx +++ b/sw/source/ui/app/docst.cxx @@ -1010,7 +1010,7 @@ USHORT SwDocShell::UpdateStyle(const String &rName, USHORT nFamily, SwWrtShell* // Vorlage auch anwenden, um harte Attributierung // zu entfernen GetWrtShell()->SetTxtFmtColl( pColl ); - GetWrtShell()->EndUndo(UNDO_INSFMTATTR, NULL); + GetWrtShell()->EndUndo(); GetWrtShell()->EndAllAction(); } break; diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx index d861fb2fe176..e3d47a82b38f 100644 --- a/sw/source/ui/app/docstyle.cxx +++ b/sw/source/ui/app/docstyle.cxx @@ -1409,7 +1409,7 @@ void SwDocStyleSheet::SetItemSet( const SfxItemSet& rSet, // --> OD 2008-02-12 #newlistlevelattrs# if (rDoc.GetIDocumentUndoRedo().DoesUndo()) { - rDoc.GetIDocumentUndoRedo().EndUndo( UNDO_INSFMTATTR, NULL ); + rDoc.GetIDocumentUndoRedo().EndUndo(UNDO_END, 0); } // <-- } diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx index c113a4a477bf..c43979225d31 100644 --- a/sw/source/ui/dochdl/swdtflvr.cxx +++ b/sw/source/ui/dochdl/swdtflvr.cxx @@ -228,7 +228,7 @@ public: } ~SwTrnsfrActionAndUndo() { - pSh->EndUndo( eUndoId ); + pSh->EndUndo(); pSh->EndAllAction(); } }; @@ -3434,7 +3434,7 @@ int SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt, { // nicht in sich selbst kopieren/verschieben rSh.DestroyCrsr(); - rSh.EndUndo( eUndoId ); + rSh.EndUndo(); rSh.EndAction(); rSh.EndAction(); return 0; @@ -3542,8 +3542,8 @@ int SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt, rSrcSh.LeaveSelFrmMode(); if( rSrcSh.GetDoc() != rSh.GetDoc() ) - rSrcSh.EndUndo( eUndoId ); - rSh.EndUndo( eUndoId ); + rSrcSh.EndUndo(); + rSh.EndUndo(); // Shell in den richtigen Status versetzen if( &rSrcSh != &rSh && ( rSh.IsFrmSelected() || rSh.IsObjSelected() )) diff --git a/sw/source/ui/docvw/PostItMgr.cxx b/sw/source/ui/docvw/PostItMgr.cxx index f5b0cc32a5ea..f45d1ee1e78c 100644 --- a/sw/source/ui/docvw/PostItMgr.cxx +++ b/sw/source/ui/docvw/PostItMgr.cxx @@ -1247,7 +1247,7 @@ void SwPostItMgr::Delete(String aAuthor) mpWrtShell->GotoField( *(*i) ); mpWrtShell->DelRight(); } - mpWrtShell->EndUndo( UNDO_DELETE ); + mpWrtShell->EndUndo(); PrepareView(); mpWrtShell->EndAllAction(); mbLayout = true; @@ -1293,7 +1293,7 @@ void SwPostItMgr::Delete() mvPostItFlds.clear(); */ - mpWrtShell->EndUndo( UNDO_DELETE ); + mpWrtShell->EndUndo(); PrepareView(); mpWrtShell->EndAllAction(); mbLayout = true; diff --git a/sw/source/ui/lingu/olmenu.cxx b/sw/source/ui/lingu/olmenu.cxx index d10d0fdec41a..352580707f74 100644 --- a/sw/source/ui/lingu/olmenu.cxx +++ b/sw/source/ui/lingu/olmenu.cxx @@ -788,7 +788,7 @@ void SwSpellPopup::Execute( USHORT nId ) of temporary auto correction is now undoable two and must reside in the same undo group.*/ pSh->EndAction(); - pSh->EndUndo(UNDO_UI_REPLACE); + pSh->EndUndo(); pSh->SetInsMode( bOldIns ); } diff --git a/sw/source/ui/misc/redlndlg.cxx b/sw/source/ui/misc/redlndlg.cxx index fd6c37fa5e2d..19decf172798 100644 --- a/sw/source/ui/misc/redlndlg.cxx +++ b/sw/source/ui/misc/redlndlg.cxx @@ -960,7 +960,9 @@ void SwRedlineAcceptDlg::CallAcceptReject( BOOL bSelect, BOOL bAccept ) // #111827# if (aRedlines.size() > 1) - pSh->EndUndo(bAccept? UNDO_ACCEPT_REDLINE : UNDO_REJECT_REDLINE); + { + pSh->EndUndo(); + } pSh->EndAction(); diff --git a/sw/source/ui/ribbar/drawbase.cxx b/sw/source/ui/ribbar/drawbase.cxx index bbfa7242c4ad..fae2df9c0f4a 100644 --- a/sw/source/ui/ribbar/drawbase.cxx +++ b/sw/source/ui/ribbar/drawbase.cxx @@ -364,7 +364,9 @@ BOOL SwDrawBase::MouseButtonUp(const MouseEvent& rMEvt) } } if (m_pWin->GetSdrDrawMode() == OBJ_NONE) - m_pSh->EndUndo(UNDO_INSERT); + { + m_pSh->EndUndo(); + } } bReturn = TRUE; diff --git a/sw/source/ui/shells/drwbassh.cxx b/sw/source/ui/shells/drwbassh.cxx index 2bd3a59d0810..ba205e5fb313 100644 --- a/sw/source/ui/shells/drwbassh.cxx +++ b/sw/source/ui/shells/drwbassh.cxx @@ -294,7 +294,7 @@ void SwDrawBaseShell::Execute(SfxRequest &rReq) pSh->StartAllAction(); // --> OD 2004-07-14 #i30451# - pSh->StartUndo(); + pSh->StartUndo(UNDO_INSFMTATTR); pSdrView->SetGeoAttrToMarked(*pOutSet); diff --git a/sw/source/ui/shells/textsh.cxx b/sw/source/ui/shells/textsh.cxx index c270ee72c26a..b7795172e55f 100644 --- a/sw/source/ui/shells/textsh.cxx +++ b/sw/source/ui/shells/textsh.cxx @@ -1208,7 +1208,7 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) } rSh.EndAllAction(); - rSh.EndUndo( UNDO_INSERT ); + rSh.EndUndo(); if ( aChars.Len() ) { diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx index c268f95aee8c..fd3ac1544b6b 100644 --- a/sw/source/ui/uiview/view2.cxx +++ b/sw/source/ui/uiview/view2.cxx @@ -471,7 +471,7 @@ BOOL SwView::InsertGraphicDlg( SfxRequest& rReq ) rReq.Done(); } - rSh.EndUndo(UNDO_INSERT); // wegen moegl. Shellwechsel + rSh.EndUndo(); // due to possible change of Shell } delete pFileDlg; diff --git a/sw/source/ui/uiview/viewsrch.cxx b/sw/source/ui/uiview/viewsrch.cxx index a5727c402c11..dd2db26a58e8 100644 --- a/sw/source/ui/uiview/viewsrch.cxx +++ b/sw/source/ui/uiview/viewsrch.cxx @@ -585,7 +585,7 @@ void SwView::Replace() pSrchItem->GetReplaceString(), SwWrtShell::GETSTYLE_CREATESOME )); - pWrtShell->EndUndo(UNDO_UI_REPLACE_STYLE); // #111827# + pWrtShell->EndUndo(); // #111827# } else { diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx index 4a51f2c9e787..e3777e6a8feb 100644 --- a/sw/source/ui/utlui/content.cxx +++ b/sw/source/ui/utlui/content.cxx @@ -2818,7 +2818,7 @@ void SwContentTree::EditEntry(SvLBoxEntry* pEntry, sal_uInt8 nMode) pActiveShell->StartUndo(UNDO_DELETE, &aRewriter); pActiveShell->GetView().GetViewFrame()->GetDispatcher()->Execute(FN_TABLE_SELECT_ALL); pActiveShell->DeleteRow(); - pActiveShell->EndUndo(UNDO_DELETE); + pActiveShell->EndUndo(); pActiveShell->EndAction(); } else if(nMode == EDIT_MODE_RENAME) diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx index 208334e8431e..1402286d3c67 100644 --- a/sw/source/ui/wrtsh/wrtsh1.cxx +++ b/sw/source/ui/wrtsh/wrtsh1.cxx @@ -276,7 +276,7 @@ JP 21.01.98: Ueberschreiben ueberschreibt nur die Selektion, nicht das if( bStarted ) { EndAllAction(); - EndUndo(UNDO_REPLACE); + EndUndo(); } // delete pChgFlg; } @@ -376,7 +376,7 @@ void SwWrtShell::Insert( const String &rPath, const String &rFilter, if ( bOwnMgr ) delete pFrmMgr; - EndUndo(UNDO_INSERT); + EndUndo(); EndAllAction(); } diff --git a/sw/source/ui/wrtsh/wrtsh2.cxx b/sw/source/ui/wrtsh/wrtsh2.cxx index daf2fabe17fc..7aa0c49087d2 100644 --- a/sw/source/ui/wrtsh/wrtsh2.cxx +++ b/sw/source/ui/wrtsh/wrtsh2.cxx @@ -97,7 +97,7 @@ void SwWrtShell::Insert(SwField &rFld) } SwEditShell::Insert2(rFld, bDeleted); - EndUndo(UNDO_INSERT); + EndUndo(); EndAllAction(); } |