[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - chart2/source
Balazs Varga (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jul 2 10:09:37 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 e0b2dadd5d7a97acd047d074c346216a0cc8a4f0
Author: Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Wed Jun 17 15:07:53 2020 +0200
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Jul 2 12:09:02 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>
(cherry picked from commit f6604dd2cfbc6d4041ef019951a7f1341197ee26)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97373
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.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 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();
}
More information about the Libreoffice-commits
mailing list