Bug 106174 - FILEOPEN: Paragraph alignment inherited from parent style not loaded from doc(x) file
Summary: FILEOPEN: Paragraph alignment inherited from parent style not loaded from doc...
Status: CLOSED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
4.2 all versions
Hardware: All All
: high normal
Assignee: Justin L
URL:
Whiteboard: interoperability target:6.2.0 target:...
Keywords: bibisected, bisected, filter:docx, regression
Depends on:
Blocks: DOCX-Paragraph RTL
  Show dependency treegraph
 
Reported: 2017-02-24 11:18 UTC by Gabor Kelemen (allotropia)
Modified: 2024-08-03 09:15 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Screenshot of the document in LO 5.2.3 and Excel 2013 side by side (136.17 KB, image/png)
2017-02-24 11:18 UTC, Gabor Kelemen (allotropia)
Details
Test document with alignment settings inherited from parent style (9.30 KB, application/vnd.oasis.opendocument.text)
2017-02-24 11:19 UTC, Gabor Kelemen (allotropia)
Details
The document exported to docx format (13.57 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2017-02-24 11:21 UTC, Gabor Kelemen (allotropia)
Details
The same document saved in doc (17.00 KB, application/msword)
2017-02-24 11:25 UTC, Gabor Kelemen (allotropia)
Details
The document exported to rtf format (2.61 KB, application/msword)
2017-02-24 11:31 UTC, Gabor Kelemen (allotropia)
Details
Screenshot in current 6.2 master and Word 2010 (292.72 KB, image/png)
2018-06-26 17:28 UTC, Gabor Kelemen (allotropia)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2017-02-24 11:18:37 UTC
Created attachment 131437 [details]
Screenshot of the document in LO 5.2.3 and Excel 2013 side by side

Attached documents have some custom styles with centered and right alignment, and child styles that are supposed to inherit these alignment settings.

If the document is saved to odt (also in doc and rtf) this works: the child styles have the paragraph alignment settings of their parents.

If the document is saved to docx and opened in LO then this does not work in LO 5.2.3: the child styles have the default Left alignment.

Interestingly the problem does not occur in Word 2013: the alignment settings are inherited and displayed correctly.
Comment 1 Gabor Kelemen (allotropia) 2017-02-24 11:19:43 UTC
Created attachment 131438 [details]
Test document with alignment settings inherited from parent style
Comment 2 Gabor Kelemen (allotropia) 2017-02-24 11:21:25 UTC
Created attachment 131439 [details]
The document exported to docx format
Comment 3 Gabor Kelemen (allotropia) 2017-02-24 11:25:07 UTC
Created attachment 131440 [details]
The same document saved in doc
Comment 4 Gabor Kelemen (allotropia) 2017-02-24 11:31:28 UTC
Created attachment 131441 [details]
The document exported to rtf format

Even this works :)
Comment 6 Aron Budea 2017-02-24 18:38:08 UTC Comment hidden (bibisection)
Comment 7 Aron Budea 2017-02-24 18:40:46 UTC
This bug started with the comment referenced below. I assume there's no point in CC-ing anyone from KACST.

https://cgit.freedesktop.org/libreoffice/core/commit/?id=84b3d6dc3a7d5ba52b00285e59e7aa6b5ca15837
author		Faisal M. Al-Otaibi <fmalotaibi@kacst.edu.sa>	2013-11-15 15:09:21 (GMT)
committer	Faisal M. Al-Otaibi <fmalotaibi@kacst.edu.sa>	2013-11-15 15:16:36 (GMT)

"DOCX:fdo#71646 fix wrong direction when save the file."
Comment 8 Aron Budea 2017-02-25 06:02:35 UTC
In the exported files the difference is in styles.xml. The one that is imported incorrectly has this attribute for center/right aligned paragraph styles (two of each):
<w:bidi w:val="0"/>
Comment 9 Aron Budea 2017-03-16 01:30:15 UTC
Piece of code from import:
rContext->Insert(PROP_WRITING_MODE, uno::makeAny( text::WritingMode2::LR_TB ));
rContext->Insert(PROP_PARA_ADJUST, uno::makeAny( style::ParagraphAdjust_LEFT ), /*bOverwrite=*/false);
http://opengrok.libreoffice.org/xref/core/writerfilter/source/dmapper/DomainMapper.cxx#1453

I wonder if this piece of code is what is causing the bug, or later where the value of PROP_PARA_ADJUST is considered instead of what is inherited from the style.

Then the other question is whether bidi attribute should actually be written in the OOXML in this case, even if it's set to 0 (false).
Comment 10 QA Administrators 2018-06-26 02:44:33 UTC Comment hidden (obsolete)
Comment 11 Gabor Kelemen (allotropia) 2018-06-26 17:28:23 UTC
Created attachment 143142 [details]
Screenshot in current 6.2 master and Word 2010

Still no inheritance of alignment.
Comment 12 Justin L 2018-07-07 18:39:14 UTC
code pointer:
writerfilter/source/dmapper/DomainMapper.cxx  case NS_ooxml::LN_CT_PPrBase_bidi:
Comment 13 Justin L 2018-07-09 18:33:25 UTC
Proposed fix:
https://gerrit.libreoffice.org/57195 related tdf#106174 writerfilter: replace broken FindParentStyleSheet
https://gerrit.libreoffice.org/57196 tdf#106174 writerfilter: bidi - only if different from style
Comment 14 Commit Notification 2018-07-13 08:22:54 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=bc67bda7363df48f1983513a8e969b61738139f5

related tdf#106174 writerfilter: replace broken FindParentStyleSheet

It will be available in 6.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 15 Commit Notification 2018-07-19 11:44:29 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-6-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=d3ecf6070b439e902343a2a83bc9384382e41fee&h=libreoffice-6-1

related tdf#106174 writerfilter: replace broken FindParentStyleSheet

It will be available in 6.1.0.2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 16 Commit Notification 2018-07-25 08:19:51 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9fc9510ae3f46e5c1fd65303bac9f01ddc79cb5c

tdf#106174 writerfilter: bidi - prev adjust? prev bidi?

It will be available in 6.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 17 Justin L 2018-07-25 09:30:35 UTC
Not backporting - too many other connected dependencies for a complex and error-prone area.
Comment 18 Commit Notification 2018-08-22 04:14:57 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=85818da3307a28b2d9c6fa5c1c97ca7833dfe24c

tdf#106174 ww8import: bidi - prev adjust? prev bidi?

It will be available in 6.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 19 Commit Notification 2018-12-06 06:31:53 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "libreoffice-6-2":

https://git.libreoffice.org/core/+/931cb1caf26a09d7152360407e1f163fc3fab1c2%5E%21

Revert "tdf#106174 ww8import: bidi - prev adjust? prev bidi?"

It will be available in 6.2.0.1.

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 Justin L 2018-12-06 06:46:30 UTC
Leaving this bug marked as fixed, but .doc is now fixed only in master (6.3) because it caused a bad regression in bug 121110. Because I am really struggling to create a clean fix for the regression, I don't want to backport any future fix for bug 121110 to 6.2. So, I'm just eliminating the problem from 6.2 and delaying it until 6.3.
Comment 21 fredwall 2020-09-09 09:22:12 UTC Comment hidden (spam)
Comment 22 michsam 2021-01-09 05:45:58 UTC Comment hidden (spam)