Bug 131862 - ODF: Remove deprecated attribute table:cell-range-address from element <chart:plot-area>
Summary: ODF: Remove deprecated attribute table:cell-range-address from element <chart...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Chart (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: odf target:25.2.0
Keywords: difficultyInteresting, easyHack, skillCpp, topicCleanup
Depends on:
Blocks: Chart ODF-export-invalid ODF-1.4-Support
  Show dependency treegraph
 
Reported: 2020-04-03 21:45 UTC by Regina Henschel
Modified: 2024-11-27 16:38 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2020-04-03 21:45:38 UTC
ODF 1.2 has deprecated the table:call-range-address as attribute of element <chart:plot-area>. Instead the attribute chart:values-cell-range-address of <chart:series> is used.
http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#attribute-table_cell-range-address_element-chart_plot-area

The use of this attribute with element <chart:plot-area> will be removed in ODF 1.4. Therefore it is time to change LibreOffice accordingly.


I have made some tests with charts in Writer, Calc, Impress and Draw. I have generated a chart, then removed the attribute in file, and then reopened the file. In all my tests, the chart was the same as created. So it should be no problem to remove writing that attribute for ODF 1.4.

I could not test charts in reports (REPORTBUILDER) because of crashes. The REPORTBUILDER seem to have severe problems with charts, see bug 117162, bug 117159, bug 87012 for example.

I have looked at Pivot-Charts too. They have principle ODF related errors in cell addresses and need rework anyway, see bug 112785 and bug 112783.

Old OOo versions use this attribute to distinguish between the cases, that the data source is the internal table of the chart, or the chart has an external data source. I have seen comments on this. So it might be, that import/export filter for these old versions still need to treat this attribute.
Comment 1 Michael Stahl (allotropia) 2020-04-06 11:13:45 UTC
i can't find any recent changes to xmloff that would be relevant, it looks much like it did in 2008.

reportdesign has this fun code:

reportdesign/source/filter/xml/xmlExportDocumentHandler.cxx
    else if ( _sName == "chart:plot-area" )
    {
        SvXMLAttributeList* pList = comphelper::getUnoTunnelImplementation<SvXMLAttributeList>(xAttribs);
        pList->RemoveAttribute("table:cell-range-address");
    }
Comment 2 QA Administrators 2022-06-02 03:33:52 UTC Comment hidden (obsolete)
Comment 3 Regina Henschel 2022-06-02 10:00:48 UTC
The task is still not solved in Version: 7.4.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 172e208e6b0674f42c301c5ee5e280e9138ba1b4
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL
Comment 4 QA Administrators 2024-06-02 03:14:25 UTC Comment hidden (obsolete)
Comment 5 Regina Henschel 2024-06-02 13:44:27 UTC
The task is still not solved in Version: 24.8.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: fbe57382eef1138999f63e01b6152d4d05749807
CPU threads: 32; OS: Windows 11 X86_64 (10.0 build 22631); UI render: default; VCL: win
Locale: de-DE (de_DE); UI: en-US
Calc: threaded
Comment 6 Regina Henschel 2024-07-24 16:30:37 UTC
The import of this attribute happens in
https://opengrok.libreoffice.org/xref/core/xmloff/source/chart/SchXMLPlotAreaContext.cxx?r=12008e10#231

The export of this attribute happens in
https://opengrok.libreoffice.org/xref/core/xmloff/source/chart/SchXMLExport.cxx?r=12008e10#1951

The latter file has some examples how to restrict saving to a special version. Look for SvtSaveOptions in the file.

Searching for "xml_cell_range_address" in OpenGrog gives many unsuitable results, because the attribute is not only uses for element <chart:plot-area> but for a lot of other elements too, see https://docs.oasis-open.org/office/OpenDocument/v1.3/os/part3-schema/OpenDocument-v1.3-os-part3-schema.html#__RefHeading__1418294_253892949

Perhaps it is an easyHack. Because report builder and Pivot-Charts might be affected too, I think it is not a "Beginner" easyHack.
Comment 7 Regina Henschel 2024-11-14 20:03:19 UTC
PivotCharts use the table:cell-range-address attribute for a purpose, that is unrelated to its meaning in older OOo version and that is not ODF conform at all, see bug 112783.
Comment 8 Regina Henschel 2024-11-18 16:58:53 UTC
Simply not writing the attribute does not work. Then the unit test fails:
chart2/qa/extras/uichart.cxx(70) : error : Assertion
Test name: testTdf136011::TestBody
equality assertion failed
- Expected: A
- Actual  : B
- Incorrect description in column: 0

The reason is not obvious. It seem so be somewhere in ScChart2DataProvider::detectArguments in chart2uno.cxx.
Comment 9 Commit Notification 2024-11-27 16:11:14 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/7cec59402d09077749cc6bbe96cbf19652d2d3d9

tdf#131862 No table:cell-range-address in ODF 1.4

It will be available in 25.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Regina Henschel 2024-11-27 16:38:16 UTC
To verify:
A) Open a chart produced in older version and save it in ODF 1.4.
B) Save a document with chart in ODF 1.4 and reopen it. The chart should not have changed.
C) Copy a chart from Calc to Impress or Draw. The visual appearance should be the same, only that the copy has the data in an internal table.
D) Do A)-C) not only with simple charts but with multi-level categories and changed order of data series.

In all cases, there must not exist table:cell-range-address as attribute of the <chart:plot-area> element in file format, when saved in ODF 1.4. The attribute may exist in other elements.


The reason for the unit test failure mentioned in comment 8 is, that copying to clipboard had created an erroneous order of series, if only the attribute table:cell-range-address is no longer written. The solution in the patch is to not only omit table:cell-range-address attribute but also the related and already deprecated attributes chart:data-source-has-labels, chart:column-mapping and chart:row-mapping.