diff options
author | Muthu Subramanian <sumuthu@novell.com> | 2011-07-05 16:32:50 +0530 |
---|---|---|
committer | Muthu Subramanian <sumuthu@novell.com> | 2011-07-05 16:32:50 +0530 |
commit | fc0a2d2d9525736a11c963d70a66e1246667e82f (patch) | |
tree | 6de2952feb7412ef3f0773a37a2e2bc2feb7ea43 /oox | |
parent | Interestingly, struct lconv is empty in Android's C library (diff) | |
download | core-fc0a2d2d9525736a11c963d70a66e1246667e82f.tar.gz core-fc0a2d2d9525736a11c963d70a66e1246667e82f.zip |
Moving the pptx classes to use FragmentHandler2/ContextHandler2.
This is to make it use the better and newer parent handlers.
And to support MCE.
[PB] Probable candidate for typo breakages.
Diffstat (limited to 'oox')
36 files changed, 405 insertions, 674 deletions
diff --git a/oox/inc/oox/ppt/backgroundproperties.hxx b/oox/inc/oox/ppt/backgroundproperties.hxx index 7f254e8c386e..4be1177fc55f 100644 --- a/oox/inc/oox/ppt/backgroundproperties.hxx +++ b/oox/inc/oox/ppt/backgroundproperties.hxx @@ -29,18 +29,18 @@ #ifndef OOX_POWERPOINT_BACKGROUNDPROPERTIES_HXX #define OOX_POWERPOINT_BACKGROUNDPROPERTIES_HXX -#include "oox/core/contexthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" #include "oox/drawingml/fillproperties.hxx" namespace oox { namespace ppt { // --------------------------------------------------------------------- -class BackgroundPropertiesContext : public ::oox::core::ContextHandler +class BackgroundPropertiesContext : public ::oox::core::FragmentHandler2 { public: - BackgroundPropertiesContext( ::oox::core::ContextHandler& rParent, ::oox::drawingml::FillProperties& rFillProperties ) throw(); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + BackgroundPropertiesContext( ::oox::core::FragmentHandler2& rParent, ::oox::drawingml::FillProperties& rFillProperties ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); protected: ::oox::drawingml::FillProperties& mrFillProperties; diff --git a/oox/inc/oox/ppt/customshowlistcontext.hxx b/oox/inc/oox/ppt/customshowlistcontext.hxx index df5ca3a7a6fe..d10976b3ad46 100644 --- a/oox/inc/oox/ppt/customshowlistcontext.hxx +++ b/oox/inc/oox/ppt/customshowlistcontext.hxx @@ -31,7 +31,7 @@ #ifndef OOX_POWERPOINT_CUSTOMSHOWLISTCONTEXT_HXX #define OOX_POWERPOINT_CUSTOMSHOWLISTCONTEXT_HXX -#include "oox/core/contexthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" #include <vector> namespace oox { namespace ppt { @@ -45,18 +45,16 @@ namespace oox { namespace ppt { }; /** CT_ */ - class CustomShowListContext : public ::oox::core::ContextHandler + class CustomShowListContext : public ::oox::core::FragmentHandler2 { std::vector< CustomShow >& mrCustomShowList; public: - CustomShowListContext( ::oox::core::ContextHandler& rParent, + CustomShowListContext( ::oox::core::FragmentHandler2& rParent, std::vector< CustomShow >& rCustomShowList ); ~CustomShowListContext( ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL - createFastChildContext( ::sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& /*xAttribs*/ ) - throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); }; } } diff --git a/oox/inc/oox/ppt/layoutfragmenthandler.hxx b/oox/inc/oox/ppt/layoutfragmenthandler.hxx index bc29d732ee28..4e7ae5d28f8e 100644 --- a/oox/inc/oox/ppt/layoutfragmenthandler.hxx +++ b/oox/inc/oox/ppt/layoutfragmenthandler.hxx @@ -41,8 +41,7 @@ public: LayoutFragmentHandler( ::oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, SlidePersistPtr pMasterPersistPtr ) throw(); virtual ~LayoutFragmentHandler() throw(); - virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); }; } } diff --git a/oox/inc/oox/ppt/presentationfragmenthandler.hxx b/oox/inc/oox/ppt/presentationfragmenthandler.hxx index f4d46dba9afc..77db0d6dbdb4 100644 --- a/oox/inc/oox/ppt/presentationfragmenthandler.hxx +++ b/oox/inc/oox/ppt/presentationfragmenthandler.hxx @@ -33,7 +33,9 @@ #include <com/sun/star/awt/Size.hpp> #include "oox/drawingml/textliststyle.hxx" #include "oox/ppt/slidepersist.hxx" +#include "oox/core/contexthandler.hxx" #include "oox/core/fragmenthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" #include "oox/core/relations.hxx" #include "oox/ppt/customshowlistcontext.hxx" @@ -42,15 +44,13 @@ namespace oox { namespace ppt { -class PresentationFragmentHandler : public ::oox::core::FragmentHandler +class PresentationFragmentHandler : public ::oox::core::FragmentHandler2 { public: PresentationFragmentHandler( ::oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath ) throw(); virtual ~PresentationFragmentHandler() throw(); - - virtual void SAL_CALL startDocument( ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL endDocument( ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual void finalizeImport(); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); protected: bool importSlide( const ::oox::core::FragmentHandlerRef& rxSlideFragmentHandler, diff --git a/oox/inc/oox/ppt/slidefragmenthandler.hxx b/oox/inc/oox/ppt/slidefragmenthandler.hxx index b530d8cb2550..ce518e214511 100644 --- a/oox/inc/oox/ppt/slidefragmenthandler.hxx +++ b/oox/inc/oox/ppt/slidefragmenthandler.hxx @@ -31,7 +31,7 @@ #include <com/sun/star/drawing/XDrawPage.hpp> #include "oox/helper/propertymap.hxx" -#include "oox/core/fragmenthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" #include "oox/ppt/slidepersist.hxx" #include <stack> @@ -40,14 +40,14 @@ namespace oox { namespace ppt { -class SlideFragmentHandler : public ::oox::core::FragmentHandler +class SlideFragmentHandler : public ::oox::core::FragmentHandler2 { public: SlideFragmentHandler( ::oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, SlidePersistPtr pPersistPtr, const ShapeLocation eShapeLocation ) throw(); virtual ~SlideFragmentHandler() throw(); - virtual void SAL_CALL endDocument( ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual void finalizeImport(); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); protected: SlidePersistPtr mpSlidePersistPtr; diff --git a/oox/inc/oox/ppt/slidemastertextstylescontext.hxx b/oox/inc/oox/ppt/slidemastertextstylescontext.hxx index 9f232ee853c8..4381a289a6e1 100644 --- a/oox/inc/oox/ppt/slidemastertextstylescontext.hxx +++ b/oox/inc/oox/ppt/slidemastertextstylescontext.hxx @@ -31,17 +31,17 @@ #include "oox/drawingml/theme.hxx" #include "oox/core/contexthandler.hxx" -#include "oox/core/fragmenthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" #include "oox/ppt/slidepersist.hxx" namespace oox { namespace ppt { -class SlideMasterTextStylesContext : public oox::core::ContextHandler +class SlideMasterTextStylesContext : public oox::core::FragmentHandler2 { public: - SlideMasterTextStylesContext( ::oox::core::ContextHandler& rParent, SlidePersistPtr pSlidePersistPtr ); + SlideMasterTextStylesContext( ::oox::core::FragmentHandler2& rParent, SlidePersistPtr pSlidePersistPtr ); ~SlideMasterTextStylesContext(); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); protected: SlidePersistPtr mpSlidePersistPtr; diff --git a/oox/inc/oox/ppt/slidetimingcontext.hxx b/oox/inc/oox/ppt/slidetimingcontext.hxx index 76dbb7cd2790..a1ba2dd5e936 100644 --- a/oox/inc/oox/ppt/slidetimingcontext.hxx +++ b/oox/inc/oox/ppt/slidetimingcontext.hxx @@ -31,23 +31,20 @@ #include <com/sun/star/animations/XTimeContainer.hpp> #include "oox/ppt/timenode.hxx" -#include "oox/core/contexthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" #include <stack> #include <vector> namespace oox { namespace ppt { -class SlideTimingContext : public ::oox::core::ContextHandler +class SlideTimingContext : public ::oox::core::FragmentHandler2 { public: - SlideTimingContext( ::oox::core::ContextHandler& rParent, TimeNodePtrList & aTimeNodeList ) throw(); + SlideTimingContext( ::oox::core::FragmentHandler2& rParent, TimeNodePtrList & aTimeNodeList ) throw(); virtual ~SlideTimingContext() throw(); - virtual void SAL_CALL endDocument( ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL endFastElement( sal_Int32 aElement ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); private: TimeNodePtrList & maTimeNodeList; diff --git a/oox/inc/oox/ppt/slidetransitioncontext.hxx b/oox/inc/oox/ppt/slidetransitioncontext.hxx index 361a06f4b556..e6d2cbb729b1 100644 --- a/oox/inc/oox/ppt/slidetransitioncontext.hxx +++ b/oox/inc/oox/ppt/slidetransitioncontext.hxx @@ -29,26 +29,24 @@ #ifndef OOX_PPT_SLIDETRANSITIONCONTEXT #define OOX_PPT_SLIDETRANSITIONCONTEXT -#include "oox/core/contexthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" #include "oox/ppt/slidetransition.hxx" namespace oox { class PropertyMap; } namespace oox { namespace ppt { - class SlideTransitionContext : public ::oox::core::ContextHandler + class SlideTransitionContext : public ::oox::core::FragmentHandler2 { public: - SlideTransitionContext( ::oox::core::ContextHandler& rParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, + SlideTransitionContext( ::oox::core::FragmentHandler2& rParent, + const AttributeList& rAttributes, PropertyMap & aProperties ) throw(); virtual ~SlideTransitionContext() throw(); - virtual void SAL_CALL endFastElement( sal_Int32 aElement ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL - createFastChildContext( ::sal_Int32 Element, - const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) - throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual void onEndElement(); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); + private: PropertyMap& maSlideProperties; diff --git a/oox/inc/oox/ppt/soundactioncontext.hxx b/oox/inc/oox/ppt/soundactioncontext.hxx index 0ee8a88dc5dc..d368c1fad649 100644 --- a/oox/inc/oox/ppt/soundactioncontext.hxx +++ b/oox/inc/oox/ppt/soundactioncontext.hxx @@ -30,20 +30,20 @@ #ifndef OOX_PPT_SOUNDACTIONCONTEXT #define OOX_PPT_SOUNDACTIONCONTEXT -#include "oox/core/contexthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" namespace oox { class PropertyMap; } namespace oox { namespace ppt { -class SoundActionContext : public ::oox::core::ContextHandler +class SoundActionContext : public ::oox::core::FragmentHandler2 { public: - SoundActionContext( ::oox::core::ContextHandler& rParent, PropertyMap & aProperties ) throw(); + SoundActionContext( ::oox::core::FragmentHandler2& rParent, PropertyMap & aProperties ) throw(); virtual ~SoundActionContext() throw(); - virtual void SAL_CALL endFastElement( sal_Int32 aElement ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual void onEndElement(); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); private: PropertyMap& maSlideProperties; diff --git a/oox/inc/oox/ppt/timenodelistcontext.hxx b/oox/inc/oox/ppt/timenodelistcontext.hxx index 25c929cdaf67..75949a419077 100644 --- a/oox/inc/oox/ppt/timenodelistcontext.hxx +++ b/oox/inc/oox/ppt/timenodelistcontext.hxx @@ -29,7 +29,7 @@ #ifndef OOX_PPT_TIMENODELISTCONTEXT #define OOX_PPT_TIMENODELISTCONTEXT -#include "oox/core/contexthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" #include "oox/ppt/timenode.hxx" #include <com/sun/star/animations/XTimeContainer.hpp> @@ -37,15 +37,15 @@ namespace oox { namespace ppt { - class TimeNodeContext : public ::oox::core::ContextHandler + class TimeNodeContext : public ::oox::core::FragmentHandler2 { public: virtual ~TimeNodeContext() throw(); - static TimeNodeContext * SAL_CALL makeContext( ::oox::core::ContextHandler& rParent, sal_Int32 aElement, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ); + static TimeNodeContext * SAL_CALL makeContext( ::oox::core::FragmentHandler2& rParent, sal_Int32 aElement, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ); protected: - TimeNodeContext( ::oox::core::ContextHandler& rParent, sal_Int32 aElement, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) throw(); + TimeNodeContext( ::oox::core::FragmentHandler2& rParent, sal_Int32 aElement, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) throw(); sal_Int32 mnElement; TimeNodePtr mpNode; @@ -54,17 +54,14 @@ namespace oox { namespace ppt { /** FastParser context for XML_tnLst, XML_subTnLst and XML_childTnLst */ -class TimeNodeListContext : public ::oox::core::ContextHandler +class TimeNodeListContext : public ::oox::core::FragmentHandler2 { public: - TimeNodeListContext( ::oox::core::ContextHandler& rParent, TimeNodePtrList & aList ) throw(); + TimeNodeListContext( ::oox::core::FragmentHandler2& rParent, TimeNodePtrList & aList ) throw(); virtual ~TimeNodeListContext() throw(); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL - createFastChildContext( ::sal_Int32 Element, - const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) - throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); private: TimeNodePtrList & maList; diff --git a/oox/source/ppt/animvariantcontext.cxx b/oox/source/ppt/animvariantcontext.cxx index 7d0c9a6c153e..c559cbb56d18 100644 --- a/oox/source/ppt/animvariantcontext.cxx +++ b/oox/source/ppt/animvariantcontext.cxx @@ -48,8 +48,8 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace ppt { - AnimVariantContext::AnimVariantContext( ContextHandler& rParent, sal_Int32 aElement, Any & aValue ) - : ContextHandler( rParent ) + AnimVariantContext::AnimVariantContext( FragmentHandler2& rParent, sal_Int32 aElement, Any & aValue ) + : FragmentHandler2( rParent ) , mnElement( aElement ) , maValue( aValue ) { @@ -59,63 +59,52 @@ namespace oox { namespace ppt { { } - void SAL_CALL AnimVariantContext::endFastElement( sal_Int32 aElement ) - throw ( SAXException, RuntimeException) + void AnimVariantContext::onEndElement() { - if( ( aElement == mnElement ) && maColor.isUsed() ) + if( isCurrentElement( mnElement ) && maColor.isUsed() ) { maValue = makeAny( maColor.getColor( getFilter().getGraphicHelper() ) ); } } - Reference< XFastContextHandler > - SAL_CALL AnimVariantContext::createFastChildContext( ::sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) + ContextHandlerRef AnimVariantContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - AttributeList attribs(xAttribs); - switch( aElementToken ) { case PPT_TOKEN( boolVal ): { - bool val = attribs.getBool( XML_val, false ); + bool val = rAttribs.getBool( XML_val, false ); maValue = makeAny( val ); - break; + return this; } case PPT_TOKEN( clrVal ): - xRet.set( new ::oox::drawingml::ColorContext( *this, maColor ) ); + return new ::oox::drawingml::ColorContext( *this, maColor ); // we'll defer setting the Any until the end. - break; case PPT_TOKEN( fltVal ): { - double val = attribs.getDouble( XML_val, 0.0 ); + double val = rAttribs.getDouble( XML_val, 0.0 ); maValue = makeAny( val ); - break; + return this; } case PPT_TOKEN( intVal ): { - sal_Int32 val = attribs.getInteger( XML_val, 0 ); + sal_Int32 val = rAttribs.getInteger( XML_val, 0 ); maValue = makeAny( val ); - break; + return this; } case PPT_TOKEN( strVal ): { - OUString val = attribs.getString( XML_val, OUString() ); + OUString val = rAttribs.getString( XML_val, OUString() ); convertMeasure( val ); // ignore success or failure if it fails, use as is maValue = makeAny( val ); - break; + return this; } default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } diff --git a/oox/source/ppt/animvariantcontext.hxx b/oox/source/ppt/animvariantcontext.hxx index 7508cbef40b9..3c0c2a029bb5 100644 --- a/oox/source/ppt/animvariantcontext.hxx +++ b/oox/source/ppt/animvariantcontext.hxx @@ -34,20 +34,20 @@ #include <com/sun/star/uno/Any.hxx> -#include "oox/core/contexthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" #include "oox/drawingml/color.hxx" namespace oox { namespace ppt { /** context CT_TLAnimVariant */ class AnimVariantContext - : public ::oox::core::ContextHandler + : public ::oox::core::FragmentHandler2 { public: - AnimVariantContext( ::oox::core::ContextHandler& rParent, ::sal_Int32 aElement, ::com::sun::star::uno::Any & aValue ); + AnimVariantContext( ::oox::core::FragmentHandler2& rParent, ::sal_Int32 aElement, ::com::sun::star::uno::Any & aValue ); ~AnimVariantContext( ) throw( ); - virtual void SAL_CALL endFastElement( sal_Int32 /*aElement*/ ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void onEndElement(); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); private: ::sal_Int32 mnElement; diff --git a/oox/source/ppt/backgroundproperties.cxx b/oox/source/ppt/backgroundproperties.cxx index e3a3714417ff..bbc9940ad10b 100644 --- a/oox/source/ppt/backgroundproperties.cxx +++ b/oox/source/ppt/backgroundproperties.cxx @@ -29,6 +29,7 @@ #include "oox/ppt/backgroundproperties.hxx" #include "oox/drawingml/fillpropertiesgroupcontext.hxx" #include "oox/drawingml/drawingmltypes.hxx" +#include "oox/core/contexthandler2.hxx" using ::rtl::OUString; using namespace ::oox::core; @@ -38,27 +39,22 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace ppt { // --------------------------------------------------------------------- -BackgroundPropertiesContext::BackgroundPropertiesContext( ContextHandler& rParent, ::oox::drawingml::FillProperties& rFillProperties ) throw() -: ContextHandler( rParent ) +BackgroundPropertiesContext::BackgroundPropertiesContext( FragmentHandler2& rParent, ::oox::drawingml::FillProperties& rFillProperties ) +: FragmentHandler2( rParent ) , mrFillProperties( rFillProperties ) { } -Reference< XFastContextHandler > BackgroundPropertiesContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +::oox::core::ContextHandlerRef BackgroundPropertiesContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch( aElementToken ) { case PPT_TOKEN( fill ): // a:CT_FillEffect - break; + return this; } // FillPropertiesGroupContext - if( !xRet.is() ) - xRet = ::oox::drawingml::FillPropertiesContext::createFillContext( *this, aElementToken, xAttribs, mrFillProperties ); - - return xRet; + return dynamic_cast <ContextHandler *> (::oox::drawingml::FillPropertiesContext::createFillContext( *this, aElementToken, rAttribs.getFastAttributeList(), mrFillProperties ).get()); } } } diff --git a/oox/source/ppt/buildlistcontext.cxx b/oox/source/ppt/buildlistcontext.cxx index 11c07c484a91..cd0ea90964a6 100644 --- a/oox/source/ppt/buildlistcontext.cxx +++ b/oox/source/ppt/buildlistcontext.cxx @@ -38,10 +38,10 @@ using ::rtl::OUString; namespace oox { namespace ppt { - BuildListContext::BuildListContext( ContextHandler& rParent, + BuildListContext::BuildListContext( FragmentHandler2& rParent, const Reference< XFastAttributeList >& /*xAttribs*/, TimeNodePtrList & aTimeNodeList) - : ContextHandler( rParent ) + : FragmentHandler2( rParent ) , maTimeNodeList( aTimeNodeList ) , mbInBldGraphic( false ) , mbBuildAsOne( false ) @@ -52,9 +52,9 @@ namespace oox { namespace ppt { { } - void SAL_CALL BuildListContext::endFastElement( sal_Int32 aElement ) throw ( SAXException, RuntimeException) + void BuildListContext::onEndElement() { - switch( aElement ) + switch( getCurrentElement() ) { case PPT_TOKEN( bldGraphic ): mbInBldGraphic = false; @@ -64,12 +64,8 @@ namespace oox { namespace ppt { } } - Reference< XFastContextHandler > SAL_CALL BuildListContext::createFastChildContext( ::sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) + ::oox::core::ContextHandlerRef BuildListContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch( aElementToken ) { case PPT_TOKEN( bldAsOne ): @@ -77,36 +73,31 @@ namespace oox { namespace ppt { { mbBuildAsOne = true; } - break; + return this; case PPT_TOKEN( bldSub ): if( mbInBldGraphic ) { } - break; + return this; case PPT_TOKEN( bldGraphic ): { mbInBldGraphic = true; - AttributeList attribs( xAttribs ); - OUString sShapeId = xAttribs->getOptionalValue( XML_spid ); + OUString sShapeId = rAttribs.getString( XML_spid, OUString() ); // TODO -// bool uiExpand = attribs.getBool( XML_uiExpand, true ); +// bool uiExpand = rAttribs.getBool( XML_uiExpand, true ); /* this is unsigned */ -// sal_uInt32 nGroupId = attribs.getUnsignedInteger( XML_grpId, 0 ); - break; +// sal_uInt32 nGroupId = rAttribs.getUnsignedInteger( XML_grpId, 0 ); + return this; } case A_TOKEN( bldDgm ): case A_TOKEN( bldOleChart ): case A_TOKEN( bldP ): - - break; + return this; default: break; } - if( !xRet.is() ) - xRet.set(this); - - return xRet; + return this; } diff --git a/oox/source/ppt/buildlistcontext.hxx b/oox/source/ppt/buildlistcontext.hxx index 1c4e3949fa7b..f147fa8af215 100644 --- a/oox/source/ppt/buildlistcontext.hxx +++ b/oox/source/ppt/buildlistcontext.hxx @@ -32,25 +32,25 @@ #define OOX_PPT_BUILDLISTCONTEXT #include "oox/ppt/timenode.hxx" -#include "oox/core/contexthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" namespace oox { namespace ppt { /** CT_BuildList */ class BuildListContext - : public ::oox::core::ContextHandler + : public ::oox::core::FragmentHandler2 { public: - BuildListContext( ::oox::core::ContextHandler& rParent, + BuildListContext( ::oox::core::FragmentHandler2& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, TimeNodePtrList & aTimeNodeList); ~BuildListContext( ); - virtual void SAL_CALL endFastElement( sal_Int32 aElement ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual void onEndElement(); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& /*xAttribs*/ ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); private: TimeNodePtrList & maTimeNodeList; bool mbInBldGraphic; diff --git a/oox/source/ppt/commonbehaviorcontext.cxx b/oox/source/ppt/commonbehaviorcontext.cxx index 72c59f730053..2e24aa43adb6 100644 --- a/oox/source/ppt/commonbehaviorcontext.cxx +++ b/oox/source/ppt/commonbehaviorcontext.cxx @@ -53,7 +53,7 @@ using namespace ::com::sun::star::animations; namespace oox { namespace ppt { - CommonBehaviorContext::CommonBehaviorContext( ContextHandler& rParent, + CommonBehaviorContext::CommonBehaviorContext( FragmentHandler2& rParent, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) : TimeNodeContext( rParent, PPT_TOKEN( cBhvr ), xAttribs, pNode ) @@ -69,10 +69,9 @@ namespace oox { namespace ppt { - void SAL_CALL CommonBehaviorContext::endFastElement( sal_Int32 aElement ) - throw ( SAXException, RuntimeException) + void CommonBehaviorContext::onEndElement() { - switch( aElement ) + switch( getCurrentElement() ) { case PPT_TOKEN( cBhvr ): { @@ -126,8 +125,7 @@ namespace oox { namespace ppt { } - void CommonBehaviorContext::characters( const OUString& aChars ) - throw( SAXException, RuntimeException ) + void CommonBehaviorContext::onCharacters( const OUString& aChars ) { if( mbIsInAttrName ) { @@ -136,23 +134,17 @@ namespace oox { namespace ppt { } - Reference< XFastContextHandler > SAL_CALL CommonBehaviorContext::createFastChildContext( ::sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) + ::oox::core::ContextHandlerRef CommonBehaviorContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch ( aElementToken ) { case PPT_TOKEN( cTn ): - xRet.set( new CommonTimeNodeContext( *this, aElementToken, xAttribs, mpNode ) ); - break; + return new CommonTimeNodeContext( *this, aElementToken, rAttribs.getFastAttributeList(), mpNode ); case PPT_TOKEN( tgtEl ): - xRet.set( new TimeTargetElementContext( *this, mpNode->getTarget() ) ); - break; + return new TimeTargetElementContext( *this, mpNode->getTarget() ); case PPT_TOKEN( attrNameLst ): mbInAttrList = true; - break; + return this; case PPT_TOKEN( attrName ): { if( mbInAttrList ) @@ -164,16 +156,13 @@ namespace oox { namespace ppt { { OSL_TRACE( "OOX: Attribute Name outside an Attribute List" ); } - break; + return this; } default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } } } diff --git a/oox/source/ppt/commonbehaviorcontext.hxx b/oox/source/ppt/commonbehaviorcontext.hxx index e047bbc46c7f..4415687f0b06 100644 --- a/oox/source/ppt/commonbehaviorcontext.hxx +++ b/oox/source/ppt/commonbehaviorcontext.hxx @@ -50,24 +50,17 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - CommonBehaviorContext( ::oox::core::ContextHandler& rParent, + CommonBehaviorContext( ::oox::core::FragmentHandler2& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ); ~CommonBehaviorContext( ) throw( ); - virtual void SAL_CALL endFastElement( sal_Int32 aElement ) - throw ( ::com::sun::star::xml::sax::SAXException, - ::com::sun::star::uno::RuntimeException ); + virtual void onEndElement(); - virtual void SAL_CALL characters( const ::rtl::OUString& aChars ) - throw ( ::com::sun::star::xml::sax::SAXException, - ::com::sun::star::uno::RuntimeException ); + virtual void onCharacters( const ::rtl::OUString& aChars ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, - const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& /*xAttribs*/ ) - throw ( ::com::sun::star::xml::sax::SAXException, - ::com::sun::star::uno::RuntimeException ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); private: bool mbInAttrList; diff --git a/oox/source/ppt/commontimenodecontext.cxx b/oox/source/ppt/commontimenodecontext.cxx index ac88c8c67a1a..30b630cacf72 100644 --- a/oox/source/ppt/commontimenodecontext.cxx +++ b/oox/source/ppt/commontimenodecontext.cxx @@ -374,7 +374,7 @@ static OUString getConvertedSubType( sal_Int16 nPresetClass, sal_Int32 nPresetId // END CommonTimeNodeContext::CommonTimeNodeContext( - ContextHandler& rParent, + FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) @@ -614,39 +614,34 @@ static OUString getConvertedSubType( sal_Int16 nPresetClass, sal_Int32 nPresetId } - void SAL_CALL CommonTimeNodeContext::endFastElement( sal_Int32 aElement ) throw ( SAXException, RuntimeException) + void CommonTimeNodeContext::onEndElement() { - if( aElement == ( PPT_TOKEN( iterate ) ) ) + if( isCurrentElement( PPT_TOKEN( iterate ) ) ) { mbIterate = false; } } - Reference< XFastContextHandler > SAL_CALL CommonTimeNodeContext::createFastChildContext( ::sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw ( SAXException, RuntimeException ) + ::oox::core::ContextHandlerRef CommonTimeNodeContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; switch ( aElementToken ) { case PPT_TOKEN( childTnLst ): case PPT_TOKEN( subTnLst ): - xRet.set( new TimeNodeListContext( *this, mpNode->getChildren() ) ); - break; + return new TimeNodeListContext( *this, mpNode->getChildren() ); case PPT_TOKEN( stCondLst ): - xRet.set( new CondListContext( *this, aElementToken, xAttribs, mpNode, mpNode->getStartCondition() ) ); - break; + return new CondListContext( *this, aElementToken, rAttribs.getFastAttributeList(), mpNode, mpNode->getStartCondition() ); case PPT_TOKEN( endCondLst ): - xRet.set( new CondListContext( *this, aElementToken, xAttribs, mpNode, mpNode->getEndCondition() ) ); - break; + return new CondListContext( *this, aElementToken, rAttribs.getFastAttributeList(), mpNode, mpNode->getEndCondition() ); case PPT_TOKEN( endSync ): - xRet.set( new CondContext( *this, xAttribs, mpNode, mpNode->getEndSyncValue() ) ); - break; + return new CondContext( *this, rAttribs.getFastAttributeList(), mpNode, mpNode->getEndSyncValue() ); case PPT_TOKEN( iterate ): { - sal_Int32 nVal = xAttribs->getOptionalValueToken( XML_type, XML_el ); + sal_Int32 nVal = rAttribs.getToken( XML_type, XML_el ); if( nVal != 0 ) { // TODO put that in a function @@ -671,37 +666,31 @@ static OUString getConvertedSubType( sal_Int16 nPresetClass, sal_Int32 nPresetId mpNode->getNodeProperties()[ NP_ITERATETYPE ] <<= nEnum; } // in case of exception we ignore the whole tag. - AttributeList attribs( xAttribs ); // TODO what to do with this - /*bool bBackwards =*/ attribs.getBool( XML_backwards, false ); + /*bool bBackwards =*/ rAttribs.getBool( XML_backwards, false ); mbIterate = true; - break; + return this; } case PPT_TOKEN( tmAbs ): if( mbIterate ) { - AttributeList attribs( xAttribs ); - double fTime = attribs.getUnsigned( XML_val, 0 ); + double fTime = rAttribs.getUnsigned( XML_val, 0 ); // time in ms. property is in % TODO mpNode->getNodeProperties()[ NP_ITERATEINTERVAL ] <<= fTime; } - break; + return this; case PPT_TOKEN( tmPct ): if( mbIterate ) { - AttributeList attribs( xAttribs ); - double fPercent = (double)attribs.getUnsigned( XML_val, 0 ) / 100000.0; + double fPercent = (double)rAttribs.getUnsigned( XML_val, 0 ) / 100000.0; mpNode->getNodeProperties()[ NP_ITERATEINTERVAL ] <<= fPercent; } - break; + return this; default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } } } diff --git a/oox/source/ppt/commontimenodecontext.hxx b/oox/source/ppt/commontimenodecontext.hxx index cb67433ee398..0cdb8be7868e 100644 --- a/oox/source/ppt/commontimenodecontext.hxx +++ b/oox/source/ppt/commontimenodecontext.hxx @@ -44,12 +44,12 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - CommonTimeNodeContext( ::oox::core::ContextHandler& rParent, sal_Int32 aElement, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, const TimeNodePtr & pNode); + CommonTimeNodeContext( ::oox::core::FragmentHandler2& rParent, sal_Int32 aElement, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, const TimeNodePtr & pNode); ~CommonTimeNodeContext( ) throw( ); - virtual void SAL_CALL endFastElement( sal_Int32 aElement ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); + virtual void onEndElement(); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& /*xAttribs*/ ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); private: bool mbIterate; diff --git a/oox/source/ppt/conditioncontext.cxx b/oox/source/ppt/conditioncontext.cxx index 97dd7f9bfcd5..6be6b1f0753a 100644 --- a/oox/source/ppt/conditioncontext.cxx +++ b/oox/source/ppt/conditioncontext.cxx @@ -51,7 +51,7 @@ using namespace ::com::sun::star::animations; namespace oox { namespace ppt { - CondContext::CondContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, + CondContext::CondContext( FragmentHandler2& rParent, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode, AnimationCondition & aValue ) : TimeNodeContext( rParent, PPT_TOKEN( cond ), xAttribs, pNode ) , maCond( aValue ) @@ -116,10 +116,8 @@ namespace oox { namespace ppt { } } - Reference< XFastContextHandler > SAL_CALL CondContext::createFastChildContext( ::sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw ( SAXException, RuntimeException ) + ::oox::core::ContextHandlerRef CondContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch( aElementToken ) { case PPT_TOKEN( rtn ): @@ -127,7 +125,7 @@ namespace oox { namespace ppt { // ST_TLTriggerRuntimeNode { first, last, all } sal_Int32 aTok; sal_Int16 nEnum; - aTok = xAttribs->getOptionalValueToken( XML_val, XML_first ); + aTok = rAttribs.getToken( XML_val, XML_first ); switch( aTok ) { case XML_first: @@ -144,28 +142,23 @@ namespace oox { namespace ppt { } maCond.mnType = aElementToken; maCond.maValue = makeAny( nEnum ); - break; + return this; } case PPT_TOKEN( tn ): { maCond.mnType = aElementToken; - AttributeList attribs( xAttribs ); - sal_uInt32 nId = attribs.getUnsigned( XML_val, 0 ); + sal_uInt32 nId = rAttribs.getUnsigned( XML_val, 0 ); maCond.maValue = makeAny( nId ); - break; + return this; } case PPT_TOKEN( tgtEl ): // CT_TLTimeTargetElement - xRet.set( new TimeTargetElementContext( *this, maCond.getTarget() ) ); - break; + return new TimeTargetElementContext( *this, maCond.getTarget() ); default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } @@ -173,7 +166,7 @@ namespace oox { namespace ppt { /** CT_TLTimeConditionList */ CondListContext::CondListContext( - ContextHandler& rParent, sal_Int32 aElement, + FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode, AnimationConditionList & aCond ) @@ -187,25 +180,19 @@ namespace oox { namespace ppt { { } - Reference< XFastContextHandler > CondListContext::createFastChildContext( ::sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs ) throw ( SAXException, RuntimeException ) + ::oox::core::ContextHandlerRef CondListContext::onCreateContext( sal_Int32 aElement, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch( aElement ) { case PPT_TOKEN( cond ): // add a condition to the list maConditions.push_back( AnimationCondition() ); - xRet.set( new CondContext( *this, xAttribs, mpNode, maConditions.back() ) ); + return new CondContext( *this, rAttribs.getFastAttributeList(), mpNode, maConditions.back() ); break; default: break; } - - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } diff --git a/oox/source/ppt/conditioncontext.hxx b/oox/source/ppt/conditioncontext.hxx index 3abd050da006..ff387a123193 100644 --- a/oox/source/ppt/conditioncontext.hxx +++ b/oox/source/ppt/conditioncontext.hxx @@ -46,11 +46,11 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - CondContext( ::oox::core::ContextHandler& rParent, + CondContext( ::oox::core::FragmentHandler2& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, const TimeNodePtr & pNode, AnimationCondition & aCond ); ~CondContext( ) throw( ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); private: // ::com::sun::star::uno::Any & maCond; @@ -66,13 +66,13 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - CondListContext( ::oox::core::ContextHandler& rParent, + CondListContext( ::oox::core::FragmentHandler2& rParent, sal_Int32 aElement, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, const TimeNodePtr & pNode, AnimationConditionList & aCondList ); ~CondListContext( ) throw( ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& /*xAttribs*/ ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); private: AnimationConditionList & maConditions; diff --git a/oox/source/ppt/customshowlistcontext.cxx b/oox/source/ppt/customshowlistcontext.cxx index 76bac5b7467c..c75ee4e8a370 100644 --- a/oox/source/ppt/customshowlistcontext.cxx +++ b/oox/source/ppt/customshowlistcontext.cxx @@ -34,24 +34,22 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace ppt { -class CustomShowContext : public ::oox::core::ContextHandler +class CustomShowContext : public ::oox::core::FragmentHandler2 { CustomShow mrCustomShow; public: - CustomShowContext( ::oox::core::ContextHandler& rParent, + CustomShowContext( ::oox::core::FragmentHandler2& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, CustomShow& rCustomShow ); ~CustomShowContext( ); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL - createFastChildContext( ::sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& /*xAttribs*/ ) - throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); }; -CustomShowContext::CustomShowContext( ContextHandler& rParent, +CustomShowContext::CustomShowContext( FragmentHandler2& rParent, const Reference< XFastAttributeList >& rxAttribs, CustomShow& rCustomShow ) -: ContextHandler( rParent ) +: FragmentHandler2( rParent ) , mrCustomShow( rCustomShow ) { mrCustomShow.maName = rxAttribs->getOptionalValue( XML_name ); @@ -62,29 +60,25 @@ CustomShowContext::~CustomShowContext( ) { } -Reference< XFastContextHandler > SAL_CALL CustomShowContext::createFastChildContext( sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) +::oox::core::ContextHandlerRef CustomShowContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; switch( aElementToken ) { case PPT_TOKEN( sld ) : - mrCustomShow.maSldLst.push_back( xAttribs->getOptionalValue( R_TOKEN( id ) ) ); + mrCustomShow.maSldLst.push_back( rAttribs.getString( R_TOKEN( id ), rtl::OUString() ) ); + return this; default: break; } - if( !xRet.is() ) - xRet.set( this ); - return xRet; + return this; } //--------------------------------------------------------------------------- -CustomShowListContext::CustomShowListContext( ContextHandler& rParent, +CustomShowListContext::CustomShowListContext( FragmentHandler2& rParent, std::vector< CustomShow >& rCustomShowList ) -: ContextHandler( rParent ) +: FragmentHandler2( rParent ) , mrCustomShowList( rCustomShowList ) { } @@ -93,26 +87,21 @@ CustomShowListContext::~CustomShowListContext( ) { } -Reference< XFastContextHandler > SAL_CALL CustomShowListContext::createFastChildContext( sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) +::oox::core::ContextHandlerRef CustomShowListContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; switch( aElementToken ) { case PPT_TOKEN( custShow ) : { CustomShow aCustomShow; mrCustomShowList.push_back( aCustomShow ); - xRet = new CustomShowContext( *this, xAttribs, mrCustomShowList.back() ); + return new CustomShowContext( *this, rAttribs.getFastAttributeList(), mrCustomShowList.back() ); } default: break; } - if( !xRet.is() ) - xRet.set( this ); - return xRet; + return this; } diff --git a/oox/source/ppt/headerfootercontext.cxx b/oox/source/ppt/headerfootercontext.cxx index 88a1e7c60894..83963585bd0d 100644 --- a/oox/source/ppt/headerfootercontext.cxx +++ b/oox/source/ppt/headerfootercontext.cxx @@ -35,26 +35,25 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace ppt { - HeaderFooterContext::HeaderFooterContext( ContextHandler& rParent, - const Reference< XFastAttributeList >& xAttribs, HeaderFooter& rHeaderFooter ) - : ContextHandler( rParent ) + HeaderFooterContext::HeaderFooterContext( FragmentHandler2& rParent, + const AttributeList& rAttribs, HeaderFooter& rHeaderFooter ) + : FragmentHandler2( rParent ) { - AttributeList aAttribs( xAttribs ); - if ( xAttribs->hasAttribute( XML_sldNum ) ) + if ( rAttribs.hasAttribute( XML_sldNum ) ) { - rHeaderFooter.mbSlideNumber = aAttribs.getBool( XML_sldNum, sal_True ); + rHeaderFooter.mbSlideNumber = rAttribs.getBool( XML_sldNum, sal_True ); } - if ( xAttribs->hasAttribute( XML_hdr ) ) + if ( rAttribs.hasAttribute( XML_hdr ) ) { - rHeaderFooter.mbHeader = aAttribs.getBool( XML_hdr, sal_True ); + rHeaderFooter.mbHeader = rAttribs.getBool( XML_hdr, sal_True ); } - if ( xAttribs->hasAttribute( XML_ftr ) ) + if ( rAttribs.hasAttribute( XML_ftr ) ) { - rHeaderFooter.mbFooter = aAttribs.getBool( XML_ftr, sal_True ); + rHeaderFooter.mbFooter = rAttribs.getBool( XML_ftr, sal_True ); } - if ( xAttribs->hasAttribute( XML_dt ) ) + if ( rAttribs.hasAttribute( XML_dt ) ) { - rHeaderFooter.mbDateTime = aAttribs.getBool( XML_dt, sal_True ); + rHeaderFooter.mbDateTime = rAttribs.getBool( XML_dt, sal_True ); } } diff --git a/oox/source/ppt/headerfootercontext.hxx b/oox/source/ppt/headerfootercontext.hxx index 7cd83b5f53e4..4cc78b9e7dcf 100644 --- a/oox/source/ppt/headerfootercontext.hxx +++ b/oox/source/ppt/headerfootercontext.hxx @@ -32,16 +32,16 @@ #define OOX_PPT_HEADERFOOTERCONTEXT #include "oox/ppt/headerfooter.hxx" -#include "oox/core/contexthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" namespace oox { namespace ppt { /** CT_HeaderFooter */ - class HeaderFooterContext : public ::oox::core::ContextHandler + class HeaderFooterContext : public ::oox::core::FragmentHandler2 { public: - HeaderFooterContext( ::oox::core::ContextHandler& rParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, HeaderFooter& rHeaderFooter ); + HeaderFooterContext( ::oox::core::FragmentHandler2& rParent, + const AttributeList& rAttribs, HeaderFooter& rHeaderFooter ); ~HeaderFooterContext( ); }; diff --git a/oox/source/ppt/layoutfragmenthandler.cxx b/oox/source/ppt/layoutfragmenthandler.cxx index 19a9e6ead026..6697f8190db2 100644 --- a/oox/source/ppt/layoutfragmenthandler.cxx +++ b/oox/source/ppt/layoutfragmenthandler.cxx @@ -60,27 +60,20 @@ LayoutFragmentHandler::~LayoutFragmentHandler() } -Reference< XFastContextHandler > LayoutFragmentHandler::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) - throw (SAXException, RuntimeException) +ContextHandlerRef LayoutFragmentHandler::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet = getFastContextHandler(); switch( aElementToken ) { case PPT_TOKEN( sldLayout ): // CT_SlideLayout - mpSlidePersistPtr->setLayoutValueToken( xAttribs->getOptionalValueToken( XML_type, 0 ) ); // CT_SlideLayoutType + mpSlidePersistPtr->setLayoutValueToken( rAttribs.getToken( XML_type, 0 ) ); // CT_SlideLayoutType break; case PPT_TOKEN( hf ): // CT_HeaderFooter - xRet.set( new HeaderFooterContext( *this, xAttribs, mpSlidePersistPtr->getHeaderFooter() ) ); + return new HeaderFooterContext( *this, rAttribs, mpSlidePersistPtr->getHeaderFooter() ); break; default: - xRet.set( SlideFragmentHandler::createFastChildContext( aElementToken, xAttribs ) ); + return SlideFragmentHandler::onCreateContext( aElementToken, rAttribs ); } - return xRet; -} - -void SAL_CALL LayoutFragmentHandler::endDocument() - throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) -{ + return this; } } } diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx index 31a2781d845b..e9fe6994472e 100644 --- a/oox/source/ppt/presentationfragmenthandler.cxx +++ b/oox/source/ppt/presentationfragmenthandler.cxx @@ -61,7 +61,7 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace ppt { PresentationFragmentHandler::PresentationFragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath ) throw() -: FragmentHandler( rFilter, rFragmentPath ) +: FragmentHandler2( rFilter, rFragmentPath ) , mpTextListStyle( new TextListStyle ) { TextParagraphPropertiesVector& rParagraphDefaulsVector( mpTextListStyle->getListStyle() ); @@ -76,10 +76,6 @@ PresentationFragmentHandler::PresentationFragmentHandler( XmlFilterBase& rFilter PresentationFragmentHandler::~PresentationFragmentHandler() throw() { - -} -void PresentationFragmentHandler::startDocument() throw (SAXException, RuntimeException) -{ } void ResolveTextFields( XmlFilterBase& rFilter ) @@ -142,7 +138,7 @@ void ResolveTextFields( XmlFilterBase& rFilter ) } } -void PresentationFragmentHandler::endDocument() throw (SAXException, RuntimeException) +void PresentationFragmentHandler::finalizeImport() { // todo: localized progress bar text const Reference< task::XStatusIndicator >& rxStatusIndicator( getFilter().getStatusIndicator() ); @@ -300,41 +296,36 @@ void PresentationFragmentHandler::endDocument() throw (SAXException, RuntimeExce } // CT_Presentation -Reference< XFastContextHandler > PresentationFragmentHandler::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +::oox::core::ContextHandlerRef PresentationFragmentHandler::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; switch( aElementToken ) { case PPT_TOKEN( presentation ): case PPT_TOKEN( sldMasterIdLst ): case PPT_TOKEN( notesMasterIdLst ): case PPT_TOKEN( sldIdLst ): - break; + return this; case PPT_TOKEN( sldMasterId ): - maSlideMasterVector.push_back( xAttribs->getOptionalValue( R_TOKEN( id ) ) ); - break; + maSlideMasterVector.push_back( rAttribs.getString( R_TOKEN( id ), OUString() ) ); + return this; case PPT_TOKEN( sldId ): - maSlidesVector.push_back( xAttribs->getOptionalValue( R_TOKEN( id ) ) ); - break; + maSlidesVector.push_back( rAttribs.getString( R_TOKEN( id ), OUString() ) ); + return this; case PPT_TOKEN( notesMasterId ): - maNotesMasterVector.push_back( xAttribs->getOptionalValue(R_TOKEN( id ) ) ); - break; + maNotesMasterVector.push_back( rAttribs.getString( R_TOKEN( id ), OUString() ) ); + return this; case PPT_TOKEN( sldSz ): - maSlideSize = GetSize2D( xAttribs ); - break; + maSlideSize = GetSize2D( rAttribs.getFastAttributeList() ); + return this; case PPT_TOKEN( notesSz ): - maNotesSize = GetSize2D( xAttribs ); - break; + maNotesSize = GetSize2D( rAttribs.getFastAttributeList() ); + return this; case PPT_TOKEN( custShowLst ): - xRet.set( new CustomShowListContext( *this, maCustomShowList ) ); - break; + return new CustomShowListContext( *this, maCustomShowList ); case PPT_TOKEN( defaultTextStyle ): - xRet.set( new TextListStyleContext( *this, *mpTextListStyle ) ); - break; + return new TextListStyleContext( *this, *mpTextListStyle ); } - if ( !xRet.is() ) - xRet = getFastContextHandler(); - return xRet; + return this; } bool PresentationFragmentHandler::importSlide( const FragmentHandlerRef& rxSlideFragmentHandler, diff --git a/oox/source/ppt/slidefragmenthandler.cxx b/oox/source/ppt/slidefragmenthandler.cxx index 48a53a5f7e1f..4652690e7765 100644 --- a/oox/source/ppt/slidefragmenthandler.cxx +++ b/oox/source/ppt/slidefragmenthandler.cxx @@ -59,7 +59,7 @@ using namespace ::com::sun::star::container; namespace oox { namespace ppt { SlideFragmentHandler::SlideFragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath, SlidePersistPtr pPersistPtr, const ShapeLocation eShapeLocation ) throw() -: FragmentHandler( rFilter, rFragmentPath ) +: FragmentHandler2( rFilter, rFragmentPath ) , mpSlidePersistPtr( pPersistPtr ) , meShapeLocation( eShapeLocation ) { @@ -75,109 +75,102 @@ SlideFragmentHandler::~SlideFragmentHandler() throw() mpSlidePersistPtr->getDrawing()->convertAndInsert(); } -Reference< XFastContextHandler > SlideFragmentHandler::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +::oox::core::ContextHandlerRef SlideFragmentHandler::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - AttributeList aAttribs( xAttribs ); - switch( aElementToken ) { case PPT_TOKEN( sldMaster ): // CT_SlideMaster case PPT_TOKEN( handoutMaster ): // CT_HandoutMaster case PPT_TOKEN( sld ): // CT_CommonSlideData { - AttributeList attribs( xAttribs ); - Reference< XDrawPage > xSlide( mpSlidePersistPtr->getPage() ); PropertyMap aPropMap; PropertySet aSlideProp( xSlide ); - aPropMap[ PROP_Visible ] = Any( attribs.getBool( XML_show, sal_True ) ); + aPropMap[ PROP_Visible ] = Any( rAttribs.getBool( XML_show, sal_True ) ); aSlideProp.setProperties( aPropMap ); - break; + return this; } case PPT_TOKEN( notes ): // CT_NotesSlide case PPT_TOKEN( notesMaster ): // CT_NotesMaster - break; + return this; case PPT_TOKEN( cSld ): // CT_CommonSlideData - maSlideName = xAttribs->getOptionalValue(XML_name); - break; + maSlideName = rAttribs.getString(XML_name, OUString()); + return this; case PPT_TOKEN( spTree ): // CT_GroupShape { - xRet.set( new PPTShapeGroupContext( + // TODO Convert this to FragmentHandler2 + return new PPTShapeGroupContext( *this, mpSlidePersistPtr, meShapeLocation, mpSlidePersistPtr->getShapes(), - oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.GroupShape" ) ) ) ); + oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.GroupShape" ) ) ); } break; case PPT_TOKEN( controls ): - xRet = getFastContextHandler(); - break; + return this; case PPT_TOKEN( control ): { ::oox::vml::ControlInfo aInfo; - aInfo.setShapeId( aAttribs.getInteger( XML_spid, 0 ) ); - aInfo.maFragmentPath = getFragmentPathFromRelId( aAttribs.getString( R_TOKEN( id ), OUString() ) ); - aInfo.maName = aAttribs.getXString( XML_name, OUString() ); + aInfo.setShapeId( rAttribs.getInteger( XML_spid, 0 ) ); + aInfo.maFragmentPath = getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( id ), OUString() ) ); + aInfo.maName = rAttribs.getXString( XML_name, OUString() ); mpSlidePersistPtr->getDrawing()->registerControl( aInfo ); } - return xRet; + return this; case PPT_TOKEN( timing ): // CT_SlideTiming - xRet.set( new SlideTimingContext( *this, mpSlidePersistPtr->getTimeNodeList() ) ); - break; + return new SlideTimingContext( *this, mpSlidePersistPtr->getTimeNodeList() ); case PPT_TOKEN( transition ): // CT_SlideTransition - xRet.set( new SlideTransitionContext( *this, xAttribs, maSlideProperties ) ); - break; + return new SlideTransitionContext( *this, rAttribs, maSlideProperties ); case PPT_TOKEN( hf ): - xRet.set( new HeaderFooterContext( *this, xAttribs, mpSlidePersistPtr->getHeaderFooter() ) ); - break; + return new HeaderFooterContext( *this, rAttribs, mpSlidePersistPtr->getHeaderFooter() ); // BackgroundGroup + case PPT_TOKEN( bg ): + return this; case PPT_TOKEN( bgPr ): // CT_BackgroundProperties { FillPropertiesPtr pFillPropertiesPtr( new FillProperties ); - xRet.set( new BackgroundPropertiesContext( *this, *pFillPropertiesPtr ) ); mpSlidePersistPtr->setBackgroundProperties( pFillPropertiesPtr ); + return new BackgroundPropertiesContext( *this, *pFillPropertiesPtr ); } break; case PPT_TOKEN( bgRef ): // a:CT_StyleMatrixReference { FillPropertiesPtr pFillPropertiesPtr( new FillProperties( - *mpSlidePersistPtr->getTheme()->getFillStyle( xAttribs->getOptionalValue( XML_idx ).toInt32() ) ) ); - xRet.set( new ColorContext( *this, mpSlidePersistPtr->getBackgroundColor() ) ); + *mpSlidePersistPtr->getTheme()->getFillStyle( rAttribs.getInteger( XML_idx, -1 ) ) ) ); + ContextHandlerRef ret = new ColorContext( *this, mpSlidePersistPtr->getBackgroundColor() ); mpSlidePersistPtr->setBackgroundProperties( pFillPropertiesPtr ); + return ret; } break; case PPT_TOKEN( clrMap ): // CT_ColorMapping { oox::drawingml::ClrMapPtr pClrMapPtr( new oox::drawingml::ClrMap() ); - xRet.set( new oox::drawingml::clrMapContext( *this, xAttribs, *pClrMapPtr ) ); + ContextHandlerRef ret = new oox::drawingml::clrMapContext( *this, rAttribs.getFastAttributeList(), *pClrMapPtr ); mpSlidePersistPtr->setClrMap( pClrMapPtr ); + return ret; } break; case PPT_TOKEN( clrMapOvr ): // CT_ColorMappingOverride case PPT_TOKEN( sldLayoutIdLst ): // CT_SlideLayoutIdList - break; + return this; case PPT_TOKEN( txStyles ): // CT_SlideMasterTextStyles - xRet.set( new SlideMasterTextStylesContext( *this, mpSlidePersistPtr ) ); + return new SlideMasterTextStylesContext( *this, mpSlidePersistPtr ); break; case PPT_TOKEN( custDataLst ): // CT_CustomerDataList case PPT_TOKEN( tagLst ): // CT_TagList - break; + return this; } - if( !xRet.is() ) - xRet = getFastContextHandler(); - - return xRet; + return this; } -void SAL_CALL SlideFragmentHandler::endDocument( ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) +void SlideFragmentHandler::finalizeImport() { try { diff --git a/oox/source/ppt/slidemastertextstylescontext.cxx b/oox/source/ppt/slidemastertextstylescontext.cxx index 08b7aaf4af7c..2d1e59c0382d 100644 --- a/oox/source/ppt/slidemastertextstylescontext.cxx +++ b/oox/source/ppt/slidemastertextstylescontext.cxx @@ -37,8 +37,8 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace ppt { -SlideMasterTextStylesContext::SlideMasterTextStylesContext( ContextHandler& rParent, SlidePersistPtr pSlidePersistPtr ) -: ContextHandler( rParent ) +SlideMasterTextStylesContext::SlideMasterTextStylesContext( FragmentHandler2& rParent, SlidePersistPtr pSlidePersistPtr ) +: FragmentHandler2( rParent ) , mpSlidePersistPtr( pSlidePersistPtr ) { } @@ -47,10 +47,9 @@ SlideMasterTextStylesContext::~SlideMasterTextStylesContext() { } -Reference< XFastContextHandler > SlideMasterTextStylesContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& /* xAttribs */ ) throw (SAXException, RuntimeException) +::oox::core::ContextHandlerRef SlideMasterTextStylesContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& /*rAttribs*/ ) { oox::drawingml::TextListStylePtr aTextListStylePtr; - Reference< XFastContextHandler > xRet; switch( aElementToken ) { case PPT_TOKEN( titleStyle ): @@ -78,12 +77,10 @@ Reference< XFastContextHandler > SlideMasterTextStylesContext::createFastChildCo { // are obtained. i got some documents without having the textsize set at for ( int i = 0; i < 9; i++ ) // any point, the master reference application is using 18pt then aTextListStylePtr->getListStyle()[ i ]->getTextCharacterProperties().moHeight = 1800; - xRet.set( new oox::drawingml::TextListStyleContext( *this, *aTextListStylePtr ) ); + return new oox::drawingml::TextListStyleContext( *this, *aTextListStylePtr ); } - if( !xRet.is() ) - xRet.set( this ); - return xRet; + return this; } } } diff --git a/oox/source/ppt/slidetimingcontext.cxx b/oox/source/ppt/slidetimingcontext.cxx index 6c4fcf76a9d2..31738a580e57 100644 --- a/oox/source/ppt/slidetimingcontext.cxx +++ b/oox/source/ppt/slidetimingcontext.cxx @@ -49,8 +49,8 @@ using namespace ::com::sun::star::container; namespace oox { namespace ppt { -SlideTimingContext::SlideTimingContext( ContextHandler& rParent, TimeNodePtrList & aTimeNodeList ) throw() - : ContextHandler( rParent ) +SlideTimingContext::SlideTimingContext( FragmentHandler2& rParent, TimeNodePtrList & aTimeNodeList ) throw() + : FragmentHandler2( rParent ) , maTimeNodeList( aTimeNodeList ) { } @@ -60,42 +60,26 @@ SlideTimingContext::~SlideTimingContext() throw() } -void SlideTimingContext::endFastElement( sal_Int32 /*aElement*/ ) throw ( SAXException, RuntimeException) +::oox::core::ContextHandlerRef SlideTimingContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { -} - - -Reference< XFastContextHandler > SlideTimingContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) -{ - Reference< XFastContextHandler > xRet; - switch( aElementToken ) { case PPT_TOKEN( bldLst ): - xRet.set( new BuildListContext( *this, xAttribs, maTimeNodeList ) ); - break; + return new BuildListContext( *this, rAttribs.getFastAttributeList(), maTimeNodeList ); case PPT_TOKEN( extLst ): - return xRet; + return this; case PPT_TOKEN( tnLst ): // timing nodes { - xRet.set( new TimeNodeListContext( *this, maTimeNodeList ) ); + return new TimeNodeListContext( *this, maTimeNodeList ); } break; default: - break; + return this; } - if( !xRet.is() ) - xRet.set(this); - - return xRet; -} - -void SAL_CALL SlideTimingContext::endDocument( ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException) -{ - + return this; } } } diff --git a/oox/source/ppt/slidetransitioncontext.cxx b/oox/source/ppt/slidetransitioncontext.cxx index c7f61912f44e..c74e0d89a2a7 100644 --- a/oox/source/ppt/slidetransitioncontext.cxx +++ b/oox/source/ppt/slidetransitioncontext.cxx @@ -51,23 +51,21 @@ using namespace ::com::sun::star::container; namespace oox { namespace ppt { -SlideTransitionContext::SlideTransitionContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, PropertyMap & aProperties ) throw() -: ContextHandler( rParent ) +SlideTransitionContext::SlideTransitionContext( FragmentHandler2& rParent, const AttributeList& rAttribs, PropertyMap & aProperties ) throw() +: FragmentHandler2( rParent ) , maSlideProperties( aProperties ) , mbHasTransition( sal_False ) { - AttributeList attribs(xAttribs); - // ST_TransitionSpeed - maTransition.setOoxTransitionSpeed( xAttribs->getOptionalValueToken( XML_spd, XML_fast ) ); + maTransition.setOoxTransitionSpeed( rAttribs.getToken( XML_spd, XML_fast ) ); // TODO - attribs.getBool( XML_advClick, true ); + rAttribs.getBool( XML_advClick, true ); // careful. if missing, no auto advance... 0 looks like a valid value // for auto advance - if(attribs.hasAttribute( XML_advTm )) - maTransition.setOoxAdvanceTime( attribs.getInteger( XML_advTm, -1 ) ); + if(rAttribs.hasAttribute( XML_advTm )) + maTransition.setOoxAdvanceTime( rAttribs.getInteger( XML_advTm, -1 ) ); } SlideTransitionContext::~SlideTransitionContext() throw() @@ -75,10 +73,8 @@ SlideTransitionContext::~SlideTransitionContext() throw() } -Reference< XFastContextHandler > SlideTransitionContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +::oox::core::ContextHandlerRef SlideTransitionContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch( aElementToken ) { case PPT_TOKEN( blinds ): @@ -88,67 +84,65 @@ Reference< XFastContextHandler > SlideTransitionContext::createFastChildContext( if (!mbHasTransition) { mbHasTransition = true; - maTransition.setOoxTransitionType( aElementToken, xAttribs->getOptionalValueToken( XML_dir, XML_horz ), 0); + maTransition.setOoxTransitionType( aElementToken, rAttribs.getToken( XML_dir, XML_horz ), 0); // ST_Direction { XML_horz, XML_vert } } - break; + return this; case PPT_TOKEN( cover ): case PPT_TOKEN( pull ): if (!mbHasTransition) { mbHasTransition = true; - maTransition.setOoxTransitionType( aElementToken, xAttribs->getOptionalValueToken( XML_dir, XML_l ), 0 ); + maTransition.setOoxTransitionType( aElementToken, rAttribs.getToken( XML_dir, XML_l ), 0 ); // ST_TransitionEightDirectionType { ST_TransitionSideDirectionType { // XML_d, XML_d, XML_r, XML_u }, // ST_TransitionCornerDirectionType { // XML_ld, XML_lu, XML_rd, XML_ru } } - break; + return this; case PPT_TOKEN( cut ): case PPT_TOKEN( fade ): if (!mbHasTransition) { mbHasTransition = true; - AttributeList attribs(xAttribs); // CT_OptionalBlackTransition xdb:bool - maTransition.setOoxTransitionType( aElementToken, attribs.getBool( XML_thruBlk, false ), 0); + maTransition.setOoxTransitionType( aElementToken, rAttribs.getBool( XML_thruBlk, false ), 0); } - break; + return this; case PPT_TOKEN( push ): case PPT_TOKEN( wipe ): if (!mbHasTransition) { mbHasTransition = true; - maTransition.setOoxTransitionType( aElementToken, xAttribs->getOptionalValueToken( XML_dir, XML_l ), 0 ); + maTransition.setOoxTransitionType( aElementToken, rAttribs.getToken( XML_dir, XML_l ), 0 ); // ST_TransitionSideDirectionType { XML_d, XML_l, XML_r, XML_u } } - break; + return this; case PPT_TOKEN( split ): if (!mbHasTransition) { mbHasTransition = true; - maTransition.setOoxTransitionType( aElementToken, xAttribs->getOptionalValueToken( XML_orient, XML_horz ), xAttribs->getOptionalValueToken( XML_dir, XML_out ) ); + maTransition.setOoxTransitionType( aElementToken, rAttribs.getToken( XML_orient, XML_horz ), rAttribs.getToken( XML_dir, XML_out ) ); // ST_Direction { XML_horz, XML_vert } // ST_TransitionInOutDirectionType { XML_out, XML_in } } - break; + return this; case PPT_TOKEN( zoom ): if (!mbHasTransition) { mbHasTransition = true; - maTransition.setOoxTransitionType( aElementToken, xAttribs->getOptionalValueToken( XML_dir, XML_out ), 0 ); + maTransition.setOoxTransitionType( aElementToken, rAttribs.getToken( XML_dir, XML_out ), 0 ); // ST_TransitionInOutDirectionType { XML_out, XML_in } } - break; + return this; case PPT_TOKEN( wheel ): if (!mbHasTransition) { mbHasTransition = true; - AttributeList attribs(xAttribs); - maTransition.setOoxTransitionType( aElementToken, attribs.getUnsigned( XML_spokes, 4 ), 0 ); + maTransition.setOoxTransitionType( aElementToken, rAttribs.getUnsigned( XML_spokes, 4 ), 0 ); // unsignedInt } - break; + return this; case PPT_TOKEN( circle ): case PPT_TOKEN( diamond ): case PPT_TOKEN( dissolve ): @@ -162,28 +156,23 @@ Reference< XFastContextHandler > SlideTransitionContext::createFastChildContext( mbHasTransition = true; maTransition.setOoxTransitionType( aElementToken, 0, 0 ); } - break; - + return this; case PPT_TOKEN( sndAc ): // CT_TransitionSoundAction //"Sound" - xRet.set( new SoundActionContext ( *this, maSlideProperties ) ); - break; + return new SoundActionContext ( *this, maSlideProperties ); case PPT_TOKEN( extLst ): // CT_OfficeArtExtensionList - return xRet; + return this; default: break; } - if( !xRet.is() ) - xRet.set(this); - - return xRet; + return this; } -void SlideTransitionContext::endFastElement( sal_Int32 aElement ) throw (::com::sun::star::xml::sax::SAXException, RuntimeException) +void SlideTransitionContext::onEndElement() { - if( aElement == (PPT_TOKEN( transition )) ) + if( isCurrentElement(PPT_TOKEN( transition )) ) { if( mbHasTransition ) { diff --git a/oox/source/ppt/soundactioncontext.cxx b/oox/source/ppt/soundactioncontext.cxx index 64a24963ab66..7b510beda983 100644 --- a/oox/source/ppt/soundactioncontext.cxx +++ b/oox/source/ppt/soundactioncontext.cxx @@ -44,8 +44,8 @@ using namespace ::com::sun::star::uno; namespace oox { namespace ppt { - SoundActionContext::SoundActionContext( ContextHandler& rParent, PropertyMap & aProperties ) throw() - : ContextHandler( rParent ) + SoundActionContext::SoundActionContext( FragmentHandler2& rParent, PropertyMap & aProperties ) throw() + : FragmentHandler2( rParent ) , maSlideProperties( aProperties ) , mbHasStartSound( false ) , mbLoopSound( false ) @@ -59,9 +59,9 @@ namespace oox { namespace ppt { } - void SoundActionContext::endFastElement( sal_Int32 aElement ) throw (SAXException, RuntimeException) + void SoundActionContext::onEndElement() { - if ( aElement == PPT_TOKEN( sndAc ) ) + if ( isCurrentElement( PPT_TOKEN( sndAc ) ) ) { if( mbHasStartSound ) { @@ -97,37 +97,32 @@ namespace oox { namespace ppt { } - Reference< XFastContextHandler > SoundActionContext::createFastChildContext( ::sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) + ::oox::core::ContextHandlerRef SoundActionContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - AttributeList attribs(xAttribs); - - switch( aElement ) + switch( aElementToken ) { case PPT_TOKEN( snd ): if( mbHasStartSound ) { drawingml::EmbeddedWAVAudioFile aAudio; - drawingml::getEmbeddedWAVAudioFile( getRelations(), xAttribs, aAudio); + drawingml::getEmbeddedWAVAudioFile( getRelations(), rAttribs.getFastAttributeList(), aAudio); msSndName = ( aAudio.mbBuiltIn ? aAudio.msName : aAudio.msEmbed ); } - break; + return this; case PPT_TOKEN( endSnd ): // CT_Empty mbStopSound = true; - break; + return this; case PPT_TOKEN( stSnd ): mbHasStartSound = true; - mbLoopSound = attribs.getBool( XML_loop, false ); + mbLoopSound = rAttribs.getBool( XML_loop, false ); + return this; default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } diff --git a/oox/source/ppt/timeanimvaluecontext.cxx b/oox/source/ppt/timeanimvaluecontext.cxx index fd247de41a86..8feb1e623d28 100644 --- a/oox/source/ppt/timeanimvaluecontext.cxx +++ b/oox/source/ppt/timeanimvaluecontext.cxx @@ -36,10 +36,10 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace ppt { - TimeAnimValueListContext::TimeAnimValueListContext( ContextHandler& rParent, + TimeAnimValueListContext::TimeAnimValueListContext( FragmentHandler2& rParent, const Reference< XFastAttributeList >& /*xAttribs*/, TimeAnimationValueList & aTavList ) - : ContextHandler( rParent ) + : FragmentHandler2( rParent ) , maTavList( aTavList ) , mbInValue( false ) { @@ -51,21 +51,17 @@ namespace oox { namespace ppt { } - void SAL_CALL TimeAnimValueListContext::endFastElement( sal_Int32 aElement ) - throw ( SAXException, RuntimeException) + void TimeAnimValueListContext::onEndElement() { - if( aElement == PPT_TOKEN( tav ) ) + if( isCurrentElement( PPT_TOKEN( tav ) ) ) { mbInValue = false; } } - Reference< XFastContextHandler > SAL_CALL TimeAnimValueListContext::createFastChildContext( ::sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) + ::oox::core::ContextHandlerRef TimeAnimValueListContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; switch ( aElementToken ) { @@ -73,26 +69,23 @@ namespace oox { namespace ppt { { mbInValue = true; TimeAnimationValue val; - val.msFormula = xAttribs->getOptionalValue( XML_fmla ); - val.msTime = xAttribs->getOptionalValue( XML_tm ); + val.msFormula = rAttribs.getString( XML_fmla, rtl::OUString() ); + val.msTime = rAttribs.getString( XML_tm, rtl::OUString() ); maTavList.push_back( val ); - break; + return this; } case PPT_TOKEN( val ): if( mbInValue ) { // CT_TLAnimVariant - xRet.set( new AnimVariantContext( *this, aElementToken, maTavList.back().maValue ) ); + return new AnimVariantContext( *this, aElementToken, maTavList.back().maValue ); } break; default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } diff --git a/oox/source/ppt/timeanimvaluecontext.hxx b/oox/source/ppt/timeanimvaluecontext.hxx index 10041e2ac413..173e9c19bf5b 100644 --- a/oox/source/ppt/timeanimvaluecontext.hxx +++ b/oox/source/ppt/timeanimvaluecontext.hxx @@ -31,26 +31,25 @@ #ifndef OOX_PPT_TIMEANIMVALUELISTCONTEXT #define OOX_PPT_TIMEANIMVALUELISTCONTEXT -#include "oox/core/contexthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" #include "oox/ppt/animationspersist.hxx" namespace oox { namespace ppt { /** CT_TLTimeAnimateValueList */ class TimeAnimValueListContext - : public ::oox::core::ContextHandler + : public ::oox::core::FragmentHandler2 { public: - TimeAnimValueListContext( ::oox::core::ContextHandler& rParent, + TimeAnimValueListContext( ::oox::core::FragmentHandler2& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, TimeAnimationValueList & aTavList ); ~TimeAnimValueListContext( ); - virtual void SAL_CALL endFastElement( sal_Int32 aElement ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& /*xAttribs*/ ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual void onEndElement(); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); private: TimeAnimationValueList & maTavList; diff --git a/oox/source/ppt/timenodelistcontext.cxx b/oox/source/ppt/timenodelistcontext.cxx index 9aa72213dfe6..ab250d98d10f 100644 --- a/oox/source/ppt/timenodelistcontext.cxx +++ b/oox/source/ppt/timenodelistcontext.cxx @@ -117,7 +117,7 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - MediaNodeContext( ContextHandler& rParent, sal_Int32 aElement, + MediaNodeContext( FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) : TimeNodeContext( rParent, aElement, xAttribs, pNode ) @@ -139,9 +139,9 @@ namespace oox { namespace ppt { } } - virtual void SAL_CALL endFastElement( sal_Int32 aElement ) - throw ( SAXException, RuntimeException) + virtual void onEndElement() { + sal_Int32 aElement = getCurrentElement(); if( aElement == PPT_TOKEN( audio ) ) { // TODO deal with mbIsNarration @@ -152,25 +152,18 @@ namespace oox { namespace ppt { } } - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch ( aElementToken ) { case PPT_TOKEN( cBhvr ): - xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) ); + return new CommonBehaviorContext ( *this, rAttribs.getFastAttributeList(), mpNode ); break; default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } private: @@ -185,7 +178,7 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - SetTimeNodeContext( ContextHandler& rParent, sal_Int32 aElement, + SetTimeNodeContext( FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) : TimeNodeContext( rParent, aElement, xAttribs, pNode ) @@ -212,35 +205,20 @@ namespace oox { namespace ppt { } - virtual void SAL_CALL endFastElement( sal_Int32 /*aElement*/ ) - throw ( SAXException, RuntimeException) + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - } - - - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) - { - Reference< XFastContextHandler > xRet; - switch ( aElementToken ) { case PPT_TOKEN( cBhvr ): - xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) ); - break; + return new CommonBehaviorContext ( *this, rAttribs.getFastAttributeList(), mpNode ); case PPT_TOKEN( to ): // CT_TLAnimVariant - xRet.set( new AnimVariantContext( *this, aElementToken, maTo ) ); - break; + return new AnimVariantContext( *this, aElementToken, maTo ); default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } private: Any maTo; @@ -252,7 +230,7 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - CmdTimeNodeContext( ContextHandler& rParent, sal_Int32 aElement, + CmdTimeNodeContext( FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) : TimeNodeContext( rParent, aElement, xAttribs, pNode ) @@ -273,10 +251,9 @@ namespace oox { namespace ppt { { } - virtual void SAL_CALL endFastElement( sal_Int32 aElement ) - throw ( SAXException, RuntimeException) + virtual void onEndElement() { - if( aElement == PPT_TOKEN( cmd ) ) + if( isCurrentElement( PPT_TOKEN( cmd ) ) ) { try { // see sd/source/filter/ppt/pptinanimations.cxx @@ -347,25 +324,17 @@ namespace oox { namespace ppt { } - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch ( aElementToken ) { case PPT_TOKEN( cBhvr ): - xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) ); - break; + return new CommonBehaviorContext ( *this, rAttribs.getFastAttributeList(), mpNode ); default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } private: @@ -380,7 +349,7 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - SequenceTimeNodeContext( ContextHandler& rParent, sal_Int32 aElement, + SequenceTimeNodeContext( FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) : TimeNodeContext( rParent, aElement, xAttribs, pNode ) @@ -400,33 +369,23 @@ namespace oox { namespace ppt { } - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch ( aElementToken ) { case PPT_TOKEN( cTn ): - xRet.set( new CommonTimeNodeContext( *this, aElementToken, xAttribs, mpNode ) ); - break; + return new CommonTimeNodeContext( *this, aElementToken, rAttribs.getFastAttributeList(), mpNode ); case PPT_TOKEN( nextCondLst ): - xRet.set( new CondListContext( *this, aElementToken, xAttribs, mpNode, - mpNode->getNextCondition() ) ); - break; + return new CondListContext( *this, aElementToken, rAttribs.getFastAttributeList(), mpNode, + mpNode->getNextCondition() ); case PPT_TOKEN( prevCondLst ): - xRet.set( new CondListContext( *this, aElementToken, xAttribs, mpNode, - mpNode->getPrevCondition() ) ); - break; + return new CondListContext( *this, aElementToken, rAttribs.getFastAttributeList(), mpNode, + mpNode->getPrevCondition() ); default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } private: bool mbConcurrent; @@ -441,32 +400,24 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - ParallelExclTimeNodeContext( ContextHandler& rParent, sal_Int32 aElement, + ParallelExclTimeNodeContext( FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) : TimeNodeContext( rParent, aElement, xAttribs, pNode ) { } - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch ( aElementToken ) { case PPT_TOKEN( cTn ): - xRet.set( new CommonTimeNodeContext( *this, aElementToken, xAttribs, mpNode ) ); - break; + return new CommonTimeNodeContext( *this, aElementToken, rAttribs.getFastAttributeList(), mpNode ); default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } protected: @@ -479,7 +430,7 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - AnimColorContext( ContextHandler& rParent, sal_Int32 aElement, + AnimColorContext( FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) throw() : TimeNodeContext( rParent, aElement, xAttribs, pNode ) @@ -495,10 +446,10 @@ namespace oox { namespace ppt { { } - virtual void SAL_CALL endFastElement( sal_Int32 aElement ) throw ( SAXException, RuntimeException) + virtual void onEndElement() { //xParentNode - if( aElement == mnElement ) + if( isCurrentElement( mnElement ) ) { NodePropertyMap & pProps(mpNode->getNodeProperties()); pProps[ NP_DIRECTION ] = makeAny( mnDir == XML_cw ); @@ -514,10 +465,8 @@ namespace oox { namespace ppt { } - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw ( SAXException, RuntimeException ) + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch ( aElementToken ) { case PPT_TOKEN( hsl ): @@ -526,12 +475,11 @@ namespace oox { namespace ppt { if( mbHasByColor ) { m_byColor.colorSpace = AnimationColorSpace::HSL; - m_byColor.one = xAttribs->getOptionalValue( XML_h ).toInt32( ); - m_byColor.two = xAttribs->getOptionalValue( XML_s ).toInt32( ); - m_byColor.three = xAttribs->getOptionalValue( XML_l ).toInt32( ); + m_byColor.one = rAttribs.getInteger( XML_h, 0 ); + m_byColor.two = rAttribs.getInteger( XML_s, 0 ); + m_byColor.three = rAttribs.getInteger( XML_l, 0 ); } - xRet.set(this); - break; + return this; } case PPT_TOKEN( rgb ): { @@ -539,38 +487,30 @@ namespace oox { namespace ppt { { // CT_TLByRgbColorTransform m_byColor.colorSpace = AnimationColorSpace::RGB; - m_byColor.one = xAttribs->getOptionalValue( XML_r ).toInt32(); - m_byColor.two = xAttribs->getOptionalValue( XML_g ).toInt32(); - m_byColor.three = xAttribs->getOptionalValue( XML_b ).toInt32(); + m_byColor.one = rAttribs.getInteger( XML_r, 0 ); + m_byColor.two = rAttribs.getInteger( XML_g, 0 ); + m_byColor.three = rAttribs.getInteger( XML_b, 0 ); } - xRet.set(this); - break; + return this; } case PPT_TOKEN( by ): // CT_TLByAnimateColorTransform mbHasByColor = true; - xRet.set(this); - break; + return this; case PPT_TOKEN( cBhvr ): - xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) ); - break; + return new CommonBehaviorContext ( *this, rAttribs.getFastAttributeList(), mpNode ); case PPT_TOKEN( to ): // CT_Color - xRet.set( new ColorContext( *this, maToClr ) ); - break; + return new ColorContext( *this, maToClr ); case PPT_TOKEN( from ): // CT_Color - xRet.set( new ColorContext( *this, maFromClr ) ); - break; + return new ColorContext( *this, maFromClr ); default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } @@ -589,7 +529,7 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - AnimContext( ContextHandler& rParent, sal_Int32 aElement, + AnimContext( FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) throw() : TimeNodeContext( rParent, aElement, xAttribs, pNode ) @@ -671,26 +611,21 @@ namespace oox { namespace ppt { } - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw ( SAXException, RuntimeException ) + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch ( aElementToken ) { case PPT_TOKEN( cBhvr ): - xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) ); + return new CommonBehaviorContext ( *this, rAttribs.getFastAttributeList(), mpNode ); break; case PPT_TOKEN( tavLst ): - xRet.set( new TimeAnimValueListContext ( *this, xAttribs, maTavList ) ); + return new TimeAnimValueListContext ( *this, rAttribs.getFastAttributeList(), maTavList ); break; default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } private: sal_Int32 mnValueType; @@ -703,7 +638,7 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - AnimScaleContext( ContextHandler& rParent, sal_Int32 aElement, + AnimScaleContext( FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) throw() : TimeNodeContext( rParent, aElement, xAttribs, pNode ) @@ -720,9 +655,9 @@ namespace oox { namespace ppt { { } - virtual void SAL_CALL endFastElement( sal_Int32 aElement ) throw ( SAXException, RuntimeException) + virtual void onEndElement() { - if( aElement == mnElement ) + if( isCurrentElement( mnElement ) ) { if( maTo.hasValue() ) { @@ -739,49 +674,41 @@ namespace oox { namespace ppt { } } - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch ( aElementToken ) { case PPT_TOKEN( cBhvr ): - xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) ); - break; + return new CommonBehaviorContext ( *this, rAttribs.getFastAttributeList(), mpNode ); case PPT_TOKEN( to ): { // CT_TLPoint - Point p = GetPointPercent( xAttribs ); + Point p = GetPointPercent( rAttribs.getFastAttributeList() ); maTo <<= p.X; maTo <<= p.Y; - break; + return this; } case PPT_TOKEN( from ): { // CT_TLPoint - Point p = GetPointPercent( xAttribs ); + Point p = GetPointPercent( rAttribs.getFastAttributeList() ); maFrom <<= p.X; maFrom <<= p.Y; - break; + return this; } case PPT_TOKEN( by ): { // CT_TLPoint - Point p = GetPointPercent( xAttribs ); + Point p = GetPointPercent( rAttribs.getFastAttributeList() ); maBy <<= p.X; maBy <<= p.Y; - break; + return this; } default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } private: Any maBy; @@ -796,7 +723,7 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - AnimRotContext( ContextHandler& rParent, sal_Int32 aElement, + AnimRotContext( FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) throw() : TimeNodeContext( rParent, aElement, xAttribs, pNode ) @@ -827,23 +754,17 @@ namespace oox { namespace ppt { { } - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw ( SAXException, RuntimeException ) + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch ( aElementToken ) { case PPT_TOKEN( cBhvr ): - xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) ); - break; + return new CommonBehaviorContext ( *this, rAttribs.getFastAttributeList(), mpNode ); default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } }; @@ -854,7 +775,7 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - AnimMotionContext( ContextHandler& rParent, sal_Int32 aElement, + AnimMotionContext( FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) throw() : TimeNodeContext( rParent, aElement, xAttribs, pNode ) @@ -893,63 +814,55 @@ namespace oox { namespace ppt { } - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch ( aElementToken ) { case PPT_TOKEN( cBhvr ): - xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) ); - break; + return new CommonBehaviorContext ( *this, rAttribs.getFastAttributeList(), mpNode ); case PPT_TOKEN( to ): { // CT_TLPoint - Point p = GetPointPercent( xAttribs ); + Point p = GetPointPercent( rAttribs.getFastAttributeList() ); Any rAny; rAny <<= p.X; rAny <<= p.Y; mpNode->setTo( rAny ); - break; + return this; } case PPT_TOKEN( from ): { // CT_TLPoint - Point p = GetPointPercent( xAttribs ); + Point p = GetPointPercent( rAttribs.getFastAttributeList() ); Any rAny; rAny <<= p.X; rAny <<= p.Y; mpNode->setFrom( rAny ); - break; + return this; } case PPT_TOKEN( by ): { // CT_TLPoint - Point p = GetPointPercent( xAttribs ); + Point p = GetPointPercent( rAttribs.getFastAttributeList() ); Any rAny; rAny <<= p.X; rAny <<= p.Y; mpNode->setBy( rAny ); - break; + return this; } case PPT_TOKEN( rCtr ): { // CT_TLPoint - Point p = GetPointPercent( xAttribs ); + Point p = GetPointPercent( rAttribs.getFastAttributeList() ); // TODO push (void)p; - break; + return this; } default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } private: OUString msPtsTypes; @@ -963,7 +876,7 @@ namespace oox { namespace ppt { : public TimeNodeContext { public: - AnimEffectContext( ContextHandler& rParent, sal_Int32 aElement, + AnimEffectContext( FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) throw() : TimeNodeContext( rParent, aElement, xAttribs, pNode ) @@ -987,27 +900,20 @@ namespace oox { namespace ppt { } - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw ( SAXException, RuntimeException ) + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch ( aElementToken ) { case PPT_TOKEN( cBhvr ): - xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) ); - break; + return new CommonBehaviorContext ( *this, rAttribs.getFastAttributeList(), mpNode ); case PPT_TOKEN( progress ): - xRet.set( new AnimVariantContext( *this, aElementToken, maProgress ) ); + return new AnimVariantContext( *this, aElementToken, maProgress ); // TODO handle it. - break; default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } private: Any maProgress; @@ -1018,7 +924,7 @@ namespace oox { namespace ppt { TimeNodeContext * TimeNodeContext::makeContext( - ContextHandler& rParent, sal_Int32 aElement, + FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ) { @@ -1069,10 +975,10 @@ namespace oox { namespace ppt { } - TimeNodeContext::TimeNodeContext( ContextHandler& rParent, sal_Int32 aElement, + TimeNodeContext::TimeNodeContext( FragmentHandler2& rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& /*xAttribs*/, const TimeNodePtr & pNode ) throw() - : ContextHandler( rParent ) + : FragmentHandler2( rParent ) , mnElement( aElement ) , mpNode( pNode ) { @@ -1085,9 +991,9 @@ namespace oox { namespace ppt { } - TimeNodeListContext::TimeNodeListContext( ContextHandler& rParent, TimeNodePtrList & aList ) + TimeNodeListContext::TimeNodeListContext( FragmentHandler2& rParent, TimeNodePtrList & aList ) throw() - : ContextHandler( rParent ) + : FragmentHandler2( rParent ) , maList( aList ) { } @@ -1098,10 +1004,8 @@ namespace oox { namespace ppt { } - Reference< XFastContextHandler > SAL_CALL TimeNodeListContext::createFastChildContext( ::sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) + ::oox::core::ContextHandlerRef TimeNodeListContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - sal_Int16 nNodeType; switch( aElementToken ) @@ -1155,10 +1059,9 @@ namespace oox { namespace ppt { TimeNodePtr pNode(new TimeNode(nNodeType)); maList.push_back( pNode ); - ContextHandler * pContext = TimeNodeContext::makeContext( *this, aElementToken, xAttribs, pNode ); - xRet.set( pContext ? pContext : this ); + FragmentHandler2 * pContext = TimeNodeContext::makeContext( *this, aElementToken, rAttribs.getFastAttributeList(), pNode ); - return xRet; + return pContext ? pContext : this; } diff --git a/oox/source/ppt/timetargetelementcontext.cxx b/oox/source/ppt/timetargetelementcontext.cxx index 2a0f61c0c4a3..93cbcf701625 100644 --- a/oox/source/ppt/timetargetelementcontext.cxx +++ b/oox/source/ppt/timetargetelementcontext.cxx @@ -49,55 +49,49 @@ namespace oox { namespace ppt { // CT_TLShapeTargetElement class ShapeTargetElementContext - : public ContextHandler + : public FragmentHandler2 { public: - ShapeTargetElementContext( ContextHandler& rParent, ShapeTargetElement & aValue ) - : ContextHandler( rParent ) + ShapeTargetElementContext( FragmentHandler2& rParent, ShapeTargetElement & aValue ) + : FragmentHandler2( rParent ) , bTargetSet(false) , maShapeTarget(aValue) { } - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch( aElementToken ) { case PPT_TOKEN( bg ): bTargetSet = true; maShapeTarget.mnType = XML_bg; - break; + return this; case PPT_TOKEN( txEl ): bTargetSet = true; maShapeTarget.mnType = XML_txEl; - break; + return this; case PPT_TOKEN( subSp ): bTargetSet = true; maShapeTarget.mnType = XML_subSp; - maShapeTarget.msSubShapeId = xAttribs->getOptionalValue( XML_spid ); - break; + maShapeTarget.msSubShapeId = rAttribs.getString( XML_spid, OUString() ); + return this; case PPT_TOKEN( graphicEl ): case PPT_TOKEN( oleChartEl ): bTargetSet = true; // TODO - break; + return this; case PPT_TOKEN( charRg ): case PPT_TOKEN( pRg ): if( bTargetSet && maShapeTarget.mnType == XML_txEl ) { maShapeTarget.mnRangeType = getBaseToken( aElementToken ); - maShapeTarget.maRange = drawingml::GetIndexRange( xAttribs ); + maShapeTarget.maRange = drawingml::GetIndexRange( rAttribs.getFastAttributeList() ); } - break; + return this; default: break; } - if( !xRet.is() ) - xRet.set( this ); - return xRet; + return this; } private: @@ -107,8 +101,8 @@ namespace oox { namespace ppt { - TimeTargetElementContext::TimeTargetElementContext( ContextHandler& rParent, const AnimTargetElementPtr & pValue ) - : ContextHandler( rParent ), + TimeTargetElementContext::TimeTargetElementContext( FragmentHandler2& rParent, const AnimTargetElementPtr & pValue ) + : FragmentHandler2( rParent ), mpTarget( pValue ) { OSL_ENSURE( mpTarget, "no valid target passed" ); @@ -119,34 +113,28 @@ namespace oox { namespace ppt { { } - void SAL_CALL TimeTargetElementContext::endFastElement( sal_Int32 /*aElement*/ ) throw ( SAXException, RuntimeException) - { - } - - Reference< XFastContextHandler > SAL_CALL TimeTargetElementContext::createFastChildContext( ::sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw ( SAXException, RuntimeException ) + ::oox::core::ContextHandlerRef TimeTargetElementContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch( aElementToken ) { case PPT_TOKEN( inkTgt ): { mpTarget->mnType = XML_inkTgt; - OUString aId = xAttribs->getOptionalValue( XML_spid ); + OUString aId = rAttribs.getString( XML_spid, OUString() ); if( aId.getLength() ) { mpTarget->msValue = aId; } - break; + return this; } case PPT_TOKEN( sldTgt ): mpTarget->mnType = XML_sldTgt; - break; + return this; case PPT_TOKEN( sndTgt ): { mpTarget->mnType = XML_sndTgt; drawingml::EmbeddedWAVAudioFile aAudio; - drawingml::getEmbeddedWAVAudioFile( getRelations(), xAttribs, aAudio); + drawingml::getEmbeddedWAVAudioFile( getRelations(), rAttribs.getFastAttributeList(), aAudio); OUString sSndName = ( aAudio.mbBuiltIn ? aAudio.msName : aAudio.msEmbed ); mpTarget->msValue = sSndName; @@ -155,20 +143,16 @@ namespace oox { namespace ppt { case PPT_TOKEN( spTgt ): { mpTarget->mnType = XML_spTgt; - OUString aId = xAttribs->getOptionalValue( XML_spid ); + OUString aId = rAttribs.getString( XML_spid, OUString() ); mpTarget->msValue = aId; - xRet.set( new ShapeTargetElementContext( *this, mpTarget->maShapeTarget ) ); - break; + return new ShapeTargetElementContext( *this, mpTarget->maShapeTarget ); } default: OSL_TRACE( "OOX: unhandled tag %ld in TL_TimeTargetElement.", getBaseToken( aElementToken ) ); break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } diff --git a/oox/source/ppt/timetargetelementcontext.hxx b/oox/source/ppt/timetargetelementcontext.hxx index 8ee22fd26aae..f20890f1899a 100644 --- a/oox/source/ppt/timetargetelementcontext.hxx +++ b/oox/source/ppt/timetargetelementcontext.hxx @@ -29,20 +29,19 @@ #ifndef OOX_PPT_TIMETARGETELEMENTCONTEXT #define OOX_PPT_TIMETARGETELEMENTCONTEXT -#include "oox/core/contexthandler.hxx" +#include "oox/core/fragmenthandler2.hxx" #include "oox/ppt/animationspersist.hxx" namespace oox { namespace ppt { /** context CT_TLTimeTargetElement */ class TimeTargetElementContext - : public ::oox::core::ContextHandler + : public ::oox::core::FragmentHandler2 { public: - TimeTargetElementContext( ::oox::core::ContextHandler& rParent, const AnimTargetElementPtr & aValue ); + TimeTargetElementContext( ::oox::core::FragmentHandler2& rParent, const AnimTargetElementPtr & aValue ); ~TimeTargetElementContext( ) throw( ); - virtual void SAL_CALL endFastElement( sal_Int32 /*aElement*/ ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs ) throw ( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ); private: AnimTargetElementPtr mpTarget; |