diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2022-08-22 15:29:58 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2022-08-23 10:25:09 +0200 |
commit | 27892a5e12dada80226f778ab2bd14b1bdaab58a (patch) | |
tree | f0b91370794fc5b883bc79ceb28ecdc891b3d916 /sw/source/core/doc/docbm.cxx | |
parent | 937c22f242d0c08b0980ce864530966378ada9a9 (diff) |
sw: enable Replace with Protect Bookmarks
The dialog calls Replace on the whole bookmark, and with commit
7974cea6c788e02d7c36573e2d10dcc51884f70e the bookmark is preserved, so
the HasReadonlySel() should not prevent this replace from happening.
Change-Id: I823b042c8327c6716b2ac1a8a86beffd887e6e4c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138693
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sw/source/core/doc/docbm.cxx')
-rw-r--r-- | sw/source/core/doc/docbm.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index 52461872b6e0..027cc884ce08 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -973,6 +973,7 @@ namespace sw::mark static bool isDeleteMark( ::sw::mark::MarkBase const*const pMark, + bool const isReplace, SwNode const& rStt, SwNode const& rEnd, std::optional<sal_Int32> oStartContentIdx, @@ -996,6 +997,8 @@ namespace sw::mark && lcl_Lower(pMark->GetOtherMarkPos(), rEnd, oEndContentIdx); // special case: completely in range, touching the end? if ( oEndContentIdx.has_value() + && !(isReplace && IDocumentMarkAccess::GetType(*pMark) + == IDocumentMarkAccess::MarkType::BOOKMARK) && ( ( rbIsOtherPosInRange && pMark->GetMarkPos().GetNode() == rEnd && pMark->GetMarkPos().GetContentIndex() == *oEndContentIdx ) @@ -1041,7 +1044,7 @@ namespace sw::mark return false; } - bool MarkManager::isBookmarkDeleted(SwPaM const& rPaM) const + bool MarkManager::isBookmarkDeleted(SwPaM const& rPaM, bool const isReplace) const { SwPosition const& rStart(*rPaM.Start()); SwPosition const& rEnd(*rPaM.End()); @@ -1051,7 +1054,7 @@ namespace sw::mark { bool bIsPosInRange(false); bool bIsOtherPosInRange(false); - bool const bDeleteMark = isDeleteMark(*ppMark, + bool const bDeleteMark = isDeleteMark(*ppMark, isReplace, rStart.GetNode(), rEnd.GetNode(), rStart.GetContentIndex(), rEnd.GetContentIndex(), bIsPosInRange, bIsOtherPosInRange); if (bDeleteMark @@ -1087,7 +1090,7 @@ namespace sw::mark ::sw::mark::MarkBase *const pMark = *ppMark; bool bIsPosInRange(false); bool bIsOtherPosInRange(false); - bool const bDeleteMark = isDeleteMark(pMark, rStt, rEnd, oStartContentIdx, oEndContentIdx, bIsPosInRange, bIsOtherPosInRange); + bool const bDeleteMark = isDeleteMark(pMark, false, rStt, rEnd, oStartContentIdx, oEndContentIdx, bIsPosInRange, bIsOtherPosInRange); if ( bIsPosInRange && ( bIsOtherPosInRange |