1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_OOX_VML_VMLSHAPECONTEXT_HXX
21 #define INCLUDED_OOX_VML_VMLSHAPECONTEXT_HXX
23 #include <oox/core/contexthandler.hxx>
24 #include <oox/core/contexthandler2.hxx>
25 #include <oox/helper/helper.hxx>
26 #include <rtl/ustring.hxx>
27 #include <sal/types.h>
29 namespace oox
{ class AttributeList
; }
35 struct ShapeTypeModel
;
47 class ShapeLayoutContext final
: public ::oox::core::ContextHandler2
50 explicit ShapeLayoutContext(
51 ::oox::core::ContextHandler2Helper
const & rParent
,
54 virtual ::oox::core::ContextHandlerRef
55 onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) override
;
62 class ClientDataContext final
: public ::oox::core::ContextHandler2
65 explicit ClientDataContext(
66 ::oox::core::ContextHandler2Helper
const & rParent
,
67 ClientData
& rClientData
,
68 const AttributeList
& rAttribs
);
70 virtual ::oox::core::ContextHandlerRef
71 onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) override
;
72 virtual void onCharacters( const OUString
& rChars
) override
;
73 virtual void onEndElement() override
;
76 ClientData
& mrClientData
;
77 OUString maElementText
;
81 class ShapeContextBase
: public ::oox::core::ContextHandler2
84 static ::oox::core::ContextHandlerRef
86 ::oox::core::ContextHandler2Helper
const & rParent
,
87 ShapeContainer
& rShapes
,
89 const AttributeList
& rAttribs
);
92 explicit ShapeContextBase( ::oox::core::ContextHandler2Helper
const & rParent
);
96 class ShapeTypeContext
: public ShapeContextBase
99 explicit ShapeTypeContext(
100 ::oox::core::ContextHandler2Helper
const & rParent
,
101 std::shared_ptr
<ShapeType
> const& pShapeType
,
102 const AttributeList
& rAttribs
);
104 virtual ::oox::core::ContextHandlerRef
105 onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) override
;
108 /** Processes the 'style' attribute. */
109 void setStyle( std::u16string_view rStyle
);
111 /** Resolve a relation identifier to a fragment path. */
112 std::optional
< OUString
> decodeFragmentPath( const AttributeList
& rAttribs
, sal_Int32 nToken
) const;
115 std::shared_ptr
<ShapeType
> m_pShapeType
;
116 ShapeTypeModel
& mrTypeModel
;
120 class ShapeContext
: public ShapeTypeContext
123 explicit ShapeContext(::oox::core::ContextHandler2Helper
const& rParent
,
124 const std::shared_ptr
<ShapeBase
>& pShape
, const AttributeList
& rAttribs
);
126 virtual ::oox::core::ContextHandlerRef
127 onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) override
;
130 /** Processes the 'points' attribute. */
131 void setPoints( std::u16string_view rPoints
);
132 /** Processes the 'from' attribute. */
133 void setFrom( const OUString
& rPoints
);
134 /** Processes the 'to' attribute. */
135 void setTo( const OUString
& rPoints
);
136 /** Processes the 'control1' attribute. */
137 void setControl1( const OUString
& rPoints
);
138 /** Processes the 'control2' attribute. */
139 void setControl2( const OUString
& rPoints
);
140 /** Processes the 'path' attribute. */
141 void setVmlPath( const OUString
& rPath
);
142 /** Processes the 'href' attribute. */
143 void setHyperlink( const OUString
& rHyperlink
);
147 ShapeModel
& mrShapeModel
;
151 class GroupShapeContext final
: public ShapeContext
154 explicit GroupShapeContext(::oox::core::ContextHandler2Helper
const& rParent
,
155 const std::shared_ptr
<GroupShape
>& pShape
,
156 const AttributeList
& rAttribs
);
158 virtual ::oox::core::ContextHandlerRef
159 onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) override
;
162 ShapeContainer
& mrShapes
;
166 class RectangleShapeContext final
: public ShapeContext
169 explicit RectangleShapeContext(::oox::core::ContextHandler2Helper
const& rParent
,
170 const AttributeList
& rAttribs
,
171 const std::shared_ptr
<RectangleShape
>& pShape
);
173 virtual ::oox::core::ContextHandlerRef
174 onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) override
;
177 class ControlShapeContext final
: public ShapeContextBase
180 explicit ControlShapeContext(
181 ::oox::core::ContextHandler2Helper
const & rParent
,
182 ShapeContainer
& rShapes
,
183 const AttributeList
& rAttribs
);
187 } // namespace oox::vml
191 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */