diff options
author | Christian Lippka <cl@openoffice.org> | 2000-12-13 18:16:42 +0000 |
---|---|---|
committer | Christian Lippka <cl@openoffice.org> | 2000-12-13 18:16:42 +0000 |
commit | 38868cce5ec853d4bb242c9bff2695e659da6353 (patch) | |
tree | adc872f6acf1f2d90dd2d9dadcbad531ee304ed7 /xmloff | |
parent | 5fb34d9ceb8bdb374e796cc44261553f85c80071 (diff) |
#80699# reworked shape id creation and fixed import for all shapes
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/draw/makefile.mk | 7 | ||||
-rw-r--r-- | xmloff/source/draw/sdxmlexp.cxx | 20 | ||||
-rw-r--r-- | xmloff/source/draw/shapeexport.cxx | 52 | ||||
-rw-r--r-- | xmloff/source/draw/shapeimport.cxx | 270 | ||||
-rw-r--r-- | xmloff/source/draw/ximp3dscene.cxx | 276 | ||||
-rw-r--r-- | xmloff/source/draw/ximp3dscene.hxx | 13 | ||||
-rw-r--r-- | xmloff/source/draw/ximpbody.cxx | 10 | ||||
-rw-r--r-- | xmloff/source/draw/ximpbody.hxx | 10 | ||||
-rw-r--r-- | xmloff/source/draw/ximpgrp.cxx | 33 | ||||
-rw-r--r-- | xmloff/source/draw/ximpgrp.hxx | 7 | ||||
-rw-r--r-- | xmloff/source/draw/ximpnote.cxx | 11 | ||||
-rw-r--r-- | xmloff/source/draw/ximpnote.hxx | 10 | ||||
-rw-r--r-- | xmloff/source/draw/ximppage.cxx | 123 | ||||
-rw-r--r-- | xmloff/source/draw/ximppage.hxx | 121 | ||||
-rw-r--r-- | xmloff/source/draw/ximpshap.cxx | 1519 | ||||
-rw-r--r-- | xmloff/source/draw/ximpshap.hxx | 74 | ||||
-rw-r--r-- | xmloff/source/draw/ximpstyl.cxx | 12 | ||||
-rw-r--r-- | xmloff/source/draw/ximpstyl.hxx | 10 |
18 files changed, 1202 insertions, 1376 deletions
diff --git a/xmloff/source/draw/makefile.mk b/xmloff/source/draw/makefile.mk index 7de5b5f2394f..5ecd1b50caca 100644 --- a/xmloff/source/draw/makefile.mk +++ b/xmloff/source/draw/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.3 $ +# $Revision: 1.4 $ # -# last change: $Author: cl $ $Date: 2000-12-01 19:19:53 $ +# last change: $Author: cl $ $Date: 2000-12-13 19:13:03 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -90,7 +90,8 @@ SLOFILES = \ $(SLO)$/xexptran.obj \ $(SLO)$/shapeexport.obj \ $(SLO)$/shapeimport.obj \ - $(SLO)$/XMLShapeStyleContext.obj + $(SLO)$/XMLShapeStyleContext.obj \ + $(SLO)$/ximppage.obj # --- Targets -------------------------------------------------------------- diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index 9ab07776e9b7..6270b1d8321d 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: sdxmlexp.cxx,v $ * - * $Revision: 1.33 $ + * $Revision: 1.34 $ * - * last change: $Author: aw $ $Date: 2000-12-13 11:00:00 $ + * last change: $Author: cl $ $Date: 2000-12-13 19:13:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -3375,6 +3375,14 @@ void SdXMLExport::ImpStartWriteGroupShape(SvXMLExport& rExp, uno::Reference< container::XIndexAccess > xShapes(xShape, uno::UNO_QUERY); if(xShapes.is() && xShapes->getCount()) { + // export shape id if needed + sal_Int32 nShapeId = rExp.GetShapeExport()->getShapeId( xShape ); + if( nShapeId != -1 ) + { + const OUString sId( OUString::valueOf( nShapeId ) ); + rExp.AddAttribute(XML_NAMESPACE_DRAW, sXML_id, sId ); + } + // group shape or 3Dscene? sal_Bool bIsScene(FALSE); uno::Reference< drawing::XShapeDescriptor > xShapeDescriptor(xShape, uno::UNO_QUERY); @@ -3686,6 +3694,14 @@ void SdXMLExport::ImpWriteSingleShapeStyleInfos(uno::Reference< container::XInde uno::Reference< container::XIndexAccess > xShapes(xShape, uno::UNO_QUERY); if(xShapes.is() && xShapes->getCount()) { + // export shape id if needed + sal_Int32 nShapeId = GetShapeExport()->getShapeId( xShape ); + if( nShapeId != -1 ) + { + const OUString sId( OUString::valueOf( nShapeId ) ); + AddAttribute(XML_NAMESPACE_DRAW, sXML_id, sId ); + } + // group shape or 3Dscene? sal_Bool bIsScene(FALSE); uno::Reference< drawing::XShapeDescriptor > xShapeDescriptor(xShape, uno::UNO_QUERY); diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index eb905081ba2b..bde6a021039f 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -2,9 +2,9 @@ * * $RCSfile: shapeexport.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: cl $ $Date: 2000-12-11 07:44:37 $ + * last change: $Author: cl $ $Date: 2000-12-13 19:13:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -276,52 +276,22 @@ void XMLShapeExport::exportAutoStyles() /** creates a unique id for this shape, this id is saved and exported with this shape later with the exportShape method. Its ok to call this twice with the same shape */ -void XMLShapeExport::createShapeId( const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& xShape ) +void XMLShapeExport::createShapeId( const uno::Reference < drawing::XShape >& xShape ) { -/* - uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY ); - if( xPropSet.is() && xPropSet->getPropertySetInfo()->hasPropertyByName( msZIndex ) ) - { - sal_Int32 nIndex = 0; - xPropSet->getPropertyValue( msZIndex ) >>= nIndex; - - const std::vector<XMLShapeIdHint>::size_type nCount = maUsedShapeIds.size(); - for( std::vector<XMLShapeIdHint>::size_type i = 0; i < nCount; i++ ) - { - if( maUsedShapeIds[i].mnShapeIndex == nIndex ) - return; // we already have an id for this shape; - } + ShapeIdsMap::iterator aId( maShapeIds.find( xShape ) ); - XMLShapeIdHint aNewHint; - aNewHint.mnShapeIndex = nIndex; - aNewHint.mnShapeId = mnNextUniqueShapeId++; - maUsedShapeIds.push_back( aNewHint ); - } - else - { - DBG_ERROR( "createShapeId failed!" ); - } -*/ + if( aId == maShapeIds.end() ) + maShapeIds[xShape] = mnNextUniqueShapeId++; } /** returns the unique id for this shape. It returns -1 if the was no createShapeId call for this shape yet. */ -sal_Int32 XMLShapeExport::getShapeId( const com::sun::star::uno::Reference < com::sun::star::drawing::XShape >& xShape ) +sal_Int32 XMLShapeExport::getShapeId( const uno::Reference < drawing::XShape >& xShape ) { -/* - uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY ); - if( xPropSet.is() && xPropSet->getPropertySetInfo()->hasPropertyByName( msZIndex ) ) - { - sal_Int32 nIndex = 0; - xPropSet->getPropertyValue( msZIndex ) >>= nIndex; + ShapeIdsMap::iterator aId( maShapeIds.find( xShape ) ); + + if( aId != maShapeIds.end() ) + return (*aId).second; - const std::vector<XMLShapeIdHint>::size_type nCount = maUsedShapeIds.size(); - for( std::vector<XMLShapeIdHint>::size_type i = 0; i < nCount; i++ ) - { - if( maUsedShapeIds[i].mnShapeIndex == nIndex ) - return maUsedShapeIds[i].mnShapeId; - } - } -*/ return -1; } diff --git a/xmloff/source/draw/shapeimport.cxx b/xmloff/source/draw/shapeimport.cxx index f085bb26f235..9e4ad463125e 100644 --- a/xmloff/source/draw/shapeimport.cxx +++ b/xmloff/source/draw/shapeimport.cxx @@ -2,9 +2,9 @@ * * $RCSfile: shapeimport.cxx,v $ * - * $Revision: 1.19 $ + * $Revision: 1.20 $ * - * last change: $Author: cl $ $Date: 2000-12-11 07:51:20 $ + * last change: $Author: cl $ $Date: 2000-12-13 19:13:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -109,6 +109,10 @@ #include "ximp3dobject.hxx" #endif +#ifndef _XIMPGROUP_HXX +#include "ximpgrp.hxx" +#endif + using namespace ::rtl; using namespace ::std; using namespace ::com::sun::star; @@ -124,24 +128,31 @@ XMLShapeImportHelper::XMLShapeImportHelper( mpStylesContext(0L), mpAutoStylesContext(0L), mpGroupShapeElemTokenMap(0L), + mp3DSceneShapeElemTokenMap(0L), + mp3DObjectAttrTokenMap(0L), + mp3DPolygonBasedAttrTokenMap(0L), + mp3DCubeObjectAttrTokenMap(0L), + mp3DSphereObjectAttrTokenMap(0L), + mp3DSceneShapeAttrTokenMap(0L), + mp3DLightAttrTokenMap(0L), + mpPathShapeAttrTokenMap(0L), + mpPolygonShapeAttrTokenMap(0L), +/* mpShapeAttrTokenMap(0L), mpRectShapeAttrTokenMap(0L), mpLineShapeAttrTokenMap(0L), mpEllipseShapeAttrTokenMap(0L), - mpPolygonShapeAttrTokenMap(0L), - mpPathShapeAttrTokenMap(0L), mpTextBoxShapeAttrTokenMap(0L), mpControlShapeAttrTokenMap(0L), mpPageShapeAttrTokenMap(0L), mpGraphicObjectShapeAttrTokenMap(0L), - mp3DSceneShapeElemTokenMap(0L), - mp3DObjectAttrTokenMap(0L), - mp3DPolygonBasedAttrTokenMap(0L), - mp3DCubeObjectAttrTokenMap(0L), - mp3DSphereObjectAttrTokenMap(0L), - mp3DSceneShapeAttrTokenMap(0L), - mp3DLightAttrTokenMap(0L), - mpSortContext(0L) +*/ + mpSortContext(0L), + msStartShape(RTL_CONSTASCII_USTRINGPARAM("StartShape")), + msEndShape(RTL_CONSTASCII_USTRINGPARAM("EndShape")), + msStartGluePointIndex(RTL_CONSTASCII_USTRINGPARAM("StartGluePointIndex")), + msEndGluePointIndex(RTL_CONSTASCII_USTRINGPARAM("EndGluePointIndex")) + { mpSdPropHdlFactory = new XMLSdPropHdlFactory( rModel ); @@ -177,6 +188,8 @@ XMLShapeImportHelper::XMLShapeImportHelper( XMLShapeImportHelper::~XMLShapeImportHelper() { + DBG_ASSERT( maConnections.empty(), "XMLShapeImportHelper::restoreConnections() was not called!" ); + // cleanup factory, decrease refcount. Should lead to destruction. if(mpSdPropHdlFactory) { @@ -199,16 +212,18 @@ XMLShapeImportHelper::~XMLShapeImportHelper() } if(mpGroupShapeElemTokenMap) delete mpGroupShapeElemTokenMap; +/* if(mpShapeAttrTokenMap) delete mpShapeAttrTokenMap; if(mpRectShapeAttrTokenMap) delete mpRectShapeAttrTokenMap; if(mpLineShapeAttrTokenMap) delete mpLineShapeAttrTokenMap; if(mpEllipseShapeAttrTokenMap) delete mpEllipseShapeAttrTokenMap; - if(mpPolygonShapeAttrTokenMap) delete mpPolygonShapeAttrTokenMap; - if(mpPathShapeAttrTokenMap) delete mpPathShapeAttrTokenMap; if(mpTextBoxShapeAttrTokenMap) delete mpTextBoxShapeAttrTokenMap; if(mpControlShapeAttrTokenMap) delete mpControlShapeAttrTokenMap; if(mpPageShapeAttrTokenMap) delete mpPageShapeAttrTokenMap; if(mpGraphicObjectShapeAttrTokenMap) delete mpGraphicObjectShapeAttrTokenMap; +*/ + if(mpPolygonShapeAttrTokenMap) delete mpPolygonShapeAttrTokenMap; + if(mpPathShapeAttrTokenMap) delete mpPathShapeAttrTokenMap; if(mp3DSceneShapeElemTokenMap) delete mp3DSceneShapeElemTokenMap; if(mp3DObjectAttrTokenMap) delete mp3DObjectAttrTokenMap; if(mp3DPolygonBasedAttrTokenMap) delete mp3DPolygonBasedAttrTokenMap; @@ -278,7 +293,7 @@ const SvXMLTokenMap& XMLShapeImportHelper::Get3DSceneShapeElemTokenMap() } ////////////////////////////////////////////////////////////////////////////// - +/* static __FAR_DATA SvXMLTokenMapEntry aShapeAttrTokenMap[] = { { XML_NAMESPACE_DRAW, sXML_name, XML_TOK_SHAPE_NAME }, @@ -297,7 +312,7 @@ const SvXMLTokenMap& XMLShapeImportHelper::GetShapeAttrTokenMap() mpShapeAttrTokenMap = new SvXMLTokenMap(aShapeAttrTokenMap); return *mpShapeAttrTokenMap; } - +*/ ////////////////////////////////////////////////////////////////////////////// static __FAR_DATA SvXMLTokenMapEntry a3DObjectAttrTokenMap[] = @@ -363,7 +378,7 @@ const SvXMLTokenMap& XMLShapeImportHelper::Get3DSphereObjectAttrTokenMap() } ////////////////////////////////////////////////////////////////////////////// - +/* static __FAR_DATA SvXMLTokenMapEntry aRectShapeAttrTokenMap[] = { { XML_NAMESPACE_SVG, sXML_x, XML_TOK_RECTSHAPE_X }, @@ -419,7 +434,7 @@ const SvXMLTokenMap& XMLShapeImportHelper::GetEllipseShapeAttrTokenMap() } ////////////////////////////////////////////////////////////////////////////// - +*/ static __FAR_DATA SvXMLTokenMapEntry aPolygonShapeAttrTokenMap[] = { { XML_NAMESPACE_SVG, sXML_x, XML_TOK_POLYGONSHAPE_X }, @@ -457,7 +472,7 @@ const SvXMLTokenMap& XMLShapeImportHelper::GetPathShapeAttrTokenMap() mpPathShapeAttrTokenMap = new SvXMLTokenMap(aPathShapeAttrTokenMap); return *mpPathShapeAttrTokenMap; } - +/* ////////////////////////////////////////////////////////////////////////////// static __FAR_DATA SvXMLTokenMapEntry aTextBoxShapeAttrTokenMap[] = @@ -493,7 +508,7 @@ const SvXMLTokenMap& XMLShapeImportHelper::GetControlShapeAttrTokenMap() mpControlShapeAttrTokenMap = new SvXMLTokenMap(aControlShapeAttrTokenMap); return *mpControlShapeAttrTokenMap; } - +*/ ////////////////////////////////////////////////////////////////////////////// static __FAR_DATA SvXMLTokenMapEntry a3DSceneShapeAttrTokenMap[] = @@ -542,7 +557,7 @@ const SvXMLTokenMap& XMLShapeImportHelper::Get3DLightAttrTokenMap() } ////////////////////////////////////////////////////////////////////////////// - +/* static __FAR_DATA SvXMLTokenMapEntry aPageShapeAttrTokenMap[] = { { XML_NAMESPACE_SVG, sXML_x, XML_TOK_PAGESHAPE_X }, @@ -577,7 +592,7 @@ const SvXMLTokenMap& XMLShapeImportHelper::GetGraphicObjectShapeAttrTokenMap() mpGraphicObjectShapeAttrTokenMap = new SvXMLTokenMap(aGraphicObjectShapeAttrTokenMap); return *mpGraphicObjectShapeAttrTokenMap; } - +*/ ////////////////////////////////////////////////////////////////////////////// SvXMLImportContext* XMLShapeImportHelper::Create3DSceneChildContext( @@ -606,26 +621,7 @@ SvXMLImportContext* XMLShapeImportHelper::Create3DSceneChildContext( case XML_TOK_3DSCENE_3DSCENE: { // dr3d:3dscene inside dr3d:3dscene context - // create new 3DScene shape and add it to rShapes, use it - // as base for the new 3DScene import - uno::Reference< lang::XMultiServiceFactory > xServiceFact(mxModel, uno::UNO_QUERY); - if(xServiceFact.is()) - { - uno::Reference< drawing::XShape > xShape( - xServiceFact->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Shape3DSceneObject"))), - uno::UNO_QUERY); - if(xShape.is()) - { - rShapes->add( xShape ); - - uno::Reference< drawing::XShapes > xNewShapes(xShape, uno::UNO_QUERY); - if(xNewShapes.is()) - { - pContext = new SdXML3DSceneShapeContext( rImport, nPrefix, rLocalName, xAttrList, xNewShapes); - } - } - } + pContext = new SdXML3DSceneShapeContext( rImport, nPrefix, rLocalName, xAttrList, rShapes); break; } case XML_TOK_3DSCENE_3DCUBE: @@ -693,51 +689,13 @@ SvXMLImportContext* XMLShapeImportHelper::CreateGroupChildContext( case XML_TOK_GROUP_GROUP: { // draw:g inside group context (RECURSIVE) - // create new group shape and add it to rShapes, use it - // as base for the new group import - uno::Reference< lang::XMultiServiceFactory > xServiceFact(mxModel, uno::UNO_QUERY); - if(xServiceFact.is()) - { - uno::Reference< drawing::XShape > xShape( - xServiceFact->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GroupShape"))), - uno::UNO_QUERY); - if(xShape.is()) - { - addShape( xShape, xAttrList, rShapes ); - - uno::Reference< drawing::XShapes > xNewShapes(xShape, uno::UNO_QUERY); - if(xNewShapes.is()) - { - pContext = new SdXMLGroupShapeContext( rImport, nPrefix, rLocalName, xAttrList, xNewShapes); - } - } - } + pContext = new SdXMLGroupShapeContext( rImport, nPrefix, rLocalName, xAttrList, rShapes); break; } case XML_TOK_GROUP_3DSCENE: { // dr3d:3dscene inside group context - // create new 3DScene shape and add it to rShapes, use it - // as base for the new 3DScene import - uno::Reference< lang::XMultiServiceFactory > xServiceFact(mxModel, uno::UNO_QUERY); - if(xServiceFact.is()) - { - uno::Reference< drawing::XShape > xShape( - xServiceFact->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Shape3DSceneObject"))), - uno::UNO_QUERY); - if(xShape.is()) - { - addShape( xShape, xAttrList, rShapes ); - - uno::Reference< drawing::XShapes > xNewShapes(xShape, uno::UNO_QUERY); - if(xNewShapes.is()) - { - pContext = new SdXML3DSceneShapeContext( rImport, nPrefix, rLocalName, xAttrList, xNewShapes); - } - } - } + pContext = new SdXML3DSceneShapeContext( rImport, nPrefix, rLocalName, xAttrList, rShapes); break; } case XML_TOK_GROUP_RECT: @@ -875,55 +833,25 @@ struct ZOrderHint int operator<(const ZOrderHint& rComp) const { return nShould < rComp.nShould; } }; -struct ConnectionHint -{ - sal_Int32 nConnectorIndex; - sal_Bool bStart; - sal_Int32 nDestShapeId; - sal_Int32 nDestGlueId; -}; - -struct ltint32 -{ - bool operator()(const sal_Int32 p, sal_Int32 q) const - { - return p < q; - } -}; - class ShapeSortContext { public: uno::Reference< drawing::XShapes > mxShapes; list<ZOrderHint> maZOrderList; list<ZOrderHint> maUnsortedList; - vector<ConnectionHint> maConnections; - map<sal_Int32,sal_Int32,ltint32> maShapeIdMap; sal_Int32 mnCurrentZ; ShapeSortContext* mpParentContext; const OUString msZOrder; - const OUString msStartShape; - const OUString msEndShape; - const OUString msStartGluePointIndex; - const OUString msEndGluePointIndex; ShapeSortContext( uno::Reference< drawing::XShapes >& rShapes, ShapeSortContext* pParentContext = NULL ); void moveShape( sal_Int32 nSourcePos, sal_Int32 nDestPos ); - void restoreConnections(); - - void createShapeId( sal_Int32 nId ); - uno::Reference< drawing::XShape > getShapeFromId( sal_Int32 nId ); }; ShapeSortContext::ShapeSortContext( uno::Reference< drawing::XShapes >& rShapes, ShapeSortContext* pParentContext ) : mxShapes( rShapes ), mnCurrentZ( 0 ), mpParentContext( pParentContext ), - msZOrder(RTL_CONSTASCII_USTRINGPARAM("ZOrder")), - msStartShape(RTL_CONSTASCII_USTRINGPARAM("StartShape")), - msEndShape(RTL_CONSTASCII_USTRINGPARAM("EndShape")), - msStartGluePointIndex(RTL_CONSTASCII_USTRINGPARAM("StartGluePointIndex")), - msEndGluePointIndex(RTL_CONSTASCII_USTRINGPARAM("EndGluePointIndex")) + msZOrder(RTL_CONSTASCII_USTRINGPARAM("ZOrder")) { } @@ -966,52 +894,6 @@ void ShapeSortContext::moveShape( sal_Int32 nSourcePos, sal_Int32 nDestPos ) } } -void ShapeSortContext::restoreConnections() -{ - if( !maConnections.empty() ) - { - uno::Any aAny; - uno::Reference< beans::XPropertySet > xConnector; - - const vector<ConnectionHint>::size_type nCount = maConnections.size(); - for( vector<ConnectionHint>::size_type i = 0; i < nCount; i++ ) - { - ConnectionHint& rHint = maConnections[i]; - if( mxShapes->getByIndex( rHint.nConnectorIndex ) >>= xConnector ) - { - uno::Reference< drawing::XShape > xShape( getShapeFromId( rHint.nDestShapeId ) ); - if( xShape.is() ) - { - aAny <<= xShape; - xConnector->setPropertyValue( rHint.bStart ? msStartShape : msEndShape, aAny ); - } - - aAny <<= rHint.nDestGlueId; - xConnector->setPropertyValue( rHint.bStart ? msStartGluePointIndex : msEndGluePointIndex, aAny ); - } - } - } -} - -void ShapeSortContext::createShapeId( sal_Int32 nId ) -{ - maShapeIdMap[mnCurrentZ] = nId; -} - -uno::Reference< drawing::XShape > ShapeSortContext::getShapeFromId( sal_Int32 nId ) -{ - uno::Reference< drawing::XShape > xShape; - - map<sal_Int32,sal_Int32,ltint32>::iterator aIter = maShapeIdMap.find( nId ); - if( aIter != maShapeIdMap.end() ) - { - uno::Any aAny( mxShapes->getByIndex( maShapeIdMap[nId] ) ); - aAny >>= xShape; - } - - return xShape; -} - void XMLShapeImportHelper::pushGroupForSorting( uno::Reference< drawing::XShapes >& rShapes ) { mpSortContext = new ShapeSortContext( rShapes, mpSortContext ); @@ -1086,38 +968,66 @@ void XMLShapeImportHelper::shapeWithZIndexAdded( com::sun::star::uno::Reference< } } -void XMLShapeImportHelper::addShapeConnection( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rConnectorShape, - sal_Bool bStart, - sal_Int32 nDestShapeId, - sal_Int32 nDestGlueId ) +void XMLShapeImportHelper::createShapeId( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape, sal_Int32 nId ) { - DBG_ASSERT( mpSortContext, "Connection Shapes are not working without a sort context!" ); - if( mpSortContext ) - { - ConnectionHint aHint; - aHint.nConnectorIndex = mpSortContext->mnCurrentZ; - aHint.bStart = bStart; - aHint.nDestShapeId = nDestShapeId; - aHint.nDestGlueId = nDestGlueId; + DBG_ASSERT( maShapeIds.find(nId) == maShapeIds.end(), "draw:id imported twice!" ); + maShapeIds[nId] = xShape; +} - mpSortContext->maConnections.push_back( aHint ); +uno::Reference< drawing::XShape > XMLShapeImportHelper::getShapeFromId( sal_Int32 nId ) +{ + IdShapeMap::iterator aShapeIter( maShapeIds.find( nId ) ); + if( aShapeIter != maShapeIds.end() ) + { + return (*aShapeIter).second; + } + else + { + DBG_ERROR( "unknown draw:id found!" ); + uno::Reference< drawing::XShape > xShape; + return xShape; } } -void XMLShapeImportHelper::createShapeId( sal_Int32 nId ) +void XMLShapeImportHelper::addShapeConnection( com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rConnectorShape, + sal_Bool bStart, + sal_Int32 nDestShapeId, + sal_Int32 nDestGlueId ) { - /* - if( mpSortContext ) - mpSortContext->createShapeId( nId ); - */ + ConnectionHint aHint; + aHint.mxConnector = rConnectorShape; + aHint.bStart = bStart; + aHint.nDestShapeId = nDestShapeId; + aHint.nDestGlueId = nDestGlueId; + + maConnections.push_back( aHint ); } void XMLShapeImportHelper::restoreConnections() { - if( mpSortContext ) + if( !maConnections.empty() ) { - // restore connections for connection shapes - // mpSortContext->restoreConnections(); + uno::Any aAny; + + const vector<ConnectionHint>::size_type nCount = maConnections.size(); + for( vector<ConnectionHint>::size_type i = 0; i < nCount; i++ ) + { + ConnectionHint& rHint = maConnections[i]; + uno::Reference< beans::XPropertySet > xConnector( rHint.mxConnector, uno::UNO_QUERY ); + if( xConnector.is() ) + { + uno::Reference< drawing::XShape > xShape( getShapeFromId( rHint.nDestShapeId ) ); + if( xShape.is() ) + { + aAny <<= xShape; + xConnector->setPropertyValue( rHint.bStart ? msStartShape : msEndShape, aAny ); + } + + aAny <<= rHint.nDestGlueId; + xConnector->setPropertyValue( rHint.bStart ? msStartGluePointIndex : msEndGluePointIndex, aAny ); + } + } + maConnections.clear(); } } diff --git a/xmloff/source/draw/ximp3dscene.cxx b/xmloff/source/draw/ximp3dscene.cxx index 12ecffface71..191fa32d23c5 100644 --- a/xmloff/source/draw/ximp3dscene.cxx +++ b/xmloff/source/draw/ximp3dscene.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ximp3dscene.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2000-12-07 15:15:53 $ + * last change: $Author: cl $ $Date: 2000-12-13 19:13:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -148,7 +148,7 @@ SdXML3DLightContext::~SdXML3DLightContext() ////////////////////////////////////////////////////////////////////////////// -TYPEINIT1( SdXML3DSceneShapeContext, SvXMLImportContext ); +TYPEINIT1( SdXML3DSceneShapeContext, SdXMLShapeContext ); SdXML3DSceneShapeContext::SdXML3DSceneShapeContext( SvXMLImport& rImport, @@ -157,7 +157,6 @@ SdXML3DSceneShapeContext::SdXML3DSceneShapeContext( const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, uno::Reference< drawing::XShapes >& rShapes) : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes ), - mxShapes(rShapes), mbSetTransform( FALSE ), mxPrjMode(drawing::ProjectionMode_PERSPECTIVE), mnDistance(1000), @@ -179,7 +178,6 @@ SdXML3DSceneShapeContext::SdXML3DSceneShapeContext( SdXML3DSceneShapeContext::~SdXML3DSceneShapeContext() { - // release remembered light contexts, they are no longer needed while(maList.Count()) maList.Remove(maList.Count() - 1)->ReleaseRef(); @@ -189,6 +187,16 @@ SdXML3DSceneShapeContext::~SdXML3DSceneShapeContext() void SdXML3DSceneShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) { + // create new 3DScene shape and add it to rShapes, use it + // as base for the new 3DScene import + AddShape( "com.sun.star.drawing.Shape3DSceneObject" ); + if( mxShape.is() ) + { + mxChilds = uno::Reference< drawing::XShapes >::query( mxShape ); + + SetSizeAndPosition(); + } + // read attributes for the 3DScene sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; for(sal_Int16 i=0; i < nAttrCount; i++) @@ -317,156 +325,154 @@ void SdXML3DSceneShapeContext::StartElement(const uno::Reference< xml::sax::XAtt void SdXML3DSceneShapeContext::EndElement() { - if(mxShapes.is()) + if(mxShape.is()) { - uno::Reference< drawing::XShape > xShape(mxShapes, uno::UNO_QUERY); - if(xShape.is()) + // set local parameters on shape +/* + awt::Point aPoint(mnX, mnY); + awt::Size aSize(mnWidth, mnHeight); + mxShape->setPosition(aPoint); + mxShape->setSize(aSize); +*/ + + uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY); + if(xPropSet.is()) { - // set local parameters on shape - awt::Point aPoint(mnX, mnY); - awt::Size aSize(mnWidth, mnHeight); - xShape->setPosition(aPoint); - xShape->setSize(aSize); - - uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); - if(xPropSet.is()) + uno::Any aAny; + + // world transformation + if(mbSetTransform) { - uno::Any aAny; + aAny <<= mxHomMat; + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DTransformMatrix")), aAny); + } - // world transformation - if(mbSetTransform) - { - aAny <<= mxHomMat; - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DTransformMatrix")), aAny); - } + // projection "D3DScenePerspective" drawing::ProjectionMode + aAny <<= mxPrjMode; + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DScenePerspective")), aAny); - // projection "D3DScenePerspective" drawing::ProjectionMode - aAny <<= mxPrjMode; - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DScenePerspective")), aAny); + // distance + aAny <<= mnDistance; + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneDistance")), aAny); - // distance - aAny <<= mnDistance; - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneDistance")), aAny); + // focalLength + aAny <<= mnFocalLength; + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneFocalLength")), aAny); - // focalLength - aAny <<= mnFocalLength; - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneFocalLength")), aAny); + // shadowSlant + aAny <<= (sal_Int16)mnShadowSlant; + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneShadowSlant")), aAny); - // shadowSlant - aAny <<= (sal_Int16)mnShadowSlant; - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneShadowSlant")), aAny); + // shadeMode + aAny <<= mxShadeMode; + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneShadeMode")), aAny); - // shadeMode - aAny <<= mxShadeMode; - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneShadeMode")), aAny); + // ambientColor + aAny <<= maAmbientColor.GetColor(); + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneAmbientColor")), aAny); - // ambientColor - aAny <<= maAmbientColor.GetColor(); - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneAmbientColor")), aAny); + // lightingMode + aAny <<= mbLightingMode; + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneTwoSidedLighting")), aAny); - // lightingMode - aAny <<= mbLightingMode; - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneTwoSidedLighting")), aAny); + if(maList.Count()) + { + uno::Any aAny2; + uno::Any aAny3; - if(maList.Count()) + // set lights + for(sal_uInt32 a(0L); a < maList.Count(); a++) { - uno::Any aAny2; - uno::Any aAny3; - - // set lights - for(sal_uInt32 a(0L); a < maList.Count(); a++) + SdXML3DLightContext* pCtx = (SdXML3DLightContext*)maList.GetObject(a); + + // set anys + aAny <<= pCtx->GetDiffuseColor().GetColor(); + drawing::Direction3D xLightDir; + xLightDir.DirectionX = pCtx->GetDirection().X(); + xLightDir.DirectionY = pCtx->GetDirection().Y(); + xLightDir.DirectionZ = pCtx->GetDirection().Z(); + aAny2 <<= xLightDir; + aAny3 <<= pCtx->GetEnabled(); + + switch(a) { - SdXML3DLightContext* pCtx = (SdXML3DLightContext*)maList.GetObject(a); - - // set anys - aAny <<= pCtx->GetDiffuseColor().GetColor(); - drawing::Direction3D xLightDir; - xLightDir.DirectionX = pCtx->GetDirection().X(); - xLightDir.DirectionY = pCtx->GetDirection().Y(); - xLightDir.DirectionZ = pCtx->GetDirection().Z(); - aAny2 <<= xLightDir; - aAny3 <<= pCtx->GetEnabled(); - - switch(a) + case 0: { - case 0: - { - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor1")), aAny); - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection1")), aAny2); - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn1")), aAny3); - break; - } - case 1: - { - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor2")), aAny); - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection2")), aAny2); - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn2")), aAny3); - break; - } - case 2: - { - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor3")), aAny); - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection3")), aAny2); - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn3")), aAny3); - break; - } - case 3: - { - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor4")), aAny); - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection4")), aAny2); - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn4")), aAny3); - break; - } - case 4: - { - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor5")), aAny); - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection5")), aAny2); - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn5")), aAny3); - break; - } - case 5: - { - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor6")), aAny); - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection6")), aAny2); - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn6")), aAny3); - break; - } - case 6: - { - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor7")), aAny); - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection7")), aAny2); - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn7")), aAny3); - break; - } - case 7: - { - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor8")), aAny); - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection8")), aAny2); - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn8")), aAny3); - break; - } + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor1")), aAny); + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection1")), aAny2); + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn1")), aAny3); + break; + } + case 1: + { + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor2")), aAny); + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection2")), aAny2); + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn2")), aAny3); + break; + } + case 2: + { + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor3")), aAny); + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection3")), aAny2); + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn3")), aAny3); + break; + } + case 3: + { + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor4")), aAny); + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection4")), aAny2); + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn4")), aAny3); + break; + } + case 4: + { + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor5")), aAny); + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection5")), aAny2); + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn5")), aAny3); + break; + } + case 5: + { + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor6")), aAny); + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection6")), aAny2); + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn6")), aAny3); + break; + } + case 6: + { + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor7")), aAny); + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection7")), aAny2); + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn7")), aAny3); + break; + } + case 7: + { + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightColor8")), aAny); + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightDirection8")), aAny2); + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSceneLightOn8")), aAny3); + break; } } } - - // CameraGeometry and camera settings - drawing::CameraGeometry aCamGeo; - aCamGeo.vrp.PositionX = maVRP.X(); - aCamGeo.vrp.PositionY = maVRP.Y(); - aCamGeo.vrp.PositionZ = maVRP.Z(); - aCamGeo.vpn.DirectionX = maVPN.X(); - aCamGeo.vpn.DirectionY = maVPN.Y(); - aCamGeo.vpn.DirectionZ = maVPN.Z(); - aCamGeo.vup.DirectionX = maVUP.X(); - aCamGeo.vup.DirectionY = maVUP.Y(); - aCamGeo.vup.DirectionZ = maVUP.Z(); - aAny <<= aCamGeo; - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DCameraGeometry")), aAny); } - // call parent - SvXMLImportContext::EndElement(); + // CameraGeometry and camera settings + drawing::CameraGeometry aCamGeo; + aCamGeo.vrp.PositionX = maVRP.X(); + aCamGeo.vrp.PositionY = maVRP.Y(); + aCamGeo.vrp.PositionZ = maVRP.Z(); + aCamGeo.vpn.DirectionX = maVPN.X(); + aCamGeo.vpn.DirectionY = maVPN.Y(); + aCamGeo.vpn.DirectionZ = maVPN.Z(); + aCamGeo.vup.DirectionX = maVUP.X(); + aCamGeo.vup.DirectionY = maVUP.Y(); + aCamGeo.vup.DirectionZ = maVUP.Z(); + aAny <<= aCamGeo; + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DCameraGeometry")), aAny); } + + // call parent + SdXMLShapeContext::EndElement(); } } @@ -497,7 +503,7 @@ SvXMLImportContext* SdXML3DSceneShapeContext::CreateChildContext( USHORT nPrefix if(!pContext) { pContext = GetImport().GetShapeImport()->Create3DSceneChildContext( - GetImport(), nPrefix, rLocalName, xAttrList, mxShapes); + GetImport(), nPrefix, rLocalName, xAttrList, mxChilds); } // call parent when no own context was created diff --git a/xmloff/source/draw/ximp3dscene.hxx b/xmloff/source/draw/ximp3dscene.hxx index 7e75838ec89c..278a2752d0c5 100644 --- a/xmloff/source/draw/ximp3dscene.hxx +++ b/xmloff/source/draw/ximp3dscene.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ximp3dscene.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: cl $ $Date: 2000-12-05 23:25:00 $ + * last change: $Author: cl $ $Date: 2000-12-13 19:13:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -139,17 +139,12 @@ class SdXML3DSceneShapeContext : public SdXMLShapeContext { // the shape group this group is working on // this is the scene at the same time - com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > mxShapes; + com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > mxChilds; // list for local light contexts Imp3DLightList maList; // local parameters which need to be read - sal_Int32 mnX; - sal_Int32 mnY; - sal_Int32 mnWidth; - sal_Int32 mnHeight; - com::sun::star::drawing::HomogenMatrix mxHomMat; BOOL mbSetTransform; @@ -173,7 +168,7 @@ class SdXML3DSceneShapeContext : public SdXMLShapeContext protected: void SetLocalShapesContext(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rNew) - { mxShapes = rNew; } + { mxChilds = rNew; } public: TYPEINFO(); diff --git a/xmloff/source/draw/ximpbody.cxx b/xmloff/source/draw/ximpbody.cxx index 7881fa388949..00ff781f5083 100644 --- a/xmloff/source/draw/ximpbody.cxx +++ b/xmloff/source/draw/ximpbody.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ximpbody.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: cl $ $Date: 2000-12-11 08:00:05 $ + * last change: $Author: cl $ $Date: 2000-12-13 19:13:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -118,7 +118,7 @@ SdXMLDrawPageContext::SdXMLDrawPageContext( SdXMLImport& rImport, USHORT nPrfx, const OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, uno::Reference< drawing::XShapes >& rShapes) -: SdXMLGroupShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes ) +: SdXMLGenericPageContext( rImport, nPrfx, rLocalName, xAttrList, rShapes ) { sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; @@ -336,14 +336,14 @@ SvXMLImportContext *SdXMLDrawPageContext::CreateChildContext( USHORT nPrefix, // call parent when no own context was created if(!pContext) - pContext = SdXMLGroupShapeContext::CreateChildContext(nPrefix, rLocalName, xAttrList); + pContext = SdXMLGenericPageContext::CreateChildContext(nPrefix, rLocalName, xAttrList); return pContext; } void SdXMLDrawPageContext::EndElement() { - SdXMLGroupShapeContext::EndElement(); + SdXMLGenericPageContext::EndElement(); GetImport().GetShapeImport()->restoreConnections(); } diff --git a/xmloff/source/draw/ximpbody.hxx b/xmloff/source/draw/ximpbody.hxx index a546905e7c53..46c7af6eaa0e 100644 --- a/xmloff/source/draw/ximpbody.hxx +++ b/xmloff/source/draw/ximpbody.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ximpbody.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: cl $ $Date: 2000-12-11 08:00:05 $ + * last change: $Author: cl $ $Date: 2000-12-13 19:13:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,14 +74,14 @@ #include "nmspmap.hxx" #endif -#ifndef _XIMPGROUP_HXX -#include "ximpgrp.hxx" +#ifndef _XIMPPAGE_HXX +#include "ximppage.hxx" #endif ////////////////////////////////////////////////////////////////////////////// // draw:page context -class SdXMLDrawPageContext : public SdXMLGroupShapeContext +class SdXMLDrawPageContext : public SdXMLGenericPageContext { rtl::OUString maName; rtl::OUString maStyleName; diff --git a/xmloff/source/draw/ximpgrp.cxx b/xmloff/source/draw/ximpgrp.cxx index 2a7dbb1161a4..fc3332e1452c 100644 --- a/xmloff/source/draw/ximpgrp.cxx +++ b/xmloff/source/draw/ximpgrp.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ximpgrp.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: cl $ $Date: 2000-11-23 18:25:49 $ + * last change: $Author: cl $ $Date: 2000-12-13 19:13:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -81,10 +81,8 @@ SdXMLGroupShapeContext::SdXMLGroupShapeContext( USHORT nPrfx, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList>& xAttrList, uno::Reference< drawing::XShapes >& rShapes) -: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes ), - mxShapes( rShapes ) +: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes ) { - GetImport().GetShapeImport()->pushGroupForSorting( rShapes ); } ////////////////////////////////////////////////////////////////////////////// @@ -103,7 +101,7 @@ SvXMLImportContext* SdXMLGroupShapeContext::CreateChildContext( USHORT nPrefix, // call GroupChildContext function at common ShapeImport pContext = GetImport().GetShapeImport()->CreateGroupChildContext( - GetImport(), nPrefix, rLocalName, xAttrList, mxShapes); + GetImport(), nPrefix, rLocalName, xAttrList, mxChilds); // call parent when no own context was created if(!pContext) @@ -115,9 +113,30 @@ SvXMLImportContext* SdXMLGroupShapeContext::CreateChildContext( USHORT nPrefix, ////////////////////////////////////////////////////////////////////////////// +void SdXMLGroupShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) +{ + // create new group shape and add it to rShapes, use it + // as base for the new group import + AddShape( "com.sun.star.drawing.GroupShape" ); + SdXMLShapeContext::StartElement(xAttrList); + + if(mxShape.is()) + { + SdXMLShapeContext::StartElement(xAttrList); + mxChilds = uno::Reference< drawing::XShapes >::query( mxShape ); + if( mxChilds.is() ) + GetImport().GetShapeImport()->pushGroupForSorting( mxChilds ); + } + + GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes ); +} + +////////////////////////////////////////////////////////////////////////////// + void SdXMLGroupShapeContext::EndElement() { - GetImport().GetShapeImport()->popGroupAndSort(); + if( mxChilds.is() ) + GetImport().GetShapeImport()->popGroupAndSort(); } diff --git a/xmloff/source/draw/ximpgrp.hxx b/xmloff/source/draw/ximpgrp.hxx index 1d9731016ec4..2ee1f78f143d 100644 --- a/xmloff/source/draw/ximpgrp.hxx +++ b/xmloff/source/draw/ximpgrp.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ximpgrp.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: cl $ $Date: 2000-12-05 23:25:41 $ + * last change: $Author: cl $ $Date: 2000-12-13 19:13:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,7 +92,7 @@ class SdXMLGroupShapeContext : public SdXMLShapeContext { // the shape group this group is working on - com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > mxShapes; + com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > mxChilds; protected: void SetLocalShapesContext(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rNew) @@ -109,6 +109,7 @@ public: virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix, const rtl::OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList ); + virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList); virtual void EndElement(); const com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& GetLocalShapesContext() const diff --git a/xmloff/source/draw/ximpnote.cxx b/xmloff/source/draw/ximpnote.cxx index 7c8a92502791..1cb2256b1e54 100644 --- a/xmloff/source/draw/ximpnote.cxx +++ b/xmloff/source/draw/ximpnote.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ximpnote.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: cl $ $Date: 2000-12-11 08:00:05 $ + * last change: $Author: cl $ $Date: 2000-12-13 19:13:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -78,7 +78,7 @@ SdXMLNotesContext::SdXMLNotesContext( SdXMLImport& rImport, USHORT nPrfx, const OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, uno::Reference< drawing::XShapes >& rShapes) -: SdXMLGroupShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes ), +: SdXMLGenericPageContext( rImport, nPrfx, rLocalName, xAttrList, rShapes ), mbNotesMode(FALSE) { if(GetSdImport().IsImpress()) @@ -144,7 +144,7 @@ SvXMLImportContext *SdXMLNotesContext::CreateChildContext( USHORT nPrefix, // call parent when no own context was created if(!pContext) - pContext = SdXMLGroupShapeContext::CreateChildContext(nPrefix, rLocalName, xAttrList); + pContext = SdXMLGenericPageContext::CreateChildContext(nPrefix, rLocalName, xAttrList); return pContext; } @@ -159,8 +159,7 @@ SvXMLImportContext *SdXMLNotesContext::CreateChildContext( USHORT nPrefix, void SdXMLNotesContext::EndElement() { - SdXMLGroupShapeContext::EndElement(); - GetImport().GetShapeImport()->restoreConnections(); + SdXMLGenericPageContext::EndElement(); } diff --git a/xmloff/source/draw/ximpnote.hxx b/xmloff/source/draw/ximpnote.hxx index 6c512a618f22..ffc0bfcac3d7 100644 --- a/xmloff/source/draw/ximpnote.hxx +++ b/xmloff/source/draw/ximpnote.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ximpnote.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: cl $ $Date: 2000-12-05 23:25:41 $ + * last change: $Author: cl $ $Date: 2000-12-13 19:13:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,14 +74,14 @@ #include "nmspmap.hxx" #endif -#ifndef _XIMPGROUP_HXX -#include "ximpgrp.hxx" +#ifndef _XIMPPAGE_HXX +#include "ximppage.hxx" #endif ////////////////////////////////////////////////////////////////////////////// // presentation:notes context -class SdXMLNotesContext : public SdXMLGroupShapeContext +class SdXMLNotesContext : public SdXMLGenericPageContext { BOOL mbNotesMode; diff --git a/xmloff/source/draw/ximppage.cxx b/xmloff/source/draw/ximppage.cxx new file mode 100644 index 000000000000..8374cfa23f76 --- /dev/null +++ b/xmloff/source/draw/ximppage.cxx @@ -0,0 +1,123 @@ +/************************************************************************* + * + * $RCSfile: ximppage.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: cl $ $Date: 2000-12-13 19:16:42 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#pragma hdrstop + +#ifndef _XIMPPAGE_HXX +#include "ximppage.hxx" +#endif + +#ifndef _XIMPSHAPE_HXX +#include "ximpshap.hxx" +#endif + +using namespace ::rtl; +using namespace ::com::sun::star; + +////////////////////////////////////////////////////////////////////////////// + +TYPEINIT1( SdXMLGenericPageContext, SvXMLImportContext ); + +SdXMLGenericPageContext::SdXMLGenericPageContext( + SvXMLImport& rImport, + USHORT nPrfx, const OUString& rLocalName, + const uno::Reference< xml::sax::XAttributeList>& xAttrList, + uno::Reference< drawing::XShapes >& rShapes) +: SvXMLImportContext( rImport, nPrfx, rLocalName ), + mxShapes( rShapes ) +{ + GetImport().GetShapeImport()->pushGroupForSorting( rShapes ); +} + +////////////////////////////////////////////////////////////////////////////// + +SdXMLGenericPageContext::~SdXMLGenericPageContext() +{ +} + +////////////////////////////////////////////////////////////////////////////// + +SvXMLImportContext* SdXMLGenericPageContext::CreateChildContext( USHORT nPrefix, + const OUString& rLocalName, + const uno::Reference< xml::sax::XAttributeList>& xAttrList ) +{ + SvXMLImportContext* pContext = 0L; + + // call GroupChildContext function at common ShapeImport + pContext = GetImport().GetShapeImport()->CreateGroupChildContext( + GetImport(), nPrefix, rLocalName, xAttrList, mxShapes); + + // call parent when no own context was created + if(!pContext) + pContext = SvXMLImportContext::CreateChildContext( + nPrefix, rLocalName, xAttrList); + + return pContext; +} + +////////////////////////////////////////////////////////////////////////////// + +void SdXMLGenericPageContext::EndElement() +{ + GetImport().GetShapeImport()->popGroupAndSort(); +} + + diff --git a/xmloff/source/draw/ximppage.hxx b/xmloff/source/draw/ximppage.hxx new file mode 100644 index 000000000000..6e50092e48f6 --- /dev/null +++ b/xmloff/source/draw/ximppage.hxx @@ -0,0 +1,121 @@ +/************************************************************************* + * + * $RCSfile: ximppage.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: cl $ $Date: 2000-12-13 19:16:42 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _XIMPPAGE_HXX +#define _XIMPPAGE_HXX + +#ifndef _XMLOFF_XMLICTXT_HXX +#include "xmlictxt.hxx" +#endif + +#ifndef _SDXMLIMP_IMPL_HXX +#include "sdxmlimp_impl.hxx" +#endif + +#ifndef _XMLOFF_NMSPMAP_HXX +#include "nmspmap.hxx" +#endif + +#ifndef _COM_SUN_STAR_DRAWING_XSHAPES_HPP_ +#include <com/sun/star/drawing/XShapes.hpp> +#endif + +#ifndef _RTTI_HXX +#include <tools/rtti.hxx> +#endif + +#ifndef _XIMPSHAPE_HXX +#include "ximpshap.hxx" +#endif + +////////////////////////////////////////////////////////////////////////////// +// draw:g context (RECURSIVE) + +class SdXMLGenericPageContext : public SvXMLImportContext +{ + // the shape group this group is working on + com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > mxShapes; + +protected: + void SetLocalShapesContext(com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rNew) + { mxShapes = rNew; } + +public: + TYPEINFO(); + + SdXMLGenericPageContext( SvXMLImport& rImport, USHORT nPrfx, const rtl::OUString& rLocalName, + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, + com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes); + virtual ~SdXMLGenericPageContext(); + + virtual SvXMLImportContext *CreateChildContext( + USHORT nPrefix, const rtl::OUString& rLocalName, + const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList ); + virtual void EndElement(); + + const com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& GetLocalShapesContext() const + { return mxShapes; } + com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& GetLocalShapesContext() + { return mxShapes; } +}; + + +#endif // _XIMPGROUP_HXX diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 99077a5be0fe..55c67eba467d 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ximpshap.cxx,v $ * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * - * last change: $Author: cl $ $Date: 2000-12-06 16:53:44 $ + * last change: $Author: cl $ $Date: 2000-12-13 19:13:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -142,65 +142,10 @@ SdXMLShapeContext::SdXMLShapeContext( mbIsPlaceholder(FALSE), mbIsUserTransformed(FALSE), mxAttrList(xAttrList), - mnZOrder(-1) + mnZOrder(-1), + mnShapeId(-1), + maSize( 1, 1 ) { - sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - for(sal_Int16 i=0; i < nAttrCount; i++) - { - OUString sAttrName = xAttrList->getNameByIndex( i ); - OUString aLocalName; - sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); - OUString sValue = xAttrList->getValueByIndex( i ); - const SvXMLTokenMap& rAttrTokenMap = GetImport().GetShapeImport()->GetShapeAttrTokenMap(); - - switch(rAttrTokenMap.Get(nPrefix, aLocalName)) - { - case XML_TOK_SHAPE_NAME: - { - maShapeName = sValue; - break; - } - case XML_TOK_SHAPE_IS_USER_TRANSFORMED: - { - if(sValue.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_true)))) - mbIsUserTransformed = TRUE; - break; - } - case XML_TOK_SHAPE_IS_PLACEHOLDER: - { - if(sValue.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_true)))) - mbIsPlaceholder = TRUE; - break; - } - case XML_TOK_SHAPE_DRAWSTYLE_NAME_GRAPHICS: - { - maDrawStyleName = sValue; - break; - } - case XML_TOK_SHAPE_PRESENTATION_CLASS: - { - maPresentationClass = sValue; - break; - } - case XML_TOK_SHAPE_DRAWSTYLE_NAME_PRESENTATION: - { - maDrawStyleName = sValue; - mnStyleFamily = XML_STYLE_FAMILY_SD_PRESENTATION_ID; - break; - } - case XML_TOK_SHAPE_TRANSFORM: - { - SdXMLImExTransform2D aTransform(sValue, GetImport().GetMM100UnitConverter()); - if(aTransform.NeedsAction()) - { - double fVal(0.0); - if(aTransform.FindRotate(fVal) && fVal != 0.0) - mnRotate = (sal_Int32)(fVal * 100.0); - } - break; - } - } - } } ////////////////////////////////////////////////////////////////////////////// @@ -264,18 +209,7 @@ SvXMLImportContext *SdXMLShapeContext::CreateChildContext( USHORT nPrefix, void SdXMLShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) { - // set parameters on shape - if(mnRotate != 0L) - { - uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY); - if(xPropSet.is()) - { - uno::Any aAny; - aAny <<= mnRotate; - xPropSet->setPropertyValue( - OUString(RTL_CONSTASCII_USTRINGPARAM("RotateAngle")), aAny); - } - } + GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes ); } ////////////////////////////////////////////////////////////////////////////// @@ -294,8 +228,58 @@ void SdXMLShapeContext::AddShape(uno::Reference< drawing::XShape >& xShape) xNamed->setName( maShapeName ); } - GetImport().GetShapeImport()->addShape( xShape, mxAttrList, mxShapes ); - GetImport().GetShapeImport()->shapeWithZIndexAdded( xShape, mnZOrder ); + UniReference< XMLShapeImportHelper > xImp( GetImport().GetShapeImport() ); + xImp->addShape( xShape, mxAttrList, mxShapes ); + xImp->shapeWithZIndexAdded( xShape, mnZOrder ); + + if( mnShapeId != -1 ) + xImp->createShapeId( xShape, mnShapeId ); + } +} + +////////////////////////////////////////////////////////////////////////////// + +void SdXMLShapeContext::AddShape(const char* pServiceName ) +{ + uno::Reference< lang::XMultiServiceFactory > xServiceFact(GetImport().GetModel(), uno::UNO_QUERY); + if(xServiceFact.is()) + { + uno::Reference< drawing::XShape > xShape(xServiceFact->createInstance(OUString::createFromAscii(pServiceName)), uno::UNO_QUERY); + if( xShape.is() ) + AddShape( xShape ); + } +} + +////////////////////////////////////////////////////////////////////////////// + +void SdXMLShapeContext::SetSize() +{ + if( mxShape.is() ) + mxShape->setSize(maSize); +} + +////////////////////////////////////////////////////////////////////////////// + +void SdXMLShapeContext::SetPosition() +{ + if( mxShape.is() ) + mxShape->setPosition(maPosition); +} + +////////////////////////////////////////////////////////////////////////////// + +void SdXMLShapeContext::SetRotation() +{ + if(mnRotate != 0L) + { + uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY); + if(xPropSet.is()) + { + uno::Any aAny; + aAny <<= mnRotate; + xPropSet->setPropertyValue( + OUString(RTL_CONSTASCII_USTRINGPARAM("RotateAngle")), aAny); + } } } @@ -359,9 +343,66 @@ void SdXMLShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUStr { mnZOrder = rValue.toInt32(); } - if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_id)) ) + else if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_id)) ) + { + mnShapeId = rValue.toInt32(); + } + else if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_name)) ) + { + maShapeName = rValue; + } + else if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_style_name)) ) { - GetImport().GetShapeImport()->createShapeId( rValue.toInt32() ); + maDrawStyleName = rValue; + } + } + else if( XML_NAMESPACE_PRESENTATION == nPrefix ) + { + if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_user_transformed)) ) + { + mbIsUserTransformed = rValue.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_true)); + } + if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_placeholder)) ) + { + mbIsPlaceholder = rValue.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_true)); + } + if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_class)) ) + { + maPresentationClass = rValue; + } + if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_style_name)) ) + { + maDrawStyleName = rValue; + mnStyleFamily = XML_STYLE_FAMILY_SD_PRESENTATION_ID; + } + } + else if( XML_NAMESPACE_SVG == nPrefix ) + { + if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_x)) ) + { + GetImport().GetMM100UnitConverter().convertMeasure(maPosition.X, rValue); + } + else if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_y)) ) + { + GetImport().GetMM100UnitConverter().convertMeasure(maPosition.Y, rValue); + } + else if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_width)) ) + { + GetImport().GetMM100UnitConverter().convertMeasure(maSize.Width, rValue); + } + else if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_height)) ) + { + GetImport().GetMM100UnitConverter().convertMeasure(maSize.Height, rValue); + } + else if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_transform)) ) + { + SdXMLImExTransform2D aTransform(rValue, GetImport().GetMM100UnitConverter()); + if(aTransform.NeedsAction()) + { + double fVal(0.0); + if(aTransform.FindRotate(fVal) && fVal != 0.0) + mnRotate = (sal_Int32)(fVal * 100.0); + } } } } @@ -378,50 +419,8 @@ SdXMLRectShapeContext::SdXMLRectShapeContext( const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, uno::Reference< drawing::XShapes >& rShapes) : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes ), - mnX( 0L ), - mnY( 0L ), - mnWidth( 1L ), - mnHeight( 1L ), mnRadius( 0L ) { - sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - for(sal_Int16 i=0; i < nAttrCount; i++) - { - OUString sAttrName = xAttrList->getNameByIndex( i ); - OUString aLocalName; - sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); - OUString sValue = xAttrList->getValueByIndex( i ); - const SvXMLTokenMap& rAttrTokenMap = GetImport().GetShapeImport()->GetRectShapeAttrTokenMap(); - - switch(rAttrTokenMap.Get(nPrefix, aLocalName)) - { - case XML_TOK_RECTSHAPE_X: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnX, sValue); - break; - } - case XML_TOK_RECTSHAPE_Y: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnY, sValue); - break; - } - case XML_TOK_RECTSHAPE_WIDTH: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnWidth, sValue); - break; - } - case XML_TOK_RECTSHAPE_HEIGHT: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnHeight, sValue); - break; - } - case XML_TOK_RECTSHAPE_CORNER_RADIUS: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnRadius, sValue); - break; - } - } - } } ////////////////////////////////////////////////////////////////////////////// @@ -432,43 +431,49 @@ SdXMLRectShapeContext::~SdXMLRectShapeContext() ////////////////////////////////////////////////////////////////////////////// +// this is called from the parent group for each unparsed attribute in the attribute list +void SdXMLRectShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) +{ + if( XML_NAMESPACE_DRAW == nPrefix ) + { + if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_corner_radius)) ) + { + GetImport().GetMM100UnitConverter().convertMeasure(mnRadius, rValue); + return; + } + } + + SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue ); +} + +////////////////////////////////////////////////////////////////////////////// + void SdXMLRectShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) { // create rectangle shape - uno::Reference< lang::XMultiServiceFactory > xServiceFact(GetImport().GetModel(), uno::UNO_QUERY); - if(xServiceFact.is()) + AddShape("com.sun.star.drawing.RectangleShape"); + if(mxShape.is()) { - uno::Reference< drawing::XShape > xShape(xServiceFact->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.RectangleShape"))), - uno::UNO_QUERY); - if(xShape.is()) - { - // Add, set Style and properties from base shape - AddShape(xShape); - SetStyle(); - SdXMLShapeContext::StartElement(xAttrList); + // Add, set Style and properties from base shape + SetStyle(); - // set local parameters on shape - awt::Point aPoint(mnX, mnY); - awt::Size aSize(mnWidth, mnHeight); - xShape->setPosition(aPoint); - xShape->setSize(aSize); + // set local parameters on shape + SetSizeAndPosition(); + SetRotation(); - if(mnRadius) + if(mnRadius) + { + uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY); + if(xPropSet.is()) { - uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); - if(xPropSet.is()) - { - uno::Any aAny; - aAny <<= mnRadius; - xPropSet->setPropertyValue( - OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius")), aAny); - } + uno::Any aAny; + aAny <<= mnRadius; + xPropSet->setPropertyValue( + OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius")), aAny); } } + SdXMLShapeContext::StartElement(xAttrList); } - - GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes ); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -488,39 +493,6 @@ SdXMLLineShapeContext::SdXMLLineShapeContext( mnX2( 1L ), mnY2( 1L ) { - sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - for(sal_Int16 i=0; i < nAttrCount; i++) - { - OUString sAttrName = xAttrList->getNameByIndex( i ); - OUString aLocalName; - sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); - OUString sValue = xAttrList->getValueByIndex( i ); - const SvXMLTokenMap& rAttrTokenMap = GetImport().GetShapeImport()->GetLineShapeAttrTokenMap(); - - switch(rAttrTokenMap.Get(nPrefix, aLocalName)) - { - case XML_TOK_LINESHAPE_X1: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnX1, sValue); - break; - } - case XML_TOK_LINESHAPE_Y1: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnY1, sValue); - break; - } - case XML_TOK_LINESHAPE_X2: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnX2, sValue); - break; - } - case XML_TOK_LINESHAPE_Y2: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnY2, sValue); - break; - } - } - } } ////////////////////////////////////////////////////////////////////////////// @@ -531,43 +503,68 @@ SdXMLLineShapeContext::~SdXMLLineShapeContext() ////////////////////////////////////////////////////////////////////////////// +// this is called from the parent group for each unparsed attribute in the attribute list +void SdXMLLineShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) +{ + if( XML_NAMESPACE_SVG == nPrefix ) + { + if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_x1)) ) + { + GetImport().GetMM100UnitConverter().convertMeasure(mnX1, rValue); + return; + } + if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_y1)) ) + { + GetImport().GetMM100UnitConverter().convertMeasure(mnY1, rValue); + return; + } + if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_x2)) ) + { + GetImport().GetMM100UnitConverter().convertMeasure(mnX2, rValue); + return; + } + if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_y2)) ) + { + GetImport().GetMM100UnitConverter().convertMeasure(mnY2, rValue); + return; + } + } + + SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue ); +} + +////////////////////////////////////////////////////////////////////////////// + void SdXMLLineShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) { // create rectangle shape - uno::Reference< lang::XMultiServiceFactory > xServiceFact(GetImport().GetModel(), uno::UNO_QUERY); - if(xServiceFact.is()) + AddShape("com.sun.star.drawing.LineShape"); + if(mxShape.is()) { - uno::Reference< drawing::XShape > xShape(xServiceFact->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.LineShape"))), uno::UNO_QUERY); - if(xShape.is()) - { - // Add, set Style and properties from base shape - AddShape(xShape); - SetStyle(); - SdXMLShapeContext::StartElement(xAttrList); + // Add, set Style and properties from base shape + SetStyle(); - // set local parameters on shape - uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); - if(xPropSet.is()) - { - drawing::PointSequenceSequence aPolyPoly(1L); - drawing::PointSequence* pOuterSequence = aPolyPoly.getArray(); - pOuterSequence->realloc(2L); - awt::Point* pInnerSequence = pOuterSequence->getArray(); - uno::Any aAny; + // set local parameters on shape + uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY); + if(xPropSet.is()) + { + drawing::PointSequenceSequence aPolyPoly(1L); + drawing::PointSequence* pOuterSequence = aPolyPoly.getArray(); + pOuterSequence->realloc(2L); + awt::Point* pInnerSequence = pOuterSequence->getArray(); + uno::Any aAny; - *pInnerSequence = awt::Point( mnX1, mnY1 ); - pInnerSequence++; - *pInnerSequence = awt::Point( mnX2, mnY2 ); + *pInnerSequence = awt::Point( mnX1, mnY1 ); + pInnerSequence++; + *pInnerSequence = awt::Point( mnX2, mnY2 ); - aAny <<= aPolyPoly; - xPropSet->setPropertyValue( - OUString(RTL_CONSTASCII_USTRINGPARAM("PolyPolygon")), aAny); - } + aAny <<= aPolyPoly; + xPropSet->setPropertyValue( + OUString(RTL_CONSTASCII_USTRINGPARAM("PolyPolygon")), aAny); } - } - GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes ); + SdXMLShapeContext::StartElement(xAttrList); + } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -587,46 +584,6 @@ SdXMLEllipseShapeContext::SdXMLEllipseShapeContext( mnRX( 1L ), mnRY( 1L ) { - sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - for(sal_Int16 i=0; i < nAttrCount; i++) - { - OUString sAttrName = xAttrList->getNameByIndex( i ); - OUString aLocalName; - sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); - OUString sValue = xAttrList->getValueByIndex( i ); - const SvXMLTokenMap& rAttrTokenMap = GetImport().GetShapeImport()->GetEllipseShapeAttrTokenMap(); - - switch(rAttrTokenMap.Get(nPrefix, aLocalName)) - { - case XML_TOK_ELLIPSESHAPE_CX: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnCX, sValue); - break; - } - case XML_TOK_ELLIPSESHAPE_CY: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnCY, sValue); - break; - } - case XML_TOK_ELLIPSESHAPE_RX: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnRX, sValue); - break; - } - case XML_TOK_ELLIPSESHAPE_RY: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnRY, sValue); - break; - } - case XML_TOK_ELLIPSESHAPE_R: - { - // single radius, it's a circle and both radii are the same - GetImport().GetMM100UnitConverter().convertMeasure(mnRX, sValue); - mnRY = mnRX; - break; - } - } - } } ////////////////////////////////////////////////////////////////////////////// @@ -637,31 +594,64 @@ SdXMLEllipseShapeContext::~SdXMLEllipseShapeContext() ////////////////////////////////////////////////////////////////////////////// -void SdXMLEllipseShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) +// this is called from the parent group for each unparsed attribute in the attribute list +void SdXMLEllipseShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) { - // create rectangle shape - uno::Reference< lang::XMultiServiceFactory > xServiceFact(GetImport().GetModel(), uno::UNO_QUERY); - if(xServiceFact.is()) + if( XML_NAMESPACE_SVG == nPrefix ) { - uno::Reference< drawing::XShape > xShape(xServiceFact->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.EllipseShape"))), - uno::UNO_QUERY); - if(xShape.is()) + if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_rx)) ) { - // Add, set Style and properties from base shape - AddShape(xShape); - SetStyle(); - SdXMLShapeContext::StartElement(xAttrList); - - // set local parameters on shape - awt::Point aPoint(mnCX - mnRX, mnCY - mnRY); - awt::Size aSize(mnRX + mnRX, mnRY + mnRY); - xShape->setPosition(aPoint); - xShape->setSize(aSize); + GetImport().GetMM100UnitConverter().convertMeasure(mnRX, rValue); + return; + } + if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_ry)) ) + { + GetImport().GetMM100UnitConverter().convertMeasure(mnRY, rValue); + return; + } + if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_cx)) ) + { + GetImport().GetMM100UnitConverter().convertMeasure(mnCX, rValue); + return; + } + if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_cy)) ) + { + GetImport().GetMM100UnitConverter().convertMeasure(mnCY, rValue); + return; + } + if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_r)) ) + { + // single radius, it's a circle and both radii are the same + GetImport().GetMM100UnitConverter().convertMeasure(mnRX, rValue); + mnRY = mnRX; + return; } } - GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes ); + SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue ); +} + +////////////////////////////////////////////////////////////////////////////// + +void SdXMLEllipseShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) +{ + // create rectangle shape + AddShape("com.sun.star.drawing.EllipseShape"); + if(mxShape.is()) + { + // Add, set Style and properties from base shape + SetStyle(); + + // set local parameters on shape + awt::Point aPoint(mnCX - mnRX, mnCY - mnRY); + awt::Size aSize(mnRX + mnRX, mnRY + mnRY); + mxShape->setPosition(aPoint); + mxShape->setSize(aSize); + + SetRotation(); + + SdXMLShapeContext::StartElement(xAttrList); + } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -676,55 +666,33 @@ SdXMLPolygonShapeContext::SdXMLPolygonShapeContext( const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, uno::Reference< drawing::XShapes >& rShapes, sal_Bool bClosed) : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes ), - mnX( 0L ), - mnY( 0L ), - mnWidth( 1L ), - mnHeight( 1L ), mbClosed( bClosed ) { - sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - for(sal_Int16 i=0; i < nAttrCount; i++) - { - OUString sAttrName = xAttrList->getNameByIndex( i ); - OUString aLocalName; - sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); - OUString sValue = xAttrList->getValueByIndex( i ); - const SvXMLTokenMap& rAttrTokenMap = GetImport().GetShapeImport()->GetPolygonShapeAttrTokenMap(); +} + +////////////////////////////////////////////////////////////////////////////// - switch(rAttrTokenMap.Get(nPrefix, aLocalName)) +// this is called from the parent group for each unparsed attribute in the attribute list +void SdXMLPolygonShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) +{ + if( XML_NAMESPACE_SVG == nPrefix ) + { + if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_viewBox)) ) { - case XML_TOK_POLYGONSHAPE_VIEWBOX: - { - maViewBox = sValue; - break; - } - case XML_TOK_POLYGONSHAPE_POINTS: - { - maPoints = sValue; - break; - } - case XML_TOK_POLYGONSHAPE_X: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnX, sValue); - break; - } - case XML_TOK_POLYGONSHAPE_Y: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnY, sValue); - break; - } - case XML_TOK_POLYGONSHAPE_WIDTH: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnWidth, sValue); - break; - } - case XML_TOK_POLYGONSHAPE_HEIGHT: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnHeight, sValue); - break; - } + maViewBox = rValue; + return; + } + } + else if( XML_NAMESPACE_DRAW == nPrefix ) + { + if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_points)) ) + { + maPoints = rValue; + return; } } + + SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue ); } ////////////////////////////////////////////////////////////////////////////// @@ -737,48 +705,35 @@ SdXMLPolygonShapeContext::~SdXMLPolygonShapeContext() void SdXMLPolygonShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) { - // create rectangle shape - uno::Reference< lang::XMultiServiceFactory > xServiceFact(GetImport().GetModel(), uno::UNO_QUERY); - if(xServiceFact.is()) + // Add, set Style and properties from base shape + AddShape("com.sun.star.drawing.PolyLineShape"); + if( mxShape.is() ) { - uno::Reference< drawing::XShape > xShape(xServiceFact->createInstance( - mbClosed ? OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.PolyPolygonShape")) - : OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.PolyLineShape"))), - uno::UNO_QUERY); - if(xShape.is()) - { - // Add, set Style and properties from base shape - AddShape(xShape); - SetStyle(); - SdXMLShapeContext::StartElement(xAttrList); - - // set local parameters on shape - uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); - if(xPropSet.is()) - { - // set parameters on shape - awt::Point aPoint(mnX, mnY); - awt::Size aSize(mnWidth, mnHeight); - uno::Any aAny; + SetStyle(); - xShape->setPosition(aPoint); - xShape->setSize(aSize); + // set parameters on shape + SetSizeAndPosition(); + SetRotation(); - // set polygon - if(maPoints.getLength() && maViewBox.getLength()) - { - SdXMLImExViewBox aViewBox(maViewBox, GetImport().GetMM100UnitConverter()); - SdXMLImExPointsElement aPoints(maPoints, aViewBox, aPoint, aSize, GetImport().GetMM100UnitConverter()); + // set local parameters on shape + uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY); + if(xPropSet.is()) + { + // set polygon + if(maPoints.getLength() && maViewBox.getLength()) + { + SdXMLImExViewBox aViewBox(maViewBox, GetImport().GetMM100UnitConverter()); + SdXMLImExPointsElement aPoints(maPoints, aViewBox, maPosition, maSize, GetImport().GetMM100UnitConverter()); - aAny <<= aPoints.GetPointSequenceSequence(); - xPropSet->setPropertyValue( - OUString(RTL_CONSTASCII_USTRINGPARAM("PolyPolygon")), aAny); - } + uno::Any aAny; + aAny <<= aPoints.GetPointSequenceSequence(); + xPropSet->setPropertyValue( + OUString(RTL_CONSTASCII_USTRINGPARAM("PolyPolygon")), aAny); } } - } - GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes ); + SdXMLShapeContext::StartElement(xAttrList); + } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -793,55 +748,8 @@ SdXMLPathShapeContext::SdXMLPathShapeContext( const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, uno::Reference< drawing::XShapes >& rShapes) : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes ), - mnX( 0L ), - mnY( 0L ), - mnWidth( 1L ), - mnHeight( 1L ), mbClosed( TRUE ) { - sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - for(sal_Int16 i=0; i < nAttrCount; i++) - { - OUString sAttrName = xAttrList->getNameByIndex( i ); - OUString aLocalName; - sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); - OUString sValue = xAttrList->getValueByIndex( i ); - const SvXMLTokenMap& rAttrTokenMap = GetImport().GetShapeImport()->GetPathShapeAttrTokenMap(); - - switch(rAttrTokenMap.Get(nPrefix, aLocalName)) - { - case XML_TOK_PATHSHAPE_VIEWBOX: - { - maViewBox = sValue; - break; - } - case XML_TOK_PATHSHAPE_D: - { - maD = sValue; - break; - } - case XML_TOK_PATHSHAPE_X: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnX, sValue); - break; - } - case XML_TOK_PATHSHAPE_Y: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnY, sValue); - break; - } - case XML_TOK_PATHSHAPE_WIDTH: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnWidth, sValue); - break; - } - case XML_TOK_PATHSHAPE_HEIGHT: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnHeight, sValue); - break; - } - } - } } ////////////////////////////////////////////////////////////////////////////// @@ -852,99 +760,102 @@ SdXMLPathShapeContext::~SdXMLPathShapeContext() ////////////////////////////////////////////////////////////////////////////// +// this is called from the parent group for each unparsed attribute in the attribute list +void SdXMLPathShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) +{ + if( XML_NAMESPACE_SVG == nPrefix ) + { + if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_viewBox)) ) + { + maViewBox = rValue; + return; + } + else if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_d)) ) + { + maD = rValue; + return; + } + } + + SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue ); +} + +////////////////////////////////////////////////////////////////////////////// + void SdXMLPathShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) { // create polygon shape - uno::Reference< lang::XMultiServiceFactory > xServiceFact(GetImport().GetModel(), uno::UNO_QUERY); - if(xServiceFact.is()) + if(maD.getLength()) { - if(maD.getLength()) - { - // prepare some of the parameters - uno::Reference< drawing::XShape > xShape; - awt::Point aPoint(mnX, mnY); - awt::Size aSize(mnWidth, mnHeight); - SdXMLImExViewBox aViewBox(maViewBox, GetImport().GetMM100UnitConverter()); - SdXMLImExSvgDElement aPoints(maD, aViewBox, aPoint, aSize, GetImport().GetMM100UnitConverter()); + // prepare some of the parameters + SdXMLImExViewBox aViewBox(maViewBox, GetImport().GetMM100UnitConverter()); + SdXMLImExSvgDElement aPoints(maD, aViewBox, maPosition, maSize, GetImport().GetMM100UnitConverter()); - // now create shape - if(aPoints.IsCurve()) + char* pService; + // now create shape + if(aPoints.IsCurve()) + { + if(aPoints.IsClosed()) { - if(aPoints.IsClosed()) - { - xShape = uno::Reference< drawing::XShape > ( - xServiceFact->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ClosedBezierShape"))), - uno::UNO_QUERY); - } - else - { - xShape = uno::Reference< drawing::XShape > ( - xServiceFact->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.OpenBezierShape"))), - uno::UNO_QUERY); - } + pService = "com.sun.star.drawing.ClosedBezierShape"; } else { - if(aPoints.IsClosed()) - { - xShape = uno::Reference< drawing::XShape > ( - xServiceFact->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.PolyPolygonShape"))), - uno::UNO_QUERY); - } - else - { - xShape = uno::Reference< drawing::XShape > ( - xServiceFact->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.PolyLineShape"))), - uno::UNO_QUERY); - } + pService = "com.sun.star.drawing.OpenBezierShape"; } + } + else + { + if(aPoints.IsClosed()) + { + pService = "com.sun.star.drawing.PolyPolygonShape"; + } + else + { + pService = "com.sun.star.drawing.PolyLineShape"; + } + } - if(xShape.is()) + // Add, set Style and properties from base shape + AddShape(pService); + if( mxShapes.is() ) + { + SetStyle(); + + // set parameters on shape + SetSizeAndPosition(); + SetRotation(); + + // set local parameters on shape + uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY); + if(xPropSet.is()) { - // Add, set Style and properties from base shape - AddShape(xShape); - SetStyle(); - SdXMLShapeContext::StartElement(xAttrList); - - // set local parameters on shape - uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); - if(xPropSet.is()) - { - uno::Any aAny; + uno::Any aAny; - xShape->setPosition(aPoint); - xShape->setSize(aSize); + // set svg:d + if(maD.getLength()) + { + if(aPoints.IsCurve()) + { + drawing::PolyPolygonBezierCoords aSourcePolyPolygon( + aPoints.GetPointSequenceSequence(), + aPoints.GetFlagSequenceSequence()); - // set svg:d - if(maD.getLength()) + aAny <<= aSourcePolyPolygon; + xPropSet->setPropertyValue( + OUString(RTL_CONSTASCII_USTRINGPARAM("PolyPolygonBezier")), aAny); + } + else { - if(aPoints.IsCurve()) - { - drawing::PolyPolygonBezierCoords aSourcePolyPolygon( - aPoints.GetPointSequenceSequence(), - aPoints.GetFlagSequenceSequence()); - - aAny <<= aSourcePolyPolygon; - xPropSet->setPropertyValue( - OUString(RTL_CONSTASCII_USTRINGPARAM("PolyPolygonBezier")), aAny); - } - else - { - aAny <<= aPoints.GetPointSequenceSequence(); - xPropSet->setPropertyValue( - OUString(RTL_CONSTASCII_USTRINGPARAM("PolyPolygon")), aAny); - } + aAny <<= aPoints.GetPointSequenceSequence(); + xPropSet->setPropertyValue( + OUString(RTL_CONSTASCII_USTRINGPARAM("PolyPolygon")), aAny); } } } + SdXMLShapeContext::StartElement(xAttrList); } } - - GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes ); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -958,45 +869,8 @@ SdXMLTextBoxShapeContext::SdXMLTextBoxShapeContext( const OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, uno::Reference< drawing::XShapes >& rShapes) -: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes ), - mnX( 0L ), - mnY( 0L ), - mnWidth( 1L ), - mnHeight( 1L ) +: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes ) { - sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - for(sal_Int16 i=0; i < nAttrCount; i++) - { - OUString sAttrName = xAttrList->getNameByIndex( i ); - OUString aLocalName; - sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); - OUString sValue = xAttrList->getValueByIndex( i ); - const SvXMLTokenMap& rAttrTokenMap = GetImport().GetShapeImport()->GetTextBoxShapeAttrTokenMap(); - - switch(rAttrTokenMap.Get(nPrefix, aLocalName)) - { - case XML_TOK_TEXTBOXSHAPE_X: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnX, sValue); - break; - } - case XML_TOK_TEXTBOXSHAPE_Y: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnY, sValue); - break; - } - case XML_TOK_TEXTBOXSHAPE_WIDTH: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnWidth, sValue); - break; - } - case XML_TOK_TEXTBOXSHAPE_HEIGHT: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnHeight, sValue); - break; - } - } - } } ////////////////////////////////////////////////////////////////////////////// @@ -1010,89 +884,76 @@ SdXMLTextBoxShapeContext::~SdXMLTextBoxShapeContext() void SdXMLTextBoxShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) { // create textbox shape - uno::Reference< lang::XMultiServiceFactory > xServiceFact(GetImport().GetModel(), uno::UNO_QUERY); - if(xServiceFact.is()) - { - uno::Reference< drawing::XShape > xShape; - sal_Bool bIsPresShape(FALSE); + sal_Bool bIsPresShape(FALSE); + + char *pService; - if(maPresentationClass.getLength()) + if(maPresentationClass.getLength()) + { + if(maPresentationClass.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_presentation_subtitle)))) { - if(maPresentationClass.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_presentation_subtitle)))) - { - // XmlShapeTypePresSubtitleShape - xShape = uno::Reference< drawing::XShape > (xServiceFact->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.SubtitleShape"))), uno::UNO_QUERY); - bIsPresShape = TRUE; - } - else if(maPresentationClass.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_presentation_title)))) - { - // XmlShapeTypePresTitleTextShape - xShape = uno::Reference< drawing::XShape > (xServiceFact->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.TitleTextShape"))), uno::UNO_QUERY); - bIsPresShape = TRUE; - } - else if(maPresentationClass.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_presentation_outline)))) - { - // XmlShapeTypePresOutlinerShape - xShape = uno::Reference< drawing::XShape > (xServiceFact->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.OutlinerShape"))), uno::UNO_QUERY); - bIsPresShape = TRUE; - } - else if(maPresentationClass.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_presentation_notes)))) - { - // XmlShapeTypePresNotesShape - xShape = uno::Reference< drawing::XShape > (xServiceFact->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.NotesShape"))), uno::UNO_QUERY); - bIsPresShape = TRUE; - } + // XmlShapeTypePresSubtitleShape + pService = "com.sun.star.presentation.SubtitleShape"; } - else + else if(maPresentationClass.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_presentation_outline)))) { - // normal text shape - xShape = uno::Reference< drawing::XShape > (xServiceFact->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.TextShape"))), uno::UNO_QUERY); + // XmlShapeTypePresOutlinerShape + pService = "com.sun.star.presentation.OutlinerShape"; } - - if(xShape.is()) + else if(maPresentationClass.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_presentation_notes)))) { - // Add, set Style and properties from base shape - AddShape(xShape); + // XmlShapeTypePresNotesShape + pService = "com.sun.star.presentation.NotesShape"; + } + else // if(maPresentationClass.equals(OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_presentation_title)))) + { + // XmlShapeTypePresTitleTextShape + pService = "com.sun.star.presentation.TitleTextShape"; + } + bIsPresShape = TRUE; + } + else + { + // normal text shape + pService = "com.sun.star.drawing.TextShape"; + } + + // Add, set Style and properties from base shape + AddShape(pService); + + if( mxShape.is() ) + { + SetStyle(); - if(bIsPresShape) + if(bIsPresShape) + { + uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY); + if(xProps.is()) { - uno::Reference< beans::XPropertySet > xProps(xShape, uno::UNO_QUERY); - if(xProps.is()) + uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() ); + if( xPropsInfo.is() ) { - uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() ); - if( xPropsInfo.is() ) - { - if( !mbIsPlaceholder && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ))) - xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), ::cppu::bool2any( sal_False ) ); + if( !mbIsPlaceholder && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ))) + xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), ::cppu::bool2any( sal_False ) ); - if( mbIsUserTransformed && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ))) - xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ), ::cppu::bool2any( sal_False ) ); - } + if( mbIsUserTransformed && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ))) + xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsPlaceholderDependent") ), ::cppu::bool2any( sal_False ) ); } } + } - SetStyle(); + // set parameters on shape + if(!bIsPresShape || mbIsUserTransformed) + { + // set pos and size on shape, this should remove binding + // to pres object on masterpage + SetSizeAndPosition(); + } - SdXMLShapeContext::StartElement(xAttrList); + SetRotation(); - if(!bIsPresShape || mbIsUserTransformed) - { - // set pos and size on shape, this should remove binding - // to pres object on masterpage - awt::Point aPoint(mnX, mnY); - awt::Size aSize(mnWidth, mnHeight); - xShape->setPosition(aPoint); - xShape->setSize(aSize); - } - } + SdXMLShapeContext::StartElement(xAttrList); } - - GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes ); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1106,45 +967,8 @@ SdXMLControlShapeContext::SdXMLControlShapeContext( const OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, uno::Reference< drawing::XShapes >& rShapes) -: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes ), - mnX( 0L ), - mnY( 0L ), - mnWidth( 1L ), - mnHeight( 1L ) +: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes ) { - sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - for(sal_Int16 i=0; i < nAttrCount; i++) - { - OUString sAttrName = xAttrList->getNameByIndex( i ); - OUString aLocalName; - sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); - OUString sValue = xAttrList->getValueByIndex( i ); - const SvXMLTokenMap& rAttrTokenMap = GetImport().GetShapeImport()->GetControlShapeAttrTokenMap(); - - switch(rAttrTokenMap.Get(nPrefix, aLocalName)) - { - case XML_TOK_CONTROLSHAPE_X: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnX, sValue); - break; - } - case XML_TOK_CONTROLSHAPE_Y: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnY, sValue); - break; - } - case XML_TOK_CONTROLSHAPE_WIDTH: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnWidth, sValue); - break; - } - case XML_TOK_CONTROLSHAPE_HEIGHT: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnHeight, sValue); - break; - } - } - } } ////////////////////////////////////////////////////////////////////////////// @@ -1158,27 +982,18 @@ SdXMLControlShapeContext::~SdXMLControlShapeContext() void SdXMLControlShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) { // create Control shape - uno::Reference< lang::XMultiServiceFactory > xServiceFact(GetImport().GetModel(), uno::UNO_QUERY); - if(xServiceFact.is()) + // add, set style and properties from base shape + AddShape("com.sun.star.drawing.ControlShape"); + if( mxShape.is() ) { - uno::Reference< drawing::XShape > xShape(xServiceFact->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ControlShape"))), uno::UNO_QUERY); - if(xShape.is()) - { - // add, set style and properties from base shape - AddShape(xShape); - SetStyle(); - SdXMLShapeContext::StartElement(xAttrList); + SetStyle(); - // set local parameters on shape - awt::Point aPoint(mnX, mnY); - awt::Size aSize(mnWidth, mnHeight); - xShape->setPosition(aPoint); - xShape->setSize(aSize); - } - } + // set parameters on shape + SetSizeAndPosition(); + SetRotation(); - GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes ); + SdXMLShapeContext::StartElement(xAttrList); + } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1224,22 +1039,22 @@ void SdXMLConnectorShapeContext::processAttribute( sal_uInt16 nPrefix, const ::r if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_start_shape)) ) { mnStartShapeId = rValue.toInt32(); - break; + return; } if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_start_glue_point)) ) { mnStartGlueId = rValue.toInt32(); - break; + return; } if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_end_shape)) ) { mnEndShapeId = rValue.toInt32(); - break; + return; } if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_end_glue_point)) ) { mnEndGlueId = rValue.toInt32(); - break; + return; } if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_line_skew)) ) { @@ -1257,12 +1072,12 @@ void SdXMLConnectorShapeContext::processAttribute( sal_uInt16 nPrefix, const ::r } } } - break; + return; } if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_type)) ) { SvXMLUnitConverter::convertEnum( mnType, rValue, aXML_ConnectionKind_EnumMap ); - break; + return; } } case XML_NAMESPACE_SVG: @@ -1270,25 +1085,27 @@ void SdXMLConnectorShapeContext::processAttribute( sal_uInt16 nPrefix, const ::r if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_x1)) ) { GetImport().GetMM100UnitConverter().convertMeasure(maStart.X, rValue); - break; + return; } if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_y1)) ) { GetImport().GetMM100UnitConverter().convertMeasure(maStart.Y, rValue); - break; + return; } if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_x2)) ) { GetImport().GetMM100UnitConverter().convertMeasure(maEnd.X, rValue); - break; + return; } if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_y2)) ) { GetImport().GetMM100UnitConverter().convertMeasure(maEnd.Y, rValue); - break; + return; } } } + + SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue ); } ////////////////////////////////////////////////////////////////////////////// @@ -1296,50 +1113,42 @@ void SdXMLConnectorShapeContext::processAttribute( sal_uInt16 nPrefix, const ::r void SdXMLConnectorShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) { // create Connector shape - uno::Reference< lang::XMultiServiceFactory > xServiceFact(GetImport().GetModel(), uno::UNO_QUERY); - if(xServiceFact.is()) + // add, set style and properties from base shape + AddShape("com.sun.star.drawing.ConnectorShape"); + if(mxShape.is()) { - uno::Reference< drawing::XShape > xShape(xServiceFact->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.ConnectorShape"))), uno::UNO_QUERY); - if(xShape.is()) + // add connection ids + if( mnStartShapeId != -1 ) + GetImport().GetShapeImport()->addShapeConnection( mxShape, sal_True, mnStartShapeId, mnStartGlueId ); + if( mnEndShapeId != -1 ) + GetImport().GetShapeImport()->addShapeConnection( mxShape, sal_False, mnEndShapeId, mnEndGlueId ); + + uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY ); + if( xProps.is() ) { - // add connection ids - if( mnStartShapeId != -1 ) - GetImport().GetShapeImport()->addShapeConnection( xShape, sal_True, mnStartShapeId, mnStartGlueId ); - if( mnEndShapeId != -1 ) - GetImport().GetShapeImport()->addShapeConnection( xShape, sal_False, mnEndShapeId, mnEndGlueId ); - - // add, set style and properties from base shape - AddShape(xShape); - - uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY ); - if( xProps.is() ) - { - uno::Any aAny; - aAny <<= maStart; - xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition")), aAny); + uno::Any aAny; + aAny <<= maStart; + xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition")), aAny); - aAny <<= maEnd; - xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition")), aAny ); + aAny <<= maEnd; + xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition")), aAny ); - aAny <<= (drawing::ConnectorType)mnType; - xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeKind")), aAny ); + aAny <<= (drawing::ConnectorType)mnType; + xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeKind")), aAny ); - aAny <<= mnDelta1; - xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine1Delta")), aAny ); + aAny <<= mnDelta1; + xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine1Delta")), aAny ); - aAny <<= mnDelta2; - xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine2Delta")), aAny ); + aAny <<= mnDelta2; + xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine2Delta")), aAny ); - aAny <<= mnDelta3; - xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine3Delta")), aAny ); - } - SetStyle(); - SdXMLShapeContext::StartElement(xAttrList); + aAny <<= mnDelta3; + xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EdgeLine3Delta")), aAny ); } - } + SetStyle(); - GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes ); + SdXMLShapeContext::StartElement(xAttrList); + } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1375,25 +1184,27 @@ void SdXMLMeasureShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_x1)) ) { GetImport().GetMM100UnitConverter().convertMeasure(maStart.X, rValue); - break; + return; } if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_y1)) ) { GetImport().GetMM100UnitConverter().convertMeasure(maStart.Y, rValue); - break; + return; } if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_x2)) ) { GetImport().GetMM100UnitConverter().convertMeasure(maEnd.X, rValue); - break; + return; } if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_y2)) ) { GetImport().GetMM100UnitConverter().convertMeasure(maEnd.Y, rValue); - break; + return; } } } + + SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue ); } ////////////////////////////////////////////////////////////////////////////// @@ -1401,33 +1212,23 @@ void SdXMLMeasureShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl void SdXMLMeasureShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) { // create Measure shape - uno::Reference< lang::XMultiServiceFactory > xServiceFact(GetImport().GetModel(), uno::UNO_QUERY); - if(xServiceFact.is()) + // add, set style and properties from base shape + AddShape("com.sun.star.drawing.MeasureShape"); + if(mxShape.is()) { - uno::Reference< drawing::XShape > xShape(xServiceFact->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.MeasureShape"))), uno::UNO_QUERY); - if(xShape.is()) + SetStyle(); + uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY ); + if( xProps.is() ) { - // add, set style and properties from base shape - AddShape(xShape); - - uno::Reference< beans::XPropertySet > xProps( xShape, uno::UNO_QUERY ); - if( xProps.is() ) - { - uno::Any aAny; - aAny <<= maStart; - xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition")), aAny); - - aAny <<= maEnd; - xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition")), aAny ); - } + uno::Any aAny; + aAny <<= maStart; + xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("StartPosition")), aAny); - SetStyle(); - SdXMLShapeContext::StartElement(xAttrList); + aAny <<= maEnd; + xProps->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("EndPosition")), aAny ); } + SdXMLShapeContext::StartElement(xAttrList); } - - GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes ); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1441,45 +1242,8 @@ SdXMLPageShapeContext::SdXMLPageShapeContext( const OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, uno::Reference< drawing::XShapes >& rShapes) -: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes ), - mnX( 0L ), - mnY( 0L ), - mnWidth( 1L ), - mnHeight( 1L ) +: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes ) { - sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - for(sal_Int16 i=0; i < nAttrCount; i++) - { - OUString sAttrName = xAttrList->getNameByIndex( i ); - OUString aLocalName; - sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); - OUString sValue = xAttrList->getValueByIndex( i ); - const SvXMLTokenMap& rAttrTokenMap = GetImport().GetShapeImport()->GetPageShapeAttrTokenMap(); - - switch(rAttrTokenMap.Get(nPrefix, aLocalName)) - { - case XML_TOK_PAGESHAPE_X: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnX, sValue); - break; - } - case XML_TOK_PAGESHAPE_Y: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnY, sValue); - break; - } - case XML_TOK_PAGESHAPE_WIDTH: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnWidth, sValue); - break; - } - case XML_TOK_PAGESHAPE_HEIGHT: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnHeight, sValue); - break; - } - } - } } ////////////////////////////////////////////////////////////////////////////// @@ -1493,28 +1257,17 @@ SdXMLPageShapeContext::~SdXMLPageShapeContext() void SdXMLPageShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) { // create Page shape - uno::Reference< lang::XMultiServiceFactory > xServiceFact(GetImport().GetModel(), uno::UNO_QUERY); - if(xServiceFact.is()) + // add, set style and properties from base shape + AddShape("com.sun.star.drawing.PageShape"); + if(mxShape.is()) { - uno::Reference< drawing::XShape > xShape(xServiceFact->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.PageShape"))), uno::UNO_QUERY); - if(xShape.is()) - { - // add, set style and properties from base shape - AddShape(xShape); + SetStyle(); - SetStyle(); - SdXMLShapeContext::StartElement(xAttrList); + // set parameters on shape + SetSizeAndPosition(); - // set local parameters on shape - awt::Point aPoint(mnX, mnY); - awt::Size aSize(mnWidth, mnHeight); - xShape->setPosition(aPoint); - xShape->setSize(aSize); - } + SdXMLShapeContext::StartElement(xAttrList); } - - GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes ); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1543,21 +1296,18 @@ SdXMLCaptionShapeContext::~SdXMLCaptionShapeContext() void SdXMLCaptionShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) { // create Caption shape - uno::Reference< lang::XMultiServiceFactory > xServiceFact(GetImport().GetModel(), uno::UNO_QUERY); - if(xServiceFact.is()) + // add, set style and properties from base shape + AddShape("com.sun.star.drawing.CaptionShape"); + if( mxShape.is() ) { - uno::Reference< drawing::XShape > xShape(xServiceFact->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.CaptionShape"))), uno::UNO_QUERY); - if(xShape.is()) - { - // add, set style and properties from base shape - AddShape(xShape); - SetStyle(); - SdXMLShapeContext::StartElement(xAttrList); - } - } + SetStyle(); - GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes ); + // set parameters on shape + SetSizeAndPosition(); + SetRotation(); + + SdXMLShapeContext::StartElement(xAttrList); + } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1572,84 +1322,55 @@ SdXMLGraphicObjectShapeContext::SdXMLGraphicObjectShapeContext( const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, uno::Reference< drawing::XShapes >& rShapes) : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes ), - mnX( 0L ), - mnY( 0L ), - mnWidth( 1L ), - mnHeight( 1L ) + maURL() { - OUString aURL; +} - sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - for(sal_Int16 i=0; i < nAttrCount; i++) - { - OUString sAttrName = xAttrList->getNameByIndex( i ); - OUString aLocalName; - sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); - OUString sValue = xAttrList->getValueByIndex( i ); - const SvXMLTokenMap& rAttrTokenMap = GetImport().GetShapeImport()->GetGraphicObjectShapeAttrTokenMap(); +////////////////////////////////////////////////////////////////////////////// - switch(rAttrTokenMap.Get(nPrefix, aLocalName)) +// this is called from the parent group for each unparsed attribute in the attribute list +void SdXMLGraphicObjectShapeContext::processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ) +{ + if( XML_NAMESPACE_XLINK == nPrefix ) + { + if( rLocalName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sXML_href)) ) { - case XML_TOK_GOSHAPE_X: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnX, sValue); - break; - } - case XML_TOK_GOSHAPE_Y: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnY, sValue); - break; - } - case XML_TOK_GOSHAPE_WIDTH: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnWidth, sValue); - break; - } - case XML_TOK_GOSHAPE_HEIGHT: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnHeight, sValue); - break; - } - case XML_TOK_GOSHAPE_URL: - { - aURL = sValue; - } + maURL = rValue; + return; } } + SdXMLShapeContext::processAttribute( nPrefix, rLocalName, rValue ); +} + +////////////////////////////////////////////////////////////////////////////// + +void SdXMLGraphicObjectShapeContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ) +{ // create graphic object shape - uno::Reference< lang::XMultiServiceFactory > xServiceFact(GetImport().GetModel(), uno::UNO_QUERY); - if(xServiceFact.is()) + AddShape( "com.sun.star.drawing.GraphicObjectShape" ); + if(mxShape.is()) { - OUString aType(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GraphicObjectShape")); - if( maPresentationClass.getLength() ) - aType = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.GraphicObjectShape")); - - uno::Reference< drawing::XShape > xShape( xServiceFact->createInstance( aType ), uno::UNO_QUERY); - if(xShape.is()) + SetStyle(); + if( !mbIsPlaceholder ) { - AddShape( xShape ); - - if( !mbIsPlaceholder ) + uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY); + if(xProps.is()) { - uno::Reference< beans::XPropertySet > xProps(xShape, uno::UNO_QUERY); - if(xProps.is()) - { - uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() ); - if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ))) - xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), ::cppu::bool2any( sal_False ) ); + uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() ); + if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ))) + xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), ::cppu::bool2any( sal_False ) ); - if( aURL.getLength() ) + if( maURL.getLength() ) + { + uno::Any aAny; + aAny <<= GetImport().ResolveGraphicObjectURL( maURL, sal_False ); + try + { + xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicURL") ), aAny ); + } + catch (lang::IllegalArgumentException const &) { - uno::Any aAny; - aAny <<= rImport.ResolveGraphicObjectURL( aURL, sal_False ); - try - { - xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicURL") ), aAny ); - } - catch (lang::IllegalArgumentException const &) - { - } } } } @@ -1657,7 +1378,7 @@ SdXMLGraphicObjectShapeContext::SdXMLGraphicObjectShapeContext( if(mbIsUserTransformed) { - uno::Reference< beans::XPropertySet > xProps(xShape, uno::UNO_QUERY); + uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY); if(xProps.is()) { uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() ); @@ -1669,18 +1390,12 @@ SdXMLGraphicObjectShapeContext::SdXMLGraphicObjectShapeContext( } } - SetStyle(); - - // set local parameters on shape - awt::Point aPoint(mnX, mnY); - awt::Size aSize(mnWidth, mnHeight); - xShape->setPosition(aPoint); - xShape->setSize(aSize); + // set parameters on shape + SetSizeAndPosition(); + SetRotation(); SdXMLShapeContext::StartElement(xAttrList); } - - GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes ); } ////////////////////////////////////////////////////////////////////////////// @@ -1702,87 +1417,56 @@ SdXMLChartShapeContext::SdXMLChartShapeContext( const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, uno::Reference< drawing::XShapes >& rShapes) : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes ), - mnX( 0L ), - mnY( 0L ), - mnWidth( 1L ), - mnHeight( 1L ), mpChartContext( NULL ) { - sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - for(sal_Int16 i=0; i < nAttrCount; i++) - { - OUString sAttrName = xAttrList->getNameByIndex( i ); - OUString aLocalName; - sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); - OUString sValue = xAttrList->getValueByIndex( i ); - const SvXMLTokenMap& rAttrTokenMap = GetImport().GetShapeImport()->GetRectShapeAttrTokenMap(); +} - switch(rAttrTokenMap.Get(nPrefix, aLocalName)) - { - case XML_TOK_RECTSHAPE_X: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnX, sValue); - break; - } - case XML_TOK_RECTSHAPE_Y: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnY, sValue); - break; - } - case XML_TOK_RECTSHAPE_WIDTH: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnWidth, sValue); - break; - } - case XML_TOK_RECTSHAPE_HEIGHT: - { - GetImport().GetMM100UnitConverter().convertMeasure(mnHeight, sValue); - break; - } - } - } +////////////////////////////////////////////////////////////////////////////// - // create rectangle shape - uno::Reference< lang::XMultiServiceFactory > xServiceFact(GetImport().GetModel(), uno::UNO_QUERY); - if(xServiceFact.is()) +SdXMLChartShapeContext::~SdXMLChartShapeContext() +{ + if( mpChartContext ) + delete mpChartContext; +} + +////////////////////////////////////////////////////////////////////////////// + +void SdXMLChartShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) +{ + const sal_Bool bIsPresentation = maPresentationClass.getLength() != 0; + AddShape( bIsPresentation ? "com.sun.star.presentation.ChartShape" : "com.sun.star.drawing.OLE2Shape" ); + + if(mxShape.is()) { - OUString aType(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.OLE2Shape")); - if( maPresentationClass.getLength() ) - aType = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.ChartShape")); + SetStyle(); - uno::Reference< drawing::XShape > xShape( xServiceFact->createInstance( aType ), uno::UNO_QUERY); - if(xShape.is()) + if( !mbIsPlaceholder ) { - AddShape( xShape ); - - if( !mbIsPlaceholder ) + uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY); + if(xProps.is()) { - uno::Reference< beans::XPropertySet > xProps(xShape, uno::UNO_QUERY); - if(xProps.is()) - { - uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() ); - if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ))) - xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), ::cppu::bool2any( sal_False ) ); + uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() ); + if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ))) + xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("IsEmptyPresentationObject") ), ::cppu::bool2any( sal_False ) ); - uno::Any aAny; + uno::Any aAny; - const OUString aCLSID( RTL_CONSTASCII_USTRINGPARAM("BF884321-85DD-11D1-89d0-008029e4b0b1")); - aAny <<= aCLSID; - xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID") ), aAny ); + const OUString aCLSID( RTL_CONSTASCII_USTRINGPARAM("BF884321-85DD-11D1-89d0-008029e4b0b1")); + aAny <<= aCLSID; + xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("CLSID") ), aAny ); - aAny = xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Model") ) ); - uno::Reference< frame::XModel > xChartModel; - if( aAny >>= xChartModel ) - { - mpChartContext = rImport.GetChartImport()->CreateChartContext( rImport, nPrfx, rLocalName, xChartModel, xAttrList ); - } + aAny = xProps->getPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("Model") ) ); + uno::Reference< frame::XModel > xChartModel; + if( aAny >>= xChartModel ) + { + mpChartContext = GetImport().GetChartImport()->CreateChartContext( GetImport(), XML_NAMESPACE_SVG, OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_chart)), xChartModel, xAttrList ); } } } if(mbIsUserTransformed) { - uno::Reference< beans::XPropertySet > xProps(xShape, uno::UNO_QUERY); + uno::Reference< beans::XPropertySet > xProps(mxShape, uno::UNO_QUERY); if(xProps.is()) { uno::Reference< beans::XPropertySetInfo > xPropsInfo( xProps->getPropertySetInfo() ); @@ -1794,32 +1478,15 @@ SdXMLChartShapeContext::SdXMLChartShapeContext( } } - SetStyle(); - - // set local parameters on shape - awt::Point aPoint(mnX, mnY); - awt::Size aSize(mnWidth, mnHeight); - xShape->setPosition(aPoint); - xShape->setSize(aSize); - } -} -////////////////////////////////////////////////////////////////////////////// + // set parameters on shape + SetSizeAndPosition(); -SdXMLChartShapeContext::~SdXMLChartShapeContext() -{ - if( mpChartContext ) - delete mpChartContext; -} - -////////////////////////////////////////////////////////////////////////////// - -void SdXMLChartShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) -{ - if( mpChartContext ) - mpChartContext->StartElement( xAttrList ); + SdXMLShapeContext::StartElement(xAttrList); - GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes ); + if( mpChartContext ) + mpChartContext->StartElement( xAttrList ); + } } void SdXMLChartShapeContext::EndElement() diff --git a/xmloff/source/draw/ximpshap.hxx b/xmloff/source/draw/ximpshap.hxx index 927bf5fa841a..a2885c50e625 100644 --- a/xmloff/source/draw/ximpshap.hxx +++ b/xmloff/source/draw/ximpshap.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ximpshap.hxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: cl $ $Date: 2000-12-05 23:26:19 $ + * last change: $Author: cl $ $Date: 2000-12-13 19:13:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -111,9 +111,22 @@ protected: sal_Bool mbIsPlaceholder; sal_Bool mbIsUserTransformed; sal_Int32 mnZOrder; + sal_Int32 mnShapeId; + + com::sun::star::awt::Size maSize; + com::sun::star::awt::Point maPosition; + sal_Int32 mnX; + sal_Int32 mnY; + sal_Int32 mnWidth; + sal_Int32 mnHeight; void SetStyle(); void AddShape(com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape); + void AddShape(const char* pServiceName ); + void SetSize(); + void SetPosition(); + void SetRotation(); + void SetSizeAndPosition() { SetPosition(); SetSize(); } SvXMLImport& GetImport() { return SvXMLImportContext::GetImport(); } const SvXMLImport& GetImport() const { return SvXMLImportContext::GetImport(); } @@ -142,10 +155,6 @@ public: class SdXMLRectShapeContext : public SdXMLShapeContext { - sal_Int32 mnX; - sal_Int32 mnY; - sal_Int32 mnWidth; - sal_Int32 mnHeight; sal_Int32 mnRadius; public: @@ -157,6 +166,9 @@ public: com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes); virtual ~SdXMLRectShapeContext(); virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList); + + // this is called from the parent group for each unparsed attribute in the attribute list + virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); }; ////////////////////////////////////////////////////////////////////////////// @@ -178,6 +190,9 @@ public: com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes); virtual ~SdXMLLineShapeContext(); virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList); + + // this is called from the parent group for each unparsed attribute in the attribute list + virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); }; ////////////////////////////////////////////////////////////////////////////// @@ -199,6 +214,9 @@ public: com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes); virtual ~SdXMLEllipseShapeContext(); virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList); + + // this is called from the parent group for each unparsed attribute in the attribute list + virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); }; ////////////////////////////////////////////////////////////////////////////// @@ -208,10 +226,6 @@ class SdXMLPolygonShapeContext : public SdXMLShapeContext { rtl::OUString maPoints; rtl::OUString maViewBox; - sal_Int32 mnX; - sal_Int32 mnY; - sal_Int32 mnWidth; - sal_Int32 mnHeight; sal_Bool mbClosed; public: @@ -223,6 +237,9 @@ public: com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes, sal_Bool bClosed); virtual ~SdXMLPolygonShapeContext(); virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList); + + // this is called from the parent group for each unparsed attribute in the attribute list + virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); }; ////////////////////////////////////////////////////////////////////////////// @@ -232,10 +249,6 @@ class SdXMLPathShapeContext : public SdXMLShapeContext { rtl::OUString maD; rtl::OUString maViewBox; - sal_Int32 mnX; - sal_Int32 mnY; - sal_Int32 mnWidth; - sal_Int32 mnHeight; sal_Bool mbClosed; public: @@ -247,6 +260,9 @@ public: com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes); virtual ~SdXMLPathShapeContext(); virtual void StartElement(const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList); + + // this is called from the parent group for each unparsed attribute in the attribute list + virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); }; ////////////////////////////////////////////////////////////////////////////// @@ -254,11 +270,6 @@ public: class SdXMLTextBoxShapeContext : public SdXMLShapeContext { - sal_Int32 mnX; - sal_Int32 mnY; - sal_Int32 mnWidth; - sal_Int32 mnHeight; - public: TYPEINFO(); @@ -275,11 +286,6 @@ public: class SdXMLControlShapeContext : public SdXMLShapeContext { - sal_Int32 mnX; - sal_Int32 mnY; - sal_Int32 mnWidth; - sal_Int32 mnHeight; - public: TYPEINFO(); @@ -352,11 +358,6 @@ public: class SdXMLPageShapeContext : public SdXMLShapeContext { - sal_Int32 mnX; - sal_Int32 mnY; - sal_Int32 mnWidth; - sal_Int32 mnHeight; - public: TYPEINFO(); @@ -389,11 +390,7 @@ public: class SdXMLGraphicObjectShapeContext : public SdXMLShapeContext { - sal_Int32 mnX; - sal_Int32 mnY; - sal_Int32 mnWidth; - sal_Int32 mnHeight; - + ::rtl::OUString maURL; public: TYPEINFO(); @@ -402,6 +399,11 @@ public: const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes); virtual ~SdXMLGraphicObjectShapeContext(); + + virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); + + // this is called from the parent group for each unparsed attribute in the attribute list + virtual void processAttribute( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const ::rtl::OUString& rValue ); }; ////////////////////////////////////////////////////////////////////////////// @@ -409,10 +411,6 @@ public: class SdXMLChartShapeContext : public SdXMLShapeContext { - sal_Int32 mnX; - sal_Int32 mnY; - sal_Int32 mnWidth; - sal_Int32 mnHeight; SvXMLImportContext* mpChartContext; public: diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx index d446422aa994..e976cac7e66f 100644 --- a/xmloff/source/draw/ximpstyl.cxx +++ b/xmloff/source/draw/ximpstyl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ximpstyl.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: cl $ $Date: 2000-12-11 08:00:05 $ + * last change: $Author: cl $ $Date: 2000-12-13 19:13:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -562,7 +562,7 @@ SdXMLPresentationPlaceholderContext::~SdXMLPresentationPlaceholderContext() ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// -TYPEINIT1( SdXMLMasterPageContext, SdXMLGroupShapeContext ); +TYPEINIT1( SdXMLMasterPageContext, SdXMLGenericPageContext ); SdXMLMasterPageContext::SdXMLMasterPageContext( SdXMLImport& rImport, @@ -570,7 +570,7 @@ SdXMLMasterPageContext::SdXMLMasterPageContext( const OUString& rLName, const uno::Reference< xml::sax::XAttributeList>& xAttrList, uno::Reference< drawing::XShapes >& rShapes) -: SdXMLGroupShapeContext( rImport, nPrfx, rLName, xAttrList, rShapes ) +: SdXMLGenericPageContext( rImport, nPrfx, rLName, xAttrList, rShapes ) { sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; for(sal_Int16 i=0; i < nAttrCount; i++) @@ -759,7 +759,7 @@ void SdXMLMasterPageContext::EndElement() ((SdXMLStylesContext*)pContext)->SetMasterPageStyles(*this); } - SdXMLGroupShapeContext::EndElement(); + SdXMLGenericPageContext::EndElement(); GetImport().GetShapeImport()->restoreConnections(); } @@ -806,7 +806,7 @@ SvXMLImportContext* SdXMLMasterPageContext::CreateChildContext( // call base class if(!pContext) - pContext = SdXMLGroupShapeContext::CreateChildContext(nPrefix, rLocalName, xAttrList); + pContext = SdXMLGenericPageContext::CreateChildContext(nPrefix, rLocalName, xAttrList); return pContext; } diff --git a/xmloff/source/draw/ximpstyl.hxx b/xmloff/source/draw/ximpstyl.hxx index 8fd3b72d676d..cb88b98dcde4 100644 --- a/xmloff/source/draw/ximpstyl.hxx +++ b/xmloff/source/draw/ximpstyl.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ximpstyl.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: cl $ $Date: 2000-12-05 23:26:19 $ + * last change: $Author: cl $ $Date: 2000-12-13 19:13:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -70,8 +70,8 @@ #include "sdxmlimp_impl.hxx" #endif -#ifndef _XIMPGROUP_HXX -#include "ximpgrp.hxx" +#ifndef _XIMPPAGE_HXX +#include "ximppage.hxx" #endif #ifndef _XMLOFF_XMLSTYLE_HXX @@ -149,7 +149,7 @@ public: ////////////////////////////////////////////////////////////////////////////// // style:masterpage context -class SdXMLMasterPageContext: public SdXMLGroupShapeContext +class SdXMLMasterPageContext: public SdXMLGenericPageContext { rtl::OUString msPageMasterName; rtl::OUString msName; |