LibreOffice Module oox (master)
1
oox
source
shape
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 <
drawingml/shapepropertiescontext.hxx
>
13
#include <
oox/drawingml/connectorshapecontext.hxx
>
14
#include <
oox/drawingml/graphicshapecontext.hxx
>
15
#include <
oox/drawingml/shape.hxx
>
16
#include <
oox/drawingml/shapecontext.hxx
>
17
#include <
oox/drawingml/shapegroupcontext.hxx
>
18
#include <
oox/helper/attributelist.hxx
>
19
#include <oox/token/namespaces.hxx>
20
#include <oox/token/tokens.hxx>
21
22
using namespace
com::sun::star
;
23
24
namespace
oox::shape
25
{
26
LockedCanvasContext::LockedCanvasContext
(
FragmentHandler2
const
& rParent)
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
33
LockedCanvasContext::~LockedCanvasContext
() =
default
;
34
35
::oox::core::ContextHandlerRef
36
LockedCanvasContext::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
43
return
new
oox::drawingml::ShapePropertiesContext
(*
this
, *
mpShapePtr
);
44
case
XML_txSp:
// CT_GvmlTextShape
45
break
;
46
case
XML_sp:
// CT_GvmlShape
47
{
48
return
new
oox::drawingml::ShapeContext
(
49
*
this
,
mpShapePtr
,
50
std::make_shared<oox::drawingml::Shape>(
"com.sun.star.drawing.CustomShape"
,
true
));
51
}
52
case
XML_cxnSp:
// CT_GvmlConnector
53
{
54
oox::drawingml::ShapePtr
pShape
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
{
61
return
new
oox::drawingml::GraphicShapeContext
(
62
*
this
,
mpShapePtr
,
63
std::make_shared<oox::drawingml::Shape>(
"com.sun.star.drawing.GraphicObjectShape"
));
64
}
65
case
XML_graphicFrame:
// CT_GvmlGraphicObjectFrame
66
{
67
return
new
oox::drawingml::GraphicalObjectFrameContext
(
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
{
74
return
new
oox::drawingml::ShapeGroupContext
(
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.hxx
attributelist.hxx
oox::core::FragmentHandler2
Definition:
fragmenthandler2.hxx:47
oox::drawingml::ConnectorShapeContext
Definition:
connectorshapecontext.hxx:43
oox::drawingml::GraphicShapeContext
Definition:
graphicshapecontext.hxx:37
oox::drawingml::GraphicalObjectFrameContext
Definition:
graphicshapecontext.hxx:46
oox::drawingml::ShapeContext
Definition:
shapecontext.hxx:34
oox::drawingml::ShapeGroupContext
Definition:
shapegroupcontext.hxx:33
oox::drawingml::ShapePropertiesContext
Definition:
shapepropertiescontext.hxx:29
oox::shape::LockedCanvasContext::LockedCanvasContext
LockedCanvasContext(oox::core::FragmentHandler2 const &rParent)
Definition:
LockedCanvasContext.cxx:26
oox::shape::LockedCanvasContext::onCreateContext
oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElementToken, const ::oox::AttributeList &rAttribs) override
Definition:
LockedCanvasContext.cxx:36
oox::shape::LockedCanvasContext::mpShapePtr
oox::drawingml::ShapePtr mpShapePtr
Definition:
LockedCanvasContext.hxx:31
oox::shape::LockedCanvasContext::~LockedCanvasContext
~LockedCanvasContext() override
rtl::Reference
connectorshapecontext.hxx
graphicshapecontext.hxx
log.hxx
SAL_WARN
#define SAL_WARN(area, stream)
com::sun::star
oox::drawingml::ShapePtr
std::shared_ptr< Shape > ShapePtr
Definition:
drawingmltypes.hxx:79
oox::shape
Definition:
LockedCanvasContext.cxx:25
shape.hxx
shapecontext.hxx
shapegroupcontext.hxx
shapepropertiescontext.hxx
Generated on Sun Jul 30 2023 04:44:16 for LibreOffice Module oox (master) by
1.9.3