diff options
author | Andras Timar <andras.timar@collabora.com> | 2021-11-09 23:36:32 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2021-11-10 16:02:47 +0100 |
commit | 453363ae1384a6d6f2c77052170b39a1ebf567a6 (patch) | |
tree | 00abaa66789af094020d2c5341bb616856effc9f /chart2 | |
parent | 34b586dc84b810eece7ae08b4028caba78db319f (diff) |
tdf#136111 fix scaling problem on chart driven by a macro
Change-Id: I9a55bcfceb9259f0d5dc944c00a34b3e4a891e0e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124940
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
(cherry picked from commit 0644f44daef7caa8a246221d762fbc0f6af3672c)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124864
Tested-by: Jenkins
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/inc/ChartTypeHelper.hxx | 1 | ||||
-rw-r--r-- | chart2/source/tools/ChartTypeHelper.cxx | 13 | ||||
-rw-r--r-- | chart2/source/view/main/ChartView.cxx | 9 |
3 files changed, 21 insertions, 2 deletions
diff --git a/chart2/source/inc/ChartTypeHelper.hxx b/chart2/source/inc/ChartTypeHelper.hxx index 1a6345321825..d4917be283fb 100644 --- a/chart2/source/inc/ChartTypeHelper.hxx +++ b/chart2/source/inc/ChartTypeHelper.hxx @@ -49,6 +49,7 @@ public: static bool isSupportingDateAxis( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionIndex ); static bool isSupportingComplexCategory( const css::uno::Reference< css::chart2::XChartType >& xChartType ); static bool isSupportingCategoryPositioning( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); + static bool shiftCategoryPosAtXAxisPerDefault( const css::uno::Reference< css::chart2::XChartType >& xChartType ); //returns sequence of css::chart::DataLabelPlacement static css::uno::Sequence < sal_Int32 > getSupportedLabelPlacements( diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx index bb8f965ee199..323e68197969 100644 --- a/chart2/source/tools/ChartTypeHelper.cxx +++ b/chart2/source/tools/ChartTypeHelper.cxx @@ -464,6 +464,19 @@ bool ChartTypeHelper::isSupportingCategoryPositioning( const uno::Reference< cha return false; } +bool ChartTypeHelper::shiftCategoryPosAtXAxisPerDefault( const uno::Reference< chart2::XChartType >& xChartType ) +{ + if(xChartType.is()) + { + OUString aChartTypeName = xChartType->getChartType(); + if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_COLUMN) + || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_BAR) + || aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) ) + return true; + } + return false; +} + bool ChartTypeHelper::noBordersForSimpleScheme( const uno::Reference< chart2::XChartType >& xChartType ) { if(xChartType.is()) diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 698583e477aa..021853b6408f 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -325,7 +325,7 @@ public: void AdaptScaleOfYAxisWithoutAttachedSeries( ChartModel& rModel ); - static bool isCategoryPositionShifted( + bool isCategoryPositionShifted( const chart2::ScaleData& rSourceScale, bool bHasComplexCategories ); private: @@ -350,12 +350,14 @@ private: */ sal_Int32 m_nMaxAxisIndex; + bool m_bChartTypeUsesShiftedCategoryPositionPerDefault; sal_Int32 m_nDefaultDateNumberFormat; }; SeriesPlotterContainer::SeriesPlotterContainer( std::vector< std::unique_ptr<VCoordinateSystem> >& rVCooSysList ) : m_rVCooSysList( rVCooSysList ) , m_nMaxAxisIndex(0) + , m_bChartTypeUsesShiftedCategoryPositionPerDefault(false) , m_nDefaultDateNumberFormat(0) { } @@ -519,6 +521,9 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter( } } + if(nT==0) + m_bChartTypeUsesShiftedCategoryPositionPerDefault = ChartTypeHelper::shiftCategoryPosAtXAxisPerDefault( xChartType ); + bool bExcludingPositioning = DiagramHelper::getDiagramPositioningMode( xDiagram ) == DiagramPositioningMode_EXCLUDING; VSeriesPlotter* pPlotter = VSeriesPlotter::createSeriesPlotter( xChartType, nDimensionCount, bExcludingPositioning ); if( !pPlotter ) @@ -630,7 +635,7 @@ bool SeriesPlotterContainer::isCategoryPositionShifted( const chart2::ScaleData& rSourceScale, bool bHasComplexCategories ) { if (rSourceScale.AxisType == AxisType::CATEGORY) - return bHasComplexCategories || rSourceScale.ShiftedCategoryPosition; + return bHasComplexCategories || rSourceScale.ShiftedCategoryPosition || m_bChartTypeUsesShiftedCategoryPositionPerDefault; if (rSourceScale.AxisType == AxisType::DATE) return rSourceScale.ShiftedCategoryPosition; |