summaryrefslogtreecommitdiffstats
path: root/oox/source/shape/WpgContext.cxx
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
commit940b4d1848e8c70ab7642901a68594e8016caffc (patch)
treeeb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /oox/source/shape/WpgContext.cxx
parentInitial commit. (diff)
downloadlibreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz
libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.zip
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'oox/source/shape/WpgContext.cxx')
-rw-r--r--oox/source/shape/WpgContext.cxx78
1 files changed, 78 insertions, 0 deletions
diff --git a/oox/source/shape/WpgContext.cxx b/oox/source/shape/WpgContext.cxx
new file mode 100644
index 000000000..7896f8a4c
--- /dev/null
+++ b/oox/source/shape/WpgContext.cxx
@@ -0,0 +1,78 @@
+/* -*- 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 <sal/log.hxx>
+#include <drawingml/shapepropertiescontext.hxx>
+#include <oox/drawingml/shapegroupcontext.hxx>
+#include <oox/drawingml/graphicshapecontext.hxx>
+#include <oox/token/namespaces.hxx>
+#include <oox/token/tokens.hxx>
+
+using namespace com::sun::star;
+
+namespace oox::shape
+{
+WpgContext::WpgContext(FragmentHandler2 const& rParent)
+ : FragmentHandler2(rParent)
+{
+ mpShape = std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GroupShape");
+ mpShape->setWps(true);
+}
+
+WpgContext::~WpgContext() = default;
+
+oox::core::ContextHandlerRef WpgContext::onCreateContext(sal_Int32 nElementToken,
+ const oox::AttributeList& /*rAttribs*/)
+{
+ switch (getBaseToken(nElementToken))
+ {
+ case XML_wgp:
+ case XML_cNvGrpSpPr:
+ case XML_grpSpPr:
+ return new oox::drawingml::ShapePropertiesContext(*this, *mpShape);
+ case XML_wsp:
+ {
+ // Don't set default character height, Writer has its own way to set
+ // the default, and if we don't set it here, editeng properly inherits
+ // it.
+ oox::drawingml::ShapePtr pShape = std::make_shared<oox::drawingml::Shape>(
+ "com.sun.star.drawing.CustomShape", /*bDefaultHeight=*/false);
+ return new oox::drawingml::ShapeContext(*this, mpShape, pShape);
+ // return new oox::shape::WpsContext(*this, uno::Reference<drawing::XShape>(),
+ // mpShape, pShape);
+ }
+ case XML_pic:
+ return new oox::drawingml::GraphicShapeContext(
+ *this, mpShape,
+ std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GraphicObjectShape"));
+ case XML_grpSp:
+ {
+ return new oox::drawingml::ShapeGroupContext(
+ *this, mpShape,
+ std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GroupShape"));
+ }
+ case XML_graphicFrame:
+ {
+ auto pShape = std::make_shared<oox::drawingml::Shape>(
+ "com.sun.star.drawing.GraphicObjectShape");
+ pShape->setWps(true);
+ return new oox::drawingml::GraphicalObjectFrameContext(*this, mpShape, pShape,
+ /*bEmbedShapesInChart=*/true);
+ }
+ default:
+ SAL_WARN("oox", "WpgContext::createFastChildContext: unhandled element: "
+ << getBaseToken(nElementToken));
+ break;
+ }
+ return nullptr;
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */