Line data Source code
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 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_OOX_VML_VMLSHAPECONTEXT_HXX
21 : #define INCLUDED_OOX_VML_VMLSHAPECONTEXT_HXX
22 :
23 : #include <oox/core/contexthandler2.hxx>
24 :
25 : namespace oox {
26 : namespace vml {
27 :
28 : class Drawing;
29 :
30 : struct ShapeTypeModel;
31 : class ShapeType;
32 :
33 : struct ClientData;
34 : struct ShapeModel;
35 : class ShapeBase;
36 : class GroupShape;
37 : class RectangleShape;
38 :
39 : class ShapeContainer;
40 :
41 :
42 :
43 12 : class ShapeLayoutContext : public ::oox::core::ContextHandler2
44 : {
45 : public:
46 : explicit ShapeLayoutContext(
47 : ::oox::core::ContextHandler2Helper& rParent,
48 : Drawing& rDrawing );
49 :
50 : virtual ::oox::core::ContextHandlerRef
51 : onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
52 :
53 : private:
54 : Drawing& mrDrawing;
55 : };
56 :
57 :
58 :
59 8 : class ClientDataContext : public ::oox::core::ContextHandler2
60 : {
61 : public:
62 : explicit ClientDataContext(
63 : ::oox::core::ContextHandler2Helper& rParent,
64 : ClientData& rClientData,
65 : const AttributeList& rAttribs );
66 :
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;
71 :
72 : private:
73 : ClientData& mrClientData;
74 : OUString maElementText;
75 : };
76 :
77 :
78 :
79 2330 : class ShapeContextBase : public ::oox::core::ContextHandler2
80 : {
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 );
88 :
89 : protected:
90 : explicit ShapeContextBase( ::oox::core::ContextHandler2Helper& rParent );
91 : };
92 :
93 :
94 :
95 2732 : class ShapeTypeContext : public ShapeContextBase
96 : {
97 : public:
98 : explicit ShapeTypeContext(
99 : ::oox::core::ContextHandler2Helper& rParent,
100 : ShapeType& rShapeType,
101 : const AttributeList& rAttribs );
102 :
103 : virtual ::oox::core::ContextHandlerRef
104 : onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
105 :
106 : private:
107 : /** Processes the 'style' attribute. */
108 : void setStyle( const OUString& rStyle );
109 :
110 : /** Resolve a relation identifier to a fragment path. */
111 : OptValue< OUString > decodeFragmentPath( const AttributeList& rAttribs, sal_Int32 nToken ) const;
112 :
113 : private:
114 : ShapeTypeModel& mrTypeModel;
115 : };
116 :
117 :
118 :
119 3320 : class ShapeContext : public ShapeTypeContext
120 : {
121 : public:
122 : explicit ShapeContext(
123 : ::oox::core::ContextHandler2Helper& rParent,
124 : ShapeBase& rShape,
125 : const AttributeList& rAttribs );
126 :
127 : virtual ::oox::core::ContextHandlerRef
128 : onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
129 :
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 );
143 :
144 : protected:
145 : ShapeBase& mrShape;
146 :
147 : private:
148 : ShapeModel& mrShapeModel;
149 : };
150 :
151 :
152 :
153 136 : class GroupShapeContext : public ShapeContext
154 : {
155 : public:
156 : explicit GroupShapeContext(
157 : ::oox::core::ContextHandler2Helper& rParent,
158 : GroupShape& rShape,
159 : const AttributeList& rAttribs );
160 :
161 : virtual ::oox::core::ContextHandlerRef
162 : onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
163 :
164 : private:
165 : ShapeContainer& mrShapes;
166 : };
167 :
168 :
169 :
170 936 : class RectangleShapeContext : public ShapeContext
171 : {
172 : public:
173 : explicit RectangleShapeContext(
174 : ::oox::core::ContextHandler2Helper& rParent,
175 : const AttributeList& rAttribs,
176 : RectangleShape& rShape );
177 :
178 : virtual ::oox::core::ContextHandlerRef
179 : onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
180 : };
181 :
182 :
183 : } // namespace vml
184 : } // namespace oox
185 :
186 : #endif
187 :
188 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|