diff options
author | Tor Lillqvist <tml@iki.fi> | 2013-06-24 19:34:03 +0300 |
---|---|---|
committer | Fridrich Strba <fridrich@documentfoundation.org> | 2013-06-28 09:02:50 +0000 |
commit | 8810d26c92c4f70b2a05c63088e30fc780ed6caf (patch) | |
tree | 0af69efb6f42cb257e2f1ba2d740d2283d8725c0 /oox/source | |
parent | bc8f89931ab4cc0537e7710b6bc375c844ba6e68 (diff) |
Convert all ContextHandler-derived clases over to ContextHandler2
Change-Id: I81f54e3b7d29a0807ec4c2f082ae00fd6e1d6138
Reviewed-on: https://gerrit.libreoffice.org/4580
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'oox/source')
45 files changed, 820 insertions, 1236 deletions
diff --git a/oox/source/drawingml/clrschemecontext.cxx b/oox/source/drawingml/clrschemecontext.cxx index 8a13b845b7c5..83244bed6856 100644 --- a/oox/source/drawingml/clrschemecontext.cxx +++ b/oox/source/drawingml/clrschemecontext.cxx @@ -26,35 +26,35 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace drawingml { -static void setClrMap( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, +static void setClrMap( const ::oox::AttributeList& rAttributes, ClrMap& rClrMap, sal_Int32 nToken ) { - if ( xAttributes->hasAttribute( nToken ) ) + if ( rAttributes.hasAttribute( nToken ) ) { - sal_Int32 nMappedToken = xAttributes->getOptionalValueToken( nToken, 0 ); + sal_Int32 nMappedToken = rAttributes.getToken( nToken, 0 ); rClrMap.setColorMap( nToken, nMappedToken ); } } -clrMapContext::clrMapContext( ContextHandler& rParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, ClrMap& rClrMap ) -: ContextHandler( rParent ) +clrMapContext::clrMapContext( ContextHandler2Helper& rParent, + const ::oox::AttributeList& rAttributes, ClrMap& rClrMap ) +: ContextHandler2( rParent ) { - setClrMap( xAttributes, rClrMap, XML_bg1 ); - setClrMap( xAttributes, rClrMap, XML_tx1 ); - setClrMap( xAttributes, rClrMap, XML_bg2 ); - setClrMap( xAttributes, rClrMap, XML_tx2 ); - setClrMap( xAttributes, rClrMap, XML_accent1 ); - setClrMap( xAttributes, rClrMap, XML_accent2 ); - setClrMap( xAttributes, rClrMap, XML_accent3 ); - setClrMap( xAttributes, rClrMap, XML_accent4 ); - setClrMap( xAttributes, rClrMap, XML_accent5 ); - setClrMap( xAttributes, rClrMap, XML_accent6 ); - setClrMap( xAttributes, rClrMap, XML_hlink ); - setClrMap( xAttributes, rClrMap, XML_folHlink ); + setClrMap( rAttributes, rClrMap, XML_bg1 ); + setClrMap( rAttributes, rClrMap, XML_tx1 ); + setClrMap( rAttributes, rClrMap, XML_bg2 ); + setClrMap( rAttributes, rClrMap, XML_tx2 ); + setClrMap( rAttributes, rClrMap, XML_accent1 ); + setClrMap( rAttributes, rClrMap, XML_accent2 ); + setClrMap( rAttributes, rClrMap, XML_accent3 ); + setClrMap( rAttributes, rClrMap, XML_accent4 ); + setClrMap( rAttributes, rClrMap, XML_accent5 ); + setClrMap( rAttributes, rClrMap, XML_accent6 ); + setClrMap( rAttributes, rClrMap, XML_hlink ); + setClrMap( rAttributes, rClrMap, XML_folHlink ); } -clrSchemeColorContext::clrSchemeColorContext( ContextHandler& rParent, ClrScheme& rClrScheme, sal_Int32 nColorToken ) : +clrSchemeColorContext::clrSchemeColorContext( ContextHandler2Helper& rParent, ClrScheme& rClrScheme, sal_Int32 nColorToken ) : ColorContext( rParent, *this ), mrClrScheme( rClrScheme ), mnColorToken( nColorToken ) @@ -66,14 +66,14 @@ clrSchemeColorContext::~clrSchemeColorContext() mrClrScheme.setColor( mnColorToken, getColor( getFilter().getGraphicHelper() ) ); } -clrSchemeContext::clrSchemeContext( ContextHandler& rParent, ClrScheme& rClrScheme ) : - ContextHandler( rParent ), +clrSchemeContext::clrSchemeContext( ContextHandler2Helper& rParent, ClrScheme& rClrScheme ) : + ContextHandler2( rParent ), mrClrScheme( rClrScheme ) { } -Reference< XFastContextHandler > clrSchemeContext::createFastChildContext( - sal_Int32 nElement, const Reference< XFastAttributeList >& ) throw (SAXException, RuntimeException) +ContextHandlerRef clrSchemeContext::onCreateContext( + sal_Int32 nElement, const AttributeList& ) { switch( nElement ) { diff --git a/oox/source/drawingml/colorchoicecontext.cxx b/oox/source/drawingml/colorchoicecontext.cxx index 40f1cd6974eb..b33b6dd87b79 100644 --- a/oox/source/drawingml/colorchoicecontext.cxx +++ b/oox/source/drawingml/colorchoicecontext.cxx @@ -33,56 +33,53 @@ namespace drawingml { // ============================================================================ -ColorValueContext::ColorValueContext( ContextHandler& rParent, Color& rColor ) : - ContextHandler( rParent ), +ColorValueContext::ColorValueContext( ContextHandler2Helper& rParent, Color& rColor ) : + ContextHandler2( rParent ), mrColor( rColor ) { } -void ColorValueContext::startFastElement( sal_Int32 nElement, const Reference< XFastAttributeList >& rxAttribs ) - throw (SAXException, RuntimeException) +void ColorValueContext::onStartElement( const AttributeList& rAttribs ) { - AttributeList aAttribs( rxAttribs ); - switch( nElement ) + switch( getCurrentElement() ) { case A_TOKEN( scrgbClr ): mrColor.setScrgbClr( - aAttribs.getInteger( XML_r, 0 ), - aAttribs.getInteger( XML_g, 0 ), - aAttribs.getInteger( XML_b, 0 ) ); + rAttribs.getInteger( XML_r, 0 ), + rAttribs.getInteger( XML_g, 0 ), + rAttribs.getInteger( XML_b, 0 ) ); break; case A_TOKEN( srgbClr ): - mrColor.setSrgbClr( aAttribs.getIntegerHex( XML_val, 0 ) ); + mrColor.setSrgbClr( rAttribs.getIntegerHex( XML_val, 0 ) ); break; case A_TOKEN( hslClr ): mrColor.setHslClr( - aAttribs.getInteger( XML_hue, 0 ), - aAttribs.getInteger( XML_sat, 0 ), - aAttribs.getInteger( XML_lum, 0 ) ); + rAttribs.getInteger( XML_hue, 0 ), + rAttribs.getInteger( XML_sat, 0 ), + rAttribs.getInteger( XML_lum, 0 ) ); break; case A_TOKEN( sysClr ): mrColor.setSysClr( - aAttribs.getToken( XML_val, XML_TOKEN_INVALID ), - aAttribs.getIntegerHex( XML_lastClr, -1 ) ); + rAttribs.getToken( XML_val, XML_TOKEN_INVALID ), + rAttribs.getIntegerHex( XML_lastClr, -1 ) ); break; case A_TOKEN( schemeClr ): - mrColor.setSchemeClr( aAttribs.getToken( XML_val, XML_TOKEN_INVALID ) ); + mrColor.setSchemeClr( rAttribs.getToken( XML_val, XML_TOKEN_INVALID ) ); break; case A_TOKEN( prstClr ): - mrColor.setPrstClr( aAttribs.getToken( XML_val, XML_TOKEN_INVALID ) ); + mrColor.setPrstClr( rAttribs.getToken( XML_val, XML_TOKEN_INVALID ) ); break; } } -Reference< XFastContextHandler > ColorValueContext::createFastChildContext( - sal_Int32 nElement, const Reference< XFastAttributeList >& rxAttribs ) throw (SAXException, RuntimeException) +::oox::core::ContextHandlerRef ColorValueContext::onCreateContext( + sal_Int32 nElement, const AttributeList& rAttribs ) { - AttributeList aAttribs( rxAttribs ); switch( nElement ) { case A_TOKEN( alpha ): @@ -108,7 +105,7 @@ Reference< XFastContextHandler > ColorValueContext::createFastChildContext( case A_TOKEN( satOff ): case A_TOKEN( shade ): case A_TOKEN( tint ): - mrColor.addTransformation( nElement, aAttribs.getInteger( XML_val, 0 ) ); + mrColor.addTransformation( nElement, rAttribs.getInteger( XML_val, 0 ) ); break; case A_TOKEN( comp ): case A_TOKEN( gamma ): @@ -123,14 +120,14 @@ Reference< XFastContextHandler > ColorValueContext::createFastChildContext( // ============================================================================ -ColorContext::ColorContext( ContextHandler& rParent, Color& rColor ) : - ContextHandler( rParent ), +ColorContext::ColorContext( ContextHandler2Helper& rParent, Color& rColor ) : + ContextHandler2( rParent ), mrColor( rColor ) { } -Reference< XFastContextHandler > ColorContext::createFastChildContext( - sal_Int32 nElement, const Reference< XFastAttributeList >& ) throw (SAXException, RuntimeException) +::oox::core::ContextHandlerRef ColorContext::onCreateContext( + sal_Int32 nElement, const AttributeList& ) { switch( nElement ) { diff --git a/oox/source/drawingml/customshapegeometry.cxx b/oox/source/drawingml/customshapegeometry.cxx index 3155b893c198..6ad190d16a58 100644 --- a/oox/source/drawingml/customshapegeometry.cxx +++ b/oox/source/drawingml/customshapegeometry.cxx @@ -440,19 +440,19 @@ static EnhancedCustomShapeParameter GetAdjCoordinate( CustomShapeProperties& rCu // --------------------------------------------------------------------- // CT_GeomGuideList -class GeomGuideListContext : public ContextHandler +class GeomGuideListContext : public ContextHandler2 { public: - GeomGuideListContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< CustomShapeGuide >& rGuideList ); - 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); + GeomGuideListContext( ContextHandler2Helper& rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< CustomShapeGuide >& rGuideList ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE; protected: std::vector< CustomShapeGuide >& mrGuideList; CustomShapeProperties& mrCustomShapeProperties; }; -GeomGuideListContext::GeomGuideListContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< CustomShapeGuide >& rGuideList ) -: ContextHandler( rParent ) +GeomGuideListContext::GeomGuideListContext( ContextHandler2Helper& rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< CustomShapeGuide >& rGuideList ) +: ContextHandler2( rParent ) , mrGuideList( rGuideList ) , mrCustomShapeProperties( rCustomShapeProperties ) { @@ -624,13 +624,13 @@ static OUString convertToOOEquation( CustomShapeProperties& rCustomShapeProperti return aEquation; } -Reference< XFastContextHandler > GeomGuideListContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +ContextHandlerRef GeomGuideListContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { if ( aElementToken == A_TOKEN( gd ) ) // CT_GeomGuide { CustomShapeGuide aGuide; - aGuide.maName = xAttribs->getOptionalValue( XML_name ); - aGuide.maFormula = convertToOOEquation( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_fmla ) ); + aGuide.maName = rAttribs.getString( XML_name ).get(); + aGuide.maFormula = convertToOOEquation( mrCustomShapeProperties, rAttribs.getString( XML_fmla ).get() ); mrGuideList.push_back( aGuide ); } return this; @@ -645,257 +645,249 @@ static const OUString GetGeomGuideName( const OUString& rValue ) // --------------------------------------------------------------------- // CT_AdjPoint2D -class AdjPoint2DContext : public ContextHandler +class AdjPoint2DContext : public ContextHandler2 { public: - AdjPoint2DContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D ); + AdjPoint2DContext( ContextHandler2Helper& rParent, const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D ); }; -AdjPoint2DContext::AdjPoint2DContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D ) -: ContextHandler( rParent ) +AdjPoint2DContext::AdjPoint2DContext( ContextHandler2Helper& rParent, const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D ) +: ContextHandler2( rParent ) { - rAdjPoint2D.First = GetAdjCoordinate( rCustomShapeProperties, xAttribs->getOptionalValue( XML_x ), sal_True ); - rAdjPoint2D.Second = GetAdjCoordinate( rCustomShapeProperties, xAttribs->getOptionalValue( XML_y ), sal_True ); + rAdjPoint2D.First = GetAdjCoordinate( rCustomShapeProperties, rAttribs.getString( XML_x ).get(), sal_True ); + rAdjPoint2D.Second = GetAdjCoordinate( rCustomShapeProperties, rAttribs.getString( XML_y ).get(), sal_True ); } // --------------------------------------------------------------------- // CT_XYAdjustHandle -class XYAdjustHandleContext : public ContextHandler +class XYAdjustHandleContext : public ContextHandler2 { public: - XYAdjustHandleContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, AdjustHandle& rAdjustHandle ); - 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); + XYAdjustHandleContext( ContextHandler2Helper& rParent, const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, AdjustHandle& rAdjustHandle ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE; protected: AdjustHandle& mrAdjustHandle; CustomShapeProperties& mrCustomShapeProperties; }; -XYAdjustHandleContext::XYAdjustHandleContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, AdjustHandle& rAdjustHandle ) -: ContextHandler( rParent ) +XYAdjustHandleContext::XYAdjustHandleContext( ContextHandler2Helper& rParent, const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, AdjustHandle& rAdjustHandle ) +: ContextHandler2( rParent ) , mrAdjustHandle( rAdjustHandle ) , mrCustomShapeProperties( rCustomShapeProperties ) { const OUString aEmptyDefault; - AttributeList aAttribs( xAttribs ); - if ( aAttribs.hasAttribute( XML_gdRefX ) ) + if ( rAttribs.hasAttribute( XML_gdRefX ) ) { - mrAdjustHandle.gdRef1 = GetGeomGuideName( aAttribs.getString( XML_gdRefX, aEmptyDefault ) ); + mrAdjustHandle.gdRef1 = GetGeomGuideName( rAttribs.getString( XML_gdRefX, aEmptyDefault ) ); } - if ( aAttribs.hasAttribute( XML_minX ) ) + if ( rAttribs.hasAttribute( XML_minX ) ) { - mrAdjustHandle.min1 = GetAdjCoordinate( mrCustomShapeProperties, aAttribs.getString( XML_minX, aEmptyDefault ), sal_True ); + mrAdjustHandle.min1 = GetAdjCoordinate( mrCustomShapeProperties, rAttribs.getString( XML_minX, aEmptyDefault ), sal_True ); } - if ( aAttribs.hasAttribute( XML_maxX ) ) + if ( rAttribs.hasAttribute( XML_maxX ) ) { - mrAdjustHandle.max1 = GetAdjCoordinate( mrCustomShapeProperties, aAttribs.getString( XML_maxX, aEmptyDefault ), sal_True ); + mrAdjustHandle.max1 = GetAdjCoordinate( mrCustomShapeProperties, rAttribs.getString( XML_maxX, aEmptyDefault ), sal_True ); } - if ( aAttribs.hasAttribute( XML_gdRefY ) ) + if ( rAttribs.hasAttribute( XML_gdRefY ) ) { - mrAdjustHandle.gdRef2 = GetGeomGuideName( aAttribs.getString( XML_gdRefY, aEmptyDefault ) ); + mrAdjustHandle.gdRef2 = GetGeomGuideName( rAttribs.getString( XML_gdRefY, aEmptyDefault ) ); } - if ( aAttribs.hasAttribute( XML_minY ) ) + if ( rAttribs.hasAttribute( XML_minY ) ) { - mrAdjustHandle.min2 = GetAdjCoordinate( mrCustomShapeProperties, aAttribs.getString( XML_minY, aEmptyDefault ), sal_True ); + mrAdjustHandle.min2 = GetAdjCoordinate( mrCustomShapeProperties, rAttribs.getString( XML_minY, aEmptyDefault ), sal_True ); } - if ( aAttribs.hasAttribute( XML_maxY ) ) + if ( rAttribs.hasAttribute( XML_maxY ) ) { - mrAdjustHandle.max2 = GetAdjCoordinate( mrCustomShapeProperties, aAttribs.getString( XML_maxY, aEmptyDefault ), sal_True ); + mrAdjustHandle.max2 = GetAdjCoordinate( mrCustomShapeProperties, rAttribs.getString( XML_maxY, aEmptyDefault ), sal_True ); } } -Reference< XFastContextHandler > XYAdjustHandleContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +ContextHandlerRef XYAdjustHandleContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xContext; if ( aElementToken == A_TOKEN( pos ) ) - xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties, mrAdjustHandle.pos ); // CT_AdjPoint2D - return xContext; + return new AdjPoint2DContext( *this, rAttribs, mrCustomShapeProperties, mrAdjustHandle.pos ); // CT_AdjPoint2D + return 0; } // --------------------------------------------------------------------- // CT_PolarAdjustHandle -class PolarAdjustHandleContext : public ContextHandler +class PolarAdjustHandleContext : public ContextHandler2 { public: - PolarAdjustHandleContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, AdjustHandle& rAdjustHandle ); - 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); + PolarAdjustHandleContext( ContextHandler2Helper& rParent, const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, AdjustHandle& rAdjustHandle ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE; protected: AdjustHandle& mrAdjustHandle; CustomShapeProperties& mrCustomShapeProperties; }; -PolarAdjustHandleContext::PolarAdjustHandleContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, AdjustHandle& rAdjustHandle ) -: ContextHandler( rParent ) +PolarAdjustHandleContext::PolarAdjustHandleContext( ContextHandler2Helper& rParent, const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, AdjustHandle& rAdjustHandle ) +: ContextHandler2( rParent ) , mrAdjustHandle( rAdjustHandle ) , mrCustomShapeProperties( rCustomShapeProperties ) { const OUString aEmptyDefault; - AttributeList aAttribs( xAttribs ); - if ( aAttribs.hasAttribute( XML_gdRefR ) ) + if ( rAttribs.hasAttribute( XML_gdRefR ) ) { - mrAdjustHandle.gdRef1 = GetGeomGuideName( aAttribs.getString( XML_gdRefR, aEmptyDefault ) ); + mrAdjustHandle.gdRef1 = GetGeomGuideName( rAttribs.getString( XML_gdRefR, aEmptyDefault ) ); } - if ( aAttribs.hasAttribute( XML_minR ) ) + if ( rAttribs.hasAttribute( XML_minR ) ) { - mrAdjustHandle.min1 = GetAdjCoordinate( mrCustomShapeProperties, aAttribs.getString( XML_minR, aEmptyDefault ), sal_True ); + mrAdjustHandle.min1 = GetAdjCoordinate( mrCustomShapeProperties, rAttribs.getString( XML_minR, aEmptyDefault ), sal_True ); } - if ( aAttribs.hasAttribute( XML_maxR ) ) + if ( rAttribs.hasAttribute( XML_maxR ) ) { - mrAdjustHandle.max1 = GetAdjCoordinate( mrCustomShapeProperties, aAttribs.getString( XML_maxR, aEmptyDefault ), sal_True ); + mrAdjustHandle.max1 = GetAdjCoordinate( mrCustomShapeProperties, rAttribs.getString( XML_maxR, aEmptyDefault ), sal_True ); } - if ( aAttribs.hasAttribute( XML_gdRefAng ) ) + if ( rAttribs.hasAttribute( XML_gdRefAng ) ) { - mrAdjustHandle.gdRef2 = GetGeomGuideName( aAttribs.getString( XML_gdRefAng, aEmptyDefault ) ); + mrAdjustHandle.gdRef2 = GetGeomGuideName( rAttribs.getString( XML_gdRefAng, aEmptyDefault ) ); } - if ( aAttribs.hasAttribute( XML_minAng ) ) + if ( rAttribs.hasAttribute( XML_minAng ) ) { - mrAdjustHandle.min2 = GetAdjCoordinate( mrCustomShapeProperties, aAttribs.getString( XML_minAng, aEmptyDefault ) ); + mrAdjustHandle.min2 = GetAdjCoordinate( mrCustomShapeProperties, rAttribs.getString( XML_minAng, aEmptyDefault ) ); } - if ( aAttribs.hasAttribute( XML_maxAng ) ) + if ( rAttribs.hasAttribute( XML_maxAng ) ) { - mrAdjustHandle.max2 = GetAdjCoordinate( mrCustomShapeProperties, aAttribs.getString( XML_maxAng, aEmptyDefault ) ); + mrAdjustHandle.max2 = GetAdjCoordinate( mrCustomShapeProperties, rAttribs.getString( XML_maxAng, aEmptyDefault ) ); } } -Reference< XFastContextHandler > PolarAdjustHandleContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +ContextHandlerRef PolarAdjustHandleContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xContext; if ( aElementToken == A_TOKEN( pos ) ) - xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties, mrAdjustHandle.pos ); // CT_AdjPoint2D - return xContext; + return new AdjPoint2DContext( *this, rAttribs, mrCustomShapeProperties, mrAdjustHandle.pos ); // CT_AdjPoint2D + return 0; } // --------------------------------------------------------------------- // CT_AdjustHandleList -class AdjustHandleListContext : public ContextHandler +class AdjustHandleListContext : public ContextHandler2 { public: - AdjustHandleListContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< AdjustHandle >& rAdjustHandleList ); - 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); + AdjustHandleListContext( ContextHandler2Helper& rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< AdjustHandle >& rAdjustHandleList ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE; protected: std::vector< AdjustHandle >& mrAdjustHandleList; CustomShapeProperties& mrCustomShapeProperties; }; -AdjustHandleListContext::AdjustHandleListContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< AdjustHandle >& rAdjustHandleList ) -: ContextHandler( rParent ) +AdjustHandleListContext::AdjustHandleListContext( ContextHandler2Helper& rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< AdjustHandle >& rAdjustHandleList ) +: ContextHandler2( rParent ) , mrAdjustHandleList( rAdjustHandleList ) , mrCustomShapeProperties( rCustomShapeProperties ) { } -Reference< XFastContextHandler > AdjustHandleListContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +ContextHandlerRef AdjustHandleListContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xContext; if ( aElementToken == A_TOKEN( ahXY ) ) // CT_XYAdjustHandle { AdjustHandle aAdjustHandle( sal_False ); mrAdjustHandleList.push_back( aAdjustHandle ); - xContext = new XYAdjustHandleContext( *this, xAttribs, mrCustomShapeProperties, mrAdjustHandleList.back() ); + return new XYAdjustHandleContext( *this, rAttribs, mrCustomShapeProperties, mrAdjustHandleList.back() ); } else if ( aElementToken == A_TOKEN( ahPolar ) ) // CT_PolarAdjustHandle { AdjustHandle aAdjustHandle( sal_True ); mrAdjustHandleList.push_back( aAdjustHandle ); - xContext = new PolarAdjustHandleContext( *this, xAttribs, mrCustomShapeProperties, mrAdjustHandleList.back() ); + return new PolarAdjustHandleContext( *this, rAttribs, mrCustomShapeProperties, mrAdjustHandleList.back() ); } - return xContext; + return 0; } // --------------------------------------------------------------------- // CT_ConnectionSite -class ConnectionSiteContext : public ContextHandler +class ConnectionSiteContext : public ContextHandler2 { public: - ConnectionSiteContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, ConnectionSite& rConnectionSite ); - 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); + ConnectionSiteContext( ContextHandler2Helper& rParent, const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, ConnectionSite& rConnectionSite ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE; protected: ConnectionSite& mrConnectionSite; CustomShapeProperties& mrCustomShapeProperties; }; -ConnectionSiteContext::ConnectionSiteContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, ConnectionSite& rConnectionSite ) -: ContextHandler( rParent ) +ConnectionSiteContext::ConnectionSiteContext( ContextHandler2Helper& rParent, const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, ConnectionSite& rConnectionSite ) +: ContextHandler2( rParent ) , mrConnectionSite( rConnectionSite ) , mrCustomShapeProperties( rCustomShapeProperties ) { - mrConnectionSite.ang = GetAdjCoordinate( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_ang ) ); + mrConnectionSite.ang = GetAdjCoordinate( mrCustomShapeProperties, rAttribs.getString( XML_ang ).get() ); } -Reference< XFastContextHandler > ConnectionSiteContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +ContextHandlerRef ConnectionSiteContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xContext; if ( aElementToken == A_TOKEN( pos ) ) - xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties, mrConnectionSite.pos ); // CT_AdjPoint2D - return xContext; + return new AdjPoint2DContext( *this, rAttribs, mrCustomShapeProperties, mrConnectionSite.pos ); // CT_AdjPoint2D + return 0; } // --------------------------------------------------------------------- // CT_Path2DMoveTo -class Path2DMoveToContext : public ContextHandler +class Path2DMoveToContext : public ContextHandler2 { public: - Path2DMoveToContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D ); - 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); + Path2DMoveToContext( ContextHandler2Helper& rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE; protected: EnhancedCustomShapeParameterPair& mrAdjPoint2D; CustomShapeProperties& mrCustomShapeProperties; }; -Path2DMoveToContext::Path2DMoveToContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D ) -: ContextHandler( rParent ) +Path2DMoveToContext::Path2DMoveToContext( ContextHandler2Helper& rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D ) +: ContextHandler2( rParent ) , mrAdjPoint2D( rAdjPoint2D ) , mrCustomShapeProperties( rCustomShapeProperties ) { } -Reference< XFastContextHandler > Path2DMoveToContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +ContextHandlerRef Path2DMoveToContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xContext; if ( aElementToken == A_TOKEN( pt ) ) - xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties, mrAdjPoint2D ); // CT_AdjPoint2D - return xContext; + return new AdjPoint2DContext( *this, rAttribs, mrCustomShapeProperties, mrAdjPoint2D ); // CT_AdjPoint2D + return 0; } // --------------------------------------------------------------------- // CT_Path2DLineTo -class Path2DLineToContext : public ContextHandler +class Path2DLineToContext : public ContextHandler2 { public: - Path2DLineToContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D ); - 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); + Path2DLineToContext( ContextHandler2Helper& rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE; protected: EnhancedCustomShapeParameterPair& mrAdjPoint2D; CustomShapeProperties& mrCustomShapeProperties; }; -Path2DLineToContext::Path2DLineToContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D ) -: ContextHandler( rParent ) +Path2DLineToContext::Path2DLineToContext( ContextHandler2Helper& rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D ) +: ContextHandler2( rParent ) , mrAdjPoint2D( rAdjPoint2D ) , mrCustomShapeProperties( rCustomShapeProperties ) { } -Reference< XFastContextHandler > Path2DLineToContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +ContextHandlerRef Path2DLineToContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xContext; if ( aElementToken == A_TOKEN( pt ) ) - xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties, mrAdjPoint2D ); // CT_AdjPoint2D - return xContext; + return new AdjPoint2DContext( *this, rAttribs, mrCustomShapeProperties, mrAdjPoint2D ); // CT_AdjPoint2D + return 0; } // --------------------------------------------------------------------- // CT_Path2DQuadBezierTo -class Path2DQuadBezierToContext : public ContextHandler +class Path2DQuadBezierToContext : public ContextHandler2 { public: - Path2DQuadBezierToContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rPt1, EnhancedCustomShapeParameterPair& rPt2 ); - 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); + Path2DQuadBezierToContext( ContextHandler2Helper& rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rPt1, EnhancedCustomShapeParameterPair& rPt2 ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE; protected: EnhancedCustomShapeParameterPair& mrPt1; @@ -904,11 +896,11 @@ protected: CustomShapeProperties& mrCustomShapeProperties; }; -Path2DQuadBezierToContext::Path2DQuadBezierToContext( ContextHandler& rParent, +Path2DQuadBezierToContext::Path2DQuadBezierToContext( ContextHandler2Helper& rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rPt1, EnhancedCustomShapeParameterPair& rPt2 ) -: ContextHandler( rParent ) +: ContextHandler2( rParent ) , mrPt1( rPt1 ) , mrPt2( rPt2 ) , nCount( 0 ) @@ -916,22 +908,21 @@ Path2DQuadBezierToContext::Path2DQuadBezierToContext( ContextHandler& rParent, { } -Reference< XFastContextHandler > Path2DQuadBezierToContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +ContextHandlerRef Path2DQuadBezierToContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xContext; if ( aElementToken == A_TOKEN( pt ) ) - xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties, nCount++ ? mrPt2 : mrPt1 ); // CT_AdjPoint2D - return xContext; + return new AdjPoint2DContext( *this, rAttribs, mrCustomShapeProperties, nCount++ ? mrPt2 : mrPt1 ); // CT_AdjPoint2D + return 0; } // --------------------------------------------------------------------- // CT_Path2DCubicBezierTo -class Path2DCubicBezierToContext : public ContextHandler +class Path2DCubicBezierToContext : public ContextHandler2 { public: - Path2DCubicBezierToContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, + Path2DCubicBezierToContext( ContextHandler2Helper& rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair&, EnhancedCustomShapeParameterPair&, EnhancedCustomShapeParameterPair& ); - 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 ::oox::AttributeList& rAttribs ) SAL_OVERRIDE; protected: CustomShapeProperties& mrCustomShapeProperties; @@ -941,11 +932,11 @@ protected: int nCount; }; -Path2DCubicBezierToContext::Path2DCubicBezierToContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, +Path2DCubicBezierToContext::Path2DCubicBezierToContext( ContextHandler2Helper& rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rControlPt1, EnhancedCustomShapeParameterPair& rControlPt2, EnhancedCustomShapeParameterPair& rEndPt ) -: ContextHandler( rParent ) +: ContextHandler2( rParent ) , mrCustomShapeProperties( rCustomShapeProperties ) , mrControlPt1( rControlPt1 ) , mrControlPt2( rControlPt2 ) @@ -954,25 +945,23 @@ Path2DCubicBezierToContext::Path2DCubicBezierToContext( ContextHandler& rParent, { } -Reference< XFastContextHandler > Path2DCubicBezierToContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +ContextHandlerRef Path2DCubicBezierToContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xContext; if ( aElementToken == A_TOKEN( pt ) ) - xContext = new AdjPoint2DContext( *this, xAttribs, mrCustomShapeProperties, + return new AdjPoint2DContext( *this, rAttribs, mrCustomShapeProperties, nCount++ ? nCount == 2 ? mrControlPt2 : mrEndPt : mrControlPt1 ); // CT_AdjPoint2D - return xContext; + return 0; } // --------------------------------------------------------------------- // CT_Path2DContext -class Path2DContext : public ContextHandler +class Path2DContext : public ContextHandler2 { public: - Path2DContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >& rSegments, Path2D& rPath2D ); + Path2DContext( ContextHandler2Helper& rParent, const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >& rSegments, Path2D& rPath2D ); virtual ~Path2DContext(); - 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 ::oox::AttributeList& rAttribs ) SAL_OVERRIDE; protected: Path2D& mrPath2D; @@ -980,20 +969,19 @@ protected: CustomShapeProperties& mrCustomShapeProperties; }; -Path2DContext::Path2DContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties, std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >& rSegments, Path2D& rPath2D ) -: ContextHandler( rParent ) +Path2DContext::Path2DContext( ContextHandler2Helper& rParent, const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, std::vector< com::sun::star::drawing::EnhancedCustomShapeSegment >& rSegments, Path2D& rPath2D ) +: ContextHandler2( rParent ) , mrPath2D( rPath2D ) , mrSegments( rSegments ) , mrCustomShapeProperties( rCustomShapeProperties ) { const OUString aEmptyString; - AttributeList aAttribs( xAttribs ); - rPath2D.w = aAttribs.getString( XML_w, aEmptyString ).toInt64(); - rPath2D.h = aAttribs.getString( XML_h, aEmptyString ).toInt64(); - rPath2D.fill = aAttribs.getToken( XML_fill, XML_norm ); - rPath2D.stroke = aAttribs.getBool( XML_stroke, sal_True ); - rPath2D.extrusionOk = aAttribs.getBool( XML_extrusionOk, sal_True ); + rPath2D.w = rAttribs.getString( XML_w, aEmptyString ).toInt64(); + rPath2D.h = rAttribs.getString( XML_h, aEmptyString ).toInt64(); + rPath2D.fill = rAttribs.getToken( XML_fill, XML_norm ); + rPath2D.stroke = rAttribs.getBool( XML_stroke, sal_True ); + rPath2D.extrusionOk = rAttribs.getBool( XML_extrusionOk, sal_True ); } Path2DContext::~Path2DContext() @@ -1032,10 +1020,9 @@ Path2DContext::~Path2DContext() mrSegments.push_back( aNewSegment ); } -Reference< XFastContextHandler > Path2DContext::createFastChildContext( sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) throw ( SAXException, RuntimeException ) +ContextHandlerRef Path2DContext::onCreateContext( sal_Int32 aElementToken, + const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xContext; switch( aElementToken ) { case A_TOKEN( close ) : @@ -1058,7 +1045,7 @@ Reference< XFastContextHandler > Path2DContext::createFastChildContext( sal_Int3 EnhancedCustomShapeParameterPair aAdjPoint2D; mrPath2D.parameter.push_back( aAdjPoint2D ); - xContext = new Path2DMoveToContext( *this, mrCustomShapeProperties, mrPath2D.parameter.back() ); + return new Path2DMoveToContext( *this, mrCustomShapeProperties, mrPath2D.parameter.back() ); } break; case A_TOKEN( lnTo ) : @@ -1074,7 +1061,7 @@ Reference< XFastContextHandler > Path2DContext::createFastChildContext( sal_Int3 } EnhancedCustomShapeParameterPair aAdjPoint2D; mrPath2D.parameter.push_back( aAdjPoint2D ); - xContext = new Path2DLineToContext( *this, mrCustomShapeProperties, mrPath2D.parameter.back() ); + return new Path2DLineToContext( *this, mrCustomShapeProperties, mrPath2D.parameter.back() ); } break; case A_TOKEN( arcTo ) : // CT_Path2DArcTo @@ -1092,8 +1079,8 @@ Reference< XFastContextHandler > Path2DContext::createFastChildContext( sal_Int3 EnhancedCustomShapeParameterPair aScale; EnhancedCustomShapeParameterPair aAngles; - aScale.First = GetAdjCoordinate( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_wR ), sal_True ); - aScale.Second = GetAdjCoordinate( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_hR ), sal_True ); + aScale.First = GetAdjCoordinate( mrCustomShapeProperties, rAttribs.getString( XML_wR ).get(), sal_True ); + aScale.Second = GetAdjCoordinate( mrCustomShapeProperties, rAttribs.getString( XML_hR ).get(), sal_True ); CustomShapeGuide aGuide; sal_Int32 nArcNum = mrCustomShapeProperties.getArcNum(); @@ -1101,7 +1088,7 @@ Reference< XFastContextHandler > Path2DContext::createFastChildContext( sal_Int3 // start angle aGuide.maName = "arctosa" + OUString::valueOf( nArcNum ); aGuide.maFormula = "(" - + GetFormulaParameter( GetAdjCoordinate( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_stAng ) ) ) + + GetFormulaParameter( GetAdjCoordinate( mrCustomShapeProperties, rAttribs.getString( XML_stAng ).get() ) ) + ")/60000.0"; aAngles.First.Value = Any( CustomShapeProperties::SetCustomShapeGuideValue( mrCustomShapeProperties.getGuideList(), aGuide ) ); aAngles.First.Type = EnhancedCustomShapeParameterType::EQUATION; @@ -1109,7 +1096,7 @@ Reference< XFastContextHandler > Path2DContext::createFastChildContext( sal_Int3 // swing angle aGuide.maName = "arctosw" + OUString::valueOf( nArcNum ); aGuide.maFormula = "(" - + GetFormulaParameter( GetAdjCoordinate( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_swAng ) ) ) + + GetFormulaParameter( GetAdjCoordinate( mrCustomShapeProperties, rAttribs.getString( XML_swAng ).get() ) ) + ")/60000.0"; aAngles.Second.Value = Any( CustomShapeProperties::SetCustomShapeGuideValue( mrCustomShapeProperties.getGuideList(), aGuide ) ); aAngles.Second.Type = EnhancedCustomShapeParameterType::EQUATION; @@ -1133,7 +1120,7 @@ Reference< XFastContextHandler > Path2DContext::createFastChildContext( sal_Int3 EnhancedCustomShapeParameterPair aPt2; mrPath2D.parameter.push_back( aPt1 ); mrPath2D.parameter.push_back( aPt2 ); - xContext = new Path2DQuadBezierToContext( *this, mrCustomShapeProperties, + return new Path2DQuadBezierToContext( *this, mrCustomShapeProperties, mrPath2D.parameter[ mrPath2D.parameter.size() - 2 ], mrPath2D.parameter.back() ); } @@ -1155,25 +1142,25 @@ Reference< XFastContextHandler > Path2DContext::createFastChildContext( sal_Int3 mrPath2D.parameter.push_back( aControlPt1 ); mrPath2D.parameter.push_back( aControlPt2 ); mrPath2D.parameter.push_back( aEndPt ); - xContext = new Path2DCubicBezierToContext( *this, mrCustomShapeProperties, + return new Path2DCubicBezierToContext( *this, mrCustomShapeProperties, mrPath2D.parameter[ mrPath2D.parameter.size() - 3 ], mrPath2D.parameter[ mrPath2D.parameter.size() - 2 ], mrPath2D.parameter.back() ); } break; } - return xContext; + return 0; } // --------------------------------------------------------------------- // CT_Path2DList -class Path2DListContext : public ContextHandler +class Path2DListContext : public ContextHandler2 { public: - Path2DListContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< EnhancedCustomShapeSegment >& rSegments, + Path2DListContext( ContextHandler2Helper& rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< EnhancedCustomShapeSegment >& rSegments, std::vector< Path2D >& rPath2DList ); - 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 ::oox::AttributeList& rAttribs ) SAL_OVERRIDE; protected: @@ -1182,90 +1169,82 @@ protected: std::vector< Path2D >& mrPath2DList; }; -Path2DListContext::Path2DListContext( ContextHandler& rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< EnhancedCustomShapeSegment >& rSegments, +Path2DListContext::Path2DListContext( ContextHandler2Helper& rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< EnhancedCustomShapeSegment >& rSegments, std::vector< Path2D >& rPath2DList ) -: ContextHandler( rParent ) +: ContextHandler2( rParent ) , mrCustomShapeProperties( rCustomShapeProperties ) , mrSegments( rSegments ) , mrPath2DList( rPath2DList ) { } -::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL Path2DListContext::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) +ContextHandlerRef Path2DListContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xContext; if ( aElementToken == A_TOKEN( path ) ) { Path2D aPath2D; mrPath2DList.push_back( aPath2D ); - xContext = new Path2DContext( *this, xAttribs, mrCustomShapeProperties, mrSegments, mrPath2DList.back() ); + return new Path2DContext( *this, rAttribs, mrCustomShapeProperties, mrSegments, mrPath2DList.back() ); } - return xContext; + return 0; } // --------------------------------------------------------------------- // CT_CustomGeometry2D -CustomShapeGeometryContext::CustomShapeGeometryContext( ContextHandler& rParent, const Reference< XFastAttributeList >& /* xAttribs */, CustomShapeProperties& rCustomShapeProperties ) -: ContextHandler( rParent ) +CustomShapeGeometryContext::CustomShapeGeometryContext( ContextHandler2Helper& rParent, const AttributeList& /* rAttribs */, CustomShapeProperties& rCustomShapeProperties ) +: ContextHandler2( rParent ) , mrCustomShapeProperties( rCustomShapeProperties ) { } -Reference< XFastContextHandler > CustomShapeGeometryContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +ContextHandlerRef CustomShapeGeometryContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xContext; switch( aElementToken ) { case A_TOKEN( avLst ): // CT_GeomGuideList adjust value list - xContext = new GeomGuideListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getAdjustmentGuideList() ); - break; + return new GeomGuideListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getAdjustmentGuideList() ); case A_TOKEN( gdLst ): // CT_GeomGuideList guide list - xContext = new GeomGuideListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getGuideList() ); - break; + return new GeomGuideListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getGuideList() ); case A_TOKEN( ahLst ): // CT_AdjustHandleList adjust handle list - xContext = new AdjustHandleListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getAdjustHandleList() ); - break; + return new AdjustHandleListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getAdjustHandleList() ); case A_TOKEN( cxnLst ): // CT_ConnectionSiteList connection site list - xContext = this; - break; + return this; case A_TOKEN( rect ): // CT_GeomRectList geometry rect list { GeomRect aGeomRect; - aGeomRect.l = GetAdjCoordinate( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_l ), sal_True ); - aGeomRect.t = GetAdjCoordinate( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_t ), sal_True ); - aGeomRect.r = GetAdjCoordinate( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_r ), sal_True ); - aGeomRect.b = GetAdjCoordinate( mrCustomShapeProperties, xAttribs->getOptionalValue( XML_b ), sal_True ); + aGeomRect.l = GetAdjCoordinate( mrCustomShapeProperties, rAttribs.getString( XML_l ).get(), sal_True ); + aGeomRect.t = GetAdjCoordinate( mrCustomShapeProperties, rAttribs.getString( XML_t ).get(), sal_True ); + aGeomRect.r = GetAdjCoordinate( mrCustomShapeProperties, rAttribs.getString( XML_r ).get(), sal_True ); + aGeomRect.b = GetAdjCoordinate( mrCustomShapeProperties, rAttribs.getString( XML_b ).get(), sal_True ); mrCustomShapeProperties.getTextRect() = aGeomRect; } break; case A_TOKEN( pathLst ): // CT_Path2DList 2d path list - xContext = new Path2DListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getSegments(), mrCustomShapeProperties.getPath2DList() ); - break; + return new Path2DListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getSegments(), mrCustomShapeProperties.getPath2DList() ); // from cxnLst: case A_TOKEN( cxn ): // CT_ConnectionSite { ConnectionSite aConnectionSite; mrCustomShapeProperties.getConnectionSiteList().push_back( aConnectionSite ); - xContext = new ConnectionSiteContext( *this, xAttribs, mrCustomShapeProperties, mrCustomShapeProperties.getConnectionSiteList().back() ); + return new ConnectionSiteContext( *this, rAttribs, mrCustomShapeProperties, mrCustomShapeProperties.getConnectionSiteList().back() ); } - break; } - return xContext; + return 0; } // --------------------------------------------------------------------- // CT_PresetGeometry2D -PresetShapeGeometryContext::PresetShapeGeometryContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties ) -: ContextHandler( rParent ) +PresetShapeGeometryContext::PresetShapeGeometryContext( ContextHandler2Helper& rParent, const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties ) +: ContextHandler2( rParent ) , mrCustomShapeProperties( rCustomShapeProperties ) { - sal_Int32 nShapeType = xAttribs->getOptionalValueToken( XML_prst, FastToken::DONTKNOW ); + sal_Int32 nShapeType = rAttribs.getToken( XML_prst, FastToken::DONTKNOW ); OSL_ENSURE( nShapeType != FastToken::DONTKNOW, "oox::drawingml::CustomShapeCustomGeometryContext::CustomShapeCustomGeometryContext(), unknown shape type" ); mrCustomShapeProperties.setShapePresetType( nShapeType ); } -Reference< XFastContextHandler > PresetShapeGeometryContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& ) throw (SAXException, RuntimeException) +ContextHandlerRef PresetShapeGeometryContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& ) { if ( aElementToken == A_TOKEN( avLst ) ) return new GeomGuideListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getAdjustmentGuideList() ); @@ -1275,16 +1254,16 @@ Reference< XFastContextHandler > PresetShapeGeometryContext::createFastChildCont // --------------------------------------------------------------------- // CT_PresetTextShape -PresetTextShapeContext::PresetTextShapeContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, CustomShapeProperties& rCustomShapeProperties ) -: ContextHandler( rParent ) +PresetTextShapeContext::PresetTextShapeContext( ContextHandler2Helper& rParent, const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties ) +: ContextHandler2( rParent ) , mrCustomShapeProperties( rCustomShapeProperties ) { - sal_Int32 nShapeType = xAttribs->getOptionalValueToken( XML_prst, FastToken::DONTKNOW ); + sal_Int32 nShapeType = rAttribs.getToken( XML_prst, FastToken::DONTKNOW ); OSL_ENSURE( nShapeType != FastToken::DONTKNOW, "oox::drawingml::CustomShapeCustomGeometryContext::CustomShapeCustomGeometryContext(), unknown shape type" ); mrCustomShapeProperties.setShapePresetType( nShapeType ); } -Reference< XFastContextHandler > PresetTextShapeContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& ) throw (SAXException, RuntimeException) +ContextHandlerRef PresetTextShapeContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& ) { if ( aElementToken == A_TOKEN( avLst ) ) return new GeomGuideListContext( *this, mrCustomShapeProperties, mrCustomShapeProperties.getAdjustmentGuideList() ); diff --git a/oox/source/drawingml/diagram/datamodelcontext.cxx b/oox/source/drawingml/diagram/datamodelcontext.cxx index 2526be2f7e7d..dba149e018e6 100644 --- a/oox/source/drawingml/diagram/datamodelcontext.cxx +++ b/oox/source/drawingml/diagram/datamodelcontext.cxx @@ -31,23 +31,20 @@ namespace oox { namespace drawingml { // CT_CxnList class CxnListContext - : public ContextHandler + : public ContextHandler2 { public: - CxnListContext( ContextHandler& rParent, + CxnListContext( ContextHandler2Helper& rParent, dgm::Connections & aConnections ) - : ContextHandler( rParent ) + : ContextHandler2( rParent ) , mrConnection( aConnections ) { } - virtual Reference< XFastContextHandler > SAL_CALL - createFastChildContext( sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw (SAXException, RuntimeException) + virtual ContextHandlerRef + onCreateContext( sal_Int32 aElementToken, + const AttributeList& rAttribs ) SAL_OVERRIDE { - Reference< XFastContextHandler > xRet; - switch( aElementToken ) { case DGM_TOKEN( cxn ): @@ -55,27 +52,25 @@ public: mrConnection.push_back( dgm::Connection() ); dgm::Connection& rConnection=mrConnection.back(); - const sal_Int32 nType = xAttribs->getOptionalValueToken( XML_type, XML_parOf ); + const sal_Int32 nType = rAttribs.getToken( XML_type, XML_parOf ); rConnection.mnType = nType; - rConnection.msModelId = xAttribs->getOptionalValue( XML_modelId ); - rConnection.msSourceId = xAttribs->getOptionalValue( XML_srcId ); - rConnection.msDestId = xAttribs->getOptionalValue( XML_destId ); - rConnection.msPresId = xAttribs->getOptionalValue( XML_presId ); - rConnection.msSibTransId = xAttribs->getOptionalValue( XML_sibTransId ); - rConnection.msParTransId = xAttribs->getOptionalValue( XML_parTransId ); - const AttributeList attribs( xAttribs ); - rConnection.mnSourceOrder = attribs.getInteger( XML_srcOrd, 0 ); - rConnection.mnDestOrder = attribs.getInteger( XML_destOrd, 0 ); + rConnection.msModelId = rAttribs.getString( XML_modelId ).get(); + rConnection.msSourceId = rAttribs.getString( XML_srcId ).get(); + rConnection.msDestId = rAttribs.getString( XML_destId ).get(); + rConnection.msPresId = rAttribs.getString( XML_presId ).get(); + rConnection.msSibTransId = rAttribs.getString( XML_sibTransId ).get(); + rConnection.msParTransId = rAttribs.getString( XML_parTransId ).get(); + rConnection.mnSourceOrder = rAttribs.getInteger( XML_srcOrd, 0 ); + rConnection.mnDestOrder = rAttribs.getInteger( XML_destOrd, 0 ); // skip CT_extLst - return xRet; + return 0; } default: break; } - if( !xRet.is() ) - xRet.set( this ); - return xRet; + + return this; } private: dgm::Connections& mrConnection; @@ -84,23 +79,19 @@ private: // CT_presLayoutVars class PresLayoutVarsContext - : public ContextHandler + : public ContextHandler2 { public: - PresLayoutVarsContext( ContextHandler& rParent, + PresLayoutVarsContext( ContextHandler2Helper& rParent, dgm::Point & rPoint ) : - ContextHandler( rParent ), + ContextHandler2( rParent ), mrPoint( rPoint ) { } - virtual Reference< XFastContextHandler > SAL_CALL - createFastChildContext( sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw (SAXException, RuntimeException) + virtual ContextHandlerRef + onCreateContext( sal_Int32 aElementToken, + const AttributeList& rAttribs ) SAL_OVERRIDE { - Reference< XFastContextHandler > xRet; - AttributeList aAttribs( xAttribs ); - switch( aElementToken ) { // TODO @@ -108,32 +99,31 @@ public: case DGM_TOKEN( animOne ): break; case DGM_TOKEN( bulletEnabled ): - mrPoint.mbBulletEnabled = aAttribs.getBool( XML_val, false ); + mrPoint.mbBulletEnabled = rAttribs.getBool( XML_val, false ); break; case DGM_TOKEN( chMax ): - mrPoint.mnMaxChildren = aAttribs.getInteger( XML_val, -1 ); + mrPoint.mnMaxChildren = rAttribs.getInteger( XML_val, -1 ); break; case DGM_TOKEN( chPref ): - mrPoint.mnPreferredChildren = aAttribs.getInteger( XML_val, -1 ); + mrPoint.mnPreferredChildren = rAttribs.getInteger( XML_val, -1 ); break; case DGM_TOKEN( dir ): - mrPoint.mnDirection = aAttribs.getToken( XML_val, XML_norm ); + mrPoint.mnDirection = rAttribs.getToken( XML_val, XML_norm ); break; case DGM_TOKEN( hierBranch ): - mrPoint.mnHierarchyBranch = aAttribs.getToken( XML_val, XML_std ); + mrPoint.mnHierarchyBranch = rAttribs.getToken( XML_val, XML_std ); break; case DGM_TOKEN( orgChart ): - mrPoint.mbOrgChartEnabled = aAttribs.getBool( XML_val, false ); + mrPoint.mbOrgChartEnabled = rAttribs.getBool( XML_val, false ); break; case DGM_TOKEN( resizeHandles ): - mrPoint.mnResizeHandles = aAttribs.getToken( XML_val, XML_rel ); + mrPoint.mnResizeHandles = rAttribs.getToken( XML_val, XML_rel ); break; default: break; } - if( !xRet.is() ) - xRet.set( this ); - return xRet; + + return this; } private: @@ -143,76 +133,64 @@ private: // CT_prSet class PropertiesContext - : public ContextHandler + : public ContextHandler2 { public: - PropertiesContext( ContextHandler& rParent, + PropertiesContext( ContextHandler2Helper& rParent, dgm::Point & rPoint, - const Reference< XFastAttributeList >& xAttribs ) : - ContextHandler( rParent ), + const AttributeList& rAttribs ) : + ContextHandler2( rParent ), mrPoint( rPoint ) { OUString aEmptyStr; - AttributeList aAttribs( xAttribs ); - - mrPoint.msColorTransformCategoryId = aAttribs.getString( XML_csCatId, aEmptyStr ); - mrPoint.msColorTransformTypeId = aAttribs.getString( XML_csTypeId, aEmptyStr ); - mrPoint.msLayoutCategoryId = aAttribs.getString( XML_loCatId, aEmptyStr ); - mrPoint.msLayoutTypeId = aAttribs.getString( XML_loTypeId, aEmptyStr ); - mrPoint.msPlaceholderText = aAttribs.getString( XML_phldrT, aEmptyStr ); - mrPoint.msPresentationAssociationId = aAttribs.getString( XML_presAssocID, aEmptyStr ); - mrPoint.msPresentationLayoutName = aAttribs.getString( XML_presName, aEmptyStr ); - mrPoint.msPresentationLayoutStyleLabel = aAttribs.getString( XML_presStyleLbl, aEmptyStr ); - mrPoint.msQuickStyleCategoryId = aAttribs.getString( XML_qsCatId, aEmptyStr ); - mrPoint.msQuickStyleTypeId = aAttribs.getString( XML_qsTypeId, aEmptyStr ); - - mrPoint.mnCustomAngle = aAttribs.getInteger( XML_custAng, -1 ); - mrPoint.mnPercentageNeighbourWidth = aAttribs.getInteger( XML_custLinFactNeighborX, -1 ); - mrPoint.mnPercentageNeighbourHeight = aAttribs.getInteger( XML_custLinFactNeighborY, -1 ); - mrPoint.mnPercentageOwnWidth = aAttribs.getInteger( XML_custLinFactX, -1 ); - mrPoint.mnPercentageOwnHeight = aAttribs.getInteger( XML_custLinFactY, -1 ); - mrPoint.mnIncludeAngleScale = aAttribs.getInteger( XML_custRadScaleInc, -1 ); - mrPoint.mnRadiusScale = aAttribs.getInteger( XML_custRadScaleRad, -1 ); - mrPoint.mnWidthScale = aAttribs.getInteger( XML_custScaleX, -1 ); - mrPoint.mnHeightScale = aAttribs.getInteger( XML_custScaleY, -1 ); - mrPoint.mnWidthOverride = aAttribs.getInteger( XML_custSzX, -1 ); - mrPoint.mnHeightOverride = aAttribs.getInteger( XML_custSzY, -1 ); - mrPoint.mnLayoutStyleCount = aAttribs.getInteger( XML_presStyleCnt, -1 ); - mrPoint.mnLayoutStyleIndex = aAttribs.getInteger( XML_presStyleIdx, -1 ); - - mrPoint.mbCoherent3DOffset = aAttribs.getBool( XML_coherent3DOff, false ); - mrPoint.mbCustomHorizontalFlip = aAttribs.getBool( XML_custFlipHor, false ); - mrPoint.mbCustomVerticalFlip = aAttribs.getBool( XML_custFlipVert, false ); - mrPoint.mbCustomText = aAttribs.getBool( XML_custT, false ); - mrPoint.mbIsPlaceholder = aAttribs.getBool( XML_phldr, false ); + + mrPoint.msColorTransformCategoryId = rAttribs.getString( XML_csCatId, aEmptyStr ); + mrPoint.msColorTransformTypeId = rAttribs.getString( XML_csTypeId, aEmptyStr ); + mrPoint.msLayoutCategoryId = rAttribs.getString( XML_loCatId, aEmptyStr ); + mrPoint.msLayoutTypeId = rAttribs.getString( XML_loTypeId, aEmptyStr ); + mrPoint.msPlaceholderText = rAttribs.getString( XML_phldrT, aEmptyStr ); + mrPoint.msPresentationAssociationId = rAttribs.getString( XML_presAssocID, aEmptyStr ); + mrPoint.msPresentationLayoutName = rAttribs.getString( XML_presName, aEmptyStr ); + mrPoint.msPresentationLayoutStyleLabel = rAttribs.getString( XML_presStyleLbl, aEmptyStr ); + mrPoint.msQuickStyleCategoryId = rAttribs.getString( XML_qsCatId, aEmptyStr ); + mrPoint.msQuickStyleTypeId = rAttribs.getString( XML_qsTypeId, aEmptyStr ); + + mrPoint.mnCustomAngle = rAttribs.getInteger( XML_custAng, -1 ); + mrPoint.mnPercentageNeighbourWidth = rAttribs.getInteger( XML_custLinFactNeighborX, -1 ); + mrPoint.mnPercentageNeighbourHeight = rAttribs.getInteger( XML_custLinFactNeighborY, -1 ); + mrPoint.mnPercentageOwnWidth = rAttribs.getInteger( XML_custLinFactX, -1 ); + mrPoint.mnPercentageOwnHeight = rAttribs.getInteger( XML_custLinFactY, -1 ); + mrPoint.mnIncludeAngleScale = rAttribs.getInteger( XML_custRadScaleInc, -1 ); + mrPoint.mnRadiusScale = rAttribs.getInteger( XML_custRadScaleRad, -1 ); + mrPoint.mnWidthScale = rAttribs.getInteger( XML_custScaleX, -1 ); + mrPoint.mnHeightScale = rAttribs.getInteger( XML_custScaleY, -1 ); + mrPoint.mnWidthOverride = rAttribs.getInteger( XML_custSzX, -1 ); + mrPoint.mnHeightOverride = rAttribs.getInteger( XML_custSzY, -1 ); + mrPoint.mnLayoutStyleCount = rAttribs.getInteger( XML_presStyleCnt, -1 ); + mrPoint.mnLayoutStyleIndex = rAttribs.getInteger( XML_presStyleIdx, -1 ); + + mrPoint.mbCoherent3DOffset = rAttribs.getBool( XML_coherent3DOff, false ); + mrPoint.mbCustomHorizontalFlip = rAttribs.getBool( XML_custFlipHor, false ); + mrPoint.mbCustomVerticalFlip = rAttribs.getBool( XML_custFlipVert, false ); + mrPoint.mbCustomText = rAttribs.getBool( XML_custT, false ); + mrPoint.mbIsPlaceholder = rAttribs.getBool( XML_phldr, false ); } - virtual Reference< XFastContextHandler > SAL_CALL - createFastChildContext( sal_Int32 aElementToken, - const Reference< XFastAttributeList >& ) - throw (SAXException, RuntimeException) + virtual ContextHandlerRef + onCreateContext( sal_Int32 aElementToken, + const AttributeList& ) SAL_OVERRIDE { - Reference< XFastContextHandler > xRet; - switch( aElementToken ) { case DGM_TOKEN( presLayoutVars ): - { - xRet.set( new PresLayoutVarsContext( *this, mrPoint ) ); - break; - } + return new PresLayoutVarsContext( *this, mrPoint ); case DGM_TOKEN( style ): - { - // TODO // skip CT_shapeStyle - return xRet; - } + return 0; default: break; } - if( !xRet.is() ) - xRet.set( this ); - return xRet; + return this; } private: @@ -222,48 +200,43 @@ private: // CL_Pt class PtContext - : public ContextHandler + : public ContextHandler2 { public: - PtContext( ContextHandler& rParent, - const Reference< XFastAttributeList >& xAttribs, + PtContext( ContextHandler2Helper& rParent, + const AttributeList& rAttribs, dgm::Point & rPoint): - ContextHandler( rParent ), + ContextHandler2( rParent ), mrPoint( rPoint ) { - mrPoint.msModelId = xAttribs->getOptionalValue( XML_modelId ); + mrPoint.msModelId = rAttribs.getString( XML_modelId ).get(); // the default type is XML_node - const sal_Int32 nType = xAttribs->getOptionalValueToken( XML_type, XML_node ); + const sal_Int32 nType = rAttribs.getToken( XML_type, XML_node ); mrPoint.mnType = nType; // ignore the cxnId unless it is this type. See 5.15.3.1.3 in Primer if( ( nType == XML_parTrans ) || ( nType == XML_sibTrans ) ) - mrPoint.msCnxId = xAttribs->getOptionalValue( XML_cxnId ); + mrPoint.msCnxId = rAttribs.getString( XML_cxnId ).get(); } - virtual Reference< XFastContextHandler > SAL_CALL - createFastChildContext( sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw (SAXException, RuntimeException) + virtual ContextHandlerRef + onCreateContext( sal_Int32 aElementToken, + const AttributeList& rAttribs ) SAL_OVERRIDE { - Reference< XFastContextHandler > xRet; - switch( aElementToken ) { case DGM_TOKEN( extLst ): - return xRet; + return 0; case DGM_TOKEN( prSet ): OSL_TRACE( "diagram property set for point"); - xRet = new PropertiesContext( *this, mrPoint, xAttribs ); - break; + return new PropertiesContext( *this, mrPoint, rAttribs ); case DGM_TOKEN( spPr ): OSL_TRACE( "shape props for point"); if( !mrPoint.mpShape ) mrPoint.mpShape.reset( new Shape() ); - xRet = new ShapePropertiesContext( *this, *(mrPoint.mpShape) ); - break; + return new ShapePropertiesContext( *this, *(mrPoint.mpShape) ); case DGM_TOKEN( t ): { OSL_TRACE( "shape text body for point"); @@ -271,15 +244,12 @@ public: if( !mrPoint.mpShape ) mrPoint.mpShape.reset( new Shape() ); mrPoint.mpShape->setTextBody( xTextBody ); - xRet = new TextBodyContext( *this, *xTextBody ); - break; + return new TextBodyContext( *this, *xTextBody ); } default: break; } - if( !xRet.is() ) - xRet.set( this ); - return xRet; + return this; } private: @@ -290,35 +260,29 @@ private: // CT_PtList class PtListContext - : public ContextHandler + : public ContextHandler2 { public: - PtListContext( ContextHandler& rParent, dgm::Points& rPoints) : - ContextHandler( rParent ), + PtListContext( ContextHandler2Helper& rParent, dgm::Points& rPoints) : + ContextHandler2( rParent ), mrPoints( rPoints ) {} - virtual Reference< XFastContextHandler > SAL_CALL - createFastChildContext( sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw (SAXException, RuntimeException) + virtual ContextHandlerRef + onCreateContext( sal_Int32 aElementToken, + const AttributeList& rAttribs ) SAL_OVERRIDE { - Reference< XFastContextHandler > xRet; - switch( aElementToken ) { case DGM_TOKEN( pt ): { // CT_Pt mrPoints.push_back( dgm::Point() ); - xRet.set( new PtContext( *this, xAttribs, mrPoints.back() ) ); - break; + return new PtContext( *this, rAttribs, mrPoints.back() ); } default: break; } - if( !xRet.is() ) - xRet.set( this ); - return xRet; + return this; } private: @@ -327,23 +291,20 @@ private: // CT_BackgroundFormatting class BackgroundFormattingContext - : public ContextHandler + : public ContextHandler2 { public: - BackgroundFormattingContext( ContextHandler& rParent, DiagramDataPtr & pModel ) - : ContextHandler( rParent ) + BackgroundFormattingContext( ContextHandler2Helper& rParent, DiagramDataPtr & pModel ) + : ContextHandler2( rParent ) , mpDataModel( pModel ) { OSL_ENSURE( pModel, "the data model MUST NOT be NULL" ); } - virtual Reference< XFastContextHandler > SAL_CALL - createFastChildContext( sal_Int32 aElementToken, - const Reference< XFastAttributeList >& xAttribs ) - throw (SAXException, RuntimeException) + virtual ContextHandlerRef + onCreateContext( sal_Int32 aElementToken, + const AttributeList& rAttribs ) SAL_OVERRIDE { - Reference< XFastContextHandler > xRet; - switch( aElementToken ) { case A_TOKEN( blipFill ): @@ -353,9 +314,8 @@ public: case A_TOKEN( pattFill ): case A_TOKEN( solidFill ): // EG_FillProperties - xRet.set( FillPropertiesContext::createFillContext( - *this, aElementToken, xAttribs, *mpDataModel->getFillProperties() ) ); - break; + return FillPropertiesContext::createFillContext( + *this, aElementToken, rAttribs, *mpDataModel->getFillProperties() ); case A_TOKEN( effectDag ): case A_TOKEN( effectLst ): // TODO @@ -364,9 +324,7 @@ public: default: break; } - if( !xRet.is() ) - xRet.set( this ); - return xRet; + return this; } private: DiagramDataPtr mpDataModel; @@ -374,9 +332,9 @@ private: -DataModelContext::DataModelContext( ContextHandler& rParent, +DataModelContext::DataModelContext( ContextHandler2Helper& rParent, const DiagramDataPtr & pDataModel ) - : ContextHandler( rParent ) + : ContextHandler2( rParent ) , mpDataModel( pDataModel ) { OSL_ENSURE( pDataModel, "Data Model must not be NULL" ); @@ -389,45 +347,36 @@ DataModelContext::~DataModelContext() mpDataModel->dump(); } -Reference< XFastContextHandler > SAL_CALL -DataModelContext::createFastChildContext( ::sal_Int32 aElement, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException) +ContextHandlerRef +DataModelContext::onCreateContext( ::sal_Int32 aElement, + const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch( aElement ) { case DGM_TOKEN( cxnLst ): // CT_CxnList - xRet.set( new CxnListContext( *this, mpDataModel->getConnections() ) ); - break; + return new CxnListContext( *this, mpDataModel->getConnections() ); case DGM_TOKEN( ptLst ): // CT_PtList - xRet.set( new PtListContext( *this, mpDataModel->getPoints() ) ); - break; + return new PtListContext( *this, mpDataModel->getPoints() ); case DGM_TOKEN( bg ): // CT_BackgroundFormatting - xRet.set( new BackgroundFormattingContext( *this, mpDataModel ) ); - break; + return new BackgroundFormattingContext( *this, mpDataModel ); case DGM_TOKEN( whole ): // CT_WholeE2oFormatting // TODO - return xRet; + return 0; case DGM_TOKEN( extLst ): case A_TOKEN( ext ): break; case DSP_TOKEN( dataModelExt ): - mpDataModel->getExtDrawings().push_back( xAttribs->getOptionalValue( XML_relId ) ); + mpDataModel->getExtDrawings().push_back( rAttribs.getString( XML_relId ).get() ); break; default: break; } - if( !xRet.is() ) - xRet.set( this ); - - return xRet; + return this; } } } diff --git a/oox/source/drawingml/diagram/datamodelcontext.hxx b/oox/source/drawingml/diagram/datamodelcontext.hxx index ad3163f4fad1..eb2333efff55 100644 --- a/oox/source/drawingml/diagram/datamodelcontext.hxx +++ b/oox/source/drawingml/diagram/datamodelcontext.hxx @@ -22,19 +22,19 @@ #include <com/sun/star/drawing/XShapes.hpp> -#include "oox/core/contexthandler.hxx" +#include "oox/core/contexthandler2.hxx" #include "diagram.hxx" namespace oox { namespace drawingml { // CT_DataModel -class DataModelContext : public ::oox::core::ContextHandler +class DataModelContext : public ::oox::core::ContextHandler2 { public: - DataModelContext( ::oox::core::ContextHandler& rParent, const DiagramDataPtr & pDataModelPtr ); + DataModelContext( ::oox::core::ContextHandler2Helper& rParent, const DiagramDataPtr & pDataModelPtr ); virtual ~DataModelContext(); - 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 Element, const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE; protected: DiagramDataPtr mpDataModel; diff --git a/oox/source/drawingml/diagram/diagramfragmenthandler.cxx b/oox/source/drawingml/diagram/diagramfragmenthandler.cxx index cea339ad1758..f003fb167413 100644 --- a/oox/source/drawingml/diagram/diagramfragmenthandler.cxx +++ b/oox/source/drawingml/diagram/diagramfragmenthandler.cxx @@ -34,7 +34,7 @@ DiagramDataFragmentHandler::DiagramDataFragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath, const DiagramDataPtr pDataPtr ) throw( ) - : FragmentHandler( rFilter, rFragmentPath ) + : FragmentHandler2( rFilter, rFragmentPath ) , mpDataPtr( pDataPtr ) { } @@ -51,26 +51,19 @@ void SAL_CALL DiagramDataFragmentHandler::endDocument() } -Reference< XFastContextHandler > SAL_CALL -DiagramDataFragmentHandler::createFastChildContext( ::sal_Int32 aElement, - const Reference< XFastAttributeList >& ) - throw ( SAXException, RuntimeException) +ContextHandlerRef +DiagramDataFragmentHandler::onCreateContext( ::sal_Int32 aElement, + const AttributeList& ) { - Reference< XFastContextHandler > xRet; - switch( aElement ) { case DGM_TOKEN( dataModel ): - xRet.set( new DataModelContext( *this, mpDataPtr ) ); - break; + return new DataModelContext( *this, mpDataPtr ); default: break; } - if( !xRet.is() ) - xRet = getFastContextHandler(); - - return xRet; + return this; } /////////////////// diff --git a/oox/source/drawingml/diagram/diagramfragmenthandler.hxx b/oox/source/drawingml/diagram/diagramfragmenthandler.hxx index 95808ce243d8..af86a900caa0 100644 --- a/oox/source/drawingml/diagram/diagramfragmenthandler.hxx +++ b/oox/source/drawingml/diagram/diagramfragmenthandler.hxx @@ -20,21 +20,20 @@ #ifndef OOX_DRAWINGML_DIAGRAMFRAGMENTHANDLER #define OOX_DRAWINGML_DIAGRAMFRAGMENTHANDLER -#include "oox/core/fragmenthandler.hxx" #include "oox/core/fragmenthandler2.hxx" #include "oox/drawingml/diagram/diagram.hxx" namespace oox { namespace drawingml { -class DiagramDataFragmentHandler : public ::oox::core::FragmentHandler +class DiagramDataFragmentHandler : public ::oox::core::FragmentHandler2 { public: DiagramDataFragmentHandler( oox::core::XmlFilterBase& rFilter, const OUString& rFragmentPath, const DiagramDataPtr pDataPtr ) throw(); virtual ~DiagramDataFragmentHandler() 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 Element, const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE; private: diff --git a/oox/source/drawingml/effectpropertiescontext.cxx b/oox/source/drawingml/effectpropertiescontext.cxx index 7da597157314..2364ee64757f 100644 --- a/oox/source/drawingml/effectpropertiescontext.cxx +++ b/oox/source/drawingml/effectpropertiescontext.cxx @@ -22,9 +22,9 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace drawingml { // --------------------------------------------------------------------- -EffectPropertiesContext::EffectPropertiesContext( ContextHandler& rParent, +EffectPropertiesContext::EffectPropertiesContext( ContextHandler2Helper& rParent, EffectProperties& rEffectProperties ) throw() -: ContextHandler( rParent ) +: ContextHandler2( rParent ) , mrEffectProperties( rEffectProperties ) { } @@ -33,15 +33,14 @@ EffectPropertiesContext::~EffectPropertiesContext() { } -Reference< XFastContextHandler > EffectPropertiesContext::createFastChildContext( sal_Int32 nElement, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) { - AttributeList aAttribs( xAttribs ); switch( nElement ) { case A_TOKEN( outerShdw ): { - mrEffectProperties.maShadow.moShadowDist = aAttribs.getInteger( XML_dist, 0 ); - mrEffectProperties.maShadow.moShadowDir = aAttribs.getInteger( XML_dir, 0 ); + mrEffectProperties.maShadow.moShadowDist = rAttribs.getInteger( XML_dist, 0 ); + mrEffectProperties.maShadow.moShadowDir = rAttribs.getInteger( XML_dir, 0 ); return new ColorContext( *this, mrEffectProperties.maShadow.moShadowColor ); } break; diff --git a/oox/source/drawingml/fillpropertiesgroupcontext.cxx b/oox/source/drawingml/fillpropertiesgroupcontext.cxx index 4a0769328142..0d84d3a6bb90 100644 --- a/oox/source/drawingml/fillpropertiesgroupcontext.cxx +++ b/oox/source/drawingml/fillpropertiesgroupcontext.cxx @@ -28,83 +28,75 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::xml::sax; -using ::oox::core::ContextHandler; +using ::oox::core::ContextHandler2; using ::oox::core::XmlFilterBase; +using ::oox::core::ContextHandlerRef; namespace oox { namespace drawingml { -// ============================================================================ - -SolidFillContext::SolidFillContext( ContextHandler& rParent, - const Reference< XFastAttributeList >&, FillProperties& rFillProps ) : +SolidFillContext::SolidFillContext( ContextHandler2Helper& rParent, + const AttributeList&, FillProperties& rFillProps ) : ColorContext( rParent, rFillProps.maFillColor ) { } -// ============================================================================ - -GradientFillContext::GradientFillContext( ContextHandler& rParent, - const Reference< XFastAttributeList >& rxAttribs, GradientFillProperties& rGradientProps ) : - ContextHandler( rParent ), +GradientFillContext::GradientFillContext( ContextHandler2Helper& rParent, + const AttributeList& rAttribs, GradientFillProperties& rGradientProps ) : + ContextHandler2( rParent ), mrGradientProps( rGradientProps ) { - AttributeList aAttribs( rxAttribs ); - mrGradientProps.moShadeFlip = aAttribs.getToken( XML_flip ); - mrGradientProps.moRotateWithShape = aAttribs.getBool( XML_rotWithShape ); + mrGradientProps.moShadeFlip = rAttribs.getToken( XML_flip ); + mrGradientProps.moRotateWithShape = rAttribs.getBool( XML_rotWithShape ); } -Reference< XFastContextHandler > GradientFillContext::createFastChildContext( - sal_Int32 nElement, const Reference< XFastAttributeList >& rxAttribs ) throw (SAXException, RuntimeException) +ContextHandlerRef GradientFillContext::onCreateContext( + sal_Int32 nElement, const AttributeList& rAttribs ) { - AttributeList aAttribs( rxAttribs ); switch( nElement ) { case A_TOKEN( gsLst ): return this; // for gs elements case A_TOKEN( gs ): - if( aAttribs.hasAttribute( XML_pos ) ) + if( rAttribs.hasAttribute( XML_pos ) ) { - double fPosition = getLimitedValue< double >( aAttribs.getDouble( XML_pos, 0.0 ) / 100000.0, 0.0, 1.0 ); + double fPosition = getLimitedValue< double >( rAttribs.getDouble( XML_pos, 0.0 ) / 100000.0, 0.0, 1.0 ); return new ColorContext( *this, mrGradientProps.maGradientStops[ fPosition ] ); } break; case A_TOKEN( lin ): - mrGradientProps.moShadeAngle = aAttribs.getInteger( XML_ang ); - mrGradientProps.moShadeScaled = aAttribs.getBool( XML_scaled ); + mrGradientProps.moShadeAngle = rAttribs.getInteger( XML_ang ); + mrGradientProps.moShadeScaled = rAttribs.getBool( XML_scaled ); break; case A_TOKEN( path ): // always set a path type, this disables linear gradient in conversion - mrGradientProps.moGradientPath = aAttribs.getToken( XML_path, XML_rect ); + mrGradientProps.moGradientPath = rAttribs.getToken( XML_path, XML_rect ); return this; // for fillToRect element case A_TOKEN( fillToRect ): - mrGradientProps.moFillToRect = GetRelativeRect( rxAttribs ); + mrGradientProps.moFillToRect = GetRelativeRect( rAttribs.getFastAttributeList() ); break; case A_TOKEN( tileRect ): - mrGradientProps.moTileRect = GetRelativeRect( rxAttribs ); + mrGradientProps.moTileRect = GetRelativeRect( rAttribs.getFastAttributeList() ); break; } return 0; } -// ============================================================================ - -PatternFillContext::PatternFillContext( ContextHandler& rParent, - const Reference< XFastAttributeList >& rxAttribs, PatternFillProperties& rPatternProps ) : - ContextHandler( rParent ), +PatternFillContext::PatternFillContext( ContextHandler2Helper& rParent, + const AttributeList& rAttribs, PatternFillProperties& rPatternProps ) : + ContextHandler2( rParent ), mrPatternProps( rPatternProps ) { - AttributeList aAttribs( rxAttribs ); - mrPatternProps.moPattPreset = aAttribs.getToken( XML_prst ); + mrPatternProps.moPattPreset = rAttribs.getToken( XML_prst ); } -Reference< XFastContextHandler > PatternFillContext::createFastChildContext( - sal_Int32 nElement, const Reference< XFastAttributeList >& ) throw (SAXException, RuntimeException) +ContextHandlerRef PatternFillContext::onCreateContext( + sal_Int32 nElement, const AttributeList& ) { switch( nElement ) { @@ -116,18 +108,14 @@ Reference< XFastContextHandler > PatternFillContext::createFastChildContext( return 0; } -// ============================================================================ -// ============================================================================ - -ColorChangeContext::ColorChangeContext( ContextHandler& rParent, - const Reference< XFastAttributeList >& rxAttribs, BlipFillProperties& rBlipProps ) : - ContextHandler( rParent ), +ColorChangeContext::ColorChangeContext( ContextHandler2Helper& rParent, + const AttributeList& rAttribs, BlipFillProperties& rBlipProps ) : + ContextHandler2( rParent ), mrBlipProps( rBlipProps ) { mrBlipProps.maColorChangeFrom.setUnused(); mrBlipProps.maColorChangeTo.setUnused(); - AttributeList aAttribs( rxAttribs ); - mbUseAlpha = aAttribs.getBool( XML_useA, true ); + mbUseAlpha = rAttribs.getBool( XML_useA, true ); } ColorChangeContext::~ColorChangeContext() @@ -136,8 +124,8 @@ ColorChangeContext::~ColorChangeContext() mrBlipProps.maColorChangeTo.clearTransparence(); } -Reference< XFastContextHandler > ColorChangeContext::createFastChildContext( - sal_Int32 nElement, const Reference< XFastAttributeList >& ) throw (SAXException, RuntimeException) +ContextHandlerRef ColorChangeContext::onCreateContext( + sal_Int32 nElement, const AttributeList& ) { switch( nElement ) { @@ -149,29 +137,26 @@ Reference< XFastContextHandler > ColorChangeContext::createFastChildContext( return 0; } -// ============================================================================ - -BlipContext::BlipContext( ContextHandler& rParent, - const Reference< XFastAttributeList >& rxAttribs, BlipFillProperties& rBlipProps ) : - ContextHandler( rParent ), +BlipContext::BlipContext( ContextHandler2Helper& rParent, + const AttributeList& rAttribs, BlipFillProperties& rBlipProps ) : + ContextHandler2( rParent ), mrBlipProps( rBlipProps ) { - AttributeList aAttribs( rxAttribs ); - if( aAttribs.hasAttribute( R_TOKEN( embed ) ) ) + if( rAttribs.hasAttribute( R_TOKEN( embed ) ) ) { // internal picture URL - OUString aFragmentPath = getFragmentPathFromRelId( aAttribs.getString( R_TOKEN( embed ), OUString() ) ); + OUString aFragmentPath = getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( embed ), OUString() ) ); if( !aFragmentPath.isEmpty() ) mrBlipProps.mxGraphic = getFilter().getGraphicHelper().importEmbeddedGraphic( aFragmentPath ); } - else if( aAttribs.hasAttribute( R_TOKEN( link ) ) ) + else if( rAttribs.hasAttribute( R_TOKEN( link ) ) ) { // external URL // we will embed this link, this is better than just doing nothing.. // TODO: import this graphic as real link, but this requires some // code rework. - OUString aRelId = aAttribs.getString( R_TOKEN( link ), OUString() ); + OUString aRelId = rAttribs.getString( R_TOKEN( link ), OUString() ); OUString aTargetLink = getFilter().getAbsoluteUrl( getRelations().getExternalTargetFromRelId( aRelId ) ); SfxMedium xMed( aTargetLink, STREAM_STD_READ ); xMed.DownLoad(); @@ -181,10 +166,9 @@ BlipContext::BlipContext( ContextHandler& rParent, } } -Reference< XFastContextHandler > BlipContext::createFastChildContext( - sal_Int32 nElement, const Reference< XFastAttributeList >& rxAttribs ) throw (SAXException, RuntimeException) +ContextHandlerRef BlipContext::onCreateContext( + sal_Int32 nElement, const AttributeList& rAttribs ) { - AttributeList aAttribs( rxAttribs ); switch( nElement ) { case A_TOKEN( biLevel ): @@ -193,56 +177,52 @@ Reference< XFastContextHandler > BlipContext::createFastChildContext( break; case A_TOKEN( clrChange ): - return new ColorChangeContext( *this, rxAttribs, mrBlipProps ); + return new ColorChangeContext( *this, rAttribs, mrBlipProps ); case A_TOKEN( lum ): - mrBlipProps.moBrightness = aAttribs.getInteger( XML_bright ); - mrBlipProps.moContrast = aAttribs.getInteger( XML_contrast ); + mrBlipProps.moBrightness = rAttribs.getInteger( XML_bright ); + mrBlipProps.moContrast = rAttribs.getInteger( XML_contrast ); break; } return 0; } -// ============================================================================ - -BlipFillContext::BlipFillContext( ContextHandler& rParent, - const Reference< XFastAttributeList >& rxAttribs, BlipFillProperties& rBlipProps ) : - ContextHandler( rParent ), +BlipFillContext::BlipFillContext( ContextHandler2Helper& rParent, + const AttributeList& rAttribs, BlipFillProperties& rBlipProps ) : + ContextHandler2( rParent ), mrBlipProps( rBlipProps ) { - AttributeList aAttribs( rxAttribs ); - mrBlipProps.moRotateWithShape = aAttribs.getBool( XML_rotWithShape ); + mrBlipProps.moRotateWithShape = rAttribs.getBool( XML_rotWithShape ); } -Reference< XFastContextHandler > BlipFillContext::createFastChildContext( - sal_Int32 nElement, const Reference< XFastAttributeList >& rxAttribs ) throw (SAXException, RuntimeException) +ContextHandlerRef BlipFillContext::onCreateContext( + sal_Int32 nElement, const AttributeList& rAttribs ) { - AttributeList aAttribs( rxAttribs ); switch( nElement ) { case A_TOKEN( blip ): - return new BlipContext( *this, rxAttribs, mrBlipProps ); + return new BlipContext( *this, rAttribs, mrBlipProps ); case A_TOKEN( srcRect ): { OUString aDefault( "0" ); ::com::sun::star::geometry::IntegerRectangle2D aClipRect; - aClipRect.X1 = GetPercent( aAttribs.getString( XML_l, aDefault ) ); - aClipRect.Y1 = GetPercent( aAttribs.getString( XML_t, aDefault ) ); - aClipRect.X2 = GetPercent( aAttribs.getString( XML_r, aDefault ) ); - aClipRect.Y2 = GetPercent( aAttribs.getString( XML_b, aDefault ) ); + aClipRect.X1 = GetPercent( rAttribs.getString( XML_l, aDefault ) ); + aClipRect.Y1 = GetPercent( rAttribs.getString( XML_t, aDefault ) ); + aClipRect.X2 = GetPercent( rAttribs.getString( XML_r, aDefault ) ); + aClipRect.Y2 = GetPercent( rAttribs.getString( XML_b, aDefault ) ); mrBlipProps.moClipRect = aClipRect; } break; case A_TOKEN( tile ): mrBlipProps.moBitmapMode = getBaseToken( nElement ); - mrBlipProps.moTileOffsetX = aAttribs.getInteger( XML_tx ); - mrBlipProps.moTileOffsetY = aAttribs.getInteger( XML_ty ); - mrBlipProps.moTileScaleX = aAttribs.getInteger( XML_sx ); - mrBlipProps.moTileScaleY = aAttribs.getInteger( XML_sy ); - mrBlipProps.moTileAlign = aAttribs.getToken( XML_algn ); - mrBlipProps.moTileFlip = aAttribs.getToken( XML_flip ); + mrBlipProps.moTileOffsetX = rAttribs.getInteger( XML_tx ); + mrBlipProps.moTileOffsetY = rAttribs.getInteger( XML_ty ); + mrBlipProps.moTileScaleX = rAttribs.getInteger( XML_sx ); + mrBlipProps.moTileScaleY = rAttribs.getInteger( XML_sy ); + mrBlipProps.moTileAlign = rAttribs.getToken( XML_algn ); + mrBlipProps.moTileFlip = rAttribs.getToken( XML_flip ); break; case A_TOKEN( stretch ): @@ -250,47 +230,41 @@ Reference< XFastContextHandler > BlipFillContext::createFastChildContext( return this; // for fillRect element case A_TOKEN( fillRect ): - mrBlipProps.moFillRect = GetRelativeRect( rxAttribs ); + mrBlipProps.moFillRect = GetRelativeRect( rAttribs.getFastAttributeList() ); break; } return 0; } -// ============================================================================ -// ============================================================================ - -FillPropertiesContext::FillPropertiesContext( ContextHandler& rParent, FillProperties& rFillProps ) : - ContextHandler( rParent ), +FillPropertiesContext::FillPropertiesContext( ContextHandler2Helper& rParent, FillProperties& rFillProps ) : + ContextHandler2( rParent ), mrFillProps( rFillProps ) { } -Reference< XFastContextHandler > FillPropertiesContext::createFastChildContext( - sal_Int32 nElement, const Reference< XFastAttributeList >& rxAttribs ) - throw ( SAXException, RuntimeException ) +ContextHandlerRef FillPropertiesContext::onCreateContext( + sal_Int32 nElement, const AttributeList& rAttribs ) { - return createFillContext( *this, nElement, rxAttribs, mrFillProps ); + return createFillContext( *this, nElement, rAttribs, mrFillProps ); } -Reference< XFastContextHandler > FillPropertiesContext::createFillContext( - ContextHandler& rParent, sal_Int32 nElement, - const Reference< XFastAttributeList >& rxAttribs, FillProperties& rFillProps ) +ContextHandlerRef FillPropertiesContext::createFillContext( + ContextHandler2Helper& rParent, sal_Int32 nElement, + const AttributeList& rAttribs, FillProperties& rFillProps ) { switch( nElement ) { case A_TOKEN( noFill ): { rFillProps.moFillType = getBaseToken( nElement ); return 0; }; - case A_TOKEN( solidFill ): { rFillProps.moFillType = getBaseToken( nElement ); return new SolidFillContext( rParent, rxAttribs, rFillProps ); }; - case A_TOKEN( gradFill ): { rFillProps.moFillType = getBaseToken( nElement ); return new GradientFillContext( rParent, rxAttribs, rFillProps.maGradientProps ); }; - case A_TOKEN( pattFill ): { rFillProps.moFillType = getBaseToken( nElement ); return new PatternFillContext( rParent, rxAttribs, rFillProps.maPatternProps ); }; - case A_TOKEN( blipFill ): { rFillProps.moFillType = getBaseToken( nElement ); return new BlipFillContext( rParent, rxAttribs, rFillProps.maBlipProps ); }; + case A_TOKEN( solidFill ): { rFillProps.moFillType = getBaseToken( nElement ); return new SolidFillContext( rParent, rAttribs, rFillProps ); }; + case A_TOKEN( gradFill ): { rFillProps.moFillType = getBaseToken( nElement ); return new GradientFillContext( rParent, rAttribs, rFillProps.maGradientProps ); }; + case A_TOKEN( pattFill ): { rFillProps.moFillType = getBaseToken( nElement ); return new PatternFillContext( rParent, rAttribs, rFillProps.maPatternProps ); }; + case A_TOKEN( blipFill ): { rFillProps.moFillType = getBaseToken( nElement ); return new BlipFillContext( rParent, rAttribs, rFillProps.maBlipProps ); }; case A_TOKEN( grpFill ): { rFillProps.moFillType = getBaseToken( nElement ); return 0; }; // TODO } return 0; } -// ============================================================================ - -SimpleFillPropertiesContext::SimpleFillPropertiesContext( ContextHandler& rParent, Color& rColor ) : +SimpleFillPropertiesContext::SimpleFillPropertiesContext( ContextHandler2Helper& rParent, Color& rColor ) : FillPropertiesContext( rParent, *this ), mrColor( rColor ) { @@ -301,8 +275,6 @@ SimpleFillPropertiesContext::~SimpleFillPropertiesContext() mrColor = getBestSolidColor(); } -// ============================================================================ - } // namespace drawingml } // namespace oox diff --git a/oox/source/drawingml/graphicshapecontext.cxx b/oox/source/drawingml/graphicshapecontext.cxx index 22ad713cb19b..0def78514c75 100644 --- a/oox/source/drawingml/graphicshapecontext.cxx +++ b/oox/source/drawingml/graphicshapecontext.cxx @@ -63,9 +63,9 @@ ContextHandlerRef GraphicShapeContext::onCreateContext( sal_Int32 aElementToken, { // CT_ShapeProperties case XML_xfrm: - return new Transform2DContext( *this, rAttribs.getFastAttributeList(), *mpShapePtr ); + return new Transform2DContext( *this, rAttribs, *mpShapePtr ); case XML_blipFill: - return new BlipFillContext( *this, rAttribs.getFastAttributeList(), mpShapePtr->getGraphicProperties().maBlipProps ); + return new BlipFillContext( *this, rAttribs, mpShapePtr->getGraphicProperties().maBlipProps ); case XML_wavAudioFile: { getEmbeddedWAVAudioFile( getRelations(), rAttribs.getFastAttributeList(), mpShapePtr->getGraphicProperties().maAudio ); @@ -115,7 +115,7 @@ ContextHandlerRef GraphicalObjectFrameContext::onCreateContext( sal_Int32 aEleme case XML_nvGraphicFramePr: // CT_GraphicalObjectFrameNonVisual break; case XML_xfrm: // CT_Transform2D - return new Transform2DContext( *this, rAttribs.getFastAttributeList(), *mpShapePtr ); + return new Transform2DContext( *this, rAttribs, *mpShapePtr ); case XML_graphic: // CT_GraphicalObject return this; diff --git a/oox/source/drawingml/guidcontext.cxx b/oox/source/drawingml/guidcontext.cxx index 092f84bc3f6b..0e000d799e6a 100644 --- a/oox/source/drawingml/guidcontext.cxx +++ b/oox/source/drawingml/guidcontext.cxx @@ -25,12 +25,12 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace drawingml { -GuidContext::GuidContext( ContextHandler& rParent, OUString& rGuidId ) -: ContextHandler( rParent ) +GuidContext::GuidContext( ContextHandler2Helper& rParent, OUString& rGuidId ) +: ContextHandler2( rParent ) , mrGuidId( rGuidId ) { } -void GuidContext::characters( const OUString& aChars ) throw ( SAXException, RuntimeException ) +void GuidContext::onCharacters( const OUString& aChars ) { mrGuidId += aChars; } diff --git a/oox/source/drawingml/hyperlinkcontext.cxx b/oox/source/drawingml/hyperlinkcontext.cxx index 44892cf1579c..c84c17171239 100644 --- a/oox/source/drawingml/hyperlinkcontext.cxx +++ b/oox/source/drawingml/hyperlinkcontext.cxx @@ -33,13 +33,13 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace drawingml { -HyperLinkContext::HyperLinkContext( ContextHandler& rParent, - const Reference< XFastAttributeList >& xAttributes, PropertyMap& aProperties ) - : ContextHandler( rParent ) +HyperLinkContext::HyperLinkContext( ContextHandler2Helper& rParent, + const AttributeList& rAttribs, PropertyMap& aProperties ) + : ContextHandler2( rParent ) , maProperties(aProperties) { OUString sURL, sHref; - OUString aRelId = xAttributes->getOptionalValue( R_TOKEN( id ) ); + OUString aRelId = rAttribs.getString( R_TOKEN( id ) ).get(); if ( !aRelId.isEmpty() ) { OSL_TRACE("OOX: URI rId %s", OUStringToOString (aRelId, RTL_TEXTENCODING_UTF8).pData->buffer); @@ -55,13 +55,13 @@ HyperLinkContext::HyperLinkContext( ContextHandler& rParent, sURL = getRelations().getInternalTargetFromRelId( aRelId ); } } - OUString sTooltip = xAttributes->getOptionalValue( R_TOKEN( tooltip ) ); + OUString sTooltip = rAttribs.getString( R_TOKEN( tooltip ) ).get(); if ( !sTooltip.isEmpty() ) maProperties[ PROP_Representation ] <<= sTooltip; - OUString sFrame = xAttributes->getOptionalValue( R_TOKEN( tgtFrame ) ); + OUString sFrame = rAttribs.getString( R_TOKEN( tgtFrame ) ).get(); if( !sFrame.isEmpty() ) maProperties[ PROP_TargetFrame ] <<= sFrame; - OUString aAction = xAttributes->getOptionalValue( XML_action ); + OUString aAction = rAttribs.getString( XML_action ).get(); if ( !aAction.isEmpty() ) { // reserved values of the unrestricted string aAction: @@ -149,22 +149,20 @@ HyperLinkContext::~HyperLinkContext() { } -Reference< XFastContextHandler > HyperLinkContext::createFastChildContext( - ::sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +ContextHandlerRef HyperLinkContext::onCreateContext( + ::sal_Int32 aElement, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; switch( aElement ) { case A_TOKEN( extLst ): - return xRet; + return 0; case A_TOKEN( snd ): EmbeddedWAVAudioFile aAudio; - getEmbeddedWAVAudioFile( getRelations(), xAttribs, aAudio ); + getEmbeddedWAVAudioFile( getRelations(), rAttribs.getFastAttributeList(), aAudio ); break; } - if ( !xRet.is() ) - xRet.set( this ); - return xRet; + + return this; } } // namespace drawingml diff --git a/oox/source/drawingml/hyperlinkcontext.hxx b/oox/source/drawingml/hyperlinkcontext.hxx index 403193095adb..8431863c8628 100644 --- a/oox/source/drawingml/hyperlinkcontext.hxx +++ b/oox/source/drawingml/hyperlinkcontext.hxx @@ -21,23 +21,23 @@ #define OOX_DRAWINGML_HYPERLINKCONTEXT_HXX #include <com/sun/star/xml/sax/XFastAttributeList.hpp> -#include "oox/core/contexthandler.hxx" +#include "oox/core/contexthandler2.hxx" namespace oox { class PropertyMap; } namespace oox { namespace drawingml { -class HyperLinkContext : public ::oox::core::ContextHandler +class HyperLinkContext : public ::oox::core::ContextHandler2 { public: HyperLinkContext( - ::oox::core::ContextHandler& rParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttribs, + ::oox::core::ContextHandler2Helper& rParent, + const ::oox::AttributeList& rAttribs, PropertyMap& aProperties ); virtual ~HyperLinkContext(); - 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 Element, const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE; protected: PropertyMap& maProperties; diff --git a/oox/source/drawingml/linepropertiescontext.cxx b/oox/source/drawingml/linepropertiescontext.cxx index ceb2e53a19db..5761ed0ee273 100644 --- a/oox/source/drawingml/linepropertiescontext.cxx +++ b/oox/source/drawingml/linepropertiescontext.cxx @@ -32,25 +32,22 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace drawingml { // --------------------------------------------------------------------- -LinePropertiesContext::LinePropertiesContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, +LinePropertiesContext::LinePropertiesContext( ContextHandler2Helper& rParent, const AttributeList& rAttribs, LineProperties& rLineProperties ) throw() -: ContextHandler( rParent ) +: ContextHandler2( rParent ) , mrLineProperties( rLineProperties ) { - AttributeList aAttribs( xAttribs ); - mrLineProperties.moLineWidth = aAttribs.getInteger( XML_w ); - mrLineProperties.moLineCompound = aAttribs.getToken( XML_cmpd ); - mrLineProperties.moLineCap = aAttribs.getToken( XML_cap ); + mrLineProperties.moLineWidth = rAttribs.getInteger( XML_w ); + mrLineProperties.moLineCompound = rAttribs.getToken( XML_cmpd ); + mrLineProperties.moLineCap = rAttribs.getToken( XML_cap ); } LinePropertiesContext::~LinePropertiesContext() { } -Reference< XFastContextHandler > LinePropertiesContext::createFastChildContext( sal_Int32 nElement, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +ContextHandlerRef LinePropertiesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - AttributeList aAttribs( xAttribs ); switch( nElement ) { // LineFillPropertiesGroup @@ -58,19 +55,19 @@ Reference< XFastContextHandler > LinePropertiesContext::createFastChildContext( case A_TOKEN( solidFill ): case A_TOKEN( gradFill ): case A_TOKEN( pattFill ): - xRet = FillPropertiesContext::createFillContext( *this, nElement, xAttribs, mrLineProperties.maLineFill ); + return FillPropertiesContext::createFillContext( *this, nElement, rAttribs, mrLineProperties.maLineFill ); break; // LineDashPropertiesGroup case A_TOKEN( prstDash ): // CT_PresetLineDashProperties - mrLineProperties.moPresetDash = aAttribs.getToken( XML_val ); + mrLineProperties.moPresetDash = rAttribs.getToken( XML_val ); break; case A_TOKEN( custDash ): // CT_DashStopList - xRet = this; + return this; break; case A_TOKEN( ds ): mrLineProperties.maCustomDash.push_back( LineProperties::DashStop( - aAttribs.getInteger( XML_d, 0 ), aAttribs.getInteger( XML_sp, 0 ) ) ); + rAttribs.getInteger( XML_d, 0 ), rAttribs.getInteger( XML_sp, 0 ) ) ); break; // LineJoinPropertiesGroup @@ -85,13 +82,13 @@ Reference< XFastContextHandler > LinePropertiesContext::createFastChildContext( { // ST_LineEndType bool bTailEnd = nElement == A_TOKEN( tailEnd ); LineArrowProperties& rArrowProps = bTailEnd ? mrLineProperties.maEndArrow : mrLineProperties.maStartArrow; - rArrowProps.moArrowType = aAttribs.getToken( XML_type ); - rArrowProps.moArrowWidth = aAttribs.getToken( XML_w ); - rArrowProps.moArrowLength = aAttribs.getToken( XML_len ); + rArrowProps.moArrowType = rAttribs.getToken( XML_type ); + rArrowProps.moArrowWidth = rAttribs.getToken( XML_w ); + rArrowProps.moArrowLength = rAttribs.getToken( XML_len ); } break; } - return xRet; + return 0; } } } diff --git a/oox/source/drawingml/objectdefaultcontext.cxx b/oox/source/drawingml/objectdefaultcontext.cxx index ff432516625e..7b1e40c19e5f 100644 --- a/oox/source/drawingml/objectdefaultcontext.cxx +++ b/oox/source/drawingml/objectdefaultcontext.cxx @@ -27,13 +27,13 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace drawingml { -objectDefaultContext::objectDefaultContext( ContextHandler& rParent, Theme& rTheme ) -: ContextHandler( rParent ) +objectDefaultContext::objectDefaultContext( ContextHandler2Helper& rParent, Theme& rTheme ) +: ContextHandler2( rParent ) , mrTheme( rTheme ) { } -Reference< XFastContextHandler > objectDefaultContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& /* xAttribs */ ) throw (SAXException, RuntimeException) +ContextHandlerRef objectDefaultContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& /* rAttribs */ ) { switch( aElementToken ) { diff --git a/oox/source/drawingml/scene3dcontext.cxx b/oox/source/drawingml/scene3dcontext.cxx index 8dc914b166c9..24323ef37e50 100644 --- a/oox/source/drawingml/scene3dcontext.cxx +++ b/oox/source/drawingml/scene3dcontext.cxx @@ -37,24 +37,20 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace drawingml { -Scene3DContext::Scene3DContext( ContextHandler& rParent, Shape3DProperties& r3DProperties ) throw() -: ContextHandler( rParent ) +Scene3DContext::Scene3DContext( ContextHandler2Helper& rParent, Shape3DProperties& r3DProperties ) throw() +: ContextHandler2( rParent ) , mr3DProperties( r3DProperties ) { } -Reference< XFastContextHandler > Scene3DContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) +ContextHandlerRef Scene3DContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - AttributeList aAttribs( xAttribs ); - Reference< XFastContextHandler > xRet; - switch( aElementToken ) { case NMSP_DRAWINGML|XML_camera: - mr3DProperties.mfFieldOfVision = aAttribs.getInteger( XML_fov, 0 ) / 36000000.0; - mr3DProperties.mfZoom = aAttribs.getInteger( XML_zoom, 100000 ) / 100000.0; - mr3DProperties.mnPreset = aAttribs.getToken( XML_prst, XML_none ); + mr3DProperties.mfFieldOfVision = rAttribs.getInteger( XML_fov, 0 ) / 36000000.0; + mr3DProperties.mfZoom = rAttribs.getInteger( XML_zoom, 100000 ) / 100000.0; + mr3DProperties.mnPreset = rAttribs.getToken( XML_prst, XML_none ); legacyObliqueTopLeft legacyObliqueTop @@ -123,7 +119,7 @@ perspectiveRelaxedModerately // TODO: nested element XML_rot break; case NMSP_DRAWINGML|XML_lightRig: - mr3DProperties.mnLightRigDirection = aAttribs.getToken( XML_dir, XML_none ); + mr3DProperties.mnLightRigDirection = rAttribs.getToken( XML_dir, XML_none ); XML_tl XML_t @@ -135,7 +131,7 @@ XML_b XML_br - mr3DProperties.mnLightRigType = aAttribs.getToken( XML_rig, XML_none ); + mr3DProperties.mnLightRigType = rAttribs.getToken( XML_rig, XML_none ); XML_legacyFlat1 XML_legacyFlat2 @@ -169,9 +165,9 @@ XML_brightRoom break; case NMSP_DRAWINGML|XML_backdrop: case NMSP_DRAWINGML|XML_extLst: - return xRet; // TODO: later (backdrop is not supported by core anyway) + return 0; // TODO: later (backdrop is not supported by core anyway) } - return xRet; + return 0; } } } diff --git a/oox/source/drawingml/shapecontext.cxx b/oox/source/drawingml/shapecontext.cxx index db49d4f40b74..7a1de2de0494 100644 --- a/oox/source/drawingml/shapecontext.cxx +++ b/oox/source/drawingml/shapecontext.cxx @@ -78,8 +78,7 @@ ContextHandlerRef ShapeContext::onCreateContext( sal_Int32 aElementToken, const } case XML_hlinkMouseOver: case XML_hlinkClick: - return new HyperLinkContext( *this, rAttribs.getFastAttributeList(), getShape()->getShapeProperties() ); - break; + return new HyperLinkContext( *this, rAttribs, getShape()->getShapeProperties() ); case XML_ph: mpShapePtr->setSubType( rAttribs.getToken( XML_type, XML_obj ) ); if( rAttribs.hasAttribute( XML_idx ) ) diff --git a/oox/source/drawingml/shapepropertiescontext.cxx b/oox/source/drawingml/shapepropertiescontext.cxx index e0fe19f450a4..da1b2b9f742f 100644 --- a/oox/source/drawingml/shapepropertiescontext.cxx +++ b/oox/source/drawingml/shapepropertiescontext.cxx @@ -44,34 +44,29 @@ namespace oox { namespace drawingml { // ==================================================================== // CT_ShapeProperties -ShapePropertiesContext::ShapePropertiesContext( ContextHandler& rParent, Shape& rShape ) -: ContextHandler( rParent ) +ShapePropertiesContext::ShapePropertiesContext( ContextHandler2Helper& rParent, Shape& rShape ) +: ContextHandler2( rParent ) , mrShape( rShape ) { } // -------------------------------------------------------------------- -Reference< XFastContextHandler > ShapePropertiesContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +ContextHandlerRef ShapePropertiesContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch( aElementToken ) { // CT_Transform2D case A_TOKEN( xfrm ): - xRet.set( new Transform2DContext( *this, xAttribs, mrShape ) ); - break; + return new Transform2DContext( *this, rAttribs, mrShape ); // GeometryGroup case A_TOKEN( custGeom ): // custom geometry "CT_CustomGeometry2D" - xRet.set( new CustomShapeGeometryContext( *this, xAttribs, *(mrShape.getCustomShapeProperties()) ) ); - break; - + return new CustomShapeGeometryContext( *this, rAttribs, *(mrShape.getCustomShapeProperties()) ); case A_TOKEN( prstGeom ): // preset geometry "CT_PresetGeometry2D" { - sal_Int32 nToken = xAttribs->getOptionalValueToken( XML_prst, 0 ); + sal_Int32 nToken = rAttribs.getToken( XML_prst, 0 ); // TODO: Move the following checks to a separate place or as a separate function if ( nToken == XML_line ) { @@ -83,29 +78,25 @@ Reference< XFastContextHandler > ShapePropertiesContext::createFastChildContext( { mrShape.getServiceName() = "com.sun.star.drawing.CustomShape"; } - xRet.set( new PresetShapeGeometryContext( *this, xAttribs, *(mrShape.getCustomShapeProperties()) ) ); + return new PresetShapeGeometryContext( *this, rAttribs, *(mrShape.getCustomShapeProperties()) ); } - break; case A_TOKEN( prstTxWarp ): - xRet.set( new PresetTextShapeContext( *this, xAttribs, *(mrShape.getCustomShapeProperties()) ) ); - break; + return new PresetTextShapeContext( *this, rAttribs, *(mrShape.getCustomShapeProperties()) ); // CT_LineProperties case A_TOKEN( ln ): - xRet.set( new LinePropertiesContext( *this, xAttribs, mrShape.getLineProperties() ) ); - break; + return new LinePropertiesContext( *this, rAttribs, mrShape.getLineProperties() ); // EffectPropertiesGroup // todo not supported by core case A_TOKEN( effectLst ): // CT_EffectList case A_TOKEN( effectDag ): // CT_EffectContainer - xRet.set( new EffectPropertiesContext( *this, mrShape.getEffectProperties() ) ); - break; + return new EffectPropertiesContext( *this, mrShape.getEffectProperties() ); // todo case A_TOKEN( scene3d ): // CT_Scene3D -// xRet.set( new Scene3DContext( *this, xAttribs, *(mrShape.get3DShapeProperties()) ) ); +// return new Scene3DContext( *this, rAttribs, *(mrShape.get3DShapeProperties()) ); break; // todo @@ -114,10 +105,7 @@ Reference< XFastContextHandler > ShapePropertiesContext::createFastChildContext( } // FillPropertiesGroupContext - if( !xRet.is() ) - xRet.set( FillPropertiesContext::createFillContext( *this, aElementToken, xAttribs, mrShape.getFillProperties() ) ); - - return xRet; + return FillPropertiesContext::createFillContext( *this, aElementToken, rAttribs, mrShape.getFillProperties() ); } } } diff --git a/oox/source/drawingml/shapestylecontext.cxx b/oox/source/drawingml/shapestylecontext.cxx index 27b004b83adf..9dc27f02d0a8 100644 --- a/oox/source/drawingml/shapestylecontext.cxx +++ b/oox/source/drawingml/shapestylecontext.cxx @@ -31,8 +31,8 @@ namespace oox { namespace drawingml { // --------------- // CT_ShapeStyle // --------------- -ShapeStyleContext::ShapeStyleContext( ContextHandler& rParent, Shape& rShape ) -: ContextHandler( rParent ) +ShapeStyleContext::ShapeStyleContext( ContextHandler2Helper& rParent, Shape& rShape ) +: ContextHandler2( rParent ) , mrShape( rShape ) { } @@ -41,19 +41,8 @@ ShapeStyleContext::~ShapeStyleContext() { } -// -------------------------------------------------------------------- - -void ShapeStyleContext::endFastElement( sal_Int32 ) throw (SAXException, RuntimeException) -{ -} - -// -------------------------------------------------------------------- - -Reference< XFastContextHandler > ShapeStyleContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& rxAttributes ) - throw ( SAXException, RuntimeException ) +ContextHandlerRef ShapeStyleContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - AttributeList aAttribs( rxAttributes ); switch( aElementToken ) { case A_TOKEN( lnRef ) : // CT_StyleMatrixReference @@ -63,21 +52,18 @@ Reference< XFastContextHandler > ShapeStyleContext::createFastChildContext( sal_ { sal_Int32 nToken = getBaseToken( aElementToken ); ShapeStyleRef& rStyleRef = mrShape.getShapeStyleRefs()[ nToken ]; - rStyleRef.mnThemedIdx = (nToken == XML_fontRef) ? aAttribs.getToken( XML_idx, XML_none ) : aAttribs.getInteger( XML_idx, 0 ); + rStyleRef.mnThemedIdx = (nToken == XML_fontRef) ? rAttribs.getToken( XML_idx, XML_none ) : rAttribs.getInteger( XML_idx, 0 ); // Set default Text Color. Some xml files don't seem // to have color definitions inside fontRef - Use // tx1 in such cases if( nToken == XML_fontRef && !rStyleRef.maPhClr.isUsed() ) rStyleRef.maPhClr.setSchemeClr(XML_tx1); - xRet.set( new ColorContext( *this, rStyleRef.maPhClr ) ); + return new ColorContext( *this, rStyleRef.maPhClr ); } - break; } - return xRet; + return 0; } -// -------------------------------------------------------------------- - } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/spdefcontext.cxx b/oox/source/drawingml/spdefcontext.cxx index 812a09718bff..2b718334454d 100644 --- a/oox/source/drawingml/spdefcontext.cxx +++ b/oox/source/drawingml/spdefcontext.cxx @@ -29,39 +29,31 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace drawingml { -spDefContext::spDefContext( ContextHandler& rParent, Shape& rDefaultObject ) -: ContextHandler( rParent ) +spDefContext::spDefContext( ContextHandler2Helper& rParent, Shape& rDefaultObject ) +: ContextHandler2( rParent ) , mrDefaultObject( rDefaultObject ) { } -Reference< XFastContextHandler > spDefContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +ContextHandlerRef spDefContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; switch( aElementToken ) { case A_TOKEN( spPr ): - { - xRet = new ShapePropertiesContext( *this, mrDefaultObject ); - break; - } + return new ShapePropertiesContext( *this, mrDefaultObject ); case A_TOKEN( bodyPr ): { TextBodyPtr xTextBody( new TextBody ); mrDefaultObject.setTextBody( xTextBody ); - xRet = new TextBodyPropertiesContext( *this, xAttribs, xTextBody->getTextProperties() ); - break; + return new TextBodyPropertiesContext( *this, rAttribs, xTextBody->getTextProperties() ); } case A_TOKEN( lstStyle ): - xRet.set( new TextListStyleContext( *this, *mrDefaultObject.getMasterTextListStyle() ) ); - break; + return new TextListStyleContext( *this, *mrDefaultObject.getMasterTextListStyle() ); case A_TOKEN( style ): break; } - if( !xRet.is() ) - xRet.set( this ); - return xRet; + return this; } } } diff --git a/oox/source/drawingml/table/tablebackgroundstylecontext.cxx b/oox/source/drawingml/table/tablebackgroundstylecontext.cxx index 52511abd3295..a56115699fc7 100644 --- a/oox/source/drawingml/table/tablebackgroundstylecontext.cxx +++ b/oox/source/drawingml/table/tablebackgroundstylecontext.cxx @@ -30,8 +30,8 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace drawingml { namespace table { -TableBackgroundStyleContext::TableBackgroundStyleContext( ContextHandler& rParent, TableStyle& rTableStyle ) -: ContextHandler( rParent ) +TableBackgroundStyleContext::TableBackgroundStyleContext( ContextHandler2Helper& rParent, TableStyle& rTableStyle ) +: ContextHandler2( rParent ) , mrTableStyle( rTableStyle ) { } @@ -40,13 +40,9 @@ TableBackgroundStyleContext::~TableBackgroundStyleContext() { } -uno::Reference< xml::sax::XFastContextHandler > SAL_CALL -TableBackgroundStyleContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs ) - throw ( xml::sax::SAXException, uno::RuntimeException) +ContextHandlerRef +TableBackgroundStyleContext::onCreateContext( ::sal_Int32 aElementToken, const AttributeList& rAttribs ) { - uno::Reference< xml::sax::XFastContextHandler > xRet; - - AttributeList aAttribs( xAttribs ); switch( aElementToken ) { // EG_ThemeableFillStyle (choice) @@ -54,29 +50,22 @@ TableBackgroundStyleContext::createFastChildContext( ::sal_Int32 aElementToken, { boost::shared_ptr< FillProperties >& rxFillProperties = mrTableStyle.getBackgroundFillProperties(); rxFillProperties.reset( new FillProperties ); - xRet.set( new FillPropertiesContext( *this, *rxFillProperties ) ); + return new FillPropertiesContext( *this, *rxFillProperties ); } - break; case A_TOKEN( fillRef ): // CT_StyleMatrixReference { ShapeStyleRef& rStyleRef = mrTableStyle.getBackgroundFillStyleRef(); - rStyleRef.mnThemedIdx = aAttribs.getInteger( XML_idx, 0 ); - xRet.set( new ColorContext( *this, rStyleRef.maPhClr ) ); + rStyleRef.mnThemedIdx = rAttribs.getInteger( XML_idx, 0 ); + return new ColorContext( *this, rStyleRef.maPhClr ); } - break; - // EG_ThemeableEffectStyle (choice) case A_TOKEN( effect ): // CT_EffectProperties break; case A_TOKEN( effectRef ): // CT_StyleMatrixReference break; } - if( !xRet.is() ) - { - uno::Reference<XFastContextHandler> xTmp(this); - xRet.set( xTmp ); - } - return xRet; + + return this; } } } } diff --git a/oox/source/drawingml/table/tablecellcontext.cxx b/oox/source/drawingml/table/tablecellcontext.cxx index 0c9e9bb092a0..05c3d061ab15 100644 --- a/oox/source/drawingml/table/tablecellcontext.cxx +++ b/oox/source/drawingml/table/tablecellcontext.cxx @@ -30,71 +30,59 @@ using namespace ::com::sun::star; namespace oox { namespace drawingml { namespace table { -TableCellContext::TableCellContext( ContextHandler& rParent, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs, TableCell& rTableCell ) -: ContextHandler( rParent ) +TableCellContext::TableCellContext( ContextHandler2Helper& rParent, const AttributeList& rAttribs, TableCell& rTableCell ) +: ContextHandler2( rParent ) , mrTableCell( rTableCell ) { - if ( xAttribs->hasAttribute( XML_rowSpan ) ) - mrTableCell.setRowSpan( xAttribs->getOptionalValue( XML_rowSpan ).toInt32() ); - if ( xAttribs->hasAttribute( XML_gridSpan ) ) - mrTableCell.setGridSpan( xAttribs->getOptionalValue( XML_gridSpan ).toInt32() ); + if ( rAttribs.hasAttribute( XML_rowSpan ) ) + mrTableCell.setRowSpan( rAttribs.getString( XML_rowSpan ).get().toInt32() ); + if ( rAttribs.hasAttribute( XML_gridSpan ) ) + mrTableCell.setGridSpan( rAttribs.getString( XML_gridSpan ).get().toInt32() ); - AttributeList aAttribs( xAttribs ); - mrTableCell.sethMerge( aAttribs.getBool( XML_hMerge, sal_False ) ); - mrTableCell.setvMerge( aAttribs.getBool( XML_vMerge, sal_False ) ); + mrTableCell.sethMerge( rAttribs.getBool( XML_hMerge, sal_False ) ); + mrTableCell.setvMerge( rAttribs.getBool( XML_vMerge, sal_False ) ); } TableCellContext::~TableCellContext() { } -uno::Reference< xml::sax::XFastContextHandler > SAL_CALL -TableCellContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs ) - throw ( xml::sax::SAXException, uno::RuntimeException) +ContextHandlerRef +TableCellContext::onCreateContext( ::sal_Int32 aElementToken, const AttributeList& rAttribs ) { - uno::Reference< xml::sax::XFastContextHandler > xRet; - switch( aElementToken ) { case A_TOKEN( txBody ): // CT_TextBody { oox::drawingml::TextBodyPtr xTextBody( new oox::drawingml::TextBody ); mrTableCell.setTextBody( xTextBody ); - xRet = new oox::drawingml::TextBodyContext( *this, *xTextBody ); + return new oox::drawingml::TextBodyContext( *this, *xTextBody ); } - break; case A_TOKEN( tcPr ): // CT_TableCellProperties { - AttributeList aAttribs( xAttribs ); - mrTableCell.setLeftMargin( aAttribs.getInteger( XML_marL, 91440 ) ); - mrTableCell.setRightMargin( aAttribs.getInteger( XML_marR, 91440 ) ); - mrTableCell.setTopMargin( aAttribs.getInteger( XML_marT, 45720 ) ); - mrTableCell.setBottomMargin( aAttribs.getInteger( XML_marB, 45720 ) ); - mrTableCell.setVertToken( xAttribs->getOptionalValueToken( XML_vert, XML_horz ) ); // ST_TextVerticalType - mrTableCell.setAnchorToken( xAttribs->getOptionalValueToken( XML_anchor, XML_t ) ); // ST_TextAnchoringType - mrTableCell.setAnchorCtr( aAttribs.getBool( XML_anchorCtr, sal_False ) ); - mrTableCell.setHorzOverflowToken( xAttribs->getOptionalValueToken( XML_horzOverflow, XML_clip ) ); // ST_TextHorzOverflowType + mrTableCell.setLeftMargin( rAttribs.getInteger( XML_marL, 91440 ) ); + mrTableCell.setRightMargin( rAttribs.getInteger( XML_marR, 91440 ) ); + mrTableCell.setTopMargin( rAttribs.getInteger( XML_marT, 45720 ) ); + mrTableCell.setBottomMargin( rAttribs.getInteger( XML_marB, 45720 ) ); + mrTableCell.setVertToken( rAttribs.getToken( XML_vert, XML_horz ) ); // ST_TextVerticalType + mrTableCell.setAnchorToken( rAttribs.getToken( XML_anchor, XML_t ) ); // ST_TextAnchoringType + mrTableCell.setAnchorCtr( rAttribs.getBool( XML_anchorCtr, sal_False ) ); + mrTableCell.setHorzOverflowToken( rAttribs.getToken( XML_horzOverflow, XML_clip ) ); // ST_TextHorzOverflowType } break; case A_TOKEN( lnL ): - xRet.set( new oox::drawingml::LinePropertiesContext( *this, xAttribs, mrTableCell.maLinePropertiesLeft ) ); - break; + return new oox::drawingml::LinePropertiesContext( *this, rAttribs, mrTableCell.maLinePropertiesLeft ); case A_TOKEN( lnR ): - xRet.set( new oox::drawingml::LinePropertiesContext( *this, xAttribs, mrTableCell.maLinePropertiesRight ) ); - break; + return new oox::drawingml::LinePropertiesContext( *this, rAttribs, mrTableCell.maLinePropertiesRight ); case A_TOKEN( lnT ): - xRet.set( new oox::drawingml::LinePropertiesContext( *this, xAttribs, mrTableCell.maLinePropertiesTop ) ); - break; + return new oox::drawingml::LinePropertiesContext( *this, rAttribs, mrTableCell.maLinePropertiesTop ); case A_TOKEN( lnB ): - xRet.set( new oox::drawingml::LinePropertiesContext( *this, xAttribs, mrTableCell.maLinePropertiesBottom ) ); - break; + return new oox::drawingml::LinePropertiesContext( *this, rAttribs, mrTableCell.maLinePropertiesBottom ); case A_TOKEN( lnTlToBr ): - xRet.set( new oox::drawingml::LinePropertiesContext( *this, xAttribs, mrTableCell.maLinePropertiesTopLeftToBottomRight ) ); - break; + return new oox::drawingml::LinePropertiesContext( *this, rAttribs, mrTableCell.maLinePropertiesTopLeftToBottomRight ); case A_TOKEN( lnBlToTr ): - xRet.set( new oox::drawingml::LinePropertiesContext( *this, xAttribs, mrTableCell.maLinePropertiesBottomLeftToTopRight ) ); - break; + return new oox::drawingml::LinePropertiesContext( *this, rAttribs, mrTableCell.maLinePropertiesBottomLeftToTopRight ); case A_TOKEN( cell3D ): // CT_Cell3D break; @@ -102,16 +90,11 @@ TableCellContext::createFastChildContext( ::sal_Int32 aElementToken, const uno:: break; default: - xRet.set( FillPropertiesContext::createFillContext( *this, aElementToken, xAttribs, mrTableCell.maFillProperties ) ); - break; + return FillPropertiesContext::createFillContext( *this, aElementToken, rAttribs, mrTableCell.maFillProperties ); } - if ( !xRet.is() ) - { - uno::Reference< XFastContextHandler > xTmp( this ); - xRet.set( xTmp ); - } - return xRet; + + return this; } } } } diff --git a/oox/source/drawingml/table/tablecontext.cxx b/oox/source/drawingml/table/tablecontext.cxx index f83e2877b2b6..c02d85a0e56a 100644 --- a/oox/source/drawingml/table/tablecontext.cxx +++ b/oox/source/drawingml/table/tablecontext.cxx @@ -61,7 +61,7 @@ TableContext::onCreateContext( ::sal_Int32 aElementToken, const AttributeList& r { boost::shared_ptr< TableStyle >& rTableStyle = mrTableProperties.getTableStyle(); rTableStyle.reset( new TableStyle() ); - return new TableStyleContext( *this, rAttribs.getFastAttributeList(), *rTableStyle ); + return new TableStyleContext( *this, rAttribs, *rTableStyle ); } case A_TOKEN( tableStyleId ): // ST_Guid return new oox::drawingml::GuidContext( *this, mrTableProperties.getStyleId() ); @@ -78,7 +78,7 @@ TableContext::onCreateContext( ::sal_Int32 aElementToken, const AttributeList& r { std::vector< TableRow >& rvTableRows( mrTableProperties.getTableRows() ); rvTableRows.resize( rvTableRows.size() + 1 ); - return new TableRowContext( *this, rAttribs.getFastAttributeList(), rvTableRows.back() ); + return new TableRowContext( *this, rAttribs, rvTableRows.back() ); } } diff --git a/oox/source/drawingml/table/tablepartstylecontext.cxx b/oox/source/drawingml/table/tablepartstylecontext.cxx index 9386fa197fef..69282f2c7e98 100644 --- a/oox/source/drawingml/table/tablepartstylecontext.cxx +++ b/oox/source/drawingml/table/tablepartstylecontext.cxx @@ -30,8 +30,8 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace drawingml { namespace table { -TablePartStyleContext::TablePartStyleContext( ContextHandler& rParent, TableStylePart& rTableStylePart ) -: ContextHandler( rParent ) +TablePartStyleContext::TablePartStyleContext( ContextHandler2Helper& rParent, TableStylePart& rTableStylePart ) +: ContextHandler2( rParent ) , mrTableStylePart( rTableStylePart ) { } @@ -41,27 +41,18 @@ TablePartStyleContext::~TablePartStyleContext() } // CT_TablePartStyle -uno::Reference< xml::sax::XFastContextHandler > SAL_CALL -TablePartStyleContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs ) - throw ( xml::sax::SAXException, uno::RuntimeException) +ContextHandlerRef +TablePartStyleContext::onCreateContext( ::sal_Int32 aElementToken, const AttributeList& rAttribs ) { - uno::Reference< xml::sax::XFastContextHandler > xRet; - switch( aElementToken ) { case A_TOKEN( tcTxStyle ): // CT_TableStyleTextStyle - xRet.set( new TableStyleTextStyleContext( *this, xAttribs, mrTableStylePart ) ); - break; + return new TableStyleTextStyleContext( *this, rAttribs, mrTableStylePart ); case A_TOKEN( tcStyle ): // CT_TableStyleCellStyle - xRet.set( new TableStyleCellStyleContext( *this, mrTableStylePart ) ); - break; - } - if( !xRet.is() ) - { - uno::Reference<XFastContextHandler> xTmp(this); - xRet.set( xTmp ); + return new TableStyleCellStyleContext( *this, mrTableStylePart ); } - return xRet; + + return this; } } } } diff --git a/oox/source/drawingml/table/tablerowcontext.cxx b/oox/source/drawingml/table/tablerowcontext.cxx index 1f15d5eb986c..5984d7601e78 100644 --- a/oox/source/drawingml/table/tablerowcontext.cxx +++ b/oox/source/drawingml/table/tablerowcontext.cxx @@ -28,42 +28,34 @@ using namespace ::com::sun::star; namespace oox { namespace drawingml { namespace table { -TableRowContext::TableRowContext( ContextHandler& rParent, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs, TableRow& rTableRow ) -: ContextHandler( rParent ) +TableRowContext::TableRowContext( ContextHandler2Helper& rParent, const AttributeList& rAttribs, TableRow& rTableRow ) +: ContextHandler2( rParent ) , mrTableRow( rTableRow ) { - rTableRow.setHeight( xAttribs->getOptionalValue( XML_h ).toInt32() ); + rTableRow.setHeight( rAttribs.getString( XML_h ).get().toInt32() ); } TableRowContext::~TableRowContext() { } -uno::Reference< xml::sax::XFastContextHandler > SAL_CALL -TableRowContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs ) - throw ( xml::sax::SAXException, uno::RuntimeException) +ContextHandlerRef +TableRowContext::onCreateContext( ::sal_Int32 aElementToken, const AttributeList& rAttribs ) { - uno::Reference< xml::sax::XFastContextHandler > xRet; - switch( aElementToken ) { case A_TOKEN( tc ): // CT_TableCell { std::vector< TableCell >& rvTableCells = mrTableRow.getTableCells(); rvTableCells.resize( rvTableCells.size() + 1 ); - xRet.set( new TableCellContext( *this, xAttribs, rvTableCells.back() ) ); + return new TableCellContext( *this, rAttribs, rvTableCells.back() ); } - break; case A_TOKEN( extLst ): // CT_OfficeArtExtensionList default: break; } - if( !xRet.is() ) - { - uno::Reference< XFastContextHandler > xTmp( this ); - xRet.set( xTmp ); - } - return xRet; + + return this; } } } } diff --git a/oox/source/drawingml/table/tablestylecellstylecontext.cxx b/oox/source/drawingml/table/tablestylecellstylecontext.cxx index 6304b612f3ac..c6be9157cb8b 100644 --- a/oox/source/drawingml/table/tablestylecellstylecontext.cxx +++ b/oox/source/drawingml/table/tablestylecellstylecontext.cxx @@ -31,8 +31,8 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace drawingml { namespace table { -TableStyleCellStyleContext::TableStyleCellStyleContext( ContextHandler& rParent, TableStylePart& rTableStylePart ) -: ContextHandler( rParent ) +TableStyleCellStyleContext::TableStyleCellStyleContext( ContextHandler2Helper& rParent, TableStylePart& rTableStylePart ) +: ContextHandler2( rParent ) , mrTableStylePart( rTableStylePart ) , mnLineType( XML_none ) { @@ -43,12 +43,9 @@ TableStyleCellStyleContext::~TableStyleCellStyleContext() } // CT_TableStyleCellStyle -uno::Reference< xml::sax::XFastContextHandler > SAL_CALL -TableStyleCellStyleContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs ) - throw ( xml::sax::SAXException, uno::RuntimeException) +ContextHandlerRef +TableStyleCellStyleContext::onCreateContext( ::sal_Int32 aElementToken, const AttributeList& rAttribs ) { - uno::Reference< xml::sax::XFastContextHandler > xRet; - AttributeList aAttribs( xAttribs ); switch( aElementToken ) { case A_TOKEN( tcBdr ): // CT_TableCellBorderStyle @@ -71,7 +68,7 @@ TableStyleCellStyleContext::createFastChildContext( ::sal_Int32 aElementToken, c std::map < sal_Int32, ::oox::drawingml::LinePropertiesPtr >& rLineBorders = mrTableStylePart.getLineBorders(); ::oox::drawingml::LinePropertiesPtr mpLineProperties( new oox::drawingml::LineProperties ); rLineBorders[ mnLineType ] = mpLineProperties; - xRet = new LinePropertiesContext( *this, xAttribs, *mpLineProperties ); + return new LinePropertiesContext( *this, rAttribs, *mpLineProperties ); } } break; @@ -80,8 +77,8 @@ TableStyleCellStyleContext::createFastChildContext( ::sal_Int32 aElementToken, c if ( mnLineType != XML_none ) { ShapeStyleRef& rLineStyleRef = mrTableStylePart.getStyleRefs()[ mnLineType ]; - rLineStyleRef.mnThemedIdx = aAttribs.getInteger( XML_idx, 0 ); - xRet.set( new ColorContext( *this, rLineStyleRef.maPhClr ) ); + rLineStyleRef.mnThemedIdx = rAttribs.getInteger( XML_idx, 0 ); + return new ColorContext( *this, rLineStyleRef.maPhClr ); } } break; @@ -91,26 +88,19 @@ TableStyleCellStyleContext::createFastChildContext( ::sal_Int32 aElementToken, c { FillPropertiesPtr& rxFillProperties = mrTableStylePart.getFillProperties(); rxFillProperties.reset( new FillProperties ); - xRet.set( new FillPropertiesContext( *this, *rxFillProperties ) ); + return new FillPropertiesContext( *this, *rxFillProperties ); } - break; case A_TOKEN( fillRef ): // CT_StyleMatrixReference { ShapeStyleRef& rStyleRef = mrTableStylePart.getStyleRefs()[ XML_fillRef ]; - rStyleRef.mnThemedIdx = aAttribs.getInteger( XML_idx, 0 ); - xRet.set( new ColorContext( *this, rStyleRef.maPhClr ) ); + rStyleRef.mnThemedIdx = rAttribs.getInteger( XML_idx, 0 ); + return new ColorContext( *this, rStyleRef.maPhClr ); } - break; - case A_TOKEN( cell3D ): // CT_Cell3D break; } - if( !xRet.is() ) - { - uno::Reference<XFastContextHandler> xTmp(this); - xRet.set( xTmp ); - } - return xRet; + + return this; } } } } diff --git a/oox/source/drawingml/table/tablestylecontext.cxx b/oox/source/drawingml/table/tablestylecontext.cxx index cb9fdd785878..0e6e0dec7966 100644 --- a/oox/source/drawingml/table/tablestylecontext.cxx +++ b/oox/source/drawingml/table/tablestylecontext.cxx @@ -30,78 +30,56 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace drawingml { namespace table { -TableStyleContext::TableStyleContext( ContextHandler& rParent, - const Reference< XFastAttributeList >& xAttribs, TableStyle& rTableStyle ) -: ContextHandler( rParent ) +TableStyleContext::TableStyleContext( ContextHandler2Helper& rParent, + const AttributeList& rAttribs, TableStyle& rTableStyle ) +: ContextHandler2( rParent ) , mrTableStyle( rTableStyle ) { - mrTableStyle.getStyleId() = xAttribs->getOptionalValue( XML_styleId ); - mrTableStyle.getStyleName() = xAttribs->getOptionalValue( XML_styleName ); + mrTableStyle.getStyleId() = rAttribs.getString( XML_styleId ).get(); + mrTableStyle.getStyleName() = rAttribs.getString( XML_styleName ).get(); } TableStyleContext::~TableStyleContext() { } -uno::Reference< xml::sax::XFastContextHandler > SAL_CALL -TableStyleContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& /* xAttribs */ ) - throw ( xml::sax::SAXException, uno::RuntimeException) +ContextHandlerRef +TableStyleContext::onCreateContext( ::sal_Int32 aElementToken, const AttributeList& /* rAttribs */ ) { - uno::Reference< xml::sax::XFastContextHandler > xRet; - switch( aElementToken ) { case A_TOKEN( tblBg ): // CT_TableBackgroundStyle - xRet = new TableBackgroundStyleContext( *this, mrTableStyle ); - break; + return new TableBackgroundStyleContext( *this, mrTableStyle ); case A_TOKEN( wholeTbl ): // CT_TablePartStyle - xRet = new TablePartStyleContext( *this, mrTableStyle.getWholeTbl() ); - break; + return new TablePartStyleContext( *this, mrTableStyle.getWholeTbl() ); case A_TOKEN( band1H ): // CT_TablePartStyle - xRet = new TablePartStyleContext( *this, mrTableStyle.getBand1H() ); - break; + return new TablePartStyleContext( *this, mrTableStyle.getBand1H() ); case A_TOKEN( band2H ): // CT_TablePartStyle - xRet = new TablePartStyleContext( *this, mrTableStyle.getBand2H() ); - break; + return new TablePartStyleContext( *this, mrTableStyle.getBand2H() ); case A_TOKEN( band1V ): // CT_TablePartStyle - xRet = new TablePartStyleContext( *this, mrTableStyle.getBand1V() ); - break; + return new TablePartStyleContext( *this, mrTableStyle.getBand1V() ); case A_TOKEN( band2V ): // CT_TablePartStyle - xRet = new TablePartStyleContext( *this, mrTableStyle.getBand2V() ); - break; + return new TablePartStyleContext( *this, mrTableStyle.getBand2V() ); case A_TOKEN( lastCol ): // CT_TablePartStyle - xRet = new TablePartStyleContext( *this, mrTableStyle.getLastCol() ); - break; + return new TablePartStyleContext( *this, mrTableStyle.getLastCol() ); case A_TOKEN( firstCol ): // CT_TablePartStyle - xRet = new TablePartStyleContext( *this, mrTableStyle.getFirstCol() ); - break; + return new TablePartStyleContext( *this, mrTableStyle.getFirstCol() ); case A_TOKEN( lastRow ): // CT_TablePartStyle - xRet = new TablePartStyleContext( *this, mrTableStyle.getLastRow() ); - break; + return new TablePartStyleContext( *this, mrTableStyle.getLastRow() ); case A_TOKEN( seCell ): // CT_TablePartStyle - xRet = new TablePartStyleContext( *this, mrTableStyle.getSeCell() ); - break; + return new TablePartStyleContext( *this, mrTableStyle.getSeCell() ); case A_TOKEN( swCell ): // CT_TablePartStyle - xRet = new TablePartStyleContext( *this, mrTableStyle.getSwCell() ); - break; + return new TablePartStyleContext( *this, mrTableStyle.getSwCell() ); case A_TOKEN( firstRow ): // CT_TablePartStyle - xRet = new TablePartStyleContext( *this, mrTableStyle.getFirstRow() ); - break; + return new TablePartStyleContext( *this, mrTableStyle.getFirstRow() ); case A_TOKEN( neCell ): // CT_TablePartStyle - xRet = new TablePartStyleContext( *this, mrTableStyle.getNeCell() ); - break; + return new TablePartStyleContext( *this, mrTableStyle.getNeCell() ); case A_TOKEN( nwCell ): // CT_TablePartStyle - xRet = new TablePartStyleContext( *this, mrTableStyle.getNwCell() ); - break; + return new TablePartStyleContext( *this, mrTableStyle.getNwCell() ); case A_TOKEN( extLst ): // CT_OfficeArtExtensionList break; } - if( !xRet.is() ) - { - uno::Reference<XFastContextHandler> xTmp(this); - xRet.set( xTmp ); - } - return xRet; + return this; } } } } diff --git a/oox/source/drawingml/table/tablestylelistfragmenthandler.cxx b/oox/source/drawingml/table/tablestylelistfragmenthandler.cxx index 18d9df6a58bb..0e564e91fa86 100644 --- a/oox/source/drawingml/table/tablestylelistfragmenthandler.cxx +++ b/oox/source/drawingml/table/tablestylelistfragmenthandler.cxx @@ -30,8 +30,6 @@ namespace oox { namespace drawingml { namespace table { -// ============================================================================ - TableStyleListFragmentHandler::TableStyleListFragmentHandler( XmlFilterBase& rFilter, const OUString& rFragmentPath, TableStyleList& rTableStyleList ): FragmentHandler2( rFilter, rFragmentPath ), mrTableStyleList( rTableStyleList ) @@ -54,13 +52,11 @@ ContextHandlerRef TableStyleListFragmentHandler::onCreateContext( case A_TOKEN( tblStyle ): // CT_TableStyle std::vector< TableStyle >& rTableStyles = mrTableStyleList.getTableStyles(); rTableStyles.resize( rTableStyles.size() + 1 ); - return new TableStyleContext( *this, rAttribs.getFastAttributeList(), rTableStyles.back() ); + return new TableStyleContext( *this, rAttribs, rTableStyles.back() ); } return this; } -// ============================================================================ - } // namespace table } // namespace drawingml } // namespace oox diff --git a/oox/source/drawingml/table/tablestyletextstylecontext.cxx b/oox/source/drawingml/table/tablestyletextstylecontext.cxx index 51a96027f908..ba85feabc16d 100644 --- a/oox/source/drawingml/table/tablestyletextstylecontext.cxx +++ b/oox/source/drawingml/table/tablestyletextstylecontext.cxx @@ -30,21 +30,21 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace drawingml { namespace table { -TableStyleTextStyleContext::TableStyleTextStyleContext( ContextHandler& rParent, - const Reference< XFastAttributeList >& xAttribs, TableStylePart& rTableStylePart ) -: ContextHandler( rParent ) +TableStyleTextStyleContext::TableStyleTextStyleContext( ContextHandler2Helper& rParent, + const AttributeList& rAttribs, TableStylePart& rTableStylePart ) +: ContextHandler2( rParent ) , mrTableStylePart( rTableStylePart ) { - if( xAttribs->hasAttribute( XML_b ) ) { - sal_Int32 nB = xAttribs->getOptionalValueToken( XML_b, XML_def ); + if( rAttribs.hasAttribute( XML_b ) ) { + sal_Int32 nB = rAttribs.getToken( XML_b, XML_def ); if ( nB == XML_on ) mrTableStylePart.getTextBoldStyle() = ::boost::optional< sal_Bool >( sal_True ); else if ( nB == XML_off ) mrTableStylePart.getTextBoldStyle() = ::boost::optional< sal_Bool >( sal_False ); } - if( xAttribs->hasAttribute( XML_i ) ) { - sal_Int32 nI = xAttribs->getOptionalValueToken( XML_i, XML_def ); + if( rAttribs.hasAttribute( XML_i ) ) { + sal_Int32 nI = rAttribs.getToken( XML_i, XML_def ); if ( nI == XML_on ) mrTableStylePart.getTextItalicStyle() = ::boost::optional< sal_Bool >( sal_True ); else if ( nI == XML_off ) @@ -57,47 +57,39 @@ TableStyleTextStyleContext::~TableStyleTextStyleContext() } // CT_TableStyleTextStyle -uno::Reference< xml::sax::XFastContextHandler > SAL_CALL -TableStyleTextStyleContext::createFastChildContext( ::sal_Int32 aElementToken, const uno::Reference< xml::sax::XFastAttributeList >& xAttribs ) - throw ( xml::sax::SAXException, uno::RuntimeException) +ContextHandlerRef +TableStyleTextStyleContext::onCreateContext( ::sal_Int32 aElementToken, const AttributeList& rAttribs ) { - uno::Reference< xml::sax::XFastContextHandler > xRet; - AttributeList aAttribs( xAttribs ); - switch( aElementToken ) { // EG_ThemeableFontStyles (choice) case A_TOKEN( font ): // CT_FontCollection - xRet.set( this ); - break; + return this; case A_TOKEN( ea ): // CT_TextFont - mrTableStylePart.getAsianFont().setAttributes( aAttribs ); + mrTableStylePart.getAsianFont().setAttributes( rAttribs ); return 0; case A_TOKEN( cs ): // CT_TextFont - mrTableStylePart.getComplexFont().setAttributes( aAttribs ); + mrTableStylePart.getComplexFont().setAttributes( rAttribs ); return 0; case A_TOKEN( sym ): // CT_TextFont - mrTableStylePart.getSymbolFont().setAttributes( aAttribs ); + mrTableStylePart.getSymbolFont().setAttributes( rAttribs ); return 0; case A_TOKEN( latin ): // CT_TextFont - mrTableStylePart.getLatinFont().setAttributes( aAttribs ); + mrTableStylePart.getLatinFont().setAttributes( rAttribs ); return 0; case A_TOKEN( fontRef ): // CT_FontReference { ShapeStyleRef& rFontStyle = mrTableStylePart.getStyleRefs()[ XML_fontRef ]; - rFontStyle.mnThemedIdx = aAttribs.getToken( XML_idx, XML_none ); - xRet.set( new ColorContext( *this, rFontStyle.maPhClr ) ); + rFontStyle.mnThemedIdx = rAttribs.getToken( XML_idx, XML_none ); + return new ColorContext( *this, rFontStyle.maPhClr ); } - break; case A_TOKEN( extLst ): // CT_OfficeArtExtensionList break; } - if( !xRet.is() ) - xRet.set( new ColorValueContext( *this, mrTableStylePart.getTextColor() ) ); - return xRet; + return new ColorValueContext( *this, mrTableStylePart.getTextColor() ); } } } } diff --git a/oox/source/drawingml/textbodycontext.cxx b/oox/source/drawingml/textbodycontext.cxx index 378c3217543b..415bddf28b7f 100644 --- a/oox/source/drawingml/textbodycontext.cxx +++ b/oox/source/drawingml/textbodycontext.cxx @@ -36,39 +36,28 @@ namespace oox { namespace drawingml { // -------------------------------------------------------------------- // CT_TextParagraph -class TextParagraphContext : public ContextHandler +class TextParagraphContext : public ContextHandler2 { public: - TextParagraphContext( ContextHandler& rParent, TextParagraph& rPara ); + TextParagraphContext( ContextHandler2Helper& rParent, TextParagraph& rPara ); - virtual void SAL_CALL endFastElement( sal_Int32 aElementToken ) throw (SAXException, RuntimeException); - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException); + virtual ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) SAL_OVERRIDE; protected: TextParagraph& mrParagraph; }; // -------------------------------------------------------------------- -TextParagraphContext::TextParagraphContext( ContextHandler& rParent, TextParagraph& rPara ) -: ContextHandler( rParent ) +TextParagraphContext::TextParagraphContext( ContextHandler2Helper& rParent, TextParagraph& rPara ) +: ContextHandler2( rParent ) , mrParagraph( rPara ) { } // -------------------------------------------------------------------- -void TextParagraphContext::endFastElement( sal_Int32 aElementToken ) throw (SAXException, RuntimeException) -{ - if( aElementToken == (A_TOKEN( p )) ) - { - } -} - -// -------------------------------------------------------------------- -Reference< XFastContextHandler > TextParagraphContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +ContextHandlerRef TextParagraphContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - // EG_TextRun switch( aElementToken ) { @@ -76,38 +65,33 @@ Reference< XFastContextHandler > TextParagraphContext::createFastChildContext( s { TextRunPtr pRun( new TextRun ); mrParagraph.addRun( pRun ); - xRet.set( new RegularTextRunContext( *this, pRun ) ); - break; + return new RegularTextRunContext( *this, pRun ); } case A_TOKEN( br ): // "CT_TextLineBreak" Soft return line break (vertical tab). { TextRunPtr pRun( new TextRun ); pRun->setLineBreak(); mrParagraph.addRun( pRun ); - xRet.set( new RegularTextRunContext( *this, pRun ) ); - break; + return new RegularTextRunContext( *this, pRun ); } case A_TOKEN( fld ): // "CT_TextField" Text Field. { TextFieldPtr pField( new TextField ); mrParagraph.addRun( pField ); - xRet.set( new TextFieldContext( *this, xAttribs, *pField ) ); - break; + return new TextFieldContext( *this, rAttribs, *pField ); } case A_TOKEN( pPr ): - xRet.set( new TextParagraphPropertiesContext( *this, xAttribs, mrParagraph.getProperties() ) ); - break; + return new TextParagraphPropertiesContext( *this, rAttribs, mrParagraph.getProperties() ); case A_TOKEN( endParaRPr ): - xRet.set( new TextCharacterPropertiesContext( *this, xAttribs, mrParagraph.getEndProperties() ) ); - break; + return new TextCharacterPropertiesContext( *this, rAttribs, mrParagraph.getEndProperties() ); } - return xRet; + return 0; } // -------------------------------------------------------------------- -RegularTextRunContext::RegularTextRunContext( ContextHandler& rParent, TextRunPtr pRunPtr ) -: ContextHandler( rParent ) +RegularTextRunContext::RegularTextRunContext( ContextHandler2Helper& rParent, TextRunPtr pRunPtr ) +: ContextHandler2( rParent ) , mpRunPtr( pRunPtr ) , mbIsInText( false ) { @@ -115,9 +99,9 @@ RegularTextRunContext::RegularTextRunContext( ContextHandler& rParent, TextRunPt // -------------------------------------------------------------------- -void RegularTextRunContext::endFastElement( sal_Int32 aElementToken ) throw (SAXException, RuntimeException) +void RegularTextRunContext::onEndElement( ) { - switch( aElementToken ) + switch( getCurrentElement() ) { case A_TOKEN( t ): { @@ -134,7 +118,7 @@ void RegularTextRunContext::endFastElement( sal_Int32 aElementToken ) throw (SAX // -------------------------------------------------------------------- -void RegularTextRunContext::characters( const OUString& aChars ) throw (SAXException, RuntimeException) +void RegularTextRunContext::onCharacters( const OUString& aChars ) { if( mbIsInText ) { @@ -144,57 +128,44 @@ void RegularTextRunContext::characters( const OUString& aChars ) throw (SAXExcep // -------------------------------------------------------------------- -Reference< XFastContextHandler > RegularTextRunContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs) throw (SAXException, RuntimeException) +ContextHandlerRef RegularTextRunContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs) { - Reference< XFastContextHandler > xRet( this ); - switch( aElementToken ) { case A_TOKEN( rPr ): // "CT_TextCharPropertyBag" The text char properties of this text run. - xRet.set( new TextCharacterPropertiesContext( *this, xAttribs, mpRunPtr->getTextCharacterProperties() ) ); + return new TextCharacterPropertiesContext( *this, rAttribs, mpRunPtr->getTextCharacterProperties() ); break; case A_TOKEN( t ): // "xsd:string" minOccurs="1" The actual text string. mbIsInText = true; break; } - return xRet; + return this; } // -------------------------------------------------------------------- -TextBodyContext::TextBodyContext( ContextHandler& rParent, TextBody& rTextBody ) -: ContextHandler( rParent ) +TextBodyContext::TextBodyContext( ContextHandler2Helper& rParent, TextBody& rTextBody ) +: ContextHandler2( rParent ) , mrTextBody( rTextBody ) { } // -------------------------------------------------------------------- -void TextBodyContext::endFastElement( sal_Int32 ) throw (SAXException, RuntimeException) +ContextHandlerRef TextBodyContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { -} - -// -------------------------------------------------------------------- - -Reference< XFastContextHandler > TextBodyContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) -{ - Reference< XFastContextHandler > xRet; - switch( aElementToken ) { case A_TOKEN( bodyPr ): // CT_TextBodyPropertyBag - xRet.set( new TextBodyPropertiesContext( *this, xAttribs, mrTextBody.getTextProperties() ) ); - break; + return new TextBodyPropertiesContext( *this, rAttribs, mrTextBody.getTextProperties() ); case A_TOKEN( lstStyle ): // CT_TextListStyle - xRet.set( new TextListStyleContext( *this, mrTextBody.getTextListStyle() ) ); - break; + return new TextListStyleContext( *this, mrTextBody.getTextListStyle() ); case A_TOKEN( p ): // CT_TextParagraph - xRet.set( new TextParagraphContext( *this, mrTextBody.addParagraph() ) ); - break; + return new TextParagraphContext( *this, mrTextBody.addParagraph() ); } - return xRet; + return 0; } // -------------------------------------------------------------------- diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx index 3fc2aa74abc9..358db9f9c987 100644 --- a/oox/source/drawingml/textbodypropertiescontext.cxx +++ b/oox/source/drawingml/textbodypropertiescontext.cxx @@ -36,18 +36,14 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace drawingml { -// -------------------------------------------------------------------- - // CT_TextBodyProperties -TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler& rParent, - const Reference< XFastAttributeList >& xAttributes, TextBodyProperties& rTextBodyProp ) -: ContextHandler( rParent ) +TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler2Helper& rParent, + const AttributeList& rAttribs, TextBodyProperties& rTextBodyProp ) +: ContextHandler2( rParent ) , mrTextBodyProp( rTextBodyProp ) { - AttributeList aAttribs( xAttributes ); - // ST_TextWrappingType - sal_Int32 nWrappingType = aAttribs.getToken( XML_wrap, XML_square ); + sal_Int32 nWrappingType = rAttribs.getToken( XML_wrap, XML_square ); mrTextBodyProp.maPropertyMap[ PROP_TextWordWrap ] <<= static_cast< sal_Bool >( nWrappingType == XML_square ); // ST_Coordinate @@ -55,42 +51,42 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler& rParent, sal_Int32 aIns[] = { XML_lIns, XML_tIns, XML_rIns, XML_bIns }; for( sal_Int32 i = 0; i < ( sal_Int32 )( sizeof( aIns ) / sizeof( sal_Int32 ) ); i++) { - sValue = xAttributes->getOptionalValue( aIns[i] ); + sValue = rAttribs.getString( aIns[i] ).get(); if( !sValue.isEmpty() ) mrTextBodyProp.moInsets[i] = GetCoordinate( sValue ); } - bool bAnchorCenter = aAttribs.getBool( XML_anchorCtr, false ); - if( xAttributes->hasAttribute( XML_anchorCtr ) ) { + bool bAnchorCenter = rAttribs.getBool( XML_anchorCtr, false ); + if( rAttribs.hasAttribute( XML_anchorCtr ) ) { if( bAnchorCenter ) mrTextBodyProp.maPropertyMap[ PROP_TextHorizontalAdjust ] <<= TextHorizontalAdjust_CENTER; } -// bool bCompatLineSpacing = aAttribs.getBool( XML_compatLnSpc, false ); -// bool bForceAA = aAttribs.getBool( XML_forceAA, false ); -// bool bFromWordArt = aAttribs.getBool( XML_fromWordArt, false ); +// bool bCompatLineSpacing = rAttribs.getBool( XML_compatLnSpc, false ); +// bool bForceAA = rAttribs.getBool( XML_forceAA, false ); +// bool bFromWordArt = rAttribs.getBool( XML_fromWordArt, false ); // ST_TextHorzOverflowType -// sal_Int32 nHorzOverflow = xAttributes->getOptionalValueToken( XML_horzOverflow, XML_overflow ); +// sal_Int32 nHorzOverflow = rAttribs.getToken( XML_horzOverflow, XML_overflow ); // ST_TextVertOverflowType -// sal_Int32 nVertOverflow = xAttributes->getOptionalValueToken( XML_vertOverflow, XML_overflow ); +// sal_Int32 nVertOverflow = rAttribs.getToken( XML_vertOverflow, XML_overflow ); // ST_TextColumnCount -// sal_Int32 nNumCol = aAttribs.getInteger( XML_numCol, 1 ); +// sal_Int32 nNumCol = rAttribs.getInteger( XML_numCol, 1 ); // ST_Angle - mrTextBodyProp.moRotation = aAttribs.getInteger( XML_rot ); + mrTextBodyProp.moRotation = rAttribs.getInteger( XML_rot ); -// bool bRtlCol = aAttribs.getBool( XML_rtlCol, false ); +// bool bRtlCol = rAttribs.getBool( XML_rtlCol, false ); // ST_PositiveCoordinate -// sal_Int32 nSpcCol = aAttribs.getInteger( XML_spcCol, 0 ); -// bool bSpcFirstLastPara = aAttribs.getBool( XML_spcFirstLastPara, 0 ); -// bool bUpRight = aAttribs.getBool( XML_upright, 0 ); +// sal_Int32 nSpcCol = rAttribs.getInteger( XML_spcCol, 0 ); +// bool bSpcFirstLastPara = rAttribs.getBool( XML_spcFirstLastPara, 0 ); +// bool bUpRight = rAttribs.getBool( XML_upright, 0 ); // ST_TextVerticalType - if( xAttributes->hasAttribute( XML_vert ) ) { - mrTextBodyProp.moVert = aAttribs.getToken( XML_vert ); - bool bRtl = aAttribs.getBool( XML_rtl, false ); + if( rAttribs.hasAttribute( XML_vert ) ) { + mrTextBodyProp.moVert = rAttribs.getToken( XML_vert ); + bool bRtl = rAttribs.getBool( XML_rtl, false ); sal_Int32 tVert = mrTextBodyProp.moVert.get( XML_horz ); if( tVert == XML_vert || tVert == XML_eaVert || tVert == XML_vert270 || tVert == XML_mongolianVert ) mrTextBodyProp.moRotation = -5400000*(tVert==XML_vert270?3:1); @@ -100,8 +96,8 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler& rParent, } // ST_TextAnchoringType - if( xAttributes->hasAttribute( XML_anchor ) ) { - switch( xAttributes->getOptionalValueToken( XML_anchor, XML_t ) ) + if( rAttribs.hasAttribute( XML_anchor ) ) { + switch( rAttribs.getToken( XML_anchor, XML_t ) ) { case XML_b : mrTextBodyProp.meVA = drawing::TextVerticalAdjust_BOTTOM; break; case XML_dist : @@ -118,17 +114,8 @@ TextBodyPropertiesContext::TextBodyPropertiesContext( ContextHandler& rParent, mrTextBodyProp.maPropertyMap[ PROP_TextFitToSize ] <<= drawing::TextFitToSizeType_NONE; } -// -------------------------------------------------------------------- - -void TextBodyPropertiesContext::endFastElement( sal_Int32 ) throw (SAXException, RuntimeException) -{ -} - -// -------------------------------------------------------------------- - -Reference< XFastContextHandler > TextBodyPropertiesContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& /*xAttributes*/) throw (SAXException, RuntimeException) +ContextHandlerRef TextBodyPropertiesContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& /*rAttribs*/) { - Reference< XFastContextHandler > xRet; switch( aElementToken ) { // Sequence @@ -157,11 +144,9 @@ Reference< XFastContextHandler > TextBodyPropertiesContext::createFastChildConte break; } - return xRet; + return 0; } -// -------------------------------------------------------------------- - } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/textcharacterpropertiescontext.cxx b/oox/source/drawingml/textcharacterpropertiescontext.cxx index ed2ef6e88726..dfca590a62e5 100644 --- a/oox/source/drawingml/textcharacterpropertiescontext.cxx +++ b/oox/source/drawingml/textcharacterpropertiescontext.cxx @@ -34,33 +34,30 @@ using namespace ::com::sun::star::awt; namespace oox { namespace drawingml { -// -------------------------------------------------------------------- - // CT_TextCharacterProperties TextCharacterPropertiesContext::TextCharacterPropertiesContext( - ContextHandler& rParent, - const Reference< XFastAttributeList >& rXAttributes, + ContextHandler2Helper& rParent, + const AttributeList& rAttribs, TextCharacterProperties& rTextCharacterProperties ) -: ContextHandler( rParent ) +: ContextHandler2( rParent ) , mrTextCharacterProperties( rTextCharacterProperties ) { - AttributeList aAttribs( rXAttributes ); - if ( aAttribs.hasAttribute( XML_lang ) ) - mrTextCharacterProperties.moLang = aAttribs.getString( XML_lang ); - if ( aAttribs.hasAttribute( XML_sz ) ) - mrTextCharacterProperties.moHeight = aAttribs.getInteger( XML_sz ); - if ( aAttribs.hasAttribute( XML_spc ) ) - mrTextCharacterProperties.moSpacing = aAttribs.getInteger( XML_spc ); - if ( aAttribs.hasAttribute( XML_u ) ) - mrTextCharacterProperties.moUnderline = aAttribs.getToken( XML_u ); - if ( aAttribs.hasAttribute( XML_strike ) ) - mrTextCharacterProperties.moStrikeout = aAttribs.getToken( XML_strike ); - -// mrTextCharacterProperties.moCaseMap = aAttribs.getToken( XML_cap ); - if ( aAttribs.hasAttribute( XML_b ) ) - mrTextCharacterProperties.moBold = aAttribs.getBool( XML_b ); - if ( aAttribs.hasAttribute( XML_i ) ) - mrTextCharacterProperties.moItalic = aAttribs.getBool( XML_i ); + if ( rAttribs.hasAttribute( XML_lang ) ) + mrTextCharacterProperties.moLang = rAttribs.getString( XML_lang ); + if ( rAttribs.hasAttribute( XML_sz ) ) + mrTextCharacterProperties.moHeight = rAttribs.getInteger( XML_sz ); + if ( rAttribs.hasAttribute( XML_spc ) ) + mrTextCharacterProperties.moSpacing = rAttribs.getInteger( XML_spc ); + if ( rAttribs.hasAttribute( XML_u ) ) + mrTextCharacterProperties.moUnderline = rAttribs.getToken( XML_u ); + if ( rAttribs.hasAttribute( XML_strike ) ) + mrTextCharacterProperties.moStrikeout = rAttribs.getToken( XML_strike ); + +// mrTextCharacterProperties.moCaseMap = rAttribs.getToken( XML_cap ); + if ( rAttribs.hasAttribute( XML_b ) ) + mrTextCharacterProperties.moBold = rAttribs.getBool( XML_b ); + if ( rAttribs.hasAttribute( XML_i ) ) + mrTextCharacterProperties.moItalic = rAttribs.getBool( XML_i ); // TODO /* todo: we need to be able to iterate over the XFastAttributes @@ -70,7 +67,7 @@ TextCharacterPropertiesContext::TextCharacterPropertiesContext( //case A_TOKEN( kern ): // ST_TextLanguageID - OUString sAltLang = rXAttributes->getOptionalValue( XML_altLang ); + OUString sAltLang = rAttribs.getString( XML_altLang ).get(); case A_TOKEN( kumimoji ): // xsd:boolean break; @@ -91,28 +88,16 @@ TextCharacterPropertiesContext::~TextCharacterPropertiesContext() { } -// -------------------------------------------------------------------- - -void TextCharacterPropertiesContext::endFastElement( sal_Int32 ) throw (SAXException, RuntimeException) -{ -} - -// -------------------------------------------------------------------- - -Reference< XFastContextHandler > TextCharacterPropertiesContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttributes ) throw (SAXException, RuntimeException) +ContextHandlerRef TextCharacterPropertiesContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - AttributeList aAttribs( xAttributes ); - Reference< XFastContextHandler > xRet; switch( aElementToken ) { // TODO unsupported yet // case A_TOKEN( ln ): // CT_LineProperties -// xRet.set( new LinePropertiesContext( getHandler(), xAttributes, maTextOutlineProperties ) ); -// break; +// return new LinePropertiesContext( getHandler(), rAttribs, maTextOutlineProperties ); case A_TOKEN( solidFill ): // EG_FillProperties - xRet.set( new ColorContext( *this, mrTextCharacterProperties.maCharColor ) ); - break; + return new ColorContext( *this, mrTextCharacterProperties.maCharColor ); // EG_EffectProperties case A_TOKEN( effectDag ): // CT_EffectContainer 5.1.10.25 @@ -120,8 +105,7 @@ Reference< XFastContextHandler > TextCharacterPropertiesContext::createFastChild break; case A_TOKEN( highlight ): // CT_Color - xRet.set( new ColorContext( *this, mrTextCharacterProperties.maHighlightColor ) ); - break; + return new ColorContext( *this, mrTextCharacterProperties.maHighlightColor ); // EG_TextUnderlineLine case A_TOKEN( uLnTx ): // CT_TextUnderlineLineFollowText @@ -129,42 +113,36 @@ Reference< XFastContextHandler > TextCharacterPropertiesContext::createFastChild break; // TODO unsupported yet // case A_TOKEN( uLn ): // CT_LineProperties -// xRet.set( new LinePropertiesContext( getHandler(), xAttributes, maUnderlineProperties ) ); -// break; +// return new LinePropertiesContext( getHandler(), rAttribs, maUnderlineProperties ); // EG_TextUnderlineFill case A_TOKEN( uFillTx ): // CT_TextUnderlineFillFollowText mrTextCharacterProperties.moUnderlineFillFollowText = true; break; case A_TOKEN( uFill ): // CT_TextUnderlineFillGroupWrapper->EG_FillProperties (not supported) - xRet.set( new SimpleFillPropertiesContext( *this, mrTextCharacterProperties.maUnderlineColor ) ); - break; + return new SimpleFillPropertiesContext( *this, mrTextCharacterProperties.maUnderlineColor ); // CT_FontCollection case A_TOKEN( latin ): // CT_TextFont - mrTextCharacterProperties.maLatinFont.setAttributes( aAttribs ); + mrTextCharacterProperties.maLatinFont.setAttributes( rAttribs ); break; case A_TOKEN( ea ): // CT_TextFont - mrTextCharacterProperties.maAsianFont.setAttributes( aAttribs ); + mrTextCharacterProperties.maAsianFont.setAttributes( rAttribs ); break; case A_TOKEN( cs ): // CT_TextFont - mrTextCharacterProperties.maComplexFont.setAttributes( aAttribs ); + mrTextCharacterProperties.maComplexFont.setAttributes( rAttribs ); break; case A_TOKEN( sym ): // CT_TextFont - mrTextCharacterProperties.maSymbolFont.setAttributes( aAttribs ); + mrTextCharacterProperties.maSymbolFont.setAttributes( rAttribs ); break; case A_TOKEN( hlinkClick ): // CT_Hyperlink case A_TOKEN( hlinkMouseOver ): // CT_Hyperlink - xRet.set( new HyperLinkContext( *this, xAttributes, mrTextCharacterProperties.maHyperlinkPropertyMap ) ); - break; + return new HyperLinkContext( *this, rAttribs, mrTextCharacterProperties.maHyperlinkPropertyMap ); } - if( !xRet.is() ) - xRet.set( this ); - return xRet; -} -// -------------------------------------------------------------------- + return this; +} } } diff --git a/oox/source/drawingml/textfieldcontext.cxx b/oox/source/drawingml/textfieldcontext.cxx index 82b3e7090f40..8dcb14d3baeb 100644 --- a/oox/source/drawingml/textfieldcontext.cxx +++ b/oox/source/drawingml/textfieldcontext.cxx @@ -28,26 +28,26 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace drawingml { -TextFieldContext::TextFieldContext( ContextHandler& rParent, - const Reference< XFastAttributeList >& rXAttributes, +TextFieldContext::TextFieldContext( ContextHandler2Helper& rParent, + const AttributeList& rAttributes, TextField& rTextField) - : ContextHandler( rParent ) + : ContextHandler2( rParent ) , mrTextField( rTextField ) , mbIsInText( false ) { - mrTextField.setUuid( rXAttributes->getOptionalValue( XML_id ) ); - mrTextField.setType( rXAttributes->getOptionalValue( XML_type ) ); + mrTextField.setUuid( rAttributes.getString( XML_id ).get() ); + mrTextField.setType( rAttributes.getString( XML_type ).get() ); } -void TextFieldContext::endFastElement( sal_Int32 aElementToken ) throw (SAXException, RuntimeException) +void TextFieldContext::onEndElement( ) { - if( aElementToken == (A_TOKEN( t )) ) + if( getCurrentElement() == (A_TOKEN( t )) ) { mbIsInText = false; } } -void TextFieldContext::characters( const OUString& aChars ) throw (SAXException, RuntimeException) +void TextFieldContext::onCharacters( const OUString& aChars ) { if( mbIsInText ) { @@ -55,28 +55,21 @@ void TextFieldContext::characters( const OUString& aChars ) throw (SAXException, } } -Reference< XFastContextHandler > TextFieldContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) - throw (SAXException, RuntimeException) +ContextHandlerRef TextFieldContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; switch( aElementToken ) { case A_TOKEN( rPr ): - xRet.set( new TextCharacterPropertiesContext( *this, xAttribs, mrTextField.getTextCharacterProperties() ) ); - break; + return new TextCharacterPropertiesContext( *this, rAttribs, mrTextField.getTextCharacterProperties() ); case A_TOKEN( pPr ): - xRet.set( new TextParagraphPropertiesContext( *this, xAttribs, mrTextField.getTextParagraphProperties() ) ); - break; + return new TextParagraphPropertiesContext( *this, rAttribs, mrTextField.getTextParagraphProperties() ); case A_TOKEN( t ): mbIsInText = true; break; } - if ( !xRet.is() ) - xRet.set( this ); - return xRet; + return this; } - } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/textliststylecontext.cxx b/oox/source/drawingml/textliststylecontext.cxx index 76d71d907097..b57171455463 100644 --- a/oox/source/drawingml/textliststylecontext.cxx +++ b/oox/source/drawingml/textliststylecontext.cxx @@ -27,11 +27,9 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace drawingml { -// -------------------------------------------------------------------- - // CT_TextListStyle -TextListStyleContext::TextListStyleContext( ContextHandler& rParent, TextListStyle& rTextListStyle ) -: ContextHandler( rParent ) +TextListStyleContext::TextListStyleContext( ContextHandler2Helper& rParent, TextListStyle& rTextListStyle ) +: ContextHandler2( rParent ) , mrTextListStyle( rTextListStyle ) { } @@ -42,57 +40,37 @@ TextListStyleContext::~TextListStyleContext() // -------------------------------------------------------------------- -void TextListStyleContext::endFastElement( sal_Int32 ) throw (SAXException, RuntimeException) -{ -} - -// -------------------------------------------------------------------- - -Reference< XFastContextHandler > TextListStyleContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& rxAttributes ) throw (SAXException, RuntimeException) +ContextHandlerRef TextListStyleContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; switch( aElementToken ) { case A_TOKEN( defPPr ): // CT_TextParagraphProperties - xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 0 ] ) ); - break; + return new TextParagraphPropertiesContext( *this, rAttribs, *mrTextListStyle.getListStyle()[ 0 ] ); case A_TOKEN( outline1pPr ): - xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getAggregationListStyle()[ 0 ] ) ); - break; + return new TextParagraphPropertiesContext( *this, rAttribs, *mrTextListStyle.getAggregationListStyle()[ 0 ] ); case A_TOKEN( outline2pPr ): - xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getAggregationListStyle()[ 1 ] ) ); - break; + return new TextParagraphPropertiesContext( *this, rAttribs, *mrTextListStyle.getAggregationListStyle()[ 1 ] ); case A_TOKEN( lvl1pPr ): - xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 0 ] ) ); - break; + return new TextParagraphPropertiesContext( *this, rAttribs, *mrTextListStyle.getListStyle()[ 0 ] ); case A_TOKEN( lvl2pPr ): - xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 1 ] ) ); - break; + return new TextParagraphPropertiesContext( *this, rAttribs, *mrTextListStyle.getListStyle()[ 1 ] ); case A_TOKEN( lvl3pPr ): - xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 2 ] ) ); - break; + return new TextParagraphPropertiesContext( *this, rAttribs, *mrTextListStyle.getListStyle()[ 2 ] ); case A_TOKEN( lvl4pPr ): - xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 3 ] ) ); - break; + return new TextParagraphPropertiesContext( *this, rAttribs, *mrTextListStyle.getListStyle()[ 3 ] ); case A_TOKEN( lvl5pPr ): - xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 4 ] ) ); - break; + return new TextParagraphPropertiesContext( *this, rAttribs, *mrTextListStyle.getListStyle()[ 4 ] ); case A_TOKEN( lvl6pPr ): - xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 5 ] ) ); - break; + return new TextParagraphPropertiesContext( *this, rAttribs, *mrTextListStyle.getListStyle()[ 5 ] ); case A_TOKEN( lvl7pPr ): - xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 6 ] ) ); - break; + return new TextParagraphPropertiesContext( *this, rAttribs, *mrTextListStyle.getListStyle()[ 6 ] ); case A_TOKEN( lvl8pPr ): - xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 7 ] ) ); - break; + return new TextParagraphPropertiesContext( *this, rAttribs, *mrTextListStyle.getListStyle()[ 7 ] ); case A_TOKEN( lvl9pPr ): - xRet.set( new TextParagraphPropertiesContext( *this, rxAttributes, *mrTextListStyle.getListStyle()[ 8 ] ) ); - break; + return new TextParagraphPropertiesContext( *this, rAttribs, *mrTextListStyle.getListStyle()[ 8 ] ); } - if ( !xRet.is() ) - xRet.set( this ); - return xRet; + + return this; } // -------------------------------------------------------------------- diff --git a/oox/source/drawingml/textparagraphpropertiescontext.cxx b/oox/source/drawingml/textparagraphpropertiescontext.cxx index 6b5f29aff42b..4ec6b655fbeb 100644 --- a/oox/source/drawingml/textparagraphpropertiescontext.cxx +++ b/oox/source/drawingml/textparagraphpropertiescontext.cxx @@ -39,58 +39,57 @@ using namespace ::com::sun::star::text; namespace oox { namespace drawingml { // CT_TextParagraphProperties -TextParagraphPropertiesContext::TextParagraphPropertiesContext( ContextHandler& rParent, - const Reference< XFastAttributeList >& xAttribs, +TextParagraphPropertiesContext::TextParagraphPropertiesContext( ContextHandler2Helper& rParent, + const AttributeList& rAttribs, TextParagraphProperties& rTextParagraphProperties ) -: ContextHandler( rParent ) +: ContextHandler2( rParent ) , mrTextParagraphProperties( rTextParagraphProperties ) , mrSpaceBefore( rTextParagraphProperties.getParaTopMargin() ) , mrSpaceAfter( rTextParagraphProperties.getParaBottomMargin() ) , mrBulletList( rTextParagraphProperties.getBulletList() ) { OUString sValue; - AttributeList attribs( xAttribs ); PropertyMap& rPropertyMap( mrTextParagraphProperties.getTextParagraphPropertyMap() ); // ST_TextAlignType - rPropertyMap[ PROP_ParaAdjust ] <<= GetParaAdjust( xAttribs->getOptionalValueToken( XML_algn, XML_l ) ); + rPropertyMap[ PROP_ParaAdjust ] <<= GetParaAdjust( rAttribs.getToken( XML_algn, XML_l ) ); // TODO see to do the same with RubyAdjust // ST_Coordinate32 -// sValue = xAttribs->getOptionalValue( XML_defTabSz ); SJ: we need to be able to set the default tab size for each text object, +// sValue = rAttribs.getString( XML_defTabSz ).get(); SJ: we need to be able to set the default tab size for each text object, // this is possible at the moment only for the whole document. // sal_Int32 nDefTabSize = ( sValue.getLength() == 0 ? 0 : GetCoordinate( sValue ) ); // TODO -// bool bEaLineBrk = attribs.getBool( XML_eaLnBrk, true ); - if ( xAttribs->hasAttribute( XML_latinLnBrk ) ) +// bool bEaLineBrk = rAttribs.getBool( XML_eaLnBrk, true ); + if ( rAttribs.hasAttribute( XML_latinLnBrk ) ) { - bool bLatinLineBrk = attribs.getBool( XML_latinLnBrk, true ); + bool bLatinLineBrk = rAttribs.getBool( XML_latinLnBrk, true ); rPropertyMap[ PROP_ParaIsHyphenation ] <<= bLatinLineBrk; } // TODO see what to do with Asian hyphenation // ST_TextFontAlignType // TODO -// sal_Int32 nFontAlign = xAttribs->getOptionalValueToken( XML_fontAlgn, XML_base ); +// sal_Int32 nFontAlign = rAttribs.getToken( XML_fontAlgn, XML_base ); - if ( xAttribs->hasAttribute( XML_hangingPunct ) ) + if ( rAttribs.hasAttribute( XML_hangingPunct ) ) { - bool bHangingPunct = attribs.getBool( XML_hangingPunct, false ); + bool bHangingPunct = rAttribs.getBool( XML_hangingPunct, false ); rPropertyMap[ PROP_ParaIsHangingPunctuation ] <<= bHangingPunct; } // ST_Coordinate - if ( xAttribs->hasAttribute( XML_indent ) ) + if ( rAttribs.hasAttribute( XML_indent ) ) { - sValue = xAttribs->getOptionalValue( XML_indent ); + sValue = rAttribs.getString( XML_indent ).get(); mrTextParagraphProperties.getFirstLineIndentation() = boost::optional< sal_Int32 >( sValue.isEmpty() ? 0 : GetCoordinate( sValue ) ); } // ST_TextIndentLevelType // -1 is an invalid value and denote the lack of level - sal_Int32 nLevel = attribs.getInteger( XML_lvl, 0 ); + sal_Int32 nLevel = rAttribs.getInteger( XML_lvl, 0 ); if( nLevel > 8 || nLevel < 0 ) { nLevel = 0; @@ -105,29 +104,28 @@ TextParagraphPropertiesContext::TextParagraphPropertiesContext( ContextHandler& // ST_TextMargin // ParaLeftMargin - if ( xAttribs->hasAttribute( XML_marL ) ) + if ( rAttribs.hasAttribute( XML_marL ) ) { - sValue = xAttribs->getOptionalValue( XML_marL ); + sValue = rAttribs.getString( XML_marL ).get(); mrTextParagraphProperties.getParaLeftMargin() = boost::optional< sal_Int32 >( sValue.isEmpty() ? 0 : GetCoordinate( sValue ) ); } // ParaRightMargin - if ( xAttribs->hasAttribute( XML_marR ) ) + if ( rAttribs.hasAttribute( XML_marR ) ) { - sValue = xAttribs->getOptionalValue( XML_marR ); + sValue = rAttribs.getString( XML_marR ).get(); sal_Int32 nMarR = sValue.isEmpty() ? 0 : GetCoordinate( sValue ) ; rPropertyMap[ PROP_ParaRightMargin ] <<= nMarR; } - if ( xAttribs->hasAttribute( XML_rtl ) ) + if ( rAttribs.hasAttribute( XML_rtl ) ) { - bool bRtl = attribs.getBool( XML_rtl, false ); + bool bRtl = rAttribs.getBool( XML_rtl, false ); rPropertyMap[ PROP_WritingMode ] <<= ( bRtl ? WritingMode2::RL_TB : WritingMode2::LR_TB ); } } - TextParagraphPropertiesContext::~TextParagraphPropertiesContext() { PropertyMap& rPropertyMap( mrTextParagraphProperties.getTextParagraphPropertyMap() ); @@ -159,48 +157,33 @@ TextParagraphPropertiesContext::~TextParagraphPropertiesContext() // -------------------------------------------------------------------- -void TextParagraphPropertiesContext::endFastElement( sal_Int32 ) throw (SAXException, RuntimeException) -{ -} - - - -// -------------------------------------------------------------------- - -Reference< XFastContextHandler > TextParagraphPropertiesContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& rXAttributes ) throw (SAXException, RuntimeException) +ContextHandlerRef TextParagraphPropertiesContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - AttributeList aAttribs( rXAttributes ); Reference< XFastContextHandler > xRet; switch( aElementToken ) { case A_TOKEN( lnSpc ): // CT_TextSpacing - xRet.set( new TextSpacingContext( *this, maLineSpacing ) ); - break; + return new TextSpacingContext( *this, maLineSpacing ); case A_TOKEN( spcBef ): // CT_TextSpacing - xRet.set( new TextSpacingContext( *this, mrSpaceBefore ) ); - break; + return new TextSpacingContext( *this, mrSpaceBefore ); case A_TOKEN( spcAft ): // CT_TextSpacing - xRet.set( new TextSpacingContext( *this, mrSpaceAfter ) ); - break; - + return new TextSpacingContext( *this, mrSpaceAfter ); // EG_TextBulletColor case A_TOKEN( buClrTx ): // CT_TextBulletColorFollowText ??? mrBulletList.mbBulletColorFollowText <<= sal_True; break; case A_TOKEN( buClr ): // CT_Color - xRet.set( new ColorContext( *this, *mrBulletList.maBulletColorPtr ) ); - break; - + return new ColorContext( *this, *mrBulletList.maBulletColorPtr ); // EG_TextBulletSize case A_TOKEN( buSzTx ): // CT_TextBulletSizeFollowText mrBulletList.setBulletSize(100); break; case A_TOKEN( buSzPct ): // CT_TextBulletSizePercent - mrBulletList.setBulletSize( static_cast<sal_Int16>( GetPercent( rXAttributes->getOptionalValue( XML_val ) ) / 1000 ) ); + mrBulletList.setBulletSize( static_cast<sal_Int16>( GetPercent( rAttribs.getString( XML_val ).get() ) / 1000 ) ); break; case A_TOKEN( buSzPts ): // CT_TextBulletSizePoint mrBulletList.setBulletSize(0); - mrBulletList.setFontSize( static_cast<sal_Int16>(GetTextSize( rXAttributes->getOptionalValue( XML_val ) ) ) ); + mrBulletList.setFontSize( static_cast<sal_Int16>(GetTextSize( rAttribs.getString( XML_val ).get() ) ) ); break; // EG_TextBulletTypeface @@ -208,7 +191,7 @@ Reference< XFastContextHandler > TextParagraphPropertiesContext::createFastChild mrBulletList.mbBulletFontFollowText <<= sal_True; break; case A_TOKEN( buFont ): // CT_TextFont - mrBulletList.maBulletFont.setAttributes( aAttribs ); + mrBulletList.maBulletFont.setAttributes( rAttribs ); break; // EG_TextBullet @@ -217,10 +200,9 @@ Reference< XFastContextHandler > TextParagraphPropertiesContext::createFastChild break; case A_TOKEN( buAutoNum ): // CT_TextAutonumberBullet { - AttributeList attribs( rXAttributes ); try { - sal_Int32 nType = rXAttributes->getValueToken( XML_type ); - sal_Int32 nStartAt = attribs.getInteger( XML_startAt, 1 ); + sal_Int32 nType = rAttribs.getToken( XML_type, 0 ); + sal_Int32 nStartAt = rAttribs.getInteger( XML_startAt, 1 ); if( nStartAt > 32767 ) { nStartAt = 32767; @@ -240,7 +222,7 @@ Reference< XFastContextHandler > TextParagraphPropertiesContext::createFastChild } case A_TOKEN( buChar ): // CT_TextCharBullet try { - mrBulletList.setBulletChar( rXAttributes->getValue( XML_char ) ); + mrBulletList.setBulletChar( rAttribs.getString( XML_char ).get() ); } catch(SAXException& /* e */) { @@ -250,24 +232,16 @@ Reference< XFastContextHandler > TextParagraphPropertiesContext::createFastChild case A_TOKEN( buBlip ): // CT_TextBlipBullet { mxBlipProps.reset( new BlipFillProperties ); - xRet.set( new BlipFillContext( *this, rXAttributes, *mxBlipProps ) ); + return new BlipFillContext( *this, rAttribs, *mxBlipProps ); } - break; - case A_TOKEN( tabLst ): // CT_TextTabStopList - xRet.set( new TextTabStopListContext( *this, maTabList ) ); - break; + return new TextTabStopListContext( *this, maTabList ); case A_TOKEN( defRPr ): // CT_TextCharacterProperties - xRet.set( new TextCharacterPropertiesContext( *this, rXAttributes, mrTextParagraphProperties.getTextCharacterProperties() ) ); - break; + return new TextCharacterPropertiesContext( *this, rAttribs, mrTextParagraphProperties.getTextCharacterProperties() ); } - if ( !xRet.is() ) - xRet.set( this ); - return xRet; + return this; } -// -------------------------------------------------------------------- - } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/textspacingcontext.cxx b/oox/source/drawingml/textspacingcontext.cxx index a4d710186600..2c14530196db 100644 --- a/oox/source/drawingml/textspacingcontext.cxx +++ b/oox/source/drawingml/textspacingcontext.cxx @@ -28,41 +28,32 @@ using namespace ::com::sun::star::uno; namespace oox { namespace drawingml { - TextSpacingContext::TextSpacingContext( ContextHandler& rParent, TextSpacing & aSpacing ) - : ContextHandler( rParent ) + TextSpacingContext::TextSpacingContext( ContextHandler2Helper& rParent, TextSpacing & aSpacing ) + : ContextHandler2( rParent ) , maSpacing( aSpacing ) { maSpacing.bHasValue = true; } - void TextSpacingContext::endFastElement( sal_Int32 /*nElement*/ ) - throw ( SAXException, RuntimeException ) + ContextHandlerRef TextSpacingContext::onCreateContext( ::sal_Int32 aElement, + const AttributeList& rAttribs ) { - } - - Reference< XFastContextHandler > TextSpacingContext::createFastChildContext( ::sal_Int32 aElement, - const Reference< XFastAttributeList >& xAttribs ) - throw ( SAXException, RuntimeException ) - { - Reference< XFastContextHandler > xRet; switch( aElement ) { case A_TOKEN( spcPct ): maSpacing.nUnit = TextSpacing::PERCENT; - maSpacing.nValue = GetPercent( xAttribs->getValue( XML_val ) ); + maSpacing.nValue = GetPercent( rAttribs.getString( XML_val ).get() ); break; case A_TOKEN( spcPts ): maSpacing.nUnit = TextSpacing::POINTS; - maSpacing.nValue = GetTextSpacingPoint( xAttribs->getValue( XML_val ) ); + maSpacing.nValue = GetTextSpacingPoint( rAttribs.getString( XML_val ).get() ); break; default: break; } - if ( !xRet.is() ) - xRet.set( this ); - return xRet; - } + return this; + } } } diff --git a/oox/source/drawingml/textspacingcontext.hxx b/oox/source/drawingml/textspacingcontext.hxx index a98fb38c9cb6..a287764c10fd 100644 --- a/oox/source/drawingml/textspacingcontext.hxx +++ b/oox/source/drawingml/textspacingcontext.hxx @@ -20,31 +20,25 @@ #ifndef OOX_DRAWINGML_TEXTSPACINGCONTEXT_HXX #define OOX_DRAWINGML_TEXTSPACINGCONTEXT_HXX -#include "oox/core/contexthandler.hxx" +#include "oox/core/contexthandler2.hxx" namespace oox { namespace drawingml { class TextSpacing; -class TextSpacingContext : public ::oox::core::ContextHandler +class TextSpacingContext : public ::oox::core::ContextHandler2 { public: - TextSpacingContext( ::oox::core::ContextHandler& rParent, TextSpacing & aSpacing ); + TextSpacingContext( ::oox::core::ContextHandler2Helper& rParent, TextSpacing & aSpacing ); - virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) 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 Element, const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE; private: TextSpacing& maSpacing; }; - } } - - - #endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/texttabstoplistcontext.cxx b/oox/source/drawingml/texttabstoplistcontext.cxx index ae12dd0ba0d1..831ac13fa72e 100644 --- a/oox/source/drawingml/texttabstoplistcontext.cxx +++ b/oox/source/drawingml/texttabstoplistcontext.cxx @@ -32,8 +32,8 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace drawingml { - TextTabStopListContext::TextTabStopListContext( ContextHandler& rParent, std::list< TabStop > & aTabList ) - : ContextHandler( rParent ) + TextTabStopListContext::TextTabStopListContext( ContextHandler2Helper& rParent, std::list< TabStop > & aTabList ) + : ContextHandler2( rParent ) , maTabList( aTabList ) { } @@ -42,29 +42,20 @@ namespace oox { namespace drawingml { { } - void SAL_CALL TextTabStopListContext::endFastElement( ::sal_Int32 /*Element*/ ) - throw ( SAXException, RuntimeException) + ContextHandlerRef TextTabStopListContext::onCreateContext( ::sal_Int32 aElement, const AttributeList& rAttribs ) { - } - - - Reference< ::XFastContextHandler > TextTabStopListContext::createFastChildContext( ::sal_Int32 aElement, - const Reference< XFastAttributeList >& xAttribs ) - throw (SAXException, RuntimeException) - { - Reference< XFastContextHandler > xRet; switch( aElement ) { case A_TOKEN( tab ): { OUString sValue; TabStop aTabStop; - sValue = xAttribs->getOptionalValue( XML_pos ); + sValue = rAttribs.getString( XML_pos ).get(); if( !sValue.isEmpty() ) { aTabStop.Position = GetCoordinate( sValue ); } - sal_Int32 aToken = xAttribs->getOptionalValueToken( XML_algn, 0 ); + sal_Int32 aToken = rAttribs.getToken( XML_algn, 0 ); if( aToken != 0 ) { aTabStop.Alignment = GetTabAlign( aToken ); @@ -75,13 +66,8 @@ namespace oox { namespace drawingml { default: break; } - if ( !xRet.is() ) - xRet.set( this ); - return xRet; + return this; } - - } } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/texttabstoplistcontext.hxx b/oox/source/drawingml/texttabstoplistcontext.hxx index 78f9f748eae1..4e5fabaa5ecf 100644 --- a/oox/source/drawingml/texttabstoplistcontext.hxx +++ b/oox/source/drawingml/texttabstoplistcontext.hxx @@ -24,28 +24,25 @@ #include <com/sun/star/style/TabStop.hpp> -#include "oox/core/contexthandler.hxx" +#include "oox/core/contexthandler2.hxx" namespace oox { namespace drawingml { - class TextTabStopListContext : public ::oox::core::ContextHandler + class TextTabStopListContext : public ::oox::core::ContextHandler2 { public: - TextTabStopListContext( ::oox::core::ContextHandler& rParent, + TextTabStopListContext( ::oox::core::ContextHandler2Helper& rParent, ::std::list< ::com::sun::star::style::TabStop > & aTabList ); ~TextTabStopListContext(); - virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) 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 Element, const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE; protected: ::std::list< ::com::sun::star::style::TabStop > & maTabList; }; - } } - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/drawingml/themeelementscontext.cxx b/oox/source/drawingml/themeelementscontext.cxx index a171545e7df8..a2ff33814ca8 100644 --- a/oox/source/drawingml/themeelementscontext.cxx +++ b/oox/source/drawingml/themeelementscontext.cxx @@ -37,24 +37,23 @@ namespace drawingml { // ============================================================================ -class FillStyleListContext : public ContextHandler +class FillStyleListContext : public ContextHandler2 { public: - FillStyleListContext( ContextHandler& rParent, FillStyleList& rFillStyleList ); - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, const Reference< XFastAttributeList >& Attribs ) throw (SAXException, RuntimeException); + FillStyleListContext( ContextHandler2Helper& rParent, FillStyleList& rFillStyleList ); + virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE; private: FillStyleList& mrFillStyleList; }; -FillStyleListContext::FillStyleListContext( ContextHandler& rParent, FillStyleList& rFillStyleList ) : - ContextHandler( rParent ), +FillStyleListContext::FillStyleListContext( ContextHandler2Helper& rParent, FillStyleList& rFillStyleList ) : + ContextHandler2( rParent ), mrFillStyleList( rFillStyleList ) { } -Reference< XFastContextHandler > FillStyleListContext::createFastChildContext( sal_Int32 nElement, const Reference< XFastAttributeList >& xAttribs ) - throw (SAXException, RuntimeException) +ContextHandlerRef FillStyleListContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) { switch( nElement ) { @@ -65,60 +64,59 @@ Reference< XFastContextHandler > FillStyleListContext::createFastChildContext( s case A_TOKEN( pattFill ): case A_TOKEN( grpFill ): mrFillStyleList.push_back( FillPropertiesPtr( new FillProperties ) ); - return FillPropertiesContext::createFillContext( *this, nElement, xAttribs, *mrFillStyleList.back() ); + return FillPropertiesContext::createFillContext( *this, nElement, rAttribs, *mrFillStyleList.back() ); } return 0; } // ============================================================================ -class LineStyleListContext : public ContextHandler +class LineStyleListContext : public ContextHandler2 { public: - LineStyleListContext( ContextHandler& rParent, LineStyleList& rLineStyleList ); - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, const Reference< XFastAttributeList >& Attribs ) throw (SAXException, RuntimeException); + LineStyleListContext( ContextHandler2Helper& rParent, LineStyleList& rLineStyleList ); + virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE; private: LineStyleList& mrLineStyleList; }; -LineStyleListContext::LineStyleListContext( ContextHandler& rParent, LineStyleList& rLineStyleList ) : - ContextHandler( rParent ), +LineStyleListContext::LineStyleListContext( ContextHandler2Helper& rParent, LineStyleList& rLineStyleList ) : + ContextHandler2( rParent ), mrLineStyleList( rLineStyleList ) { } -Reference< XFastContextHandler > LineStyleListContext::createFastChildContext( sal_Int32 nElement, const Reference< XFastAttributeList >& xAttribs ) - throw (SAXException, RuntimeException) +ContextHandlerRef LineStyleListContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) { switch( nElement ) { case A_TOKEN( ln ): mrLineStyleList.push_back( LinePropertiesPtr( new LineProperties ) ); - return new LinePropertiesContext( *this, xAttribs, *mrLineStyleList.back() ); + return new LinePropertiesContext( *this, rAttribs, *mrLineStyleList.back() ); } return 0; } // ============================================================================ -class EffectStyleListContext : public ContextHandler +class EffectStyleListContext : public ContextHandler2 { public: - EffectStyleListContext( ContextHandler& rParent, EffectStyleList& rEffectStyleList ); - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, const Reference< XFastAttributeList >& Attribs ) throw (SAXException, RuntimeException); + EffectStyleListContext( ContextHandler2Helper& rParent, EffectStyleList& rEffectStyleList ); + virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE; private: EffectStyleList& mrEffectStyleList; }; -EffectStyleListContext::EffectStyleListContext( ContextHandler& rParent, EffectStyleList& rEffectStyleList ) : - ContextHandler( rParent ), +EffectStyleListContext::EffectStyleListContext( ContextHandler2Helper& rParent, EffectStyleList& rEffectStyleList ) : + ContextHandler2( rParent ), mrEffectStyleList( rEffectStyleList ) { } -Reference< XFastContextHandler > EffectStyleListContext::createFastChildContext( sal_Int32 nElement, const Reference< XFastAttributeList >& /*xAttribs*/ ) throw (SAXException, RuntimeException) +ContextHandlerRef EffectStyleListContext::onCreateContext( sal_Int32 nElement, const AttributeList& /*rAttribs*/ ) { switch( nElement ) { @@ -136,28 +134,26 @@ Reference< XFastContextHandler > EffectStyleListContext::createFastChildContext( // ============================================================================ -class FontSchemeContext : public ContextHandler +class FontSchemeContext : public ContextHandler2 { public: - FontSchemeContext( ContextHandler& rParent, FontScheme& rFontScheme ); - virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( sal_Int32 nElement, const Reference< XFastAttributeList >& Attribs ) throw (SAXException, RuntimeException); - virtual void SAL_CALL endFastElement( sal_Int32 nElement ) throw (SAXException, RuntimeException); + FontSchemeContext( ContextHandler2Helper& rParent, FontScheme& rFontScheme ); + virtual ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE; + virtual void onEndElement() SAL_OVERRIDE; private: FontScheme& mrFontScheme; TextCharacterPropertiesPtr mxCharProps; }; -FontSchemeContext::FontSchemeContext( ContextHandler& rParent, FontScheme& rFontScheme ) : - ContextHandler( rParent ), +FontSchemeContext::FontSchemeContext( ContextHandler2Helper& rParent, FontScheme& rFontScheme ) : + ContextHandler2( rParent ), mrFontScheme( rFontScheme ) { } -Reference< XFastContextHandler > FontSchemeContext::createFastChildContext( sal_Int32 nElement, const Reference< XFastAttributeList >& rxAttribs ) - throw (SAXException, RuntimeException) +ContextHandlerRef FontSchemeContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) { - AttributeList aAttribs( rxAttribs ); switch( nElement ) { case A_TOKEN( majorFont ): @@ -171,23 +167,23 @@ Reference< XFastContextHandler > FontSchemeContext::createFastChildContext( sal_ case A_TOKEN( latin ): if( mxCharProps.get() ) - mxCharProps->maLatinFont.setAttributes( aAttribs ); + mxCharProps->maLatinFont.setAttributes( rAttribs ); break; case A_TOKEN( ea ): if( mxCharProps.get() ) - mxCharProps->maAsianFont.setAttributes( aAttribs ); + mxCharProps->maAsianFont.setAttributes( rAttribs ); break; case A_TOKEN( cs ): if( mxCharProps.get() ) - mxCharProps->maComplexFont.setAttributes( aAttribs ); + mxCharProps->maComplexFont.setAttributes( rAttribs ); break; } return 0; } -void FontSchemeContext::endFastElement( sal_Int32 nElement ) throw (SAXException, RuntimeException) +void FontSchemeContext::onEndElement() { - switch( nElement ) + switch( getCurrentElement() ) { case A_TOKEN( majorFont ): case A_TOKEN( minorFont ): @@ -198,16 +194,15 @@ void FontSchemeContext::endFastElement( sal_Int32 nElement ) throw (SAXException // ============================================================================ -ThemeElementsContext::ThemeElementsContext( ContextHandler& rParent, Theme& rTheme ) : - ContextHandler( rParent ), +ThemeElementsContext::ThemeElementsContext( ContextHandler2Helper& rParent, Theme& rTheme ) : + ContextHandler2( rParent ), mrTheme( rTheme ) { } -Reference< XFastContextHandler > ThemeElementsContext::createFastChildContext( sal_Int32 nElement, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +ContextHandlerRef ThemeElementsContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) { // CT_BaseStyles - Reference< XFastContextHandler > xRet; switch( nElement ) { case A_TOKEN( clrScheme ): // CT_ColorScheme @@ -216,7 +211,7 @@ Reference< XFastContextHandler > ThemeElementsContext::createFastChildContext( s return new FontSchemeContext( *this, mrTheme.getFontScheme() ); case A_TOKEN( fmtScheme ): // CT_StyleMatrix - mrTheme.setStyleName( xAttribs->getOptionalValue( XML_name ) ); + mrTheme.setStyleName( rAttribs.getString( XML_name ).get() ); return this; case A_TOKEN( fillStyleLst ): // CT_FillStyleList diff --git a/oox/source/drawingml/transform2dcontext.cxx b/oox/source/drawingml/transform2dcontext.cxx index a28160bf8307..8b9040cf564e 100644 --- a/oox/source/drawingml/transform2dcontext.cxx +++ b/oox/source/drawingml/transform2dcontext.cxx @@ -28,32 +28,29 @@ using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::xml::sax::SAXException; using ::com::sun::star::xml::sax::XFastAttributeList; using ::com::sun::star::xml::sax::XFastContextHandler; -using ::oox::core::ContextHandler; +using ::oox::core::ContextHandlerRef; namespace oox { namespace drawingml { -// ============================================================================ - /** context to import a CT_Transform2D */ -Transform2DContext::Transform2DContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, Shape& rShape, bool btxXfrm ) throw() -: ContextHandler( rParent ) +Transform2DContext::Transform2DContext( ContextHandler2Helper& rParent, const AttributeList& rAttribs, Shape& rShape, bool btxXfrm ) throw() +: ContextHandler2( rParent ) , mrShape( rShape ) , mbtxXfrm ( btxXfrm ) { - AttributeList aAttributeList( xAttribs ); if( !btxXfrm ) { - mrShape.setRotation( aAttributeList.getInteger( XML_rot, 0 ) ); // 60000ths of a degree Positive angles are clockwise; negative angles are counter-clockwise - mrShape.setFlip( aAttributeList.getBool( XML_flipH, sal_False ), aAttributeList.getBool( XML_flipV, sal_False ) ); + mrShape.setRotation( rAttribs.getInteger( XML_rot, 0 ) ); // 60000ths of a degree Positive angles are clockwise; negative angles are counter-clockwise + mrShape.setFlip( rAttribs.getBool( XML_flipH, sal_False ), rAttribs.getBool( XML_flipV, sal_False ) ); } else { - mrShape.getTextBody()->getTextProperties().moRotation = aAttributeList.getInteger( XML_rot ); + mrShape.getTextBody()->getTextProperties().moRotation = rAttribs.getInteger( XML_rot ); } } -Reference< XFastContextHandler > Transform2DContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException) +ContextHandlerRef Transform2DContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { if( mbtxXfrm ) { @@ -61,8 +58,8 @@ Reference< XFastContextHandler > Transform2DContext::createFastChildContext( sal { case A_TOKEN( off ): { - OUString sXValue = xAttribs->getOptionalValue( XML_x ); - OUString sYValue = xAttribs->getOptionalValue( XML_y ); + OUString sXValue = rAttribs.getString( XML_x ).get(); + OUString sYValue = rAttribs.getString( XML_y ).get(); if( !sXValue.isEmpty() ) mrShape.getTextBody()->getTextProperties().moTextOffX = GetCoordinate( sXValue.toInt32() - mrShape.getPosition().X ); if( !sYValue.isEmpty() ) @@ -78,24 +75,22 @@ Reference< XFastContextHandler > Transform2DContext::createFastChildContext( sal switch( aElementToken ) { case A_TOKEN( off ): // horz/vert translation - mrShape.setPosition( awt::Point( xAttribs->getOptionalValue( XML_x ).toInt32(), xAttribs->getOptionalValue( XML_y ).toInt32() ) ); + mrShape.setPosition( awt::Point( rAttribs.getString( XML_x ).get().toInt32(), rAttribs.getString( XML_y ).get().toInt32() ) ); break; case A_TOKEN( ext ): // horz/vert size - mrShape.setSize( awt::Size( xAttribs->getOptionalValue( XML_cx ).toInt32(), xAttribs->getOptionalValue( XML_cy ).toInt32() ) ); + mrShape.setSize( awt::Size( rAttribs.getString( XML_cx ).get().toInt32(), rAttribs.getString( XML_cy ).get().toInt32() ) ); break; case A_TOKEN( chOff ): // horz/vert translation of children - mrShape.setChildPosition( awt::Point( xAttribs->getOptionalValue( XML_x ).toInt32(), xAttribs->getOptionalValue( XML_y ).toInt32() ) ); + mrShape.setChildPosition( awt::Point( rAttribs.getString( XML_x ).get().toInt32(), rAttribs.getString( XML_y ).get().toInt32() ) ); break; case A_TOKEN( chExt ): // horz/vert size of children - mrShape.setChildSize( awt::Size( xAttribs->getOptionalValue( XML_cx ).toInt32(), xAttribs->getOptionalValue( XML_cy ).toInt32() ) ); + mrShape.setChildSize( awt::Size( rAttribs.getString( XML_cx ).get().toInt32(), rAttribs.getString( XML_cy ).get().toInt32() ) ); break; } return 0; } -// ============================================================================ - } // namespace drawingml } // namespace oox diff --git a/oox/source/ppt/backgroundproperties.cxx b/oox/source/ppt/backgroundproperties.cxx index b28512d019b7..fac91bc7e034 100644 --- a/oox/source/ppt/backgroundproperties.cxx +++ b/oox/source/ppt/backgroundproperties.cxx @@ -44,7 +44,7 @@ BackgroundPropertiesContext::BackgroundPropertiesContext( FragmentHandler2& rPar } // FillPropertiesGroupContext - return dynamic_cast <ContextHandler *> (::oox::drawingml::FillPropertiesContext::createFillContext( *this, aElementToken, rAttribs.getFastAttributeList(), mrFillProperties ).get()); + return dynamic_cast <ContextHandler *> (::oox::drawingml::FillPropertiesContext::createFillContext( *this, aElementToken, rAttribs, mrFillProperties ).get()); } } } diff --git a/oox/source/ppt/pptshapecontext.cxx b/oox/source/ppt/pptshapecontext.cxx index c8a4eff4fe05..f5a1e903a1af 100644 --- a/oox/source/ppt/pptshapecontext.cxx +++ b/oox/source/ppt/pptshapecontext.cxx @@ -220,7 +220,7 @@ ContextHandlerRef PPTShapeContext::onCreateContext( sal_Int32 aElementToken, con } case PPT_TOKEN( txXfrm ): { - return new oox::drawingml::Transform2DContext( *this, rAttribs.getFastAttributeList(), *mpShapePtr, true ); + return new oox::drawingml::Transform2DContext( *this, rAttribs, *mpShapePtr, true ); } } diff --git a/oox/source/ppt/pptshapepropertiescontext.cxx b/oox/source/ppt/pptshapepropertiescontext.cxx index f49f905542e4..1ebf9268207c 100644 --- a/oox/source/ppt/pptshapepropertiescontext.cxx +++ b/oox/source/ppt/pptshapepropertiescontext.cxx @@ -44,31 +44,23 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace ppt { // CT_Shape -PPTShapePropertiesContext::PPTShapePropertiesContext( ContextHandler& rParent, ::oox::drawingml::Shape& rShape ) +PPTShapePropertiesContext::PPTShapePropertiesContext( ContextHandler2Helper& rParent, ::oox::drawingml::Shape& rShape ) : ShapePropertiesContext( rParent, rShape ) { } -Reference< XFastContextHandler > PPTShapePropertiesContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) - throw (SAXException, RuntimeException) +ContextHandlerRef PPTShapePropertiesContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) { - Reference< XFastContextHandler > xRet; - switch( aElementToken ) { case A_TOKEN( xfrm ): - { mrShape.getShapeProperties()[ PROP_IsPlaceholderDependent ] <<= sal_False; - - xRet = ShapePropertiesContext::createFastChildContext( aElementToken, xAttribs ); - } - break; + return ShapePropertiesContext::onCreateContext( aElementToken, rAttribs ); default: - xRet = ShapePropertiesContext::createFastChildContext( aElementToken, xAttribs ); - break; + return ShapePropertiesContext::onCreateContext( aElementToken, rAttribs ); } - return xRet; + return 0; } } } diff --git a/oox/source/ppt/slidefragmenthandler.cxx b/oox/source/ppt/slidefragmenthandler.cxx index 6f0cf755bf76..7ae3b0fec627 100644 --- a/oox/source/ppt/slidefragmenthandler.cxx +++ b/oox/source/ppt/slidefragmenthandler.cxx @@ -175,7 +175,7 @@ SlideFragmentHandler::~SlideFragmentHandler() throw() case PPT_TOKEN( clrMap ): // CT_ColorMapping { oox::drawingml::ClrMapPtr pClrMapPtr( ( aElementToken == PPT_TOKEN( clrMap ) || !mpSlidePersistPtr.get() || !mpSlidePersistPtr->getClrMap().get() ) ? new oox::drawingml::ClrMap() : new oox::drawingml::ClrMap( *mpSlidePersistPtr->getClrMap() ) ); - ContextHandlerRef ret = new oox::drawingml::clrMapContext( *this, rAttribs.getFastAttributeList(), *pClrMapPtr ); + ContextHandlerRef ret = new oox::drawingml::clrMapContext( *this, rAttribs, *pClrMapPtr ); mpSlidePersistPtr->setClrMap( pClrMapPtr ); return ret; } |