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

fdo#49934 fix RTF import of column break in case no columns are defined

It turns out on that case the column break should be parsed as a page
break.

Change-Id: I5dddc8f334fab35bc2ff03fd8127989ab6a601f3
üst 0144c952
{\rtf1\ansi\uc1\deff0\deflang1024
\paperw11960\paperh16900\margl1991\margr1422\margt1422\margb1138\pgnstart0\widowctrl\qj\ftnbj\f0\aftnnar
{\pard\plain\s0\qj\widctlpar\f0\fs24\sl240\slmult1 \sb60 \fi0 Lorem ipsum, lacus.\par
\column
\pard\plain\s0\qj\widctlpar\f0\fs24\sl240\slmult1 \sb60 \fi0 Suspendisse ut massa. Cras nec ante. Pellentesque a nulla. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam tincidunt urna. Nulla ullamcorper vesti- bulum turpis. Pellentesque cursus luctus mauris.\par
}
}
......@@ -128,6 +128,7 @@ public:
void testFdo55525();
void testFdo57708();
void testFdo54473();
void testFdo49934();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
......@@ -206,6 +207,7 @@ void Test::run()
{"fdo55525.rtf", &Test::testFdo55525},
{"fdo57708.rtf", &Test::testFdo57708},
{"fdo54473.rtf", &Test::testFdo54473},
{"fdo49934.rtf", &Test::testFdo49934},
};
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
{
......@@ -950,6 +952,12 @@ void Test::testFdo54473()
CPPUNIT_ASSERT_EQUAL(OUString("ForeignTxt"), getProperty<OUString>(getRun(getParagraph(1), 3, "character "), "CharStyleName"));
}
void Test::testFdo49934()
{
// Column break without columns defined should be a page break, but it was just ignored.
CPPUNIT_ASSERT_EQUAL(2, getPages());
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
......
......@@ -1760,10 +1760,23 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
break;
case RTF_COLUMN:
{
sal_uInt8 sBreak[] = { 0xe };
Mapper().startCharacterGroup();
Mapper().text(sBreak, 1);
Mapper().endCharacterGroup();
bool bColumns = false; // If we have multiple columns
RTFValue::Pointer_t pCols = m_aStates.top().aSectionSprms.find(NS_ooxml::LN_EG_SectPrContents_cols);
if (pCols.get())
{
RTFValue::Pointer_t pNum = pCols->getAttributes().find(NS_ooxml::LN_CT_Columns_num);
if (pNum.get() && pNum->getInt() > 1)
bColumns = true;
}
if (bColumns)
{
sal_uInt8 sBreak[] = { 0xe };
Mapper().startCharacterGroup();
Mapper().text(sBreak, 1);
Mapper().endCharacterGroup();
}
else
dispatchSymbol(RTF_PAGE);
}
break;
case RTF_CHFTN:
......
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