summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2016-11-02 10:13:49 +0300
committerJustin Luth <justin_luth@sil.org>2016-11-05 04:23:29 +0000
commit67e385ac8dfd804015c8b6199865b71ab6e927b4 (patch)
treef25a7eaa44b96654a7a39ea0e2324dc78896c0c1
parent570e8488b5cee5cc4c931c3468490acd6cab27cf (diff)
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@sil.org> Tested-by: Justin Luth <justin_luth@sil.org>
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf41542_borderlessPadding.odtbin0 -> 15669 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport9.cxx6
-rw-r--r--sw/qa/extras/ww8export/data/tdf41542_borderlessPadding.odtbin0 -> 15669 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export2.cxx6
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx4
-rw-r--r--sw/source/filter/ww8/writerwordglue.cxx4
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx4
7 files changed, 18 insertions, 6 deletions
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 000000000000..9585041de3b2
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf41542_borderlessPadding.odt
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index a580bc99bc49..48bd1186fc8f 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 000000000000..9585041de3b2
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf41542_borderlessPadding.odt
Binary files differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx
index 50aad0f8d5a6..9e12ee9f8bec 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 1d908981dbd8..09e117215169 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 773e167e1a21..7e64c7f3fc64 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 0f6b04db8746..4ff302d54d6d 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;