Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / include / oox / vml / vmlshapecontext.hxx
blob61e189fc009f6b4c4e774f40114c502b141a4153
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::vml {
33 class Drawing;
35 struct ShapeTypeModel;
36 class ShapeType;
38 struct ClientData;
39 struct ShapeModel;
40 class ShapeBase;
41 class GroupShape;
42 class RectangleShape;
44 class ShapeContainer;
47 class ShapeLayoutContext final : public ::oox::core::ContextHandler2
49 public:
50 explicit ShapeLayoutContext(
51 ::oox::core::ContextHandler2Helper const & rParent,
52 Drawing& rDrawing );
54 virtual ::oox::core::ContextHandlerRef
55 onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
57 private:
58 Drawing& mrDrawing;
62 class ClientDataContext final : public ::oox::core::ContextHandler2
64 public:
65 explicit ClientDataContext(
66 ::oox::core::ContextHandler2Helper const & rParent,
67 ClientData& rClientData,
68 const AttributeList& rAttribs );
70 virtual ::oox::core::ContextHandlerRef
71 onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
72 virtual void onCharacters( const OUString& rChars ) override;
73 virtual void onEndElement() override;
75 private:
76 ClientData& mrClientData;
77 OUString maElementText;
81 class ShapeContextBase : public ::oox::core::ContextHandler2
83 public:
84 static ::oox::core::ContextHandlerRef
85 createShapeContext(
86 ::oox::core::ContextHandler2Helper const & rParent,
87 ShapeContainer& rShapes,
88 sal_Int32 nElement,
89 const AttributeList& rAttribs );
91 protected:
92 explicit ShapeContextBase( ::oox::core::ContextHandler2Helper const & rParent );
96 class ShapeTypeContext : public ShapeContextBase
98 public:
99 explicit ShapeTypeContext(
100 ::oox::core::ContextHandler2Helper const & rParent,
101 std::shared_ptr<ShapeType> const& pShapeType,
102 const AttributeList& rAttribs );
104 virtual ::oox::core::ContextHandlerRef
105 onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
107 private:
108 /** Processes the 'style' attribute. */
109 void setStyle( std::u16string_view rStyle );
111 /** Resolve a relation identifier to a fragment path. */
112 std::optional< OUString > decodeFragmentPath( const AttributeList& rAttribs, sal_Int32 nToken ) const;
114 private:
115 std::shared_ptr<ShapeType> m_pShapeType;
116 ShapeTypeModel& mrTypeModel;
120 class ShapeContext : public ShapeTypeContext
122 public:
123 explicit ShapeContext(::oox::core::ContextHandler2Helper const& rParent,
124 const std::shared_ptr<ShapeBase>& pShape, const AttributeList& rAttribs);
126 virtual ::oox::core::ContextHandlerRef
127 onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
129 private:
130 /** Processes the 'points' attribute. */
131 void setPoints( std::u16string_view rPoints );
132 /** Processes the 'from' attribute. */
133 void setFrom( const OUString& rPoints );
134 /** Processes the 'to' attribute. */
135 void setTo( const OUString& rPoints );
136 /** Processes the 'control1' attribute. */
137 void setControl1( const OUString& rPoints );
138 /** Processes the 'control2' attribute. */
139 void setControl2( const OUString& rPoints );
140 /** Processes the 'path' attribute. */
141 void setVmlPath( const OUString& rPath );
142 /** Processes the 'href' attribute. */
143 void setHyperlink( const OUString& rHyperlink );
145 private:
146 ShapeBase& mrShape;
147 ShapeModel& mrShapeModel;
151 class GroupShapeContext final : public ShapeContext
153 public:
154 explicit GroupShapeContext(::oox::core::ContextHandler2Helper const& rParent,
155 const std::shared_ptr<GroupShape>& pShape,
156 const AttributeList& rAttribs);
158 virtual ::oox::core::ContextHandlerRef
159 onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
161 private:
162 ShapeContainer& mrShapes;
166 class RectangleShapeContext final : public ShapeContext
168 public:
169 explicit RectangleShapeContext(::oox::core::ContextHandler2Helper const& rParent,
170 const AttributeList& rAttribs,
171 const std::shared_ptr<RectangleShape>& pShape);
173 virtual ::oox::core::ContextHandlerRef
174 onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
177 class ControlShapeContext final : public ShapeContextBase
179 public:
180 explicit ControlShapeContext(
181 ::oox::core::ContextHandler2Helper const & rParent,
182 ShapeContainer& rShapes,
183 const AttributeList& rAttribs );
187 } // namespace oox::vml
189 #endif
191 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */