[Libreoffice-commits] core.git: chart2/source
Balazs Varga (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jun 26 14:01:25 UTC 2020
chart2/source/view/charttypes/VSeriesPlotter.cxx | 2 +-
chart2/source/view/inc/VSeriesPlotter.hxx | 2 ++
chart2/source/view/main/ChartView.cxx | 5 ++++-
3 files changed, 7 insertions(+), 2 deletions(-)
New commits:
commit f6604dd2cfbc6d4041ef019951a7f1341197ee26
Author: Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Wed Jun 17 15:07:53 2020 +0200
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Fri Jun 26 16:00:44 2020 +0200
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 at numbertext.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
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();
}
More information about the Libreoffice-commits
mailing list