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 <rtl/ustring.hxx>
26 #include <sal/types.h>
27 //#include <oox/dllapi.h>
31 namespace oox
{ class AttributeList
; }
37 struct ShapeTypeModel
;
49 class ShapeLayoutContext final
: public ::oox::core::ContextHandler2
52 explicit ShapeLayoutContext(
53 ::oox::core::ContextHandler2Helper
const & rParent
,
56 virtual ::oox::core::ContextHandlerRef
57 onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) override
;
64 class ClientDataContext final
: public ::oox::core::ContextHandler2
67 explicit ClientDataContext(
68 ::oox::core::ContextHandler2Helper
const & rParent
,
69 ClientData
& rClientData
,
70 const AttributeList
& rAttribs
);
72 virtual ::oox::core::ContextHandlerRef
73 onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) override
;
74 virtual void onCharacters( const OUString
& rChars
) override
;
75 virtual void onEndElement() override
;
78 ClientData
& mrClientData
;
79 OUString maElementText
;
83 class SAL_DLLPUBLIC_RTTI ShapeContextBase
: public ::oox::core::ContextHandler2
86 static ::oox::core::ContextHandlerRef
88 ::oox::core::ContextHandler2Helper
const & rParent
,
89 ShapeContainer
& rShapes
,
91 const AttributeList
& rAttribs
);
94 explicit ShapeContextBase( ::oox::core::ContextHandler2Helper
const & rParent
);
98 class SAL_DLLPUBLIC_RTTI ShapeTypeContext
: public ShapeContextBase
101 explicit ShapeTypeContext(
102 ::oox::core::ContextHandler2Helper
const & rParent
,
103 std::shared_ptr
<ShapeType
> const& pShapeType
,
104 const AttributeList
& rAttribs
);
106 virtual ::oox::core::ContextHandlerRef
107 onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) override
;
110 /** Processes the 'style' attribute. */
111 void setStyle( std::u16string_view rStyle
);
113 /** Resolve a relation identifier to a fragment path. */
114 std::optional
< OUString
> decodeFragmentPath( const AttributeList
& rAttribs
, sal_Int32 nToken
) const;
117 std::shared_ptr
<ShapeType
> m_pShapeType
;
118 ShapeTypeModel
& mrTypeModel
;
122 class SAL_DLLPUBLIC_RTTI ShapeContext
: public ShapeTypeContext
125 explicit ShapeContext(::oox::core::ContextHandler2Helper
const& rParent
,
126 const std::shared_ptr
<ShapeBase
>& pShape
, const AttributeList
& rAttribs
);
128 virtual ::oox::core::ContextHandlerRef
129 onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) override
;
131 void OOX_DLLPUBLIC
setWriterShape();
134 /** Processes the 'points' attribute. */
135 void setPoints( std::u16string_view rPoints
);
136 /** Processes the 'from' attribute. */
137 void setFrom( const OUString
& rPoints
);
138 /** Processes the 'to' attribute. */
139 void setTo( const OUString
& rPoints
);
140 /** Processes the 'control1' attribute. */
141 void setControl1( const OUString
& rPoints
);
142 /** Processes the 'control2' attribute. */
143 void setControl2( const OUString
& rPoints
);
144 /** Processes the 'path' attribute. */
145 void setVmlPath( const OUString
& rPath
);
146 /** Processes the 'href' attribute. */
147 void setHyperlink( const OUString
& rHyperlink
);
151 ShapeModel
& mrShapeModel
;
155 class GroupShapeContext final
: public ShapeContext
158 explicit GroupShapeContext(::oox::core::ContextHandler2Helper
const& rParent
,
159 const std::shared_ptr
<GroupShape
>& pShape
,
160 const AttributeList
& rAttribs
);
162 virtual ::oox::core::ContextHandlerRef
163 onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) override
;
166 ShapeContainer
& mrShapes
;
170 class RectangleShapeContext final
: public ShapeContext
173 explicit RectangleShapeContext(::oox::core::ContextHandler2Helper
const& rParent
,
174 const AttributeList
& rAttribs
,
175 const std::shared_ptr
<RectangleShape
>& pShape
);
177 virtual ::oox::core::ContextHandlerRef
178 onCreateContext( sal_Int32 nElement
, const AttributeList
& rAttribs
) override
;
181 class ControlShapeContext final
: public ShapeContextBase
184 explicit ControlShapeContext(
185 ::oox::core::ContextHandler2Helper
const & rParent
,
186 ShapeContainer
& rShapes
,
187 const AttributeList
& rAttribs
);
191 } // namespace oox::vml
195 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */