Kaydet (Commit) e1afe431 authored tarafından Miklos Vajna's avatar Miklos Vajna

RTF import: handle RTF_FTNSEP and RTF_CHFTNSEP

Commit 330b8602 (fdo#68787 DOCX import:
handle when w:separator is missing for footnotes, 2013-09-04) disabled
footnote separator by default in dmapper, as the OOXML tokenizer always
provided a uFtnEdnSep in case a separator was wanted.

Let the RTF tokenizer do the same, this way we're in sync with Word
again: if RTF_CHFTNSEP is in RTF_FTNSEP, then we show the separator,
otherwise we don't.

Change-Id: I74b46c5d71227682e093695336dc9eb6fde22121
üst 16adb05e
{\rtf1
\ftnbj
{\*\ftnsep \chftnsep \par}
\pard\plain
This will have a separator
\chftn
{\footnote \chftn Footnote.}
\par
}
......@@ -1405,6 +1405,13 @@ 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: */
......@@ -1739,6 +1739,10 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
m_aStates.top().bInShapeGroup = true;
}
break;
case RTF_FTNSEP:
m_aStates.top().nDestinationState = DESTINATION_FOOTNOTESEPARATOR;
m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_FtnEdn_type, RTFValue::Pointer_t(new RTFValue(NS_ooxml::LN_Value_wordprocessingml_ST_FtnEdn_separator)));
break;
default:
SAL_INFO("writerfilter", "TODO handle destination '" << lcl_RtfToString(nKeyword) << "'");
// Make sure we skip destinations (even without \*) till we don't handle them
......@@ -1806,7 +1810,13 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
runProps();
if (!m_aStates.top().pCurrentBuffer)
{
parBreak();
if (m_aStates.top().nDestinationState == DESTINATION_FOOTNOTESEPARATOR)
{
static const sal_Unicode uCR = 0xd;
Mapper().utext((const sal_uInt8*)&uCR, 1);
}
else
parBreak();
// Not in table? Reset max width.
m_nCellxMax = 0;
}
......@@ -2020,6 +2030,12 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
singleChar(0x15);
}
break;
case RTF_CHFTNSEP:
{
static const sal_Unicode uFtnEdnSep = 0x3;
Mapper().utext((const sal_uInt8*)&uFtnEdnSep, 1);
}
break;
default:
{
SAL_INFO("writerfilter", "TODO handle symbol '" << lcl_RtfToString(nKeyword) << "'");
......
......@@ -150,6 +150,7 @@ namespace writerfilter {
DESTINATION_LFOLEVEL,
DESTINATION_BACKGROUND,
DESTINATION_SHAPEGROUP,
DESTINATION_FOOTNOTESEPARATOR,
};
enum RTFErrors
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment