diff options
author | Marco Cecchetti <mrcekets@gmail.com> | 2011-07-22 12:14:06 +0200 |
---|---|---|
committer | Thorsten Behrens <tbehrens@novell.com> | 2011-08-26 18:25:20 +0200 |
commit | ac756a96b8fd6bd9177bfd1b4b01eff9e8ab2820 (patch) | |
tree | 469698116a5d6c5d0c11886a937bc05f9c8987ec | |
parent | 8cac883fcdce6ba3f4881ef642534de6d1561c0f (diff) |
Now AnimationsExporterImpl defines its own XMLSdPropHdlFactory object.
The old behaviour was to get the XMLSdPropHdlFactory object of
SdXMLExport through a dangerous static cast of the exporter object (of
type SvXMLExport). See method AnimationsExporterImpl::convertValue.
This let the class AnimationsExporter to be used by any class derived
from SvXMLExport.
-rw-r--r-- | xmloff/source/draw/animationexport.cxx | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/xmloff/source/draw/animationexport.cxx b/xmloff/source/draw/animationexport.cxx index b66ec8873993..851209b13a8a 100644 --- a/xmloff/source/draw/animationexport.cxx +++ b/xmloff/source/draw/animationexport.cxx @@ -515,6 +515,7 @@ class AnimationsExporterImpl { public: AnimationsExporterImpl( SvXMLExport& rExport, const Reference< XPropertySet >& xPageProps ); + virtual ~AnimationsExporterImpl(); void prepareNode( const Reference< XAnimationNode >& xNode ); void exportNode( const Reference< XAnimationNode >& xNode ); @@ -542,6 +543,7 @@ private: SvXMLExport& mrExport; Reference< XInterface > mxExport; Reference< XPropertySet > mxPageProps; + XMLSdPropHdlFactory* mpSdPropHdlFactory; }; AnimationsExporterImpl::AnimationsExporterImpl( SvXMLExport& rExport, const Reference< XPropertySet >& xPageProps ) @@ -557,6 +559,24 @@ AnimationsExporterImpl::AnimationsExporterImpl( SvXMLExport& rExport, const Refe { OSL_FAIL( "xmloff::AnimationsExporterImpl::AnimationsExporterImpl(), RuntimeException catched!" ); } + + mpSdPropHdlFactory = new XMLSdPropHdlFactory( mrExport.GetModel(), mrExport ); + if( mpSdPropHdlFactory ) + { + // set lock to avoid deletion + mpSdPropHdlFactory->acquire(); + } + +} + +AnimationsExporterImpl::~AnimationsExporterImpl() +{ + // cleanup factory, decrease refcount. Should lead to destruction. + if(mpSdPropHdlFactory) + { + mpSdPropHdlFactory->release(); + mpSdPropHdlFactory = 0L; + } } void AnimationsExporterImpl::exportTransitionNode() @@ -1526,7 +1546,8 @@ void AnimationsExporterImpl::convertValue( XMLTokenEnum eAttributeName, OUString nType = XML_TYPE_STRING; } - const XMLPropertyHandler* pHandler = static_cast<SdXMLExport*>(&mrExport)->GetSdPropHdlFactory()->GetPropertyHandler( nType ); + //const XMLPropertyHandler* pHandler = static_cast<SdXMLExport*>(&mrExport)->GetSdPropHdlFactory()->GetPropertyHandler( nType ); + const XMLPropertyHandler* pHandler = mpSdPropHdlFactory->GetPropertyHandler( nType ); if( pHandler ) { pHandler->exportXML( aString, rValue, mrExport.GetMM100UnitConverter() ); |