Bug 159013 - FILEOPEN: DOCX: "normal" header is wrongly copied into the "different first header" of the following section
Summary: FILEOPEN: DOCX: "normal" header is wrongly copied into the "different first h...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.2.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, regression
Depends on:
Blocks: DOCX-Header-Footer Regressions-ooxml-handle-first-hdr-ftr
  Show dependency treegraph
 
Reported: 2024-01-04 10:44 UTC by Xisco Faulí
Modified: 2024-07-22 18:24 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Comparsion MSO vs LibreOffice 24.8 master (327.87 KB, image/png)
2024-01-04 10:44 UTC, Xisco Faulí
Details
159013_inheritHeader.docx: inheriting first page styles (17.80 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2024-07-09 16:28 UTC, Justin L
Details
159013_inheritHeader_mso2010.pdf: how it looks in the authoring program (86.40 KB, application/pdf)
2024-07-09 16:29 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Xisco Faulí 2024-01-04 10:44:13 UTC
Created attachment 191752 [details]
Comparsion MSO vs LibreOffice 24.8 master

Steps to reproduce:
1. Open attachment 98490 [details] from bug 78304

-> The first page is duplicated

Reproduced in

Version: 24.2.0.0.beta1+ (X86_64) / LibreOffice Community
Build ID: 0034d2ab9382da86340738137218791a4ccc9c90
CPU threads: 8; OS: Linux 6.1; UI render: default; VCL: gtk3
Locale: fr-FR (es_ES.UTF-8); UI: en-US
Calc: threaded

[Bug found by office-interoperability-tools]
Comment 1 Xisco Faulí 2024-01-04 10:44:57 UTC
Regression introduced by:

author	Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>	2023-11-28 13:46:21 +0900
committer	Tomaž Vajngerl <quikee@gmail.com>	2023-12-01 08:26:38 +0100
commit 4b0fa253a4540f5461397815d290586f9ddabe61 (patch)
tree c58c59871244dc75e538caeea40658303da00b8b
parent 93357349ff1998b41ea1ebedf09dc1cc5da316f7 (diff)
tdf#136472 adjust ooxml import to handle first header/footer

Bisected with: bibisect-linux64-24.2
Comment 2 Justin L 2024-07-09 12:48:38 UTC
It is not that the first page is duplicated. The first page's content primarily comes from a large, textual image attached to the header.

What is duplicated is that the header for page 1 is also now copied to the first-page header on page 2. (Page 2's style now has a different "first page header" - which is correct, but it should be an empty header.)
Comment 3 Justin L 2024-07-09 16:28:01 UTC
Created attachment 195193 [details]
159013_inheritHeader.docx: inheriting first page styles

LO has never done this properly yet, although definitely quikee's patch has changed things. It affect this document as well.
Comment 4 Justin L 2024-07-09 16:29:15 UTC
Created attachment 195194 [details]
159013_inheritHeader_mso2010.pdf: how it looks in the authoring program
Comment 5 Justin L 2024-07-09 19:41:54 UTC
I expect the problem is in copyHeaderFooterTextProperty.
UNO is too stupid to allow us to copy the "First" text (because a separate "first" is not enabled on this previous (source) page style, so it just copies the text of "default").

We probably need to define a DomainMapper XText as xFirst and update that any time a new first is defined: copying from that instead of copying it from the previous style.
Comment 6 Tomaz Vajngerl 2024-07-10 01:13:50 UTC
Yes, my strategy to fix this is to add some UNO properties (or change the existing ones) where the XText can be set strictly to the page it is meant to - no matter what is enabled or not. 

When implementing this I was fighting this all the time and it took quite some time to get it working correctly for the current tests, but even that was not completely correct. The code is also not the best because of this. Having better control what is set without relying on the order how it is set would make everything much easier.

Now I just need to get a bit less busy as I currently am to find time for this...
Comment 7 Justin L 2024-07-10 02:22:02 UTC
proposed fix at https://gerrit.libreoffice.org/c/core/+/170259
Comment 8 Commit Notification 2024-07-11 06:56:26 UTC Comment hidden (obsolete, reverted)
Comment 9 Commit Notification 2024-07-11 16:09:19 UTC Comment hidden (obsolete)
Comment 10 Commit Notification 2024-07-16 11:48:39 UTC Comment hidden (obsolete)
Comment 11 Commit Notification 2024-07-22 18:15:18 UTC Comment hidden (obsolete)
Comment 12 Justin L 2024-07-22 18:24:54 UTC
See attachment 195276 [details] from bug 158977 and make sure any fix works with that document also.