[Libreoffice-commits] core.git: sw/qa sw/source

Miklos Vajna vmiklos at collabora.co.uk
Sun Jan 5 05:27:11 PST 2014


 sw/qa/extras/rtfexport/data/fdo68787.rtf |    9 +++++++++
 sw/qa/extras/rtfexport/rtfexport.cxx     |    7 +++++++
 sw/qa/extras/rtfimport/data/fdo68787.rtf |    9 ---------
 sw/qa/extras/rtfimport/rtfimport.cxx     |    7 -------
 sw/source/filter/ww8/rtfexport.cxx       |   14 ++++++++++++++
 sw/source/filter/ww8/rtfexport.hxx       |    1 +
 6 files changed, 31 insertions(+), 16 deletions(-)

New commits:
commit f4db3ac593c7c49dc584399a40fa8275025adb3c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sun Jan 5 14:10:22 2014 +0100

    RTF export: write RTF_FTNSEP and RTF_CHFTNSEP if necessary
    
    Change-Id: Ie680436df68ea6287437f792d97259ee0a840ee1

diff --git a/sw/qa/extras/rtfimport/data/fdo68787.rtf b/sw/qa/extras/rtfexport/data/fdo68787.rtf
similarity index 100%
rename from sw/qa/extras/rtfimport/data/fdo68787.rtf
rename to sw/qa/extras/rtfexport/data/fdo68787.rtf
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index b6084cb..40cc51f 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -579,6 +579,13 @@ DECLARE_RTFEXPORT_TEST(testFdo66743, "fdo66743.rtf")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0xd8d8d8), getProperty<sal_Int32>(xCell, "BackColor"));
 }
 
+DECLARE_RTFEXPORT_TEST(testFdo68787, "fdo68787.rtf")
+{
+    uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
+    // This was 0, the 'lack of \chftnsep' <-> '0 line width' mapping was missing in the RTF tokenizer / exporter.
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(25), getProperty<sal_Int32>(xPageStyle, "FootnoteLineRelativeWidth"));
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 0ad5177..a5ab93d 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1405,13 +1405,6 @@ DECLARE_RTFIMPORT_TEST(testBackground, "background.rtf")
     CPPUNIT_ASSERT_EQUAL(false, bool(getProperty<sal_Bool>(getShape(2), "Opaque")));
 }
 
-DECLARE_RTFIMPORT_TEST(testFdo68787, "fdo68787.rtf")
-{
-    uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
-    // This was 0, the 'lack of \chftnsep' <-> '0 line width' mapping was missing in the RTF tokenizer.
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(25), getProperty<sal_Int32>(xPageStyle, "FootnoteLineRelativeWidth"));
-}
-
 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 5113f93..59f55d9 100644
--- a/sw/source/filter/ww8/rtfexport.cxx
+++ b/sw/source/filter/ww8/rtfexport.cxx
@@ -382,6 +382,18 @@ void RtfExport::WriteStyles()
     SAL_INFO("sw.rtf", OSL_THIS_FUNC << " end");
 }
 
+void RtfExport::WriteFootnoteSettings()
+{
+    const SwPageFtnInfo& rFtnInfo = pDoc->GetPageDesc(0).GetFtnInfo();
+    // Request a separator only in case the width is larger than zero.
+    bool bSeparator = double(rFtnInfo.GetWidth()) > 0;
+
+    Strm() << '{' << OOO_STRING_SVTOOLS_RTF_IGNORE << OOO_STRING_SVTOOLS_RTF_FTNSEP;
+    if (bSeparator)
+        Strm() << OOO_STRING_SVTOOLS_RTF_CHFTNSEP;
+    Strm() << '}';
+}
+
 void RtfExport::WriteMainText()
 {
     SAL_INFO("sw.rtf", OSL_THIS_FUNC << " start");
@@ -696,6 +708,8 @@ void RtfExport::ExportDocument_Impl()
 
     Strm() << SAL_NEWLINE_STRING;
 
+    WriteFootnoteSettings();
+
     WriteMainText();
 
     Strm() << '}';
diff --git a/sw/source/filter/ww8/rtfexport.hxx b/sw/source/filter/ww8/rtfexport.hxx
index 9e30cf3..7e429af 100644
--- a/sw/source/filter/ww8/rtfexport.hxx
+++ b/sw/source/filter/ww8/rtfexport.hxx
@@ -173,6 +173,7 @@ private:
 
     void WriteFonts();
     void WriteStyles();
+    void WriteFootnoteSettings();
     void WriteMainText();
     void WriteInfo();
     /// Writes the writer-specific \pgdsctbl group.


More information about the Libreoffice-commits mailing list