sw/qa/extras/rtfexport/data/gutter-left.rtf | 4 ++++ sw/qa/extras/rtfexport/rtfexport4.cxx | 15 +++++++++++++++ sw/source/filter/ww8/rtfattributeoutput.cxx | 5 +++++ writerfilter/source/rtftok/rtfdispatchvalue.cxx | 5 +++++ 4 files changed, 29 insertions(+)
New commits: commit 113e7c1be4ca87f936738270cf763800e8ec5832 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Thu Feb 4 09:31:11 2021 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Thu Feb 4 10:35:46 2021 +0100 tdf#91920 sw page gutter margin: add RTF filter Map between \gutter and SvxLRSpaceItem::m_nGutterMargin. Change-Id: I40303f87f59d18e04beb016869dc2a8f3c7da755 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110401 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins 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 cf9a25e40d7c..2bfdf0a13c87 100644 --- a/sw/qa/extras/rtfexport/rtfexport4.cxx +++ b/sw/qa/extras/rtfexport/rtfexport4.cxx @@ -385,6 +385,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 3f39c585a0ab..79f88ab22ba0 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -3163,6 +3163,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 930c613c9750..f9198baafb12 100644 --- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx +++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx @@ -1375,6 +1375,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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits