[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sw/CppunitTest_sw_ooxmllinks.mk sw/CppunitTest_sw_ww8export2.mk sw/qa writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Tue May 29 14:32:07 UTC 2018


 sw/CppunitTest_sw_ww8export2.mk             |   34 ----------------------------
 sw/qa/extras/ooxmlexport/ooxmlexport6.cxx   |    4 +--
 sw/qa/extras/ww8export/data/tdf117503.docx  |binary
 sw/qa/extras/ww8export/ww8export2.cxx       |    7 +++++
 writerfilter/source/dmapper/PropertyMap.cxx |   27 +++++++++++++++++++++-
 5 files changed, 36 insertions(+), 36 deletions(-)

New commits:
commit 02a924831933d964cda209897bab27c48803c891
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon May 28 21:59:27 2018 +0200

    tdf#117503 DOCX import: fix out of sync first/later top margin
    
    Improve the synchronization between the first page and follow page
    style, so that when the DOC export invokes
    sw::util::IsPlausableSingleWordSection(), it recognizes that originally
    these were the same Word section.
    
    If they don't match up, then the exporter will insert an explicit
    section break, meaning we get one more page in the export result
    compared to the original.
    
    (cherry picked from commit b7ae863efeb082816cc4fe660527a9650d90e186)
    
    Change-Id: I336cf347698187cdede47be2659cec51e4381e85
    Reviewed-on: https://gerrit.libreoffice.org/54988
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/CppunitTest_sw_ooxmllinks.mk b/sw/CppunitTest_sw_ooxmllinks.mk
old mode 100755
new mode 100644
diff --git a/sw/CppunitTest_sw_ww8export2.mk b/sw/CppunitTest_sw_ww8export2.mk
index 5ece5d90a0a3..616347d52904 100644
--- a/sw/CppunitTest_sw_ww8export2.mk
+++ b/sw/CppunitTest_sw_ww8export2.mk
@@ -47,39 +47,7 @@ $(eval $(call gb_CppunitTest_use_sdk_api,sw_ww8export2))
 $(eval $(call gb_CppunitTest_use_ure,sw_ww8export2))
 $(eval $(call gb_CppunitTest_use_vcl,sw_ww8export2))
 
-$(eval $(call gb_CppunitTest_use_components,sw_ww8export2,\
-    basic/util/sb \
-    comphelper/util/comphelp \
-    configmgr/source/configmgr \
-    dbaccess/util/dba \
-    embeddedobj/util/embobj \
-    emfio/emfio \
-    filter/source/config/cache/filterconfig1 \
-    filter/source/storagefilterdetect/storagefd \
-    forms/util/frm \
-    framework/util/fwk \
-    i18npool/util/i18npool \
-    linguistic/source/lng \
-    package/source/xstor/xstor \
-    package/util/package2 \
-    sax/source/expatwrap/expwrap \
-    sw/util/msword \
-    sw/util/sw \
-    sw/util/swd \
-    sfx2/util/sfx \
-    svl/source/fsstor/fsstorage \
-    svtools/util/svt \
-    toolkit/util/tk \
-    ucb/source/core/ucb1 \
-    ucb/source/ucp/file/ucpfile1 \
-    unotools/util/utl \
-    unoxml/source/service/unoxml \
-    unoxml/source/rdf/unordf \
-    uui/util/uui \
-    $(if $(filter DESKTOP,$(BUILD_TYPE)),xmlhelp/util/ucpchelp1) \
-    vcl/vcl.common \
-    xmloff/util/xo \
-))
+$(eval $(call gb_CppunitTest_use_rdb,sw_ww8export2,services))
 
 $(eval $(call gb_CppunitTest_use_configuration,sw_ww8export2))
 
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
index 099566cd8072..837111995c79 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
@@ -454,7 +454,7 @@ DECLARE_OOXMLEXPORT_TEST(testVMLData, "TestVMLData.docx")
 {
     // The problem was exporter was exporting vml data for shape in w:rPr element.
     // vml data should not come under w:rPr element.
-    xmlDocPtr pXmlDoc = parseExport("word/header1.xml");
+    xmlDocPtr pXmlDoc = parseExport("word/header2.xml");
     if (!pXmlDoc)
         return;
     CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:hdr/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:shape", "stroked").match("f"));
@@ -464,7 +464,7 @@ DECLARE_OOXMLEXPORT_TEST(testImageData, "image_data.docx")
 {
     // The problem was exporter was exporting v:imagedata data for shape in w:pict as v:fill w element.
 
-    xmlDocPtr pXmlDoc = parseExport("word/header1.xml");
+    xmlDocPtr pXmlDoc = parseExport("word/header2.xml");
     if (!pXmlDoc)
         return;
     CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:hdr/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:shape/v:imagedata", "detectmouseclick").match("t"));
diff --git a/sw/qa/extras/ww8export/data/tdf117503.docx b/sw/qa/extras/ww8export/data/tdf117503.docx
new file mode 100644
index 000000000000..f817f035b5cf
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf117503.docx differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx
index bc9a104740bb..f7ec720bce99 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -814,6 +814,13 @@ DECLARE_WW8EXPORT_TEST(testTdf112118_DOC, "tdf112118.doc")
     }
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf117503, "tdf117503.docx")
+{
+    // This was 3, first page + standard page styles were not merged together
+    // on export.
+    CPPUNIT_ASSERT_EQUAL(2, getPages());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index f9a09b31df61..7289a744c3f4 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -899,7 +899,8 @@ void SectionPropertyMap::CopyLastHeaderFooter( bool bFirstPage, DomainMapper_Imp
 
 void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage )
 {
-    if (bFirstPage && m_bTitlePage && m_aFollowPageStyle.is())
+    bool bCopyFirstToFollow = bFirstPage && m_bTitlePage && m_aFollowPageStyle.is();
+    if (bCopyFirstToFollow)
     {
         // This is a first page and has a follow style, then enable the
         // header/footer there as well to be consistent.
@@ -932,6 +933,13 @@ void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage )
         Insert( PROP_HEADER_BODY_DISTANCE, uno::makeAny( nHeaderTop - MIN_HEAD_FOOT_HEIGHT ) );// ULSpace.Top()
         Insert( PROP_HEADER_HEIGHT, uno::makeAny( nHeaderTop ) );
 
+        if (bCopyFirstToFollow && HasHeader(/*bFirstPage=*/true))
+        {
+            m_aFollowPageStyle->setPropertyValue("HeaderDynamicSpacing",
+                                                 getProperty(PROP_HEADER_DYNAMIC_SPACING)->second);
+            m_aFollowPageStyle->setPropertyValue("HeaderHeight",
+                                                 getProperty(PROP_HEADER_HEIGHT)->second);
+        }
     }
     else
     {
@@ -962,6 +970,14 @@ void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage )
         Insert( PROP_FOOTER_DYNAMIC_SPACING, uno::makeAny( true ) );
         Insert( PROP_FOOTER_BODY_DISTANCE, uno::makeAny( nHeaderBottom - MIN_HEAD_FOOT_HEIGHT ) );
         Insert( PROP_FOOTER_HEIGHT, uno::makeAny( nHeaderBottom ) );
+
+        if (bCopyFirstToFollow && HasFooter(/*bFirstPage=*/true))
+        {
+            m_aFollowPageStyle->setPropertyValue("FooterDynamicSpacing",
+                                                 getProperty(PROP_FOOTER_DYNAMIC_SPACING)->second);
+            m_aFollowPageStyle->setPropertyValue("FooterHeight",
+                                                 getProperty(PROP_FOOTER_HEIGHT)->second);
+        }
     }
     else
     {
@@ -976,6 +992,15 @@ void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage )
     //now set the top/bottom margin for the follow page style
     Insert( PROP_TOP_MARGIN, uno::makeAny( std::max<sal_Int32>(nTopMargin, 0) ) );
     Insert( PROP_BOTTOM_MARGIN, uno::makeAny( std::max<sal_Int32>(nBottomMargin, 0) ) );
+
+    if (bCopyFirstToFollow)
+    {
+        if (HasHeader(/*bFirstPage=*/true))
+            m_aFollowPageStyle->setPropertyValue("TopMargin", getProperty(PROP_TOP_MARGIN)->second);
+        if (HasFooter(/*bFirstPage=*/true))
+            m_aFollowPageStyle->setPropertyValue("BottomMargin",
+                                                 getProperty(PROP_BOTTOM_MARGIN)->second);
+    }
 }
 
 uno::Reference< beans::XPropertySet > lcl_GetRangeProperties( bool bIsFirstSection,


More information about the Libreoffice-commits mailing list