1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_xmloff.hxx" 30*cdf0e10cSrcweir #include "ximpcustomshape.hxx" 31*cdf0e10cSrcweir #include "ximpshap.hxx" 32*cdf0e10cSrcweir #include "xmlehelp.hxx" 33*cdf0e10cSrcweir #include <rtl/math.hxx> 34*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx> 35*cdf0e10cSrcweir #include <rtl/ustring.hxx> 36*cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h> 37*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/xml/sax/XAttributeList.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/container/XIndexContainer.hpp> 40*cdf0e10cSrcweir #include <xmloff/xmltoken.hxx> 41*cdf0e10cSrcweir #include "EnhancedCustomShapeToken.hxx" 42*cdf0e10cSrcweir #include <xmloff/xmlimp.hxx> 43*cdf0e10cSrcweir #include <xmloff/xmltkmap.hxx> 44*cdf0e10cSrcweir #include "xmloff/xmlnmspe.hxx" 45*cdf0e10cSrcweir #include <xmloff/nmspmap.hxx> 46*cdf0e10cSrcweir #include <xmloff/xmluconv.hxx> 47*cdf0e10cSrcweir #include "xexptran.hxx" 48*cdf0e10cSrcweir #include "xmloff/xmlerror.hxx" 49*cdf0e10cSrcweir #include <tools/debug.hxx> 50*cdf0e10cSrcweir #include <com/sun/star/drawing/Direction3D.hpp> 51*cdf0e10cSrcweir #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> 52*cdf0e10cSrcweir #include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp> 53*cdf0e10cSrcweir #include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp> 54*cdf0e10cSrcweir #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp> 55*cdf0e10cSrcweir #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp> 56*cdf0e10cSrcweir #include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp> 57*cdf0e10cSrcweir #include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp> 58*cdf0e10cSrcweir #include <com/sun/star/drawing/ProjectionMode.hpp> 59*cdf0e10cSrcweir #include <hash_map> 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir using namespace ::com::sun::star; 62*cdf0e10cSrcweir using namespace ::xmloff::token; 63*cdf0e10cSrcweir using namespace ::xmloff::EnhancedCustomShapeToken; 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir TYPEINIT1( XMLEnhancedCustomShapeContext, SvXMLImportContext ); 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir XMLEnhancedCustomShapeContext::XMLEnhancedCustomShapeContext( SvXMLImport& rImport, 68*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape, 69*cdf0e10cSrcweir sal_uInt16 nPrefix, const rtl::OUString& rLocalName, 70*cdf0e10cSrcweir std::vector< com::sun::star::beans::PropertyValue >& rCustomShapeGeometry ) : 71*cdf0e10cSrcweir SvXMLImportContext( rImport, nPrefix, rLocalName ), 72*cdf0e10cSrcweir mrUnitConverter( rImport.GetMM100UnitConverter() ), 73*cdf0e10cSrcweir mrxShape( rxShape ), 74*cdf0e10cSrcweir mrCustomShapeGeometry( rCustomShapeGeometry ) 75*cdf0e10cSrcweir { 76*cdf0e10cSrcweir } 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir const SvXMLEnumMapEntry aXML_GluePointEnumMap[] = 79*cdf0e10cSrcweir { 80*cdf0e10cSrcweir { XML_NONE, 0 }, 81*cdf0e10cSrcweir { XML_SEGMENTS, 1 }, 82*cdf0e10cSrcweir { XML_NONE, 2 }, 83*cdf0e10cSrcweir { XML_RECTANGLE, 3 }, 84*cdf0e10cSrcweir { XML_TOKEN_INVALID, 0 } 85*cdf0e10cSrcweir }; 86*cdf0e10cSrcweir void GetBool( std::vector< com::sun::star::beans::PropertyValue >& rDest, 87*cdf0e10cSrcweir const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp ) 88*cdf0e10cSrcweir { 89*cdf0e10cSrcweir sal_Bool bAttrBool; 90*cdf0e10cSrcweir if ( SvXMLUnitConverter::convertBool( bAttrBool, rValue ) ) 91*cdf0e10cSrcweir { 92*cdf0e10cSrcweir beans::PropertyValue aProp; 93*cdf0e10cSrcweir aProp.Name = EASGet( eDestProp ); 94*cdf0e10cSrcweir aProp.Value <<= bAttrBool; 95*cdf0e10cSrcweir rDest.push_back( aProp ); 96*cdf0e10cSrcweir } 97*cdf0e10cSrcweir } 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir void GetInt32( std::vector< com::sun::star::beans::PropertyValue >& rDest, 100*cdf0e10cSrcweir const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp ) 101*cdf0e10cSrcweir { 102*cdf0e10cSrcweir sal_Int32 nAttrNumber; 103*cdf0e10cSrcweir if ( SvXMLUnitConverter::convertNumber( nAttrNumber, rValue ) ) 104*cdf0e10cSrcweir { 105*cdf0e10cSrcweir beans::PropertyValue aProp; 106*cdf0e10cSrcweir aProp.Name = EASGet( eDestProp ); 107*cdf0e10cSrcweir aProp.Value <<= nAttrNumber; 108*cdf0e10cSrcweir rDest.push_back( aProp ); 109*cdf0e10cSrcweir } 110*cdf0e10cSrcweir } 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir void GetDouble( std::vector< com::sun::star::beans::PropertyValue >& rDest, 113*cdf0e10cSrcweir const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp ) 114*cdf0e10cSrcweir { 115*cdf0e10cSrcweir double fAttrDouble; 116*cdf0e10cSrcweir if ( SvXMLUnitConverter::convertDouble( fAttrDouble, rValue ) ) 117*cdf0e10cSrcweir { 118*cdf0e10cSrcweir beans::PropertyValue aProp; 119*cdf0e10cSrcweir aProp.Name = EASGet( eDestProp ); 120*cdf0e10cSrcweir aProp.Value <<= fAttrDouble; 121*cdf0e10cSrcweir rDest.push_back( aProp ); 122*cdf0e10cSrcweir } 123*cdf0e10cSrcweir } 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir void GetDistance( std::vector< com::sun::star::beans::PropertyValue >& rDest, 126*cdf0e10cSrcweir const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp ) 127*cdf0e10cSrcweir { 128*cdf0e10cSrcweir double fAttrDouble; 129*cdf0e10cSrcweir MapUnit eSrcUnit( SvXMLExportHelper::GetUnitFromString( rValue, MAP_100TH_MM ) ); 130*cdf0e10cSrcweir if ( SvXMLUnitConverter::convertDouble( fAttrDouble, rValue, eSrcUnit, MAP_100TH_MM ) ) 131*cdf0e10cSrcweir { 132*cdf0e10cSrcweir beans::PropertyValue aProp; 133*cdf0e10cSrcweir aProp.Name = EASGet( eDestProp ); 134*cdf0e10cSrcweir aProp.Value <<= fAttrDouble; 135*cdf0e10cSrcweir rDest.push_back( aProp ); 136*cdf0e10cSrcweir } 137*cdf0e10cSrcweir } 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir void GetString( std::vector< com::sun::star::beans::PropertyValue >& rDest, 140*cdf0e10cSrcweir const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp ) 141*cdf0e10cSrcweir { 142*cdf0e10cSrcweir beans::PropertyValue aProp; 143*cdf0e10cSrcweir aProp.Name = EASGet( eDestProp ); 144*cdf0e10cSrcweir aProp.Value <<= rValue; 145*cdf0e10cSrcweir rDest.push_back( aProp ); 146*cdf0e10cSrcweir } 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir void GetEnum( std::vector< com::sun::star::beans::PropertyValue >& rDest, 149*cdf0e10cSrcweir const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp, 150*cdf0e10cSrcweir const SvXMLEnumMapEntry& rMap ) 151*cdf0e10cSrcweir { 152*cdf0e10cSrcweir sal_uInt16 eKind; 153*cdf0e10cSrcweir if( SvXMLUnitConverter::convertEnum( eKind, rValue, &rMap ) ) 154*cdf0e10cSrcweir { 155*cdf0e10cSrcweir sal_Int16 nEnum = (sal_Int16)eKind; 156*cdf0e10cSrcweir beans::PropertyValue aProp; 157*cdf0e10cSrcweir aProp.Name = EASGet( eDestProp ); 158*cdf0e10cSrcweir aProp.Value <<= nEnum; 159*cdf0e10cSrcweir rDest.push_back( aProp ); 160*cdf0e10cSrcweir } 161*cdf0e10cSrcweir } 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir void GetDoublePercentage( std::vector< com::sun::star::beans::PropertyValue >& rDest, 164*cdf0e10cSrcweir const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp ) 165*cdf0e10cSrcweir { 166*cdf0e10cSrcweir MapUnit eSrcUnit = SvXMLExportHelper::GetUnitFromString( rValue, MAP_100TH_MM ); 167*cdf0e10cSrcweir if ( eSrcUnit == MAP_RELATIVE ) 168*cdf0e10cSrcweir { 169*cdf0e10cSrcweir rtl_math_ConversionStatus eStatus; 170*cdf0e10cSrcweir double fAttrDouble = ::rtl::math::stringToDouble( rValue, 171*cdf0e10cSrcweir (sal_Unicode)('.'), (sal_Unicode)(','), &eStatus, NULL ); 172*cdf0e10cSrcweir if ( eStatus == rtl_math_ConversionStatus_Ok ) 173*cdf0e10cSrcweir { 174*cdf0e10cSrcweir beans::PropertyValue aProp; 175*cdf0e10cSrcweir aProp.Name = EASGet( eDestProp ); 176*cdf0e10cSrcweir aProp.Value <<= fAttrDouble; 177*cdf0e10cSrcweir rDest.push_back( aProp ); 178*cdf0e10cSrcweir } 179*cdf0e10cSrcweir } 180*cdf0e10cSrcweir } 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir void GetB3DVector( std::vector< com::sun::star::beans::PropertyValue >& rDest, 183*cdf0e10cSrcweir const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp ) 184*cdf0e10cSrcweir { 185*cdf0e10cSrcweir ::basegfx::B3DVector aB3DVector; 186*cdf0e10cSrcweir if ( SvXMLUnitConverter::convertB3DVector( aB3DVector, rValue ) ) 187*cdf0e10cSrcweir { 188*cdf0e10cSrcweir drawing::Direction3D aDirection3D( aB3DVector.getX(), aB3DVector.getY(), aB3DVector.getZ() ); 189*cdf0e10cSrcweir beans::PropertyValue aProp; 190*cdf0e10cSrcweir aProp.Name = EASGet( eDestProp ); 191*cdf0e10cSrcweir aProp.Value <<= aDirection3D; 192*cdf0e10cSrcweir rDest.push_back( aProp ); 193*cdf0e10cSrcweir } 194*cdf0e10cSrcweir } 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir sal_Bool GetEquationName( const rtl::OUString& rEquation, const sal_Int32 nStart, rtl::OUString& rEquationName ) 197*cdf0e10cSrcweir { 198*cdf0e10cSrcweir sal_Int32 nIndex = nStart; 199*cdf0e10cSrcweir while( nIndex < rEquation.getLength() ) 200*cdf0e10cSrcweir { 201*cdf0e10cSrcweir sal_Unicode nChar = rEquation[ nIndex ]; 202*cdf0e10cSrcweir if ( 203*cdf0e10cSrcweir ( ( nChar >= 'a' ) && ( nChar <= 'z' ) ) 204*cdf0e10cSrcweir || ( ( nChar >= 'A' ) && ( nChar <= 'Z' ) ) 205*cdf0e10cSrcweir || ( ( nChar >= '0' ) && ( nChar <= '9' ) ) 206*cdf0e10cSrcweir ) 207*cdf0e10cSrcweir { 208*cdf0e10cSrcweir nIndex++; 209*cdf0e10cSrcweir } 210*cdf0e10cSrcweir else 211*cdf0e10cSrcweir break; 212*cdf0e10cSrcweir } 213*cdf0e10cSrcweir sal_Bool bValid = ( nIndex - nStart ) != 0; 214*cdf0e10cSrcweir if ( bValid ) 215*cdf0e10cSrcweir rEquationName = rEquation.copy( nStart, nIndex - nStart ); 216*cdf0e10cSrcweir return bValid; 217*cdf0e10cSrcweir } 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir sal_Bool GetNextParameter( com::sun::star::drawing::EnhancedCustomShapeParameter& rParameter, sal_Int32& nIndex, const rtl::OUString& rParaString ) 220*cdf0e10cSrcweir { 221*cdf0e10cSrcweir if ( nIndex >= rParaString.getLength() ) 222*cdf0e10cSrcweir return sal_False; 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir sal_Bool bValid = sal_True; 225*cdf0e10cSrcweir sal_Bool bNumberRequired = sal_True; 226*cdf0e10cSrcweir sal_Bool bMustBePositiveWholeNumbered = sal_False; 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::NORMAL; 229*cdf0e10cSrcweir if ( rParaString[ nIndex ] == (sal_Unicode)'$' ) 230*cdf0e10cSrcweir { 231*cdf0e10cSrcweir rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::ADJUSTMENT; 232*cdf0e10cSrcweir bMustBePositiveWholeNumbered = sal_True; 233*cdf0e10cSrcweir nIndex++; 234*cdf0e10cSrcweir } 235*cdf0e10cSrcweir else if ( rParaString[ nIndex ] == (sal_Unicode)'?' ) 236*cdf0e10cSrcweir { 237*cdf0e10cSrcweir nIndex++; 238*cdf0e10cSrcweir bNumberRequired = sal_False; 239*cdf0e10cSrcweir rtl::OUString aEquationName; 240*cdf0e10cSrcweir bValid = GetEquationName( rParaString, nIndex, aEquationName ); 241*cdf0e10cSrcweir if ( bValid ) 242*cdf0e10cSrcweir { 243*cdf0e10cSrcweir rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::EQUATION; 244*cdf0e10cSrcweir rParameter.Value <<= aEquationName; 245*cdf0e10cSrcweir nIndex += aEquationName.getLength(); 246*cdf0e10cSrcweir } 247*cdf0e10cSrcweir } 248*cdf0e10cSrcweir else if ( rParaString[ nIndex ] > (sal_Unicode)'9' ) 249*cdf0e10cSrcweir { 250*cdf0e10cSrcweir bNumberRequired = sal_False; 251*cdf0e10cSrcweir if ( rParaString.matchIgnoreAsciiCaseAsciiL( "left", 4, nIndex ) ) 252*cdf0e10cSrcweir { 253*cdf0e10cSrcweir rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::LEFT; 254*cdf0e10cSrcweir nIndex += 4; 255*cdf0e10cSrcweir } 256*cdf0e10cSrcweir else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "top", 3, nIndex ) ) 257*cdf0e10cSrcweir { 258*cdf0e10cSrcweir rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::TOP; 259*cdf0e10cSrcweir nIndex += 3; 260*cdf0e10cSrcweir } 261*cdf0e10cSrcweir else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "right", 5, nIndex ) ) 262*cdf0e10cSrcweir { 263*cdf0e10cSrcweir rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::RIGHT; 264*cdf0e10cSrcweir nIndex += 5; 265*cdf0e10cSrcweir } 266*cdf0e10cSrcweir else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "bottom", 6, nIndex ) ) 267*cdf0e10cSrcweir { 268*cdf0e10cSrcweir rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::BOTTOM; 269*cdf0e10cSrcweir nIndex += 6; 270*cdf0e10cSrcweir } 271*cdf0e10cSrcweir else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "xstretch", 8, nIndex ) ) 272*cdf0e10cSrcweir { 273*cdf0e10cSrcweir rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::XSTRETCH; 274*cdf0e10cSrcweir nIndex += 8; 275*cdf0e10cSrcweir } 276*cdf0e10cSrcweir else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "ystretch", 8, nIndex ) ) 277*cdf0e10cSrcweir { 278*cdf0e10cSrcweir rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::YSTRETCH; 279*cdf0e10cSrcweir nIndex += 8; 280*cdf0e10cSrcweir } 281*cdf0e10cSrcweir else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "hasstroke", 9, nIndex ) ) 282*cdf0e10cSrcweir { 283*cdf0e10cSrcweir rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::HASSTROKE; 284*cdf0e10cSrcweir nIndex += 9; 285*cdf0e10cSrcweir } 286*cdf0e10cSrcweir else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "hasfill", 7, nIndex ) ) 287*cdf0e10cSrcweir { 288*cdf0e10cSrcweir rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::HASFILL; 289*cdf0e10cSrcweir nIndex += 7; 290*cdf0e10cSrcweir } 291*cdf0e10cSrcweir else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "width", 5, nIndex ) ) 292*cdf0e10cSrcweir { 293*cdf0e10cSrcweir rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::WIDTH; 294*cdf0e10cSrcweir nIndex += 5; 295*cdf0e10cSrcweir } 296*cdf0e10cSrcweir else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "height", 6, nIndex ) ) 297*cdf0e10cSrcweir { 298*cdf0e10cSrcweir rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::HEIGHT; 299*cdf0e10cSrcweir nIndex += 6; 300*cdf0e10cSrcweir } 301*cdf0e10cSrcweir else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "logwidth", 8, nIndex ) ) 302*cdf0e10cSrcweir { 303*cdf0e10cSrcweir rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::LOGWIDTH; 304*cdf0e10cSrcweir nIndex += 8; 305*cdf0e10cSrcweir } 306*cdf0e10cSrcweir else if ( rParaString.matchIgnoreAsciiCaseAsciiL( "logheight", 9, nIndex ) ) 307*cdf0e10cSrcweir { 308*cdf0e10cSrcweir rParameter.Type = com::sun::star::drawing::EnhancedCustomShapeParameterType::LOGHEIGHT; 309*cdf0e10cSrcweir nIndex += 9; 310*cdf0e10cSrcweir } 311*cdf0e10cSrcweir else 312*cdf0e10cSrcweir bValid = sal_False; 313*cdf0e10cSrcweir } 314*cdf0e10cSrcweir if ( bValid ) 315*cdf0e10cSrcweir { 316*cdf0e10cSrcweir if ( bNumberRequired ) 317*cdf0e10cSrcweir { 318*cdf0e10cSrcweir sal_Int32 nStartIndex = nIndex; 319*cdf0e10cSrcweir 320*cdf0e10cSrcweir sal_Bool bM = sal_False; // set if the value is negative 321*cdf0e10cSrcweir sal_Bool bE = sal_False; // set if a double is including a "E" statement 322*cdf0e10cSrcweir sal_Bool bEM = sal_False; // set if a double is including a "E-"statement 323*cdf0e10cSrcweir sal_Bool bDot = sal_False; // set if there is a dot included 324*cdf0e10cSrcweir sal_Bool bEnd = sal_False; // set for each value that can not be part of a double/integer 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir while( ( nIndex < rParaString.getLength() ) && bValid ) 327*cdf0e10cSrcweir { 328*cdf0e10cSrcweir switch( rParaString[ nIndex ] ) 329*cdf0e10cSrcweir { 330*cdf0e10cSrcweir case '.' : 331*cdf0e10cSrcweir { 332*cdf0e10cSrcweir if ( bMustBePositiveWholeNumbered ) 333*cdf0e10cSrcweir bValid = sal_False; 334*cdf0e10cSrcweir else 335*cdf0e10cSrcweir { 336*cdf0e10cSrcweir if ( bDot ) 337*cdf0e10cSrcweir bValid = sal_False; 338*cdf0e10cSrcweir else 339*cdf0e10cSrcweir bDot = sal_True; 340*cdf0e10cSrcweir } 341*cdf0e10cSrcweir } 342*cdf0e10cSrcweir break; 343*cdf0e10cSrcweir case '-' : 344*cdf0e10cSrcweir { 345*cdf0e10cSrcweir if ( bMustBePositiveWholeNumbered ) 346*cdf0e10cSrcweir bValid = sal_False; 347*cdf0e10cSrcweir else 348*cdf0e10cSrcweir { 349*cdf0e10cSrcweir if ( nStartIndex == nIndex ) 350*cdf0e10cSrcweir bM = sal_True; 351*cdf0e10cSrcweir else if ( bE ) 352*cdf0e10cSrcweir bEM = sal_True; 353*cdf0e10cSrcweir else 354*cdf0e10cSrcweir bValid = sal_False; 355*cdf0e10cSrcweir } 356*cdf0e10cSrcweir } 357*cdf0e10cSrcweir break; 358*cdf0e10cSrcweir 359*cdf0e10cSrcweir case 'e' : 360*cdf0e10cSrcweir case 'E' : 361*cdf0e10cSrcweir { 362*cdf0e10cSrcweir if ( bMustBePositiveWholeNumbered ) 363*cdf0e10cSrcweir bEnd = sal_True; 364*cdf0e10cSrcweir else 365*cdf0e10cSrcweir { 366*cdf0e10cSrcweir if ( !bE ) 367*cdf0e10cSrcweir bE = sal_True; 368*cdf0e10cSrcweir else 369*cdf0e10cSrcweir bEnd = sal_True; 370*cdf0e10cSrcweir } 371*cdf0e10cSrcweir } 372*cdf0e10cSrcweir break; 373*cdf0e10cSrcweir case '0' : 374*cdf0e10cSrcweir case '1' : 375*cdf0e10cSrcweir case '2' : 376*cdf0e10cSrcweir case '3' : 377*cdf0e10cSrcweir case '4' : 378*cdf0e10cSrcweir case '5' : 379*cdf0e10cSrcweir case '6' : 380*cdf0e10cSrcweir case '7' : 381*cdf0e10cSrcweir case '8' : 382*cdf0e10cSrcweir case '9' : 383*cdf0e10cSrcweir break; 384*cdf0e10cSrcweir default: 385*cdf0e10cSrcweir bEnd = sal_True; 386*cdf0e10cSrcweir } 387*cdf0e10cSrcweir if ( !bEnd ) 388*cdf0e10cSrcweir nIndex++; 389*cdf0e10cSrcweir else 390*cdf0e10cSrcweir break; 391*cdf0e10cSrcweir } 392*cdf0e10cSrcweir if ( nIndex == nStartIndex ) 393*cdf0e10cSrcweir bValid = sal_False; 394*cdf0e10cSrcweir if ( bValid ) 395*cdf0e10cSrcweir { 396*cdf0e10cSrcweir rtl::OUString aNumber( rParaString.copy( nStartIndex, nIndex - nStartIndex ) ); 397*cdf0e10cSrcweir if ( bE || bDot ) 398*cdf0e10cSrcweir { 399*cdf0e10cSrcweir double fAttrDouble; 400*cdf0e10cSrcweir if ( SvXMLUnitConverter::convertDouble( fAttrDouble, aNumber ) ) 401*cdf0e10cSrcweir rParameter.Value <<= fAttrDouble; 402*cdf0e10cSrcweir else 403*cdf0e10cSrcweir bValid = sal_False; 404*cdf0e10cSrcweir } 405*cdf0e10cSrcweir else 406*cdf0e10cSrcweir { 407*cdf0e10cSrcweir sal_Int32 nValue; 408*cdf0e10cSrcweir if ( SvXMLUnitConverter::convertNumber( nValue, aNumber ) ) 409*cdf0e10cSrcweir rParameter.Value <<= nValue; 410*cdf0e10cSrcweir else 411*cdf0e10cSrcweir bValid = sal_False; 412*cdf0e10cSrcweir } 413*cdf0e10cSrcweir } 414*cdf0e10cSrcweir } 415*cdf0e10cSrcweir } 416*cdf0e10cSrcweir if ( bValid ) 417*cdf0e10cSrcweir { // skipping white spaces 418*cdf0e10cSrcweir while( ( nIndex < rParaString.getLength() ) && rParaString[ nIndex ] == (sal_Unicode)' ' ) 419*cdf0e10cSrcweir nIndex++; 420*cdf0e10cSrcweir } 421*cdf0e10cSrcweir return bValid; 422*cdf0e10cSrcweir } 423*cdf0e10cSrcweir 424*cdf0e10cSrcweir void GetPosition3D( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:extrusion-viewpoint 425*cdf0e10cSrcweir const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp, 426*cdf0e10cSrcweir SvXMLUnitConverter& rUnitConverter ) 427*cdf0e10cSrcweir { 428*cdf0e10cSrcweir drawing::Position3D aPosition3D; 429*cdf0e10cSrcweir if ( rUnitConverter.convertPosition3D( aPosition3D, rValue ) ) 430*cdf0e10cSrcweir { 431*cdf0e10cSrcweir beans::PropertyValue aProp; 432*cdf0e10cSrcweir aProp.Name = EASGet( eDestProp ); 433*cdf0e10cSrcweir aProp.Value <<= aPosition3D; 434*cdf0e10cSrcweir rDest.push_back( aProp ); 435*cdf0e10cSrcweir } 436*cdf0e10cSrcweir } 437*cdf0e10cSrcweir 438*cdf0e10cSrcweir void GetDoubleSequence( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:glue-point-leaving-directions 439*cdf0e10cSrcweir const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp ) 440*cdf0e10cSrcweir { 441*cdf0e10cSrcweir std::vector< double > vDirection; 442*cdf0e10cSrcweir sal_Int32 nIndex = 0; 443*cdf0e10cSrcweir do 444*cdf0e10cSrcweir { 445*cdf0e10cSrcweir double fAttrDouble; 446*cdf0e10cSrcweir rtl::OUString aToken( rValue.getToken( 0, ',', nIndex ) ); 447*cdf0e10cSrcweir if ( !SvXMLUnitConverter::convertDouble( fAttrDouble, aToken ) ) 448*cdf0e10cSrcweir break; 449*cdf0e10cSrcweir else 450*cdf0e10cSrcweir vDirection.push_back( fAttrDouble ); 451*cdf0e10cSrcweir } 452*cdf0e10cSrcweir while ( nIndex >= 0 ); 453*cdf0e10cSrcweir 454*cdf0e10cSrcweir if ( !vDirection.empty() ) 455*cdf0e10cSrcweir { 456*cdf0e10cSrcweir uno::Sequence< double > aDirectionsSeq( vDirection.size() ); 457*cdf0e10cSrcweir std::vector< double >::const_iterator aIter = vDirection.begin(); 458*cdf0e10cSrcweir std::vector< double >::const_iterator aEnd = vDirection.end(); 459*cdf0e10cSrcweir double* pValues = aDirectionsSeq.getArray(); 460*cdf0e10cSrcweir 461*cdf0e10cSrcweir while ( aIter != aEnd ) 462*cdf0e10cSrcweir *pValues++ = *aIter++; 463*cdf0e10cSrcweir 464*cdf0e10cSrcweir beans::PropertyValue aProp; 465*cdf0e10cSrcweir aProp.Name = EASGet( eDestProp ); 466*cdf0e10cSrcweir aProp.Value <<= aDirectionsSeq; 467*cdf0e10cSrcweir rDest.push_back( aProp ); 468*cdf0e10cSrcweir } 469*cdf0e10cSrcweir } 470*cdf0e10cSrcweir 471*cdf0e10cSrcweir void GetEnhancedParameter( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:handle-position 472*cdf0e10cSrcweir const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp ) 473*cdf0e10cSrcweir { 474*cdf0e10cSrcweir sal_Int32 nIndex = 0; 475*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeParameter aParameter; 476*cdf0e10cSrcweir if ( GetNextParameter( aParameter, nIndex, rValue ) ) 477*cdf0e10cSrcweir { 478*cdf0e10cSrcweir beans::PropertyValue aProp; 479*cdf0e10cSrcweir aProp.Name = EASGet( eDestProp ); 480*cdf0e10cSrcweir aProp.Value <<= aParameter; 481*cdf0e10cSrcweir rDest.push_back( aProp ); 482*cdf0e10cSrcweir } 483*cdf0e10cSrcweir } 484*cdf0e10cSrcweir 485*cdf0e10cSrcweir void GetEnhancedParameterPair( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:handle-position 486*cdf0e10cSrcweir const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp ) 487*cdf0e10cSrcweir { 488*cdf0e10cSrcweir sal_Int32 nIndex = 0; 489*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeParameterPair aParameterPair; 490*cdf0e10cSrcweir if ( GetNextParameter( aParameterPair.First, nIndex, rValue ) 491*cdf0e10cSrcweir && GetNextParameter( aParameterPair.Second, nIndex, rValue ) ) 492*cdf0e10cSrcweir { 493*cdf0e10cSrcweir beans::PropertyValue aProp; 494*cdf0e10cSrcweir aProp.Name = EASGet( eDestProp ); 495*cdf0e10cSrcweir aProp.Value <<= aParameterPair; 496*cdf0e10cSrcweir rDest.push_back( aProp ); 497*cdf0e10cSrcweir } 498*cdf0e10cSrcweir } 499*cdf0e10cSrcweir 500*cdf0e10cSrcweir sal_Int32 GetEnhancedParameterPairSequence( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:glue-points 501*cdf0e10cSrcweir const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp ) 502*cdf0e10cSrcweir { 503*cdf0e10cSrcweir std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair > vParameter; 504*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeParameterPair aParameter; 505*cdf0e10cSrcweir 506*cdf0e10cSrcweir sal_Int32 nIndex = 0; 507*cdf0e10cSrcweir while ( GetNextParameter( aParameter.First, nIndex, rValue ) 508*cdf0e10cSrcweir && GetNextParameter( aParameter.Second, nIndex, rValue ) ) 509*cdf0e10cSrcweir { 510*cdf0e10cSrcweir vParameter.push_back( aParameter ); 511*cdf0e10cSrcweir } 512*cdf0e10cSrcweir if ( !vParameter.empty() ) 513*cdf0e10cSrcweir { 514*cdf0e10cSrcweir uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > aParameterSeq( vParameter.size() ); 515*cdf0e10cSrcweir std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair >::const_iterator aIter = vParameter.begin(); 516*cdf0e10cSrcweir std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair >::const_iterator aEnd = vParameter.end(); 517*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeParameterPair* pValues = aParameterSeq.getArray(); 518*cdf0e10cSrcweir 519*cdf0e10cSrcweir while ( aIter != aEnd ) 520*cdf0e10cSrcweir *pValues++ = *aIter++; 521*cdf0e10cSrcweir 522*cdf0e10cSrcweir beans::PropertyValue aProp; 523*cdf0e10cSrcweir aProp.Name = EASGet( eDestProp ); 524*cdf0e10cSrcweir aProp.Value <<= aParameterSeq; 525*cdf0e10cSrcweir rDest.push_back( aProp ); 526*cdf0e10cSrcweir } 527*cdf0e10cSrcweir return vParameter.size(); 528*cdf0e10cSrcweir } 529*cdf0e10cSrcweir 530*cdf0e10cSrcweir void GetEnhancedRectangleSequence( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:text-areas 531*cdf0e10cSrcweir const rtl::OUString& rValue, const EnhancedCustomShapeTokenEnum eDestProp ) 532*cdf0e10cSrcweir { 533*cdf0e10cSrcweir std::vector< com::sun::star::drawing::EnhancedCustomShapeTextFrame > vTextFrame; 534*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeTextFrame aParameter; 535*cdf0e10cSrcweir 536*cdf0e10cSrcweir sal_Int32 nIndex = 0; 537*cdf0e10cSrcweir 538*cdf0e10cSrcweir while ( GetNextParameter( aParameter.TopLeft.First, nIndex, rValue ) 539*cdf0e10cSrcweir && GetNextParameter( aParameter.TopLeft.Second, nIndex, rValue ) 540*cdf0e10cSrcweir && GetNextParameter( aParameter.BottomRight.First, nIndex, rValue ) 541*cdf0e10cSrcweir && GetNextParameter( aParameter.BottomRight.Second, nIndex, rValue ) ) 542*cdf0e10cSrcweir { 543*cdf0e10cSrcweir vTextFrame.push_back( aParameter ); 544*cdf0e10cSrcweir } 545*cdf0e10cSrcweir if ( !vTextFrame.empty() ) 546*cdf0e10cSrcweir { 547*cdf0e10cSrcweir uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame > aTextFrameSeq( vTextFrame.size() ); 548*cdf0e10cSrcweir std::vector< com::sun::star::drawing::EnhancedCustomShapeTextFrame >::const_iterator aIter = vTextFrame.begin(); 549*cdf0e10cSrcweir std::vector< com::sun::star::drawing::EnhancedCustomShapeTextFrame >::const_iterator aEnd = vTextFrame.end(); 550*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeTextFrame* pValues = aTextFrameSeq.getArray(); 551*cdf0e10cSrcweir 552*cdf0e10cSrcweir while ( aIter != aEnd ) 553*cdf0e10cSrcweir *pValues++ = *aIter++; 554*cdf0e10cSrcweir 555*cdf0e10cSrcweir beans::PropertyValue aProp; 556*cdf0e10cSrcweir aProp.Name = EASGet( eDestProp ); 557*cdf0e10cSrcweir aProp.Value <<= aTextFrameSeq; 558*cdf0e10cSrcweir rDest.push_back( aProp ); 559*cdf0e10cSrcweir } 560*cdf0e10cSrcweir } 561*cdf0e10cSrcweir 562*cdf0e10cSrcweir void GetEnhancedPath( std::vector< com::sun::star::beans::PropertyValue >& rDest, // e.g. draw:enhanced-path 563*cdf0e10cSrcweir const rtl::OUString& rValue ) 564*cdf0e10cSrcweir { 565*cdf0e10cSrcweir std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair > vCoordinates; 566*cdf0e10cSrcweir std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment > vSegments; 567*cdf0e10cSrcweir 568*cdf0e10cSrcweir sal_Int32 nIndex = 0; 569*cdf0e10cSrcweir sal_Int32 nParameterCount = 0; 570*cdf0e10cSrcweir 571*cdf0e10cSrcweir sal_Int32 nParametersNeeded = 1; 572*cdf0e10cSrcweir sal_Int16 nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::MOVETO; 573*cdf0e10cSrcweir 574*cdf0e10cSrcweir sal_Bool bValid = sal_True; 575*cdf0e10cSrcweir 576*cdf0e10cSrcweir while( bValid && ( nIndex < rValue.getLength() ) ) 577*cdf0e10cSrcweir { 578*cdf0e10cSrcweir switch( rValue[ nIndex ] ) 579*cdf0e10cSrcweir { 580*cdf0e10cSrcweir case 'M' : 581*cdf0e10cSrcweir { 582*cdf0e10cSrcweir nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::MOVETO; 583*cdf0e10cSrcweir nParametersNeeded = 1; 584*cdf0e10cSrcweir nIndex++; 585*cdf0e10cSrcweir } 586*cdf0e10cSrcweir break; 587*cdf0e10cSrcweir case 'L' : 588*cdf0e10cSrcweir { 589*cdf0e10cSrcweir nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::LINETO; 590*cdf0e10cSrcweir nParametersNeeded = 1; 591*cdf0e10cSrcweir nIndex++; 592*cdf0e10cSrcweir } 593*cdf0e10cSrcweir break; 594*cdf0e10cSrcweir case 'C' : 595*cdf0e10cSrcweir { 596*cdf0e10cSrcweir nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CURVETO; 597*cdf0e10cSrcweir nParametersNeeded = 3; 598*cdf0e10cSrcweir nIndex++; 599*cdf0e10cSrcweir } 600*cdf0e10cSrcweir break; 601*cdf0e10cSrcweir case 'Z' : 602*cdf0e10cSrcweir { 603*cdf0e10cSrcweir nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH; 604*cdf0e10cSrcweir nParametersNeeded = 0; 605*cdf0e10cSrcweir nIndex++; 606*cdf0e10cSrcweir } 607*cdf0e10cSrcweir break; 608*cdf0e10cSrcweir case 'N' : 609*cdf0e10cSrcweir { 610*cdf0e10cSrcweir nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH; 611*cdf0e10cSrcweir nParametersNeeded = 0; 612*cdf0e10cSrcweir nIndex++; 613*cdf0e10cSrcweir } 614*cdf0e10cSrcweir break; 615*cdf0e10cSrcweir case 'F' : 616*cdf0e10cSrcweir { 617*cdf0e10cSrcweir nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::NOFILL; 618*cdf0e10cSrcweir nParametersNeeded = 0; 619*cdf0e10cSrcweir nIndex++; 620*cdf0e10cSrcweir } 621*cdf0e10cSrcweir break; 622*cdf0e10cSrcweir case 'S' : 623*cdf0e10cSrcweir { 624*cdf0e10cSrcweir nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::NOSTROKE; 625*cdf0e10cSrcweir nParametersNeeded = 0; 626*cdf0e10cSrcweir nIndex++; 627*cdf0e10cSrcweir } 628*cdf0e10cSrcweir break; 629*cdf0e10cSrcweir case 'T' : 630*cdf0e10cSrcweir { 631*cdf0e10cSrcweir nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSETO; 632*cdf0e10cSrcweir nParametersNeeded = 3; 633*cdf0e10cSrcweir nIndex++; 634*cdf0e10cSrcweir } 635*cdf0e10cSrcweir break; 636*cdf0e10cSrcweir case 'U' : 637*cdf0e10cSrcweir { 638*cdf0e10cSrcweir nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSE; 639*cdf0e10cSrcweir nParametersNeeded = 3; 640*cdf0e10cSrcweir nIndex++; 641*cdf0e10cSrcweir } 642*cdf0e10cSrcweir break; 643*cdf0e10cSrcweir case 'A' : 644*cdf0e10cSrcweir { 645*cdf0e10cSrcweir nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ARCTO; 646*cdf0e10cSrcweir nParametersNeeded = 4; 647*cdf0e10cSrcweir nIndex++; 648*cdf0e10cSrcweir } 649*cdf0e10cSrcweir break; 650*cdf0e10cSrcweir case 'B' : 651*cdf0e10cSrcweir { 652*cdf0e10cSrcweir nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ARC; 653*cdf0e10cSrcweir nParametersNeeded = 4; 654*cdf0e10cSrcweir nIndex++; 655*cdf0e10cSrcweir } 656*cdf0e10cSrcweir break; 657*cdf0e10cSrcweir case 'W' : 658*cdf0e10cSrcweir { 659*cdf0e10cSrcweir nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARCTO; 660*cdf0e10cSrcweir nParametersNeeded = 4; 661*cdf0e10cSrcweir nIndex++; 662*cdf0e10cSrcweir } 663*cdf0e10cSrcweir break; 664*cdf0e10cSrcweir case 'V' : 665*cdf0e10cSrcweir { 666*cdf0e10cSrcweir nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARC; 667*cdf0e10cSrcweir nParametersNeeded = 4; 668*cdf0e10cSrcweir nIndex++; 669*cdf0e10cSrcweir } 670*cdf0e10cSrcweir break; 671*cdf0e10cSrcweir case 'X' : 672*cdf0e10cSrcweir { 673*cdf0e10cSrcweir nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTX; 674*cdf0e10cSrcweir nParametersNeeded = 1; 675*cdf0e10cSrcweir nIndex++; 676*cdf0e10cSrcweir } 677*cdf0e10cSrcweir break; 678*cdf0e10cSrcweir case 'Y' : 679*cdf0e10cSrcweir { 680*cdf0e10cSrcweir nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTY; 681*cdf0e10cSrcweir nParametersNeeded = 1; 682*cdf0e10cSrcweir nIndex++; 683*cdf0e10cSrcweir } 684*cdf0e10cSrcweir break; 685*cdf0e10cSrcweir case 'Q' : 686*cdf0e10cSrcweir { 687*cdf0e10cSrcweir nLatestSegmentCommand = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::QUADRATICCURVETO; 688*cdf0e10cSrcweir nParametersNeeded = 2; 689*cdf0e10cSrcweir nIndex++; 690*cdf0e10cSrcweir } 691*cdf0e10cSrcweir break; 692*cdf0e10cSrcweir case ' ' : 693*cdf0e10cSrcweir { 694*cdf0e10cSrcweir nIndex++; 695*cdf0e10cSrcweir } 696*cdf0e10cSrcweir break; 697*cdf0e10cSrcweir 698*cdf0e10cSrcweir case '$' : 699*cdf0e10cSrcweir case '?' : 700*cdf0e10cSrcweir case '0' : 701*cdf0e10cSrcweir case '1' : 702*cdf0e10cSrcweir case '2' : 703*cdf0e10cSrcweir case '3' : 704*cdf0e10cSrcweir case '4' : 705*cdf0e10cSrcweir case '5' : 706*cdf0e10cSrcweir case '6' : 707*cdf0e10cSrcweir case '7' : 708*cdf0e10cSrcweir case '8' : 709*cdf0e10cSrcweir case '9' : 710*cdf0e10cSrcweir case '.' : 711*cdf0e10cSrcweir case '-' : 712*cdf0e10cSrcweir { 713*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeParameterPair aPair; 714*cdf0e10cSrcweir if ( GetNextParameter( aPair.First, nIndex, rValue ) && 715*cdf0e10cSrcweir GetNextParameter( aPair.Second, nIndex, rValue ) ) 716*cdf0e10cSrcweir { 717*cdf0e10cSrcweir vCoordinates.push_back( aPair ); 718*cdf0e10cSrcweir nParameterCount++; 719*cdf0e10cSrcweir } 720*cdf0e10cSrcweir else 721*cdf0e10cSrcweir bValid = sal_False; 722*cdf0e10cSrcweir } 723*cdf0e10cSrcweir break; 724*cdf0e10cSrcweir default: 725*cdf0e10cSrcweir nIndex++; 726*cdf0e10cSrcweir break; 727*cdf0e10cSrcweir } 728*cdf0e10cSrcweir if ( !nParameterCount && !nParametersNeeded ) 729*cdf0e10cSrcweir { 730*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeSegment aSegment; 731*cdf0e10cSrcweir aSegment.Command = nLatestSegmentCommand; 732*cdf0e10cSrcweir aSegment.Count = 0; 733*cdf0e10cSrcweir vSegments.push_back( aSegment ); 734*cdf0e10cSrcweir nParametersNeeded = 0x7fffffff; 735*cdf0e10cSrcweir } 736*cdf0e10cSrcweir else if ( nParameterCount >= nParametersNeeded ) 737*cdf0e10cSrcweir { 738*cdf0e10cSrcweir // check if the last command is identical, 739*cdf0e10cSrcweir // if so, we just need to increment the count 740*cdf0e10cSrcweir if ( !vSegments.empty() && ( vSegments[ vSegments.size() - 1 ].Command == nLatestSegmentCommand ) ) 741*cdf0e10cSrcweir vSegments[ vSegments.size() -1 ].Count++; 742*cdf0e10cSrcweir else 743*cdf0e10cSrcweir { 744*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeSegment aSegment; 745*cdf0e10cSrcweir aSegment.Command = nLatestSegmentCommand; 746*cdf0e10cSrcweir aSegment.Count = 1; 747*cdf0e10cSrcweir vSegments.push_back( aSegment ); 748*cdf0e10cSrcweir } 749*cdf0e10cSrcweir nParameterCount = 0; 750*cdf0e10cSrcweir } 751*cdf0e10cSrcweir } 752*cdf0e10cSrcweir // adding the Coordinates property 753*cdf0e10cSrcweir uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > seqCoordinates( vCoordinates.size() ); 754*cdf0e10cSrcweir std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair >::const_iterator aCoordinatesIter = vCoordinates.begin(); 755*cdf0e10cSrcweir std::vector< com::sun::star::drawing::EnhancedCustomShapeParameterPair >::const_iterator aCoordinatesEnd = vCoordinates.end(); 756*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeParameterPair* pCoordinateValues = seqCoordinates.getArray(); 757*cdf0e10cSrcweir 758*cdf0e10cSrcweir while ( aCoordinatesIter != aCoordinatesEnd ) 759*cdf0e10cSrcweir *pCoordinateValues++ = *aCoordinatesIter++; 760*cdf0e10cSrcweir 761*cdf0e10cSrcweir beans::PropertyValue aProp; 762*cdf0e10cSrcweir aProp.Name = EASGet( EAS_Coordinates ); 763*cdf0e10cSrcweir aProp.Value <<= seqCoordinates; 764*cdf0e10cSrcweir rDest.push_back( aProp ); 765*cdf0e10cSrcweir 766*cdf0e10cSrcweir 767*cdf0e10cSrcweir // adding the Segments property 768*cdf0e10cSrcweir uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > seqSegments( vSegments.size() ); 769*cdf0e10cSrcweir std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >::const_iterator aSegmentsIter = vSegments.begin(); 770*cdf0e10cSrcweir std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >::const_iterator aSegmentsEnd = vSegments.end(); 771*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeSegment* pSegmentValues = seqSegments.getArray(); 772*cdf0e10cSrcweir 773*cdf0e10cSrcweir while ( aSegmentsIter != aSegmentsEnd ) 774*cdf0e10cSrcweir *pSegmentValues++ = *aSegmentsIter++; 775*cdf0e10cSrcweir 776*cdf0e10cSrcweir aProp.Name = EASGet( EAS_Segments ); 777*cdf0e10cSrcweir aProp.Value <<= seqSegments; 778*cdf0e10cSrcweir rDest.push_back( aProp ); 779*cdf0e10cSrcweir } 780*cdf0e10cSrcweir 781*cdf0e10cSrcweir void GetAdjustmentValues( std::vector< com::sun::star::beans::PropertyValue >& rDest, // draw:adjustments 782*cdf0e10cSrcweir const rtl::OUString& rValue ) 783*cdf0e10cSrcweir { 784*cdf0e10cSrcweir std::vector< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > vAdjustmentValue; 785*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeParameter aParameter; 786*cdf0e10cSrcweir sal_Int32 nIndex = 0; 787*cdf0e10cSrcweir while ( GetNextParameter( aParameter, nIndex, rValue ) ) 788*cdf0e10cSrcweir { 789*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue aAdj; 790*cdf0e10cSrcweir if ( aParameter.Type == com::sun::star::drawing::EnhancedCustomShapeParameterType::NORMAL ) 791*cdf0e10cSrcweir { 792*cdf0e10cSrcweir aAdj.Value <<= aParameter.Value; 793*cdf0e10cSrcweir aAdj.State = beans::PropertyState_DIRECT_VALUE; 794*cdf0e10cSrcweir } 795*cdf0e10cSrcweir else 796*cdf0e10cSrcweir aAdj.State = beans::PropertyState_DEFAULT_VALUE; // this should not be, but better than setting nothing 797*cdf0e10cSrcweir 798*cdf0e10cSrcweir vAdjustmentValue.push_back( aAdj ); 799*cdf0e10cSrcweir } 800*cdf0e10cSrcweir 801*cdf0e10cSrcweir sal_Int32 nAdjustmentValues = vAdjustmentValue.size(); 802*cdf0e10cSrcweir if ( nAdjustmentValues ) 803*cdf0e10cSrcweir { 804*cdf0e10cSrcweir uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > aAdjustmentValues( nAdjustmentValues ); 805*cdf0e10cSrcweir std::vector< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue >::const_iterator aIter = vAdjustmentValue.begin(); 806*cdf0e10cSrcweir std::vector< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue >::const_iterator aEnd = vAdjustmentValue.end(); 807*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue* pValues = aAdjustmentValues.getArray(); 808*cdf0e10cSrcweir 809*cdf0e10cSrcweir while ( aIter != aEnd ) 810*cdf0e10cSrcweir *pValues++ = *aIter++; 811*cdf0e10cSrcweir 812*cdf0e10cSrcweir beans::PropertyValue aProp; 813*cdf0e10cSrcweir aProp.Name = EASGet( EAS_AdjustmentValues ); 814*cdf0e10cSrcweir aProp.Value <<= aAdjustmentValues; 815*cdf0e10cSrcweir rDest.push_back( aProp ); 816*cdf0e10cSrcweir } 817*cdf0e10cSrcweir } 818*cdf0e10cSrcweir 819*cdf0e10cSrcweir void XMLEnhancedCustomShapeContext::StartElement( const uno::Reference< xml::sax::XAttributeList >& xAttrList ) 820*cdf0e10cSrcweir { 821*cdf0e10cSrcweir sal_Int16 nLength = xAttrList->getLength(); 822*cdf0e10cSrcweir if ( nLength ) 823*cdf0e10cSrcweir { 824*cdf0e10cSrcweir sal_Int32 nAttrNumber; 825*cdf0e10cSrcweir for( sal_Int16 nAttr = 0; nAttr < nLength; nAttr++ ) 826*cdf0e10cSrcweir { 827*cdf0e10cSrcweir rtl::OUString aLocalName; 828*cdf0e10cSrcweir const rtl::OUString& rValue = xAttrList->getValueByIndex( nAttr ); 829*cdf0e10cSrcweir /* sven fixme, this must be checked! sal_uInt16 nPrefix = */ GetImport().GetNamespaceMap().GetKeyByAttrName( xAttrList->getNameByIndex( nAttr ), &aLocalName ); 830*cdf0e10cSrcweir 831*cdf0e10cSrcweir switch( EASGet( aLocalName ) ) 832*cdf0e10cSrcweir { 833*cdf0e10cSrcweir case EAS_type : 834*cdf0e10cSrcweir GetString( mrCustomShapeGeometry, rValue, EAS_Type ); 835*cdf0e10cSrcweir break; 836*cdf0e10cSrcweir case EAS_mirror_horizontal : 837*cdf0e10cSrcweir GetBool( mrCustomShapeGeometry, rValue, EAS_MirroredX ); 838*cdf0e10cSrcweir break; 839*cdf0e10cSrcweir case EAS_mirror_vertical : 840*cdf0e10cSrcweir GetBool( mrCustomShapeGeometry, rValue, EAS_MirroredY ); 841*cdf0e10cSrcweir break; 842*cdf0e10cSrcweir case EAS_viewBox : 843*cdf0e10cSrcweir { 844*cdf0e10cSrcweir SdXMLImExViewBox aViewBox( rValue, GetImport().GetMM100UnitConverter() ); 845*cdf0e10cSrcweir awt::Rectangle aRect( aViewBox.GetX(), aViewBox.GetY(), aViewBox.GetWidth(), aViewBox.GetHeight() ); 846*cdf0e10cSrcweir beans::PropertyValue aProp; 847*cdf0e10cSrcweir aProp.Name = EASGet( EAS_ViewBox ); 848*cdf0e10cSrcweir aProp.Value <<= aRect; 849*cdf0e10cSrcweir mrCustomShapeGeometry.push_back( aProp ); 850*cdf0e10cSrcweir } 851*cdf0e10cSrcweir break; 852*cdf0e10cSrcweir case EAS_text_rotate_angle : 853*cdf0e10cSrcweir GetDouble( mrCustomShapeGeometry, rValue, EAS_TextRotateAngle ); 854*cdf0e10cSrcweir break; 855*cdf0e10cSrcweir case EAS_extrusion_allowed : 856*cdf0e10cSrcweir GetBool( maPath, rValue, EAS_ExtrusionAllowed ); 857*cdf0e10cSrcweir break; 858*cdf0e10cSrcweir case EAS_text_path_allowed : 859*cdf0e10cSrcweir GetBool( maPath, rValue, EAS_TextPathAllowed ); 860*cdf0e10cSrcweir break; 861*cdf0e10cSrcweir case EAS_concentric_gradient_fill_allowed : 862*cdf0e10cSrcweir GetBool( maPath, rValue, EAS_ConcentricGradientFillAllowed ); 863*cdf0e10cSrcweir break; 864*cdf0e10cSrcweir case EAS_extrusion : 865*cdf0e10cSrcweir GetBool( maExtrusion, rValue, EAS_Extrusion ); 866*cdf0e10cSrcweir break; 867*cdf0e10cSrcweir case EAS_extrusion_brightness : 868*cdf0e10cSrcweir GetDoublePercentage( maExtrusion, rValue, EAS_Brightness ); 869*cdf0e10cSrcweir break; 870*cdf0e10cSrcweir case EAS_extrusion_depth : 871*cdf0e10cSrcweir { 872*cdf0e10cSrcweir sal_Int32 nIndex = 0; 873*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeParameterPair aParameterPair; 874*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeParameter& rDepth = aParameterPair.First; 875*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeParameter& rFraction = aParameterPair.Second; 876*cdf0e10cSrcweir if ( GetNextParameter( rDepth, nIndex, rValue ) ) 877*cdf0e10cSrcweir { 878*cdf0e10cSrcweir // try to catch the unit for the depth 879*cdf0e10cSrcweir MapUnit eSrcUnit( SvXMLExportHelper::GetUnitFromString( rValue, MAP_100TH_MM ) ); 880*cdf0e10cSrcweir 881*cdf0e10cSrcweir rtl::OUStringBuffer aUnitStr; 882*cdf0e10cSrcweir double fFactor = SvXMLExportHelper::GetConversionFactor( aUnitStr, MAP_100TH_MM, eSrcUnit ); 883*cdf0e10cSrcweir if ( ( fFactor != 1.0 ) && ( fFactor != 0.0 ) ) 884*cdf0e10cSrcweir { 885*cdf0e10cSrcweir double fDepth; 886*cdf0e10cSrcweir if ( rDepth.Value >>= fDepth ) 887*cdf0e10cSrcweir { 888*cdf0e10cSrcweir fDepth /= fFactor; 889*cdf0e10cSrcweir rDepth.Value <<= fDepth; 890*cdf0e10cSrcweir } 891*cdf0e10cSrcweir } 892*cdf0e10cSrcweir if ( rValue.matchIgnoreAsciiCase( rtl::OUString( aUnitStr ), nIndex ) ) 893*cdf0e10cSrcweir nIndex += aUnitStr.getLength(); 894*cdf0e10cSrcweir 895*cdf0e10cSrcweir // skipping white spaces 896*cdf0e10cSrcweir while( ( nIndex < rValue.getLength() ) && rValue[ nIndex ] == (sal_Unicode)' ' ) 897*cdf0e10cSrcweir nIndex++; 898*cdf0e10cSrcweir 899*cdf0e10cSrcweir if ( GetNextParameter( rFraction, nIndex, rValue ) ) 900*cdf0e10cSrcweir { 901*cdf0e10cSrcweir beans::PropertyValue aProp; 902*cdf0e10cSrcweir aProp.Name = EASGet( EAS_Depth ); 903*cdf0e10cSrcweir aProp.Value <<= aParameterPair; 904*cdf0e10cSrcweir maExtrusion.push_back( aProp ); 905*cdf0e10cSrcweir } 906*cdf0e10cSrcweir } 907*cdf0e10cSrcweir } 908*cdf0e10cSrcweir break; 909*cdf0e10cSrcweir case EAS_extrusion_diffusion : 910*cdf0e10cSrcweir GetDoublePercentage( maExtrusion, rValue, EAS_Diffusion ); 911*cdf0e10cSrcweir break; 912*cdf0e10cSrcweir case EAS_extrusion_number_of_line_segments : 913*cdf0e10cSrcweir GetInt32( maExtrusion, rValue, EAS_NumberOfLineSegments ); 914*cdf0e10cSrcweir break; 915*cdf0e10cSrcweir case EAS_extrusion_light_face : 916*cdf0e10cSrcweir GetBool( maExtrusion, rValue, EAS_LightFace ); 917*cdf0e10cSrcweir break; 918*cdf0e10cSrcweir case EAS_extrusion_first_light_harsh : 919*cdf0e10cSrcweir GetBool( maExtrusion, rValue, EAS_FirstLightHarsh ); 920*cdf0e10cSrcweir break; 921*cdf0e10cSrcweir case EAS_extrusion_second_light_harsh : 922*cdf0e10cSrcweir GetBool( maExtrusion, rValue, EAS_SecondLightHarsh ); 923*cdf0e10cSrcweir break; 924*cdf0e10cSrcweir case EAS_extrusion_first_light_level : 925*cdf0e10cSrcweir GetDoublePercentage( maExtrusion, rValue, EAS_FirstLightLevel ); 926*cdf0e10cSrcweir break; 927*cdf0e10cSrcweir case EAS_extrusion_second_light_level : 928*cdf0e10cSrcweir GetDoublePercentage( maExtrusion, rValue, EAS_SecondLightLevel ); 929*cdf0e10cSrcweir break; 930*cdf0e10cSrcweir case EAS_extrusion_first_light_direction : 931*cdf0e10cSrcweir GetB3DVector( maExtrusion, rValue, EAS_FirstLightDirection ); 932*cdf0e10cSrcweir break; 933*cdf0e10cSrcweir case EAS_extrusion_second_light_direction : 934*cdf0e10cSrcweir GetB3DVector( maExtrusion, rValue, EAS_SecondLightDirection ); 935*cdf0e10cSrcweir break; 936*cdf0e10cSrcweir case EAS_extrusion_metal : 937*cdf0e10cSrcweir GetBool( maExtrusion, rValue, EAS_Metal ); 938*cdf0e10cSrcweir break; 939*cdf0e10cSrcweir case EAS_shade_mode : 940*cdf0e10cSrcweir { 941*cdf0e10cSrcweir drawing::ShadeMode eShadeMode( drawing::ShadeMode_FLAT ); 942*cdf0e10cSrcweir if( IsXMLToken( rValue, XML_PHONG ) ) 943*cdf0e10cSrcweir eShadeMode = drawing::ShadeMode_PHONG; 944*cdf0e10cSrcweir else if ( IsXMLToken( rValue, XML_GOURAUD ) ) 945*cdf0e10cSrcweir eShadeMode = drawing::ShadeMode_SMOOTH; 946*cdf0e10cSrcweir else if ( IsXMLToken( rValue, XML_DRAFT ) ) 947*cdf0e10cSrcweir eShadeMode = drawing::ShadeMode_DRAFT; 948*cdf0e10cSrcweir 949*cdf0e10cSrcweir beans::PropertyValue aProp; 950*cdf0e10cSrcweir aProp.Name = EASGet( EAS_ShadeMode ); 951*cdf0e10cSrcweir aProp.Value <<= eShadeMode; 952*cdf0e10cSrcweir maExtrusion.push_back( aProp ); 953*cdf0e10cSrcweir } 954*cdf0e10cSrcweir break; 955*cdf0e10cSrcweir case EAS_extrusion_rotation_angle : 956*cdf0e10cSrcweir GetEnhancedParameterPair( maExtrusion, rValue, EAS_RotateAngle ); 957*cdf0e10cSrcweir break; 958*cdf0e10cSrcweir case EAS_extrusion_rotation_center : 959*cdf0e10cSrcweir GetB3DVector( maExtrusion, rValue, EAS_RotationCenter ); 960*cdf0e10cSrcweir break; 961*cdf0e10cSrcweir case EAS_extrusion_shininess : 962*cdf0e10cSrcweir GetDoublePercentage( maExtrusion, rValue, EAS_Shininess ); 963*cdf0e10cSrcweir break; 964*cdf0e10cSrcweir case EAS_extrusion_skew : 965*cdf0e10cSrcweir GetEnhancedParameterPair( maExtrusion, rValue, EAS_Skew ); 966*cdf0e10cSrcweir break; 967*cdf0e10cSrcweir case EAS_extrusion_specularity : 968*cdf0e10cSrcweir GetDoublePercentage( maExtrusion, rValue, EAS_Specularity ); 969*cdf0e10cSrcweir break; 970*cdf0e10cSrcweir case EAS_projection : 971*cdf0e10cSrcweir { 972*cdf0e10cSrcweir drawing::ProjectionMode eProjectionMode( drawing::ProjectionMode_PERSPECTIVE ); 973*cdf0e10cSrcweir if( IsXMLToken( rValue, XML_PARALLEL ) ) 974*cdf0e10cSrcweir eProjectionMode = drawing::ProjectionMode_PARALLEL; 975*cdf0e10cSrcweir 976*cdf0e10cSrcweir beans::PropertyValue aProp; 977*cdf0e10cSrcweir aProp.Name = EASGet( EAS_ProjectionMode ); 978*cdf0e10cSrcweir aProp.Value <<= eProjectionMode; 979*cdf0e10cSrcweir maExtrusion.push_back( aProp ); 980*cdf0e10cSrcweir } 981*cdf0e10cSrcweir break; 982*cdf0e10cSrcweir case EAS_extrusion_viewpoint : 983*cdf0e10cSrcweir GetPosition3D( maExtrusion, rValue, EAS_ViewPoint, mrUnitConverter ); 984*cdf0e10cSrcweir break; 985*cdf0e10cSrcweir case EAS_extrusion_origin : 986*cdf0e10cSrcweir GetEnhancedParameterPair( maExtrusion, rValue, EAS_Origin ); 987*cdf0e10cSrcweir break; 988*cdf0e10cSrcweir case EAS_extrusion_color : 989*cdf0e10cSrcweir GetBool( maExtrusion, rValue, EAS_Color ); 990*cdf0e10cSrcweir break; 991*cdf0e10cSrcweir case EAS_enhanced_path : 992*cdf0e10cSrcweir GetEnhancedPath( maPath, rValue ); 993*cdf0e10cSrcweir break; 994*cdf0e10cSrcweir case EAS_path_stretchpoint_x : 995*cdf0e10cSrcweir { 996*cdf0e10cSrcweir if ( SvXMLUnitConverter::convertNumber( nAttrNumber, rValue ) ) 997*cdf0e10cSrcweir { 998*cdf0e10cSrcweir beans::PropertyValue aProp; 999*cdf0e10cSrcweir aProp.Name = EASGet( EAS_StretchX ); 1000*cdf0e10cSrcweir aProp.Value <<= nAttrNumber; 1001*cdf0e10cSrcweir maPath.push_back( aProp ); 1002*cdf0e10cSrcweir } 1003*cdf0e10cSrcweir } 1004*cdf0e10cSrcweir break; 1005*cdf0e10cSrcweir case EAS_path_stretchpoint_y : 1006*cdf0e10cSrcweir { 1007*cdf0e10cSrcweir if ( SvXMLUnitConverter::convertNumber( nAttrNumber, rValue ) ) 1008*cdf0e10cSrcweir { 1009*cdf0e10cSrcweir beans::PropertyValue aProp; 1010*cdf0e10cSrcweir aProp.Name = EASGet( EAS_StretchY ); 1011*cdf0e10cSrcweir aProp.Value <<= nAttrNumber; 1012*cdf0e10cSrcweir maPath.push_back( aProp ); 1013*cdf0e10cSrcweir } 1014*cdf0e10cSrcweir } 1015*cdf0e10cSrcweir break; 1016*cdf0e10cSrcweir case EAS_text_areas : 1017*cdf0e10cSrcweir GetEnhancedRectangleSequence( maPath, rValue, EAS_TextFrames ); 1018*cdf0e10cSrcweir break; 1019*cdf0e10cSrcweir case EAS_glue_points : 1020*cdf0e10cSrcweir { 1021*cdf0e10cSrcweir sal_Int32 i, nPairs = GetEnhancedParameterPairSequence( maPath, rValue, EAS_GluePoints ); 1022*cdf0e10cSrcweir GetImport().GetShapeImport()->moveGluePointMapping( mrxShape, nPairs ); 1023*cdf0e10cSrcweir for ( i = 0; i < nPairs; i++ ) 1024*cdf0e10cSrcweir GetImport().GetShapeImport()->addGluePointMapping( mrxShape, i + 4, i + 4 ); 1025*cdf0e10cSrcweir } 1026*cdf0e10cSrcweir break; 1027*cdf0e10cSrcweir case EAS_glue_point_type : 1028*cdf0e10cSrcweir GetEnum( maPath, rValue, EAS_GluePointType, *aXML_GluePointEnumMap ); 1029*cdf0e10cSrcweir break; 1030*cdf0e10cSrcweir case EAS_glue_point_leaving_directions : 1031*cdf0e10cSrcweir GetDoubleSequence( maPath, rValue, EAS_GluePointLeavingDirections ); 1032*cdf0e10cSrcweir break; 1033*cdf0e10cSrcweir case EAS_text_path : 1034*cdf0e10cSrcweir GetBool( maTextPath, rValue, EAS_TextPath ); 1035*cdf0e10cSrcweir break; 1036*cdf0e10cSrcweir case EAS_text_path_mode : 1037*cdf0e10cSrcweir { 1038*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeTextPathMode eTextPathMode( com::sun::star::drawing::EnhancedCustomShapeTextPathMode_NORMAL ); 1039*cdf0e10cSrcweir if( IsXMLToken( rValue, XML_PATH ) ) 1040*cdf0e10cSrcweir eTextPathMode = com::sun::star::drawing::EnhancedCustomShapeTextPathMode_PATH; 1041*cdf0e10cSrcweir else if ( IsXMLToken( rValue, XML_SHAPE ) ) 1042*cdf0e10cSrcweir eTextPathMode = com::sun::star::drawing::EnhancedCustomShapeTextPathMode_SHAPE; 1043*cdf0e10cSrcweir 1044*cdf0e10cSrcweir beans::PropertyValue aProp; 1045*cdf0e10cSrcweir aProp.Name = EASGet( EAS_TextPathMode ); 1046*cdf0e10cSrcweir aProp.Value <<= eTextPathMode; 1047*cdf0e10cSrcweir maTextPath.push_back( aProp ); 1048*cdf0e10cSrcweir } 1049*cdf0e10cSrcweir break; 1050*cdf0e10cSrcweir case EAS_text_path_scale : 1051*cdf0e10cSrcweir { 1052*cdf0e10cSrcweir sal_Bool bScaleX = IsXMLToken( rValue, XML_SHAPE ); 1053*cdf0e10cSrcweir beans::PropertyValue aProp; 1054*cdf0e10cSrcweir aProp.Name = EASGet( EAS_ScaleX ); 1055*cdf0e10cSrcweir aProp.Value <<= bScaleX; 1056*cdf0e10cSrcweir maTextPath.push_back( aProp ); 1057*cdf0e10cSrcweir } 1058*cdf0e10cSrcweir break; 1059*cdf0e10cSrcweir case EAS_text_path_same_letter_heights : 1060*cdf0e10cSrcweir GetBool( maTextPath, rValue, EAS_SameLetterHeights ); 1061*cdf0e10cSrcweir break; 1062*cdf0e10cSrcweir case EAS_modifiers : 1063*cdf0e10cSrcweir GetAdjustmentValues( mrCustomShapeGeometry, rValue ); 1064*cdf0e10cSrcweir break; 1065*cdf0e10cSrcweir default: 1066*cdf0e10cSrcweir break; 1067*cdf0e10cSrcweir } 1068*cdf0e10cSrcweir } 1069*cdf0e10cSrcweir } 1070*cdf0e10cSrcweir } 1071*cdf0e10cSrcweir 1072*cdf0e10cSrcweir void SdXMLCustomShapePropertyMerge( std::vector< com::sun::star::beans::PropertyValue >& rPropVec, 1073*cdf0e10cSrcweir const std::vector< beans::PropertyValues >& rElement, 1074*cdf0e10cSrcweir const rtl::OUString& rElementName ) 1075*cdf0e10cSrcweir { 1076*cdf0e10cSrcweir if ( !rElement.empty() ) 1077*cdf0e10cSrcweir { 1078*cdf0e10cSrcweir uno::Sequence< beans::PropertyValues > aPropSeq( rElement.size() ); 1079*cdf0e10cSrcweir std::vector< beans::PropertyValues >::const_iterator aIter = rElement.begin(); 1080*cdf0e10cSrcweir std::vector< beans::PropertyValues >::const_iterator aEnd = rElement.end(); 1081*cdf0e10cSrcweir beans::PropertyValues* pValues = aPropSeq.getArray(); 1082*cdf0e10cSrcweir 1083*cdf0e10cSrcweir while ( aIter != aEnd ) 1084*cdf0e10cSrcweir *pValues++ = *aIter++; 1085*cdf0e10cSrcweir 1086*cdf0e10cSrcweir beans::PropertyValue aProp; 1087*cdf0e10cSrcweir aProp.Name = rElementName; 1088*cdf0e10cSrcweir aProp.Value <<= aPropSeq; 1089*cdf0e10cSrcweir rPropVec.push_back( aProp ); 1090*cdf0e10cSrcweir } 1091*cdf0e10cSrcweir } 1092*cdf0e10cSrcweir 1093*cdf0e10cSrcweir void SdXMLCustomShapePropertyMerge( std::vector< com::sun::star::beans::PropertyValue >& rPropVec, 1094*cdf0e10cSrcweir const std::vector< rtl::OUString >& rElement, 1095*cdf0e10cSrcweir const rtl::OUString& rElementName ) 1096*cdf0e10cSrcweir { 1097*cdf0e10cSrcweir if ( !rElement.empty() ) 1098*cdf0e10cSrcweir { 1099*cdf0e10cSrcweir uno::Sequence< rtl::OUString > aPropSeq( rElement.size() ); 1100*cdf0e10cSrcweir std::vector< rtl::OUString >::const_iterator aIter = rElement.begin(); 1101*cdf0e10cSrcweir std::vector< rtl::OUString >::const_iterator aEnd = rElement.end(); 1102*cdf0e10cSrcweir rtl::OUString* pValues = aPropSeq.getArray(); 1103*cdf0e10cSrcweir 1104*cdf0e10cSrcweir while ( aIter != aEnd ) 1105*cdf0e10cSrcweir *pValues++ = *aIter++; 1106*cdf0e10cSrcweir 1107*cdf0e10cSrcweir beans::PropertyValue aProp; 1108*cdf0e10cSrcweir aProp.Name = rElementName; 1109*cdf0e10cSrcweir aProp.Value <<= aPropSeq; 1110*cdf0e10cSrcweir rPropVec.push_back( aProp ); 1111*cdf0e10cSrcweir } 1112*cdf0e10cSrcweir } 1113*cdf0e10cSrcweir 1114*cdf0e10cSrcweir void SdXMLCustomShapePropertyMerge( std::vector< com::sun::star::beans::PropertyValue >& rPropVec, 1115*cdf0e10cSrcweir const std::vector< com::sun::star::beans::PropertyValue >& rElement, 1116*cdf0e10cSrcweir const rtl::OUString& rElementName ) 1117*cdf0e10cSrcweir { 1118*cdf0e10cSrcweir if ( !rElement.empty() ) 1119*cdf0e10cSrcweir { 1120*cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aPropSeq( rElement.size() ); 1121*cdf0e10cSrcweir std::vector< beans::PropertyValue >::const_iterator aIter = rElement.begin(); 1122*cdf0e10cSrcweir std::vector< beans::PropertyValue >::const_iterator aEnd = rElement.end(); 1123*cdf0e10cSrcweir beans::PropertyValue* pValues = aPropSeq.getArray(); 1124*cdf0e10cSrcweir 1125*cdf0e10cSrcweir while ( aIter != aEnd ) 1126*cdf0e10cSrcweir *pValues++ = *aIter++; 1127*cdf0e10cSrcweir 1128*cdf0e10cSrcweir beans::PropertyValue aProp; 1129*cdf0e10cSrcweir aProp.Name = rElementName; 1130*cdf0e10cSrcweir aProp.Value <<= aPropSeq; 1131*cdf0e10cSrcweir rPropVec.push_back( aProp ); 1132*cdf0e10cSrcweir } 1133*cdf0e10cSrcweir } 1134*cdf0e10cSrcweir 1135*cdf0e10cSrcweir typedef std::hash_map< rtl::OUString, sal_Int32, rtl::OUStringHash, OUStringEqFunc> EquationHashMap; 1136*cdf0e10cSrcweir 1137*cdf0e10cSrcweir /* if rPara.Type is from type EnhancedCustomShapeParameterType::EQUATION, the name of the equation 1138*cdf0e10cSrcweir will be converted from rtl::OUString to index */ 1139*cdf0e10cSrcweir void CheckAndResolveEquationParameter( com::sun::star::drawing::EnhancedCustomShapeParameter& rPara, EquationHashMap* pH ) 1140*cdf0e10cSrcweir { 1141*cdf0e10cSrcweir if ( rPara.Type == com::sun::star::drawing::EnhancedCustomShapeParameterType::EQUATION ) 1142*cdf0e10cSrcweir { 1143*cdf0e10cSrcweir rtl::OUString aEquationName; 1144*cdf0e10cSrcweir if ( rPara.Value >>= aEquationName ) 1145*cdf0e10cSrcweir { 1146*cdf0e10cSrcweir sal_Int32 nIndex = 0; 1147*cdf0e10cSrcweir EquationHashMap::iterator aHashIter( pH->find( aEquationName ) ); 1148*cdf0e10cSrcweir if ( aHashIter != pH->end() ) 1149*cdf0e10cSrcweir nIndex = (*aHashIter).second; 1150*cdf0e10cSrcweir rPara.Value <<= nIndex; 1151*cdf0e10cSrcweir } 1152*cdf0e10cSrcweir } 1153*cdf0e10cSrcweir } 1154*cdf0e10cSrcweir 1155*cdf0e10cSrcweir void XMLEnhancedCustomShapeContext::EndElement() 1156*cdf0e10cSrcweir { 1157*cdf0e10cSrcweir // resolve properties that are indexing a Equation 1158*cdf0e10cSrcweir if ( !maEquations.empty() ) 1159*cdf0e10cSrcweir { 1160*cdf0e10cSrcweir // creating hash map containing the name and index of each equation 1161*cdf0e10cSrcweir EquationHashMap* pH = new EquationHashMap; 1162*cdf0e10cSrcweir std::vector< rtl::OUString >::iterator aEquationNameIter = maEquationNames.begin(); 1163*cdf0e10cSrcweir std::vector< rtl::OUString >::iterator aEquationNameEnd = maEquationNames.end(); 1164*cdf0e10cSrcweir while( aEquationNameIter != aEquationNameEnd ) 1165*cdf0e10cSrcweir { 1166*cdf0e10cSrcweir (*pH)[ *aEquationNameIter ] = (sal_Int32)( aEquationNameIter - maEquationNames.begin() ); 1167*cdf0e10cSrcweir aEquationNameIter++; 1168*cdf0e10cSrcweir } 1169*cdf0e10cSrcweir 1170*cdf0e10cSrcweir // resolve equation 1171*cdf0e10cSrcweir std::vector< rtl::OUString >::iterator aEquationIter = maEquations.begin(); 1172*cdf0e10cSrcweir std::vector< rtl::OUString >::iterator aEquationEnd = maEquations.end(); 1173*cdf0e10cSrcweir while( aEquationIter != aEquationEnd ) 1174*cdf0e10cSrcweir { 1175*cdf0e10cSrcweir sal_Int32 nIndexOf = 0; 1176*cdf0e10cSrcweir do 1177*cdf0e10cSrcweir { 1178*cdf0e10cSrcweir nIndexOf = aEquationIter->indexOf( '?', nIndexOf ); 1179*cdf0e10cSrcweir if ( nIndexOf != -1 ) 1180*cdf0e10cSrcweir { 1181*cdf0e10cSrcweir rtl::OUString aEquationName; 1182*cdf0e10cSrcweir if ( GetEquationName( *aEquationIter, nIndexOf + 1, aEquationName ) ) 1183*cdf0e10cSrcweir { 1184*cdf0e10cSrcweir // copying first characters inclusive '?' 1185*cdf0e10cSrcweir rtl::OUString aNew( aEquationIter->copy( 0, nIndexOf + 1 ) ); 1186*cdf0e10cSrcweir sal_Int32 nIndex = 0; 1187*cdf0e10cSrcweir EquationHashMap::iterator aHashIter( pH->find( aEquationName ) ); 1188*cdf0e10cSrcweir if ( aHashIter != pH->end() ) 1189*cdf0e10cSrcweir nIndex = (*aHashIter).second; 1190*cdf0e10cSrcweir aNew += rtl::OUString::valueOf( nIndex ); 1191*cdf0e10cSrcweir aNew += aEquationIter->copy( nIndexOf + aEquationName.getLength() + 1 ); 1192*cdf0e10cSrcweir *aEquationIter = aNew; 1193*cdf0e10cSrcweir } 1194*cdf0e10cSrcweir nIndexOf++; 1195*cdf0e10cSrcweir } 1196*cdf0e10cSrcweir } 1197*cdf0e10cSrcweir while( nIndexOf != -1 ); 1198*cdf0e10cSrcweir aEquationIter++; 1199*cdf0e10cSrcweir } 1200*cdf0e10cSrcweir 1201*cdf0e10cSrcweir // Path 1202*cdf0e10cSrcweir sal_Int32 i; 1203*cdf0e10cSrcweir std::vector< beans::PropertyValue >::iterator aPathIter = maPath.begin(); 1204*cdf0e10cSrcweir std::vector< beans::PropertyValue >::iterator aPathEnd = maPath.end(); 1205*cdf0e10cSrcweir while ( aPathIter != aPathEnd ) 1206*cdf0e10cSrcweir { 1207*cdf0e10cSrcweir switch( EASGet( aPathIter->Name ) ) 1208*cdf0e10cSrcweir { 1209*cdf0e10cSrcweir case EAS_Coordinates : 1210*cdf0e10cSrcweir case EAS_GluePoints : 1211*cdf0e10cSrcweir { 1212*cdf0e10cSrcweir uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair >& rSeq = 1213*cdf0e10cSrcweir *((uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair >*) 1214*cdf0e10cSrcweir aPathIter->Value.getValue()); 1215*cdf0e10cSrcweir for ( i = 0; i < rSeq.getLength(); i++ ) 1216*cdf0e10cSrcweir { 1217*cdf0e10cSrcweir CheckAndResolveEquationParameter( rSeq[ i ].First, pH ); 1218*cdf0e10cSrcweir CheckAndResolveEquationParameter( rSeq[ i ].Second, pH ); 1219*cdf0e10cSrcweir } 1220*cdf0e10cSrcweir } 1221*cdf0e10cSrcweir break; 1222*cdf0e10cSrcweir case EAS_TextFrames : 1223*cdf0e10cSrcweir { 1224*cdf0e10cSrcweir uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame >& rSeq = 1225*cdf0e10cSrcweir *((uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame >*) 1226*cdf0e10cSrcweir aPathIter->Value.getValue()); 1227*cdf0e10cSrcweir for ( i = 0; i < rSeq.getLength(); i++ ) 1228*cdf0e10cSrcweir { 1229*cdf0e10cSrcweir CheckAndResolveEquationParameter( rSeq[ i ].TopLeft.First, pH ); 1230*cdf0e10cSrcweir CheckAndResolveEquationParameter( rSeq[ i ].TopLeft.Second, pH ); 1231*cdf0e10cSrcweir CheckAndResolveEquationParameter( rSeq[ i ].BottomRight.First, pH ); 1232*cdf0e10cSrcweir CheckAndResolveEquationParameter( rSeq[ i ].BottomRight.Second, pH ); 1233*cdf0e10cSrcweir } 1234*cdf0e10cSrcweir } 1235*cdf0e10cSrcweir break; 1236*cdf0e10cSrcweir default: 1237*cdf0e10cSrcweir break; 1238*cdf0e10cSrcweir } 1239*cdf0e10cSrcweir aPathIter++; 1240*cdf0e10cSrcweir } 1241*cdf0e10cSrcweir std::vector< beans::PropertyValues >::iterator aHandleIter = maHandles.begin(); 1242*cdf0e10cSrcweir std::vector< beans::PropertyValues >::iterator aHandleEnd = maHandles.end(); 1243*cdf0e10cSrcweir while ( aHandleIter != aHandleEnd ) 1244*cdf0e10cSrcweir { 1245*cdf0e10cSrcweir beans::PropertyValue* pValues = aHandleIter->getArray(); 1246*cdf0e10cSrcweir for ( i = 0; i < aHandleIter->getLength(); i++ ) 1247*cdf0e10cSrcweir { 1248*cdf0e10cSrcweir switch( EASGet( pValues->Name ) ) 1249*cdf0e10cSrcweir { 1250*cdf0e10cSrcweir case EAS_RangeYMinimum : 1251*cdf0e10cSrcweir case EAS_RangeYMaximum : 1252*cdf0e10cSrcweir case EAS_RangeXMinimum : 1253*cdf0e10cSrcweir case EAS_RangeXMaximum : 1254*cdf0e10cSrcweir case EAS_RadiusRangeMinimum : 1255*cdf0e10cSrcweir case EAS_RadiusRangeMaximum : 1256*cdf0e10cSrcweir { 1257*cdf0e10cSrcweir CheckAndResolveEquationParameter( *((com::sun::star::drawing::EnhancedCustomShapeParameter*) 1258*cdf0e10cSrcweir pValues->Value.getValue()), pH ); 1259*cdf0e10cSrcweir } 1260*cdf0e10cSrcweir break; 1261*cdf0e10cSrcweir 1262*cdf0e10cSrcweir case EAS_Position : 1263*cdf0e10cSrcweir case EAS_Polar : 1264*cdf0e10cSrcweir { 1265*cdf0e10cSrcweir CheckAndResolveEquationParameter( (*((com::sun::star::drawing::EnhancedCustomShapeParameterPair*) 1266*cdf0e10cSrcweir pValues->Value.getValue())).First, pH ); 1267*cdf0e10cSrcweir CheckAndResolveEquationParameter( (*((com::sun::star::drawing::EnhancedCustomShapeParameterPair*) 1268*cdf0e10cSrcweir pValues->Value.getValue())).Second, pH ); 1269*cdf0e10cSrcweir } 1270*cdf0e10cSrcweir break; 1271*cdf0e10cSrcweir default: 1272*cdf0e10cSrcweir break; 1273*cdf0e10cSrcweir } 1274*cdf0e10cSrcweir pValues++; 1275*cdf0e10cSrcweir } 1276*cdf0e10cSrcweir aHandleIter++; 1277*cdf0e10cSrcweir } 1278*cdf0e10cSrcweir delete pH; 1279*cdf0e10cSrcweir } 1280*cdf0e10cSrcweir 1281*cdf0e10cSrcweir SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maExtrusion, EASGet( EAS_Extrusion ) ); 1282*cdf0e10cSrcweir SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maPath, EASGet( EAS_Path ) ); 1283*cdf0e10cSrcweir SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maTextPath, EASGet( EAS_TextPath ) ); 1284*cdf0e10cSrcweir SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maEquations, EASGet( EAS_Equations ) ); 1285*cdf0e10cSrcweir if ( !maHandles.empty() ) 1286*cdf0e10cSrcweir SdXMLCustomShapePropertyMerge( mrCustomShapeGeometry, maHandles, EASGet( EAS_Handles ) ); 1287*cdf0e10cSrcweir } 1288*cdf0e10cSrcweir 1289*cdf0e10cSrcweir SvXMLImportContext* XMLEnhancedCustomShapeContext::CreateChildContext( sal_uInt16 nPrefix,const rtl::OUString& rLocalName, 1290*cdf0e10cSrcweir const uno::Reference< xml::sax::XAttributeList> & xAttrList ) 1291*cdf0e10cSrcweir { 1292*cdf0e10cSrcweir EnhancedCustomShapeTokenEnum aTokenEnum = EASGet( rLocalName ); 1293*cdf0e10cSrcweir if ( aTokenEnum == EAS_equation ) 1294*cdf0e10cSrcweir { 1295*cdf0e10cSrcweir sal_Int16 nLength = xAttrList->getLength(); 1296*cdf0e10cSrcweir if ( nLength ) 1297*cdf0e10cSrcweir { 1298*cdf0e10cSrcweir rtl::OUString aFormula; 1299*cdf0e10cSrcweir rtl::OUString aFormulaName; 1300*cdf0e10cSrcweir for( sal_Int16 nAttr = 0; nAttr < nLength; nAttr++ ) 1301*cdf0e10cSrcweir { 1302*cdf0e10cSrcweir rtl::OUString aLocalName; 1303*cdf0e10cSrcweir const rtl::OUString& rValue = xAttrList->getValueByIndex( nAttr ); 1304*cdf0e10cSrcweir /* fixme sven, this needs to be chekced! sal_uInt16 nPrefix = */ GetImport().GetNamespaceMap().GetKeyByAttrName( xAttrList->getNameByIndex( nAttr ), &aLocalName ); 1305*cdf0e10cSrcweir 1306*cdf0e10cSrcweir switch( EASGet( aLocalName ) ) 1307*cdf0e10cSrcweir { 1308*cdf0e10cSrcweir case EAS_formula : 1309*cdf0e10cSrcweir aFormula = rValue; 1310*cdf0e10cSrcweir break; 1311*cdf0e10cSrcweir case EAS_name : 1312*cdf0e10cSrcweir aFormulaName = rValue; 1313*cdf0e10cSrcweir break; 1314*cdf0e10cSrcweir default: 1315*cdf0e10cSrcweir break; 1316*cdf0e10cSrcweir } 1317*cdf0e10cSrcweir } 1318*cdf0e10cSrcweir if ( aFormulaName.getLength() || aFormula.getLength() ) 1319*cdf0e10cSrcweir { 1320*cdf0e10cSrcweir maEquations.push_back( aFormula ); 1321*cdf0e10cSrcweir maEquationNames.push_back( aFormulaName ); 1322*cdf0e10cSrcweir } 1323*cdf0e10cSrcweir } 1324*cdf0e10cSrcweir } 1325*cdf0e10cSrcweir else if ( aTokenEnum == EAS_handle ) 1326*cdf0e10cSrcweir { 1327*cdf0e10cSrcweir std::vector< com::sun::star::beans::PropertyValue > aHandle; 1328*cdf0e10cSrcweir const sal_Int16 nLength = xAttrList->getLength(); 1329*cdf0e10cSrcweir for( sal_Int16 nAttr = 0; nAttr < nLength; nAttr++ ) 1330*cdf0e10cSrcweir { 1331*cdf0e10cSrcweir rtl::OUString aLocalName; 1332*cdf0e10cSrcweir const rtl::OUString& rValue = xAttrList->getValueByIndex( nAttr ); 1333*cdf0e10cSrcweir /* fixme sven, this needs to be chekced! sal_uInt16 nPrefix = */ GetImport().GetNamespaceMap().GetKeyByAttrName( xAttrList->getNameByIndex( nAttr ), &aLocalName ); 1334*cdf0e10cSrcweir switch( EASGet( aLocalName ) ) 1335*cdf0e10cSrcweir { 1336*cdf0e10cSrcweir case EAS_handle_mirror_vertical : 1337*cdf0e10cSrcweir GetBool( aHandle, rValue, EAS_MirroredY ); 1338*cdf0e10cSrcweir break; 1339*cdf0e10cSrcweir case EAS_handle_mirror_horizontal : 1340*cdf0e10cSrcweir GetBool( aHandle, rValue, EAS_MirroredX ); 1341*cdf0e10cSrcweir break; 1342*cdf0e10cSrcweir case EAS_handle_switched : 1343*cdf0e10cSrcweir GetBool( aHandle, rValue, EAS_Switched ); 1344*cdf0e10cSrcweir break; 1345*cdf0e10cSrcweir case EAS_handle_position : 1346*cdf0e10cSrcweir GetEnhancedParameterPair( aHandle, rValue, EAS_Position ); 1347*cdf0e10cSrcweir break; 1348*cdf0e10cSrcweir case EAS_handle_range_x_minimum : 1349*cdf0e10cSrcweir GetEnhancedParameter( aHandle, rValue, EAS_RangeXMinimum ); 1350*cdf0e10cSrcweir break; 1351*cdf0e10cSrcweir case EAS_handle_range_x_maximum : 1352*cdf0e10cSrcweir GetEnhancedParameter( aHandle, rValue, EAS_RangeXMaximum ); 1353*cdf0e10cSrcweir break; 1354*cdf0e10cSrcweir case EAS_handle_range_y_minimum : 1355*cdf0e10cSrcweir GetEnhancedParameter( aHandle, rValue, EAS_RangeYMinimum ); 1356*cdf0e10cSrcweir break; 1357*cdf0e10cSrcweir case EAS_handle_range_y_maximum : 1358*cdf0e10cSrcweir GetEnhancedParameter( aHandle, rValue, EAS_RangeYMaximum ); 1359*cdf0e10cSrcweir break; 1360*cdf0e10cSrcweir case EAS_handle_polar : 1361*cdf0e10cSrcweir GetEnhancedParameterPair( aHandle, rValue, EAS_Polar ); 1362*cdf0e10cSrcweir break; 1363*cdf0e10cSrcweir case EAS_handle_radius_range_minimum : 1364*cdf0e10cSrcweir GetEnhancedParameter( aHandle, rValue, EAS_RadiusRangeMinimum ); 1365*cdf0e10cSrcweir break; 1366*cdf0e10cSrcweir case EAS_handle_radius_range_maximum : 1367*cdf0e10cSrcweir GetEnhancedParameter( aHandle, rValue, EAS_RadiusRangeMaximum ); 1368*cdf0e10cSrcweir break; 1369*cdf0e10cSrcweir default: 1370*cdf0e10cSrcweir break; 1371*cdf0e10cSrcweir } 1372*cdf0e10cSrcweir } 1373*cdf0e10cSrcweir beans::PropertyValues aPropSeq( aHandle.size() ); 1374*cdf0e10cSrcweir std::vector< beans::PropertyValue >::const_iterator aIter = aHandle.begin(); 1375*cdf0e10cSrcweir std::vector< beans::PropertyValue >::const_iterator aEnd = aHandle.end(); 1376*cdf0e10cSrcweir beans::PropertyValue* pValues = aPropSeq.getArray(); 1377*cdf0e10cSrcweir 1378*cdf0e10cSrcweir while ( aIter != aEnd ) 1379*cdf0e10cSrcweir *pValues++ = *aIter++; 1380*cdf0e10cSrcweir 1381*cdf0e10cSrcweir maHandles.push_back( aPropSeq ); 1382*cdf0e10cSrcweir } 1383*cdf0e10cSrcweir return SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList ); 1384*cdf0e10cSrcweir } 1385