summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2024-09-27 17:03:53 -0400
committerJustin Luth <jluth@mail.com>2024-09-28 20:46:42 +0200
commit7f84c993d3d2b5f05b18e740fea960901da57f80 (patch)
treedbd75eda0db3d41d82f2d61f10a1c4c0672f36da
parentd8d4efbe1faf6e3a4a048ab4bb8f23516ce13268 (diff)
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 <jluth@mail.com>
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport12.cxx6
-rw-r--r--sw/qa/extras/ww8export/ww8export3.cxx12
-rw-r--r--sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx13
3 files changed, 11 insertions, 20 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
index f5af7f65d8bc..821fe9ea6074 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx
@@ -801,6 +801,10 @@ DECLARE_OOXMLEXPORT_TEST(testTdf120224_textControlCrossRef, "tdf120224_textContr
xRunEnum->nextElement(); //Text
uno::Reference<beans::XPropertySet> xPropertySet(xRunEnum->nextElement(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(u"Bookmark"_ustr,
+ getProperty<OUString>(xPropertySet, u"TextPortionType"_ustr));
+
+ xPropertySet.set(xRunEnum->nextElement(), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(u"TextFieldStart"_ustr,
getProperty<OUString>(xPropertySet, u"TextPortionType"_ustr));
uno::Reference<container::XNamed> xBookmark(
@@ -821,7 +825,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(u"Text1"_ustr, sTextFieldName);
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index a4ba58d4c37a..c4d7276c16d1 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -416,7 +416,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), u"Bookmark"_ustr);
+ uno::Reference<text::XFormField> xFormField = getProperty< uno::Reference<text::XFormField> >(getRun(getParagraph(5), 4), u"Bookmark"_ustr);
uno::Reference<container::XNameContainer> xParameters(xFormField->getParameters());
OUString sTmp;
@@ -440,27 +440,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), u"Bookmark"_ustr);
+ xFormField = getProperty< uno::Reference<text::XFormField> >(getRun(getParagraph(6), 3), u"Bookmark"_ustr);
xParameters.set(xFormField->getParameters());
xParameters->getByName(u"Type"_ustr) >>= sTmp;
CPPUNIT_ASSERT_EQUAL(u"calculated"_ustr, sTmp);
- xFormField = getProperty< uno::Reference<text::XFormField> >(getRun(getParagraph(7), 2), u"Bookmark"_ustr);
+ xFormField = getProperty< uno::Reference<text::XFormField> >(getRun(getParagraph(7), 3), u"Bookmark"_ustr);
xParameters.set(xFormField->getParameters());
xParameters->getByName(u"Type"_ustr) >>= sTmp;
CPPUNIT_ASSERT_EQUAL(u"currentDate"_ustr, sTmp);
- xFormField = getProperty< uno::Reference<text::XFormField> >(getRun(getParagraph(7), 7), u"Bookmark"_ustr);
+ xFormField = getProperty< uno::Reference<text::XFormField> >(getRun(getParagraph(7), 10), u"Bookmark"_ustr);
xParameters.set(xFormField->getParameters());
xParameters->getByName(u"Type"_ustr) >>= sTmp;
CPPUNIT_ASSERT_EQUAL(u"currentTime"_ustr, sTmp);
- xFormField = getProperty< uno::Reference<text::XFormField> >(getRun(getParagraph(8), 2), u"Bookmark"_ustr);
+ xFormField = getProperty< uno::Reference<text::XFormField> >(getRun(getParagraph(8), 3), u"Bookmark"_ustr);
xParameters.set(xFormField->getParameters());
xParameters->getByName(u"Type"_ustr) >>= sTmp;
CPPUNIT_ASSERT_EQUAL(u"number"_ustr, sTmp);
- xFormField = getProperty< uno::Reference<text::XFormField> >(getRun(getParagraph(8), 7), u"Bookmark"_ustr);
+ xFormField = getProperty< uno::Reference<text::XFormField> >(getRun(getParagraph(8), 10), u"Bookmark"_ustr);
xParameters.set(xFormField->getParameters());
xParameters->getByName(u"Type"_ustr) >>= sTmp;
CPPUNIT_ASSERT_EQUAL(u"date"_ustr, sTmp);
diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
index 8b35fc8618c6..5c0974007e37 100644
--- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx
@@ -9128,19 +9128,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)