[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sw/qa writerfilter/source
Mike Kaganski
mike.kaganski at collabora.com
Tue Jun 27 18:11:11 UTC 2017
sw/qa/extras/ooxmlimport/data/tdf108806.docx |binary
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 9 +++++++++
writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 9 +++++++--
3 files changed, 16 insertions(+), 2 deletions(-)
New commits:
commit 1beebea6376d9a6b4c0a854f8403799659b73bae
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date: Tue Jun 27 07:50:12 2017 +0300
tdf#108806: convert CRLF into space in OOXML text
Change-Id: I8e2e108a705ecdb55c096a589d83d51c48b0b83c
Reviewed-on: https://gerrit.libreoffice.org/39286
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/39322
Tested-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/sw/qa/extras/ooxmlimport/data/tdf108806.docx b/sw/qa/extras/ooxmlimport/data/tdf108806.docx
new file mode 100644
index 000000000000..007b10ae6f96
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf108806.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 2a22195fd17b..260fabb4b690 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1397,6 +1397,15 @@ 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(testTdf108714, "tdf108714.docx")
{
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index cd79f2c0454b..042998559336 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -623,9 +623,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)
More information about the Libreoffice-commits
mailing list