This is a follow-up to Bug 93970. OpenOffice has a history of adding a negative indent to Heading styles. This broke .docx imports and was fixed by: http://cgit.freedesktop.org/libreoffice/core/commit/?id=b95d203bc17c83ec0fe5139f519d53ed1d842d3a The style was fixed for new ODT documents in Bug 93970, but the .DOC importer still uses the strange, old style resulting incorrectly formatted files. View attachment 118988 [details] to see how this looks. Steps to reproduce: 1. In Word create a multi-line document with Style = Heading 1-10. 2. Save as .doc 3. Open in LibreOffice. See attachment 118938 [details] for an example of this negative indent. Note to developers: Rather than apply a fix to new ODT files, imported DOCX, and now imported DOC files, shouldn't we fix the styles themselves and then add a fix for any legacy ODT files that rely on this strange behavior?
Reproducible with LO 5.0.3.2, Win 8.1 Word and LO behave differently
Created attachment 124862 [details] sample with multiline headers from Word 2007 in MS binary Verified that errant heading indents are gone in LibreOffice 5.1.2 for a new Writer .odt document. However, the attached sample MS Word binary .doc document on filter import to Writer 5.1.2 is mishandled with the odd negative 1st line indent and increasing base line as in refs [1][2] Interesting if export from Word 2007 save-as ODF .odt document--that is opened in Writer 5.1.2 without heading indents of the .doc format. Also attaching a screen clip. =-refs-= [1] https://bugs.documentfoundation.org/show_bug.cgi?id=93970#c12 [2] https://bugs.documentfoundation.org/show_bug.cgi?id=93970#c27
Created attachment 124863 [details] same header test .doc save-as exported to .odt from Word 2007
Created attachment 124864 [details] same header test .doc save-as exported to .odt from Word 2007
Created attachment 124865 [details] clips of the test document An assemblage of clips showing the mishandling in the ww8 import filter for handling multi-line headings. 1. is the original document in Word 2007 2. is the original document imported into Writer 5.1.2.2 3. is a save-as from Word 2007 to ODF, openend in Writer 5.1.2.2 4. is a new document in Writer 5.1.2.2 with text-only paste from the Word document, with LO Headings applied. Still some work to be done with the ww8 import filter. However, round trip Writer -> .DOC -> Word 2007 -> new .DOC -> Writer retains heading styles, but clears the odd shifting indents.
Anyone working on this should review: The native odt fix in Bug 93970 http://cgit.freedesktop.org/libreoffice/core/commit/?id=05fd8cb848ecba425124d61cd76e2f9418d5378c The docx fix in Bug 53175 https://cgit.freedesktop.org/libreoffice/core/commit/?id=b95d203bc17c83ec0fe5139f519d53ed1d842d3a I have a feeling these fixes are hacks and fixing the issue on the wrong level or every format needs this fix.
when working on this, it might be good to keep this one in mind too bug 98639 " Spacing to contents (distance to paragraph border) is broken after saving as docx " And (I've written this before somewhere): from what I heard in 2007/8 at a OOoCon presentation, in the ODF specs, the indent (margins) of the list styles prevail over those from the paragraphs. That has been the case in Writer for a long time. No longer in recent versions. Might be that that change is intentional, but I missed it. (Hmm, me prolly should make a good test case and separate issue ;\ )
Trying to trace what is going on here: - The document outline style created for a new document has the indents set appropriately for a numbered list. As I commented against bug 93970, it looks like outline numbering used to be enabled by default but was disabled in 1996. The outline indents probably should have been adjusted accordingly at that time but they were not. - The native odt fix in bug 93970 does not touch the outline style, rather it changes the default paragraph styles named "Heading 1", "Heading 2" etc. It explicitly sets an indent of zero on these paragraph styles. - The docx fix in bug 53175 sidesteps all this by disabling creation of all the default paragraph styles when loading a docx. I think we should adjust the default document outline style to have zero indent, and then revert the change for bug 93970. This fixes the doc issue too, I guess because a default outline indent of zero matches Word's default. I would like to do some more testing on this before submitting a patch. One downside with this approach would be if somebody really wants a numbered outline, then heaps of clicking is involved to configure the outline style back to how it was before. I think it would be a great UI improvement if the Tools -> Outline Numbering dialog allowed the user to select from the available list styles to initialise the outline style, rather than having to set up the outline style from first principals.
(In reply to Cor Nouws from comment #7) > And (I've written this before somewhere): from what I heard in 2007/8 at a > OOoCon presentation, in the ODF specs, the indent (margins) of the list > styles prevail over those from the paragraphs. > That has been the case in Writer for a long time. No longer in recent > versions. > Might be that that change is intentional, but I missed it. > (Hmm, me prolly should make a good test case and separate issue ;\ ) Yes that sounds very interesting, probably worth following up. I started looking at the ODT spec but could not find this interaction spelled out clearly.
(In reply to Cor Nouws from comment #7) ... > And (I've written this before somewhere): from what I heard in 2007/8 at a > OOoCon presentation, in the ODF specs, the indent (margins) of the list > styles prevail over those from the paragraphs. > That has been the case in Writer for a long time. No longer in recent > versions. Actually when I test this now in LO 4.0.1 and in master(5.2alpha), I see the same behaviour in both of these versions: the indent set on the list style overrides the indent set on the paragraph style. However either of these will override the indent set on the document's outline style (Tools menu -> Outline Numbering).
https://cgit.freedesktop.org/libreoffice/core/commit/?id=77171fc384b3c6359cdae026a0c38f2f112c9d60
Luke Deller, Brilliant job tracking down and fixing this 20 year old regression. I have verified that this fix works on: • Old .odt files with legacy behavior open/roundtrip correctly • New .odt files do not indent • .doc files now correctly imported and round without indent • .docx files continue to import correctly Marking Bug 65865 as a dupe of this, as that is centering correctly now too. Beautiful work! Thank you!
*** Bug 65865 has been marked as a duplicate of this bug. ***