summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chart2/qa/extras/chart2export.cxx11
-rw-r--r--chart2/qa/extras/data/ods/test_CrossBetween.odsbin12365 -> 0 bytes
-rw-r--r--chart2/source/model/template/ChartTypeTemplate.cxx9
-rw-r--r--chart2/source/tools/AxisHelper.cxx2
-rw-r--r--chart2/source/view/main/ChartView.cxx17
-rw-r--r--oox/source/drawingml/chart/axisconverter.cxx2
6 files changed, 16 insertions, 25 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index cb9e4aa32df3..b1441268b31a 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -127,7 +127,6 @@ public:
void testCombinedChartSecondaryAxisODS();
void testCrossBetweenXLSX();
void testCrossBetweenWithDeletedAxis();
- void testCrossBetweenODS();
void testAxisTitleRotationXLSX();
void testAxisTitlePositionDOCX();
void testAxisCrossBetweenXSLX();
@@ -243,7 +242,6 @@ public:
CPPUNIT_TEST(testCombinedChartSecondaryAxisODS);
CPPUNIT_TEST(testCrossBetweenXLSX);
CPPUNIT_TEST(testCrossBetweenWithDeletedAxis);
- CPPUNIT_TEST(testCrossBetweenODS);
CPPUNIT_TEST(testAxisTitleRotationXLSX);
CPPUNIT_TEST(testAxisTitlePositionDOCX);
CPPUNIT_TEST(testAxisCrossBetweenXSLX);
@@ -2013,15 +2011,6 @@ void Chart2ExportTest::testCrossBetweenWithDeletedAxis()
assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx/c:crossBetween", "val", "between");
}
-void Chart2ExportTest::testCrossBetweenODS()
-{
- // Original file was created with LibreOffice
- load("/chart2/qa/extras/data/ods/", "test_CrossBetween.ods");
- xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
- CPPUNIT_ASSERT(pXmlDoc);
- assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:valAx/c:crossBetween", "val", "between");
-}
-
void Chart2ExportTest::testAxisTitleRotationXLSX()
{
load("/chart2/qa/extras/data/xlsx/", "axis_title_rotation.xlsx");
diff --git a/chart2/qa/extras/data/ods/test_CrossBetween.ods b/chart2/qa/extras/data/ods/test_CrossBetween.ods
deleted file mode 100644
index e59546b3d0cd..000000000000
--- a/chart2/qa/extras/data/ods/test_CrossBetween.ods
+++ /dev/null
Binary files differ
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);
}
diff --git a/oox/source/drawingml/chart/axisconverter.cxx b/oox/source/drawingml/chart/axisconverter.cxx
index 86764b241e52..f0e65035dd7c 100644
--- a/oox/source/drawingml/chart/axisconverter.cxx
+++ b/oox/source/drawingml/chart/axisconverter.cxx
@@ -233,6 +233,8 @@ void AxisConverter::convertFromModel(
case API_Y_AXIS:
OSL_ENSURE( mrModel.mnTypeId == C_TOKEN( valAx ), "AxisConverter::convertFromModel - unexpected axis model type (must: c:valAx)" );
aScaleData.AxisType = isPercent(rTypeGroups) ? cssc2::AxisType::PERCENT : cssc2::AxisType::REALNUMBER;
+ if( mrModel.mnCrossBetween != -1 )
+ aScaleData.ShiftedCategoryPosition = mrModel.mnCrossBetween == XML_between;
break;
case API_Z_AXIS:
OSL_ENSURE( mrModel.mnTypeId == C_TOKEN( serAx ), "AxisConverter::convertFromModel - unexpected axis model type (must: c:serAx)" );