sw/qa/extras/ooxmlexport/ooxmlexport5.cxx |    8 ++++++++
 sw/source/core/doc/docbm.cxx              |   15 +++++++++++----
 2 files changed, 19 insertions(+), 4 deletions(-)

New commits:
commit b01d9c03c7686147b60ccbb756922e86cda1e883
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Fri Apr 21 11:30:43 2023 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Fri May 5 21:46:18 2023 +0200

    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 <jl...@mail.com>
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151004
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index f33013413a1c..fa592d8496c5 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -1357,6 +1357,14 @@ CPPUNIT_TEST_FIXTURE(Test, fdo60957)
     loadAndSave("fdo60957-2.docx");
     xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
     assertXPath(pXmlDoc, "//w:tbl", 2);
+
+    //tdf#154956
+    uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, 
uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> 
xBookmarksByIdx(xBookmarksSupplier->getBookmarks(), uno::UNO_QUERY);
+    uno::Reference<container::XNameAccess> xBookmarksByName = 
xBookmarksSupplier->getBookmarks();
+
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), 
xBookmarksByIdx->getCount());
+    CPPUNIT_ASSERT(xBookmarksByName->hasByName("_GoBack"));
 }
 
 //This has more cells than msword supports, we must balance the
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 3a0383324d9f..00102a5e8458 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,

Reply via email to