summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2018-09-06 17:21:05 +0200
committerLászló Németh <nemeth@numbertext.org>2018-09-07 20:55:03 +0200
commit694a6389e84d5b416cde6dde2d5eaa589a0a6493 (patch)
treec9d1caa5d8d311ca682685892ac70b0444b74c0d /sw/source
parent453fde35bb838febf73bfda0bd981ee270c9b12e (diff)
tdf#119019 DOCX track changes: fix invisible delete and insert
during editing in a paragraph with tracked paragraph formatting, by accepting the old formatting change automatically in the actual paragraph before text deletion/insertion. Note: it's not possible to reject paragraph formatting changes in LO, but showing them is a minimal requirement. Now they are still visible in change tracking dialog and by the vertical line before the related paragraphs until there are no new text deletions and insertions in those paragraphs. Change-Id: I526daad8dd96212ac73a10627128553452e4d31c Reviewed-on: https://gerrit.libreoffice.org/60101 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx13
-rw-r--r--sw/source/core/doc/DocumentRedlineManager.cxx25
-rw-r--r--sw/source/core/inc/DocumentRedlineManager.hxx2
3 files changed, 40 insertions, 0 deletions
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 788cb61dd7df..52e67c6d0146 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -2449,6 +2449,15 @@ bool DocumentContentOperationsManager::Overwrite( const SwPaM &rRg, const OUStri
bool DocumentContentOperationsManager::InsertString( const SwPaM &rRg, const OUString &rStr,
const SwInsertFlags nInsertMode )
{
+ // tdf#119019 accept tracked paragraph formatting to do not hide new insertions
+ if( m_rDoc.getIDocumentRedlineAccess().IsRedlineOn() )
+ {
+ RedlineFlags eOld = m_rDoc.getIDocumentRedlineAccess().GetRedlineFlags();
+ m_rDoc.getIDocumentRedlineAccess().AcceptRedlineParagraphFormatting( rRg );
+ if (eOld != m_rDoc.getIDocumentRedlineAccess().GetRedlineFlags())
+ m_rDoc.getIDocumentRedlineAccess().SetRedlineFlags( eOld );
+ }
+
// fetching DoesUndo is surprisingly expensive
bool bDoesUndo = m_rDoc.GetIDocumentUndoRedo().DoesUndo();
if (bDoesUndo)
@@ -3578,6 +3587,10 @@ bool DocumentContentOperationsManager::DeleteAndJoinWithRedlineImpl( SwPaM & rPa
}
}
+ // tdf#119019 accept tracked paragraph formatting to do not hide new deletions
+ if ( *rPam.GetPoint() != *rPam.GetMark() )
+ m_rDoc.getIDocumentRedlineAccess().AcceptRedlineParagraphFormatting( rPam );
+
if (m_rDoc.GetIDocumentUndoRedo().DoesUndo())
{
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index c5b259f6aef6..d489d6065d49 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -2262,6 +2262,31 @@ bool DocumentRedlineManager::AcceptRedline( const SwPaM& rPam, bool bCallDelete
// #TODO - add 'SwExtraRedlineTable' also ?
}
+void DocumentRedlineManager::AcceptRedlineParagraphFormatting( const SwPaM &rPam )
+{
+ const SwPosition* pStt = rPam.Start(),
+ * pEnd = pStt == rPam.GetPoint() ? rPam.GetMark()
+ : rPam.GetPoint();
+
+ const sal_uLong nSttIdx = pStt->nNode.GetIndex();
+ const sal_uLong nEndIdx = pEnd->nNode.GetIndex();
+
+ for( SwRedlineTable::size_type n = 0; n < mpRedlineTable->size() ; ++n )
+ {
+ const SwRangeRedline* pTmp = (*mpRedlineTable)[ n ];
+ sal_uLong nPt = pTmp->GetPoint()->nNode.GetIndex(),
+ nMk = pTmp->GetMark()->nNode.GetIndex();
+ if( nPt < nMk ) { long nTmp = nMk; nMk = nPt; nPt = nTmp; }
+
+ if( nsRedlineType_t::REDLINE_PARAGRAPH_FORMAT == pTmp->GetType() &&
+ ( (nSttIdx <= nMk && nMk <= nEndIdx) || (nSttIdx <= nPt && nPt <= nEndIdx) ) )
+ AcceptRedline( n, false );
+
+ if( nMk > nEndIdx )
+ break;
+ }
+}
+
bool DocumentRedlineManager::RejectRedline( SwRedlineTable::size_type nPos, bool bCallDelete )
{
bool bRet = false;
diff --git a/sw/source/core/inc/DocumentRedlineManager.hxx b/sw/source/core/inc/DocumentRedlineManager.hxx
index 1a410a15b6ba..9a3bd2cbd6ab 100644
--- a/sw/source/core/inc/DocumentRedlineManager.hxx
+++ b/sw/source/core/inc/DocumentRedlineManager.hxx
@@ -86,6 +86,8 @@ public:
virtual bool AcceptRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) override;
+ virtual void AcceptRedlineParagraphFormatting(/*[in]*/const SwPaM& rPam) override;
+
virtual bool RejectRedline(/*[in]*/SwRedlineTable::size_type nPos, /*[in]*/bool bCallDelete) override;
virtual bool RejectRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) override;