summaryrefslogtreecommitdiff
path: root/chart2/source
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2020-06-17 15:07:53 +0200
committerLászló Németh <nemeth@numbertext.org>2020-06-26 16:00:44 +0200
commitf6604dd2cfbc6d4041ef019951a7f1341197ee26 (patch)
tree8aa3595a8bd437584365324baa0576f2066428e0 /chart2/source
parent0ebdd6ebad2332d38f95e6b1848fcdd53973084e (diff)
tdf#134039 Chart view: fix moving pie chart area
Do not allow to move data labels, when we create data series for the first time, in case of pie or donut chart, but allow to move when we recreate data series for pie or donut chart. Change-Id: If0d61116da1524d15553f8a80453ce2003484d1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96534 Tested-by: Jenkins Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'chart2/source')
-rw-r--r--chart2/source/view/charttypes/VSeriesPlotter.cxx2
-rw-r--r--chart2/source/view/inc/VSeriesPlotter.hxx2
-rw-r--r--chart2/source/view/main/ChartView.cxx5
3 files changed, 7 insertions, 2 deletions
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 063a87eb78ee..19b43ae3d964 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -718,7 +718,7 @@ uno::Reference< drawing::XShape > VSeriesPlotter::createDataLabel( const uno::Re
}
awt::Point aTextShapePos(xTextShape->getPosition());
- if( rDataSeries.isLabelCustomPos(nPointIndex) )
+ if( m_bPieLabelsAllowToMove && rDataSeries.isLabelCustomPos(nPointIndex) )
{
awt::Point aRelPos = rDataSeries.getLabelPosition(aTextShapePos, nPointIndex);
if( aRelPos.X != -1 )
diff --git a/chart2/source/view/inc/VSeriesPlotter.hxx b/chart2/source/view/inc/VSeriesPlotter.hxx
index aa87abb4f2c9..7e60be2bdf1b 100644
--- a/chart2/source/view/inc/VSeriesPlotter.hxx
+++ b/chart2/source/view/inc/VSeriesPlotter.hxx
@@ -241,6 +241,7 @@ public:
//better performance for big data
void setCoordinateSystemResolution( const css::uno::Sequence< sal_Int32 >& rCoordinateSystemResolution );
bool PointsWereSkipped() const { return m_bPointsWereSkipped;}
+ void setPieLabelsAllowToMove( bool bIsPieOrDonut ) { m_bPieLabelsAllowToMove = bIsPieOrDonut; };
//return the depth for a logic 1
double getTransformedDepth() const;
@@ -422,6 +423,7 @@ protected:
//better performance for big data
css::uno::Sequence< sal_Int32 > m_aCoordinateSystemResolution;
bool m_bPointsWereSkipped;
+ bool m_bPieLabelsAllowToMove;
private:
typedef std::map< sal_Int32 , ExplicitScaleData > tSecondaryValueScales;
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index f168e7e0b2df..a5e0ab5da984 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -1588,7 +1588,8 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D
Sequence<sal_Int32> aCoordinateSystemResolution = pVCooSys->getCoordinateSystemResolution( rPageSize, m_aPageResolution );
pSeriesPlotter->setCoordinateSystemResolution( aCoordinateSystemResolution );
}
-
+ // Do not allow to move data labels in case of pie or donut chart, yet!
+ pSeriesPlotter->setPieLabelsAllowToMove(!bIsPieOrDonut);
pSeriesPlotter->createShapes();
m_bPointsWereSkipped = m_bPointsWereSkipped || pSeriesPlotter->PointsWereSkipped();
}
@@ -1627,6 +1628,8 @@ awt::Rectangle ChartView::impl_createDiagramAndContent( const CreateShapeParam2D
VCoordinateSystem* pVCooSys = lcl_getCooSysForPlotter( rVCooSysList, aPlotter.get() );
if(nDimensionCount==2)
aPlotter->setTransformationSceneToScreen( pVCooSys->getTransformationSceneToScreen() );
+ // Now we can move data labels in case of pie or donut chart!
+ aPlotter->setPieLabelsAllowToMove(bIsPieOrDonut);
aPlotter->createShapes();
m_bPointsWereSkipped = m_bPointsWereSkipped || aPlotter->PointsWereSkipped();
}