diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-01-12 20:28:26 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-01-12 20:28:26 +0100 |
commit | 898a8b00622d219741ec7649dbac560bc1f70f6b (patch) | |
tree | 56701de314ff3150fe3287ba4d02465a02dda2b6 /chart2 | |
parent | 56bd8bb862bf6bcb2242bc864be9abf56f0c092f (diff) |
More loplugin:cstylecast: chart2
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable
loplugin:cstylecast for some more cases" plus
solenv/clang-format/reformat-formatted-files
Change-Id: I745557506326b2b0ce66d0058ebf85e5ed2a0952
Diffstat (limited to 'chart2')
23 files changed, 76 insertions, 76 deletions
diff --git a/chart2/qa/extras/chart2_trendcalculators.cxx b/chart2/qa/extras/chart2_trendcalculators.cxx index a45091057e80..42e1f52e467e 100644 --- a/chart2/qa/extras/chart2_trendcalculators.cxx +++ b/chart2/qa/extras/chart2_trendcalculators.cxx @@ -87,7 +87,7 @@ void Chart2TrendCalculators::loadCalculatorFromSheet(sal_Int32 nSheet) CPPUNIT_ASSERT( xRegressionCurveContainer.is() ); Sequence< Reference< chart2::XRegressionCurve > > xRegressionCurveSequence = xRegressionCurveContainer->getRegressionCurves(); - CPPUNIT_ASSERT_EQUAL((sal_Int32) 1, xRegressionCurveSequence.getLength()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xRegressionCurveSequence.getLength()); m_xCurve = xRegressionCurveSequence[0]; CPPUNIT_ASSERT(m_xCurve.is()); @@ -116,7 +116,7 @@ void Chart2TrendCalculators::testPotentialRegression1() Sequence< double > yValues( 7 ); for (int i=0; i<7; i++) { - const double d = (double) i; + const double d = static_cast<double>(i); xValues[i] = d; yValues[i] = 2.0 * pow ( d, 3 ); } @@ -132,7 +132,7 @@ void Chart2TrendCalculators::testPotentialRegression2() Sequence< double > yValues( 7 ); for (int i=0; i<7; i++) { - const double d = (double) i; + const double d = static_cast<double>(i); xValues[i] = d; yValues[i] = -2.0 * pow ( d, 3 ); } @@ -148,7 +148,7 @@ void Chart2TrendCalculators::testLinearRegression1() Sequence< double > yValues( 7 ); for (int i=0; i<7; i++) { - const double d = (double) i; + const double d = static_cast<double>(i); xValues[i] = d; yValues[i] = - 2.0 * d - 5.0 ; } @@ -164,7 +164,7 @@ void Chart2TrendCalculators::testPolynomialRegression1() Sequence< double > yValues( 7 ); for (int i=0; i<7; i++) { - const double d = (double) i; + const double d = static_cast<double>(i); xValues[i] = d; yValues[i] = - 2.0 * d * d + 4 * d - 5; } @@ -180,7 +180,7 @@ void Chart2TrendCalculators::testExponentialRegression1() Sequence< double > yValues( 7 ); for (int i=0; i<7; i++) { - const double d = (double) i; + const double d = static_cast<double>(i); xValues[i] = d; yValues[i] = 2.0 * exp ( 0.3 * d ); } @@ -195,7 +195,7 @@ void Chart2TrendCalculators::testExponentialRegression2() Sequence< double > yValues( 7 ); for (int i=0; i<7; i++) { - const double d = (double) i; + const double d = static_cast<double>(i); xValues[i] = d; yValues[i] = -2.0 * exp ( 0.3 * d ); } diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index 6764935a91cc..deedbc0bee7f 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -392,7 +392,7 @@ void checkTrendlinesInChart(uno::Reference< chart2::XChartDocument > const & xCh CPPUNIT_ASSERT( xRegressionCurveContainer.is() ); Sequence< Reference< chart2::XRegressionCurve > > xRegressionCurveSequence = xRegressionCurveContainer->getRegressionCurves(); - CPPUNIT_ASSERT_EQUAL((sal_Int32) 3, xRegressionCurveSequence.getLength()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xRegressionCurveSequence.getLength()); Reference<chart2::XRegressionCurve> xCurve; diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index a49e80e1b867..b7e1bb79faec 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -1045,7 +1045,7 @@ void Chart2ImportTest::testTrendlineDefaultValue2007XLSX() CPPUNIT_ASSERT(xDataSeries.is()); Reference<chart2::XRegressionCurveContainer> xRegressionCurveContainer(xDataSeries, UNO_QUERY_THROW); Sequence< Reference<chart2::XRegressionCurve> > xRegressionCurveSequence = xRegressionCurveContainer->getRegressionCurves(); - CPPUNIT_ASSERT_EQUAL((sal_Int32) 1, xRegressionCurveSequence.getLength()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xRegressionCurveSequence.getLength()); Reference<chart2::XRegressionCurve> xCurve = xRegressionCurveSequence[0]; @@ -1071,7 +1071,7 @@ void Chart2ImportTest::testTrendlineDefaultValue2013XLSX() CPPUNIT_ASSERT(xDataSeries.is()); Reference<chart2::XRegressionCurveContainer> xRegressionCurveContainer(xDataSeries, UNO_QUERY_THROW); Sequence< Reference<chart2::XRegressionCurve> > xRegressionCurveSequence = xRegressionCurveContainer->getRegressionCurves(); - CPPUNIT_ASSERT_EQUAL((sal_Int32) 1, xRegressionCurveSequence.getLength()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xRegressionCurveSequence.getLength()); Reference<chart2::XRegressionCurve> xCurve = xRegressionCurveSequence[0]; diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx index b2b5bfae4a4b..11c3d3ec0869 100644 --- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx +++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx @@ -591,7 +591,7 @@ void SchAttribTabDlg::PageCreated(sal_uInt16 nId, SfxTabPage &rPage) break; case RID_SVXPAGE_NUMBERFORMAT: - aSet.Put (SvxNumberInfoItem( m_pNumberFormatter, (sal_uInt16)SID_ATTR_NUMBERFORMAT_INFO)); + aSet.Put (SvxNumberInfoItem( m_pNumberFormatter, static_cast<sal_uInt16>(SID_ATTR_NUMBERFORMAT_INFO))); rPage.PageCreated(aSet); break; case TP_XERRORBAR: diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx index 25ea30bc51b4..a81c46a51d5f 100644 --- a/chart2/source/controller/dialogs/res_DataLabel.cxx +++ b/chart2/source/controller/dialogs/res_DataLabel.cxx @@ -192,7 +192,7 @@ IMPL_LINK( DataLabelResources, NumberFormatDialogHdl, Button *, pButton, void ) m_pCBPercent->Check(); SfxItemSet aNumberSet = NumberFormatDialog::CreateEmptyItemSetForNumberFormatDialog( *m_pPool ); - aNumberSet.Put (SvxNumberInfoItem( m_pNumberFormatter, (sal_uInt16)SID_ATTR_NUMBERFORMAT_INFO)); + aNumberSet.Put (SvxNumberInfoItem( m_pNumberFormatter, static_cast<sal_uInt16>(SID_ATTR_NUMBERFORMAT_INFO))); bool bPercent = ( pButton == m_pPB_NumberFormatForPercent ); diff --git a/chart2/source/controller/dialogs/res_ErrorBar.cxx b/chart2/source/controller/dialogs/res_ErrorBar.cxx index 9b4642751ad7..cc13839aa760 100644 --- a/chart2/source/controller/dialogs/res_ErrorBar.cxx +++ b/chart2/source/controller/dialogs/res_ErrorBar.cxx @@ -220,7 +220,7 @@ void ErrorBarResources::SetAxisMinorStepWidthForErrorBarDecimals( double fMinorS else { m_nConstDecimalDigits = 0; - m_nConstSpinSize = static_cast< sal_Int64 >( pow( 10.0, (int)nExponent )); + m_nConstSpinSize = static_cast< sal_Int64 >( pow( 10.0, static_cast<int>(nExponent) )); } } diff --git a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx index ae2bc432f8bb..87d2b73c1564 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneGeometry.cxx @@ -218,7 +218,7 @@ void ThreeD_SceneGeometry_TabPage::applyPerspectiveToModel() try { m_xSceneProperties->setPropertyValue( "D3DScenePerspective" , uno::Any( aMode )); - m_xSceneProperties->setPropertyValue( "Perspective" , uno::Any( (sal_Int32)m_pMFPerspective->GetValue() )); + m_xSceneProperties->setPropertyValue( "Perspective" , uno::Any( static_cast<sal_Int32>(m_pMFPerspective->GetValue()) )); } catch( const uno::Exception & ex ) { diff --git a/chart2/source/controller/dialogs/tp_AxisPositions.cxx b/chart2/source/controller/dialogs/tp_AxisPositions.cxx index 50d1af5193fa..9225d9831967 100644 --- a/chart2/source/controller/dialogs/tp_AxisPositions.cxx +++ b/chart2/source/controller/dialogs/tp_AxisPositions.cxx @@ -293,7 +293,7 @@ void AxisPositionsTabPage::SetNumFormatter( SvNumberFormatter* pFormatter ) const SfxPoolItem *pPoolItem = nullptr; if( GetItemSet().GetItemState( SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT, true, &pPoolItem ) == SfxItemState::SET ) { - sal_uLong nFmt = (sal_uLong)static_cast<const SfxInt32Item*>(pPoolItem)->GetValue(); + sal_uLong nFmt = static_cast<sal_uLong>(static_cast<const SfxInt32Item*>(pPoolItem)->GetValue()); m_pED_CrossesAt->SetFormatKey( nFmt ); } } diff --git a/chart2/source/controller/dialogs/tp_PolarOptions.cxx b/chart2/source/controller/dialogs/tp_PolarOptions.cxx index 39b8b3d9a9a0..263b881396cf 100644 --- a/chart2/source/controller/dialogs/tp_PolarOptions.cxx +++ b/chart2/source/controller/dialogs/tp_PolarOptions.cxx @@ -90,7 +90,7 @@ void PolarOptionsTabPage::Reset(const SfxItemSet* rInAttrs) if (rInAttrs->GetItemState(SCHATTR_STARTING_ANGLE, true, &pPoolItem) == SfxItemState::SET) { - long nTmp = (long)static_cast<const SfxInt32Item*>(pPoolItem)->GetValue(); + long nTmp = static_cast<long>(static_cast<const SfxInt32Item*>(pPoolItem)->GetValue()); m_pAngleDial->SetRotation( nTmp*100 ); } else diff --git a/chart2/source/controller/dialogs/tp_Scale.cxx b/chart2/source/controller/dialogs/tp_Scale.cxx index c4e04638abda..024341aa2bc1 100644 --- a/chart2/source/controller/dialogs/tp_Scale.cxx +++ b/chart2/source/controller/dialogs/tp_Scale.cxx @@ -316,7 +316,7 @@ void ScaleTabPage::Reset(const SfxItemSet* rInAttrs) m_bAllowDateAxis = static_cast<const SfxBoolItem*>(pPoolItem)->GetValue(); m_nAxisType=chart2::AxisType::REALNUMBER; if (rInAttrs->GetItemState(SCHATTR_AXISTYPE, true, &pPoolItem) == SfxItemState::SET) - m_nAxisType = (int) static_cast<const SfxInt32Item*>(pPoolItem)->GetValue(); + m_nAxisType = static_cast<int>(static_cast<const SfxInt32Item*>(pPoolItem)->GetValue()); if( m_nAxisType==chart2::AxisType::DATE && !m_bAllowDateAxis ) m_nAxisType=chart2::AxisType::CATEGORY; if( m_bAllowDateAxis ) @@ -556,7 +556,7 @@ void ScaleTabPage::SetNumFormat() if( GetItemSet().GetItemState( SID_ATTR_NUMBERFORMAT_VALUE, true, &pPoolItem ) == SfxItemState::SET ) { - sal_uLong nFmt = (sal_uLong)static_cast<const SfxInt32Item*>(pPoolItem)->GetValue(); + sal_uLong nFmt = static_cast<sal_uLong>(static_cast<const SfxInt32Item*>(pPoolItem)->GetValue()); m_pFmtFldMax->SetFormatKey( nFmt ); m_pFmtFldMin->SetFormatKey( nFmt ); diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx index fa2590da00d1..7fd67a016869 100644 --- a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx +++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx @@ -156,13 +156,13 @@ void SchOptionTabPage::Reset(const SfxItemSet* rInAttrs) long nTmp; if (rInAttrs->GetItemState(SCHATTR_BAR_GAPWIDTH, true, &pPoolItem) == SfxItemState::SET) { - nTmp = (long)static_cast<const SfxInt32Item*>(pPoolItem)->GetValue(); + nTmp = static_cast<long>(static_cast<const SfxInt32Item*>(pPoolItem)->GetValue()); m_pMTGap->SetValue(nTmp); } if (rInAttrs->GetItemState(SCHATTR_BAR_OVERLAP, true, &pPoolItem) == SfxItemState::SET) { - nTmp = (long)static_cast<const SfxInt32Item*>(pPoolItem)->GetValue(); + nTmp = static_cast<long>(static_cast<const SfxInt32Item*>(pPoolItem)->GetValue()); m_pMTOverlap->SetValue(nTmp); } diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index ec9e4323ffe2..151b916b37be 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -664,7 +664,7 @@ void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt ) && !rMEvt.IsRight() ) { //start drag - sal_uInt16 nDrgLog = (sal_uInt16)pChartWindow->PixelToLogic(Size(DRGPIX,0)).Width(); + sal_uInt16 nDrgLog = static_cast<sal_uInt16>(pChartWindow->PixelToLogic(Size(DRGPIX,0)).Width()); SdrDragMethod* pDragMethod = nullptr; //change selection to 3D scene if rotate mode diff --git a/chart2/source/controller/main/DragMethod_PieSegment.cxx b/chart2/source/controller/main/DragMethod_PieSegment.cxx index 85cf8cdd6fd1..735afbc82778 100644 --- a/chart2/source/controller/main/DragMethod_PieSegment.cxx +++ b/chart2/source/controller/main/DragMethod_PieSegment.cxx @@ -94,7 +94,7 @@ void DragMethod_PieSegment::MoveSdrDrag(const Point& rPnt) m_fAdditionalOffset = 1.0 - m_fInitialOffset; B2DVector aNewPosVector = m_aStartVector + (m_aDragDirection * m_fAdditionalOffset); - Point aNewPos = Point( (long)(aNewPosVector.getX()), (long)(aNewPosVector.getY()) ); + Point aNewPos = Point( static_cast<long>(aNewPosVector.getX()), static_cast<long>(aNewPosVector.getY()) ); if( aNewPos != DragStat().GetNow() ) { Hide(); diff --git a/chart2/source/controller/main/DragMethod_RotateDiagram.cxx b/chart2/source/controller/main/DragMethod_RotateDiagram.cxx index b099ca239dbb..74bb7f7dd3a7 100644 --- a/chart2/source/controller/main/DragMethod_RotateDiagram.cxx +++ b/chart2/source/controller/main/DragMethod_RotateDiagram.cxx @@ -113,10 +113,10 @@ void DragMethod_RotateDiagram::MoveSdrDrag(const Point& rPnt) Hide(); //calculate new angle - double fX = F_PI / 2.0 * (double)(rPnt.Y() - m_aStartPos.Y()) - / (m_aReferenceRect.GetHeight() > 0 ? (double)m_aReferenceRect.GetHeight() : 1.0); - double fY = F_PI * (double)(rPnt.X() - m_aStartPos.X()) - / (m_aReferenceRect.GetWidth() > 0 ? (double)m_aReferenceRect.GetWidth() : 1.0); + double fX = F_PI / 2.0 * static_cast<double>(rPnt.Y() - m_aStartPos.Y()) + / (m_aReferenceRect.GetHeight() > 0 ? static_cast<double>(m_aReferenceRect.GetHeight()) : 1.0); + double fY = F_PI * static_cast<double>(rPnt.X() - m_aStartPos.X()) + / (m_aReferenceRect.GetWidth() > 0 ? static_cast<double>(m_aReferenceRect.GetWidth()) : 1.0); if( m_eRotationDirection != ROTATIONDIRECTION_Y ) m_fAdditionalYAngleRad = fY; diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx index 0244657476a5..f93d03015cd3 100644 --- a/chart2/source/tools/ObjectIdentifier.cxx +++ b/chart2/source/tools/ObjectIdentifier.cxx @@ -491,7 +491,7 @@ OUString ObjectIdentifier::createClassifiedIdentifierForParticles( OUStringBuffer aRet( m_aProtocol ); aRet.append( lcl_createClassificationStringForType( eObjectType, rDragMethodServiceName, rDragParameterString )); - if(aRet.getLength() > (sal_Int32)strlen(m_aProtocol)) + if(aRet.getLength() > static_cast<sal_Int32>(strlen(m_aProtocol))) aRet.append("/"); if(!rParentParticle.isEmpty()) @@ -683,7 +683,7 @@ OUString ObjectIdentifier::createClassifiedIdentifierWithParent( OUStringBuffer aRet( m_aProtocol ); aRet.append( lcl_createClassificationStringForType( eObjectType, rDragMethodServiceName, rDragParameterString )); - if(aRet.getLength() > (sal_Int32)strlen(m_aProtocol)) + if(aRet.getLength() > static_cast<sal_Int32>(strlen(m_aProtocol))) aRet.append("/"); aRet.append(rParentPartical); if(!rParentPartical.isEmpty()) diff --git a/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx b/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx index 953efc8a3351..ab67bbd09e36 100644 --- a/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx +++ b/chart2/source/tools/PolynomialRegressionCurveCalculator.cxx @@ -79,7 +79,7 @@ void SAL_CALL PolynomialRegressionCurveCalculator::recalculateRegression( for(sal_Int32 i = 0; i < aNoValues; i++) { double xValue = aValues.first[i]; - aQRTransposed[i + aColumnIndex] = std::pow(xValue, (int) aPower); + aQRTransposed[i + aColumnIndex] = std::pow(xValue, static_cast<int>(aPower)); } } @@ -206,7 +206,7 @@ double SAL_CALL PolynomialRegressionCurveCalculator::getCurveValue( double x ) return fResult; } - sal_Int32 aNoCoefficients = (sal_Int32) mCoefficients.size(); + sal_Int32 aNoCoefficients = static_cast<sal_Int32>(mCoefficients.size()); // Horner's method fResult = 0.0; diff --git a/chart2/source/tools/XMLRangeHelper.cxx b/chart2/source/tools/XMLRangeHelper.cxx index 72f9df8c6280..39e19e49a4b8 100644 --- a/chart2/source/tools/XMLRangeHelper.cxx +++ b/chart2/source/tools/XMLRangeHelper.cxx @@ -83,23 +83,23 @@ void lcl_getXMLStringForCell( const ::chart::XMLRangeHelper::Cell & rCell, OUStr // get A, B, C, ..., AA, AB, ... representation of column number if( nCol < 26 ) - output->append( (sal_Unicode)('A' + nCol) ); + output->append( static_cast<sal_Unicode>('A' + nCol) ); else if( nCol < 702 ) { - output->append( (sal_Unicode)('A' + nCol / 26 - 1 )); - output->append( (sal_Unicode)('A' + nCol % 26) ); + output->append( static_cast<sal_Unicode>('A' + nCol / 26 - 1 )); + output->append( static_cast<sal_Unicode>('A' + nCol % 26) ); } else // works for nCol <= 18,278 { - output->append( (sal_Unicode)('A' + nCol / 702 - 1 )); - output->append( (sal_Unicode)('A' + (nCol % 702) / 26 )); - output->append( (sal_Unicode)('A' + nCol % 26) ); + output->append( static_cast<sal_Unicode>('A' + nCol / 702 - 1 )); + output->append( static_cast<sal_Unicode>('A' + (nCol % 702) / 26 )); + output->append( static_cast<sal_Unicode>('A' + nCol % 26) ); } // write row number as number if( ! rCell.bRelativeRow ) output->append( '$' ); - output->append( rCell.nRow + (sal_Int32)1 ); + output->append( rCell.nRow + sal_Int32(1) ); } void lcl_getSingleCellAddressFromXMLString( diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx index e3e8db81d140..35cc5f572a69 100644 --- a/chart2/source/view/charttypes/GL3DBarChart.cxx +++ b/chart2/source/view/charttypes/GL3DBarChart.cxx @@ -181,7 +181,7 @@ private: void RenderAnimationThread::execute() { osl::MutexGuard aGuard(mpChart->maMutex); - glm::vec3 aStep = (maEndPos - maStartPos)/(float)mnSteps; + glm::vec3 aStep = (maEndPos - maStartPos)/static_cast<float>(mnSteps); for(sal_Int32 i = 0; i < mnSteps; ++i) { mpChart->maCameraPosition += aStep; @@ -298,8 +298,8 @@ void RenderBenchMarkThread::MoveToDefault() mpChart->mpRenderer->EndClick(); mnStep = 0; mnStepsTotal = STEPS; - maStep = (mpChart->maDefaultCameraPosition - mpChart->maCameraPosition)/((float)mnStepsTotal); - maStepDirection = (mpChart->maDefaultCameraDirection - mpChart->maCameraDirection)/((float)mnStepsTotal); + maStep = (mpChart->maDefaultCameraPosition - mpChart->maCameraPosition)/static_cast<float>(mnStepsTotal); + maStepDirection = (mpChart->maDefaultCameraDirection - mpChart->maCameraDirection)/static_cast<float>(mnStepsTotal); mbExecuting = true; } MoveCamera(); @@ -330,7 +330,7 @@ void RenderBenchMarkThread::MoveToBar() maTargetDirection.x += BAR_SIZE_X / 2.0f; maTargetDirection.y += BAR_SIZE_Y / 2.0f; maTargetPosition.y = maTargetDirection.y - 240; - maMatrixStep = mpChart->mpRenderer->GetDiffOfTwoCameras(mpChart->maCameraPosition, maTargetPosition, mpChart->maCameraDirection, maTargetDirection)/((float)mnStepsTotal); + maMatrixStep = mpChart->mpRenderer->GetDiffOfTwoCameras(mpChart->maCameraPosition, maTargetPosition, mpChart->maCameraDirection, maTargetDirection)/static_cast<float>(mnStepsTotal); mpChart->maClickCond.set(); mbExecuting = true; mbNeedFlyBack = false; @@ -361,7 +361,7 @@ void RenderBenchMarkThread::MoveToSelectedBar() maTargetDirection.x += BAR_SIZE_X / 2.0f; maTargetDirection.y += BAR_SIZE_Y / 2.0f; maTargetPosition.y = maTargetDirection.y - 240; - maMatrixStep = mpChart->mpRenderer->GetDiffOfTwoCameras( maTargetPosition, maTargetDirection)/((float)mnStepsTotal); + maMatrixStep = mpChart->mpRenderer->GetDiffOfTwoCameras( maTargetPosition, maTargetDirection)/static_cast<float>(mnStepsTotal); mpChart->maClickCond.set(); mbExecuting = true; mbNeedFlyBack = false; @@ -390,7 +390,7 @@ void RenderBenchMarkThread::AutoMoveToBar() maTargetDirection.x += BAR_SIZE_X / 2.0f; maTargetDirection.y += BAR_SIZE_Y / 2.0f; maTargetPosition.y = maTargetDirection.y - 240; - maMatrixStep = mpChart->mpRenderer->GetDiffOfTwoCameras(mpChart->maCameraPosition, maTargetPosition, mpChart->maCameraDirection, maTargetDirection)/((float)mnStepsTotal); + maMatrixStep = mpChart->mpRenderer->GetDiffOfTwoCameras(mpChart->maCameraPosition, maTargetPosition, mpChart->maCameraDirection, maTargetDirection)/static_cast<float>(mnStepsTotal); mpChart->mpRenderer->StartClick(mpChart->mnSelectBarId); mbAutoFlyExecuting = true; mbNeedFlyBack = false; @@ -850,7 +850,7 @@ void GL3DBarChart::create3DShapes(const std::vector<std::unique_ptr<VDataSeries> //if scroll the bars, set the speed and distance first if (mbScrollFlg) { - mpRenderer->SetScrollSpeed((BAR_SIZE_X + BAR_DISTANCE_X) / (float)miScrollRate); + mpRenderer->SetScrollSpeed((BAR_SIZE_X + BAR_DISTANCE_X) / static_cast<float>(miScrollRate)); mpRenderer->SetScrollDistance(BAR_SIZE_X + BAR_DISTANCE_X); } spawnRenderThread(new RenderBenchMarkThread(this)); @@ -1115,7 +1115,7 @@ void GL3DBarChart::scroll(long nDelta) (maRenderEvent != EVENT_AUTO_FLY) && (maRenderEvent != EVENT_SHOW_SELECT)) return; glm::vec3 aDir = glm::normalize(maCameraPosition - maCameraDirection); - maCameraPosition -= ((float)nDelta/10) * aDir; + maCameraPosition -= (static_cast<float>(nDelta)/10) * aDir; mpCamera->setPosition(maCameraPosition); if(mbBenchMarkMode) { @@ -1143,7 +1143,7 @@ float GL3DBarChart::addScreenTextShape(OUString &nStr, const glm::vec2& rLeftOrR { maScreenTextShapes.push_back(o3tl::make_unique<opengl3D::ScreenText>(mpRenderer.get(), *mpTextCache, nStr, rColor, nEvent)); const opengl3D::TextCacheItem& rTextCache = mpTextCache->getText(nStr); - float nRectWidth = (float)rTextCache.maSize.Width() / (float)rTextCache.maSize.Height() * nTextHeight / 2.0f; + float nRectWidth = static_cast<float>(rTextCache.maSize.Width()) / static_cast<float>(rTextCache.maSize.Height()) * nTextHeight / 2.0f; opengl3D::ScreenText* pScreenText = static_cast<opengl3D::ScreenText*>(maScreenTextShapes.back().get()); if (bLeftTopFlag) pScreenText->setPosition(rLeftOrRightTop, glm::vec2(rLeftOrRightTop.x + nRectWidth, rLeftOrRightTop.y - nTextHeight), rPos); @@ -1206,7 +1206,7 @@ void GL3DBarChart::updateDataUpdateFPS() } else { - float fFPS = (float)miDataUpdateCounter * 1000 / (float)nDeltaMs; + float fFPS = static_cast<float>(miDataUpdateCounter) * 1000 / static_cast<float>(nDeltaMs); maDataUpdateFPS = OUString::number(fFPS); } miDataUpdateCounter = 0; @@ -1253,7 +1253,7 @@ void GL3DBarChart::addMovementScreenText(sal_uInt32 nBarId) OUString aBarValue = "Value: " + OUString::number(rBarInfo.mnVal); maScreenTextShapes.push_back(o3tl::make_unique<opengl3D::ScreenText>(mpRenderer.get(), *mpTextCache, aBarValue, glm::vec4(0.0f, 0.0f, 1.0f, 0.0f), CALC_POS_EVENT_ID, true)); const opengl3D::TextCacheItem& rTextCache = mpTextCache->getText(aBarValue); - float nRectWidth = (float)rTextCache.maSize.Width() / (float)rTextCache.maSize.Height() * 0.024; + float nRectWidth = static_cast<float>(rTextCache.maSize.Width()) / static_cast<float>(rTextCache.maSize.Height()) * 0.024; opengl3D::ScreenText* pScreenText = static_cast<opengl3D::ScreenText*>(maScreenTextShapes.back().get()); pScreenText->setPosition(glm::vec2(-nRectWidth / 2, 0.03f), glm::vec2(nRectWidth / 2, -0.03f), aTextPos); } @@ -1450,7 +1450,7 @@ void GL3DBarChart::updateScroll() OUString aBarValue = "Value: " + OUString::number(i.mnVal); maScreenTextShapes.push_back(o3tl::make_unique<opengl3D::ScreenText>(mpRenderer.get(), *mpTextCache, aBarValue, glm::vec4(0.0f, 0.0f, 1.0f, 0.0f), CALC_POS_EVENT_ID, true)); const opengl3D::TextCacheItem& rTextCache = mpTextCache->getText(aBarValue); - float nRectWidth = (float)rTextCache.maSize.Width() / (float)rTextCache.maSize.Height() * 0.024; + float nRectWidth = static_cast<float>(rTextCache.maSize.Width()) / static_cast<float>(rTextCache.maSize.Height()) * 0.024; glm::vec3 aTextPos = glm::vec3(i.maPos.x + BAR_SIZE_X / 2.0f, i.maPos.y + BAR_SIZE_Y / 2.0f, i.maPos.z); diff --git a/chart2/source/view/inc/ViewDefines.hxx b/chart2/source/view/inc/ViewDefines.hxx index f4d91a739618..186f01b2c390 100644 --- a/chart2/source/view/inc/ViewDefines.hxx +++ b/chart2/source/view/inc/ViewDefines.hxx @@ -22,7 +22,7 @@ namespace chart { -#define CHART_3DOBJECT_SEGMENTCOUNT ((sal_Int32)32) +#define CHART_3DOBJECT_SEGMENTCOUNT (sal_Int32(32)) //There needs to be a little distance between grid lines and walls in 3D, otherwise the lines are partly hidden by the walls #define GRID_TO_WALL_DISTANCE (1.0) diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx index 61d956bfaf99..800f9cea2262 100644 --- a/chart2/source/view/main/DummyXShape.cxx +++ b/chart2/source/view/main/DummyXShape.cxx @@ -440,7 +440,7 @@ void DummyArea2D::render() for(sal_Int32 j = 0; j < nPointsCount; j++) { const css::awt::Point& p = points[j]; - pChart->m_GLRender.SetArea2DShapePoint((float)p.X, (float)p.Y, nPointsCount); + pChart->m_GLRender.SetArea2DShapePoint(static_cast<float>(p.X), static_cast<float>(p.Y), nPointsCount); } } @@ -598,7 +598,7 @@ void DummyLine2D::render() sal_uInt8 B = (nColorValue & 0x000000FF); pChart->m_GLRender.SetLine2DColor(R, G, B, nAlpha); - SAL_INFO("chart2.opengl", "line colorvalue = " << nColorValue << ", R = " << (int)R << ", G = " << (int)G << ", B = " << (int)B); + SAL_INFO("chart2.opengl", "line colorvalue = " << nColorValue << ", R = " << static_cast<int>(R) << ", G = " << static_cast<int>(G) << ", B = " << static_cast<int>(B)); } else SAL_WARN("chart2.opengl", "no line color set"); @@ -624,7 +624,7 @@ void DummyLine2D::render() for(sal_Int32 j = 0; j < pointscount; j++) { css::awt::Point& p = points[j]; - pChart->m_GLRender.SetLine2DShapePoint((float)p.X, (float)p.Y, pointscount); + pChart->m_GLRender.SetLine2DShapePoint(static_cast<float>(p.X), static_cast<float>(p.Y), pointscount); } } diff --git a/chart2/source/view/main/GL3DRenderer.cxx b/chart2/source/view/main/GL3DRenderer.cxx index 2fb4de8b6983..b1b8510347c6 100644 --- a/chart2/source/view/main/GL3DRenderer.cxx +++ b/chart2/source/view/main/GL3DRenderer.cxx @@ -399,7 +399,7 @@ void OpenGL3DRenderer::init() CHECK_GL_ERROR(); m_fViewAngle = 30.0f; - m_3DProjection = glm::perspective(m_fViewAngle, (float)m_iWidth / (float)m_iHeight, 0.01f, 6000.0f); + m_3DProjection = glm::perspective(m_fViewAngle, static_cast<float>(m_iWidth) / static_cast<float>(m_iHeight), 0.01f, 6000.0f); maResources.m_b330Support = epoxy_gl_version() >= 33; CHECK_GL_ERROR(); @@ -1852,14 +1852,14 @@ void OpenGL3DRenderer::CreateTextTextureBatch(const boost::shared_array<sal_uInt glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, m_TextInfoBatch.texture[index].subTextureNum, bmpWidth, bmpHeight, 1, GL_RGB, GL_UNSIGNED_BYTE, bitmapBuf.get()); CHECK_GL_ERROR(); //calc texture coordinate - m_TextInfoBatch.textureCoordList.emplace_back((float)bmpWidth / (float)m_TextInfoBatch.texture[index].textureArrayWidth, + m_TextInfoBatch.textureCoordList.emplace_back(static_cast<float>(bmpWidth) / static_cast<float>(m_TextInfoBatch.texture[index].textureArrayWidth), 0, m_TextInfoBatch.texture[index].subTextureNum); - m_TextInfoBatch.textureCoordList.emplace_back((float)bmpWidth / (float)m_TextInfoBatch.texture[index].textureArrayWidth, - (float)bmpHeight/ (float)m_TextInfoBatch.texture[index].textureArrayHeight, + m_TextInfoBatch.textureCoordList.emplace_back(static_cast<float>(bmpWidth) / static_cast<float>(m_TextInfoBatch.texture[index].textureArrayWidth), + static_cast<float>(bmpHeight)/ static_cast<float>(m_TextInfoBatch.texture[index].textureArrayHeight), m_TextInfoBatch.texture[index].subTextureNum); m_TextInfoBatch.textureCoordList.emplace_back(0, - (float)bmpHeight/ (float)m_TextInfoBatch.texture[index].textureArrayHeight, + static_cast<float>(bmpHeight)/ static_cast<float>(m_TextInfoBatch.texture[index].textureArrayHeight), m_TextInfoBatch.texture[index].subTextureNum); m_TextInfoBatch.textureCoordList.emplace_back(0, 0, diff --git a/chart2/source/view/main/OpenGLRender.cxx b/chart2/source/view/main/OpenGLRender.cxx index 788d5e9fc45f..fb3d7e0a8df0 100644 --- a/chart2/source/view/main/OpenGLRender.cxx +++ b/chart2/source/view/main/OpenGLRender.cxx @@ -348,7 +348,7 @@ void OpenGLRender::SetSize(int width, int height) void OpenGLRender::SetSizePixel(int width, int height) { m_Projection = glm::ortho(0.f, float(m_iWidth), 0.f, float(m_iHeight), -4.f, 3.f); - m_Projection = m_Projection * glm::scale(glm::vec3((float)width / m_iWidth, -(float)height / m_iHeight, 1.0f)); + m_Projection = m_Projection * glm::scale(glm::vec3(static_cast<float>(width) / m_iWidth, -static_cast<float>(height) / m_iHeight, 1.0f)); m_View = glm::lookAt(glm::vec3(0,m_iHeight,1), glm::vec3(0,m_iHeight,0), @@ -357,12 +357,12 @@ void OpenGLRender::SetSizePixel(int width, int height) void OpenGLRender::SetLine2DColor(sal_uInt8 r, sal_uInt8 g, sal_uInt8 b, sal_uInt8 nAlpha) { - m_2DColor = glm::vec4((float)r / 255.0f, (float)g / 255.0f, (float)b / 255.0f, nAlpha/255.f); + m_2DColor = glm::vec4(static_cast<float>(r) / 255.0f, static_cast<float>(g) / 255.0f, static_cast<float>(b) / 255.0f, nAlpha/255.f); } void OpenGLRender::SetLine2DWidth(int width) { - m_fLineWidth = std::max((float)width, 0.001f); + m_fLineWidth = std::max(static_cast<float>(width), 0.001f); } void OpenGLRender::SetColor(sal_uInt32 color, sal_uInt8 nAlpha) @@ -370,7 +370,7 @@ void OpenGLRender::SetColor(sal_uInt32 color, sal_uInt8 nAlpha) sal_uInt8 r = (color & 0x00FF0000) >> 16; sal_uInt8 g = (color & 0x0000FF00) >> 8; sal_uInt8 b = (color & 0x000000FF); - m_2DColor = glm::vec4((float)r / 255.0f, (float)g / 255.0f, (float)b / 255.0f, nAlpha/ 255.f); + m_2DColor = glm::vec4(static_cast<float>(r) / 255.0f, static_cast<float>(g) / 255.0f, static_cast<float>(b) / 255.0f, nAlpha/ 255.f); } int OpenGLRender::Create2DCircle(int detail) @@ -651,7 +651,7 @@ int OpenGLRender::CreateTextTexture(const boost::shared_array<sal_uInt8> &rPixel long bmpHeight = aPixelSize.Height(); TextInfo aTextInfo; - aTextInfo.rotation = -(double)rotation / 360.0 * 2* GL_PI; + aTextInfo.rotation = -static_cast<double>(rotation) / 360.0 * 2* GL_PI; aTextInfo.vertex[0] = -aSize.Width / 2; aTextInfo.vertex[1] = -aSize.Height / 2; aTextInfo.vertex[2] = m_fZStep; @@ -857,28 +857,28 @@ void OpenGLRender::SetBackGroundColor(sal_uInt32 color1, sal_uInt32 color2, css: sal_uInt8 g = (color1 & 0x0000FF00) >> 8; sal_uInt8 b = (color1 & 0x000000FF); - m_BackgroundColor[0] = (float)r / 255.0f; - m_BackgroundColor[1] = (float)g / 255.0f; - m_BackgroundColor[2] = (float)b / 255.0f; + m_BackgroundColor[0] = static_cast<float>(r) / 255.0f; + m_BackgroundColor[1] = static_cast<float>(g) / 255.0f; + m_BackgroundColor[2] = static_cast<float>(b) / 255.0f; m_BackgroundColor[3] = fillStyle != css::drawing::FillStyle_NONE ? 1.0 : 0.0; - m_BackgroundColor[4] = (float)r / 255.0f; - m_BackgroundColor[5] = (float)g / 255.0f; - m_BackgroundColor[6] = (float)b / 255.0f; + m_BackgroundColor[4] = static_cast<float>(r) / 255.0f; + m_BackgroundColor[5] = static_cast<float>(g) / 255.0f; + m_BackgroundColor[6] = static_cast<float>(b) / 255.0f; m_BackgroundColor[7] = fillStyle != css::drawing::FillStyle_NONE ? 1.0 : 0.0; r = (color2 & 0x00FF0000) >> 16; g = (color2 & 0x0000FF00) >> 8; b = (color2 & 0x000000FF); - m_BackgroundColor[8] = (float)r / 255.0f; - m_BackgroundColor[9] = (float)g / 255.0f; - m_BackgroundColor[10] = (float)b / 255.0f; + m_BackgroundColor[8] = static_cast<float>(r) / 255.0f; + m_BackgroundColor[9] = static_cast<float>(g) / 255.0f; + m_BackgroundColor[10] = static_cast<float>(b) / 255.0f; m_BackgroundColor[11] = fillStyle != css::drawing::FillStyle_NONE ? 1.0 : 0.0; - m_BackgroundColor[12] = (float)r / 255.0f; - m_BackgroundColor[13] = (float)g / 255.0f; - m_BackgroundColor[14] = (float)b / 255.0f; + m_BackgroundColor[12] = static_cast<float>(r) / 255.0f; + m_BackgroundColor[13] = static_cast<float>(g) / 255.0f; + m_BackgroundColor[14] = static_cast<float>(b) / 255.0f; m_BackgroundColor[15] = fillStyle != css::drawing::FillStyle_NONE ? 1.0 : 0.0; SAL_INFO("chart2.opengl", "color1 = " << color1 << ", color2 = " << color2); diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx index 53a10b922276..ad79415d6a6c 100644 --- a/chart2/source/view/main/ShapeFactory.cxx +++ b/chart2/source/view/main/ShapeFactory.cxx @@ -950,7 +950,7 @@ uno::Reference< drawing::XShape > //depth xProp->setPropertyValue( UNO_NAME_3D_EXTRUDE_DEPTH - , uno::Any((sal_Int32)fDepth) ); + , uno::Any(static_cast<sal_Int32>(fDepth)) ); //PercentDiagonal xProp->setPropertyValue( UNO_NAME_3D_PERCENT_DIAGONAL |