summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-04-01 09:21:39 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-04-01 10:07:21 +0200
commitf15c6c5d2947a61e6521471b6b7541812953efc3 (patch)
tree14611c291253fbb920b1305d1ffb56866714f6f4
parentUse isEmpty instead of comparing getLength to 0 (ucb) (diff)
downloadcore-f15c6c5d2947a61e6521471b6b7541812953efc3.tar.gz
core-f15c6c5d2947a61e6521471b6b7541812953efc3.zip
tdf#140343 sw page rtl gutter margin: add RTF filter
Map to the \rtlgutter section flag. This means that now rtl gutter is handled for all Word formats. Change-Id: I4c2c12b7df2ce2109d4d638df71e6b7f322afe52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113439 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
-rw-r--r--include/svtools/rtfkeywd.hxx1
-rw-r--r--sw/qa/extras/rtfexport/data/rtl-gutter.rtf4
-rw-r--r--sw/qa/extras/rtfexport/rtfexport3.cxx17
-rw-r--r--sw/source/filter/ww8/attributeoutputbase.hxx2
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx10
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.hxx2
-rw-r--r--writerfilter/source/rtftok/rtfdispatchflag.cxx6
7 files changed, 41 insertions, 1 deletions
diff --git a/include/svtools/rtfkeywd.hxx b/include/svtools/rtfkeywd.hxx
index b02395e45a5d..113faa14389e 100644
--- a/include/svtools/rtfkeywd.hxx
+++ b/include/svtools/rtfkeywd.hxx
@@ -1224,5 +1224,6 @@
#define LO_STRING_SVTOOLS_RTF_SAAUTO "\\saauto"
#define LO_STRING_SVTOOLS_RTF_HTMAUTSP "\\htmautsp"
#define LO_STRING_SVTOOLS_RTF_GUTTERPRL "\\gutterprl"
+#define LO_STRING_SVTOOLS_RTF_RTLGUTTER "\\rtlgutter"
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/rtfexport/data/rtl-gutter.rtf b/sw/qa/extras/rtfexport/data/rtl-gutter.rtf
new file mode 100644
index 000000000000..45c7c86b4500
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/rtl-gutter.rtf
@@ -0,0 +1,4 @@
+{\rtf1
+\paperw8395\paperh5947\margl360\margr360\margt720\margb1440\gutter1080\rtlgutter
+\pard\plain hello\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx
index a3b5f6b2779c..6f801bc3f8cc 100644
--- a/sw/qa/extras/rtfexport/rtfexport3.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport3.cxx
@@ -404,6 +404,23 @@ DECLARE_RTFEXPORT_TEST(testTdf128428_dntblnsbdb, "tdf128428_dntblnsbdb.rtf")
CPPUNIT_ASSERT_EQUAL(1, getPages());
}
+CPPUNIT_TEST_FIXTURE(Test, testRtlGutter)
+{
+ auto verify = [this]() {
+ uno::Reference<beans::XPropertySet> xStandard(
+ getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(getProperty<bool>(xStandard, "RtlGutter"));
+ };
+
+ // Given a document with RTL gutter, when loading it:
+ load(mpTestDocumentPath, "rtl-gutter.rtf");
+ // Then make sure the section's gutter is still RTL:
+ // Without the accompanying fix in place, this test would have failed as \rtlgutter was missing.
+ verify();
+ reload(mpFilter, "rtl-gutter.rtf");
+ verify();
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/attributeoutputbase.hxx b/sw/source/filter/ww8/attributeoutputbase.hxx
index d85d58237d60..eceeb4f51c5f 100644
--- a/sw/source/filter/ww8/attributeoutputbase.hxx
+++ b/sw/source/filter/ww8/attributeoutputbase.hxx
@@ -641,7 +641,7 @@ protected:
ww8::WidthsPtr GetColumnWidths( ww8::WW8TableNodeInfoInner::Pointer_t const & pTableTextNodeInfoInner );
/// RES_RTL_GUTTER
- virtual void SectionRtlGutter(const SfxBoolItem& /*rRtlGutter*/) {}
+ virtual void SectionRtlGutter(const SfxBoolItem& rRtlGutter) = 0;
public:
AttributeOutputBase(const OUString& sBaseURL)
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 91a0362aa686..6c37ce00be0d 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -4368,4 +4368,14 @@ void RtfAttributeOutput::BulletDefinition(int /*nId*/, const Graphic& rGraphic,
m_rExport.Strm().WriteCharPtr("}}"); // pict, shppict
}
+void RtfAttributeOutput::SectionRtlGutter(const SfxBoolItem& rRtlGutter)
+{
+ if (!rRtlGutter.GetValue())
+ {
+ return;
+ }
+
+ m_rExport.Strm().WriteCharPtr(LO_STRING_SVTOOLS_RTF_RTLGUTTER);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/rtfattributeoutput.hxx b/sw/source/filter/ww8/rtfattributeoutput.hxx
index 17cf107d1cf4..94bb37af9686 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.hxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.hxx
@@ -458,6 +458,8 @@ protected:
bool DropdownField(const SwField* pField) override;
bool PlaceholderField(const SwField* pField) override;
+ void SectionRtlGutter(const SfxBoolItem& rRtlGutter) override;
+
private:
/// Reference to the export, where to get the data from
RtfExport& m_rExport;
diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx
index 7b12ec41075c..c56124106eb2 100644
--- a/writerfilter/source/rtftok/rtfdispatchflag.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx
@@ -1228,6 +1228,12 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
case RTFKeyword::GUTTERPRL:
m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_gutterAtTop, new RTFValue(1));
break;
+ case RTFKeyword::RTLGUTTER:
+ {
+ m_aStates.top().getSectionSprms().set(NS_ooxml::LN_EG_SectPrContents_rtlGutter,
+ new RTFValue(1));
+ }
+ break;
default:
{
SAL_INFO("writerfilter", "TODO handle flag '" << keywordToString(nKeyword) << "'");