From a56bfe734a7bed40a175e0eeb7e86e7006a83f83 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 22 Nov 2013 16:34:18 +0100 Subject: cp#1000016 DOCX/RTF import: fix RemoveLastParagraph() on Windows Change-Id: I3f9d69ddbb2144c60a724e4242128b65ae167455 --- sw/qa/extras/rtfimport/rtfimport.cxx | 19 +++++++++++++++++-- writerfilter/source/dmapper/DomainMapper_Impl.cxx | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index f1db5f6e600a..78fafea554d5 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -8,8 +8,6 @@ #include -#if !defined(MACOSX) && !defined(WNT) - #include #include #include @@ -110,6 +108,8 @@ protected: #define DECLARE_RTFIMPORT_TEST(TestName, filename) DECLARE_SW_IMPORT_TEST(TestName, filename, Test) +#if !defined(MACOSX) && !defined(WNT) + DECLARE_RTFIMPORT_TEST(testFdo45553, "fdo45553.rtf") { uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); @@ -1367,6 +1367,21 @@ DECLARE_RTFIMPORT_TEST(testCp1000018, "cp1000018.rtf") #endif +DECLARE_RTFIMPORT_TEST(testCp1000016, "hello.rtf") +{ + // The single-line document had a second fake empty para on Windows. + bool bFound = true; + try + { + getParagraph(2); + } + catch (const container::NoSuchElementException&) + { + bFound = false; + } + CPPUNIT_ASSERT_EQUAL(false, bFound); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index d88ca499d0fc..3181c9f42657 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -299,7 +299,7 @@ void DomainMapper_Impl::RemoveLastParagraph( ) xCursor->goLeft( 1, true ); // If this is a text on a shape, possibly the text has the trailing // newline removed already. - if (xCursor->getString() == "\n") + if (xCursor->getString() == SAL_NEWLINE_STRING) { uno::Reference xDocProps(GetTextDocument(), uno::UNO_QUERY); const OUString aRecordChanges("RecordChanges"); -- cgit