Bug 141892 - The type of an embedded chart in Writer is missing
Summary: The type of an embedded chart in Writer is missing
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.1.2.2 release
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:24.2.0
Keywords: bibisected, bisected, regression
: 146982 (view as bug list)
Depends on:
Blocks: Chart
  Show dependency treegraph
 
Reported: 2021-04-25 12:07 UTC by Naruhiko Ogasawara
Modified: 2023-10-17 11:18 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
The ODT file to reproduce (16.85 KB, application/vnd.oasis.opendocument.text)
2021-04-25 12:07 UTC, Naruhiko Ogasawara
Details
console logs (30.94 KB, text/plain)
2021-04-25 12:24 UTC, Julien Nabet
Details
The example file resaved in LO 7.0 (20.17 KB, application/vnd.oasis.opendocument.text)
2021-04-26 19:00 UTC, NISZ LibreOffice Team
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Naruhiko Ogasawara 2021-04-25 12:07:50 UTC
Created attachment 171401 [details]
The ODT file to reproduce

The attached document was generated our own Java code powered by jOpenDocument[1] ODF operation library.  It has an embedded chart that has "Net - Point and Lines" type, but since LibO 7.1, the type information is gone when loading.  With 7.0 or earlier, it can be opened without issue.

Step 1. Load an attached ODF (1.2 extended)
Step 2. See the chart area

Expected: can see the "Net - Point and Lines" type chart.
Actual: there is a blank chart, but changing the chart type to "Net - Point and Lines," it seems well.


NOTE: ODFValidator claims 'element "draw:image" is missing "type" attribute,' so I think it might be a problem with jOpenDocument.  But LibO versions prior to 7.0 were able to read it fine. So if possible, please make it readable in 7.1 and later.


[1] http://www.jopendocument.org/
we know it's so old library (the latest release was in 2014) but our several tools still depend on it deeply and could not switch others at this time.
Comment 1 Julien Nabet 2021-04-25 12:24:25 UTC
Created attachment 171402 [details]
console logs

On pc Debian x86-64 with master sources updated today, I could reproduce this.
I attached console logs, the most interesting seems to be these ones:
warn:xmloff.chart:40869:40869:xmloff/source/chart/SchXMLChartContext.cxx:399: need a charttype to create a diagram
warn:legacy.osl:40869:40869:sw/source/core/unocore/unochart.cxx:978: XLabeledDataSequence in data source contains 0 entries
warn:legacy.osl:40869:40869:sw/source/core/unocore/unochart.cxx:978: XLabeledDataSequence in data source contains 0 entries
Comment 2 NISZ LibreOffice Team 2021-04-26 18:54:17 UTC
Bibisected to:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=574eec9036c5f185b3572ba1e0ca9d111eb361dc

author	Mike Kaganski <mike.kaganski@collabora.com>	2020-09-12 17:22:23 +0300
committer	Mike Kaganski <mike.kaganski@collabora.com>	2020-09-15 06:09:04 +0200

tdf#77007: chart must honor its parent's IsEnableSetModified

Adding CC to: Mike Kaganski
Comment 3 NISZ LibreOffice Team 2021-04-26 19:00:34 UTC
Created attachment 171433 [details]
The example file resaved in LO 7.0

It might be argued that the external generator is buggy.

Saving the example file in LO 7.0 makes it open just fine in 7.1.
Comment 4 Julien Nabet 2021-04-26 20:20:56 UTC
I confirm I see "RaderChart" with "alpha", "bravo", "charlie" when commenting block:
// tdf#77007: honor parent's IsEnableSetModified
// Check it before LifeTimeGuard, to avoid deadlocking solar mutex and this guard
if (auto pParentShell = SfxObjectShell::GetShellFromComponent(getParent());
    pParentShell && !pParentShell->IsEnableSetModified())
    return;
Comment 5 Julien Nabet 2021-04-26 20:29:00 UTC
I noticed that even when reverting part of a patch and having the chart, I still see these logs:
warn:xmloff:92890:92890:xmloff/source/chart/SchXMLChartContext.cxx:388: unknown attribute http://www.w3.org/1999/xlink xlink:type value=simple
warn:xmloff.chart:92890:92890:xmloff/source/chart/SchXMLChartContext.cxx:399: need a charttype to create a diagram
warn:legacy.osl:92890:92890:sw/source/core/unocore/unochart.cxx:978: XLabeledDataSequence in data source contains 0 entries
warn:legacy.osl:92890:92890:sw/source/core/unocore/unochart.cxx:978: XLabeledDataSequence in data source contains 0 entries
Comment 6 NISZ LibreOffice Team 2021-04-27 06:58:56 UTC
bug #141914 was bibisected to the same source commit, but this problem still persists even after the recent fix to that in todays nightly:

Version: 7.2.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: eeb2854e085fdd9f7a38d6e952a8aedf43e90323
CPU threads: 4; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win
Locale: hu-HU (hu_HU); UI: en-US
Calc: CL
Comment 7 Julien Nabet 2021-04-27 07:05:45 UTC
(In reply to NISZ LibreOffice Team from comment #6)
> bug #141914 was bibisected to the same source commit, but this problem still
> persists even after the recent fix to that in todays nightly:
> ...

I also gave a try, I confirm too.
But at the same time, it's not as if Mike had indicated the patch would also fix this one so it could be expected.
Comment 8 Mike Kaganski 2021-04-27 08:54:56 UTC
This is not a problem of an invalid format (the issue reported by ODF validator is unrelated). This is about the placement of the object's document stream.

The generator puts chart's <office:document> as a child of <draw:object> right inside content.xml (absolutely valid case). When re-saved from v.7.0, the chart is placed into its own *.xml under Object N subdirectory inside the ODF package. This changes the moment when the chart's XML is read to after the full document model creation, and at that case, the document already allows setting modified flag.

This problem may also be reproduced with any chart in a text document, even generated by 7.1, if you save it as FODT - which uses the same <office:document> directly in <draw:object> approach.

It seems that current import code abuses some side effect of setting the object modified, where that side effect makes additional changes somewhere in the chart's model; while that change in the model should be made explicitly at some point of reading the XML. I don't know which property is that.
Comment 9 NISZ LibreOffice Team 2021-05-05 11:17:04 UTC
attachment 118190 [details] from bug 93676 is a good example for the fodt with disappearing chart after:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=574eec9036c5f185b3572ba1e0ca9d111eb361dc

tdf#77007: chart must honor its parent's IsEnableSetModified
Comment 10 Mike Kaganski 2022-01-25 14:42:30 UTC
*** Bug 146982 has been marked as a duplicate of this bug. ***
Comment 11 Mike Kaganski 2023-10-16 16:23:33 UTC
https://gerrit.libreoffice.org/c/core/+/158051
Comment 12 Commit Notification 2023-10-16 16:28:42 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/f26bf09a0e93449ea85269a09a8a073a20903349

tdf#141892: Set chart view to dirty state after loading

It will be available in 24.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 13 Julien Nabet 2023-10-16 19:22:38 UTC
On pc Debian x86-64 with master sources updated today, I don't know if it's completely ok but I got a chart! :-)

On console, I noticed these kinds of logs:
warn:xmloff:9474:9474:xmloff/source/text/XMLTextListAutoStylePool.cxx:163: getStyleFamilies() from XModel failed for export!
warn:xmloff.chart:9474:9474:xmloff/source/chart/SchXMLExport.cxx:3978: No DataProvider
warn:chart2.tools:9474:9474:chart2/source/tools/WrappedPropertySet.cxx:137: found no inner property set to map to
warn:legacy.osl:9474:9474:xmloff/source/style/xmlexppr.cxx:856: special item not handled in xml export
warn:xmloff:9474:9474:xmloff/source/chart/SchXMLChartContext.cxx:392: unknown attribute http://www.w3.org/1999/xlink xlink:type value=simple
warn:legacy.osl:9474:9474:sw/source/core/unocore/unochart.cxx:972: XLabeledDataSequence in data source contains 0 entries

but perhaps unrelated.
Comment 14 Naruhiko Ogasawara 2023-10-17 10:02:40 UTC
I also confirmed that the issue was fixed with:

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 2247b00230e479e63ab996d4e1694b1d74aeba81
CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: Skia/Vulkan; VCL: win
Locale: ja-JP (ja_JP); UI: ja-JP
Calc: CL threaded
Comment 15 Julien Nabet 2023-10-17 11:18:45 UTC
(In reply to Naruhiko Ogasawara from comment #14)
> I also confirmed that the issue was fixed with:
Thank you for the feedback.
Let's put this one to VERIFIED then.