Bug 112785 - svg:desc not suitable for a table cell identifier
Summary: svg:desc not suitable for a table cell identifier
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Chart (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: lowest enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:odf
Depends on:
Blocks: Chart ODF-spec
  Show dependency treegraph
 
Reported: 2017-09-30 18:13 UTC by Regina Henschel
Modified: 2024-11-14 23:59 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
sheet with pivot table and pivot chart (18.96 KB, application/vnd.oasis.opendocument.spreadsheet)
2017-09-30 18:13 UTC, Regina Henschel
Details
minimal sample chart created with OOo 3.3 (11.89 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-11-06 10:10 UTC, Stéphane Guillou (stragu)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2017-09-30 18:13:23 UTC
Created attachment 136654 [details]
sheet with pivot table and pivot chart

The current solution of pivot charts uses e.g the structure
<table:table-cell office:value-type="float" office:value="NaN">
    <text:p>NaN</text:p>
    <draw:g>
        <svg:desc>PT@data 0</svg:desc>
    </draw:g>
</table:table-cell>

to define an identifier for the cell, that will be used in a cell reference.

This structure gives no formal error, but I will surely not support the idea of miss-using a description of a graphical element as identifier for a table-cell.

There exists more suitable solutions.
Currently possible is
attribute xml:id
or
as part of the entire table the element
<table:named-expressions> with its child element <table:named-range>.

This problem should be solved together with bug 112783.
Comment 1 Regina Henschel 2017-09-30 18:25:00 UTC
I see, that problem has come in earlier and is not specific for pivot charts.
Comment 2 Regina Henschel 2017-10-01 21:04:12 UTC
It is already there in LO 3.5.1, but not in AOO 4.1.2. It is not clear, why it was introduced. LibreOffice can handle the chart without having that elements.
Comment 3 Buovjaga 2017-11-02 17:24:03 UTC
Setting to NEW
Comment 4 Stéphane Guillou (stragu) 2023-11-06 00:27:16 UTC
(In reply to Regina Henschel from comment #2)
> It is already there in LO 3.5.1, but not in AOO 4.1.2.
But Pivot Chart were introduced in 5.4 for bug 83257, so why are earlier versions relevant?

Quikee, any thoughts on why it was done this way?
Comment 5 Tomaz Vajngerl 2023-11-06 06:11:42 UTC
(In reply to Stéphane Guillou (stragu) from comment #4)
> (In reply to Regina Henschel from comment #2)
> > It is already there in LO 3.5.1, but not in AOO 4.1.2.
> But Pivot Chart were introduced in 5.4 for bug 83257, so why are earlier
> versions relevant?

I think Regina just noticed that Pivot Charts are not related to this issue and that the issue was present even before Pivot Chart introduction. 
 
> Quikee, any thoughts on why it was done this way?

Not sure, it's not related to Pivot Charts I think, but I do vaguely remember that element. Maybe it is because "draw:g" (group) is similar to svg's (svg:g), somebody thought "svg:desc" would be a good element to add for some purpuse.

Also, I wonder if Pivot Charts were even implemented for ODS..
Comment 6 Stéphane Guillou (stragu) 2023-11-06 10:07:12 UTC
(In reply to Tomaz Vajngerl from comment #5)
> I think Regina just noticed that Pivot Charts are not related to this issue
> and that the issue was present even before Pivot Chart introduction. 
Ah right, thank you. Sorry Regina, I missed comment 1 entirely.
Now I see it, even for a simple chart created in OOo 3.3, no need to involve pivot tables or pivot charts.
Comment 7 Stéphane Guillou (stragu) 2023-11-06 10:10:13 UTC
Created attachment 190670 [details]
minimal sample chart created with OOo 3.3

After unpacking the ODS, Object 1 > content.xml contains:

<table:table-cell office:value-type="float" office:value="1">
   <text:p>1</text:p>
   <draw:g>
      <svg:desc>Sheet1.A1:Sheet1.A3</svg:desc>
   </draw:g>
</table:table-cell>

Same if created with recent trunk build:

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 31fb3045dabdb27d913712f3abcade315e3ea9bd
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded
Comment 8 Xisco Faulí 2024-10-01 08:47:39 UTC
Hi Regina,
If I do the following change as you suggested in the description:

--- a/xmloff/source/chart/SchXMLTools.cxx
+++ b/xmloff/source/chart/SchXMLTools.cxx
@@ -715,8 +715,8 @@ void exportRangeToSomewhere( SvXMLExport& rExport, const OUString& rValue )
     SvXMLElementExport aEmptyShapeGroup( rExport, XML_NAMESPACE_DRAW,
                               ::xmloff::token::GetXMLToken( ::xmloff::token::XML_G ),
                               true, false );
-    SvXMLElementExport aDescription( rExport, XML_NAMESPACE_SVG,
-                              ::xmloff::token::GetXMLToken( ::xmloff::token::XML_DESC ),
+    SvXMLElementExport aDescription( rExport, XML_NAMESPACE_XML,
+                              ::xmloff::token::GetXMLToken( ::xmloff::token::XML_ID ),
                               true, false );
     rExport.GetDocHandler()->characters( rValue );
 }

some tests start to fail with

Test name: PivotChartTest::testRoundtrip
forced failure
- /tmp/lu2932261icabs.tmp/Object 1/content.xml[2,6426]:  Error: tag name "xml:id" is not allowed. Possible tag names are: <a>,<caption>,<circle>,<connector>,<control>,<custom-shape>,<desc>,<ellipse>,<event-listeners>,<frame>,<g>,<glue-point>,<line>,<measure>,<page-thumbnail>,<path>,<polygon>,<polyline>,<rect>,<regular-polygon>,<scene>,<title>
><text:p>Total</text:p><draw:g><xml:id>PT@label 0</xml:id></draw:g></table:tabl
Comment 9 Regina Henschel 2024-10-01 15:26:55 UTC
xml:id is not an element but an attribute. It could be set as attribute on the empty group element, which currently contains the <svg:desc> child element.

But I don't know in what context the embedded table is used at all and where the <svg:desc> element is currently evaluated.

My concern about the <svg:desc> element is, that its specification says,
"The <svg:desc> element specifies a prose description of a graphic object that may be used to support accessibility."
(10.3.18 <svg:desc>, part 3, ODF 1.3)

And this description does not fit to its use in the embedded table in the chart.

We might need a total different attribute/element for the intended purpose.