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

fdo#84645 RTF import: set DontBalanceTextColumns=true for the last section ...

... if it has multiple columns. See commit
d1852047 (DOCX import: set
DontBalanceTextColumns=true for the last section, 2014-07-17) for the
DOCX equivalent of this problem; this just adapts the RTF tokenizer to
dmapper.

Change-Id: Ib30f9b386e204b8b2987832ab17ee0cc53b3f0bc
üst 5fea6b76
{\rtf1
\cols2
\pard\plain First paragraph.\par
Second paragraph.\par
}
......@@ -2068,6 +2068,14 @@ DECLARE_RTFIMPORT_TEST(testFdo82512, "fdo82512.rtf")
CPPUNIT_ASSERT_EQUAL(style::BreakType_COLUMN_BEFORE, getProperty<style::BreakType>(getParagraph(2), "BreakType"));
}
DECLARE_RTFIMPORT_TEST(testUnbalancedColumns, "unbalanced-columns.rtf")
{
uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xTextSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY);
// This was false, last section was balanced, but it's unbalanced in Word.
CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xTextSections->getByIndex(0), "DontBalanceTextColumns"));
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -611,6 +611,12 @@ void RTFDocumentImpl::sectBreak(bool bFinal = false)
writerfilter::Reference<Properties>::Pointer_t const pProperties(
new RTFReferenceProperties(aAttributes, aSprms)
);
if (bFinal && !m_pSuperstream)
// This is the end of the document, not just the end of e.g. a header.
// This makes sure that dmapper can set DontBalanceTextColumns=true for this section if necessary.
Mapper().markLastSectionGroup();
// The trick is that we send properties of the previous section right now, which will be exactly what dmapper expects.
Mapper().props(pProperties);
Mapper().endParagraphGroup();
......
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