LCOV - code coverage report
Current view: top level - libreoffice/oox/source/drawingml - customshapegeometry.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 61 563 10.8 %
Date: 2012-12-27 Functions: 16 59 27.1 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #include "oox/drawingml/customshapegeometry.hxx"
      21             : 
      22             : #include <com/sun/star/xml/sax/FastToken.hpp>
      23             : #include <comphelper/stl_types.hxx>
      24             : #include <boost/unordered_map.hpp>
      25             : #include "oox/helper/helper.hxx"
      26             : #include "oox/helper/attributelist.hxx"
      27             : #include "oox/helper/propertymap.hxx"
      28             : 
      29             : using namespace ::oox::core;
      30             : using namespace ::com::sun::star::uno;
      31             : using namespace ::com::sun::star::beans;
      32             : using namespace ::com::sun::star::drawing;
      33             : using namespace ::com::sun::star::xml::sax;
      34             : 
      35             : namespace oox { namespace drawingml {
      36             : 
      37             : enum FormularCommand
      38             : {
      39             :     FC_MULDIV = 0,
      40             :     FC_PLUSMINUS,
      41             :     FC_PLUSDIV,
      42             :     FC_IFELSE,
      43             :     FC_IFELSE1,
      44             :     FC_ABS,
      45             :     FC_AT2,
      46             :     FC_CAT2,
      47             :     FC_COS,
      48             :     FC_MAX,
      49             :     FC_MIN,
      50             :     FC_MOD,
      51             :     FC_PIN,
      52             :     FC_SAT2,
      53             :     FC_SIN,
      54             :     FC_SQRT,
      55             :     FC_TAN,
      56             :     FC_VAL,
      57             :     FC_LAST
      58             : };
      59             : struct FormularCommandNameTable
      60             : {
      61             :     const char*     pS;
      62             :     FormularCommand pE;
      63             : };
      64             : static FormularCommandNameTable pFormularCommandNameTable[] =
      65             : {
      66             :     { "*/",     FC_MULDIV },
      67             :     { "+-",     FC_PLUSMINUS },
      68             :     { "+/",     FC_PLUSDIV },
      69             :     { "ifelse", FC_IFELSE },
      70             :     { "?:",     FC_IFELSE1 },
      71             :     { "abs",    FC_ABS },
      72             :     { "at2",    FC_AT2 },
      73             :     { "cat2",   FC_CAT2 },
      74             :     { "cos",    FC_COS },
      75             :     { "max",    FC_MAX },
      76             :     { "min",    FC_MIN },
      77             :     { "mod",    FC_MOD },
      78             :     { "pin",    FC_PIN },
      79             :     { "sat2",   FC_SAT2 },
      80             :     { "sin",    FC_SIN },
      81             :     { "sqrt",   FC_SQRT },
      82             :     { "tan",    FC_TAN },
      83             :     { "val",    FC_VAL }
      84             : 
      85             : };
      86             : typedef boost::unordered_map< OUString, FormularCommand, OUStringHash, comphelper::UStringEqual > FormulaCommandHMap;
      87             : 
      88             : static const FormulaCommandHMap* pCommandHashMap;
      89             : 
      90             : //
      91           0 : OUString GetFormulaParameter( const EnhancedCustomShapeParameter& rParameter )
      92             : {
      93           0 :     OUString aRet;
      94           0 :     switch( rParameter.Type )
      95             :     {
      96             :         case EnhancedCustomShapeParameterType::NORMAL :
      97             :         {
      98           0 :             if ( rParameter.Value.getValueTypeClass() == TypeClass_DOUBLE )
      99             :             {
     100           0 :                 double fValue = 0.0;
     101           0 :                 if ( rParameter.Value >>= fValue )
     102           0 :                     aRet = OUString::valueOf( fValue );
     103             :             }
     104             :             else
     105             :             {
     106           0 :                 sal_Int32 nValue = 0;
     107           0 :                 if ( rParameter.Value >>= nValue )
     108           0 :                     aRet = OUString::valueOf( nValue );
     109             :             }
     110             :         }
     111           0 :         break;
     112             :         case EnhancedCustomShapeParameterType::EQUATION :
     113             :         {
     114           0 :             if ( rParameter.Value.getValueTypeClass() == TypeClass_LONG )
     115             :             {
     116             :                 sal_Int32 nFormulaIndex;
     117           0 :                 if ( rParameter.Value >>= nFormulaIndex )
     118             :                 {
     119             :                     aRet = CREATE_OUSTRING( "?" )
     120           0 :                         + OUString::valueOf( nFormulaIndex )
     121           0 :                             + CREATE_OUSTRING( " " );
     122             :                 }
     123             :             }
     124             :             else
     125             :             {
     126             :                 // ups... we should have an index here and not the formula name
     127             :             }
     128             :         }
     129           0 :         break;
     130             :         case EnhancedCustomShapeParameterType::ADJUSTMENT :
     131             :         {
     132           0 :             if ( rParameter.Value.getValueTypeClass() == TypeClass_LONG )
     133             :             {
     134             :                 sal_Int32 nAdjustmentIndex;
     135           0 :                 if ( rParameter.Value >>= nAdjustmentIndex )
     136             :                 {
     137             :                     aRet = CREATE_OUSTRING( "$" )
     138           0 :                         + OUString::valueOf( nAdjustmentIndex )
     139           0 :                             + CREATE_OUSTRING( " " );
     140             :                 }
     141             :             }
     142             :             else
     143             :             {
     144             :                 // ups... we should have an index here and not the formula name
     145             :             }
     146             :         }
     147           0 :         break;
     148             :         case EnhancedCustomShapeParameterType::LEFT :
     149             :         {
     150           0 :             const OUString sLeft( CREATE_OUSTRING( "left" ) );
     151           0 :             aRet = sLeft;
     152             :         }
     153           0 :         break;
     154             :         case EnhancedCustomShapeParameterType::TOP :
     155             :         {
     156           0 :             const OUString sTop( CREATE_OUSTRING( "top" ) );
     157           0 :             aRet = sTop;
     158             :         }
     159           0 :         break;
     160             :         case EnhancedCustomShapeParameterType::RIGHT :
     161             :         {
     162           0 :             const OUString sRight( CREATE_OUSTRING( "right" ) );
     163           0 :             aRet = sRight;
     164             :         }
     165           0 :         break;
     166             :         case EnhancedCustomShapeParameterType::BOTTOM :
     167             :         {
     168           0 :             const OUString sBottom( CREATE_OUSTRING( "bottom" ) );
     169           0 :             aRet = sBottom;
     170             :         }
     171           0 :         break;
     172             :         case EnhancedCustomShapeParameterType::XSTRETCH :
     173             :         {
     174           0 :             const OUString sXStretch( CREATE_OUSTRING( "xstretch" ) );
     175           0 :             aRet = sXStretch;
     176             :         }
     177           0 :         break;
     178             :         case EnhancedCustomShapeParameterType::YSTRETCH :
     179             :         {
     180           0 :             const OUString sYStretch( CREATE_OUSTRING( "ystretch" ) );
     181           0 :             aRet = sYStretch;
     182             :         }
     183           0 :         break;
     184             :         case EnhancedCustomShapeParameterType::HASSTROKE :
     185             :         {
     186           0 :             const OUString sHasStroke( CREATE_OUSTRING( "hasstroke" ) );
     187           0 :             aRet = sHasStroke;
     188             :         }
     189           0 :         break;
     190             :         case EnhancedCustomShapeParameterType::HASFILL :
     191             :         {
     192           0 :             const OUString sHasFill( CREATE_OUSTRING( "hasfill" ) );
     193           0 :             aRet = sHasFill;
     194             :         }
     195           0 :         break;
     196             :         case EnhancedCustomShapeParameterType::WIDTH :
     197             :         {
     198           0 :             const OUString sWidth( CREATE_OUSTRING( "width" ) );
     199           0 :             aRet = sWidth;
     200             :         }
     201           0 :         break;
     202             :         case EnhancedCustomShapeParameterType::HEIGHT :
     203             :         {
     204           0 :             const OUString sHeight( CREATE_OUSTRING( "height" ) );
     205           0 :             aRet = sHeight;
     206             :         }
     207           0 :         break;
     208             :         case EnhancedCustomShapeParameterType::LOGWIDTH :
     209             :         {
     210           0 :             const OUString sLogWidth( CREATE_OUSTRING( "logwidth" ) );
     211           0 :             aRet = sLogWidth;
     212             :         }
     213           0 :         break;
     214             :         case EnhancedCustomShapeParameterType::LOGHEIGHT :
     215             :         {
     216           0 :             const OUString sLogHeight( CREATE_OUSTRING( "logheight" ) );
     217           0 :             aRet = sLogHeight;
     218             :         }
     219           0 :         break;
     220             :     }
     221           0 :     return aRet;
     222             : }
     223             : 
     224             : // ---------------------------------------------------------------------
     225             : 
     226           8 : static EnhancedCustomShapeParameter GetAdjCoordinate( CustomShapeProperties& rCustomShapeProperties, const OUString& rValue, sal_Bool bNoSymbols = sal_True )
     227             : {
     228           8 :     com::sun::star::drawing::EnhancedCustomShapeParameter aRet;
     229           8 :     if ( !rValue.isEmpty() )
     230             :     {
     231           8 :         sal_Bool    bConstant = sal_True;
     232           8 :         sal_Int32   nConstant = -1;
     233           8 :         sal_Int32   nIntVal = 0;
     234             : 
     235             :         // first check if its a constant value
     236           8 :         switch( AttributeConversion::decodeToken( rValue ) )
     237             :         {
     238           0 :             case XML_3cd4 : nConstant = 270 * 60000; break;
     239           0 :             case XML_3cd8 : nConstant = 135 * 60000; break;
     240           0 :             case XML_5cd8 : nConstant = 225 * 60000; break;
     241           0 :             case XML_7cd8 : nConstant = 315 * 60000; break;
     242           0 :             case XML_cd2  : nConstant = 180 * 60000; break;
     243           0 :             case XML_cd3  : nConstant = 120 * 60000; break;
     244           0 :             case XML_cd4  : nConstant =  90 * 60000; break;
     245           0 :             case XML_cd8  : nConstant =  45 * 60000; break;
     246             : 
     247             :             case XML_b :    // variable height of the shape defined in spPr
     248             :             case XML_h :
     249             :             {
     250           0 :                 if ( bNoSymbols )
     251             :                 {
     252           0 :                     CustomShapeGuide aGuide;
     253           0 :                     aGuide.maName = rValue;
     254           0 :                     aGuide.maFormula = CREATE_OUSTRING( "logheight" );
     255             : 
     256           0 :                     aRet.Value = Any( CustomShapeProperties::SetCustomShapeGuideValue( rCustomShapeProperties.getGuideList(), aGuide ) );
     257           0 :                     aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
     258             :                 }
     259             :                 else
     260           0 :                     aRet.Type = EnhancedCustomShapeParameterType::LOGHEIGHT;   // TODO: HEIGHT needs to be implemented
     261             :             }
     262           0 :             break;
     263             : 
     264             : 
     265             :             case XML_hd10 :   // !!PASSTHROUGH INTENDED
     266           0 :                 nIntVal += 2; // */ h 1.0 10.0
     267             :             case XML_hd8 :    // */ h 1.0 8.0
     268           0 :                 nIntVal += 2;
     269             :             case XML_hd6 :    // */ h 1.0 6.0
     270           0 :                 nIntVal++;
     271             :             case XML_hd5 :    // */ h 1.0 5.0
     272           0 :                 nIntVal++;
     273             :             case XML_hd4 :    // */ h 1.0 4.0
     274           0 :                 nIntVal++;
     275             :             case XML_hd3 :    // */ h 1.0 3.0
     276           0 :                 nIntVal++;
     277             :             case XML_hd2 :    // */ h 1.0 2.0
     278             :             case XML_vc :     // */ h 1.0 2.0
     279             :             {
     280           0 :                 nIntVal += 2;
     281             : 
     282           0 :                 CustomShapeGuide aGuide;
     283           0 :                 aGuide.maName = rValue;
     284           0 :                 aGuide.maFormula = CREATE_OUSTRING( "logheight/" ) + OUString::valueOf( nIntVal );
     285             : 
     286           0 :                 aRet.Value = Any( CustomShapeProperties::SetCustomShapeGuideValue( rCustomShapeProperties.getGuideList(), aGuide ) );
     287           0 :                 aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
     288             :             }
     289           0 :             break;
     290             : 
     291             :             case XML_t :
     292             :             case XML_l :
     293             :             {
     294           0 :                 nConstant = 0;
     295           0 :                 aRet.Type = EnhancedCustomShapeParameterType::NORMAL;
     296             :             }
     297           0 :             break;
     298             : 
     299             :             case XML_ls :   // longest side: max w h
     300             :             {
     301           0 :                 CustomShapeGuide aGuide;
     302           0 :                 aGuide.maName = rValue;
     303           0 :                 aGuide.maFormula = CREATE_OUSTRING( "max(logwidth,logheight)" );
     304             : 
     305           0 :                 aRet.Value = Any( CustomShapeProperties::SetCustomShapeGuideValue( rCustomShapeProperties.getGuideList(), aGuide ) );
     306           0 :                 aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
     307             :             }
     308           0 :             break;
     309             :             case XML_ss :   // shortest side: min w h
     310             :             {
     311           0 :                 CustomShapeGuide aGuide;
     312           0 :                 aGuide.maName = rValue;
     313           0 :                 aGuide.maFormula = CREATE_OUSTRING( "min(logwidth,logheight)" );
     314             : 
     315           0 :                 aRet.Value = Any( CustomShapeProperties::SetCustomShapeGuideValue( rCustomShapeProperties.getGuideList(), aGuide ) );
     316           0 :                 aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
     317             :             }
     318           0 :             break;
     319             :             case XML_ssd32 : // */ ss 1.0 32.0
     320           0 :                 nIntVal += 16;
     321             :             case XML_ssd16 : // */ ss 1.0 16.0
     322           0 :                 nIntVal += 8;
     323             :             case XML_ssd8 :  // */ ss 1.0 8.0
     324           0 :                 nIntVal += 2;
     325             :             case XML_ssd6 :  // */ ss 1.0 6.0
     326           0 :                 nIntVal += 2;
     327             :             case XML_ssd4 :  // */ ss 1.0 4.0
     328           0 :                 nIntVal += 2;
     329             :             case XML_ssd2 :  // */ ss 1.0 2.0
     330             :             {
     331           0 :                 nIntVal += 2;
     332             : 
     333           0 :                 CustomShapeGuide aGuide;
     334           0 :                 aGuide.maName = rValue;
     335           0 :                 aGuide.maFormula = CREATE_OUSTRING( "min(logwidth,logheight)/" ) + OUString::valueOf( nIntVal );
     336             : 
     337           0 :                 aRet.Value = Any( CustomShapeProperties::SetCustomShapeGuideValue( rCustomShapeProperties.getGuideList(), aGuide ) );
     338           0 :                 aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
     339             :             }
     340           0 :             break;
     341             : 
     342             :             case XML_r :    // variable width of the shape defined in spPr
     343             :             case XML_w :
     344             :             {
     345           0 :                 if ( bNoSymbols )
     346             :                 {
     347           0 :                     CustomShapeGuide aGuide;
     348           0 :                     aGuide.maName = rValue;
     349           0 :                     aGuide.maFormula = CREATE_OUSTRING( "logwidth" );
     350             : 
     351           0 :                     aRet.Value = Any( CustomShapeProperties::SetCustomShapeGuideValue( rCustomShapeProperties.getGuideList(), aGuide ) );
     352           0 :                     aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
     353             :                 }
     354             :                 else
     355           0 :                     aRet.Type = EnhancedCustomShapeParameterType::LOGWIDTH;
     356             :             }
     357           0 :             break;
     358             : 
     359             :             case XML_wd32 : // */ w 1.0 32.0
     360           0 :                 nIntVal += 20;
     361             :             case XML_wd12 : // */ w 1.0 12.0
     362           0 :                 nIntVal += 2;
     363             :             case XML_wd10 : // */ w 1.0 10.0
     364           0 :                 nIntVal += 2;
     365             :             case XML_wd8 :  // */ w 1.0 8.0
     366           0 :                 nIntVal += 2;
     367             :             case XML_wd6 :  // */ w 1.0 6.0
     368           0 :                 nIntVal++;
     369             :             case XML_wd5 :  // */ w 1.0 5.0
     370           0 :                 nIntVal++;
     371             :             case XML_wd4 :  // */ w 1.0 4.0
     372           0 :                 nIntVal++;
     373             :             case XML_wd3 :  // */ w 1.0 3.0
     374           0 :                 nIntVal++;
     375             :             case XML_hc :   // */ w 1.0 2.0
     376             :             case XML_wd2 :  // */ w 1.0 2.0
     377             :             {
     378           0 :                 nIntVal += 2;
     379             : 
     380           0 :                 CustomShapeGuide aGuide;
     381           0 :                 aGuide.maName = rValue;
     382           0 :                 aGuide.maFormula = CREATE_OUSTRING( "logwidth/" ) + OUString::valueOf( nIntVal );
     383             : 
     384           0 :                 aRet.Value = Any( CustomShapeProperties::SetCustomShapeGuideValue( rCustomShapeProperties.getGuideList(), aGuide ) );
     385           0 :                 aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
     386             :             }
     387           0 :             break;
     388             : 
     389             :             default:
     390           8 :                 bConstant = sal_False;
     391           8 :             break;
     392             :         }
     393           8 :         if ( bConstant )
     394             :         {
     395           0 :             if (nConstant != -1) {
     396           0 :                 aRet.Value = Any( nConstant );
     397           0 :                 aRet.Type = EnhancedCustomShapeParameterType::NORMAL;
     398             :             }
     399             :         }
     400             :         else
     401             :         {
     402           8 :             sal_Unicode n = rValue[ 0 ];
     403           8 :             if ( ( n == '+' ) || ( n == '-' ) )
     404             :             {
     405           0 :                 if ( !rValue.isEmpty() )
     406           0 :                     n = rValue[ 1 ];
     407             :             }
     408           8 :             if ( ( n >= '0' ) && ( n <= '9' ) )
     409             :             {   // seems to be a ST_Coordinate
     410           8 :                 aRet.Value = Any( (sal_Int32)(rValue.toInt32() ) );
     411           8 :                 aRet.Type = EnhancedCustomShapeParameterType::NORMAL;
     412             :             }
     413             :             else
     414             :             {
     415           0 :                 sal_Int32 nGuideIndex = CustomShapeProperties::GetCustomShapeGuideValue( rCustomShapeProperties.getAdjustmentGuideList(), rValue );
     416           0 :                 if ( nGuideIndex >= 0 )
     417             :                 {
     418           0 :                     aRet.Value = Any( nGuideIndex );
     419           0 :                     aRet.Type = EnhancedCustomShapeParameterType::ADJUSTMENT;
     420             :                 }
     421             :                 else
     422             :                 {
     423           0 :                     nGuideIndex = CustomShapeProperties::GetCustomShapeGuideValue( rCustomShapeProperties.getGuideList(), rValue );
     424           0 :                     if ( nGuideIndex >= 0 )
     425             :                     {
     426           0 :                         aRet.Value = Any( nGuideIndex );
     427           0 :                         aRet.Type = EnhancedCustomShapeParameterType::EQUATION;
     428             :                     }
     429             :                     else
     430             :                     {
     431             :                         OSL_TRACE("error: unhandled value '%s'", OUStringToOString( rValue, RTL_TEXTENCODING_ASCII_US ).getStr());
     432           0 :                         aRet.Value = Any( rValue );
     433             :                     }
     434             :                 }
     435             :             }
     436             :         }
     437             :     }
     438           8 :     return aRet;
     439             : }
     440             : 
     441             : // ---------------------------------------------------------------------
     442             : // CT_GeomGuideList
     443         108 : class GeomGuideListContext : public ContextHandler
     444             : {
     445             : public:
     446             :     GeomGuideListContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< CustomShapeGuide >& rGuideList );
     447             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
     448             : 
     449             : protected:
     450             :     std::vector< CustomShapeGuide >&    mrGuideList;
     451             :     CustomShapeProperties&              mrCustomShapeProperties;
     452             : };
     453             : 
     454          54 : GeomGuideListContext::GeomGuideListContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< CustomShapeGuide >& rGuideList )
     455             : : ContextHandler( rParent )
     456             : , mrGuideList( rGuideList )
     457          54 : , mrCustomShapeProperties( rCustomShapeProperties )
     458             : {
     459          54 : }
     460             : 
     461           0 : static OUString convertToOOEquation( CustomShapeProperties& rCustomShapeProperties, const OUString& rSource )
     462             : {
     463           0 :     if ( !pCommandHashMap )
     464             :     {
     465           0 :         FormulaCommandHMap* pHM = new FormulaCommandHMap();
     466           0 :         for( sal_Int32 i = 0; i < FC_LAST; i++ )
     467           0 :             (*pHM)[ OUString::createFromAscii( pFormularCommandNameTable[ i ].pS ) ] =  pFormularCommandNameTable[ i ].pE;
     468           0 :         pCommandHashMap = pHM;
     469             :     }
     470             : 
     471           0 :     std::vector< OUString > aTokens;
     472           0 :     sal_Int32 nIndex = 0;
     473           0 :     do
     474             :     {
     475           0 :         OUString aToken( rSource.getToken( 0, ' ', nIndex ) );
     476           0 :         if ( !aToken.isEmpty() )
     477           0 :             aTokens.push_back( aToken );
     478             :     }
     479             :     while ( nIndex >= 0 );
     480             : 
     481           0 :     OUString aEquation;
     482           0 :     if ( !aTokens.empty() )
     483             :     {
     484           0 :         sal_Int32 i, nParameters = aTokens.size() - 1;
     485           0 :         if ( nParameters > 3 )
     486           0 :             nParameters = 3;
     487             : 
     488           0 :         OUString sParameters[ 3 ];
     489             : 
     490           0 :         for ( i = 0; i < nParameters; i++ )
     491           0 :             sParameters[ i ] = GetFormulaParameter( GetAdjCoordinate( rCustomShapeProperties, aTokens[ i + 1 ], sal_False ) );
     492             : 
     493           0 :         const FormulaCommandHMap::const_iterator aIter( pCommandHashMap->find( aTokens[ 0 ] ) );
     494           0 :         if ( aIter != pCommandHashMap->end() )
     495             :         {
     496           0 :             switch( aIter->second )
     497             :             {
     498             :                 case FC_MULDIV :
     499             :                 {
     500           0 :                     if ( nParameters == 3 )
     501           0 :                         aEquation = sParameters[ 0 ] + CREATE_OUSTRING( "*" ) + sParameters[ 1 ]
     502           0 :                             + CREATE_OUSTRING( "/" ) + sParameters[ 2 ];
     503             :                 }
     504           0 :                 break;
     505             :                 case FC_PLUSMINUS :
     506             :                 {
     507           0 :                     if ( nParameters == 3 )
     508           0 :                         aEquation = sParameters[ 0 ] + CREATE_OUSTRING( "+" ) + sParameters[ 1 ]
     509           0 :                             + CREATE_OUSTRING( "-" ) + sParameters[ 2 ];
     510             :                 }
     511           0 :                 break;
     512             :                 case FC_PLUSDIV :
     513             :                 {
     514           0 :                     if ( nParameters == 3 )
     515           0 :                         aEquation = CREATE_OUSTRING( "(" ) + sParameters[ 0 ] + CREATE_OUSTRING( "+" )
     516           0 :                             + sParameters[ 1 ] + CREATE_OUSTRING( ")/" ) + sParameters[ 2 ];
     517             :                 }
     518           0 :                 break;
     519             :                 case FC_IFELSE :
     520             :                 case FC_IFELSE1 :
     521             :                 {
     522           0 :                     if ( nParameters == 3 )
     523           0 :                         aEquation = CREATE_OUSTRING( "if(" ) + sParameters[ 0 ] + CREATE_OUSTRING( "," )
     524           0 :                             + sParameters[ 1 ] + CREATE_OUSTRING( "," ) + sParameters[ 2 ] + CREATE_OUSTRING( ")" );
     525             :                 }
     526           0 :                 break;
     527             :                 case FC_ABS :
     528             :                 {
     529           0 :                     if ( nParameters == 1 )
     530           0 :                         aEquation = CREATE_OUSTRING( "abs(" ) + sParameters[ 0 ] + CREATE_OUSTRING( ")" );
     531             :                 }
     532           0 :                 break;
     533             :                 case FC_AT2 :
     534             :                 {
     535           0 :                     if ( nParameters == 2 )
     536           0 :                         aEquation = CREATE_OUSTRING( "(10800000*atan2(" ) + sParameters[ 1 ] + CREATE_OUSTRING( "," )
     537           0 :                         + sParameters[ 0 ] + CREATE_OUSTRING( "))/pi" );
     538             :                 }
     539           0 :                 break;
     540             :                 case FC_CAT2 :
     541             :                 {
     542           0 :                     if ( nParameters == 3 )
     543           0 :                         aEquation = sParameters[ 0 ] + CREATE_OUSTRING( "*(cos(atan2(" ) +
     544           0 :                             sParameters[ 2 ] + CREATE_OUSTRING( "," ) + sParameters[ 1 ] + CREATE_OUSTRING( ")))" );
     545             :                 }
     546           0 :                 break;
     547             :                 case FC_COS :
     548             :                 {
     549           0 :                     if ( nParameters == 2 )
     550           0 :                         aEquation = sParameters[ 0 ] + CREATE_OUSTRING( "*cos(pi*(" ) +
     551           0 :                         sParameters[ 1 ] + CREATE_OUSTRING( ")/10800000)" );
     552             :                 }
     553           0 :                 break;
     554             :                 case FC_MAX :
     555             :                 {
     556           0 :                     if ( nParameters == 2 )
     557           0 :                         aEquation = CREATE_OUSTRING( "max(" ) + sParameters[ 0 ] + CREATE_OUSTRING( "," ) +
     558           0 :                             sParameters[ 1 ] + CREATE_OUSTRING( ")" );
     559             :                 }
     560           0 :                 break;
     561             :                 case FC_MIN :
     562             :                 {
     563           0 :                     if ( nParameters == 2 )
     564           0 :                         aEquation = CREATE_OUSTRING( "min(" ) + sParameters[ 0 ] + CREATE_OUSTRING( "," ) +
     565           0 :                             sParameters[ 1 ] + CREATE_OUSTRING( ")" );
     566             :                 }
     567           0 :                 break;
     568             :                 case FC_MOD :
     569             :                 {
     570           0 :                     if ( nParameters == 3 )
     571             :                         aEquation = CREATE_OUSTRING( "sqrt(" )
     572           0 :                             + sParameters[ 0 ] + CREATE_OUSTRING( "*" ) + sParameters[ 0 ] + CREATE_OUSTRING( "+" )
     573           0 :                             + sParameters[ 1 ] + CREATE_OUSTRING( "*" ) + sParameters[ 1 ] + CREATE_OUSTRING( "+" )
     574           0 :                             + sParameters[ 2 ] + CREATE_OUSTRING( "*" ) + sParameters[ 2 ] + CREATE_OUSTRING( ")" );
     575             :                 }
     576           0 :                 break;
     577             :                 case FC_PIN :
     578             :                 {
     579           0 :                     if ( nParameters == 3 ) // if(x-y,x,if(y-z,z,y))
     580           0 :                         aEquation = CREATE_OUSTRING( "if(" ) + sParameters[ 0 ] + CREATE_OUSTRING( "-" ) + sParameters[ 1 ]
     581           0 :                             + CREATE_OUSTRING( "," ) + sParameters[ 0 ] + CREATE_OUSTRING( ",if(" ) + sParameters[ 2 ]
     582           0 :                             + CREATE_OUSTRING( "-" ) + sParameters[ 1 ] + CREATE_OUSTRING( "," ) + sParameters[ 1 ]
     583           0 :                             + CREATE_OUSTRING( "," ) + sParameters[ 2 ] + CREATE_OUSTRING( "))" );
     584             :                 }
     585           0 :                 break;
     586             :                 case FC_SAT2 :
     587             :                 {
     588           0 :                     if ( nParameters == 3 )
     589           0 :                         aEquation = sParameters[ 0 ] + CREATE_OUSTRING( "*(sin(atan2(" ) +
     590           0 :                             sParameters[ 2 ] + CREATE_OUSTRING( "," ) + sParameters[ 1 ] + CREATE_OUSTRING( ")))" );
     591             :                 }
     592           0 :                 break;
     593             :                 case FC_SIN :
     594             :                 {
     595           0 :                     if ( nParameters == 2 )
     596           0 :                         aEquation = sParameters[ 0 ] + CREATE_OUSTRING( "*sin(pi*(" ) +
     597           0 :                         sParameters[ 1 ] + CREATE_OUSTRING( ")/10800000)" );
     598             :                 }
     599           0 :                 break;
     600             :                 case FC_SQRT :
     601             :                 {
     602           0 :                     if ( nParameters == 1 )
     603           0 :                         aEquation = CREATE_OUSTRING( "sqrt(" ) + sParameters[ 0 ] + CREATE_OUSTRING( ")" );
     604             :                 }
     605           0 :                 break;
     606             :                 case FC_TAN :
     607             :                 {
     608           0 :                     if ( nParameters == 2 )
     609           0 :                         aEquation = sParameters[ 0 ] + CREATE_OUSTRING( "*tan(pi*(" ) +
     610           0 :                         sParameters[ 1 ] + CREATE_OUSTRING( ")/10800000)" );
     611             :                 }
     612           0 :                 break;
     613             :                 case FC_VAL :
     614             :                 {
     615           0 :                     if ( nParameters == 1 )
     616           0 :                         aEquation = sParameters[ 0 ];
     617             :                 }
     618           0 :                 break;
     619             :                 default :
     620           0 :                     break;
     621             :             }
     622           0 :         }
     623             :     }
     624           0 :     return aEquation;
     625             : }
     626             : 
     627           0 : Reference< XFastContextHandler > GeomGuideListContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
     628             : {
     629           0 :     if ( aElementToken == A_TOKEN( gd ) )   // CT_GeomGuide
     630             :     {
     631           0 :         CustomShapeGuide aGuide;
     632           0 :         aGuide.maName = xAttribs->getOptionalValue( XML_name );
     633           0 :         aGuide.maFormula = convertToOOEquation( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_fmla ) );
     634           0 :         mrGuideList.push_back( aGuide );
     635             :     }
     636           0 :     return this;
     637             : }
     638             : 
     639             : // ---------------------------------------------------------------------
     640             : 
     641           0 : static const OUString GetGeomGuideName( const OUString& rValue )
     642             : {
     643           0 :     return rValue;
     644             : }
     645             : 
     646             : // ---------------------------------------------------------------------
     647             : // CT_AdjPoint2D
     648           0 : class AdjPoint2DContext : public ContextHandler
     649             : {
     650             : public:
     651             :     AdjPoint2DContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D );
     652             : };
     653             : 
     654           0 : AdjPoint2DContext::AdjPoint2DContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D )
     655           0 : : ContextHandler( rParent )
     656             : {
     657           0 :     rAdjPoint2D.First = GetAdjCoordinate( rCustomShapeProperties, xAttribs->getOptionalValue( XML_x ), sal_True );
     658           0 :     rAdjPoint2D.Second = GetAdjCoordinate( rCustomShapeProperties, xAttribs->getOptionalValue( XML_y ), sal_True );
     659           0 : }
     660             : 
     661             : // ---------------------------------------------------------------------
     662             : // CT_XYAdjustHandle
     663           0 : class XYAdjustHandleContext : public ContextHandler
     664             : {
     665             : public:
     666             :     XYAdjustHandleContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, AdjustHandle& rAdjustHandle );
     667             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
     668             : 
     669             : protected:
     670             :     AdjustHandle& mrAdjustHandle;
     671             :     CustomShapeProperties& mrCustomShapeProperties;
     672             : };
     673             : 
     674           0 : XYAdjustHandleContext::XYAdjustHandleContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, AdjustHandle& rAdjustHandle )
     675             : : ContextHandler( rParent )
     676             : , mrAdjustHandle( rAdjustHandle )
     677           0 : , mrCustomShapeProperties( rCustomShapeProperties )
     678             : {
     679           0 :     const OUString aEmptyDefault;
     680           0 :     AttributeList aAttribs( xAttribs );
     681           0 :     if ( aAttribs.hasAttribute( XML_gdRefX ) )
     682             :     {
     683           0 :         mrAdjustHandle.gdRef1 = GetGeomGuideName( aAttribs.getString( XML_gdRefX, aEmptyDefault ) );
     684             :     }
     685           0 :     if ( aAttribs.hasAttribute( XML_minX ) )
     686             :     {
     687           0 :         mrAdjustHandle.min1 = GetAdjCoordinate( mrCustomShapeProperties, aAttribs.getString( XML_minX, aEmptyDefault ), sal_True );
     688             :     }
     689           0 :     if ( aAttribs.hasAttribute( XML_maxX ) )
     690             :     {
     691           0 :         mrAdjustHandle.max1 = GetAdjCoordinate( mrCustomShapeProperties, aAttribs.getString( XML_maxX, aEmptyDefault ), sal_True );
     692             :     }
     693           0 :     if ( aAttribs.hasAttribute( XML_gdRefY ) )
     694             :     {
     695           0 :         mrAdjustHandle.gdRef2 = GetGeomGuideName( aAttribs.getString( XML_gdRefY, aEmptyDefault ) );
     696             :     }
     697           0 :     if ( aAttribs.hasAttribute( XML_minY ) )
     698             :     {
     699           0 :         mrAdjustHandle.min2 = GetAdjCoordinate( mrCustomShapeProperties, aAttribs.getString( XML_minY, aEmptyDefault ), sal_True );
     700             :     }
     701           0 :     if ( aAttribs.hasAttribute( XML_maxY ) )
     702             :     {
     703           0 :         mrAdjustHandle.max2 = GetAdjCoordinate( mrCustomShapeProperties, aAttribs.getString( XML_maxY, aEmptyDefault ), sal_True );
     704           0 :     }
     705           0 : }
     706             : 
     707           0 : Reference< XFastContextHandler > XYAdjustHandleContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
     708             : {
     709           0 :     Reference< XFastContextHandler > xContext;
     710           0 :     if ( aElementToken == A_TOKEN( pos ) )
     711           0 :         xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties, mrAdjustHandle.pos );   // CT_AdjPoint2D
     712           0 :     return xContext;
     713             : }
     714             : 
     715             : // ---------------------------------------------------------------------
     716             : // CT_PolarAdjustHandle
     717           0 : class PolarAdjustHandleContext : public ContextHandler
     718             : {
     719             : public:
     720             :     PolarAdjustHandleContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, AdjustHandle& rAdjustHandle );
     721             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
     722             : 
     723             : protected:
     724             :     AdjustHandle& mrAdjustHandle;
     725             :     CustomShapeProperties& mrCustomShapeProperties;
     726             : };
     727             : 
     728           0 : PolarAdjustHandleContext::PolarAdjustHandleContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, AdjustHandle& rAdjustHandle )
     729             : : ContextHandler( rParent )
     730             : , mrAdjustHandle( rAdjustHandle )
     731           0 : , mrCustomShapeProperties( rCustomShapeProperties )
     732             : {
     733           0 :     const OUString aEmptyDefault;
     734           0 :     AttributeList aAttribs( xAttribs );
     735           0 :     if ( aAttribs.hasAttribute( XML_gdRefR ) )
     736             :     {
     737           0 :         mrAdjustHandle.gdRef1 = GetGeomGuideName( aAttribs.getString( XML_gdRefR, aEmptyDefault ) );
     738             :     }
     739           0 :     if ( aAttribs.hasAttribute( XML_minR ) )
     740             :     {
     741           0 :         mrAdjustHandle.min1 = GetAdjCoordinate( mrCustomShapeProperties, aAttribs.getString( XML_minR, aEmptyDefault ), sal_True );
     742             :     }
     743           0 :     if ( aAttribs.hasAttribute( XML_maxR ) )
     744             :     {
     745           0 :         mrAdjustHandle.max1 = GetAdjCoordinate( mrCustomShapeProperties, aAttribs.getString( XML_maxR, aEmptyDefault ), sal_True );
     746             :     }
     747           0 :     if ( aAttribs.hasAttribute( XML_gdRefAng ) )
     748             :     {
     749           0 :         mrAdjustHandle.gdRef2 = GetGeomGuideName( aAttribs.getString( XML_gdRefAng, aEmptyDefault ) );
     750             :     }
     751           0 :     if ( aAttribs.hasAttribute( XML_minAng ) )
     752             :     {
     753           0 :         mrAdjustHandle.min2 = GetAdjCoordinate( mrCustomShapeProperties, aAttribs.getString( XML_minAng, aEmptyDefault ) );
     754             :     }
     755           0 :     if ( aAttribs.hasAttribute( XML_maxAng ) )
     756             :     {
     757           0 :         mrAdjustHandle.max2 = GetAdjCoordinate( mrCustomShapeProperties, aAttribs.getString( XML_maxAng, aEmptyDefault ) );
     758           0 :     }
     759           0 : }
     760             : 
     761           0 : Reference< XFastContextHandler > PolarAdjustHandleContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
     762             : {
     763           0 :     Reference< XFastContextHandler > xContext;
     764           0 :     if ( aElementToken == A_TOKEN( pos ) )
     765           0 :         xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties, mrAdjustHandle.pos );   // CT_AdjPoint2D
     766           0 :     return xContext;
     767             : }
     768             : 
     769             : // ---------------------------------------------------------------------
     770             : // CT_AdjustHandleList
     771           4 : class AdjustHandleListContext : public ContextHandler
     772             : {
     773             : public:
     774             :     AdjustHandleListContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< AdjustHandle >& rAdjustHandleList );
     775             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
     776             : 
     777             : protected:
     778             :     std::vector< AdjustHandle >& mrAdjustHandleList;
     779             :     CustomShapeProperties& mrCustomShapeProperties;
     780             : };
     781             : 
     782           2 : AdjustHandleListContext::AdjustHandleListContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< AdjustHandle >& rAdjustHandleList )
     783             : : ContextHandler( rParent )
     784             : , mrAdjustHandleList( rAdjustHandleList )
     785           2 : , mrCustomShapeProperties( rCustomShapeProperties )
     786             : {
     787           2 : }
     788             : 
     789           0 : Reference< XFastContextHandler > AdjustHandleListContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
     790             : {
     791           0 :     Reference< XFastContextHandler > xContext;
     792           0 :     if ( aElementToken == A_TOKEN( ahXY ) )         // CT_XYAdjustHandle
     793             :     {
     794           0 :         AdjustHandle aAdjustHandle( sal_False );
     795           0 :         mrAdjustHandleList.push_back( aAdjustHandle );
     796           0 :         xContext = new XYAdjustHandleContext( *this, xAttribs, mrCustomShapeProperties, mrAdjustHandleList.back() );
     797             :     }
     798           0 :     else if ( aElementToken == A_TOKEN( ahPolar ) ) // CT_PolarAdjustHandle
     799             :     {
     800           0 :         AdjustHandle aAdjustHandle( sal_True );
     801           0 :         mrAdjustHandleList.push_back( aAdjustHandle );
     802           0 :         xContext = new PolarAdjustHandleContext( *this, xAttribs, mrCustomShapeProperties, mrAdjustHandleList.back() );
     803             :     }
     804           0 :     return xContext;
     805             : }
     806             : 
     807             : // ---------------------------------------------------------------------
     808             : // CT_ConnectionSite
     809           0 : class ConnectionSiteContext : public ContextHandler
     810             : {
     811             : public:
     812             :     ConnectionSiteContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, ConnectionSite& rConnectionSite );
     813             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
     814             : 
     815             : protected:
     816             :     ConnectionSite& mrConnectionSite;
     817             :     CustomShapeProperties& mrCustomShapeProperties;
     818             : };
     819             : 
     820           0 : ConnectionSiteContext::ConnectionSiteContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, ConnectionSite& rConnectionSite )
     821             : : ContextHandler( rParent )
     822             : , mrConnectionSite( rConnectionSite )
     823           0 : , mrCustomShapeProperties( rCustomShapeProperties )
     824             : {
     825           0 :     mrConnectionSite.ang = GetAdjCoordinate( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_ang ) );
     826           0 : }
     827             : 
     828           0 : Reference< XFastContextHandler > ConnectionSiteContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
     829             : {
     830           0 :     Reference< XFastContextHandler > xContext;
     831           0 :     if ( aElementToken == A_TOKEN( pos ) )
     832           0 :         xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties, mrConnectionSite.pos ); // CT_AdjPoint2D
     833           0 :     return xContext;
     834             : }
     835             : 
     836             : // ---------------------------------------------------------------------
     837             : // CT_Path2DMoveTo
     838           0 : class Path2DMoveToContext : public ContextHandler
     839             : {
     840             : public:
     841             :     Path2DMoveToContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D );
     842             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
     843             : 
     844             : protected:
     845             :     EnhancedCustomShapeParameterPair& mrAdjPoint2D;
     846             :     CustomShapeProperties& mrCustomShapeProperties;
     847             : };
     848             : 
     849           0 : Path2DMoveToContext::Path2DMoveToContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D )
     850             : : ContextHandler( rParent )
     851             : , mrAdjPoint2D( rAdjPoint2D )
     852           0 : , mrCustomShapeProperties( rCustomShapeProperties )
     853             : {
     854           0 : }
     855             : 
     856           0 : Reference< XFastContextHandler > Path2DMoveToContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
     857             : {
     858           0 :     Reference< XFastContextHandler > xContext;
     859           0 :     if ( aElementToken == A_TOKEN( pt ) )
     860           0 :         xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties, mrAdjPoint2D );     // CT_AdjPoint2D
     861           0 :     return xContext;
     862             : }
     863             : 
     864             : // ---------------------------------------------------------------------
     865             : // CT_Path2DLineTo
     866           0 : class Path2DLineToContext : public ContextHandler
     867             : {
     868             : public:
     869             :     Path2DLineToContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D );
     870             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
     871             : 
     872             : protected:
     873             :     EnhancedCustomShapeParameterPair& mrAdjPoint2D;
     874             :     CustomShapeProperties& mrCustomShapeProperties;
     875             : };
     876             : 
     877           0 : Path2DLineToContext::Path2DLineToContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D )
     878             : : ContextHandler( rParent )
     879             : , mrAdjPoint2D( rAdjPoint2D )
     880           0 : , mrCustomShapeProperties( rCustomShapeProperties )
     881             : {
     882           0 : }
     883             : 
     884           0 : Reference< XFastContextHandler > Path2DLineToContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
     885             : {
     886           0 :     Reference< XFastContextHandler > xContext;
     887           0 :     if ( aElementToken == A_TOKEN( pt ) )
     888           0 :         xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties, mrAdjPoint2D );     // CT_AdjPoint2D
     889           0 :     return xContext;
     890             : }
     891             : 
     892             : // ---------------------------------------------------------------------
     893             : // CT_Path2DQuadBezierTo
     894           0 : class Path2DQuadBezierToContext : public ContextHandler
     895             : {
     896             : public:
     897             :     Path2DQuadBezierToContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rPt1, EnhancedCustomShapeParameterPair& rPt2 );
     898             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
     899             : 
     900             : protected:
     901             :     EnhancedCustomShapeParameterPair& mrPt1;
     902             :     EnhancedCustomShapeParameterPair& mrPt2;
     903             :     int nCount;
     904             :     CustomShapeProperties& mrCustomShapeProperties;
     905             : };
     906             : 
     907           0 : Path2DQuadBezierToContext::Path2DQuadBezierToContext( ContextHandler& rParent,
     908             :     CustomShapeProperties& rCustomShapeProperties,
     909             :         EnhancedCustomShapeParameterPair& rPt1,
     910             :             EnhancedCustomShapeParameterPair& rPt2 )
     911             : : ContextHandler( rParent )
     912             : , mrPt1( rPt1 )
     913             : , mrPt2( rPt2 )
     914             : , nCount( 0 )
     915           0 : , mrCustomShapeProperties( rCustomShapeProperties )
     916             : {
     917           0 : }
     918             : 
     919           0 : Reference< XFastContextHandler > Path2DQuadBezierToContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
     920             : {
     921           0 :     Reference< XFastContextHandler > xContext;
     922           0 :     if ( aElementToken == A_TOKEN( pt ) )
     923           0 :         xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties, nCount++ ? mrPt2 : mrPt1 ); // CT_AdjPoint2D
     924           0 :     return xContext;
     925             : }
     926             : 
     927             : // ---------------------------------------------------------------------
     928             : // CT_Path2DCubicBezierTo
     929           0 : class Path2DCubicBezierToContext : public ContextHandler
     930             : {
     931             : public:
     932             :     Path2DCubicBezierToContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties,
     933             :         EnhancedCustomShapeParameterPair&, EnhancedCustomShapeParameterPair&, EnhancedCustomShapeParameterPair& );
     934             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
     935             : 
     936             : protected:
     937             :     CustomShapeProperties& mrCustomShapeProperties;
     938             :     EnhancedCustomShapeParameterPair& mrControlPt1;
     939             :     EnhancedCustomShapeParameterPair& mrControlPt2;
     940             :     EnhancedCustomShapeParameterPair& mrEndPt;
     941             :     int nCount;
     942             : };
     943             : 
     944           0 : Path2DCubicBezierToContext::Path2DCubicBezierToContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties,
     945             :     EnhancedCustomShapeParameterPair& rControlPt1,
     946             :         EnhancedCustomShapeParameterPair& rControlPt2,
     947             :             EnhancedCustomShapeParameterPair& rEndPt )
     948             : : ContextHandler( rParent )
     949             : , mrCustomShapeProperties( rCustomShapeProperties )
     950             : , mrControlPt1( rControlPt1 )
     951             : , mrControlPt2( rControlPt2 )
     952             : , mrEndPt( rEndPt )
     953           0 : , nCount( 0 )
     954             : {
     955           0 : }
     956             : 
     957           0 : Reference< XFastContextHandler > Path2DCubicBezierToContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
     958             : {
     959           0 :     Reference< XFastContextHandler > xContext;
     960           0 :     if ( aElementToken == A_TOKEN( pt ) )
     961             :         xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties,
     962           0 :             nCount++ ? nCount == 2 ? mrControlPt2 : mrEndPt : mrControlPt1 );   // CT_AdjPoint2D
     963           0 :     return xContext;
     964             : }
     965             : 
     966             : // ---------------------------------------------------------------------
     967             : // CT_Path2DContext
     968             : class Path2DContext : public ContextHandler
     969             : {
     970             : public:
     971             :     Path2DContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >& rSegments, Path2D& rPath2D );
     972             :     virtual ~Path2DContext();
     973             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL
     974             :         createFastChildContext( sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs )
     975             :             throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
     976             : 
     977             : protected:
     978             :     Path2D& mrPath2D;
     979             :     std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >& mrSegments;
     980             :     CustomShapeProperties& mrCustomShapeProperties;
     981             : };
     982             : 
     983           0 : Path2DContext::Path2DContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >& rSegments, Path2D& rPath2D )
     984             : : ContextHandler( rParent )
     985             : , mrPath2D( rPath2D )
     986             : , mrSegments( rSegments )
     987           0 : , mrCustomShapeProperties( rCustomShapeProperties )
     988             : {
     989           0 :     const OUString aEmptyString;
     990             : 
     991           0 :     AttributeList aAttribs( xAttribs );
     992           0 :     rPath2D.w = aAttribs.getString( XML_w, aEmptyString ).toInt64();
     993           0 :     rPath2D.h = aAttribs.getString( XML_h, aEmptyString ).toInt64();
     994           0 :     rPath2D.fill = aAttribs.getToken( XML_fill, XML_norm );
     995           0 :     rPath2D.stroke = aAttribs.getBool( XML_stroke, sal_True );
     996           0 :     rPath2D.extrusionOk = aAttribs.getBool( XML_extrusionOk, sal_True );
     997           0 : }
     998             : 
     999           0 : Path2DContext::~Path2DContext()
    1000             : {
    1001           0 :     EnhancedCustomShapeSegment aNewSegment;
    1002           0 :     switch ( mrPath2D.fill )
    1003             :     {
    1004             :         case XML_none:
    1005           0 :             aNewSegment.Command = EnhancedCustomShapeSegmentCommand::NOFILL;
    1006           0 :             break;
    1007             :         case XML_darken:
    1008           0 :             aNewSegment.Command = EnhancedCustomShapeSegmentCommand::DARKEN;
    1009           0 :             break;
    1010             :         case XML_darkenLess:
    1011           0 :             aNewSegment.Command = EnhancedCustomShapeSegmentCommand::DARKENLESS;
    1012           0 :             break;
    1013             :         case XML_lighten:
    1014           0 :             aNewSegment.Command = EnhancedCustomShapeSegmentCommand::LIGHTEN;
    1015           0 :             break;
    1016             :         case XML_lightenLess:
    1017           0 :             aNewSegment.Command = EnhancedCustomShapeSegmentCommand::LIGHTENLESS;
    1018           0 :             break;
    1019             :     }
    1020           0 :     if (mrPath2D.fill != XML_norm) {
    1021           0 :         aNewSegment.Count = 0;
    1022           0 :         mrSegments.push_back( aNewSegment );
    1023             :     }
    1024           0 :     if ( !mrPath2D.stroke )
    1025             :     {
    1026           0 :         aNewSegment.Command = EnhancedCustomShapeSegmentCommand::NOSTROKE;
    1027           0 :         aNewSegment.Count = 0;
    1028           0 :         mrSegments.push_back( aNewSegment );
    1029             :     }
    1030           0 :     aNewSegment.Command = EnhancedCustomShapeSegmentCommand::ENDSUBPATH;
    1031           0 :     aNewSegment.Count = 0;
    1032           0 :     mrSegments.push_back( aNewSegment );
    1033           0 : }
    1034             : 
    1035           0 : Reference< XFastContextHandler > Path2DContext::createFastChildContext( sal_Int32 aElementToken,
    1036             :     const Reference< XFastAttributeList >& xAttribs ) throw ( SAXException, RuntimeException )
    1037             : {
    1038           0 :     Reference< XFastContextHandler > xContext;
    1039           0 :     switch( aElementToken )
    1040             :     {
    1041             :         case A_TOKEN( close ) :
    1042             :         {
    1043             :             // ignore close after move to (ppt does seems to do the same, see accentCallout2 preset for example)
    1044           0 :             if ( mrSegments.empty() || ( mrSegments.back().Command != EnhancedCustomShapeSegmentCommand::MOVETO ) ) {
    1045           0 :                 EnhancedCustomShapeSegment aNewSegment;
    1046           0 :                 aNewSegment.Command = EnhancedCustomShapeSegmentCommand::CLOSESUBPATH;
    1047           0 :                 aNewSegment.Count = 0;
    1048           0 :                 mrSegments.push_back( aNewSegment );
    1049             :             }
    1050             :         }
    1051           0 :         break;
    1052             :         case A_TOKEN( moveTo ) :
    1053             :         {
    1054           0 :             EnhancedCustomShapeSegment aNewSegment;
    1055           0 :             aNewSegment.Command = EnhancedCustomShapeSegmentCommand::MOVETO;
    1056           0 :             aNewSegment.Count = 1;
    1057           0 :             mrSegments.push_back( aNewSegment );
    1058             : 
    1059           0 :             EnhancedCustomShapeParameterPair aAdjPoint2D;
    1060           0 :             mrPath2D.parameter.push_back( aAdjPoint2D );
    1061           0 :             xContext = new Path2DMoveToContext( *this, mrCustomShapeProperties, mrPath2D.parameter.back() );
    1062             :         }
    1063           0 :         break;
    1064             :         case A_TOKEN( lnTo ) :
    1065             :         {
    1066             : 
    1067           0 :             if ( !mrSegments.empty() && ( mrSegments.back().Command == EnhancedCustomShapeSegmentCommand::LINETO ) )
    1068           0 :                 mrSegments.back().Count++;
    1069             :             else
    1070             :             {
    1071           0 :                 EnhancedCustomShapeSegment aSegment;
    1072           0 :                 aSegment.Command = EnhancedCustomShapeSegmentCommand::LINETO;
    1073           0 :                 aSegment.Count = 1;
    1074           0 :                 mrSegments.push_back( aSegment );
    1075             :             }
    1076           0 :             EnhancedCustomShapeParameterPair aAdjPoint2D;
    1077           0 :             mrPath2D.parameter.push_back( aAdjPoint2D );
    1078           0 :             xContext = new Path2DLineToContext( *this, mrCustomShapeProperties, mrPath2D.parameter.back() );
    1079             :         }
    1080           0 :         break;
    1081             :         case A_TOKEN( arcTo ) : // CT_Path2DArcTo
    1082             :         {
    1083           0 :             if ( !mrSegments.empty() && ( mrSegments.back().Command == EnhancedCustomShapeSegmentCommand::ARCANGLETO ) )
    1084           0 :                 mrSegments.back().Count++;
    1085             :             else
    1086             :             {
    1087           0 :                 EnhancedCustomShapeSegment aSegment;
    1088           0 :                 aSegment.Command = EnhancedCustomShapeSegmentCommand::ARCANGLETO;
    1089           0 :                 aSegment.Count = 1;
    1090           0 :                 mrSegments.push_back( aSegment );
    1091             :             }
    1092             : 
    1093           0 :             EnhancedCustomShapeParameterPair aScale;
    1094           0 :             EnhancedCustomShapeParameterPair aAngles;
    1095             : 
    1096           0 :             aScale.First = GetAdjCoordinate( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_wR ), sal_True );
    1097           0 :             aScale.Second = GetAdjCoordinate( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_hR ), sal_True );
    1098             : 
    1099           0 :             CustomShapeGuide aGuide;
    1100           0 :             sal_Int32 nArcNum = mrCustomShapeProperties.getArcNum();
    1101             : 
    1102             :             // start angle
    1103           0 :             aGuide.maName = CREATE_OUSTRING("arctosa") + OUString::valueOf( nArcNum );
    1104             :             aGuide.maFormula = CREATE_OUSTRING( "(")
    1105           0 :                 + GetFormulaParameter( GetAdjCoordinate( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_stAng ) ) )
    1106           0 :                 + CREATE_OUSTRING( ")/60000.0" );
    1107           0 :             aAngles.First.Value = Any( CustomShapeProperties::SetCustomShapeGuideValue( mrCustomShapeProperties.getGuideList(), aGuide ) );
    1108           0 :             aAngles.First.Type = EnhancedCustomShapeParameterType::EQUATION;
    1109             : 
    1110             :             // swing angle
    1111           0 :             aGuide.maName = CREATE_OUSTRING("arctosw") + OUString::valueOf( nArcNum );
    1112             :             aGuide.maFormula = CREATE_OUSTRING( "(")
    1113           0 :                 + GetFormulaParameter( GetAdjCoordinate( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_swAng ) ) )
    1114           0 :                 + CREATE_OUSTRING( ")/60000.0" );
    1115           0 :             aAngles.Second.Value = Any( CustomShapeProperties::SetCustomShapeGuideValue( mrCustomShapeProperties.getGuideList(), aGuide ) );
    1116           0 :             aAngles.Second.Type = EnhancedCustomShapeParameterType::EQUATION;
    1117             : 
    1118           0 :             mrPath2D.parameter.push_back( aScale );
    1119           0 :             mrPath2D.parameter.push_back( aAngles );
    1120             :         }
    1121           0 :         break;
    1122             :         case A_TOKEN( quadBezTo ) :
    1123             :         {
    1124           0 :             if ( !mrSegments.empty() && ( mrSegments.back().Command == EnhancedCustomShapeSegmentCommand::QUADRATICCURVETO ) )
    1125           0 :                 mrSegments.back().Count++;
    1126             :             else
    1127             :             {
    1128           0 :                 EnhancedCustomShapeSegment aSegment;
    1129           0 :                 aSegment.Command = EnhancedCustomShapeSegmentCommand::QUADRATICCURVETO;
    1130           0 :                 aSegment.Count = 1;
    1131           0 :                 mrSegments.push_back( aSegment );
    1132             :             }
    1133           0 :             EnhancedCustomShapeParameterPair aPt1;
    1134           0 :             EnhancedCustomShapeParameterPair aPt2;
    1135           0 :             mrPath2D.parameter.push_back( aPt1 );
    1136           0 :             mrPath2D.parameter.push_back( aPt2 );
    1137             :             xContext = new Path2DQuadBezierToContext( *this, mrCustomShapeProperties,
    1138           0 :                             mrPath2D.parameter[ mrPath2D.parameter.size() - 2 ],
    1139           0 :                                 mrPath2D.parameter.back() );
    1140             :         }
    1141           0 :         break;
    1142             :         case A_TOKEN( cubicBezTo ) :
    1143             :         {
    1144           0 :             if ( !mrSegments.empty() && ( mrSegments.back().Command == EnhancedCustomShapeSegmentCommand::CURVETO ) )
    1145           0 :                 mrSegments.back().Count++;
    1146             :             else
    1147             :             {
    1148           0 :                 EnhancedCustomShapeSegment aSegment;
    1149           0 :                 aSegment.Command = EnhancedCustomShapeSegmentCommand::CURVETO;
    1150           0 :                 aSegment.Count = 1;
    1151           0 :                 mrSegments.push_back( aSegment );
    1152             :             }
    1153           0 :             EnhancedCustomShapeParameterPair aControlPt1;
    1154           0 :             EnhancedCustomShapeParameterPair aControlPt2;
    1155           0 :             EnhancedCustomShapeParameterPair aEndPt;
    1156           0 :             mrPath2D.parameter.push_back( aControlPt1 );
    1157           0 :             mrPath2D.parameter.push_back( aControlPt2 );
    1158           0 :             mrPath2D.parameter.push_back( aEndPt );
    1159             :             xContext = new Path2DCubicBezierToContext( *this, mrCustomShapeProperties,
    1160           0 :                             mrPath2D.parameter[ mrPath2D.parameter.size() - 3 ],
    1161           0 :                                 mrPath2D.parameter[ mrPath2D.parameter.size() - 2 ],
    1162           0 :                                     mrPath2D.parameter.back() );
    1163             :         }
    1164           0 :         break;
    1165             :     }
    1166           0 :     return xContext;
    1167             : }
    1168             : 
    1169             : // ---------------------------------------------------------------------
    1170             : // CT_Path2DList
    1171           4 : class Path2DListContext : public ContextHandler
    1172             : {
    1173             : public:
    1174             :     Path2DListContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< EnhancedCustomShapeSegment >& rSegments,
    1175             :         std::vector< Path2D >& rPath2DList );
    1176             : 
    1177             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
    1178             : 
    1179             : protected:
    1180             : 
    1181             :     CustomShapeProperties& mrCustomShapeProperties;
    1182             :     std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >& mrSegments;
    1183             :     std::vector< Path2D >& mrPath2DList;
    1184             : };
    1185             : 
    1186           2 : Path2DListContext::Path2DListContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< EnhancedCustomShapeSegment >& rSegments,
    1187             :                                         std::vector< Path2D >& rPath2DList )
    1188             : : ContextHandler( rParent )
    1189             : , mrCustomShapeProperties( rCustomShapeProperties )
    1190             : , mrSegments( rSegments )
    1191           2 : , mrPath2DList( rPath2DList )
    1192             : {
    1193           2 : }
    1194             : 
    1195           0 : ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL Path2DListContext::createFastChildContext( sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException)
    1196             : {
    1197           0 :     Reference< XFastContextHandler > xContext;
    1198           0 :     if ( aElementToken == A_TOKEN( path ) )
    1199             :     {
    1200           0 :         Path2D aPath2D;
    1201           0 :         mrPath2DList.push_back( aPath2D );
    1202           0 :         xContext = new Path2DContext( *this, xAttribs, mrCustomShapeProperties,  mrSegments, mrPath2DList.back() );
    1203             :     }
    1204           0 :     return xContext;
    1205             : }
    1206             : 
    1207             : // ---------------------------------------------------------------------
    1208             : // CT_CustomGeometry2D
    1209           2 : CustomShapeGeometryContext::CustomShapeGeometryContext( ContextHandler& rParent, const Reference< XFastAttributeList >& /* xAttribs */, CustomShapeProperties& rCustomShapeProperties )
    1210             : : ContextHandler( rParent )
    1211           2 : , mrCustomShapeProperties( rCustomShapeProperties )
    1212             : {
    1213           2 : }
    1214             : 
    1215          12 : Reference< XFastContextHandler > CustomShapeGeometryContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
    1216             : {
    1217          12 :     Reference< XFastContextHandler > xContext;
    1218          12 :     switch( aElementToken )
    1219             :     {
    1220             :         case A_TOKEN( avLst ):          // CT_GeomGuideList adjust value list
    1221           2 :             xContext = new GeomGuideListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getAdjustmentGuideList() );
    1222           2 :         break;
    1223             :         case A_TOKEN( gdLst ):          // CT_GeomGuideList guide list
    1224           2 :             xContext = new GeomGuideListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getGuideList() );
    1225           2 :         break;
    1226             :         case A_TOKEN( ahLst ):          // CT_AdjustHandleList adjust handle list
    1227           2 :             xContext = new AdjustHandleListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getAdjustHandleList() );
    1228           2 :         break;
    1229             :         case A_TOKEN( cxnLst ):         // CT_ConnectionSiteList connection site list
    1230           2 :             xContext = this;
    1231           2 :         break;
    1232             :         case A_TOKEN( rect ):           // CT_GeomRectList geometry rect list
    1233             :         {
    1234           2 :             GeomRect aGeomRect;
    1235           2 :             aGeomRect.l = GetAdjCoordinate( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_l ), sal_True );
    1236           2 :             aGeomRect.t = GetAdjCoordinate( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_t ), sal_True );
    1237           2 :             aGeomRect.r = GetAdjCoordinate( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_r ), sal_True );
    1238           2 :             aGeomRect.b = GetAdjCoordinate( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_b ), sal_True );
    1239           2 :             mrCustomShapeProperties.getTextRect() = aGeomRect;
    1240             :         }
    1241           2 :         break;
    1242             :         case A_TOKEN( pathLst ):        // CT_Path2DList 2d path list
    1243           2 :             xContext = new Path2DListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getSegments(), mrCustomShapeProperties.getPath2DList() );
    1244           2 :         break;
    1245             : 
    1246             :         // from cxnLst:
    1247             :         case A_TOKEN( cxn ):                // CT_ConnectionSite
    1248             :         {
    1249           0 :             ConnectionSite aConnectionSite;
    1250           0 :             mrCustomShapeProperties.getConnectionSiteList().push_back( aConnectionSite );
    1251           0 :             xContext = new ConnectionSiteContext( *this, xAttribs, mrCustomShapeProperties, mrCustomShapeProperties.getConnectionSiteList().back() );
    1252             :         }
    1253           0 :         break;
    1254             :     }
    1255          12 :     return xContext;
    1256             : }
    1257             : 
    1258             : // ---------------------------------------------------------------------
    1259             : // CT_PresetGeometry2D
    1260          50 : PresetShapeGeometryContext::PresetShapeGeometryContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties )
    1261             : : ContextHandler( rParent )
    1262          50 : , mrCustomShapeProperties( rCustomShapeProperties )
    1263             : {
    1264          50 :     sal_Int32 nShapeType = xAttribs->getOptionalValueToken( XML_prst, FastToken::DONTKNOW );
    1265             :     OSL_ENSURE( nShapeType != FastToken::DONTKNOW, "oox::drawingml::CustomShapeCustomGeometryContext::CustomShapeCustomGeometryContext(), unknown shape type" );
    1266          50 :     mrCustomShapeProperties.setShapePresetType( nShapeType );
    1267          50 : }
    1268             : 
    1269          50 : Reference< XFastContextHandler > PresetShapeGeometryContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& ) throw (SAXException, RuntimeException)
    1270             : {
    1271          50 :     if ( aElementToken == A_TOKEN( avLst ) )
    1272          50 :         return new GeomGuideListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getAdjustmentGuideList() );
    1273             :     else
    1274           0 :         return this;
    1275             : }
    1276             : 
    1277             : // ---------------------------------------------------------------------
    1278             : // CT_PresetTextShape
    1279           0 : PresetTextShapeContext::PresetTextShapeContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties )
    1280             : : ContextHandler( rParent )
    1281           0 : , mrCustomShapeProperties( rCustomShapeProperties )
    1282             : {
    1283           0 :     sal_Int32 nShapeType = xAttribs->getOptionalValueToken( XML_prst, FastToken::DONTKNOW );
    1284             :     OSL_ENSURE( nShapeType != FastToken::DONTKNOW, "oox::drawingml::CustomShapeCustomGeometryContext::CustomShapeCustomGeometryContext(), unknown shape type" );
    1285           0 :     mrCustomShapeProperties.setShapePresetType( nShapeType );
    1286           0 : }
    1287             : 
    1288           0 : Reference< XFastContextHandler > PresetTextShapeContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& ) throw (SAXException, RuntimeException)
    1289             : {
    1290           0 :     if ( aElementToken == A_TOKEN( avLst ) )
    1291           0 :         return new GeomGuideListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getAdjustmentGuideList() );
    1292             :     else
    1293           0 :         return this;
    1294             : }
    1295             : 
    1296          51 : } }
    1297             : 
    1298             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10