From bd1014e245676335c7830f7bcc56afd5adf90fa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Sun, 2 Mar 2014 21:04:53 +0000 Subject: [PATCH] coverity#705000 Unchecked dynamic_cast MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Iae20a0ab45779483fc501e5ab982e38f38ba21b7 Reviewed-on: https://gerrit.libreoffice.org/8425 Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- sw/source/filter/ww8/ww8par.cxx | 42 +++++++++++++++++---------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index dc20084dd647..053134e03a5e 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -952,27 +952,29 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, if ( ( ( rObjData.nSpFlags & SP_FFLIPV ) || mnFix16Angle || nTextRotationAngle ) && dynamic_cast< SdrObjCustomShape* >( pObj ) ) { SdrObjCustomShape* pCustomShape = dynamic_cast< SdrObjCustomShape* >( pObj ); - - double fExtraTextRotation = 0.0; - if ( mnFix16Angle && !( GetPropertyValue( DFF_Prop_FitTextToShape ) & 4 ) ) - { // text is already rotated, we have to take back the object rotation if DFF_Prop_RotateText is false - fExtraTextRotation = -mnFix16Angle; - } - if ( rObjData.nSpFlags & SP_FFLIPV ) // sj: in ppt the text is flipped, whereas in word the text - { // remains unchanged, so we have to take back the flipping here - fExtraTextRotation += 18000.0; // because our core will flip text if the shape is flipped. - } - fExtraTextRotation += nTextRotationAngle; - if ( !::basegfx::fTools::equalZero( fExtraTextRotation ) ) + if (pCustomShape) { - fExtraTextRotation /= 100.0; - SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pCustomShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); - const OUString sTextRotateAngle( "TextRotateAngle" ); - com::sun::star::beans::PropertyValue aPropVal; - aPropVal.Name = sTextRotateAngle; - aPropVal.Value <<= fExtraTextRotation; - aGeometryItem.SetPropertyValue( aPropVal ); - pCustomShape->SetMergedItem( aGeometryItem ); + double fExtraTextRotation = 0.0; + if ( mnFix16Angle && !( GetPropertyValue( DFF_Prop_FitTextToShape ) & 4 ) ) + { // text is already rotated, we have to take back the object rotation if DFF_Prop_RotateText is false + fExtraTextRotation = -mnFix16Angle; + } + if ( rObjData.nSpFlags & SP_FFLIPV ) // sj: in ppt the text is flipped, whereas in word the text + { // remains unchanged, so we have to take back the flipping here + fExtraTextRotation += 18000.0; // because our core will flip text if the shape is flipped. + } + fExtraTextRotation += nTextRotationAngle; + if ( !::basegfx::fTools::equalZero( fExtraTextRotation ) ) + { + fExtraTextRotation /= 100.0; + SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)pCustomShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); + const OUString sTextRotateAngle( "TextRotateAngle" ); + com::sun::star::beans::PropertyValue aPropVal; + aPropVal.Name = sTextRotateAngle; + aPropVal.Value <<= fExtraTextRotation; + aGeometryItem.SetPropertyValue( aPropVal ); + pCustomShape->SetMergedItem( aGeometryItem ); + } } } else if ( mnFix16Angle )