LibreOffice Module oox (master) 1
customshapeproperties.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#ifndef INCLUDED_OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX
21#define INCLUDED_OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX
22
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>
31#include <oox/token/tokens.hxx>
32
33namespace oox::drawingml {
34
35class CustomShapeProperties;
36
37typedef std::shared_ptr< CustomShapeProperties > CustomShapePropertiesPtr;
38
40{
41 OUString maName;
42 OUString maFormula;
43};
44
46{
47 bool polar;
48 css::drawing::EnhancedCustomShapeParameterPair
50
51 // depending to the type (polar or not):
52 std::optional< OUString > gdRef1; // gdRefX or gdRefR
53 std::optional< css::drawing::EnhancedCustomShapeParameter >
54 min1; // minX or minR
55 std::optional< css::drawing::EnhancedCustomShapeParameter >
56 max1; // maxX or maxR
57 std::optional< OUString > gdRef2; // gdRefY or gdRefAng
58 std::optional< css::drawing::EnhancedCustomShapeParameter >
59 min2; // minX or minAng
60 std::optional< css::drawing::EnhancedCustomShapeParameter >
61 max2; // maxY or maxAng
62
63 AdjustHandle( bool bPolar ) : polar( bPolar ) {};
64};
65
67{
68 css::drawing::EnhancedCustomShapeParameterPair
70 css::drawing::EnhancedCustomShapeParameter
72};
73
75{
76 css::drawing::EnhancedCustomShapeParameter l;
77 css::drawing::EnhancedCustomShapeParameter t;
78 css::drawing::EnhancedCustomShapeParameter r;
79 css::drawing::EnhancedCustomShapeParameter b;
80};
81
82struct Path2D
83{
84 sal_Int64 w;
85 sal_Int64 h;
86 sal_Int32 fill;
87 bool stroke;
89 std::vector< css::drawing::EnhancedCustomShapeParameterPair > parameter;
90
91 Path2D() : w( 0 ), h( 0 ), fill( XML_norm ), stroke( true ), extrusionOk( true ) {};
92};
93
94
96{
97public:
99
100 void pushToPropSet( const css::uno::Reference < css::beans::XPropertySet > & xPropSet,
101 const css::awt::Size &aSize );
102
103 sal_Int32 getShapePresetType() const { return mnShapePresetType; }
104 css::uno::Sequence< sal_Int8 > const & getShapePresetTypeName() const;
105 void setShapePresetType( sal_Int32 nShapePresetType ){ mnShapePresetType = nShapePresetType; };
107 void setShapeTypeOverride( bool bShapeTypeOverride ) { mbShapeTypeOverride = bShapeTypeOverride; };
108
109 std::vector< CustomShapeGuide >& getAdjustmentGuideList(){ return maAdjustmentGuideList; };
110 std::vector< CustomShapeGuide >& getGuideList(){ return maGuideList; };
111 std::vector< AdjustHandle >& getAdjustHandleList(){ return maAdjustHandleList; };
112 std::vector< ConnectionSite >& getConnectionSiteList(){ return maConnectionSiteList; };
113 std::optional< GeomRect >& getTextRect(){ return maTextRect; };
114 std::vector< Path2D >& getPath2DList(){ return maPath2DList; };
115 std::vector< css::drawing::EnhancedCustomShapeSegment >& getSegments(){ return maSegments; };
116 void setMirroredX( bool bMirroredX ) { mbMirroredX = bMirroredX; };
117 void setMirroredY( bool bMirroredY ) { mbMirroredY = bMirroredY; };
118 void setTextPreRotateAngle( sal_Int32 nAngle ) { mnTextPreRotateAngle = nAngle; };
119 void setTextCameraZRotateAngle( sal_Int32 nAngle ) { mnTextCameraZRotateAngle = nAngle; };
120 void setTextAreaRotateAngle(sal_Int32 nAngle) { moTextAreaRotateAngle = nAngle; };
121
122 static sal_Int32 SetCustomShapeGuideValue( std::vector< CustomShapeGuide >& rGuideList, const CustomShapeGuide& rGuide );
123 static sal_Int32 GetCustomShapeGuideValue( const std::vector< CustomShapeGuide >& rGuideList, std::u16string_view rFormulaName );
124
125 sal_Int32 getArcNum() { return mnArcNum++; }
126 sal_Int32 countArcTo() { return mnArcNum; }
127
132 bool representsDefaultShape() const;
133
134private:
135
138 std::vector< CustomShapeGuide > maAdjustmentGuideList;
139 std::vector< CustomShapeGuide > maGuideList;
140 std::vector< AdjustHandle > maAdjustHandleList;
141 std::vector< ConnectionSite > maConnectionSiteList;
142 std::optional< GeomRect > maTextRect;
143 std::vector< Path2D > maPath2DList;
144
145 std::vector< css::drawing::EnhancedCustomShapeSegment >
149 sal_Int32 mnTextPreRotateAngle; // TextPreRotateAngle
151 std::optional< sal_Int32 > moTextAreaRotateAngle; // TextRotateAngle
152
153 typedef std::unordered_map< sal_Int32, PropertyMap > PresetDataMap;
154
156 static void initializePresetDataMap();
157
158 sal_Int32 mnArcNum;
159};
160
161}
162
163#endif // INCLUDED_OOX_DRAWINGML_CUSTOMSHAPEPROPERTIES_HXX
164
165/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::vector< css::drawing::EnhancedCustomShapeSegment > & getSegments()
std::vector< ConnectionSite > & getConnectionSiteList()
std::optional< sal_Int32 > moTextAreaRotateAngle
void setShapePresetType(sal_Int32 nShapePresetType)
void pushToPropSet(const css::uno::Reference< css::beans::XPropertySet > &xPropSet, const css::awt::Size &aSize)
bool representsDefaultShape() const
Returns whether or not the current CustomShapeProperties represent a default shape preset that is rec...
void setShapeTypeOverride(bool bShapeTypeOverride)
std::unordered_map< sal_Int32, PropertyMap > PresetDataMap
std::vector< CustomShapeGuide > & getGuideList()
std::optional< GeomRect > & getTextRect()
std::vector< CustomShapeGuide > maGuideList
static sal_Int32 GetCustomShapeGuideValue(const std::vector< CustomShapeGuide > &rGuideList, std::u16string_view rFormulaName)
std::vector< CustomShapeGuide > maAdjustmentGuideList
css::uno::Sequence< sal_Int8 > const & getShapePresetTypeName() const
std::vector< AdjustHandle > & getAdjustHandleList()
std::vector< CustomShapeGuide > & getAdjustmentGuideList()
static sal_Int32 SetCustomShapeGuideValue(std::vector< CustomShapeGuide > &rGuideList, const CustomShapeGuide &rGuide)
std::vector< css::drawing::EnhancedCustomShapeSegment > maSegments
std::vector< ConnectionSite > maConnectionSiteList
std::vector< AdjustHandle > maAdjustHandleList
std::shared_ptr< CustomShapeProperties > CustomShapePropertiesPtr
XML_norm
std::optional< OUString > gdRef1
std::optional< css::drawing::EnhancedCustomShapeParameter > min2
std::optional< OUString > gdRef2
std::optional< css::drawing::EnhancedCustomShapeParameter > min1
std::optional< css::drawing::EnhancedCustomShapeParameter > max1
css::drawing::EnhancedCustomShapeParameterPair pos
std::optional< css::drawing::EnhancedCustomShapeParameter > max2
css::drawing::EnhancedCustomShapeParameter ang
css::drawing::EnhancedCustomShapeParameterPair pos
css::drawing::EnhancedCustomShapeParameter l
css::drawing::EnhancedCustomShapeParameter b
css::drawing::EnhancedCustomShapeParameter r
css::drawing::EnhancedCustomShapeParameter t
std::vector< css::drawing::EnhancedCustomShapeParameterPair > parameter