1*63bba73cSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*63bba73cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*63bba73cSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*63bba73cSAndrew Rist * distributed with this work for additional information 6*63bba73cSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*63bba73cSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*63bba73cSAndrew Rist * "License"); you may not use this file except in compliance 9*63bba73cSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*63bba73cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*63bba73cSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*63bba73cSAndrew Rist * software distributed under the License is distributed on an 15*63bba73cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*63bba73cSAndrew Rist * KIND, either express or implied. See the License for the 17*63bba73cSAndrew Rist * specific language governing permissions and limitations 18*63bba73cSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*63bba73cSAndrew Rist *************************************************************/ 21*63bba73cSAndrew Rist 22*63bba73cSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_xmloff.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <tools/debug.hxx> 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <com/sun/star/text/PositionLayoutDir.hpp> 30cdf0e10cSrcweir #include <com/sun/star/chart/XChartDocument.hpp> 31cdf0e10cSrcweir 32cdf0e10cSrcweir #include "unointerfacetouniqueidentifiermapper.hxx" 33cdf0e10cSrcweir 34cdf0e10cSrcweir #include <list> 35cdf0e10cSrcweir 36cdf0e10cSrcweir #ifndef _XMLOFF_SHAPEIMPORT_HXX 37cdf0e10cSrcweir #include <xmloff/shapeimport.hxx> 38cdf0e10cSrcweir #endif 39cdf0e10cSrcweir #include <xmloff/xmltkmap.hxx> 40cdf0e10cSrcweir #include "xmloff/xmlnmspe.hxx" 41cdf0e10cSrcweir #include <xmloff/xmltoken.hxx> 42cdf0e10cSrcweir #include "ximpstyl.hxx" 43cdf0e10cSrcweir #include "ximpshap.hxx" 44cdf0e10cSrcweir #include "sdpropls.hxx" 45cdf0e10cSrcweir #include <xmloff/xmlprmap.hxx> 46cdf0e10cSrcweir #include "ximp3dscene.hxx" 47cdf0e10cSrcweir #include "ximp3dobject.hxx" 48cdf0e10cSrcweir #include "ximpgrp.hxx" 49cdf0e10cSrcweir #include "ximplink.hxx" 50cdf0e10cSrcweir 51cdf0e10cSrcweir #include <map> 52cdf0e10cSrcweir #include <vector> 53cdf0e10cSrcweir 54cdf0e10cSrcweir using ::rtl::OUString; 55cdf0e10cSrcweir using ::rtl::OUStringBuffer; 56cdf0e10cSrcweir 57cdf0e10cSrcweir using namespace ::std; 58cdf0e10cSrcweir using namespace ::com::sun::star; 59cdf0e10cSrcweir using namespace ::xmloff::token; 60cdf0e10cSrcweir 61cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 62cdf0e10cSrcweir 63cdf0e10cSrcweir struct ltint32 64cdf0e10cSrcweir { 65cdf0e10cSrcweir bool operator()(const sal_Int32 p, sal_Int32 q) const 66cdf0e10cSrcweir { 67cdf0e10cSrcweir return p < q; 68cdf0e10cSrcweir } 69cdf0e10cSrcweir }; 70cdf0e10cSrcweir 71cdf0e10cSrcweir typedef std::map<sal_Int32,com::sun::star::uno::Reference< com::sun::star::drawing::XShape >,ltint32> IdShapeMap; 72cdf0e10cSrcweir 73cdf0e10cSrcweir struct ConnectionHint 74cdf0e10cSrcweir { 75cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxConnector; 76cdf0e10cSrcweir sal_Bool bStart; 77cdf0e10cSrcweir OUString aDestShapeId; 78cdf0e10cSrcweir sal_Int32 nDestGlueId; 79cdf0e10cSrcweir }; 80cdf0e10cSrcweir 81cdf0e10cSrcweir struct XShapeCompareHelper 82cdf0e10cSrcweir { 83cdf0e10cSrcweir bool operator()(com::sun::star::uno::Reference < com::sun::star::drawing::XShape > x1, 84cdf0e10cSrcweir com::sun::star::uno::Reference < com::sun::star::drawing::XShape > x2 ) const 85cdf0e10cSrcweir { 86cdf0e10cSrcweir return x1.get() < x2.get(); 87cdf0e10cSrcweir } 88cdf0e10cSrcweir }; 89cdf0e10cSrcweir 90cdf0e10cSrcweir /** this map store all glue point id mappings for shapes that had user defined glue points. This 91cdf0e10cSrcweir is needed because on insertion the glue points will get a new and unique id */ 92cdf0e10cSrcweir typedef std::map<sal_Int32,sal_Int32,ltint32> GluePointIdMap; 93cdf0e10cSrcweir typedef std::map< com::sun::star::uno::Reference < com::sun::star::drawing::XShape >, GluePointIdMap, XShapeCompareHelper > ShapeGluePointsMap; 94cdf0e10cSrcweir 95cdf0e10cSrcweir /** this struct is created for each startPage() call and stores information that is needed during 96cdf0e10cSrcweir import of shapes for one page. Since pages could be nested ( notes pages inside impress ) there 97cdf0e10cSrcweir is a pointer so one can build up a stack of this structs */ 98cdf0e10cSrcweir struct XMLShapeImportPageContextImpl 99cdf0e10cSrcweir { 100cdf0e10cSrcweir ShapeGluePointsMap maShapeGluePointsMap; 101cdf0e10cSrcweir 102cdf0e10cSrcweir uno::Reference < drawing::XShapes > mxShapes; 103cdf0e10cSrcweir 104cdf0e10cSrcweir struct XMLShapeImportPageContextImpl* mpNext; 105cdf0e10cSrcweir }; 106cdf0e10cSrcweir 107cdf0e10cSrcweir /** this class is to enable adding members to the XMLShapeImportHelper without getting incompatible */ 108cdf0e10cSrcweir struct XMLShapeImportHelperImpl 109cdf0e10cSrcweir { 110cdf0e10cSrcweir // context for sorting shapes 111cdf0e10cSrcweir ShapeSortContext* mpSortContext; 112cdf0e10cSrcweir 113cdf0e10cSrcweir IdShapeMap maShapeIds; 114cdf0e10cSrcweir 115cdf0e10cSrcweir std::vector<ConnectionHint> maConnections; 116cdf0e10cSrcweir 117cdf0e10cSrcweir // #88546# possibility to swich progress bar handling on/off 118cdf0e10cSrcweir sal_Bool mbHandleProgressBar; 119cdf0e10cSrcweir 120cdf0e10cSrcweir // stores the capability of the current model to create presentation shapes 121cdf0e10cSrcweir sal_Bool mbIsPresentationShapesSupported; 122cdf0e10cSrcweir }; 123cdf0e10cSrcweir 124cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 125cdf0e10cSrcweir 126cdf0e10cSrcweir XMLShapeImportHelper::XMLShapeImportHelper( 127cdf0e10cSrcweir SvXMLImport& rImporter, 128cdf0e10cSrcweir const uno::Reference< frame::XModel>& rModel, 129cdf0e10cSrcweir SvXMLImportPropertyMapper *pExtMapper ) 130cdf0e10cSrcweir : mpPageContext(NULL), 131cdf0e10cSrcweir mxModel(rModel), 132cdf0e10cSrcweir 133cdf0e10cSrcweir mpPropertySetMapper(0L), 134cdf0e10cSrcweir mpPresPagePropsMapper(0L), 135cdf0e10cSrcweir mpStylesContext(0L), 136cdf0e10cSrcweir mpAutoStylesContext(0L), 137cdf0e10cSrcweir mpGroupShapeElemTokenMap(0L), 138cdf0e10cSrcweir mpFrameShapeElemTokenMap(0L), 139cdf0e10cSrcweir mp3DSceneShapeElemTokenMap(0L), 140cdf0e10cSrcweir mp3DObjectAttrTokenMap(0L), 141cdf0e10cSrcweir mp3DPolygonBasedAttrTokenMap(0L), 142cdf0e10cSrcweir mp3DCubeObjectAttrTokenMap(0L), 143cdf0e10cSrcweir mp3DSphereObjectAttrTokenMap(0L), 144cdf0e10cSrcweir mp3DSceneShapeAttrTokenMap(0L), 145cdf0e10cSrcweir mp3DLightAttrTokenMap(0L), 146cdf0e10cSrcweir mpPathShapeAttrTokenMap(0L), 147cdf0e10cSrcweir mpPolygonShapeAttrTokenMap(0L), 148cdf0e10cSrcweir msStartShape(RTL_CONSTASCII_USTRINGPARAM("StartShape")), 149cdf0e10cSrcweir msEndShape(RTL_CONSTASCII_USTRINGPARAM("EndShape")), 150cdf0e10cSrcweir msStartGluePointIndex(RTL_CONSTASCII_USTRINGPARAM("StartGluePointIndex")), 151cdf0e10cSrcweir msEndGluePointIndex(RTL_CONSTASCII_USTRINGPARAM("EndGluePointIndex")), 152cdf0e10cSrcweir 153cdf0e10cSrcweir mrImporter( rImporter ) 154cdf0e10cSrcweir { 155cdf0e10cSrcweir mpImpl = new XMLShapeImportHelperImpl(); 156cdf0e10cSrcweir mpImpl->mpSortContext = 0; 157cdf0e10cSrcweir 158cdf0e10cSrcweir // #88546# init to sal_False 159cdf0e10cSrcweir mpImpl->mbHandleProgressBar = sal_False; 160cdf0e10cSrcweir 161cdf0e10cSrcweir mpSdPropHdlFactory = new XMLSdPropHdlFactory( rModel, rImporter ); 162cdf0e10cSrcweir 163cdf0e10cSrcweir // set lock to avoid deletion 164cdf0e10cSrcweir mpSdPropHdlFactory->acquire(); 165cdf0e10cSrcweir 166cdf0e10cSrcweir // construct PropertySetMapper 167cdf0e10cSrcweir UniReference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper(mpSdPropHdlFactory); 168cdf0e10cSrcweir mpPropertySetMapper = new SvXMLImportPropertyMapper( xMapper, rImporter ); 169cdf0e10cSrcweir // set lock to avoid deletion 170cdf0e10cSrcweir mpPropertySetMapper->acquire(); 171cdf0e10cSrcweir 172cdf0e10cSrcweir if( pExtMapper ) 173cdf0e10cSrcweir { 174cdf0e10cSrcweir UniReference < SvXMLImportPropertyMapper > xExtMapper( pExtMapper ); 175cdf0e10cSrcweir mpPropertySetMapper->ChainImportMapper( xExtMapper ); 176cdf0e10cSrcweir } 177cdf0e10cSrcweir 178cdf0e10cSrcweir // chain text attributes 179cdf0e10cSrcweir mpPropertySetMapper->ChainImportMapper(XMLTextImportHelper::CreateParaExtPropMapper(rImporter)); 180cdf0e10cSrcweir mpPropertySetMapper->ChainImportMapper(XMLTextImportHelper::CreateParaDefaultExtPropMapper(rImporter)); 181cdf0e10cSrcweir 182cdf0e10cSrcweir // construct PresPagePropsMapper 183cdf0e10cSrcweir xMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLSDPresPageProps, mpSdPropHdlFactory); 184cdf0e10cSrcweir mpPresPagePropsMapper = new SvXMLImportPropertyMapper( xMapper, rImporter ); 185cdf0e10cSrcweir if(mpPresPagePropsMapper) 186cdf0e10cSrcweir { 187cdf0e10cSrcweir // set lock to avoid deletion 188cdf0e10cSrcweir mpPresPagePropsMapper->acquire(); 189cdf0e10cSrcweir } 190cdf0e10cSrcweir 191cdf0e10cSrcweir uno::Reference< lang::XServiceInfo > xInfo( rImporter.GetModel(), uno::UNO_QUERY ); 192cdf0e10cSrcweir const OUString aSName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.PresentationDocument") ); 193cdf0e10cSrcweir mpImpl->mbIsPresentationShapesSupported = xInfo.is() && xInfo->supportsService( aSName ); 194cdf0e10cSrcweir } 195cdf0e10cSrcweir 196cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 197cdf0e10cSrcweir 198cdf0e10cSrcweir XMLShapeImportHelper::~XMLShapeImportHelper() 199cdf0e10cSrcweir { 200cdf0e10cSrcweir DBG_ASSERT( mpImpl->maConnections.empty(), "XMLShapeImportHelper::restoreConnections() was not called!" ); 201cdf0e10cSrcweir 202cdf0e10cSrcweir // cleanup factory, decrease refcount. Should lead to destruction. 203cdf0e10cSrcweir if(mpSdPropHdlFactory) 204cdf0e10cSrcweir { 205cdf0e10cSrcweir mpSdPropHdlFactory->release(); 206cdf0e10cSrcweir mpSdPropHdlFactory = 0L; 207cdf0e10cSrcweir } 208cdf0e10cSrcweir 209cdf0e10cSrcweir // cleanup mapper, decrease refcount. Should lead to destruction. 210cdf0e10cSrcweir if(mpPropertySetMapper) 211cdf0e10cSrcweir { 212cdf0e10cSrcweir mpPropertySetMapper->release(); 213cdf0e10cSrcweir mpPropertySetMapper = 0L; 214cdf0e10cSrcweir } 215cdf0e10cSrcweir 216cdf0e10cSrcweir // cleanup presPage mapper, decrease refcount. Should lead to destruction. 217cdf0e10cSrcweir if(mpPresPagePropsMapper) 218cdf0e10cSrcweir { 219cdf0e10cSrcweir mpPresPagePropsMapper->release(); 220cdf0e10cSrcweir mpPresPagePropsMapper = 0L; 221cdf0e10cSrcweir } 222cdf0e10cSrcweir 223cdf0e10cSrcweir if(mpGroupShapeElemTokenMap) delete mpGroupShapeElemTokenMap; 224cdf0e10cSrcweir if(mpFrameShapeElemTokenMap) delete mpFrameShapeElemTokenMap; 225cdf0e10cSrcweir /* 226cdf0e10cSrcweir if(mpShapeAttrTokenMap) delete mpShapeAttrTokenMap; 227cdf0e10cSrcweir if(mpRectShapeAttrTokenMap) delete mpRectShapeAttrTokenMap; 228cdf0e10cSrcweir if(mpLineShapeAttrTokenMap) delete mpLineShapeAttrTokenMap; 229cdf0e10cSrcweir if(mpEllipseShapeAttrTokenMap) delete mpEllipseShapeAttrTokenMap; 230cdf0e10cSrcweir if(mpTextBoxShapeAttrTokenMap) delete mpTextBoxShapeAttrTokenMap; 231cdf0e10cSrcweir if(mpControlShapeAttrTokenMap) delete mpControlShapeAttrTokenMap; 232cdf0e10cSrcweir if(mpPageShapeAttrTokenMap) delete mpPageShapeAttrTokenMap; 233cdf0e10cSrcweir if(mpGraphicObjectShapeAttrTokenMap) delete mpGraphicObjectShapeAttrTokenMap; 234cdf0e10cSrcweir */ 235cdf0e10cSrcweir if(mpPolygonShapeAttrTokenMap) delete mpPolygonShapeAttrTokenMap; 236cdf0e10cSrcweir if(mpPathShapeAttrTokenMap) delete mpPathShapeAttrTokenMap; 237cdf0e10cSrcweir if(mp3DSceneShapeElemTokenMap) delete mp3DSceneShapeElemTokenMap; 238cdf0e10cSrcweir if(mp3DObjectAttrTokenMap) delete mp3DObjectAttrTokenMap; 239cdf0e10cSrcweir if(mp3DPolygonBasedAttrTokenMap) delete mp3DPolygonBasedAttrTokenMap; 240cdf0e10cSrcweir if(mp3DCubeObjectAttrTokenMap) delete mp3DCubeObjectAttrTokenMap; 241cdf0e10cSrcweir if(mp3DSphereObjectAttrTokenMap) delete mp3DSphereObjectAttrTokenMap; 242cdf0e10cSrcweir if(mp3DSceneShapeAttrTokenMap) delete mp3DSceneShapeAttrTokenMap; 243cdf0e10cSrcweir if(mp3DLightAttrTokenMap) delete mp3DLightAttrTokenMap; 244cdf0e10cSrcweir 245cdf0e10cSrcweir // Styles or AutoStyles context? 246cdf0e10cSrcweir if(mpStylesContext) 247cdf0e10cSrcweir { 248cdf0e10cSrcweir mpStylesContext->Clear(); 249cdf0e10cSrcweir mpStylesContext->ReleaseRef(); 250cdf0e10cSrcweir } 251cdf0e10cSrcweir 252cdf0e10cSrcweir if(mpAutoStylesContext) 253cdf0e10cSrcweir { 254cdf0e10cSrcweir mpAutoStylesContext->Clear(); 255cdf0e10cSrcweir mpAutoStylesContext->ReleaseRef(); 256cdf0e10cSrcweir } 257cdf0e10cSrcweir 258cdf0e10cSrcweir delete mpImpl; 259cdf0e10cSrcweir } 260cdf0e10cSrcweir 261cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 262cdf0e10cSrcweir 263cdf0e10cSrcweir 264cdf0e10cSrcweir 265cdf0e10cSrcweir const SvXMLTokenMap& XMLShapeImportHelper::GetGroupShapeElemTokenMap() 266cdf0e10cSrcweir { 267cdf0e10cSrcweir if(!mpGroupShapeElemTokenMap) 268cdf0e10cSrcweir { 269cdf0e10cSrcweir static __FAR_DATA SvXMLTokenMapEntry aGroupShapeElemTokenMap[] = 270cdf0e10cSrcweir { 271cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_G, XML_TOK_GROUP_GROUP }, 272cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_RECT, XML_TOK_GROUP_RECT }, 273cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_LINE, XML_TOK_GROUP_LINE }, 274cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_CIRCLE, XML_TOK_GROUP_CIRCLE }, 275cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_ELLIPSE, XML_TOK_GROUP_ELLIPSE }, 276cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_POLYGON, XML_TOK_GROUP_POLYGON }, 277cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_POLYLINE, XML_TOK_GROUP_POLYLINE }, 278cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_PATH, XML_TOK_GROUP_PATH }, 279cdf0e10cSrcweir 280cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_CONTROL, XML_TOK_GROUP_CONTROL }, 281cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_CONNECTOR, XML_TOK_GROUP_CONNECTOR }, 282cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_MEASURE, XML_TOK_GROUP_MEASURE }, 283cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_PAGE_THUMBNAIL, XML_TOK_GROUP_PAGE }, 284cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_CAPTION, XML_TOK_GROUP_CAPTION }, 285cdf0e10cSrcweir 286cdf0e10cSrcweir { XML_NAMESPACE_CHART, XML_CHART, XML_TOK_GROUP_CHART }, 287cdf0e10cSrcweir { XML_NAMESPACE_DR3D, XML_SCENE, XML_TOK_GROUP_3DSCENE }, 288cdf0e10cSrcweir 289cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_FRAME, XML_TOK_GROUP_FRAME }, 290cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_CUSTOM_SHAPE, XML_TOK_GROUP_CUSTOM_SHAPE }, 291cdf0e10cSrcweir 292cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_CUSTOM_SHAPE, XML_TOK_GROUP_CUSTOM_SHAPE }, 293cdf0e10cSrcweir { XML_NAMESPACE_OFFICE, XML_ANNOTATION, XML_TOK_GROUP_ANNOTATION }, 294cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_A, XML_TOK_GROUP_A }, 295cdf0e10cSrcweir 296cdf0e10cSrcweir XML_TOKEN_MAP_END 297cdf0e10cSrcweir }; 298cdf0e10cSrcweir 299cdf0e10cSrcweir mpGroupShapeElemTokenMap = new SvXMLTokenMap(aGroupShapeElemTokenMap); 300cdf0e10cSrcweir } // if(!mpGroupShapeElemTokenMap) 301cdf0e10cSrcweir 302cdf0e10cSrcweir return *mpGroupShapeElemTokenMap; 303cdf0e10cSrcweir } 304cdf0e10cSrcweir 305cdf0e10cSrcweir const SvXMLTokenMap& XMLShapeImportHelper::GetFrameShapeElemTokenMap() 306cdf0e10cSrcweir { 307cdf0e10cSrcweir if(!mpFrameShapeElemTokenMap) 308cdf0e10cSrcweir { 309cdf0e10cSrcweir static __FAR_DATA SvXMLTokenMapEntry aFrameShapeElemTokenMap[] = 310cdf0e10cSrcweir { 311cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_TEXT_BOX, XML_TOK_FRAME_TEXT_BOX }, 312cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_IMAGE, XML_TOK_FRAME_IMAGE }, 313cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_OBJECT, XML_TOK_FRAME_OBJECT }, 314cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_OBJECT_OLE, XML_TOK_FRAME_OBJECT_OLE }, 315cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_PLUGIN, XML_TOK_FRAME_PLUGIN }, 316cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_FLOATING_FRAME, XML_TOK_FRAME_FLOATING_FRAME}, 317cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_APPLET, XML_TOK_FRAME_APPLET }, 318cdf0e10cSrcweir { XML_NAMESPACE_TABLE, XML_TABLE, XML_TOK_FRAME_TABLE }, 319cdf0e10cSrcweir XML_TOKEN_MAP_END 320cdf0e10cSrcweir }; 321cdf0e10cSrcweir 322cdf0e10cSrcweir mpFrameShapeElemTokenMap = new SvXMLTokenMap(aFrameShapeElemTokenMap); 323cdf0e10cSrcweir } // if(!mpFrameShapeElemTokenMap) 324cdf0e10cSrcweir 325cdf0e10cSrcweir return *mpFrameShapeElemTokenMap; 326cdf0e10cSrcweir } 327cdf0e10cSrcweir 328cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 329cdf0e10cSrcweir 330cdf0e10cSrcweir 331cdf0e10cSrcweir const SvXMLTokenMap& XMLShapeImportHelper::Get3DSceneShapeElemTokenMap() 332cdf0e10cSrcweir { 333cdf0e10cSrcweir if(!mp3DSceneShapeElemTokenMap) 334cdf0e10cSrcweir { 335cdf0e10cSrcweir static __FAR_DATA SvXMLTokenMapEntry a3DSceneShapeElemTokenMap[] = 336cdf0e10cSrcweir { 337cdf0e10cSrcweir { XML_NAMESPACE_DR3D, XML_SCENE, XML_TOK_3DSCENE_3DSCENE }, 338cdf0e10cSrcweir { XML_NAMESPACE_DR3D, XML_CUBE, XML_TOK_3DSCENE_3DCUBE }, 339cdf0e10cSrcweir { XML_NAMESPACE_DR3D, XML_SPHERE, XML_TOK_3DSCENE_3DSPHERE }, 340cdf0e10cSrcweir { XML_NAMESPACE_DR3D, XML_ROTATE, XML_TOK_3DSCENE_3DLATHE }, 341cdf0e10cSrcweir { XML_NAMESPACE_DR3D, XML_EXTRUDE, XML_TOK_3DSCENE_3DEXTRUDE }, 342cdf0e10cSrcweir XML_TOKEN_MAP_END 343cdf0e10cSrcweir }; 344cdf0e10cSrcweir 345cdf0e10cSrcweir mp3DSceneShapeElemTokenMap = new SvXMLTokenMap(a3DSceneShapeElemTokenMap); 346cdf0e10cSrcweir } // if(!mp3DSceneShapeElemTokenMap) 347cdf0e10cSrcweir 348cdf0e10cSrcweir return *mp3DSceneShapeElemTokenMap; 349cdf0e10cSrcweir } 350cdf0e10cSrcweir 351cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 352cdf0e10cSrcweir /* 353cdf0e10cSrcweir 354cdf0e10cSrcweir const SvXMLTokenMap& XMLShapeImportHelper::GetShapeAttrTokenMap() 355cdf0e10cSrcweir { 356cdf0e10cSrcweir if(!mpShapeAttrTokenMap) 357cdf0e10cSrcweir { 358cdf0e10cSrcweir static __FAR_DATA SvXMLTokenMapEntry aShapeAttrTokenMap[] = 359cdf0e10cSrcweir { 360cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_NAME, XML_TOK_SHAPE_NAME }, 361cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_STYLE_NAME, XML_TOK_SHAPE_DRAWSTYLE_NAME_GRAPHICS }, 362cdf0e10cSrcweir { XML_NAMESPACE_PRESENTATION, XML_CLASS, XML_TOK_SHAPE_PRESENTATION_CLASS }, 363cdf0e10cSrcweir { XML_NAMESPACE_PRESENTATION, XML_STYLE_NAME, XML_TOK_SHAPE_DRAWSTYLE_NAME_PRESENTATION }, 364cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_TRANSFORM, XML_TOK_SHAPE_TRANSFORM }, 365cdf0e10cSrcweir { XML_NAMESPACE_PRESENTATION, XML_PLACEHOLDER, XML_TOK_SHAPE_IS_PLACEHOLDER }, 366cdf0e10cSrcweir { XML_NAMESPACE_PRESENTATION, XML_USER_TRANSFORMED, XML_TOK_SHAPE_IS_USER_TRANSFORMED }, 367cdf0e10cSrcweir XML_TOKEN_MAP_END 368cdf0e10cSrcweir }; 369cdf0e10cSrcweir 370cdf0e10cSrcweir mpShapeAttrTokenMap = new SvXMLTokenMap(aShapeAttrTokenMap); 371cdf0e10cSrcweir } 372cdf0e10cSrcweir 373cdf0e10cSrcweir return *mpShapeAttrTokenMap; 374cdf0e10cSrcweir } 375cdf0e10cSrcweir */ 376cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 377cdf0e10cSrcweir 378cdf0e10cSrcweir 379cdf0e10cSrcweir const SvXMLTokenMap& XMLShapeImportHelper::Get3DObjectAttrTokenMap() 380cdf0e10cSrcweir { 381cdf0e10cSrcweir if(!mp3DObjectAttrTokenMap) 382cdf0e10cSrcweir { 383cdf0e10cSrcweir static __FAR_DATA SvXMLTokenMapEntry a3DObjectAttrTokenMap[] = 384cdf0e10cSrcweir { 385cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_STYLE_NAME, XML_TOK_3DOBJECT_DRAWSTYLE_NAME }, 386cdf0e10cSrcweir { XML_NAMESPACE_DR3D, XML_TRANSFORM, XML_TOK_3DOBJECT_TRANSFORM }, 387cdf0e10cSrcweir XML_TOKEN_MAP_END 388cdf0e10cSrcweir }; 389cdf0e10cSrcweir 390cdf0e10cSrcweir mp3DObjectAttrTokenMap = new SvXMLTokenMap(a3DObjectAttrTokenMap); 391cdf0e10cSrcweir } // if(!mp3DObjectAttrTokenMap) 392cdf0e10cSrcweir 393cdf0e10cSrcweir return *mp3DObjectAttrTokenMap; 394cdf0e10cSrcweir } 395cdf0e10cSrcweir 396cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 397cdf0e10cSrcweir 398cdf0e10cSrcweir 399cdf0e10cSrcweir const SvXMLTokenMap& XMLShapeImportHelper::Get3DPolygonBasedAttrTokenMap() 400cdf0e10cSrcweir { 401cdf0e10cSrcweir if(!mp3DPolygonBasedAttrTokenMap) 402cdf0e10cSrcweir { 403cdf0e10cSrcweir static __FAR_DATA SvXMLTokenMapEntry a3DPolygonBasedAttrTokenMap[] = 404cdf0e10cSrcweir { 405cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_VIEWBOX, XML_TOK_3DPOLYGONBASED_VIEWBOX }, 406cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_D, XML_TOK_3DPOLYGONBASED_D }, 407cdf0e10cSrcweir XML_TOKEN_MAP_END 408cdf0e10cSrcweir }; 409cdf0e10cSrcweir 410cdf0e10cSrcweir mp3DPolygonBasedAttrTokenMap = new SvXMLTokenMap(a3DPolygonBasedAttrTokenMap); 411cdf0e10cSrcweir } // if(!mp3DPolygonBasedAttrTokenMap) 412cdf0e10cSrcweir 413cdf0e10cSrcweir return *mp3DPolygonBasedAttrTokenMap; 414cdf0e10cSrcweir } 415cdf0e10cSrcweir 416cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 417cdf0e10cSrcweir 418cdf0e10cSrcweir 419cdf0e10cSrcweir const SvXMLTokenMap& XMLShapeImportHelper::Get3DCubeObjectAttrTokenMap() 420cdf0e10cSrcweir { 421cdf0e10cSrcweir if(!mp3DCubeObjectAttrTokenMap) 422cdf0e10cSrcweir { 423cdf0e10cSrcweir static __FAR_DATA SvXMLTokenMapEntry a3DCubeObjectAttrTokenMap[] = 424cdf0e10cSrcweir { 425cdf0e10cSrcweir { XML_NAMESPACE_DR3D, XML_MIN_EDGE, XML_TOK_3DCUBEOBJ_MINEDGE }, 426cdf0e10cSrcweir { XML_NAMESPACE_DR3D, XML_MAX_EDGE, XML_TOK_3DCUBEOBJ_MAXEDGE }, 427cdf0e10cSrcweir XML_TOKEN_MAP_END 428cdf0e10cSrcweir }; 429cdf0e10cSrcweir 430cdf0e10cSrcweir mp3DCubeObjectAttrTokenMap = new SvXMLTokenMap(a3DCubeObjectAttrTokenMap); 431cdf0e10cSrcweir } // if(!mp3DCubeObjectAttrTokenMap) 432cdf0e10cSrcweir 433cdf0e10cSrcweir return *mp3DCubeObjectAttrTokenMap; 434cdf0e10cSrcweir } 435cdf0e10cSrcweir 436cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 437cdf0e10cSrcweir 438cdf0e10cSrcweir 439cdf0e10cSrcweir const SvXMLTokenMap& XMLShapeImportHelper::Get3DSphereObjectAttrTokenMap() 440cdf0e10cSrcweir { 441cdf0e10cSrcweir if(!mp3DSphereObjectAttrTokenMap) 442cdf0e10cSrcweir { 443cdf0e10cSrcweir static __FAR_DATA SvXMLTokenMapEntry a3DSphereObjectAttrTokenMap[] = 444cdf0e10cSrcweir { 445cdf0e10cSrcweir { XML_NAMESPACE_DR3D, XML_CENTER, XML_TOK_3DSPHEREOBJ_CENTER }, 446cdf0e10cSrcweir { XML_NAMESPACE_DR3D, XML_SIZE, XML_TOK_3DSPHEREOBJ_SIZE }, 447cdf0e10cSrcweir XML_TOKEN_MAP_END 448cdf0e10cSrcweir }; 449cdf0e10cSrcweir 450cdf0e10cSrcweir mp3DSphereObjectAttrTokenMap = new SvXMLTokenMap(a3DSphereObjectAttrTokenMap); 451cdf0e10cSrcweir } // if(!mp3DSphereObjectAttrTokenMap) 452cdf0e10cSrcweir 453cdf0e10cSrcweir return *mp3DSphereObjectAttrTokenMap; 454cdf0e10cSrcweir } 455cdf0e10cSrcweir 456cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 457cdf0e10cSrcweir /* 458cdf0e10cSrcweir 459cdf0e10cSrcweir const SvXMLTokenMap& XMLShapeImportHelper::GetRectShapeAttrTokenMap() 460cdf0e10cSrcweir { 461cdf0e10cSrcweir if(!mpRectShapeAttrTokenMap) 462cdf0e10cSrcweir { 463cdf0e10cSrcweir static __FAR_DATA SvXMLTokenMapEntry aRectShapeAttrTokenMap[] = 464cdf0e10cSrcweir { 465cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_X, XML_TOK_RECTSHAPE_X }, 466cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_Y, XML_TOK_RECTSHAPE_Y }, 467cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_WIDTH, XML_TOK_RECTSHAPE_WIDTH }, 468cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_RECTSHAPE_HEIGHT }, 469cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_CORNER_RADIUS, XML_TOK_RECTSHAPE_CORNER_RADIUS }, 470cdf0e10cSrcweir XML_TOKEN_MAP_END 471cdf0e10cSrcweir }; 472cdf0e10cSrcweir 473cdf0e10cSrcweir mpRectShapeAttrTokenMap = new SvXMLTokenMap(aRectShapeAttrTokenMap); 474cdf0e10cSrcweir } 475cdf0e10cSrcweir 476cdf0e10cSrcweir return *mpRectShapeAttrTokenMap; 477cdf0e10cSrcweir } 478cdf0e10cSrcweir 479cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 480cdf0e10cSrcweir 481cdf0e10cSrcweir 482cdf0e10cSrcweir const SvXMLTokenMap& XMLShapeImportHelper::GetLineShapeAttrTokenMap() 483cdf0e10cSrcweir { 484cdf0e10cSrcweir if(!mpLineShapeAttrTokenMap) 485cdf0e10cSrcweir { 486cdf0e10cSrcweir static __FAR_DATA SvXMLTokenMapEntry aLineShapeAttrTokenMap[] = 487cdf0e10cSrcweir { 488cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_X1, XML_TOK_LINESHAPE_X1 }, 489cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_Y1, XML_TOK_LINESHAPE_Y1 }, 490cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_X2, XML_TOK_LINESHAPE_X2 }, 491cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_Y2, XML_TOK_LINESHAPE_Y2 }, 492cdf0e10cSrcweir XML_TOKEN_MAP_END 493cdf0e10cSrcweir }; 494cdf0e10cSrcweir 495cdf0e10cSrcweir mpLineShapeAttrTokenMap = new SvXMLTokenMap(aLineShapeAttrTokenMap); 496cdf0e10cSrcweir } 497cdf0e10cSrcweir 498cdf0e10cSrcweir return *mpLineShapeAttrTokenMap; 499cdf0e10cSrcweir } 500cdf0e10cSrcweir 501cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 502cdf0e10cSrcweir 503cdf0e10cSrcweir 504cdf0e10cSrcweir const SvXMLTokenMap& XMLShapeImportHelper::GetEllipseShapeAttrTokenMap() 505cdf0e10cSrcweir { 506cdf0e10cSrcweir if(!mpEllipseShapeAttrTokenMap) 507cdf0e10cSrcweir { 508cdf0e10cSrcweir static __FAR_DATA SvXMLTokenMapEntry aEllipseShapeAttrTokenMap[] = 509cdf0e10cSrcweir { 510cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_RX, XML_TOK_ELLIPSESHAPE_RX }, 511cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_RY, XML_TOK_ELLIPSESHAPE_RY }, 512cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_CX, XML_TOK_ELLIPSESHAPE_CX }, 513cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_CY, XML_TOK_ELLIPSESHAPE_CY }, 514cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_R, XML_TOK_ELLIPSESHAPE_R }, 515cdf0e10cSrcweir XML_TOKEN_MAP_END 516cdf0e10cSrcweir }; 517cdf0e10cSrcweir 518cdf0e10cSrcweir mpEllipseShapeAttrTokenMap = new SvXMLTokenMap(aEllipseShapeAttrTokenMap); 519cdf0e10cSrcweir } 520cdf0e10cSrcweir 521cdf0e10cSrcweir return *mpEllipseShapeAttrTokenMap; 522cdf0e10cSrcweir } 523cdf0e10cSrcweir 524cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 525cdf0e10cSrcweir */ 526cdf0e10cSrcweir 527cdf0e10cSrcweir const SvXMLTokenMap& XMLShapeImportHelper::GetPolygonShapeAttrTokenMap() 528cdf0e10cSrcweir { 529cdf0e10cSrcweir if(!mpPolygonShapeAttrTokenMap) 530cdf0e10cSrcweir { 531cdf0e10cSrcweir static __FAR_DATA SvXMLTokenMapEntry aPolygonShapeAttrTokenMap[] = 532cdf0e10cSrcweir { 533cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_VIEWBOX, XML_TOK_POLYGONSHAPE_VIEWBOX }, 534cdf0e10cSrcweir { XML_NAMESPACE_DRAW, XML_POINTS, XML_TOK_POLYGONSHAPE_POINTS }, 535cdf0e10cSrcweir XML_TOKEN_MAP_END 536cdf0e10cSrcweir }; 537cdf0e10cSrcweir 538cdf0e10cSrcweir mpPolygonShapeAttrTokenMap = new SvXMLTokenMap(aPolygonShapeAttrTokenMap); 539cdf0e10cSrcweir } // if(!mpPolygonShapeAttrTokenMap) 540cdf0e10cSrcweir 541cdf0e10cSrcweir return *mpPolygonShapeAttrTokenMap; 542cdf0e10cSrcweir } 543cdf0e10cSrcweir 544cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 545cdf0e10cSrcweir 546cdf0e10cSrcweir 547cdf0e10cSrcweir const SvXMLTokenMap& XMLShapeImportHelper::GetPathShapeAttrTokenMap() 548cdf0e10cSrcweir { 549cdf0e10cSrcweir if(!mpPathShapeAttrTokenMap) 550cdf0e10cSrcweir { 551cdf0e10cSrcweir static __FAR_DATA SvXMLTokenMapEntry aPathShapeAttrTokenMap[] = 552cdf0e10cSrcweir { 553cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_VIEWBOX, XML_TOK_PATHSHAPE_VIEWBOX }, 554cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_D, XML_TOK_PATHSHAPE_D }, 555cdf0e10cSrcweir XML_TOKEN_MAP_END 556cdf0e10cSrcweir }; 557cdf0e10cSrcweir 558cdf0e10cSrcweir mpPathShapeAttrTokenMap = new SvXMLTokenMap(aPathShapeAttrTokenMap); 559cdf0e10cSrcweir } // if(!mpPathShapeAttrTokenMap) 560cdf0e10cSrcweir 561cdf0e10cSrcweir return *mpPathShapeAttrTokenMap; 562cdf0e10cSrcweir } 563cdf0e10cSrcweir /* 564cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 565cdf0e10cSrcweir 566cdf0e10cSrcweir 567cdf0e10cSrcweir const SvXMLTokenMap& XMLShapeImportHelper::GetTextBoxShapeAttrTokenMap() 568cdf0e10cSrcweir { 569cdf0e10cSrcweir if(!mpTextBoxShapeAttrTokenMap) 570cdf0e10cSrcweir { 571cdf0e10cSrcweir static __FAR_DATA SvXMLTokenMapEntry aTextBoxShapeAttrTokenMap[] = 572cdf0e10cSrcweir { 573cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_X, XML_TOK_TEXTBOXSHAPE_X }, 574cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_Y, XML_TOK_TEXTBOXSHAPE_Y }, 575cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_WIDTH, XML_TOK_TEXTBOXSHAPE_WIDTH }, 576cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_TEXTBOXSHAPE_HEIGHT }, 577cdf0e10cSrcweir XML_TOKEN_MAP_END 578cdf0e10cSrcweir }; 579cdf0e10cSrcweir 580cdf0e10cSrcweir mpTextBoxShapeAttrTokenMap = new SvXMLTokenMap(aTextBoxShapeAttrTokenMap); 581cdf0e10cSrcweir } 582cdf0e10cSrcweir 583cdf0e10cSrcweir return *mpTextBoxShapeAttrTokenMap; 584cdf0e10cSrcweir } 585cdf0e10cSrcweir 586cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 587cdf0e10cSrcweir 588cdf0e10cSrcweir 589cdf0e10cSrcweir const SvXMLTokenMap& XMLShapeImportHelper::GetControlShapeAttrTokenMap() 590cdf0e10cSrcweir { 591cdf0e10cSrcweir if(!mpControlShapeAttrTokenMap) 592cdf0e10cSrcweir { 593cdf0e10cSrcweir static __FAR_DATA SvXMLTokenMapEntry aControlShapeAttrTokenMap[] = 594cdf0e10cSrcweir { 595cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_X, XML_TOK_CONTROLSHAPE_X }, 596cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_Y, XML_TOK_CONTROLSHAPE_Y }, 597cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_WIDTH, XML_TOK_CONTROLSHAPE_WIDTH }, 598cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_CONTROLSHAPE_HEIGHT }, 599cdf0e10cSrcweir XML_TOKEN_MAP_END 600cdf0e10cSrcweir }; 601cdf0e10cSrcweir 602cdf0e10cSrcweir mpControlShapeAttrTokenMap = new SvXMLTokenMap(aControlShapeAttrTokenMap); 603cdf0e10cSrcweir } 604cdf0e10cSrcweir 605cdf0e10cSrcweir return *mpControlShapeAttrTokenMap; 606cdf0e10cSrcweir } 607cdf0e10cSrcweir */ 608cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 609cdf0e10cSrcweir 610cdf0e10cSrcweir 611cdf0e10cSrcweir const SvXMLTokenMap& XMLShapeImportHelper::Get3DSceneShapeAttrTokenMap() 612cdf0e10cSrcweir { 613cdf0e10cSrcweir if(!mp3DSceneShapeAttrTokenMap) 614cdf0e10cSrcweir { 615cdf0e10cSrcweir static __FAR_DATA SvXMLTokenMapEntry a3DSceneShapeAttrTokenMap[] = 616cdf0e10cSrcweir { 617cdf0e10cSrcweir { XML_NAMESPACE_DR3D, XML_TRANSFORM, XML_TOK_3DSCENESHAPE_TRANSFORM }, 618cdf0e10cSrcweir { XML_NAMESPACE_DR3D, XML_VRP, XML_TOK_3DSCENESHAPE_VRP }, 619cdf0e10cSrcweir { XML_NAMESPACE_DR3D, XML_VPN, XML_TOK_3DSCENESHAPE_VPN }, 620cdf0e10cSrcweir { XML_NAMESPACE_DR3D, XML_VUP, XML_TOK_3DSCENESHAPE_VUP }, 621cdf0e10cSrcweir { XML_NAMESPACE_DR3D, XML_PROJECTION, XML_TOK_3DSCENESHAPE_PROJECTION }, 622cdf0e10cSrcweir { XML_NAMESPACE_DR3D, XML_DISTANCE, XML_TOK_3DSCENESHAPE_DISTANCE }, 623cdf0e10cSrcweir { XML_NAMESPACE_DR3D, XML_FOCAL_LENGTH, XML_TOK_3DSCENESHAPE_FOCAL_LENGTH }, 624cdf0e10cSrcweir { XML_NAMESPACE_DR3D, XML_SHADOW_SLANT, XML_TOK_3DSCENESHAPE_SHADOW_SLANT }, 625cdf0e10cSrcweir { XML_NAMESPACE_DR3D, XML_SHADE_MODE, XML_TOK_3DSCENESHAPE_SHADE_MODE }, 626cdf0e10cSrcweir { XML_NAMESPACE_DR3D, XML_AMBIENT_COLOR, XML_TOK_3DSCENESHAPE_AMBIENT_COLOR }, 627cdf0e10cSrcweir { XML_NAMESPACE_DR3D, XML_LIGHTING_MODE, XML_TOK_3DSCENESHAPE_LIGHTING_MODE }, 628cdf0e10cSrcweir XML_TOKEN_MAP_END 629cdf0e10cSrcweir }; 630cdf0e10cSrcweir 631cdf0e10cSrcweir mp3DSceneShapeAttrTokenMap = new SvXMLTokenMap(a3DSceneShapeAttrTokenMap); 632cdf0e10cSrcweir } // if(!mp3DSceneShapeAttrTokenMap) 633cdf0e10cSrcweir 634cdf0e10cSrcweir return *mp3DSceneShapeAttrTokenMap; 635cdf0e10cSrcweir } 636cdf0e10cSrcweir 637cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 638cdf0e10cSrcweir 639cdf0e10cSrcweir 640cdf0e10cSrcweir const SvXMLTokenMap& XMLShapeImportHelper::Get3DLightAttrTokenMap() 641cdf0e10cSrcweir { 642cdf0e10cSrcweir if(!mp3DLightAttrTokenMap) 643cdf0e10cSrcweir { 644cdf0e10cSrcweir static __FAR_DATA SvXMLTokenMapEntry a3DLightAttrTokenMap[] = 645cdf0e10cSrcweir { 646cdf0e10cSrcweir { XML_NAMESPACE_DR3D, XML_DIFFUSE_COLOR, XML_TOK_3DLIGHT_DIFFUSE_COLOR }, 647cdf0e10cSrcweir { XML_NAMESPACE_DR3D, XML_DIRECTION, XML_TOK_3DLIGHT_DIRECTION }, 648cdf0e10cSrcweir { XML_NAMESPACE_DR3D, XML_ENABLED, XML_TOK_3DLIGHT_ENABLED }, 649cdf0e10cSrcweir { XML_NAMESPACE_DR3D, XML_SPECULAR, XML_TOK_3DLIGHT_SPECULAR }, 650cdf0e10cSrcweir XML_TOKEN_MAP_END 651cdf0e10cSrcweir }; 652cdf0e10cSrcweir 653cdf0e10cSrcweir mp3DLightAttrTokenMap = new SvXMLTokenMap(a3DLightAttrTokenMap); 654cdf0e10cSrcweir } // if(!mp3DLightAttrTokenMap) 655cdf0e10cSrcweir 656cdf0e10cSrcweir return *mp3DLightAttrTokenMap; 657cdf0e10cSrcweir } 658cdf0e10cSrcweir 659cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 660cdf0e10cSrcweir /* 661cdf0e10cSrcweir 662cdf0e10cSrcweir const SvXMLTokenMap& XMLShapeImportHelper::GetPageShapeAttrTokenMap() 663cdf0e10cSrcweir { 664cdf0e10cSrcweir if(!mpPageShapeAttrTokenMap) 665cdf0e10cSrcweir { 666cdf0e10cSrcweir static __FAR_DATA SvXMLTokenMapEntry aPageShapeAttrTokenMap[] = 667cdf0e10cSrcweir { 668cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_X, XML_TOK_PAGESHAPE_X }, 669cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_Y, XML_TOK_PAGESHAPE_Y }, 670cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_WIDTH, XML_TOK_PAGESHAPE_WIDTH }, 671cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_PAGESHAPE_HEIGHT }, 672cdf0e10cSrcweir XML_TOKEN_MAP_END 673cdf0e10cSrcweir }; 674cdf0e10cSrcweir 675cdf0e10cSrcweir mpPageShapeAttrTokenMap = new SvXMLTokenMap(aPageShapeAttrTokenMap); 676cdf0e10cSrcweir } 677cdf0e10cSrcweir 678cdf0e10cSrcweir return *mpPageShapeAttrTokenMap; 679cdf0e10cSrcweir } 680cdf0e10cSrcweir 681cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 682cdf0e10cSrcweir 683cdf0e10cSrcweir 684cdf0e10cSrcweir const SvXMLTokenMap& XMLShapeImportHelper::GetGraphicObjectShapeAttrTokenMap() 685cdf0e10cSrcweir { 686cdf0e10cSrcweir if(!mpGraphicObjectShapeAttrTokenMap) 687cdf0e10cSrcweir { 688cdf0e10cSrcweir static __FAR_DATA SvXMLTokenMapEntry aGraphicObjectShapeAttrTokenMap[] = 689cdf0e10cSrcweir { 690cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_X, XML_TOK_GOSHAPE_X }, 691cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_Y, XML_TOK_GOSHAPE_Y }, 692cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_WIDTH, XML_TOK_GOSHAPE_WIDTH }, 693cdf0e10cSrcweir { XML_NAMESPACE_SVG, XML_HEIGHT, XML_TOK_GOSHAPE_HEIGHT }, 694cdf0e10cSrcweir { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_GOSHAPE_URL }, 695cdf0e10cSrcweir XML_TOKEN_MAP_END 696cdf0e10cSrcweir }; 697cdf0e10cSrcweir 698cdf0e10cSrcweir mpGraphicObjectShapeAttrTokenMap = new SvXMLTokenMap(aGraphicObjectShapeAttrTokenMap); 699cdf0e10cSrcweir } 700cdf0e10cSrcweir 701cdf0e10cSrcweir return *mpGraphicObjectShapeAttrTokenMap; 702cdf0e10cSrcweir } 703cdf0e10cSrcweir */ 704cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 705cdf0e10cSrcweir 706cdf0e10cSrcweir SvXMLShapeContext* XMLShapeImportHelper::Create3DSceneChildContext( 707cdf0e10cSrcweir SvXMLImport& rImport, 708cdf0e10cSrcweir sal_uInt16 p_nPrefix, 709cdf0e10cSrcweir const OUString& rLocalName, 710cdf0e10cSrcweir const uno::Reference< xml::sax::XAttributeList>& xAttrList, 711cdf0e10cSrcweir uno::Reference< drawing::XShapes >& rShapes) 712cdf0e10cSrcweir { 713cdf0e10cSrcweir SdXMLShapeContext *pContext = 0L; 714cdf0e10cSrcweir 715cdf0e10cSrcweir if(rShapes.is()) 716cdf0e10cSrcweir { 717cdf0e10cSrcweir const SvXMLTokenMap& rTokenMap = Get3DSceneShapeElemTokenMap(); 718cdf0e10cSrcweir switch(rTokenMap.Get(p_nPrefix, rLocalName)) 719cdf0e10cSrcweir { 720cdf0e10cSrcweir case XML_TOK_3DSCENE_3DSCENE: 721cdf0e10cSrcweir { 722cdf0e10cSrcweir // dr3d:3dscene inside dr3d:3dscene context 723cdf0e10cSrcweir pContext = new SdXML3DSceneShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False); 724cdf0e10cSrcweir break; 725cdf0e10cSrcweir } 726cdf0e10cSrcweir case XML_TOK_3DSCENE_3DCUBE: 727cdf0e10cSrcweir { 728cdf0e10cSrcweir // dr3d:3dcube inside dr3d:3dscene context 729cdf0e10cSrcweir pContext = new SdXML3DCubeObjectShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False); 730cdf0e10cSrcweir break; 731cdf0e10cSrcweir } 732cdf0e10cSrcweir case XML_TOK_3DSCENE_3DSPHERE: 733cdf0e10cSrcweir { 734cdf0e10cSrcweir // dr3d:3dsphere inside dr3d:3dscene context 735cdf0e10cSrcweir pContext = new SdXML3DSphereObjectShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False); 736cdf0e10cSrcweir break; 737cdf0e10cSrcweir } 738cdf0e10cSrcweir case XML_TOK_3DSCENE_3DLATHE: 739cdf0e10cSrcweir { 740cdf0e10cSrcweir // dr3d:3dlathe inside dr3d:3dscene context 741cdf0e10cSrcweir pContext = new SdXML3DLatheObjectShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False); 742cdf0e10cSrcweir break; 743cdf0e10cSrcweir } 744cdf0e10cSrcweir case XML_TOK_3DSCENE_3DEXTRUDE: 745cdf0e10cSrcweir { 746cdf0e10cSrcweir // dr3d:3dextrude inside dr3d:3dscene context 747cdf0e10cSrcweir pContext = new SdXML3DExtrudeObjectShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False); 748cdf0e10cSrcweir break; 749cdf0e10cSrcweir } 750cdf0e10cSrcweir } 751cdf0e10cSrcweir } 752cdf0e10cSrcweir 753cdf0e10cSrcweir // now parse the attribute list and call the child context for each unknown attribute 754cdf0e10cSrcweir sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; 755cdf0e10cSrcweir for(sal_Int16 a(0); a < nAttrCount; a++) 756cdf0e10cSrcweir { 757cdf0e10cSrcweir const OUString& rAttrName = xAttrList->getNameByIndex(a); 758cdf0e10cSrcweir OUString aLocalName; 759cdf0e10cSrcweir sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName(rAttrName, &aLocalName); 760cdf0e10cSrcweir const OUString aValue( xAttrList->getValueByIndex(a) ); 761cdf0e10cSrcweir 762cdf0e10cSrcweir pContext->processAttribute( nPrefix, aLocalName, aValue ); 763cdf0e10cSrcweir } 764cdf0e10cSrcweir 765cdf0e10cSrcweir return pContext; 766cdf0e10cSrcweir } 767cdf0e10cSrcweir 768cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 769cdf0e10cSrcweir 770cdf0e10cSrcweir void XMLShapeImportHelper::SetStylesContext(SvXMLStylesContext* pNew) 771cdf0e10cSrcweir { 772cdf0e10cSrcweir mpStylesContext = pNew; 773cdf0e10cSrcweir mpStylesContext->AddRef(); 774cdf0e10cSrcweir } 775cdf0e10cSrcweir 776cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 777cdf0e10cSrcweir 778cdf0e10cSrcweir void XMLShapeImportHelper::SetAutoStylesContext(SvXMLStylesContext* pNew) 779cdf0e10cSrcweir { 780cdf0e10cSrcweir mpAutoStylesContext = pNew; 781cdf0e10cSrcweir mpAutoStylesContext->AddRef(); 782cdf0e10cSrcweir } 783cdf0e10cSrcweir 784cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 785cdf0e10cSrcweir 786cdf0e10cSrcweir SvXMLShapeContext* XMLShapeImportHelper::CreateGroupChildContext( 787cdf0e10cSrcweir SvXMLImport& rImport, 788cdf0e10cSrcweir sal_uInt16 p_nPrefix, 789cdf0e10cSrcweir const OUString& rLocalName, 790cdf0e10cSrcweir const uno::Reference< xml::sax::XAttributeList>& xAttrList, 791cdf0e10cSrcweir uno::Reference< drawing::XShapes >& rShapes, 792cdf0e10cSrcweir sal_Bool bTemporaryShape) 793cdf0e10cSrcweir { 794cdf0e10cSrcweir SdXMLShapeContext *pContext = 0L; 795cdf0e10cSrcweir 796cdf0e10cSrcweir const SvXMLTokenMap& rTokenMap = GetGroupShapeElemTokenMap(); 797cdf0e10cSrcweir sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; 798cdf0e10cSrcweir 799cdf0e10cSrcweir switch(rTokenMap.Get(p_nPrefix, rLocalName)) 800cdf0e10cSrcweir { 801cdf0e10cSrcweir case XML_TOK_GROUP_GROUP: 802cdf0e10cSrcweir { 803cdf0e10cSrcweir // draw:g inside group context (RECURSIVE) 804cdf0e10cSrcweir pContext = new SdXMLGroupShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape); 805cdf0e10cSrcweir break; 806cdf0e10cSrcweir } 807cdf0e10cSrcweir case XML_TOK_GROUP_3DSCENE: 808cdf0e10cSrcweir { 809cdf0e10cSrcweir // dr3d:3dscene inside group context 810cdf0e10cSrcweir pContext = new SdXML3DSceneShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape); 811cdf0e10cSrcweir break; 812cdf0e10cSrcweir } 813cdf0e10cSrcweir case XML_TOK_GROUP_RECT: 814cdf0e10cSrcweir { 815cdf0e10cSrcweir // draw:rect inside group context 816cdf0e10cSrcweir pContext = new SdXMLRectShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape ); 817cdf0e10cSrcweir break; 818cdf0e10cSrcweir } 819cdf0e10cSrcweir case XML_TOK_GROUP_LINE: 820cdf0e10cSrcweir { 821cdf0e10cSrcweir // draw:line inside group context 822cdf0e10cSrcweir pContext = new SdXMLLineShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape ); 823cdf0e10cSrcweir break; 824cdf0e10cSrcweir } 825cdf0e10cSrcweir case XML_TOK_GROUP_CIRCLE: 826cdf0e10cSrcweir case XML_TOK_GROUP_ELLIPSE: 827cdf0e10cSrcweir { 828cdf0e10cSrcweir // draw:circle or draw:ellipse inside group context 829cdf0e10cSrcweir pContext = new SdXMLEllipseShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape ); 830cdf0e10cSrcweir break; 831cdf0e10cSrcweir } 832cdf0e10cSrcweir case XML_TOK_GROUP_POLYGON: 833cdf0e10cSrcweir case XML_TOK_GROUP_POLYLINE: 834cdf0e10cSrcweir { 835cdf0e10cSrcweir // draw:polygon or draw:polyline inside group context 836cdf0e10cSrcweir pContext = new SdXMLPolygonShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, 837cdf0e10cSrcweir rTokenMap.Get(p_nPrefix, rLocalName) == XML_TOK_GROUP_POLYGON ? sal_True : sal_False, bTemporaryShape ); 838cdf0e10cSrcweir break; 839cdf0e10cSrcweir } 840cdf0e10cSrcweir case XML_TOK_GROUP_PATH: 841cdf0e10cSrcweir { 842cdf0e10cSrcweir // draw:path inside group context 843cdf0e10cSrcweir pContext = new SdXMLPathShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape); 844cdf0e10cSrcweir break; 845cdf0e10cSrcweir } 846cdf0e10cSrcweir case XML_TOK_GROUP_FRAME: 847cdf0e10cSrcweir { 848cdf0e10cSrcweir // text:text-box inside group context 849cdf0e10cSrcweir pContext = new SdXMLFrameShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape ); 850cdf0e10cSrcweir break; 851cdf0e10cSrcweir } 852cdf0e10cSrcweir case XML_TOK_GROUP_CONTROL: 853cdf0e10cSrcweir { 854cdf0e10cSrcweir // draw:control inside group context 855cdf0e10cSrcweir pContext = new SdXMLControlShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape ); 856cdf0e10cSrcweir break; 857cdf0e10cSrcweir } 858cdf0e10cSrcweir case XML_TOK_GROUP_CONNECTOR: 859cdf0e10cSrcweir { 860cdf0e10cSrcweir // draw:connector inside group context 861cdf0e10cSrcweir pContext = new SdXMLConnectorShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape ); 862cdf0e10cSrcweir break; 863cdf0e10cSrcweir } 864cdf0e10cSrcweir case XML_TOK_GROUP_MEASURE: 865cdf0e10cSrcweir { 866cdf0e10cSrcweir // draw:measure inside group context 867cdf0e10cSrcweir pContext = new SdXMLMeasureShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape ); 868cdf0e10cSrcweir break; 869cdf0e10cSrcweir } 870cdf0e10cSrcweir case XML_TOK_GROUP_PAGE: 871cdf0e10cSrcweir { 872cdf0e10cSrcweir // draw:page inside group context 873cdf0e10cSrcweir pContext = new SdXMLPageShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape ); 874cdf0e10cSrcweir break; 875cdf0e10cSrcweir } 876cdf0e10cSrcweir case XML_TOK_GROUP_CAPTION: 877cdf0e10cSrcweir case XML_TOK_GROUP_ANNOTATION: 878cdf0e10cSrcweir { 879cdf0e10cSrcweir // draw:caption inside group context 880cdf0e10cSrcweir pContext = new SdXMLCaptionShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape ); 881cdf0e10cSrcweir break; 882cdf0e10cSrcweir } 883cdf0e10cSrcweir case XML_TOK_GROUP_CHART: 884cdf0e10cSrcweir { 885cdf0e10cSrcweir // chart:chart inside group context 886cdf0e10cSrcweir pContext = new SdXMLChartShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, bTemporaryShape ); 887cdf0e10cSrcweir break; 888cdf0e10cSrcweir } 889cdf0e10cSrcweir case XML_TOK_GROUP_CUSTOM_SHAPE: 890cdf0e10cSrcweir { 891cdf0e10cSrcweir // draw:customshape 892cdf0e10cSrcweir pContext = new SdXMLCustomShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False ); 893cdf0e10cSrcweir break; 894cdf0e10cSrcweir } 895cdf0e10cSrcweir case XML_TOK_GROUP_A: 896cdf0e10cSrcweir { 897cdf0e10cSrcweir return new SdXMLShapeLinkContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes ); 898cdf0e10cSrcweir } 899cdf0e10cSrcweir // add other shapes here... 900cdf0e10cSrcweir default: 901cdf0e10cSrcweir return new SvXMLShapeContext( rImport, p_nPrefix, rLocalName, bTemporaryShape ); 902cdf0e10cSrcweir } 903cdf0e10cSrcweir 904cdf0e10cSrcweir // now parse the attribute list and call the child context for each unknown attribute 905cdf0e10cSrcweir for(sal_Int16 a(0); a < nAttrCount; a++) 906cdf0e10cSrcweir { 907cdf0e10cSrcweir const OUString& rAttrName = xAttrList->getNameByIndex(a); 908cdf0e10cSrcweir OUString aLocalName; 909cdf0e10cSrcweir sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName(rAttrName, &aLocalName); 910cdf0e10cSrcweir const OUString aValue( xAttrList->getValueByIndex(a) ); 911cdf0e10cSrcweir 912cdf0e10cSrcweir pContext->processAttribute( nPrefix, aLocalName, aValue ); 913cdf0e10cSrcweir } 914cdf0e10cSrcweir 915cdf0e10cSrcweir return pContext; 916cdf0e10cSrcweir } 917cdf0e10cSrcweir 918cdf0e10cSrcweir // This method is called from SdXMLFrameContext to create children of drawe:frame 919cdf0e10cSrcweir SvXMLShapeContext* XMLShapeImportHelper::CreateFrameChildContext( 920cdf0e10cSrcweir SvXMLImport& rImport, 921cdf0e10cSrcweir sal_uInt16 p_nPrefix, 922cdf0e10cSrcweir const OUString& rLocalName, 923cdf0e10cSrcweir const uno::Reference< xml::sax::XAttributeList>& rAttrList, 924cdf0e10cSrcweir uno::Reference< drawing::XShapes >& rShapes, 925cdf0e10cSrcweir const uno::Reference< xml::sax::XAttributeList>& rFrameAttrList) 926cdf0e10cSrcweir { 927cdf0e10cSrcweir SdXMLShapeContext *pContext = 0L; 928cdf0e10cSrcweir 929cdf0e10cSrcweir const SvXMLTokenMap& rTokenMap = GetFrameShapeElemTokenMap(); 930cdf0e10cSrcweir 931cdf0e10cSrcweir SvXMLAttributeList *pAttrList = new SvXMLAttributeList( rAttrList ); 932cdf0e10cSrcweir if( rFrameAttrList.is() ) 933cdf0e10cSrcweir pAttrList->AppendAttributeList( rFrameAttrList ); 934cdf0e10cSrcweir uno::Reference < xml::sax::XAttributeList > xAttrList = pAttrList; 935cdf0e10cSrcweir 936cdf0e10cSrcweir 937cdf0e10cSrcweir switch(rTokenMap.Get(p_nPrefix, rLocalName)) 938cdf0e10cSrcweir { 939cdf0e10cSrcweir case XML_TOK_FRAME_TEXT_BOX: 940cdf0e10cSrcweir { 941cdf0e10cSrcweir // text:text-box inside group context 942cdf0e10cSrcweir pContext = new SdXMLTextBoxShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False ); 943cdf0e10cSrcweir break; 944cdf0e10cSrcweir } 945cdf0e10cSrcweir case XML_TOK_FRAME_IMAGE: 946cdf0e10cSrcweir { 947cdf0e10cSrcweir // office:image inside group context 948cdf0e10cSrcweir pContext = new SdXMLGraphicObjectShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False ); 949cdf0e10cSrcweir break; 950cdf0e10cSrcweir } 951cdf0e10cSrcweir case XML_TOK_FRAME_OBJECT: 952cdf0e10cSrcweir case XML_TOK_FRAME_OBJECT_OLE: 953cdf0e10cSrcweir { 954cdf0e10cSrcweir // draw:object or draw:object_ole 955cdf0e10cSrcweir pContext = new SdXMLObjectShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False ); 956cdf0e10cSrcweir break; 957cdf0e10cSrcweir } 958cdf0e10cSrcweir case XML_TOK_FRAME_TABLE: 959cdf0e10cSrcweir { 960cdf0e10cSrcweir // draw:object or draw:object_ole 961cdf0e10cSrcweir if( rImport.IsTableShapeSupported() ) 962cdf0e10cSrcweir pContext = new SdXMLTableShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes ); 963cdf0e10cSrcweir break; 964cdf0e10cSrcweir 965cdf0e10cSrcweir } 966cdf0e10cSrcweir case XML_TOK_FRAME_PLUGIN: 967cdf0e10cSrcweir { 968cdf0e10cSrcweir // draw:plugin 969cdf0e10cSrcweir pContext = new SdXMLPluginShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False ); 970cdf0e10cSrcweir break; 971cdf0e10cSrcweir } 972cdf0e10cSrcweir case XML_TOK_FRAME_FLOATING_FRAME: 973cdf0e10cSrcweir { 974cdf0e10cSrcweir // draw:floating-frame 975cdf0e10cSrcweir pContext = new SdXMLFloatingFrameShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False ); 976cdf0e10cSrcweir break; 977cdf0e10cSrcweir } 978cdf0e10cSrcweir case XML_TOK_FRAME_APPLET: 979cdf0e10cSrcweir { 980cdf0e10cSrcweir // draw:applet 981cdf0e10cSrcweir pContext = new SdXMLAppletShapeContext( rImport, p_nPrefix, rLocalName, xAttrList, rShapes, sal_False ); 982cdf0e10cSrcweir break; 983cdf0e10cSrcweir } 984cdf0e10cSrcweir // add other shapes here... 985cdf0e10cSrcweir default: 986cdf0e10cSrcweir break; 987cdf0e10cSrcweir } 988cdf0e10cSrcweir 989cdf0e10cSrcweir if( pContext ) 990cdf0e10cSrcweir { 991cdf0e10cSrcweir // now parse the attribute list and call the child context for each unknown attribute 992cdf0e10cSrcweir sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; 993cdf0e10cSrcweir for(sal_Int16 a(0); a < nAttrCount; a++) 994cdf0e10cSrcweir { 995cdf0e10cSrcweir const OUString& rAttrName = xAttrList->getNameByIndex(a); 996cdf0e10cSrcweir OUString aLocalName; 997cdf0e10cSrcweir sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName(rAttrName, &aLocalName); 998cdf0e10cSrcweir const OUString aValue( xAttrList->getValueByIndex(a) ); 999cdf0e10cSrcweir 1000cdf0e10cSrcweir pContext->processAttribute( nPrefix, aLocalName, aValue ); 1001cdf0e10cSrcweir } 1002cdf0e10cSrcweir } 1003cdf0e10cSrcweir 1004cdf0e10cSrcweir return pContext; 1005cdf0e10cSrcweir } 1006cdf0e10cSrcweir 1007cdf0e10cSrcweir SvXMLImportContext *XMLShapeImportHelper::CreateFrameChildContext( 1008cdf0e10cSrcweir SvXMLImportContext *pThisContext, 1009cdf0e10cSrcweir sal_uInt16 nPrefix, 1010cdf0e10cSrcweir const OUString& rLocalName, 1011cdf0e10cSrcweir const uno::Reference< xml::sax::XAttributeList>& xAttrList ) 1012cdf0e10cSrcweir { 1013cdf0e10cSrcweir SvXMLImportContext * pContext = NULL; 1014cdf0e10cSrcweir 1015cdf0e10cSrcweir SdXMLFrameShapeContext *pFrameContext = PTR_CAST( SdXMLFrameShapeContext, pThisContext ); 1016cdf0e10cSrcweir if( pFrameContext ) 1017cdf0e10cSrcweir pContext = pFrameContext->CreateChildContext( nPrefix, rLocalName, xAttrList ); 1018cdf0e10cSrcweir 1019cdf0e10cSrcweir return pContext; 1020cdf0e10cSrcweir } 1021cdf0e10cSrcweir 1022cdf0e10cSrcweir 1023cdf0e10cSrcweir /** this function is called whenever the implementation classes like to add this new 1024cdf0e10cSrcweir shape to the given XShapes. 1025cdf0e10cSrcweir */ 1026cdf0e10cSrcweir void XMLShapeImportHelper::addShape( uno::Reference< drawing::XShape >& rShape, 1027cdf0e10cSrcweir const uno::Reference< xml::sax::XAttributeList >&, 1028cdf0e10cSrcweir uno::Reference< drawing::XShapes >& rShapes) 1029cdf0e10cSrcweir { 1030cdf0e10cSrcweir if( rShape.is() && rShapes.is() ) 1031cdf0e10cSrcweir { 1032cdf0e10cSrcweir // add new shape to parent 1033cdf0e10cSrcweir rShapes->add( rShape ); 1034cdf0e10cSrcweir } 1035cdf0e10cSrcweir } 1036cdf0e10cSrcweir 1037cdf0e10cSrcweir /** this function is called whenever the implementation classes have finished importing 1038cdf0e10cSrcweir a shape to the given XShapes. The shape is already inserted into its XShapes and 1039cdf0e10cSrcweir all properties and styles are set. 1040cdf0e10cSrcweir */ 1041cdf0e10cSrcweir void XMLShapeImportHelper::finishShape( 1042cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rShape, 1043cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >&, 1044cdf0e10cSrcweir com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >&) 1045cdf0e10cSrcweir { 1046cdf0e10cSrcweir // --> OD 2004-08-10 #i28749#, #i36248# - set property <PositionLayoutDir> 1047cdf0e10cSrcweir // to <PositionInHoriL2R>, if it exists and the import states that 1048cdf0e10cSrcweir // the shape positioning attributes are in horizontal left-to-right 1049cdf0e10cSrcweir // layout. This is the case for the OpenOffice.org file format. 1050cdf0e10cSrcweir // This setting is done for Writer documents, because the property 1051cdf0e10cSrcweir // only exists at service com::sun::star::text::Shape - the Writer 1052cdf0e10cSrcweir // UNO service for shapes. 1053cdf0e10cSrcweir // The value indicates that the positioning attributes are given 1054cdf0e10cSrcweir // in horizontal left-to-right layout. The property is evaluated 1055cdf0e10cSrcweir // during the first positioning of the shape in order to convert 1056cdf0e10cSrcweir // the shape position given in the OpenOffice.org file format to 1057cdf0e10cSrcweir // the one for the OASIS Open Office file format. 1058cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPropSet(rShape, uno::UNO_QUERY); 1059cdf0e10cSrcweir if ( xPropSet.is() ) 1060cdf0e10cSrcweir { 1061cdf0e10cSrcweir if ( mrImporter.IsShapePositionInHoriL2R() && 1062cdf0e10cSrcweir xPropSet->getPropertySetInfo()->hasPropertyByName( 1063cdf0e10cSrcweir OUString(RTL_CONSTASCII_USTRINGPARAM("PositionLayoutDir"))) ) 1064cdf0e10cSrcweir { 1065cdf0e10cSrcweir uno::Any aPosLayoutDir; 1066cdf0e10cSrcweir aPosLayoutDir <<= text::PositionLayoutDir::PositionInHoriL2R; 1067cdf0e10cSrcweir xPropSet->setPropertyValue( 1068cdf0e10cSrcweir OUString(RTL_CONSTASCII_USTRINGPARAM("PositionLayoutDir")), 1069cdf0e10cSrcweir aPosLayoutDir ); 1070cdf0e10cSrcweir } 1071cdf0e10cSrcweir } 1072cdf0e10cSrcweir // <-- 1073cdf0e10cSrcweir } 1074cdf0e10cSrcweir 1075cdf0e10cSrcweir // helper functions for z-order sorting 1076cdf0e10cSrcweir struct ZOrderHint 1077cdf0e10cSrcweir { 1078cdf0e10cSrcweir sal_Int32 nIs; 1079cdf0e10cSrcweir sal_Int32 nShould; 1080cdf0e10cSrcweir 1081cdf0e10cSrcweir int operator<(const ZOrderHint& rComp) const { return nShould < rComp.nShould; } 1082cdf0e10cSrcweir }; 1083cdf0e10cSrcweir 1084cdf0e10cSrcweir class ShapeSortContext 1085cdf0e10cSrcweir { 1086cdf0e10cSrcweir public: 1087cdf0e10cSrcweir uno::Reference< drawing::XShapes > mxShapes; 1088cdf0e10cSrcweir list<ZOrderHint> maZOrderList; 1089cdf0e10cSrcweir list<ZOrderHint> maUnsortedList; 1090cdf0e10cSrcweir 1091cdf0e10cSrcweir sal_Int32 mnCurrentZ; 1092cdf0e10cSrcweir ShapeSortContext* mpParentContext; 1093cdf0e10cSrcweir const OUString msZOrder; 1094cdf0e10cSrcweir 1095cdf0e10cSrcweir ShapeSortContext( uno::Reference< drawing::XShapes >& rShapes, ShapeSortContext* pParentContext = NULL ); 1096cdf0e10cSrcweir 1097cdf0e10cSrcweir void moveShape( sal_Int32 nSourcePos, sal_Int32 nDestPos ); 1098cdf0e10cSrcweir }; 1099cdf0e10cSrcweir 1100cdf0e10cSrcweir ShapeSortContext::ShapeSortContext( uno::Reference< drawing::XShapes >& rShapes, ShapeSortContext* pParentContext ) 1101cdf0e10cSrcweir : mxShapes( rShapes ), mnCurrentZ( 0 ), mpParentContext( pParentContext ), 1102cdf0e10cSrcweir msZOrder(RTL_CONSTASCII_USTRINGPARAM("ZOrder")) 1103cdf0e10cSrcweir { 1104cdf0e10cSrcweir } 1105cdf0e10cSrcweir 1106cdf0e10cSrcweir void ShapeSortContext::moveShape( sal_Int32 nSourcePos, sal_Int32 nDestPos ) 1107cdf0e10cSrcweir { 1108cdf0e10cSrcweir uno::Any aAny( mxShapes->getByIndex( nSourcePos ) ); 1109cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xPropSet; 1110cdf0e10cSrcweir aAny >>= xPropSet; 1111cdf0e10cSrcweir 1112cdf0e10cSrcweir if( xPropSet.is() && xPropSet->getPropertySetInfo()->hasPropertyByName( msZOrder ) ) 1113cdf0e10cSrcweir { 1114cdf0e10cSrcweir aAny <<= nDestPos; 1115cdf0e10cSrcweir xPropSet->setPropertyValue( msZOrder, aAny ); 1116cdf0e10cSrcweir 1117cdf0e10cSrcweir list<ZOrderHint>::iterator aIter = maZOrderList.begin(); 1118cdf0e10cSrcweir list<ZOrderHint>::iterator aEnd = maZOrderList.end(); 1119cdf0e10cSrcweir 1120cdf0e10cSrcweir while( aIter != aEnd ) 1121cdf0e10cSrcweir { 1122cdf0e10cSrcweir if( (*aIter).nIs < nSourcePos ) 1123cdf0e10cSrcweir { 1124cdf0e10cSrcweir DBG_ASSERT( (*aIter).nIs >= nDestPos, "Shape sorting failed" ); 1125cdf0e10cSrcweir (*aIter).nIs++; 1126cdf0e10cSrcweir } 1127cdf0e10cSrcweir aIter++; 1128cdf0e10cSrcweir } 1129cdf0e10cSrcweir 1130cdf0e10cSrcweir aIter = maUnsortedList.begin(); 1131cdf0e10cSrcweir aEnd = maUnsortedList.end(); 1132cdf0e10cSrcweir 1133cdf0e10cSrcweir while( aIter != aEnd ) 1134cdf0e10cSrcweir { 1135cdf0e10cSrcweir if( (*aIter).nIs < nSourcePos ) 1136cdf0e10cSrcweir { 1137cdf0e10cSrcweir DBG_ASSERT( (*aIter).nIs >= nDestPos, "shape sorting failed" ); 1138cdf0e10cSrcweir (*aIter).nIs++; 1139cdf0e10cSrcweir } 1140cdf0e10cSrcweir aIter++; 1141cdf0e10cSrcweir } 1142cdf0e10cSrcweir } 1143cdf0e10cSrcweir } 1144cdf0e10cSrcweir 1145cdf0e10cSrcweir void XMLShapeImportHelper::pushGroupForSorting( uno::Reference< drawing::XShapes >& rShapes ) 1146cdf0e10cSrcweir { 1147cdf0e10cSrcweir mpImpl->mpSortContext = new ShapeSortContext( rShapes, mpImpl->mpSortContext ); 1148cdf0e10cSrcweir } 1149cdf0e10cSrcweir 1150cdf0e10cSrcweir void XMLShapeImportHelper::popGroupAndSort() 1151cdf0e10cSrcweir { 1152cdf0e10cSrcweir DBG_ASSERT( mpImpl->mpSortContext, "No context to sort!" ); 1153cdf0e10cSrcweir if( mpImpl->mpSortContext == NULL ) 1154cdf0e10cSrcweir return; 1155cdf0e10cSrcweir 1156cdf0e10cSrcweir try 1157cdf0e10cSrcweir { 1158cdf0e10cSrcweir list<ZOrderHint>& rZList = mpImpl->mpSortContext->maZOrderList; 1159cdf0e10cSrcweir list<ZOrderHint>& rUnsortedList = mpImpl->mpSortContext->maUnsortedList; 1160cdf0e10cSrcweir 1161cdf0e10cSrcweir // sort shapes 1162cdf0e10cSrcweir if( !rZList.empty() ) 1163cdf0e10cSrcweir { 1164cdf0e10cSrcweir // only do something if we have shapes to sort 1165cdf0e10cSrcweir 1166cdf0e10cSrcweir // check if there are more shapes than inserted with ::shapeWithZIndexAdded() 1167cdf0e10cSrcweir // This can happen if there where already shapes on the page before import 1168cdf0e10cSrcweir // Since the writer may delete some of this shapes during import, we need 1169cdf0e10cSrcweir // to do this here and not in our c'tor anymore 1170cdf0e10cSrcweir 1171cdf0e10cSrcweir // check if we have more shapes than we know of 1172cdf0e10cSrcweir sal_Int32 nCount = mpImpl->mpSortContext->mxShapes->getCount(); 1173cdf0e10cSrcweir 1174cdf0e10cSrcweir nCount -= rZList.size(); 1175cdf0e10cSrcweir nCount -= rUnsortedList.size(); 1176cdf0e10cSrcweir 1177cdf0e10cSrcweir 1178cdf0e10cSrcweir if( nCount > 0 ) 1179cdf0e10cSrcweir { 1180cdf0e10cSrcweir // first update offsets of added shapes 1181cdf0e10cSrcweir list<ZOrderHint>::iterator aIter( rZList.begin() ); 1182cdf0e10cSrcweir while( aIter != rZList.end() ) 1183cdf0e10cSrcweir (*aIter++).nIs += nCount; 1184cdf0e10cSrcweir 1185cdf0e10cSrcweir aIter = rUnsortedList.begin(); 1186cdf0e10cSrcweir while( aIter != rUnsortedList.end() ) 1187cdf0e10cSrcweir (*aIter++).nIs += nCount; 1188cdf0e10cSrcweir 1189cdf0e10cSrcweir // second add the already existing shapes in the unsorted list 1190cdf0e10cSrcweir ZOrderHint aNewHint; 1191cdf0e10cSrcweir 1192cdf0e10cSrcweir do 1193cdf0e10cSrcweir { 1194cdf0e10cSrcweir nCount--; 1195cdf0e10cSrcweir 1196cdf0e10cSrcweir aNewHint.nIs = nCount; 1197cdf0e10cSrcweir aNewHint.nShould = -1; 1198cdf0e10cSrcweir 1199cdf0e10cSrcweir rUnsortedList.insert(rUnsortedList.begin(), aNewHint); 1200cdf0e10cSrcweir } 1201cdf0e10cSrcweir while( nCount ); 1202cdf0e10cSrcweir } 1203cdf0e10cSrcweir 1204cdf0e10cSrcweir // sort z ordered shapes 1205cdf0e10cSrcweir rZList.sort(); 1206cdf0e10cSrcweir 1207cdf0e10cSrcweir // this is the current index, all shapes before that 1208cdf0e10cSrcweir // index are finished 1209cdf0e10cSrcweir sal_Int32 nIndex = 0; 1210cdf0e10cSrcweir while( !rZList.empty() ) 1211cdf0e10cSrcweir { 1212cdf0e10cSrcweir list<ZOrderHint>::iterator aIter( rZList.begin() ); 1213cdf0e10cSrcweir 1214cdf0e10cSrcweir while( nIndex < (*aIter).nShould && !rUnsortedList.empty() ) 1215cdf0e10cSrcweir { 1216cdf0e10cSrcweir ZOrderHint aGapHint( *rUnsortedList.begin() ); 1217cdf0e10cSrcweir rUnsortedList.pop_front(); 1218cdf0e10cSrcweir 1219cdf0e10cSrcweir mpImpl->mpSortContext->moveShape( aGapHint.nIs, nIndex++ ); 1220cdf0e10cSrcweir } 1221cdf0e10cSrcweir 1222cdf0e10cSrcweir if( (*aIter).nIs != nIndex ) 1223cdf0e10cSrcweir mpImpl->mpSortContext->moveShape( (*aIter).nIs, nIndex ); 1224cdf0e10cSrcweir 1225cdf0e10cSrcweir rZList.pop_front(); 1226cdf0e10cSrcweir nIndex++; 1227cdf0e10cSrcweir } 1228cdf0e10cSrcweir } 1229cdf0e10cSrcweir } 1230cdf0e10cSrcweir catch( uno::Exception& ) 1231cdf0e10cSrcweir { 1232cdf0e10cSrcweir DBG_ERROR("exception while sorting shapes, sorting failed!"); 1233cdf0e10cSrcweir } 1234cdf0e10cSrcweir 1235cdf0e10cSrcweir // put parent on top and delete current context, were done 1236cdf0e10cSrcweir ShapeSortContext* pContext = mpImpl->mpSortContext; 1237cdf0e10cSrcweir mpImpl->mpSortContext = pContext->mpParentContext; 1238cdf0e10cSrcweir delete pContext; 1239cdf0e10cSrcweir } 1240cdf0e10cSrcweir 1241cdf0e10cSrcweir void XMLShapeImportHelper::shapeWithZIndexAdded( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >&, sal_Int32 nZIndex ) 1242cdf0e10cSrcweir { 1243cdf0e10cSrcweir if( mpImpl->mpSortContext) 1244cdf0e10cSrcweir { 1245cdf0e10cSrcweir ZOrderHint aNewHint; 1246cdf0e10cSrcweir aNewHint.nIs = mpImpl->mpSortContext->mnCurrentZ++; 1247cdf0e10cSrcweir aNewHint.nShould = nZIndex; 1248cdf0e10cSrcweir 1249cdf0e10cSrcweir if( nZIndex == -1 ) 1250cdf0e10cSrcweir { 1251cdf0e10cSrcweir // don't care, so add to unsorted list 1252cdf0e10cSrcweir mpImpl->mpSortContext->maUnsortedList.push_back(aNewHint); 1253cdf0e10cSrcweir } 1254cdf0e10cSrcweir else 1255cdf0e10cSrcweir { 1256cdf0e10cSrcweir // insert into sort list 1257cdf0e10cSrcweir mpImpl->mpSortContext->maZOrderList.push_back(aNewHint); 1258cdf0e10cSrcweir } 1259cdf0e10cSrcweir } 1260cdf0e10cSrcweir } 1261cdf0e10cSrcweir 1262cdf0e10cSrcweir void XMLShapeImportHelper::addShapeConnection( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rConnectorShape, 1263cdf0e10cSrcweir sal_Bool bStart, 1264cdf0e10cSrcweir const rtl::OUString& rDestShapeId, 1265cdf0e10cSrcweir sal_Int32 nDestGlueId ) 1266cdf0e10cSrcweir { 1267cdf0e10cSrcweir ConnectionHint aHint; 1268cdf0e10cSrcweir aHint.mxConnector = rConnectorShape; 1269cdf0e10cSrcweir aHint.bStart = bStart; 1270cdf0e10cSrcweir aHint.aDestShapeId = rDestShapeId; 1271cdf0e10cSrcweir aHint.nDestGlueId = nDestGlueId; 1272cdf0e10cSrcweir 1273cdf0e10cSrcweir mpImpl->maConnections.push_back( aHint ); 1274cdf0e10cSrcweir } 1275cdf0e10cSrcweir 1276cdf0e10cSrcweir void XMLShapeImportHelper::restoreConnections() 1277cdf0e10cSrcweir { 1278cdf0e10cSrcweir if( !mpImpl->maConnections.empty() ) 1279cdf0e10cSrcweir { 1280cdf0e10cSrcweir uno::Any aAny; 1281cdf0e10cSrcweir 1282cdf0e10cSrcweir const vector<ConnectionHint>::size_type nCount = mpImpl->maConnections.size(); 1283cdf0e10cSrcweir for( vector<ConnectionHint>::size_type i = 0; i < nCount; i++ ) 1284cdf0e10cSrcweir { 1285cdf0e10cSrcweir ConnectionHint& rHint = mpImpl->maConnections[i]; 1286cdf0e10cSrcweir uno::Reference< beans::XPropertySet > xConnector( rHint.mxConnector, uno::UNO_QUERY ); 1287cdf0e10cSrcweir if( xConnector.is() ) 1288cdf0e10cSrcweir { 1289cdf0e10cSrcweir // #86637# remember line deltas 1290cdf0e10cSrcweir uno::Any aLine1Delta; 1291cdf0e10cSrcweir uno::Any aLine2Delta; 1292cdf0e10cSrcweir uno::Any aLine3Delta; 1293cdf0e10cSrcweir OUString aStr1(RTL_CONSTASCII_USTRINGPARAM("EdgeLine1Delta")); 1294cdf0e10cSrcweir OUString aStr2(RTL_CONSTASCII_USTRINGPARAM("EdgeLine2Delta")); 1295cdf0e10cSrcweir OUString aStr3(RTL_CONSTASCII_USTRINGPARAM("EdgeLine3Delta")); 1296cdf0e10cSrcweir aLine1Delta = xConnector->getPropertyValue(aStr1); 1297cdf0e10cSrcweir aLine2Delta = xConnector->getPropertyValue(aStr2); 1298cdf0e10cSrcweir aLine3Delta = xConnector->getPropertyValue(aStr3); 1299cdf0e10cSrcweir 1300cdf0e10cSrcweir // #86637# simply setting these values WILL force the connector to do 1301cdf0e10cSrcweir // an new layout promptly. So the line delta values have to be rescued 1302cdf0e10cSrcweir // and restored around connector changes. 1303cdf0e10cSrcweir uno::Reference< drawing::XShape > xShape( 1304cdf0e10cSrcweir mrImporter.getInterfaceToIdentifierMapper().getReference( rHint.aDestShapeId ), uno::UNO_QUERY ); 1305cdf0e10cSrcweir if( xShape.is() ) 1306cdf0e10cSrcweir { 1307cdf0e10cSrcweir aAny <<= xShape; 1308cdf0e10cSrcweir xConnector->setPropertyValue( rHint.bStart ? msStartShape : msEndShape, aAny ); 1309cdf0e10cSrcweir 1310cdf0e10cSrcweir sal_Int32 nGlueId = rHint.nDestGlueId < 4 ? rHint.nDestGlueId : getGluePointId( xShape, rHint.nDestGlueId ); 1311cdf0e10cSrcweir aAny <<= nGlueId; 1312cdf0e10cSrcweir xConnector->setPropertyValue( rHint.bStart ? msStartGluePointIndex : msEndGluePointIndex, aAny ); 1313cdf0e10cSrcweir } 1314cdf0e10cSrcweir 1315cdf0e10cSrcweir // #86637# restore line deltas 1316cdf0e10cSrcweir xConnector->setPropertyValue(aStr1, aLine1Delta ); 1317cdf0e10cSrcweir xConnector->setPropertyValue(aStr2, aLine2Delta ); 1318cdf0e10cSrcweir xConnector->setPropertyValue(aStr3, aLine3Delta ); 1319cdf0e10cSrcweir } 1320cdf0e10cSrcweir } 1321cdf0e10cSrcweir mpImpl->maConnections.clear(); 1322cdf0e10cSrcweir } 1323cdf0e10cSrcweir } 1324cdf0e10cSrcweir 1325cdf0e10cSrcweir SvXMLImportPropertyMapper* XMLShapeImportHelper::CreateShapePropMapper( const uno::Reference< frame::XModel>& rModel, SvXMLImport& rImport ) 1326cdf0e10cSrcweir { 1327cdf0e10cSrcweir UniReference< XMLPropertyHandlerFactory > xFactory = new XMLSdPropHdlFactory( rModel, rImport ); 1328cdf0e10cSrcweir UniReference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper( xFactory ); 1329cdf0e10cSrcweir SvXMLImportPropertyMapper* pResult = new SvXMLImportPropertyMapper( xMapper, rImport ); 1330cdf0e10cSrcweir 1331cdf0e10cSrcweir // chain text attributes 1332cdf0e10cSrcweir pResult->ChainImportMapper( XMLTextImportHelper::CreateParaExtPropMapper( rImport ) ); 1333cdf0e10cSrcweir return pResult; 1334cdf0e10cSrcweir } 1335cdf0e10cSrcweir 1336cdf0e10cSrcweir /** creates a shape property set mapper that can be used for non shape elements. 1337cdf0e10cSrcweir Only current feature is that the ShapeUserDefinedAttributes property is not included in this one. */ 1338cdf0e10cSrcweir SvXMLImportPropertyMapper* XMLShapeImportHelper::CreateExternalShapePropMapper( const uno::Reference< frame::XModel>& rModel, SvXMLImport& rImport ) 1339cdf0e10cSrcweir { 1340cdf0e10cSrcweir UniReference< XMLPropertyHandlerFactory > xFactory = new XMLSdPropHdlFactory( rModel, rImport ); 1341cdf0e10cSrcweir UniReference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper( xFactory, 1 ); 1342cdf0e10cSrcweir SvXMLImportPropertyMapper* pResult = new SvXMLImportPropertyMapper( xMapper, rImport ); 1343cdf0e10cSrcweir 1344cdf0e10cSrcweir // chain text attributes 1345cdf0e10cSrcweir pResult->ChainImportMapper( XMLTextImportHelper::CreateParaExtPropMapper( rImport ) ); 1346cdf0e10cSrcweir return pResult; 1347cdf0e10cSrcweir } 1348cdf0e10cSrcweir 1349cdf0e10cSrcweir /** adds a mapping for a glue point identifier from an xml file to the identifier created after inserting 1350cdf0e10cSrcweir the new glue point into the core. The saved mappings can be retrieved by getGluePointId() */ 1351cdf0e10cSrcweir void XMLShapeImportHelper::addGluePointMapping( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, 1352cdf0e10cSrcweir sal_Int32 nSourceId, sal_Int32 nDestinnationId ) 1353cdf0e10cSrcweir { 1354cdf0e10cSrcweir if( mpPageContext ) 1355cdf0e10cSrcweir mpPageContext->maShapeGluePointsMap[xShape][nSourceId] = nDestinnationId; 1356cdf0e10cSrcweir } 1357cdf0e10cSrcweir 1358cdf0e10cSrcweir /** moves all current DestinationId's by n */ 1359cdf0e10cSrcweir void XMLShapeImportHelper::moveGluePointMapping( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, const sal_Int32 n ) 1360cdf0e10cSrcweir { 1361cdf0e10cSrcweir if( mpPageContext ) 1362cdf0e10cSrcweir { 1363cdf0e10cSrcweir ShapeGluePointsMap::iterator aShapeIter( mpPageContext->maShapeGluePointsMap.find( xShape ) ); 1364cdf0e10cSrcweir if( aShapeIter != mpPageContext->maShapeGluePointsMap.end() ) 1365cdf0e10cSrcweir { 1366cdf0e10cSrcweir GluePointIdMap::iterator aShapeIdIter = (*aShapeIter).second.begin(); 1367cdf0e10cSrcweir GluePointIdMap::iterator aShapeIdEnd = (*aShapeIter).second.end(); 1368cdf0e10cSrcweir while ( aShapeIdIter != aShapeIdEnd ) 1369cdf0e10cSrcweir { 1370cdf0e10cSrcweir if ( (*aShapeIdIter).second != -1 ) 1371cdf0e10cSrcweir (*aShapeIdIter).second += n; 1372cdf0e10cSrcweir aShapeIdIter++; 1373cdf0e10cSrcweir } 1374cdf0e10cSrcweir } 1375cdf0e10cSrcweir } 1376cdf0e10cSrcweir } 1377cdf0e10cSrcweir 1378cdf0e10cSrcweir /** retrieves a mapping for a glue point identifier from the current xml file to the identifier created after 1379cdf0e10cSrcweir inserting the new glue point into the core. The mapping must be initialized first with addGluePointMapping() */ 1380cdf0e10cSrcweir sal_Int32 XMLShapeImportHelper::getGluePointId( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, sal_Int32 nSourceId ) 1381cdf0e10cSrcweir { 1382cdf0e10cSrcweir if( mpPageContext ) 1383cdf0e10cSrcweir { 1384cdf0e10cSrcweir ShapeGluePointsMap::iterator aShapeIter( mpPageContext->maShapeGluePointsMap.find( xShape ) ); 1385cdf0e10cSrcweir if( aShapeIter != mpPageContext->maShapeGluePointsMap.end() ) 1386cdf0e10cSrcweir { 1387cdf0e10cSrcweir GluePointIdMap::iterator aIdIter = (*aShapeIter).second.find(nSourceId); 1388cdf0e10cSrcweir if( aIdIter != (*aShapeIter).second.end() ) 1389cdf0e10cSrcweir return (*aIdIter).second; 1390cdf0e10cSrcweir } 1391cdf0e10cSrcweir } 1392cdf0e10cSrcweir 1393cdf0e10cSrcweir return -1; 1394cdf0e10cSrcweir } 1395cdf0e10cSrcweir 1396cdf0e10cSrcweir /** this method must be calling before the first shape is imported for the given page */ 1397cdf0e10cSrcweir void XMLShapeImportHelper::startPage( com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes ) 1398cdf0e10cSrcweir { 1399cdf0e10cSrcweir XMLShapeImportPageContextImpl* pOldContext = mpPageContext; 1400cdf0e10cSrcweir mpPageContext = new XMLShapeImportPageContextImpl(); 1401cdf0e10cSrcweir mpPageContext->mpNext = pOldContext; 1402cdf0e10cSrcweir mpPageContext->mxShapes = rShapes; 1403cdf0e10cSrcweir } 1404cdf0e10cSrcweir 1405cdf0e10cSrcweir /** this method must be calling after the last shape is imported for the given page */ 1406cdf0e10cSrcweir void XMLShapeImportHelper::endPage( com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& 1407cdf0e10cSrcweir #ifdef DBG_UTIL 1408cdf0e10cSrcweir rShapes 1409cdf0e10cSrcweir #endif 1410cdf0e10cSrcweir ) 1411cdf0e10cSrcweir { 1412cdf0e10cSrcweir DBG_ASSERT( mpPageContext && (mpPageContext->mxShapes == rShapes), "wrong call to endPage(), no startPage called or wrong page" ); 1413cdf0e10cSrcweir if( NULL == mpPageContext ) 1414cdf0e10cSrcweir return; 1415cdf0e10cSrcweir 1416cdf0e10cSrcweir restoreConnections(); 1417cdf0e10cSrcweir 1418cdf0e10cSrcweir XMLShapeImportPageContextImpl* pNextContext = mpPageContext->mpNext; 1419cdf0e10cSrcweir delete mpPageContext; 1420cdf0e10cSrcweir mpPageContext = pNextContext; 1421cdf0e10cSrcweir } 1422cdf0e10cSrcweir 1423cdf0e10cSrcweir // #88546# 1424cdf0e10cSrcweir /** defines if the import should increment the progress bar or not */ 1425cdf0e10cSrcweir void XMLShapeImportHelper::enableHandleProgressBar( sal_Bool bEnable ) 1426cdf0e10cSrcweir { 1427cdf0e10cSrcweir mpImpl->mbHandleProgressBar = bEnable; 1428cdf0e10cSrcweir } 1429cdf0e10cSrcweir 1430cdf0e10cSrcweir sal_Bool XMLShapeImportHelper::IsHandleProgressBarEnabled() const 1431cdf0e10cSrcweir { 1432cdf0e10cSrcweir return mpImpl->mbHandleProgressBar; 1433cdf0e10cSrcweir } 1434cdf0e10cSrcweir 1435cdf0e10cSrcweir /** queries the capability of the current model to create presentation shapes */ 1436cdf0e10cSrcweir sal_Bool XMLShapeImportHelper::IsPresentationShapesSupported() 1437cdf0e10cSrcweir { 1438cdf0e10cSrcweir return mpImpl->mbIsPresentationShapesSupported; 1439cdf0e10cSrcweir } 1440cdf0e10cSrcweir 1441cdf0e10cSrcweir const rtl::Reference< XMLTableImport >& XMLShapeImportHelper::GetShapeTableImport() 1442cdf0e10cSrcweir { 1443cdf0e10cSrcweir if( !mxShapeTableImport.is() ) 1444cdf0e10cSrcweir { 1445cdf0e10cSrcweir rtl::Reference< XMLPropertyHandlerFactory > xFactory( new XMLSdPropHdlFactory( mrImporter.GetModel(), mrImporter ) ); 1446cdf0e10cSrcweir rtl::Reference< XMLPropertySetMapper > xPropertySetMapper( new XMLShapePropertySetMapper( xFactory.get() ) ); 1447cdf0e10cSrcweir mxShapeTableImport = new XMLTableImport( mrImporter, xPropertySetMapper, xFactory ); 1448cdf0e10cSrcweir } 1449cdf0e10cSrcweir 1450cdf0e10cSrcweir return mxShapeTableImport; 1451cdf0e10cSrcweir } 1452cdf0e10cSrcweir 1453cdf0e10cSrcweir void SvXMLShapeContext::setHyperlink( const OUString& rHyperlink ) 1454cdf0e10cSrcweir { 1455cdf0e10cSrcweir msHyperlink = rHyperlink; 1456cdf0e10cSrcweir } 1457