Bug 148561 - FILESAVE: ODT: Incorrect header/footer numbering appears after RT
Summary: FILESAVE: ODT: Incorrect header/footer numbering appears after RT
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: low minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected
Depends on:
Blocks: Bullet-Number-Outline-Lists
  Show dependency treegraph
 
Reported: 2022-04-13 12:03 UTC by Xisco Faulí
Modified: 2023-05-12 00:23 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Before vs After the RT (198.06 KB, image/png)
2022-04-13 12:03 UTC, Xisco Faulí
Details
148561_exampleB.docx: minimized version (10.87 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2022-04-13 14:21 UTC, Justin L
Details
148561_exampleC.docx: an even simpler example - just header text, no frame (11.19 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2022-04-19 18:28 UTC, Justin L
Details
148561_homemade51.zip: ODT made in LO51 with PDF at creation and after reload. (52.21 KB, application/zip)
2022-04-21 05:37 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Xisco Faulí 2022-04-13 12:03:36 UTC
Created attachment 179519 [details]
Before vs After the RT

Steps to reproduce:
1. Open attachment from bug 
2. Save it as ODT
3. Reopen

-> Vertical left text contains numbering

Reproduced in

Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: 9877a0190e43241f4a5102e5d9cc7181f91d5a6f
CPU threads: 8; OS: Linux 5.10; UI render: default; VCL: gtk3
Locale: es-ES (es_ES.UTF-8); UI: en-US
Calc: threaded

[Bug found by office-interoperability-tools]
Comment 1 Xisco Faulí 2022-04-13 12:04:34 UTC
Regression introduced by:

author	Justin Luth <justin_luth@sil.org>	2021-05-13 13:50:56 +0200
committer	Miklos Vajna <vmiklos@collabora.com>	2021-07-06 08:52:55 +0200
commit 3e09e0784ad7669d3e0a7655f5e604a2387b1b5d (patch)
tree 1b2b34076c4e9d344135a88aa7bd2a429eeae3ba
parent cfc677d667e118bfe7f092b584c4773476b9b906 (diff)
tdf#141966 writerfilter CN: fix chapter number identification

Bisected with: bibisect-linux64-7.3

Adding Cc: to Justin Luth
Comment 2 Xisco Faulí 2022-04-13 12:24:21 UTC
Steps to reproduce:
1. Open attachment 51225 [details] from bug 40900
2. Save it as ODT
3. Reopen
Comment 3 Justin L 2022-04-13 12:28:56 UTC
Oh, good. This is a "save DOCX to ODT". I don't care too much about that.

With LO pre-defining stuff as it's own wonky Chapter Number concept, something like this doesn't surprise me. Lowering importance/priority.
Comment 4 Justin L 2022-04-13 14:21:34 UTC
Created attachment 179533 [details]
148561_exampleB.docx: minimized version

I don't see why this is importing as a list. AFAICS, it is not defined in the .ODT styles.

This stuff is found in styles.xml, as part of the header.

If I assign a Heading 6 to text in the body (content.xml) then that has no problems. When I assigned Heading 6 in the header, then it goes wonky.
Comment 5 Justin L 2022-04-19 18:28:07 UTC
Created attachment 179669 [details]
148561_exampleC.docx: an even simpler example - just header text, no frame

The difference is that Outline numbering rule retains its specified levels now instead of having all of that info wiped out - even though the levels are not connected to any styles.

Additionally, we now no longer export WWNum1 - which is unused anyway and pretty much mirrored what Outline would have looked like, had it existed.

The easiest way to see this is to run xmllint --format styles.xml > stylesB.xml and then run meld against it.

This has got to be some kind of ODT import bug. The header stuff is all in the styles.xml file, so perhaps defaults are used on header/footer code before the style information affecting Chapter Numbering is finalized?
Comment 6 Justin L 2022-04-20 11:45:23 UTC
Yup. There is all kinds of goofy code in xmloff/source/text/txtimp.cxx that checks for various bug states and then forces a bunch of numbering related stuff. And this happens before "assign paragraph styles to list levels of outline style after all styles are imported and finished."
Comment 7 Justin L 2022-04-20 13:41:57 UTC
It's not really a regression because it has always imported these text:h items as Outline styles. They just didn't have any format strings to display, so it wasn't noticed. As soon as you assign a format string, the problem is seen.
Comment 8 Justin L 2022-04-21 05:37:48 UTC
Created attachment 179693 [details]
148561_homemade51.zip: ODT made in LO51 with PDF at creation and after reload.

I was able to make a clean-room example with LO 5.1. Steps to reproduce:
-Tools – Chapter Numbering. Set level 1  Para style to none, and set  Number to something.
-Paragraph styles: Set Heading 1 to have Outline level 1
-assign Heading 1 style to both the header text and the body text. Notice no numbering on either one – as expected (148561_homemade51.pdf).
-save as .ODT and reload.  Notice the header got Outline numbering applied to it. (148561_homemade51RT.pdf)

P.S. You can substitute any level number - just use that level in all steps. It must be one of the heading styles - any style that produces a text:h instead of a text:p.
Comment 9 Justin L 2022-04-21 11:23:35 UTC
(In reply to Justin L from comment #8)
>  any style that produces a text:h instead of a text:p.
and all that takes is to give any paragraph style an outline level.

So simplified steps to reproduce:
1.) create a footer (you can leave it blank) and set the footer para-style to be outline level 1.
2.) assign a number to Chapter Numbering level 1 (and you can leave the Heading 1 paragraph assignment - it doesn't need to be removed)
3.) save as .ODT and reload, noticing that the footer now has numbering.

reproduced with these steps in LO 3.5 - assume inherited from OOo.

A hack fix is:
-                     !bOutlineStyleCandidate &&
+                     !bOutlineStyleCandidate && !IsInHeaderFooter() &&