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

László Németh laszlo.nemeth at collabora.com
Mon May 4 06:03:28 PDT 2015


 sw/qa/extras/ooxmlimport/data/n779627b.docx       |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx          |   16 ++++++++++++++--
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    3 ++-
 3 files changed, 16 insertions(+), 3 deletions(-)

New commits:
commit fccd44a01e2092b587bbab43f5c5f56cd7ece4cd
Author: László Németh <laszlo.nemeth at collabora.com>
Date:   Mon May 4 14:50:49 2015 +0200

    tdf#91077 unit tests for shape import of discarded DOCX header/footer
    
    Change-Id: I3e78e3104af97eed91c102e9ca5546e0785c5f8c

diff --git a/sw/qa/extras/ooxmlimport/data/n779627b.docx b/sw/qa/extras/ooxmlimport/data/n779627b.docx
new file mode 100644
index 0000000..1873715
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/n779627b.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index eebdc08..c9c0368 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -839,8 +839,20 @@ DECLARE_OOXMLIMPORT_TEST(testN779627, "n779627.docx")
             sal_Int32(0), nLeftMargin);
 
     /*
-     * Another problem tested with this document is that the roundrect is
-     * centered vertically and horizontally.
+     * Another problem tested with this document is the unnecessary loading of the shapes
+     * anchored to a discarded header or footer
+     */
+    uno::Reference<text::XTextDocument> textDocument(mxComponent, uno::UNO_QUERY);
+    uno::Reference<drawing::XDrawPageSupplier> drawPageSupplier(textDocument, uno::UNO_QUERY);
+    uno::Reference<drawing::XDrawPage> drawPage = drawPageSupplier->getDrawPage();
+    CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), drawPage->getCount());
+}
+
+DECLARE_OOXMLIMPORT_TEST(testN779627b, "n779627b.docx")
+{
+    /*
+     * Another problem tested with the original n779627.docx document (before removing its unnecessary
+     * shape loading) is that the roundrect is centered vertically and horizontally.
      */
     uno::Reference<beans::XPropertySet> xShapeProperties( getShape(1), uno::UNO_QUERY );
     uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor(xShapeProperties, uno::UNO_QUERY);
commit da0c3b50c79697dd595b00922ede004b9f2960f4
Author: László Németh <laszlo.nemeth at collabora.com>
Date:   Mon May 4 14:48:48 2015 +0200

    tdf#91077 don't import shapes from discarded DOCX header/footer
    
    Change-Id: I674eadb84fc870031244a61f5c07d2cdf18a8dd1

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 5188ca4..337930b 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -2032,7 +2032,8 @@ void DomainMapper_Impl::PopShapeContext()
         }
 
         // Remove the shape if required (most likely replacement shape for OLE object)
-        if ( m_aAnchoredStack.top().bToRemove )
+        // or anchored to a discarded header or footer
+        if ( m_aAnchoredStack.top().bToRemove || m_bDiscardHeaderFooter )
         {
             try
             {


More information about the Libreoffice-commits mailing list