Bug 104239 - FILEOPEN: DOC: Incorrect numbering in second level
Summary: FILEOPEN: DOC: Incorrect numbering in second level
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.4.0.0.alpha0+ Master
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:7.3.0
Keywords: bibisected, bisected, filter:doc, regression
: 75748 120396 (view as bug list)
Depends on:
Blocks: DOC-Bullet-Number-Lists
  Show dependency treegraph
 
Reported: 2016-11-28 20:30 UTC by Xisco Faulí
Modified: 2021-08-23 17:52 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
sample (41.00 KB, application/msword)
2016-11-28 20:30 UTC, Xisco Faulí
Details
sample2 (51.00 KB, application/msword)
2016-12-15 19:37 UTC, Xisco Faulí
Details
comparison MSO 2010 and LibreOffice 6.4 Master (57.17 KB, image/png)
2019-09-29 17:05 UTC, Xisco Faulí
Details
numbering_DUMP.doc: illustrated doc-dumper detail of comment 2's example document. (2.07 MB, application/msword)
2021-07-02 06:35 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Xisco Faulí 2016-11-28 20:30:56 UTC
Created attachment 129098 [details]
sample

Steps:
1. Open attached document

Observed behaviour: Numbering in second level in page 2 is incorrect

Reproduced in

Version: 5.3.0.0.alpha1+
Build ID: 4ebf1ea7cb66fc3e6b94cd38dd233aaead69f3d5
CPU Threads: 4; OS Version: Linux 4.8; UI Render: default; VCL: gtk3; Layout
Engine: old; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group

but not in

Version: 4.3.0.0.alpha1+
Build ID: c15927f20d4727c3b8de68497b6949e72f9e6e9e
Comment 1 Xisco Faulí 2016-11-28 20:32:18 UTC
Regression introduced by:

author	Oliver-Rainer Wittmann <orw@apache.org>	2014-07-01 15:20:58 (GMT)
committer	Caolán McNamara <caolanm@redhat.com>	2014-07-02 09:46:47 (GMT)
commit	fa0421c763a92dbfead1d0144b434a3b6ab9dccb (patch)
tree	f02c0c1ccdb24ca4cc8c6e7de03c83ea43503218
parent	9fb4cf25cf25b565058baff74af40398127c4083 (diff)
Related: #i78498# some further improvements and corrections for outlines
- apply default outline level to WW8 Build-in Heading Styles
- get WW8 Build-In Heading Styles' list level applied to the paragraphs
- apply list level properties of WW8 Built-In Heading Styles only, if
the list level of the WW8 Build-In Heading Style corresponds to its
outline level

(cherry picked from commit 90ea610040acc8cc2ae66e774aff11b0bafcc59c)
(cherry picked from commit 2b0eadc3a706a2b2b41c48caa4f01691978f1190)

Conflicts:
	sw/source/filter/ww8/ww8par.cxx
	sw/source/filter/ww8/ww8par2.cxx
	sw/source/filter/ww8/ww8par2.hxx
	sw/source/filter/ww8/ww8par3.cxx
Comment 2 Xisco Faulí 2016-12-15 19:37:36 UTC
Created attachment 129675 [details]
sample2
Comment 3 Rostislav 'R.Yu.' Okulov 2017-03-26 18:38:13 UTC
Faced same bug,
Works fine with <=4.3 and stop working with =>4.4
Comment 4 QA Administrators 2018-09-28 02:43:40 UTC Comment hidden (obsolete)
Comment 5 Roman Kuznetsov 2018-09-28 11:11:47 UTC
still repro in 

Version: 6.1.2.1
Build ID: 65905a128db06ba48db947242809d14d3f9a93fe
CPU threads: 4; OS: Windows 6.1; UI render: default; 
Locale: ru-RU (ru_RU); Calc: group threaded
Comment 6 QA Administrators 2019-09-29 03:08:29 UTC Comment hidden (obsolete, spam)
Comment 7 Rostislav 'R.Yu.' Okulov 2019-09-29 14:04:36 UTC Comment hidden (obsolete)
Comment 8 Xisco Faulí 2019-09-29 17:05:03 UTC
Created attachment 154642 [details]
comparison MSO 2010 and LibreOffice 6.4 Master
Comment 9 Xisco Faulí 2019-09-29 17:05:19 UTC
Still reproducible in

Version: 6.4.0.0.alpha0+
Build ID: d5b7627a0e738c0866b819910153b96b611813f8
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); UI-Language: en-US
Calc: threaded
Comment 10 Xisco Faulí 2019-09-29 17:12:52 UTC Comment hidden (obsolete)
Comment 11 Timur 2019-12-20 20:05:26 UTC Comment hidden (obsolete)
Comment 12 Justin L 2021-04-19 12:40:34 UTC Comment hidden (obsolete)
Comment 13 Justin L 2021-04-19 12:53:04 UTC
In test_numerotation.doc, Titre 1 (heading 1) really does not specify a numbering list (sprmPIlfo) or a listlevel (sprmPIlvl), only an outline level (sprmPOutLvl). So there is no numbering associated with this style.
Instead, the numbering is applied directly on all four paragraphs using sprmPIlfo listId 1.

