Bump version to 6.4-15
[LibreOffice.git] / include / oox / vml / vmlshapecontext.hxx
blobc07bcf12e84f1789551b619c3252b179ee49111d
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/.
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; }
31 namespace oox {
32 namespace vml {
34 class Drawing;
36 struct ShapeTypeModel;
37 class ShapeType;
39 struct ClientData;
40 struct ShapeModel;
41 class ShapeBase;
42 class GroupShape;
43 class RectangleShape;
45 class ShapeContainer;
48 class ShapeLayoutContext final : public ::oox::core::ContextHandler2
50 public:
51 explicit ShapeLayoutContext(
52 ::oox::core::ContextHandler2Helper const & rParent,
53 Drawing& rDrawing );
55 virtual ::oox::core::ContextHandlerRef
56 onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
58 private:
59 Drawing& mrDrawing;
63 class ClientDataContext final : public ::oox::core::ContextHandler2
65 public:
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;
76 private:
77 ClientData& mrClientData;
78 OUString maElementText;
82 class ShapeContextBase : public ::oox::core::ContextHandler2
84 public:
85 static ::oox::core::ContextHandlerRef
86 createShapeContext(
87 ::oox::core::ContextHandler2Helper const & rParent,
88 ShapeContainer& rShapes,
89 sal_Int32 nElement,
90 const AttributeList& rAttribs );
92 protected:
93 explicit ShapeContextBase( ::oox::core::ContextHandler2Helper const & rParent );
97 class ShapeTypeContext : public ShapeContextBase
99 public:
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;
108 private:
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;
115 private:
116 std::shared_ptr<ShapeType> m_pShapeType;
117 ShapeTypeModel& mrTypeModel;
121 class ShapeContext : public ShapeTypeContext
123 public:
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;
130 private:
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 );
144 private:
145 ShapeBase& mrShape;
146 ShapeModel& mrShapeModel;
150 class GroupShapeContext final : public ShapeContext
152 public:
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;
160 private:
161 ShapeContainer& mrShapes;
165 class RectangleShapeContext final : public ShapeContext
167 public:
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
178 public:
179 explicit ControlShapeContext(
180 ::oox::core::ContextHandler2Helper const & rParent,
181 ShapeContainer& rShapes,
182 const AttributeList& rAttribs );
186 } // namespace vml
187 } // namespace oox
189 #endif
191 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */