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>
26 #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
27 #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
28 #include <com/sun/star/drawing/XShape.hpp>
29 #include <oox/helper/helper.hxx>
30 #include <oox/helper/propertymap.hxx>
31 #include <oox/token/tokens.hxx>
33 namespace oox
{ namespace drawingml
{
35 class CustomShapeProperties
;
37 typedef std::shared_ptr
< CustomShapeProperties
> CustomShapePropertiesPtr
;
39 struct CustomShapeGuide
48 css::drawing::EnhancedCustomShapeParameterPair
51 // depending to the type (polar or not):
52 OptValue
< OUString
> gdRef1
; // gdRefX or gdRefR
53 OptValue
< css::drawing::EnhancedCustomShapeParameter
>
55 OptValue
< css::drawing::EnhancedCustomShapeParameter
>
57 OptValue
< OUString
> gdRef2
; // gdRefY or gdRefAng
58 OptValue
< css::drawing::EnhancedCustomShapeParameter
>
59 min2
; // minX or minAng
60 OptValue
< css::drawing::EnhancedCustomShapeParameter
>
61 max2
; // maxY or maxAng
63 AdjustHandle( bool bPolar
) : polar( bPolar
) {};
68 css::drawing::EnhancedCustomShapeParameterPair
70 css::drawing::EnhancedCustomShapeParameter
76 css::drawing::EnhancedCustomShapeParameter l
;
77 css::drawing::EnhancedCustomShapeParameter t
;
78 css::drawing::EnhancedCustomShapeParameter r
;
79 css::drawing::EnhancedCustomShapeParameter b
;
89 std::vector
< css::drawing::EnhancedCustomShapeParameterPair
> parameter
;
91 Path2D() : w( 0 ), h( 0 ), fill( XML_norm
), stroke( true ), extrusionOk( true ) {};
95 class CustomShapeProperties final
98 CustomShapeProperties();
99 ~CustomShapeProperties();
101 void pushToPropSet( const css::uno::Reference
< css::beans::XPropertySet
> & xPropSet
,
102 const css::uno::Reference
< css::drawing::XShape
> & xShape
,
103 const css::awt::Size
&aSize
);
105 sal_Int32
getShapePresetType() const { return mnShapePresetType
; }
106 css::uno::Sequence
< sal_Int8
> const & getShapePresetTypeName() const;
107 void setShapePresetType( sal_Int32 nShapePresetType
){ mnShapePresetType
= nShapePresetType
; };
108 bool getShapeTypeOverride() const { return mbShapeTypeOverride
; };
109 void setShapeTypeOverride( bool bShapeTypeOverride
) { mbShapeTypeOverride
= bShapeTypeOverride
; };
111 std::vector
< CustomShapeGuide
>& getAdjustmentGuideList(){ return maAdjustmentGuideList
; };
112 std::vector
< CustomShapeGuide
>& getGuideList(){ return maGuideList
; };
113 std::vector
< AdjustHandle
>& getAdjustHandleList(){ return maAdjustHandleList
; };
114 std::vector
< ConnectionSite
>& getConnectionSiteList(){ return maConnectionSiteList
; };
115 OptValue
< GeomRect
>& getTextRect(){ return maTextRect
; };
116 std::vector
< Path2D
>& getPath2DList(){ return maPath2DList
; };
117 std::vector
< css::drawing::EnhancedCustomShapeSegment
>& getSegments(){ return maSegments
; };
118 void setMirroredX( bool bMirroredX
) { mbMirroredX
= bMirroredX
; };
119 void setMirroredY( bool bMirroredY
) { mbMirroredY
= bMirroredY
; };
120 void setTextRotateAngle( sal_Int32 nAngle
) { mnTextRotateAngle
= nAngle
; };
121 void setTextCameraZRotateAngle( sal_Int32 nAngle
) { mnTextCameraZRotateAngle
= nAngle
; };
123 static sal_Int32
SetCustomShapeGuideValue( std::vector
< CustomShapeGuide
>& rGuideList
, const CustomShapeGuide
& rGuide
);
124 static sal_Int32
GetCustomShapeGuideValue( const std::vector
< CustomShapeGuide
>& rGuideList
, const OUString
& rFormulaName
);
126 sal_Int32
getArcNum() { return mnArcNum
++; }
130 sal_Int32 mnShapePresetType
;
131 bool mbShapeTypeOverride
;
132 std::vector
< CustomShapeGuide
> maAdjustmentGuideList
;
133 std::vector
< CustomShapeGuide
> maGuideList
;
134 std::vector
< AdjustHandle
> maAdjustHandleList
;
135 std::vector
< ConnectionSite
> maConnectionSiteList
;
136 OptValue
< GeomRect
> maTextRect
;
137 std::vector
< Path2D
> maPath2DList
;
139 std::vector
< css::drawing::EnhancedCustomShapeSegment
>
143 sal_Int32 mnTextRotateAngle
;
144 sal_Int32 mnTextCameraZRotateAngle
;
146 typedef std::unordered_map
< sal_Int32
, PropertyMap
> PresetDataMap
;
148 static PresetDataMap maPresetDataMap
;
149 static void initializePresetDataMap();
156 #endif // INCLUDED_OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX
158 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */