diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-02-04 09:31:11 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-02-09 17:08:37 +0100 |
commit | 7a55bce5effb2ca89a0a386182a1dbabfac0c889 (patch) | |
tree | 1d42798062c87b58f4290e00d913d7245f7d3f3b | |
parent | 0a50ed4fb20cc816a8999798339857862ec245b4 (diff) |
tdf#91920 sw page gutter margin: add RTF filter
Map between \gutter and SvxLRSpaceItem::m_nGutterMargin.
(cherry picked from commit 113e7c1be4ca87f936738270cf763800e8ec5832)
Change-Id: I40303f87f59d18e04beb016869dc2a8f3c7da755
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110637
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r-- | sw/qa/extras/rtfexport/data/gutter-left.rtf | 4 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport4.cxx | 15 | ||||
-rw-r--r-- | sw/source/filter/ww8/rtfattributeoutput.cxx | 5 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchvalue.cxx | 5 |
4 files changed, 29 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfexport/data/gutter-left.rtf b/sw/qa/extras/rtfexport/data/gutter-left.rtf new file mode 100644 index 000000000000..66016045c9d1 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/gutter-left.rtf @@ -0,0 +1,4 @@ +{\rtf1 +\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter720 +\pard\plain Half in gutter on the left\par +} diff --git a/sw/qa/extras/rtfexport/rtfexport4.cxx b/sw/qa/extras/rtfexport/rtfexport4.cxx index fdfdc07c8979..a1b5d5e599b8 100644 --- a/sw/qa/extras/rtfexport/rtfexport4.cxx +++ b/sw/qa/extras/rtfexport/rtfexport4.cxx @@ -295,6 +295,21 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf126309) static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(getParagraph(1), "ParaAdjust"))); } +CPPUNIT_TEST_FIXTURE(Test, testGutterLeft) +{ + load(mpTestDocumentPath, "gutter-left.rtf"); + reload(mpFilter, "gutter-left.rtf"); + 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); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 9f174bd6d14d..53fffd032a17 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -3152,6 +3152,11 @@ void RtfAttributeOutput::FormatLRSpace(const SvxLRSpaceItem& rLRSpace) m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_MARGRSXN); m_aSectionBreaks.append(static_cast<sal_Int32>(rLRSpace.GetRight())); } + if (rLRSpace.GetGutterMargin()) + { + m_aSectionBreaks.append(OOO_STRING_SVTOOLS_RTF_GUTTER); + m_aSectionBreaks.append(static_cast<sal_Int32>(rLRSpace.GetGutterMargin())); + } if (!m_bBufferSectionBreaks) m_rExport.Strm().WriteOString(m_aSectionBreaks.makeStringAndClear()); } diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx index 7f458bf5ca94..e769eb9deef8 100644 --- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx +++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx @@ -1070,6 +1070,11 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_footer, pIntValue); break; + case RTF_GUTTER: + putNestedAttribute(m_aStates.top().getSectionSprms(), + NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_gutter, + pIntValue); + break; case RTF_DEFTAB: m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_defaultTabStop, pIntValue); break; |