summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-02-03 11:58:10 +0100
committerMiklos Vajna <vmiklos@collabora.com>2021-02-03 14:38:55 +0100
commitb07f6c14a49aea23457b41b0d75390e68fe550b3 (patch)
treea3913e2c0420acbdacfa2a51ad55a88211a6fa96 /sw
parent57f5f399c6047fa6c484a3b969c84aca3a723fab (diff)
tdf#91920 sw page gutter margin: add DOCX filter
- import: convert the gutter twips value to mm100, then map it to the GutterMargin property of the page style - export: map SvxLRSpaceItem::m_nGutterMargin to <w:pgMar ... w:gutter="..."/> Change-Id: I971d32ffe4e67c2c5a5518b5aa63cb8514e04e2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110345 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/gutter-left.docxbin0 -> 11860 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport16.cxx13
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx12
3 files changed, 19 insertions, 6 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/gutter-left.docx b/sw/qa/extras/ooxmlexport/data/gutter-left.docx
new file mode 100644
index 000000000000..4dc1cbf615f7
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/gutter-left.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
index 3d89e01501c7..c35db2c88cd1 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -38,6 +38,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf138892_noNumbering, "tdf138892_noNumbering.docx"
CPPUNIT_ASSERT_MESSAGE("Para3: <blank line>", getProperty<OUString>(getParagraph(3), "NumberingStyleName").isEmpty());
}
+DECLARE_OOXMLEXPORT_TEST(testGutterLeft, "gutter-left.docx")
+{
+ uno::Reference<beans::XPropertySet> xPageStyle;
+ getStyles("PageStyles")->getByName("Standard") >>= xPageStyle;
+ sal_Int32 nGutterMargin{};
+ xPageStyle->getPropertyValue("GutterMargin") >>= nGutterMargin;
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 1270
+ // - Actual : 0
+ // i.e. gutter margin was lost.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270), nGutterMargin);
+}
+
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf134619_numberingProps, "tdf134619_numberingProps.doc")
{
// Get the third paragraph's numbering style's 1st level's bullet size
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 04bf7b36c068..653e72b64b69 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -8765,10 +8765,12 @@ void DocxAttributeOutput::FormatLRSpace( const SvxLRSpaceItem& rLRSpace )
m_pageMargins.nLeft += sal::static_int_cast<sal_uInt16>(rLRSpace.GetLeft());
m_pageMargins.nRight += sal::static_int_cast<sal_uInt16>(rLRSpace.GetRight());
+ sal_uInt16 nGutter = rLRSpace.GetGutterMargin();
- AddToAttrList( m_pSectionSpacingAttrList, 2,
+ AddToAttrList( m_pSectionSpacingAttrList, 3,
FSNS( XML_w, XML_left ), OString::number( m_pageMargins.nLeft ).getStr(),
- FSNS( XML_w, XML_right ), OString::number( m_pageMargins.nRight ).getStr() );
+ FSNS( XML_w, XML_right ), OString::number( m_pageMargins.nRight ).getStr(),
+ FSNS( XML_w, XML_gutter ), OString::number( nGutter ).getStr() );
}
else
{
@@ -8851,13 +8853,11 @@ void DocxAttributeOutput::FormatULSpace( const SvxULSpaceItem& rULSpace )
// Page Bottom
m_pageMargins.nBottom = aDistances.dyaBottom;
- AddToAttrList( m_pSectionSpacingAttrList, 5,
+ AddToAttrList( m_pSectionSpacingAttrList, 4,
FSNS( XML_w, XML_header ), OString::number( nHeader ).getStr(),
FSNS( XML_w, XML_top ), OString::number( m_pageMargins.nTop ).getStr(),
FSNS( XML_w, XML_footer ), OString::number( nFooter ).getStr(),
- FSNS( XML_w, XML_bottom ), OString::number( m_pageMargins.nBottom ).getStr(),
- // FIXME Page Gutter is not handled ATM, setting to 0 as it's mandatory for OOXML
- FSNS( XML_w, XML_gutter ), "0" );
+ FSNS( XML_w, XML_bottom ), OString::number( m_pageMargins.nBottom ).getStr() );
}
else
{