diff options
Diffstat (limited to 'chart2/source')
-rw-r--r-- | chart2/source/model/template/ChartTypeTemplate.cxx | 9 | ||||
-rw-r--r-- | chart2/source/tools/AxisHelper.cxx | 2 | ||||
-rw-r--r-- | chart2/source/view/main/ChartView.cxx | 17 |
3 files changed, 14 insertions, 14 deletions
diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx index afd9eb0f048a..03a12a13a5a2 100644 --- a/chart2/source/model/template/ChartTypeTemplate.cxx +++ b/chart2/source/model/template/ChartTypeTemplate.cxx @@ -623,14 +623,7 @@ void ChartTypeTemplate::adaptScales( aData.Categories = xCategories; if(bSupportsCategories) { - Reference< XChartType > xChartType(getChartTypeForNewSeries(Sequence< Reference< XChartType > >())); - if( aData.AxisType == AxisType::CATEGORY ) - { - if( !m_aServiceName.endsWith("ColumnWithLine") ) - aData.ShiftedCategoryPosition = ::chart::ChartTypeHelper::shiftCategoryPosAtXAxisPerDefault(xChartType); - else - aData.ShiftedCategoryPosition = true; - } + Reference< XChartType > xChartType( getChartTypeForNewSeries(Sequence< Reference< XChartType > >() )); bool bSupportsDates = ::chart::ChartTypeHelper::isSupportingDateAxis( xChartType, nDimensionX ); if( aData.AxisType != AxisType::CATEGORY && ( aData.AxisType != AxisType::DATE || !bSupportsDates) ) { diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index 6ec3d44f48d4..25d481bff352 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -73,7 +73,7 @@ ScaleData AxisHelper::createDefaultScale() ScaleData aScaleData; aScaleData.AxisType = chart2::AxisType::REALNUMBER; aScaleData.AutoDateAxis = true; - aScaleData.ShiftedCategoryPosition = false; + aScaleData.ShiftedCategoryPosition = false;//this is adapted in the view code currently Sequence< SubIncrement > aSubIncrements(1); aSubIncrements[0] = SubIncrement(); aScaleData.IncrementData.SubIncrements = aSubIncrements; diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index f0f84a9783f2..0468ecf78642 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -324,8 +324,8 @@ public: void AdaptScaleOfYAxisWithoutAttachedSeries( ChartModel& rModel ); - static bool isCategoryPositionShifted( - const chart2::ScaleData& rSourceScale, bool bHasComplexCategories ); + bool isCategoryPositionShifted( + const chart2::ScaleData& rSourceScale, bool bHasComplexCategories, bool bShiftedCategoryPosition) const; private: /** A vector of series plotters. @@ -349,12 +349,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) { } @@ -518,6 +520,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 ) @@ -626,9 +631,9 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter( } bool SeriesPlotterContainer::isCategoryPositionShifted( - const chart2::ScaleData& rSourceScale, bool bHasComplexCategories ) + const chart2::ScaleData& rSourceScale, bool bHasComplexCategories, bool bShiftedCategoryPosition) const { - if (rSourceScale.AxisType == AxisType::CATEGORY && rSourceScale.ShiftedCategoryPosition) + if (rSourceScale.AxisType == AxisType::CATEGORY && (m_bChartTypeUsesShiftedCategoryPositionPerDefault || bShiftedCategoryPosition)) return true; if (rSourceScale.AxisType == AxisType::CATEGORY && bHasComplexCategories) @@ -679,7 +684,9 @@ void SeriesPlotterContainer::initAxisUsageList(const Date& rNullDate) AxisHelper::checkDateAxis( aSourceScale, pCatProvider, bDateAxisAllowed ); bool bHasComplexCat = pCatProvider && pCatProvider->hasComplexCategories() && bComplexCategoryAllowed; - aSourceScale.ShiftedCategoryPosition = isCategoryPositionShifted(aSourceScale, bHasComplexCat); + // Come from CrossBetween OOXML tag + bool bShiftedCategoryPosition = aSourceScale.ShiftedCategoryPosition; + aSourceScale.ShiftedCategoryPosition = isCategoryPositionShifted(aSourceScale, bHasComplexCat, bShiftedCategoryPosition); m_aAxisUsageList[xAxis].aAutoScaling = ScaleAutomatism(aSourceScale, rNullDate); } |