RTF import: fix import of \line symbol

"Required line break" was eaten by the newly added code in text() to
ignore \'0a.  (regression from f593a2e417)

Change-Id: Id32687c40a17ddb99196635cedfc850182705799
This commit is contained in:
Michael Stahl
2013-02-05 20:46:19 +01:00
parent cf8f6fe1f9
commit c4696e7c04
3 changed files with 15 additions and 2 deletions

View File

@@ -0,0 +1 @@
{\rtf1 foo\line bar}

View File

@@ -138,6 +138,7 @@ public:
void testFdo58933(); void testFdo58933();
void testFdo44053(); void testFdo44053();
void testFdo48440(); void testFdo48440();
void testFdo58646line();
void testFdo58646(); void testFdo58646();
void testFdo59419(); void testFdo59419();
void testFdo58076_2(); void testFdo58076_2();
@@ -250,6 +251,7 @@ void Test::run()
{"fdo58933.rtf", &Test::testFdo58933}, {"fdo58933.rtf", &Test::testFdo58933},
{"fdo44053.rtf", &Test::testFdo44053}, {"fdo44053.rtf", &Test::testFdo44053},
{"fdo48440.rtf", &Test::testFdo48440}, {"fdo48440.rtf", &Test::testFdo48440},
{"fdo58646line.rtf", &Test::testFdo58646line},
{"fdo58646.rtf", &Test::testFdo58646}, {"fdo58646.rtf", &Test::testFdo58646},
{"fdo59419.rtf", &Test::testFdo59419}, {"fdo59419.rtf", &Test::testFdo59419},
{"fdo58076-2.rtf", &Test::testFdo58076_2}, {"fdo58076-2.rtf", &Test::testFdo58076_2},
@@ -1076,6 +1078,12 @@ void Test::testFdo48440()
CPPUNIT_ASSERT_EQUAL(2, getPages()); CPPUNIT_ASSERT_EQUAL(2, getPages());
} }
void Test::testFdo58646line()
{
// \line symbol was ignored
getParagraph(1, "foo\nbar");
}
void Test::testFdo58646() void Test::testFdo58646()
{ {
// Page break was ignored inside a continous section, on title page. // Page break was ignored inside a continous section, on title page.

View File

@@ -1605,12 +1605,16 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
checkUnicode(); checkUnicode();
setNeedSect(); setNeedSect();
RTFSkipDestination aSkip(*this); RTFSkipDestination aSkip(*this);
sal_uInt8 cCh = 0;
if (RTF_LINE == nKeyword)
{ // very special handling since text() will eat lone '\n'
singleChar('\n');
return 0;
}
// Trivial symbols // Trivial symbols
sal_uInt8 cCh = 0;
switch (nKeyword) switch (nKeyword)
{ {
case RTF_LINE: cCh = '\n'; break;
case RTF_TAB: cCh = '\t'; break; case RTF_TAB: cCh = '\t'; break;
case RTF_BACKSLASH: cCh = '\\'; break; case RTF_BACKSLASH: cCh = '\\'; break;
case RTF_LBRACE: cCh = '{'; break; case RTF_LBRACE: cCh = '{'; break;