1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_OOX_VML_VMLSHAPECONTEXT_HXX
21 #define INCLUDED_OOX_VML_VMLSHAPECONTEXT_HXX
23 #include <oox/core/contexthandler.hxx>
24 #include <oox/core/contexthandler2.hxx>
25 #include <oox/helper/helper.hxx>
26 #include <rtl/ustring.hxx>
27 #include <sal/types.h>
29 namespace oox
{ class AttributeList
; }
36 struct ShapeTypeModel
;
48 class ShapeLayoutContext final
: public ::oox::core::ContextHandler2
51 explicit ShapeLayoutContext(
52 ::oox::core::ContextHandler2Helper
const & rParent
,
55 virtual ::oox::core::ContextHandlerRef
56 onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) override
;
63 class ClientDataContext final
: public ::oox::core::ContextHandler2
66 explicit ClientDataContext(
67 ::oox::core::ContextHandler2Helper
const & rParent
,
68 ClientData
& rClientData
,
69 const AttributeList
& rAttribs
);
71 virtual ::oox::core::ContextHandlerRef
72 onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) override
;
73 virtual void onCharacters( const OUString
& rChars
) override
;
74 virtual void onEndElement() override
;
77 ClientData
& mrClientData
;
78 OUString maElementText
;
82 class ShapeContextBase
: public ::oox::core::ContextHandler2
85 static ::oox::core::ContextHandlerRef
87 ::oox::core::ContextHandler2Helper
const & rParent
,
88 ShapeContainer
& rShapes
,
90 const AttributeList
& rAttribs
);
93 explicit ShapeContextBase( ::oox::core::ContextHandler2Helper
const & rParent
);
97 class ShapeTypeContext
: public ShapeContextBase
100 explicit ShapeTypeContext(
101 ::oox::core::ContextHandler2Helper
const & rParent
,
102 std::shared_ptr
<ShapeType
> const& pShapeType
,
103 const AttributeList
& rAttribs
);
105 virtual ::oox::core::ContextHandlerRef
106 onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) override
;
109 /** Processes the 'style' attribute. */
110 void setStyle( const OUString
& rStyle
);
112 /** Resolve a relation identifier to a fragment path. */
113 OptValue
< OUString
> decodeFragmentPath( const AttributeList
& rAttribs
, sal_Int32 nToken
) const;
116 std::shared_ptr
<ShapeType
> m_pShapeType
;
117 ShapeTypeModel
& mrTypeModel
;
121 class ShapeContext
: public ShapeTypeContext
124 explicit ShapeContext(::oox::core::ContextHandler2Helper
const& rParent
,
125 const std::shared_ptr
<ShapeBase
>& pShape
, const AttributeList
& rAttribs
);
127 virtual ::oox::core::ContextHandlerRef
128 onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) override
;
131 /** Processes the 'points' attribute. */
132 void setPoints( const OUString
& rPoints
);
133 /** Processes the 'from' attribute. */
134 void setFrom( const OUString
& rPoints
);
135 /** Processes the 'to' attribute. */
136 void setTo( const OUString
& rPoints
);
137 /** Processes the 'control1' attribute. */
138 void setControl1( const OUString
& rPoints
);
139 /** Processes the 'control2' attribute. */
140 void setControl2( const OUString
& rPoints
);
141 /** Processes the 'path' attribute. */
142 void setVmlPath( const OUString
& rPath
);
146 ShapeModel
& mrShapeModel
;
150 class GroupShapeContext final
: public ShapeContext
153 explicit GroupShapeContext(::oox::core::ContextHandler2Helper
const& rParent
,
154 const std::shared_ptr
<GroupShape
>& pShape
,
155 const AttributeList
& rAttribs
);
157 virtual ::oox::core::ContextHandlerRef
158 onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) override
;
161 ShapeContainer
& mrShapes
;
165 class RectangleShapeContext final
: public ShapeContext
168 explicit RectangleShapeContext(::oox::core::ContextHandler2Helper
const& rParent
,
169 const AttributeList
& rAttribs
,
170 const std::shared_ptr
<RectangleShape
>& pShape
);
172 virtual ::oox::core::ContextHandlerRef
173 onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) override
;
176 class ControlShapeContext final
: public ShapeContextBase
179 explicit ControlShapeContext(
180 ::oox::core::ContextHandler2Helper
const & rParent
,
181 ShapeContainer
& rShapes
,
182 const AttributeList
& rAttribs
);
191 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */