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 --- chart2/qa/extras/chart2dump/chart2dump.cxx | 1 + .../qa/extras/chart2dump/data/date-categories.pptx | Bin 0 -> 41931 bytes .../reference/axislabeltest/date-categories.txt | 180 +++++++++++++++++++++ 3 files changed, 181 insertions(+) create mode 100644 chart2/qa/extras/chart2dump/data/date-categories.pptx create mode 100644 chart2/qa/extras/chart2dump/reference/axislabeltest/date-categories.txt (limited to 'chart2/qa/extras/chart2dump') diff --git a/chart2/qa/extras/chart2dump/chart2dump.cxx b/chart2/qa/extras/chart2dump/chart2dump.cxx index 28768ca68957..fc3944f494e3 100644 --- a/chart2/qa/extras/chart2dump/chart2dump.cxx +++ b/chart2/qa/extras/chart2dump/chart2dump.cxx @@ -616,6 +616,7 @@ DECLARE_DUMP_TEST(AxisLabelTest, Chart2DumpTest, false) "formated_axis_labels.odp", "percent_stacked_column_chart.odp", "tdf118150.xlsx", + "date-categories.pptx", }; for (const OUString& sTestFile : aTestFiles) diff --git a/chart2/qa/extras/chart2dump/data/date-categories.pptx b/chart2/qa/extras/chart2dump/data/date-categories.pptx new file mode 100644 index 000000000000..b9e0c69f32b7 Binary files /dev/null and b/chart2/qa/extras/chart2dump/data/date-categories.pptx differ diff --git a/chart2/qa/extras/chart2dump/reference/axislabeltest/date-categories.txt b/chart2/qa/extras/chart2dump/reference/axislabeltest/date-categories.txt new file mode 100644 index 000000000000..a9274fd7838a --- /dev/null +++ b/chart2/qa/extras/chart2dump/reference/axislabeltest/date-categories.txt @@ -0,0 +1,180 @@ +/// CID/D=0:CS=0:Axis=0,0 +// nAxisLabelsCount +22 +// xLabel->getString() +15/Jun/21 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +17/Jun/21 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +19/Jun/21 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +21/Jun/21 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +23/Jun/21 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +25/Jun/21 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +27/Jun/21 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +29/Jun/21 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +1/Jul/21 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +3/Jul/21 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +5/Jul/21 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +7/Jul/21 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +9/Jul/21 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +11/Jul/21 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +13/Jul/21 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +15/Jul/21 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +17/Jul/21 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +19/Jul/21 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +21/Jul/21 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +23/Jul/21 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +25/Jul/21 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +27/Jul/21 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +/// CID/D=0:CS=0:Axis=1,0 +// nAxisLabelsCount +7 +// xLabel->getString() +0 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +20 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +40 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +60 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +80 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +100 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 +// xLabel->getString() +120 +// static_cast(aLabelFontColor) +5855577 +// fLabelFontHeight +9 -- cgit