Bug 142129

Summary: Exported PDF of master document with hidden sections containing headings shows headings anyway
Product: LibreOffice Reporter: Olivier Hallot <olivier.hallot>
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: VERIFIED FIXED    
Severity: normal CC: andreas.heinisch, aron.budea, ilmari.lauhakangas, michael.stahl, thb
Priority: medium    
Version: 7.2.0.0.alpha0+   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=140863
Whiteboard: target:7.2.0 target:7.3.0 target:7.2.2
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 107805    
Attachments: Master doc with one sub doc (chapter)
Chapter for master doc
Resulting PDF with the issue
List of bookmarks (on the left) and ToC on the document.

Description Olivier Hallot 2021-05-06 12:09:17 UTC
Created attachment 171695 [details]
Master doc with one sub doc (chapter)

On exporting to PDF of a master document with the following conditions

1) chapters has hidden sections controlled by master
2) chapter has headings in chapter numbering inside hidden sections

Actual results: The TOC used in PDF shows entries that should be hidden/not there

Expected results: NO TOC entries for hidden section in PDF

The attached  files shows it.

The master document attached has one chapter (Preface).

The chapter has one hidded section, containing the "Copyright " heading

On exporting to PDF the hidded section is not shown (OK!), but the PDF TOC still shows it.
Comment 1 Olivier Hallot 2021-05-06 12:09:58 UTC
Created attachment 171696 [details]
Chapter for master doc
Comment 2 Olivier Hallot 2021-05-06 12:11:12 UTC
Created attachment 171697 [details]
Resulting PDF with the issue

The PDF bookmark list (used as TOC) shows the hidden "Copyright" heading, and should not.
Comment 3 Dieter 2021-05-22 09:06:53 UTC
(In reply to Olivier Hallot from comment #0)
> Actual results: The TOC used in PDF shows entries that should be hidden/not
> there

After index update entries in TOC disappear. And I won't expect, that there is an index update while exporting to PDF. So I would say NOTABUG.

Version: 7.2.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 1675a68526c43c6c6e4dc850ee911f0c1de75c88
CPU threads: 4; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL
Comment 4 Olivier Hallot 2021-06-07 13:36:27 UTC
Slight misunderstanding here, the ToC I'm referring is the PDF list of bookmarks that acts as ToC for the PDF. The attached image pick the difference between the document ToC and the  list of bookmarks (on the left, and includes the "copyright" entry).
Comment 5 Olivier Hallot 2021-06-07 13:37:22 UTC
Created attachment 172677 [details]
List of bookmarks (on the left) and ToC on the document.
Comment 6 Dieter 2021-06-20 10:13:23 UTC
I understand the problem now, but I don't know how to reproduce it (not familiar enough with hidden sections)
Comment 7 Michael Stahl (allotropia) 2021-08-24 15:54:03 UTC
uh i can't reproduce this on master or current 7.1.... i load the master document, export to pdf, look at the ToC in firefox and Evince, there's no "Copyright"/"Contributors" etc there

if i open the attached PDF i see the problem

what version are you using?

does it require a special setting in the export dialog?
Comment 8 Olivier Hallot 2021-08-25 00:12:26 UTC
The issue still exist in LO 7.1

The zip file in the link below contains a draft of the Getting Started Guide with a master document and chapters with hidden sections controlled by master field variable "book eq 1" and the resulting PDF with +460 pages.

The PDF generated shows the issue, when you click in a bookmark link that is on the bottom of the book. The target is missed, you land in a page that is not the target of the bookmark.

https://nextcloud.documentfoundation.org/s/Dy8eAScEPRsakS9
Comment 9 Michael Stahl (allotropia) 2021-08-27 16:48:34 UTC
that looks like a different bug altogether...

the problem in GS72.pdf starts on page 24, the "Parts of the window" goes to the correct location but next item "Displaying" is too short by 4 pages ... actually some content is duplicated there? yes, the 4 pages are duplicate content, page 21-24 duplicated on page 25-28.

however i haven't had any luck with trying to reproduce this problem either in multiple attempts with master, a self-built 7.1, and the 7.1.5.2 release.

how do you create these PDFs, you use File->Export menu like a normal user, not anything fancy?
Comment 10 Buovjaga 2021-09-03 13:31:48 UTC
With attachment 171695 [details] and attachment 171696 [details]: this appears in 7.1 repo and is not seen in newest of 7.2 repo.
Comment 11 Buovjaga 2021-09-03 13:57:31 UTC
7.2 repo says the fix is https://git.libreoffice.org/core/commit/5fc6a601d7a1978db291fd0f7dcec638a7c25651
section.cxx: Remove remaining SwClientNotifyCalls

Did double-check the commit.
Comment 12 Commit Notification 2021-09-07 17:03:14 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/992f878e8c3424f7ce96a78ccf3a316b29ffd9ec

tdf#142129 vcl: add unit test

It will be available in 7.3.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 Commit Notification 2021-09-08 08:10:42 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-7-2":

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

tdf#142129 vcl: add unit test

It will be available in 7.2.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.