[Libreoffice-commits] core.git: sw/qa sw/source

Justin Luth justin_luth at sil.org
Sat Nov 5 04:23:56 UTC 2016


 sw/qa/extras/ooxmlexport/data/tdf41542_borderlessPadding.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx                    |    6 ++++++
 sw/qa/extras/ww8export/data/tdf41542_borderlessPadding.odt   |binary
 sw/qa/extras/ww8export/ww8export2.cxx                        |    6 ++++++
 sw/source/filter/ww8/docxattributeoutput.cxx                 |    4 ++--
 sw/source/filter/ww8/writerwordglue.cxx                      |    4 ++--
 sw/source/filter/ww8/ww8atr.cxx                              |    4 ++--
 7 files changed, 18 insertions(+), 6 deletions(-)

New commits:
commit 67e385ac8dfd804015c8b6199865b71ab6e927b4
Author: Justin Luth <justin_luth at sil.org>
Date:   Wed Nov 2 10:13:49 2016 +0300

    tdf#41542 MSWordExport: accommodate page's borderless padding
    
    Honor the padding value even if the border is not visible. This is
    needed both for ODT->DOC(X) (starting in LO5.4), authoring documents
    DOC(X) files from within LO (starting in LO5.3), or round-tripping
    current documents created in some other WordProcessor that produces
    valid ODT documents with borderless padding.
    
    Change-Id: I2d653f2c8d3ad22f86384ad17d3a0b8c89738f60
    Reviewed-on: https://gerrit.libreoffice.org/30512
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Tested-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf41542_borderlessPadding.odt b/sw/qa/extras/ooxmlexport/data/tdf41542_borderlessPadding.odt
new file mode 100644
index 0000000..9585041
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf41542_borderlessPadding.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index a580bc9..48bd118 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -55,6 +55,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf89377, "tdf89377_tableWithBreakBeforeParaStyle.d
     CPPUNIT_ASSERT_EQUAL( 3, getPages() );
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf41542_borderlessPadding, "tdf41542_borderlessPadding.odt")
+{
+    // the page style's borderless padding should force this to 3 pages, not 1
+    CPPUNIT_ASSERT_EQUAL( 3, getPages() );
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf103389, "tdf103389.docx")
 {
     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/qa/extras/ww8export/data/tdf41542_borderlessPadding.odt b/sw/qa/extras/ww8export/data/tdf41542_borderlessPadding.odt
new file mode 100644
index 0000000..9585041
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf41542_borderlessPadding.odt differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx
index 50aad0f..9e12ee9 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -27,6 +27,12 @@ public:
     }
 
 };
+DECLARE_WW8EXPORT_TEST(testTdf41542_borderlessPadding, "tdf41542_borderlessPadding.odt")
+{
+    // the page style's borderless padding should force this to 3 pages, not 1
+    CPPUNIT_ASSERT_EQUAL( 3, getPages() );
+}
+
 
 DECLARE_WW8EXPORT_TEST(testTdf89377, "tdf89377_tableWithBreakBeforeParaStyle.doc")
 {
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 1d90898..09e1172 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7307,8 +7307,8 @@ void DocxAttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLRSpace )
         const SfxPoolItem* pItem = m_rExport.HasItem( RES_BOX );
         if ( pItem )
         {
-            m_pageMargins.nPageMarginRight = static_cast<const SvxBoxItem*>(pItem)->CalcLineSpace( SvxBoxItemLine::LEFT );
-            m_pageMargins.nPageMarginLeft = static_cast<const SvxBoxItem*>(pItem)->CalcLineSpace( SvxBoxItemLine::RIGHT );
+            m_pageMargins.nPageMarginRight = static_cast<const SvxBoxItem*>(pItem)->CalcLineSpace( SvxBoxItemLine::LEFT, /*bEvenIfNoLine*/true );
+            m_pageMargins.nPageMarginLeft = static_cast<const SvxBoxItem*>(pItem)->CalcLineSpace( SvxBoxItemLine::RIGHT, /*bEvenIfNoLine*/true );
         }
         else
             m_pageMargins.nPageMarginLeft = m_pageMargins.nPageMarginRight = 0;
diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx
index 773e167..7e64c7f 100644
--- a/sw/source/filter/ww8/writerwordglue.cxx
+++ b/sw/source/filter/ww8/writerwordglue.cxx
@@ -394,8 +394,8 @@ namespace sw
         {
             if (const SvxBoxItem *pBox = rPage.GetItem<SvxBoxItem>(RES_BOX))
             {
-                dyaHdrTop = pBox->CalcLineSpace(SvxBoxItemLine::TOP);
-                dyaHdrBottom = pBox->CalcLineSpace(SvxBoxItemLine::BOTTOM);
+                dyaHdrTop = pBox->CalcLineSpace( SvxBoxItemLine::TOP, /*bEvenIfNoLine*/true );
+                dyaHdrBottom = pBox->CalcLineSpace( SvxBoxItemLine::BOTTOM, /*bEvenIfNoLine*/true );
             }
             else
             {
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 0f6b04d..4ff302d 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -3636,8 +3636,8 @@ void WW8AttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLR )
         const SfxPoolItem* pItem = m_rWW8Export.HasItem( RES_BOX );
         if ( pItem )
         {
-            nRDist = static_cast<const SvxBoxItem*>(pItem)->CalcLineSpace( SvxBoxItemLine::LEFT );
-            nLDist = static_cast<const SvxBoxItem*>(pItem)->CalcLineSpace( SvxBoxItemLine::RIGHT );
+            nRDist = static_cast<const SvxBoxItem*>(pItem)->CalcLineSpace( SvxBoxItemLine::LEFT, /*bEvenIfNoLine*/true );
+            nLDist = static_cast<const SvxBoxItem*>(pItem)->CalcLineSpace( SvxBoxItemLine::RIGHT, /*bEvenIfNoLine*/true );
         }
         else
             nLDist = nRDist = 0;


More information about the Libreoffice-commits mailing list