sw/qa/extras/ooxmlexport/ooxmlexport12.cxx        |    6 +++++-
 sw/qa/extras/ww8export/ww8export3.cxx             |   12 ++++++------
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   13 -------------
 3 files changed, 11 insertions(+), 20 deletions(-)

New commits:
commit 1a4baa7d2907a9a3317b25762cbe11ae27389fea
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Fri Sep 27 17:03:53 2024 -0400
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Fri Oct 4 09:25:03 2024 +0200

    tdf#163154 revert "tdf120224 writerfilter: consume excess bookmark
    
    ... from fields"
    
    The intention of my 6.2 commit 579c0749bef8c980507229439715e72060c1b077
    hack was to avoid importing duplicate LO-exported bookmarks.
    (LO exported the bookmarks inside the field definition,
    while MS normally has the bookmarks outside the field.)
    
    So the impact of this revert should be neglible,
    affecting mainly documents that LO round-tripped before 6.2
    which would just import one more "Copy" of a bookmark.
    
    The reason for doing the revert is also not terribly important.
    For a few odd documents that otherwise wouldn't import a bookmark
    around a field, it will allow the LO navigator a way to quickly
    jump to the field (since Legacy Fields are not included
    in the Navigator's field list).
    
    Note that what I am reverting was a HACK any way.
    It did a pretty good job of only ignoring LO-exported bookmarks,
    since MS Word usually puts the bookmark around the OUTSIDE
    of the field, while LO always puts the bookmark
    inside the field definition (and thus IsOpenField())
    
    make CppunitTest_sw_ww8export3 \
        CPPUNIT_TEST_NAME=testTdf79435_legacyInputFields
    
    make CppunitTest_sw_ooxmlexport12 \
        CPPUNIT_TEST_NAME=testTdf120224_textControlCrossRef
    
    Change-Id: Iefaf1173794c66b2a6f3e5c2143ed594de7efe35
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174081
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>
    (cherry picked from commit 7f84c993d3d2b5f05b18e740fea960901da57f80)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174020
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174309

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index c77936a8d66c..aff6a689a9dd 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -800,6 +800,10 @@ 
DECLARE_OOXMLEXPORT_TEST(testTdf120224_textControlCrossRef, "tdf120224_textContr
     xRunEnum->nextElement(); //Text
     uno::Reference<beans::XPropertySet> xPropertySet(xRunEnum->nextElement(), 
uno::UNO_QUERY);
 
+    CPPUNIT_ASSERT_EQUAL(OUString("Bookmark"),
+                         getProperty<OUString>(xPropertySet, 
"TextPortionType"));
+
+    xPropertySet.set(xRunEnum->nextElement(), uno::UNO_QUERY);
     CPPUNIT_ASSERT_EQUAL(OUString("TextFieldStart"),
                          getProperty<OUString>(xPropertySet, 
"TextPortionType"));
     uno::Reference<container::XNamed> xBookmark(
@@ -819,7 +823,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf120224_textControlCrossRef, 
"tdf120224_textContr
     uno::Reference<container::XIndexAccess> 
xBookmarksByIdx(xBookmarksSupplier->getBookmarks(),
                                                             uno::UNO_QUERY);
     // TextFields should not be turned into real bookmarks.
-    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), 
xBookmarksByIdx->getCount());
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), 
xBookmarksByIdx->getCount());
 
     // The actual name isn't critical, but if it fails, it is worth asking why.
     CPPUNIT_ASSERT_EQUAL(OUString("Text1"), sTextFieldName);
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx 
b/sw/qa/extras/ww8export/ww8export3.cxx
index 97ea979d01e8..34bc542da52c 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -415,7 +415,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf79435_legacyInputFields)
 {
     loadAndReload("tdf79435_legacyInputFields.docx");
     //using .docx input file to verify cross-format compatibility.
-    uno::Reference<text::XFormField> xFormField = getProperty< 
uno::Reference<text::XFormField> >(getRun(getParagraph(5), 3), "Bookmark");
+    uno::Reference<text::XFormField> xFormField = getProperty< 
uno::Reference<text::XFormField> >(getRun(getParagraph(5), 4), "Bookmark");
     uno::Reference<container::XNameContainer> 
xParameters(xFormField->getParameters());
 
     OUString sTmp;
@@ -439,27 +439,27 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf79435_legacyInputFields)
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Max Length", sal_uInt16(10), nMaxLength);
 
     // too bad this is based on character runs - just found try trial and 
