bump product version to 6.3.0.0.beta1
[LibreOffice.git] / oox / inc / drawingml / customshapeproperties.hxx
blobddd29199ff41105d2059de69dc71daf8776075dc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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
23 #include <memory>
24 #include <unordered_map>
25 #include <vector>
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
41 OUString maName;
42 OUString maFormula;
45 struct AdjustHandle
47 bool polar;
48 css::drawing::EnhancedCustomShapeParameterPair
49 pos;
51 // depending to the type (polar or not):
52 OptValue< OUString > gdRef1; // gdRefX or gdRefR
53 OptValue< css::drawing::EnhancedCustomShapeParameter >
54 min1; // minX or minR
55 OptValue< css::drawing::EnhancedCustomShapeParameter >
56 max1; // maxX or maxR
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 ) {};
66 struct ConnectionSite
68 css::drawing::EnhancedCustomShapeParameterPair
69 pos;
70 css::drawing::EnhancedCustomShapeParameter
71 ang;
74 struct GeomRect
76 css::drawing::EnhancedCustomShapeParameter l;
77 css::drawing::EnhancedCustomShapeParameter t;
78 css::drawing::EnhancedCustomShapeParameter r;
79 css::drawing::EnhancedCustomShapeParameter b;
82 struct Path2D
84 sal_Int64 w;
85 sal_Int64 h;
86 sal_Int32 fill;
87 bool stroke;
88 bool extrusionOk;
89 std::vector< css::drawing::EnhancedCustomShapeParameterPair > parameter;
91 Path2D() : w( 0 ), h( 0 ), fill( XML_norm ), stroke( true ), extrusionOk( true ) {};
95 class CustomShapeProperties final
97 public:
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(){ 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; };
122 static sal_Int32 SetCustomShapeGuideValue( std::vector< CustomShapeGuide >& rGuideList, const CustomShapeGuide& rGuide );
123 static sal_Int32 GetCustomShapeGuideValue( const std::vector< CustomShapeGuide >& rGuideList, const OUString& rFormulaName );
125 sal_Int32 getArcNum() { return mnArcNum++; }
127 private:
129 sal_Int32 mnShapePresetType;
130 bool mbShapeTypeOverride;
131 std::vector< CustomShapeGuide > maAdjustmentGuideList;
132 std::vector< CustomShapeGuide > maGuideList;
133 std::vector< AdjustHandle > maAdjustHandleList;
134 std::vector< ConnectionSite > maConnectionSiteList;
135 OptValue< GeomRect > maTextRect;
136 std::vector< Path2D > maPath2DList;
138 std::vector< css::drawing::EnhancedCustomShapeSegment >
139 maSegments;
140 bool mbMirroredX;
141 bool mbMirroredY;
142 sal_Int32 mnTextRotateAngle;
144 typedef std::unordered_map< sal_Int32, PropertyMap > PresetDataMap;
146 static PresetDataMap maPresetDataMap;
147 static void initializePresetDataMap();
149 sal_Int32 mnArcNum;
154 #endif // INCLUDED_OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */