fdo#59419 fix RTF import of hex form of \r and \n
Change-Id: Ic700cdc67f756cafc454c326b73f680a8a47a6e8
This commit is contained in:
5
sw/qa/extras/rtfimport/data/fdo59419.rtf
Normal file
5
sw/qa/extras/rtfimport/data/fdo59419.rtf
Normal file
@@ -0,0 +1,5 @@
|
||||
{\rtf1
|
||||
\trowd\cellx3000\pard\plain\intbl the next cell will be empty\cell\row
|
||||
\pard\trowd\cellx3000\pard\plain\intbl\'0d\cell\row
|
||||
\pard\par
|
||||
}
|
@@ -139,6 +139,7 @@ public:
|
||||
void testFdo44053();
|
||||
void testFdo48440();
|
||||
void testFdo58646();
|
||||
void testFdo59419();
|
||||
|
||||
CPPUNIT_TEST_SUITE(Test);
|
||||
#if !defined(MACOSX) && !defined(WNT)
|
||||
@@ -249,6 +250,7 @@ void Test::run()
|
||||
{"fdo44053.rtf", &Test::testFdo44053},
|
||||
{"fdo48440.rtf", &Test::testFdo48440},
|
||||
{"fdo58646.rtf", &Test::testFdo58646},
|
||||
{"fdo59419.rtf", &Test::testFdo59419},
|
||||
};
|
||||
header();
|
||||
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
|
||||
@@ -1078,6 +1080,14 @@ void Test::testFdo58646()
|
||||
CPPUNIT_ASSERT_EQUAL(2, getPages());
|
||||
}
|
||||
|
||||
void Test::testFdo59419()
|
||||
{
|
||||
// Junk to be ignored broke import of the table.
|
||||
uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
|
||||
uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY);
|
||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
@@ -945,6 +945,14 @@ void RTFDocumentImpl::singleChar(sal_uInt8 nValue, bool bRunProps)
|
||||
|
||||
void RTFDocumentImpl::text(OUString& rString)
|
||||
{
|
||||
if (rString.getLength() == 1)
|
||||
{
|
||||
// No cheating! Tokenizer ignores bare \r and \n, their hex \'0d / \'0a form doesn't count, either.
|
||||
char ch = rString.getStr()[0];
|
||||
if (ch == 0x0d || ch == 0x0a)
|
||||
return;
|
||||
}
|
||||
|
||||
bool bRet = true;
|
||||
switch (m_aStates.top().nDestinationState)
|
||||
{
|
||||
|
Reference in New Issue
Block a user