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 
10 #include "LockedCanvasContext.hxx"
11 #include <sal/log.hxx>
12 #include <oox/drawingml/shape.hxx>
15 #include <oox/token/namespaces.hxx>
16 #include <oox/token/tokens.hxx>
17 
18 using namespace com::sun::star;
19 
20 namespace oox::shape
21 {
22 LockedCanvasContext::LockedCanvasContext(FragmentHandler2 const& rParent)
23  : FragmentHandler2(rParent)
24 {
25 }
26 
28 
30 LockedCanvasContext::onCreateContext(sal_Int32 nElementToken,
31  const ::oox::AttributeList& /*rAttribs*/)
32 {
33  switch (getBaseToken(nElementToken))
34  {
35  case XML_lockedCanvas:
36  case XML_nvGrpSpPr:
37  case XML_grpSpPr:
38  break;
39  case XML_sp:
40  {
41  oox::drawingml::ShapePtr pMasterShape;
42  mpShape = std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.CustomShape");
43  mpShape->setLockedCanvas(true);
44  return new oox::drawingml::ShapeContext(*this, pMasterShape, mpShape);
45  }
46  case XML_grpSp:
47  {
48  oox::drawingml::ShapePtr pMasterShape;
49  mpShape = std::make_shared<oox::drawingml::Shape>("com.sun.star.drawing.GroupShape");
50  mpShape->setLockedCanvas(true);
51  return new oox::drawingml::ShapeGroupContext(*this, pMasterShape, mpShape);
52  }
53  default:
54  SAL_WARN("oox", "LockedCanvasContext::createFastChildContext: unhandled element:"
55  << getBaseToken(nElementToken));
56  break;
57  }
58  return nullptr;
59 }
60 }
61 
62 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElementToken, const ::oox::AttributeList &rAttribs) override
oox::drawingml::ShapePtr mpShape
#define SAL_WARN(area, stream)
std::shared_ptr< Shape > ShapePtr