diff options
author | Eike Rathke <erack@redhat.com> | 2016-10-06 17:26:44 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-10-06 20:55:28 +0000 |
commit | a5442b696697e4a24566b1f5b7e5c9bc77a9fd03 (patch) | |
tree | 989ed9b2f781fae584a03392b138e4e7dd27fae3 /chart2 | |
parent | ff085ed8fd6438d855526a8a4d699960e4d3cc73 (diff) |
rtl::math::approxEqual(value,0.0) never yields true for value!=0.0
... so replace with a simple value == 0.0 also in other modules than sc.
Change-Id: Ie7316505a1cf9c15100114b45d300facceb03b7e
Reviewed-on: https://gerrit.libreoffice.org/29575
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/controller/main/DragMethod_PieSegment.cxx | 2 | ||||
-rw-r--r-- | chart2/source/tools/DiagramHelper.cxx | 2 | ||||
-rw-r--r-- | chart2/source/view/axes/VCartesianAxis.cxx | 10 | ||||
-rw-r--r-- | chart2/source/view/charttypes/AreaChart.cxx | 2 | ||||
-rw-r--r-- | chart2/source/view/charttypes/BubbleChart.cxx | 2 | ||||
-rw-r--r-- | chart2/source/view/charttypes/NetChart.cxx | 2 | ||||
-rw-r--r-- | chart2/source/view/charttypes/PieChart.cxx | 12 | ||||
-rw-r--r-- | chart2/source/view/main/AbstractShapeFactory.cxx | 2 |
8 files changed, 17 insertions, 17 deletions
diff --git a/chart2/source/controller/main/DragMethod_PieSegment.cxx b/chart2/source/controller/main/DragMethod_PieSegment.cxx index 3e175ec7056c..d2eaa2b5cebf 100644 --- a/chart2/source/controller/main/DragMethod_PieSegment.cxx +++ b/chart2/source/controller/main/DragMethod_PieSegment.cxx @@ -63,7 +63,7 @@ DragMethod_PieSegment::DragMethod_PieSegment( DrawViewWrapper& rDrawViewWrapper B2DVector aMaxVector( aMaximumPosition.X, aMaximumPosition.Y ); m_aDragDirection = aMaxVector - aMinVector; m_fDragRange = m_aDragDirection.scalar( m_aDragDirection ); - if( ::rtl::math::approxEqual( m_fDragRange, 0.0 ) ) + if( m_fDragRange == 0.0 ) m_fDragRange = 1.0; } DragMethod_PieSegment::~DragMethod_PieSegment() diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index ce0eca35b9c0..ac19d718f1f9 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -167,7 +167,7 @@ void DiagramHelper::setVertical( double fAngleDegree = 0.0; xTitleProps->getPropertyValue("TextRotation") >>= fAngleDegree; - if (!rtl::math::approxEqual(fAngleDegree, 0.0) && + if (fAngleDegree != 0.0 && !rtl::math::approxEqual(fAngleDegree, 90.0)) continue; diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index f58afb729ff0..daccb00c1411 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -492,7 +492,7 @@ bool VCartesianAxis::isBreakOfLabelsAllowed( //no break for value axis if( !m_bUseTextLabels ) return false; - if( !::rtl::math::approxEqual( rAxisLabelProperties.fRotationAngleDegree, 0.0 ) ) + if( rAxisLabelProperties.fRotationAngleDegree != 0.0 ) return false; //break only for horizontal axis return bIsHorizontalAxis; @@ -507,7 +507,7 @@ bool canAutoAdjustLabelPlacement( return false; if( rAxisLabelProperties.bLineBreakAllowed ) // auto line break may conflict with... return false; - if( !::rtl::math::approxEqual( rAxisLabelProperties.fRotationAngleDegree, 0.0 ) ) + if( rAxisLabelProperties.fRotationAngleDegree != 0.0 ) return false; // automatic adjusting labels only works for // horizontal axis with horizontal text @@ -813,7 +813,7 @@ bool VCartesianAxis::createTextShapes( recordMaximumTextSize( pTickInfo->xTextShape, rAxisLabelProperties.fRotationAngleDegree ); if( nLimitedSpaceForText>0 && !rAxisLabelProperties.bOverlapAllowed - && ::rtl::math::approxEqual( rAxisLabelProperties.fRotationAngleDegree, 0.0 ) + && rAxisLabelProperties.fRotationAngleDegree == 0.0 && m_aAxisProperties.m_bComplexCategories && lcl_hasWordBreak( pTickInfo->xTextShape ) ) { @@ -1340,7 +1340,7 @@ void VCartesianAxis::get2DAxisMainLine( ScreenPosAndLogicPos aNotSoGoodPos( aPosList[1] ); //choose most bottom positions - if( !::rtl::math::approxEqual( fDeltaX, 0.0 ) ) // prefer left-right alignments + if( fDeltaX != 0.0 ) // prefer left-right alignments { if( aBestPos.aScreenPos.getX() > aNotSoGoodPos.aScreenPos.getX() ) rAlignment.meAlignment = LABEL_ALIGN_RIGHT; @@ -1596,7 +1596,7 @@ void VCartesianAxis::createLabels() if( m_aAxisProperties.m_bComplexCategories ) { aComplexProps.bLineBreakAllowed = true; - aComplexProps.bOverlapAllowed = !::rtl::math::approxEqual( aComplexProps.fRotationAngleDegree, 0.0 ); + aComplexProps.bOverlapAllowed = aComplexProps.fRotationAngleDegree != 0.0; } AxisLabelProperties& rAxisLabelProperties = m_aAxisProperties.m_bComplexCategories ? aComplexProps : m_aAxisLabelProperties; diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx index 8933429d04f0..6ee585c4581e 100644 --- a/chart2/source/view/charttypes/AreaChart.cxx +++ b/chart2/source/view/charttypes/AreaChart.cxx @@ -766,7 +766,7 @@ void AreaChart::createShapes() fLogicY = fabs( fLogicY ); std::map< sal_Int32, double >& rLogicYSumMap = aLogicYSumMapByX[nIndex]; - if( pPosHelper->isPercentY() && !::rtl::math::approxEqual( rLogicYSumMap[nAttachedAxisIndex], 0.0 ) ) + if( pPosHelper->isPercentY() && rLogicYSumMap[nAttachedAxisIndex] != 0.0 ) { fLogicY = fabs( fLogicY )/rLogicYSumMap[nAttachedAxisIndex]; } diff --git a/chart2/source/view/charttypes/BubbleChart.cxx b/chart2/source/view/charttypes/BubbleChart.cxx index a9e9dabfc111..af4f65227d17 100644 --- a/chart2/source/view/charttypes/BubbleChart.cxx +++ b/chart2/source/view/charttypes/BubbleChart.cxx @@ -255,7 +255,7 @@ void BubbleChart::createShapes() if( !m_bShowNegativeValues && fBubbleSize<0.0 ) continue; - if( ::rtl::math::approxEqual( fBubbleSize, 0.0 ) || ::rtl::math::isNan(fBubbleSize) ) + if( fBubbleSize == 0.0 || ::rtl::math::isNan(fBubbleSize) ) continue; if( ::rtl::math::isNan(fLogicX) || ::rtl::math::isInf(fLogicX) diff --git a/chart2/source/view/charttypes/NetChart.cxx b/chart2/source/view/charttypes/NetChart.cxx index b69a4750a467..e62036a048c0 100644 --- a/chart2/source/view/charttypes/NetChart.cxx +++ b/chart2/source/view/charttypes/NetChart.cxx @@ -475,7 +475,7 @@ void NetChart::createShapes() } } - if( pPosHelper->isPercentY() && !::rtl::math::approxEqual( aLogicYSumMap[nAttachedAxisIndex], 0.0 ) ) + if( pPosHelper->isPercentY() && aLogicYSumMap[nAttachedAxisIndex] != 0.0 ) { fLogicY = fabs( fLogicY )/aLogicYSumMap[nAttachedAxisIndex]; } diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index d2df00070f7d..d91e5a10d3fd 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -230,7 +230,7 @@ uno::Reference< drawing::XShape > PieChart::createDataPoint( { //transform position: drawing::Direction3D aOffset; - if (!::rtl::math::approxEqual(rParam.mfExplodePercentage, 0.0)) + if (rParam.mfExplodePercentage != 0.0) { double fAngle = rParam.mfUnitCircleStartAngleDegree + rParam.mfUnitCircleWidthAngleDegree/2.0; double fRadius = (rParam.mfUnitCircleOuterRadius-rParam.mfUnitCircleInnerRadius)*rParam.mfExplodePercentage; @@ -272,7 +272,7 @@ void PieChart::createTextLabelShape( ///to both normalized radii. (See notes for ///`PolarPlottingPositionHelper::transformToRadius`, especially example 3, ///and related comments). - if (!rtl::math::approxEqual(rParam.mfExplodePercentage, 0.0)) + if (rParam.mfExplodePercentage != 0.0) { double fExplodeOffset = (rParam.mfUnitCircleOuterRadius-rParam.mfUnitCircleInnerRadius)*rParam.mfExplodePercentage; rParam.mfUnitCircleInnerRadius += fExplodeOffset; @@ -1123,7 +1123,7 @@ void PieChart::rearrangeLabelToAvoidOverlapIfRequested( const awt::Size& rPageSi return; double fPageDiagonaleLength = sqrt( double( rPageSize.Width*rPageSize.Width + rPageSize.Height*rPageSize.Height) ); - if( ::rtl::math::approxEqual( fPageDiagonaleLength, 0.0 ) ) + if( fPageDiagonaleLength == 0.0 ) return; ///initialize next and previous member of `PieLabelInfo` objects @@ -1325,7 +1325,7 @@ bool PieChart::performLabelBestFitInnerPlacement(ShapeParam& rShapeParam, PieLab " old anchor point = " << rPieLabelInfo.aFirstPosition ); - if( ::rtl::math::approxEqual( fPieRadius, 0.0 ) ) + if( fPieRadius == 0.0 ) return false; // get label b.b. width and height @@ -1417,7 +1417,7 @@ bool PieChart::performLabelBestFitInnerPlacement(ShapeParam& rShapeParam, PieLab // note that in the former case 0 <= f(alpha, beta) <= 180, // whilst in the latter case 180 <= f(alpha, beta) <= 360; double fAlphaMod90 = fmod( fAlphaDeg + 45, 90.0 ) - 45; - double fSign = ::rtl::math::approxEqual( fAlphaMod90, 0.0 ) + double fSign = fAlphaMod90 == 0.0 ? 0.0 : ( fAlphaMod90 < 0 ) ? -1.0 : 1.0; double fThetaRad = fSign * fAlphaRad + M_PI_2 * (1 - fSign * nNearestEdgeIndex) + fBetaRad; @@ -1430,7 +1430,7 @@ bool PieChart::performLabelBestFitInnerPlacement(ShapeParam& rShapeParam, PieLab // that is the distance between C and P double fDistanceCP; // when the bisector ray intersects the b.b. in F we have theta mod 180 == 0 - if( ::rtl::math::approxEqual( fmod(fThetaRad, M_PI), 0.0 )) + if( fmod(fThetaRad, M_PI) == 0.0 ) { fDistanceCP = fPieRadius - fDistancePF; } diff --git a/chart2/source/view/main/AbstractShapeFactory.cxx b/chart2/source/view/main/AbstractShapeFactory.cxx index 752ff10185dd..56953a9cfcbf 100644 --- a/chart2/source/view/main/AbstractShapeFactory.cxx +++ b/chart2/source/view/main/AbstractShapeFactory.cxx @@ -306,7 +306,7 @@ awt::Size AbstractShapeFactory::getSizeAfterRotation( { const awt::Size aSize( xShape->getSize() ); - if( ::rtl::math::approxEqual( fRotationAngleDegree, 0.0 ) ) + if( fRotationAngleDegree == 0.0 ) aRet = aSize; else { |