Issue 119592 - [From Symphony] The left-style columns display with the same width when opening with AOO
[From Symphony] The left-style columns display with the same width when openi...
Product: Writer
Classification: Application
Component: open-import
PC All
: P3 Normal (vote)
: 4.0.0
Assigned To: Andre
Depends on:
  Show dependency treegraph
Reported: 2012-05-30 09:17 UTC by xiao ting xiao
Modified: 2012-10-09 08:19 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---

ColumnsLeft (14.30 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2012-05-30 09:17 UTC, xiao ting xiao
no flags Details
screenshot in MS (138.95 KB, image/jpeg)
2012-05-30 09:18 UTC, xiao ting xiao
no flags Details
screenshot in AOO (160.48 KB, image/jpeg)
2012-05-30 09:19 UTC, xiao ting xiao
no flags Details
Patch (854 bytes, patch)
2012-06-21 09:14 UTC, wujinlong
wujinlong: review?
Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description xiao ting xiao 2012-05-30 09:17:28 UTC
Created attachment 77809 [details]

1. Open the attached docx sample files.
2. Check the two columns in the page 1.
 Defect: The two columns are equal in width,instead of the expected left-style coloumns set in ms2010.

Please see screenshots for detail information.
Comment 1 xiao ting xiao 2012-05-30 09:18:32 UTC
Created attachment 77810 [details]
screenshot in MS
Comment 2 xiao ting xiao 2012-05-30 09:19:22 UTC
Created attachment 77811 [details]
screenshot in AOO
Comment 3 wujinlong 2012-06-21 09:14:48 UTC
Created attachment 78424 [details]

Root case: the column width calculation logic miss the case for two columns.

Resolution: Correct the column width calculation entry condition to make the column calculation correct.
Comment 4 Andre 2012-07-10 15:20:58 UTC
I am not really familiar with Writer code but it looks like m_nColumnCount is off by one by design, indicated by loops like
    for( sal_Int32 nCol = 0; nCol <= m_nColumnCount; ++nCol)

With that in mind I understand the patch, but the original code looks like an error, ie the comparison

    if ( ... sal_Int32(m_aColDistance.size()) == m_nColumnCount) ...)

looks like it should be

    if ( ... sal_Int32(m_aColDistance.size()) == m_nColumnCount+1) ...)

which is basically what the patch does.

My question is this: why not remove the 

    sal_Int32(m_aColDistance.size()) == m_nColumnCount)

part from the if-statement?
Comment 5 Andre 2012-07-27 14:59:21 UTC
@wujinlong: Can you give an answer to the question in my last comment?
Comment 6 Oliver-Rainer Wittmann 2012-08-13 10:02:22 UTC
@wijinlong: Do you have any feedback on Andre's comment?
Comment 7 wujinlong 2012-08-29 09:13:11 UTC
Hi Andre,

Sorry for late response. 

I did some debug today, and found that 

1) if there is 2 columns, 
m_nColumnCount = 1
m_aColDistance.size() = 2

2) if there is n (n>2) columns,
m_nColumnCount = n -1 
m_aColDistance.size() = n - 1

So the original logic is correct if columns number > 2. While this fix is to handle the special case for 2 columns.

So we need these 2 conditions, and they are OR relationship in logic. The first one is for columns > 2, and the second is specific for columns = 2.

((sal_Int32(m_aColDistance.size()) == m_nColumnCount) || (sal_Int32(m_aColDistance.size()) == m_nColumnCount + 1)) )

Comment 8 SVN Robot 2012-08-30 08:29:17 UTC
"af" committed SVN revision 1378848 into trunk:
#i119592# Fixed column widths.
Comment 9 Andre 2012-08-30 08:30:15 UTC
Applied the patch.
Comment 10 Du Jing 2012-09-04 07:01:57 UTC
verified on the AOO3.5_r1380171
Comment 11 Shenfeng Liu 2012-10-09 08:19:12 UTC
set Target Milestone to AOO 3.5.0 for PM purpose.