xref: /trunk/main/oox/inc/oox/vml/vmlshapecontext.hxx (revision e3508121)
1*e3508121SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*e3508121SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*e3508121SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*e3508121SAndrew Rist  * distributed with this work for additional information
6*e3508121SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*e3508121SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*e3508121SAndrew Rist  * "License"); you may not use this file except in compliance
9*e3508121SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*e3508121SAndrew Rist  *
11*e3508121SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*e3508121SAndrew Rist  *
13*e3508121SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*e3508121SAndrew Rist  * software distributed under the License is distributed on an
15*e3508121SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*e3508121SAndrew Rist  * KIND, either express or implied.  See the License for the
17*e3508121SAndrew Rist  * specific language governing permissions and limitations
18*e3508121SAndrew Rist  * under the License.
19*e3508121SAndrew Rist  *
20*e3508121SAndrew Rist  *************************************************************/
21*e3508121SAndrew Rist 
22*e3508121SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef OOX_VML_VMLSHAPECONTEXT_HXX
25cdf0e10cSrcweir #define OOX_VML_VMLSHAPECONTEXT_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "oox/core/contexthandler2.hxx"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir namespace oox {
30cdf0e10cSrcweir namespace vml {
31cdf0e10cSrcweir 
32cdf0e10cSrcweir class Drawing;
33cdf0e10cSrcweir 
34cdf0e10cSrcweir struct ShapeTypeModel;
35cdf0e10cSrcweir class ShapeType;
36cdf0e10cSrcweir 
37cdf0e10cSrcweir struct ClientData;
38cdf0e10cSrcweir struct ShapeModel;
39cdf0e10cSrcweir class ShapeBase;
40cdf0e10cSrcweir class GroupShape;
41cdf0e10cSrcweir 
42cdf0e10cSrcweir class ShapeContainer;
43cdf0e10cSrcweir 
44cdf0e10cSrcweir // ============================================================================
45cdf0e10cSrcweir 
46cdf0e10cSrcweir class ShapeLayoutContext : public ::oox::core::ContextHandler2
47cdf0e10cSrcweir {
48cdf0e10cSrcweir public:
49cdf0e10cSrcweir     explicit            ShapeLayoutContext(
50cdf0e10cSrcweir                             ::oox::core::ContextHandler2Helper& rParent,
51cdf0e10cSrcweir                             Drawing& rDrawing );
52cdf0e10cSrcweir 
53cdf0e10cSrcweir     virtual ::oox::core::ContextHandlerRef
54cdf0e10cSrcweir                         onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
55cdf0e10cSrcweir 
56cdf0e10cSrcweir private:
57cdf0e10cSrcweir     Drawing&            mrDrawing;
58cdf0e10cSrcweir };
59cdf0e10cSrcweir 
60cdf0e10cSrcweir // ============================================================================
61cdf0e10cSrcweir 
62cdf0e10cSrcweir class ClientDataContext : public ::oox::core::ContextHandler2
63cdf0e10cSrcweir {
64cdf0e10cSrcweir public:
65cdf0e10cSrcweir     explicit            ClientDataContext(
66cdf0e10cSrcweir                             ::oox::core::ContextHandler2Helper& rParent,
67cdf0e10cSrcweir                             ClientData& rClientData,
68cdf0e10cSrcweir                             const AttributeList& rAttribs );
69cdf0e10cSrcweir 
70cdf0e10cSrcweir     virtual ::oox::core::ContextHandlerRef
71cdf0e10cSrcweir                         onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
72cdf0e10cSrcweir     virtual void        onCharacters( const ::rtl::OUString& rChars );
73cdf0e10cSrcweir     virtual void        onEndElement();
74cdf0e10cSrcweir 
75cdf0e10cSrcweir private:
76cdf0e10cSrcweir     ClientData&         mrClientData;
77cdf0e10cSrcweir     ::rtl::OUString     maElementText;
78cdf0e10cSrcweir };
79cdf0e10cSrcweir 
80cdf0e10cSrcweir // ============================================================================
81cdf0e10cSrcweir 
82cdf0e10cSrcweir class ShapeContextBase : public ::oox::core::ContextHandler2
83cdf0e10cSrcweir {
84cdf0e10cSrcweir public:
85cdf0e10cSrcweir     static ::oox::core::ContextHandlerRef
86cdf0e10cSrcweir                         createShapeContext(
87cdf0e10cSrcweir                             ::oox::core::ContextHandler2Helper& rParent,
88cdf0e10cSrcweir                             ShapeContainer& rShapes,
89cdf0e10cSrcweir                             sal_Int32 nElement,
90cdf0e10cSrcweir                             const AttributeList& rAttribs );
91cdf0e10cSrcweir 
92cdf0e10cSrcweir protected:
93cdf0e10cSrcweir     explicit            ShapeContextBase( ::oox::core::ContextHandler2Helper& rParent );
94cdf0e10cSrcweir };
95cdf0e10cSrcweir 
96cdf0e10cSrcweir // ============================================================================
97cdf0e10cSrcweir 
98cdf0e10cSrcweir class ShapeTypeContext : public ShapeContextBase
99cdf0e10cSrcweir {
100cdf0e10cSrcweir public:
101cdf0e10cSrcweir     explicit            ShapeTypeContext(
102cdf0e10cSrcweir                             ::oox::core::ContextHandler2Helper& rParent,
103cdf0e10cSrcweir                             ShapeType& rShapeType,
104cdf0e10cSrcweir                             const AttributeList& rAttribs );
105cdf0e10cSrcweir 
106cdf0e10cSrcweir     virtual ::oox::core::ContextHandlerRef
107cdf0e10cSrcweir                         onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
108cdf0e10cSrcweir 
109cdf0e10cSrcweir private:
110cdf0e10cSrcweir     /** Processes the 'style' attribute. */
111cdf0e10cSrcweir     void                setStyle( const ::rtl::OUString& rStyle );
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     /** Resolve a relation identifier to a fragment path. */
114cdf0e10cSrcweir     OptValue< ::rtl::OUString > decodeFragmentPath( const AttributeList& rAttribs, sal_Int32 nToken ) const;
115cdf0e10cSrcweir 
116cdf0e10cSrcweir private:
117cdf0e10cSrcweir     ShapeTypeModel&     mrTypeModel;
118cdf0e10cSrcweir };
119cdf0e10cSrcweir 
120cdf0e10cSrcweir // ============================================================================
121cdf0e10cSrcweir 
122cdf0e10cSrcweir class ShapeContext : public ShapeTypeContext
123cdf0e10cSrcweir {
124cdf0e10cSrcweir public:
125cdf0e10cSrcweir     explicit            ShapeContext(
126cdf0e10cSrcweir                             ::oox::core::ContextHandler2Helper& rParent,
127cdf0e10cSrcweir                             ShapeBase& rShape,
128cdf0e10cSrcweir                             const AttributeList& rAttribs );
129cdf0e10cSrcweir 
130cdf0e10cSrcweir     virtual ::oox::core::ContextHandlerRef
131cdf0e10cSrcweir                         onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
132cdf0e10cSrcweir 
133cdf0e10cSrcweir private:
134cdf0e10cSrcweir     /** Processes the 'points' attribute. */
135cdf0e10cSrcweir     void                setPoints( const ::rtl::OUString& rPoints );
136cdf0e10cSrcweir 
137cdf0e10cSrcweir private:
138cdf0e10cSrcweir     ShapeModel&         mrShapeModel;
139cdf0e10cSrcweir };
140cdf0e10cSrcweir 
141cdf0e10cSrcweir // ============================================================================
142cdf0e10cSrcweir 
143cdf0e10cSrcweir class GroupShapeContext : public ShapeContext
144cdf0e10cSrcweir {
145cdf0e10cSrcweir public:
146cdf0e10cSrcweir     explicit            GroupShapeContext(
147cdf0e10cSrcweir                             ::oox::core::ContextHandler2Helper& rParent,
148cdf0e10cSrcweir                             GroupShape& rShape,
149cdf0e10cSrcweir                             const AttributeList& rAttribs );
150cdf0e10cSrcweir 
151cdf0e10cSrcweir     virtual ::oox::core::ContextHandlerRef
152cdf0e10cSrcweir                         onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
153cdf0e10cSrcweir 
154cdf0e10cSrcweir private:
155cdf0e10cSrcweir     ShapeContainer&     mrShapes;
156cdf0e10cSrcweir };
157cdf0e10cSrcweir 
158cdf0e10cSrcweir // ============================================================================
159cdf0e10cSrcweir 
160cdf0e10cSrcweir } // namespace vml
161cdf0e10cSrcweir } // namespace oox
162cdf0e10cSrcweir 
163cdf0e10cSrcweir #endif
164