23#include <oox/token/properties.hxx>
25#include <com/sun/star/awt/Rectangle.hpp>
26#include <com/sun/star/awt/Size.hpp>
27#include <com/sun/star/beans/PropertyValues.hpp>
28#include <com/sun/star/beans/XPropertySet.hpp>
29#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
30#include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
31#include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
32#include <com/sun/star/drawing/XShape.hpp>
47: mnShapePresetType ( -1 )
48, mbShapeTypeOverride(false)
49, mbMirroredX ( false )
50, mbMirroredY ( false )
51, mnTextPreRotateAngle ( 0 )
52, mnTextCameraZRotateAngle ( 0 )
64 std::vector<CustomShapeGuide>::size_type
nIndex = 0;
70 if (
nIndex == rGuideList.size() )
71 rGuideList.push_back( rGuide );
72 return static_cast< sal_Int32
>(
nIndex );
82 sal_Int32
nIndex =
static_cast< sal_Int32
>( rGuideList.size() ) - 1;
137 static constexpr OUStringLiteral sCustomShapeGeometry(
u"CustomShapeGeometry");
138 static constexpr OUStringLiteral sAdjustmentValues(
u"AdjustmentValues");
139 uno::Any aGeoPropSet = xPropSet->getPropertyValue( sCustomShapeGeometry );
140 uno::Sequence< beans::PropertyValue > aGeoPropSeq;
141 if ( aGeoPropSet >>= aGeoPropSeq )
143 for (
auto& rGeoProp : asNonConstRange(aGeoPropSeq) )
145 if ( rGeoProp.Name == sAdjustmentValues )
147 uno::Sequence< css::drawing::EnhancedCustomShapeAdjustmentValue > aAdjustmentSeq;
148 if ( rGeoProp.Value >>= aAdjustmentSeq )
150 auto aAdjustmentSeqRange = asNonConstRange(aAdjustmentSeq);
154 if ( adjustmentGuide.maName.getLength() > 3 )
156 sal_Int32 nAdjustmentIndex =
o3tl::toInt32(adjustmentGuide.maName.subView( 3 )) - 1;
157 if ( ( nAdjustmentIndex >= 0 ) && ( nAdjustmentIndex < aAdjustmentSeq.getLength() ) )
159 EnhancedCustomShapeAdjustmentValue aAdjustmentVal;
160 aAdjustmentVal.Value <<= adjustmentGuide.maFormula.toInt32();
161 aAdjustmentVal.State = PropertyState_DIRECT_VALUE;
162 aAdjustmentVal.Name = adjustmentGuide.maName;
163 aAdjustmentSeqRange[ nAdjustmentIndex ] = aAdjustmentVal;
165 }
else if ( aAdjustmentSeq.hasElements() ) {
166 EnhancedCustomShapeAdjustmentValue aAdjustmentVal;
167 aAdjustmentVal.Value <<= adjustmentGuide.maFormula.toInt32();
168 aAdjustmentVal.State = PropertyState_DIRECT_VALUE;
169 aAdjustmentVal.Name = adjustmentGuide.maName;
170 if (
nIndex < aAdjustmentSeq.getLength())
172 aAdjustmentSeqRange[
nIndex] = aAdjustmentVal;
177 rGeoProp.Value <<= aAdjustmentSeq;
178 xPropSet->setPropertyValue( sCustomShapeGeometry,
Any( aGeoPropSeq ) );
189 aPropertyMap.
setProperty( PROP_Type, OUString(
"ooxml-non-primitive" ));
200 awt::Rectangle aViewBox( 0, 0, aSize.Width, aSize.Height );
204 aViewBox = awt::Rectangle( 0, 0, 0, 0 );
208 auto aAdjustmentValuesRange = asNonConstRange(aAdjustmentValues);
211 EnhancedCustomShapeAdjustmentValue aAdjustmentVal;
213 aAdjustmentVal.State = PropertyState_DIRECT_VALUE;
215 aAdjustmentValuesRange[
i ] = aAdjustmentVal;
217 aPropertyMap.
setProperty( PROP_AdjustmentValues, aAdjustmentValues);
231 sal_uInt32 nParameterPairs = 0;
233 nParameterPairs +=
i.parameter.size();
236 auto aParameterPairsRange = asNonConstRange(aParameterPairs);
239 for (
auto const & j:
i.parameter )
240 aParameterPairsRange[ k++ ] = j;
241 aPath.
setProperty( PROP_Coordinates, aParameterPairs);
245 bool bAllZero =
true;
259 SAL_INFO(
"oox.cscode",
260 "set subpath; size: " << p2d.w <<
" x " << p2d.h);
261 return awt::Size(p2d.w, p2d.h);
263 aPath.
setProperty( PROP_SubViewSize, aSubViewSize);
268 aPropertyMap.
setProperty( PROP_Path, aPathSequence);
272 [](
const auto& g) { return g.maFormula; });
273 aPropertyMap.
setProperty( PROP_Equations, aEquations);
276 auto aHandlesRange = asNonConstRange(aHandles);
352 SAL_INFO(
"oox.cscode",
"==cscode== begin");
354 SAL_INFO(
"oox.cscode",
"==cscode== end");
355 SAL_INFO(
"oox.csdata",
"==csdata== begin");
357 SAL_INFO(
"oox.csdata",
"==csdata== end");
A helper that maps property identifiers to property values.
static void dumpData(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet)
css::uno::Sequence< css::beans::PropertyValue > makePropertyValueSequence() const
Returns a sequence of property values, filled with all contained properties.
bool setProperty(sal_Int32 nPropId, Type &&rValue)
Sets the specified property to the passed value.
static void dumpCode(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet)
css::uno::Reference< css::beans::XPropertySet > makePropertySet() const
Creates a property set supporting the XPropertySet interface and inserts all properties.
A wrapper for a UNO property set.
bool setProperty(sal_Int32 nPropId, const Type &rValue)
Puts the passed value into the property set.
css::uno::Sequence< sal_Int8 > const & getUtf8TokenName(sal_Int32 nToken) const
Returns the UTF8 name of the passed token identifier as byte sequence.
static void initializePresetDataMap()
std::optional< sal_Int32 > moTextAreaRotateAngle
sal_Int32 mnTextCameraZRotateAngle
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...
std::unordered_map< sal_Int32, PropertyMap > PresetDataMap
std::vector< CustomShapeGuide > maGuideList
sal_Int32 mnTextPreRotateAngle
static PresetDataMap maPresetDataMap
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
sal_Int32 getShapePresetType() const
sal_Int32 mnShapePresetType
std::optional< GeomRect > maTextRect
static sal_Int32 SetCustomShapeGuideValue(std::vector< CustomShapeGuide > &rGuideList, const CustomShapeGuide &rGuide)
std::vector< css::drawing::EnhancedCustomShapeSegment > maSegments
std::vector< Path2D > maPath2DList
std::vector< AdjustHandle > maAdjustHandleList
Sequence< sal_Int8 > aSeq
#define SAL_INFO(area, stream)
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
TokenMap & StaticTokenMap()