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

Miklos Vajna vmiklos at collabora.co.uk
Tue Apr 10 09:19:15 UTC 2018


 sw/qa/extras/ooxmlexport/data/tdf116410.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx    |    6 ++++++
 sw/qa/extras/ooxmlimport/data/tdf115719b.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx      |    6 ++++++
 writerfilter/source/dmapper/PropertyMap.cxx   |    4 ++++
 5 files changed, 16 insertions(+)

New commits:
commit da01b17379fcb3cb89eddf718c922d1676aa482a
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Mar 26 21:52:05 2018 +0200

    tdf#116410 DOCX import: restrict increased object spacing to multiple shapes
    
    This anchored object handling is just there to be bug-compatible with
    Word, it's not needed for the case when there is a single shape in the
    paragraph.
    
    (cherry picked from commit 2c4d84e93901571ead79c85aa3894ef4e10bf5af)
    
    Also:
    
    Related: tdf#115719 DOCX import: fix ignore of increased anchored obj spacing
    
    If there is only a single anchored object, then ignore only the current
    paragraph, not all paragraphs of the section.
    
    (cherry picked from commit 599ff05300599d4e4ce818092f18e76e738b921e)
    
    Conflicts:
            sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
    
    Change-Id: I5e3dc4ba9a4a6f459ec6217e8974ebc2d7303bcc
    Reviewed-on: https://gerrit.libreoffice.org/52022
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf116410.docx b/sw/qa/extras/ooxmlexport/data/tdf116410.docx
new file mode 100644
index 000000000000..5352a233ed70
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf116410.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 079e3513a4a1..922f2fcb7192 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -121,6 +121,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf115719, "tdf115719.docx")
     CPPUNIT_ASSERT_EQUAL(2, getPages());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf116410, "tdf116410.docx")
+{
+    // Opposite of the above, was 2 pages, should be 1 page.
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf113183, "tdf113183.docx")
 {
     // This was 2096, the horizontal positioning of the star shape affected the
diff --git a/sw/qa/extras/ooxmlimport/data/tdf115719b.docx b/sw/qa/extras/ooxmlimport/data/tdf115719b.docx
new file mode 100644
index 000000000000..551b9871fe60
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf115719b.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index e3cdc19701ab..3af5a063c002 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -276,6 +276,12 @@ xray ThisComponent.StyleFamilies.PageStyles.Default.Width
     CPPUNIT_ASSERT( pos.X > width / 2 );
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf115719b, "tdf115719b.docx")
+{
+    // This was 0, 4th (last) paragraph had no increased spacing.
+    CPPUNIT_ASSERT(getProperty<sal_Int32>(getParagraph(4), "ParaTopMargin") > 0);
+}
+
 DECLARE_OOXMLIMPORT_TEST(testN766477, "n766477.docx")
 {
     /*
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 708b80a55c4f..af4133a7625e 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1148,6 +1148,10 @@ void SectionPropertyMap::HandleIncreasedAnchoredObjectSpacing(DomainMapper_Impl&
     std::vector<AnchoredObjectInfo>& rAnchoredObjectAnchors = rDM_Impl.m_aAnchoredObjectAnchors;
     for (auto& rAnchor : rAnchoredObjectAnchors)
     {
+        // Ignore this paragraph when there is a single shape only.
+        if (rAnchor.m_aAnchoredObjects.size() < 2)
+            continue;
+
         // Analyze the anchored objects of this paragraph, now that we know the
         // page width.
         sal_Int32 nShapesWidth = 0;


More information about the Libreoffice-commits mailing list