Branch libreoffice-5-0-4
[LibreOffice.git] / include / oox / vml / vmlshapecontext.hxx
blob4f178db1361a3adaaf7706d25388642adf843776
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/contexthandler2.hxx>
25 namespace oox {
26 namespace vml {
28 class Drawing;
30 struct ShapeTypeModel;
31 class ShapeType;
33 struct ClientData;
34 struct ShapeModel;
35 class ShapeBase;
36 class GroupShape;
37 class RectangleShape;
39 class ShapeContainer;
43 class ShapeLayoutContext : public ::oox::core::ContextHandler2
45 public:
46 explicit ShapeLayoutContext(
47 ::oox::core::ContextHandler2Helper& rParent,
48 Drawing& rDrawing );
50 virtual ::oox::core::ContextHandlerRef
51 onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
53 private:
54 Drawing& mrDrawing;
59 class ClientDataContext : public ::oox::core::ContextHandler2
61 public:
62 explicit ClientDataContext(
63 ::oox::core::ContextHandler2Helper& rParent,
64 ClientData& rClientData,
65 const AttributeList& rAttribs );
67 virtual ::oox::core::ContextHandlerRef
68 onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
69 virtual void onCharacters( const OUString& rChars ) SAL_OVERRIDE;
70 virtual void onEndElement() SAL_OVERRIDE;
72 private:
73 ClientData& mrClientData;
74 OUString maElementText;
79 class ShapeContextBase : public ::oox::core::ContextHandler2
81 public:
82 static ::oox::core::ContextHandlerRef
83 createShapeContext(
84 ::oox::core::ContextHandler2Helper& rParent,
85 ShapeContainer& rShapes,
86 sal_Int32 nElement,
87 const AttributeList& rAttribs );
89 protected:
90 explicit ShapeContextBase( ::oox::core::ContextHandler2Helper& rParent );
95 class ShapeTypeContext : public ShapeContextBase
97 public:
98 explicit ShapeTypeContext(
99 ::oox::core::ContextHandler2Helper& rParent,
100 ShapeType& rShapeType,
101 const AttributeList& rAttribs );
103 virtual ::oox::core::ContextHandlerRef
104 onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
106 private:
107 /** Processes the 'style' attribute. */
108 void setStyle( const OUString& rStyle );
110 /** Resolve a relation identifier to a fragment path. */
111 OptValue< OUString > decodeFragmentPath( const AttributeList& rAttribs, sal_Int32 nToken ) const;
113 private:
114 ShapeTypeModel& mrTypeModel;
119 class ShapeContext : public ShapeTypeContext
121 public:
122 explicit ShapeContext(
123 ::oox::core::ContextHandler2Helper& rParent,
124 ShapeBase& rShape,
125 const AttributeList& rAttribs );
127 virtual ::oox::core::ContextHandlerRef
128 onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_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 protected:
145 ShapeBase& mrShape;
147 private:
148 ShapeModel& mrShapeModel;
153 class GroupShapeContext : public ShapeContext
155 public:
156 explicit GroupShapeContext(
157 ::oox::core::ContextHandler2Helper& rParent,
158 GroupShape& rShape,
159 const AttributeList& rAttribs );
161 virtual ::oox::core::ContextHandlerRef
162 onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
164 private:
165 ShapeContainer& mrShapes;
170 class RectangleShapeContext : public ShapeContext
172 public:
173 explicit RectangleShapeContext(
174 ::oox::core::ContextHandler2Helper& rParent,
175 const AttributeList& rAttribs,
176 RectangleShape& rShape );
178 virtual ::oox::core::ContextHandlerRef
179 onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
183 } // namespace vml
184 } // namespace oox
186 #endif
188 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */