summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-11-03 14:55:29 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-11-03 14:13:57 +0100
commit2a3f5d11522cd69f0ce221cde3a63b7e85e94b53 (patch)
tree51a9483a42769f64fff5b329af6604cdf5a5f7ff /chart2
parente73bf95c00168bbf7d312cd11c40d0581ebd928e (diff)
tdf#120703 PVS: V547 Expression is always true/false
Change-Id: I856345576ff5c10a41509a97ad4539272bd55568 Reviewed-on: https://gerrit.libreoffice.org/62803 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/accessibility/AccessibleBase.cxx8
-rw-r--r--chart2/source/model/template/BubbleDataInterpreter.cxx3
-rw-r--r--chart2/source/view/charttypes/AreaChart.cxx87
-rw-r--r--chart2/source/view/charttypes/BubbleChart.cxx28
-rw-r--r--chart2/source/view/main/ChartView.cxx6
5 files changed, 61 insertions, 71 deletions
diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx b/chart2/source/controller/accessibility/AccessibleBase.cxx
index b21cc823a4f5..c21b92db6b28 100644
--- a/chart2/source/controller/accessibility/AccessibleBase.cxx
+++ b/chart2/source/controller/accessibility/AccessibleBase.cxx
@@ -685,14 +685,10 @@ awt::Point SAL_CALL AccessibleBase::getLocationOnScreen()
{
CheckDisposeState();
- if( m_aAccInfo.m_pParent != nullptr )
+ if (AccessibleBase* pParent = m_aAccInfo.m_pParent)
{
- AccessibleBase * pParent = m_aAccInfo.m_pParent;
awt::Point aLocThisRel( getLocation());
- awt::Point aUpperLeft;
-
- if( pParent != nullptr )
- aUpperLeft = pParent->getLocationOnScreen();
+ awt::Point aUpperLeft(pParent->getLocationOnScreen());
return awt::Point( aUpperLeft.X + aLocThisRel.X,
aUpperLeft.Y + aLocThisRel.Y );
diff --git a/chart2/source/model/template/BubbleDataInterpreter.cxx b/chart2/source/model/template/BubbleDataInterpreter.cxx
index 6f1fc604bb49..cfef7f25baac 100644
--- a/chart2/source/model/template/BubbleDataInterpreter.cxx
+++ b/chart2/source/model/template/BubbleDataInterpreter.cxx
@@ -134,8 +134,7 @@ chart2::InterpretedData SAL_CALL BubbleDataInterpreter::interpretDataSource(
}
if( aYValuesVector.size() > nN )
aNewData.push_back( aYValuesVector[nN] );
- if( aSizeValuesVector.size() > nN )
- aNewData.push_back( aSizeValuesVector[nN] );
+ aNewData.push_back(aSizeValuesVector[nN]);
Reference< XDataSeries > xSeries;
if( nSeriesIndex < aSeriesToReUse.getLength())
diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx
index 005d7c4afba8..02ea81e98232 100644
--- a/chart2/source/view/charttypes/AreaChart.cxx
+++ b/chart2/source/view/charttypes/AreaChart.cxx
@@ -542,10 +542,8 @@ void AreaChart::impl_createSeriesShapes()
for( std::unique_ptr<VDataSeries> const & pSeries : rXSlot.m_aSeriesVector )
{
sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex();
- PlottingPositionHelper* pPosHelper = &(getPlottingPositionHelper( nAttachedAxisIndex ));
- if(!pPosHelper)
- pPosHelper = m_pMainPosHelper.get();
- PlotterBase::m_pPosHelper = pPosHelper;
+ PlottingPositionHelper& rPosHelper = getPlottingPositionHelper(nAttachedAxisIndex);
+ m_pPosHelper = &rPosHelper;
createRegressionCurvesShapes( *pSeries, m_xErrorBarTarget, m_xRegressionCurveEquationTarget,
m_pPosHelper->maySkipPointsInRegressionCalculation());
@@ -553,12 +551,13 @@ void AreaChart::impl_createSeriesShapes()
pSeriesPoly = &pSeries->m_aPolyPolygonShape3D;
if( m_bArea )
{
- if( !impl_createArea( pSeries.get(), pSeriesPoly, aPreviousSeriesPolyMap[nAttachedAxisIndex], pPosHelper ) )
+ if (!impl_createArea(pSeries.get(), pSeriesPoly,
+ aPreviousSeriesPolyMap[nAttachedAxisIndex], &rPosHelper))
continue;
}
if( m_bLine )
{
- if( !impl_createLine( pSeries.get(), pSeriesPoly, pPosHelper ) )
+ if (!impl_createLine(pSeries.get(), pSeriesPoly, &rPosHelper))
continue;
}
aPreviousSeriesPolyMap[nAttachedAxisIndex] = pSeriesPoly;
@@ -677,10 +676,7 @@ void AreaChart::createShapes()
if( rLogicYSumMap.find(nAttachedAxisIndex)==rLogicYSumMap.end() )
rLogicYSumMap[nAttachedAxisIndex]=0.0;
- PlottingPositionHelper* pPosHelper = &(getPlottingPositionHelper( nAttachedAxisIndex ));
- if(!pPosHelper)
- pPosHelper = m_pMainPosHelper.get();
- PlotterBase::m_pPosHelper = pPosHelper;
+ m_pPosHelper = &getPlottingPositionHelper(nAttachedAxisIndex);
double fAdd = pSeries->getYValue( nIndex );
if( !::rtl::math::isNan(fAdd) && !::rtl::math::isInf(fAdd) )
@@ -707,10 +703,8 @@ void AreaChart::createShapes()
uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShapeFrontChild(pSeries.get(), m_xSeriesTarget);
sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex();
- PlottingPositionHelper* pPosHelper = &(getPlottingPositionHelper( nAttachedAxisIndex ));
- if(!pPosHelper)
- pPosHelper = m_pMainPosHelper.get();
- PlotterBase::m_pPosHelper = pPosHelper;
+ PlottingPositionHelper& rPosHelper = getPlottingPositionHelper(nAttachedAxisIndex);
+ m_pPosHelper = &rPosHelper;
if(m_nDimension==3)
fLogicZ = nZ+0.5;
@@ -735,7 +729,7 @@ void AreaChart::createShapes()
fLogicY = fabs( fLogicY );
std::map< sal_Int32, double >& rLogicYSumMap = aLogicYSumMapByX[nIndex];
- if( pPosHelper->isPercentY() && rLogicYSumMap[nAttachedAxisIndex] != 0.0 )
+ if (rPosHelper.isPercentY() && rLogicYSumMap[nAttachedAxisIndex] != 0.0)
{
fLogicY = fabs( fLogicY )/rLogicYSumMap[nAttachedAxisIndex];
}
@@ -766,7 +760,7 @@ void AreaChart::createShapes()
fLogicY += rLogicYForNextSeriesMap[nAttachedAxisIndex];
rLogicYForNextSeriesMap[nAttachedAxisIndex] = fLogicY;
- bool bIsVisible = pPosHelper->isLogicVisible( fLogicX, fLogicY, fLogicZ );
+ bool bIsVisible = rPosHelper.isLogicVisible(fLogicX, fLogicY, fLogicZ);
//remind minimal and maximal x values for area 'grounding' points
//only for filled area
@@ -781,18 +775,20 @@ void AreaChart::createShapes()
drawing::Position3D aUnscaledLogicPosition( fLogicX, fLogicY, fLogicZ );
drawing::Position3D aScaledLogicPosition(aUnscaledLogicPosition);
- pPosHelper->doLogicScaling( aScaledLogicPosition );
+ rPosHelper.doLogicScaling(aScaledLogicPosition);
//transformation 3) -> 4)
- drawing::Position3D aScenePosition( pPosHelper->transformLogicToScene( fLogicX,fLogicY,fLogicZ, false ) );
+ drawing::Position3D aScenePosition(
+ rPosHelper.transformLogicToScene(fLogicX, fLogicY, fLogicZ, false));
//better performance for big data
FormerPoint aFormerPoint( aSeriesFormerPointMap[pSeries.get()] );
- pPosHelper->setCoordinateSystemResolution( m_aCoordinateSystemResolution );
- if( !pSeries->isAttributedDataPoint(nIndex)
- &&
- pPosHelper->isSameForGivenResolution( aFormerPoint.m_fX, aFormerPoint.m_fY, aFormerPoint.m_fZ
- , aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY, aScaledLogicPosition.PositionZ ) )
+ rPosHelper.setCoordinateSystemResolution(m_aCoordinateSystemResolution);
+ if (!pSeries->isAttributedDataPoint(nIndex)
+ && rPosHelper.isSameForGivenResolution(
+ aFormerPoint.m_fX, aFormerPoint.m_fY, aFormerPoint.m_fZ,
+ aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY,
+ aScaledLogicPosition.PositionZ))
{
++nSkippedPoints;
m_bPointsWereSkipped = true;
@@ -859,31 +855,27 @@ void AreaChart::createShapes()
{
if(m_nDimension!=3)
{
- if( pSymbolProperties )
+ if (pSymbolProperties->Style != SymbolStyle_NONE)
{
- if( pSymbolProperties->Style != SymbolStyle_NONE )
- {
- aSymbolSize.DirectionX = pSymbolProperties->Size.Width;
- aSymbolSize.DirectionY = pSymbolProperties->Size.Height;
- }
-
- if( pSymbolProperties->Style == SymbolStyle_STANDARD )
- {
- sal_Int32 nSymbol = pSymbolProperties->StandardSymbol;
- m_pShapeFactory->createSymbol2D( xPointGroupShape_Shapes
- , aScenePosition, aSymbolSize
- , nSymbol
- , pSymbolProperties->BorderColor
- , pSymbolProperties->FillColor );
- }
- else if( pSymbolProperties->Style == SymbolStyle_GRAPHIC )
- {
- m_pShapeFactory->createGraphic2D( xPointGroupShape_Shapes
- , aScenePosition , aSymbolSize
- , pSymbolProperties->Graphic );
- }
- //@todo other symbol styles
+ aSymbolSize.DirectionX = pSymbolProperties->Size.Width;
+ aSymbolSize.DirectionY = pSymbolProperties->Size.Height;
}
+
+ if (pSymbolProperties->Style == SymbolStyle_STANDARD)
+ {
+ sal_Int32 nSymbol = pSymbolProperties->StandardSymbol;
+ m_pShapeFactory->createSymbol2D(
+ xPointGroupShape_Shapes, aScenePosition, aSymbolSize,
+ nSymbol, pSymbolProperties->BorderColor,
+ pSymbolProperties->FillColor);
+ }
+ else if (pSymbolProperties->Style == SymbolStyle_GRAPHIC)
+ {
+ m_pShapeFactory->createGraphic2D(xPointGroupShape_Shapes,
+ aScenePosition, aSymbolSize,
+ pSymbolProperties->Graphic);
+ }
+ //@todo other symbol styles
}
}
//create error bars
@@ -901,7 +893,8 @@ void AreaChart::createShapes()
, aScenePosition.PositionY
, aScenePosition.PositionZ+getTransformedDepth() );
- sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( nIndex, m_xChartTypeModel, pPosHelper->isSwapXAndY() );
+ sal_Int32 nLabelPlacement = pSeries->getLabelPlacement(
+ nIndex, m_xChartTypeModel, rPosHelper.isSwapXAndY());
switch(nLabelPlacement)
{
diff --git a/chart2/source/view/charttypes/BubbleChart.cxx b/chart2/source/view/charttypes/BubbleChart.cxx
index ee3b0cc38e3e..012d1301f49d 100644
--- a/chart2/source/view/charttypes/BubbleChart.cxx
+++ b/chart2/source/view/charttypes/BubbleChart.cxx
@@ -218,10 +218,9 @@ void BubbleChart::createShapes()
uno::Reference< drawing::XShapes > xSeriesGroupShape_Shapes = getSeriesGroupShape(pSeries.get(), xSeriesTarget);
sal_Int32 nAttachedAxisIndex = pSeries->getAttachedAxisIndex();
- PlottingPositionHelper* pPosHelper = &(getPlottingPositionHelper( nAttachedAxisIndex ));
- if(!pPosHelper)
- pPosHelper = m_pMainPosHelper;
- PlotterBase::m_pPosHelper = pPosHelper;
+ PlottingPositionHelper& rPosHelper
+ = getPlottingPositionHelper(nAttachedAxisIndex);
+ m_pPosHelper = &rPosHelper;
//collect data point information (logic coordinates, style ):
double fLogicX = pSeries->getXValue(nIndex);
@@ -238,22 +237,24 @@ void BubbleChart::createShapes()
|| ::rtl::math::isNan(fLogicY) || ::rtl::math::isInf(fLogicY) )
continue;
- bool bIsVisible = pPosHelper->isLogicVisible( fLogicX, fLogicY, fLogicZ );
+ bool bIsVisible = rPosHelper.isLogicVisible(fLogicX, fLogicY, fLogicZ);
drawing::Position3D aUnscaledLogicPosition( fLogicX, fLogicY, fLogicZ );
drawing::Position3D aScaledLogicPosition(aUnscaledLogicPosition);
- pPosHelper->doLogicScaling( aScaledLogicPosition );
+ rPosHelper.doLogicScaling(aScaledLogicPosition);
//transformation 3) -> 4)
- drawing::Position3D aScenePosition( pPosHelper->transformLogicToScene( fLogicX,fLogicY,fLogicZ, false ) );
+ drawing::Position3D aScenePosition(
+ rPosHelper.transformLogicToScene(fLogicX, fLogicY, fLogicZ, false));
//better performance for big data
FormerPoint aFormerPoint( aSeriesFormerPointMap[pSeries.get()] );
- pPosHelper->setCoordinateSystemResolution( m_aCoordinateSystemResolution );
- if( !pSeries->isAttributedDataPoint(nIndex)
- &&
- pPosHelper->isSameForGivenResolution( aFormerPoint.m_fX, aFormerPoint.m_fY, aFormerPoint.m_fZ
- , aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY, aScaledLogicPosition.PositionZ ) )
+ rPosHelper.setCoordinateSystemResolution(m_aCoordinateSystemResolution);
+ if (!pSeries->isAttributedDataPoint(nIndex)
+ && rPosHelper.isSameForGivenResolution(
+ aFormerPoint.m_fX, aFormerPoint.m_fY, aFormerPoint.m_fZ,
+ aScaledLogicPosition.PositionX, aScaledLogicPosition.PositionY,
+ aScaledLogicPosition.PositionZ))
{
nSkippedPoints++;
m_bPointsWereSkipped = true;
@@ -315,7 +316,8 @@ void BubbleChart::createShapes()
, aScenePosition.PositionY
, aScenePosition.PositionZ+getTransformedDepth() );
- sal_Int32 nLabelPlacement = pSeries->getLabelPlacement( nIndex, m_xChartTypeModel, pPosHelper->isSwapXAndY() );
+ sal_Int32 nLabelPlacement = pSeries->getLabelPlacement(
+ nIndex, m_xChartTypeModel, rPosHelper.isSwapXAndY());
switch(nLabelPlacement)
{
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 28494f7a46d3..56a439d48e37 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -1434,9 +1434,9 @@ sal_Int16 lcl_getDefaultWritingModeFromPool( const std::shared_ptr<DrawModelWrap
if(!pDrawModelWrapper)
return nWritingMode;
- const SfxPoolItem* pItem = &(pDrawModelWrapper->GetItemPool().GetDefaultItem( EE_PARA_WRITINGDIR ));
- if( pItem )
- nWritingMode = static_cast< sal_Int16 >(static_cast< const SvxFrameDirectionItem * >( pItem )->GetValue());
+ const SfxPoolItem& rItem = pDrawModelWrapper->GetItemPool().GetDefaultItem(EE_PARA_WRITINGDIR);
+ nWritingMode
+ = static_cast<sal_Int16>(static_cast<const SvxFrameDirectionItem&>(rItem).GetValue());
return nWritingMode;
}