summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorAndras Timar <andras.timar@collabora.com>2021-11-09 23:36:32 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2021-11-15 12:37:02 +0100
commit80ada110c56398e984d3f2d1f0ae1f30e8a73690 (patch)
tree376a1830edecfa6068628f9139ad1c42cbd7890c /chart2
parentac3c1de61e7cf069d3022907570832130235fa32 (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> (cherry picked from commit 453363ae1384a6d6f2c77052170b39a1ebf567a6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124970 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/inc/ChartTypeHelper.hxx1
-rw-r--r--chart2/source/tools/ChartTypeHelper.cxx13
-rw-r--r--chart2/source/view/main/ChartView.cxx9
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 a4b8059ffb19..a260636a0604 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 f6642c920968..5cfee64f0641 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -323,7 +323,7 @@ public:
void AdaptScaleOfYAxisWithoutAttachedSeries( ChartModel& rModel );
- static bool isCategoryPositionShifted(
+ bool isCategoryPositionShifted(
const chart2::ScaleData& rSourceScale, bool bHasComplexCategories );
private:
@@ -348,12 +348,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)
{
}
@@ -517,6 +519,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 )
@@ -628,7 +633,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;