summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--oox/Library_oox.mk1
-rw-r--r--oox/source/shape/LockedCanvasContext.cxx66
-rw-r--r--oox/source/shape/LockedCanvasContext.hxx40
-rw-r--r--oox/source/shape/ShapeContextHandler.cxx37
-rw-r--r--oox/source/shape/ShapeContextHandler.hxx2
5 files changed, 145 insertions, 1 deletions
diff --git a/oox/Library_oox.mk b/oox/Library_oox.mk
index 3d8743fe4f40..45f4b9cc494a 100644
--- a/oox/Library_oox.mk
+++ b/oox/Library_oox.mk
@@ -266,6 +266,7 @@ $(eval $(call gb_Library_add_exception_objects,oox,\
oox/source/ppt/timenodelistcontext \
oox/source/ppt/timetargetelementcontext \
oox/source/ppt/extdrawingfragmenthandler \
+ oox/source/shape/LockedCanvasContext \
oox/source/shape/ShapeContextHandler \
oox/source/shape/ShapeDrawingFragmentHandler \
oox/source/shape/ShapeFilterBase \
diff --git a/oox/source/shape/LockedCanvasContext.cxx b/oox/source/shape/LockedCanvasContext.cxx
new file mode 100644
index 000000000000..9a7e9c0ff55c
--- /dev/null
+++ b/oox/source/shape/LockedCanvasContext.cxx
@@ -0,0 +1,66 @@
+/* -*- 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 "LockedCanvasContext.hxx"
+#include <oox/drawingml/shapegroupcontext.hxx>
+
+using namespace com::sun::star;
+
+namespace oox { namespace shape {
+
+LockedCanvasContext::LockedCanvasContext( ContextHandler& rParent )
+: ContextHandler( rParent )
+{
+}
+
+LockedCanvasContext::~LockedCanvasContext()
+{
+}
+
+oox::drawingml::ShapePtr LockedCanvasContext::getShape()
+{
+ return mpShape;
+}
+
+uno::Reference< xml::sax::XFastContextHandler > LockedCanvasContext::createFastChildContext( sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& /*xAttribs*/ ) throw (xml::sax::SAXException, uno::RuntimeException)
+{
+ uno::Reference< xml::sax::XFastContextHandler > xRet;
+
+ switch( getBaseToken( aElementToken ) )
+ {
+ case XML_lockedCanvas:
+ break;
+ case XML_nvGrpSpPr:
+ break;
+ case XML_grpSpPr:
+ break;
+ case XML_sp:
+ {
+ oox::drawingml::ShapePtr pMasterShape;
+ mpShape.reset(new oox::drawingml::Shape("com.sun.star.drawing.CustomShape"));
+ xRet = new oox::drawingml::ShapeContext( *this, pMasterShape, mpShape );
+ }
+ break;
+ case XML_grpSp:
+ {
+ oox::drawingml::ShapePtr pMasterShape;
+ mpShape.reset(new oox::drawingml::Shape("com.sun.star.drawing.GroupShape"));
+ xRet = new oox::drawingml::ShapeGroupContext( *this, pMasterShape, mpShape );
+ }
+ break;
+ default:
+ SAL_WARN("oox", "LockedCanvasContext::createFastChildContext: unhandled element:" << getBaseToken(aElementToken));
+ break;
+ }
+ return xRet;
+}
+
+} }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/shape/LockedCanvasContext.hxx b/oox/source/shape/LockedCanvasContext.hxx
new file mode 100644
index 000000000000..c93d49d54aad
--- /dev/null
+++ b/oox/source/shape/LockedCanvasContext.hxx
@@ -0,0 +1,40 @@
+/* -*- 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 OOX_SHAPE_LOCKEDCANVASCONTEXT
+#define OOX_SHAPE_LOCKEDCANVASCONTEXT
+
+#include "oox/core/contexthandler.hxx"
+#include "oox/drawingml/shape.hxx"
+
+namespace oox { namespace shape {
+
+/// Locked canvas is kind of a container for drawingml shapes: it can even contain group shapes.
+class LockedCanvasContext : public oox::core::ContextHandler
+{
+public:
+ LockedCanvasContext( oox::core::ContextHandler& rParent );
+ virtual ~LockedCanvasContext();
+
+ virtual com::sun::star::uno::Reference< com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 Element, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
+
+ oox::drawingml::ShapePtr getShape();
+
+protected:
+
+ oox::drawingml::ShapePtr mpShape;
+};
+
+
+} }
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx
index 9c8da2d0549d..5c1f990a5ab9 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -21,6 +21,7 @@
#include "ShapeContextHandler.hxx"
#include "ShapeDrawingFragmentHandler.hxx"
+#include "LockedCanvasContext.hxx"
#include "oox/vml/vmldrawingfragment.hxx"
#include "oox/vml/vmlshape.hxx"
#include "oox/drawingml/themefragmenthandler.hxx"
@@ -69,6 +70,26 @@ ShapeContextHandler::~ShapeContextHandler()
{
}
+uno::Reference<xml::sax::XFastContextHandler> ShapeContextHandler::getLockedCanvasContext(sal_Int32 nElement)
+{
+ if (!mxLockedCanvasContext.is())
+ {
+ FragmentHandlerRef rFragmentHandler(new ShapeFragmentHandler(*mxFilterBase, msRelationFragmentPath));
+ ShapePtr pMasterShape;
+
+ switch (nElement & 0xffff)
+ {
+ case XML_lockedCanvas:
+ mxLockedCanvasContext.set(new LockedCanvasContext(*rFragmentHandler));
+ break;
+ default:
+ break;
+ }
+ }
+
+ return mxLockedCanvasContext;
+}
+
uno::Reference<xml::sax::XFastContextHandler>
ShapeContextHandler::getGraphicShapeContext(::sal_Int32 Element )
{
@@ -140,6 +161,9 @@ ShapeContextHandler::getContextHandler()
case NMSP_dmlDiagram:
xResult.set(getDiagramShapeContext());
break;
+ case NMSP_dmlLockedCanvas:
+ xResult.set(getLockedCanvasContext(mnStartToken));
+ break;
default:
xResult.set(getGraphicShapeContext(mnStartToken));
break;
@@ -164,7 +188,7 @@ void SAL_CALL ShapeContextHandler::startFastElement
mpThemePtr.reset(new Theme());
- if (Element == DGM_TOKEN(relIds))
+ if (Element == DGM_TOKEN(relIds) || Element == LC_TOKEN(lockedCanvas))
{
// Parse the theme relation, if available; the diagram won't have colors without it.
if (!msRelationFragmentPath.isEmpty())
@@ -309,6 +333,17 @@ ShapeContextHandler::getShape() throw (uno::RuntimeException)
}
mxDiagramShapeContext.clear();
}
+ else if (mxLockedCanvasContext.is())
+ {
+ ShapePtr pShape = dynamic_cast<LockedCanvasContext*>(mxLockedCanvasContext.get())->getShape();
+ if (pShape)
+ {
+ basegfx::B2DHomMatrix aMatrix;
+ pShape->addShape(*mxFilterBase, mpThemePtr.get(), xShapes, aMatrix, pShape->getFillProperties());
+ xResult = pShape->getXShape();
+ mxLockedCanvasContext.clear();
+ }
+ }
else if (mpShape.get() != NULL)
{
basegfx::B2DHomMatrix aTransformation;
diff --git a/oox/source/shape/ShapeContextHandler.hxx b/oox/source/shape/ShapeContextHandler.hxx
index f8cdcb77bfc0..c70460644729 100644
--- a/oox/source/shape/ShapeContextHandler.hxx
+++ b/oox/source/shape/ShapeContextHandler.hxx
@@ -149,6 +149,7 @@ private:
css::uno::Reference<XFastContextHandler> mxDrawingFragmentHandler;
css::uno::Reference<XFastContextHandler> mxGraphicShapeContext;
css::uno::Reference<XFastContextHandler> mxDiagramShapeContext;
+ css::uno::Reference<XFastContextHandler> mxLockedCanvasContext;
core::XmlFilterRef mxFilterBase;
drawingml::ThemePtr mpThemePtr;
@@ -159,6 +160,7 @@ private:
css::uno::Reference<XFastContextHandler> getGraphicShapeContext(::sal_Int32 Element);
css::uno::Reference<XFastContextHandler> getDrawingShapeContext();
css::uno::Reference<XFastContextHandler> getDiagramShapeContext();
+ css::uno::Reference<XFastContextHandler> getLockedCanvasContext(sal_Int32 nElement);
css::uno::Reference<XFastContextHandler> getContextHandler();
};