From e910705421b40f3accff684e956854ff68761574 Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Tue, 9 Sep 2014 23:14:01 +0200 Subject: Use Any.get(..) instead of Any.getValue(..) and ugly cast Change-Id: I1c76ee7c7873e76fb1682475141c14dd658bff4a --- oox/source/export/drawingml.cxx | 48 +++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 19 deletions(-) (limited to 'oox/source') diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index a9377f3d689d..35d837fea4bf 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -542,7 +542,7 @@ void DrawingML::WriteLineArrow( Reference< XPropertySet > rXPropSet, bool bLineS } } -void DrawingML::WriteOutline( Reference< XPropertySet > rXPropSet ) +void DrawingML::WriteOutline( Reference rXPropSet ) { drawing::LineStyle aLineStyle( drawing::LineStyle_NONE ); @@ -558,15 +558,23 @@ void DrawingML::WriteOutline( Reference< XPropertySet > rXPropSet ) // get InteropGrabBag and search the relevant attributes OUString sColorFillScheme; - sal_uInt32 nOriginalColor( 0 ), nStyleColor( 0 ), nStyleLineWidth( 0 ); - Sequence< PropertyValue > aStyleProperties, aTransformations; - drawing::LineStyle aStyleLineStyle( drawing::LineStyle_NONE ); - drawing::LineJoint aStyleLineJoint( drawing::LineJoint_NONE ); - if ( GetProperty( rXPropSet, "InteropGrabBag" ) ) + + sal_uInt32 nOriginalColor = 0; + sal_uInt32 nStyleColor = 0; + sal_uInt32 nStyleLineWidth = 0; + + Sequence aStyleProperties; + Sequence aTransformations; + + drawing::LineStyle aStyleLineStyle(drawing::LineStyle_NONE); + drawing::LineJoint aStyleLineJoint(drawing::LineJoint_NONE); + + if (GetProperty(rXPropSet, "InteropGrabBag")) { - Sequence< PropertyValue > aGrabBag; + Sequence aGrabBag; mAny >>= aGrabBag; - for( sal_Int32 i=0; i < aGrabBag.getLength(); ++i ) + + for (sal_Int32 i=0; i < aGrabBag.getLength(); ++i) { if( aGrabBag[i].Name == "SpPrLnSolidFillSchemeClr" ) aGrabBag[i].Value >>= sColorFillScheme; @@ -577,9 +585,9 @@ void DrawingML::WriteOutline( Reference< XPropertySet > rXPropSet ) else if( aGrabBag[i].Name == "SpPrLnSolidFillSchemeClrTransformations" ) aGrabBag[i].Value >>= aTransformations; } - if( aStyleProperties.hasElements() ) + if (aStyleProperties.hasElements()) { - for( sal_Int32 i=0; i < aStyleProperties.getLength(); ++i ) + for (sal_Int32 i=0; i < aStyleProperties.getLength(); ++i) { if( aStyleProperties[i].Name == "Color" ) aStyleProperties[i].Value >>= nStyleColor; @@ -595,18 +603,20 @@ void DrawingML::WriteOutline( Reference< XPropertySet > rXPropSet ) GET( nLineWidth, LineWidth ); - switch( aLineStyle ) + switch (aLineStyle) { case drawing::LineStyle_NONE: bNoFill = true; break; case drawing::LineStyle_DASH: - if( GETA( LineDash ) ) + if (GetProperty(rXPropSet, "LineDash")) { - aLineDash = *(drawing::LineDash*) mAny.getValue(); + aLineDash = mAny.get(); bDashSet = true; - if( aLineDash.Style == DashStyle_ROUND || aLineDash.Style == DashStyle_ROUNDRELATIVE ) + if (aLineDash.Style == DashStyle_ROUND || aLineDash.Style == DashStyle_ROUNDRELATIVE) + { cap = "rnd"; + } DBG(fprintf(stderr, "dash dots: %d dashes: %d dotlen: %d dashlen: %d distance: %d\n", int( aLineDash.Dots ), int( aLineDash.Dashes ), int( aLineDash.DotLen ), int( aLineDash.DashLen ), int( aLineDash.Distance ))); @@ -616,16 +626,17 @@ void DrawingML::WriteOutline( Reference< XPropertySet > rXPropSet ) default: if ( GETA( LineColor ) ) { - nColor = *((sal_uInt32*) mAny.getValue()) & 0xffffff; + nColor = mAny.get() & 0xffffff; bColorSet = true; } break; } + OString sWidth = (nLineWidth > 1 && nStyleLineWidth != nLineWidth) ? I64S(MM100toEMU(nLineWidth)) : NULL; + mpFS->startElementNS( XML_a, XML_ln, XML_cap, cap, - XML_w, nLineWidth > 1 && nStyleLineWidth != nLineWidth ? - I64S( MM100toEMU( nLineWidth ) ) :NULL, + XML_w, sWidth, FSEND ); if( bColorSet ) @@ -715,9 +726,8 @@ void DrawingML::WriteOutline( Reference< XPropertySet > rXPropSet ) if( !bNoFill && nLineWidth > 1 && GETA( LineJoint ) ) { - LineJoint eLineJoint; + LineJoint eLineJoint = mAny.get(); - mAny >>= eLineJoint; if( aStyleLineJoint == LineJoint_NONE || aStyleLineJoint != eLineJoint ) { // style-defined line joint does not exist, or is different from the shape's joint -- cgit