Bug 81993

Summary: FILEOPEN: DOCX paragraph not centered though it's style is set to center
Product: LibreOffice Reporter: Kevin Suo <suokunlong>
Component: WriterAssignee: Michael Stahl <mst.fdo>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: anistenis, caolanm, mst.fdo, philipz85
Version: 4.1.6.2 releaseKeywords: regression
Hardware: All   
OS: All   
See Also: https://issues.apache.org/ooo/show_bug.cgi?id=119464
https://bugs.freedesktop.org/show_bug.cgi?id=43093
https://bugs.freedesktop.org/show_bug.cgi?id=53175
Whiteboard: bibisected filter:docx target:4.4.0 target:4.3.1 target:4.2.7
i915 platform: i915 features:
Attachments: test DOCX file
screenshot showing the problem

Description Kevin Suo 2014-08-01 06:38:47 UTC
Created attachment 103789 [details]
test DOCX file

The attached DOCX file has a title and a subtitle, each has styles applied. Both styles were set "centered". 

When open with LibreOffice, the title is centered as expected, but sub-title is not centered.

The file was created with MSO 2010. It's centered in both MSO 2010 and Kingsoft Office.

Reproducible with:
LibreOffice 4.3.0.4, 4.4.0.0.alpha0+ 2014-07-21_06:04:54
Windows XP SP3.

Also reproducible with Apache OpenOffice 4.1.
Comment 1 Kevin Suo 2014-08-01 06:42:34 UTC
Created attachment 103790 [details]
screenshot showing the problem
Comment 2 Kevin Suo 2014-08-01 06:59:55 UTC
When unzip,

in /word/document.xml

<w:p ...>
 <w:pPr>
  <w:pStyle w:val="a4"/></w:pPr>
 <w:r>
  ...
  <w:t>SUBTITLE (CENTERED)</w:t>
 </w:r>

in /word/styles.xml:

For styleID a4:
<w:style w:type="paragraph" w:styleId="a4">
<w:name w:val="Subtitle"/>
<w:basedOn w:val="a3"/>
...

For styleID a3:

<w:style w:type="paragraph" w:styleId="a3">
 <w:name w:val="Title"/>
 ...
 <w:jc w:val="center"/>

--> styleID a4 is based on styleID a3, a3 is centered, so a4 should also be centered.
Comment 3 Jay Philips 2014-08-01 09:25:19 UTC
Confirmed on Linux Mint on 4.1.6, 4.2.5 and 4.3.1. This is a regression as it works fine in 4.0.6.
Comment 4 Xisco Faulí 2014-08-01 11:26:03 UTC
bibisected:

There are only 'skip'ped commits left to test.
The first bad commit could be any of:
6a9079688b8251402bfcea35b741a418cab30229
ff4b17247dc05a006a5c4c57dced132c87f2396c
We cannot bisect more!

