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