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 31*cdf0e10cSrcweir #include <com/sun/star/graphic/XGraphic.hpp> 32*cdf0e10cSrcweir #include <com/sun/star/graphic/XGraphicProvider.hpp> 33*cdf0e10cSrcweir #include <com/sun/star/embed/ElementModes.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/embed/XTransactedObject.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/io/XSeekableInputStream.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/drawing/HomogenMatrix.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/drawing/PolyPolygonShape3D.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/drawing/ProjectionMode.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/drawing/ShadeMode.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/drawing/Direction3D.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/drawing/Position3D.hpp> 42*cdf0e10cSrcweir #include <com/sun/star/drawing/CameraGeometry.hpp> 43*cdf0e10cSrcweir #include <com/sun/star/drawing/DoubleSequence.hpp> 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir #include <com/sun/star/table/XColumnRowRange.hpp> 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir #ifndef _XMLOFF_SHAPEEXPORT_HXX 48*cdf0e10cSrcweir #include <xmloff/shapeexport.hxx> 49*cdf0e10cSrcweir #endif 50*cdf0e10cSrcweir #include "sdpropls.hxx" 51*cdf0e10cSrcweir #include <tools/debug.hxx> 52*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx> 53*cdf0e10cSrcweir #include <xmloff/xmlexp.hxx> 54*cdf0e10cSrcweir #include <xmloff/xmluconv.hxx> 55*cdf0e10cSrcweir #include "xexptran.hxx" 56*cdf0e10cSrcweir #include <xmloff/xmltoken.hxx> 57*cdf0e10cSrcweir #include "EnhancedCustomShapeToken.hxx" 58*cdf0e10cSrcweir #include <com/sun/star/container/XIdentifierContainer.hpp> 59*cdf0e10cSrcweir #include <com/sun/star/drawing/ShadeMode.hpp> 60*cdf0e10cSrcweir #include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp> 61*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_DRAWING_ENHANCEDCUSTOMSHAPEPARAMETERPARI_HPP_ 62*cdf0e10cSrcweir #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> 63*cdf0e10cSrcweir #endif 64*cdf0e10cSrcweir #include <com/sun/star/drawing/EnhancedCustomShapeGluePointType.hpp> 65*cdf0e10cSrcweir #include <com/sun/star/drawing/EnhancedCustomShapeTextFrame.hpp> 66*cdf0e10cSrcweir #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp> 67*cdf0e10cSrcweir #include <com/sun/star/drawing/EnhancedCustomShapeSegmentCommand.hpp> 68*cdf0e10cSrcweir #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp> 69*cdf0e10cSrcweir #include <com/sun/star/drawing/EnhancedCustomShapeTextPathMode.hpp> 70*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyValues.hpp> 71*cdf0e10cSrcweir #include <rtl/math.hxx> 72*cdf0e10cSrcweir #include <tools/string.hxx> 73*cdf0e10cSrcweir #include <basegfx/vector/b3dvector.hxx> 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir #include "xmloff/xmlnmspe.hxx" 76*cdf0e10cSrcweir #include "XMLBase64Export.hxx" 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir using ::rtl::OUString; 79*cdf0e10cSrcweir using ::rtl::OUStringBuffer; 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir using namespace ::com::sun::star; 82*cdf0e10cSrcweir using namespace ::com::sun::star::io; 83*cdf0e10cSrcweir using namespace ::xmloff::token; 84*cdf0e10cSrcweir using namespace ::xmloff::EnhancedCustomShapeToken; 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir using ::com::sun::star::embed::XStorage; 87*cdf0e10cSrcweir using ::com::sun::star::uno::UNO_QUERY; 88*cdf0e10cSrcweir using ::com::sun::star::uno::UNO_QUERY_THROW; 89*cdf0e10cSrcweir using ::com::sun::star::uno::Reference; 90*cdf0e10cSrcweir using ::com::sun::star::uno::Sequence; 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir void ExportParameter( rtl::OUStringBuffer& rStrBuffer, const com::sun::star::drawing::EnhancedCustomShapeParameter& rParameter ) 95*cdf0e10cSrcweir { 96*cdf0e10cSrcweir if ( rStrBuffer.getLength() ) 97*cdf0e10cSrcweir rStrBuffer.append( (sal_Unicode)' ' ); 98*cdf0e10cSrcweir if ( rParameter.Value.getValueTypeClass() == uno::TypeClass_DOUBLE ) 99*cdf0e10cSrcweir { 100*cdf0e10cSrcweir double fNumber = 0.0; 101*cdf0e10cSrcweir rParameter.Value >>= fNumber; 102*cdf0e10cSrcweir ::rtl::math::doubleToUStringBuffer( rStrBuffer, fNumber, rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, '.', sal_True ); 103*cdf0e10cSrcweir } 104*cdf0e10cSrcweir else 105*cdf0e10cSrcweir { 106*cdf0e10cSrcweir sal_Int32 nValue = 0; 107*cdf0e10cSrcweir rParameter.Value >>= nValue; 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir switch( rParameter.Type ) 110*cdf0e10cSrcweir { 111*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeParameterType::EQUATION : 112*cdf0e10cSrcweir { 113*cdf0e10cSrcweir rStrBuffer.append( (sal_Unicode)'?' ); 114*cdf0e10cSrcweir rStrBuffer.append( (sal_Unicode)'f' ); 115*cdf0e10cSrcweir rStrBuffer.append( rtl::OUString::valueOf( nValue ) ); 116*cdf0e10cSrcweir } 117*cdf0e10cSrcweir break; 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeParameterType::ADJUSTMENT : 120*cdf0e10cSrcweir { 121*cdf0e10cSrcweir rStrBuffer.append( (sal_Unicode)'$' ); 122*cdf0e10cSrcweir rStrBuffer.append( rtl::OUString::valueOf( nValue ) ); 123*cdf0e10cSrcweir } 124*cdf0e10cSrcweir break; 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeParameterType::BOTTOM : 127*cdf0e10cSrcweir rStrBuffer.append( GetXMLToken( XML_BOTTOM ) ); break; 128*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeParameterType::RIGHT : 129*cdf0e10cSrcweir rStrBuffer.append( GetXMLToken( XML_RIGHT ) ); break; 130*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeParameterType::TOP : 131*cdf0e10cSrcweir rStrBuffer.append( GetXMLToken( XML_TOP ) ); break; 132*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeParameterType::LEFT : 133*cdf0e10cSrcweir rStrBuffer.append( GetXMLToken( XML_LEFT ) ); break; 134*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeParameterType::XSTRETCH : 135*cdf0e10cSrcweir rStrBuffer.append( GetXMLToken( XML_XSTRETCH ) ); break; 136*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeParameterType::YSTRETCH : 137*cdf0e10cSrcweir rStrBuffer.append( GetXMLToken( XML_YSTRETCH ) ); break; 138*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeParameterType::HASSTROKE : 139*cdf0e10cSrcweir rStrBuffer.append( GetXMLToken( XML_HASSTROKE ) ); break; 140*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeParameterType::HASFILL : 141*cdf0e10cSrcweir rStrBuffer.append( GetXMLToken( XML_HASFILL ) ); break; 142*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeParameterType::WIDTH : 143*cdf0e10cSrcweir rStrBuffer.append( GetXMLToken( XML_WIDTH ) ); break; 144*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeParameterType::HEIGHT : 145*cdf0e10cSrcweir rStrBuffer.append( GetXMLToken( XML_HEIGHT ) ); break; 146*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeParameterType::LOGWIDTH : 147*cdf0e10cSrcweir rStrBuffer.append( GetXMLToken( XML_LOGWIDTH ) ); break; 148*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeParameterType::LOGHEIGHT : 149*cdf0e10cSrcweir rStrBuffer.append( GetXMLToken( XML_LOGHEIGHT ) ); break; 150*cdf0e10cSrcweir default : 151*cdf0e10cSrcweir rStrBuffer.append( rtl::OUString::valueOf( nValue ) ); 152*cdf0e10cSrcweir } 153*cdf0e10cSrcweir } 154*cdf0e10cSrcweir } 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir void ImpExportEquations( SvXMLExport& rExport, const uno::Sequence< rtl::OUString >& rEquations ) 157*cdf0e10cSrcweir { 158*cdf0e10cSrcweir sal_Int32 i; 159*cdf0e10cSrcweir for ( i = 0; i < rEquations.getLength(); i++ ) 160*cdf0e10cSrcweir { 161*cdf0e10cSrcweir rtl::OUString aStr( String( 'f' ) ); 162*cdf0e10cSrcweir aStr += rtl::OUString::valueOf( i ); 163*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aStr ); 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir aStr = rEquations[ i ]; 166*cdf0e10cSrcweir sal_Int32 nIndex = 0; 167*cdf0e10cSrcweir do 168*cdf0e10cSrcweir { 169*cdf0e10cSrcweir nIndex = aStr.indexOf( (sal_Unicode)'?', nIndex ); 170*cdf0e10cSrcweir if ( nIndex != -1 ) 171*cdf0e10cSrcweir { 172*cdf0e10cSrcweir rtl::OUString aNew( aStr.copy( 0, nIndex + 1 ) ); 173*cdf0e10cSrcweir aNew += String( 'f' ); 174*cdf0e10cSrcweir aNew += aStr.copy( nIndex + 1, ( aStr.getLength() - nIndex ) - 1 ); 175*cdf0e10cSrcweir aStr = aNew; 176*cdf0e10cSrcweir nIndex++; 177*cdf0e10cSrcweir } 178*cdf0e10cSrcweir } while( nIndex != -1 ); 179*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_FORMULA, aStr ); 180*cdf0e10cSrcweir SvXMLElementExport aOBJ( rExport, XML_NAMESPACE_DRAW, XML_EQUATION, sal_True, sal_True ); 181*cdf0e10cSrcweir } 182*cdf0e10cSrcweir } 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir void ImpExportHandles( SvXMLExport& rExport, const uno::Sequence< beans::PropertyValues >& rHandles ) 185*cdf0e10cSrcweir { 186*cdf0e10cSrcweir sal_uInt32 i, j, nElements = rHandles.getLength(); 187*cdf0e10cSrcweir if ( nElements ) 188*cdf0e10cSrcweir { 189*cdf0e10cSrcweir rtl::OUString aStr; 190*cdf0e10cSrcweir rtl::OUStringBuffer aStrBuffer; 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir for ( i = 0; i < nElements; i++ ) 193*cdf0e10cSrcweir { 194*cdf0e10cSrcweir sal_Bool bPosition = sal_False; 195*cdf0e10cSrcweir const uno::Sequence< beans::PropertyValue >& rPropSeq = rHandles[ i ]; 196*cdf0e10cSrcweir for ( j = 0; j < (sal_uInt32)rPropSeq.getLength(); j++ ) 197*cdf0e10cSrcweir { 198*cdf0e10cSrcweir const beans::PropertyValue& rPropVal = rPropSeq[ j ]; 199*cdf0e10cSrcweir switch( EASGet( rPropVal.Name ) ) 200*cdf0e10cSrcweir { 201*cdf0e10cSrcweir case EAS_Position : 202*cdf0e10cSrcweir { 203*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeParameterPair aPosition; 204*cdf0e10cSrcweir if ( rPropVal.Value >>= aPosition ) 205*cdf0e10cSrcweir { 206*cdf0e10cSrcweir ExportParameter( aStrBuffer, aPosition.First ); 207*cdf0e10cSrcweir ExportParameter( aStrBuffer, aPosition.Second ); 208*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 209*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_POSITION, aStr ); 210*cdf0e10cSrcweir bPosition = sal_True; 211*cdf0e10cSrcweir } 212*cdf0e10cSrcweir } 213*cdf0e10cSrcweir break; 214*cdf0e10cSrcweir case EAS_MirroredX : 215*cdf0e10cSrcweir { 216*cdf0e10cSrcweir sal_Bool bMirroredX = sal_Bool(); 217*cdf0e10cSrcweir if ( rPropVal.Value >>= bMirroredX ) 218*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_MIRROR_HORIZONTAL, 219*cdf0e10cSrcweir bMirroredX ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) ); 220*cdf0e10cSrcweir } 221*cdf0e10cSrcweir break; 222*cdf0e10cSrcweir case EAS_MirroredY : 223*cdf0e10cSrcweir { 224*cdf0e10cSrcweir sal_Bool bMirroredY = sal_Bool(); 225*cdf0e10cSrcweir if ( rPropVal.Value >>= bMirroredY ) 226*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_MIRROR_VERTICAL, 227*cdf0e10cSrcweir bMirroredY ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) ); 228*cdf0e10cSrcweir } 229*cdf0e10cSrcweir break; 230*cdf0e10cSrcweir case EAS_Switched : 231*cdf0e10cSrcweir { 232*cdf0e10cSrcweir sal_Bool bSwitched = sal_Bool(); 233*cdf0e10cSrcweir if ( rPropVal.Value >>= bSwitched ) 234*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_SWITCHED, 235*cdf0e10cSrcweir bSwitched ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) ); 236*cdf0e10cSrcweir } 237*cdf0e10cSrcweir break; 238*cdf0e10cSrcweir case EAS_Polar : 239*cdf0e10cSrcweir { 240*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeParameterPair aPolar; 241*cdf0e10cSrcweir if ( rPropVal.Value >>= aPolar ) 242*cdf0e10cSrcweir { 243*cdf0e10cSrcweir ExportParameter( aStrBuffer, aPolar.First ); 244*cdf0e10cSrcweir ExportParameter( aStrBuffer, aPolar.Second ); 245*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 246*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_POLAR, aStr ); 247*cdf0e10cSrcweir } 248*cdf0e10cSrcweir } 249*cdf0e10cSrcweir break; 250*cdf0e10cSrcweir case EAS_RadiusRangeMinimum : 251*cdf0e10cSrcweir { 252*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMinimum; 253*cdf0e10cSrcweir if ( rPropVal.Value >>= aRadiusRangeMinimum ) 254*cdf0e10cSrcweir { 255*cdf0e10cSrcweir ExportParameter( aStrBuffer, aRadiusRangeMinimum ); 256*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 257*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_RADIUS_RANGE_MINIMUM, aStr ); 258*cdf0e10cSrcweir } 259*cdf0e10cSrcweir } 260*cdf0e10cSrcweir break; 261*cdf0e10cSrcweir case EAS_RadiusRangeMaximum : 262*cdf0e10cSrcweir { 263*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeParameter aRadiusRangeMaximum; 264*cdf0e10cSrcweir if ( rPropVal.Value >>= aRadiusRangeMaximum ) 265*cdf0e10cSrcweir { 266*cdf0e10cSrcweir ExportParameter( aStrBuffer, aRadiusRangeMaximum ); 267*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 268*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_RADIUS_RANGE_MAXIMUM, aStr ); 269*cdf0e10cSrcweir } 270*cdf0e10cSrcweir } 271*cdf0e10cSrcweir break; 272*cdf0e10cSrcweir case EAS_RangeXMinimum : 273*cdf0e10cSrcweir { 274*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeParameter aXRangeMinimum; 275*cdf0e10cSrcweir if ( rPropVal.Value >>= aXRangeMinimum ) 276*cdf0e10cSrcweir { 277*cdf0e10cSrcweir ExportParameter( aStrBuffer, aXRangeMinimum ); 278*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 279*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_RANGE_X_MINIMUM, aStr ); 280*cdf0e10cSrcweir } 281*cdf0e10cSrcweir } 282*cdf0e10cSrcweir break; 283*cdf0e10cSrcweir case EAS_RangeXMaximum : 284*cdf0e10cSrcweir { 285*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeParameter aXRangeMaximum; 286*cdf0e10cSrcweir if ( rPropVal.Value >>= aXRangeMaximum ) 287*cdf0e10cSrcweir { 288*cdf0e10cSrcweir ExportParameter( aStrBuffer, aXRangeMaximum ); 289*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 290*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_RANGE_X_MAXIMUM, aStr ); 291*cdf0e10cSrcweir } 292*cdf0e10cSrcweir } 293*cdf0e10cSrcweir break; 294*cdf0e10cSrcweir case EAS_RangeYMinimum : 295*cdf0e10cSrcweir { 296*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeParameter aYRangeMinimum; 297*cdf0e10cSrcweir if ( rPropVal.Value >>= aYRangeMinimum ) 298*cdf0e10cSrcweir { 299*cdf0e10cSrcweir ExportParameter( aStrBuffer, aYRangeMinimum ); 300*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 301*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_RANGE_Y_MINIMUM, aStr ); 302*cdf0e10cSrcweir } 303*cdf0e10cSrcweir } 304*cdf0e10cSrcweir break; 305*cdf0e10cSrcweir case EAS_RangeYMaximum : 306*cdf0e10cSrcweir { 307*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeParameter aYRangeMaximum; 308*cdf0e10cSrcweir if ( rPropVal.Value >>= aYRangeMaximum ) 309*cdf0e10cSrcweir { 310*cdf0e10cSrcweir ExportParameter( aStrBuffer, aYRangeMaximum ); 311*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 312*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_HANDLE_RANGE_Y_MAXIMUM, aStr ); 313*cdf0e10cSrcweir } 314*cdf0e10cSrcweir } 315*cdf0e10cSrcweir break; 316*cdf0e10cSrcweir default: 317*cdf0e10cSrcweir break; 318*cdf0e10cSrcweir } 319*cdf0e10cSrcweir } 320*cdf0e10cSrcweir if ( bPosition ) 321*cdf0e10cSrcweir SvXMLElementExport aOBJ( rExport, XML_NAMESPACE_DRAW, XML_HANDLE, sal_True, sal_True ); 322*cdf0e10cSrcweir else 323*cdf0e10cSrcweir rExport.ClearAttrList(); 324*cdf0e10cSrcweir } 325*cdf0e10cSrcweir } 326*cdf0e10cSrcweir } 327*cdf0e10cSrcweir 328*cdf0e10cSrcweir void ImpExportEnhancedPath( SvXMLExport& rExport, 329*cdf0e10cSrcweir const uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair >& rCoordinates, 330*cdf0e10cSrcweir const uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment >& rSegments ) 331*cdf0e10cSrcweir { 332*cdf0e10cSrcweir 333*cdf0e10cSrcweir rtl::OUString aStr; 334*cdf0e10cSrcweir rtl::OUStringBuffer aStrBuffer; 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir sal_Int32 i, j, k, l; 337*cdf0e10cSrcweir 338*cdf0e10cSrcweir sal_Int32 nCoords = rCoordinates.getLength(); 339*cdf0e10cSrcweir sal_Int32 nSegments = rSegments.getLength(); 340*cdf0e10cSrcweir sal_Bool bSimpleSegments = nSegments == 0; 341*cdf0e10cSrcweir if ( bSimpleSegments ) 342*cdf0e10cSrcweir nSegments = 4; 343*cdf0e10cSrcweir for ( j = i = 0; j < nSegments; j++ ) 344*cdf0e10cSrcweir { 345*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeSegment aSegment; 346*cdf0e10cSrcweir if ( bSimpleSegments ) 347*cdf0e10cSrcweir { 348*cdf0e10cSrcweir // if there are not enough segments we will default them 349*cdf0e10cSrcweir switch( j ) 350*cdf0e10cSrcweir { 351*cdf0e10cSrcweir case 0 : 352*cdf0e10cSrcweir { 353*cdf0e10cSrcweir aSegment.Count = 1; 354*cdf0e10cSrcweir aSegment.Command = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::MOVETO; 355*cdf0e10cSrcweir } 356*cdf0e10cSrcweir break; 357*cdf0e10cSrcweir case 1 : 358*cdf0e10cSrcweir { 359*cdf0e10cSrcweir aSegment.Count = (sal_Int16)Min( nCoords - 1, (sal_Int32)32767 ); 360*cdf0e10cSrcweir aSegment.Command = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::LINETO; 361*cdf0e10cSrcweir } 362*cdf0e10cSrcweir break; 363*cdf0e10cSrcweir case 2 : 364*cdf0e10cSrcweir { 365*cdf0e10cSrcweir aSegment.Count = 1; 366*cdf0e10cSrcweir aSegment.Command = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH; 367*cdf0e10cSrcweir } 368*cdf0e10cSrcweir break; 369*cdf0e10cSrcweir case 3 : 370*cdf0e10cSrcweir { 371*cdf0e10cSrcweir aSegment.Count = 1; 372*cdf0e10cSrcweir aSegment.Command = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH; 373*cdf0e10cSrcweir } 374*cdf0e10cSrcweir break; 375*cdf0e10cSrcweir } 376*cdf0e10cSrcweir } 377*cdf0e10cSrcweir else 378*cdf0e10cSrcweir aSegment = rSegments[ j ]; 379*cdf0e10cSrcweir 380*cdf0e10cSrcweir if ( aStrBuffer.getLength() ) 381*cdf0e10cSrcweir aStrBuffer.append( (sal_Unicode)' ' ); 382*cdf0e10cSrcweir 383*cdf0e10cSrcweir sal_Int32 nParameter = 0; 384*cdf0e10cSrcweir switch( aSegment.Command ) 385*cdf0e10cSrcweir { 386*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOSESUBPATH : 387*cdf0e10cSrcweir aStrBuffer.append( (sal_Unicode)'Z' ); break; 388*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ENDSUBPATH : 389*cdf0e10cSrcweir aStrBuffer.append( (sal_Unicode)'N' ); break; 390*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::NOFILL : 391*cdf0e10cSrcweir aStrBuffer.append( (sal_Unicode)'F' ); break; 392*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::NOSTROKE : 393*cdf0e10cSrcweir aStrBuffer.append( (sal_Unicode)'S' ); break; 394*cdf0e10cSrcweir 395*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::MOVETO : 396*cdf0e10cSrcweir aStrBuffer.append( (sal_Unicode)'M' ); nParameter = 1; break; 397*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::LINETO : 398*cdf0e10cSrcweir aStrBuffer.append( (sal_Unicode)'L' ); nParameter = 1; break; 399*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CURVETO : 400*cdf0e10cSrcweir aStrBuffer.append( (sal_Unicode)'C' ); nParameter = 3; break; 401*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSETO : 402*cdf0e10cSrcweir aStrBuffer.append( (sal_Unicode)'T' ); nParameter = 3; break; 403*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ANGLEELLIPSE : 404*cdf0e10cSrcweir aStrBuffer.append( (sal_Unicode)'U' ); nParameter = 3; break; 405*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ARCTO : 406*cdf0e10cSrcweir aStrBuffer.append( (sal_Unicode)'A' ); nParameter = 4; break; 407*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ARC : 408*cdf0e10cSrcweir aStrBuffer.append( (sal_Unicode)'B' ); nParameter = 4; break; 409*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARCTO : 410*cdf0e10cSrcweir aStrBuffer.append( (sal_Unicode)'W' ); nParameter = 4; break; 411*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::CLOCKWISEARC : 412*cdf0e10cSrcweir aStrBuffer.append( (sal_Unicode)'V' ); nParameter = 4; break; 413*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTX : 414*cdf0e10cSrcweir aStrBuffer.append( (sal_Unicode)'X' ); nParameter = 1; break; 415*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::ELLIPTICALQUADRANTY : 416*cdf0e10cSrcweir aStrBuffer.append( (sal_Unicode)'Y' ); nParameter = 1; break; 417*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::QUADRATICCURVETO : 418*cdf0e10cSrcweir aStrBuffer.append( (sal_Unicode)'Q' ); nParameter = 2; break; 419*cdf0e10cSrcweir 420*cdf0e10cSrcweir default : // ups, seems to be something wrong 421*cdf0e10cSrcweir { 422*cdf0e10cSrcweir aSegment.Count = 1; 423*cdf0e10cSrcweir aSegment.Command = com::sun::star::drawing::EnhancedCustomShapeSegmentCommand::LINETO; 424*cdf0e10cSrcweir } 425*cdf0e10cSrcweir break; 426*cdf0e10cSrcweir } 427*cdf0e10cSrcweir if ( nParameter ) 428*cdf0e10cSrcweir { 429*cdf0e10cSrcweir for ( k = 0; k < aSegment.Count; k++ ) 430*cdf0e10cSrcweir { 431*cdf0e10cSrcweir if ( ( i + nParameter ) <= nCoords ) 432*cdf0e10cSrcweir { 433*cdf0e10cSrcweir for ( l = 0; l < nParameter; l++ ) 434*cdf0e10cSrcweir { 435*cdf0e10cSrcweir ExportParameter( aStrBuffer, rCoordinates[ i ].First ); 436*cdf0e10cSrcweir ExportParameter( aStrBuffer, rCoordinates[ i++ ].Second ); 437*cdf0e10cSrcweir } 438*cdf0e10cSrcweir } 439*cdf0e10cSrcweir else 440*cdf0e10cSrcweir { 441*cdf0e10cSrcweir j = nSegments; // error -> exiting 442*cdf0e10cSrcweir break; 443*cdf0e10cSrcweir } 444*cdf0e10cSrcweir } 445*cdf0e10cSrcweir } 446*cdf0e10cSrcweir } 447*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 448*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_ENHANCED_PATH, aStr ); 449*cdf0e10cSrcweir } 450*cdf0e10cSrcweir 451*cdf0e10cSrcweir void ImpExportEnhancedGeometry( SvXMLExport& rExport, const uno::Reference< beans::XPropertySet >& xPropSet ) 452*cdf0e10cSrcweir { 453*cdf0e10cSrcweir sal_Bool bEquations = sal_False; 454*cdf0e10cSrcweir uno::Sequence< rtl::OUString > aEquations; 455*cdf0e10cSrcweir 456*cdf0e10cSrcweir sal_Bool bHandles = sal_False; 457*cdf0e10cSrcweir uno::Sequence< beans::PropertyValues > aHandles; 458*cdf0e10cSrcweir 459*cdf0e10cSrcweir sal_Bool bCoordinates = sal_False; 460*cdf0e10cSrcweir uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeSegment > aSegments; 461*cdf0e10cSrcweir uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair > aCoordinates; 462*cdf0e10cSrcweir 463*cdf0e10cSrcweir uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue > aAdjustmentValues; 464*cdf0e10cSrcweir 465*cdf0e10cSrcweir rtl::OUString aStr; 466*cdf0e10cSrcweir rtl::OUStringBuffer aStrBuffer; 467*cdf0e10cSrcweir SvXMLUnitConverter& rUnitConverter = rExport.GetMM100UnitConverter(); 468*cdf0e10cSrcweir 469*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() ); 470*cdf0e10cSrcweir 471*cdf0e10cSrcweir // geometry 472*cdf0e10cSrcweir const rtl::OUString sCustomShapeGeometry( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeGeometry" ) ); 473*cdf0e10cSrcweir if ( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName( sCustomShapeGeometry ) ) 474*cdf0e10cSrcweir { 475*cdf0e10cSrcweir uno::Any aGeoPropSet( xPropSet->getPropertyValue( sCustomShapeGeometry ) ); 476*cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aGeoPropSeq; 477*cdf0e10cSrcweir 478*cdf0e10cSrcweir if ( aGeoPropSet >>= aGeoPropSeq ) 479*cdf0e10cSrcweir { 480*cdf0e10cSrcweir const rtl::OUString sCustomShapeType( RTL_CONSTASCII_USTRINGPARAM( "NonPrimitive" ) ); 481*cdf0e10cSrcweir rtl::OUString aCustomShapeType( sCustomShapeType ); 482*cdf0e10cSrcweir 483*cdf0e10cSrcweir sal_Int32 j, nGeoPropCount = aGeoPropSeq.getLength(); 484*cdf0e10cSrcweir for ( j = 0; j < nGeoPropCount; j++ ) 485*cdf0e10cSrcweir { 486*cdf0e10cSrcweir const beans::PropertyValue& rGeoProp = aGeoPropSeq[ j ]; 487*cdf0e10cSrcweir switch( EASGet( rGeoProp.Name ) ) 488*cdf0e10cSrcweir { 489*cdf0e10cSrcweir case EAS_Type : 490*cdf0e10cSrcweir { 491*cdf0e10cSrcweir rGeoProp.Value >>= aCustomShapeType; 492*cdf0e10cSrcweir } 493*cdf0e10cSrcweir break; 494*cdf0e10cSrcweir case EAS_MirroredX : 495*cdf0e10cSrcweir { 496*cdf0e10cSrcweir sal_Bool bMirroredX = sal_Bool(); 497*cdf0e10cSrcweir if ( rGeoProp.Value >>= bMirroredX ) 498*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIRROR_HORIZONTAL, 499*cdf0e10cSrcweir bMirroredX ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) ); 500*cdf0e10cSrcweir } 501*cdf0e10cSrcweir break; 502*cdf0e10cSrcweir case EAS_MirroredY : 503*cdf0e10cSrcweir { 504*cdf0e10cSrcweir sal_Bool bMirroredY = sal_Bool(); 505*cdf0e10cSrcweir if ( rGeoProp.Value >>= bMirroredY ) 506*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIRROR_VERTICAL, 507*cdf0e10cSrcweir bMirroredY ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) ); 508*cdf0e10cSrcweir } 509*cdf0e10cSrcweir break; 510*cdf0e10cSrcweir case EAS_ViewBox : 511*cdf0e10cSrcweir { 512*cdf0e10cSrcweir awt::Rectangle aRect; 513*cdf0e10cSrcweir if ( rGeoProp.Value >>= aRect ) 514*cdf0e10cSrcweir { 515*cdf0e10cSrcweir SdXMLImExViewBox aViewBox( aRect.X, aRect.Y, aRect.Width, aRect.Height ); 516*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString() ); 517*cdf0e10cSrcweir } 518*cdf0e10cSrcweir } 519*cdf0e10cSrcweir break; 520*cdf0e10cSrcweir case EAS_TextRotateAngle : 521*cdf0e10cSrcweir { 522*cdf0e10cSrcweir double fTextRotateAngle = 0; 523*cdf0e10cSrcweir if ( rGeoProp.Value >>= fTextRotateAngle ) 524*cdf0e10cSrcweir { 525*cdf0e10cSrcweir rUnitConverter.convertDouble( aStrBuffer, fTextRotateAngle ); 526*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 527*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_ROTATE_ANGLE, aStr ); 528*cdf0e10cSrcweir } 529*cdf0e10cSrcweir } 530*cdf0e10cSrcweir break; 531*cdf0e10cSrcweir case EAS_Extrusion : 532*cdf0e10cSrcweir { 533*cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aExtrusionPropSeq; 534*cdf0e10cSrcweir if ( rGeoProp.Value >>= aExtrusionPropSeq ) 535*cdf0e10cSrcweir { 536*cdf0e10cSrcweir sal_Int32 i, nCount = aExtrusionPropSeq.getLength(); 537*cdf0e10cSrcweir for ( i = 0; i < nCount; i++ ) 538*cdf0e10cSrcweir { 539*cdf0e10cSrcweir const beans::PropertyValue& rProp = aExtrusionPropSeq[ i ]; 540*cdf0e10cSrcweir switch( EASGet( rProp.Name ) ) 541*cdf0e10cSrcweir { 542*cdf0e10cSrcweir case EAS_Extrusion : 543*cdf0e10cSrcweir { 544*cdf0e10cSrcweir sal_Bool bExtrusionOn = sal_Bool(); 545*cdf0e10cSrcweir if ( rProp.Value >>= bExtrusionOn ) 546*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION, 547*cdf0e10cSrcweir bExtrusionOn ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) ); 548*cdf0e10cSrcweir } 549*cdf0e10cSrcweir break; 550*cdf0e10cSrcweir case EAS_Brightness : 551*cdf0e10cSrcweir { 552*cdf0e10cSrcweir double fExtrusionBrightness = 0; 553*cdf0e10cSrcweir if ( rProp.Value >>= fExtrusionBrightness ) 554*cdf0e10cSrcweir { 555*cdf0e10cSrcweir rUnitConverter.convertDouble( aStrBuffer, fExtrusionBrightness, sal_False, MAP_RELATIVE, MAP_RELATIVE ); 556*cdf0e10cSrcweir aStrBuffer.append( (sal_Unicode)'%' ); 557*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 558*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_BRIGHTNESS, aStr ); 559*cdf0e10cSrcweir } 560*cdf0e10cSrcweir } 561*cdf0e10cSrcweir break; 562*cdf0e10cSrcweir case EAS_Depth : 563*cdf0e10cSrcweir { 564*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeParameterPair aDepthParaPair; 565*cdf0e10cSrcweir if ( rProp.Value >>= aDepthParaPair ) 566*cdf0e10cSrcweir { 567*cdf0e10cSrcweir double fDepth = 0; 568*cdf0e10cSrcweir if ( aDepthParaPair.First.Value >>= fDepth ) 569*cdf0e10cSrcweir { 570*cdf0e10cSrcweir rExport.GetMM100UnitConverter().convertDouble( aStrBuffer, fDepth, sal_True ); 571*cdf0e10cSrcweir ExportParameter( aStrBuffer, aDepthParaPair.Second ); 572*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 573*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_DEPTH, aStr ); 574*cdf0e10cSrcweir } 575*cdf0e10cSrcweir } 576*cdf0e10cSrcweir } 577*cdf0e10cSrcweir break; 578*cdf0e10cSrcweir case EAS_Diffusion : 579*cdf0e10cSrcweir { 580*cdf0e10cSrcweir double fExtrusionDiffusion = 0; 581*cdf0e10cSrcweir if ( rProp.Value >>= fExtrusionDiffusion ) 582*cdf0e10cSrcweir { 583*cdf0e10cSrcweir rUnitConverter.convertDouble( aStrBuffer, fExtrusionDiffusion, sal_False, MAP_RELATIVE, MAP_RELATIVE ); 584*cdf0e10cSrcweir aStrBuffer.append( (sal_Unicode)'%' ); 585*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 586*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_DIFFUSION, aStr ); 587*cdf0e10cSrcweir } 588*cdf0e10cSrcweir } 589*cdf0e10cSrcweir break; 590*cdf0e10cSrcweir case EAS_NumberOfLineSegments : 591*cdf0e10cSrcweir { 592*cdf0e10cSrcweir sal_Int32 nExtrusionNumberOfLineSegments = 0; 593*cdf0e10cSrcweir if ( rProp.Value >>= nExtrusionNumberOfLineSegments ) 594*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_NUMBER_OF_LINE_SEGMENTS, rtl::OUString::valueOf( nExtrusionNumberOfLineSegments ) ); 595*cdf0e10cSrcweir } 596*cdf0e10cSrcweir break; 597*cdf0e10cSrcweir case EAS_LightFace : 598*cdf0e10cSrcweir { 599*cdf0e10cSrcweir sal_Bool bExtrusionLightFace = sal_Bool(); 600*cdf0e10cSrcweir if ( rProp.Value >>= bExtrusionLightFace ) 601*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_LIGHT_FACE, 602*cdf0e10cSrcweir bExtrusionLightFace ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) ); 603*cdf0e10cSrcweir } 604*cdf0e10cSrcweir break; 605*cdf0e10cSrcweir case EAS_FirstLightHarsh : 606*cdf0e10cSrcweir { 607*cdf0e10cSrcweir sal_Bool bExtrusionFirstLightHarsh = sal_Bool(); 608*cdf0e10cSrcweir if ( rProp.Value >>= bExtrusionFirstLightHarsh ) 609*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_FIRST_LIGHT_HARSH, 610*cdf0e10cSrcweir bExtrusionFirstLightHarsh ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) ); 611*cdf0e10cSrcweir } 612*cdf0e10cSrcweir break; 613*cdf0e10cSrcweir case EAS_SecondLightHarsh : 614*cdf0e10cSrcweir { 615*cdf0e10cSrcweir sal_Bool bExtrusionSecondLightHarsh = sal_Bool(); 616*cdf0e10cSrcweir if ( rProp.Value >>= bExtrusionSecondLightHarsh ) 617*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SECOND_LIGHT_HARSH, 618*cdf0e10cSrcweir bExtrusionSecondLightHarsh ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) ); 619*cdf0e10cSrcweir } 620*cdf0e10cSrcweir break; 621*cdf0e10cSrcweir case EAS_FirstLightLevel : 622*cdf0e10cSrcweir { 623*cdf0e10cSrcweir double fExtrusionFirstLightLevel = 0; 624*cdf0e10cSrcweir if ( rProp.Value >>= fExtrusionFirstLightLevel ) 625*cdf0e10cSrcweir { 626*cdf0e10cSrcweir rUnitConverter.convertDouble( aStrBuffer, fExtrusionFirstLightLevel, sal_False, MAP_RELATIVE, MAP_RELATIVE ); 627*cdf0e10cSrcweir aStrBuffer.append( (sal_Unicode)'%' ); 628*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 629*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_FIRST_LIGHT_LEVEL, aStr ); 630*cdf0e10cSrcweir } 631*cdf0e10cSrcweir } 632*cdf0e10cSrcweir break; 633*cdf0e10cSrcweir case EAS_SecondLightLevel : 634*cdf0e10cSrcweir { 635*cdf0e10cSrcweir double fExtrusionSecondLightLevel = 0; 636*cdf0e10cSrcweir if ( rProp.Value >>= fExtrusionSecondLightLevel ) 637*cdf0e10cSrcweir { 638*cdf0e10cSrcweir rUnitConverter.convertDouble( aStrBuffer, fExtrusionSecondLightLevel, sal_False, MAP_RELATIVE, MAP_RELATIVE ); 639*cdf0e10cSrcweir aStrBuffer.append( (sal_Unicode)'%' ); 640*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 641*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SECOND_LIGHT_LEVEL, aStr ); 642*cdf0e10cSrcweir } 643*cdf0e10cSrcweir } 644*cdf0e10cSrcweir break; 645*cdf0e10cSrcweir case EAS_FirstLightDirection : 646*cdf0e10cSrcweir { 647*cdf0e10cSrcweir drawing::Direction3D aExtrusionFirstLightDirection; 648*cdf0e10cSrcweir if ( rProp.Value >>= aExtrusionFirstLightDirection ) 649*cdf0e10cSrcweir { 650*cdf0e10cSrcweir ::basegfx::B3DVector aVec3D( aExtrusionFirstLightDirection.DirectionX, aExtrusionFirstLightDirection.DirectionY, 651*cdf0e10cSrcweir aExtrusionFirstLightDirection.DirectionZ ); 652*cdf0e10cSrcweir rUnitConverter.convertB3DVector( aStrBuffer, aVec3D ); 653*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 654*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_FIRST_LIGHT_DIRECTION, aStr ); 655*cdf0e10cSrcweir } 656*cdf0e10cSrcweir } 657*cdf0e10cSrcweir break; 658*cdf0e10cSrcweir case EAS_SecondLightDirection : 659*cdf0e10cSrcweir { 660*cdf0e10cSrcweir drawing::Direction3D aExtrusionSecondLightDirection; 661*cdf0e10cSrcweir if ( rProp.Value >>= aExtrusionSecondLightDirection ) 662*cdf0e10cSrcweir { 663*cdf0e10cSrcweir ::basegfx::B3DVector aVec3D( aExtrusionSecondLightDirection.DirectionX, aExtrusionSecondLightDirection.DirectionY, 664*cdf0e10cSrcweir aExtrusionSecondLightDirection.DirectionZ ); 665*cdf0e10cSrcweir rUnitConverter.convertB3DVector( aStrBuffer, aVec3D ); 666*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 667*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SECOND_LIGHT_DIRECTION, aStr ); 668*cdf0e10cSrcweir } 669*cdf0e10cSrcweir } 670*cdf0e10cSrcweir break; 671*cdf0e10cSrcweir case EAS_Metal : 672*cdf0e10cSrcweir { 673*cdf0e10cSrcweir sal_Bool bExtrusionMetal = sal_Bool(); 674*cdf0e10cSrcweir if ( rProp.Value >>= bExtrusionMetal ) 675*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_METAL, 676*cdf0e10cSrcweir bExtrusionMetal ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) ); 677*cdf0e10cSrcweir } 678*cdf0e10cSrcweir break; 679*cdf0e10cSrcweir case EAS_ShadeMode : 680*cdf0e10cSrcweir { 681*cdf0e10cSrcweir // shadeMode 682*cdf0e10cSrcweir drawing::ShadeMode eShadeMode; 683*cdf0e10cSrcweir if( rProp.Value >>= eShadeMode ) 684*cdf0e10cSrcweir { 685*cdf0e10cSrcweir if( eShadeMode == drawing::ShadeMode_FLAT ) 686*cdf0e10cSrcweir aStr = GetXMLToken( XML_FLAT ); 687*cdf0e10cSrcweir else if( eShadeMode == drawing::ShadeMode_PHONG ) 688*cdf0e10cSrcweir aStr = GetXMLToken( XML_PHONG ); 689*cdf0e10cSrcweir else if( eShadeMode == drawing::ShadeMode_SMOOTH ) 690*cdf0e10cSrcweir aStr = GetXMLToken( XML_GOURAUD ); 691*cdf0e10cSrcweir else 692*cdf0e10cSrcweir aStr = GetXMLToken( XML_DRAFT ); 693*cdf0e10cSrcweir } 694*cdf0e10cSrcweir else 695*cdf0e10cSrcweir { 696*cdf0e10cSrcweir // ShadeMode enum not there, write default 697*cdf0e10cSrcweir aStr = GetXMLToken( XML_FLAT); 698*cdf0e10cSrcweir } 699*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DR3D, XML_SHADE_MODE, aStr ); 700*cdf0e10cSrcweir } 701*cdf0e10cSrcweir break; 702*cdf0e10cSrcweir case EAS_RotateAngle : 703*cdf0e10cSrcweir { 704*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeParameterPair aRotateAngleParaPair; 705*cdf0e10cSrcweir if ( rProp.Value >>= aRotateAngleParaPair ) 706*cdf0e10cSrcweir { 707*cdf0e10cSrcweir ExportParameter( aStrBuffer, aRotateAngleParaPair.First ); 708*cdf0e10cSrcweir ExportParameter( aStrBuffer, aRotateAngleParaPair.Second ); 709*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 710*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_ROTATION_ANGLE, aStr ); 711*cdf0e10cSrcweir } 712*cdf0e10cSrcweir } 713*cdf0e10cSrcweir break; 714*cdf0e10cSrcweir case EAS_RotationCenter : 715*cdf0e10cSrcweir { 716*cdf0e10cSrcweir drawing::Direction3D aExtrusionRotationCenter; 717*cdf0e10cSrcweir if ( rProp.Value >>= aExtrusionRotationCenter ) 718*cdf0e10cSrcweir { 719*cdf0e10cSrcweir ::basegfx::B3DVector aVec3D( aExtrusionRotationCenter.DirectionX, aExtrusionRotationCenter.DirectionY, 720*cdf0e10cSrcweir aExtrusionRotationCenter.DirectionZ ); 721*cdf0e10cSrcweir rUnitConverter.convertB3DVector( aStrBuffer, aVec3D ); 722*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 723*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_ROTATION_CENTER, aStr ); 724*cdf0e10cSrcweir } 725*cdf0e10cSrcweir } 726*cdf0e10cSrcweir break; 727*cdf0e10cSrcweir case EAS_Shininess : 728*cdf0e10cSrcweir { 729*cdf0e10cSrcweir double fExtrusionShininess = 0; 730*cdf0e10cSrcweir if ( rProp.Value >>= fExtrusionShininess ) 731*cdf0e10cSrcweir { 732*cdf0e10cSrcweir rUnitConverter.convertDouble( aStrBuffer, fExtrusionShininess, sal_False, MAP_RELATIVE, MAP_RELATIVE ); 733*cdf0e10cSrcweir aStrBuffer.append( (sal_Unicode)'%' ); 734*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 735*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SHININESS, aStr ); 736*cdf0e10cSrcweir } 737*cdf0e10cSrcweir } 738*cdf0e10cSrcweir break; 739*cdf0e10cSrcweir case EAS_Skew : 740*cdf0e10cSrcweir { 741*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeParameterPair aSkewParaPair; 742*cdf0e10cSrcweir if ( rProp.Value >>= aSkewParaPair ) 743*cdf0e10cSrcweir { 744*cdf0e10cSrcweir ExportParameter( aStrBuffer, aSkewParaPair.First ); 745*cdf0e10cSrcweir ExportParameter( aStrBuffer, aSkewParaPair.Second ); 746*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 747*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SKEW, aStr ); 748*cdf0e10cSrcweir } 749*cdf0e10cSrcweir } 750*cdf0e10cSrcweir break; 751*cdf0e10cSrcweir case EAS_Specularity : 752*cdf0e10cSrcweir { 753*cdf0e10cSrcweir double fExtrusionSpecularity = 0; 754*cdf0e10cSrcweir if ( rProp.Value >>= fExtrusionSpecularity ) 755*cdf0e10cSrcweir { 756*cdf0e10cSrcweir rUnitConverter.convertDouble( aStrBuffer, fExtrusionSpecularity, sal_False, MAP_RELATIVE, MAP_RELATIVE ); 757*cdf0e10cSrcweir aStrBuffer.append( (sal_Unicode)'%' ); 758*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 759*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_SPECULARITY, aStr ); 760*cdf0e10cSrcweir } 761*cdf0e10cSrcweir } 762*cdf0e10cSrcweir break; 763*cdf0e10cSrcweir case EAS_ProjectionMode : 764*cdf0e10cSrcweir { 765*cdf0e10cSrcweir drawing::ProjectionMode eProjectionMode; 766*cdf0e10cSrcweir if ( rProp.Value >>= eProjectionMode ) 767*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DR3D, XML_PROJECTION, 768*cdf0e10cSrcweir eProjectionMode == drawing::ProjectionMode_PARALLEL ? GetXMLToken( XML_PARALLEL ) : GetXMLToken( XML_PERSPECTIVE ) ); 769*cdf0e10cSrcweir } 770*cdf0e10cSrcweir break; 771*cdf0e10cSrcweir case EAS_ViewPoint : 772*cdf0e10cSrcweir { 773*cdf0e10cSrcweir drawing::Position3D aExtrusionViewPoint; 774*cdf0e10cSrcweir if ( rProp.Value >>= aExtrusionViewPoint ) 775*cdf0e10cSrcweir { 776*cdf0e10cSrcweir rUnitConverter.convertPosition3D( aStrBuffer, aExtrusionViewPoint ); 777*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 778*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_VIEWPOINT, aStr ); 779*cdf0e10cSrcweir } 780*cdf0e10cSrcweir } 781*cdf0e10cSrcweir break; 782*cdf0e10cSrcweir case EAS_Origin : 783*cdf0e10cSrcweir { 784*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeParameterPair aOriginParaPair; 785*cdf0e10cSrcweir if ( rProp.Value >>= aOriginParaPair ) 786*cdf0e10cSrcweir { 787*cdf0e10cSrcweir ExportParameter( aStrBuffer, aOriginParaPair.First ); 788*cdf0e10cSrcweir ExportParameter( aStrBuffer, aOriginParaPair.Second ); 789*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 790*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_ORIGIN, aStr ); 791*cdf0e10cSrcweir } 792*cdf0e10cSrcweir } 793*cdf0e10cSrcweir break; 794*cdf0e10cSrcweir case EAS_Color : 795*cdf0e10cSrcweir { 796*cdf0e10cSrcweir sal_Bool bExtrusionColor = sal_Bool(); 797*cdf0e10cSrcweir if ( rProp.Value >>= bExtrusionColor ) 798*cdf0e10cSrcweir { 799*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_COLOR, 800*cdf0e10cSrcweir bExtrusionColor ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) ); 801*cdf0e10cSrcweir } 802*cdf0e10cSrcweir } 803*cdf0e10cSrcweir break; 804*cdf0e10cSrcweir default: 805*cdf0e10cSrcweir break; 806*cdf0e10cSrcweir } 807*cdf0e10cSrcweir } 808*cdf0e10cSrcweir } 809*cdf0e10cSrcweir } 810*cdf0e10cSrcweir break; 811*cdf0e10cSrcweir case EAS_TextPath : 812*cdf0e10cSrcweir { 813*cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aTextPathPropSeq; 814*cdf0e10cSrcweir if ( rGeoProp.Value >>= aTextPathPropSeq ) 815*cdf0e10cSrcweir { 816*cdf0e10cSrcweir sal_Int32 i, nCount = aTextPathPropSeq.getLength(); 817*cdf0e10cSrcweir for ( i = 0; i < nCount; i++ ) 818*cdf0e10cSrcweir { 819*cdf0e10cSrcweir const beans::PropertyValue& rProp = aTextPathPropSeq[ i ]; 820*cdf0e10cSrcweir switch( EASGet( rProp.Name ) ) 821*cdf0e10cSrcweir { 822*cdf0e10cSrcweir case EAS_TextPath : 823*cdf0e10cSrcweir { 824*cdf0e10cSrcweir sal_Bool bTextPathOn = sal_Bool(); 825*cdf0e10cSrcweir if ( rProp.Value >>= bTextPathOn ) 826*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_PATH, 827*cdf0e10cSrcweir bTextPathOn ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) ); 828*cdf0e10cSrcweir } 829*cdf0e10cSrcweir break; 830*cdf0e10cSrcweir case EAS_TextPathMode : 831*cdf0e10cSrcweir { 832*cdf0e10cSrcweir com::sun::star::drawing::EnhancedCustomShapeTextPathMode eTextPathMode; 833*cdf0e10cSrcweir if ( rProp.Value >>= eTextPathMode ) 834*cdf0e10cSrcweir { 835*cdf0e10cSrcweir switch ( eTextPathMode ) 836*cdf0e10cSrcweir { 837*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeTextPathMode_NORMAL: aStr = GetXMLToken( XML_NORMAL ); break; 838*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeTextPathMode_PATH : aStr = GetXMLToken( XML_PATH ); break; 839*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeTextPathMode_SHAPE : aStr = GetXMLToken( XML_SHAPE ); break; 840*cdf0e10cSrcweir default: 841*cdf0e10cSrcweir break; 842*cdf0e10cSrcweir } 843*cdf0e10cSrcweir if ( aStr.getLength() ) 844*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_PATH_MODE, aStr ); 845*cdf0e10cSrcweir } 846*cdf0e10cSrcweir } 847*cdf0e10cSrcweir break; 848*cdf0e10cSrcweir case EAS_ScaleX : 849*cdf0e10cSrcweir { 850*cdf0e10cSrcweir sal_Bool bScaleX = sal_Bool(); 851*cdf0e10cSrcweir if ( rProp.Value >>= bScaleX ) 852*cdf0e10cSrcweir { 853*cdf0e10cSrcweir aStr = bScaleX ? GetXMLToken( XML_SHAPE ) : GetXMLToken( XML_PATH ); 854*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_PATH_SCALE, aStr ); 855*cdf0e10cSrcweir } 856*cdf0e10cSrcweir } 857*cdf0e10cSrcweir break; 858*cdf0e10cSrcweir case EAS_SameLetterHeights : 859*cdf0e10cSrcweir { 860*cdf0e10cSrcweir sal_Bool bSameLetterHeights = sal_Bool(); 861*cdf0e10cSrcweir if ( rProp.Value >>= bSameLetterHeights ) 862*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_PATH_SAME_LETTER_HEIGHTS, 863*cdf0e10cSrcweir bSameLetterHeights ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) ); 864*cdf0e10cSrcweir } 865*cdf0e10cSrcweir break; 866*cdf0e10cSrcweir default: 867*cdf0e10cSrcweir break; 868*cdf0e10cSrcweir } 869*cdf0e10cSrcweir } 870*cdf0e10cSrcweir } 871*cdf0e10cSrcweir } 872*cdf0e10cSrcweir break; 873*cdf0e10cSrcweir case EAS_Path : 874*cdf0e10cSrcweir { 875*cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aPathPropSeq; 876*cdf0e10cSrcweir if ( rGeoProp.Value >>= aPathPropSeq ) 877*cdf0e10cSrcweir { 878*cdf0e10cSrcweir sal_Int32 i, nCount = aPathPropSeq.getLength(); 879*cdf0e10cSrcweir for ( i = 0; i < nCount; i++ ) 880*cdf0e10cSrcweir { 881*cdf0e10cSrcweir const beans::PropertyValue& rProp = aPathPropSeq[ i ]; 882*cdf0e10cSrcweir switch( EASGet( rProp.Name ) ) 883*cdf0e10cSrcweir { 884*cdf0e10cSrcweir case EAS_ExtrusionAllowed : 885*cdf0e10cSrcweir { 886*cdf0e10cSrcweir sal_Bool bExtrusionAllowed = sal_Bool(); 887*cdf0e10cSrcweir if ( rProp.Value >>= bExtrusionAllowed ) 888*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_EXTRUSION_ALLOWED, 889*cdf0e10cSrcweir bExtrusionAllowed ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) ); 890*cdf0e10cSrcweir } 891*cdf0e10cSrcweir break; 892*cdf0e10cSrcweir case EAS_ConcentricGradientFillAllowed : 893*cdf0e10cSrcweir { 894*cdf0e10cSrcweir sal_Bool bConcentricGradientFillAllowed = sal_Bool(); 895*cdf0e10cSrcweir if ( rProp.Value >>= bConcentricGradientFillAllowed ) 896*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CONCENTRIC_GRADIENT_FILL_ALLOWED, 897*cdf0e10cSrcweir bConcentricGradientFillAllowed ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) ); 898*cdf0e10cSrcweir } 899*cdf0e10cSrcweir break; 900*cdf0e10cSrcweir case EAS_TextPathAllowed : 901*cdf0e10cSrcweir { 902*cdf0e10cSrcweir sal_Bool bTextPathAllowed = sal_Bool(); 903*cdf0e10cSrcweir if ( rProp.Value >>= bTextPathAllowed ) 904*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_PATH_ALLOWED, 905*cdf0e10cSrcweir bTextPathAllowed ? GetXMLToken( XML_TRUE ) : GetXMLToken( XML_FALSE ) ); 906*cdf0e10cSrcweir } 907*cdf0e10cSrcweir break; 908*cdf0e10cSrcweir case EAS_GluePoints : 909*cdf0e10cSrcweir { 910*cdf0e10cSrcweir com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeParameterPair> aGluePoints; 911*cdf0e10cSrcweir if ( rProp.Value >>= aGluePoints ) 912*cdf0e10cSrcweir { 913*cdf0e10cSrcweir sal_Int32 k, nElements = aGluePoints.getLength(); 914*cdf0e10cSrcweir if ( nElements ) 915*cdf0e10cSrcweir { 916*cdf0e10cSrcweir for( k = 0; k < nElements; k++ ) 917*cdf0e10cSrcweir { 918*cdf0e10cSrcweir ExportParameter( aStrBuffer, aGluePoints[ k ].First ); 919*cdf0e10cSrcweir ExportParameter( aStrBuffer, aGluePoints[ k ].Second ); 920*cdf0e10cSrcweir } 921*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 922*cdf0e10cSrcweir } 923*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_GLUE_POINTS, aStr ); 924*cdf0e10cSrcweir } 925*cdf0e10cSrcweir } 926*cdf0e10cSrcweir break; 927*cdf0e10cSrcweir case EAS_GluePointType : 928*cdf0e10cSrcweir { 929*cdf0e10cSrcweir sal_Int16 nGluePointType = sal_Int16(); 930*cdf0e10cSrcweir if ( rProp.Value >>= nGluePointType ) 931*cdf0e10cSrcweir { 932*cdf0e10cSrcweir switch ( nGluePointType ) 933*cdf0e10cSrcweir { 934*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeGluePointType::NONE : aStr = GetXMLToken( XML_NONE ); break; 935*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeGluePointType::SEGMENTS : aStr = GetXMLToken( XML_SEGMENTS ); break; 936*cdf0e10cSrcweir case com::sun::star::drawing::EnhancedCustomShapeGluePointType::RECT : aStr = GetXMLToken( XML_RECTANGLE ); break; 937*cdf0e10cSrcweir } 938*cdf0e10cSrcweir if ( aStr.getLength() ) 939*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_GLUE_POINT_TYPE, aStr ); 940*cdf0e10cSrcweir } 941*cdf0e10cSrcweir } 942*cdf0e10cSrcweir break; 943*cdf0e10cSrcweir case EAS_Coordinates : 944*cdf0e10cSrcweir { 945*cdf0e10cSrcweir bCoordinates = ( rProp.Value >>= aCoordinates ); 946*cdf0e10cSrcweir } 947*cdf0e10cSrcweir break; 948*cdf0e10cSrcweir case EAS_Segments : 949*cdf0e10cSrcweir { 950*cdf0e10cSrcweir rProp.Value >>= aSegments; 951*cdf0e10cSrcweir } 952*cdf0e10cSrcweir break; 953*cdf0e10cSrcweir case EAS_StretchX : 954*cdf0e10cSrcweir { 955*cdf0e10cSrcweir sal_Int32 nStretchPoint = 0; 956*cdf0e10cSrcweir if ( rProp.Value >>= nStretchPoint ) 957*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_PATH_STRETCHPOINT_X, rtl::OUString::valueOf( nStretchPoint ) ); 958*cdf0e10cSrcweir } 959*cdf0e10cSrcweir break; 960*cdf0e10cSrcweir case EAS_StretchY : 961*cdf0e10cSrcweir { 962*cdf0e10cSrcweir sal_Int32 nStretchPoint = 0; 963*cdf0e10cSrcweir if ( rProp.Value >>= nStretchPoint ) 964*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_PATH_STRETCHPOINT_Y, rtl::OUString::valueOf( nStretchPoint ) ); 965*cdf0e10cSrcweir } 966*cdf0e10cSrcweir break; 967*cdf0e10cSrcweir case EAS_TextFrames : 968*cdf0e10cSrcweir { 969*cdf0e10cSrcweir com::sun::star::uno::Sequence< com::sun::star::drawing::EnhancedCustomShapeTextFrame > aPathTextFrames; 970*cdf0e10cSrcweir if ( rProp.Value >>= aPathTextFrames ) 971*cdf0e10cSrcweir { 972*cdf0e10cSrcweir if ( (sal_uInt16)aPathTextFrames.getLength() ) 973*cdf0e10cSrcweir { 974*cdf0e10cSrcweir sal_uInt16 k, nElements = (sal_uInt16)aPathTextFrames.getLength(); 975*cdf0e10cSrcweir for ( k = 0; k < nElements; k++ ) 976*cdf0e10cSrcweir { 977*cdf0e10cSrcweir ExportParameter( aStrBuffer, aPathTextFrames[ k ].TopLeft.First ); 978*cdf0e10cSrcweir ExportParameter( aStrBuffer, aPathTextFrames[ k ].TopLeft.Second ); 979*cdf0e10cSrcweir ExportParameter( aStrBuffer, aPathTextFrames[ k ].BottomRight.First ); 980*cdf0e10cSrcweir ExportParameter( aStrBuffer, aPathTextFrames[ k ].BottomRight.Second ); 981*cdf0e10cSrcweir } 982*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 983*cdf0e10cSrcweir } 984*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TEXT_AREAS, aStr ); 985*cdf0e10cSrcweir } 986*cdf0e10cSrcweir } 987*cdf0e10cSrcweir break; 988*cdf0e10cSrcweir default: 989*cdf0e10cSrcweir break; 990*cdf0e10cSrcweir } 991*cdf0e10cSrcweir } 992*cdf0e10cSrcweir } 993*cdf0e10cSrcweir } 994*cdf0e10cSrcweir break; 995*cdf0e10cSrcweir case EAS_Equations : 996*cdf0e10cSrcweir { 997*cdf0e10cSrcweir bEquations = ( rGeoProp.Value >>= aEquations ); 998*cdf0e10cSrcweir } 999*cdf0e10cSrcweir break; 1000*cdf0e10cSrcweir case EAS_Handles : 1001*cdf0e10cSrcweir { 1002*cdf0e10cSrcweir bHandles = ( rGeoProp.Value >>= aHandles ); 1003*cdf0e10cSrcweir } 1004*cdf0e10cSrcweir break; 1005*cdf0e10cSrcweir case EAS_AdjustmentValues : 1006*cdf0e10cSrcweir { 1007*cdf0e10cSrcweir rGeoProp.Value >>= aAdjustmentValues; 1008*cdf0e10cSrcweir } 1009*cdf0e10cSrcweir break; 1010*cdf0e10cSrcweir default: 1011*cdf0e10cSrcweir break; 1012*cdf0e10cSrcweir } 1013*cdf0e10cSrcweir } // for 1014*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_TYPE, aCustomShapeType ); 1015*cdf0e10cSrcweir 1016*cdf0e10cSrcweir // adjustments 1017*cdf0e10cSrcweir sal_Int32 nAdjustmentValues = aAdjustmentValues.getLength(); 1018*cdf0e10cSrcweir if ( nAdjustmentValues ) 1019*cdf0e10cSrcweir { 1020*cdf0e10cSrcweir sal_Int32 i, nValue = 0; 1021*cdf0e10cSrcweir for ( i = 0; i < nAdjustmentValues; i++ ) 1022*cdf0e10cSrcweir { 1023*cdf0e10cSrcweir if ( i ) 1024*cdf0e10cSrcweir aStrBuffer.append( (sal_Unicode)' ' ); 1025*cdf0e10cSrcweir 1026*cdf0e10cSrcweir const com::sun::star::drawing::EnhancedCustomShapeAdjustmentValue& rAdj = aAdjustmentValues[ i ]; 1027*cdf0e10cSrcweir if ( rAdj.State == beans::PropertyState_DIRECT_VALUE ) 1028*cdf0e10cSrcweir { 1029*cdf0e10cSrcweir if ( rAdj.Value.getValueTypeClass() == uno::TypeClass_DOUBLE ) 1030*cdf0e10cSrcweir { 1031*cdf0e10cSrcweir double fValue = 0.0; 1032*cdf0e10cSrcweir rAdj.Value >>= fValue; 1033*cdf0e10cSrcweir rUnitConverter.convertDouble( aStrBuffer, fValue ); 1034*cdf0e10cSrcweir } 1035*cdf0e10cSrcweir else 1036*cdf0e10cSrcweir { 1037*cdf0e10cSrcweir rAdj.Value >>= nValue; 1038*cdf0e10cSrcweir rUnitConverter.convertNumber( aStrBuffer, nValue ); 1039*cdf0e10cSrcweir } 1040*cdf0e10cSrcweir } 1041*cdf0e10cSrcweir else 1042*cdf0e10cSrcweir rUnitConverter.convertNumber( aStrBuffer, 0 ); // this should not be, but better than setting nothing 1043*cdf0e10cSrcweir } 1044*cdf0e10cSrcweir aStr = aStrBuffer.makeStringAndClear(); 1045*cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MODIFIERS, aStr ); 1046*cdf0e10cSrcweir } 1047*cdf0e10cSrcweir if ( bCoordinates ) 1048*cdf0e10cSrcweir ImpExportEnhancedPath( rExport, aCoordinates, aSegments ); 1049*cdf0e10cSrcweir } 1050*cdf0e10cSrcweir } 1051*cdf0e10cSrcweir SvXMLElementExport aOBJ( rExport, XML_NAMESPACE_DRAW, XML_ENHANCED_GEOMETRY, sal_True, sal_True ); 1052*cdf0e10cSrcweir if ( bEquations ) 1053*cdf0e10cSrcweir ImpExportEquations( rExport, aEquations ); 1054*cdf0e10cSrcweir if ( bHandles ) 1055*cdf0e10cSrcweir ImpExportHandles( rExport, aHandles ); 1056*cdf0e10cSrcweir } 1057*cdf0e10cSrcweir 1058*cdf0e10cSrcweir void XMLShapeExport::ImpExportCustomShape( 1059*cdf0e10cSrcweir const uno::Reference< drawing::XShape >& xShape, 1060*cdf0e10cSrcweir XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint ) 1061*cdf0e10cSrcweir { 1062*cdf0e10cSrcweir const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); 1063*cdf0e10cSrcweir if ( xPropSet.is() ) 1064*cdf0e10cSrcweir { 1065*cdf0e10cSrcweir rtl::OUString aStr; 1066*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() ); 1067*cdf0e10cSrcweir 1068*cdf0e10cSrcweir // Transformation 1069*cdf0e10cSrcweir ImpExportNewTrans( xPropSet, nFeatures, pRefPoint ); 1070*cdf0e10cSrcweir 1071*cdf0e10cSrcweir if ( xPropSetInfo.is() ) 1072*cdf0e10cSrcweir { 1073*cdf0e10cSrcweir const rtl::OUString sCustomShapeEngine( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeEngine" ) ); 1074*cdf0e10cSrcweir if ( xPropSetInfo->hasPropertyByName( sCustomShapeEngine ) ) 1075*cdf0e10cSrcweir { 1076*cdf0e10cSrcweir uno::Any aEngine( xPropSet->getPropertyValue( sCustomShapeEngine ) ); 1077*cdf0e10cSrcweir if ( ( aEngine >>= aStr ) && aStr.getLength() ) 1078*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_ENGINE, aStr ); 1079*cdf0e10cSrcweir } 1080*cdf0e10cSrcweir const rtl::OUString sCustomShapeData( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeData" ) ); 1081*cdf0e10cSrcweir if ( xPropSetInfo->hasPropertyByName( sCustomShapeData ) ) 1082*cdf0e10cSrcweir { 1083*cdf0e10cSrcweir uno::Any aData( xPropSet->getPropertyValue( sCustomShapeData ) ); 1084*cdf0e10cSrcweir if ( ( aData >>= aStr ) && aStr.getLength() ) 1085*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_DATA, aStr ); 1086*cdf0e10cSrcweir } 1087*cdf0e10cSrcweir } 1088*cdf0e10cSrcweir sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# 1089*cdf0e10cSrcweir SvXMLElementExport aOBJ( mrExport, XML_NAMESPACE_DRAW, XML_CUSTOM_SHAPE, bCreateNewline, sal_True ); 1090*cdf0e10cSrcweir ImpExportDescription( xShape ); // #i68101# 1091*cdf0e10cSrcweir ImpExportEvents( xShape ); 1092*cdf0e10cSrcweir ImpExportGluePoints( xShape ); 1093*cdf0e10cSrcweir ImpExportText( xShape ); 1094*cdf0e10cSrcweir ImpExportEnhancedGeometry( mrExport, xPropSet ); 1095*cdf0e10cSrcweir } 1096*cdf0e10cSrcweir } 1097*cdf0e10cSrcweir 1098*cdf0e10cSrcweir void XMLShapeExport::ImpExportTableShape( const uno::Reference< drawing::XShape >& xShape, XmlShapeType eShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint ) 1099*cdf0e10cSrcweir { 1100*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); 1101*cdf0e10cSrcweir uno::Reference< container::XNamed > xNamed(xShape, uno::UNO_QUERY); 1102*cdf0e10cSrcweir 1103*cdf0e10cSrcweir DBG_ASSERT( xPropSet.is() && xNamed.is(), "xmloff::XMLShapeExport::ImpExportTableShape(), tabe shape is not implementing needed interfaces"); 1104*cdf0e10cSrcweir if(xPropSet.is() && xNamed.is()) try 1105*cdf0e10cSrcweir { 1106*cdf0e10cSrcweir // Transformation 1107*cdf0e10cSrcweir ImpExportNewTrans(xPropSet, nFeatures, pRefPoint); 1108*cdf0e10cSrcweir 1109*cdf0e10cSrcweir sal_Bool bIsEmptyPresObj = sal_False; 1110*cdf0e10cSrcweir 1111*cdf0e10cSrcweir // presentation settings 1112*cdf0e10cSrcweir if(eShapeType == XmlShapeTypePresTableShape) 1113*cdf0e10cSrcweir bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_TABLE) ); 1114*cdf0e10cSrcweir 1115*cdf0e10cSrcweir const bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); 1116*cdf0e10cSrcweir const bool bExportEmbedded(0 != (mrExport.getExportFlags() & EXPORT_EMBEDDED)); 1117*cdf0e10cSrcweir 1118*cdf0e10cSrcweir SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW, XML_FRAME, bCreateNewline, sal_True ); 1119*cdf0e10cSrcweir 1120*cdf0e10cSrcweir // do not export in ODF 1.1 or older 1121*cdf0e10cSrcweir if( mrExport.getDefaultVersion() >= SvtSaveOptions::ODFVER_012 ) 1122*cdf0e10cSrcweir { 1123*cdf0e10cSrcweir if( !bIsEmptyPresObj ) 1124*cdf0e10cSrcweir { 1125*cdf0e10cSrcweir uno::Reference< container::XNamed > xTemplate( xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TableTemplate" ) ) ), uno::UNO_QUERY ); 1126*cdf0e10cSrcweir if( xTemplate.is() ) 1127*cdf0e10cSrcweir { 1128*cdf0e10cSrcweir const OUString sTemplate( xTemplate->getName() ); 1129*cdf0e10cSrcweir if( sTemplate.getLength() ) 1130*cdf0e10cSrcweir { 1131*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_TABLE, XML_TEMPLATE_NAME, sTemplate ); 1132*cdf0e10cSrcweir 1133*cdf0e10cSrcweir for( const XMLPropertyMapEntry* pEntry = &aXMLTableShapeAttributes[0]; pEntry->msApiName; pEntry++ ) 1134*cdf0e10cSrcweir { 1135*cdf0e10cSrcweir try 1136*cdf0e10cSrcweir { 1137*cdf0e10cSrcweir sal_Bool bBool = sal_False; 1138*cdf0e10cSrcweir const OUString sAPIPropertyName( OUString(pEntry->msApiName, pEntry->nApiNameLength, RTL_TEXTENCODING_ASCII_US ) ); 1139*cdf0e10cSrcweir 1140*cdf0e10cSrcweir xPropSet->getPropertyValue( sAPIPropertyName ) >>= bBool; 1141*cdf0e10cSrcweir if( bBool ) 1142*cdf0e10cSrcweir mrExport.AddAttribute(pEntry->mnNameSpace, pEntry->meXMLName, XML_TRUE ); 1143*cdf0e10cSrcweir } 1144*cdf0e10cSrcweir catch( uno::Exception& ) 1145*cdf0e10cSrcweir { 1146*cdf0e10cSrcweir DBG_ERROR("XMLShapeExport::ImpExportTableShape(), exception caught!"); 1147*cdf0e10cSrcweir } 1148*cdf0e10cSrcweir } 1149*cdf0e10cSrcweir } 1150*cdf0e10cSrcweir } 1151*cdf0e10cSrcweir 1152*cdf0e10cSrcweir 1153*cdf0e10cSrcweir uno::Reference< table::XColumnRowRange > xRange( xPropSet->getPropertyValue( msModel ), uno::UNO_QUERY_THROW ); 1154*cdf0e10cSrcweir GetShapeTableExport()->exportTable( xRange ); 1155*cdf0e10cSrcweir } 1156*cdf0e10cSrcweir } 1157*cdf0e10cSrcweir 1158*cdf0e10cSrcweir if( !bIsEmptyPresObj ) 1159*cdf0e10cSrcweir { 1160*cdf0e10cSrcweir uno::Reference< graphic::XGraphic > xGraphic( xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "ReplacementGraphic" ) ) ), uno::UNO_QUERY ); 1161*cdf0e10cSrcweir if( xGraphic.is() ) try 1162*cdf0e10cSrcweir { 1163*cdf0e10cSrcweir Reference< lang::XMultiServiceFactory > xSM( GetExport().getServiceFactory(), UNO_QUERY_THROW ); 1164*cdf0e10cSrcweir 1165*cdf0e10cSrcweir uno::Reference< embed::XStorage > xPictureStorage; 1166*cdf0e10cSrcweir uno::Reference< embed::XStorage > xStorage; 1167*cdf0e10cSrcweir uno::Reference< io::XStream > xPictureStream; 1168*cdf0e10cSrcweir 1169*cdf0e10cSrcweir OUString sPictureName; 1170*cdf0e10cSrcweir if( bExportEmbedded ) 1171*cdf0e10cSrcweir { 1172*cdf0e10cSrcweir xPictureStream.set( xSM->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.MemoryStream" ) ) ), UNO_QUERY_THROW ); 1173*cdf0e10cSrcweir } 1174*cdf0e10cSrcweir else 1175*cdf0e10cSrcweir { 1176*cdf0e10cSrcweir xStorage.set( GetExport().GetTargetStorage(), UNO_QUERY_THROW ); 1177*cdf0e10cSrcweir 1178*cdf0e10cSrcweir xPictureStorage.set( xStorage->openStorageElement( OUString( RTL_CONSTASCII_USTRINGPARAM( "Pictures" ) ), ::embed::ElementModes::READWRITE ), uno::UNO_QUERY_THROW ); 1179*cdf0e10cSrcweir const OUString sPrefix( RTL_CONSTASCII_USTRINGPARAM("TablePreview") ); 1180*cdf0e10cSrcweir const OUString sSuffix( RTL_CONSTASCII_USTRINGPARAM(".svm") ); 1181*cdf0e10cSrcweir 1182*cdf0e10cSrcweir sal_Int32 nIndex = 0; 1183*cdf0e10cSrcweir do 1184*cdf0e10cSrcweir { 1185*cdf0e10cSrcweir sPictureName = sPrefix; 1186*cdf0e10cSrcweir sPictureName += OUString::valueOf( ++nIndex ); 1187*cdf0e10cSrcweir sPictureName += sSuffix; 1188*cdf0e10cSrcweir } 1189*cdf0e10cSrcweir while( xPictureStorage->hasByName( sPictureName ) ); 1190*cdf0e10cSrcweir 1191*cdf0e10cSrcweir xPictureStream.set( xPictureStorage->openStreamElement( sPictureName, ::embed::ElementModes::READWRITE ), UNO_QUERY_THROW ); 1192*cdf0e10cSrcweir } 1193*cdf0e10cSrcweir 1194*cdf0e10cSrcweir Reference< graphic::XGraphicProvider > xProvider( xSM->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.graphic.GraphicProvider" ) ) ), UNO_QUERY_THROW ); 1195*cdf0e10cSrcweir Sequence< beans::PropertyValue > aArgs( 2 ); 1196*cdf0e10cSrcweir aArgs[ 0 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "MimeType" ) ); 1197*cdf0e10cSrcweir aArgs[ 0 ].Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "image/x-vclgraphic" ) ); 1198*cdf0e10cSrcweir aArgs[ 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "OutputStream" ) ); 1199*cdf0e10cSrcweir aArgs[ 1 ].Value <<= xPictureStream->getOutputStream(); 1200*cdf0e10cSrcweir xProvider->storeGraphic( xGraphic, aArgs ); 1201*cdf0e10cSrcweir 1202*cdf0e10cSrcweir if( xPictureStorage.is() ) 1203*cdf0e10cSrcweir { 1204*cdf0e10cSrcweir Reference< embed::XTransactedObject > xTrans( xPictureStorage, UNO_QUERY ); 1205*cdf0e10cSrcweir if( xTrans.is() ) 1206*cdf0e10cSrcweir xTrans->commit(); 1207*cdf0e10cSrcweir } 1208*cdf0e10cSrcweir 1209*cdf0e10cSrcweir if( !bExportEmbedded ) 1210*cdf0e10cSrcweir { 1211*cdf0e10cSrcweir OUString sURL( RTL_CONSTASCII_USTRINGPARAM( "Pictures/" ) ); 1212*cdf0e10cSrcweir sURL += sPictureName; 1213*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sURL ); 1214*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); 1215*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED ); 1216*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD ); 1217*cdf0e10cSrcweir } 1218*cdf0e10cSrcweir 1219*cdf0e10cSrcweir SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_DRAW, XML_IMAGE, sal_False, sal_True ); 1220*cdf0e10cSrcweir 1221*cdf0e10cSrcweir if( bExportEmbedded ) 1222*cdf0e10cSrcweir { 1223*cdf0e10cSrcweir Reference< XSeekableInputStream > xSeekable( xPictureStream, UNO_QUERY_THROW ); 1224*cdf0e10cSrcweir xSeekable->seek(0); 1225*cdf0e10cSrcweir 1226*cdf0e10cSrcweir XMLBase64Export aBase64Exp( GetExport() ); 1227*cdf0e10cSrcweir aBase64Exp.exportOfficeBinaryDataElement( Reference < XInputStream >( xPictureStream, UNO_QUERY_THROW ) ); 1228*cdf0e10cSrcweir } 1229*cdf0e10cSrcweir } 1230*cdf0e10cSrcweir catch( uno::Exception& ) 1231*cdf0e10cSrcweir { 1232*cdf0e10cSrcweir DBG_ERROR("xmloff::XMLShapeExport::ImpExportTableShape(), exception caught!"); 1233*cdf0e10cSrcweir } 1234*cdf0e10cSrcweir } 1235*cdf0e10cSrcweir 1236*cdf0e10cSrcweir ImpExportEvents( xShape ); 1237*cdf0e10cSrcweir ImpExportGluePoints( xShape ); 1238*cdf0e10cSrcweir ImpExportDescription( xShape ); // #i68101# 1239*cdf0e10cSrcweir } 1240*cdf0e10cSrcweir catch( uno::Exception& ) 1241*cdf0e10cSrcweir { 1242*cdf0e10cSrcweir DBG_ERROR( "xmloff::XMLShapeExport::ImpExportTableShape(), exception caught!" ); 1243*cdf0e10cSrcweir } 1244*cdf0e10cSrcweir } 1245