23#include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
24#include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp>
25#include <com/sun/star/xml/sax/FastToken.hpp>
26#include <osl/diagnose.h>
31#include <oox/token/namespaces.hxx>
32#include <oox/token/tokens.hxx>
33#include <unordered_map>
66struct FormulaCommandNameTable
77 {
"+-", FC_PLUSMINUS },
79 {
"ifelse", FC_IFELSE },
103 switch( rParameter.Type )
105 case EnhancedCustomShapeParameterType::NORMAL :
107 if ( rParameter.Value.getValueTypeClass() == TypeClass_DOUBLE )
110 if ( rParameter.Value >>= fValue )
111 aRet = OUString::number( fValue );
116 if ( rParameter.Value >>=
nValue )
117 aRet = OUString::number(
nValue );
121 case EnhancedCustomShapeParameterType::EQUATION :
123 if ( rParameter.Value.getValueTypeClass() == TypeClass_LONG )
125 sal_Int32 nFormulaIndex;
126 if ( rParameter.Value >>= nFormulaIndex )
129 + OUString::number( nFormulaIndex )
139 case EnhancedCustomShapeParameterType::ADJUSTMENT :
141 if ( rParameter.Value.getValueTypeClass() == TypeClass_LONG )
143 sal_Int32 nAdjustmentIndex;
144 if ( rParameter.Value >>= nAdjustmentIndex )
147 + OUString::number( nAdjustmentIndex )
157 case EnhancedCustomShapeParameterType::LEFT :
160 case EnhancedCustomShapeParameterType::TOP :
163 case EnhancedCustomShapeParameterType::RIGHT :
166 case EnhancedCustomShapeParameterType::BOTTOM :
169 case EnhancedCustomShapeParameterType::XSTRETCH :
172 case EnhancedCustomShapeParameterType::YSTRETCH :
175 case EnhancedCustomShapeParameterType::HASSTROKE :
178 case EnhancedCustomShapeParameterType::HASFILL :
181 case EnhancedCustomShapeParameterType::WIDTH :
184 case EnhancedCustomShapeParameterType::HEIGHT :
187 case EnhancedCustomShapeParameterType::LOGWIDTH :
190 case EnhancedCustomShapeParameterType::LOGHEIGHT :
199 css::drawing::EnhancedCustomShapeParameter aRet;
200 if ( !rValue.isEmpty() )
202 bool bConstant =
true;
203 sal_Int32 nConstant = -1;
204 sal_Int32 nIntVal = 0;
209 case XML_3cd4 : nConstant = 270 * 60000;
break;
210 case XML_3cd8 : nConstant = 135 * 60000;
break;
211 case XML_5cd8 : nConstant = 225 * 60000;
break;
212 case XML_7cd8 : nConstant = 315 * 60000;
break;
213 case XML_cd2 : nConstant = 180 * 60000;
break;
214 case XML_cd3 : nConstant = 120 * 60000;
break;
215 case XML_cd4 : nConstant = 90 * 60000;
break;
216 case XML_cd8 : nConstant = 45 * 60000;
break;
228 aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
231 aRet.Type = EnhancedCustomShapeParameterType::LOGHEIGHT;
260 aGuide.
maFormula =
"logheight/" + OUString::number( nIntVal );
263 aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
271 aRet.Type = EnhancedCustomShapeParameterType::NORMAL;
279 aGuide.
maFormula =
"max(logwidth,logheight)";
282 aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
289 aGuide.
maFormula =
"min(logwidth,logheight)";
292 aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
316 aGuide.
maFormula =
"min(logwidth,logheight)/" + OUString::number( nIntVal );
319 aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
333 aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
336 aRet.Type = EnhancedCustomShapeParameterType::LOGWIDTH;
371 aGuide.
maFormula =
"logwidth/" + OUString::number( nIntVal );
374 aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
384 if (nConstant != -1) {
385 aRet.Value <<= nConstant;
386 aRet.Type = EnhancedCustomShapeParameterType::NORMAL;
392 if ( (
n ==
'+' ) || (
n ==
'-' ) )
394 if ( rValue.getLength() > 1 )
397 if ( (
n >=
'0' ) && (
n <=
'9' ) )
399 aRet.Value <<= rValue.toInt32();
400 aRet.Type = EnhancedCustomShapeParameterType::NORMAL;
405 if ( nGuideIndex >= 0 )
407 aRet.Value <<= nGuideIndex;
408 aRet.Type = EnhancedCustomShapeParameterType::ADJUSTMENT;
413 if ( nGuideIndex >= 0 )
415 aRet.Value <<= nGuideIndex;
416 aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
420 SAL_WARN(
"oox",
"error: unhandled value " << rValue);
421 aRet.Value <<= rValue;
433class GeomGuideListContext :
public ContextHandler2
436 GeomGuideListContext( ContextHandler2Helper
const & rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< CustomShapeGuide >& rGuideList );
446GeomGuideListContext::GeomGuideListContext( ContextHandler2Helper
const & rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< CustomShapeGuide >& rGuideList )
447: ContextHandler2( rParent )
459 (*pHM)[ OUString::createFromAscii(
i.pS ) ] =
i.pE;
463 std::vector< OUString > aTokens;
468 if ( !aToken.isEmpty() )
469 aTokens.push_back( aToken );
474 if ( !aTokens.empty() )
476 sal_Int32
i, nParameters = aTokens.size() - 1;
477 if ( nParameters > 3 )
480 OUString sParameters[ 3 ];
482 for (
i = 0;
i < nParameters;
i++ )
485 const FormulaCommandHMap::const_iterator aIter(
pCommandHashMap->find( aTokens[ 0 ] ) );
488 switch( aIter->second )
492 if ( nParameters == 3 )
493 aEquation = sParameters[ 0 ] +
"*" + sParameters[ 1 ]
494 +
"/" + sParameters[ 2 ];
499 if ( nParameters == 3 )
500 aEquation = sParameters[ 0 ] +
"+" + sParameters[ 1 ]
501 +
"-" + sParameters[ 2 ];
506 if ( nParameters == 3 )
507 aEquation =
"(" + sParameters[ 0 ] +
"+"
508 + sParameters[ 1 ] +
")/" + sParameters[ 2 ];
514 if ( nParameters == 3 )
515 aEquation =
"if(" + sParameters[ 0 ] +
","
516 + sParameters[ 1 ] +
"," + sParameters[ 2 ] +
")";
521 if ( nParameters == 1 )
522 aEquation =
"abs(" + sParameters[ 0 ] +
")";
527 if ( nParameters == 2 )
528 aEquation =
"(10800000*atan2(" + sParameters[ 1 ] +
","
529 + sParameters[ 0 ] +
"))/pi";
534 if ( nParameters == 3 )
535 aEquation = sParameters[ 0 ] +
"*(cos(atan2(" +
536 sParameters[ 2 ] +
"," + sParameters[ 1 ] +
")))";
541 if ( nParameters == 2 )
542 aEquation = sParameters[ 0 ] +
"*cos(pi*(" +
543 sParameters[ 1 ] +
")/10800000)";
548 if ( nParameters == 2 )
549 aEquation =
"max(" + sParameters[ 0 ] +
"," +
550 sParameters[ 1 ] +
")";
555 if ( nParameters == 2 )
556 aEquation =
"min(" + sParameters[ 0 ] +
"," +
557 sParameters[ 1 ] +
")";
562 if ( nParameters == 3 )
564 + sParameters[ 0 ] +
"*" + sParameters[ 0 ] +
"+"
565 + sParameters[ 1 ] +
"*" + sParameters[ 1 ] +
"+"
566 + sParameters[ 2 ] +
"*" + sParameters[ 2 ] +
")";
571 if ( nParameters == 3 )
572 aEquation =
"if(" + sParameters[ 0 ] +
"-" + sParameters[ 1 ]
573 +
"," + sParameters[ 0 ] +
",if(" + sParameters[ 2 ]
574 +
"-" + sParameters[ 1 ] +
"," + sParameters[ 1 ]
575 +
"," + sParameters[ 2 ] +
"))";
580 if ( nParameters == 3 )
581 aEquation = sParameters[ 0 ] +
"*(sin(atan2(" +
582 sParameters[ 2 ] +
"," + sParameters[ 1 ] +
")))";
587 if ( nParameters == 2 )
588 aEquation = sParameters[ 0 ] +
"*sin(pi*(" +
589 sParameters[ 1 ] +
")/10800000)";
594 if ( nParameters == 1 )
595 aEquation =
"sqrt(" + sParameters[ 0 ] +
")";
600 if ( nParameters == 2 )
601 aEquation = sParameters[ 0 ] +
"*tan(pi*(" +
602 sParameters[ 1 ] +
")/10800000)";
607 if ( nParameters == 1 )
608 aEquation = sParameters[ 0 ];
621 if ( aElementToken == A_TOKEN( gd ) )
623 CustomShapeGuide aGuide;
639class AdjPoint2DContext :
public ContextHandler2
642 AdjPoint2DContext( ContextHandler2Helper
const & rParent,
const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D );
647AdjPoint2DContext::AdjPoint2DContext( ContextHandler2Helper
const & rParent,
const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D )
648: ContextHandler2( rParent )
650 rAdjPoint2D.First =
GetAdjCoordinate( rCustomShapeProperties, rAttribs.getStringDefaulted( XML_x ) );
651 rAdjPoint2D.Second =
GetAdjCoordinate( rCustomShapeProperties, rAttribs.getStringDefaulted( XML_y ) );
657class XYAdjustHandleContext :
public ContextHandler2
660 XYAdjustHandleContext( ContextHandler2Helper
const & rParent,
const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, AdjustHandle& rAdjustHandle );
670XYAdjustHandleContext::XYAdjustHandleContext( ContextHandler2Helper
const & rParent,
const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, AdjustHandle& rAdjustHandle )
671: ContextHandler2( rParent )
675 if ( rAttribs.hasAttribute( XML_gdRefX ) )
679 if ( rAttribs.hasAttribute( XML_minX ) )
683 if ( rAttribs.hasAttribute( XML_maxX ) )
687 if ( rAttribs.hasAttribute( XML_gdRefY ) )
691 if ( rAttribs.hasAttribute( XML_minY ) )
695 if ( rAttribs.hasAttribute( XML_maxY ) )
701ContextHandlerRef XYAdjustHandleContext::onCreateContext( sal_Int32 aElementToken,
const AttributeList& rAttribs )
703 if ( aElementToken == A_TOKEN( pos ) )
711class PolarAdjustHandleContext :
public ContextHandler2
714 PolarAdjustHandleContext( ContextHandler2Helper
const & rParent,
const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, AdjustHandle& rAdjustHandle );
724PolarAdjustHandleContext::PolarAdjustHandleContext( ContextHandler2Helper
const & rParent,
const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, AdjustHandle& rAdjustHandle )
725: ContextHandler2( rParent )
729 if ( rAttribs.hasAttribute( XML_gdRefR ) )
734 if ( rAttribs.hasAttribute( XML_minR ) )
738 if ( rAttribs.hasAttribute( XML_maxR ) )
742 if ( rAttribs.hasAttribute( XML_gdRefAng ) )
747 if ( rAttribs.hasAttribute( XML_minAng ) )
751 if ( rAttribs.hasAttribute( XML_maxAng ) )
757ContextHandlerRef PolarAdjustHandleContext::onCreateContext( sal_Int32 aElementToken,
const AttributeList& rAttribs )
760 if ( aElementToken == A_TOKEN( pos ) )
768class AdjustHandleListContext :
public ContextHandler2
771 AdjustHandleListContext( ContextHandler2Helper
const & rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< AdjustHandle >& rAdjustHandleList );
781AdjustHandleListContext::AdjustHandleListContext( ContextHandler2Helper
const & rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< AdjustHandle >& rAdjustHandleList )
782: ContextHandler2( rParent )
788ContextHandlerRef AdjustHandleListContext::onCreateContext( sal_Int32 aElementToken,
const AttributeList& rAttribs )
790 if ( aElementToken == A_TOKEN( ahXY ) )
792 AdjustHandle aAdjustHandle(
false );
796 else if ( aElementToken == A_TOKEN( ahPolar ) )
798 AdjustHandle aAdjustHandle(
true );
808class ConnectionSiteContext :
public ContextHandler2
811 ConnectionSiteContext( ContextHandler2Helper
const & rParent,
const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, ConnectionSite& rConnectionSite );
821ConnectionSiteContext::ConnectionSiteContext( ContextHandler2Helper
const & rParent,
const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, ConnectionSite& rConnectionSite )
822: ContextHandler2( rParent )
829ContextHandlerRef ConnectionSiteContext::onCreateContext( sal_Int32 aElementToken,
const AttributeList& rAttribs )
831 if ( aElementToken == A_TOKEN( pos ) )
839class Path2DMoveToContext :
public ContextHandler2
842 Path2DMoveToContext( ContextHandler2Helper
const & rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D );
852Path2DMoveToContext::Path2DMoveToContext( ContextHandler2Helper
const & rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D )
853: ContextHandler2( rParent )
859ContextHandlerRef Path2DMoveToContext::onCreateContext( sal_Int32 aElementToken,
const AttributeList& rAttribs )
861 if ( aElementToken == A_TOKEN( pt ) )
869class Path2DLineToContext :
public ContextHandler2
872 Path2DLineToContext( ContextHandler2Helper
const & rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D );
882Path2DLineToContext::Path2DLineToContext( ContextHandler2Helper
const & rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D )
883: ContextHandler2( rParent )
889ContextHandlerRef Path2DLineToContext::onCreateContext( sal_Int32 aElementToken,
const AttributeList& rAttribs )
891 if ( aElementToken == A_TOKEN( pt ) )
899class Path2DQuadBezierToContext :
public ContextHandler2
902 Path2DQuadBezierToContext( ContextHandler2Helper
const & rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rPt1, EnhancedCustomShapeParameterPair& rPt2 );
906 EnhancedCustomShapeParameterPair&
mrPt1;
907 EnhancedCustomShapeParameterPair&
mrPt2;
914Path2DQuadBezierToContext::Path2DQuadBezierToContext( ContextHandler2Helper
const & rParent,
915 CustomShapeProperties& rCustomShapeProperties,
916 EnhancedCustomShapeParameterPair& rPt1,
917 EnhancedCustomShapeParameterPair& rPt2 )
918: ContextHandler2( rParent )
926ContextHandlerRef Path2DQuadBezierToContext::onCreateContext( sal_Int32 aElementToken,
const AttributeList& rAttribs )
928 if ( aElementToken == A_TOKEN( pt ) )
936class Path2DCubicBezierToContext :
public ContextHandler2
939 Path2DCubicBezierToContext( ContextHandler2Helper
const & rParent, CustomShapeProperties& rCustomShapeProperties,
940 EnhancedCustomShapeParameterPair&, EnhancedCustomShapeParameterPair&, EnhancedCustomShapeParameterPair& );
953Path2DCubicBezierToContext::Path2DCubicBezierToContext( ContextHandler2Helper
const & rParent, CustomShapeProperties& rCustomShapeProperties,
954 EnhancedCustomShapeParameterPair& rControlPt1,
955 EnhancedCustomShapeParameterPair& rControlPt2,
956 EnhancedCustomShapeParameterPair& rEndPt )
957: ContextHandler2( rParent )
966ContextHandlerRef Path2DCubicBezierToContext::onCreateContext( sal_Int32 aElementToken,
const AttributeList& rAttribs )
968 if ( aElementToken == A_TOKEN( pt ) )
977class Path2DContext :
public ContextHandler2
980 Path2DContext( ContextHandler2Helper
const & rParent,
const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, std::vector< css::drawing::EnhancedCustomShapeSegment >& rSegments, Path2D& rPath2D );
981 virtual void onEndElement()
override;
983 onCreateContext( sal_Int32 aElementToken, const ::oox::AttributeList& rAttribs )
override;
987 std::vector< css::drawing::EnhancedCustomShapeSegment >&
mrSegments;
993Path2DContext::Path2DContext( ContextHandler2Helper
const & rParent,
const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, std::vector< css::drawing::EnhancedCustomShapeSegment >& rSegments, Path2D& rPath2D )
994: ContextHandler2( rParent )
999 rPath2D.w = rAttribs.getHyper( XML_w, 0 );
1000 rPath2D.h = rAttribs.getHyper( XML_h, 0 );
1001 rPath2D.fill = rAttribs.getToken( XML_fill,
XML_norm );
1002 rPath2D.stroke = rAttribs.getBool( XML_stroke,
true );
1003 rPath2D.extrusionOk = rAttribs.getBool( XML_extrusionOk,
true );
1006void Path2DContext::onEndElement()
1008 EnhancedCustomShapeSegment aNewSegment;
1012 aNewSegment.Command = EnhancedCustomShapeSegmentCommand::NOFILL;
1015 aNewSegment.Command = EnhancedCustomShapeSegmentCommand::DARKEN;
1017 case XML_darkenLess:
1018 aNewSegment.Command = EnhancedCustomShapeSegmentCommand::DARKENLESS;
1021 aNewSegment.Command = EnhancedCustomShapeSegmentCommand::LIGHTEN;
1023 case XML_lightenLess:
1024 aNewSegment.Command = EnhancedCustomShapeSegmentCommand::LIGHTENLESS;
1028 aNewSegment.Count = 0;
1033 aNewSegment.Command = EnhancedCustomShapeSegmentCommand::NOSTROKE;
1034 aNewSegment.Count = 0;
1037 aNewSegment.Command = EnhancedCustomShapeSegmentCommand::ENDSUBPATH;
1038 aNewSegment.Count = 0;
1044 const AttributeList& rAttribs )
1046 switch( aElementToken )
1048 case A_TOKEN( close ) :
1051 if (
mrSegments.empty() || (
mrSegments.back().Command != EnhancedCustomShapeSegmentCommand::MOVETO ) ) {
1052 EnhancedCustomShapeSegment aNewSegment;
1053 aNewSegment.Command = EnhancedCustomShapeSegmentCommand::CLOSESUBPATH;
1054 aNewSegment.Count = 0;
1059 case A_TOKEN( moveTo ) :
1061 EnhancedCustomShapeSegment aNewSegment;
1062 aNewSegment.Command = EnhancedCustomShapeSegmentCommand::MOVETO;
1063 aNewSegment.Count = 1;
1066 EnhancedCustomShapeParameterPair aAdjPoint2D;
1067 mrPath2D.parameter.push_back( aAdjPoint2D );
1071 case A_TOKEN( lnTo ) :
1073 if ( !
mrSegments.empty() && (
mrSegments.back().Command == EnhancedCustomShapeSegmentCommand::LINETO ) )
1077 EnhancedCustomShapeSegment aSegment;
1078 aSegment.Command = EnhancedCustomShapeSegmentCommand::LINETO;
1082 EnhancedCustomShapeParameterPair aAdjPoint2D;
1083 mrPath2D.parameter.push_back( aAdjPoint2D );
1087 case A_TOKEN( arcTo ) :
1089 if ( !
mrSegments.empty() && (
mrSegments.back().Command == EnhancedCustomShapeSegmentCommand::ARCANGLETO ) )
1093 EnhancedCustomShapeSegment aSegment;
1094 aSegment.Command = EnhancedCustomShapeSegmentCommand::ARCANGLETO;
1099 EnhancedCustomShapeParameterPair aScale;
1100 EnhancedCustomShapeParameterPair aAngles;
1105 CustomShapeGuide aGuide;
1109 aGuide.maName =
"arctosa" + OUString::number( nArcNum );
1110 aGuide.maFormula =
"("
1113 aAngles.First.Value <<= CustomShapeProperties::SetCustomShapeGuideValue(
mrCustomShapeProperties.getGuideList(), aGuide );
1114 aAngles.First.Type = EnhancedCustomShapeParameterType::EQUATION;
1117 aGuide.maName =
"arctosw" + OUString::number( nArcNum );
1118 aGuide.maFormula =
"("
1121 aAngles.Second.Value <<= CustomShapeProperties::SetCustomShapeGuideValue(
mrCustomShapeProperties.getGuideList(), aGuide );
1122 aAngles.Second.Type = EnhancedCustomShapeParameterType::EQUATION;
1124 mrPath2D.parameter.push_back( aScale );
1125 mrPath2D.parameter.push_back( aAngles );
1128 case A_TOKEN( quadBezTo ) :
1130 if ( !
mrSegments.empty() && (
mrSegments.back().Command == EnhancedCustomShapeSegmentCommand::QUADRATICCURVETO ) )
1134 EnhancedCustomShapeSegment aSegment;
1135 aSegment.Command = EnhancedCustomShapeSegmentCommand::QUADRATICCURVETO;
1139 EnhancedCustomShapeParameterPair aPt1;
1140 EnhancedCustomShapeParameterPair aPt2;
1141 mrPath2D.parameter.push_back( aPt1 );
1142 mrPath2D.parameter.push_back( aPt2 );
1148 case A_TOKEN( cubicBezTo ) :
1150 if ( !
mrSegments.empty() && (
mrSegments.back().Command == EnhancedCustomShapeSegmentCommand::CURVETO ) )
1154 EnhancedCustomShapeSegment aSegment;
1155 aSegment.Command = EnhancedCustomShapeSegmentCommand::CURVETO;
1159 EnhancedCustomShapeParameterPair aControlPt1;
1160 EnhancedCustomShapeParameterPair aControlPt2;
1161 EnhancedCustomShapeParameterPair aEndPt;
1162 mrPath2D.parameter.push_back( aControlPt1 );
1163 mrPath2D.parameter.push_back( aControlPt2 );
1164 mrPath2D.parameter.push_back( aEndPt );
1178class Path2DListContext :
public ContextHandler2
1181 Path2DListContext( ContextHandler2Helper
const & rParent, CustomShapeProperties & rCustomShapeProperties, std::vector< EnhancedCustomShapeSegment >& rSegments,
1182 std::vector< Path2D >& rPath2DList );
1189 std::vector< css::drawing::EnhancedCustomShapeSegment >&
mrSegments;
1195Path2DListContext:: Path2DListContext( ContextHandler2Helper
const & rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< EnhancedCustomShapeSegment >& rSegments,
1196 std::vector< Path2D >& rPath2DList )
1197: ContextHandler2( rParent )
1204ContextHandlerRef Path2DListContext::onCreateContext( sal_Int32 aElementToken,
const AttributeList& rAttribs )
1206 if ( aElementToken == A_TOKEN( path ) )
1216CustomShapeGeometryContext::CustomShapeGeometryContext( ContextHandler2Helper
const & rParent,
CustomShapeProperties& rCustomShapeProperties )
1224 switch( aElementToken )
1226 case A_TOKEN( avLst ):
1228 case A_TOKEN( gdLst ):
1230 case A_TOKEN( ahLst ):
1232 case A_TOKEN( cxnLst ):
1234 case A_TOKEN( rect ):
1244 case A_TOKEN( pathLst ):
1248 case A_TOKEN( cxn ):
1263 sal_Int32 nShapeType = rAttribs.
getToken( XML_prst, FastToken::DONTKNOW );
1264 OSL_ENSURE( nShapeType != FastToken::DONTKNOW,
"oox::drawingml::CustomShapeCustomGeometryContext::CustomShapeCustomGeometryContext(), unknown shape type" );
1270 if ( aElementToken == A_TOKEN( avLst ) )
1281 sal_Int32 nShapeType = rAttribs.
getToken( XML_prst, FastToken::DONTKNOW );
1282 OSL_ENSURE( nShapeType != FastToken::DONTKNOW,
"oox::drawingml::CustomShapeCustomGeometryContext::CustomShapeCustomGeometryContext(), unknown shape type" );
1288 if ( aElementToken == A_TOKEN( avLst ) )
static sal_Int32 decodeToken(std::u16string_view rValue)
Returns the XML token identifier from the passed string.
Provides access to attribute values of an element.
OUString getStringDefaulted(sal_Int32 nAttrToken) const
Returns the string value of the specified attribute, returns an empty string if attribute not present...
std::optional< sal_Int32 > getToken(sal_Int32 nAttrToken) const
Returns the token identifier of the value of the specified attribute.
virtual ::oox::core::ContextHandlerRef onCreateContext(::sal_Int32 aElementToken, const ::oox::AttributeList &rAttribs) override
CustomShapeProperties & mrCustomShapeProperties
std::vector< css::drawing::EnhancedCustomShapeSegment > & getSegments()
std::vector< ConnectionSite > & getConnectionSiteList()
void setShapePresetType(sal_Int32 nShapePresetType)
std::vector< CustomShapeGuide > & getGuideList()
std::optional< GeomRect > & getTextRect()
std::vector< Path2D > & getPath2DList()
static sal_Int32 GetCustomShapeGuideValue(const std::vector< CustomShapeGuide > &rGuideList, std::u16string_view rFormulaName)
std::vector< AdjustHandle > & getAdjustHandleList()
std::vector< CustomShapeGuide > & getAdjustmentGuideList()
static sal_Int32 SetCustomShapeGuideValue(std::vector< CustomShapeGuide > &rGuideList, const CustomShapeGuide &rGuide)
PresetShapeGeometryContext(::oox::core::ContextHandler2Helper const &rParent, const ::oox::AttributeList &rAttributes, CustomShapeProperties &rCustomShapeProperties)
virtual ::oox::core::ContextHandlerRef onCreateContext(::sal_Int32 aElementToken, const ::oox::AttributeList &rAttribs) override
CustomShapeProperties & mrCustomShapeProperties
CustomShapeProperties & mrCustomShapeProperties
PresetTextShapeContext(::oox::core::ContextHandler2Helper const &rParent, const ::oox::AttributeList &rAttributes, CustomShapeProperties &rCustomShapeProperties)
virtual ::oox::core::ContextHandlerRef onCreateContext(::sal_Int32 aElementToken, const ::oox::AttributeList &rAttribs) override
std::vector< AdjustHandle > & mrAdjustHandleList
EnhancedCustomShapeParameterPair & mrAdjPoint2D
std::vector< CustomShapeGuide > & mrGuideList
EnhancedCustomShapeParameterPair & mrPt1
EnhancedCustomShapeParameterPair & mrControlPt1
ConnectionSite & mrConnectionSite
std::vector< Path2D > & mrPath2DList
EnhancedCustomShapeParameterPair & mrControlPt2
std::vector< css::drawing::EnhancedCustomShapeSegment > & mrSegments
AdjustHandle & mrAdjustHandle
EnhancedCustomShapeParameterPair & mrEndPt
CustomShapeProperties & mrCustomShapeProperties
EnhancedCustomShapeParameterPair & mrPt2
#define SAL_WARN(area, stream)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
::rtl::Reference< ContextHandler > ContextHandlerRef
static const OUString & GetGeomGuideName(const OUString &rValue)
static const FormulaCommandHMap * pCommandHashMap
static EnhancedCustomShapeParameter GetAdjCoordinate(CustomShapeProperties &rCustomShapeProperties, const OUString &rValue, bool bNoSymbols=true)
const FormulaCommandNameTable pFormulaCommandNameTable[]
static OUString convertToOOEquation(CustomShapeProperties &rCustomShapeProperties, std::u16string_view rSource)
std::unordered_map< OUString, FormulaCommand > FormulaCommandHMap
static OUString GetFormulaParameter(const EnhancedCustomShapeParameter &rParameter)
css::drawing::EnhancedCustomShapeParameter l
css::drawing::EnhancedCustomShapeParameter b
css::drawing::EnhancedCustomShapeParameter r
css::drawing::EnhancedCustomShapeParameter t