[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sw/qa writerfilter/source

Attila Bakos (NISZ) (via logerrit) logerrit at kemper.freedesktop.org
Wed May 5 08:58:38 UTC 2021


 sw/qa/extras/layout/data/tdf138782.docx      |binary
 sw/qa/extras/layout/layout2.cxx              |   16 ++++++++++++++++
 writerfilter/source/dmapper/DomainMapper.cxx |    5 +++++
 writerfilter/source/filter/WriterFilter.cxx  |    1 -
 4 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit 4e7ef3f7421febc08e621bf9ca276cec7b032808
Author:     Attila Bakos (NISZ) <bakos.attilakaroly at nisz.hu>
AuthorDate: Thu Apr 22 13:26:58 2021 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Wed May 5 10:58:03 2021 +0200

    tdf#138782 DOCX import: fix frame positions of old docs
    
    by limiting AddFrameOffsets compatibility option
    for docs created by MSO 2010 or older.
    
    Likely regression from commit 355d25eac764713f4d52eac801ade6e2ff1deab0
    (n#779627: added quite some compat options from the ww8
    filter on writerfilter).
    
    This patch fixes several bugs, which were
    collected as duplicates by Gábor Kelemen.
    
    Change-Id: I106e90c4bf00bb0b6a8986615cb3ad9c4828d5b3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114476
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit 5812fb81013cc124a9b6a0b9912a34cc715fc495)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115077
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
    Tested-by: Jenkins

diff --git a/sw/qa/extras/layout/data/tdf138782.docx b/sw/qa/extras/layout/data/tdf138782.docx
new file mode 100644
index 000000000000..8bad2ae1b8c4
Binary files /dev/null and b/sw/qa/extras/layout/data/tdf138782.docx differ
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index f0fb593df6a9..9894ceac418c 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -2654,6 +2654,22 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf137185)
     // Before the patch it failed, because the text appeared 2 times on each other.
 }
 
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf138782)
+{
+    CPPUNIT_ASSERT(createDoc("tdf138782.docx"));
+    auto pXml = parseLayoutDump();
+    CPPUNIT_ASSERT(pXml);
+
+    // Without the fix it failed because the 3rd shape was outside the page:
+    // - Expected less than: 13327
+    // - Actual  : 14469
+
+    CPPUNIT_ASSERT_LESS(
+        getXPath(pXml, "/root/page/infos/bounds", "right").toInt32(),
+        getXPath(pXml, "/root/page/body/txt[8]/anchored/SwAnchoredDrawObject/bounds", "right")
+            .toInt32());
+}
+
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf135035)
 {
     createDoc("tdf135035.docx");
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 4a1481f3ea44..b2765a8c572c 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -249,6 +249,11 @@ DomainMapper::~DomainMapper()
             aGrabBag.update(aProperties);
             xDocProps->setPropertyValue("InteropGrabBag", uno::Any(aGrabBag.getAsConstPropertyValueList()));
         }
+
+        // tdf#138782: for docs created in MS Word 2010 and older (compatibilityMode <= 14)
+        m_pImpl->SetDocumentSettingsProperty(
+            "AddFrameOffsets",
+            uno::Any(14 >= m_pImpl->GetSettingsTable()->GetWordCompatibilityMode()));
     }
     catch( const uno::Exception& ) {}
 
diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx
index 0f0fcdb63391..d866981dd438 100644
--- a/writerfilter/source/filter/WriterFilter.cxx
+++ b/writerfilter/source/filter/WriterFilter.cxx
@@ -304,7 +304,6 @@ void WriterFilter::setTargetDocument(const uno::Reference<lang::XComponent>& xDo
     uno::Reference<beans::XPropertySet> xSettings(
         xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY);
 
-    xSettings->setPropertyValue("AddFrameOffsets", uno::makeAny(true));
     xSettings->setPropertyValue("AddVerticalFrameOffsets", uno::makeAny(true));
     xSettings->setPropertyValue("UseOldNumbering", uno::makeAny(false));
     xSettings->setPropertyValue("IgnoreFirstLineIndentInNumbering", uno::makeAny(false));


More information about the Libreoffice-commits mailing list