Branch data 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 OOX_VML_VMLSHAPECONTEXT_HXX
21 : : #define 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 [ - + ]: 6 : 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 );
52 : :
53 : : private:
54 : : Drawing& mrDrawing;
55 : : };
56 : :
57 : : // ============================================================================
58 : :
59 [ - + ]: 12 : 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 );
69 : : virtual void onCharacters( const ::rtl::OUString& rChars );
70 : : virtual void onEndElement();
71 : :
72 : : private:
73 : : ClientData& mrClientData;
74 : : ::rtl::OUString maElementText;
75 : : };
76 : :
77 : : // ============================================================================
78 : :
79 [ - + ]: 87 : 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 [ - + ]: 117 : 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 );
105 : :
106 : : private:
107 : : /** Processes the 'style' attribute. */
108 : : void setStyle( const ::rtl::OUString& rStyle );
109 : :
110 : : /** Resolve a relation identifier to a fragment path. */
111 : : OptValue< ::rtl::OUString > decodeFragmentPath( const AttributeList& rAttribs, sal_Int32 nToken ) const;
112 : :
113 : : private:
114 : : ShapeTypeModel& mrTypeModel;
115 : : };
116 : :
117 : : // ============================================================================
118 : :
119 [ - + ]: 96 : 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 );
129 : :
130 : : private:
131 : : /** Processes the 'points' attribute. */
132 : : void setPoints( const ::rtl::OUString& rPoints );
133 : : /** Processes the 'from' attribute. */
134 : : void setFrom( const ::rtl::OUString& rPoints );
135 : : /** Processes the 'to' attribute. */
136 : : void setTo( const ::rtl::OUString& rPoints );
137 : :
138 : : protected:
139 : : ShapeBase& mrShape;
140 : :
141 : : private:
142 : : ShapeModel& mrShapeModel;
143 : : };
144 : :
145 : : // ============================================================================
146 : :
147 [ - + ]: 12 : class GroupShapeContext : public ShapeContext
148 : : {
149 : : public:
150 : : explicit GroupShapeContext(
151 : : ::oox::core::ContextHandler2Helper& rParent,
152 : : GroupShape& rShape,
153 : : const AttributeList& rAttribs );
154 : :
155 : : virtual ::oox::core::ContextHandlerRef
156 : : onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
157 : :
158 : : private:
159 : : ShapeContainer& mrShapes;
160 : : };
161 : :
162 : : // ============================================================================
163 : :
164 [ - + ]: 24 : class RectangleShapeContext : public ShapeContext
165 : : {
166 : : public:
167 : : explicit RectangleShapeContext(
168 : : ::oox::core::ContextHandler2Helper& rParent,
169 : : const AttributeList& rAttribs,
170 : : RectangleShape& rShape );
171 : :
172 : : virtual ::oox::core::ContextHandlerRef
173 : : onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
174 : : };
175 : : // ============================================================================
176 : :
177 : : } // namespace vml
178 : : } // namespace oox
179 : :
180 : : #endif
181 : :
182 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|