summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2017-07-25 12:29:07 -0400
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-07-28 10:40:13 +0200
commit756b2431f0006a01affa7c92c2dede2b11166001 (patch)
treea81e7cec6deb205ef6dcf37b769bd8c12c465872
parentea3ca5e10aa3190e28fe37801727f8b5f8543e13 (diff)
tdf#108949 rtf writerfilter: apply char properties to footnote
commit fdfdea4d5af51a68f2d497cc5c3359d74c385fd5 for tdf#82173 added that functionality for .docx, but since .rtf didn't support character props for footnotes, it messed up other formatting. start/EndCharacterGroup() fixes the reported bug. runProps() adds the functionality for .rtf that was requested for .docx in bug 82173. Change-Id: Ia9a2332659247a0fe2c2a506f1967c148362928f Reviewed-on: https://gerrit.libreoffice.org/40430 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--sw/qa/extras/rtfexport/data/tdf108949_footnote.rtf15
-rw-r--r--sw/qa/extras/rtfexport/rtfexport3.cxx16
-rw-r--r--writerfilter/source/rtftok/rtfdispatchdestination.cxx6
3 files changed, 33 insertions, 4 deletions
diff --git a/sw/qa/extras/rtfexport/data/tdf108949_footnote.rtf b/sw/qa/extras/rtfexport/data/tdf108949_footnote.rtf
new file mode 100644
index 000000000000..648229078c71
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf108949_footnote.rtf
@@ -0,0 +1,15 @@
+{\rtf1\ansi
+
+{\*\listtable{\list\listtemplateid-1{\listlevel{\leveltext\'02\'00.;}{\levelnumbers\'01;}}}}{\listname ;}\listid740254765
+{\*\listoverridetable{\listoverride\listid726493088\ls1}}
+
+{\colortbl;\red255\green0\blue0;\red0\green255\blue255;}
+
+\landscape\paperh5953\paperw8391
+
+\fet0
+{\listtext\pard\plain 1.\tab}\ilvl0\ls1 Footnote
+{\cf1 \chftn{\footnote{\chftn \tab This text should be normal, the in-text footnote character should be red.}}}
+ test\par
+\pard\plain List paragraphs are not properly managed in LO - at least not around footnotes.
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx
index afba7d9fec87..35d7fc9861ec 100644
--- a/sw/qa/extras/rtfexport/rtfexport3.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport3.cxx
@@ -11,6 +11,7 @@
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
#include <com/sun/star/style/PageStyleLayout.hpp>
+#include <com/sun/star/text/XFootnote.hpp>
#include <com/sun/star/text/XFootnotesSupplier.hpp>
#include <com/sun/star/text/XPageCursor.hpp>
#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
@@ -24,7 +25,7 @@ public:
DECLARE_RTFEXPORT_TEST(testTdf108949, "tdf108949_footnoteCharFormat.odt")
{
- //CPPUNIT_ASSERT_EQUAL_MESSAGE("Paragraph Numbering style", OUString(), getProperty<OUString>(getParagraph(2), "NumberingStyleName"));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Paragraph Numbering style", OUString(), getProperty<OUString>(getParagraph(2), "NumberingStyleName"));
uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY);
@@ -35,6 +36,19 @@ DECLARE_RTFEXPORT_TEST(testTdf108949, "tdf108949_footnoteCharFormat.odt")
//CPPUNIT_ASSERT_EQUAL(sal_Int32(0x000000), getProperty<sal_Int32>(getRun(getParagraphOfText(1, xFootnoteText),1), "CharColor"));
}
+DECLARE_RTFIMPORT_TEST(testTdf108949_footnote, "tdf108949_footnote.rtf")
+{
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Paragraph Numbering style", OUString(), getProperty<OUString>(getParagraph(2), "NumberingStyleName"));
+
+ uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY);
+
+ uno::Reference<text::XFootnote> xFootnote;
+ xFootnotes->getByIndex(0) >>= xFootnote;
+ // The color of the footnote anchor was black (0x000000)
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Footnote Character color", sal_Int32(0xFF0000), getProperty< sal_Int32 >(xFootnote->getAnchor(), "CharColor") );
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfdispatchdestination.cxx b/writerfilter/source/rtftok/rtfdispatchdestination.cxx
index 4d1960df367e..4799a3be8978 100644
--- a/writerfilter/source/rtftok/rtfdispatchdestination.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchdestination.cxx
@@ -303,8 +303,8 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
}
}
m_aStates.top().eDestination = Destination::FOOTNOTE;
- if (bCustomMark)
- Mapper().startCharacterGroup();
+ Mapper().startCharacterGroup();
+ runProps();
if (!m_aStates.top().pCurrentBuffer)
resolveSubstream(m_nGroupStartPos - 1, nId, aCustomMark);
else
@@ -322,8 +322,8 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
auto pValue = std::make_shared<RTFValue>(1);
m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_FtnEdnRef_customMarkFollows, pValue);
text(aCustomMark);
- Mapper().endCharacterGroup();
}
+ Mapper().endCharacterGroup();
m_aStates.top().eDestination = Destination::SKIP;
}
break;