# bad: [423a84c4f7068853974887d98442bc2a2d0cc91b] source-hash-c15927f20d4727c3b8de68497b6949e72f9e6e9e
# good: [65fd30f5cb4cdd37995a33420ed8273c0a29bf00] source-hash-d6cde02dbce8c28c6af836e2dc1120f8a6ef9932
git bisect start 'latest' 'oldest'
# bad: [e02439a3d6297a1f5334fa558ddec5ef4212c574] source-hash-6b8393474974d2af7a2cb3c47b3d5c081b550bdb
git bisect bad e02439a3d6297a1f5334fa558ddec5ef4212c574
# good: [8f4aeaad2f65d656328a451154142bb82efa4327] source-hash-1885266f274575327cdeee9852945a3e91f32f15
git bisect good 8f4aeaad2f65d656328a451154142bb82efa4327
# good: [9995fae0d8a24ce31bcb5e9cd0459b69cfbf7a02] source-hash-8600bc24bbc9029e92bea6102bff2921bc10b33e
git bisect good 9995fae0d8a24ce31bcb5e9cd0459b69cfbf7a02
# good: [8ad82bc1416a07501651e8d96fe268e47d3931d3] source-hash-13821254f88d2c5488fba9fe6393dcf4ae810db4
git bisect good 8ad82bc1416a07501651e8d96fe268e47d3931d3
# bad: [d084d250b04446535ca1d7c29cf2062e6bd042b3] source-hash-688f72e3a2c3ef923389bbd21f6aea3afe1114db
git bisect bad d084d250b04446535ca1d7c29cf2062e6bd042b3
# bad: [013adf05b6bf8e5d44a4e820d43177d7fb749079] source-hash-a16a4006e40bdb2cb4671846295fe2bf5a856e68
git bisect bad 013adf05b6bf8e5d44a4e820d43177d7fb749079
# bad: [ff4b17247dc05a006a5c4c57dced132c87f2396c] source-hash-d74ba0c4147f33abd9d0c03883cc88f15e160ee5
git bisect bad ff4b17247dc05a006a5c4c57dced132c87f2396c
# good: [54c7e3977148ffe7631292f2f7d6d60cf7c86bbc] source-hash-5ad95cec96f6f08c55bb226a6eaeb1eeb95c1279
git bisect good 54c7e3977148ffe7631292f2f7d6d60cf7c86bbc
# skip: [6a9079688b8251402bfcea35b741a418cab30229] source-hash-bd7b2c7befbd10bebaba3a9b6ea491969ac1dcb0
git bisect skip 6a9079688b8251402bfcea35b741a418cab30229
# good: [005d70d91c2589e3a200a9dfd4050820cbf73376] source-hash-358b60b3b172968a7605b428af01df456d7669b2
git bisect good 005d70d91c2589e3a200a9dfd4050820cbf73376
# only skipped commits left to test
# possible first bad commit: [ff4b17247dc05a006a5c4c57dced132c87f2396c] source-hash-d74ba0c4147f33abd9d0c03883cc88f15e160ee5
# possible first bad commit: [6a9079688b8251402bfcea35b741a418cab30229] source-hash-bd7b2c7befbd10bebaba3a9b6ea491969ac1dcb0
Comment 5 Xisco Faulí 2014-08-01 12:56:31 UTC
it looks like this issue was introduced by commit acc671ec74c874ffd22803bb2ee54a1f2c027155. 

If I revert that commit, the attach file and the one attached here https://issues.apache.org/ooo/show_bug.cgi?id=119464 are rendered correctly. Is it ok if we just revert the commit in Libreoffice ?
Comment 6 Michael Stahl 2014-08-04 15:40:10 UTC
thanks for the bisect!

this is clearly the *better* fix for that bug, because it takes
care of derived styles:

commit 3f9e7e72c53ecbe8ee1ab060f811cb41eadfc7e1
Author:     Faisal M. Al-Otaibi <fmalotaibi@kacst.edu.sa>
AuthorDate: Wed Nov 13 22:23:05 2013 +0300

    DOCX: fdo#43093 set alignment if not already set


also this commit should make the whole thing unnecessary because
Center on Title/Subtitle is not set by Writer:

commit b95d203bc17c83ec0fe5139f519d53ed1d842d3a
Author:     Cédric Bosdonnat <cedric.bosdonnat@free.fr>
AuthorDate: Mon Aug 20 11:29:29 2012 +0200

    fdo#53175: Don't load the default values of the styles in writerfilter
  

so reverting the commit from comment #5 is indicated.
Comment 7 Commit Notification 2014-08-04 15:41:04 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

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

fdo#81993: Revert "Resolves: #i119464# Update default alignment ...



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 8 Commit Notification 2014-08-05 07:23:38 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-4-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=b3b4f0da07710ecfef6ee06345280fb6b77dc781&h=libreoffice-4-3

fdo#81993: Revert "Resolves: #i119464# Update default alignment ...


It will be available in LibreOffice 4.3.1.

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 9 Commit Notification 2014-08-05 07:26:41 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-4-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=11ad475ec81353ddf87834e22e2db02c23d172d7&h=libreoffice-4-2

fdo#81993: Revert "Resolves: #i119464# Update default alignment ...


It will be available in LibreOffice 4.2.7.

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.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.