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>
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index ef1e15e..ceb6bdf 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 e047b2d..ab5e544 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,