47#include <com/sun/star/awt/Size.hpp>
48#include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
49#include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
50#include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
51#include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp>
52#include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp>
63#include <unordered_set>
68using namespace ::com::sun::star::drawing::EnhancedCustomShapeSegmentCommand;
72 sal_uInt32 nDat =
static_cast<sal_uInt32
>(
nValue);
73 sal_Int32 nNewValue =
nValue;
76 if ( ( nDat >> 16 ) == 0x8000 )
78 nNewValue =
static_cast<sal_uInt16
>(nDat);
79 rParameter.Type = EnhancedCustomShapeParameterType::EQUATION;
82 rParameter.Type = EnhancedCustomShapeParameterType::NORMAL;
83 rParameter.Value <<= nNewValue;
89 bool b1Special = ( nFlags & 0x2000 ) != 0;
90 bool b2Special = ( nFlags & 0x4000 ) != 0;
91 bool b3Special = ( nFlags & 0x8000 ) != 0;
92 switch( nFlags & 0xff )
97 sal_Int32 nOptimize = 0;
128 if ( b3Special || nP3 )
138 if ( b2Special || ( nP2 != 1 ) )
143 if ( b3Special || ( ( nP3 != 1 ) && ( nP3 != 0 ) ) )
197 aEquation +=
"sqrt(";
214 aEquation +=
"atan2(";
218 aEquation +=
")/(pi/180)";
224 aEquation +=
"*sin(";
226 aEquation +=
"*(pi/180))";
232 aEquation +=
"*cos(";
234 aEquation +=
"*(pi/180))";
240 aEquation +=
"*cos(atan2(";
250 aEquation +=
"*sin(atan2(";
259 aEquation +=
"sqrt(";
267 aEquation +=
"*sqrt(1-(";
282 aEquation +=
"*tan(";
289 aEquation +=
"sqrt(";
302 aEquation +=
"(cos(";
304 aEquation +=
"*(pi/180))*(";
306 aEquation +=
"-10800)+sin(";
308 aEquation +=
"*(pi/180))*(";
310 aEquation +=
"-10800))+10800";
315 aEquation +=
"-(sin(";
317 aEquation +=
"*(pi/180))*(";
319 aEquation +=
"-10800)-cos(";
321 aEquation +=
"*(pi/180))*(";
323 aEquation +=
"-10800))+10800";
332 if ( bIsSpecialValue )
337 rParameter += OUString::number( nPara & 0xff );
362 rParameter +=
"left";
372 rParameter +=
"right";
377 rParameter +=
"bottom";
385 rParameter += OUString::number( nPara );
392 if ( bIsSpecialValue )
394 if ( ( nPara >= 0x100 ) && ( nPara <= 0x107 ) )
397 rParameter.Type = EnhancedCustomShapeParameterType::ADJUSTMENT;
399 else if ( ( nPara >= 3 ) && ( nPara <= 0x82 ) )
402 rParameter.Type = EnhancedCustomShapeParameterType::EQUATION;
404 else if ( nPara == 0 )
408 rParameter.Type = EnhancedCustomShapeParameterType::LEFT;
410 rParameter.Type = EnhancedCustomShapeParameterType::TOP;
412 else if ( nPara == 1 )
416 rParameter.Type = EnhancedCustomShapeParameterType::RIGHT;
418 rParameter.Type = EnhancedCustomShapeParameterType::BOTTOM;
420 else if ( nPara == 2 )
423 rParameter.Type = EnhancedCustomShapeParameterType::NORMAL;
428 rParameter.Type = EnhancedCustomShapeParameterType::NORMAL;
434 rParameter.Type = EnhancedCustomShapeParameterType::NORMAL;
436 rParameter.Value <<=
nValue;
440 const css::beans::PropertyValues& rHandleProperties,
443 bool bRetValue =
false;
444 if ( rHandleProperties.hasElements() )
447 for (
const css::beans::PropertyValue& rPropVal : rHandleProperties )
449 if ( rPropVal.Name ==
"Position" )
451 if ( rPropVal.Value >>= rDestinationHandle.
aPosition )
454 else if ( rPropVal.Name ==
"MirroredX" )
457 if ( rPropVal.Value >>= bMirroredX )
463 else if ( rPropVal.Name ==
"MirroredY" )
466 if ( rPropVal.Value >>= bMirroredY )
472 else if ( rPropVal.Name ==
"Switched" )
475 if ( rPropVal.Value >>= bSwitched )
481 else if ( rPropVal.Name ==
"Polar" )
483 if ( rPropVal.Value >>= rDestinationHandle.
aPolar )
486 else if ( rPropVal.Name ==
"RefX" )
488 if ( rPropVal.Value >>= rDestinationHandle.
nRefX )
491 else if ( rPropVal.Name ==
"RefY" )
493 if ( rPropVal.Value >>= rDestinationHandle.
nRefY )
496 else if ( rPropVal.Name ==
"RefAngle" )
498 if ( rPropVal.Value >>= rDestinationHandle.
nRefAngle )
501 else if ( rPropVal.Name ==
"RefR" )
503 if ( rPropVal.Value >>= rDestinationHandle.
nRefR )
506 else if ( rPropVal.Name ==
"RadiusRangeMinimum" )
511 else if ( rPropVal.Name ==
"RadiusRangeMaximum" )
516 else if ( rPropVal.Name ==
"RangeXMinimum" )
521 else if ( rPropVal.Name ==
"RangeXMaximum" )
526 else if ( rPropVal.Name ==
"RangeYMinimum" )
531 else if ( rPropVal.Name ==
"RangeYMaximum" )
544 static constexpr OUStringLiteral sAdjustmentValues(
u"AdjustmentValues" );
551 static constexpr OUStringLiteral sViewBox(
u"ViewBox" );
553 css::awt::Rectangle aViewBox;
554 if ( pViewBox && (*pViewBox >>= aViewBox ) )
561 static constexpr OUStringLiteral sPath(
u"Path" );
562 static constexpr OUStringLiteral sCoordinates(
u"Coordinates" );
563 static constexpr OUStringLiteral sGluePoints(
u"GluePoints" );
564 static constexpr OUStringLiteral sSegments(
u"Segments" );
565 static constexpr OUStringLiteral sSubViewSize(
u"SubViewSize" );
566 static constexpr OUStringLiteral sStretchX(
u"StretchX" );
567 static constexpr OUStringLiteral sStretchY(
u"StretchY" );
568 static constexpr OUStringLiteral sTextFrames(
u"TextFrames" );
569 static constexpr OUStringLiteral sEquations(
u"Equations" );
570 static constexpr OUStringLiteral sHandles(
u"Handles" );
601 sal_Int32 nStretchX = 0;
602 if ( *pAny >>= nStretchX )
611 sal_Int32 nStretchY = 0;
612 if ( *pAny >>= nStretchY )
641 sal_Int32 nWidth = 0;
642 sal_Int32 nHeight = 0;
649 "set subpath " <<
nIndex <<
" size: " << nWidth <<
" x "
653 if ( nWidth && nHeight ) {
667 "ooxml shape, path width: " <<
nCoordWidth <<
" height: "
710:
SfxItemSet ( rSdrObjCustomShape.GetMergedItemSet() ),
711 mrSdrObjCustomShape ( rSdrObjCustomShape ),
715 nCoordWidthG ( 21600 ),
716 nCoordHeightG ( 21600 ),
717 bOOXMLShape ( false ),
718 nXRef ( 0x80000000 ),
719 nYRef ( 0x80000000 ),
744 aP.AdjustX( -(aS.
Width() / 2) );
745 aP.AdjustY( -(aS.
Height() / 2) );
750 static constexpr OUStringLiteral
sType =
u"Type";
753 *pAny >>= sShapeType;
759 static constexpr OUStringLiteral sMirroredX =
u"MirroredX";
760 static constexpr OUStringLiteral sMirroredY =
u"MirroredY";
798 if (sShapeType ==
"col-60da8460")
802 else if (sShapeType ==
"col-502ad400")
806 else if (sShapeType.getLength() > 4 && sShapeType.match(
"col-" ))
846 "error: equation number: " <<
i <<
", parser failed ("
859 case ExpressionFunct::EnumPi : fRet = M_PI;
break;
860 case ExpressionFunct::EnumLeft : fRet =
static_cast<double>(
nCoordLeft);
break;
861 case ExpressionFunct::EnumTop : fRet =
static_cast<double>(
nCoordTop);
break;
864 case ExpressionFunct::EnumXStretch : fRet =
nXRef;
break;
865 case ExpressionFunct::EnumYStretch : fRet =
nYRef;
break;
866 case ExpressionFunct::EnumHasStroke : fRet =
bStroked ? 1.0 : 0.0;
break;
867 case ExpressionFunct::EnumHasFill : fRet =
bFilled ? 1.0 : 0.0;
break;
868 case ExpressionFunct::EnumWidth : fRet =
nCoordWidth;
break;
869 case ExpressionFunct::EnumHeight : fRet =
nCoordHeight;
break;
878 double fNumber = 0.0;
885 sal_Int32 nNumber = 0;
887 fNumber =
static_cast<double>(nNumber);
894 double fNumber = 0.0;
895 static sal_uInt32 nLevel = 0;
913 << fNumber <<
" --> " << 180.0*fNumber/10800000.0);
915 if ( !std::isfinite( fNumber ) )
920 SAL_WARN(
"svx",
"EnhancedCustomShape2d::GetEquationValueAsDouble failed");
926 "?" <<
nIndex <<
" --> " << fNumber <<
" (angle: "
927 << 180.0*fNumber/10800000.0 <<
")");
935 bool bRetValue =
false;
940 pseqAdjustmentValues[
nIndex ].Value <<= rValue;
941 pseqAdjustmentValues[
nIndex ].State = css::beans::PropertyState_DIRECT_VALUE;
948 const bool bScale,
const bool bReplaceGeoSize )
const
952 GetParameter(fValX, rPair.First, bReplaceGeoSize,
false);
959 GetParameter(fValY, rPair.Second,
false, bReplaceGeoSize);
969 const bool bScale,
const bool bReplaceGeoSize )
const
976 const bool bReplaceGeoWidth,
const bool bReplaceGeoHeight )
const
979 switch ( rParameter.Type )
981 case EnhancedCustomShapeParameterType::ADJUSTMENT :
983 sal_Int32 nAdjustmentIndex = 0;
984 if ( rParameter.Value >>= nAdjustmentIndex )
990 case EnhancedCustomShapeParameterType::EQUATION :
992 sal_Int32 nEquationIndex = 0;
993 if ( rParameter.Value >>= nEquationIndex )
999 case EnhancedCustomShapeParameterType::NORMAL :
1001 if ( rParameter.Value.getValueTypeClass() == TypeClass_DOUBLE )
1004 if ( rParameter.Value >>= fValue )
1012 if ( rParameter.Value >>=
nValue )
1023 case EnhancedCustomShapeParameterType::LEFT :
1028 case EnhancedCustomShapeParameterType::TOP :
1033 case EnhancedCustomShapeParameterType::RIGHT :
1038 case EnhancedCustomShapeParameterType::BOTTOM :
1060 return ( nLumDat >> 28 ) * 10;
1067 if ( dBrightness == 0.0)
1073 if (dBrightness >=0.0)
1075 return Color(
static_cast<sal_uInt8>(
static_cast< sal_Int32
>( std::clamp(rFillColor.
GetRed() * (1.0-dBrightness) + dBrightness * 255.0, 0.0, 255.0) )),
1076 static_cast<sal_uInt8>(
static_cast< sal_Int32
>( std::clamp(rFillColor.
GetGreen() * (1.0-dBrightness) + dBrightness * 255.0, 0.0, 255.0) )),
1077 static_cast<sal_uInt8>(
static_cast< sal_Int32
>( std::clamp(rFillColor.
GetBlue() * (1.0-dBrightness) + dBrightness * 255.0, 0.0, 255.0) )) );
1081 return Color(
static_cast<sal_uInt8>(
static_cast< sal_Int32
>( std::clamp(rFillColor.
GetRed() * (1.0+dBrightness), 0.0, 255.0) )),
1082 static_cast<sal_uInt8>(
static_cast< sal_Int32
>( std::clamp(rFillColor.
GetGreen() * (1.0+dBrightness), 0.0, 255.0) )),
1083 static_cast<sal_uInt8>(
static_cast< sal_Int32
>( std::clamp(rFillColor.
GetBlue() * (1.0+dBrightness), 0.0, 255.0) )) );
1099 if( nLuminance > 0 )
1102 aHSVColor.
getGreen() * (1.0-nLuminance/100.0));
1105 (1.0-nLuminance/100.0)*aHSVColor.
getBlue());
1107 else if( nLuminance < 0 )
1110 (1.0+nLuminance/100.0)*aHSVColor.
getBlue());
1114 return Color(
static_cast<sal_uInt8>(
static_cast< sal_Int32
>( std::clamp(aHSVColor.
getRed(),0.0,1.0) * 255.0 + 0.5 )),
1115 static_cast<sal_uInt8>(
static_cast< sal_Int32
>( std::clamp(aHSVColor.
getGreen(),0.0,1.0) * 255.0 + 0.5 )),
1116 static_cast<sal_uInt8>(
static_cast< sal_Int32
>( std::clamp(aHSVColor.
getBlue(),0.0,1.0) * 255.0 + 0.5 )) );
1153 bool bRetValue =
false;
1169 double dx = fRadius *
fXScale;
1170 double fX = dx * cos(
a );
1171 double fY =-dx * sin(
a );
1174 FRound( fX + aReferencePoint.X() ),
1184 css::drawing::EnhancedCustomShapeParameter aFirst = aHandle.
aPosition.First;
1185 css::drawing::EnhancedCustomShapeParameter aSecond = aHandle.
aPosition.Second;
1220 const double fX,
const double fW,
const double fH)
1223 if (fW <= 0.0 || fH <= 0.0)
1227 if ((rShapeType ==
u"ooxml-bentArrow" && nHandleIndex == 2) || (rShapeType ==
u"ooxml-chevron")
1228 || (rShapeType ==
u"ooxml-curvedRightArrow") || (rShapeType ==
u"ooxml-foldedCorner")
1229 || (rShapeType ==
u"ooxml-homePlate") || (rShapeType ==
u"ooxml-notchedRightArrow")
1230 || (rShapeType ==
u"ooxml-nonIsoscelesTrapezoid" && nHandleIndex == 1)
1231 || (rShapeType ==
u"ooxml-rightArrow")
1232 || (rShapeType ==
u"ooxml-rightArrowCallout" && nHandleIndex == 2)
1233 || (rShapeType ==
u"ooxml-round1Rect")
1234 || (rShapeType ==
u"ooxml-round2DiagRect" && nHandleIndex == 1)
1235 || (rShapeType ==
u"ooxml-round2SameRect" && nHandleIndex == 0)
1236 || (rShapeType ==
u"ooxml-snip1Rect")
1237 || (rShapeType ==
u"ooxml-snip2DiagRect" && nHandleIndex == 1)
1238 || (rShapeType ==
u"ooxml-snip2SameRect" && nHandleIndex == 0)
1239 || (rShapeType ==
u"ooxml-snipRoundRect" && nHandleIndex == 1)
1240 || (rShapeType ==
u"ooxml-swooshArrow") || (rShapeType ==
u"ooxml-stripedRightArrow"))
1241 return (fW - fX) / std::min(fW, fH) * 100000.0;
1244 if ((rShapeType ==
u"ooxml-bentArrow" && nHandleIndex == 0)
1245 || (rShapeType ==
u"ooxml-bentArrow" && nHandleIndex == 3)
1246 || (rShapeType ==
u"ooxml-corner")
1247 || (rShapeType ==
u"ooxml-curvedDownArrow") || (rShapeType ==
u"ooxml-curvedLeftArrow")
1248 || (rShapeType ==
u"ooxml-curvedUpArrow") || (rShapeType ==
u"ooxml-leftArrow")
1249 || (rShapeType ==
u"ooxml-leftArrowCallout" && nHandleIndex == 2)
1250 || (rShapeType ==
u"ooxml-leftRightArrow")
1251 || (rShapeType ==
u"ooxml-leftRightArrowCallout" && nHandleIndex == 2)
1252 || (rShapeType ==
u"ooxml-leftRightRibbon")
1253 || (rShapeType ==
u"ooxml-nonIsoscelesTrapezoid" && nHandleIndex == 0)
1254 || (rShapeType ==
u"ooxml-parallelogram")
1255 || (rShapeType ==
u"ooxml-round2DiagRect" && nHandleIndex == 0)
1256 || (rShapeType ==
u"ooxml-round2SameRect" && nHandleIndex == 1)
1257 || (rShapeType ==
u"ooxml-roundRect")
1258 || (rShapeType ==
u"ooxml-snip2DiagRect" && nHandleIndex == 0)
1259 || (rShapeType ==
u"ooxml-snip2SameRect" && nHandleIndex == 1)
1260 || (rShapeType ==
u"ooxml-snipRoundRect" && nHandleIndex == 0)
1261 || (rShapeType ==
u"ooxml-uturnArrow" && nHandleIndex == 0)
1262 || (rShapeType ==
u"ooxml-uturnArrow" && nHandleIndex == 3))
1263 return fX / std::min(fW, fH) * 100000.0;
1266 if ((rShapeType ==
u"ooxml-downArrowCallout" && nHandleIndex == 0)
1267 || (rShapeType ==
u"ooxml-leftRightUpArrow" && nHandleIndex == 0)
1268 || (rShapeType ==
u"ooxml-quadArrow" && nHandleIndex == 0)
1269 || (rShapeType ==
u"ooxml-quadArrowCallout" && nHandleIndex == 0)
1270 || (rShapeType ==
u"ooxml-upArrowCallout" && nHandleIndex == 0)
1271 || (rShapeType ==
u"ooxml-upDownArrowCallout" && nHandleIndex == 0))
1272 return (fW / 2.0 - fX) / std::min(fW, fH) * 200000.0;
1275 if ((rShapeType ==
u"ooxml-downArrowCallout" && nHandleIndex == 1)
1276 || (rShapeType ==
u"ooxml-leftRightUpArrow" && nHandleIndex == 1)
1277 || (rShapeType ==
u"ooxml-quadArrow" && nHandleIndex == 1)
1278 || (rShapeType ==
u"ooxml-quadArrowCallout" && nHandleIndex == 1)
1279 || (rShapeType ==
u"ooxml-upArrowCallout" && nHandleIndex == 1)
1280 || (rShapeType ==
u"ooxml-upDownArrowCallout" && nHandleIndex == 1))
1281 return (fW / 2.0 - fX) / std::min(fW, fH) * 100000.0;
1284 if ((rShapeType ==
u"ooxml-bentUpArrow") || (rShapeType ==
u"ooxml-leftUpArrow")
1285 || (rShapeType ==
u"ooxml-uturnArrow" && nHandleIndex == 1))
1286 return (fW - fX) / std::min(fW, fH) * 50000.0;
1289 if (rShapeType ==
u"ooxml-nonIsoscelesTrapezoid" && nHandleIndex == 0)
1290 return fX / std::min(fW, fH) * 200000.0;
1293 if ((rShapeType ==
u"ooxml-downArrow" && nHandleIndex == 0)
1294 || (rShapeType ==
u"ooxml-ellipseRibbon") || (rShapeType ==
u"ooxml-ellipseRibbon2")
1295 || (rShapeType ==
u"ooxml-leftRightArrowCallout" && nHandleIndex == 3)
1296 || (rShapeType ==
u"ooxml-ribbon") || (rShapeType ==
u"ooxml-ribbon2")
1297 || (rShapeType ==
u"ooxml-upArrow" && nHandleIndex == 0)
1298 || (rShapeType ==
u"ooxml-upDownArrow" && nHandleIndex == 0))
1299 return (fW / 2.0 - fX) / fW * 200000.0;
1302 if ((rShapeType ==
u"ooxml-cloudCallout") || (rShapeType ==
u"ooxml-doubleWave")
1303 || (rShapeType ==
u"ooxml-wave") || (rShapeType ==
u"ooxml-wedgeEllipseCallout")
1304 || (rShapeType ==
u"ooxml-wedgeRectCallout")
1305 || (rShapeType ==
u"ooxml-wedgeRoundRectCallout"))
1306 return (fX - fW / 2.0) / fW * 100000.0;
1309 if (rShapeType ==
u"ooxml-teardrop")
1310 return (fX - fW / 2.0) / fW * 200000.0;
1313 if (rShapeType ==
u"ooxml-leftArrowCallout" && nHandleIndex == 3)
1314 return (fW - fX) / fW * 100000.0;
1317 if (rShapeType ==
u"ooxml-mathDivide")
1318 return (fW / 2.0 - fX) / fH * 100000.0;
1322 return fX / fW * 100000.0;
1328 const double fY,
const double fW,
const double fH)
1331 if (fW <= 0.0 || fH <= 0.0)
1335 if ((rShapeType ==
u"ooxml-leftArrowCallout" && nHandleIndex == 1)
1336 || (rShapeType ==
u"ooxml-leftRightArrowCallout" && nHandleIndex == 1)
1337 || (rShapeType ==
u"ooxml-rightArrowCallout" && nHandleIndex == 1))
1338 return (fH / 2.0 - fY) / std::min(fW, fH) * 100000.0;
1341 if ((rShapeType ==
u"ooxml-curvedLeftArrow") || (rShapeType ==
u"ooxml-curvedRightArrow")
1342 || (rShapeType ==
u"ooxml-leftArrowCallout" && nHandleIndex == 0)
1343 || (rShapeType ==
u"ooxml-leftRightArrowCallout" && nHandleIndex == 0)
1344 || (rShapeType ==
u"ooxml-mathPlus")
1345 || (rShapeType ==
u"ooxml-rightArrowCallout" && nHandleIndex == 0))
1346 return (fH / 2.0 - fY) / std::min(fW, fH) * 200000.0;
1349 if ((rShapeType ==
u"ooxml-bentUpArrow" && nHandleIndex == 0) || (rShapeType ==
u"ooxml-corner")
1350 || (rShapeType ==
u"ooxml-curvedDownArrow") || (rShapeType ==
u"ooxml-downArrow")
1351 || (rShapeType ==
u"ooxml-downArrowCallout" && nHandleIndex == 2)
1352 || (rShapeType ==
u"ooxml-uturnArrow" && nHandleIndex == 2))
1353 return (fH - fY) / std::min(fW, fH) * 100000.0;
1356 if (rShapeType ==
u"ooxml-leftUpArrow" && nHandleIndex == 0)
1357 return (fH - fY) / std::min(fW, fH) * 200000.0;
1360 if ((rShapeType ==
u"ooxml-bentUpArrow" && nHandleIndex == 2)
1361 || (rShapeType ==
u"ooxml-bracePair") || (rShapeType ==
u"ooxml-bracketPair")
1362 || (rShapeType ==
u"ooxml-can") || (rShapeType ==
u"ooxml-cube")
1363 || (rShapeType ==
u"ooxml-curvedUpArrow") || (rShapeType ==
u"ooxml-halfFrame")
1364 || (rShapeType ==
u"ooxml-leftBrace" && nHandleIndex == 0)
1365 || (rShapeType ==
u"ooxml-leftBracket") || (rShapeType ==
u"ooxml-leftRightUpArrow")
1366 || (rShapeType ==
u"ooxml-leftUpArrow" && nHandleIndex == 2)
1367 || (rShapeType ==
u"ooxml-mathMultiply") || (rShapeType ==
u"ooxml-quadArrow")
1368 || (rShapeType ==
u"ooxml-quadArrowCallout" && nHandleIndex == 2)
1369 || (rShapeType ==
u"ooxml-rightBrace" && nHandleIndex == 0)
1370 || (rShapeType ==
u"ooxml-rightBracket") || (rShapeType ==
u"ooxml-upArrow")
1371 || (rShapeType ==
u"ooxml-upArrowCallout" && nHandleIndex == 2)
1372 || (rShapeType ==
u"ooxml-upDownArrow")
1373 || (rShapeType ==
u"ooxml-upDownArrowCallout" && nHandleIndex == 2)
1374 || (rShapeType ==
u"ooxml-verticalScroll"))
1375 return fY / std::min(fW, fH) * 100000.0;
1378 if (rShapeType ==
u"ooxml-bentArrow")
1379 return fY / std::min(fW, fH) * 50000.0;
1382 if ((rShapeType ==
u"ooxml-mathDivide" && nHandleIndex == 1)
1383 || (rShapeType ==
u"ooxml-mathEqual" && nHandleIndex == 0)
1384 || (rShapeType ==
u"ooxml-mathNotEqual" && nHandleIndex == 0)
1385 || (rShapeType ==
u"ooxml-star4") || (rShapeType ==
u"ooxml-star6")
1386 || (rShapeType ==
u"ooxml-star8") || (rShapeType ==
u"ooxml-star10")
1387 || (rShapeType ==
u"ooxml-star12") || (rShapeType ==
u"ooxml-star16")
1388 || (rShapeType ==
u"ooxml-star24") || (rShapeType ==
u"ooxml-star32"))
1389 return (fH / 2.0 - fY) / fH * 100000.0;
1392 if ((rShapeType ==
u"ooxml-leftArrow") || (rShapeType ==
u"ooxml-leftRightArrow")
1393 || (rShapeType ==
u"ooxml-mathDivide" && nHandleIndex == 0)
1394 || (rShapeType ==
u"ooxml-mathEqual" && nHandleIndex == 1)
1395 || (rShapeType ==
u"ooxml-mathMinus") || (rShapeType ==
u"ooxml-notchedRightArrow")
1396 || (rShapeType ==
u"ooxml-mathNotEqual" && nHandleIndex == 2)
1397 || (rShapeType ==
u"ooxml-quadArrowCallout" && nHandleIndex == 3)
1398 || (rShapeType ==
u"ooxml-rightArrow") || (rShapeType ==
u"ooxml-stripedRightArrow")
1399 || (rShapeType ==
u"ooxml-upDownArrowCallout" && nHandleIndex == 3))
1400 return (fH / 2.0 - fY) / fH * 200000.0;
1403 if ((rShapeType ==
u"ooxml-cloudCallout") || (rShapeType ==
u"ooxml-wedgeEllipseCallout")
1404 || (rShapeType ==
u"ooxml-wedgeRectCallout")
1405 || (rShapeType ==
u"ooxml-wedgeRoundRectCallout"))
1406 return (fY - fH / 2.0) / fH * 100000.0;
1409 if ((rShapeType ==
u"ooxml-ellipseRibbon" && nHandleIndex == 2)
1410 || (rShapeType ==
u"ooxml-ellipseRibbon2" && nHandleIndex == 0)
1411 || (rShapeType ==
u"ooxml-ribbon2")
1412 || (rShapeType ==
u"ooxml-upArrowCallout" && nHandleIndex == 3))
1413 return (fH - fY) / fH * 100000.0;
1416 if (rShapeType ==
u"ooxml-smileyFace")
1417 return (fY - fH * 16515.0 / 21600.0) / fH * 100000.0;
1420 if (rShapeType ==
u"ooxml-star5")
1421 return (fH / 2.0 - fY * 100000.0 / 110557.0) / fH * 100000.0;
1422 if (rShapeType ==
u"ooxml-star7")
1423 return (fH / 2.0 - fY * 100000.0 / 105210.0) / fH * 100000.0;
1426 if (rShapeType ==
u"ooxml-swooshArrow")
1427 return (fY - std::min(fW, fH) / 8.0) / fH * 100000.0;
1430 if (rShapeType ==
u"ooxml-leftRightRibbon")
1431 return fY / fH * 200000 - 100000;
1435 return fY / fH * 100000.0;
1442 if (fDX != 0.0 || fDY != 0.0)
1444 double fAngleRad(atan2(fDY, fDX));
1463 return std::min(fHR - fY, fWR);
1465 return std::min(fWR - fX, fHR);
1467 double fD = std::min(fWR, fHR) - std::hypot(fX, fY);
1473 const double fOldD(fD);
1474 const double fWRmD(fWR - fD);
1475 const double fHRmD(fHR - fD);
1477 = fX * fX * fHRmD * fHRmD + fY * fY * fWRmD * fWRmD - fWRmD * fWRmD * fHRmD * fHRmD;
1479 = 2.0 * (fHRmD * (fWRmD * fWRmD - fX * fX) + fWRmD * (fHRmD * fHRmD - fY * fY));
1480 if (fDenominator != 0.0)
1482 fD = fD - fNumerator / fDenominator;
1483 bFound = fabs(fOldD - fD) < 1.0E-12;
1487 }
while (nIter < 50 && !bFound);
1498 OUString sShapeType(
"non-primitive");
1502 *pAny >>= sShapeType;
1504 bool bRetValue =
false;
1510 Point aP( rPosition.X, rPosition.Y );
1532 double fPos1 = aP.X();
1533 double fPos2 = aP.Y();
1561 double fTmp = fWidth;
1569 sal_Int32 nFirstAdjustmentValue = -1, nSecondAdjustmentValue = -1;
1575 if ( aHandle.
aPosition.First.Type == EnhancedCustomShapeParameterType::ADJUSTMENT )
1576 aHandle.
aPosition.First.Value >>= nFirstAdjustmentValue;
1577 if ( aHandle.
aPosition.Second.Type == EnhancedCustomShapeParameterType::ADJUSTMENT )
1578 aHandle.
aPosition.Second.Value>>= nSecondAdjustmentValue;
1584 nFirstAdjustmentValue = aHandle.
nRefR;
1586 nSecondAdjustmentValue = aHandle.
nRefAngle;
1589 double fRadius(0.0);
1596 double fDX = fPos1 - fWidth / 2.0;
1597 double fDY = fPos2 - fHeight / 2.0;
1600 if (sShapeType ==
"ooxml-blockArc" &&
nIndex == 1)
1607 double fRadiusDifference
1609 double fss(std::min(fWidth, fHeight));
1611 fRadius = fRadiusDifference * 100000.0 / fss;
1613 else if (sShapeType ==
"ooxml-donut" || sShapeType ==
"ooxml-noSmoking")
1616 double fss(std::min(fWidth, fHeight));
1618 fRadius = fPos1 * 100000.0 / fss;
1620 else if ((sShapeType ==
"ooxml-circularArrow"
1621 || sShapeType ==
"ooxml-leftRightCircularArrow"
1622 || sShapeType ==
"ooxml-leftCircularArrow")
1627 if (sShapeType ==
"ooxml-leftCircularArrow")
1632 fAngle += 21600000.0;
1635 else if ((sShapeType ==
"ooxml-circularArrow"
1636 || sShapeType ==
"ooxml-leftCircularArrow"
1637 || sShapeType ==
"ooxml-leftRightCircularArrow")
1645 double fRadiusDifferenceHandle
1648 double fss(std::min(fWidth, fHeight));
1651 fadj5 = fadj5 * fss / 100000.0;
1652 fRadius = 2.0 * (fadj5 - fRadiusDifferenceHandle);
1653 fRadius = fRadius * 100000.0 / fss;
1658 else if ((sShapeType ==
"ooxml-circularArrow"
1659 || sShapeType ==
"ooxml-leftCircularArrow"
1660 || sShapeType ==
"ooxml-leftRightCircularArrow")
1666 double fAngleRad(0.0);
1667 if (fDX != 0.0 || fDY != 0.0)
1668 fAngleRad = atan2(fDY, fDX);
1669 double fHelpX = cos(fAngleRad) * fHeight / 2.0;
1670 double fHelpY = sin(fAngleRad) * fWidth / 2.0;
1671 if (fHelpX != 0.0 || fHelpY != 0.0)
1673 double fHelpAngle = atan2(fHelpY, fHelpX);
1674 double fOuterX = fWidth / 2.0 * cos(fHelpAngle);
1675 double fOuterY = fHeight / 2.0 * sin(fHelpAngle);
1676 double fOuterRadius = std::hypot(fOuterX, fOuterY);
1677 double fHandleRadius = std::hypot(fDX, fDY);
1678 fRadius = (fOuterRadius - fHandleRadius) / 2.0;
1679 double fss(std::min(fWidth, fHeight));
1681 fRadius = fRadius * 100000.0 / fss;
1685 else if (sShapeType ==
"ooxml-mathNotEqual" &&
nIndex == 1)
1689 fadj1 = fadj1 * fHeight / 100000.0;
1690 fadj3 = fadj3 * fHeight / 100000.0;
1691 double fDYRefHorizBar = fDY + fadj1 + fadj3;
1692 if (fDX != 0.0 || fDYRefHorizBar != 0.0)
1695 fAngle = (fRawAngleDeg + 180.0) * 60000.0;
1704 fRadius = std::hypot(fDX, fDY);
1705 double fss(std::min(fWidth, fHeight));
1707 fRadius = fRadius * 100000.0 / fss;
1712 double fXRef, fYRef;
1720 fXRef = fWidth / 2.0;
1721 fYRef = fHeight / 2.0;
1723 const double fDX = fPos1 - fXRef;
1724 const double fDY = fPos2 - fYRef;
1728 if (fDX != 0.0 || fDY != 0.0)
1730 fRadius = std::hypot(fDX, fDY);
1740 if ( fRadius < fMin )
1747 if ( fRadius > fMax )
1751 if ( nFirstAdjustmentValue >= 0 )
1753 if ( nSecondAdjustmentValue >= 0 )
1764 double fAdjustX = fPos1;
1765 double fAdjustY = fPos2;
1768 nFirstAdjustmentValue = aHandle.
nRefX;
1769 if ((sShapeType ==
"ooxml-gear6") || (sShapeType ==
"ooxml-gear9"))
1772 double fss(std::min(fWidth, fHeight));
1774 double fth(fadj1 * fss / 100000.0);
1775 double frw(fWidth / 2.0 - fth);
1776 double frh(fHeight / 2.0 - fth);
1777 double fDX(fPos1 - fWidth / 2.0);
1778 double fDY(fPos2 - fHeight / 2.0);
1780 if (fDX != 0.0 || fDY != 0.0)
1781 fbA = atan2(fDY, fDX);
1783 double ftmpX(frh * cos(fbA));
1784 double ftmpY(frw * sin(fbA));
1785 if (ftmpX != 0.0 || ftmpY != 0.0)
1786 faA = atan2(ftmpY, ftmpX);
1788 double fha(-M_PI_2 - faA);
1789 if (
abs(fha) == M_PI_2)
1791 double flFD(2 * std::min(frw, frh) * tan(fha) - fth);
1793 fAdjustX = flFD / fss * 100000.0;
1799 if ((sShapeType ==
"ooxml-curvedDownArrow")
1800 || (sShapeType ==
"ooxml-curvedUpArrow"))
1802 double fss(std::min(fWidth, fHeight));
1806 double fHScaled(100000.0 * fHeight / fss);
1807 double fRadicand(fHScaled * fHScaled - fadj3 * fadj3);
1808 double fSqrt = fRadicand >= 0.0 ? sqrt(fRadicand) : 0.0;
1809 double fPart(200000.0 * fWidth / fss * (fSqrt + fHScaled));
1810 fAdjustX = fPart - 4.0 * fHScaled * fAdjustX;
1815 fAdjustX = fAdjustX - fadj2 * (fSqrt + fHScaled);
1816 double fDenominator(fSqrt - 3.0 * fHScaled);
1817 fAdjustX /= fDenominator != 0.0 ? fDenominator : 1.0;
1823 fAdjustX = fAdjustX - fadj1 * (fSqrt - fHScaled);
1824 double fDenominator(fSqrt + 3.0 * fHScaled);
1825 fAdjustX /= fDenominator != 0.0 ? fDenominator : 1.0;
1834 nSecondAdjustmentValue = aHandle.
nRefY;
1835 if ((sShapeType ==
"ooxml-gear6") || (sShapeType ==
"ooxml-gear9"))
1838 double fDX = fPos1 - fWidth / 2.0;
1839 double fDY = fPos2 - fHeight / 2.0;
1840 double fRadiusDifference
1842 double fss(std::min(fWidth, fHeight));
1844 fAdjustY = fRadiusDifference / fss * 100000.0;
1850 if (sShapeType ==
"ooxml-mathDivide" &&
nIndex == 1)
1853 else if (sShapeType ==
"ooxml-mathEqual" &&
nIndex == 0)
1855 else if (sShapeType ==
"ooxml-mathNotEqual" &&
nIndex == 0)
1857 else if (sShapeType ==
"ooxml-leftUpArrow" &&
nIndex == 0)
1859 else if ((sShapeType ==
"ooxml-curvedRightArrow")
1860 || (sShapeType ==
"ooxml-curvedLeftArrow"))
1862 double fss(std::min(fWidth, fHeight));
1866 double fWScaled(100000.0 * fWidth / fss);
1867 double fRadicand(fWScaled * fWScaled - fadj3 * fadj3);
1868 double fSqrt = fRadicand >= 0.0 ? sqrt(fRadicand) : 0.0;
1873 fAdjustY = fWScaled * (2.0 * fAdjustY - fadj2);
1874 fAdjustY += (200000.0 / fss * fHeight - fadj2) * fSqrt;
1875 double fDenominator(fSqrt + fWScaled);
1876 fAdjustY /= fDenominator != 0.0 ? fDenominator : 1.0;
1882 fAdjustY = fWScaled * (2.0 * fAdjustY + fadj1);
1883 fAdjustY += (200000.0 / fss * fHeight - fadj1) * fSqrt;
1884 double fDenominator(fSqrt + 3.0 * fWScaled);
1885 fAdjustY /= fDenominator != 0.0 ? fDenominator : 1.0;
1889 else if (sShapeType ==
"ooxml-uturnArrow" &&
nIndex == 2)
1891 double fss(std::min(fWidth, fHeight));
1895 fAdjustY += fHeight / fss * (fadj5 - 100000.0);
1898 else if (sShapeType ==
"ooxml-leftRightRibbon")
1908 if ( nFirstAdjustmentValue >= 0 )
1914 if (fAdjustX < fXMin)
1921 if (fAdjustX > fXMax)
1926 if ( nSecondAdjustmentValue >= 0 )
1932 if (fAdjustY < fYMin)
1939 if (fAdjustY > fYMax)
1947 css::beans::PropertyValue aPropVal;
1948 aPropVal.Name =
"AdjustmentValues";
1981 Point aStart( rStart );
1984 sal_Int32 bSwapStartEndAngle = 0;
1987 bSwapStartEndAngle ^= 0x01;
1989 bSwapStartEndAngle ^= 0x11;
1990 if ( bSwapStartEndAngle )
1993 if ( bSwapStartEndAngle & 1 )
1995 Point aTmp( aStart );
2006 for ( sal_uInt16 j = aTempPoly.
GetSize(); j--; )
2013 for ( sal_uInt16 j = 0; j < aTempPoly.
GetSize(); j++ )
2025 double fEAngleDeg(fmod(fEllipseAngleDeg, 360.0));
2026 if (fEAngleDeg < 0.0)
2027 fEAngleDeg += 360.0;
2028 if (fEAngleDeg == 0.0 || fEAngleDeg == 90.0 || fEAngleDeg == 180.0 || fEAngleDeg == 270.0)
2032 if (fX != 0.0 || fY != 0.0)
2034 fRet = atan2(fY, fX);
2043 double fRet(fmod(fCircleAngleDeg, 360.0));
2051 sal_Int32& rSegmentInd,
2053 const bool bLineGeometryNeededOnly,
2054 const bool bSortFilledObjectsToBack,
2057 bool bNoFill =
false;
2058 bool bNoStroke =
false;
2059 double dBrightness = 0.0;
2067 if ( !nSegInfoSize )
2069 for (
const EnhancedCustomShapeParameterPair& rCoordinate : std::as_const(
seqCoordinates) )
2071 const Point aTempPoint(
GetPoint( rCoordinate,
true,
true ));
2080 for ( ;rSegmentInd < nSegInfoSize; )
2082 sal_Int16 nCommand =
seqSegments[ rSegmentInd ].Command;
2083 sal_Int16 nPntCount=
seqSegments[ rSegmentInd++ ].Count;
2107 if(aNewB2DPolygon.
count() > 1)
2111 aNewB2DPolyPolygon.
append(aNewB2DPolygon);
2114 aNewB2DPolygon.
clear();
2116 if ( rSrcPt < nCoordSize )
2121 "moveTo: " << aTempPoint.X() <<
","
2131 if(aNewB2DPolygon.
count())
2133 if(aNewB2DPolygon.
count() > 1)
2136 aNewB2DPolyPolygon.
append(aNewB2DPolygon);
2139 aNewB2DPolygon.
clear();
2145 for ( sal_uInt16
i = 0; (
i < nPntCount ) && ( ( rSrcPt + 2 ) < nCoordSize );
i++ )
2151 DBG_ASSERT(aNewB2DPolygon.
count(),
"EnhancedCustomShape2d::CreateSubPath: Error in adding control point (!)");
2161 case ANGLEELLIPSETO:
2171 const bool bIsFromBinaryImport(sShpType.startsWith(
"mso"));
2174 const std::unordered_set<OUString> aPresetShapesWithU =
2175 {
"ellipse",
"ring",
"smiley",
"sun",
"forbidden",
"flowchart-connector",
2176 "flowchart-summing-junction",
"flowchart-or",
"cloud-callout"};
2177 std::unordered_set<OUString>::const_iterator aIter = aPresetShapesWithU.find(sShpType);
2178 const bool bIsPresetShapeWithU(aIter != aPresetShapesWithU.end());
2180 for (sal_uInt16
i = 0; (
i < nPntCount) && ((rSrcPt + 2) < nCoordSize);
i++)
2184 if (ANGLEELLIPSE == nCommand)
2186 if (aNewB2DPolygon.
count() > 1)
2190 aNewB2DPolyPolygon.
append(aNewB2DPolygon);
2192 aNewB2DPolygon.
clear();
2208 double fScaledWR(fWR *
fXScale);
2209 double fScaledHR(fHR *
fYScale);
2210 if (fScaledWR == 0.0 && fScaledHR == 0.0)
2213 aNewB2DPolygon.
append(aCenter);
2217 if (bIsFromBinaryImport)
2235 double fSwingAngle = fEndAngle;
2236 if (sShpType !=
"mso-spt143")
2238 fStartAngle /= 65536.0;
2239 fSwingAngle = fEndAngle / 65536.0;
2242 fStartAngle = -fStartAngle;
2243 fSwingAngle = -fSwingAngle;
2245 fEndAngle = fStartAngle + fSwingAngle;
2246 if (fSwingAngle < 0.0)
2247 std::swap(fStartAngle, fEndAngle);
2248 double fFrom(fStartAngle);
2249 double fTo(fFrom + 180.0);
2253 while (fTo < fEndAngle)
2264 if (fSwingAngle < 0)
2265 aTempB2DPolygon.
flip();
2266 aNewB2DPolygon.
append(aTempB2DPolygon);
2273 if (bIsPresetShapeWithU)
2293 if (fabs(fabs(fEndAngle - fStartAngle) - 360.0) < 1.0E-15)
2314 case QUADRATICCURVETO :
2316 for ( sal_Int32
i(0); (
i < nPntCount ) && ( rSrcPt + 1 < nCoordSize );
i++ )
2318 DBG_ASSERT(aNewB2DPolygon.
count(),
"EnhancedCustomShape2d::CreateSubPath: Error no previous point for Q (!)");
2319 if (aNewB2DPolygon.
count() > 0)
2332 aNewB2DPolygon.
append(aEnd);
2340 for ( sal_Int32
i(0); (
i < nPntCount ) && ( rSrcPt < nCoordSize );
i++ )
2345 "lineTo: " << aTempPoint.X() <<
","
2355 case CLOCKWISEARCTO :
2357 bool bClockwise = ( nCommand == CLOCKWISEARC ) || ( nCommand == CLOCKWISEARCTO );
2358 bool bImplicitMoveTo = (nCommand ==
ARC) || (nCommand == CLOCKWISEARC);
2359 sal_uInt32 nXor = bClockwise ? 3 : 2;
2360 for ( sal_uInt16
i = 0; (
i < nPntCount ) && ( ( rSrcPt + 3 ) < nCoordSize );
i++ )
2362 if (bImplicitMoveTo)
2364 if (aNewB2DPolygon.
count() > 1)
2369 aNewB2DPolyPolygon.
append(aNewB2DPolygon);
2371 aNewB2DPolygon.
clear();
2388 double fStartAngle, fSwingAngle;
2390 for ( sal_uInt16
i = 0; (
i < nPntCount ) && ( rSrcPt + 1 < nCoordSize );
i++ )
2394 fWR = aTempPair.
getX();
2395 fHR = aTempPair.
getY();
2397 fStartAngle = aTempPair.
getX();
2398 fSwingAngle = aTempPair.
getY();
2405 fSwingAngle = std::clamp(fSwingAngle, -360.0, 360.0);
2408 SAL_INFO(
"svx",
"ARCANGLETO scale: " << fWR <<
"x" << fHR <<
" angles: " << fStartAngle <<
"," << fSwingAngle);
2410 if (aNewB2DPolygon.
count() > 0)
2415 if (fWR == 0.0 && fHR == 0.0)
2422 double fEndAngle = fStartAngle + fSwingAngle;
2425 if (fSwingAngle < 0.0)
2426 std::swap(fStartAngle, fEndAngle);
2429 double fFrom(fStartAngle);
2431 if (fSwingAngle >= 360.0 || fSwingAngle <= -360.0)
2433 double fTo(fFrom + 180.0);
2434 while (fTo < fEndAngle)
2446 if (fSwingAngle < 0)
2447 aTempB2DPolygon.
flip();
2460 aNewB2DPolygon.
append(aTempB2DPolygon);
2468 case ELLIPTICALQUADRANTX :
2469 case ELLIPTICALQUADRANTY :
2471 if (nPntCount && (rSrcPt < nCoordSize))
2485 aNewB2DPolygon.
append(aStart);
2490 bool bIsXDirection(nCommand == ELLIPTICALQUADRANTX);
2492 for ( ; (
i < nPntCount ) && ( rSrcPt < nCoordSize );
i++ )
2496 double fRadiusX = fabs(aEnd.
getX() - aStart.
getX());
2497 double fRadiusY = fabs(aEnd.
getY() - aStart.
getY());
2554 aNewB2DPolygon.
append(aArc);
2556 bIsXDirection = !bIsXDirection;
2564#ifdef DBG_CUSTOMSHAPE
2568 SAL_WARN(
"svx",
"CustomShapes::unknown PolyFlagValue :" << nCommand );
2573 if ( nCommand == ENDSUBPATH )
2577 if ( rSegmentInd == nSegInfoSize )
2580 if(aNewB2DPolygon.
count() > 1)
2584 aNewB2DPolyPolygon.
append(aNewB2DPolygon);
2587 if(!aNewB2DPolyPolygon.
count())
2591 bool bForceCreateTwoObjects(
false);
2593 if(!bSortFilledObjectsToBack && !aNewB2DPolyPolygon.
isClosed() && !bNoStroke)
2595 bForceCreateTwoObjects =
true;
2598 if(bLineGeometryNeededOnly)
2600 bForceCreateTwoObjects =
true;
2605 if(bForceCreateTwoObjects || bSortFilledObjectsToBack)
2614 std::move(aClosedPolyPolygon)));
2618 pFill->SetMergedItemSet(aTempSet);
2631 aNewB2DPolyPolygon));
2635 pStroke->SetMergedItemSet(aTempSet);
2651 aNewB2DPolyPolygon);
2660 aNewB2DPolyPolygon);
2668 pObj->SetMergedItemSet(aTempSet);
2675 sal_uInt32 nLineObjectCount,
2678 bool bAccent =
false;
2693 sal_uInt32 nLine = 0;
2702 if ( nLine == nLineObjectCount )
2720 sal_uInt32 nLine = 0;
2731 else if ( ( bAccent && ( nLine == nLineObjectCount - 1 ) ) || ( !bAccent && ( nLine == nLineObjectCount ) ) )
2748 sal_uInt32 nLine = 0;
2776 sal_uInt32& nColorIndex,
2777 sal_uInt32 nColorCount)
2783 if (eFillStyle == drawing::FillStyle_NONE)
2786 switch( eFillStyle )
2789 case drawing::FillStyle_SOLID:
2791 if ( nColorCount || 0.0 != dBrightness )
2795 std::min(nColorIndex, nColorCount-1),
2801 case drawing::FillStyle_GRADIENT:
2805 if ( nColorCount || 0.0 != dBrightness )
2810 std::min(nColorIndex, nColorCount-1),
2815 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() )
2888 const sal_uInt32 nColorCount(
nColorData >> 28);
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 );
3033 for (
const auto& rGluePoint : std::as_const(
seqGluePoints) )
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
sal_uInt8 GetGreen() const
rtl::Reference< SdrObject > CreateLineGeometry()
css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair > seqGluePoints
bool SetHandleControllerPosition(const sal_uInt32 nIndex, const css::awt::Point &rPosition)
css::uno::Sequence< OUString > seqEquations
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
css::uno::Sequence< css::beans::PropertyValues > seqHandles
SAL_DLLPRIVATE double GetEnumFunc(const EnhancedCustomShape::ExpressionFunct eVal) const
std::vector< std::shared_ptr< EnhancedCustomShape::ExpressionNode > > vNodesSharedPtr
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)
SAL_DLLPRIVATE rtl::Reference< SdrObject > CreatePathObj(bool bLineGeometryNeededOnly)
EnhancedCustomShape2d(SdrObjCustomShape &rSdrObjCustomShape)
rtl::Reference< SdrObject > CreateObject(bool bLineGeometryNeededOnly)
SAL_DLLPRIVATE double GetAdjustValueAsDouble(const sal_Int32 nIndex) const
css::uno::Sequence< css::drawing::EnhancedCustomShapeTextFrame > seqTextFrames
static SAL_DLLPRIVATE bool ConvertSequenceToEnhancedCustomShape2dHandle(const css::beans::PropertyValues &rHandleProperties, EnhancedCustomShape2d::Handle &rDestinationHandle)
css::uno::Sequence< css::drawing::EnhancedCustomShapeAdjustmentValue > seqAdjustmentValues
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
tools::Rectangle aLogicRect
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)
static SAL_DLLPRIVATE void AppendEnhancedCustomShapeEquationParameter(OUString &rParameter, const sal_Int32 nPara, const bool bIsSpecialValue)
std::vector< EquationResult > vEquationResults
css::uno::Sequence< css::drawing::EnhancedCustomShapeSegment > seqSegments
SAL_DLLPRIVATE double GetEquationValueAsDouble(const sal_Int32 nIndex) const
SAL_DLLPRIVATE bool SetAdjustValueAsDouble(const double &rValue, const sal_Int32 nIndex)
css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair > seqCoordinates
void ApplyGluePoints(SdrObject *pObj)
SdrObjCustomShape & mrSdrObjCustomShape
css::uno::Sequence< css::awt::Size > seqSubViewSize
The transformation of a rectangle into a polygon, by using angle parameters from GeoStat.
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 & GetEndColor() const
const Color & GetStartColor() const
void SetStartColor(const Color &rColor)
void SetEndColor(const Color &rColor)
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)
#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)