Bug 151100 - Table in a shape in a header is lost on ODT export
Summary: Table in a shape in a header is lost on ODT export
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:7.5.0 target:7.4.2 target:7.3.7
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-21 08:08 UTC by Mike Kaganski
Modified: 2023-01-24 14:27 UTC (History)
2 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 Mike Kaganski 2022-09-21 08:08:51 UTC
As Caolán McNamara noted in bug 150927 comment #8:
> https://bugs.documentfoundation.org/attachment.cgi?id=148210 (from bug
> 122628) ... asserts on export to odt

This started to assert after commit 5a9fe1d80ea977c439dd10ee2056abe6b0cb4d07
  Date Fri Jul 29 17:00:14 2022 +0200
    tdf#145226 sw: ODF export: fix table-row/table-cell styles

but was thought to be related to commit 35021cd56b3b4e38035804087f215c80085564be
  Date Wed Aug 5 11:16:32 2020 +0300
    tdf#124470: Split export of table autostyles out from collection phase

However, it is obviously a pre-existing problem, since saving the mentioned file using 7.0.0 (i.e., prior to the latter commit) drops the table in the shape in the header of the first page.

The code that prevents collection respective autostyles necessary for export of the table in the header is in XMLShapeExport::collectShapeAutoStyles, where it skips the block when xText is "empty".

The respective skip appeared in commit 73fcb052edf1a21d785583bc53e8b4323b577bb1
  Date Thu Nov 22 12:26:35 2001 +0000
    #90330# only export text autostyles for shapes with text

and was later relaxed by commit 7661bbbaef31adfdb298b1447301b24a70f85834
  Date Fri Nov 25 22:46:34 2016 +0100
    tdf#102479 ODF export: ignore exceptions when checking shape text

that obviously handled a similar problem. It mentioned:

> assume that the getString() check that was added there in commit
> 73fcb052edf1a21d785583bc53e8b4323b577bb1 is just a performance
> optimization; the actual export of auto styles and content uses
> XEnumerationAccess anyway.

Yet, it seems that just tolerating exceptions here is not enough, and thus we need to drop the check completely, assuming it's the performance optimization, and assuming that processing the empty text objects would be fast anyway.

Alternatively, we might want to use XEnumerationAccess and check if it's empty.
Comment 1 Mike Kaganski 2022-09-21 08:53:57 UTC
https://gerrit.libreoffice.org/c/core/+/140313
Comment 2 Caolán McNamara 2022-09-21 08:57:39 UTC
thanks Mike, appreciate it
Comment 3 Mike Kaganski 2022-09-21 09:57:36 UTC Comment hidden (obsolete)
Comment 4 Mike Kaganski 2022-09-21 10:14:18 UTC Comment hidden (obsolete)
Comment 5 Commit Notification 2022-09-21 11:49:09 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

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

tdf#151100: xText->getString() may be empty for content needing export

It will be available in 7.5.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 6 Commit Notification 2022-09-22 09:06:19 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-7-4":

https://git.libreoffice.org/core/commit/226b1c2006e936e4b32748b810624c5d655c4a98

tdf#151100: xText->getString() may be empty for content needing export

It will be available in 7.4.3.

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 7 Commit Notification 2022-09-22 11:22:00 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-7-3":

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

tdf#151100: xText->getString() may be empty for content needing export

It will be available in 7.3.7.

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 8 Commit Notification 2022-09-23 10:36:41 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-7-4-2":

https://git.libreoffice.org/core/commit/941949ff88bf01db41ce9793a3d306c96ff88ab5

tdf#151100: xText->getString() may be empty for content needing export

It will be available in 7.4.2.

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.