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_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX
21 #define INCLUDED_OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX
24 #include <unordered_map>
27 #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
28 #include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
29 #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
30 #include <com/sun/star/drawing/EnhancedCustomShapeGluePointType.hpp>
31 #include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
32 #include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
33 #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
34 #include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp>
35 #include <com/sun/star/beans/PropertyValues.hpp>
36 #include <com/sun/star/drawing/ProjectionMode.hpp>
37 #include <com/sun/star/drawing/XShape.hpp>
38 #include <com/sun/star/graphic/XGraphic.hpp>
39 #include <oox/core/xmlfilterbase.hxx>
40 #include <oox/drawingml/color.hxx>
41 #include <oox/helper/helper.hxx>
42 #include <oox/helper/propertymap.hxx>
43 #include <oox/token/tokens.hxx>
45 namespace oox
{ namespace drawingml
{
47 class CustomShapeProperties
;
49 typedef std::shared_ptr
< CustomShapeProperties
> CustomShapePropertiesPtr
;
51 struct CustomShapeGuide
60 com::sun::star::drawing::EnhancedCustomShapeParameterPair
63 // depending to the type (polar or not):
64 OptValue
< OUString
> gdRef1
; // gdRefX or gdRefR
65 OptValue
< com::sun::star::drawing::EnhancedCustomShapeParameter
>
67 OptValue
< com::sun::star::drawing::EnhancedCustomShapeParameter
>
69 OptValue
< OUString
> gdRef2
; // gdRefY or gdRefAng
70 OptValue
< com::sun::star::drawing::EnhancedCustomShapeParameter
>
71 min2
; // minX or minAng
72 OptValue
< com::sun::star::drawing::EnhancedCustomShapeParameter
>
73 max2
; // maxY or maxAng
75 AdjustHandle( bool bPolar
) : polar( bPolar
) {};
80 com::sun::star::drawing::EnhancedCustomShapeParameterPair
82 com::sun::star::drawing::EnhancedCustomShapeParameter
88 com::sun::star::drawing::EnhancedCustomShapeParameter l
;
89 com::sun::star::drawing::EnhancedCustomShapeParameter t
;
90 com::sun::star::drawing::EnhancedCustomShapeParameter r
;
91 com::sun::star::drawing::EnhancedCustomShapeParameter b
;
101 std::vector
< com::sun::star::drawing::EnhancedCustomShapeParameterPair
> parameter
;
103 Path2D() : w( 0 ), h( 0 ), fill( XML_norm
), stroke( true ), extrusionOk( true ) {};
107 class CustomShapeProperties
111 CustomShapeProperties();
112 virtual ~CustomShapeProperties();
114 void pushToPropSet( const ::oox::core::FilterBase
& rFilterBase
,
115 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
> & xPropSet
,
116 const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
> & xShape
, const ::com::sun::star::awt::Size
&aSize
);
118 sal_Int32
getShapePresetType() const { return mnShapePresetType
; }
119 css::uno::Sequence
< sal_Int8
> getShapePresetTypeName() const;
120 void setShapePresetType( sal_Int32 nShapePresetType
){ mnShapePresetType
= nShapePresetType
; };
121 bool getShapeTypeOverride(){ return mbShapeTypeOverride
; };
122 void setShapeTypeOverride( bool bShapeTypeOverride
) { mbShapeTypeOverride
= bShapeTypeOverride
; };
124 std::vector
< CustomShapeGuide
>& getAdjustmentGuideList(){ return maAdjustmentGuideList
; };
125 std::vector
< CustomShapeGuide
>& getGuideList(){ return maGuideList
; };
126 std::vector
< AdjustHandle
>& getAdjustHandleList(){ return maAdjustHandleList
; };
127 std::vector
< ConnectionSite
>& getConnectionSiteList(){ return maConnectionSiteList
; };
128 OptValue
< GeomRect
>& getTextRect(){ return maTextRect
; };
129 std::vector
< Path2D
>& getPath2DList(){ return maPath2DList
; };
130 std::vector
< com::sun::star::drawing::EnhancedCustomShapeSegment
>& getSegments(){ return maSegments
; };
131 void setMirroredX( bool bMirroredX
) { mbMirroredX
= bMirroredX
; };
132 void setMirroredY( bool bMirroredY
) { mbMirroredY
= bMirroredY
; };
133 void setTextRotateAngle( sal_Int32 nAngle
) { mnTextRotateAngle
= nAngle
; };
135 static sal_Int32
SetCustomShapeGuideValue( std::vector
< CustomShapeGuide
>& rGuideList
, const CustomShapeGuide
& rGuide
);
136 static sal_Int32
GetCustomShapeGuideValue( const std::vector
< CustomShapeGuide
>& rGuideList
, const OUString
& rFormulaName
);
138 sal_Int32
getArcNum() { return mnArcNum
++; }
142 sal_Int32 mnShapePresetType
;
143 bool mbShapeTypeOverride
;
144 std::vector
< CustomShapeGuide
> maAdjustmentGuideList
;
145 std::vector
< CustomShapeGuide
> maGuideList
;
146 std::vector
< AdjustHandle
> maAdjustHandleList
;
147 std::vector
< ConnectionSite
> maConnectionSiteList
;
148 OptValue
< GeomRect
> maTextRect
;
149 std::vector
< Path2D
> maPath2DList
;
151 std::vector
< com::sun::star::drawing::EnhancedCustomShapeSegment
>
155 sal_Int32 mnTextRotateAngle
;
157 typedef std::unordered_map
< sal_Int32
, PropertyMap
> PresetDataMap
;
159 static PresetDataMap maPresetDataMap
;
160 static void initializePresetDataMap();
167 #endif // INCLUDED_OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX
169 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */