summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-05-09 09:10:24 +0200
committerAndras Timar <andras.timar@collabora.com>2017-05-10 21:37:27 +0200
commitc1976f31163e547ea92a10b1695474993c3530c1 (patch)
treec8fdd2d607bb0d1b7d9c7835568187a02a274edd /sw
parentbd221493a98260bcd7d1e49e1748c09eae4ebf54 (diff)
tdf#107620 RTF export: handle DocumentSettingId::PARA_SPACE_MAX compat setting
As it turns out it has a dedicated RTF control word. With this, the bugdoc is again kept as a one-page document during DOCX -> RTF conversion. If we are at it, also write the automatic before/after paragraph spacing markup. (cherry picked from commit 3a9854a92923df8013ca832c48aa9f284bcb1adc, but the nice-to-have automatic spacing markup is not picked) Conflicts: sw/qa/extras/rtfexport/rtfexport.cxx sw/source/filter/ww8/rtfattributeoutput.cxx sw/source/filter/ww8/rtfexport.cxx Change-Id: I78de644f0631e59ef507dfaa07c5a812d4ef10cd Reviewed-on: https://gerrit.libreoffice.org/37428 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit 9f827e21f68adace66caf8b7d8f0bec037e5f9b9)
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/rtfexport/data/tdf107620.docxbin0 -> 12654 bytes
-rw-r--r--sw/qa/extras/rtfexport/rtfexport.cxx11
-rw-r--r--sw/source/filter/ww8/rtfexport.cxx5
3 files changed, 16 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfexport/data/tdf107620.docx b/sw/qa/extras/rtfexport/data/tdf107620.docx
new file mode 100644
index 000000000000..285bd92ae670
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf107620.docx
Binary files differ
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index 19b3235a4cdc..003b5ef03bc5 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -1136,6 +1136,17 @@ DECLARE_RTFEXPORT_TEST(testTdf104228, "tdf104228.rtf")
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(xParagraph, "ParaLeftMargin"));
}
+DECLARE_RTFEXPORT_TEST(testTdf107620, "tdf107620.docx")
+{
+ // This failed, RTF export didn't write the \htmautsp compat flag, the
+ // original bugdoc resulting in 2 pages instead of 1.
+ uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xSettings(xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY);
+ bool bAddParaTableSpacing = true;
+ xSettings->getPropertyValue("AddParaTableSpacing") >>= bAddParaTableSpacing;
+ CPPUNIT_ASSERT(!bAddParaTableSpacing);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx
index edf7281984ef..c1143b3c5b6c 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -47,6 +47,7 @@
#include <svx/xflclit.hxx>
#include <editeng/hyphenzoneitem.hxx>
#include <fmtmeta.hxx>
+#include <IDocumentSettingAccess.hxx>
using namespace ::com::sun::star;
@@ -824,6 +825,10 @@ void RtfExport::ExportDocument_Impl()
Strm().WriteCharPtr(pOut);
}
+ if (!m_pDoc->getIDocumentSettingAccess().get(DocumentSettingId::PARA_SPACE_MAX))
+ // RTF default is true, so write compat flag if this should be false.
+ Strm().WriteCharPtr(LO_STRING_SVTOOLS_RTF_HTMAUTSP);
+
Strm().WriteCharPtr(SAL_NEWLINE_STRING);
WriteFootnoteSettings();