1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_xmloff.hxx" 30*cdf0e10cSrcweir #include "unointerfacetouniqueidentifiermapper.hxx" 31*cdf0e10cSrcweir #include <com/sun/star/text/XText.hpp> 32*cdf0e10cSrcweir #include <com/sun/star/container/XNamed.hpp> 33*cdf0e10cSrcweir #include <com/sun/star/container/XEnumerationAccess.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/drawing/CircleKind.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/drawing/ConnectorType.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/drawing/XControlShape.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/document/XEventsSupplier.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/drawing/HomogenMatrix3.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/media/ZoomLevel.hpp> 41*cdf0e10cSrcweir #include "anim.hxx" 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir #ifndef _XMLOFF_SHAPEEXPORT_HXX 44*cdf0e10cSrcweir #include <xmloff/shapeexport.hxx> 45*cdf0e10cSrcweir #endif 46*cdf0e10cSrcweir #include "sdpropls.hxx" 47*cdf0e10cSrcweir #include <tools/debug.hxx> 48*cdf0e10cSrcweir #include <tools/urlobj.hxx> 49*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx> 50*cdf0e10cSrcweir #include <xmloff/xmlexp.hxx> 51*cdf0e10cSrcweir #include <xmloff/xmluconv.hxx> 52*cdf0e10cSrcweir #include "XMLImageMapExport.hxx" 53*cdf0e10cSrcweir #include "xexptran.hxx" 54*cdf0e10cSrcweir #include <tools/gen.hxx> // FRound 55*cdf0e10cSrcweir #include <xmloff/xmltoken.hxx> 56*cdf0e10cSrcweir #include <xmloff/nmspmap.hxx> 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir #include "xmloff/xmlnmspe.hxx" 59*cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx> 60*cdf0e10cSrcweir #include <basegfx/tuple/b2dtuple.hxx> 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir using ::rtl::OUString; 63*cdf0e10cSrcweir using ::rtl::OUStringBuffer; 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir using namespace ::com::sun::star; 66*cdf0e10cSrcweir using namespace ::xmloff::token; 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir void XMLShapeExport::ImpExportNewTrans(const uno::Reference< beans::XPropertySet >& xPropSet, 72*cdf0e10cSrcweir sal_Int32 nFeatures, awt::Point* pRefPoint) 73*cdf0e10cSrcweir { 74*cdf0e10cSrcweir // get matrix 75*cdf0e10cSrcweir ::basegfx::B2DHomMatrix aMatrix; 76*cdf0e10cSrcweir ImpExportNewTrans_GetB2DHomMatrix(aMatrix, xPropSet); 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir // decompose and correct abour pRefPoint 79*cdf0e10cSrcweir ::basegfx::B2DTuple aTRScale; 80*cdf0e10cSrcweir double fTRShear(0.0); 81*cdf0e10cSrcweir double fTRRotate(0.0); 82*cdf0e10cSrcweir ::basegfx::B2DTuple aTRTranslate; 83*cdf0e10cSrcweir ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear, fTRRotate, aTRTranslate, pRefPoint); 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir // use features and write 86*cdf0e10cSrcweir ImpExportNewTrans_FeaturesAndWrite(aTRScale, fTRShear, fTRRotate, aTRTranslate, nFeatures); 87*cdf0e10cSrcweir } 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir void XMLShapeExport::ImpExportNewTrans_GetB2DHomMatrix(::basegfx::B2DHomMatrix& rMatrix, 90*cdf0e10cSrcweir const uno::Reference< beans::XPropertySet >& xPropSet) 91*cdf0e10cSrcweir { 92*cdf0e10cSrcweir // --> OD 2004-08-09 #i28749# - Get <TransformationInHoriL2R>, if it exist 93*cdf0e10cSrcweir // and if the document is exported into the OpenOffice.org file format. 94*cdf0e10cSrcweir // This property only exists at service com::sun::star::text::Shape - the 95*cdf0e10cSrcweir // Writer UNO service for shapes. 96*cdf0e10cSrcweir // This code is needed, because the positioning attributes in the 97*cdf0e10cSrcweir // OpenOffice.org file format are given in horizontal left-to-right layout 98*cdf0e10cSrcweir // regardless the layout direction the shape is in. In the OASIS Open Office 99*cdf0e10cSrcweir // file format the positioning attributes are correctly given in the layout 100*cdf0e10cSrcweir // direction the shape is in. Thus, this code provides the conversion from 101*cdf0e10cSrcweir // the OASIS Open Office file format to the OpenOffice.org file format. 102*cdf0e10cSrcweir uno::Any aAny; 103*cdf0e10cSrcweir if ( ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 && 104*cdf0e10cSrcweir xPropSet->getPropertySetInfo()->hasPropertyByName( 105*cdf0e10cSrcweir OUString(RTL_CONSTASCII_USTRINGPARAM("TransformationInHoriL2R"))) ) 106*cdf0e10cSrcweir { 107*cdf0e10cSrcweir aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("TransformationInHoriL2R"))); 108*cdf0e10cSrcweir } 109*cdf0e10cSrcweir else 110*cdf0e10cSrcweir { 111*cdf0e10cSrcweir aAny = xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Transformation"))); 112*cdf0e10cSrcweir } 113*cdf0e10cSrcweir // <-- 114*cdf0e10cSrcweir drawing::HomogenMatrix3 aMatrix; 115*cdf0e10cSrcweir aAny >>= aMatrix; 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir rMatrix.set(0, 0, aMatrix.Line1.Column1); 118*cdf0e10cSrcweir rMatrix.set(0, 1, aMatrix.Line1.Column2); 119*cdf0e10cSrcweir rMatrix.set(0, 2, aMatrix.Line1.Column3); 120*cdf0e10cSrcweir rMatrix.set(1, 0, aMatrix.Line2.Column1); 121*cdf0e10cSrcweir rMatrix.set(1, 1, aMatrix.Line2.Column2); 122*cdf0e10cSrcweir rMatrix.set(1, 2, aMatrix.Line2.Column3); 123*cdf0e10cSrcweir rMatrix.set(2, 0, aMatrix.Line3.Column1); 124*cdf0e10cSrcweir rMatrix.set(2, 1, aMatrix.Line3.Column2); 125*cdf0e10cSrcweir rMatrix.set(2, 2, aMatrix.Line3.Column3); 126*cdf0e10cSrcweir } 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir void XMLShapeExport::ImpExportNewTrans_DecomposeAndRefPoint(const ::basegfx::B2DHomMatrix& rMatrix, ::basegfx::B2DTuple& rTRScale, 129*cdf0e10cSrcweir double& fTRShear, double& fTRRotate, ::basegfx::B2DTuple& rTRTranslate, com::sun::star::awt::Point* pRefPoint) 130*cdf0e10cSrcweir { 131*cdf0e10cSrcweir // decompose matrix 132*cdf0e10cSrcweir rMatrix.decompose(rTRScale, rTRTranslate, fTRRotate, fTRShear); 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir // correct translation about pRefPoint 135*cdf0e10cSrcweir if(pRefPoint) 136*cdf0e10cSrcweir { 137*cdf0e10cSrcweir rTRTranslate -= ::basegfx::B2DTuple(pRefPoint->X, pRefPoint->Y); 138*cdf0e10cSrcweir } 139*cdf0e10cSrcweir } 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir void XMLShapeExport::ImpExportNewTrans_FeaturesAndWrite(::basegfx::B2DTuple& rTRScale, double fTRShear, 142*cdf0e10cSrcweir double fTRRotate, ::basegfx::B2DTuple& rTRTranslate, const sal_Int32 nFeatures) 143*cdf0e10cSrcweir { 144*cdf0e10cSrcweir // allways write Size (rTRScale) since this statement carries the union 145*cdf0e10cSrcweir // of the object 146*cdf0e10cSrcweir OUString aStr; 147*cdf0e10cSrcweir OUStringBuffer sStringBuffer; 148*cdf0e10cSrcweir ::basegfx::B2DTuple aTRScale(rTRScale); 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir // svg: width 151*cdf0e10cSrcweir if(!(nFeatures & SEF_EXPORT_WIDTH)) 152*cdf0e10cSrcweir { 153*cdf0e10cSrcweir aTRScale.setX(1.0); 154*cdf0e10cSrcweir } 155*cdf0e10cSrcweir else 156*cdf0e10cSrcweir { 157*cdf0e10cSrcweir if( aTRScale.getX() > 0.0 ) 158*cdf0e10cSrcweir aTRScale.setX(aTRScale.getX() - 1.0); 159*cdf0e10cSrcweir else if( aTRScale.getX() < 0.0 ) 160*cdf0e10cSrcweir aTRScale.setX(aTRScale.getX() + 1.0); 161*cdf0e10cSrcweir } 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, FRound(aTRScale.getX())); 164*cdf0e10cSrcweir aStr = sStringBuffer.makeStringAndClear(); 165*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, aStr); 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir // svg: height 168*cdf0e10cSrcweir if(!(nFeatures & SEF_EXPORT_HEIGHT)) 169*cdf0e10cSrcweir { 170*cdf0e10cSrcweir aTRScale.setY(1.0); 171*cdf0e10cSrcweir } 172*cdf0e10cSrcweir else 173*cdf0e10cSrcweir { 174*cdf0e10cSrcweir if( aTRScale.getY() > 0.0 ) 175*cdf0e10cSrcweir aTRScale.setY(aTRScale.getY() - 1.0); 176*cdf0e10cSrcweir else if( aTRScale.getY() < 0.0 ) 177*cdf0e10cSrcweir aTRScale.setY(aTRScale.getY() + 1.0); 178*cdf0e10cSrcweir } 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, FRound(aTRScale.getY())); 181*cdf0e10cSrcweir aStr = sStringBuffer.makeStringAndClear(); 182*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, aStr); 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir // decide if transformation is neccessary 185*cdf0e10cSrcweir sal_Bool bTransformationIsNeccessary(fTRShear != 0.0 || fTRRotate != 0.0); 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir if(bTransformationIsNeccessary) 188*cdf0e10cSrcweir { 189*cdf0e10cSrcweir // write transformation, but WITHOUT scale which is exported as size above 190*cdf0e10cSrcweir SdXMLImExTransform2D aTransform; 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir aTransform.AddSkewX(atan(fTRShear)); 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir // #i78696# 195*cdf0e10cSrcweir // fTRRotate is mathematically correct, but due to the error 196*cdf0e10cSrcweir // we export/import it mirrored. Since the API implementation is fixed and 197*cdf0e10cSrcweir // uses the correctly oriented angle, it is necessary for compatibility to 198*cdf0e10cSrcweir // mirror the angle here to stay at the old behaviour. There is a follow-up 199*cdf0e10cSrcweir // task (#i78698#) to fix this in the next ODF FileFormat version 200*cdf0e10cSrcweir aTransform.AddRotate(-fTRRotate); 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir aTransform.AddTranslate(rTRTranslate); 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir // does transformation need to be exported? 205*cdf0e10cSrcweir if(aTransform.NeedsAction()) 206*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_TRANSFORM, aTransform.GetExportString(mrExport.GetMM100UnitConverter())); 207*cdf0e10cSrcweir } 208*cdf0e10cSrcweir else 209*cdf0e10cSrcweir { 210*cdf0e10cSrcweir // no shear, no rotate; just add object position to export and we are done 211*cdf0e10cSrcweir if(nFeatures & SEF_EXPORT_X) 212*cdf0e10cSrcweir { 213*cdf0e10cSrcweir // svg: x 214*cdf0e10cSrcweir mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, FRound(rTRTranslate.getX())); 215*cdf0e10cSrcweir aStr = sStringBuffer.makeStringAndClear(); 216*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X, aStr); 217*cdf0e10cSrcweir } 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir if(nFeatures & SEF_EXPORT_Y) 220*cdf0e10cSrcweir { 221*cdf0e10cSrcweir // svg: y 222*cdf0e10cSrcweir mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, FRound(rTRTranslate.getY())); 223*cdf0e10cSrcweir aStr = sStringBuffer.makeStringAndClear(); 224*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y, aStr); 225*cdf0e10cSrcweir } 226*cdf0e10cSrcweir } 227*cdf0e10cSrcweir } 228*cdf0e10cSrcweir 229*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir sal_Bool XMLShapeExport::ImpExportPresentationAttributes( const uno::Reference< beans::XPropertySet >& xPropSet, const rtl::OUString& rClass ) 232*cdf0e10cSrcweir { 233*cdf0e10cSrcweir sal_Bool bIsEmpty = sal_False; 234*cdf0e10cSrcweir 235*cdf0e10cSrcweir OUStringBuffer sStringBuffer; 236*cdf0e10cSrcweir 237*cdf0e10cSrcweir // write presentation class entry 238*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_CLASS, rClass); 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir if( xPropSet.is() ) 241*cdf0e10cSrcweir { 242*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() ); 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir sal_Bool bTemp = false; 245*cdf0e10cSrcweir 246*cdf0e10cSrcweir // is empty pes shape? 247*cdf0e10cSrcweir if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject")))) 248*cdf0e10cSrcweir { 249*cdf0e10cSrcweir xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject"))) >>= bIsEmpty; 250*cdf0e10cSrcweir if( bIsEmpty ) 251*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PLACEHOLDER, XML_TRUE); 252*cdf0e10cSrcweir } 253*cdf0e10cSrcweir 254*cdf0e10cSrcweir // is user-transformed? 255*cdf0e10cSrcweir if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent")))) 256*cdf0e10cSrcweir { 257*cdf0e10cSrcweir xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent"))) >>= bTemp; 258*cdf0e10cSrcweir if(!bTemp) 259*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_USER_TRANSFORMED, XML_TRUE); 260*cdf0e10cSrcweir } 261*cdf0e10cSrcweir } 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir return bIsEmpty; 264*cdf0e10cSrcweir } 265*cdf0e10cSrcweir 266*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 267*cdf0e10cSrcweir 268*cdf0e10cSrcweir void XMLShapeExport::ImpExportText( const uno::Reference< drawing::XShape >& xShape ) 269*cdf0e10cSrcweir { 270*cdf0e10cSrcweir uno::Reference< text::XText > xText( xShape, uno::UNO_QUERY ); 271*cdf0e10cSrcweir if( xText.is() ) 272*cdf0e10cSrcweir { 273*cdf0e10cSrcweir uno::Reference< container::XEnumerationAccess > xEnumAccess( xShape, uno::UNO_QUERY ); 274*cdf0e10cSrcweir if( xEnumAccess.is() && xEnumAccess->hasElements() ) 275*cdf0e10cSrcweir mrExport.GetTextParagraphExport()->exportText( xText ); 276*cdf0e10cSrcweir } 277*cdf0e10cSrcweir } 278*cdf0e10cSrcweir 279*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 280*cdf0e10cSrcweir #include <com/sun/star/presentation/ClickAction.hpp> 281*cdf0e10cSrcweir #include <com/sun/star/presentation/AnimationSpeed.hpp> 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir namespace { 284*cdf0e10cSrcweir 285*cdf0e10cSrcweir const sal_Int32 FOUND_CLICKACTION = 0x00000001; 286*cdf0e10cSrcweir const sal_Int32 FOUND_BOOKMARK = 0x00000002; 287*cdf0e10cSrcweir const sal_Int32 FOUND_EFFECT = 0x00000004; 288*cdf0e10cSrcweir const sal_Int32 FOUND_PLAYFULL = 0x00000008; 289*cdf0e10cSrcweir const sal_Int32 FOUND_VERB = 0x00000010; 290*cdf0e10cSrcweir const sal_Int32 FOUND_SOUNDURL = 0x00000020; 291*cdf0e10cSrcweir const sal_Int32 FOUND_SPEED = 0x00000040; 292*cdf0e10cSrcweir const sal_Int32 FOUND_CLICKEVENTTYPE = 0x00000080; 293*cdf0e10cSrcweir const sal_Int32 FOUND_MACRO = 0x00000100; 294*cdf0e10cSrcweir const sal_Int32 FOUND_LIBRARY = 0x00000200; 295*cdf0e10cSrcweir const sal_Int32 FOUND_ACTIONEVENTTYPE = 0x00000400; 296*cdf0e10cSrcweir #ifdef ISSUE66550_HLINK_FOR_SHAPES 297*cdf0e10cSrcweir const sal_Int32 FOUND_URL = 0x00000800; 298*cdf0e10cSrcweir #endif 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir } // namespace 301*cdf0e10cSrcweir 302*cdf0e10cSrcweir void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& xShape ) 303*cdf0e10cSrcweir { 304*cdf0e10cSrcweir uno::Reference< document::XEventsSupplier > xEventsSupplier( xShape, uno::UNO_QUERY ); 305*cdf0e10cSrcweir if( !xEventsSupplier.is() ) 306*cdf0e10cSrcweir return; 307*cdf0e10cSrcweir 308*cdf0e10cSrcweir uno::Reference< container::XNameAccess > xEvents( xEventsSupplier->getEvents(), uno::UNO_QUERY ); 309*cdf0e10cSrcweir DBG_ASSERT( xEvents.is(), "XEventsSupplier::getEvents() returned NULL" ); 310*cdf0e10cSrcweir if( !xEvents.is() ) 311*cdf0e10cSrcweir return; 312*cdf0e10cSrcweir 313*cdf0e10cSrcweir sal_Int32 nFound = 0; 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir // extract properties from "OnClick" event -------------------------------- 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir OUString aClickEventType; 318*cdf0e10cSrcweir presentation::ClickAction eClickAction = presentation::ClickAction_NONE; 319*cdf0e10cSrcweir presentation::AnimationEffect eEffect = presentation::AnimationEffect_NONE; 320*cdf0e10cSrcweir presentation::AnimationSpeed eSpeed = presentation::AnimationSpeed_SLOW; 321*cdf0e10cSrcweir OUString aStrSoundURL; 322*cdf0e10cSrcweir sal_Bool bPlayFull = false; 323*cdf0e10cSrcweir sal_Int32 nVerb = 0; 324*cdf0e10cSrcweir OUString aStrMacro; 325*cdf0e10cSrcweir OUString aStrLibrary; 326*cdf0e10cSrcweir OUString aStrBookmark; 327*cdf0e10cSrcweir 328*cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aClickProperties; 329*cdf0e10cSrcweir if( xEvents->hasByName( msOnClick ) && (xEvents->getByName( msOnClick ) >>= aClickProperties) ) 330*cdf0e10cSrcweir { 331*cdf0e10cSrcweir const beans::PropertyValue* pProperty = aClickProperties.getConstArray(); 332*cdf0e10cSrcweir const beans::PropertyValue* pPropertyEnd = pProperty + aClickProperties.getLength(); 333*cdf0e10cSrcweir for( ; pProperty != pPropertyEnd; ++pProperty ) 334*cdf0e10cSrcweir { 335*cdf0e10cSrcweir if( ( ( nFound & FOUND_CLICKEVENTTYPE ) == 0 ) && pProperty->Name == msEventType ) 336*cdf0e10cSrcweir { 337*cdf0e10cSrcweir if( pProperty->Value >>= aClickEventType ) 338*cdf0e10cSrcweir nFound |= FOUND_CLICKEVENTTYPE; 339*cdf0e10cSrcweir } 340*cdf0e10cSrcweir else if( ( ( nFound & FOUND_CLICKACTION ) == 0 ) && pProperty->Name == msClickAction ) 341*cdf0e10cSrcweir { 342*cdf0e10cSrcweir if( pProperty->Value >>= eClickAction ) 343*cdf0e10cSrcweir nFound |= FOUND_CLICKACTION; 344*cdf0e10cSrcweir } 345*cdf0e10cSrcweir else if( ( ( nFound & FOUND_MACRO ) == 0 ) && ( pProperty->Name == msMacroName || pProperty->Name == msScript ) ) 346*cdf0e10cSrcweir { 347*cdf0e10cSrcweir if( pProperty->Value >>= aStrMacro ) 348*cdf0e10cSrcweir nFound |= FOUND_MACRO; 349*cdf0e10cSrcweir } 350*cdf0e10cSrcweir else if( ( ( nFound & FOUND_LIBRARY ) == 0 ) && pProperty->Name == msLibrary ) 351*cdf0e10cSrcweir { 352*cdf0e10cSrcweir if( pProperty->Value >>= aStrLibrary ) 353*cdf0e10cSrcweir nFound |= FOUND_LIBRARY; 354*cdf0e10cSrcweir } 355*cdf0e10cSrcweir else if( ( ( nFound & FOUND_EFFECT ) == 0 ) && pProperty->Name == msEffect ) 356*cdf0e10cSrcweir { 357*cdf0e10cSrcweir if( pProperty->Value >>= eEffect ) 358*cdf0e10cSrcweir nFound |= FOUND_EFFECT; 359*cdf0e10cSrcweir } 360*cdf0e10cSrcweir else if( ( ( nFound & FOUND_BOOKMARK ) == 0 ) && pProperty->Name == msBookmark ) 361*cdf0e10cSrcweir { 362*cdf0e10cSrcweir if( pProperty->Value >>= aStrBookmark ) 363*cdf0e10cSrcweir nFound |= FOUND_BOOKMARK; 364*cdf0e10cSrcweir } 365*cdf0e10cSrcweir else if( ( ( nFound & FOUND_SPEED ) == 0 ) && pProperty->Name == msSpeed ) 366*cdf0e10cSrcweir { 367*cdf0e10cSrcweir if( pProperty->Value >>= eSpeed ) 368*cdf0e10cSrcweir nFound |= FOUND_SPEED; 369*cdf0e10cSrcweir } 370*cdf0e10cSrcweir else if( ( ( nFound & FOUND_SOUNDURL ) == 0 ) && pProperty->Name == msSoundURL ) 371*cdf0e10cSrcweir { 372*cdf0e10cSrcweir if( pProperty->Value >>= aStrSoundURL ) 373*cdf0e10cSrcweir nFound |= FOUND_SOUNDURL; 374*cdf0e10cSrcweir } 375*cdf0e10cSrcweir else if( ( ( nFound & FOUND_PLAYFULL ) == 0 ) && pProperty->Name == msPlayFull ) 376*cdf0e10cSrcweir { 377*cdf0e10cSrcweir if( pProperty->Value >>= bPlayFull ) 378*cdf0e10cSrcweir nFound |= FOUND_PLAYFULL; 379*cdf0e10cSrcweir } 380*cdf0e10cSrcweir else if( ( ( nFound & FOUND_VERB ) == 0 ) && pProperty->Name == msVerb ) 381*cdf0e10cSrcweir { 382*cdf0e10cSrcweir if( pProperty->Value >>= nVerb ) 383*cdf0e10cSrcweir nFound |= FOUND_VERB; 384*cdf0e10cSrcweir } 385*cdf0e10cSrcweir } 386*cdf0e10cSrcweir } 387*cdf0e10cSrcweir 388*cdf0e10cSrcweir #ifdef ISSUE66550_HLINK_FOR_SHAPES 389*cdf0e10cSrcweir // extract properties from "OnAction" event ------------------------------- 390*cdf0e10cSrcweir 391*cdf0e10cSrcweir OUString aActionEventType; 392*cdf0e10cSrcweir OUString aHyperURL; 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aActionProperties; 395*cdf0e10cSrcweir if( xEvents->hasByName( msOnAction ) && (xEvents->getByName( msOnAction ) >>= aActionProperties) ) 396*cdf0e10cSrcweir { 397*cdf0e10cSrcweir const beans::PropertyValue* pProperty = aActionProperties.getConstArray(); 398*cdf0e10cSrcweir const beans::PropertyValue* pPropertyEnd = pProperty + aActionProperties.getLength(); 399*cdf0e10cSrcweir for( ; pProperty != pPropertyEnd; ++pProperty ) 400*cdf0e10cSrcweir { 401*cdf0e10cSrcweir if( ( ( nFound & FOUND_ACTIONEVENTTYPE ) == 0 ) && pProperty->Name == msEventType ) 402*cdf0e10cSrcweir { 403*cdf0e10cSrcweir if( pProperty->Value >>= aActionEventType ) 404*cdf0e10cSrcweir nFound |= FOUND_ACTIONEVENTTYPE; 405*cdf0e10cSrcweir } 406*cdf0e10cSrcweir else if( ( ( nFound & FOUND_URL ) == 0 ) && ( pProperty->Name == msURL ) ) 407*cdf0e10cSrcweir { 408*cdf0e10cSrcweir if( pProperty->Value >>= aHyperURL ) 409*cdf0e10cSrcweir nFound |= FOUND_URL; 410*cdf0e10cSrcweir } 411*cdf0e10cSrcweir } 412*cdf0e10cSrcweir } 413*cdf0e10cSrcweir #endif 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir // create the XML elements 416*cdf0e10cSrcweir 417*cdf0e10cSrcweir if( aClickEventType == msPresentation ) 418*cdf0e10cSrcweir { 419*cdf0e10cSrcweir if( ((nFound & FOUND_CLICKACTION) == 0) || (eClickAction == presentation::ClickAction_NONE) ) 420*cdf0e10cSrcweir return; 421*cdf0e10cSrcweir 422*cdf0e10cSrcweir SvXMLElementExport aEventsElemt(mrExport, XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, sal_True, sal_True); 423*cdf0e10cSrcweir 424*cdf0e10cSrcweir enum XMLTokenEnum eStrAction; 425*cdf0e10cSrcweir 426*cdf0e10cSrcweir switch( eClickAction ) 427*cdf0e10cSrcweir { 428*cdf0e10cSrcweir case presentation::ClickAction_PREVPAGE: eStrAction = XML_PREVIOUS_PAGE; break; 429*cdf0e10cSrcweir case presentation::ClickAction_NEXTPAGE: eStrAction = XML_NEXT_PAGE; break; 430*cdf0e10cSrcweir case presentation::ClickAction_FIRSTPAGE: eStrAction = XML_FIRST_PAGE; break; 431*cdf0e10cSrcweir case presentation::ClickAction_LASTPAGE: eStrAction = XML_LAST_PAGE; break; 432*cdf0e10cSrcweir case presentation::ClickAction_INVISIBLE: eStrAction = XML_HIDE; break; 433*cdf0e10cSrcweir case presentation::ClickAction_STOPPRESENTATION:eStrAction = XML_STOP; break; 434*cdf0e10cSrcweir case presentation::ClickAction_PROGRAM: eStrAction = XML_EXECUTE; break; 435*cdf0e10cSrcweir case presentation::ClickAction_BOOKMARK: eStrAction = XML_SHOW; break; 436*cdf0e10cSrcweir case presentation::ClickAction_DOCUMENT: eStrAction = XML_SHOW; break; 437*cdf0e10cSrcweir case presentation::ClickAction_MACRO: eStrAction = XML_EXECUTE_MACRO; break; 438*cdf0e10cSrcweir case presentation::ClickAction_VERB: eStrAction = XML_VERB; break; 439*cdf0e10cSrcweir case presentation::ClickAction_VANISH: eStrAction = XML_FADE_OUT; break; 440*cdf0e10cSrcweir case presentation::ClickAction_SOUND: eStrAction = XML_SOUND; break; 441*cdf0e10cSrcweir default: 442*cdf0e10cSrcweir DBG_ERROR( "unknown presentation::ClickAction found!" ); 443*cdf0e10cSrcweir eStrAction = XML_UNKNOWN; 444*cdf0e10cSrcweir } 445*cdf0e10cSrcweir 446*cdf0e10cSrcweir OUString aEventQName( 447*cdf0e10cSrcweir mrExport.GetNamespaceMap().GetQNameByKey( 448*cdf0e10cSrcweir XML_NAMESPACE_DOM, OUString( RTL_CONSTASCII_USTRINGPARAM( "click" ) ) ) ); 449*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName ); 450*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_ACTION, eStrAction ); 451*cdf0e10cSrcweir 452*cdf0e10cSrcweir if( eClickAction == presentation::ClickAction_VANISH ) 453*cdf0e10cSrcweir { 454*cdf0e10cSrcweir if( nFound & FOUND_EFFECT ) 455*cdf0e10cSrcweir { 456*cdf0e10cSrcweir XMLEffect eKind; 457*cdf0e10cSrcweir XMLEffectDirection eDirection; 458*cdf0e10cSrcweir sal_Int16 nStartScale; 459*cdf0e10cSrcweir sal_Bool bIn; 460*cdf0e10cSrcweir 461*cdf0e10cSrcweir SdXMLImplSetEffect( eEffect, eKind, eDirection, nStartScale, bIn ); 462*cdf0e10cSrcweir 463*cdf0e10cSrcweir if( eKind != EK_none ) 464*cdf0e10cSrcweir { 465*cdf0e10cSrcweir SvXMLUnitConverter::convertEnum( msBuffer, eKind, aXML_AnimationEffect_EnumMap ); 466*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_EFFECT, msBuffer.makeStringAndClear() ); 467*cdf0e10cSrcweir } 468*cdf0e10cSrcweir 469*cdf0e10cSrcweir if( eDirection != ED_none ) 470*cdf0e10cSrcweir { 471*cdf0e10cSrcweir SvXMLUnitConverter::convertEnum( msBuffer, eDirection, aXML_AnimationDirection_EnumMap ); 472*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_DIRECTION, msBuffer.makeStringAndClear() ); 473*cdf0e10cSrcweir } 474*cdf0e10cSrcweir 475*cdf0e10cSrcweir if( nStartScale != -1 ) 476*cdf0e10cSrcweir { 477*cdf0e10cSrcweir SvXMLUnitConverter::convertPercent( msBuffer, nStartScale ); 478*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_START_SCALE, msBuffer.makeStringAndClear() ); 479*cdf0e10cSrcweir } 480*cdf0e10cSrcweir } 481*cdf0e10cSrcweir 482*cdf0e10cSrcweir if( nFound & FOUND_SPEED && eEffect != presentation::AnimationEffect_NONE ) 483*cdf0e10cSrcweir { 484*cdf0e10cSrcweir if( eSpeed != presentation::AnimationSpeed_MEDIUM ) 485*cdf0e10cSrcweir { 486*cdf0e10cSrcweir SvXMLUnitConverter::convertEnum( msBuffer, eSpeed, aXML_AnimationSpeed_EnumMap ); 487*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_SPEED, msBuffer.makeStringAndClear() ); 488*cdf0e10cSrcweir } 489*cdf0e10cSrcweir } 490*cdf0e10cSrcweir } 491*cdf0e10cSrcweir 492*cdf0e10cSrcweir if( eClickAction == presentation::ClickAction_PROGRAM || 493*cdf0e10cSrcweir eClickAction == presentation::ClickAction_BOOKMARK || 494*cdf0e10cSrcweir eClickAction == presentation::ClickAction_DOCUMENT ) 495*cdf0e10cSrcweir { 496*cdf0e10cSrcweir if( eClickAction == presentation::ClickAction_BOOKMARK ) 497*cdf0e10cSrcweir msBuffer.append( sal_Unicode('#') ); 498*cdf0e10cSrcweir 499*cdf0e10cSrcweir msBuffer.append( aStrBookmark ); 500*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(msBuffer.makeStringAndClear()) ); 501*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); 502*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED ); 503*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST ); 504*cdf0e10cSrcweir } 505*cdf0e10cSrcweir 506*cdf0e10cSrcweir if( ( nFound & FOUND_VERB ) && eClickAction == presentation::ClickAction_VERB ) 507*cdf0e10cSrcweir { 508*cdf0e10cSrcweir msBuffer.append( nVerb ); 509*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_VERB, msBuffer.makeStringAndClear()); 510*cdf0e10cSrcweir } 511*cdf0e10cSrcweir 512*cdf0e10cSrcweir SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_PRESENTATION, XML_EVENT_LISTENER, sal_True, sal_True); 513*cdf0e10cSrcweir 514*cdf0e10cSrcweir if( eClickAction == presentation::ClickAction_VANISH || eClickAction == presentation::ClickAction_SOUND ) 515*cdf0e10cSrcweir { 516*cdf0e10cSrcweir if( ( nFound & FOUND_SOUNDURL ) && aStrSoundURL.getLength() != 0 ) 517*cdf0e10cSrcweir { 518*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStrSoundURL) ); 519*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); 520*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_NEW ); 521*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST ); 522*cdf0e10cSrcweir if( nFound & FOUND_PLAYFULL && bPlayFull ) 523*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_PRESENTATION, XML_PLAY_FULL, XML_TRUE ); 524*cdf0e10cSrcweir 525*cdf0e10cSrcweir SvXMLElementExport aElem( mrExport, XML_NAMESPACE_PRESENTATION, XML_SOUND, sal_True, sal_True ); 526*cdf0e10cSrcweir } 527*cdf0e10cSrcweir } 528*cdf0e10cSrcweir } 529*cdf0e10cSrcweir else if( aClickEventType == msStarBasic ) 530*cdf0e10cSrcweir { 531*cdf0e10cSrcweir if( nFound & FOUND_MACRO ) 532*cdf0e10cSrcweir { 533*cdf0e10cSrcweir SvXMLElementExport aEventsElemt(mrExport, XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, sal_True, sal_True); 534*cdf0e10cSrcweir 535*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_LANGUAGE, 536*cdf0e10cSrcweir mrExport.GetNamespaceMap().GetQNameByKey( 537*cdf0e10cSrcweir XML_NAMESPACE_OOO, 538*cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( 539*cdf0e10cSrcweir "starbasic" ) ) ) ); 540*cdf0e10cSrcweir OUString aEventQName( 541*cdf0e10cSrcweir mrExport.GetNamespaceMap().GetQNameByKey( 542*cdf0e10cSrcweir XML_NAMESPACE_DOM, OUString( RTL_CONSTASCII_USTRINGPARAM( "click" ) ) ) ); 543*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName ); 544*cdf0e10cSrcweir 545*cdf0e10cSrcweir if( nFound & FOUND_LIBRARY ) 546*cdf0e10cSrcweir { 547*cdf0e10cSrcweir OUString sLocation( GetXMLToken( 548*cdf0e10cSrcweir (aStrLibrary.equalsIgnoreAsciiCaseAscii("StarOffice") || 549*cdf0e10cSrcweir aStrLibrary.equalsIgnoreAsciiCaseAscii("application") ) ? XML_APPLICATION 550*cdf0e10cSrcweir : XML_DOCUMENT ) ); 551*cdf0e10cSrcweir OUStringBuffer sTmp( sLocation.getLength() + aStrMacro.getLength() + 1 ); 552*cdf0e10cSrcweir sTmp = sLocation; 553*cdf0e10cSrcweir sTmp.append( sal_Unicode( ':' ) ); 554*cdf0e10cSrcweir sTmp.append( aStrMacro ); 555*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_SCRIPT, XML_MACRO_NAME, 556*cdf0e10cSrcweir sTmp.makeStringAndClear()); 557*cdf0e10cSrcweir } 558*cdf0e10cSrcweir else 559*cdf0e10cSrcweir { 560*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_MACRO_NAME, aStrMacro ); 561*cdf0e10cSrcweir } 562*cdf0e10cSrcweir 563*cdf0e10cSrcweir SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SCRIPT, XML_EVENT_LISTENER, sal_True, sal_True); 564*cdf0e10cSrcweir } 565*cdf0e10cSrcweir } 566*cdf0e10cSrcweir #ifdef ISSUE66550_HLINK_FOR_SHAPES 567*cdf0e10cSrcweir else if( aClickEventType == msScript || aActionEventType == msAction ) 568*cdf0e10cSrcweir { 569*cdf0e10cSrcweir if( nFound & ( FOUND_MACRO | FOUND_URL ) ) 570*cdf0e10cSrcweir #else 571*cdf0e10cSrcweir else if( aClickEventType == msScript ) 572*cdf0e10cSrcweir { 573*cdf0e10cSrcweir if( nFound & FOUND_MACRO ) 574*cdf0e10cSrcweir #endif 575*cdf0e10cSrcweir { 576*cdf0e10cSrcweir SvXMLElementExport aEventsElemt(mrExport, XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, sal_True, sal_True); 577*cdf0e10cSrcweir if ( nFound & FOUND_MACRO ) 578*cdf0e10cSrcweir { 579*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_LANGUAGE, mrExport.GetNamespaceMap().GetQNameByKey( 580*cdf0e10cSrcweir XML_NAMESPACE_OOO, GetXMLToken(XML_SCRIPT) ) ); 581*cdf0e10cSrcweir OUString aEventQName( 582*cdf0e10cSrcweir mrExport.GetNamespaceMap().GetQNameByKey( 583*cdf0e10cSrcweir XML_NAMESPACE_DOM, OUString( RTL_CONSTASCII_USTRINGPARAM( "click" ) ) ) ); 584*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName ); 585*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aStrMacro ); 586*cdf0e10cSrcweir 587*cdf0e10cSrcweir SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SCRIPT, XML_EVENT_LISTENER, sal_True, sal_True); 588*cdf0e10cSrcweir } 589*cdf0e10cSrcweir #ifdef ISSUE66550_HLINK_FOR_SHAPES 590*cdf0e10cSrcweir if ( nFound & FOUND_URL ) 591*cdf0e10cSrcweir { 592*cdf0e10cSrcweir OUString aEventQName( 593*cdf0e10cSrcweir mrExport.GetNamespaceMap().GetQNameByKey( 594*cdf0e10cSrcweir XML_NAMESPACE_DOM, OUString( RTL_CONSTASCII_USTRINGPARAM( "action" ) ) ) ); 595*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName ); 596*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aHyperURL ); 597*cdf0e10cSrcweir 598*cdf0e10cSrcweir SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_PRESENTATION, XML_EVENT_LISTENER, sal_True, sal_True); 599*cdf0e10cSrcweir } 600*cdf0e10cSrcweir #endif 601*cdf0e10cSrcweir } 602*cdf0e10cSrcweir } 603*cdf0e10cSrcweir } 604*cdf0e10cSrcweir 605*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 606*cdf0e10cSrcweir 607*cdf0e10cSrcweir /** #i68101# export shape Title and Description */ 608*cdf0e10cSrcweir void XMLShapeExport::ImpExportDescription( const uno::Reference< drawing::XShape >& xShape ) 609*cdf0e10cSrcweir { 610*cdf0e10cSrcweir try 611*cdf0e10cSrcweir { 612*cdf0e10cSrcweir OUString aTitle; 613*cdf0e10cSrcweir OUString aDescription; 614*cdf0e10cSrcweir 615*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY_THROW ); 616*cdf0e10cSrcweir xProps->getPropertyValue( OUString::createFromAscii( "Title" ) ) >>= aTitle; 617*cdf0e10cSrcweir xProps->getPropertyValue( OUString::createFromAscii( "Description" ) ) >>= aDescription; 618*cdf0e10cSrcweir 619*cdf0e10cSrcweir if(aTitle.getLength()) 620*cdf0e10cSrcweir { 621*cdf0e10cSrcweir SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SVG, XML_TITLE, sal_True, sal_False); 622*cdf0e10cSrcweir mrExport.Characters( aTitle ); 623*cdf0e10cSrcweir } 624*cdf0e10cSrcweir 625*cdf0e10cSrcweir if(aDescription.getLength()) 626*cdf0e10cSrcweir { 627*cdf0e10cSrcweir SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SVG, XML_DESC, sal_True, sal_False ); 628*cdf0e10cSrcweir mrExport.Characters( aDescription ); 629*cdf0e10cSrcweir } 630*cdf0e10cSrcweir } 631*cdf0e10cSrcweir catch( uno::Exception& ) 632*cdf0e10cSrcweir { 633*cdf0e10cSrcweir DBG_ERROR( "could not export Title and/or Description for shape!" ); 634*cdf0e10cSrcweir } 635*cdf0e10cSrcweir } 636*cdf0e10cSrcweir 637*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 638*cdf0e10cSrcweir 639*cdf0e10cSrcweir void XMLShapeExport::ImpExportGroupShape( const uno::Reference< drawing::XShape >& xShape, XmlShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint) 640*cdf0e10cSrcweir { 641*cdf0e10cSrcweir uno::Reference< drawing::XShapes > xShapes(xShape, uno::UNO_QUERY); 642*cdf0e10cSrcweir if(xShapes.is() && xShapes->getCount()) 643*cdf0e10cSrcweir { 644*cdf0e10cSrcweir // write group shape 645*cdf0e10cSrcweir sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# 646*cdf0e10cSrcweir SvXMLElementExport aPGR(mrExport, XML_NAMESPACE_DRAW, XML_G, bCreateNewline, sal_True); 647*cdf0e10cSrcweir 648*cdf0e10cSrcweir ImpExportDescription( xShape ); // #i68101# 649*cdf0e10cSrcweir ImpExportEvents( xShape ); 650*cdf0e10cSrcweir ImpExportGluePoints( xShape ); 651*cdf0e10cSrcweir 652*cdf0e10cSrcweir // #89764# if export of position is supressed for group shape, 653*cdf0e10cSrcweir // positions of contained objects should be written relative to 654*cdf0e10cSrcweir // the upper left edge of the group. 655*cdf0e10cSrcweir awt::Point aUpperLeft; 656*cdf0e10cSrcweir 657*cdf0e10cSrcweir if(!(nFeatures & SEF_EXPORT_POSITION)) 658*cdf0e10cSrcweir { 659*cdf0e10cSrcweir nFeatures |= SEF_EXPORT_POSITION; 660*cdf0e10cSrcweir aUpperLeft = xShape->getPosition(); 661*cdf0e10cSrcweir pRefPoint = &aUpperLeft; 662*cdf0e10cSrcweir } 663*cdf0e10cSrcweir 664*cdf0e10cSrcweir // write members 665*cdf0e10cSrcweir exportShapes( xShapes, nFeatures, pRefPoint ); 666*cdf0e10cSrcweir } 667*cdf0e10cSrcweir } 668*cdf0e10cSrcweir 669*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 670*cdf0e10cSrcweir 671*cdf0e10cSrcweir void XMLShapeExport::ImpExportTextBoxShape( 672*cdf0e10cSrcweir const uno::Reference< drawing::XShape >& xShape, 673*cdf0e10cSrcweir XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint) 674*cdf0e10cSrcweir { 675*cdf0e10cSrcweir const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); 676*cdf0e10cSrcweir if(xPropSet.is()) 677*cdf0e10cSrcweir { 678*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() ); 679*cdf0e10cSrcweir 680*cdf0e10cSrcweir // presentation attribute (if presentation) 681*cdf0e10cSrcweir sal_Bool bIsPresShape(sal_False); 682*cdf0e10cSrcweir sal_Bool bIsEmptyPresObj(sal_False); 683*cdf0e10cSrcweir OUString aStr; 684*cdf0e10cSrcweir 685*cdf0e10cSrcweir switch(eShapeType) 686*cdf0e10cSrcweir { 687*cdf0e10cSrcweir case XmlShapeTypePresSubtitleShape: 688*cdf0e10cSrcweir { 689*cdf0e10cSrcweir aStr = GetXMLToken(XML_PRESENTATION_SUBTITLE); 690*cdf0e10cSrcweir bIsPresShape = sal_True; 691*cdf0e10cSrcweir break; 692*cdf0e10cSrcweir } 693*cdf0e10cSrcweir case XmlShapeTypePresTitleTextShape: 694*cdf0e10cSrcweir { 695*cdf0e10cSrcweir aStr = GetXMLToken(XML_PRESENTATION_TITLE); 696*cdf0e10cSrcweir bIsPresShape = sal_True; 697*cdf0e10cSrcweir break; 698*cdf0e10cSrcweir } 699*cdf0e10cSrcweir case XmlShapeTypePresOutlinerShape: 700*cdf0e10cSrcweir { 701*cdf0e10cSrcweir aStr = GetXMLToken(XML_PRESENTATION_OUTLINE); 702*cdf0e10cSrcweir bIsPresShape = sal_True; 703*cdf0e10cSrcweir break; 704*cdf0e10cSrcweir } 705*cdf0e10cSrcweir case XmlShapeTypePresNotesShape: 706*cdf0e10cSrcweir { 707*cdf0e10cSrcweir aStr = GetXMLToken(XML_PRESENTATION_NOTES); 708*cdf0e10cSrcweir bIsPresShape = sal_True; 709*cdf0e10cSrcweir break; 710*cdf0e10cSrcweir } 711*cdf0e10cSrcweir case XmlShapeTypePresHeaderShape: 712*cdf0e10cSrcweir { 713*cdf0e10cSrcweir aStr = GetXMLToken(XML_HEADER); 714*cdf0e10cSrcweir bIsPresShape = sal_True; 715*cdf0e10cSrcweir break; 716*cdf0e10cSrcweir } 717*cdf0e10cSrcweir case XmlShapeTypePresFooterShape: 718*cdf0e10cSrcweir { 719*cdf0e10cSrcweir aStr = GetXMLToken(XML_FOOTER); 720*cdf0e10cSrcweir bIsPresShape = sal_True; 721*cdf0e10cSrcweir break; 722*cdf0e10cSrcweir } 723*cdf0e10cSrcweir case XmlShapeTypePresSlideNumberShape: 724*cdf0e10cSrcweir { 725*cdf0e10cSrcweir aStr = GetXMLToken(XML_PAGE_NUMBER); 726*cdf0e10cSrcweir bIsPresShape = sal_True; 727*cdf0e10cSrcweir break; 728*cdf0e10cSrcweir } 729*cdf0e10cSrcweir case XmlShapeTypePresDateTimeShape: 730*cdf0e10cSrcweir { 731*cdf0e10cSrcweir aStr = GetXMLToken(XML_DATE_TIME); 732*cdf0e10cSrcweir bIsPresShape = sal_True; 733*cdf0e10cSrcweir break; 734*cdf0e10cSrcweir } 735*cdf0e10cSrcweir default: 736*cdf0e10cSrcweir break; 737*cdf0e10cSrcweir } 738*cdf0e10cSrcweir 739*cdf0e10cSrcweir // Transformation 740*cdf0e10cSrcweir ImpExportNewTrans(xPropSet, nFeatures, pRefPoint); 741*cdf0e10cSrcweir 742*cdf0e10cSrcweir if(bIsPresShape) 743*cdf0e10cSrcweir bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, aStr ); 744*cdf0e10cSrcweir 745*cdf0e10cSrcweir 746*cdf0e10cSrcweir sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# 747*cdf0e10cSrcweir SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, 748*cdf0e10cSrcweir XML_FRAME, bCreateNewline, sal_True ); 749*cdf0e10cSrcweir 750*cdf0e10cSrcweir // evtl. corner radius? 751*cdf0e10cSrcweir sal_Int32 nCornerRadius(0L); 752*cdf0e10cSrcweir xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius"))) >>= nCornerRadius; 753*cdf0e10cSrcweir if(nCornerRadius) 754*cdf0e10cSrcweir { 755*cdf0e10cSrcweir OUStringBuffer sStringBuffer; 756*cdf0e10cSrcweir mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nCornerRadius); 757*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, sStringBuffer.makeStringAndClear()); 758*cdf0e10cSrcweir } 759*cdf0e10cSrcweir 760*cdf0e10cSrcweir { 761*cdf0e10cSrcweir // write text-box 762*cdf0e10cSrcweir SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_TEXT_BOX, sal_True, sal_True); 763*cdf0e10cSrcweir if(!bIsEmptyPresObj) 764*cdf0e10cSrcweir ImpExportText( xShape ); 765*cdf0e10cSrcweir } 766*cdf0e10cSrcweir 767*cdf0e10cSrcweir ImpExportDescription( xShape ); // #i68101# 768*cdf0e10cSrcweir ImpExportEvents( xShape ); 769*cdf0e10cSrcweir ImpExportGluePoints( xShape ); 770*cdf0e10cSrcweir } 771*cdf0e10cSrcweir } 772*cdf0e10cSrcweir 773*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 774*cdf0e10cSrcweir 775*cdf0e10cSrcweir void XMLShapeExport::ImpExportRectangleShape( 776*cdf0e10cSrcweir const uno::Reference< drawing::XShape >& xShape, 777*cdf0e10cSrcweir XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint) 778*cdf0e10cSrcweir { 779*cdf0e10cSrcweir const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); 780*cdf0e10cSrcweir if(xPropSet.is()) 781*cdf0e10cSrcweir { 782*cdf0e10cSrcweir // Transformation 783*cdf0e10cSrcweir ImpExportNewTrans(xPropSet, nFeatures, pRefPoint); 784*cdf0e10cSrcweir 785*cdf0e10cSrcweir // evtl. corner radius? 786*cdf0e10cSrcweir sal_Int32 nCornerRadius(0L); 787*cdf0e10cSrcweir xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius"))) >>= nCornerRadius; 788*cdf0e10cSrcweir if(nCornerRadius) 789*cdf0e10cSrcweir { 790*cdf0e10cSrcweir OUStringBuffer sStringBuffer; 791*cdf0e10cSrcweir mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nCornerRadius); 792*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, sStringBuffer.makeStringAndClear()); 793*cdf0e10cSrcweir } 794*cdf0e10cSrcweir 795*cdf0e10cSrcweir // write rectangle 796*cdf0e10cSrcweir sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# 797*cdf0e10cSrcweir SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_RECT, bCreateNewline, sal_True); 798*cdf0e10cSrcweir 799*cdf0e10cSrcweir ImpExportDescription( xShape ); // #i68101# 800*cdf0e10cSrcweir ImpExportEvents( xShape ); 801*cdf0e10cSrcweir ImpExportGluePoints( xShape ); 802*cdf0e10cSrcweir ImpExportText( xShape ); 803*cdf0e10cSrcweir } 804*cdf0e10cSrcweir } 805*cdf0e10cSrcweir 806*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 807*cdf0e10cSrcweir 808*cdf0e10cSrcweir void XMLShapeExport::ImpExportLineShape( 809*cdf0e10cSrcweir const uno::Reference< drawing::XShape >& xShape, 810*cdf0e10cSrcweir XmlShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint) 811*cdf0e10cSrcweir { 812*cdf0e10cSrcweir const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); 813*cdf0e10cSrcweir if(xPropSet.is()) 814*cdf0e10cSrcweir { 815*cdf0e10cSrcweir OUString aStr; 816*cdf0e10cSrcweir OUStringBuffer sStringBuffer; 817*cdf0e10cSrcweir awt::Point aStart(0,0); 818*cdf0e10cSrcweir awt::Point aEnd(1,1); 819*cdf0e10cSrcweir 820*cdf0e10cSrcweir // #85920# use 'Geometry' to get the points of the line 821*cdf0e10cSrcweir // since this slot take anchor pos into account. 822*cdf0e10cSrcweir 823*cdf0e10cSrcweir // get matrix 824*cdf0e10cSrcweir ::basegfx::B2DHomMatrix aMatrix; 825*cdf0e10cSrcweir ImpExportNewTrans_GetB2DHomMatrix(aMatrix, xPropSet); 826*cdf0e10cSrcweir 827*cdf0e10cSrcweir // decompose and correct about pRefPoint 828*cdf0e10cSrcweir ::basegfx::B2DTuple aTRScale; 829*cdf0e10cSrcweir double fTRShear(0.0); 830*cdf0e10cSrcweir double fTRRotate(0.0); 831*cdf0e10cSrcweir ::basegfx::B2DTuple aTRTranslate; 832*cdf0e10cSrcweir ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear, fTRRotate, aTRTranslate, pRefPoint); 833*cdf0e10cSrcweir 834*cdf0e10cSrcweir // create base position 835*cdf0e10cSrcweir awt::Point aBasePosition(FRound(aTRTranslate.getX()), FRound(aTRTranslate.getY())); 836*cdf0e10cSrcweir 837*cdf0e10cSrcweir // get the two points 838*cdf0e10cSrcweir uno::Any aAny(xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry")))); 839*cdf0e10cSrcweir drawing::PointSequenceSequence* pSourcePolyPolygon = (drawing::PointSequenceSequence*)aAny.getValue(); 840*cdf0e10cSrcweir 841*cdf0e10cSrcweir if(pSourcePolyPolygon) 842*cdf0e10cSrcweir { 843*cdf0e10cSrcweir drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->getArray(); 844*cdf0e10cSrcweir if(pOuterSequence) 845*cdf0e10cSrcweir { 846*cdf0e10cSrcweir drawing::PointSequence* pInnerSequence = pOuterSequence++; 847*cdf0e10cSrcweir if(pInnerSequence) 848*cdf0e10cSrcweir { 849*cdf0e10cSrcweir awt::Point* pArray = pInnerSequence->getArray(); 850*cdf0e10cSrcweir if(pArray) 851*cdf0e10cSrcweir { 852*cdf0e10cSrcweir if(pInnerSequence->getLength() > 0) 853*cdf0e10cSrcweir { 854*cdf0e10cSrcweir aStart = awt::Point( 855*cdf0e10cSrcweir pArray->X + aBasePosition.X, 856*cdf0e10cSrcweir pArray->Y + aBasePosition.Y); 857*cdf0e10cSrcweir pArray++; 858*cdf0e10cSrcweir } 859*cdf0e10cSrcweir 860*cdf0e10cSrcweir if(pInnerSequence->getLength() > 1) 861*cdf0e10cSrcweir { 862*cdf0e10cSrcweir aEnd = awt::Point( 863*cdf0e10cSrcweir pArray->X + aBasePosition.X, 864*cdf0e10cSrcweir pArray->Y + aBasePosition.Y); 865*cdf0e10cSrcweir } 866*cdf0e10cSrcweir } 867*cdf0e10cSrcweir } 868*cdf0e10cSrcweir } 869*cdf0e10cSrcweir } 870*cdf0e10cSrcweir 871*cdf0e10cSrcweir if( nFeatures & SEF_EXPORT_X ) 872*cdf0e10cSrcweir { 873*cdf0e10cSrcweir // svg: x1 874*cdf0e10cSrcweir mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.X); 875*cdf0e10cSrcweir aStr = sStringBuffer.makeStringAndClear(); 876*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X1, aStr); 877*cdf0e10cSrcweir } 878*cdf0e10cSrcweir else 879*cdf0e10cSrcweir { 880*cdf0e10cSrcweir aEnd.X -= aStart.X; 881*cdf0e10cSrcweir } 882*cdf0e10cSrcweir 883*cdf0e10cSrcweir if( nFeatures & SEF_EXPORT_Y ) 884*cdf0e10cSrcweir { 885*cdf0e10cSrcweir // svg: y1 886*cdf0e10cSrcweir mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.Y); 887*cdf0e10cSrcweir aStr = sStringBuffer.makeStringAndClear(); 888*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y1, aStr); 889*cdf0e10cSrcweir } 890*cdf0e10cSrcweir else 891*cdf0e10cSrcweir { 892*cdf0e10cSrcweir aEnd.Y -= aStart.Y; 893*cdf0e10cSrcweir } 894*cdf0e10cSrcweir 895*cdf0e10cSrcweir // svg: x2 896*cdf0e10cSrcweir mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.X); 897*cdf0e10cSrcweir aStr = sStringBuffer.makeStringAndClear(); 898*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X2, aStr); 899*cdf0e10cSrcweir 900*cdf0e10cSrcweir // svg: y2 901*cdf0e10cSrcweir mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.Y); 902*cdf0e10cSrcweir aStr = sStringBuffer.makeStringAndClear(); 903*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y2, aStr); 904*cdf0e10cSrcweir 905*cdf0e10cSrcweir // write line 906*cdf0e10cSrcweir sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# 907*cdf0e10cSrcweir SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_LINE, bCreateNewline, sal_True); 908*cdf0e10cSrcweir 909*cdf0e10cSrcweir ImpExportDescription( xShape ); // #i68101# 910*cdf0e10cSrcweir ImpExportEvents( xShape ); 911*cdf0e10cSrcweir ImpExportGluePoints( xShape ); 912*cdf0e10cSrcweir ImpExportText( xShape ); 913*cdf0e10cSrcweir } 914*cdf0e10cSrcweir } 915*cdf0e10cSrcweir 916*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 917*cdf0e10cSrcweir 918*cdf0e10cSrcweir void XMLShapeExport::ImpExportEllipseShape( 919*cdf0e10cSrcweir const uno::Reference< drawing::XShape >& xShape, 920*cdf0e10cSrcweir XmlShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint) 921*cdf0e10cSrcweir { 922*cdf0e10cSrcweir const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); 923*cdf0e10cSrcweir if(xPropSet.is()) 924*cdf0e10cSrcweir { 925*cdf0e10cSrcweir // get size to decide between Circle and Ellipse 926*cdf0e10cSrcweir awt::Size aSize = xShape->getSize(); 927*cdf0e10cSrcweir sal_Int32 nRx((aSize.Width + 1) / 2); 928*cdf0e10cSrcweir sal_Int32 nRy((aSize.Height + 1) / 2); 929*cdf0e10cSrcweir sal_Bool bCircle(nRx == nRy); 930*cdf0e10cSrcweir 931*cdf0e10cSrcweir // Transformation 932*cdf0e10cSrcweir ImpExportNewTrans(xPropSet, nFeatures, pRefPoint); 933*cdf0e10cSrcweir 934*cdf0e10cSrcweir drawing::CircleKind eKind = drawing::CircleKind_FULL; 935*cdf0e10cSrcweir xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CircleKind")) ) >>= eKind; 936*cdf0e10cSrcweir if( eKind != drawing::CircleKind_FULL ) 937*cdf0e10cSrcweir { 938*cdf0e10cSrcweir OUStringBuffer sStringBuffer; 939*cdf0e10cSrcweir sal_Int32 nStartAngle = 0; 940*cdf0e10cSrcweir sal_Int32 nEndAngle = 0; 941*cdf0e10cSrcweir xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CircleStartAngle")) ) >>= nStartAngle; 942*cdf0e10cSrcweir xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CircleEndAngle")) ) >>= nEndAngle; 943*cdf0e10cSrcweir 944*cdf0e10cSrcweir const double dStartAngle = nStartAngle / 100.0; 945*cdf0e10cSrcweir const double dEndAngle = nEndAngle / 100.0; 946*cdf0e10cSrcweir 947*cdf0e10cSrcweir // export circle kind 948*cdf0e10cSrcweir SvXMLUnitConverter::convertEnum( sStringBuffer, (sal_uInt16)eKind, aXML_CircleKind_EnumMap ); 949*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_KIND, sStringBuffer.makeStringAndClear() ); 950*cdf0e10cSrcweir 951*cdf0e10cSrcweir // export start angle 952*cdf0e10cSrcweir SvXMLUnitConverter::convertDouble( sStringBuffer, dStartAngle ); 953*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_START_ANGLE, sStringBuffer.makeStringAndClear() ); 954*cdf0e10cSrcweir 955*cdf0e10cSrcweir // export end angle 956*cdf0e10cSrcweir SvXMLUnitConverter::convertDouble( sStringBuffer, dEndAngle ); 957*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_END_ANGLE, sStringBuffer.makeStringAndClear() ); 958*cdf0e10cSrcweir } 959*cdf0e10cSrcweir 960*cdf0e10cSrcweir sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# 961*cdf0e10cSrcweir 962*cdf0e10cSrcweir if(bCircle) 963*cdf0e10cSrcweir { 964*cdf0e10cSrcweir // write circle 965*cdf0e10cSrcweir SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_CIRCLE, bCreateNewline, sal_True); 966*cdf0e10cSrcweir 967*cdf0e10cSrcweir ImpExportDescription( xShape ); // #i68101# 968*cdf0e10cSrcweir ImpExportEvents( xShape ); 969*cdf0e10cSrcweir ImpExportGluePoints( xShape ); 970*cdf0e10cSrcweir ImpExportText( xShape ); 971*cdf0e10cSrcweir } 972*cdf0e10cSrcweir else 973*cdf0e10cSrcweir { 974*cdf0e10cSrcweir // write ellipse 975*cdf0e10cSrcweir SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_ELLIPSE, bCreateNewline, sal_True); 976*cdf0e10cSrcweir 977*cdf0e10cSrcweir ImpExportDescription( xShape ); // #i68101# 978*cdf0e10cSrcweir ImpExportEvents( xShape ); 979*cdf0e10cSrcweir ImpExportGluePoints( xShape ); 980*cdf0e10cSrcweir ImpExportText( xShape ); 981*cdf0e10cSrcweir } 982*cdf0e10cSrcweir } 983*cdf0e10cSrcweir } 984*cdf0e10cSrcweir 985*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 986*cdf0e10cSrcweir 987*cdf0e10cSrcweir void XMLShapeExport::ImpExportPolygonShape( 988*cdf0e10cSrcweir const uno::Reference< drawing::XShape >& xShape, 989*cdf0e10cSrcweir XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint) 990*cdf0e10cSrcweir { 991*cdf0e10cSrcweir const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); 992*cdf0e10cSrcweir if(xPropSet.is()) 993*cdf0e10cSrcweir { 994*cdf0e10cSrcweir sal_Bool bClosed(eShapeType == XmlShapeTypeDrawPolyPolygonShape 995*cdf0e10cSrcweir || eShapeType == XmlShapeTypeDrawClosedBezierShape); 996*cdf0e10cSrcweir sal_Bool bBezier(eShapeType == XmlShapeTypeDrawClosedBezierShape 997*cdf0e10cSrcweir || eShapeType == XmlShapeTypeDrawOpenBezierShape); 998*cdf0e10cSrcweir 999*cdf0e10cSrcweir // get matrix 1000*cdf0e10cSrcweir ::basegfx::B2DHomMatrix aMatrix; 1001*cdf0e10cSrcweir ImpExportNewTrans_GetB2DHomMatrix(aMatrix, xPropSet); 1002*cdf0e10cSrcweir 1003*cdf0e10cSrcweir // decompose and correct abour pRefPoint 1004*cdf0e10cSrcweir ::basegfx::B2DTuple aTRScale; 1005*cdf0e10cSrcweir double fTRShear(0.0); 1006*cdf0e10cSrcweir double fTRRotate(0.0); 1007*cdf0e10cSrcweir ::basegfx::B2DTuple aTRTranslate; 1008*cdf0e10cSrcweir ImpExportNewTrans_DecomposeAndRefPoint(aMatrix, aTRScale, fTRShear, fTRRotate, aTRTranslate, pRefPoint); 1009*cdf0e10cSrcweir 1010*cdf0e10cSrcweir // use features and write 1011*cdf0e10cSrcweir ImpExportNewTrans_FeaturesAndWrite(aTRScale, fTRShear, fTRRotate, aTRTranslate, nFeatures); 1012*cdf0e10cSrcweir 1013*cdf0e10cSrcweir // create and export ViewBox 1014*cdf0e10cSrcweir awt::Point aPoint(0, 0); 1015*cdf0e10cSrcweir awt::Size aSize(FRound(aTRScale.getX()), FRound(aTRScale.getY())); 1016*cdf0e10cSrcweir SdXMLImExViewBox aViewBox(0, 0, aSize.Width, aSize.Height); 1017*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_VIEWBOX, aViewBox.GetExportString()); 1018*cdf0e10cSrcweir 1019*cdf0e10cSrcweir sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# 1020*cdf0e10cSrcweir 1021*cdf0e10cSrcweir if(bBezier) 1022*cdf0e10cSrcweir { 1023*cdf0e10cSrcweir // get PolygonBezier 1024*cdf0e10cSrcweir uno::Any aAny( xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))) ); 1025*cdf0e10cSrcweir drawing::PolyPolygonBezierCoords* pSourcePolyPolygon = 1026*cdf0e10cSrcweir (drawing::PolyPolygonBezierCoords*)aAny.getValue(); 1027*cdf0e10cSrcweir 1028*cdf0e10cSrcweir if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength()) 1029*cdf0e10cSrcweir { 1030*cdf0e10cSrcweir sal_Int32 nOuterCnt(pSourcePolyPolygon->Coordinates.getLength()); 1031*cdf0e10cSrcweir drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->Coordinates.getArray(); 1032*cdf0e10cSrcweir drawing::FlagSequence* pOuterFlags = pSourcePolyPolygon->Flags.getArray(); 1033*cdf0e10cSrcweir 1034*cdf0e10cSrcweir if(pOuterSequence && pOuterFlags) 1035*cdf0e10cSrcweir { 1036*cdf0e10cSrcweir // prepare svx:d element export 1037*cdf0e10cSrcweir SdXMLImExSvgDElement aSvgDElement(aViewBox); 1038*cdf0e10cSrcweir 1039*cdf0e10cSrcweir for(sal_Int32 a(0L); a < nOuterCnt; a++) 1040*cdf0e10cSrcweir { 1041*cdf0e10cSrcweir drawing::PointSequence* pSequence = pOuterSequence++; 1042*cdf0e10cSrcweir drawing::FlagSequence* pFlags = pOuterFlags++; 1043*cdf0e10cSrcweir 1044*cdf0e10cSrcweir if(pSequence && pFlags) 1045*cdf0e10cSrcweir { 1046*cdf0e10cSrcweir aSvgDElement.AddPolygon(pSequence, pFlags, 1047*cdf0e10cSrcweir aPoint, aSize, bClosed); 1048*cdf0e10cSrcweir } 1049*cdf0e10cSrcweir } 1050*cdf0e10cSrcweir 1051*cdf0e10cSrcweir // write point array 1052*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString()); 1053*cdf0e10cSrcweir } 1054*cdf0e10cSrcweir 1055*cdf0e10cSrcweir // write object now 1056*cdf0e10cSrcweir SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PATH, bCreateNewline, sal_True); 1057*cdf0e10cSrcweir 1058*cdf0e10cSrcweir ImpExportDescription( xShape ); // #i68101# 1059*cdf0e10cSrcweir ImpExportEvents( xShape ); 1060*cdf0e10cSrcweir ImpExportGluePoints( xShape ); 1061*cdf0e10cSrcweir ImpExportText( xShape ); 1062*cdf0e10cSrcweir } 1063*cdf0e10cSrcweir } 1064*cdf0e10cSrcweir else 1065*cdf0e10cSrcweir { 1066*cdf0e10cSrcweir // get non-bezier polygon 1067*cdf0e10cSrcweir uno::Any aAny( xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Geometry"))) ); 1068*cdf0e10cSrcweir drawing::PointSequenceSequence* pSourcePolyPolygon = (drawing::PointSequenceSequence*)aAny.getValue(); 1069*cdf0e10cSrcweir 1070*cdf0e10cSrcweir if(pSourcePolyPolygon && pSourcePolyPolygon->getLength()) 1071*cdf0e10cSrcweir { 1072*cdf0e10cSrcweir sal_Int32 nOuterCnt(pSourcePolyPolygon->getLength()); 1073*cdf0e10cSrcweir 1074*cdf0e10cSrcweir if(1L == nOuterCnt && !bBezier) 1075*cdf0e10cSrcweir { 1076*cdf0e10cSrcweir // simple polygon shape, can be written as svg:points sequence 1077*cdf0e10cSrcweir drawing::PointSequence* pSequence = pSourcePolyPolygon->getArray(); 1078*cdf0e10cSrcweir if(pSequence) 1079*cdf0e10cSrcweir { 1080*cdf0e10cSrcweir SdXMLImExPointsElement aPoints(pSequence, aViewBox, aPoint, aSize, 1081*cdf0e10cSrcweir // #96328# 1082*cdf0e10cSrcweir bClosed); 1083*cdf0e10cSrcweir 1084*cdf0e10cSrcweir // write point array 1085*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_POINTS, aPoints.GetExportString()); 1086*cdf0e10cSrcweir } 1087*cdf0e10cSrcweir 1088*cdf0e10cSrcweir // write object now 1089*cdf0e10cSrcweir SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, 1090*cdf0e10cSrcweir bClosed ? XML_POLYGON : XML_POLYLINE , bCreateNewline, sal_True); 1091*cdf0e10cSrcweir 1092*cdf0e10cSrcweir ImpExportDescription( xShape ); // #i68101# 1093*cdf0e10cSrcweir ImpExportEvents( xShape ); 1094*cdf0e10cSrcweir ImpExportGluePoints( xShape ); 1095*cdf0e10cSrcweir ImpExportText( xShape ); 1096*cdf0e10cSrcweir } 1097*cdf0e10cSrcweir else 1098*cdf0e10cSrcweir { 1099*cdf0e10cSrcweir // polypolygon or bezier, needs to be written as a svg:path sequence 1100*cdf0e10cSrcweir drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->getArray(); 1101*cdf0e10cSrcweir if(pOuterSequence) 1102*cdf0e10cSrcweir { 1103*cdf0e10cSrcweir // prepare svx:d element export 1104*cdf0e10cSrcweir SdXMLImExSvgDElement aSvgDElement(aViewBox); 1105*cdf0e10cSrcweir 1106*cdf0e10cSrcweir for(sal_Int32 a(0L); a < nOuterCnt; a++) 1107*cdf0e10cSrcweir { 1108*cdf0e10cSrcweir drawing::PointSequence* pSequence = pOuterSequence++; 1109*cdf0e10cSrcweir if(pSequence) 1110*cdf0e10cSrcweir { 1111*cdf0e10cSrcweir aSvgDElement.AddPolygon(pSequence, 0L, aPoint, 1112*cdf0e10cSrcweir aSize, bClosed); 1113*cdf0e10cSrcweir } 1114*cdf0e10cSrcweir } 1115*cdf0e10cSrcweir 1116*cdf0e10cSrcweir // write point array 1117*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString()); 1118*cdf0e10cSrcweir } 1119*cdf0e10cSrcweir 1120*cdf0e10cSrcweir // write object now 1121*cdf0e10cSrcweir SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PATH, bCreateNewline, sal_True); 1122*cdf0e10cSrcweir 1123*cdf0e10cSrcweir ImpExportDescription( xShape ); // #i68101# 1124*cdf0e10cSrcweir ImpExportEvents( xShape ); 1125*cdf0e10cSrcweir ImpExportGluePoints( xShape ); 1126*cdf0e10cSrcweir ImpExportText( xShape ); 1127*cdf0e10cSrcweir } 1128*cdf0e10cSrcweir } 1129*cdf0e10cSrcweir } 1130*cdf0e10cSrcweir } 1131*cdf0e10cSrcweir } 1132*cdf0e10cSrcweir 1133*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1134*cdf0e10cSrcweir 1135*cdf0e10cSrcweir void XMLShapeExport::ImpExportGraphicObjectShape( 1136*cdf0e10cSrcweir const uno::Reference< drawing::XShape >& xShape, 1137*cdf0e10cSrcweir XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint) 1138*cdf0e10cSrcweir { 1139*cdf0e10cSrcweir const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); 1140*cdf0e10cSrcweir if(xPropSet.is()) 1141*cdf0e10cSrcweir { 1142*cdf0e10cSrcweir sal_Bool bIsEmptyPresObj = sal_False; 1143*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() ); 1144*cdf0e10cSrcweir 1145*cdf0e10cSrcweir // Transformation 1146*cdf0e10cSrcweir ImpExportNewTrans(xPropSet, nFeatures, pRefPoint); 1147*cdf0e10cSrcweir 1148*cdf0e10cSrcweir OUString sImageURL; 1149*cdf0e10cSrcweir 1150*cdf0e10cSrcweir if(eShapeType == XmlShapeTypePresGraphicObjectShape) 1151*cdf0e10cSrcweir bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_GRAPHIC) ); 1152*cdf0e10cSrcweir 1153*cdf0e10cSrcweir sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# 1154*cdf0e10cSrcweir SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, 1155*cdf0e10cSrcweir XML_FRAME, bCreateNewline, sal_True ); 1156*cdf0e10cSrcweir 1157*cdf0e10cSrcweir const bool bSaveBackwardsCompatible = ( mrExport.getExportFlags() & EXPORT_SAVEBACKWARDCOMPATIBLE ); 1158*cdf0e10cSrcweir 1159*cdf0e10cSrcweir if( !bIsEmptyPresObj || bSaveBackwardsCompatible ) 1160*cdf0e10cSrcweir { 1161*cdf0e10cSrcweir if( !bIsEmptyPresObj ) 1162*cdf0e10cSrcweir { 1163*cdf0e10cSrcweir OUString aStreamURL; 1164*cdf0e10cSrcweir OUString aStr; 1165*cdf0e10cSrcweir 1166*cdf0e10cSrcweir xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicStreamURL"))) >>= aStreamURL; 1167*cdf0e10cSrcweir xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicURL"))) >>= sImageURL; 1168*cdf0e10cSrcweir 1169*cdf0e10cSrcweir OUString aResolveURL( sImageURL ); 1170*cdf0e10cSrcweir const rtl::OUString sPackageURL( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.Package:") ); 1171*cdf0e10cSrcweir 1172*cdf0e10cSrcweir // sj: trying to preserve the filename 1173*cdf0e10cSrcweir if ( aStreamURL.match( sPackageURL, 0 ) ) 1174*cdf0e10cSrcweir { 1175*cdf0e10cSrcweir rtl::OUString sRequestedName( aStreamURL.copy( sPackageURL.getLength(), aStreamURL.getLength() - sPackageURL.getLength() ) ); 1176*cdf0e10cSrcweir sal_Int32 nLastIndex = sRequestedName.lastIndexOf( '/' ) + 1; 1177*cdf0e10cSrcweir if ( ( nLastIndex > 0 ) && ( nLastIndex < sRequestedName.getLength() ) ) 1178*cdf0e10cSrcweir sRequestedName = sRequestedName.copy( nLastIndex, sRequestedName.getLength() - nLastIndex ); 1179*cdf0e10cSrcweir nLastIndex = sRequestedName.lastIndexOf( '.' ); 1180*cdf0e10cSrcweir if ( nLastIndex >= 0 ) 1181*cdf0e10cSrcweir sRequestedName = sRequestedName.copy( 0, nLastIndex ); 1182*cdf0e10cSrcweir if ( sRequestedName.getLength() ) 1183*cdf0e10cSrcweir { 1184*cdf0e10cSrcweir aResolveURL = aResolveURL.concat( OUString(RTL_CONSTASCII_USTRINGPARAM("?requestedName="))); 1185*cdf0e10cSrcweir aResolveURL = aResolveURL.concat( sRequestedName ); 1186*cdf0e10cSrcweir } 1187*cdf0e10cSrcweir } 1188*cdf0e10cSrcweir 1189*cdf0e10cSrcweir aStr = mrExport.AddEmbeddedGraphicObject( aResolveURL ); 1190*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr ); 1191*cdf0e10cSrcweir 1192*cdf0e10cSrcweir if( aStr.getLength() ) 1193*cdf0e10cSrcweir { 1194*cdf0e10cSrcweir if( aStr[ 0 ] == '#' ) 1195*cdf0e10cSrcweir { 1196*cdf0e10cSrcweir aStreamURL = OUString::createFromAscii( "vnd.sun.star.Package:" ); 1197*cdf0e10cSrcweir aStreamURL = aStreamURL.concat( aStr.copy( 1, aStr.getLength() - 1 ) ); 1198*cdf0e10cSrcweir } 1199*cdf0e10cSrcweir 1200*cdf0e10cSrcweir // update stream URL for load on demand 1201*cdf0e10cSrcweir uno::Any aAny; 1202*cdf0e10cSrcweir aAny <<= aStreamURL; 1203*cdf0e10cSrcweir xPropSet->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicStreamURL")), aAny ); 1204*cdf0e10cSrcweir 1205*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); 1206*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED ); 1207*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD ); 1208*cdf0e10cSrcweir } 1209*cdf0e10cSrcweir } 1210*cdf0e10cSrcweir else 1211*cdf0e10cSrcweir { 1212*cdf0e10cSrcweir OUString aStr; 1213*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, aStr ); 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 { 1220*cdf0e10cSrcweir SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_IMAGE, sal_True, sal_True); 1221*cdf0e10cSrcweir 1222*cdf0e10cSrcweir if( sImageURL.getLength() ) 1223*cdf0e10cSrcweir { 1224*cdf0e10cSrcweir // optional office:binary-data 1225*cdf0e10cSrcweir mrExport.AddEmbeddedGraphicObjectAsBase64( sImageURL ); 1226*cdf0e10cSrcweir } 1227*cdf0e10cSrcweir if( !bIsEmptyPresObj ) 1228*cdf0e10cSrcweir ImpExportText( xShape ); 1229*cdf0e10cSrcweir } 1230*cdf0e10cSrcweir } 1231*cdf0e10cSrcweir 1232*cdf0e10cSrcweir ImpExportEvents( xShape ); 1233*cdf0e10cSrcweir ImpExportGluePoints( xShape ); 1234*cdf0e10cSrcweir 1235*cdf0e10cSrcweir // image map 1236*cdf0e10cSrcweir GetExport().GetImageMapExport().Export( xPropSet ); 1237*cdf0e10cSrcweir ImpExportDescription( xShape ); // #i68101# 1238*cdf0e10cSrcweir } 1239*cdf0e10cSrcweir } 1240*cdf0e10cSrcweir 1241*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1242*cdf0e10cSrcweir 1243*cdf0e10cSrcweir void XMLShapeExport::ImpExportChartShape( 1244*cdf0e10cSrcweir const uno::Reference< drawing::XShape >& xShape, 1245*cdf0e10cSrcweir XmlShapeType eShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint, 1246*cdf0e10cSrcweir SvXMLAttributeList* pAttrList ) 1247*cdf0e10cSrcweir { 1248*cdf0e10cSrcweir ImpExportOLE2Shape( xShape, eShapeType, nFeatures, pRefPoint, pAttrList ); 1249*cdf0e10cSrcweir } 1250*cdf0e10cSrcweir 1251*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1252*cdf0e10cSrcweir 1253*cdf0e10cSrcweir void XMLShapeExport::ImpExportControlShape( 1254*cdf0e10cSrcweir const uno::Reference< drawing::XShape >& xShape, 1255*cdf0e10cSrcweir XmlShapeType, sal_Int32 nFeatures, awt::Point* pRefPoint) 1256*cdf0e10cSrcweir { 1257*cdf0e10cSrcweir const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); 1258*cdf0e10cSrcweir if(xPropSet.is()) 1259*cdf0e10cSrcweir { 1260*cdf0e10cSrcweir // Transformation 1261*cdf0e10cSrcweir ImpExportNewTrans(xPropSet, nFeatures, pRefPoint); 1262*cdf0e10cSrcweir } 1263*cdf0e10cSrcweir 1264*cdf0e10cSrcweir uno::Reference< drawing::XControlShape > xControl( xShape, uno::UNO_QUERY ); 1265*cdf0e10cSrcweir DBG_ASSERT( xControl.is(), "Control shape is not supporting XControlShape" ); 1266*cdf0e10cSrcweir if( xControl.is() ) 1267*cdf0e10cSrcweir { 1268*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xControlModel( xControl->getControl(), uno::UNO_QUERY ); 1269*cdf0e10cSrcweir DBG_ASSERT( xControlModel.is(), "Control shape has not XControlModel" ); 1270*cdf0e10cSrcweir if( xControlModel.is() ) 1271*cdf0e10cSrcweir { 1272*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CONTROL, mrExport.GetFormExport()->getControlId( xControlModel ) ); 1273*cdf0e10cSrcweir } 1274*cdf0e10cSrcweir } 1275*cdf0e10cSrcweir 1276*cdf0e10cSrcweir sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# 1277*cdf0e10cSrcweir SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_CONTROL, bCreateNewline, sal_True); 1278*cdf0e10cSrcweir 1279*cdf0e10cSrcweir ImpExportDescription( xShape ); // #i68101# 1280*cdf0e10cSrcweir } 1281*cdf0e10cSrcweir 1282*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1283*cdf0e10cSrcweir 1284*cdf0e10cSrcweir void XMLShapeExport::ImpExportConnectorShape( 1285*cdf0e10cSrcweir const uno::Reference< drawing::XShape >& xShape, 1286*cdf0e10cSrcweir XmlShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */) 1287*cdf0e10cSrcweir { 1288*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY ); 1289*cdf0e10cSrcweir 1290*cdf0e10cSrcweir OUString aStr; 1291*cdf0e10cSrcweir OUStringBuffer sStringBuffer; 1292*cdf0e10cSrcweir 1293*cdf0e10cSrcweir // export connection kind 1294*cdf0e10cSrcweir drawing::ConnectorType eType = drawing::ConnectorType_STANDARD; 1295*cdf0e10cSrcweir uno::Any aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeKind"))); 1296*cdf0e10cSrcweir aAny >>= eType; 1297*cdf0e10cSrcweir 1298*cdf0e10cSrcweir if( eType != drawing::ConnectorType_STANDARD ) 1299*cdf0e10cSrcweir { 1300*cdf0e10cSrcweir SvXMLUnitConverter::convertEnum( sStringBuffer, (sal_uInt16)eType, aXML_ConnectionKind_EnumMap ); 1301*cdf0e10cSrcweir aStr = sStringBuffer.makeStringAndClear(); 1302*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_TYPE, aStr); 1303*cdf0e10cSrcweir } 1304*cdf0e10cSrcweir 1305*cdf0e10cSrcweir // export line skew 1306*cdf0e10cSrcweir sal_Int32 nDelta1 = 0, nDelta2 = 0, nDelta3 = 0; 1307*cdf0e10cSrcweir 1308*cdf0e10cSrcweir aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine1Delta"))); 1309*cdf0e10cSrcweir aAny >>= nDelta1; 1310*cdf0e10cSrcweir aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine2Delta"))); 1311*cdf0e10cSrcweir aAny >>= nDelta2; 1312*cdf0e10cSrcweir aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine3Delta"))); 1313*cdf0e10cSrcweir aAny >>= nDelta3; 1314*cdf0e10cSrcweir 1315*cdf0e10cSrcweir if( nDelta1 != 0 || nDelta2 != 0 || nDelta3 != 0 ) 1316*cdf0e10cSrcweir { 1317*cdf0e10cSrcweir mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nDelta1); 1318*cdf0e10cSrcweir if( nDelta2 != 0 || nDelta3 != 0 ) 1319*cdf0e10cSrcweir { 1320*cdf0e10cSrcweir const char aSpace = ' '; 1321*cdf0e10cSrcweir sStringBuffer.appendAscii( &aSpace, 1 ); 1322*cdf0e10cSrcweir mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nDelta2); 1323*cdf0e10cSrcweir if( nDelta3 != 0 ) 1324*cdf0e10cSrcweir { 1325*cdf0e10cSrcweir sStringBuffer.appendAscii( &aSpace, 1 ); 1326*cdf0e10cSrcweir mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nDelta3); 1327*cdf0e10cSrcweir } 1328*cdf0e10cSrcweir } 1329*cdf0e10cSrcweir 1330*cdf0e10cSrcweir aStr = sStringBuffer.makeStringAndClear(); 1331*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_LINE_SKEW, aStr); 1332*cdf0e10cSrcweir } 1333*cdf0e10cSrcweir 1334*cdf0e10cSrcweir // export start and end point 1335*cdf0e10cSrcweir awt::Point aStart(0,0); 1336*cdf0e10cSrcweir awt::Point aEnd(1,1); 1337*cdf0e10cSrcweir 1338*cdf0e10cSrcweir // --> OD 2004-08-09 #i36248# - Get <StartPositionInHoriL2R> and 1339*cdf0e10cSrcweir // <EndPositionInHoriL2R>, if they exist and if the document is exported 1340*cdf0e10cSrcweir // into the OpenOffice.org file format. 1341*cdf0e10cSrcweir // These properties only exist at service com::sun::star::text::Shape - the 1342*cdf0e10cSrcweir // Writer UNO service for shapes. 1343*cdf0e10cSrcweir // This code is needed, because the positioning attributes in the 1344*cdf0e10cSrcweir // OpenOffice.org file format are given in horizontal left-to-right layout 1345*cdf0e10cSrcweir // regardless the layout direction the shape is in. In the OASIS Open Office 1346*cdf0e10cSrcweir // file format the positioning attributes are correctly given in the layout 1347*cdf0e10cSrcweir // direction the shape is in. Thus, this code provides the conversion from 1348*cdf0e10cSrcweir // the OASIS Open Office file format to the OpenOffice.org file format. 1349*cdf0e10cSrcweir if ( ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 && 1350*cdf0e10cSrcweir xProps->getPropertySetInfo()->hasPropertyByName( 1351*cdf0e10cSrcweir OUString(RTL_CONSTASCII_USTRINGPARAM("StartPositionInHoriL2R"))) && 1352*cdf0e10cSrcweir xProps->getPropertySetInfo()->hasPropertyByName( 1353*cdf0e10cSrcweir OUString(RTL_CONSTASCII_USTRINGPARAM("EndPositionInHoriL2R"))) ) 1354*cdf0e10cSrcweir { 1355*cdf0e10cSrcweir xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPositionInHoriL2R"))) >>= aStart; 1356*cdf0e10cSrcweir xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPositionInHoriL2R"))) >>= aEnd; 1357*cdf0e10cSrcweir } 1358*cdf0e10cSrcweir else 1359*cdf0e10cSrcweir { 1360*cdf0e10cSrcweir xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition"))) >>= aStart; 1361*cdf0e10cSrcweir xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition"))) >>= aEnd; 1362*cdf0e10cSrcweir } 1363*cdf0e10cSrcweir // <-- 1364*cdf0e10cSrcweir 1365*cdf0e10cSrcweir if( pRefPoint ) 1366*cdf0e10cSrcweir { 1367*cdf0e10cSrcweir aStart.X -= pRefPoint->X; 1368*cdf0e10cSrcweir aStart.Y -= pRefPoint->Y; 1369*cdf0e10cSrcweir aEnd.X -= pRefPoint->X; 1370*cdf0e10cSrcweir aEnd.Y -= pRefPoint->Y; 1371*cdf0e10cSrcweir } 1372*cdf0e10cSrcweir 1373*cdf0e10cSrcweir if( nFeatures & SEF_EXPORT_X ) 1374*cdf0e10cSrcweir { 1375*cdf0e10cSrcweir // svg: x1 1376*cdf0e10cSrcweir mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.X); 1377*cdf0e10cSrcweir aStr = sStringBuffer.makeStringAndClear(); 1378*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X1, aStr); 1379*cdf0e10cSrcweir } 1380*cdf0e10cSrcweir else 1381*cdf0e10cSrcweir { 1382*cdf0e10cSrcweir aEnd.X -= aStart.X; 1383*cdf0e10cSrcweir } 1384*cdf0e10cSrcweir 1385*cdf0e10cSrcweir if( nFeatures & SEF_EXPORT_Y ) 1386*cdf0e10cSrcweir { 1387*cdf0e10cSrcweir // svg: y1 1388*cdf0e10cSrcweir mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.Y); 1389*cdf0e10cSrcweir aStr = sStringBuffer.makeStringAndClear(); 1390*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y1, aStr); 1391*cdf0e10cSrcweir } 1392*cdf0e10cSrcweir else 1393*cdf0e10cSrcweir { 1394*cdf0e10cSrcweir aEnd.Y -= aStart.Y; 1395*cdf0e10cSrcweir } 1396*cdf0e10cSrcweir 1397*cdf0e10cSrcweir // svg: x2 1398*cdf0e10cSrcweir mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.X); 1399*cdf0e10cSrcweir aStr = sStringBuffer.makeStringAndClear(); 1400*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X2, aStr); 1401*cdf0e10cSrcweir 1402*cdf0e10cSrcweir // svg: y2 1403*cdf0e10cSrcweir mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.Y); 1404*cdf0e10cSrcweir aStr = sStringBuffer.makeStringAndClear(); 1405*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y2, aStr); 1406*cdf0e10cSrcweir 1407*cdf0e10cSrcweir // #i39320# 1408*cdf0e10cSrcweir uno::Reference< uno::XInterface > xRefS; 1409*cdf0e10cSrcweir uno::Reference< uno::XInterface > xRefE; 1410*cdf0e10cSrcweir 1411*cdf0e10cSrcweir // export start connection 1412*cdf0e10cSrcweir xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartShape") ) ) >>= xRefS; 1413*cdf0e10cSrcweir if( xRefS.is() ) 1414*cdf0e10cSrcweir { 1415*cdf0e10cSrcweir const OUString& rShapeId = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xRefS ); 1416*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_START_SHAPE, rShapeId); 1417*cdf0e10cSrcweir 1418*cdf0e10cSrcweir aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartGluePointIndex")) ); 1419*cdf0e10cSrcweir sal_Int32 nGluePointId = 0; 1420*cdf0e10cSrcweir if( aAny >>= nGluePointId ) 1421*cdf0e10cSrcweir { 1422*cdf0e10cSrcweir if( nGluePointId != -1 ) 1423*cdf0e10cSrcweir { 1424*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_START_GLUE_POINT, OUString::valueOf( nGluePointId )); 1425*cdf0e10cSrcweir } 1426*cdf0e10cSrcweir } 1427*cdf0e10cSrcweir } 1428*cdf0e10cSrcweir 1429*cdf0e10cSrcweir // export end connection 1430*cdf0e10cSrcweir xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndShape")) ) >>= xRefE; 1431*cdf0e10cSrcweir if( xRefE.is() ) 1432*cdf0e10cSrcweir { 1433*cdf0e10cSrcweir const OUString& rShapeId = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xRefE ); 1434*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_END_SHAPE, rShapeId); 1435*cdf0e10cSrcweir 1436*cdf0e10cSrcweir aAny = xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndGluePointIndex")) ); 1437*cdf0e10cSrcweir sal_Int32 nGluePointId = 0; 1438*cdf0e10cSrcweir if( aAny >>= nGluePointId ) 1439*cdf0e10cSrcweir { 1440*cdf0e10cSrcweir if( nGluePointId != -1 ) 1441*cdf0e10cSrcweir { 1442*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_END_GLUE_POINT, OUString::valueOf( nGluePointId )); 1443*cdf0e10cSrcweir } 1444*cdf0e10cSrcweir } 1445*cdf0e10cSrcweir } 1446*cdf0e10cSrcweir 1447*cdf0e10cSrcweir if( xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("PolyPolygonBezier") ) ) >>= aAny ) 1448*cdf0e10cSrcweir { 1449*cdf0e10cSrcweir // get PolygonBezier 1450*cdf0e10cSrcweir drawing::PolyPolygonBezierCoords* pSourcePolyPolygon = 1451*cdf0e10cSrcweir (drawing::PolyPolygonBezierCoords*)aAny.getValue(); 1452*cdf0e10cSrcweir 1453*cdf0e10cSrcweir if(pSourcePolyPolygon && pSourcePolyPolygon->Coordinates.getLength()) 1454*cdf0e10cSrcweir { 1455*cdf0e10cSrcweir sal_Int32 nOuterCnt(pSourcePolyPolygon->Coordinates.getLength()); 1456*cdf0e10cSrcweir drawing::PointSequence* pOuterSequence = pSourcePolyPolygon->Coordinates.getArray(); 1457*cdf0e10cSrcweir drawing::FlagSequence* pOuterFlags = pSourcePolyPolygon->Flags.getArray(); 1458*cdf0e10cSrcweir 1459*cdf0e10cSrcweir if(pOuterSequence && pOuterFlags) 1460*cdf0e10cSrcweir { 1461*cdf0e10cSrcweir // prepare svx:d element export 1462*cdf0e10cSrcweir awt::Point aPoint( 0, 0 ); 1463*cdf0e10cSrcweir awt::Size aSize( 1, 1 ); 1464*cdf0e10cSrcweir SdXMLImExViewBox aViewBox( 0, 0, 1, 1 ); 1465*cdf0e10cSrcweir SdXMLImExSvgDElement aSvgDElement(aViewBox); 1466*cdf0e10cSrcweir 1467*cdf0e10cSrcweir for(sal_Int32 a(0L); a < nOuterCnt; a++) 1468*cdf0e10cSrcweir { 1469*cdf0e10cSrcweir drawing::PointSequence* pSequence = pOuterSequence++; 1470*cdf0e10cSrcweir drawing::FlagSequence* pFlags = pOuterFlags++; 1471*cdf0e10cSrcweir 1472*cdf0e10cSrcweir if(pSequence && pFlags) 1473*cdf0e10cSrcweir { 1474*cdf0e10cSrcweir aSvgDElement.AddPolygon(pSequence, pFlags, 1475*cdf0e10cSrcweir aPoint, aSize, sal_False ); 1476*cdf0e10cSrcweir } 1477*cdf0e10cSrcweir } 1478*cdf0e10cSrcweir 1479*cdf0e10cSrcweir // write point array 1480*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aSvgDElement.GetExportString()); 1481*cdf0e10cSrcweir } 1482*cdf0e10cSrcweir } 1483*cdf0e10cSrcweir } 1484*cdf0e10cSrcweir 1485*cdf0e10cSrcweir // write connector shape. Add Export later. 1486*cdf0e10cSrcweir sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# 1487*cdf0e10cSrcweir SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_CONNECTOR, bCreateNewline, sal_True); 1488*cdf0e10cSrcweir 1489*cdf0e10cSrcweir ImpExportDescription( xShape ); // #i68101# 1490*cdf0e10cSrcweir ImpExportEvents( xShape ); 1491*cdf0e10cSrcweir ImpExportGluePoints( xShape ); 1492*cdf0e10cSrcweir ImpExportText( xShape ); 1493*cdf0e10cSrcweir } 1494*cdf0e10cSrcweir 1495*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1496*cdf0e10cSrcweir 1497*cdf0e10cSrcweir void XMLShapeExport::ImpExportMeasureShape( 1498*cdf0e10cSrcweir const uno::Reference< drawing::XShape >& xShape, 1499*cdf0e10cSrcweir XmlShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */) 1500*cdf0e10cSrcweir { 1501*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY ); 1502*cdf0e10cSrcweir 1503*cdf0e10cSrcweir OUString aStr; 1504*cdf0e10cSrcweir OUStringBuffer sStringBuffer; 1505*cdf0e10cSrcweir 1506*cdf0e10cSrcweir // export start and end point 1507*cdf0e10cSrcweir awt::Point aStart(0,0); 1508*cdf0e10cSrcweir awt::Point aEnd(1,1); 1509*cdf0e10cSrcweir 1510*cdf0e10cSrcweir // --> OD 2004-08-09 #i36248# - Get <StartPositionInHoriL2R> and 1511*cdf0e10cSrcweir // <EndPositionInHoriL2R>, if they exist and if the document is exported 1512*cdf0e10cSrcweir // into the OpenOffice.org file format. 1513*cdf0e10cSrcweir // These properties only exist at service com::sun::star::text::Shape - the 1514*cdf0e10cSrcweir // Writer UNO service for shapes. 1515*cdf0e10cSrcweir // This code is needed, because the positioning attributes in the 1516*cdf0e10cSrcweir // OpenOffice.org file format are given in horizontal left-to-right layout 1517*cdf0e10cSrcweir // regardless the layout direction the shape is in. In the OASIS Open Office 1518*cdf0e10cSrcweir // file format the positioning attributes are correctly given in the layout 1519*cdf0e10cSrcweir // direction the shape is in. Thus, this code provides the conversion from 1520*cdf0e10cSrcweir // the OASIS Open Office file format to the OpenOffice.org file format. 1521*cdf0e10cSrcweir if ( ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 && 1522*cdf0e10cSrcweir xProps->getPropertySetInfo()->hasPropertyByName( 1523*cdf0e10cSrcweir OUString(RTL_CONSTASCII_USTRINGPARAM("StartPositionInHoriL2R"))) && 1524*cdf0e10cSrcweir xProps->getPropertySetInfo()->hasPropertyByName( 1525*cdf0e10cSrcweir OUString(RTL_CONSTASCII_USTRINGPARAM("EndPositionInHoriL2R"))) ) 1526*cdf0e10cSrcweir { 1527*cdf0e10cSrcweir xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPositionInHoriL2R"))) >>= aStart; 1528*cdf0e10cSrcweir xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPositionInHoriL2R"))) >>= aEnd; 1529*cdf0e10cSrcweir } 1530*cdf0e10cSrcweir else 1531*cdf0e10cSrcweir { 1532*cdf0e10cSrcweir xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition"))) >>= aStart; 1533*cdf0e10cSrcweir xProps->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition"))) >>= aEnd; 1534*cdf0e10cSrcweir } 1535*cdf0e10cSrcweir // <-- 1536*cdf0e10cSrcweir 1537*cdf0e10cSrcweir if( pRefPoint ) 1538*cdf0e10cSrcweir { 1539*cdf0e10cSrcweir aStart.X -= pRefPoint->X; 1540*cdf0e10cSrcweir aStart.Y -= pRefPoint->Y; 1541*cdf0e10cSrcweir aEnd.X -= pRefPoint->X; 1542*cdf0e10cSrcweir aEnd.Y -= pRefPoint->Y; 1543*cdf0e10cSrcweir } 1544*cdf0e10cSrcweir 1545*cdf0e10cSrcweir if( nFeatures & SEF_EXPORT_X ) 1546*cdf0e10cSrcweir { 1547*cdf0e10cSrcweir // svg: x1 1548*cdf0e10cSrcweir mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.X); 1549*cdf0e10cSrcweir aStr = sStringBuffer.makeStringAndClear(); 1550*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X1, aStr); 1551*cdf0e10cSrcweir } 1552*cdf0e10cSrcweir else 1553*cdf0e10cSrcweir { 1554*cdf0e10cSrcweir aEnd.X -= aStart.X; 1555*cdf0e10cSrcweir } 1556*cdf0e10cSrcweir 1557*cdf0e10cSrcweir if( nFeatures & SEF_EXPORT_Y ) 1558*cdf0e10cSrcweir { 1559*cdf0e10cSrcweir // svg: y1 1560*cdf0e10cSrcweir mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aStart.Y); 1561*cdf0e10cSrcweir aStr = sStringBuffer.makeStringAndClear(); 1562*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y1, aStr); 1563*cdf0e10cSrcweir } 1564*cdf0e10cSrcweir else 1565*cdf0e10cSrcweir { 1566*cdf0e10cSrcweir aEnd.Y -= aStart.Y; 1567*cdf0e10cSrcweir } 1568*cdf0e10cSrcweir 1569*cdf0e10cSrcweir // svg: x2 1570*cdf0e10cSrcweir mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.X); 1571*cdf0e10cSrcweir aStr = sStringBuffer.makeStringAndClear(); 1572*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X2, aStr); 1573*cdf0e10cSrcweir 1574*cdf0e10cSrcweir // svg: y2 1575*cdf0e10cSrcweir mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, aEnd.Y); 1576*cdf0e10cSrcweir aStr = sStringBuffer.makeStringAndClear(); 1577*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y2, aStr); 1578*cdf0e10cSrcweir 1579*cdf0e10cSrcweir // write measure shape 1580*cdf0e10cSrcweir sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# 1581*cdf0e10cSrcweir SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_MEASURE, bCreateNewline, sal_True); 1582*cdf0e10cSrcweir 1583*cdf0e10cSrcweir ImpExportDescription( xShape ); // #i68101# 1584*cdf0e10cSrcweir ImpExportEvents( xShape ); 1585*cdf0e10cSrcweir ImpExportGluePoints( xShape ); 1586*cdf0e10cSrcweir 1587*cdf0e10cSrcweir uno::Reference< text::XText > xText( xShape, uno::UNO_QUERY ); 1588*cdf0e10cSrcweir if( xText.is() ) 1589*cdf0e10cSrcweir mrExport.GetTextParagraphExport()->exportText( xText ); 1590*cdf0e10cSrcweir } 1591*cdf0e10cSrcweir 1592*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1593*cdf0e10cSrcweir 1594*cdf0e10cSrcweir void XMLShapeExport::ImpExportOLE2Shape( 1595*cdf0e10cSrcweir const uno::Reference< drawing::XShape >& xShape, 1596*cdf0e10cSrcweir XmlShapeType eShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */, 1597*cdf0e10cSrcweir SvXMLAttributeList* pAttrList /* = NULL */ ) 1598*cdf0e10cSrcweir { 1599*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); 1600*cdf0e10cSrcweir uno::Reference< container::XNamed > xNamed(xShape, uno::UNO_QUERY); 1601*cdf0e10cSrcweir 1602*cdf0e10cSrcweir DBG_ASSERT( xPropSet.is() && xNamed.is(), "ole shape is not implementing needed interfaces"); 1603*cdf0e10cSrcweir if(xPropSet.is() && xNamed.is()) 1604*cdf0e10cSrcweir { 1605*cdf0e10cSrcweir // Transformation 1606*cdf0e10cSrcweir ImpExportNewTrans(xPropSet, nFeatures, pRefPoint); 1607*cdf0e10cSrcweir 1608*cdf0e10cSrcweir sal_Bool bIsEmptyPresObj = sal_False; 1609*cdf0e10cSrcweir 1610*cdf0e10cSrcweir // presentation settings 1611*cdf0e10cSrcweir if(eShapeType == XmlShapeTypePresOLE2Shape) 1612*cdf0e10cSrcweir bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_OBJECT) ); 1613*cdf0e10cSrcweir else if(eShapeType == XmlShapeTypePresChartShape) 1614*cdf0e10cSrcweir bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_CHART) ); 1615*cdf0e10cSrcweir else if(eShapeType == XmlShapeTypePresSheetShape) 1616*cdf0e10cSrcweir bIsEmptyPresObj = ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_TABLE) ); 1617*cdf0e10cSrcweir 1618*cdf0e10cSrcweir sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# 1619*cdf0e10cSrcweir sal_Bool bExportEmbedded(0 != (mrExport.getExportFlags() & EXPORT_EMBEDDED)); 1620*cdf0e10cSrcweir OUString sPersistName; 1621*cdf0e10cSrcweir SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW, 1622*cdf0e10cSrcweir XML_FRAME, bCreateNewline, sal_True ); 1623*cdf0e10cSrcweir 1624*cdf0e10cSrcweir const bool bSaveBackwardsCompatible = ( mrExport.getExportFlags() & EXPORT_SAVEBACKWARDCOMPATIBLE ); 1625*cdf0e10cSrcweir 1626*cdf0e10cSrcweir if( !bIsEmptyPresObj || bSaveBackwardsCompatible ) 1627*cdf0e10cSrcweir { 1628*cdf0e10cSrcweir if (pAttrList) 1629*cdf0e10cSrcweir { 1630*cdf0e10cSrcweir mrExport.AddAttributeList(pAttrList); 1631*cdf0e10cSrcweir } 1632*cdf0e10cSrcweir 1633*cdf0e10cSrcweir OUString sClassId; 1634*cdf0e10cSrcweir OUString sURL; 1635*cdf0e10cSrcweir sal_Bool bInternal = false; 1636*cdf0e10cSrcweir xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("IsInternal"))) >>= bInternal; 1637*cdf0e10cSrcweir 1638*cdf0e10cSrcweir if( !bIsEmptyPresObj ) 1639*cdf0e10cSrcweir { 1640*cdf0e10cSrcweir 1641*cdf0e10cSrcweir if ( bInternal ) 1642*cdf0e10cSrcweir { 1643*cdf0e10cSrcweir // OOo internal links have no storage persistance, URL is stored in the XML file 1644*cdf0e10cSrcweir // the result LinkURL is empty in case the object is not a link 1645*cdf0e10cSrcweir xPropSet->getPropertyValue( OUString::createFromAscii( "LinkURL" ) ) >>= sURL; 1646*cdf0e10cSrcweir } 1647*cdf0e10cSrcweir 1648*cdf0e10cSrcweir xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM( "PersistName" ) ) ) >>= sPersistName; 1649*cdf0e10cSrcweir if ( !sURL.getLength() ) 1650*cdf0e10cSrcweir { 1651*cdf0e10cSrcweir if( sPersistName.getLength() ) 1652*cdf0e10cSrcweir { 1653*cdf0e10cSrcweir sURL = OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.EmbeddedObject:" ) ); 1654*cdf0e10cSrcweir sURL += sPersistName; 1655*cdf0e10cSrcweir } 1656*cdf0e10cSrcweir } 1657*cdf0e10cSrcweir 1658*cdf0e10cSrcweir if( !bInternal ) 1659*cdf0e10cSrcweir xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID"))) >>= sClassId; 1660*cdf0e10cSrcweir 1661*cdf0e10cSrcweir if( sClassId.getLength() ) 1662*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CLASS_ID, sClassId ); 1663*cdf0e10cSrcweir if(!bExportEmbedded) 1664*cdf0e10cSrcweir { 1665*cdf0e10cSrcweir // xlink:href 1666*cdf0e10cSrcweir if( sURL.getLength() ) 1667*cdf0e10cSrcweir { 1668*cdf0e10cSrcweir // #96717# in theorie, if we don't have a url we shouldn't even 1669*cdf0e10cSrcweir // export this ole shape. But practical its to risky right now 1670*cdf0e10cSrcweir // to change this so we better dispose this on load 1671*cdf0e10cSrcweir sURL = mrExport.AddEmbeddedObject( sURL ); 1672*cdf0e10cSrcweir 1673*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sURL ); 1674*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); 1675*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED ); 1676*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD ); 1677*cdf0e10cSrcweir } 1678*cdf0e10cSrcweir } 1679*cdf0e10cSrcweir } 1680*cdf0e10cSrcweir else 1681*cdf0e10cSrcweir { 1682*cdf0e10cSrcweir // export empty href for empty placeholders to be valid odf 1683*cdf0e10cSrcweir OUString sEmptyURL; 1684*cdf0e10cSrcweir 1685*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sEmptyURL ); 1686*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); 1687*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED ); 1688*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD ); 1689*cdf0e10cSrcweir } 1690*cdf0e10cSrcweir 1691*cdf0e10cSrcweir enum XMLTokenEnum eElem = sClassId.getLength() ? XML_OBJECT_OLE : XML_OBJECT; 1692*cdf0e10cSrcweir SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, eElem, sal_True, sal_True ); 1693*cdf0e10cSrcweir 1694*cdf0e10cSrcweir if(bExportEmbedded && !bIsEmptyPresObj) 1695*cdf0e10cSrcweir { 1696*cdf0e10cSrcweir // #100592# 1697*cdf0e10cSrcweir if(bInternal) 1698*cdf0e10cSrcweir { 1699*cdf0e10cSrcweir // embedded XML 1700*cdf0e10cSrcweir uno::Reference< lang::XComponent > xComp; 1701*cdf0e10cSrcweir xPropSet->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Model") ) ) >>= xComp; 1702*cdf0e10cSrcweir DBG_ASSERT( xComp.is(), "no xModel for own OLE format" ); 1703*cdf0e10cSrcweir mrExport.ExportEmbeddedOwnObject( xComp ); 1704*cdf0e10cSrcweir } 1705*cdf0e10cSrcweir else 1706*cdf0e10cSrcweir { 1707*cdf0e10cSrcweir // embed as Base64 1708*cdf0e10cSrcweir // this is an alien object ( currently MSOLE is the only supported type of such objects ) 1709*cdf0e10cSrcweir // in case it is not an OASIS format the object should be asked to store replacement image if possible 1710*cdf0e10cSrcweir 1711*cdf0e10cSrcweir ::rtl::OUString sURLRequest( sURL ); 1712*cdf0e10cSrcweir if ( ( mrExport.getExportFlags() & EXPORT_OASIS ) == 0 ) 1713*cdf0e10cSrcweir sURLRequest += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "?oasis=false" ) ); 1714*cdf0e10cSrcweir mrExport.AddEmbeddedObjectAsBase64( sURLRequest ); 1715*cdf0e10cSrcweir } 1716*cdf0e10cSrcweir } 1717*cdf0e10cSrcweir } 1718*cdf0e10cSrcweir if( !bIsEmptyPresObj ) 1719*cdf0e10cSrcweir { 1720*cdf0e10cSrcweir OUString sURL( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) ); 1721*cdf0e10cSrcweir sURL += sPersistName; 1722*cdf0e10cSrcweir if( !bExportEmbedded ) 1723*cdf0e10cSrcweir { 1724*cdf0e10cSrcweir sURL = GetExport().AddEmbeddedObject( sURL ); 1725*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_XLINK, XML_HREF, sURL ); 1726*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); 1727*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED ); 1728*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD ); 1729*cdf0e10cSrcweir } 1730*cdf0e10cSrcweir 1731*cdf0e10cSrcweir SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_DRAW, 1732*cdf0e10cSrcweir XML_IMAGE, sal_False, sal_True ); 1733*cdf0e10cSrcweir 1734*cdf0e10cSrcweir if( bExportEmbedded ) 1735*cdf0e10cSrcweir GetExport().AddEmbeddedObjectAsBase64( sURL ); 1736*cdf0e10cSrcweir } 1737*cdf0e10cSrcweir 1738*cdf0e10cSrcweir ImpExportEvents( xShape ); 1739*cdf0e10cSrcweir ImpExportGluePoints( xShape ); 1740*cdf0e10cSrcweir ImpExportDescription( xShape ); // #i68101# 1741*cdf0e10cSrcweir } 1742*cdf0e10cSrcweir } 1743*cdf0e10cSrcweir 1744*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1745*cdf0e10cSrcweir 1746*cdf0e10cSrcweir void XMLShapeExport::ImpExportPageShape( 1747*cdf0e10cSrcweir const uno::Reference< drawing::XShape >& xShape, 1748*cdf0e10cSrcweir XmlShapeType eShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */) 1749*cdf0e10cSrcweir { 1750*cdf0e10cSrcweir const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); 1751*cdf0e10cSrcweir if(xPropSet.is()) 1752*cdf0e10cSrcweir { 1753*cdf0e10cSrcweir // #86163# Transformation 1754*cdf0e10cSrcweir ImpExportNewTrans(xPropSet, nFeatures, pRefPoint); 1755*cdf0e10cSrcweir 1756*cdf0e10cSrcweir // export page number used for this page 1757*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() ); 1758*cdf0e10cSrcweir const OUString aPageNumberStr(RTL_CONSTASCII_USTRINGPARAM("PageNumber")); 1759*cdf0e10cSrcweir if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(aPageNumberStr)) 1760*cdf0e10cSrcweir { 1761*cdf0e10cSrcweir sal_Int32 nPageNumber = 0; 1762*cdf0e10cSrcweir xPropSet->getPropertyValue(aPageNumberStr) >>= nPageNumber; 1763*cdf0e10cSrcweir if( nPageNumber ) 1764*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_PAGE_NUMBER, OUString::valueOf(nPageNumber)); 1765*cdf0e10cSrcweir } 1766*cdf0e10cSrcweir 1767*cdf0e10cSrcweir // a presentation page shape, normally used on notes pages only. If 1768*cdf0e10cSrcweir // it is used not as presentation shape, it may have been created with 1769*cdf0e10cSrcweir // copy-paste exchange between draw and impress (this IS possible...) 1770*cdf0e10cSrcweir if(eShapeType == XmlShapeTypePresPageShape) 1771*cdf0e10cSrcweir { 1772*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_CLASS, 1773*cdf0e10cSrcweir XML_PRESENTATION_PAGE); 1774*cdf0e10cSrcweir } 1775*cdf0e10cSrcweir 1776*cdf0e10cSrcweir // write Page shape 1777*cdf0e10cSrcweir sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# 1778*cdf0e10cSrcweir SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PAGE_THUMBNAIL, bCreateNewline, sal_True); 1779*cdf0e10cSrcweir } 1780*cdf0e10cSrcweir } 1781*cdf0e10cSrcweir 1782*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1783*cdf0e10cSrcweir 1784*cdf0e10cSrcweir void XMLShapeExport::ImpExportCaptionShape( 1785*cdf0e10cSrcweir const uno::Reference< drawing::XShape >& xShape, 1786*cdf0e10cSrcweir XmlShapeType, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */) 1787*cdf0e10cSrcweir { 1788*cdf0e10cSrcweir const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); 1789*cdf0e10cSrcweir if(xPropSet.is()) 1790*cdf0e10cSrcweir { 1791*cdf0e10cSrcweir // Transformation 1792*cdf0e10cSrcweir ImpExportNewTrans(xPropSet, nFeatures, pRefPoint); 1793*cdf0e10cSrcweir 1794*cdf0e10cSrcweir // evtl. corner radius? 1795*cdf0e10cSrcweir sal_Int32 nCornerRadius(0L); 1796*cdf0e10cSrcweir xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius"))) >>= nCornerRadius; 1797*cdf0e10cSrcweir if(nCornerRadius) 1798*cdf0e10cSrcweir { 1799*cdf0e10cSrcweir OUStringBuffer sStringBuffer; 1800*cdf0e10cSrcweir mrExport.GetMM100UnitConverter().convertMeasure(sStringBuffer, nCornerRadius); 1801*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, sStringBuffer.makeStringAndClear()); 1802*cdf0e10cSrcweir } 1803*cdf0e10cSrcweir 1804*cdf0e10cSrcweir awt::Point aCaptionPoint; 1805*cdf0e10cSrcweir xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "CaptionPoint" ) ) ) >>= aCaptionPoint; 1806*cdf0e10cSrcweir 1807*cdf0e10cSrcweir mrExport.GetMM100UnitConverter().convertMeasure(msBuffer, aCaptionPoint.X); 1808*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CAPTION_POINT_X, msBuffer.makeStringAndClear() ); 1809*cdf0e10cSrcweir mrExport.GetMM100UnitConverter().convertMeasure(msBuffer, aCaptionPoint.Y); 1810*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CAPTION_POINT_Y, msBuffer.makeStringAndClear() ); 1811*cdf0e10cSrcweir 1812*cdf0e10cSrcweir // write Caption shape. Add export later. 1813*cdf0e10cSrcweir sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# 1814*cdf0e10cSrcweir sal_Bool bAnnotation( (nFeatures & SEF_EXPORT_ANNOTATION) == SEF_EXPORT_ANNOTATION ); 1815*cdf0e10cSrcweir 1816*cdf0e10cSrcweir SvXMLElementExport aObj( mrExport, 1817*cdf0e10cSrcweir (bAnnotation ? XML_NAMESPACE_OFFICE 1818*cdf0e10cSrcweir : XML_NAMESPACE_DRAW), 1819*cdf0e10cSrcweir (bAnnotation ? XML_ANNOTATION : XML_CAPTION), 1820*cdf0e10cSrcweir bCreateNewline, sal_True ); 1821*cdf0e10cSrcweir 1822*cdf0e10cSrcweir ImpExportDescription( xShape ); // #i68101# 1823*cdf0e10cSrcweir ImpExportEvents( xShape ); 1824*cdf0e10cSrcweir ImpExportGluePoints( xShape ); 1825*cdf0e10cSrcweir if( bAnnotation ) 1826*cdf0e10cSrcweir mrExport.exportAnnotationMeta( xShape ); 1827*cdf0e10cSrcweir ImpExportText( xShape ); 1828*cdf0e10cSrcweir } 1829*cdf0e10cSrcweir } 1830*cdf0e10cSrcweir 1831*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1832*cdf0e10cSrcweir 1833*cdf0e10cSrcweir void XMLShapeExport::ImpExportFrameShape( 1834*cdf0e10cSrcweir const uno::Reference< drawing::XShape >& xShape, 1835*cdf0e10cSrcweir XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint) 1836*cdf0e10cSrcweir { 1837*cdf0e10cSrcweir const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); 1838*cdf0e10cSrcweir if(xPropSet.is()) 1839*cdf0e10cSrcweir { 1840*cdf0e10cSrcweir // Transformation 1841*cdf0e10cSrcweir ImpExportNewTrans(xPropSet, nFeatures, pRefPoint); 1842*cdf0e10cSrcweir 1843*cdf0e10cSrcweir sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# 1844*cdf0e10cSrcweir SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, 1845*cdf0e10cSrcweir XML_FRAME, bCreateNewline, sal_True ); 1846*cdf0e10cSrcweir 1847*cdf0e10cSrcweir // export frame url 1848*cdf0e10cSrcweir OUString aStr; 1849*cdf0e10cSrcweir xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "FrameURL" ) ) ) >>= aStr; 1850*cdf0e10cSrcweir mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) ); 1851*cdf0e10cSrcweir mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); 1852*cdf0e10cSrcweir mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED ); 1853*cdf0e10cSrcweir mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD ); 1854*cdf0e10cSrcweir 1855*cdf0e10cSrcweir // export name 1856*cdf0e10cSrcweir xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "FrameName" ) ) ) >>= aStr; 1857*cdf0e10cSrcweir if( aStr.getLength() ) 1858*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_FRAME_NAME, aStr ); 1859*cdf0e10cSrcweir 1860*cdf0e10cSrcweir // write floating frame 1861*cdf0e10cSrcweir { 1862*cdf0e10cSrcweir SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_FLOATING_FRAME, sal_True, sal_True); 1863*cdf0e10cSrcweir } 1864*cdf0e10cSrcweir } 1865*cdf0e10cSrcweir } 1866*cdf0e10cSrcweir 1867*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1868*cdf0e10cSrcweir 1869*cdf0e10cSrcweir void XMLShapeExport::ImpExportAppletShape( 1870*cdf0e10cSrcweir const uno::Reference< drawing::XShape >& xShape, 1871*cdf0e10cSrcweir XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint) 1872*cdf0e10cSrcweir { 1873*cdf0e10cSrcweir const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); 1874*cdf0e10cSrcweir if(xPropSet.is()) 1875*cdf0e10cSrcweir { 1876*cdf0e10cSrcweir // Transformation 1877*cdf0e10cSrcweir ImpExportNewTrans(xPropSet, nFeatures, pRefPoint); 1878*cdf0e10cSrcweir 1879*cdf0e10cSrcweir sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# 1880*cdf0e10cSrcweir SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW, 1881*cdf0e10cSrcweir XML_FRAME, bCreateNewline, sal_True ); 1882*cdf0e10cSrcweir 1883*cdf0e10cSrcweir // export frame url 1884*cdf0e10cSrcweir OUString aStr; 1885*cdf0e10cSrcweir xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletCodeBase" ) ) ) >>= aStr; 1886*cdf0e10cSrcweir mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) ); 1887*cdf0e10cSrcweir mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); 1888*cdf0e10cSrcweir mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED ); 1889*cdf0e10cSrcweir mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD ); 1890*cdf0e10cSrcweir 1891*cdf0e10cSrcweir // export draw:applet-name 1892*cdf0e10cSrcweir xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletName" ) ) ) >>= aStr; 1893*cdf0e10cSrcweir if( aStr.getLength() ) 1894*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_APPLET_NAME, aStr ); 1895*cdf0e10cSrcweir 1896*cdf0e10cSrcweir // export draw:code 1897*cdf0e10cSrcweir xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletCode" ) ) ) >>= aStr; 1898*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_CODE, aStr ); 1899*cdf0e10cSrcweir 1900*cdf0e10cSrcweir // export draw:may-script 1901*cdf0e10cSrcweir sal_Bool bIsScript = false; 1902*cdf0e10cSrcweir xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletIsScript" ) ) ) >>= bIsScript; 1903*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MAY_SCRIPT, bIsScript ? XML_TRUE : XML_FALSE ); 1904*cdf0e10cSrcweir 1905*cdf0e10cSrcweir { 1906*cdf0e10cSrcweir // write applet 1907*cdf0e10cSrcweir SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_APPLET, sal_True, sal_True); 1908*cdf0e10cSrcweir 1909*cdf0e10cSrcweir // export parameters 1910*cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aCommands; 1911*cdf0e10cSrcweir xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "AppletCommands" ) ) ) >>= aCommands; 1912*cdf0e10cSrcweir const sal_Int32 nCount = aCommands.getLength(); 1913*cdf0e10cSrcweir for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ ) 1914*cdf0e10cSrcweir { 1915*cdf0e10cSrcweir aCommands[nIndex].Value >>= aStr; 1916*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aCommands[nIndex].Name ); 1917*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aStr ); 1918*cdf0e10cSrcweir SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True ); 1919*cdf0e10cSrcweir } 1920*cdf0e10cSrcweir } 1921*cdf0e10cSrcweir } 1922*cdf0e10cSrcweir } 1923*cdf0e10cSrcweir 1924*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1925*cdf0e10cSrcweir 1926*cdf0e10cSrcweir void XMLShapeExport::ImpExportPluginShape( 1927*cdf0e10cSrcweir const uno::Reference< drawing::XShape >& xShape, 1928*cdf0e10cSrcweir XmlShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint) 1929*cdf0e10cSrcweir { 1930*cdf0e10cSrcweir const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); 1931*cdf0e10cSrcweir if(xPropSet.is()) 1932*cdf0e10cSrcweir { 1933*cdf0e10cSrcweir // Transformation 1934*cdf0e10cSrcweir ImpExportNewTrans(xPropSet, nFeatures, pRefPoint); 1935*cdf0e10cSrcweir 1936*cdf0e10cSrcweir sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# 1937*cdf0e10cSrcweir SvXMLElementExport aElement( mrExport, XML_NAMESPACE_DRAW, 1938*cdf0e10cSrcweir XML_FRAME, bCreateNewline, sal_True ); 1939*cdf0e10cSrcweir 1940*cdf0e10cSrcweir // export plugin url 1941*cdf0e10cSrcweir OUString aStr; 1942*cdf0e10cSrcweir xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PluginURL" ) ) ) >>= aStr; 1943*cdf0e10cSrcweir mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference(aStr) ); 1944*cdf0e10cSrcweir mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); 1945*cdf0e10cSrcweir mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED ); 1946*cdf0e10cSrcweir mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD ); 1947*cdf0e10cSrcweir 1948*cdf0e10cSrcweir 1949*cdf0e10cSrcweir // export mime-type 1950*cdf0e10cSrcweir xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PluginMimeType" ) ) ) >>= aStr; 1951*cdf0e10cSrcweir if(aStr.getLength()) 1952*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIME_TYPE, aStr ); 1953*cdf0e10cSrcweir 1954*cdf0e10cSrcweir { 1955*cdf0e10cSrcweir // write plugin 1956*cdf0e10cSrcweir SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PLUGIN, sal_True, sal_True); 1957*cdf0e10cSrcweir 1958*cdf0e10cSrcweir // export parameters 1959*cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aCommands; 1960*cdf0e10cSrcweir xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "PluginCommands" ) ) ) >>= aCommands; 1961*cdf0e10cSrcweir const sal_Int32 nCount = aCommands.getLength(); 1962*cdf0e10cSrcweir for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ ) 1963*cdf0e10cSrcweir { 1964*cdf0e10cSrcweir aCommands[nIndex].Value >>= aStr; 1965*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aCommands[nIndex].Name ); 1966*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aStr ); 1967*cdf0e10cSrcweir SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True ); 1968*cdf0e10cSrcweir } 1969*cdf0e10cSrcweir } 1970*cdf0e10cSrcweir } 1971*cdf0e10cSrcweir } 1972*cdf0e10cSrcweir 1973*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 1974*cdf0e10cSrcweir 1975*cdf0e10cSrcweir void XMLShapeExport::ImpExportMediaShape( 1976*cdf0e10cSrcweir const uno::Reference< drawing::XShape >& xShape, 1977*cdf0e10cSrcweir XmlShapeType eShapeType, sal_Int32 nFeatures, com::sun::star::awt::Point* pRefPoint) 1978*cdf0e10cSrcweir { 1979*cdf0e10cSrcweir const uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); 1980*cdf0e10cSrcweir if(xPropSet.is()) 1981*cdf0e10cSrcweir { 1982*cdf0e10cSrcweir // Transformation 1983*cdf0e10cSrcweir ImpExportNewTrans(xPropSet, nFeatures, pRefPoint); 1984*cdf0e10cSrcweir 1985*cdf0e10cSrcweir if(eShapeType == XmlShapeTypePresMediaShape) 1986*cdf0e10cSrcweir ImpExportPresentationAttributes( xPropSet, GetXMLToken(XML_PRESENTATION_OBJECT) ); 1987*cdf0e10cSrcweir 1988*cdf0e10cSrcweir sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# 1989*cdf0e10cSrcweir SvXMLElementExport aElem( mrExport, XML_NAMESPACE_DRAW, 1990*cdf0e10cSrcweir XML_FRAME, bCreateNewline, sal_True ); 1991*cdf0e10cSrcweir 1992*cdf0e10cSrcweir // export media url 1993*cdf0e10cSrcweir OUString aMediaURL; 1994*cdf0e10cSrcweir xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaURL" ) ) ) >>= aMediaURL; 1995*cdf0e10cSrcweir mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, GetExport().GetRelativeReference( aMediaURL ) ); 1996*cdf0e10cSrcweir mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); 1997*cdf0e10cSrcweir mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED ); 1998*cdf0e10cSrcweir mrExport.AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONLOAD ); 1999*cdf0e10cSrcweir 2000*cdf0e10cSrcweir // export mime-type 2001*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_MIME_TYPE, OUString( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.sun.star.media" ) ) ); 2002*cdf0e10cSrcweir 2003*cdf0e10cSrcweir // write plugin 2004*cdf0e10cSrcweir SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_PLUGIN, !( nFeatures & SEF_EXPORT_NO_WS ), sal_True); 2005*cdf0e10cSrcweir 2006*cdf0e10cSrcweir // export parameters 2007*cdf0e10cSrcweir const OUString aFalseStr( RTL_CONSTASCII_USTRINGPARAM( "false" ) ), aTrueStr( RTL_CONSTASCII_USTRINGPARAM( "true" ) ); 2008*cdf0e10cSrcweir 2009*cdf0e10cSrcweir sal_Bool bLoop = false; 2010*cdf0e10cSrcweir const OUString aLoopStr( RTL_CONSTASCII_USTRINGPARAM( "Loop" ) ); 2011*cdf0e10cSrcweir xPropSet->getPropertyValue( aLoopStr ) >>= bLoop; 2012*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aLoopStr ); 2013*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, bLoop ? aTrueStr : aFalseStr ); 2014*cdf0e10cSrcweir delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True ) ); 2015*cdf0e10cSrcweir 2016*cdf0e10cSrcweir sal_Bool bMute = false; 2017*cdf0e10cSrcweir const OUString aMuteStr( RTL_CONSTASCII_USTRINGPARAM( "Mute" ) ); 2018*cdf0e10cSrcweir xPropSet->getPropertyValue( aMuteStr ) >>= bMute; 2019*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aMuteStr ); 2020*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, bMute ? aTrueStr : aFalseStr ); 2021*cdf0e10cSrcweir delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True ) ); 2022*cdf0e10cSrcweir 2023*cdf0e10cSrcweir sal_Int16 nVolumeDB = 0; 2024*cdf0e10cSrcweir const OUString aVolumeDBStr( RTL_CONSTASCII_USTRINGPARAM( "VolumeDB" ) ); 2025*cdf0e10cSrcweir xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "VolumeDB" ) ) ) >>= nVolumeDB; 2026*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aVolumeDBStr ); 2027*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, OUString::valueOf( static_cast< sal_Int32 >( nVolumeDB ) ) ); 2028*cdf0e10cSrcweir delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True ) ); 2029*cdf0e10cSrcweir 2030*cdf0e10cSrcweir media::ZoomLevel eZoom; 2031*cdf0e10cSrcweir const OUString aZoomStr( RTL_CONSTASCII_USTRINGPARAM( "Zoom" ) ); 2032*cdf0e10cSrcweir OUString aZoomValue; 2033*cdf0e10cSrcweir xPropSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Zoom" ) ) ) >>= eZoom; 2034*cdf0e10cSrcweir switch( eZoom ) 2035*cdf0e10cSrcweir { 2036*cdf0e10cSrcweir case( media::ZoomLevel_ZOOM_1_TO_4 ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "25%" ) ); break; 2037*cdf0e10cSrcweir case( media::ZoomLevel_ZOOM_1_TO_2 ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "50%" ) ); break; 2038*cdf0e10cSrcweir case( media::ZoomLevel_ORIGINAL ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "100%" ) ); break; 2039*cdf0e10cSrcweir case( media::ZoomLevel_ZOOM_2_TO_1 ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "200%" ) ); break; 2040*cdf0e10cSrcweir case( media::ZoomLevel_ZOOM_4_TO_1 ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "400%" ) ); break; 2041*cdf0e10cSrcweir case( media::ZoomLevel_FIT_TO_WINDOW ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "fit" ) ); break; 2042*cdf0e10cSrcweir case( media::ZoomLevel_FIT_TO_WINDOW_FIXED_ASPECT ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "fixedfit" ) ); break; 2043*cdf0e10cSrcweir case( media::ZoomLevel_FULLSCREEN ): aZoomValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "fullscreen" ) ); break; 2044*cdf0e10cSrcweir 2045*cdf0e10cSrcweir default: 2046*cdf0e10cSrcweir break; 2047*cdf0e10cSrcweir } 2048*cdf0e10cSrcweir 2049*cdf0e10cSrcweir if( aZoomValue.getLength() ) 2050*cdf0e10cSrcweir { 2051*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aZoomStr ); 2052*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aZoomValue ); 2053*cdf0e10cSrcweir delete( new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, sal_False, sal_True ) ); 2054*cdf0e10cSrcweir } 2055*cdf0e10cSrcweir } 2056*cdf0e10cSrcweir } 2057