46#include <com/sun/star/awt/Size.hpp>
47#include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
48#include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
49#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
50#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
51#include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
62#include <unordered_set>
67using namespace ::com::sun::star::drawing::EnhancedCustomShapeSegmentCommand;
71 sal_uInt32 nDat =
static_cast<sal_uInt32
>(
nValue);
72 sal_Int32 nNewValue =
nValue;
75 if ( ( nDat >> 16 ) == 0x8000 )
77 nNewValue =
static_cast<sal_uInt16
>(nDat);
78 rParameter.Type = EnhancedCustomShapeParameterType::EQUATION;
81 rParameter.Type = EnhancedCustomShapeParameterType::NORMAL;
82 rParameter.Value <<= nNewValue;
88 bool b1Special = ( nFlags & 0x2000 ) != 0;
89 bool b2Special = ( nFlags & 0x4000 ) != 0;
90 bool b3Special = ( nFlags & 0x8000 ) != 0;
91 switch( nFlags & 0xff )
96 sal_Int32 nOptimize = 0;
127 if ( b3Special || nP3 )
137 if ( b2Special || ( nP2 != 1 ) )
142 if ( b3Special || ( ( nP3 != 1 ) && ( nP3 != 0 ) ) )
196 aEquation +=
"sqrt(";
213 aEquation +=
"atan2(";
217 aEquation +=
")/(pi/180)";
223 aEquation +=
"*sin(";
225 aEquation +=
"*(pi/180))";
231 aEquation +=
"*cos(";
233 aEquation +=
"*(pi/180))";
239 aEquation +=
"*cos(atan2(";
249 aEquation +=
"*sin(atan2(";
258 aEquation +=
"sqrt(";
266 aEquation +=
"*sqrt(1-(";
281 aEquation +=
"*tan(";
288 aEquation +=
"sqrt(";
301 aEquation +=
"(cos(";
303 aEquation +=
"*(pi/180))*(";
305 aEquation +=
"-10800)+sin(";
307 aEquation +=
"*(pi/180))*(";
309 aEquation +=
"-10800))+10800";
314 aEquation +=
"-(sin(";
316 aEquation +=
"*(pi/180))*(";
318 aEquation +=
"-10800)-cos(";
320 aEquation +=
"*(pi/180))*(";
322 aEquation +=
"-10800))+10800";
331 if ( bIsSpecialValue )
336 rParameter += OUString::number( nPara & 0xff );
361 rParameter +=
"left";
371 rParameter +=
"right";
376 rParameter +=
"bottom";
384 rParameter += OUString::number( nPara );
391 if ( bIsSpecialValue )
393 if ( ( nPara >= 0x100 ) && ( nPara <= 0x107 ) )
396 rParameter.Type = EnhancedCustomShapeParameterType::ADJUSTMENT;
398 else if ( ( nPara >= 3 ) && ( nPara <= 0x82 ) )
401 rParameter.Type = EnhancedCustomShapeParameterType::EQUATION;
403 else if ( nPara == 0 )
407 rParameter.Type = EnhancedCustomShapeParameterType::LEFT;
409 rParameter.Type = EnhancedCustomShapeParameterType::TOP;
411 else if ( nPara == 1 )
415 rParameter.Type = EnhancedCustomShapeParameterType::RIGHT;
417 rParameter.Type = EnhancedCustomShapeParameterType::BOTTOM;
419 else if ( nPara == 2 )
422 rParameter.Type = EnhancedCustomShapeParameterType::NORMAL;
427 rParameter.Type = EnhancedCustomShapeParameterType::NORMAL;
433 rParameter.Type = EnhancedCustomShapeParameterType::NORMAL;
435 rParameter.Value <<=
nValue;
439 const css::beans::PropertyValues& rHandleProperties,
442 bool bRetValue =
false;
443 if ( rHandleProperties.hasElements() )
446 for (
const css::beans::PropertyValue& rPropVal : rHandleProperties )
448 if ( rPropVal.Name ==
"Position" )
450 if ( rPropVal.Value >>= rDestinationHandle.
aPosition )
453 else if ( rPropVal.Name ==
"MirroredX" )
456 if ( rPropVal.Value >>= bMirroredX )
462 else if ( rPropVal.Name ==
"MirroredY" )
465 if ( rPropVal.Value >>= bMirroredY )
471 else if ( rPropVal.Name ==
"Switched" )
474 if ( rPropVal.Value >>= bSwitched )
480 else if ( rPropVal.Name ==
"Polar" )
482 if ( rPropVal.Value >>= rDestinationHandle.
aPolar )
485 else if ( rPropVal.Name ==
"RefX" )
487 if ( rPropVal.Value >>= rDestinationHandle.
nRefX )
490 else if ( rPropVal.Name ==
"RefY" )
492 if ( rPropVal.Value >>= rDestinationHandle.
nRefY )
495 else if ( rPropVal.Name ==
"RefAngle" )
497 if ( rPropVal.Value >>= rDestinationHandle.
nRefAngle )
500 else if ( rPropVal.Name ==
"RefR" )
502 if ( rPropVal.Value >>= rDestinationHandle.
nRefR )
505 else if ( rPropVal.Name ==
"RadiusRangeMinimum" )
510 else if ( rPropVal.Name ==
"RadiusRangeMaximum" )
515 else if ( rPropVal.Name ==
"RangeXMinimum" )
520 else if ( rPropVal.Name ==
"RangeXMaximum" )
525 else if ( rPropVal.Name ==
"RangeYMinimum" )
530 else if ( rPropVal.Name ==
"RangeYMaximum" )
543 static constexpr OUStringLiteral sAdjustmentValues(
u"AdjustmentValues" );
550 static constexpr OUStringLiteral sViewBox(
u"ViewBox" );
552 css::awt::Rectangle aViewBox;
553 if ( pViewBox && (*pViewBox >>= aViewBox ) )
560 static constexpr OUStringLiteral sPath(
u"Path" );
561 static constexpr OUStringLiteral sCoordinates(
u"Coordinates" );
562 static constexpr OUStringLiteral sGluePoints(
u"GluePoints" );
563 static constexpr OUStringLiteral sSegments(
u"Segments" );
564 static constexpr OUStringLiteral sSubViewSize(
u"SubViewSize" );
565 static constexpr OUStringLiteral sStretchX(
u"StretchX" );
566 static constexpr OUStringLiteral sStretchY(
u"StretchY" );
567 static constexpr OUStringLiteral sTextFrames(
u"TextFrames" );
568 static constexpr OUStringLiteral sEquations(
u"Equations" );
569 static constexpr OUStringLiteral sHandles(
u"Handles" );
600 sal_Int32 nStretchX = 0;
601 if ( *pAny >>= nStretchX )
610 sal_Int32 nStretchY = 0;
611 if ( *pAny >>= nStretchY )
640 sal_Int32 nWidth = 0;
641 sal_Int32 nHeight = 0;
648 "set subpath " <<
nIndex <<
" size: " << nWidth <<
" x "
652 if ( nWidth && nHeight ) {
709:
SfxItemSet ( rSdrObjCustomShape.GetMergedItemSet() ),
710 mrSdrObjCustomShape ( rSdrObjCustomShape ),
714 m_nCoordWidthG ( 21600 ),
715 m_nCoordHeightG ( 21600 ),
716 m_bOOXMLShape ( false ),
717 m_nXRef ( 0x80000000 ),
718 m_nYRef ( 0x80000000 ),
749 static constexpr OUStringLiteral
sType =
u"Type";
752 *pAny >>= sShapeType;
758 static constexpr OUStringLiteral sMirroredX =
u"MirroredX";
759 static constexpr OUStringLiteral sMirroredY =
u"MirroredY";
797 if (sShapeType ==
"col-60da8460")
801 else if (sShapeType ==
"col-502ad400")
805 else if (sShapeType.getLength() > 4 && sShapeType.match(
"col-" ))
845 "error: equation number: " <<
i <<
", parser failed ("
858 case ExpressionFunct::EnumPi : fRet = M_PI;
break;
859 case ExpressionFunct::EnumLeft : fRet =
static_cast<double>(
m_nCoordLeft);
break;
860 case ExpressionFunct::EnumTop : fRet =
static_cast<double>(
m_nCoordTop);
break;
863 case ExpressionFunct::EnumXStretch : fRet =
m_nXRef;
break;
864 case ExpressionFunct::EnumYStretch : fRet =
m_nYRef;
break;
865 case ExpressionFunct::EnumHasStroke : fRet =
m_bStroked ? 1.0 : 0.0;
break;
866 case ExpressionFunct::EnumHasFill : fRet =
m_bFilled ? 1.0 : 0.0;
break;
867 case ExpressionFunct::EnumWidth : fRet =
m_nCoordWidth;
break;
877 double fNumber = 0.0;
884 sal_Int32 nNumber = 0;
886 fNumber =
static_cast<double>(nNumber);
893 double fNumber = 0.0;
894 static sal_uInt32 nLevel = 0;
912 << fNumber <<
" --> " << 180.0*fNumber/10800000.0);
914 if ( !std::isfinite( fNumber ) )
919 SAL_WARN(
"svx",
"EnhancedCustomShape2d::GetEquationValueAsDouble failed");
925 "?" <<
nIndex <<
" --> " << fNumber <<
" (angle: "
926 << 180.0*fNumber/10800000.0 <<
")");
934 bool bRetValue =
false;
939 pseqAdjustmentValues[
nIndex ].Value <<= rValue;
940 pseqAdjustmentValues[
nIndex ].State = css::beans::PropertyState_DIRECT_VALUE;
947 const bool bScale,
const bool bReplaceGeoSize )
const
951 GetParameter(fValX, rPair.First, bReplaceGeoSize,
false);
958 GetParameter(fValY, rPair.Second,
false, bReplaceGeoSize);
968 const bool bScale,
const bool bReplaceGeoSize )
const
975 const bool bReplaceGeoWidth,
const bool bReplaceGeoHeight )
const
978 switch ( rParameter.Type )
980 case EnhancedCustomShapeParameterType::ADJUSTMENT :
982 sal_Int32 nAdjustmentIndex = 0;
983 if ( rParameter.Value >>= nAdjustmentIndex )
989 case EnhancedCustomShapeParameterType::EQUATION :
991 sal_Int32 nEquationIndex = 0;
992 if ( rParameter.Value >>= nEquationIndex )
998 case EnhancedCustomShapeParameterType::NORMAL :
1000 if ( rParameter.Value.getValueTypeClass() == TypeClass_DOUBLE )
1003 if ( rParameter.Value >>= fValue )
1011 if ( rParameter.Value >>=
nValue )
1022 case EnhancedCustomShapeParameterType::LEFT :
1027 case EnhancedCustomShapeParameterType::TOP :
1032 case EnhancedCustomShapeParameterType::RIGHT :
1037 case EnhancedCustomShapeParameterType::BOTTOM :
1059 return ( nLumDat >> 28 ) * 10;
1066 if ( dBrightness == 0.0)
1072 if (dBrightness >=0.0)
1074 return Color(
static_cast<sal_uInt8>(
static_cast< sal_Int32
>( std::clamp(rFillColor.
GetRed() * (1.0-dBrightness) + dBrightness * 255.0, 0.0, 255.0) )),
1075 static_cast<sal_uInt8>(
static_cast< sal_Int32
>( std::clamp(rFillColor.
GetGreen() * (1.0-dBrightness) + dBrightness * 255.0, 0.0, 255.0) )),
1076 static_cast<sal_uInt8>(
static_cast< sal_Int32
>( std::clamp(rFillColor.
GetBlue() * (1.0-dBrightness) + dBrightness * 255.0, 0.0, 255.0) )) );
1080 return Color(
static_cast<sal_uInt8>(
static_cast< sal_Int32
>( std::clamp(rFillColor.
GetRed() * (1.0+dBrightness), 0.0, 255.0) )),
1081 static_cast<sal_uInt8>(
static_cast< sal_Int32
>( std::clamp(rFillColor.
GetGreen() * (1.0+dBrightness), 0.0, 255.0) )),
1082 static_cast<sal_uInt8>(
static_cast< sal_Int32
>( std::clamp(rFillColor.
GetBlue() * (1.0+dBrightness), 0.0, 255.0) )) );
1098 if( nLuminance > 0 )
1101 aHSVColor.
getGreen() * (1.0-nLuminance/100.0));
1104 (1.0-nLuminance/100.0)*aHSVColor.
getBlue());
1106 else if( nLuminance < 0 )
1109 (1.0+nLuminance/100.0)*aHSVColor.
getBlue());
1113 return Color(
static_cast<sal_uInt8>(
static_cast< sal_Int32
>( std::clamp(aHSVColor.
getRed(),0.0,1.0) * 255.0 + 0.5 )),
1114 static_cast<sal_uInt8>(
static_cast< sal_Int32
>( std::clamp(aHSVColor.
getGreen(),0.0,1.0) * 255.0 + 0.5 )),
1115 static_cast<sal_uInt8>(
static_cast< sal_Int32
>( std::clamp(aHSVColor.
getBlue(),0.0,1.0) * 255.0 + 0.5 )) );
1152 bool bRetValue =
false;
1169 double fX = dx * cos(
a );
1170 double fY =-dx * sin(
a );
1173 FRound( fX + aReferencePoint.
X() ),
1183 css::drawing::EnhancedCustomShapeParameter aFirst = aHandle.
aPosition.First;
1184 css::drawing::EnhancedCustomShapeParameter aSecond = aHandle.
aPosition.Second;
1219 const double fX,
const double fW,
const double fH)
1222 if (fW <= 0.0 || fH <= 0.0)
1226 if ((rShapeType ==
u"ooxml-bentArrow" && nHandleIndex == 2) || (rShapeType ==
u"ooxml-chevron")
1227 || (rShapeType ==
u"ooxml-curvedRightArrow") || (rShapeType ==
u"ooxml-foldedCorner")
1228 || (rShapeType ==
u"ooxml-homePlate") || (rShapeType ==
u"ooxml-notchedRightArrow")
1229 || (rShapeType ==
u"ooxml-nonIsoscelesTrapezoid" && nHandleIndex == 1)
1230 || (rShapeType ==
u"ooxml-rightArrow")
1231 || (rShapeType ==
u"ooxml-rightArrowCallout" && nHandleIndex == 2)
1232 || (rShapeType ==
u"ooxml-round1Rect")
1233 || (rShapeType ==
u"ooxml-round2DiagRect" && nHandleIndex == 1)
1234 || (rShapeType ==
u"ooxml-round2SameRect" && nHandleIndex == 0)
1235 || (rShapeType ==
u"ooxml-snip1Rect")
1236 || (rShapeType ==
u"ooxml-snip2DiagRect" && nHandleIndex == 1)
1237 || (rShapeType ==
u"ooxml-snip2SameRect" && nHandleIndex == 0)
1238 || (rShapeType ==
u"ooxml-snipRoundRect" && nHandleIndex == 1)
1239 || (rShapeType ==
u"ooxml-swooshArrow") || (rShapeType ==
u"ooxml-stripedRightArrow"))
1240 return (fW - fX) / std::min(fW, fH) * 100000.0;
1243 if ((rShapeType ==
u"ooxml-bentArrow" && nHandleIndex == 0)
1244 || (rShapeType ==
u"ooxml-bentArrow" && nHandleIndex == 3)
1245 || (rShapeType ==
u"ooxml-corner")
1246 || (rShapeType ==
u"ooxml-curvedDownArrow") || (rShapeType ==
u"ooxml-curvedLeftArrow")
1247 || (rShapeType ==
u"ooxml-curvedUpArrow") || (rShapeType ==
u"ooxml-leftArrow")
1248 || (rShapeType ==
u"ooxml-leftArrowCallout" && nHandleIndex == 2)
1249 || (rShapeType ==
u"ooxml-leftRightArrow")
1250 || (rShapeType ==
u"ooxml-leftRightArrowCallout" && nHandleIndex == 2)
1251 || (rShapeType ==
u"ooxml-leftRightRibbon")
1252 || (rShapeType ==
u"ooxml-nonIsoscelesTrapezoid" && nHandleIndex == 0)
1253 || (rShapeType ==
u"ooxml-parallelogram")
1254 || (rShapeType ==
u"ooxml-round2DiagRect" && nHandleIndex == 0)
1255 || (rShapeType ==
u"ooxml-round2SameRect" && nHandleIndex == 1)
1256 || (rShapeType ==
u"ooxml-roundRect")
1257 || (rShapeType ==
u"ooxml-snip2DiagRect" && nHandleIndex == 0)
1258 || (rShapeType ==
u"ooxml-snip2SameRect" && nHandleIndex == 1)
1259 || (rShapeType ==
u"ooxml-snipRoundRect" && nHandleIndex == 0)
1260 || (rShapeType ==
u"ooxml-uturnArrow" && nHandleIndex == 0)
1261 || (rShapeType ==
u"ooxml-uturnArrow" && nHandleIndex == 3))
1262 return fX / std::min(fW, fH) * 100000.0;
1265 if ((rShapeType ==
u"ooxml-downArrowCallout" && nHandleIndex == 0)
1266 || (rShapeType ==
u"ooxml-leftRightUpArrow" && nHandleIndex == 0)
1267 || (rShapeType ==
u"ooxml-quadArrow" && nHandleIndex == 0)
1268 || (rShapeType ==
u"ooxml-quadArrowCallout" && nHandleIndex == 0)
1269 || (rShapeType ==
u"ooxml-upArrowCallout" && nHandleIndex == 0)
1270 || (rShapeType ==
u"ooxml-upDownArrowCallout" && nHandleIndex == 0))
1271 return (fW / 2.0 - fX) / std::min(fW, fH) * 200000.0;
1274 if ((rShapeType ==
u"ooxml-downArrowCallout" && nHandleIndex == 1)
1275 || (rShapeType ==
u"ooxml-leftRightUpArrow" && nHandleIndex == 1)
1276 || (rShapeType ==
u"ooxml-quadArrow" && nHandleIndex == 1)
1277 || (rShapeType ==
u"ooxml-quadArrowCallout" && nHandleIndex == 1)
1278 || (rShapeType ==
u"ooxml-upArrowCallout" && nHandleIndex == 1)
1279 || (rShapeType ==
u"ooxml-upDownArrowCallout" && nHandleIndex == 1))
1280 return (fW / 2.0 - fX) / std::min(fW, fH) * 100000.0;
1283 if ((rShapeType ==
u"ooxml-bentUpArrow") || (rShapeType ==
u"ooxml-leftUpArrow")
1284 || (rShapeType ==
u"ooxml-uturnArrow" && nHandleIndex == 1))
1285 return (fW - fX) / std::min(fW, fH) * 50000.0;
1288 if (rShapeType ==
u"ooxml-nonIsoscelesTrapezoid" && nHandleIndex == 0)
1289 return fX / std::min(fW, fH) * 200000.0;
1292 if ((rShapeType ==
u"ooxml-downArrow" && nHandleIndex == 0)
1293 || (rShapeType ==
u"ooxml-ellipseRibbon") || (rShapeType ==
u"ooxml-ellipseRibbon2")
1294 || (rShapeType ==
u"ooxml-leftRightArrowCallout" && nHandleIndex == 3)
1295 || (rShapeType ==
u"ooxml-ribbon") || (rShapeType ==
u"ooxml-ribbon2")
1296 || (rShapeType ==
u"ooxml-upArrow" && nHandleIndex == 0)
1297 || (rShapeType ==
u"ooxml-upDownArrow" && nHandleIndex == 0))
1298 return (fW / 2.0 - fX) / fW * 200000.0;
1301 if ((rShapeType ==
u"ooxml-cloudCallout") || (rShapeType ==
u"ooxml-doubleWave")
1302 || (rShapeType ==
u"ooxml-wave") || (rShapeType ==
u"ooxml-wedgeEllipseCallout")
1303 || (rShapeType ==
u"ooxml-wedgeRectCallout")
1304 || (rShapeType ==
u"ooxml-wedgeRoundRectCallout"))
1305 return (fX - fW / 2.0) / fW * 100000.0;
1308 if (rShapeType ==
u"ooxml-teardrop")
1309 return (fX - fW / 2.0) / fW * 200000.0;
1312 if (rShapeType ==
u"ooxml-leftArrowCallout" && nHandleIndex == 3)
1313 return (fW - fX) / fW * 100000.0;
1316 if (rShapeType ==
u"ooxml-mathDivide")
1317 return (fW / 2.0 - fX) / fH * 100000.0;
1321 return fX / fW * 100000.0;
1327 const double fY,
const double fW,
const double fH)
1330 if (fW <= 0.0 || fH <= 0.0)
1334 if ((rShapeType ==
u"ooxml-leftArrowCallout" && nHandleIndex == 1)
1335 || (rShapeType ==
u"ooxml-leftRightArrowCallout" && nHandleIndex == 1)
1336 || (rShapeType ==
u"ooxml-rightArrowCallout" && nHandleIndex == 1))
1337 return (fH / 2.0 - fY) / std::min(fW, fH) * 100000.0;
1340 if ((rShapeType ==
u"ooxml-curvedLeftArrow") || (rShapeType ==
u"ooxml-curvedRightArrow")
1341 || (rShapeType ==
u"ooxml-leftArrowCallout" && nHandleIndex == 0)
1342 || (rShapeType ==
u"ooxml-leftRightArrowCallout" && nHandleIndex == 0)
1343 || (rShapeType ==
u"ooxml-mathPlus")
1344 || (rShapeType ==
u"ooxml-rightArrowCallout" && nHandleIndex == 0))
1345 return (fH / 2.0 - fY) / std::min(fW, fH) * 200000.0;
1348 if ((rShapeType ==
u"ooxml-bentUpArrow" && nHandleIndex == 0) || (rShapeType ==
u"ooxml-corner")
1349 || (rShapeType ==
u"ooxml-curvedDownArrow") || (rShapeType ==
u"ooxml-downArrow")
1350 || (rShapeType ==
u"ooxml-downArrowCallout" && nHandleIndex == 2)
1351 || (rShapeType ==
u"ooxml-uturnArrow" && nHandleIndex == 2))
1352 return (fH - fY) / std::min(fW, fH) * 100000.0;
1355 if (rShapeType ==
u"ooxml-leftUpArrow" && nHandleIndex == 0)
1356 return (fH - fY) / std::min(fW, fH) * 200000.0;
1359 if ((rShapeType ==
u"ooxml-bentUpArrow" && nHandleIndex == 2)
1360 || (rShapeType ==
u"ooxml-bracePair") || (rShapeType ==
u"ooxml-bracketPair")
1361 || (rShapeType ==
u"ooxml-can") || (rShapeType ==
u"ooxml-cube")
1362 || (rShapeType ==
u"ooxml-curvedUpArrow") || (rShapeType ==
u"ooxml-halfFrame")
1363 || (rShapeType ==
u"ooxml-leftBrace" && nHandleIndex == 0)
1364 || (rShapeType ==
u"ooxml-leftBracket") || (rShapeType ==
u"ooxml-leftRightUpArrow")
1365 || (rShapeType ==
u"ooxml-leftUpArrow" && nHandleIndex == 2)
1366 || (rShapeType ==
u"ooxml-mathMultiply") || (rShapeType ==
u"ooxml-quadArrow")
1367 || (rShapeType ==
u"ooxml-quadArrowCallout" && nHandleIndex == 2)
1368 || (rShapeType ==
u"ooxml-rightBrace" && nHandleIndex == 0)
1369 || (rShapeType ==
u"ooxml-rightBracket") || (rShapeType ==
u"ooxml-upArrow")
1370 || (rShapeType ==
u"ooxml-upArrowCallout" && nHandleIndex == 2)
1371 || (rShapeType ==
u"ooxml-upDownArrow")
1372 || (rShapeType ==
u"ooxml-upDownArrowCallout" && nHandleIndex == 2)
1373 || (rShapeType ==
u"ooxml-verticalScroll"))
1374 return fY / std::min(fW, fH) * 100000.0;
1377 if (rShapeType ==
u"ooxml-bentArrow")
1378 return fY / std::min(fW, fH) * 50000.0;
1381 if ((rShapeType ==
u"ooxml-mathDivide" && nHandleIndex == 1)
1382 || (rShapeType ==
u"ooxml-mathEqual" && nHandleIndex == 0)
1383 || (rShapeType ==
u"ooxml-mathNotEqual" && nHandleIndex == 0)
1384 || (rShapeType ==
u"ooxml-star4") || (rShapeType ==
u"ooxml-star6")
1385 || (rShapeType ==
u"ooxml-star8") || (rShapeType ==
u"ooxml-star10")
1386 || (rShapeType ==
u"ooxml-star12") || (rShapeType ==
u"ooxml-star16")
1387 || (rShapeType ==
u"ooxml-star24") || (rShapeType ==
u"ooxml-star32"))
1388 return (fH / 2.0 - fY) / fH * 100000.0;
1391 if ((rShapeType ==
u"ooxml-leftArrow") || (rShapeType ==
u"ooxml-leftRightArrow")
1392 || (rShapeType ==
u"ooxml-mathDivide" && nHandleIndex == 0)
1393 || (rShapeType ==
u"ooxml-mathEqual" && nHandleIndex == 1)
1394 || (rShapeType ==
u"ooxml-mathMinus") || (rShapeType ==
u"ooxml-notchedRightArrow")
1395 || (rShapeType ==
u"ooxml-mathNotEqual" && nHandleIndex == 2)
1396 || (rShapeType ==
u"ooxml-quadArrowCallout" && nHandleIndex == 3)
1397 || (rShapeType ==
u"ooxml-rightArrow") || (rShapeType ==
u"ooxml-stripedRightArrow")
1398 || (rShapeType ==
u"ooxml-upDownArrowCallout" && nHandleIndex == 3))
1399 return (fH / 2.0 - fY) / fH * 200000.0;
1402 if ((rShapeType ==
u"ooxml-cloudCallout") || (rShapeType ==
u"ooxml-wedgeEllipseCallout")
1403 || (rShapeType ==
u"ooxml-wedgeRectCallout")
1404 || (rShapeType ==
u"ooxml-wedgeRoundRectCallout"))
1405 return (fY - fH / 2.0) / fH * 100000.0;
1408 if ((rShapeType ==
u"ooxml-ellipseRibbon" && nHandleIndex == 2)
1409 || (rShapeType ==
u"ooxml-ellipseRibbon2" && nHandleIndex == 0)
1410 || (rShapeType ==
u"ooxml-ribbon2")
1411 || (rShapeType ==
u"ooxml-upArrowCallout" && nHandleIndex == 3))
1412 return (fH - fY) / fH * 100000.0;
1415 if (rShapeType ==
u"ooxml-smileyFace")
1416 return (fY - fH * 16515.0 / 21600.0) / fH * 100000.0;
1419 if (rShapeType ==
u"ooxml-star5")
1420 return (fH / 2.0 - fY * 100000.0 / 110557.0) / fH * 100000.0;
1421 if (rShapeType ==
u"ooxml-star7")
1422 return (fH / 2.0 - fY * 100000.0 / 105210.0) / fH * 100000.0;
1425 if (rShapeType ==
u"ooxml-swooshArrow")
1426 return (fY - std::min(fW, fH) / 8.0) / fH * 100000.0;
1429 if (rShapeType ==
u"ooxml-leftRightRibbon")
1430 return fY / fH * 200000 - 100000;
1434 return fY / fH * 100000.0;
1441 if (fDX != 0.0 || fDY != 0.0)
1443 double fAngleRad(atan2(fDY, fDX));
1462 return std::min(fHR - fY, fWR);
1464 return std::min(fWR - fX, fHR);
1466 double fD = std::min(fWR, fHR) - std::hypot(fX, fY);
1472 const double fOldD(fD);
1473 const double fWRmD(fWR - fD);
1474 const double fHRmD(fHR - fD);
1476 = fX * fX * fHRmD * fHRmD + fY * fY * fWRmD * fWRmD - fWRmD * fWRmD * fHRmD * fHRmD;
1478 = 2.0 * (fHRmD * (fWRmD * fWRmD - fX * fX) + fWRmD * (fHRmD * fHRmD - fY * fY));
1479 if (fDenominator != 0.0)
1481 fD = fD - fNumerator / fDenominator;
1482 bFound = fabs(fOldD - fD) < 1.0E-12;
1486 }
while (nIter < 50 && !bFound);
1497 OUString sShapeType(
"non-primitive");
1501 *pAny >>= sShapeType;
1503 bool bRetValue =
false;
1509 Point aP( rPosition.X, rPosition.Y );
1531 double fPos1 = aP.
X();
1532 double fPos2 = aP.
Y();
1560 double fTmp = fWidth;
1568 sal_Int32 nFirstAdjustmentValue = -1, nSecondAdjustmentValue = -1;
1574 if ( aHandle.
aPosition.First.Type == EnhancedCustomShapeParameterType::ADJUSTMENT )
1575 aHandle.
aPosition.First.Value >>= nFirstAdjustmentValue;
1576 if ( aHandle.
aPosition.Second.Type == EnhancedCustomShapeParameterType::ADJUSTMENT )
1577 aHandle.
aPosition.Second.Value>>= nSecondAdjustmentValue;
1583 nFirstAdjustmentValue = aHandle.
nRefR;
1585 nSecondAdjustmentValue = aHandle.
nRefAngle;
1588 double fRadius(0.0);
1595 double fDX = fPos1 - fWidth / 2.0;
1596 double fDY = fPos2 - fHeight / 2.0;
1599 if (sShapeType ==
"ooxml-blockArc" &&
nIndex == 1)
1606 double fRadiusDifference
1608 double fss(std::min(fWidth, fHeight));
1610 fRadius = fRadiusDifference * 100000.0 / fss;
1612 else if (sShapeType ==
"ooxml-donut" || sShapeType ==
"ooxml-noSmoking")
1615 double fss(std::min(fWidth, fHeight));
1617 fRadius = fPos1 * 100000.0 / fss;
1619 else if ((sShapeType ==
"ooxml-circularArrow"
1620 || sShapeType ==
"ooxml-leftRightCircularArrow"
1621 || sShapeType ==
"ooxml-leftCircularArrow")
1626 if (sShapeType ==
"ooxml-leftCircularArrow")
1631 fAngle += 21600000.0;
1634 else if ((sShapeType ==
"ooxml-circularArrow"
1635 || sShapeType ==
"ooxml-leftCircularArrow"
1636 || sShapeType ==
"ooxml-leftRightCircularArrow")
1644 double fRadiusDifferenceHandle
1647 double fss(std::min(fWidth, fHeight));
1650 fadj5 = fadj5 * fss / 100000.0;
1651 fRadius = 2.0 * (fadj5 - fRadiusDifferenceHandle);
1652 fRadius = fRadius * 100000.0 / fss;
1657 else if ((sShapeType ==
"ooxml-circularArrow"
1658 || sShapeType ==
"ooxml-leftCircularArrow"
1659 || sShapeType ==
"ooxml-leftRightCircularArrow")
1665 double fAngleRad(0.0);
1666 if (fDX != 0.0 || fDY != 0.0)
1667 fAngleRad = atan2(fDY, fDX);
1668 double fHelpX = cos(fAngleRad) * fHeight / 2.0;
1669 double fHelpY = sin(fAngleRad) * fWidth / 2.0;
1670 if (fHelpX != 0.0 || fHelpY != 0.0)
1672 double fHelpAngle = atan2(fHelpY, fHelpX);
1673 double fOuterX = fWidth / 2.0 * cos(fHelpAngle);
1674 double fOuterY = fHeight / 2.0 * sin(fHelpAngle);
1675 double fOuterRadius = std::hypot(fOuterX, fOuterY);
1676 double fHandleRadius = std::hypot(fDX, fDY);
1677 fRadius = (fOuterRadius - fHandleRadius) / 2.0;
1678 double fss(std::min(fWidth, fHeight));
1680 fRadius = fRadius * 100000.0 / fss;
1684 else if (sShapeType ==
"ooxml-mathNotEqual" &&
nIndex == 1)
1688 fadj1 = fadj1 * fHeight / 100000.0;
1689 fadj3 = fadj3 * fHeight / 100000.0;
1690 double fDYRefHorizBar = fDY + fadj1 + fadj3;
1691 if (fDX != 0.0 || fDYRefHorizBar != 0.0)
1694 fAngle = (fRawAngleDeg + 180.0) * 60000.0;
1703 fRadius = std::hypot(fDX, fDY);
1704 double fss(std::min(fWidth, fHeight));
1706 fRadius = fRadius * 100000.0 / fss;
1711 double fXRef, fYRef;
1719 fXRef = fWidth / 2.0;
1720 fYRef = fHeight / 2.0;
1722 const double fDX = fPos1 - fXRef;
1723 const double fDY = fPos2 - fYRef;
1727 if (fDX != 0.0 || fDY != 0.0)
1729 fRadius = std::hypot(fDX, fDY);
1739 if ( fRadius < fMin )
1746 if ( fRadius > fMax )
1750 if ( nFirstAdjustmentValue >= 0 )
1752 if ( nSecondAdjustmentValue >= 0 )
1763 double fAdjustX = fPos1;
1764 double fAdjustY = fPos2;
1767 nFirstAdjustmentValue = aHandle.
nRefX;
1768 if ((sShapeType ==
"ooxml-gear6") || (sShapeType ==
"ooxml-gear9"))
1771 double fss(std::min(fWidth, fHeight));
1773 double fth(fadj1 * fss / 100000.0);
1774 double frw(fWidth / 2.0 - fth);
1775 double frh(fHeight / 2.0 - fth);
1776 double fDX(fPos1 - fWidth / 2.0);
1777 double fDY(fPos2 - fHeight / 2.0);
1779 if (fDX != 0.0 || fDY != 0.0)
1780 fbA = atan2(fDY, fDX);
1782 double ftmpX(frh * cos(fbA));
1783 double ftmpY(frw * sin(fbA));
1784 if (ftmpX != 0.0 || ftmpY != 0.0)
1785 faA = atan2(ftmpY, ftmpX);
1787 double fha(-M_PI_2 - faA);
1788 if (
abs(fha) == M_PI_2)
1790 double flFD(2 * std::min(frw, frh) * tan(fha) - fth);
1792 fAdjustX = flFD / fss * 100000.0;
1798 if ((sShapeType ==
"ooxml-curvedDownArrow")
1799 || (sShapeType ==
"ooxml-curvedUpArrow"))
1801 double fss(std::min(fWidth, fHeight));
1805 double fHScaled(100000.0 * fHeight / fss);
1806 double fRadicand(fHScaled * fHScaled - fadj3 * fadj3);
1807 double fSqrt = fRadicand >= 0.0 ? sqrt(fRadicand) : 0.0;
1808 double fPart(200000.0 * fWidth / fss * (fSqrt + fHScaled));
1809 fAdjustX = fPart - 4.0 * fHScaled * fAdjustX;
1814 fAdjustX = fAdjustX - fadj2 * (fSqrt + fHScaled);
1815 double fDenominator(fSqrt - 3.0 * fHScaled);
1816 fAdjustX /= fDenominator != 0.0 ? fDenominator : 1.0;
1822 fAdjustX = fAdjustX - fadj1 * (fSqrt - fHScaled);
1823 double fDenominator(fSqrt + 3.0 * fHScaled);
1824 fAdjustX /= fDenominator != 0.0 ? fDenominator : 1.0;
1833 nSecondAdjustmentValue = aHandle.
nRefY;
1834 if ((sShapeType ==
"ooxml-gear6") || (sShapeType ==
"ooxml-gear9"))
1837 double fDX = fPos1 - fWidth / 2.0;
1838 double fDY = fPos2 - fHeight / 2.0;
1839 double fRadiusDifference
1841 double fss(std::min(fWidth, fHeight));
1843 fAdjustY = fRadiusDifference / fss * 100000.0;
1849 if (sShapeType ==
"ooxml-mathDivide" &&
nIndex == 1)
1852 else if (sShapeType ==
"ooxml-mathEqual" &&
nIndex == 0)
1854 else if (sShapeType ==
"ooxml-mathNotEqual" &&
nIndex == 0)
1856 else if (sShapeType ==
"ooxml-leftUpArrow" &&
nIndex == 0)
1858 else if ((sShapeType ==
"ooxml-curvedRightArrow")
1859 || (sShapeType ==
"ooxml-curvedLeftArrow"))
1861 double fss(std::min(fWidth, fHeight));
1865 double fWScaled(100000.0 * fWidth / fss);
1866 double fRadicand(fWScaled * fWScaled - fadj3 * fadj3);
1867 double fSqrt = fRadicand >= 0.0 ? sqrt(fRadicand) : 0.0;
1872 fAdjustY = fWScaled * (2.0 * fAdjustY - fadj2);
1873 fAdjustY += (200000.0 / fss * fHeight - fadj2) * fSqrt;
1874 double fDenominator(fSqrt + fWScaled);
1875 fAdjustY /= fDenominator != 0.0 ? fDenominator : 1.0;
1881 fAdjustY = fWScaled * (2.0 * fAdjustY + fadj1);
1882 fAdjustY += (200000.0 / fss * fHeight - fadj1) * fSqrt;
1883 double fDenominator(fSqrt + 3.0 * fWScaled);
1884 fAdjustY /= fDenominator != 0.0 ? fDenominator : 1.0;
1888 else if (sShapeType ==
"ooxml-uturnArrow" &&
nIndex == 2)
1890 double fss(std::min(fWidth, fHeight));
1894 fAdjustY += fHeight / fss * (fadj5 - 100000.0);
1897 else if (sShapeType ==
"ooxml-leftRightRibbon")
1907 if ( nFirstAdjustmentValue >= 0 )
1913 if (fAdjustX < fXMin)
1920 if (fAdjustX > fXMax)
1925 if ( nSecondAdjustmentValue >= 0 )
1931 if (fAdjustY < fYMin)
1938 if (fAdjustY > fYMax)
1946 css::beans::PropertyValue aPropVal;
1947 aPropVal.Name =
"AdjustmentValues";
1980 Point aStart( rStart );
1983 sal_Int32 bSwapStartEndAngle = 0;
1986 bSwapStartEndAngle ^= 0x01;
1988 bSwapStartEndAngle ^= 0x11;
1989 if ( bSwapStartEndAngle )
1992 if ( bSwapStartEndAngle & 1 )
1994 Point aTmp( aStart );
2005 for ( sal_uInt16 j = aTempPoly.
GetSize(); j--; )
2012 for ( sal_uInt16 j = 0; j < aTempPoly.
GetSize(); j++ )
2024 double fEAngleDeg(fmod(fEllipseAngleDeg, 360.0));
2025 if (fEAngleDeg < 0.0)
2026 fEAngleDeg += 360.0;
2027 if (fEAngleDeg == 0.0 || fEAngleDeg == 90.0 || fEAngleDeg == 180.0 || fEAngleDeg == 270.0)
2031 if (fX != 0.0 || fY != 0.0)
2033 fRet = atan2(fY, fX);
2042 double fRet(fmod(fCircleAngleDeg, 360.0));
2050 sal_Int32& rSegmentInd,
2052 const bool bLineGeometryNeededOnly,
2053 const bool bSortFilledObjectsToBack,
2056 bool bNoFill =
false;
2057 bool bNoStroke =
false;
2058 double dBrightness = 0.0;
2066 if ( !nSegInfoSize )
2068 for (
const EnhancedCustomShapeParameterPair& rCoordinate : std::as_const(
m_seqCoordinates) )
2070 const Point aTempPoint(
GetPoint( rCoordinate,
true,
true ));
2079 for ( ;rSegmentInd < nSegInfoSize; )
2106 if(aNewB2DPolygon.
count() > 1)
2110 aNewB2DPolyPolygon.
append(aNewB2DPolygon);
2113 aNewB2DPolygon.
clear();
2115 if ( rSrcPt < nCoordSize )
2120 "moveTo: " << aTempPoint.
X() <<
","
2130 if(aNewB2DPolygon.
count())
2132 if(aNewB2DPolygon.
count() > 1)
2135 aNewB2DPolyPolygon.
append(aNewB2DPolygon);
2138 aNewB2DPolygon.
clear();
2144 for ( sal_uInt16
i = 0; (
i < nPntCount ) && ( ( rSrcPt + 2 ) < nCoordSize );
i++ )
2150 DBG_ASSERT(aNewB2DPolygon.
count(),
"EnhancedCustomShape2d::CreateSubPath: Error in adding control point (!)");
2160 case ANGLEELLIPSETO:
2170 const bool bIsFromBinaryImport(sShpType.startsWith(
"mso"));
2173 const std::unordered_set<OUString> aPresetShapesWithU =
2174 {
"ellipse",
"ring",
"smiley",
"sun",
"forbidden",
"flowchart-connector",
2175 "flowchart-summing-junction",
"flowchart-or",
"cloud-callout"};
2176 std::unordered_set<OUString>::const_iterator aIter = aPresetShapesWithU.find(sShpType);
2177 const bool bIsPresetShapeWithU(aIter != aPresetShapesWithU.end());
2179 for (sal_uInt16
i = 0; (
i < nPntCount) && ((rSrcPt + 2) < nCoordSize);
i++)
2183 if (ANGLEELLIPSE == nCommand)
2185 if (aNewB2DPolygon.
count() > 1)
2189 aNewB2DPolyPolygon.
append(aNewB2DPolygon);
2191 aNewB2DPolygon.
clear();
2209 if (fScaledWR == 0.0 && fScaledHR == 0.0)
2212 aNewB2DPolygon.
append(aCenter);
2216 if (bIsFromBinaryImport)
2234 double fSwingAngle = fEndAngle;
2235 if (sShpType !=
"mso-spt143")
2237 fStartAngle /= 65536.0;
2238 fSwingAngle = fEndAngle / 65536.0;
2241 fStartAngle = -fStartAngle;
2242 fSwingAngle = -fSwingAngle;
2244 fEndAngle = fStartAngle + fSwingAngle;
2245 if (fSwingAngle < 0.0)
2246 std::swap(fStartAngle, fEndAngle);
2247 double fFrom(fStartAngle);
2248 double fTo(fFrom + 180.0);
2252 while (fTo < fEndAngle)
2263 if (fSwingAngle < 0)
2264 aTempB2DPolygon.
flip();
2265 aNewB2DPolygon.
append(aTempB2DPolygon);
2272 if (bIsPresetShapeWithU)
2292 if (fabs(fabs(fEndAngle - fStartAngle) - 360.0) < 1.0E-15)
2313 case QUADRATICCURVETO :
2315 for ( sal_Int32
i(0); (
i < nPntCount ) && ( rSrcPt + 1 < nCoordSize );
i++ )
2317 DBG_ASSERT(aNewB2DPolygon.
count(),
"EnhancedCustomShape2d::CreateSubPath: Error no previous point for Q (!)");
2318 if (aNewB2DPolygon.
count() > 0)
2331 aNewB2DPolygon.
append(aEnd);
2339 for ( sal_Int32
i(0); (
i < nPntCount ) && ( rSrcPt < nCoordSize );
i++ )
2344 "lineTo: " << aTempPoint.
X() <<
","
2354 case CLOCKWISEARCTO :
2356 bool bClockwise = ( nCommand == CLOCKWISEARC ) || ( nCommand == CLOCKWISEARCTO );
2357 bool bImplicitMoveTo = (nCommand ==
ARC) || (nCommand == CLOCKWISEARC);
2358 sal_uInt32 nXor = bClockwise ? 3 : 2;
2359 for ( sal_uInt16
i = 0; (
i < nPntCount ) && ( ( rSrcPt + 3 ) < nCoordSize );
i++ )
2361 if (bImplicitMoveTo)
2363 if (aNewB2DPolygon.
count() > 1)
2368 aNewB2DPolyPolygon.
append(aNewB2DPolygon);
2370 aNewB2DPolygon.
clear();
2387 double fStartAngle, fSwingAngle;
2389 for ( sal_uInt16
i = 0; (
i < nPntCount ) && ( rSrcPt + 1 < nCoordSize );
i++ )
2393 fWR = aTempPair.
getX();
2394 fHR = aTempPair.
getY();
2396 fStartAngle = aTempPair.
getX();
2397 fSwingAngle = aTempPair.
getY();
2404 fSwingAngle = std::clamp(fSwingAngle, -360.0, 360.0);
2407 SAL_INFO(
"svx",
"ARCANGLETO scale: " << fWR <<
"x" << fHR <<
" angles: " << fStartAngle <<
"," << fSwingAngle);
2409 if (aNewB2DPolygon.
count() > 0)
2414 if (fWR == 0.0 && fHR == 0.0)
2421 double fEndAngle = fStartAngle + fSwingAngle;
2424 if (fSwingAngle < 0.0)
2425 std::swap(fStartAngle, fEndAngle);
2428 double fFrom(fStartAngle);
2430 if (fSwingAngle >= 360.0 || fSwingAngle <= -360.0)
2432 double fTo(fFrom + 180.0);
2433 while (fTo < fEndAngle)
2445 if (fSwingAngle < 0)
2446 aTempB2DPolygon.
flip();
2459 aNewB2DPolygon.
append(aTempB2DPolygon);
2467 case ELLIPTICALQUADRANTX :
2468 case ELLIPTICALQUADRANTY :
2470 if (nPntCount && (rSrcPt < nCoordSize))
2484 aNewB2DPolygon.
append(aStart);
2489 bool bIsXDirection(nCommand == ELLIPTICALQUADRANTX);
2491 for ( ; (
i < nPntCount ) && ( rSrcPt < nCoordSize );
i++ )
2495 double fRadiusX = fabs(aEnd.
getX() - aStart.
getX());
2496 double fRadiusY = fabs(aEnd.
getY() - aStart.
getY());
2553 aNewB2DPolygon.
append(aArc);
2555 bIsXDirection = !bIsXDirection;
2563#ifdef DBG_CUSTOMSHAPE
2567 SAL_WARN(
"svx",
"CustomShapes::unknown PolyFlagValue :" << nCommand );
2572 if ( nCommand == ENDSUBPATH )
2576 if ( rSegmentInd == nSegInfoSize )
2579 if(aNewB2DPolygon.
count() > 1)
2583 aNewB2DPolyPolygon.
append(aNewB2DPolygon);
2586 if(!aNewB2DPolyPolygon.
count())
2590 bool bForceCreateTwoObjects(
false);
2592 if(!bSortFilledObjectsToBack && !aNewB2DPolyPolygon.
isClosed() && !bNoStroke)
2594 bForceCreateTwoObjects =
true;
2597 if(bLineGeometryNeededOnly)
2599 bForceCreateTwoObjects =
true;
2604 if(bForceCreateTwoObjects || bSortFilledObjectsToBack)
2613 std::move(aClosedPolyPolygon)));
2617 pFill->SetMergedItemSet(aTempSet);
2630 aNewB2DPolyPolygon));
2634 pStroke->SetMergedItemSet(aTempSet);
2650 aNewB2DPolyPolygon);
2659 aNewB2DPolyPolygon);
2667 pObj->SetMergedItemSet(aTempSet);
2674 sal_uInt32 nLineObjectCount,
2677 bool bAccent =
false;
2692 sal_uInt32 nLine = 0;
2701 if ( nLine == nLineObjectCount )
2719 sal_uInt32 nLine = 0;
2730 else if ( ( bAccent && ( nLine == nLineObjectCount - 1 ) ) || ( !bAccent && ( nLine == nLineObjectCount ) ) )
2747 sal_uInt32 nLine = 0;
2775 sal_uInt32& nColorIndex,
2776 sal_uInt32 nColorCount)
2782 if (eFillStyle == drawing::FillStyle_NONE)
2785 switch( eFillStyle )
2788 case drawing::FillStyle_SOLID:
2790 if ( nColorCount || 0.0 != dBrightness )
2794 std::min(nColorIndex, nColorCount-1),
2800 case drawing::FillStyle_GRADIENT:
2804 if ( nColorCount || 0.0 != dBrightness )
2807 for (
auto& candidate : aColorStops)
2810 candidate.getStopOffset(),
2812 Color(candidate.getStopColor()),
2813 std::min(nColorIndex, nColorCount-1),
2822 case drawing::FillStyle_HATCH:
2826 if ( nColorCount || 0.0 != dBrightness )
2831 std::min(nColorIndex, nColorCount-1),
2838 case drawing::FillStyle_BITMAP:
2840 if ( nColorCount || 0.0 != dBrightness )
2845 std::min(nColorIndex, nColorCount-1)));
2846 aBitmap.
Adjust( nLuminancePercent, 0, 0, 0, 0 );
2855 if ( nColorIndex < nColorCount )
2866 std::vector< std::pair< rtl::Reference<SdrPathObj>,
double > > vObjectList;
2868 sal_Int32 nSubPathIndex(0);
2869 sal_Int32 nSrcPt(0);
2870 sal_Int32 nSegmentInd(0);
2879 bLineGeometryNeededOnly,
2880 bSortFilledObjectsToBack,
2885 if ( !vObjectList.empty() )
2889 sal_uInt32 nColorIndex(0);
2892 std::vector< std::pair< rtl::Reference<SdrPathObj>,
double> > vNewList;
2902 if(pText || bLineGeometryNeededOnly || (drawing::LineStyle_NONE != eLineStyle) || (drawing::FillStyle_NONE != eFillStyle))
2903 vNewList.push_back(std::move(rCandidate));
2906 vObjectList = std::move(vNewList);
2908 if(1 == vObjectList.size())
2912 *vObjectList.begin()->first,
2913 vObjectList.begin()->second,
2920 sal_Int32 nLineObjectCount(0);
2950 if ( nLineObjectCount )
2960 if(bSortFilledObjectsToBack)
2962 std::vector< std::pair< rtl::Reference<SdrPathObj>,
double> > vTempList;
2963 vTempList.reserve(vObjectList.size());
2969 vTempList.push_back(std::move(rCandidate));
2974 if ( rCandidate.first )
2975 vTempList.push_back(std::move(rCandidate));
2978 vObjectList = std::move(vTempList);
2984 if(!vObjectList.empty())
2987 if(vObjectList.size() > 1)
2993 pRet->GetSubList()->NbcInsertObject(rCandidate.first.get());
2996 else if(1 == vObjectList.size())
2998 pRet = vObjectList.begin()->first;
3006 pRet->NbcSetSnapRect(aCurRect);
3020 pRet->SetMergedItemSet( *
this );
3043 pList->
Insert( aGluePoint );
static void CorrectCalloutArrows(MSO_SPT eSpType, sal_uInt32 nLineObjectCount, std::vector< std::pair< rtl::Reference< SdrPathObj >, double > > &vObjectList)
static double lcl_getNormalizedAngleRad(const double fCircleAngleDeg)
static double lcl_getYAdjustmentValue(std::u16string_view rShapeType, const sal_uInt32 nHandleIndex, const double fY, const double fW, const double fH)
static double lcl_getXAdjustmentValue(std::u16string_view rShapeType, const sal_uInt32 nHandleIndex, const double fX, const double fW, const double fH)
static double lcl_getAngleInOOXMLUnit(double fDY, double fDX)
static double lcl_getNormalizedCircleAngleRad(const double fWR, const double fHR, const double fEllipseAngleDeg)
static basegfx::B2DPolygon CreateArc(const tools::Rectangle &rRect, const Point &rStart, const Point &rEnd, const bool bClockwise)
static double lcl_getRadiusDistance(double fWR, double fHR, double fX, double fY)
bool SortFilledObjectsToBackByDefault(MSO_SPT eSpType)
bool Adjust(short nLuminancePercent, short nContrastPercent, short nChannelRPercent, short nChannelGPercent, short nChannelBPercent, double fGamma=1.0, bool bInvert=false, bool msoBrightness=false)
sal_uInt8 GetBlue() const
basegfx::BColor getBColor() const
sal_uInt8 GetGreen() const
rtl::Reference< SdrObject > CreateLineGeometry()
bool SetHandleControllerPosition(const sal_uInt32 nIndex, const css::awt::Point &rPosition)
bool GetHandlePosition(const sal_uInt32 nIndex, Point &rReturnPosition) const
SAL_DLLPRIVATE void AdaptObjColor(SdrPathObj &rObj, double dBrightness, const SfxItemSet &rCustomShapeSet, sal_uInt32 &nColorIndex, sal_uInt32 nColorCount)
SAL_DLLPRIVATE Color GetColorData(const Color &rFillColor, sal_uInt32 nIndex, double dBrightness) const
SAL_DLLPRIVATE void CreateSubPath(sal_Int32 &rSrcPt, sal_Int32 &rSegmentInd, std::vector< std::pair< rtl::Reference< SdrPathObj >, double > > &rObjectList, bool bLineGeometryNeededOnly, bool bSortFilledObjectsToBack, sal_Int32 nIndex)
virtual ~EnhancedCustomShape2d() override
SAL_DLLPRIVATE basegfx::B2DPoint GetPointAsB2DPoint(const css::drawing::EnhancedCustomShapeParameterPair &, const bool bScale=true, const bool bReplaceGeoSize=false) const
void GetParameter(double &rParameterReturnValue, const css::drawing::EnhancedCustomShapeParameter &, const bool bReplaceGeoWidth, const bool bReplaceGeoHeight) const
SAL_DLLPRIVATE double GetEnumFunc(const EnhancedCustomShape::ExpressionFunct eVal) const
sal_uInt32 GetHdlCount() const
SAL_DLLPRIVATE Point GetPoint(const css::drawing::EnhancedCustomShapeParameterPair &, const bool bScale=true, const bool bReplaceGeoSize=false) const
SAL_DLLPRIVATE void SetPathSize(sal_Int32 nIndex=0)
std::vector< EquationResult > m_vEquationResults
css::uno::Sequence< css::drawing::EnhancedCustomShapeTextFrame > m_seqTextFrames
SAL_DLLPRIVATE rtl::Reference< SdrObject > CreatePathObj(bool bLineGeometryNeededOnly)
sal_Int32 m_nCoordHeightG
EnhancedCustomShape2d(SdrObjCustomShape &rSdrObjCustomShape)
css::uno::Sequence< OUString > m_seqEquations
rtl::Reference< SdrObject > CreateObject(bool bLineGeometryNeededOnly)
SAL_DLLPRIVATE double GetAdjustValueAsDouble(const sal_Int32 nIndex) const
css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair > m_seqCoordinates
css::uno::Sequence< css::drawing::EnhancedCustomShapeAdjustmentValue > m_seqAdjustmentValues
static SAL_DLLPRIVATE bool ConvertSequenceToEnhancedCustomShape2dHandle(const css::beans::PropertyValues &rHandleProperties, EnhancedCustomShape2d::Handle &rDestinationHandle)
static void SetEnhancedCustomShapeParameter(css::drawing::EnhancedCustomShapeParameter &rParameter, const sal_Int32 nValue)
tools::Rectangle GetTextRect() const
static OUString GetEquation(const sal_uInt16 nFlags, sal_Int32 nPara1, sal_Int32 nPara2, sal_Int32 nPara3)
sal_Int32 GetLuminanceChange(sal_uInt32 nIndex) const
SAL_DLLPRIVATE void ApplyShapeAttributes(const SdrCustomShapeGeometryItem &rItem)
static SAL_DLLPRIVATE void SwapStartAndEndArrow(SdrObject *pObj)
static void SetEnhancedCustomShapeHandleParameter(css::drawing::EnhancedCustomShapeParameter &rParameter, const sal_Int32 nPara, const bool bIsSpecialValue, bool bHorz)
css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair > m_seqGluePoints
static SAL_DLLPRIVATE void AppendEnhancedCustomShapeEquationParameter(OUString &rParameter, const sal_Int32 nPara, const bool bIsSpecialValue)
css::uno::Sequence< css::drawing::EnhancedCustomShapeSegment > m_seqSegments
SAL_DLLPRIVATE double GetEquationValueAsDouble(const sal_Int32 nIndex) const
css::uno::Sequence< css::beans::PropertyValues > m_seqHandles
SAL_DLLPRIVATE bool SetAdjustValueAsDouble(const double &rValue, const sal_Int32 nIndex)
tools::Rectangle m_aLogicRect
std::vector< std::shared_ptr< EnhancedCustomShape::ExpressionNode > > m_vNodesSharedPtr
void ApplyGluePoints(SdrObject *pObj)
css::uno::Sequence< css::awt::Size > m_seqSubViewSize
SdrObjCustomShape & mrSdrObjCustomShape
The transformation of a rectangle into a polygon, by using angle parameters from GeoStat.
constexpr tools::Long Y() const
void setX(tools::Long nX)
void Move(tools::Long nHorzMove, tools::Long nVertMove)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
virtual const tools::Rectangle & GetSnapRect() const override
void SetPropertyValue(const css::beans::PropertyValue &rPropVal)
css::uno::Any * GetPropertyValueByName(const OUString &rPropName)
sal_uInt16 Insert(const SdrGluePoint &rGP)
void SetPercent(bool bOn)
void SetEscDir(SdrEscapeDirection nNewEsc)
void SetPos(const Point &rNewPos)
void SetAlign(SdrAlign nAlg)
double GetObjectRotation() const
const SfxPoolItem & GetMergedItem(const sal_uInt16 nWhich) const
virtual SdrGluePointList * ForceGluePointList()
SdrModel & getSdrModelFromSdrObject() const
const SfxItemSet & GetMergedItemSet() const
void ClearMergedItem(const sal_uInt16 nWhich=0)
void SetMergedItem(const SfxPoolItem &rItem)
void setFillGeometryDefiningShape(const SdrObject *pNew)
Rectangle objects (rectangle, circle, ...)
virtual SdrText * getActiveText() const
returns the currently active text.
virtual const tools::Rectangle & GetLogicRect() const override
const GeoStat & GetGeoStat() const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
const Color & GetColor() const
void SetColor(const Color &rColor)
void SetLineEndValue(const basegfx::B2DPolyPolygon &rPolyPolygon)
void SetLineStartValue(const basegfx::B2DPolyPolygon &rPolyPolygon)
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
void setClosed(bool bNew)
basegfx::B2DPoint const & getB2DPoint(sal_uInt32 nIndex) const
void transform(const basegfx::B2DHomMatrix &rMatrix)
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
void removeDoublePoints()
void setClosed(bool bNew)
void appendBezierSegment(const basegfx::B2DPoint &rNextControlPoint, const basegfx::B2DPoint &rPrevControlPoint, const basegfx::B2DPoint &rPoint)
void setBlue(double fNew)
void setGreen(double fNew)
void SetColorStops(const basegfx::BColorStops &rSteps)
const basegfx::BColorStops & GetColorStops() const
#define DBG_ASSERT(sCon, aError)
tools::Long FRound(double fVal)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
#define DFF_Prop_adjust4Value
#define DFF_Prop_geoRight
#define DFF_Prop_adjust2Value
#define DFF_Prop_adjust3Value
#define DFF_Prop_adjustValue
@ mso_sptActionButtonBlank
@ mso_sptAccentBorderCallout2
@ mso_sptAccentBorderCallout1
@ mso_sptActionButtonMovie
@ mso_sptActionButtonSound
@ mso_sptActionButtonReturn
@ mso_sptAccentBorderCallout90
@ mso_sptHorizontalScroll
@ mso_sptAccentBorderCallout3
@ mso_sptActionButtonHome
@ mso_sptCurvedRightArrow
@ mso_sptActionButtonDocument
@ mso_sptActionButtonForwardNext
@ mso_sptActionButtonBeginning
@ mso_sptActionButtonInformation
@ mso_sptActionButtonHelp
@ mso_sptActionButtonBackPrevious
#define DFF_Prop_geoBottom
#define DFF_Prop_adjust6Value
#define DFF_Prop_adjust8Value
#define DFF_Prop_adjust9Value
#define DFF_Prop_adjust10Value
#define DFF_Prop_adjust7Value
#define DFF_Prop_adjust5Value
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
BColor hsv2rgb(const BColor &rHSVColor)
BColor rgb2hsv(const BColor &rRGBColor)
B2DHomMatrix createScaleB2DHomMatrix(double fScaleX, double fScaleY)
B2DPolygon createPolygonFromEllipseSegment(const B2DPoint &rCenter, double fRadiusX, double fRadiusY, double fStart, double fEnd)
B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY)
B2DPolygon createPolygonFromEllipse(const B2DPoint &rCenter, double fRadiusX, double fRadiusY, sal_uInt32 nStartQuadrant=0)
void checkClosed(B2DPolygon &rCandidate)
constexpr double rad2deg(double v)
constexpr double deg2rad(double v)
constexpr bool starts_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
sal_uInt32 toUInt32(std::u16string_view str, sal_Int16 radix=10)
SwNodeOffset abs(const SwNodeOffset &a)
SdrOnOffItem makeSdrShadowItem(bool bShadow)
css::drawing::EnhancedCustomShapeParameter aXRangeMinimum
css::drawing::EnhancedCustomShapeParameter aYRangeMaximum
css::drawing::EnhancedCustomShapeParameter aXRangeMaximum
css::drawing::EnhancedCustomShapeParameterPair aPosition
css::drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum
css::drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum
css::drawing::EnhancedCustomShapeParameter aYRangeMinimum
css::drawing::EnhancedCustomShapeParameterPair aPolar
This exception is thrown, when the arithmetic expression parser failed to parse a string.
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_SHADOW(SDRATTR_SHADOW_FIRST+0)
constexpr TypedWhichId< SdrCustomShapeGeometryItem > SDRATTR_CUSTOMSHAPE_GEOMETRY(SDRATTR_CUSTOMSHAPE_FIRST+2)
constexpr TypedWhichId< SvxWritingModeItem > SDRATTR_TEXTDIRECTION(SDRATTR_NOTPERSIST_FIRST+34)
@ PolyLine
polygon, PolyPolygon
void ShearPoint(Point &rPnt, const Point &rRef, double tn, bool bVShear=false)
void RotatePoint(Point &rPnt, const Point &rRef, double sn, double cs)
constexpr TypedWhichId< XFillColorItem > XATTR_FILLCOLOR(XATTR_FILL_FIRST+1)
constexpr TypedWhichId< XLineStartWidthItem > XATTR_LINESTARTWIDTH(XATTR_LINE_FIRST+6)
constexpr TypedWhichId< XLineEndItem > XATTR_LINEEND(XATTR_LINE_FIRST+5)
constexpr TypedWhichId< XLineStartItem > XATTR_LINESTART(XATTR_LINE_FIRST+4)
constexpr TypedWhichId< XLineEndCenterItem > XATTR_LINEENDCENTER(XATTR_LINE_FIRST+9)
constexpr TypedWhichId< XFillHatchItem > XATTR_FILLHATCH(XATTR_FILL_FIRST+3)
constexpr TypedWhichId< XLineStartCenterItem > XATTR_LINESTARTCENTER(XATTR_LINE_FIRST+8)
constexpr TypedWhichId< XFillBitmapItem > XATTR_FILLBITMAP(XATTR_FILL_FIRST+4)
constexpr TypedWhichId< XLineStyleItem > XATTR_LINESTYLE(XATTR_LINE_FIRST)
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)
constexpr TypedWhichId< XFillGradientItem > XATTR_FILLGRADIENT(XATTR_FILL_FIRST+2)
constexpr TypedWhichId< XLineEndWidthItem > XATTR_LINEENDWIDTH(XATTR_LINE_FIRST+7)