From f547cf17a179ebd7de5c2b4dd2d00d0027a25429 Mon Sep 17 00:00:00 2001 From: Dennis Francis Date: Thu, 2 Sep 2021 14:33:55 +0530 Subject: [API CHANGE] oox: fix import of chart date categories Before this fix, date categories imported in oox's DataSourceContext were stored as formatted strings according to number format code in under the tree. As a result chart2 could not recognize them as dates. This causes problems like: * The axis that is linked to date categories cannot use the scaling/range-selection(min/max)/increments specs mentioned as axis properties. This results in distorted/unreadable chart renders w.r.t the date axis. * No re-formatting is attempted as per the number format provided for axis. This patch introduces a role qualifer argument to the XDataProvider interface method createDataSequenceByValueArray to support categories of date type via this method. When exporting to oox, write date categories and format code under This patch also fixes some discrepancies in date axis interval computation (auto mode) found by already existing unit tests. Change-Id: Ibc53b0a56fdddba80ba452d5567ce98d80460ea7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121525 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- sc/inc/PivotTableDataProvider.hxx | 3 ++- sc/inc/chart2uno.hxx | 3 ++- sc/source/filter/inc/excelchartconverter.hxx | 3 ++- sc/source/filter/oox/excelchartconverter.cxx | 2 +- sc/source/ui/unoobj/PivotTableDataProvider.cxx | 3 ++- sc/source/ui/unoobj/chart2uno.cxx | 3 ++- 6 files changed, 11 insertions(+), 6 deletions(-) (limited to 'sc') diff --git a/sc/inc/PivotTableDataProvider.hxx b/sc/inc/PivotTableDataProvider.hxx index d31b9adb2e02..a1df012ccad1 100644 --- a/sc/inc/PivotTableDataProvider.hxx +++ b/sc/inc/PivotTableDataProvider.hxx @@ -68,7 +68,8 @@ public: createDataSequenceByRangeRepresentation(const OUString& aRangeRepresentation) override; virtual css::uno::Reference SAL_CALL - createDataSequenceByValueArray(const OUString& aRole, const OUString& aRangeRepresentation) override; + createDataSequenceByValueArray(const OUString& aRole, const OUString& aRangeRepresentation, + const OUString& aRoleQualifier) override; virtual css::uno::Reference SAL_CALL getRangeSelection() override; diff --git a/sc/inc/chart2uno.hxx b/sc/inc/chart2uno.hxx index 79c289996cf7..b3d80a6ffe02 100644 --- a/sc/inc/chart2uno.hxx +++ b/sc/inc/chart2uno.hxx @@ -87,7 +87,8 @@ public: const OUString& aRangeRepresentation ) override; virtual css::uno::Reference SAL_CALL - createDataSequenceByValueArray( const OUString& aRole, const OUString& aRangeRepresentation ) override; + createDataSequenceByValueArray( const OUString& aRole, const OUString& aRangeRepresentation, + const OUString& aRoleQualifier ) override; virtual css::uno::Reference< css::sheet::XRangeSelection > SAL_CALL getRangeSelection() override; diff --git a/sc/source/filter/inc/excelchartconverter.hxx b/sc/source/filter/inc/excelchartconverter.hxx index 1d3d58922929..363966a4c023 100644 --- a/sc/source/filter/inc/excelchartconverter.hxx +++ b/sc/source/filter/inc/excelchartconverter.hxx @@ -38,7 +38,8 @@ public: virtual css::uno::Reference createDataSequence( const css::uno::Reference& rxDataProvider, - const oox::drawingml::chart::DataSequenceModel& rDataSeq, const OUString& rRole ) override; + const oox::drawingml::chart::DataSequenceModel& rDataSeq, const OUString& rRole, + const OUString& aRoleQualifier ) override; }; } // namespace oox::xls diff --git a/sc/source/filter/oox/excelchartconverter.cxx b/sc/source/filter/oox/excelchartconverter.cxx index 50695b1fb8f9..bc9a0bd030bf 100644 --- a/sc/source/filter/oox/excelchartconverter.cxx +++ b/sc/source/filter/oox/excelchartconverter.cxx @@ -64,7 +64,7 @@ void ExcelChartConverter::createDataProvider( const Reference< XChartDocument >& Reference< XDataSequence > ExcelChartConverter::createDataSequence( const Reference< XDataProvider >& rxDataProvider, const DataSequenceModel& rDataSeq, - const OUString& /*rRole*/ ) + const OUString& /*rRole*/, const OUString& /*aRoleQualifier*/ ) { Reference< XDataSequence > xDataSeq; if (!rxDataProvider.is()) diff --git a/sc/source/ui/unoobj/PivotTableDataProvider.cxx b/sc/source/ui/unoobj/PivotTableDataProvider.cxx index 2971be908072..c0b96154e0a6 100644 --- a/sc/source/ui/unoobj/PivotTableDataProvider.cxx +++ b/sc/source/ui/unoobj/PivotTableDataProvider.cxx @@ -706,7 +706,8 @@ uno::Reference SAL_CALL uno::Reference SAL_CALL PivotTableDataProvider::createDataSequenceByValueArray(const OUString& /*aRole*/, - const OUString& /*aRangeRepresentation*/) + const OUString& /*aRangeRepresentation*/, + const OUString& /*aRoleQualifier*/) { return uno::Reference(); } diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index d5ed1ad3e892..5efa562cb352 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -2068,7 +2068,8 @@ uno::Reference< chart2::data::XDataSequence > SAL_CALL uno::Reference SAL_CALL ScChart2DataProvider::createDataSequenceByValueArray( - const OUString& /*aRole*/, const OUString& /*aRangeRepresentation*/ ) + const OUString& /*aRole*/, const OUString& /*aRangeRepresentation*/, + const OUString& /*aRoleQualifier*/ ) { return uno::Reference(); } -- cgit