diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2019-09-25 16:43:48 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2019-10-04 13:20:30 +0200 |
commit | 453847e817bc43cff52fcab9de104a12571a330f (patch) | |
tree | 40af875fb40b918db218401dbfe392433e4011d8 | |
parent | 7d2497be7d4068a0cf40911e522fe0848d399c6d (diff) |
sw: add DocumentContentOperationsManager::DeleteDummyChar()
... and lcl_RemoveFieldMarks() uses it; this avoids the problem that
lcl_CalcBreaks() would of course remove the dummy character from the
deletion range.
Change-Id: Iba0f7901b9efe4af273e17c58c6b40d4fd783efd
Reviewed-on: https://gerrit.libreoffice.org/80069
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
-rw-r--r-- | sw/source/core/crsr/bookmrk.cxx | 16 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentContentOperationsManager.cxx | 17 | ||||
-rw-r--r-- | sw/source/core/inc/DocumentContentOperationsManager.hxx | 2 |
3 files changed, 23 insertions, 12 deletions
diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx index c6b6af26d12b..ae735607f631 100644 --- a/sw/source/core/crsr/bookmrk.cxx +++ b/sw/source/core/crsr/bookmrk.cxx @@ -122,27 +122,19 @@ namespace assert(pStartTextNode); if (aEndMark != CH_TXT_ATR_FORMELEMENT) { - (void) aStartMark; (void) pStartTextNode; - assert(pStartTextNode->GetText()[rStart.nContent.GetIndex()] == aStartMark); - SwPaM aStart(rStart, rStart); - ++aStart.End()->nContent; - io_pDoc->getIDocumentContentOperations().DeleteRange(aStart); + io_pDoc->GetDocumentContentOperationsManager().DeleteDummyChar(rStart, aStartMark); } const SwPosition& rEnd = pField->GetMarkEnd(); - SwTextNode const*const pEndTextNode = rEnd.nNode.GetNode().GetTextNode(); + SwTextNode *const pEndTextNode = rEnd.nNode.GetNode().GetTextNode(); assert(pEndTextNode); const sal_Int32 nEndPos = (rEnd == rStart) ? rEnd.nContent.GetIndex() : rEnd.nContent.GetIndex() - 1; assert(pEndTextNode->GetText()[nEndPos] == aEndMark); - (void) pEndTextNode; - (void) nEndPos; - SwPaM aEnd(rEnd, rEnd); - if (aEnd.Start()->nContent > 0) - --aEnd.Start()->nContent; - io_pDoc->getIDocumentContentOperations().DeleteRange(aEnd); + SwPosition const aEnd(*pEndTextNode, nEndPos); + io_pDoc->GetDocumentContentOperationsManager().DeleteDummyChar(aEnd, aEndMark); io_pDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::UI_REPLACE, nullptr); }; diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 05a497016ce7..513656a65251 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -1817,6 +1817,23 @@ void DocumentContentOperationsManager::DeleteSection( SwNode *pNode ) m_rDoc.GetNodes().DelNodes( aSttIdx, aEndIdx.GetIndex() - aSttIdx.GetIndex() + 1 ); } +void DocumentContentOperationsManager::DeleteDummyChar( + SwPosition const& rPos, sal_Unicode const cDummy) +{ + SwPaM aPam(rPos, rPos); + ++aPam.GetPoint()->nContent; + assert(aPam.GetText().getLength() == 1 && aPam.GetText()[0] == cDummy); + (void) cDummy; + + DeleteRangeImpl(aPam); + + if (!m_rDoc.getIDocumentRedlineAccess().IsIgnoreRedline() + && !m_rDoc.getIDocumentRedlineAccess().GetRedlineTable().empty()) + { + m_rDoc.getIDocumentRedlineAccess().CompressRedlines(); + } +} + void DocumentContentOperationsManager::DeleteRange( SwPaM & rPam ) { lcl_DoWithBreaks( *this, rPam, &DocumentContentOperationsManager::DeleteRangeImpl ); diff --git a/sw/source/core/inc/DocumentContentOperationsManager.hxx b/sw/source/core/inc/DocumentContentOperationsManager.hxx index d6f8f8eb2a09..d96df4b9e8fe 100644 --- a/sw/source/core/inc/DocumentContentOperationsManager.hxx +++ b/sw/source/core/inc/DocumentContentOperationsManager.hxx @@ -101,6 +101,8 @@ public: //Non-Interface methods + void DeleteDummyChar(SwPosition const& rPos, sal_Unicode cDummy); + void CopyWithFlyInFly( const SwNodeRange& rRg, const SwNodeIndex& rInsPos, const std::pair<const SwPaM&, const SwPosition&> * pCopiedPaM = nullptr, |