DOCX import: handle groupshapes inside wpg elements (groupshapes)
Change-Id: Icb44f91219f75103f469f38f96d843b8e8251e92
This commit is contained in:
parent
131f3230d9
commit
c2c7e4d8d9
@ -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;
|
||||
|
@ -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;
|
||||
|
BIN
sw/qa/extras/ooxmlimport/data/wpg-nested.docx
Executable file
BIN
sw/qa/extras/ooxmlimport/data/wpg-nested.docx
Executable file
Binary file not shown.
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user