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

Miklos Vajna vmiklos at collabora.co.uk
Fri Dec 6 07:03:02 PST 2013


 oox/source/shape/ShapeContextHandler.cxx      |    8 ++++++++
 sw/qa/extras/ooxmlimport/data/mce-nested.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx      |    4 ++++
 3 files changed, 12 insertions(+)

New commits:
commit c8e9a953636524ff3ac79859f3698491f775e10a
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Dec 6 15:54:12 2013 +0100

    DOCX import: fix import of wpg shapes after a wps textframe
    
    Change-Id: I30844062bf4d4f15ca70d9f441f0505fa4f26bb7

diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx
index 5ac772c..6cd8e82 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -322,6 +322,14 @@ void SAL_CALL ShapeContextHandler::endFastElement(::sal_Int32 Element)
 
     if (xContextHandler.is())
         xContextHandler->endFastElement(Element);
+    // In case a textbox is sent, and later we get additional properties for
+    // the textbox, then the wps context is not cleared, so do that here.
+    if (Element == (NMSP_wps | XML_wsp))
+    {
+        uno::Reference<lang::XServiceInfo> xServiceInfo(mxSavedShape, uno::UNO_QUERY);
+        if (xServiceInfo.is() && xServiceInfo->supportsService("com.sun.star.text.TextFrame"))
+            mxWpsContext.clear();
+    }
 }
 
 void SAL_CALL ShapeContextHandler::endUnknownElement
diff --git a/sw/qa/extras/ooxmlimport/data/mce-nested.docx b/sw/qa/extras/ooxmlimport/data/mce-nested.docx
index c110f63..6804fc2 100644
Binary files a/sw/qa/extras/ooxmlimport/data/mce-nested.docx and b/sw/qa/extras/ooxmlimport/data/mce-nested.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index a1a0d43..9c6510d 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1603,6 +1603,10 @@ DECLARE_OOXMLIMPORT_TEST(testMceNested, "mce-nested.docx")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(EMU_TO_MM100(2514600)), getProperty<sal_Int32>(xFrame, "VertOrientPosition"));
     // This was -1 (default), make sure the background color is set.
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x4f81bd), getProperty<sal_Int32>(xFrame, "BackColor"));
+
+    uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor(getShape(2), uno::UNO_QUERY);
+    // This was a com.sun.star.drawing.CustomShape, due to incorrect handling of wpg elements after a wps textbox.
+    CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.GroupShape"), xShapeDescriptor->getShapeType());
 }
 
 DECLARE_OOXMLIMPORT_TEST(testFdo70457, "fdo70457.docx")


More information about the Libreoffice-commits mailing list