LibreOffice Module oox (master)  1
vmlshapecontext.hxx
Go to the documentation of this file.
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 
25 #include <oox/helper/helper.hxx>
26 #include <rtl/ustring.hxx>
27 #include <sal/types.h>
28 
29 namespace oox { class AttributeList; }
30 
31 namespace oox::vml {
32 
33 class Drawing;
34 
35 struct ShapeTypeModel;
36 class ShapeType;
37 
38 struct ClientData;
39 struct ShapeModel;
40 class ShapeBase;
41 class GroupShape;
42 class RectangleShape;
43 
44 class ShapeContainer;
45 
46 
48 {
49 public:
50  explicit ShapeLayoutContext(
51  ::oox::core::ContextHandler2Helper const & rParent,
52  Drawing& rDrawing );
53 
55  onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
56 
57 private:
59 };
60 
61 
63 {
64 public:
65  explicit ClientDataContext(
66  ::oox::core::ContextHandler2Helper const & rParent,
67  ClientData& rClientData,
68  const AttributeList& rAttribs );
69 
71  onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
72  virtual void onCharacters( const OUString& rChars ) override;
73  virtual void onEndElement() override;
74 
75 private:
77  OUString maElementText;
78 };
79 
80 
82 {
83 public:
86  ::oox::core::ContextHandler2Helper const & rParent,
87  ShapeContainer& rShapes,
88  sal_Int32 nElement,
89  const AttributeList& rAttribs );
90 
91 protected:
92  explicit ShapeContextBase( ::oox::core::ContextHandler2Helper const & rParent );
93 };
94 
95 
97 {
98 public:
99  explicit ShapeTypeContext(
100  ::oox::core::ContextHandler2Helper const & rParent,
101  std::shared_ptr<ShapeType> const& pShapeType,
102  const AttributeList& rAttribs );
103 
105  onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
106 
107 private:
109  void setStyle( const OUString& rStyle );
110 
112  OptValue< OUString > decodeFragmentPath( const AttributeList& rAttribs, sal_Int32 nToken ) const;
113 
114 private:
115  std::shared_ptr<ShapeType> m_pShapeType;
117 };
118 
119 
121 {
122 public:
123  explicit ShapeContext(::oox::core::ContextHandler2Helper const& rParent,
124  const std::shared_ptr<ShapeBase>& pShape, const AttributeList& rAttribs);
125 
127  onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
128 
129 private:
131  void setPoints( const OUString& rPoints );
133  void setFrom( const OUString& rPoints );
135  void setTo( const OUString& rPoints );
137  void setControl1( const OUString& rPoints );
139  void setControl2( const OUString& rPoints );
141  void setVmlPath( const OUString& rPath );
142 
143 private:
146 };
147 
148 
149 class GroupShapeContext final : public ShapeContext
150 {
151 public:
152  explicit GroupShapeContext(::oox::core::ContextHandler2Helper const& rParent,
153  const std::shared_ptr<GroupShape>& pShape,
154  const AttributeList& rAttribs);
155 
157  onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
158 
159 private:
161 };
162 
163 
165 {
166 public:
168  const AttributeList& rAttribs,
169  const std::shared_ptr<RectangleShape>& pShape);
170 
172  onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) override;
173 };
174 
176 {
177 public:
178  explicit ControlShapeContext(
179  ::oox::core::ContextHandler2Helper const & rParent,
180  ShapeContainer& rShapes,
181  const AttributeList& rAttribs );
182 };
183 
184 
185 } // namespace oox::vml
186 
187 #endif
188 
189 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OptValue< OUString > decodeFragmentPath(const AttributeList &rAttribs, sal_Int32 nToken) const
Resolve a relation identifier to a fragment path.
The shape model structure contains all properties shared by all types of shapes.
Definition: vmlshape.hxx:60
A shape object that is part of a drawing.
Definition: vmlshape.hxx:233
ShapeContextBase(::oox::core::ContextHandler2Helper const &rParent)
virtual void onCharacters(const OUString &rChars) override
Will be called before a new child element starts, or if the current element is about to be left...
Excel specific shape client data (such as cell anchor).
Definition: vmlshape.hxx:161
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
Will be called to create a context handler for the passed element.
virtual void onEndElement() override
Will be called when the current element is about to be left.
ShapeTypeContext(::oox::core::ContextHandler2Helper const &rParent, std::shared_ptr< ShapeType > const &pShapeType, const AttributeList &rAttribs)
ShapeLayoutContext(::oox::core::ContextHandler2Helper const &rParent, Drawing &rDrawing)
::oox::core::ContextHandlerRef createShapeContext(::oox::core::ContextHandler2Helper const &rParent, ShapeContainer &rShapes, sal_Int32 nElement, const AttributeList &rAttribs)
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
Will be called to create a context handler for the passed element.
::cppu::WeakComponentImplHelper< css::report::XShape, css::lang::XServiceInfo > ShapeBase
ControlShapeContext(::oox::core::ContextHandler2Helper const &rParent, ShapeContainer &rShapes, const AttributeList &rAttribs)
std::shared_ptr< ShapeType > m_pShapeType
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
Will be called to create a context handler for the passed element.
RectangleShapeContext(::oox::core::ContextHandler2Helper const &rParent, const AttributeList &rAttribs, const std::shared_ptr< RectangleShape > &pShape)
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
Will be called to create a context handler for the passed element.
Container that holds a list of shapes and shape templates.
void setPoints(const OUString &rPoints)
Processes the 'points' attribute.
ShapeContext(::oox::core::ContextHandler2Helper const &rParent, const std::shared_ptr< ShapeBase > &pShape, const AttributeList &rAttribs)
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
Will be called to create a context handler for the passed element.
void setStyle(const OUString &rStyle)
Processes the 'style' attribute.
ClientDataContext(::oox::core::ContextHandler2Helper const &rParent, ClientData &rClientData, const AttributeList &rAttribs)
Provides access to attribute values of an element.
DefTokenId nToken
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElement, const AttributeList &rAttribs) override
Will be called to create a context handler for the passed element.
void setControl2(const OUString &rPoints)
Processes the 'control2' attribute.
::rtl::Reference< ContextHandler > ContextHandlerRef
void setTo(const OUString &rPoints)
Processes the 'to' attribute.
void setFrom(const OUString &rPoints)
Processes the 'from' attribute.
Represents the collection of VML shapes for a complete draw page.
Definition: vmldrawing.hxx:93
void setControl1(const OUString &rPoints)
Processes the 'control1' attribute.
Helper class that provides a context stack.
void setVmlPath(const OUString &rPath)
Processes the 'path' attribute.
GroupShapeContext(::oox::core::ContextHandler2Helper const &rParent, const std::shared_ptr< GroupShape > &pShape, const AttributeList &rAttribs)