diff options
author | Christian Lippka <cl@openoffice.org> | 2001-05-18 07:40:43 +0000 |
---|---|---|
committer | Christian Lippka <cl@openoffice.org> | 2001-05-18 07:40:43 +0000 |
commit | 42b04415ff98819aaf195ad80e9da8cee1c6d9d0 (patch) | |
tree | 67b0448cd1ce00a626638b3fb96402e5b13102f1 | |
parent | df63b3c8ff4d72765188f98fc635227b01f40137 (diff) |
#86567# 3d objects now use same base class as 2d shapes
-rw-r--r-- | xmloff/source/draw/shapeimport.cxx | 18 | ||||
-rw-r--r-- | xmloff/source/draw/ximp3dobject.cxx | 172 | ||||
-rw-r--r-- | xmloff/source/draw/ximp3dobject.hxx | 16 | ||||
-rw-r--r-- | xmloff/source/draw/ximp3dscene.cxx | 8 |
4 files changed, 102 insertions, 112 deletions
diff --git a/xmloff/source/draw/shapeimport.cxx b/xmloff/source/draw/shapeimport.cxx index 8a27706b3b05..5568a5093805 100644 --- a/xmloff/source/draw/shapeimport.cxx +++ b/xmloff/source/draw/shapeimport.cxx @@ -2,9 +2,9 @@ * * $RCSfile: shapeimport.cxx,v $ * - * $Revision: 1.31 $ + * $Revision: 1.32 $ * - * last change: $Author: aw $ $Date: 2001-05-08 13:34:13 $ + * last change: $Author: cl $ $Date: 2001-05-18 08:40:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -604,7 +604,7 @@ SvXMLImportContext* XMLShapeImportHelper::Create3DSceneChildContext( const uno::Reference< xml::sax::XAttributeList>& xAttrList, uno::Reference< drawing::XShapes >& rShapes) { - SvXMLImportContext *pContext = 0L; + SdXMLShapeContext *pContext = 0L; if(rShapes.is()) { @@ -653,6 +653,18 @@ SvXMLImportContext* XMLShapeImportHelper::Create3DSceneChildContext( } } + // now parse the attribute list and call the child context for each unknown attribute + sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; + for(sal_Int16 a(0); a < nAttrCount; a++) + { + const OUString& rAttrName = xAttrList->getNameByIndex(a); + OUString aLocalName; + sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName(rAttrName, &aLocalName); + const OUString aValue( xAttrList->getValueByIndex(a) ); + + pContext->processAttribute( nPrefix, aLocalName, aValue ); + } + return pContext; } diff --git a/xmloff/source/draw/ximp3dobject.cxx b/xmloff/source/draw/ximp3dobject.cxx index a0ed8a4460a4..f2cfaa9b80d9 100644 --- a/xmloff/source/draw/ximp3dobject.cxx +++ b/xmloff/source/draw/ximp3dobject.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ximp3dobject.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: sab $ $Date: 2001-03-16 14:35:56 $ + * last change: $Author: cl $ $Date: 2001-05-18 08:40:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -123,7 +123,7 @@ using namespace ::com::sun::star; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -TYPEINIT1( SdXML3DObjectContext, SvXMLImportContext ); +TYPEINIT1( SdXML3DObjectContext, SdXMLShapeContext ); SdXML3DObjectContext::SdXML3DObjectContext( SvXMLImport& rImport, @@ -131,8 +131,7 @@ SdXML3DObjectContext::SdXML3DObjectContext( const OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, uno::Reference< drawing::XShapes >& rShapes) -: SvXMLImportContext( rImport, nPrfx, rLocalName ), - mxShapes( rShapes ), +: SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes ), mbSetTransform( FALSE ) { sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; @@ -184,7 +183,7 @@ void SdXML3DObjectContext::StartElement(const uno::Reference< xml::sax::XAttribu } // call parent - SvXMLImportContext::StartElement(xAttrList); + SdXMLShapeContext::StartElement(xAttrList); } } @@ -193,11 +192,11 @@ void SdXML3DObjectContext::StartElement(const uno::Reference< xml::sax::XAttribu void SdXML3DObjectContext::EndElement() { // call parent - SvXMLImportContext::EndElement(); + SdXMLShapeContext::EndElement(); } ////////////////////////////////////////////////////////////////////////////// - +/* void SdXML3DObjectContext::AddShape(uno::Reference< drawing::XShape >& xShape) { if(xShape.is() && mxShapes.is()) @@ -209,9 +208,9 @@ void SdXML3DObjectContext::AddShape(uno::Reference< drawing::XShape >& xShape) mxShapes->add( xShape ); } } - +*/ ////////////////////////////////////////////////////////////////////////////// - +/* void SdXML3DObjectContext::SetStyle() { // set style on shape @@ -255,7 +254,7 @@ void SdXML3DObjectContext::SetStyle() } } } - +*/ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -323,43 +322,37 @@ SdXML3DCubeObjectShapeContext::~SdXML3DCubeObjectShapeContext() void SdXML3DCubeObjectShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) { // create shape - uno::Reference< lang::XMultiServiceFactory > xServiceFact(GetImport().GetModel(), uno::UNO_QUERY); - if(xServiceFact.is()) + AddShape( "com.sun.star.drawing.Shape3DCubeObject" ); + if(mxShape.is()) { - uno::Reference< drawing::XShape > xShape(xServiceFact->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Shape3DCubeObject"))), uno::UNO_QUERY); - if(xShape.is()) + // add, set style and properties from base shape + SetStyle(); + SdXML3DObjectContext::StartElement(xAttrList); + + // 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(); - SdXML3DObjectContext::StartElement(xAttrList); + // set parameters + drawing::Position3D aPosition3D; + drawing::Direction3D aDirection3D; - // set local parameters on shape - uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY); - if(xPropSet.is()) - { - // set parameters - drawing::Position3D aPosition3D; - drawing::Direction3D aDirection3D; - - // convert from min, max to size to be set - maMaxEdge = maMaxEdge - maMinEdge; - - aPosition3D.PositionX = maMinEdge.X(); - aPosition3D.PositionY = maMinEdge.Y(); - aPosition3D.PositionZ = maMinEdge.Z(); - - aDirection3D.DirectionX = maMaxEdge.X(); - aDirection3D.DirectionY = maMaxEdge.Y(); - aDirection3D.DirectionZ = maMaxEdge.Z(); - - uno::Any aAny; - aAny <<= aPosition3D; - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPosition")), aAny); - aAny <<= aDirection3D; - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSize")), aAny); - } + // convert from min, max to size to be set + maMaxEdge = maMaxEdge - maMinEdge; + + aPosition3D.PositionX = maMinEdge.X(); + aPosition3D.PositionY = maMinEdge.Y(); + aPosition3D.PositionZ = maMinEdge.Z(); + + aDirection3D.DirectionX = maMaxEdge.X(); + aDirection3D.DirectionY = maMaxEdge.Y(); + aDirection3D.DirectionZ = maMaxEdge.Z(); + + uno::Any aAny; + aAny <<= aPosition3D; + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPosition")), aAny); + aAny <<= aDirection3D; + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSize")), aAny); } } } @@ -439,40 +432,34 @@ SdXML3DSphereObjectShapeContext::~SdXML3DSphereObjectShapeContext() void SdXML3DSphereObjectShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) { // create shape - uno::Reference< lang::XMultiServiceFactory > xServiceFact(GetImport().GetModel(), uno::UNO_QUERY); - if(xServiceFact.is()) + AddShape( "com.sun.star.drawing.Shape3DSphereObject" ); + if(mxShape.is()) { - uno::Reference< drawing::XShape > xShape(xServiceFact->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Shape3DSphereObject"))), uno::UNO_QUERY); - if(xShape.is()) + // add, set style and properties from base shape + SetStyle(); + SdXML3DObjectContext::StartElement(xAttrList); + + // 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(); - SdXML3DObjectContext::StartElement(xAttrList); + // set parameters + drawing::Position3D aPosition3D; + drawing::Direction3D aDirection3D; - // set local parameters on shape - uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY); - if(xPropSet.is()) - { - // set parameters - drawing::Position3D aPosition3D; - drawing::Direction3D aDirection3D; - - aPosition3D.PositionX = maCenter.X(); - aPosition3D.PositionY = maCenter.Y(); - aPosition3D.PositionZ = maCenter.Z(); - - aDirection3D.DirectionX = maSize.X(); - aDirection3D.DirectionY = maSize.Y(); - aDirection3D.DirectionZ = maSize.Z(); - - uno::Any aAny; - aAny <<= aPosition3D; - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPosition")), aAny); - aAny <<= aDirection3D; - xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSize")), aAny); - } + aPosition3D.PositionX = maCenter.X(); + aPosition3D.PositionY = maCenter.Y(); + aPosition3D.PositionZ = maCenter.Z(); + + aDirection3D.DirectionX = maSize.X(); + aDirection3D.DirectionY = maSize.Y(); + aDirection3D.DirectionZ = maSize.Z(); + + uno::Any aAny; + aAny <<= aPosition3D; + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DPosition")), aAny); + aAny <<= aDirection3D; + xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("D3DSize")), aAny); } } } @@ -631,18 +618,12 @@ SdXML3DLatheObjectShapeContext::~SdXML3DLatheObjectShapeContext() void SdXML3DLatheObjectShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) { // create shape - uno::Reference< lang::XMultiServiceFactory > xServiceFact(GetImport().GetModel(), uno::UNO_QUERY); - if(xServiceFact.is()) + AddShape( "com.sun.star.drawing.Shape3DLatheObject" ); + if(mxShape.is()) { - uno::Reference< drawing::XShape > xShape(xServiceFact->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Shape3DLatheObject"))), uno::UNO_QUERY); - if(xShape.is()) - { - // add, set style and properties from base shape - AddShape(xShape); - SetStyle(); - SdXML3DPolygonBasedShapeContext::StartElement(xAttrList); - } + // add, set style and properties from base shape + SetStyle(); + SdXML3DPolygonBasedShapeContext::StartElement(xAttrList); } } @@ -679,19 +660,12 @@ SdXML3DExtrudeObjectShapeContext::~SdXML3DExtrudeObjectShapeContext() void SdXML3DExtrudeObjectShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttrList) { - // create shape - uno::Reference< lang::XMultiServiceFactory > xServiceFact(GetImport().GetModel(), uno::UNO_QUERY); - if(xServiceFact.is()) + AddShape( "com.sun.star.drawing.Shape3DExtrudeObject" ); + if(mxShape.is()) { - uno::Reference< drawing::XShape > xShape(xServiceFact->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Shape3DExtrudeObject"))), uno::UNO_QUERY); - if(xShape.is()) - { - // add, set style and properties from base shape - AddShape(xShape); - SetStyle(); - SdXML3DPolygonBasedShapeContext::StartElement(xAttrList); - } + // add, set style and properties from base shape + SetStyle(); + SdXML3DPolygonBasedShapeContext::StartElement(xAttrList); } } diff --git a/xmloff/source/draw/ximp3dobject.hxx b/xmloff/source/draw/ximp3dobject.hxx index b8e1025b0f47..4d7e80dc5fd7 100644 --- a/xmloff/source/draw/ximp3dobject.hxx +++ b/xmloff/source/draw/ximp3dobject.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ximp3dobject.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: cl $ $Date: 2000-12-05 23:25:00 $ + * last change: $Author: cl $ $Date: 2001-05-18 08:40:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -98,23 +98,25 @@ #include <com/sun/star/drawing/Position3D.hpp> #endif +#ifndef _XIMPSHAPE_HXX +#include "ximpshap.hxx" +#endif + ////////////////////////////////////////////////////////////////////////////// // common shape context -class SdXML3DObjectContext : public SvXMLImportContext +class SdXML3DObjectContext : public SdXMLShapeContext { protected: // the shape group this object should be created inside - com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > mxShapes; - com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxShape; - rtl::OUString maDrawStyleName; com::sun::star::drawing::HomogenMatrix mxHomMat; BOOL mbSetTransform; +/* void SetStyle(); void AddShape(com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape); - +*/ public: TYPEINFO(); diff --git a/xmloff/source/draw/ximp3dscene.cxx b/xmloff/source/draw/ximp3dscene.cxx index aea67a50dadb..ddb0eff54fa1 100644 --- a/xmloff/source/draw/ximp3dscene.cxx +++ b/xmloff/source/draw/ximp3dscene.cxx @@ -2,9 +2,9 @@ * * $RCSfile: ximp3dscene.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: cl $ $Date: 2001-03-28 11:19:11 $ + * last change: $Author: cl $ $Date: 2001-05-18 08:40:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -177,6 +177,8 @@ void SdXML3DSceneShapeContext::StartElement(const uno::Reference< xml::sax::XAtt { mxChilds = uno::Reference< drawing::XShapes >::query( mxShape ); + SetLayer(); + // set pos, size, shear and rotate SetTransformation(); } @@ -231,7 +233,7 @@ SvXMLImportContext* SdXML3DSceneShapeContext::CreateChildContext( USHORT nPrefix { pContext = GetImport().GetShapeImport()->Create3DSceneChildContext( GetImport(), nPrefix, rLocalName, xAttrList, mxChilds); - } + } // call parent when no own context was created if(!pContext) |