RTF export: write RTF_FTNSEP and RTF_CHFTNSEP if necessary

Change-Id: Ie680436df68ea6287437f792d97259ee0a840ee1
This commit is contained in:
Miklos Vajna 2014-01-05 14:10:22 +01:00
parent 0282ab3c3a
commit f4db3ac593
5 changed files with 22 additions and 7 deletions

View File

@ -579,6 +579,13 @@ DECLARE_RTFEXPORT_TEST(testFdo66743, "fdo66743.rtf")
CPPUNIT_ASSERT_EQUAL(sal_Int32(0xd8d8d8), getProperty<sal_Int32>(xCell, "BackColor")); 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 #endif
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();

View File

@ -1405,13 +1405,6 @@ DECLARE_RTFIMPORT_TEST(testBackground, "background.rtf")
CPPUNIT_ASSERT_EQUAL(false, bool(getProperty<sal_Bool>(getShape(2), "Opaque"))); 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(); CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -382,6 +382,18 @@ void RtfExport::WriteStyles()
SAL_INFO("sw.rtf", OSL_THIS_FUNC << " end"); 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() void RtfExport::WriteMainText()
{ {
SAL_INFO("sw.rtf", OSL_THIS_FUNC << " start"); SAL_INFO("sw.rtf", OSL_THIS_FUNC << " start");
@ -696,6 +708,8 @@ void RtfExport::ExportDocument_Impl()
Strm() << SAL_NEWLINE_STRING; Strm() << SAL_NEWLINE_STRING;
WriteFootnoteSettings();
WriteMainText(); WriteMainText();
Strm() << '}'; Strm() << '}';

View File

@ -173,6 +173,7 @@ private:
void WriteFonts(); void WriteFonts();
void WriteStyles(); void WriteStyles();
void WriteFootnoteSettings();
void WriteMainText(); void WriteMainText();
void WriteInfo(); void WriteInfo();
/// Writes the writer-specific \pgdsctbl group. /// Writes the writer-specific \pgdsctbl group.