fdo#50665 rtftok: don't ignore character properties of text fields
The dmapper part was already fixed in commit
9486851bae
for DOCX, this fixes the RTF
tokenizer.
Change-Id: Iaca706e50367bb744f5a03e15134bda1646df8fc
This commit is contained in:
16
sw/qa/extras/rtftok/data/fdo50665.rtf
Normal file
16
sw/qa/extras/rtftok/data/fdo50665.rtf
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{\rtf1\ansi\deff6
|
||||||
|
{\fonttbl
|
||||||
|
{\f1\fnil\fprq0\fcharset0 Times New Roman;}
|
||||||
|
{\f4\fmodern\fprq1\fcharset0 Cumberland
|
||||||
|
{\*\falt Courier New}
|
||||||
|
;}
|
||||||
|
{\f6\froman\fprq2\fcharset1 Book Antiqua
|
||||||
|
{\*\falt Times New Roman}
|
||||||
|
;}
|
||||||
|
}
|
||||||
|
\sectd\sbknone\pgwsxn11909\pghsxn16834\marglsxn1080\margrsxn1080\margtsxn2437\margbsxn1080\headery1080
|
||||||
|
\pard\plain \s7\cf0\tqr\tx9990\tqr\tx9900
|
||||||
|
{\loch\f6\fs24\lang1033\i0\b
|
||||||
|
Page : \chpgn\par
|
||||||
|
}
|
||||||
|
}
|
@@ -94,6 +94,7 @@ public:
|
|||||||
void testFdo49692();
|
void testFdo49692();
|
||||||
void testFdo45190();
|
void testFdo45190();
|
||||||
void testFdo50539();
|
void testFdo50539();
|
||||||
|
void testFdo50665();
|
||||||
|
|
||||||
CPPUNIT_TEST_SUITE(Test);
|
CPPUNIT_TEST_SUITE(Test);
|
||||||
#if !defined(MACOSX) && !defined(WNT)
|
#if !defined(MACOSX) && !defined(WNT)
|
||||||
@@ -131,6 +132,7 @@ public:
|
|||||||
CPPUNIT_TEST(testFdo49692);
|
CPPUNIT_TEST(testFdo49692);
|
||||||
CPPUNIT_TEST(testFdo45190);
|
CPPUNIT_TEST(testFdo45190);
|
||||||
CPPUNIT_TEST(testFdo50539);
|
CPPUNIT_TEST(testFdo50539);
|
||||||
|
CPPUNIT_TEST(testFdo50665);
|
||||||
#endif
|
#endif
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
@@ -761,6 +763,24 @@ void Test::testFdo50539()
|
|||||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), nValue);
|
CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), nValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Test::testFdo50665()
|
||||||
|
{
|
||||||
|
load("fdo50665.rtf");
|
||||||
|
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
|
||||||
|
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
|
||||||
|
uno::Reference<container::XEnumeration> xParaEnum(xParaEnumAccess->createEnumeration());
|
||||||
|
uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
|
||||||
|
uno::Reference<container::XEnumeration> xRunEnum(xRunEnumAccess->createEnumeration());
|
||||||
|
|
||||||
|
// Access the second run, which is a textfield
|
||||||
|
xRunEnum->nextElement();
|
||||||
|
uno::Reference<beans::XPropertySet> xRun(xRunEnum->nextElement(), uno::UNO_QUERY);
|
||||||
|
OUString aValue;
|
||||||
|
xRun->getPropertyValue("CharFontName") >>= aValue;
|
||||||
|
// This used to be the default, as character properties were ignored.
|
||||||
|
CPPUNIT_ASSERT_EQUAL(OUString("Book Antiqua"), aValue);
|
||||||
|
}
|
||||||
|
|
||||||
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
|
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
|
||||||
|
|
||||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||||
|
@@ -846,12 +846,15 @@ bool RTFFrame::inFrame()
|
|||||||
|| nY > 0;
|
|| nY > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTFDocumentImpl::singleChar(sal_uInt8 nValue)
|
void RTFDocumentImpl::singleChar(sal_uInt8 nValue, bool bRunProps)
|
||||||
{
|
{
|
||||||
sal_uInt8 sValue[] = { nValue };
|
sal_uInt8 sValue[] = { nValue };
|
||||||
if (!m_pCurrentBuffer)
|
if (!m_pCurrentBuffer)
|
||||||
{
|
{
|
||||||
Mapper().startCharacterGroup();
|
Mapper().startCharacterGroup();
|
||||||
|
// Should we send run properties?
|
||||||
|
if (bRunProps)
|
||||||
|
runProps();
|
||||||
Mapper().text(sValue, 1);
|
Mapper().text(sValue, 1);
|
||||||
Mapper().endCharacterGroup();
|
Mapper().endCharacterGroup();
|
||||||
}
|
}
|
||||||
@@ -1561,7 +1564,7 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
|
|||||||
OUString aStr("PAGE");
|
OUString aStr("PAGE");
|
||||||
singleChar(0x13);
|
singleChar(0x13);
|
||||||
text(aStr);
|
text(aStr);
|
||||||
singleChar(0x14);
|
singleChar(0x14, true);
|
||||||
singleChar(0x15);
|
singleChar(0x15);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@@ -404,7 +404,7 @@ namespace writerfilter {
|
|||||||
|
|
||||||
void text(rtl::OUString& rString);
|
void text(rtl::OUString& rString);
|
||||||
// Sends a single character to dmapper, taking care of buffering.
|
// Sends a single character to dmapper, taking care of buffering.
|
||||||
void singleChar(sal_uInt8 nValue);
|
void singleChar(sal_uInt8 nValue, bool bRunProps = false);
|
||||||
// Sends run properties to dmapper, taking care of buffering.
|
// Sends run properties to dmapper, taking care of buffering.
|
||||||
void runProps();
|
void runProps();
|
||||||
void parBreak();
|
void parBreak();
|
||||||
|
Reference in New Issue
Block a user