[Libreoffice-commits] core.git: oox/source sw/qa
Miklos Vajna
vmiklos at collabora.co.uk
Fri Dec 6 06:07:51 PST 2013
oox/source/drawingml/shapegroupcontext.cxx | 8 ++++++++
oox/source/shape/WpgContext.cxx | 6 ++++++
sw/qa/extras/ooxmlimport/data/wpg-nested.docx |binary
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 8 ++++++++
4 files changed, 22 insertions(+)
New commits:
commit c2c7e4d8d99483f74a7aa357de89240eb83c99d3
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Fri Dec 6 11:23:17 2013 +0100
DOCX import: handle groupshapes inside wpg elements (groupshapes)
Change-Id: Icb44f91219f75103f469f38f96d843b8e8251e92
diff --git a/oox/source/drawingml/shapegroupcontext.cxx b/oox/source/drawingml/shapegroupcontext.cxx
index bae6d4c..10e419f 100644
--- a/oox/source/drawingml/shapegroupcontext.cxx
+++ b/oox/source/drawingml/shapegroupcontext.cxx
@@ -88,11 +88,19 @@ ContextHandlerRef ShapeGroupContext::onCreateContext( sal_Int32 aElementToken, c
case XML_grpSp: // group shape
return new ShapeGroupContext( *this, mpGroupShapePtr, ShapePtr( new Shape( "com.sun.star.drawing.GroupShape" ) ) );
case XML_sp: // shape
+ case XML_wsp:
return new ShapeContext( *this, mpGroupShapePtr, ShapePtr( new Shape( "com.sun.star.drawing.CustomShape" ) ) );
case XML_pic: // CT_Picture
return new GraphicShapeContext( *this, mpGroupShapePtr, ShapePtr( new Shape( "com.sun.star.drawing.GraphicObjectShape" ) ) );
case XML_graphicFrame: // CT_GraphicalObjectFrame
return new GraphicalObjectFrameContext( *this, mpGroupShapePtr, ShapePtr( new Shape( "com.sun.star.drawing.GraphicObjectShape" ) ), true );
+ case XML_cNvGrpSpPr:
+ break;
+ case XML_grpSpLocks:
+ break;
+ default:
+ SAL_WARN("oox", "ShapeGroupContext::onCreateContext: unhandled element: " << getBaseToken(aElementToken));
+ break;
}
return this;
diff --git a/oox/source/shape/WpgContext.cxx b/oox/source/shape/WpgContext.cxx
index f83fe75..c8ca505 100644
--- a/oox/source/shape/WpgContext.cxx
+++ b/oox/source/shape/WpgContext.cxx
@@ -47,6 +47,12 @@ oox::core::ContextHandlerRef WpgContext::onCreateContext(sal_Int32 nElementToken
return new oox::drawingml::ShapeContext(*this, mpShape, pShape);
}
break;
+ case XML_grpSp:
+ {
+ oox::drawingml::ShapePtr pShape(new oox::drawingml::Shape("com.sun.star.drawing.GroupShape"));
+ return new oox::drawingml::ShapeGroupContext(*this, mpShape, pShape);
+ }
+ break;
default:
SAL_WARN("oox", "WpgContext::createFastChildContext: unhandled element: " << getBaseToken(nElementToken));
break;
diff --git a/sw/qa/extras/ooxmlimport/data/wpg-nested.docx b/sw/qa/extras/ooxmlimport/data/wpg-nested.docx
new file mode 100755
index 0000000..eba2aad
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/wpg-nested.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 2b271a3..24ffb76 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1555,6 +1555,14 @@ DECLARE_OOXMLIMPORT_TEST(testWpgOnly, "wpg-only.docx")
CPPUNIT_ASSERT_EQUAL(sal_Int32(EMU_TO_MM100(548005)), xShape->getPosition().X);
}
+DECLARE_OOXMLIMPORT_TEST(testWpgNested, "wpg-nested.docx")
+{
+ uno::Reference<drawing::XShapes> xGroup(getShape(1), uno::UNO_QUERY);
+ uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor(xGroup->getByIndex(0), uno::UNO_QUERY);
+ // This was a com.sun.star.drawing.CustomShape, due to lack of handling of groupshapes inside groupshapes.
+ CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.GroupShape"), xShapeDescriptor->getShapeType());
+}
+
DECLARE_OOXMLIMPORT_TEST(textboxWpgOnly, "textbox-wpg-only.docx")
{
uno::Reference<drawing::XShape> xShape = getShape(1);
More information about the Libreoffice-commits
mailing list