1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_xmloff.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <memory> 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #include "unointerfacetouniqueidentifiermapper.hxx" 34*cdf0e10cSrcweir #include <com/sun/star/presentation/ClickAction.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/lang/ServiceNotRegisteredException.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/container/XChild.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/text/XText.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/chart/XChartDocument.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/drawing/XControlShape.hpp> 40*cdf0e10cSrcweir #include <com/sun/star/style/XStyle.hpp> 41*cdf0e10cSrcweir #include <com/sun/star/drawing/XGluePointsSupplier.hpp> 42*cdf0e10cSrcweir #include <com/sun/star/container/XIdentifierAccess.hpp> 43*cdf0e10cSrcweir #include <com/sun/star/drawing/GluePoint2.hpp> 44*cdf0e10cSrcweir #include <com/sun/star/drawing/Alignment.hpp> 45*cdf0e10cSrcweir #include <com/sun/star/drawing/EscapeDirection.hpp> 46*cdf0e10cSrcweir #include <com/sun/star/table/XColumnRowRange.hpp> 47*cdf0e10cSrcweir #include <xmloff/xmluconv.hxx> 48*cdf0e10cSrcweir #include "PropertySetMerger.hxx" 49*cdf0e10cSrcweir 50*cdf0e10cSrcweir #include <xmloff/shapeexport.hxx> 51*cdf0e10cSrcweir #include "sdpropls.hxx" 52*cdf0e10cSrcweir #include "sdxmlexp_impl.hxx" 53*cdf0e10cSrcweir #include <xmloff/families.hxx> 54*cdf0e10cSrcweir #include <tools/debug.hxx> 55*cdf0e10cSrcweir #include <xmloff/contextid.hxx> 56*cdf0e10cSrcweir #include <xmloff/xmltoken.hxx> 57*cdf0e10cSrcweir #include <tools/string.hxx> 58*cdf0e10cSrcweir #include <sot/clsids.hxx> 59*cdf0e10cSrcweir #include <tools/globname.hxx> 60*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyState.hpp> 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 63*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 64*cdf0e10cSrcweir #include <com/sun/star/drawing/XCustomShapeEngine.hpp> 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir #include "xmloff/xmlnmspe.hxx" 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir using ::rtl::OUString; 69*cdf0e10cSrcweir using ::rtl::OUStringBuffer; 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir using namespace ::com::sun::star; 72*cdf0e10cSrcweir using namespace ::xmloff::token; 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir XMLShapeExport::XMLShapeExport(SvXMLExport& rExp, 77*cdf0e10cSrcweir SvXMLExportPropertyMapper *pExtMapper ) 78*cdf0e10cSrcweir : mrExport( rExp ), 79*cdf0e10cSrcweir mnNextUniqueShapeId(1), 80*cdf0e10cSrcweir maShapesInfos(), 81*cdf0e10cSrcweir maCurrentShapesIter(maShapesInfos.end()), 82*cdf0e10cSrcweir mbExportLayer( sal_False ), 83*cdf0e10cSrcweir // #88546# init to sal_False 84*cdf0e10cSrcweir mbHandleProgressBar( sal_False ), 85*cdf0e10cSrcweir msZIndex( RTL_CONSTASCII_USTRINGPARAM("ZOrder") ), 86*cdf0e10cSrcweir msPrintable( RTL_CONSTASCII_USTRINGPARAM("Printable") ), 87*cdf0e10cSrcweir msVisible( RTL_CONSTASCII_USTRINGPARAM("Visible") ), 88*cdf0e10cSrcweir msEmptyPres( RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), 89*cdf0e10cSrcweir msModel( RTL_CONSTASCII_USTRINGPARAM("Model") ), 90*cdf0e10cSrcweir msStartShape( RTL_CONSTASCII_USTRINGPARAM("StartShape") ), 91*cdf0e10cSrcweir msEndShape( RTL_CONSTASCII_USTRINGPARAM("EndShape") ), 92*cdf0e10cSrcweir msOnClick( RTL_CONSTASCII_USTRINGPARAM("OnClick") ), 93*cdf0e10cSrcweir #ifdef ISSUE66550_HLINK_FOR_SHAPES 94*cdf0e10cSrcweir msOnAction( RTL_CONSTASCII_USTRINGPARAM("OnAction") ), 95*cdf0e10cSrcweir msAction( RTL_CONSTASCII_USTRINGPARAM("Action") ), 96*cdf0e10cSrcweir msURL( RTL_CONSTASCII_USTRINGPARAM("URL") ), 97*cdf0e10cSrcweir #endif 98*cdf0e10cSrcweir msEventType( RTL_CONSTASCII_USTRINGPARAM("EventType") ), 99*cdf0e10cSrcweir msPresentation( RTL_CONSTASCII_USTRINGPARAM("Presentation") ), 100*cdf0e10cSrcweir msMacroName( RTL_CONSTASCII_USTRINGPARAM("MacroName") ), 101*cdf0e10cSrcweir msScript( RTL_CONSTASCII_USTRINGPARAM("Script") ), 102*cdf0e10cSrcweir msLibrary( RTL_CONSTASCII_USTRINGPARAM("Library") ), 103*cdf0e10cSrcweir msClickAction( RTL_CONSTASCII_USTRINGPARAM("ClickAction") ), 104*cdf0e10cSrcweir msBookmark( RTL_CONSTASCII_USTRINGPARAM("Bookmark") ), 105*cdf0e10cSrcweir msEffect( RTL_CONSTASCII_USTRINGPARAM("Effect") ), 106*cdf0e10cSrcweir msPlayFull( RTL_CONSTASCII_USTRINGPARAM("PlayFull") ), 107*cdf0e10cSrcweir msVerb( RTL_CONSTASCII_USTRINGPARAM("Verb") ), 108*cdf0e10cSrcweir msSoundURL( RTL_CONSTASCII_USTRINGPARAM("SoundURL") ), 109*cdf0e10cSrcweir msSpeed( RTL_CONSTASCII_USTRINGPARAM("Speed") ), 110*cdf0e10cSrcweir msStarBasic( RTL_CONSTASCII_USTRINGPARAM("StarBasic") ) 111*cdf0e10cSrcweir { 112*cdf0e10cSrcweir // construct PropertyHandlerFactory 113*cdf0e10cSrcweir mxSdPropHdlFactory = new XMLSdPropHdlFactory( mrExport.GetModel(), rExp ); 114*cdf0e10cSrcweir // construct PropertySetMapper 115*cdf0e10cSrcweir mxPropertySetMapper = CreateShapePropMapper( mrExport ); 116*cdf0e10cSrcweir if( pExtMapper ) 117*cdf0e10cSrcweir { 118*cdf0e10cSrcweir UniReference < SvXMLExportPropertyMapper > xExtMapper( pExtMapper ); 119*cdf0e10cSrcweir mxPropertySetMapper->ChainExportMapper( xExtMapper ); 120*cdf0e10cSrcweir } 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir /* 123*cdf0e10cSrcweir // chain text attributes 124*cdf0e10cSrcweir xPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(rExp)); 125*cdf0e10cSrcweir */ 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir mrExport.GetAutoStylePool()->AddFamily( 128*cdf0e10cSrcweir XML_STYLE_FAMILY_SD_GRAPHICS_ID, 129*cdf0e10cSrcweir OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)), 130*cdf0e10cSrcweir GetPropertySetMapper(), 131*cdf0e10cSrcweir OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_PREFIX))); 132*cdf0e10cSrcweir mrExport.GetAutoStylePool()->AddFamily( 133*cdf0e10cSrcweir XML_STYLE_FAMILY_SD_PRESENTATION_ID, 134*cdf0e10cSrcweir OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_PRESENTATION_NAME)), 135*cdf0e10cSrcweir GetPropertySetMapper(), 136*cdf0e10cSrcweir OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_PRESENTATION_PREFIX))); 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir maCurrentInfo = maShapeInfos.end(); 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir // create table export helper and let him add his families in time 141*cdf0e10cSrcweir GetShapeTableExport(); 142*cdf0e10cSrcweir } 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir XMLShapeExport::~XMLShapeExport() 147*cdf0e10cSrcweir { 148*cdf0e10cSrcweir } 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir // sj: replacing CustomShapes with standard objects that are also supported in OpenOffice.org format 153*cdf0e10cSrcweir uno::Reference< drawing::XShape > XMLShapeExport::checkForCustomShapeReplacement( const uno::Reference< drawing::XShape >& xShape ) 154*cdf0e10cSrcweir { 155*cdf0e10cSrcweir uno::Reference< drawing::XShape > xCustomShapeReplacement; 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir if( ( GetExport().getExportFlags() & EXPORT_OASIS ) == 0 ) 158*cdf0e10cSrcweir { 159*cdf0e10cSrcweir String aType( (OUString)xShape->getShapeType() ); 160*cdf0e10cSrcweir if( aType.EqualsAscii( (const sal_Char*)"com.sun.star.drawing.CustomShape" ) ) 161*cdf0e10cSrcweir { 162*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY ); 163*cdf0e10cSrcweir if( xSet.is() ) 164*cdf0e10cSrcweir { 165*cdf0e10cSrcweir rtl::OUString aEngine; 166*cdf0e10cSrcweir xSet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeEngine" ) ) ) >>= aEngine; 167*cdf0e10cSrcweir if ( !aEngine.getLength() ) 168*cdf0e10cSrcweir aEngine = OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.EnhancedCustomShapeEngine" ) ); 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); 171*cdf0e10cSrcweir /* 172*cdf0e10cSrcweir uno::Reference< drawing::XShape > aXShape = GetXShapeForSdrObject( (SdrObjCustomShape*)pCustomShape ); 173*cdf0e10cSrcweir if ( !aXShape.is() ) 174*cdf0e10cSrcweir aXShape = new SvxCustomShape( (SdrObjCustomShape*)pCustomShape ); 175*cdf0e10cSrcweir */ 176*cdf0e10cSrcweir if ( aEngine.getLength() && xFactory.is() ) 177*cdf0e10cSrcweir { 178*cdf0e10cSrcweir uno::Sequence< uno::Any > aArgument( 1 ); 179*cdf0e10cSrcweir uno::Sequence< beans::PropertyValue > aPropValues( 2 ); 180*cdf0e10cSrcweir aPropValues[ 0 ].Name = rtl::OUString::createFromAscii( "CustomShape" ); 181*cdf0e10cSrcweir aPropValues[ 0 ].Value <<= xShape; 182*cdf0e10cSrcweir sal_Bool bForceGroupWithText = sal_True; 183*cdf0e10cSrcweir aPropValues[ 1 ].Name = rtl::OUString::createFromAscii( "ForceGroupWithText" ); 184*cdf0e10cSrcweir aPropValues[ 1 ].Value <<= bForceGroupWithText; 185*cdf0e10cSrcweir aArgument[ 0 ] <<= aPropValues; 186*cdf0e10cSrcweir uno::Reference< uno::XInterface > xInterface( xFactory->createInstanceWithArguments( aEngine, aArgument ) ); 187*cdf0e10cSrcweir if ( xInterface.is() ) 188*cdf0e10cSrcweir { 189*cdf0e10cSrcweir uno::Reference< drawing::XCustomShapeEngine > xCustomShapeEngine( 190*cdf0e10cSrcweir uno::Reference< drawing::XCustomShapeEngine >( xInterface, uno::UNO_QUERY ) ); 191*cdf0e10cSrcweir if ( xCustomShapeEngine.is() ) 192*cdf0e10cSrcweir xCustomShapeReplacement = xCustomShapeEngine->render(); 193*cdf0e10cSrcweir } 194*cdf0e10cSrcweir } 195*cdf0e10cSrcweir } 196*cdf0e10cSrcweir } 197*cdf0e10cSrcweir } 198*cdf0e10cSrcweir return xCustomShapeReplacement; 199*cdf0e10cSrcweir } 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir // This method collects all automatic styles for the given XShape 202*cdf0e10cSrcweir void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShape >& xShape ) 203*cdf0e10cSrcweir { 204*cdf0e10cSrcweir if( maCurrentShapesIter == maShapesInfos.end() ) 205*cdf0e10cSrcweir { 206*cdf0e10cSrcweir DBG_ERROR( "XMLShapeExport::collectShapeAutoStyles(): no call to seekShapes()!" ); 207*cdf0e10cSrcweir return; 208*cdf0e10cSrcweir } 209*cdf0e10cSrcweir sal_Int32 nZIndex = 0; 210*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY ); 211*cdf0e10cSrcweir if( xSet.is() ) 212*cdf0e10cSrcweir xSet->getPropertyValue(msZIndex) >>= nZIndex; 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir ImplXMLShapeExportInfoVector& aShapeInfoVector = (*maCurrentShapesIter).second; 215*cdf0e10cSrcweir 216*cdf0e10cSrcweir if( (sal_Int32)aShapeInfoVector.size() <= nZIndex ) 217*cdf0e10cSrcweir { 218*cdf0e10cSrcweir DBG_ERROR( "XMLShapeExport::collectShapeAutoStyles(): no shape info allocated for a given shape" ); 219*cdf0e10cSrcweir return; 220*cdf0e10cSrcweir } 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir ImplXMLShapeExportInfo& aShapeInfo = aShapeInfoVector[nZIndex]; 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir uno::Reference< drawing::XShape > xCustomShapeReplacement = checkForCustomShapeReplacement( xShape ); 225*cdf0e10cSrcweir if ( xCustomShapeReplacement.is() ) 226*cdf0e10cSrcweir aShapeInfo.xCustomShapeReplacement = xCustomShapeReplacement; 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir // ----------------------------- 229*cdf0e10cSrcweir // first compute the shapes type 230*cdf0e10cSrcweir // ----------------------------- 231*cdf0e10cSrcweir ImpCalcShapeType(xShape, aShapeInfo.meShapeType); 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir const bool bObjSupportsText = 234*cdf0e10cSrcweir // aShapeInfo.meShapeType != XmlShapeTypeDrawControlShape && 235*cdf0e10cSrcweir aShapeInfo.meShapeType != XmlShapeTypeDrawChartShape && 236*cdf0e10cSrcweir aShapeInfo.meShapeType != XmlShapeTypePresChartShape && 237*cdf0e10cSrcweir aShapeInfo.meShapeType != XmlShapeTypeDrawOLE2Shape && 238*cdf0e10cSrcweir aShapeInfo.meShapeType != XmlShapeTypePresOLE2Shape && 239*cdf0e10cSrcweir aShapeInfo.meShapeType != XmlShapeTypeDrawSheetShape && 240*cdf0e10cSrcweir aShapeInfo.meShapeType != XmlShapeTypePresSheetShape && 241*cdf0e10cSrcweir aShapeInfo.meShapeType != XmlShapeTypeDraw3DSceneObject && 242*cdf0e10cSrcweir aShapeInfo.meShapeType != XmlShapeTypeDraw3DCubeObject && 243*cdf0e10cSrcweir aShapeInfo.meShapeType != XmlShapeTypeDraw3DSphereObject && 244*cdf0e10cSrcweir aShapeInfo.meShapeType != XmlShapeTypeDraw3DLatheObject && 245*cdf0e10cSrcweir aShapeInfo.meShapeType != XmlShapeTypeDraw3DExtrudeObject && 246*cdf0e10cSrcweir aShapeInfo.meShapeType != XmlShapeTypeDrawPageShape && 247*cdf0e10cSrcweir aShapeInfo.meShapeType != XmlShapeTypePresPageShape && 248*cdf0e10cSrcweir aShapeInfo.meShapeType != XmlShapeTypeDrawGroupShape; 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir const bool bObjSupportsStyle = 251*cdf0e10cSrcweir aShapeInfo.meShapeType != XmlShapeTypeDrawGroupShape; 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir sal_Bool bIsEmptyPresObj = sal_False; 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); 256*cdf0e10cSrcweir if ( aShapeInfo.xCustomShapeReplacement.is() ) 257*cdf0e10cSrcweir xPropSet.clear(); 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir // ---------------- 260*cdf0e10cSrcweir // prep text styles 261*cdf0e10cSrcweir // ---------------- 262*cdf0e10cSrcweir if( xPropSet.is() && bObjSupportsText ) 263*cdf0e10cSrcweir { 264*cdf0e10cSrcweir uno::Reference< text::XText > xText(xShape, uno::UNO_QUERY); 265*cdf0e10cSrcweir if(xText.is() && xText->getString().getLength()) 266*cdf0e10cSrcweir { 267*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() ); 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName(msEmptyPres) ) 270*cdf0e10cSrcweir { 271*cdf0e10cSrcweir uno::Any aAny = xPropSet->getPropertyValue(msEmptyPres); 272*cdf0e10cSrcweir aAny >>= bIsEmptyPresObj; 273*cdf0e10cSrcweir } 274*cdf0e10cSrcweir 275*cdf0e10cSrcweir if(!bIsEmptyPresObj) 276*cdf0e10cSrcweir { 277*cdf0e10cSrcweir GetExport().GetTextParagraphExport()->collectTextAutoStyles( xText ); 278*cdf0e10cSrcweir } 279*cdf0e10cSrcweir } 280*cdf0e10cSrcweir } 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir // ------------------------------ 283*cdf0e10cSrcweir // compute the shape parent style 284*cdf0e10cSrcweir // ------------------------------ 285*cdf0e10cSrcweir if( xPropSet.is() ) 286*cdf0e10cSrcweir { 287*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > xPropertySetInfo( xPropSet->getPropertySetInfo() ); 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir OUString aParentName; 290*cdf0e10cSrcweir uno::Reference< style::XStyle > xStyle; 291*cdf0e10cSrcweir 292*cdf0e10cSrcweir if( bObjSupportsStyle ) 293*cdf0e10cSrcweir { 294*cdf0e10cSrcweir if( xPropertySetInfo.is() && xPropertySetInfo->hasPropertyByName( OUString(RTL_CONSTASCII_USTRINGPARAM("Style"))) ) 295*cdf0e10cSrcweir xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Style"))) >>= xStyle; 296*cdf0e10cSrcweir 297*cdf0e10cSrcweir if(xStyle.is()) 298*cdf0e10cSrcweir { 299*cdf0e10cSrcweir // get family ID 300*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xStylePropSet(xStyle, uno::UNO_QUERY); 301*cdf0e10cSrcweir DBG_ASSERT( xStylePropSet.is(), "style without a XPropertySet?" ); 302*cdf0e10cSrcweir try 303*cdf0e10cSrcweir { 304*cdf0e10cSrcweir if(xStylePropSet.is()) 305*cdf0e10cSrcweir { 306*cdf0e10cSrcweir OUString aFamilyName; 307*cdf0e10cSrcweir xStylePropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Family"))) >>= aFamilyName; 308*cdf0e10cSrcweir if(aFamilyName.getLength() && !aFamilyName.equals(OUString(RTL_CONSTASCII_USTRINGPARAM("graphics")))) 309*cdf0e10cSrcweir aShapeInfo.mnFamily = XML_STYLE_FAMILY_SD_PRESENTATION_ID; 310*cdf0e10cSrcweir } 311*cdf0e10cSrcweir } 312*cdf0e10cSrcweir catch(beans::UnknownPropertyException aException) 313*cdf0e10cSrcweir { 314*cdf0e10cSrcweir // Ignored. 315*cdf0e10cSrcweir DBG_ASSERT(false, 316*cdf0e10cSrcweir "XMLShapeExport::collectShapeAutoStyles: style has no 'Family' property"); 317*cdf0e10cSrcweir } 318*cdf0e10cSrcweir 319*cdf0e10cSrcweir // get parent-style name 320*cdf0e10cSrcweir if(XML_STYLE_FAMILY_SD_PRESENTATION_ID == aShapeInfo.mnFamily) 321*cdf0e10cSrcweir { 322*cdf0e10cSrcweir aParentName = msPresentationStylePrefix; 323*cdf0e10cSrcweir } 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir aParentName += xStyle->getName(); 326*cdf0e10cSrcweir } 327*cdf0e10cSrcweir } 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir // filter propset 330*cdf0e10cSrcweir std::vector< XMLPropertyState > xPropStates; 331*cdf0e10cSrcweir 332*cdf0e10cSrcweir sal_Int32 nCount = 0; 333*cdf0e10cSrcweir if( (!bIsEmptyPresObj || (aShapeInfo.meShapeType != XmlShapeTypePresPageShape)) ) 334*cdf0e10cSrcweir { 335*cdf0e10cSrcweir xPropStates = GetPropertySetMapper()->Filter( xPropSet ); 336*cdf0e10cSrcweir 337*cdf0e10cSrcweir if (XmlShapeTypeDrawControlShape == aShapeInfo.meShapeType) 338*cdf0e10cSrcweir { 339*cdf0e10cSrcweir // for control shapes, we additionally need the number format style (if any) 340*cdf0e10cSrcweir uno::Reference< drawing::XControlShape > xControl(xShape, uno::UNO_QUERY); 341*cdf0e10cSrcweir DBG_ASSERT(xControl.is(), "XMLShapeExport::collectShapeAutoStyles: ShapeType control, but no XControlShape!"); 342*cdf0e10cSrcweir if (xControl.is()) 343*cdf0e10cSrcweir { 344*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xControlModel(xControl->getControl(), uno::UNO_QUERY); 345*cdf0e10cSrcweir DBG_ASSERT(xControlModel.is(), "XMLShapeExport::collectShapeAutoStyles: no control model on the control shape!"); 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir ::rtl::OUString sNumberStyle = mrExport.GetFormExport()->getControlNumberStyle(xControlModel); 348*cdf0e10cSrcweir if (0 != sNumberStyle.getLength()) 349*cdf0e10cSrcweir { 350*cdf0e10cSrcweir sal_Int32 nIndex = GetPropertySetMapper()->getPropertySetMapper()->FindEntryIndex(CTF_SD_CONTROL_SHAPE_DATA_STYLE); 351*cdf0e10cSrcweir // TODO : this retrieval of the index could be moved into the ctor, holding the index 352*cdf0e10cSrcweir // as member, thus saving time. 353*cdf0e10cSrcweir DBG_ASSERT(-1 != nIndex, "XMLShapeExport::collectShapeAutoStyles: could not obtain the index for our context id!"); 354*cdf0e10cSrcweir 355*cdf0e10cSrcweir XMLPropertyState aNewState(nIndex, uno::makeAny(sNumberStyle)); 356*cdf0e10cSrcweir xPropStates.push_back(aNewState); 357*cdf0e10cSrcweir } 358*cdf0e10cSrcweir } 359*cdf0e10cSrcweir } 360*cdf0e10cSrcweir 361*cdf0e10cSrcweir std::vector< XMLPropertyState >::iterator aIter = xPropStates.begin(); 362*cdf0e10cSrcweir std::vector< XMLPropertyState >::iterator aEnd = xPropStates.end(); 363*cdf0e10cSrcweir while( aIter != aEnd ) 364*cdf0e10cSrcweir { 365*cdf0e10cSrcweir if( aIter->mnIndex != -1 ) 366*cdf0e10cSrcweir nCount++; 367*cdf0e10cSrcweir aIter++; 368*cdf0e10cSrcweir } 369*cdf0e10cSrcweir } 370*cdf0e10cSrcweir 371*cdf0e10cSrcweir if(nCount == 0) 372*cdf0e10cSrcweir { 373*cdf0e10cSrcweir // no hard attributes, use parent style name for export 374*cdf0e10cSrcweir aShapeInfo.msStyleName = aParentName; 375*cdf0e10cSrcweir } 376*cdf0e10cSrcweir else 377*cdf0e10cSrcweir { 378*cdf0e10cSrcweir // there are filtered properties -> hard attributes 379*cdf0e10cSrcweir // try to find this style in AutoStylePool 380*cdf0e10cSrcweir aShapeInfo.msStyleName = mrExport.GetAutoStylePool()->Find(aShapeInfo.mnFamily, aParentName, xPropStates); 381*cdf0e10cSrcweir 382*cdf0e10cSrcweir if(!aShapeInfo.msStyleName.getLength()) 383*cdf0e10cSrcweir { 384*cdf0e10cSrcweir // Style did not exist, add it to AutoStalePool 385*cdf0e10cSrcweir aShapeInfo.msStyleName = mrExport.GetAutoStylePool()->Add(aShapeInfo.mnFamily, aParentName, xPropStates); 386*cdf0e10cSrcweir } 387*cdf0e10cSrcweir } 388*cdf0e10cSrcweir 389*cdf0e10cSrcweir // optionaly generate auto style for text attributes 390*cdf0e10cSrcweir if( (!bIsEmptyPresObj || (aShapeInfo.meShapeType != XmlShapeTypePresPageShape)) && bObjSupportsText ) 391*cdf0e10cSrcweir { 392*cdf0e10cSrcweir xPropStates = GetExport().GetTextParagraphExport()->GetParagraphPropertyMapper()->Filter( xPropSet ); 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir // ---------------------------------------------------------------------- 395*cdf0e10cSrcweir // yet more additionally, we need to care for the ParaAdjust property 396*cdf0e10cSrcweir if ( XmlShapeTypeDrawControlShape == aShapeInfo.meShapeType ) 397*cdf0e10cSrcweir { 398*cdf0e10cSrcweir uno::Reference< beans::XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() ); 399*cdf0e10cSrcweir uno::Reference< beans::XPropertyState > xPropState( xPropSet, uno::UNO_QUERY ); 400*cdf0e10cSrcweir if ( xPropSetInfo.is() && xPropState.is() ) 401*cdf0e10cSrcweir { 402*cdf0e10cSrcweir // this is because: 403*cdf0e10cSrcweir // * if controls shapes have a ParaAdjust property, then this is the Align property of the control model 404*cdf0e10cSrcweir // * control models are allowed to have an Align of "void" 405*cdf0e10cSrcweir // * the Default for control model's Align is TextAlign_LEFT 406*cdf0e10cSrcweir // * defaults for style properties are not written, but we need to write the "left", 407*cdf0e10cSrcweir // because we need to distiguish this "left" from the case where not align attribute 408*cdf0e10cSrcweir // is present which means "void" 409*cdf0e10cSrcweir // 102407 - 2002-11-01 - fs@openoffice.org 410*cdf0e10cSrcweir static const ::rtl::OUString s_sParaAdjustPropertyName( RTL_CONSTASCII_USTRINGPARAM( "ParaAdjust" ) ); 411*cdf0e10cSrcweir if ( xPropSetInfo->hasPropertyByName( s_sParaAdjustPropertyName ) 412*cdf0e10cSrcweir && ( beans::PropertyState_DEFAULT_VALUE == xPropState->getPropertyState( s_sParaAdjustPropertyName ) ) 413*cdf0e10cSrcweir ) 414*cdf0e10cSrcweir { 415*cdf0e10cSrcweir sal_Int32 nIndex = GetExport().GetTextParagraphExport()->GetParagraphPropertyMapper()->getPropertySetMapper()->FindEntryIndex( CTF_SD_SHAPE_PARA_ADJUST ); 416*cdf0e10cSrcweir // TODO : this retrieval of the index should be moved into the ctor, holding the index 417*cdf0e10cSrcweir // as member, thus saving time. 418*cdf0e10cSrcweir DBG_ASSERT(-1 != nIndex, "XMLShapeExport::collectShapeAutoStyles: could not obtain the index for the ParaAdjust context id!"); 419*cdf0e10cSrcweir 420*cdf0e10cSrcweir uno::Any aParaAdjustValue = xPropSet->getPropertyValue( s_sParaAdjustPropertyName ); 421*cdf0e10cSrcweir XMLPropertyState aAlignDefaultState( nIndex, aParaAdjustValue ); 422*cdf0e10cSrcweir 423*cdf0e10cSrcweir xPropStates.push_back( aAlignDefaultState ); 424*cdf0e10cSrcweir } 425*cdf0e10cSrcweir } 426*cdf0e10cSrcweir } 427*cdf0e10cSrcweir // ---------------------------------------------------------------------- 428*cdf0e10cSrcweir 429*cdf0e10cSrcweir nCount = 0; 430*cdf0e10cSrcweir std::vector< XMLPropertyState >::iterator aIter = xPropStates.begin(); 431*cdf0e10cSrcweir std::vector< XMLPropertyState >::iterator aEnd = xPropStates.end(); 432*cdf0e10cSrcweir while( aIter != aEnd ) 433*cdf0e10cSrcweir { 434*cdf0e10cSrcweir if( aIter->mnIndex != -1 ) 435*cdf0e10cSrcweir nCount++; 436*cdf0e10cSrcweir aIter++; 437*cdf0e10cSrcweir } 438*cdf0e10cSrcweir 439*cdf0e10cSrcweir if( nCount ) 440*cdf0e10cSrcweir { 441*cdf0e10cSrcweir const OUString aEmpty; 442*cdf0e10cSrcweir aShapeInfo.msTextStyleName = mrExport.GetAutoStylePool()->Find( XML_STYLE_FAMILY_TEXT_PARAGRAPH, aEmpty, xPropStates ); 443*cdf0e10cSrcweir if(!aShapeInfo.msTextStyleName.getLength()) 444*cdf0e10cSrcweir { 445*cdf0e10cSrcweir // Style did not exist, add it to AutoStalePool 446*cdf0e10cSrcweir aShapeInfo.msTextStyleName = mrExport.GetAutoStylePool()->Add(XML_STYLE_FAMILY_TEXT_PARAGRAPH, aEmpty, xPropStates); 447*cdf0e10cSrcweir } 448*cdf0e10cSrcweir } 449*cdf0e10cSrcweir } 450*cdf0e10cSrcweir } 451*cdf0e10cSrcweir 452*cdf0e10cSrcweir // ---------------------------------------- 453*cdf0e10cSrcweir // prepare animation informations if needed 454*cdf0e10cSrcweir // ---------------------------------------- 455*cdf0e10cSrcweir if( mxAnimationsExporter.is() ) 456*cdf0e10cSrcweir mxAnimationsExporter->prepare( xShape, mrExport ); 457*cdf0e10cSrcweir 458*cdf0e10cSrcweir // check for special shapes 459*cdf0e10cSrcweir 460*cdf0e10cSrcweir switch( aShapeInfo.meShapeType ) 461*cdf0e10cSrcweir { 462*cdf0e10cSrcweir case XmlShapeTypeDrawConnectorShape: 463*cdf0e10cSrcweir { 464*cdf0e10cSrcweir uno::Reference< uno::XInterface > xConnection; 465*cdf0e10cSrcweir 466*cdf0e10cSrcweir // create shape ids for export later 467*cdf0e10cSrcweir xPropSet->getPropertyValue( msStartShape ) >>= xConnection; 468*cdf0e10cSrcweir if( xConnection.is() ) 469*cdf0e10cSrcweir mrExport.getInterfaceToIdentifierMapper().registerReference( xConnection ); 470*cdf0e10cSrcweir 471*cdf0e10cSrcweir xPropSet->getPropertyValue( msEndShape ) >>= xConnection; 472*cdf0e10cSrcweir if( xConnection.is() ) 473*cdf0e10cSrcweir mrExport.getInterfaceToIdentifierMapper().registerReference( xConnection ); 474*cdf0e10cSrcweir break; 475*cdf0e10cSrcweir } 476*cdf0e10cSrcweir case XmlShapeTypePresTableShape: 477*cdf0e10cSrcweir case XmlShapeTypeDrawTableShape: 478*cdf0e10cSrcweir { 479*cdf0e10cSrcweir try 480*cdf0e10cSrcweir { 481*cdf0e10cSrcweir uno::Reference< table::XColumnRowRange > xRange( xSet->getPropertyValue( msModel ), uno::UNO_QUERY_THROW ); 482*cdf0e10cSrcweir GetShapeTableExport()->collectTableAutoStyles( xRange ); 483*cdf0e10cSrcweir } 484*cdf0e10cSrcweir catch( uno::Exception& ) 485*cdf0e10cSrcweir { 486*cdf0e10cSrcweir DBG_ERROR( "XMLShapeExport::collectShapeAutoStyles(): exception caught while collection auto styles for a table!" ); 487*cdf0e10cSrcweir } 488*cdf0e10cSrcweir break; 489*cdf0e10cSrcweir } 490*cdf0e10cSrcweir default: 491*cdf0e10cSrcweir break; 492*cdf0e10cSrcweir } 493*cdf0e10cSrcweir 494*cdf0e10cSrcweir maShapeInfos.push_back( aShapeInfo ); 495*cdf0e10cSrcweir maCurrentInfo = maShapeInfos.begin(); 496*cdf0e10cSrcweir 497*cdf0e10cSrcweir // ----------------------------------------------------- 498*cdf0e10cSrcweir // check for shape collections (group shape or 3d scene) 499*cdf0e10cSrcweir // and collect contained shapes style infos 500*cdf0e10cSrcweir // ----------------------------------------------------- 501*cdf0e10cSrcweir const uno::Reference< drawing::XShape >& xCollection = aShapeInfo.xCustomShapeReplacement.is() 502*cdf0e10cSrcweir ? aShapeInfo.xCustomShapeReplacement : xShape; 503*cdf0e10cSrcweir { 504*cdf0e10cSrcweir uno::Reference< drawing::XShapes > xShapes( xCollection, uno::UNO_QUERY ); 505*cdf0e10cSrcweir if( xShapes.is() ) 506*cdf0e10cSrcweir { 507*cdf0e10cSrcweir collectShapesAutoStyles( xShapes ); 508*cdf0e10cSrcweir } 509*cdf0e10cSrcweir } 510*cdf0e10cSrcweir } 511*cdf0e10cSrcweir 512*cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 513*cdf0e10cSrcweir 514*cdf0e10cSrcweir // --> OD 2008-05-08 #refactorlists# 515*cdf0e10cSrcweir namespace 516*cdf0e10cSrcweir { 517*cdf0e10cSrcweir class NewTextListsHelper 518*cdf0e10cSrcweir { 519*cdf0e10cSrcweir public: 520*cdf0e10cSrcweir NewTextListsHelper( SvXMLExport& rExp ) 521*cdf0e10cSrcweir : mrExport( rExp ) 522*cdf0e10cSrcweir { 523*cdf0e10cSrcweir mrExport.GetTextParagraphExport()->PushNewTextListsHelper(); 524*cdf0e10cSrcweir } 525*cdf0e10cSrcweir 526*cdf0e10cSrcweir ~NewTextListsHelper() 527*cdf0e10cSrcweir { 528*cdf0e10cSrcweir mrExport.GetTextParagraphExport()->PopTextListsHelper(); 529*cdf0e10cSrcweir } 530*cdf0e10cSrcweir 531*cdf0e10cSrcweir private: 532*cdf0e10cSrcweir SvXMLExport& mrExport; 533*cdf0e10cSrcweir }; 534*cdf0e10cSrcweir } 535*cdf0e10cSrcweir // This method exports the given XShape 536*cdf0e10cSrcweir void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape, 537*cdf0e10cSrcweir sal_Int32 nFeatures /* = SEF_DEFAULT */, 538*cdf0e10cSrcweir com::sun::star::awt::Point* pRefPoint /* = NULL */, 539*cdf0e10cSrcweir SvXMLAttributeList* pAttrList /* = NULL */ ) 540*cdf0e10cSrcweir { 541*cdf0e10cSrcweir if( maCurrentShapesIter == maShapesInfos.end() ) 542*cdf0e10cSrcweir { 543*cdf0e10cSrcweir DBG_ERROR( "XMLShapeExport::exportShape(): no auto styles where collected before export" ); 544*cdf0e10cSrcweir return; 545*cdf0e10cSrcweir } 546*cdf0e10cSrcweir sal_Int32 nZIndex = 0; 547*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xSet( xShape, uno::UNO_QUERY ); 548*cdf0e10cSrcweir 549*cdf0e10cSrcweir 550*cdf0e10cSrcweir ::std::auto_ptr< SvXMLElementExport > mpHyperlinkElement; 551*cdf0e10cSrcweir 552*cdf0e10cSrcweir // export hyperlinks with <a><shape/></a>. Currently only in draw since draw 553*cdf0e10cSrcweir // does not support document events 554*cdf0e10cSrcweir if( xSet.is() && (GetExport().GetModelType() == SvtModuleOptions::E_DRAW) ) try 555*cdf0e10cSrcweir { 556*cdf0e10cSrcweir presentation::ClickAction eAction = presentation::ClickAction_NONE; 557*cdf0e10cSrcweir xSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("OnClick"))) >>= eAction; 558*cdf0e10cSrcweir 559*cdf0e10cSrcweir if( (eAction == presentation::ClickAction_DOCUMENT) || 560*cdf0e10cSrcweir (eAction == presentation::ClickAction_BOOKMARK) ) 561*cdf0e10cSrcweir { 562*cdf0e10cSrcweir OUString sURL; 563*cdf0e10cSrcweir xSet->getPropertyValue(msBookmark) >>= sURL; 564*cdf0e10cSrcweir 565*cdf0e10cSrcweir if( sURL.getLength() ) 566*cdf0e10cSrcweir { 567*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, sURL ); 568*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); 569*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_SHOW, XML_EMBED ); 570*cdf0e10cSrcweir mpHyperlinkElement.reset( new SvXMLElementExport(mrExport, XML_NAMESPACE_DRAW, XML_A, sal_True, sal_True) ); 571*cdf0e10cSrcweir } 572*cdf0e10cSrcweir } 573*cdf0e10cSrcweir } 574*cdf0e10cSrcweir catch( uno::Exception& ) 575*cdf0e10cSrcweir { 576*cdf0e10cSrcweir DBG_ERROR("XMLShapeExport::exportShape(): exception during hyperlink export"); 577*cdf0e10cSrcweir } 578*cdf0e10cSrcweir 579*cdf0e10cSrcweir 580*cdf0e10cSrcweir if( xSet.is() ) 581*cdf0e10cSrcweir xSet->getPropertyValue(msZIndex) >>= nZIndex; 582*cdf0e10cSrcweir 583*cdf0e10cSrcweir ImplXMLShapeExportInfoVector& aShapeInfoVector = (*maCurrentShapesIter).second; 584*cdf0e10cSrcweir 585*cdf0e10cSrcweir if( (sal_Int32)aShapeInfoVector.size() <= nZIndex ) 586*cdf0e10cSrcweir { 587*cdf0e10cSrcweir DBG_ERROR( "XMLShapeExport::exportShape(): no shape info collected for a given shape" ); 588*cdf0e10cSrcweir return; 589*cdf0e10cSrcweir } 590*cdf0e10cSrcweir 591*cdf0e10cSrcweir // --> OD 2008-05-08 #refactorlists# 592*cdf0e10cSrcweir NewTextListsHelper aNewTextListsHelper( mrExport ); 593*cdf0e10cSrcweir // <-- 594*cdf0e10cSrcweir 595*cdf0e10cSrcweir const ImplXMLShapeExportInfo& aShapeInfo = aShapeInfoVector[nZIndex]; 596*cdf0e10cSrcweir 597*cdf0e10cSrcweir 598*cdf0e10cSrcweir #ifdef DBG_UTIL 599*cdf0e10cSrcweir // --------------------------------------- 600*cdf0e10cSrcweir // check if this is the correct ShapesInfo 601*cdf0e10cSrcweir // --------------------------------------- 602*cdf0e10cSrcweir uno::Reference< container::XChild > xChild( xShape, uno::UNO_QUERY ); 603*cdf0e10cSrcweir if( xChild.is() ) 604*cdf0e10cSrcweir { 605*cdf0e10cSrcweir uno::Reference< drawing::XShapes > xParent( xChild->getParent(), uno::UNO_QUERY ); 606*cdf0e10cSrcweir DBG_ASSERT( xParent.is() && xParent.get() == (*maCurrentShapesIter).first.get(), "XMLShapeExport::exportShape(): Wrong call to XMLShapeExport::seekShapes()" ); 607*cdf0e10cSrcweir } 608*cdf0e10cSrcweir 609*cdf0e10cSrcweir // ----------------------------- 610*cdf0e10cSrcweir // first compute the shapes type 611*cdf0e10cSrcweir // ----------------------------- 612*cdf0e10cSrcweir { 613*cdf0e10cSrcweir XmlShapeType eShapeType(XmlShapeTypeNotYetSet); 614*cdf0e10cSrcweir ImpCalcShapeType(xShape, eShapeType); 615*cdf0e10cSrcweir 616*cdf0e10cSrcweir DBG_ASSERT( eShapeType == aShapeInfo.meShapeType, "exportShape callings do not correspond to collectShapeAutoStyles calls!" ); 617*cdf0e10cSrcweir } 618*cdf0e10cSrcweir #endif 619*cdf0e10cSrcweir 620*cdf0e10cSrcweir // ---------------------------------------- 621*cdf0e10cSrcweir // collect animation informations if needed 622*cdf0e10cSrcweir // ---------------------------------------- 623*cdf0e10cSrcweir if( mxAnimationsExporter.is() ) 624*cdf0e10cSrcweir mxAnimationsExporter->collect( xShape, mrExport ); 625*cdf0e10cSrcweir 626*cdf0e10cSrcweir // ------------------------------- 627*cdf0e10cSrcweir // export shapes name if he has one 628*cdf0e10cSrcweir // --> OD 2006-03-13 #i51726# 629*cdf0e10cSrcweir // Export of the shape name for text documents only if the OpenDocument 630*cdf0e10cSrcweir // file format is written - exceptions are group shapes. 631*cdf0e10cSrcweir // Note: Writer documents in OpenOffice.org file format doesn't contain 632*cdf0e10cSrcweir // any names for shapes, except for group shapes. 633*cdf0e10cSrcweir // ------------------------------- 634*cdf0e10cSrcweir { 635*cdf0e10cSrcweir // --> OD 2006-03-10 #i51726# 636*cdf0e10cSrcweir if ( ( GetExport().GetModelType() != SvtModuleOptions::E_WRITER && 637*cdf0e10cSrcweir GetExport().GetModelType() != SvtModuleOptions::E_WRITERWEB && 638*cdf0e10cSrcweir GetExport().GetModelType() != SvtModuleOptions::E_WRITERGLOBAL ) || 639*cdf0e10cSrcweir ( GetExport().getExportFlags() & EXPORT_OASIS ) != 0 || 640*cdf0e10cSrcweir aShapeInfo.meShapeType == XmlShapeTypeDrawGroupShape || 641*cdf0e10cSrcweir ( aShapeInfo.meShapeType == XmlShapeTypeDrawCustomShape && 642*cdf0e10cSrcweir aShapeInfo.xCustomShapeReplacement.is() ) ) 643*cdf0e10cSrcweir { 644*cdf0e10cSrcweir uno::Reference< container::XNamed > xNamed( xShape, uno::UNO_QUERY ); 645*cdf0e10cSrcweir if( xNamed.is() ) 646*cdf0e10cSrcweir { 647*cdf0e10cSrcweir const OUString aName( xNamed->getName() ); 648*cdf0e10cSrcweir if( aName.getLength() ) 649*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_NAME, aName ); 650*cdf0e10cSrcweir } 651*cdf0e10cSrcweir } 652*cdf0e10cSrcweir // <-- 653*cdf0e10cSrcweir } 654*cdf0e10cSrcweir 655*cdf0e10cSrcweir // ------------------ 656*cdf0e10cSrcweir // export style name 657*cdf0e10cSrcweir // ------------------ 658*cdf0e10cSrcweir if( aShapeInfo.msStyleName.getLength() != 0 ) 659*cdf0e10cSrcweir { 660*cdf0e10cSrcweir if(XML_STYLE_FAMILY_SD_GRAPHICS_ID == aShapeInfo.mnFamily) 661*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME, mrExport.EncodeStyleName( aShapeInfo.msStyleName) ); 662*cdf0e10cSrcweir else 663*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_PRESENTATION, XML_STYLE_NAME, mrExport.EncodeStyleName( aShapeInfo.msStyleName) ); 664*cdf0e10cSrcweir } 665*cdf0e10cSrcweir 666*cdf0e10cSrcweir // ------------------ 667*cdf0e10cSrcweir // export text style name 668*cdf0e10cSrcweir // ------------------ 669*cdf0e10cSrcweir if( aShapeInfo.msTextStyleName.getLength() != 0 ) 670*cdf0e10cSrcweir { 671*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_TEXT_STYLE_NAME, aShapeInfo.msTextStyleName ); 672*cdf0e10cSrcweir } 673*cdf0e10cSrcweir 674*cdf0e10cSrcweir // -------------------------- 675*cdf0e10cSrcweir // export shapes id if needed 676*cdf0e10cSrcweir // -------------------------- 677*cdf0e10cSrcweir { 678*cdf0e10cSrcweir uno::Reference< uno::XInterface > xRef( xShape, uno::UNO_QUERY ); 679*cdf0e10cSrcweir const OUString& rShapeId = mrExport.getInterfaceToIdentifierMapper().getIdentifier( xRef ); 680*cdf0e10cSrcweir if( rShapeId.getLength() ) 681*cdf0e10cSrcweir { 682*cdf0e10cSrcweir mrExport.AddAttributeIdLegacy(XML_NAMESPACE_DRAW, rShapeId); 683*cdf0e10cSrcweir } 684*cdf0e10cSrcweir } 685*cdf0e10cSrcweir 686*cdf0e10cSrcweir // -------------------------- 687*cdf0e10cSrcweir // export layer information 688*cdf0e10cSrcweir // -------------------------- 689*cdf0e10cSrcweir if( IsLayerExportEnabled() ) 690*cdf0e10cSrcweir { 691*cdf0e10cSrcweir // check for group or scene shape and not export layer if this is one 692*cdf0e10cSrcweir uno::Reference< drawing::XShapes > xShapes( xShape, uno::UNO_QUERY ); 693*cdf0e10cSrcweir if( !xShapes.is() ) 694*cdf0e10cSrcweir { 695*cdf0e10cSrcweir try 696*cdf0e10cSrcweir { 697*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY ); 698*cdf0e10cSrcweir OUString aLayerName; 699*cdf0e10cSrcweir xProps->getPropertyValue( OUString::createFromAscii( "LayerName" ) ) >>= aLayerName; 700*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_LAYER, aLayerName ); 701*cdf0e10cSrcweir 702*cdf0e10cSrcweir } 703*cdf0e10cSrcweir catch( uno::Exception e ) 704*cdf0e10cSrcweir { 705*cdf0e10cSrcweir DBG_ERROR( "could not export layer name for shape!" ); 706*cdf0e10cSrcweir } 707*cdf0e10cSrcweir } 708*cdf0e10cSrcweir } 709*cdf0e10cSrcweir 710*cdf0e10cSrcweir // export draw:display (do not export in ODF 1.2 or older) 711*cdf0e10cSrcweir if( xSet.is() && ( mrExport.getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) ) 712*cdf0e10cSrcweir { 713*cdf0e10cSrcweir if( aShapeInfo.meShapeType != XmlShapeTypeDrawPageShape && aShapeInfo.meShapeType != XmlShapeTypePresPageShape && 714*cdf0e10cSrcweir aShapeInfo.meShapeType != XmlShapeTypeHandoutShape && aShapeInfo.meShapeType != XmlShapeTypeDrawChartShape ) 715*cdf0e10cSrcweir 716*cdf0e10cSrcweir try 717*cdf0e10cSrcweir { 718*cdf0e10cSrcweir sal_Bool bVisible = sal_True; 719*cdf0e10cSrcweir sal_Bool bPrintable = sal_True; 720*cdf0e10cSrcweir 721*cdf0e10cSrcweir xSet->getPropertyValue(msVisible) >>= bVisible; 722*cdf0e10cSrcweir xSet->getPropertyValue(msPrintable) >>= bPrintable; 723*cdf0e10cSrcweir 724*cdf0e10cSrcweir XMLTokenEnum eDisplayToken = XML_TOKEN_INVALID; 725*cdf0e10cSrcweir const unsigned short nDisplay = (bVisible ? 2 : 0) | (bPrintable ? 1 : 0); 726*cdf0e10cSrcweir switch( nDisplay ) 727*cdf0e10cSrcweir { 728*cdf0e10cSrcweir case 0: eDisplayToken = XML_NONE; break; 729*cdf0e10cSrcweir case 1: eDisplayToken = XML_PRINTER; break; 730*cdf0e10cSrcweir case 2: eDisplayToken = XML_SCREEN; break; 731*cdf0e10cSrcweir // case 3: eDisplayToken = XML_ALWAYS break; this is the default 732*cdf0e10cSrcweir } 733*cdf0e10cSrcweir 734*cdf0e10cSrcweir if( eDisplayToken != XML_TOKEN_INVALID ) 735*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_DRAW_EXT, XML_DISPLAY, eDisplayToken ); 736*cdf0e10cSrcweir } 737*cdf0e10cSrcweir catch( uno::Exception& ) 738*cdf0e10cSrcweir { 739*cdf0e10cSrcweir DBG_ERROR( "XMLShapeExport::exportShape(), exception caught!" ); 740*cdf0e10cSrcweir } 741*cdf0e10cSrcweir } 742*cdf0e10cSrcweir 743*cdf0e10cSrcweir // #82003# test export count 744*cdf0e10cSrcweir // #91587# ALWAYS increment since now ALL to be exported shapes are counted. 745*cdf0e10cSrcweir if(mrExport.GetShapeExport()->IsHandleProgressBarEnabled()) 746*cdf0e10cSrcweir { 747*cdf0e10cSrcweir mrExport.GetProgressBarHelper()->Increment(); 748*cdf0e10cSrcweir } 749*cdf0e10cSrcweir 750*cdf0e10cSrcweir onExport( xShape ); 751*cdf0e10cSrcweir 752*cdf0e10cSrcweir // -------------------- 753*cdf0e10cSrcweir // export shape element 754*cdf0e10cSrcweir // -------------------- 755*cdf0e10cSrcweir switch(aShapeInfo.meShapeType) 756*cdf0e10cSrcweir { 757*cdf0e10cSrcweir case XmlShapeTypeDrawRectangleShape: 758*cdf0e10cSrcweir { 759*cdf0e10cSrcweir ImpExportRectangleShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint ); 760*cdf0e10cSrcweir break; 761*cdf0e10cSrcweir } 762*cdf0e10cSrcweir case XmlShapeTypeDrawEllipseShape: 763*cdf0e10cSrcweir { 764*cdf0e10cSrcweir ImpExportEllipseShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint ); 765*cdf0e10cSrcweir break; 766*cdf0e10cSrcweir } 767*cdf0e10cSrcweir case XmlShapeTypeDrawLineShape: 768*cdf0e10cSrcweir { 769*cdf0e10cSrcweir ImpExportLineShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint ); 770*cdf0e10cSrcweir break; 771*cdf0e10cSrcweir } 772*cdf0e10cSrcweir case XmlShapeTypeDrawPolyPolygonShape: // closed PolyPolygon 773*cdf0e10cSrcweir case XmlShapeTypeDrawPolyLineShape: // open PolyPolygon 774*cdf0e10cSrcweir case XmlShapeTypeDrawClosedBezierShape: // closed PolyPolygon containing curves 775*cdf0e10cSrcweir case XmlShapeTypeDrawOpenBezierShape: // open PolyPolygon containing curves 776*cdf0e10cSrcweir { 777*cdf0e10cSrcweir ImpExportPolygonShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint ); 778*cdf0e10cSrcweir break; 779*cdf0e10cSrcweir } 780*cdf0e10cSrcweir 781*cdf0e10cSrcweir case XmlShapeTypeDrawTextShape: 782*cdf0e10cSrcweir case XmlShapeTypePresTitleTextShape: 783*cdf0e10cSrcweir case XmlShapeTypePresOutlinerShape: 784*cdf0e10cSrcweir case XmlShapeTypePresSubtitleShape: 785*cdf0e10cSrcweir case XmlShapeTypePresNotesShape: 786*cdf0e10cSrcweir case XmlShapeTypePresHeaderShape: 787*cdf0e10cSrcweir case XmlShapeTypePresFooterShape: 788*cdf0e10cSrcweir case XmlShapeTypePresSlideNumberShape: 789*cdf0e10cSrcweir case XmlShapeTypePresDateTimeShape: 790*cdf0e10cSrcweir { 791*cdf0e10cSrcweir ImpExportTextBoxShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint ); 792*cdf0e10cSrcweir break; 793*cdf0e10cSrcweir } 794*cdf0e10cSrcweir 795*cdf0e10cSrcweir case XmlShapeTypeDrawGraphicObjectShape: 796*cdf0e10cSrcweir case XmlShapeTypePresGraphicObjectShape: 797*cdf0e10cSrcweir { 798*cdf0e10cSrcweir ImpExportGraphicObjectShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint ); 799*cdf0e10cSrcweir break; 800*cdf0e10cSrcweir } 801*cdf0e10cSrcweir 802*cdf0e10cSrcweir case XmlShapeTypeDrawChartShape: 803*cdf0e10cSrcweir case XmlShapeTypePresChartShape: 804*cdf0e10cSrcweir { 805*cdf0e10cSrcweir ImpExportChartShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint, pAttrList ); 806*cdf0e10cSrcweir break; 807*cdf0e10cSrcweir } 808*cdf0e10cSrcweir 809*cdf0e10cSrcweir case XmlShapeTypeDrawControlShape: 810*cdf0e10cSrcweir { 811*cdf0e10cSrcweir ImpExportControlShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint ); 812*cdf0e10cSrcweir break; 813*cdf0e10cSrcweir } 814*cdf0e10cSrcweir 815*cdf0e10cSrcweir case XmlShapeTypeDrawConnectorShape: 816*cdf0e10cSrcweir { 817*cdf0e10cSrcweir ImpExportConnectorShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint ); 818*cdf0e10cSrcweir break; 819*cdf0e10cSrcweir } 820*cdf0e10cSrcweir 821*cdf0e10cSrcweir case XmlShapeTypeDrawMeasureShape: 822*cdf0e10cSrcweir { 823*cdf0e10cSrcweir ImpExportMeasureShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint ); 824*cdf0e10cSrcweir break; 825*cdf0e10cSrcweir } 826*cdf0e10cSrcweir 827*cdf0e10cSrcweir case XmlShapeTypeDrawOLE2Shape: 828*cdf0e10cSrcweir case XmlShapeTypePresOLE2Shape: 829*cdf0e10cSrcweir case XmlShapeTypeDrawSheetShape: 830*cdf0e10cSrcweir case XmlShapeTypePresSheetShape: 831*cdf0e10cSrcweir { 832*cdf0e10cSrcweir ImpExportOLE2Shape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint ); 833*cdf0e10cSrcweir break; 834*cdf0e10cSrcweir } 835*cdf0e10cSrcweir 836*cdf0e10cSrcweir case XmlShapeTypePresTableShape: 837*cdf0e10cSrcweir case XmlShapeTypeDrawTableShape: 838*cdf0e10cSrcweir { 839*cdf0e10cSrcweir ImpExportTableShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint ); 840*cdf0e10cSrcweir break; 841*cdf0e10cSrcweir } 842*cdf0e10cSrcweir 843*cdf0e10cSrcweir case XmlShapeTypeDrawPageShape: 844*cdf0e10cSrcweir case XmlShapeTypePresPageShape: 845*cdf0e10cSrcweir case XmlShapeTypeHandoutShape: 846*cdf0e10cSrcweir { 847*cdf0e10cSrcweir ImpExportPageShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint ); 848*cdf0e10cSrcweir break; 849*cdf0e10cSrcweir } 850*cdf0e10cSrcweir 851*cdf0e10cSrcweir case XmlShapeTypeDrawCaptionShape: 852*cdf0e10cSrcweir { 853*cdf0e10cSrcweir ImpExportCaptionShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint ); 854*cdf0e10cSrcweir break; 855*cdf0e10cSrcweir } 856*cdf0e10cSrcweir 857*cdf0e10cSrcweir case XmlShapeTypeDraw3DCubeObject: 858*cdf0e10cSrcweir case XmlShapeTypeDraw3DSphereObject: 859*cdf0e10cSrcweir case XmlShapeTypeDraw3DLatheObject: 860*cdf0e10cSrcweir case XmlShapeTypeDraw3DExtrudeObject: 861*cdf0e10cSrcweir { 862*cdf0e10cSrcweir ImpExport3DShape(xShape, aShapeInfo.meShapeType); 863*cdf0e10cSrcweir break; 864*cdf0e10cSrcweir } 865*cdf0e10cSrcweir 866*cdf0e10cSrcweir case XmlShapeTypeDraw3DSceneObject: 867*cdf0e10cSrcweir { 868*cdf0e10cSrcweir ImpExport3DSceneShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint ); 869*cdf0e10cSrcweir break; 870*cdf0e10cSrcweir } 871*cdf0e10cSrcweir 872*cdf0e10cSrcweir case XmlShapeTypeDrawGroupShape: 873*cdf0e10cSrcweir { 874*cdf0e10cSrcweir // empty group 875*cdf0e10cSrcweir ImpExportGroupShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint ); 876*cdf0e10cSrcweir break; 877*cdf0e10cSrcweir } 878*cdf0e10cSrcweir 879*cdf0e10cSrcweir case XmlShapeTypeDrawFrameShape: 880*cdf0e10cSrcweir { 881*cdf0e10cSrcweir ImpExportFrameShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint ); 882*cdf0e10cSrcweir break; 883*cdf0e10cSrcweir } 884*cdf0e10cSrcweir 885*cdf0e10cSrcweir case XmlShapeTypeDrawAppletShape: 886*cdf0e10cSrcweir { 887*cdf0e10cSrcweir ImpExportAppletShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint ); 888*cdf0e10cSrcweir break; 889*cdf0e10cSrcweir } 890*cdf0e10cSrcweir 891*cdf0e10cSrcweir case XmlShapeTypeDrawPluginShape: 892*cdf0e10cSrcweir { 893*cdf0e10cSrcweir ImpExportPluginShape(xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint ); 894*cdf0e10cSrcweir break; 895*cdf0e10cSrcweir } 896*cdf0e10cSrcweir 897*cdf0e10cSrcweir case XmlShapeTypeDrawCustomShape: 898*cdf0e10cSrcweir { 899*cdf0e10cSrcweir if ( aShapeInfo.xCustomShapeReplacement.is() ) 900*cdf0e10cSrcweir ImpExportGroupShape( aShapeInfo.xCustomShapeReplacement, XmlShapeTypeDrawGroupShape, nFeatures, pRefPoint ); 901*cdf0e10cSrcweir else 902*cdf0e10cSrcweir ImpExportCustomShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint ); 903*cdf0e10cSrcweir break; 904*cdf0e10cSrcweir } 905*cdf0e10cSrcweir 906*cdf0e10cSrcweir case XmlShapeTypePresMediaShape: 907*cdf0e10cSrcweir case XmlShapeTypeDrawMediaShape: 908*cdf0e10cSrcweir { 909*cdf0e10cSrcweir ImpExportMediaShape( xShape, aShapeInfo.meShapeType, nFeatures, pRefPoint ); 910*cdf0e10cSrcweir break; 911*cdf0e10cSrcweir } 912*cdf0e10cSrcweir 913*cdf0e10cSrcweir case XmlShapeTypePresOrgChartShape: 914*cdf0e10cSrcweir case XmlShapeTypeUnknown: 915*cdf0e10cSrcweir case XmlShapeTypeNotYetSet: 916*cdf0e10cSrcweir default: 917*cdf0e10cSrcweir { 918*cdf0e10cSrcweir // this should never happen and is an error 919*cdf0e10cSrcweir DBG_ERROR("XMLEXP: WriteShape: unknown or unexpected type of shape in export!"); 920*cdf0e10cSrcweir break; 921*cdf0e10cSrcweir } 922*cdf0e10cSrcweir } 923*cdf0e10cSrcweir 924*cdf0e10cSrcweir mpHyperlinkElement.reset(); 925*cdf0e10cSrcweir 926*cdf0e10cSrcweir // #97489# #97111# 927*cdf0e10cSrcweir // if there was an error and no element for the shape was exported 928*cdf0e10cSrcweir // we need to clear the attribute list or the attributes will be 929*cdf0e10cSrcweir // set on the next exported element, which can result in corrupt 930*cdf0e10cSrcweir // xml files due to duplicate attributes 931*cdf0e10cSrcweir 932*cdf0e10cSrcweir mrExport.CheckAttrList(); // asserts in non pro if we have attributes left 933*cdf0e10cSrcweir mrExport.ClearAttrList(); // clears the attributes 934*cdf0e10cSrcweir } 935*cdf0e10cSrcweir 936*cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 937*cdf0e10cSrcweir 938*cdf0e10cSrcweir // This method collects all automatic styles for the shapes inside the given XShapes collection 939*cdf0e10cSrcweir void XMLShapeExport::collectShapesAutoStyles( const uno::Reference < drawing::XShapes >& xShapes ) 940*cdf0e10cSrcweir { 941*cdf0e10cSrcweir ShapesInfos::iterator aOldCurrentShapesIter = maCurrentShapesIter; 942*cdf0e10cSrcweir seekShapes( xShapes ); 943*cdf0e10cSrcweir 944*cdf0e10cSrcweir uno::Reference< drawing::XShape > xShape; 945*cdf0e10cSrcweir const sal_Int32 nShapeCount(xShapes->getCount()); 946*cdf0e10cSrcweir for(sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++) 947*cdf0e10cSrcweir { 948*cdf0e10cSrcweir xShapes->getByIndex(nShapeId) >>= xShape; 949*cdf0e10cSrcweir DBG_ASSERT( xShape.is(), "Shape without a XShape?" ); 950*cdf0e10cSrcweir if(!xShape.is()) 951*cdf0e10cSrcweir continue; 952*cdf0e10cSrcweir 953*cdf0e10cSrcweir collectShapeAutoStyles( xShape ); 954*cdf0e10cSrcweir } 955*cdf0e10cSrcweir 956*cdf0e10cSrcweir maCurrentShapesIter = aOldCurrentShapesIter; 957*cdf0e10cSrcweir } 958*cdf0e10cSrcweir 959*cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 960*cdf0e10cSrcweir 961*cdf0e10cSrcweir // This method exports all XShape inside the given XShapes collection 962*cdf0e10cSrcweir void XMLShapeExport::exportShapes( const uno::Reference < drawing::XShapes >& xShapes, sal_Int32 nFeatures /* = SEF_DEFAULT */, awt::Point* pRefPoint /* = NULL */ ) 963*cdf0e10cSrcweir { 964*cdf0e10cSrcweir ShapesInfos::iterator aOldCurrentShapesIter = maCurrentShapesIter; 965*cdf0e10cSrcweir seekShapes( xShapes ); 966*cdf0e10cSrcweir 967*cdf0e10cSrcweir uno::Reference< drawing::XShape > xShape; 968*cdf0e10cSrcweir const sal_Int32 nShapeCount(xShapes->getCount()); 969*cdf0e10cSrcweir for(sal_Int32 nShapeId = 0; nShapeId < nShapeCount; nShapeId++) 970*cdf0e10cSrcweir { 971*cdf0e10cSrcweir xShapes->getByIndex(nShapeId) >>= xShape; 972*cdf0e10cSrcweir DBG_ASSERT( xShape.is(), "Shape without a XShape?" ); 973*cdf0e10cSrcweir if(!xShape.is()) 974*cdf0e10cSrcweir continue; 975*cdf0e10cSrcweir 976*cdf0e10cSrcweir exportShape( xShape, nFeatures, pRefPoint ); 977*cdf0e10cSrcweir } 978*cdf0e10cSrcweir 979*cdf0e10cSrcweir maCurrentShapesIter = aOldCurrentShapesIter; 980*cdf0e10cSrcweir } 981*cdf0e10cSrcweir 982*cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 983*cdf0e10cSrcweir 984*cdf0e10cSrcweir void XMLShapeExport::seekShapes( const uno::Reference< drawing::XShapes >& xShapes ) throw() 985*cdf0e10cSrcweir { 986*cdf0e10cSrcweir if( xShapes.is() ) 987*cdf0e10cSrcweir { 988*cdf0e10cSrcweir maCurrentShapesIter = maShapesInfos.find( xShapes ); 989*cdf0e10cSrcweir if( maCurrentShapesIter == maShapesInfos.end() ) 990*cdf0e10cSrcweir { 991*cdf0e10cSrcweir ImplXMLShapeExportInfoVector aNewInfoVector; 992*cdf0e10cSrcweir aNewInfoVector.resize( (ShapesInfos::size_type) xShapes->getCount() ); 993*cdf0e10cSrcweir maShapesInfos[ xShapes ] = aNewInfoVector; 994*cdf0e10cSrcweir 995*cdf0e10cSrcweir maCurrentShapesIter = maShapesInfos.find( xShapes ); 996*cdf0e10cSrcweir 997*cdf0e10cSrcweir DBG_ASSERT( maCurrentShapesIter != maShapesInfos.end(), "XMLShapeExport::seekShapes(): insert into stl::map failed" ); 998*cdf0e10cSrcweir } 999*cdf0e10cSrcweir 1000*cdf0e10cSrcweir DBG_ASSERT( (*maCurrentShapesIter).second.size() == (ShapesInfos::size_type)xShapes->getCount(), "XMLShapeExport::seekShapes(): XShapes size varied between calls" ); 1001*cdf0e10cSrcweir 1002*cdf0e10cSrcweir } 1003*cdf0e10cSrcweir else 1004*cdf0e10cSrcweir { 1005*cdf0e10cSrcweir maCurrentShapesIter = maShapesInfos.end(); 1006*cdf0e10cSrcweir } 1007*cdf0e10cSrcweir } 1008*cdf0e10cSrcweir 1009*cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 1010*cdf0e10cSrcweir 1011*cdf0e10cSrcweir void XMLShapeExport::exportAutoStyles() 1012*cdf0e10cSrcweir { 1013*cdf0e10cSrcweir // export all autostyle infos 1014*cdf0e10cSrcweir 1015*cdf0e10cSrcweir // ...for graphic 1016*cdf0e10cSrcweir // if(IsFamilyGraphicUsed()) 1017*cdf0e10cSrcweir { 1018*cdf0e10cSrcweir GetExport().GetAutoStylePool()->exportXML( 1019*cdf0e10cSrcweir XML_STYLE_FAMILY_SD_GRAPHICS_ID 1020*cdf0e10cSrcweir , GetExport().GetDocHandler(), 1021*cdf0e10cSrcweir GetExport().GetMM100UnitConverter(), 1022*cdf0e10cSrcweir GetExport().GetNamespaceMap() 1023*cdf0e10cSrcweir ); 1024*cdf0e10cSrcweir } 1025*cdf0e10cSrcweir 1026*cdf0e10cSrcweir // ...for presentation 1027*cdf0e10cSrcweir // if(IsFamilyPresentationUsed()) 1028*cdf0e10cSrcweir { 1029*cdf0e10cSrcweir GetExport().GetAutoStylePool()->exportXML( 1030*cdf0e10cSrcweir XML_STYLE_FAMILY_SD_PRESENTATION_ID 1031*cdf0e10cSrcweir , GetExport().GetDocHandler(), 1032*cdf0e10cSrcweir GetExport().GetMM100UnitConverter(), 1033*cdf0e10cSrcweir GetExport().GetNamespaceMap() 1034*cdf0e10cSrcweir ); 1035*cdf0e10cSrcweir } 1036*cdf0e10cSrcweir 1037*cdf0e10cSrcweir if( mxShapeTableExport.is() ) 1038*cdf0e10cSrcweir mxShapeTableExport->exportAutoStyles(); 1039*cdf0e10cSrcweir } 1040*cdf0e10cSrcweir 1041*cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 1042*cdf0e10cSrcweir 1043*cdf0e10cSrcweir /// returns the export property mapper for external chaining 1044*cdf0e10cSrcweir SvXMLExportPropertyMapper* XMLShapeExport::CreateShapePropMapper( 1045*cdf0e10cSrcweir SvXMLExport& rExport ) 1046*cdf0e10cSrcweir { 1047*cdf0e10cSrcweir UniReference< XMLPropertyHandlerFactory > xFactory = new XMLSdPropHdlFactory( rExport.GetModel(), rExport ); 1048*cdf0e10cSrcweir UniReference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper( xFactory ); 1049*cdf0e10cSrcweir SvXMLExportPropertyMapper* pResult = 1050*cdf0e10cSrcweir new XMLShapeExportPropertyMapper( xMapper, 1051*cdf0e10cSrcweir (XMLTextListAutoStylePool*)&rExport.GetTextParagraphExport()->GetListAutoStylePool(), 1052*cdf0e10cSrcweir rExport ); 1053*cdf0e10cSrcweir // chain text attributes 1054*cdf0e10cSrcweir return pResult; 1055*cdf0e10cSrcweir } 1056*cdf0e10cSrcweir 1057*cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 1058*cdf0e10cSrcweir 1059*cdf0e10cSrcweir void XMLShapeExport::ImpCalcShapeType(const uno::Reference< drawing::XShape >& xShape, 1060*cdf0e10cSrcweir XmlShapeType& eShapeType) 1061*cdf0e10cSrcweir { 1062*cdf0e10cSrcweir // set in every case, so init here 1063*cdf0e10cSrcweir eShapeType = XmlShapeTypeUnknown; 1064*cdf0e10cSrcweir 1065*cdf0e10cSrcweir uno::Reference< drawing::XShapeDescriptor > xShapeDescriptor(xShape, uno::UNO_QUERY); 1066*cdf0e10cSrcweir if(xShapeDescriptor.is()) 1067*cdf0e10cSrcweir { 1068*cdf0e10cSrcweir String aType((OUString)xShapeDescriptor->getShapeType()); 1069*cdf0e10cSrcweir 1070*cdf0e10cSrcweir if(aType.EqualsAscii((const sal_Char*)"com.sun.star.", 0, 13)) 1071*cdf0e10cSrcweir { 1072*cdf0e10cSrcweir if(aType.EqualsAscii("drawing.", 13, 8)) 1073*cdf0e10cSrcweir { 1074*cdf0e10cSrcweir // drawing shapes 1075*cdf0e10cSrcweir if (aType.EqualsAscii("Rectangle", 21, 9)) { eShapeType = XmlShapeTypeDrawRectangleShape; } 1076*cdf0e10cSrcweir 1077*cdf0e10cSrcweir // #i72177# Note: Correcting CustomShape, CustomShape->Custom, len from 9 (was wrong anyways) to 6. 1078*cdf0e10cSrcweir // As can be seen at the other compares, the appendix "Shape" is left out of the comparison. 1079*cdf0e10cSrcweir else if(aType.EqualsAscii("Custom", 21, 6)) { eShapeType = XmlShapeTypeDrawCustomShape; } 1080*cdf0e10cSrcweir 1081*cdf0e10cSrcweir else if(aType.EqualsAscii("Ellipse", 21, 7)) { eShapeType = XmlShapeTypeDrawEllipseShape; } 1082*cdf0e10cSrcweir else if(aType.EqualsAscii("Control", 21, 7)) { eShapeType = XmlShapeTypeDrawControlShape; } 1083*cdf0e10cSrcweir else if(aType.EqualsAscii("Connector", 21, 9)) { eShapeType = XmlShapeTypeDrawConnectorShape; } 1084*cdf0e10cSrcweir else if(aType.EqualsAscii("Measure", 21, 7)) { eShapeType = XmlShapeTypeDrawMeasureShape; } 1085*cdf0e10cSrcweir else if(aType.EqualsAscii("Line", 21, 4)) { eShapeType = XmlShapeTypeDrawLineShape; } 1086*cdf0e10cSrcweir 1087*cdf0e10cSrcweir // #i72177# Note: This covers two types by purpose, PolyPolygonShape and PolyPolygonPathShape 1088*cdf0e10cSrcweir else if(aType.EqualsAscii("PolyPolygon", 21, 11)) { eShapeType = XmlShapeTypeDrawPolyPolygonShape; } 1089*cdf0e10cSrcweir 1090*cdf0e10cSrcweir // #i72177# Note: This covers two types by purpose, PolyLineShape and PolyLinePathShape 1091*cdf0e10cSrcweir else if(aType.EqualsAscii("PolyLine", 21, 8)) { eShapeType = XmlShapeTypeDrawPolyLineShape; } 1092*cdf0e10cSrcweir 1093*cdf0e10cSrcweir else if(aType.EqualsAscii("OpenBezier", 21, 10)) { eShapeType = XmlShapeTypeDrawOpenBezierShape; } 1094*cdf0e10cSrcweir else if(aType.EqualsAscii("ClosedBezier", 21, 12)) { eShapeType = XmlShapeTypeDrawClosedBezierShape; } 1095*cdf0e10cSrcweir 1096*cdf0e10cSrcweir // #i72177# FreeHand (opened and closed) now supports the types OpenFreeHandShape and 1097*cdf0e10cSrcweir // ClosedFreeHandShape respectively. Represent them as bezier shapes 1098*cdf0e10cSrcweir else if(aType.EqualsAscii("OpenFreeHand", 21, 12)) { eShapeType = XmlShapeTypeDrawOpenBezierShape; } 1099*cdf0e10cSrcweir else if(aType.EqualsAscii("ClosedFreeHand", 21, 14)) { eShapeType = XmlShapeTypeDrawClosedBezierShape; } 1100*cdf0e10cSrcweir 1101*cdf0e10cSrcweir else if(aType.EqualsAscii("GraphicObject", 21, 13)) { eShapeType = XmlShapeTypeDrawGraphicObjectShape; } 1102*cdf0e10cSrcweir else if(aType.EqualsAscii("Group", 21, 5)) { eShapeType = XmlShapeTypeDrawGroupShape; } 1103*cdf0e10cSrcweir else if(aType.EqualsAscii("Text", 21, 4)) { eShapeType = XmlShapeTypeDrawTextShape; } 1104*cdf0e10cSrcweir else if(aType.EqualsAscii("OLE2", 21, 4)) 1105*cdf0e10cSrcweir { 1106*cdf0e10cSrcweir eShapeType = XmlShapeTypeDrawOLE2Shape; 1107*cdf0e10cSrcweir 1108*cdf0e10cSrcweir // get info about presentation shape 1109*cdf0e10cSrcweir uno::Reference <beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY); 1110*cdf0e10cSrcweir 1111*cdf0e10cSrcweir if(xPropSet.is()) 1112*cdf0e10cSrcweir { 1113*cdf0e10cSrcweir rtl::OUString sCLSID; 1114*cdf0e10cSrcweir if(xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID"))) >>= sCLSID) 1115*cdf0e10cSrcweir { 1116*cdf0e10cSrcweir if (sCLSID.equals(mrExport.GetChartExport()->getChartCLSID())) 1117*cdf0e10cSrcweir { 1118*cdf0e10cSrcweir eShapeType = XmlShapeTypeDrawChartShape; 1119*cdf0e10cSrcweir } 1120*cdf0e10cSrcweir else if ( 1121*cdf0e10cSrcweir sCLSID.equals(rtl::OUString( SvGlobalName( SO3_SC_CLASSID ).GetHexName())) 1122*cdf0e10cSrcweir // #110680# 1123*cdf0e10cSrcweir // same reaction for binfilter 1124*cdf0e10cSrcweir || sCLSID.equals(rtl::OUString( SvGlobalName( BF_SO3_SC_CLASSID ).GetHexName())) 1125*cdf0e10cSrcweir ) 1126*cdf0e10cSrcweir { 1127*cdf0e10cSrcweir eShapeType = XmlShapeTypeDrawSheetShape; 1128*cdf0e10cSrcweir } 1129*cdf0e10cSrcweir else 1130*cdf0e10cSrcweir { 1131*cdf0e10cSrcweir // general OLE2 Object 1132*cdf0e10cSrcweir } 1133*cdf0e10cSrcweir } 1134*cdf0e10cSrcweir } 1135*cdf0e10cSrcweir } 1136*cdf0e10cSrcweir else if(aType.EqualsAscii("Page", 21, 4)) { eShapeType = XmlShapeTypeDrawPageShape; } 1137*cdf0e10cSrcweir else if(aType.EqualsAscii("Frame", 21, 5)) { eShapeType = XmlShapeTypeDrawFrameShape; } 1138*cdf0e10cSrcweir else if(aType.EqualsAscii("Caption", 21, 7)) { eShapeType = XmlShapeTypeDrawCaptionShape; } 1139*cdf0e10cSrcweir else if(aType.EqualsAscii("Plugin", 21, 6)) { eShapeType = XmlShapeTypeDrawPluginShape; } 1140*cdf0e10cSrcweir else if(aType.EqualsAscii("Applet", 21, 6)) { eShapeType = XmlShapeTypeDrawAppletShape; } 1141*cdf0e10cSrcweir else if(aType.EqualsAscii("MediaShape", 21, 10)) { eShapeType = XmlShapeTypeDrawMediaShape; } 1142*cdf0e10cSrcweir else if(aType.EqualsAscii("TableShape", 21, 10)) { eShapeType = XmlShapeTypeDrawTableShape; } 1143*cdf0e10cSrcweir 1144*cdf0e10cSrcweir // 3D shapes 1145*cdf0e10cSrcweir else if(aType.EqualsAscii("Scene", 21 + 7, 5)) { eShapeType = XmlShapeTypeDraw3DSceneObject; } 1146*cdf0e10cSrcweir else if(aType.EqualsAscii("Cube", 21 + 7, 4)) { eShapeType = XmlShapeTypeDraw3DCubeObject; } 1147*cdf0e10cSrcweir else if(aType.EqualsAscii("Sphere", 21 + 7, 6)) { eShapeType = XmlShapeTypeDraw3DSphereObject; } 1148*cdf0e10cSrcweir else if(aType.EqualsAscii("Lathe", 21 + 7, 5)) { eShapeType = XmlShapeTypeDraw3DLatheObject; } 1149*cdf0e10cSrcweir else if(aType.EqualsAscii("Extrude", 21 + 7, 7)) { eShapeType = XmlShapeTypeDraw3DExtrudeObject; } 1150*cdf0e10cSrcweir } 1151*cdf0e10cSrcweir else if(aType.EqualsAscii("presentation.", 13, 13)) 1152*cdf0e10cSrcweir { 1153*cdf0e10cSrcweir // presentation shapes 1154*cdf0e10cSrcweir if (aType.EqualsAscii("TitleText", 26, 9)) { eShapeType = XmlShapeTypePresTitleTextShape; } 1155*cdf0e10cSrcweir else if(aType.EqualsAscii("Outliner", 26, 8)) { eShapeType = XmlShapeTypePresOutlinerShape; } 1156*cdf0e10cSrcweir else if(aType.EqualsAscii("Subtitle", 26, 8)) { eShapeType = XmlShapeTypePresSubtitleShape; } 1157*cdf0e10cSrcweir else if(aType.EqualsAscii("GraphicObject", 26, 13)) { eShapeType = XmlShapeTypePresGraphicObjectShape; } 1158*cdf0e10cSrcweir else if(aType.EqualsAscii("Page", 26, 4)) { eShapeType = XmlShapeTypePresPageShape; } 1159*cdf0e10cSrcweir else if(aType.EqualsAscii("OLE2", 26, 4)) 1160*cdf0e10cSrcweir { 1161*cdf0e10cSrcweir eShapeType = XmlShapeTypePresOLE2Shape; 1162*cdf0e10cSrcweir 1163*cdf0e10cSrcweir // get info about presentation shape 1164*cdf0e10cSrcweir uno::Reference <beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY); 1165*cdf0e10cSrcweir 1166*cdf0e10cSrcweir if(xPropSet.is()) try 1167*cdf0e10cSrcweir { 1168*cdf0e10cSrcweir rtl::OUString sCLSID; 1169*cdf0e10cSrcweir if(xPropSet->getPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID"))) >>= sCLSID) 1170*cdf0e10cSrcweir { 1171*cdf0e10cSrcweir if( sCLSID.equals(rtl::OUString( SvGlobalName( SO3_SC_CLASSID ).GetHexName())) || 1172*cdf0e10cSrcweir sCLSID.equals(rtl::OUString( SvGlobalName( BF_SO3_SC_CLASSID ).GetHexName())) ) 1173*cdf0e10cSrcweir { 1174*cdf0e10cSrcweir eShapeType = XmlShapeTypePresSheetShape; 1175*cdf0e10cSrcweir } 1176*cdf0e10cSrcweir } 1177*cdf0e10cSrcweir } 1178*cdf0e10cSrcweir catch( uno::Exception& ) 1179*cdf0e10cSrcweir { 1180*cdf0e10cSrcweir DBG_ERROR( "XMLShapeExport::ImpCalcShapeType(), expected ole shape to have the CLSID property?" ); 1181*cdf0e10cSrcweir } 1182*cdf0e10cSrcweir } 1183*cdf0e10cSrcweir else if(aType.EqualsAscii("Chart", 26, 5)) { eShapeType = XmlShapeTypePresChartShape; } 1184*cdf0e10cSrcweir else if(aType.EqualsAscii("OrgChart", 26, 8)) { eShapeType = XmlShapeTypePresOrgChartShape; } 1185*cdf0e10cSrcweir else if(aType.EqualsAscii("CalcShape", 26, 9)) { eShapeType = XmlShapeTypePresSheetShape; } 1186*cdf0e10cSrcweir else if(aType.EqualsAscii("TableShape", 26, 10)) { eShapeType = XmlShapeTypePresTableShape; } 1187*cdf0e10cSrcweir else if(aType.EqualsAscii("Notes", 26, 5)) { eShapeType = XmlShapeTypePresNotesShape; } 1188*cdf0e10cSrcweir else if(aType.EqualsAscii("HandoutShape", 26, 12)) { eShapeType = XmlShapeTypeHandoutShape; } 1189*cdf0e10cSrcweir else if(aType.EqualsAscii("HeaderShape", 26, 11)) { eShapeType = XmlShapeTypePresHeaderShape; } 1190*cdf0e10cSrcweir else if(aType.EqualsAscii("FooterShape", 26, 11)) { eShapeType = XmlShapeTypePresFooterShape; } 1191*cdf0e10cSrcweir else if(aType.EqualsAscii("SlideNumberShape", 26, 16)) { eShapeType = XmlShapeTypePresSlideNumberShape; } 1192*cdf0e10cSrcweir else if(aType.EqualsAscii("DateTimeShape", 26, 13)) { eShapeType = XmlShapeTypePresDateTimeShape; } 1193*cdf0e10cSrcweir else if(aType.EqualsAscii("MediaShape", 26, 10)) { eShapeType = XmlShapeTypePresMediaShape; } 1194*cdf0e10cSrcweir } 1195*cdf0e10cSrcweir } 1196*cdf0e10cSrcweir } 1197*cdf0e10cSrcweir } 1198*cdf0e10cSrcweir 1199*cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 1200*cdf0e10cSrcweir 1201*cdf0e10cSrcweir extern SvXMLEnumMapEntry aXML_GlueAlignment_EnumMap[]; 1202*cdf0e10cSrcweir extern SvXMLEnumMapEntry aXML_GlueEscapeDirection_EnumMap[]; 1203*cdf0e10cSrcweir 1204*cdf0e10cSrcweir /** exports all user defined glue points */ 1205*cdf0e10cSrcweir void XMLShapeExport::ImpExportGluePoints( const uno::Reference< drawing::XShape >& xShape ) 1206*cdf0e10cSrcweir { 1207*cdf0e10cSrcweir uno::Reference< drawing::XGluePointsSupplier > xSupplier( xShape, uno::UNO_QUERY ); 1208*cdf0e10cSrcweir if( !xSupplier.is() ) 1209*cdf0e10cSrcweir return; 1210*cdf0e10cSrcweir 1211*cdf0e10cSrcweir uno::Reference< container::XIdentifierAccess > xGluePoints( xSupplier->getGluePoints(), uno::UNO_QUERY ); 1212*cdf0e10cSrcweir if( !xGluePoints.is() ) 1213*cdf0e10cSrcweir return; 1214*cdf0e10cSrcweir 1215*cdf0e10cSrcweir drawing::GluePoint2 aGluePoint; 1216*cdf0e10cSrcweir 1217*cdf0e10cSrcweir uno::Sequence< sal_Int32 > aIdSequence( xGluePoints->getIdentifiers() ); 1218*cdf0e10cSrcweir 1219*cdf0e10cSrcweir const sal_Int32 nCount = aIdSequence.getLength(); 1220*cdf0e10cSrcweir for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ ) 1221*cdf0e10cSrcweir { 1222*cdf0e10cSrcweir const sal_Int32 nIdentifier = aIdSequence[nIndex]; 1223*cdf0e10cSrcweir if( (xGluePoints->getByIdentifier( nIdentifier ) >>= aGluePoint) && aGluePoint.IsUserDefined ) 1224*cdf0e10cSrcweir { 1225*cdf0e10cSrcweir // export only user defined glue points 1226*cdf0e10cSrcweir 1227*cdf0e10cSrcweir const OUString sId( OUString::valueOf( nIdentifier ) ); 1228*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_ID, sId ); 1229*cdf0e10cSrcweir 1230*cdf0e10cSrcweir mrExport.GetMM100UnitConverter().convertMeasure(msBuffer, aGluePoint.Position.X); 1231*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_X, msBuffer.makeStringAndClear()); 1232*cdf0e10cSrcweir 1233*cdf0e10cSrcweir mrExport.GetMM100UnitConverter().convertMeasure(msBuffer, aGluePoint.Position.Y); 1234*cdf0e10cSrcweir mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_Y, msBuffer.makeStringAndClear()); 1235*cdf0e10cSrcweir 1236*cdf0e10cSrcweir if( !aGluePoint.IsRelative ) 1237*cdf0e10cSrcweir { 1238*cdf0e10cSrcweir SvXMLUnitConverter::convertEnum( msBuffer, aGluePoint.PositionAlignment, aXML_GlueAlignment_EnumMap ); 1239*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_ALIGN, msBuffer.makeStringAndClear() ); 1240*cdf0e10cSrcweir } 1241*cdf0e10cSrcweir 1242*cdf0e10cSrcweir if( aGluePoint.Escape != drawing::EscapeDirection_SMART ) 1243*cdf0e10cSrcweir { 1244*cdf0e10cSrcweir SvXMLUnitConverter::convertEnum( msBuffer, aGluePoint.Escape, aXML_GlueEscapeDirection_EnumMap ); 1245*cdf0e10cSrcweir mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_ESCAPE_DIRECTION, msBuffer.makeStringAndClear() ); 1246*cdf0e10cSrcweir } 1247*cdf0e10cSrcweir 1248*cdf0e10cSrcweir SvXMLElementExport aEventsElemt(mrExport, XML_NAMESPACE_DRAW, XML_GLUE_POINT, sal_True, sal_True); 1249*cdf0e10cSrcweir } 1250*cdf0e10cSrcweir } 1251*cdf0e10cSrcweir } 1252*cdf0e10cSrcweir 1253*cdf0e10cSrcweir void XMLShapeExport::ExportGraphicDefaults() 1254*cdf0e10cSrcweir { 1255*cdf0e10cSrcweir XMLStyleExport aStEx(mrExport, OUString(), mrExport.GetAutoStylePool().get()); 1256*cdf0e10cSrcweir 1257*cdf0e10cSrcweir // construct PropertySetMapper 1258*cdf0e10cSrcweir UniReference< SvXMLExportPropertyMapper > xPropertySetMapper( CreateShapePropMapper( mrExport ) ); 1259*cdf0e10cSrcweir ((XMLShapeExportPropertyMapper*)xPropertySetMapper.get())->SetAutoStyles( sal_False ); 1260*cdf0e10cSrcweir 1261*cdf0e10cSrcweir // chain text attributes 1262*cdf0e10cSrcweir xPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(mrExport)); 1263*cdf0e10cSrcweir 1264*cdf0e10cSrcweir // chain special Writer/text frame default attributes 1265*cdf0e10cSrcweir xPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaDefaultExtPropMapper(mrExport)); 1266*cdf0e10cSrcweir 1267*cdf0e10cSrcweir // write graphic family default style 1268*cdf0e10cSrcweir uno::Reference< lang::XMultiServiceFactory > xFact( mrExport.GetModel(), uno::UNO_QUERY ); 1269*cdf0e10cSrcweir if( xFact.is() ) 1270*cdf0e10cSrcweir { 1271*cdf0e10cSrcweir try 1272*cdf0e10cSrcweir { 1273*cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xDefaults( xFact->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Defaults") ) ), uno::UNO_QUERY ); 1274*cdf0e10cSrcweir if( xDefaults.is() ) 1275*cdf0e10cSrcweir { 1276*cdf0e10cSrcweir aStEx.exportDefaultStyle( xDefaults, OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)), xPropertySetMapper ); 1277*cdf0e10cSrcweir 1278*cdf0e10cSrcweir // write graphic family styles 1279*cdf0e10cSrcweir aStEx.exportStyleFamily("graphics", OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)), xPropertySetMapper, sal_False, XML_STYLE_FAMILY_SD_GRAPHICS_ID); 1280*cdf0e10cSrcweir } 1281*cdf0e10cSrcweir } 1282*cdf0e10cSrcweir catch( lang::ServiceNotRegisteredException& ) 1283*cdf0e10cSrcweir { 1284*cdf0e10cSrcweir } 1285*cdf0e10cSrcweir } 1286*cdf0e10cSrcweir } 1287*cdf0e10cSrcweir 1288*cdf0e10cSrcweir void XMLShapeExport::onExport( const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& ) 1289*cdf0e10cSrcweir { 1290*cdf0e10cSrcweir } 1291*cdf0e10cSrcweir 1292*cdf0e10cSrcweir const rtl::Reference< XMLTableExport >& XMLShapeExport::GetShapeTableExport() 1293*cdf0e10cSrcweir { 1294*cdf0e10cSrcweir if( !mxShapeTableExport.is() ) 1295*cdf0e10cSrcweir { 1296*cdf0e10cSrcweir rtl::Reference< XMLPropertyHandlerFactory > xFactory( new XMLSdPropHdlFactory( mrExport.GetModel(), mrExport ) ); 1297*cdf0e10cSrcweir UniReference < XMLPropertySetMapper > xMapper( new XMLShapePropertySetMapper( xFactory.get() ) ); 1298*cdf0e10cSrcweir rtl::Reference< SvXMLExportPropertyMapper > xPropertySetMapper( new XMLShapeExportPropertyMapper( xMapper, (XMLTextListAutoStylePool*)&mrExport.GetTextParagraphExport()->GetListAutoStylePool(), mrExport ) ); 1299*cdf0e10cSrcweir mxShapeTableExport = new XMLTableExport( mrExport, xPropertySetMapper, xFactory ); 1300*cdf0e10cSrcweir } 1301*cdf0e10cSrcweir 1302*cdf0e10cSrcweir return mxShapeTableExport; 1303*cdf0e10cSrcweir } 1304