[Libreoffice-commits] core.git: sw/source
Rosemary Sebastian
rosemary.seb8 at gmail.com
Tue Jul 4 14:49:51 UTC 2017
sw/source/core/doc/DocumentContentOperationsManager.cxx | 4 ++-
sw/source/core/inc/UndoRedline.hxx | 5 ++++
sw/source/core/undo/unredln.cxx | 18 ++++++++++++++++
3 files changed, 26 insertions(+), 1 deletion(-)
New commits:
commit fe25f95c3de542f15f6043c85f7385cd7569f237
Author: Rosemary Sebastian <rosemary.seb8 at gmail.com>
Date: Mon Jul 3 17:18:39 2017 +0530
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 at redhat.com>
Tested-by: Michael Stahl <mstahl at redhat.com>
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);
More information about the Libreoffice-commits
mailing list