xref: /trunk/main/oox/inc/oox/vml/vmlshapecontext.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef OOX_VML_VMLSHAPECONTEXT_HXX
29 #define OOX_VML_VMLSHAPECONTEXT_HXX
30 
31 #include "oox/core/contexthandler2.hxx"
32 
33 namespace oox {
34 namespace vml {
35 
36 class Drawing;
37 
38 struct ShapeTypeModel;
39 class ShapeType;
40 
41 struct ClientData;
42 struct ShapeModel;
43 class ShapeBase;
44 class GroupShape;
45 
46 class ShapeContainer;
47 
48 // ============================================================================
49 
50 class ShapeLayoutContext : public ::oox::core::ContextHandler2
51 {
52 public:
53     explicit            ShapeLayoutContext(
54                             ::oox::core::ContextHandler2Helper& rParent,
55                             Drawing& rDrawing );
56 
57     virtual ::oox::core::ContextHandlerRef
58                         onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
59 
60 private:
61     Drawing&            mrDrawing;
62 };
63 
64 // ============================================================================
65 
66 class ClientDataContext : public ::oox::core::ContextHandler2
67 {
68 public:
69     explicit            ClientDataContext(
70                             ::oox::core::ContextHandler2Helper& rParent,
71                             ClientData& rClientData,
72                             const AttributeList& rAttribs );
73 
74     virtual ::oox::core::ContextHandlerRef
75                         onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
76     virtual void        onCharacters( const ::rtl::OUString& rChars );
77     virtual void        onEndElement();
78 
79 private:
80     ClientData&         mrClientData;
81     ::rtl::OUString     maElementText;
82 };
83 
84 // ============================================================================
85 
86 class ShapeContextBase : public ::oox::core::ContextHandler2
87 {
88 public:
89     static ::oox::core::ContextHandlerRef
90                         createShapeContext(
91                             ::oox::core::ContextHandler2Helper& rParent,
92                             ShapeContainer& rShapes,
93                             sal_Int32 nElement,
94                             const AttributeList& rAttribs );
95 
96 protected:
97     explicit            ShapeContextBase( ::oox::core::ContextHandler2Helper& rParent );
98 };
99 
100 // ============================================================================
101 
102 class ShapeTypeContext : public ShapeContextBase
103 {
104 public:
105     explicit            ShapeTypeContext(
106                             ::oox::core::ContextHandler2Helper& rParent,
107                             ShapeType& rShapeType,
108                             const AttributeList& rAttribs );
109 
110     virtual ::oox::core::ContextHandlerRef
111                         onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
112 
113 private:
114     /** Processes the 'style' attribute. */
115     void                setStyle( const ::rtl::OUString& rStyle );
116 
117     /** Resolve a relation identifier to a fragment path. */
118     OptValue< ::rtl::OUString > decodeFragmentPath( const AttributeList& rAttribs, sal_Int32 nToken ) const;
119 
120 private:
121     ShapeTypeModel&     mrTypeModel;
122 };
123 
124 // ============================================================================
125 
126 class ShapeContext : public ShapeTypeContext
127 {
128 public:
129     explicit            ShapeContext(
130                             ::oox::core::ContextHandler2Helper& rParent,
131                             ShapeBase& rShape,
132                             const AttributeList& rAttribs );
133 
134     virtual ::oox::core::ContextHandlerRef
135                         onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
136 
137 private:
138     /** Processes the 'points' attribute. */
139     void                setPoints( const ::rtl::OUString& rPoints );
140 
141 private:
142     ShapeModel&         mrShapeModel;
143 };
144 
145 // ============================================================================
146 
147 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 } // namespace vml
165 } // namespace oox
166 
167 #endif
168