[Libreoffice-commits] core.git: sw/qa writerfilter/source

Oliver Specht oliver.specht at cib.de
Wed Oct 7 08:24:56 PDT 2015


 sw/qa/extras/ooxmlimport/data/tdf90810short.docx      |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx              |   12 ++++++++++++
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |    7 +++++--
 3 files changed, 17 insertions(+), 2 deletions(-)

New commits:
commit 7e50b8073ef40d1bbe79c1c4d6c967d760283b5a
Author: Oliver Specht <oliver.specht at cib.de>
Date:   Wed Oct 7 14:34:02 2015 +0200

    tdf#90810: skip breaks outside of the requested footnote
    
    the footnote stream is parsed completely at each footnote insertion
    (line) breaks outside of the requested footnote need to be skipped
    test include
    
    Change-Id: I78de7774b7daf44c2b8980115870082fc56924bd
    Reviewed-on: https://gerrit.libreoffice.org/19228
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/ooxmlimport/data/tdf90810short.docx b/sw/qa/extras/ooxmlimport/data/tdf90810short.docx
new file mode 100755
index 0000000..85b6369
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf90810short.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 3b1024e..21f3034 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -40,6 +40,7 @@
 #include <com/sun/star/text/WritingMode2.hpp>
 #include <com/sun/star/text/XBookmarksSupplier.hpp>
 #include <com/sun/star/text/XDependentTextField.hpp>
+#include <com/sun/star/text/XFootnote.hpp>
 #include <com/sun/star/text/XFormField.hpp>
 #include <com/sun/star/text/XPageCursor.hpp>
 #include <com/sun/star/text/XTextColumns.hpp>
@@ -2862,6 +2863,17 @@ DECLARE_OOXMLIMPORT_TEST(testTdf91417, "tdf91417.docx")
     CPPUNIT_ASSERT_EQUAL(OUString("http://www.google.com/"), aValue);
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf90810, "tdf90810short.docx")
+{
+    uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
+    uno::Reference<text::XFootnotesSupplier> xFtnSupp(xTextDocument, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xFtnIdxAcc(xFtnSupp->getFootnotes(), uno::UNO_QUERY);
+    uno::Reference<text::XFootnote> xFtn(xFtnIdxAcc->getByIndex(0), uno::UNO_QUERY);
+    uno::Reference<text::XText> xFtnText(xFtn, uno::UNO_QUERY);
+    rtl::OUString sFtnText = xFtnText->getString();
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(90), static_cast<sal_Int32>(sFtnText.getLength()));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 898dacd..d43c88d 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -1031,8 +1031,11 @@ void OOXMLFastContextHandlerProperties::handlePicture()
 
 void OOXMLFastContextHandlerProperties::handleBreak()
 {
-    OOXMLBreakHandler aBreakHandler(*mpStream);
-    getPropertySet()->resolve(aBreakHandler);
+    if(isForwardEvents())
+    {
+        OOXMLBreakHandler aBreakHandler(*mpStream);
+        getPropertySet()->resolve(aBreakHandler);
+    }
 }
 
 void OOXMLFastContextHandlerProperties::handleOLE()


More information about the Libreoffice-commits mailing list