From a8e6f0bea0e8bc028ee64d0b4d9046e52de94eda Mon Sep 17 00:00:00 2001 From: Radu Ioan Date: Sat, 14 Feb 2015 00:31:54 +0200 Subject: tdf#39440 - cppcheck cleanliness Fixed some cppcheck defects Change-Id: I25fd6aba9d76df98d20b9a1bb4c9d3c1bf6f84bb Reviewed-on: https://gerrit.libreoffice.org/14487 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- .../controller/chartapiwrapper/WrappedScaleProperty.cxx | 2 +- chart2/source/controller/dialogs/DataBrowser.cxx | 11 +++++++---- chart2/source/controller/main/ChartController_Window.cxx | 4 +--- chart2/source/tools/ThreeDHelper.cxx | 3 --- 4 files changed, 9 insertions(+), 11 deletions(-) (limited to 'chart2') diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx index 9a1966dc280d..8c86559b31b6 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx @@ -190,7 +190,7 @@ void WrappedScaleProperty::setPropertyValue( tScaleProperty eScaleProperty, cons (aScaleData.IncrementData.Distance >>= fStepMain) ) { // approximate interval count - sal_Int32 nIntervalCount = static_cast< sal_Int32 >(fStepMain / fStepHelp); + sal_Int32 nIntervalCount = static_cast< sal_Int32 >(fStepMain / fStepHelp);//cppcheck-suppress zerodiv rSubIncrements[ 0 ].IntervalCount <<= nIntervalCount; } } diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx index 5276546afff1..75b55d440344 100644 --- a/chart2/source/controller/dialogs/DataBrowser.cxx +++ b/chart2/source/controller/dialogs/DataBrowser.cxx @@ -641,8 +641,7 @@ OUString DataBrowser::GetCellText( long nRow, sal_uInt16 nColumnId ) const { aResult = GetRowString( static_cast< sal_Int32 >( nRow )); } - else if( nRow >= 0 && - m_apDataBrowserModel.get()) + else if( nRow >= 0 && m_apDataBrowserModel.get()) { sal_Int32 nColIndex = static_cast< sal_Int32 >( nColumnId ) - 1; @@ -650,13 +649,15 @@ OUString DataBrowser::GetCellText( long nRow, sal_uInt16 nColumnId ) const { double fData( m_apDataBrowserModel->getCellNumber( nColIndex, nRow )); sal_Int32 nLabelColor; - bool bColorChanged = false; if( ! ::rtl::math::isNan( fData ) && m_spNumberFormatterWrapper.get() ) + { + bool bColorChanged = false; aResult = m_spNumberFormatterWrapper->getFormattedString( GetNumberFormatKey( nRow, nColumnId ), fData, nLabelColor, bColorChanged ); + } } else if( m_apDataBrowserModel->getCellType( nColIndex, nRow ) == DataBrowserModel::TEXTORDATE ) { @@ -668,11 +669,13 @@ OUString DataBrowser::GetCellText( long nRow, sal_uInt16 nColumnId ) const else if( aAny>>=fDouble ) { sal_Int32 nLabelColor; - bool bColorChanged = false; sal_Int32 nDateNumberFormat = DiagramHelper::getDateNumberFormat( Reference< util::XNumberFormatsSupplier >( m_xChartDoc, uno::UNO_QUERY) ); if( ! ::rtl::math::isNan( fDouble ) && m_spNumberFormatterWrapper.get() ) + { + bool bColorChanged = false; aResult = m_spNumberFormatterWrapper->getFormattedString( nDateNumberFormat, fDouble, nLabelColor, bColorChanged ); + } } } else diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index a8de0328fe0a..b7a677b545ea 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -1722,7 +1722,6 @@ bool ChartController::impl_moveOrResizeObject( double fAmountLogicY ) { bool bResult = false; - bool bNeedShift = true; bool bNeedResize = ( eType == CENTERED_RESIZE_OBJECT ); uno::Reference< frame::XModel > xChartModel( getModel() ); @@ -1788,8 +1787,7 @@ bool ChartController::impl_moveOrResizeObject( eActionType, ObjectNameProvider::getName( eObjectType )), m_xUndoManager ); { ControllerLockGuardUNO aCLGuard( xChartModel ); - if( bNeedShift ) - xObjProp->setPropertyValue( "RelativePosition", uno::makeAny( aRelPos )); + xObjProp->setPropertyValue( "RelativePosition", uno::makeAny( aRelPos )); if( bNeedResize || (eObjectType == OBJECTTYPE_DIAGRAM) )//Also set an explicat size at the diagram when an explicit position is set xObjProp->setPropertyValue( "RelativeSize", uno::makeAny( aRelSize )); } diff --git a/chart2/source/tools/ThreeDHelper.cxx b/chart2/source/tools/ThreeDHelper.cxx index 1ae926115f24..407efb1002e3 100644 --- a/chart2/source/tools/ThreeDHelper.cxx +++ b/chart2/source/tools/ThreeDHelper.cxx @@ -1453,7 +1453,6 @@ CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardLeft if( lcl_isRightAngledAxesSetAndSupported( xSceneProperties ) ) { ThreeDHelper::adaptRadAnglesForRightAngledAxes( fXAngleRad, fYAngleRad ); - fZAngleRad=0.0; } if( sin(fYAngleRad)>0.0 ) eRet = CuboidPlanePosition_Right; @@ -1469,7 +1468,6 @@ CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBack if( lcl_isRightAngledAxesSetAndSupported( xSceneProperties ) ) { ThreeDHelper::adaptRadAnglesForRightAngledAxes( fXAngleRad, fYAngleRad ); - fZAngleRad=0.0; } if( cos(fXAngleRad)*cos(fYAngleRad)<0.0 ) eRet = CuboidPlanePosition_Front; @@ -1485,7 +1483,6 @@ CuboidPlanePosition ThreeDHelper::getAutomaticCuboidPlanePositionForStandardBott if( lcl_isRightAngledAxesSetAndSupported( xSceneProperties ) ) { ThreeDHelper::adaptRadAnglesForRightAngledAxes( fXAngleRad, fYAngleRad ); - fZAngleRad=0.0; } if( sin(fXAngleRad)*cos(fYAngleRad)<0.0 ) eRet = CuboidPlanePosition_Top; -- cgit