diff options
author | Rosemary Sebastian <rosemary.seb8@gmail.com> | 2017-07-03 17:18:39 +0530 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-07-04 16:49:25 +0200 |
commit | fe25f95c3de542f15f6043c85f7385cd7569f237 (patch) | |
tree | e25bdffb6cf37a47e354e500ec1ab5b683b62e56 | |
parent | 9cb1fe80b2dfd3684205277f5222df3d743d09d7 (diff) |
tdf#107340 - Incorrect undo label with Track Changes set
Override the GetRewriter() function for the class SwUndoRedlineDelete
Change-Id: I4f7080d9d8eb79757e3e915b51f157bee29e9334
Reviewed-on: https://gerrit.libreoffice.org/39472
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | sw/source/core/doc/DocumentContentOperationsManager.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/inc/UndoRedline.hxx | 5 | ||||
-rw-r--r-- | sw/source/core/undo/unredln.cxx | 18 |
3 files changed, 26 insertions, 1 deletions
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index f934965cb3b9..362d6c8efc02 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -3556,8 +3556,10 @@ bool DocumentContentOperationsManager::DeleteAndJoinWithRedlineImpl( SwPaM & rPa m_rDoc.getIDocumentRedlineAccess().SetRedlineFlags( RedlineFlags::On | RedlineFlags::ShowInsert | RedlineFlags::ShowDelete ); - m_rDoc.GetIDocumentUndoRedo().StartUndo( SwUndoId::DELETE, nullptr ); pUndo = new SwUndoRedlineDelete( rPam, SwUndoId::DELETE ); + const SwRewriter aRewriter = pUndo->GetRewriter(); + const SwRewriter* const pRewriter = &aRewriter; + m_rDoc.GetIDocumentUndoRedo().StartUndo( SwUndoId::DELETE, pRewriter ); m_rDoc.GetIDocumentUndoRedo().AppendUndo( pUndo ); } diff --git a/sw/source/core/inc/UndoRedline.hxx b/sw/source/core/inc/UndoRedline.hxx index 8a62b33937a5..8cf4e63f3f57 100644 --- a/sw/source/core/inc/UndoRedline.hxx +++ b/sw/source/core/inc/UndoRedline.hxx @@ -56,17 +56,22 @@ class SwUndoRedlineDelete : public SwUndoRedline bool bIsDelim : 1; bool bIsBackspace : 1; + OUString m_sRedlineText; + virtual void UndoRedlineImpl(SwDoc & rDoc, SwPaM & rPam) override; virtual void RedoRedlineImpl(SwDoc & rDoc, SwPaM & rPam) override; public: SwUndoRedlineDelete( const SwPaM& rRange, SwUndoId nUserId ); + virtual SwRewriter GetRewriter() const override; bool CanGrouping( const SwUndoRedlineDelete& rPrev ); // SwUndoTableCpyTable needs this information: long NodeDiff() const { return nSttNode - nEndNode; } sal_Int32 ContentStart() const { return nSttContent; } + + void SetRedlineText(const OUString & rText); }; class SwUndoRedlineSort : public SwUndoRedline diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx index 2f9cd4f49b87..2f08ed55d893 100644 --- a/sw/source/core/undo/unredln.cxx +++ b/sw/source/core/undo/unredln.cxx @@ -27,6 +27,7 @@ #include <ndtxt.hxx> #include <UndoCore.hxx> #include <UndoDelete.hxx> +#include <comcore.hrc> #include <rolbck.hxx> #include <redline.hxx> #include <docary.hxx> @@ -146,6 +147,7 @@ SwUndoRedlineDelete::SwUndoRedlineDelete( const SwPaM& rRange, SwUndoId nUsrId ) bCanGroup( false ), bIsDelim( false ), bIsBackspace( false ) { const SwTextNode* pTNd; + SetRedlineText(rRange.GetText()); if( SwUndoId::DELETE == mnUserId && nSttNode == nEndNode && nSttContent + 1 == nEndContent && nullptr != (pTNd = rRange.GetNode().GetTextNode()) ) @@ -163,6 +165,22 @@ SwUndoRedlineDelete::SwUndoRedlineDelete( const SwPaM& rRange, SwUndoId nUsrId ) bCacheComment = false; } +SwRewriter SwUndoRedlineDelete::GetRewriter() const +{ + SwRewriter aResult; + OUString aStr = m_sRedlineText; + aStr = DenoteSpecialCharacters(aStr); + aStr = ShortenString(aStr, nUndoStringLength, SwResId(STR_LDOTS)); + aResult.AddRule(UndoArg1, aStr); + return aResult; +} + + +void SwUndoRedlineDelete::SetRedlineText(const OUString & rText) +{ + m_sRedlineText = rText; +} + void SwUndoRedlineDelete::UndoRedlineImpl(SwDoc & rDoc, SwPaM & rPam) { rDoc.getIDocumentRedlineAccess().DeleteRedline(rPam, true, USHRT_MAX); |