summaryrefslogtreecommitdiff
path: root/sw/source/core/doc/docbm.cxx
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2023-04-21 11:30:43 -0400
committerJustin Luth <jluth@mail.com>2023-04-25 18:29:34 +0200
commit21b1dd42e9a817ae9b68e9e13ea57ce2491940c6 (patch)
tree043d747e2201b7ec69ec637c212b29563de4602f /sw/source/core/doc/docbm.cxx
parent07f87f20c8af71faeda500b6b1d7775743bbf646 (diff)
tdf#154956 sw: delete bookmarks at end if whole node is selected
Exposed by LO 7.2.2 commit 4bf04dea9afb30a9395e80b07a81d1908937ee8b Author: Michael Stahl on Fri Aug 27 14:38:18 2021 +0200 tdf#128106 sw: copy bookmarks at start if whole node is copied Change-Id: I9205463f9beb3704eeb63fe7556103230ba7283d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150772 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> 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.cxx15
1 files changed, 11 insertions, 4 deletions
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index e047b2d1e319..ab5e544c2358 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -197,10 +197,17 @@ namespace
bool lcl_Lower( const SwPosition& rPos, const SwNode& rNdIdx, std::optional<sal_Int32> oContentIdx )
{
- return rPos.GetNode() < rNdIdx
- || ( oContentIdx.has_value()
- && rPos.GetNode() == rNdIdx
- && rPos.GetContentIndex() < *oContentIdx );
+ if (rPos.GetNode() < rNdIdx)
+ return true;
+
+ if (rPos.GetNode() != rNdIdx || !oContentIdx)
+ return false;
+
+ if (rPos.GetContentIndex() < *oContentIdx)
+ return true;
+
+ // paragraph end selected?
+ return rNdIdx.IsTextNode() && *oContentIdx == rNdIdx.GetTextNode()->Len();
}
bool lcl_MarkOrderingByStart(const ::sw::mark::MarkBase *const pFirst,