summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2020-04-17 14:12:00 +0200
committerLászló Németh <nemeth@numbertext.org>2020-05-05 09:17:22 +0200
commit778a81c114187b193140ebe816eec0805f40b6ab (patch)
tree05df5efb083410743f6875efe81428c4335c69cd /oox
parent62ba3248f654febe55fdf422163fff76552e9c32 (diff)
tdf#132486 Chart: fix OOXML export of ShiftedCategoryPosition
Regression from commit 75156c6fd73dc202df541306e1636727d51d6fc3 (tdf#132076 Chart OOXML: fix lost date format of X axis) Change-Id: I4bb62959775b0b6ed11e1f7e5473c3b9805f4e29 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92420 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/chartexport.cxx37
1 files changed, 13 insertions, 24 deletions
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 556e8a8a5958..211b5b456438 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -219,46 +219,37 @@ static bool lcl_hasCategoryLabels( const Reference< chart2::XChartDocument >& xC
return xCategories.is();
}
-static bool lcl_isCategoryAxisShifted(const Reference< chart2::XChartDocument >& xChartDoc)
+static bool lcl_isCategoryAxisShifted( const Reference< chart2::XDiagram >& xDiagram )
{
- Reference< chart2::XDiagram > xDiagram(xChartDoc->getFirstDiagram());
- bool isCategoryPositionShifted = false;
-
+ bool bCategoryPositionShifted = false;
try
{
Reference< chart2::XCoordinateSystemContainer > xCooSysCnt(
xDiagram, uno::UNO_QUERY_THROW);
const Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq(
xCooSysCnt->getCoordinateSystems());
- for( const auto& xCooSys : aCooSysSeq )
+ for (const auto& xCooSys : aCooSysSeq)
{
OSL_ASSERT(xCooSys.is());
- for( sal_Int32 nN = xCooSys->getDimension(); nN--; )
+ if( 0 < xCooSys->getDimension() && 0 <= xCooSys->getMaximumAxisIndexByDimension(0) )
{
- const sal_Int32 nMaxAxisIndex = xCooSys->getMaximumAxisIndexByDimension(nN);
- for( sal_Int32 nI = 0; nI <= nMaxAxisIndex; ++nI )
+ Reference< chart2::XAxis > xAxis = xCooSys->getAxisByDimension(0, 0);
+ OSL_ASSERT(xAxis.is());
+ if (xAxis.is())
{
- Reference< chart2::XAxis > xAxis = xCooSys->getAxisByDimension(nN, nI);
- OSL_ASSERT(xAxis.is());
- if( xAxis.is())
- {
- chart2::ScaleData aScaleData = xAxis->getScaleData();
- if( aScaleData.AxisType == AXIS_PRIMARY_Y )
- {
- isCategoryPositionShifted = aScaleData.ShiftedCategoryPosition;
- break;
- }
- }
+ chart2::ScaleData aScaleData = xAxis->getScaleData();
+ bCategoryPositionShifted = aScaleData.ShiftedCategoryPosition;
+ break;
}
}
}
}
- catch (const uno::Exception &)
+ catch (const uno::Exception&)
{
DBG_UNHANDLED_EXCEPTION("oox");
}
- return isCategoryPositionShifted;
+ return bCategoryPositionShifted;
}
static sal_Int32 lcl_getCategoryAxisType( const Reference< chart2::XDiagram >& xDiagram, sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex )
@@ -447,7 +438,6 @@ ChartExport::ChartExport( sal_Int32 nXmlNamespace, FSHelperPtr pFS, Reference< f
, mxChartModel( xModel )
, mpURLTransformer(std::make_shared<URLTransformer>())
, mbHasCategoryLabels( false )
- , mbIsCategoryPositionShifted( false )
, mbHasZAxis( false )
, mbIs3DChart( false )
, mbStacked(false)
@@ -805,7 +795,6 @@ void ChartExport::InitRangeSegmentationProperties( const Reference< chart2::XCha
if( xDataProvider.is())
{
mbHasCategoryLabels = lcl_hasCategoryLabels( xChartDoc );
- mbIsCategoryPositionShifted = lcl_isCategoryAxisShifted( xChartDoc );
}
}
catch( const uno::Exception & )
@@ -3095,7 +3084,7 @@ void ChartExport::_exportAxis(
// crossBetween
if( nAxisType == XML_valAx )
{
- if( mbIsCategoryPositionShifted )
+ if( lcl_isCategoryAxisShifted( mxNewDiagram ))
pFS->singleElement(FSNS(XML_c, XML_crossBetween), XML_val, "between");
else
pFS->singleElement(FSNS(XML_c, XML_crossBetween), XML_val, "midCat");