Bug 153090 - FILEOPEN DOCX TOF incorrect when based on paragraph style instead of category
Summary: FILEOPEN DOCX TOF incorrect when based on paragraph style instead of category
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Michael Stahl (allotropia)
URL:
Whiteboard: target:7.6.0 target:7.5.1
Keywords: filter:docx
Depends on:
Blocks: DOCX-TableofContents
  Show dependency treegraph
 
Reported: 2023-01-18 12:39 UTC by Gabor Kelemen (allotropia)
Modified: 2023-09-12 12:41 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file from Word with TOF based on paragraph style (52.83 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2023-01-18 12:39 UTC, Gabor Kelemen (allotropia)
Details
Type tab of the TOF properties dialog in Writer (81.77 KB, image/png)
2023-01-18 12:40 UTC, Gabor Kelemen (allotropia)
Details
The TOF Style setting in Word and the corresponding empty Styles list in Writer (121.03 KB, image/png)
2023-01-18 12:41 UTC, Gabor Kelemen (allotropia)
Details
The TOF after updating lost all its contents (57.48 KB, image/png)
2023-01-18 12:42 UTC, Gabor Kelemen (allotropia)
Details
The example file under Windows and GTK3 (207.78 KB, image/png)
2023-02-16 00:45 UTC, Gabor Kelemen (allotropia)
Details
TOC LO 7.6 new feature (3.02 MB, application/vnd.oasis.opendocument.text)
2023-09-07 07:46 UTC, SusanneMohn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2023-01-18 12:39:18 UTC
Created attachment 184745 [details]
Example file from Word with TOF based on paragraph style

Attached document was made in Word to contain images and captions, the latter formatted with a custom paragraph style.
A table of figures was added and set to be filled based on the CustomImageCaption style, and not on a figure category.
This makes it possible to list images having different figure categories.

1. Open attached file in Writer
2. Right click on the Table of Figures, select Edit Index
3. Observe on the Type tab the Category dropdown has the Figure entry selected. It does not have a (none) entry, like Word. You can select only one of the two categories used originally, Abb. and abra.
4. Observe on the Styles tab that the CustomImageCaption style is not listed in the left side Levels box, but it should.

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: f1830bff71847a9c17715cff52383956719847fe
CPU threads: 14; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: en-US (hu_HU); UI: en-US
Calc: threaded
Comment 1 Gabor Kelemen (allotropia) 2023-01-18 12:40:09 UTC
Created attachment 184746 [details]
Type tab of the TOF properties dialog in Writer
Comment 2 Gabor Kelemen (allotropia) 2023-01-18 12:41:46 UTC
Created attachment 184747 [details]
The TOF Style setting in Word and the corresponding empty Styles list in Writer
Comment 3 Gabor Kelemen (allotropia) 2023-01-18 12:42:25 UTC
Created attachment 184748 [details]
The TOF after updating lost all its contents
Comment 4 Stéphane Guillou (stragu) 2023-01-18 14:43:06 UTC
Reproduced with a recent master build:

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: f1830bff71847a9c17715cff52383956719847fe
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 5 Stéphane Guillou (stragu) 2023-01-18 14:46:20 UTC
Inherited from OOo, although slightly different:
- Emtpy TOF at fileopen (no need to update)
- Category is "Illustration", Abb. and abra. are not listed

Version:
OpenOffice.org 3.3.0
OOO330m20 (Build:9567)
Comment 6 Commit Notification 2023-01-23 10:13:06 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/5ef8d07fe04717dc4a5b8846a3b324381b2c8efd

tdf#153090 writerfilter,sw: DOCX/RTF import/export of TOC \c \t

It will be available in 7.6.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 7 Commit Notification 2023-01-24 13:39:27 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/90e1698dab3d286c10136719aa85fee2f56ad9fd

tdf#153090 xmloff: ODF import/export of source style on ToX

It will be available in 7.6.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 8 Commit Notification 2023-01-25 19:46:42 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/43744a9004e0fa59a525855c7e97ca153a839c42

tdf#153090 sw: add UI to SwTOXSelectTabPage

It will be available in 7.6.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 9 Michael Stahl (allotropia) 2023-01-26 09:05:26 UTC
this is implemented on master for 3 different indexes; the UI change can't be backported to 7.5 due to UI freeze but the core/DOCX patch can.
Comment 10 Stéphane Guillou (stragu) 2023-01-30 17:34:08 UTC
Thank you Michael.
I just tested the fix with:

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: ec4babad021218b75dfe8534985d7db525edde69
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

I noticed that on updating the index, the style changes from "table of figures" to "figure index 1". This is visible because the below paragraph spacing increases, which does not happen when updating the table in MS Office.

Is that expected?

Furthermore, the _CustomImageCaption style is still not listed on the left hand side of the Styles tab, when editing the index.
Comment 11 Commit Notification 2023-02-08 14:57:03 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/6947d03d89d95f7eaf537b0cbfc089061c84738a

tdf#153090 writerfilter,sw: DOCX/RTF import/export of TOC \c \t

It will be available in 7.5.1.

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 12 Gabor Kelemen (allotropia) 2023-02-16 00:45:07 UTC
Created attachment 185392 [details]
The example file under Windows and GTK3

Under Linux, I can see the Table of Contents dialog having a new checkbox and its Paragraph style selector dropdown, but it's not visible under Windows/gen VCL.

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 75a863ee7fea133ae6bcd010d1aac46815fa49e2
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: hu-HU (hu_HU.UTF-8); UI: en-US
Calc: threaded
-> good

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 75a863ee7fea133ae6bcd010d1aac46815fa49e2
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: x11
Locale: hu-HU (hu_HU.UTF-8); UI: en-US
Calc: threaded
-> bad
Comment 13 Gabor Kelemen (allotropia) 2023-02-16 00:53:59 UTC
Checked in

Version: 7.5.2.0.0+ (X86_64) / LibreOffice Community
Build ID: 1e7ee035992a0b29f42eac56ad82e2a1b0fe8ccd
CPU threads: 14; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: en-US (hu_HU); UI: en-US
Calc: threaded

and current master

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 14a36ad49518bcb5b606b0f1640e3ca56b636e89
CPU threads: 14; OS: Windows 10.0 Build 19045; UI render: default; VCL: win
Locale: en-US (hu_HU); UI: en-US
Calc: threaded

The TOC now can be updated, also a DOCX save-reload retains the setting to generate it from the _CustomImageCaption style paragraphs.

Still I'd reopen for the missing new UI between GTK3/other backends issue. That's super ugly.
Comment 14 Gabor Kelemen (allotropia) 2023-02-16 00:58:42 UTC
(In reply to Stéphane Guillou (stragu) from comment #10)
> I noticed that on updating the index, the style changes from "table of
> figures" to "figure index 1". This is visible because the below paragraph
> spacing increases, which does not happen when updating the table in MS
> Office.
> 
> Is that expected?

I think that is a separate and pre-existing issue, mapping "special" styles (which are then used for TOC-like purposes) between Word and Writer is kinda fragile.
I'll file a new one for this. This is both DOCX import and export issue.

> 
> Furthermore, the _CustomImageCaption style is still not listed on the left
> hand side of the Styles tab, when editing the index.

I saw that now in a fresh bibisect-linux-7.6 master, as it is on my screenshot.
Comment 15 Commit Notification 2023-02-20 21:10:04 UTC
Samuel Mehrbrodt committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/13047e72b7f074519f81e7542a0ed572376d4df2

tdf#153090 Fix widget display in non-gtk backends

It will be available in 7.6.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 16 Commit Notification 2023-02-20 21:16:07 UTC
Samuel Mehrbrodt committed a patch related to this issue.
It has been pushed to "master":

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

Related tdf#153090 Move dropdown next to checkbox

It will be available in 7.6.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 17 Gabor Kelemen (allotropia) 2023-04-13 00:06:41 UTC
Verified in

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: fc6806c4be8585ce0d35a6b581bf8b3dbf858500
CPU threads: 14; OS: Windows 10.0 Build 19045; UI render: default; VCL: win
Locale: hu-HU (hu_HU); UI: hu-HU
Calc: threaded

The new feature seems to work fine, under Windows and GTK UI too, and the style name setting survives docx import-export fine.
Comment 18 SusanneMohn 2023-09-07 07:42:40 UTC
For the migration of Word documents with this setting works. However, when I create a Writer document and assign a custom paragraph style to the caption, all entries in the list of figures are duplicated. Am I doing something wrong or is this intentional? see attachment.
Comment 19 SusanneMohn 2023-09-07 07:46:33 UTC
Created attachment 189406 [details]
TOC LO 7.6 new feature

For the migration of Word documents with this setting works. However, when I create a Writer document and assign a custom paragraph style to the caption, all entries are duplicated in the list of figures. Am I doing something wrong or is this intentional?
Comment 20 SusanneMohn 2023-09-07 07:53:33 UTC
Question: TOC in Writer with custom styles dublicatet
Comment 21 Stéphane Guillou (stragu) 2023-09-07 09:20:23 UTC
(In reply to SusanneMohn from comment #19)
> Created attachment 189406 [details]
> TOC LO 7.6 new feature
> 
> For the migration of Word documents with this setting works. However, when I
> create a Writer document and assign a custom paragraph style to the caption,
> all entries are duplicated in the list of figures. Am I doing something
> wrong or is this intentional?

I can see the duplicate entries in the ToC of your example file. In 7.4, updating it removes the duplicates. In 7.6.1.1, updating it does not.
Can you please open a new report for this issue, and mark this report as a link in "see also" ?
https://bugs.documentfoundation.org/enter_bug.cgi?product=LibreOffice&format=guided
This report already has enough comments commits, better start fresh and focused.
Thanks Susanne!
Comment 22 SusanneMohn 2023-09-12 07:51:04 UTC
hi Stephane, ist describet in bug 157200 https://bugs.documentfoundation.org/show_bug.cgi?id=157200