LibreOffice Module oox (master) 1
LockedCanvasContext.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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 */
9
11#include <sal/log.hxx>
19#include <oox/token/namespaces.hxx>
20#include <oox/token/tokens.hxx>
21
22using namespace com::sun::star;
23
24namespace oox::shape
25{
27 : FragmentHandler2(rParent)
28{
29 mpShapePtr = std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GroupShape");
30 mpShapePtr->setLockedCanvas(true); // will be "LockedCanvas" in InteropGrabBag
31}
32
34
36LockedCanvasContext::onCreateContext(sal_Int32 nElementToken, const ::oox::AttributeList& rAttribs)
37{
38 switch (getBaseToken(nElementToken))
39 {
40 case XML_nvGrpSpPr: // CT_GvmlGroupShapeNonVisual, child see at end
41 return this;
42 case XML_grpSpPr: // CT_GroupShapeProperties
44 case XML_txSp: // CT_GvmlTextShape
45 break;
46 case XML_sp: // CT_GvmlShape
47 {
49 *this, mpShapePtr,
50 std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.CustomShape", true));
51 }
52 case XML_cxnSp: // CT_GvmlConnector
53 {
55 = std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.ConnectorShape");
56 return new oox::drawingml::ConnectorShapeContext(*this, mpShapePtr, pShape,
57 pShape->getConnectorShapeProperties());
58 }
59 case XML_pic: // CT_GvmlPicture
60 {
62 *this, mpShapePtr,
63 std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GraphicObjectShape"));
64 }
65 case XML_graphicFrame: // CT_GvmlGraphicObjectFrame
66 {
68 *this, mpShapePtr,
69 std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GraphicObjectShape"),
70 true);
71 }
72 case XML_grpSp: // CT_GvmlGroupShape
73 {
75 *this, mpShapePtr,
76 std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GroupShape"));
77 }
78 // mandatory child elements of CT_GvmlGroupShapeNonVisual
79 case XML_cNvPr: // CT_NonVisualDrawingProps
80 {
81 mpShapePtr->setHidden(rAttribs.getBool(XML_hidden, false));
82 mpShapePtr->setId(rAttribs.getStringDefaulted(XML_id));
83 mpShapePtr->setName(rAttribs.getStringDefaulted(XML_name));
84 break;
85 }
86 case XML_cNvGrpSpPr: // CT_NonVisualGroupDrawingShapeProps
87 break;
88 default:
89 SAL_WARN("oox", "LockedCanvasContext::createFastChildContext: unhandled element:"
90 << getBaseToken(nElementToken));
91 break;
92 }
93 return nullptr;
94}
95}
96
97/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
LockedCanvasContext(oox::core::FragmentHandler2 const &rParent)
oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElementToken, const ::oox::AttributeList &rAttribs) override
oox::drawingml::ShapePtr mpShapePtr
#define SAL_WARN(area, stream)
std::shared_ptr< Shape > ShapePtr