error.
-    xFormField = getProperty< uno::Reference<text::XFormField> 
>(getRun(getParagraph(6), 2), "Bookmark");
+    xFormField = getProperty< uno::Reference<text::XFormField> 
>(getRun(getParagraph(6), 3), "Bookmark");
     xParameters.set(xFormField->getParameters());
     xParameters->getByName("Type") >>= sTmp;
     CPPUNIT_ASSERT_EQUAL(OUString("calculated"), sTmp);
 
-    xFormField = getProperty< uno::Reference<text::XFormField> 
>(getRun(getParagraph(7), 2), "Bookmark");
+    xFormField = getProperty< uno::Reference<text::XFormField> 
>(getRun(getParagraph(7), 3), "Bookmark");
     xParameters.set(xFormField->getParameters());
     xParameters->getByName("Type") >>= sTmp;
     CPPUNIT_ASSERT_EQUAL(OUString("currentDate"), sTmp);
 
-    xFormField = getProperty< uno::Reference<text::XFormField> 
>(getRun(getParagraph(7), 7), "Bookmark");
+    xFormField = getProperty< uno::Reference<text::XFormField> 
>(getRun(getParagraph(7), 10), "Bookmark");
     xParameters.set(xFormField->getParameters());
     xParameters->getByName("Type") >>= sTmp;
     CPPUNIT_ASSERT_EQUAL(OUString("currentTime"), sTmp);
 
-    xFormField = getProperty< uno::Reference<text::XFormField> 
>(getRun(getParagraph(8), 2), "Bookmark");
+    xFormField = getProperty< uno::Reference<text::XFormField> 
>(getRun(getParagraph(8), 3), "Bookmark");
     xParameters.set(xFormField->getParameters());
     xParameters->getByName("Type") >>= sTmp;
     CPPUNIT_ASSERT_EQUAL(OUString("number"), sTmp);
 
-    xFormField = getProperty< uno::Reference<text::XFormField> 
>(getRun(getParagraph(8), 7), "Bookmark");
+    xFormField = getProperty< uno::Reference<text::XFormField> 
>(getRun(getParagraph(8), 10), "Bookmark");
     xParameters.set(xFormField->getParameters());
     xParameters->getByName("Type") >>= sTmp;
     CPPUNIT_ASSERT_EQUAL(OUString("date"), sTmp);
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 86c91db63bbd..32c72d868582 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -8885,19 +8885,6 @@ void DomainMapper_Impl::SetBookmarkName( const OUString& 
rBookmarkName )
     BookmarkMap_t::iterator aBookmarkIter = m_aBookmarkMap.find( 
m_sCurrentBkmkId );
     if( aBookmarkIter != m_aBookmarkMap.end() )
     {
-        // fields are internal bookmarks: consume redundant "normal" bookmark
-        if ( IsOpenField() )
-        {
-            FFDataHandler::Pointer_t  
pFFDataHandler(GetTopFieldContext()->getFFDataHandler());
-            if (pFFDataHandler && pFFDataHandler->getName() == rBookmarkName)
-            {
-                // HACK: At the END marker, StartOrEndBookmark will START
-                // a bookmark which will eventually be abandoned, not created.
-                m_aBookmarkMap.erase(aBookmarkIter);
-                return;
-            }
-        }
-
         if ((m_sCurrentBkmkPrefix == "__RefMoveFrom__"
              || m_sCurrentBkmkPrefix == "__RefMoveTo__")
             && std::find(m_aRedlineMoveIDs.begin(), m_aRedlineMoveIDs.end(), 
rBookmarkName)

Reply via email to