summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2020-06-17 15:07:53 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2020-07-02 12:09:02 +0200
commite0b2dadd5d7a97acd047d074c346216a0cc8a4f0 (patch)
tree7451b550aca1eea236dc58be8d9b63f338cf9399 /chart2
parent67305403739786e0427b807dee10dcfe7d6f153b (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> (cherry picked from commit f6604dd2cfbc6d4041ef019951a7f1341197ee26) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97373 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'chart2')
-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 f47a1eaf412c..4b6b1fa9b48f 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();
}