[Libreoffice-commits] core.git: Branch 'libreoffice-5-3' - include/svtools sw/qa sw/source

Miklos Vajna vmiklos at collabora.co.uk
Tue May 9 13:49:27 UTC 2017


 include/svtools/rtfkeywd.hxx               |    1 +
 sw/qa/extras/rtfexport/data/tdf107620.docx |binary
 sw/qa/extras/rtfexport/rtfexport.cxx       |   11 +++++++++++
 sw/source/filter/ww8/rtfexport.cxx         |    5 +++++
 4 files changed, 17 insertions(+)

New commits:
commit 9f827e21f68adace66caf8b7d8f0bec037e5f9b9
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue May 9 09:10:24 2017 +0200

    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 at redhat.com>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/include/svtools/rtfkeywd.hxx b/include/svtools/rtfkeywd.hxx
index 55d97f51bd16..65ae39ac305d 100644
--- a/include/svtools/rtfkeywd.hxx
+++ b/include/svtools/rtfkeywd.hxx
@@ -1208,6 +1208,7 @@
 #define LO_STRING_SVTOOLS_RTF_BRDRSH "\\brdrsh"
 #define LO_STRING_SVTOOLS_RTF_GENERATOR "\\generator"
 #define LO_STRING_SVTOOLS_RTF_VIEWBKSP "\\viewbksp"
+#define LO_STRING_SVTOOLS_RTF_HTMAUTSP "\\htmautsp"
 
 #endif // INCLUDED_SVTOOLS_RTFKEYWD_HXX
 
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
Binary files /dev/null and b/sw/qa/extras/rtfexport/data/tdf107620.docx 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();


More information about the Libreoffice-commits mailing list