summaryrefslogtreecommitdiff
path: root/oox/source/shape
diff options
context:
space:
mode:
Diffstat (limited to 'oox/source/shape')
-rw-r--r--oox/source/shape/ShapeContextHandler.cxx38
-rw-r--r--oox/source/shape/ShapeContextHandler.hxx2
-rw-r--r--oox/source/shape/WpgContext.cxx59
-rw-r--r--oox/source/shape/WpgContext.hxx38
4 files changed, 136 insertions, 1 deletions
diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx
index bcf43c85542d..c12518d56fd6 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -23,6 +23,7 @@
#include "ShapeDrawingFragmentHandler.hxx"
#include "LockedCanvasContext.hxx"
#include "WpsContext.hxx"
+#include "WpgContext.hxx"
#include "oox/vml/vmldrawingfragment.hxx"
#include "oox/vml/vmlshape.hxx"
#include "oox/drawingml/themefragmenthandler.hxx"
@@ -136,6 +137,26 @@ uno::Reference<xml::sax::XFastContextHandler> ShapeContextHandler::getWpsContext
return mxWpsContext;
}
+uno::Reference<xml::sax::XFastContextHandler> ShapeContextHandler::getWpgContext(sal_Int32 nElement)
+{
+ if (!mxWpgContext.is())
+ {
+ FragmentHandler2Ref rFragmentHandler(new ShapeFragmentHandler(*mxFilterBase, msRelationFragmentPath));
+ ShapePtr pMasterShape;
+
+ switch (getBaseToken(nElement))
+ {
+ case XML_wgp:
+ mxWpgContext.set(new WpgContext(*rFragmentHandler));
+ break;
+ default:
+ break;
+ }
+ }
+
+ return mxWpgContext;
+}
+
uno::Reference<xml::sax::XFastContextHandler>
ShapeContextHandler::getGraphicShapeContext(::sal_Int32 Element )
{
@@ -216,6 +237,9 @@ ShapeContextHandler::getContextHandler()
case NMSP_wps:
xResult.set(getWpsContext(mnStartToken));
break;
+ case NMSP_wpg:
+ xResult.set(getWpgContext(mnStartToken));
+ break;
default:
xResult.set(getGraphicShapeContext(mnStartToken));
break;
@@ -240,7 +264,7 @@ void SAL_CALL ShapeContextHandler::startFastElement
mpThemePtr.reset(new Theme());
- if (Element == DGM_TOKEN(relIds) || Element == LC_TOKEN(lockedCanvas) || Element == C_TOKEN(chart) || Element == WPS_TOKEN(wsp))
+ if (Element == DGM_TOKEN(relIds) || Element == LC_TOKEN(lockedCanvas) || Element == C_TOKEN(chart) || Element == WPS_TOKEN(wsp) || Element == WPG_TOKEN(wgp))
{
// Parse the theme relation, if available; the diagram won't have colors without it.
if (!msRelationFragmentPath.isEmpty())
@@ -432,6 +456,18 @@ ShapeContextHandler::getShape() throw (uno::RuntimeException)
mxWpsContext.clear();
}
}
+ else if (mxWpgContext.is())
+ {
+ ShapePtr pShape = dynamic_cast<WpgContext*>(mxWpgContext.get())->getShape();
+ if (pShape)
+ {
+ basegfx::B2DHomMatrix aMatrix;
+ pShape->setPosition(maPosition);
+ pShape->addShape(*mxFilterBase, mpThemePtr.get(), xShapes, aMatrix, pShape->getFillProperties());
+ xResult = pShape->getXShape();
+ mxWpgContext.clear();
+ }
+ }
else if (mpShape.get() != NULL)
{
basegfx::B2DHomMatrix aTransformation;
diff --git a/oox/source/shape/ShapeContextHandler.hxx b/oox/source/shape/ShapeContextHandler.hxx
index 0c213131fee4..7a9b93c0f679 100644
--- a/oox/source/shape/ShapeContextHandler.hxx
+++ b/oox/source/shape/ShapeContextHandler.hxx
@@ -155,6 +155,7 @@ private:
css::uno::Reference<XFastContextHandler> mxDiagramShapeContext;
css::uno::Reference<XFastContextHandler> mxLockedCanvasContext;
css::uno::Reference<XFastContextHandler> mxWpsContext;
+ css::uno::Reference<XFastContextHandler> mxWpgContext;
css::uno::Reference<XFastContextHandler> mxChartShapeContext;
core::XmlFilterRef mxFilterBase;
@@ -169,6 +170,7 @@ private:
css::uno::Reference<XFastContextHandler> getDiagramShapeContext();
css::uno::Reference<XFastContextHandler> getLockedCanvasContext(sal_Int32 nElement);
css::uno::Reference<XFastContextHandler> getWpsContext(sal_Int32 nElement);
+ css::uno::Reference<XFastContextHandler> getWpgContext(sal_Int32 nElement);
css::uno::Reference<XFastContextHandler> getContextHandler();
};
diff --git a/oox/source/shape/WpgContext.cxx b/oox/source/shape/WpgContext.cxx
new file mode 100644
index 000000000000..f83fe75ced27
--- /dev/null
+++ b/oox/source/shape/WpgContext.cxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "WpgContext.hxx"
+#include <oox/drawingml/shapepropertiescontext.hxx>
+#include <oox/drawingml/shapegroupcontext.hxx>
+
+using namespace com::sun::star;
+
+namespace oox { namespace shape {
+
+WpgContext::WpgContext(ContextHandler2Helper& rParent)
+: ContextHandler2(rParent)
+{
+ mpShape.reset(new oox::drawingml::Shape("com.sun.star.drawing.GroupShape"));
+}
+
+WpgContext::~WpgContext()
+{
+}
+
+oox::drawingml::ShapePtr WpgContext::getShape()
+{
+ return mpShape;
+}
+
+oox::core::ContextHandlerRef WpgContext::onCreateContext(sal_Int32 nElementToken, const oox::AttributeList& /*rAttribs*/)
+{
+ switch (getBaseToken(nElementToken))
+ {
+ case XML_wgp:
+ break;
+ case XML_cNvGrpSpPr:
+ break;
+ case XML_grpSpPr:
+ return new oox::drawingml::ShapePropertiesContext(*this, *mpShape);
+ break;
+ case XML_wsp:
+ {
+ oox::drawingml::ShapePtr pShape(new oox::drawingml::Shape("com.sun.star.drawing.CustomShape"));
+ return new oox::drawingml::ShapeContext(*this, mpShape, pShape);
+ }
+ break;
+ default:
+ SAL_WARN("oox", "WpgContext::createFastChildContext: unhandled element: " << getBaseToken(nElementToken));
+ break;
+ }
+ return 0;
+}
+
+} }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/shape/WpgContext.hxx b/oox/source/shape/WpgContext.hxx
new file mode 100644
index 000000000000..3a609860012e
--- /dev/null
+++ b/oox/source/shape/WpgContext.hxx
@@ -0,0 +1,38 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_OOX_SOURCE_SHAPE_WPGCONTEXT_HXX
+#define INCLUDED_OOX_SOURCE_SHAPE_WPGCONTEXT_HXX
+
+#include "oox/core/contexthandler2.hxx"
+#include "oox/drawingml/shape.hxx"
+
+namespace oox { namespace shape {
+
+/// Wpg is the drawingML equivalent of v:group.
+class WpgContext : public oox::core::ContextHandler2
+{
+public:
+ WpgContext(oox::core::ContextHandler2Helper& rParent);
+ virtual ~WpgContext();
+
+ virtual oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElementToken, const oox::AttributeList& rAttribs) SAL_OVERRIDE;
+
+ oox::drawingml::ShapePtr getShape();
+
+protected:
+ oox::drawingml::ShapePtr mpShape;
+};
+
+
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */