Kaydet (Commit) 6124490c authored tarafından Mike Kaganski's avatar Mike Kaganski

tdf#108806: convert CRLF into space in OOXML text

Change-Id: I8e2e108a705ecdb55c096a589d83d51c48b0b83c
Reviewed-on: https://gerrit.libreoffice.org/39286Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst 3e874650
......@@ -1291,6 +1291,16 @@ DECLARE_OOXMLIMPORT_TEST(testTdf108408, "tdf108408.docx")
CPPUNIT_ASSERT_EQUAL(double(20), getProperty<double>(xRun, "CharHeight"));
}
DECLARE_OOXMLIMPORT_TEST(testTdf108806, "tdf108806.docx")
{
// tdf#108806:The CRLF in the text contents of XML must be converted to single spaces.
CPPUNIT_ASSERT_EQUAL(1, getParagraphs());
uno::Reference< text::XTextRange > paragraph = getParagraph(1);
CPPUNIT_ASSERT_EQUAL(
OUString("First part of a line (before CRLF). Second part of the same line (after CRLF)."),
paragraph->getString());
}
DECLARE_OOXMLIMPORT_TEST(testVmlAdjustments, "vml-adjustments.docx")
{
uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY);
......
......@@ -608,9 +608,14 @@ void OOXMLFastContextHandler::endTxbxContent()
void OOXMLFastContextHandler::text(const OUString & sText)
{
if (isForwardEvents())
{
// tdf#108806: CRLFs in XML were converted to \n before this point.
// These must be converted to spaces before further processing.
OUString sNormalizedText = sText.replaceAll("\n", " ");
mpStream->utext(reinterpret_cast < const sal_uInt8 * >
(sText.getStr()),
sText.getLength());
(sNormalizedText.getStr()),
sNormalizedText.getLength());
}
}
void OOXMLFastContextHandler::positionOffset(const OUString& rText)
......
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