Titre 2 specifies outlineLevel 1 (aka 2), ListLevel 1 (aka 2), and listId 1 (same as the heading1 paragraphs).

That causes a problem, because LO uses a secret, internal list for Chapter Numbering (Heading 2-10) which is not available for Direct Properties. (I think there is a way for numbering styles to share a list - which is how this would have to play out.)
Comment 14 Justin L 2021-04-21 09:11:19 UTC
*** Bug 120396 has been marked as a duplicate of this bug. ***
Comment 15 Justin L 2021-04-21 18:03:24 UTC
*** Bug 75748 has been marked as a duplicate of this bug. ***
Comment 16 Justin L 2021-06-23 07:04:07 UTC
A number of changes happened in 4.4. It is important to pay attention to the actual second level numbering. It is more than just "two digits showing" - they need to follow the first level section numbers and not just be 1.x all the way through the document.

A better bibisect for test_numerotation.doc is an earlier commit by author Oliver-Rainer Wittmann on 2014-06-30 09:46:15 +0100
commit	c99f264be5eaf481f88606e2606c34170675c1b4
Related: #i78498# improvements/corrections regarding outline level & Co
- import outline level attribute at Paragraph Styles
- import outline level attribute at paragraphs
- refactor code to apply list level properties to Outline Style
-- only consider WW8 list styles applied to WW8 Built-in Heading Styles
-- only assign our counterparts of WW8 Built-in Heading Styles to Outline Style

https://cgit.freedesktop.org/libreoffice/core/commit/?id=c99f264be5eaf481f88606e2606c34170675c1b4
Comment 17 Justin L 2021-06-23 17:00:52 UTC
proposed fix at 
http://gerrit.libreoffice.org/c/core/+/117745 tdf#104239 doc import: accept outlineLvl0 == (listLvl = MAXLEVEL)

and https://gerrit.libreoffice.org/c/core/+/117746 tdf#104239 doc import: use "Outline" for m_pChosenWW8OutlineStyle
Comment 18 Commit Notification 2021-06-24 17:22:42 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/8bfa14e831f31f372b98d7283fa4abc73bcb5532

tdf#104239 doc import: accept outlineLvl0 == (listLvl = MAXLEVEL)

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 19 Commit Notification 2021-06-25 18:34:23 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/27aedd8f7de6f94469ab515cf0ab0c7e85550efc

tdf#104239 doc import: use "Outline" for m_pChosenWW8OutlineStyle

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 20 Commit Notification 2021-06-26 16:32:31 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#104239 doc import: chose m_pChosenWW8OutlineStyle carefully

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 21 Commit Notification 2021-06-28 04:49:33 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#104239 doc import: listLevel 9 is body text

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 22 Commit Notification 2021-06-28 19:01:56 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#104239 doc import: fix chose m_pChosenWW8OutlineStyle carefully

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 23 Justin L 2021-07-01 14:15:13 UTC
test_numerotation.doc: comment 0: fixed
numbering.doc: comment2: not fixed.
numbering_increase.doc: comment 14: fixed
75748 test1 MS2010.doc: comment 15: fixed
Comment 24 Justin L 2021-07-02 06:35:19 UTC
Created attachment 173310 [details]
numbering_DUMP.doc: illustrated doc-dumper detail of comment 2's example document.

(In reply to Justin L from comment #23)
> numbering.doc: comment2: not fixed.
This is a fairly simple document (surprisingly) and can be "fixed" by not doing any chapter numbering at all.

It only uses LFO 8 (and LFO 0). Only styles Heading 1 and Heading 2 define an LFO (8 of course). In the body text, it uses LFO 0 to cancel numbering on some heading styles, and it specifies LFO8 along with listLvl 2 (aka level 3) on the (Heading 2) paragraphs that are missing the numbering.

The reason the numbering is missing is because Chapter Numbering has an empty slot for Level 3. That is really tricky though - to evaluate the entire body of text to see if m_pChosenWW8OutlineStyle is in use before accepting it.

One option would be to ONLY accept LFO 1 as m_pChosenWW8OutlineStyle, but that is pretty drastic.

P.S. numbering.doc is a good counter-check to use with any fixes for bug 130670.
Comment 25 Commit Notification 2021-07-03 09:44:16 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/26af8b14aad463ea7f1fd22ac221269f23145855

tdf104239 doc import: re-arrange aPreventUseAsChapterNumbering

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 26 Commit Notification 2021-07-05 04:06:27 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/17bc5794d6acd38304653dc78b95f9f772893ca7

tdf#104239 doc import CN: don't skip no-style levels

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 27 Timur 2021-07-15 10:18:52 UTC
I set Verified for sample and duplicates, DOC and DOCX. 
Very great from Justin. Thanks.
Comment 28 Justin L 2021-08-23 17:52:25 UTC
(In reply to Justin L from comment #23)
> numbering.doc: comment2: not fixed.
Just for the record, this was fixed (and added as a unit test) by comment 26.