summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-12-08 13:04:16 (GMT)
committerMiklos Vajna <vmiklos@suse.cz>2012-12-08 13:25:15 (GMT)
commit257a4090af068085143d71d60e6032ba0b998804 (patch)
tree5680a0495fd4ab3e3fa626af9c8a6dc1a51e2833
parent0144c952282a4555b7ab0cfcf9d35bf753e5d8cb (diff)
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
-rw-r--r--sw/qa/extras/rtfimport/data/fdo49934.rtf7
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx8
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx21
3 files changed, 32 insertions, 4 deletions
diff --git a/sw/qa/extras/rtfimport/data/fdo49934.rtf b/sw/qa/extras/rtfimport/data/fdo49934.rtf
new file mode 100644
index 0000000..19ba5cd
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo49934.rtf
@@ -0,0 +1,7 @@
+{\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
+}
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 826ca96..2df2e05 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -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();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index ef3be2b..da26efd 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -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: