1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "drawingml/customshapegeometry.hxx"
21 #include <drawingml/customshapeproperties.hxx>
23 #include <com/sun/star/xml/sax/FastToken.hpp>
24 #include <osl/diagnose.h>
25 #include "oox/helper/helper.hxx"
26 #include "oox/helper/attributelist.hxx"
27 #include "oox/helper/propertymap.hxx"
28 #include <unordered_map>
30 using namespace ::oox::core
;
31 using namespace ::com::sun::star::uno
;
32 using namespace ::com::sun::star::beans
;
33 using namespace ::com::sun::star::drawing
;
34 using namespace ::com::sun::star::xml::sax
;
36 namespace oox
{ namespace drawingml
{
60 struct FormularCommandNameTable
65 static const FormularCommandNameTable pFormularCommandNameTable
[] =
68 { "+-", FC_PLUSMINUS
},
70 { "ifelse", FC_IFELSE
},
87 typedef std::unordered_map
< OUString
, FormularCommand
, OUStringHash
> FormulaCommandHMap
;
89 static const FormulaCommandHMap
* pCommandHashMap
;
91 OUString
GetFormulaParameter( const EnhancedCustomShapeParameter
& rParameter
)
94 switch( rParameter
.Type
)
96 case EnhancedCustomShapeParameterType::NORMAL
:
98 if ( rParameter
.Value
.getValueTypeClass() == TypeClass_DOUBLE
)
101 if ( rParameter
.Value
>>= fValue
)
102 aRet
= OUString::number( fValue
);
106 sal_Int32 nValue
= 0;
107 if ( rParameter
.Value
>>= nValue
)
108 aRet
= OUString::number( nValue
);
112 case EnhancedCustomShapeParameterType::EQUATION
:
114 if ( rParameter
.Value
.getValueTypeClass() == TypeClass_LONG
)
116 sal_Int32 nFormulaIndex
;
117 if ( rParameter
.Value
>>= nFormulaIndex
)
120 + OUString::number( nFormulaIndex
)
126 // ups... we should have an index here and not the formula name
130 case EnhancedCustomShapeParameterType::ADJUSTMENT
:
132 if ( rParameter
.Value
.getValueTypeClass() == TypeClass_LONG
)
134 sal_Int32 nAdjustmentIndex
;
135 if ( rParameter
.Value
>>= nAdjustmentIndex
)
138 + OUString::number( nAdjustmentIndex
)
144 // ups... we should have an index here and not the formula name
148 case EnhancedCustomShapeParameterType::LEFT
:
150 const OUString
sLeft( "left" );
154 case EnhancedCustomShapeParameterType::TOP
:
156 const OUString
sTop( "top" );
160 case EnhancedCustomShapeParameterType::RIGHT
:
162 const OUString
sRight( "right" );
166 case EnhancedCustomShapeParameterType::BOTTOM
:
168 const OUString
sBottom( "bottom" );
172 case EnhancedCustomShapeParameterType::XSTRETCH
:
174 const OUString
sXStretch( "xstretch" );
178 case EnhancedCustomShapeParameterType::YSTRETCH
:
180 const OUString
sYStretch( "ystretch" );
184 case EnhancedCustomShapeParameterType::HASSTROKE
:
186 const OUString
sHasStroke( "hasstroke" );
190 case EnhancedCustomShapeParameterType::HASFILL
:
192 const OUString
sHasFill( "hasfill" );
196 case EnhancedCustomShapeParameterType::WIDTH
:
198 const OUString
sWidth( "width" );
202 case EnhancedCustomShapeParameterType::HEIGHT
:
204 const OUString
sHeight( "height" );
208 case EnhancedCustomShapeParameterType::LOGWIDTH
:
210 const OUString
sLogWidth( "logwidth" );
214 case EnhancedCustomShapeParameterType::LOGHEIGHT
:
216 const OUString
sLogHeight( "logheight" );
224 static EnhancedCustomShapeParameter
GetAdjCoordinate( CustomShapeProperties
& rCustomShapeProperties
, const OUString
& rValue
, bool bNoSymbols
= true )
226 com::sun::star::drawing::EnhancedCustomShapeParameter aRet
;
227 if ( !rValue
.isEmpty() )
229 bool bConstant
= true;
230 sal_Int32 nConstant
= -1;
231 sal_Int32 nIntVal
= 0;
233 // first check if it's a constant value
234 switch( AttributeConversion::decodeToken( rValue
) )
236 case XML_3cd4
: nConstant
= 270 * 60000; break;
237 case XML_3cd8
: nConstant
= 135 * 60000; break;
238 case XML_5cd8
: nConstant
= 225 * 60000; break;
239 case XML_7cd8
: nConstant
= 315 * 60000; break;
240 case XML_cd2
: nConstant
= 180 * 60000; break;
241 case XML_cd3
: nConstant
= 120 * 60000; break;
242 case XML_cd4
: nConstant
= 90 * 60000; break;
243 case XML_cd8
: nConstant
= 45 * 60000; break;
245 case XML_b
: // variable height of the shape defined in spPr
250 CustomShapeGuide aGuide
;
251 aGuide
.maName
= rValue
;
252 aGuide
.maFormula
= "logheight" ;
254 aRet
.Value
= Any( CustomShapeProperties::SetCustomShapeGuideValue( rCustomShapeProperties
.getGuideList(), aGuide
) );
255 aRet
.Type
= EnhancedCustomShapeParameterType::EQUATION
;
258 aRet
.Type
= EnhancedCustomShapeParameterType::LOGHEIGHT
; // TODO: HEIGHT needs to be implemented
262 case XML_hd10
: // !!PASSTHROUGH INTENDED
263 nIntVal
+= 2; // */ h 1.0 10.0
264 case XML_hd8
: // */ h 1.0 8.0
266 case XML_hd6
: // */ h 1.0 6.0
268 case XML_hd5
: // */ h 1.0 5.0
270 case XML_hd4
: // */ h 1.0 4.0
272 case XML_hd3
: // */ h 1.0 3.0
274 case XML_hd2
: // */ h 1.0 2.0
275 case XML_vc
: // */ h 1.0 2.0
279 CustomShapeGuide aGuide
;
280 aGuide
.maName
= rValue
;
281 aGuide
.maFormula
= "logheight/" + OUString::number( nIntVal
);
283 aRet
.Value
= Any( CustomShapeProperties::SetCustomShapeGuideValue( rCustomShapeProperties
.getGuideList(), aGuide
) );
284 aRet
.Type
= EnhancedCustomShapeParameterType::EQUATION
;
292 aRet
.Type
= EnhancedCustomShapeParameterType::NORMAL
;
296 case XML_ls
: // longest side: max w h
298 CustomShapeGuide aGuide
;
299 aGuide
.maName
= rValue
;
300 aGuide
.maFormula
= "max(logwidth,logheight)";
302 aRet
.Value
= Any( CustomShapeProperties::SetCustomShapeGuideValue( rCustomShapeProperties
.getGuideList(), aGuide
) );
303 aRet
.Type
= EnhancedCustomShapeParameterType::EQUATION
;
306 case XML_ss
: // shortest side: min w h
308 CustomShapeGuide aGuide
;
309 aGuide
.maName
= rValue
;
310 aGuide
.maFormula
= "min(logwidth,logheight)";
312 aRet
.Value
= Any( CustomShapeProperties::SetCustomShapeGuideValue( rCustomShapeProperties
.getGuideList(), aGuide
) );
313 aRet
.Type
= EnhancedCustomShapeParameterType::EQUATION
;
316 case XML_ssd32
: // */ ss 1.0 32.0
318 case XML_ssd16
: // */ ss 1.0 16.0
320 case XML_ssd8
: // */ ss 1.0 8.0
322 case XML_ssd6
: // */ ss 1.0 6.0
324 case XML_ssd4
: // */ ss 1.0 4.0
326 case XML_ssd2
: // */ ss 1.0 2.0
330 CustomShapeGuide aGuide
;
331 aGuide
.maName
= rValue
;
332 aGuide
.maFormula
= "min(logwidth,logheight)/" + OUString::number( nIntVal
);
334 aRet
.Value
= Any( CustomShapeProperties::SetCustomShapeGuideValue( rCustomShapeProperties
.getGuideList(), aGuide
) );
335 aRet
.Type
= EnhancedCustomShapeParameterType::EQUATION
;
339 case XML_r
: // variable width of the shape defined in spPr
344 CustomShapeGuide aGuide
;
345 aGuide
.maName
= rValue
;
346 aGuide
.maFormula
= "logwidth" ;
348 aRet
.Value
= Any( CustomShapeProperties::SetCustomShapeGuideValue( rCustomShapeProperties
.getGuideList(), aGuide
) );
349 aRet
.Type
= EnhancedCustomShapeParameterType::EQUATION
;
352 aRet
.Type
= EnhancedCustomShapeParameterType::LOGWIDTH
;
356 case XML_wd32
: // */ w 1.0 32.0
358 case XML_wd12
: // */ w 1.0 12.0
360 case XML_wd10
: // */ w 1.0 10.0
362 case XML_wd8
: // */ w 1.0 8.0
364 case XML_wd6
: // */ w 1.0 6.0
366 case XML_wd5
: // */ w 1.0 5.0
368 case XML_wd4
: // */ w 1.0 4.0
370 case XML_wd3
: // */ w 1.0 3.0
372 case XML_hc
: // */ w 1.0 2.0
373 case XML_wd2
: // */ w 1.0 2.0
377 CustomShapeGuide aGuide
;
378 aGuide
.maName
= rValue
;
379 aGuide
.maFormula
= "logwidth/" + OUString::number( nIntVal
);
381 aRet
.Value
= Any( CustomShapeProperties::SetCustomShapeGuideValue( rCustomShapeProperties
.getGuideList(), aGuide
) );
382 aRet
.Type
= EnhancedCustomShapeParameterType::EQUATION
;
392 if (nConstant
!= -1) {
393 aRet
.Value
= Any( nConstant
);
394 aRet
.Type
= EnhancedCustomShapeParameterType::NORMAL
;
399 sal_Unicode n
= rValue
[ 0 ];
400 if ( ( n
== '+' ) || ( n
== '-' ) )
402 if ( rValue
.getLength() > 1 )
405 if ( ( n
>= '0' ) && ( n
<= '9' ) )
406 { // seems to be a ST_Coordinate
407 aRet
.Value
= Any( (sal_Int32
)(rValue
.toInt32() ) );
408 aRet
.Type
= EnhancedCustomShapeParameterType::NORMAL
;
412 sal_Int32 nGuideIndex
= CustomShapeProperties::GetCustomShapeGuideValue( rCustomShapeProperties
.getAdjustmentGuideList(), rValue
);
413 if ( nGuideIndex
>= 0 )
415 aRet
.Value
= Any( nGuideIndex
);
416 aRet
.Type
= EnhancedCustomShapeParameterType::ADJUSTMENT
;
420 nGuideIndex
= CustomShapeProperties::GetCustomShapeGuideValue( rCustomShapeProperties
.getGuideList(), rValue
);
421 if ( nGuideIndex
>= 0 )
423 aRet
.Value
= Any( nGuideIndex
);
424 aRet
.Type
= EnhancedCustomShapeParameterType::EQUATION
;
428 OSL_TRACE("error: unhandled value '%s'", OUStringToOString( rValue
, RTL_TEXTENCODING_ASCII_US
).getStr());
429 aRet
.Value
= Any( rValue
);
439 class GeomGuideListContext
: public ContextHandler2
442 GeomGuideListContext( ContextHandler2Helper
& rParent
, CustomShapeProperties
& rCustomShapeProperties
, std::vector
< CustomShapeGuide
>& rGuideList
);
443 virtual ::oox::core::ContextHandlerRef
onCreateContext( sal_Int32 aElementToken
, const ::oox::AttributeList
& rAttribs
) SAL_OVERRIDE
;
446 std::vector
< CustomShapeGuide
>& mrGuideList
;
447 CustomShapeProperties
& mrCustomShapeProperties
;
450 GeomGuideListContext::GeomGuideListContext( ContextHandler2Helper
& rParent
, CustomShapeProperties
& rCustomShapeProperties
, std::vector
< CustomShapeGuide
>& rGuideList
)
451 : ContextHandler2( rParent
)
452 , mrGuideList( rGuideList
)
453 , mrCustomShapeProperties( rCustomShapeProperties
)
457 static OUString
convertToOOEquation( CustomShapeProperties
& rCustomShapeProperties
, const OUString
& rSource
)
459 if ( !pCommandHashMap
)
461 FormulaCommandHMap
* pHM
= new FormulaCommandHMap();
462 for( sal_Int32 i
= 0; i
< FC_LAST
; i
++ )
463 (*pHM
)[ OUString::createFromAscii( pFormularCommandNameTable
[ i
].pS
) ] = pFormularCommandNameTable
[ i
].pE
;
464 pCommandHashMap
= pHM
;
467 std::vector
< OUString
> aTokens
;
468 sal_Int32 nIndex
= 0;
471 OUString
aToken( rSource
.getToken( 0, ' ', nIndex
) );
472 if ( !aToken
.isEmpty() )
473 aTokens
.push_back( aToken
);
475 while ( nIndex
>= 0 );
478 if ( !aTokens
.empty() )
480 sal_Int32 i
, nParameters
= aTokens
.size() - 1;
481 if ( nParameters
> 3 )
484 OUString sParameters
[ 3 ];
486 for ( i
= 0; i
< nParameters
; i
++ )
487 sParameters
[ i
] = GetFormulaParameter( GetAdjCoordinate( rCustomShapeProperties
, aTokens
[ i
+ 1 ], false ) );
489 const FormulaCommandHMap::const_iterator
aIter( pCommandHashMap
->find( aTokens
[ 0 ] ) );
490 if ( aIter
!= pCommandHashMap
->end() )
492 switch( aIter
->second
)
496 if ( nParameters
== 3 )
497 aEquation
= sParameters
[ 0 ] + "*" + sParameters
[ 1 ]
498 + "/" + sParameters
[ 2 ];
503 if ( nParameters
== 3 )
504 aEquation
= sParameters
[ 0 ] + "+" + sParameters
[ 1 ]
505 + "-" + sParameters
[ 2 ];
510 if ( nParameters
== 3 )
511 aEquation
= "(" + sParameters
[ 0 ] + "+"
512 + sParameters
[ 1 ] + ")/" + sParameters
[ 2 ];
518 if ( nParameters
== 3 )
519 aEquation
= "if(" + sParameters
[ 0 ] + ","
520 + sParameters
[ 1 ] + "," + sParameters
[ 2 ] + ")";
525 if ( nParameters
== 1 )
526 aEquation
= "abs(" + sParameters
[ 0 ] + ")";
531 if ( nParameters
== 2 )
532 aEquation
= "(10800000*atan2(" + sParameters
[ 1 ] + ","
533 + sParameters
[ 0 ] + "))/pi";
538 if ( nParameters
== 3 )
539 aEquation
= sParameters
[ 0 ] + "*(cos(atan2(" +
540 sParameters
[ 2 ] + "," + sParameters
[ 1 ] + ")))";
545 if ( nParameters
== 2 )
546 aEquation
= sParameters
[ 0 ] + "*cos(pi*(" +
547 sParameters
[ 1 ] + ")/10800000)";
552 if ( nParameters
== 2 )
553 aEquation
= "max(" + sParameters
[ 0 ] + "," +
554 sParameters
[ 1 ] + ")";
559 if ( nParameters
== 2 )
560 aEquation
= "min(" + sParameters
[ 0 ] + "," +
561 sParameters
[ 1 ] + ")";
566 if ( nParameters
== 3 )
568 + sParameters
[ 0 ] + "*" + sParameters
[ 0 ] + "+"
569 + sParameters
[ 1 ] + "*" + sParameters
[ 1 ] + "+"
570 + sParameters
[ 2 ] + "*" + sParameters
[ 2 ] + ")";
575 if ( nParameters
== 3 ) // if(x-y,x,if(y-z,z,y))
576 aEquation
= "if(" + sParameters
[ 0 ] + "-" + sParameters
[ 1 ]
577 + "," + sParameters
[ 0 ] + ",if(" + sParameters
[ 2 ]
578 + "-" + sParameters
[ 1 ] + "," + sParameters
[ 1 ]
579 + "," + sParameters
[ 2 ] + "))";
584 if ( nParameters
== 3 )
585 aEquation
= sParameters
[ 0 ] + "*(sin(atan2(" +
586 sParameters
[ 2 ] + "," + sParameters
[ 1 ] + ")))";
591 if ( nParameters
== 2 )
592 aEquation
= sParameters
[ 0 ] + "*sin(pi*(" +
593 sParameters
[ 1 ] + ")/10800000)";
598 if ( nParameters
== 1 )
599 aEquation
= "sqrt(" + sParameters
[ 0 ] + ")";
604 if ( nParameters
== 2 )
605 aEquation
= sParameters
[ 0 ] + "*tan(pi*(" +
606 sParameters
[ 1 ] + ")/10800000)";
611 if ( nParameters
== 1 )
612 aEquation
= sParameters
[ 0 ];
623 ContextHandlerRef
GeomGuideListContext::onCreateContext( sal_Int32 aElementToken
, const AttributeList
& rAttribs
)
625 if ( aElementToken
== A_TOKEN( gd
) ) // CT_GeomGuide
627 CustomShapeGuide aGuide
;
628 aGuide
.maName
= rAttribs
.getString( XML_name
).get();
629 aGuide
.maFormula
= convertToOOEquation( mrCustomShapeProperties
, rAttribs
.getString( XML_fmla
).get() );
630 mrGuideList
.push_back( aGuide
);
635 static const OUString
GetGeomGuideName( const OUString
& rValue
)
641 class AdjPoint2DContext
: public ContextHandler2
644 AdjPoint2DContext( ContextHandler2Helper
& rParent
, const AttributeList
& rAttribs
, CustomShapeProperties
& rCustomShapeProperties
, EnhancedCustomShapeParameterPair
& rAdjPoint2D
);
647 AdjPoint2DContext::AdjPoint2DContext( ContextHandler2Helper
& rParent
, const AttributeList
& rAttribs
, CustomShapeProperties
& rCustomShapeProperties
, EnhancedCustomShapeParameterPair
& rAdjPoint2D
)
648 : ContextHandler2( rParent
)
650 rAdjPoint2D
.First
= GetAdjCoordinate( rCustomShapeProperties
, rAttribs
.getString( XML_x
).get(), true );
651 rAdjPoint2D
.Second
= GetAdjCoordinate( rCustomShapeProperties
, rAttribs
.getString( XML_y
).get(), true );
655 class XYAdjustHandleContext
: public ContextHandler2
658 XYAdjustHandleContext( ContextHandler2Helper
& rParent
, const AttributeList
& rAttribs
, CustomShapeProperties
& rCustomShapeProperties
, AdjustHandle
& rAdjustHandle
);
659 virtual ::oox::core::ContextHandlerRef
onCreateContext( sal_Int32 aElementToken
, const ::oox::AttributeList
& rAttribs
) SAL_OVERRIDE
;
662 AdjustHandle
& mrAdjustHandle
;
663 CustomShapeProperties
& mrCustomShapeProperties
;
666 XYAdjustHandleContext::XYAdjustHandleContext( ContextHandler2Helper
& rParent
, const AttributeList
& rAttribs
, CustomShapeProperties
& rCustomShapeProperties
, AdjustHandle
& rAdjustHandle
)
667 : ContextHandler2( rParent
)
668 , mrAdjustHandle( rAdjustHandle
)
669 , mrCustomShapeProperties( rCustomShapeProperties
)
671 const OUString aEmptyDefault
;
672 if ( rAttribs
.hasAttribute( XML_gdRefX
) )
674 mrAdjustHandle
.gdRef1
= GetGeomGuideName( rAttribs
.getString( XML_gdRefX
, aEmptyDefault
) );
676 if ( rAttribs
.hasAttribute( XML_minX
) )
678 mrAdjustHandle
.min1
= GetAdjCoordinate( mrCustomShapeProperties
, rAttribs
.getString( XML_minX
, aEmptyDefault
), true );
680 if ( rAttribs
.hasAttribute( XML_maxX
) )
682 mrAdjustHandle
.max1
= GetAdjCoordinate( mrCustomShapeProperties
, rAttribs
.getString( XML_maxX
, aEmptyDefault
), true );
684 if ( rAttribs
.hasAttribute( XML_gdRefY
) )
686 mrAdjustHandle
.gdRef2
= GetGeomGuideName( rAttribs
.getString( XML_gdRefY
, aEmptyDefault
) );
688 if ( rAttribs
.hasAttribute( XML_minY
) )
690 mrAdjustHandle
.min2
= GetAdjCoordinate( mrCustomShapeProperties
, rAttribs
.getString( XML_minY
, aEmptyDefault
), true );
692 if ( rAttribs
.hasAttribute( XML_maxY
) )
694 mrAdjustHandle
.max2
= GetAdjCoordinate( mrCustomShapeProperties
, rAttribs
.getString( XML_maxY
, aEmptyDefault
), true );
698 ContextHandlerRef
XYAdjustHandleContext::onCreateContext( sal_Int32 aElementToken
, const AttributeList
& rAttribs
)
700 if ( aElementToken
== A_TOKEN( pos
) )
701 return new AdjPoint2DContext( *this, rAttribs
, mrCustomShapeProperties
, mrAdjustHandle
.pos
); // CT_AdjPoint2D
705 // CT_PolarAdjustHandle
706 class PolarAdjustHandleContext
: public ContextHandler2
709 PolarAdjustHandleContext( ContextHandler2Helper
& rParent
, const AttributeList
& rAttribs
, CustomShapeProperties
& rCustomShapeProperties
, AdjustHandle
& rAdjustHandle
);
710 virtual ::oox::core::ContextHandlerRef
onCreateContext( sal_Int32 aElementToken
, const ::oox::AttributeList
& rAttribs
) SAL_OVERRIDE
;
713 AdjustHandle
& mrAdjustHandle
;
714 CustomShapeProperties
& mrCustomShapeProperties
;
717 PolarAdjustHandleContext::PolarAdjustHandleContext( ContextHandler2Helper
& rParent
, const AttributeList
& rAttribs
, CustomShapeProperties
& rCustomShapeProperties
, AdjustHandle
& rAdjustHandle
)
718 : ContextHandler2( rParent
)
719 , mrAdjustHandle( rAdjustHandle
)
720 , mrCustomShapeProperties( rCustomShapeProperties
)
722 const OUString aEmptyDefault
;
723 if ( rAttribs
.hasAttribute( XML_gdRefR
) )
725 mrAdjustHandle
.gdRef1
= GetGeomGuideName( rAttribs
.getString( XML_gdRefR
, aEmptyDefault
) );
727 if ( rAttribs
.hasAttribute( XML_minR
) )
729 mrAdjustHandle
.min1
= GetAdjCoordinate( mrCustomShapeProperties
, rAttribs
.getString( XML_minR
, aEmptyDefault
), true );
731 if ( rAttribs
.hasAttribute( XML_maxR
) )
733 mrAdjustHandle
.max1
= GetAdjCoordinate( mrCustomShapeProperties
, rAttribs
.getString( XML_maxR
, aEmptyDefault
), true );
735 if ( rAttribs
.hasAttribute( XML_gdRefAng
) )
737 mrAdjustHandle
.gdRef2
= GetGeomGuideName( rAttribs
.getString( XML_gdRefAng
, aEmptyDefault
) );
739 if ( rAttribs
.hasAttribute( XML_minAng
) )
741 mrAdjustHandle
.min2
= GetAdjCoordinate( mrCustomShapeProperties
, rAttribs
.getString( XML_minAng
, aEmptyDefault
) );
743 if ( rAttribs
.hasAttribute( XML_maxAng
) )
745 mrAdjustHandle
.max2
= GetAdjCoordinate( mrCustomShapeProperties
, rAttribs
.getString( XML_maxAng
, aEmptyDefault
) );
749 ContextHandlerRef
PolarAdjustHandleContext::onCreateContext( sal_Int32 aElementToken
, const AttributeList
& rAttribs
)
751 if ( aElementToken
== A_TOKEN( pos
) )
752 return new AdjPoint2DContext( *this, rAttribs
, mrCustomShapeProperties
, mrAdjustHandle
.pos
); // CT_AdjPoint2D
756 // CT_AdjustHandleList
757 class AdjustHandleListContext
: public ContextHandler2
760 AdjustHandleListContext( ContextHandler2Helper
& rParent
, CustomShapeProperties
& rCustomShapeProperties
, std::vector
< AdjustHandle
>& rAdjustHandleList
);
761 virtual ::oox::core::ContextHandlerRef
onCreateContext( sal_Int32 aElementToken
, const ::oox::AttributeList
& rAttribs
) SAL_OVERRIDE
;
764 std::vector
< AdjustHandle
>& mrAdjustHandleList
;
765 CustomShapeProperties
& mrCustomShapeProperties
;
768 AdjustHandleListContext::AdjustHandleListContext( ContextHandler2Helper
& rParent
, CustomShapeProperties
& rCustomShapeProperties
, std::vector
< AdjustHandle
>& rAdjustHandleList
)
769 : ContextHandler2( rParent
)
770 , mrAdjustHandleList( rAdjustHandleList
)
771 , mrCustomShapeProperties( rCustomShapeProperties
)
775 ContextHandlerRef
AdjustHandleListContext::onCreateContext( sal_Int32 aElementToken
, const AttributeList
& rAttribs
)
777 if ( aElementToken
== A_TOKEN( ahXY
) ) // CT_XYAdjustHandle
779 AdjustHandle
aAdjustHandle( false );
780 mrAdjustHandleList
.push_back( aAdjustHandle
);
781 return new XYAdjustHandleContext( *this, rAttribs
, mrCustomShapeProperties
, mrAdjustHandleList
.back() );
783 else if ( aElementToken
== A_TOKEN( ahPolar
) ) // CT_PolarAdjustHandle
785 AdjustHandle
aAdjustHandle( true );
786 mrAdjustHandleList
.push_back( aAdjustHandle
);
787 return new PolarAdjustHandleContext( *this, rAttribs
, mrCustomShapeProperties
, mrAdjustHandleList
.back() );
793 class ConnectionSiteContext
: public ContextHandler2
796 ConnectionSiteContext( ContextHandler2Helper
& rParent
, const AttributeList
& rAttribs
, CustomShapeProperties
& rCustomShapeProperties
, ConnectionSite
& rConnectionSite
);
797 virtual ::oox::core::ContextHandlerRef
onCreateContext( sal_Int32 aElementToken
, const ::oox::AttributeList
& rAttribs
) SAL_OVERRIDE
;
800 ConnectionSite
& mrConnectionSite
;
801 CustomShapeProperties
& mrCustomShapeProperties
;
804 ConnectionSiteContext::ConnectionSiteContext( ContextHandler2Helper
& rParent
, const AttributeList
& rAttribs
, CustomShapeProperties
& rCustomShapeProperties
, ConnectionSite
& rConnectionSite
)
805 : ContextHandler2( rParent
)
806 , mrConnectionSite( rConnectionSite
)
807 , mrCustomShapeProperties( rCustomShapeProperties
)
809 mrConnectionSite
.ang
= GetAdjCoordinate( mrCustomShapeProperties
, rAttribs
.getString( XML_ang
).get() );
812 ContextHandlerRef
ConnectionSiteContext::onCreateContext( sal_Int32 aElementToken
, const AttributeList
& rAttribs
)
814 if ( aElementToken
== A_TOKEN( pos
) )
815 return new AdjPoint2DContext( *this, rAttribs
, mrCustomShapeProperties
, mrConnectionSite
.pos
); // CT_AdjPoint2D
820 class Path2DMoveToContext
: public ContextHandler2
823 Path2DMoveToContext( ContextHandler2Helper
& rParent
, CustomShapeProperties
& rCustomShapeProperties
, EnhancedCustomShapeParameterPair
& rAdjPoint2D
);
824 virtual ::oox::core::ContextHandlerRef
onCreateContext( sal_Int32 aElementToken
, const ::oox::AttributeList
& rAttribs
) SAL_OVERRIDE
;
827 EnhancedCustomShapeParameterPair
& mrAdjPoint2D
;
828 CustomShapeProperties
& mrCustomShapeProperties
;
831 Path2DMoveToContext::Path2DMoveToContext( ContextHandler2Helper
& rParent
, CustomShapeProperties
& rCustomShapeProperties
, EnhancedCustomShapeParameterPair
& rAdjPoint2D
)
832 : ContextHandler2( rParent
)
833 , mrAdjPoint2D( rAdjPoint2D
)
834 , mrCustomShapeProperties( rCustomShapeProperties
)
838 ContextHandlerRef
Path2DMoveToContext::onCreateContext( sal_Int32 aElementToken
, const AttributeList
& rAttribs
)
840 if ( aElementToken
== A_TOKEN( pt
) )
841 return new AdjPoint2DContext( *this, rAttribs
, mrCustomShapeProperties
, mrAdjPoint2D
); // CT_AdjPoint2D
846 class Path2DLineToContext
: public ContextHandler2
849 Path2DLineToContext( ContextHandler2Helper
& rParent
, CustomShapeProperties
& rCustomShapeProperties
, EnhancedCustomShapeParameterPair
& rAdjPoint2D
);
850 virtual ::oox::core::ContextHandlerRef
onCreateContext( sal_Int32 aElementToken
, const ::oox::AttributeList
& rAttribs
) SAL_OVERRIDE
;
853 EnhancedCustomShapeParameterPair
& mrAdjPoint2D
;
854 CustomShapeProperties
& mrCustomShapeProperties
;
857 Path2DLineToContext::Path2DLineToContext( ContextHandler2Helper
& rParent
, CustomShapeProperties
& rCustomShapeProperties
, EnhancedCustomShapeParameterPair
& rAdjPoint2D
)
858 : ContextHandler2( rParent
)
859 , mrAdjPoint2D( rAdjPoint2D
)
860 , mrCustomShapeProperties( rCustomShapeProperties
)
864 ContextHandlerRef
Path2DLineToContext::onCreateContext( sal_Int32 aElementToken
, const AttributeList
& rAttribs
)
866 if ( aElementToken
== A_TOKEN( pt
) )
867 return new AdjPoint2DContext( *this, rAttribs
, mrCustomShapeProperties
, mrAdjPoint2D
); // CT_AdjPoint2D
871 // CT_Path2DQuadBezierTo
872 class Path2DQuadBezierToContext
: public ContextHandler2
875 Path2DQuadBezierToContext( ContextHandler2Helper
& rParent
, CustomShapeProperties
& rCustomShapeProperties
, EnhancedCustomShapeParameterPair
& rPt1
, EnhancedCustomShapeParameterPair
& rPt2
);
876 virtual ::oox::core::ContextHandlerRef
onCreateContext( sal_Int32 aElementToken
, const ::oox::AttributeList
& rAttribs
) SAL_OVERRIDE
;
879 EnhancedCustomShapeParameterPair
& mrPt1
;
880 EnhancedCustomShapeParameterPair
& mrPt2
;
882 CustomShapeProperties
& mrCustomShapeProperties
;
885 Path2DQuadBezierToContext::Path2DQuadBezierToContext( ContextHandler2Helper
& rParent
,
886 CustomShapeProperties
& rCustomShapeProperties
,
887 EnhancedCustomShapeParameterPair
& rPt1
,
888 EnhancedCustomShapeParameterPair
& rPt2
)
889 : ContextHandler2( rParent
)
893 , mrCustomShapeProperties( rCustomShapeProperties
)
897 ContextHandlerRef
Path2DQuadBezierToContext::onCreateContext( sal_Int32 aElementToken
, const AttributeList
& rAttribs
)
899 if ( aElementToken
== A_TOKEN( pt
) )
900 return new AdjPoint2DContext( *this, rAttribs
, mrCustomShapeProperties
, nCount
++ ? mrPt2
: mrPt1
); // CT_AdjPoint2D
904 // CT_Path2DCubicBezierTo
905 class Path2DCubicBezierToContext
: public ContextHandler2
908 Path2DCubicBezierToContext( ContextHandler2Helper
& rParent
, CustomShapeProperties
& rCustomShapeProperties
,
909 EnhancedCustomShapeParameterPair
&, EnhancedCustomShapeParameterPair
&, EnhancedCustomShapeParameterPair
& );
910 virtual ::oox::core::ContextHandlerRef
onCreateContext( sal_Int32 aElementToken
, const ::oox::AttributeList
& rAttribs
) SAL_OVERRIDE
;
913 CustomShapeProperties
& mrCustomShapeProperties
;
914 EnhancedCustomShapeParameterPair
& mrControlPt1
;
915 EnhancedCustomShapeParameterPair
& mrControlPt2
;
916 EnhancedCustomShapeParameterPair
& mrEndPt
;
920 Path2DCubicBezierToContext::Path2DCubicBezierToContext( ContextHandler2Helper
& rParent
, CustomShapeProperties
& rCustomShapeProperties
,
921 EnhancedCustomShapeParameterPair
& rControlPt1
,
922 EnhancedCustomShapeParameterPair
& rControlPt2
,
923 EnhancedCustomShapeParameterPair
& rEndPt
)
924 : ContextHandler2( rParent
)
925 , mrCustomShapeProperties( rCustomShapeProperties
)
926 , mrControlPt1( rControlPt1
)
927 , mrControlPt2( rControlPt2
)
933 ContextHandlerRef
Path2DCubicBezierToContext::onCreateContext( sal_Int32 aElementToken
, const AttributeList
& rAttribs
)
935 if ( aElementToken
== A_TOKEN( pt
) )
936 return new AdjPoint2DContext( *this, rAttribs
, mrCustomShapeProperties
,
937 nCount
++ ? nCount
== 2 ? mrControlPt2
: mrEndPt
: mrControlPt1
); // CT_AdjPoint2D
942 class Path2DContext
: public ContextHandler2
945 Path2DContext( ContextHandler2Helper
& rParent
, const AttributeList
& rAttribs
, CustomShapeProperties
& rCustomShapeProperties
, std::vector
< com::sun::star::drawing::EnhancedCustomShapeSegment
>& rSegments
, Path2D
& rPath2D
);
946 virtual ~Path2DContext();
947 virtual ::oox::core::ContextHandlerRef
948 onCreateContext( sal_Int32 aElementToken
, const ::oox::AttributeList
& rAttribs
) SAL_OVERRIDE
;
952 std::vector
< com::sun::star::drawing::EnhancedCustomShapeSegment
>& mrSegments
;
953 CustomShapeProperties
& mrCustomShapeProperties
;
956 Path2DContext::Path2DContext( ContextHandler2Helper
& rParent
, const AttributeList
& rAttribs
, CustomShapeProperties
& rCustomShapeProperties
, std::vector
< com::sun::star::drawing::EnhancedCustomShapeSegment
>& rSegments
, Path2D
& rPath2D
)
957 : ContextHandler2( rParent
)
958 , mrPath2D( rPath2D
)
959 , mrSegments( rSegments
)
960 , mrCustomShapeProperties( rCustomShapeProperties
)
962 const OUString aEmptyString
;
964 rPath2D
.w
= rAttribs
.getString( XML_w
, aEmptyString
).toInt64();
965 rPath2D
.h
= rAttribs
.getString( XML_h
, aEmptyString
).toInt64();
966 rPath2D
.fill
= rAttribs
.getToken( XML_fill
, XML_norm
);
967 rPath2D
.stroke
= rAttribs
.getBool( XML_stroke
, true );
968 rPath2D
.extrusionOk
= rAttribs
.getBool( XML_extrusionOk
, true );
971 Path2DContext::~Path2DContext()
973 EnhancedCustomShapeSegment aNewSegment
;
974 switch ( mrPath2D
.fill
)
977 aNewSegment
.Command
= EnhancedCustomShapeSegmentCommand::NOFILL
;
980 aNewSegment
.Command
= EnhancedCustomShapeSegmentCommand::DARKEN
;
983 aNewSegment
.Command
= EnhancedCustomShapeSegmentCommand::DARKENLESS
;
986 aNewSegment
.Command
= EnhancedCustomShapeSegmentCommand::LIGHTEN
;
988 case XML_lightenLess
:
989 aNewSegment
.Command
= EnhancedCustomShapeSegmentCommand::LIGHTENLESS
;
992 if (mrPath2D
.fill
!= XML_norm
) {
993 aNewSegment
.Count
= 0;
994 mrSegments
.push_back( aNewSegment
);
996 if ( !mrPath2D
.stroke
)
998 aNewSegment
.Command
= EnhancedCustomShapeSegmentCommand::NOSTROKE
;
999 aNewSegment
.Count
= 0;
1000 mrSegments
.push_back( aNewSegment
);
1002 aNewSegment
.Command
= EnhancedCustomShapeSegmentCommand::ENDSUBPATH
;
1003 aNewSegment
.Count
= 0;
1004 mrSegments
.push_back( aNewSegment
);
1007 ContextHandlerRef
Path2DContext::onCreateContext( sal_Int32 aElementToken
,
1008 const AttributeList
& rAttribs
)
1010 switch( aElementToken
)
1012 case A_TOKEN( close
) :
1014 // ignore close after move to (ppt does seems to do the same, see accentCallout2 preset for example)
1015 if ( mrSegments
.empty() || ( mrSegments
.back().Command
!= EnhancedCustomShapeSegmentCommand::MOVETO
) ) {
1016 EnhancedCustomShapeSegment aNewSegment
;
1017 aNewSegment
.Command
= EnhancedCustomShapeSegmentCommand::CLOSESUBPATH
;
1018 aNewSegment
.Count
= 0;
1019 mrSegments
.push_back( aNewSegment
);
1023 case A_TOKEN( moveTo
) :
1025 EnhancedCustomShapeSegment aNewSegment
;
1026 aNewSegment
.Command
= EnhancedCustomShapeSegmentCommand::MOVETO
;
1027 aNewSegment
.Count
= 1;
1028 mrSegments
.push_back( aNewSegment
);
1030 EnhancedCustomShapeParameterPair aAdjPoint2D
;
1031 mrPath2D
.parameter
.push_back( aAdjPoint2D
);
1032 return new Path2DMoveToContext( *this, mrCustomShapeProperties
, mrPath2D
.parameter
.back() );
1035 case A_TOKEN( lnTo
) :
1037 if ( !mrSegments
.empty() && ( mrSegments
.back().Command
== EnhancedCustomShapeSegmentCommand::LINETO
) )
1038 mrSegments
.back().Count
++;
1041 EnhancedCustomShapeSegment aSegment
;
1042 aSegment
.Command
= EnhancedCustomShapeSegmentCommand::LINETO
;
1044 mrSegments
.push_back( aSegment
);
1046 EnhancedCustomShapeParameterPair aAdjPoint2D
;
1047 mrPath2D
.parameter
.push_back( aAdjPoint2D
);
1048 return new Path2DLineToContext( *this, mrCustomShapeProperties
, mrPath2D
.parameter
.back() );
1051 case A_TOKEN( arcTo
) : // CT_Path2DArcTo
1053 if ( !mrSegments
.empty() && ( mrSegments
.back().Command
== EnhancedCustomShapeSegmentCommand::ARCANGLETO
) )
1054 mrSegments
.back().Count
++;
1057 EnhancedCustomShapeSegment aSegment
;
1058 aSegment
.Command
= EnhancedCustomShapeSegmentCommand::ARCANGLETO
;
1060 mrSegments
.push_back( aSegment
);
1063 EnhancedCustomShapeParameterPair aScale
;
1064 EnhancedCustomShapeParameterPair aAngles
;
1066 aScale
.First
= GetAdjCoordinate( mrCustomShapeProperties
, rAttribs
.getString( XML_wR
).get(), true );
1067 aScale
.Second
= GetAdjCoordinate( mrCustomShapeProperties
, rAttribs
.getString( XML_hR
).get(), true );
1069 CustomShapeGuide aGuide
;
1070 sal_Int32 nArcNum
= mrCustomShapeProperties
.getArcNum();
1073 aGuide
.maName
= "arctosa" + OUString::number( nArcNum
);
1074 aGuide
.maFormula
= "("
1075 + GetFormulaParameter( GetAdjCoordinate( mrCustomShapeProperties
, rAttribs
.getString( XML_stAng
).get() ) )
1077 aAngles
.First
.Value
= Any( CustomShapeProperties::SetCustomShapeGuideValue( mrCustomShapeProperties
.getGuideList(), aGuide
) );
1078 aAngles
.First
.Type
= EnhancedCustomShapeParameterType::EQUATION
;
1081 aGuide
.maName
= "arctosw" + OUString::number( nArcNum
);
1082 aGuide
.maFormula
= "("
1083 + GetFormulaParameter( GetAdjCoordinate( mrCustomShapeProperties
, rAttribs
.getString( XML_swAng
).get() ) )
1085 aAngles
.Second
.Value
= Any( CustomShapeProperties::SetCustomShapeGuideValue( mrCustomShapeProperties
.getGuideList(), aGuide
) );
1086 aAngles
.Second
.Type
= EnhancedCustomShapeParameterType::EQUATION
;
1088 mrPath2D
.parameter
.push_back( aScale
);
1089 mrPath2D
.parameter
.push_back( aAngles
);
1092 case A_TOKEN( quadBezTo
) :
1094 if ( !mrSegments
.empty() && ( mrSegments
.back().Command
== EnhancedCustomShapeSegmentCommand::QUADRATICCURVETO
) )
1095 mrSegments
.back().Count
++;
1098 EnhancedCustomShapeSegment aSegment
;
1099 aSegment
.Command
= EnhancedCustomShapeSegmentCommand::QUADRATICCURVETO
;
1101 mrSegments
.push_back( aSegment
);
1103 EnhancedCustomShapeParameterPair aPt1
;
1104 EnhancedCustomShapeParameterPair aPt2
;
1105 mrPath2D
.parameter
.push_back( aPt1
);
1106 mrPath2D
.parameter
.push_back( aPt2
);
1107 return new Path2DQuadBezierToContext( *this, mrCustomShapeProperties
,
1108 mrPath2D
.parameter
[ mrPath2D
.parameter
.size() - 2 ],
1109 mrPath2D
.parameter
.back() );
1112 case A_TOKEN( cubicBezTo
) :
1114 if ( !mrSegments
.empty() && ( mrSegments
.back().Command
== EnhancedCustomShapeSegmentCommand::CURVETO
) )
1115 mrSegments
.back().Count
++;
1118 EnhancedCustomShapeSegment aSegment
;
1119 aSegment
.Command
= EnhancedCustomShapeSegmentCommand::CURVETO
;
1121 mrSegments
.push_back( aSegment
);
1123 EnhancedCustomShapeParameterPair aControlPt1
;
1124 EnhancedCustomShapeParameterPair aControlPt2
;
1125 EnhancedCustomShapeParameterPair aEndPt
;
1126 mrPath2D
.parameter
.push_back( aControlPt1
);
1127 mrPath2D
.parameter
.push_back( aControlPt2
);
1128 mrPath2D
.parameter
.push_back( aEndPt
);
1129 return new Path2DCubicBezierToContext( *this, mrCustomShapeProperties
,
1130 mrPath2D
.parameter
[ mrPath2D
.parameter
.size() - 3 ],
1131 mrPath2D
.parameter
[ mrPath2D
.parameter
.size() - 2 ],
1132 mrPath2D
.parameter
.back() );
1140 class Path2DListContext
: public ContextHandler2
1143 Path2DListContext( ContextHandler2Helper
& rParent
, CustomShapeProperties
& rCustomShapeProperties
, std::vector
< EnhancedCustomShapeSegment
>& rSegments
,
1144 std::vector
< Path2D
>& rPath2DList
);
1146 virtual ::oox::core::ContextHandlerRef
onCreateContext( sal_Int32 aElementToken
, const ::oox::AttributeList
& rAttribs
) SAL_OVERRIDE
;
1150 CustomShapeProperties
& mrCustomShapeProperties
;
1151 std::vector
< com::sun::star::drawing::EnhancedCustomShapeSegment
>& mrSegments
;
1152 std::vector
< Path2D
>& mrPath2DList
;
1155 Path2DListContext::Path2DListContext( ContextHandler2Helper
& rParent
, CustomShapeProperties
& rCustomShapeProperties
, std::vector
< EnhancedCustomShapeSegment
>& rSegments
,
1156 std::vector
< Path2D
>& rPath2DList
)
1157 : ContextHandler2( rParent
)
1158 , mrCustomShapeProperties( rCustomShapeProperties
)
1159 , mrSegments( rSegments
)
1160 , mrPath2DList( rPath2DList
)
1164 ContextHandlerRef
Path2DListContext::onCreateContext( sal_Int32 aElementToken
, const AttributeList
& rAttribs
)
1166 if ( aElementToken
== A_TOKEN( path
) )
1169 mrPath2DList
.push_back( aPath2D
);
1170 return new Path2DContext( *this, rAttribs
, mrCustomShapeProperties
, mrSegments
, mrPath2DList
.back() );
1175 // CT_CustomGeometry2D
1176 CustomShapeGeometryContext::CustomShapeGeometryContext( ContextHandler2Helper
& rParent
, const AttributeList
& /* rAttribs */, CustomShapeProperties
& rCustomShapeProperties
)
1177 : ContextHandler2( rParent
)
1178 , mrCustomShapeProperties( rCustomShapeProperties
)
1182 ContextHandlerRef
CustomShapeGeometryContext::onCreateContext( sal_Int32 aElementToken
, const AttributeList
& rAttribs
)
1184 switch( aElementToken
)
1186 case A_TOKEN( avLst
): // CT_GeomGuideList adjust value list
1187 return new GeomGuideListContext( *this, mrCustomShapeProperties
, mrCustomShapeProperties
.getAdjustmentGuideList() );
1188 case A_TOKEN( gdLst
): // CT_GeomGuideList guide list
1189 return new GeomGuideListContext( *this, mrCustomShapeProperties
, mrCustomShapeProperties
.getGuideList() );
1190 case A_TOKEN( ahLst
): // CT_AdjustHandleList adjust handle list
1191 return new AdjustHandleListContext( *this, mrCustomShapeProperties
, mrCustomShapeProperties
.getAdjustHandleList() );
1192 case A_TOKEN( cxnLst
): // CT_ConnectionSiteList connection site list
1194 case A_TOKEN( rect
): // CT_GeomRectList geometry rect list
1197 aGeomRect
.l
= GetAdjCoordinate( mrCustomShapeProperties
, rAttribs
.getString( XML_l
).get(), true );
1198 aGeomRect
.t
= GetAdjCoordinate( mrCustomShapeProperties
, rAttribs
.getString( XML_t
).get(), true );
1199 aGeomRect
.r
= GetAdjCoordinate( mrCustomShapeProperties
, rAttribs
.getString( XML_r
).get(), true );
1200 aGeomRect
.b
= GetAdjCoordinate( mrCustomShapeProperties
, rAttribs
.getString( XML_b
).get(), true );
1201 mrCustomShapeProperties
.getTextRect() = aGeomRect
;
1204 case A_TOKEN( pathLst
): // CT_Path2DList 2d path list
1205 return new Path2DListContext( *this, mrCustomShapeProperties
, mrCustomShapeProperties
.getSegments(), mrCustomShapeProperties
.getPath2DList() );
1208 case A_TOKEN( cxn
): // CT_ConnectionSite
1210 ConnectionSite aConnectionSite
;
1211 mrCustomShapeProperties
.getConnectionSiteList().push_back( aConnectionSite
);
1212 return new ConnectionSiteContext( *this, rAttribs
, mrCustomShapeProperties
, mrCustomShapeProperties
.getConnectionSiteList().back() );
1218 // CT_PresetGeometry2D
1219 PresetShapeGeometryContext::PresetShapeGeometryContext( ContextHandler2Helper
& rParent
, const AttributeList
& rAttribs
, CustomShapeProperties
& rCustomShapeProperties
)
1220 : ContextHandler2( rParent
)
1221 , mrCustomShapeProperties( rCustomShapeProperties
)
1223 sal_Int32 nShapeType
= rAttribs
.getToken( XML_prst
, FastToken::DONTKNOW
);
1224 OSL_ENSURE( nShapeType
!= FastToken::DONTKNOW
, "oox::drawingml::CustomShapeCustomGeometryContext::CustomShapeCustomGeometryContext(), unknown shape type" );
1225 mrCustomShapeProperties
.setShapePresetType( nShapeType
);
1228 ContextHandlerRef
PresetShapeGeometryContext::onCreateContext( sal_Int32 aElementToken
, const AttributeList
& )
1230 if ( aElementToken
== A_TOKEN( avLst
) )
1231 return new GeomGuideListContext( *this, mrCustomShapeProperties
, mrCustomShapeProperties
.getAdjustmentGuideList() );
1236 // CT_PresetTextShape
1237 PresetTextShapeContext::PresetTextShapeContext( ContextHandler2Helper
& rParent
, const AttributeList
& rAttribs
, CustomShapeProperties
& rCustomShapeProperties
)
1238 : ContextHandler2( rParent
)
1239 , mrCustomShapeProperties( rCustomShapeProperties
)
1241 sal_Int32 nShapeType
= rAttribs
.getToken( XML_prst
, FastToken::DONTKNOW
);
1242 OSL_ENSURE( nShapeType
!= FastToken::DONTKNOW
, "oox::drawingml::CustomShapeCustomGeometryContext::CustomShapeCustomGeometryContext(), unknown shape type" );
1243 mrCustomShapeProperties
.setShapePresetType( nShapeType
);
1246 ContextHandlerRef
PresetTextShapeContext::onCreateContext( sal_Int32 aElementToken
, const AttributeList
& )
1248 if ( aElementToken
== A_TOKEN( avLst
) )
1249 return new GeomGuideListContext( *this, mrCustomShapeProperties
, mrCustomShapeProperties
.getAdjustmentGuideList() );
1256 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */