Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / oox / source / shape / WpgContext.cxx
blob88521e981ee60a55569b51f5cb3b21accfd3e6d9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
11 #include "WpgContext.hxx"
12 #include <sal/log.hxx>
13 #include <drawingml/shapepropertiescontext.hxx>
14 #include <oox/drawingml/shapegroupcontext.hxx>
15 #include <oox/drawingml/graphicshapecontext.hxx>
16 #include <oox/token/namespaces.hxx>
17 #include <oox/token/tokens.hxx>
19 using namespace com::sun::star;
21 namespace oox
23 namespace shape
26 WpgContext::WpgContext(ContextHandler2Helper const& rParent)
27 : ContextHandler2(rParent)
29 mpShape.reset(new oox::drawingml::Shape("com.sun.star.drawing.GroupShape"));
30 mpShape->setWps(true);
33 WpgContext::~WpgContext() = default;
35 oox::core::ContextHandlerRef WpgContext::onCreateContext(sal_Int32 nElementToken, const oox::AttributeList& /*rAttribs*/)
37 switch (getBaseToken(nElementToken))
39 case XML_wgp:
40 case XML_cNvGrpSpPr:
41 case XML_grpSpPr:
42 return new oox::drawingml::ShapePropertiesContext(*this, *mpShape);
43 case XML_wsp:
45 // Don't set default character height, Writer has its own way to set
46 // the default, and if we don't set it here, editeng properly inherits
47 // it.
48 oox::drawingml::ShapePtr pShape(new oox::drawingml::Shape("com.sun.star.drawing.CustomShape", /*bDefaultHeight=*/false));
49 return new oox::drawingml::ShapeContext(*this, mpShape, pShape);
50 // return new oox::shape::WpsContext(*this, uno::Reference<drawing::XShape>(),
51 // mpShape, pShape);
53 case XML_pic:
54 return new oox::drawingml::GraphicShapeContext(*this, mpShape, std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GraphicObjectShape"));
55 case XML_grpSp:
57 return new oox::drawingml::ShapeGroupContext(*this, mpShape, std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GroupShape"));
59 case XML_graphicFrame:
61 auto pShape = std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GraphicObjectShape");
62 pShape->setWps(true);
63 return new oox::drawingml::GraphicalObjectFrameContext(*this, mpShape, pShape, /*bEmbedShapesInChart=*/true);
65 default:
66 SAL_WARN("oox", "WpgContext::createFastChildContext: unhandled element: " << getBaseToken(nElementToken));
67 break;
69 return nullptr;
75 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */