https://bugs.documentfoundation.org/show_bug.cgi?id=160921

Justin L <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|https://bugs.documentfounda |
                   |tion.org/show_bug.cgi?id=16 |
                   |2616                        |
                 CC|                            |[email protected]
           Assignee|[email protected] |[email protected]
                   |desktop.org                 |

--- Comment #10 from Justin L <[email protected]> ---
My steps to reproduce in a simple document:
-create a new spreadsheet and enter '=22/7' in cell A1  (looks good)
-set optimal width adding zero margin (increases in size, looks good)
-on the toolbar: Add Decimal Place (turns into ### as can be expected)
-set optimal width again with zero added margin (remains ### which is
unexpected)

One way to fix this might be to set the minimum UI margin addition to 5.65pt
(0.08inch) which seems to be an internal default since there is never a truly
zero margin.


The problem is that when GetOptimalColWidth asks for GetTextWidth, it does so
with MapMode not enabled.
In my example, I got OutputDevice::GetTextWidth of 109.

However, when ScOutputData::LayoutStrings asks for GetTextWidth it does so with
MapModeEnabled, so it gets a different OutputDevice::GetTextWidth result of
112.

Then there are lots of other funny magic numbers added in various places. The
zero margin is never actually zero, but always 2 (1 on each side). So
GetOptimalColWidth set the actual col width as 113 (109 + 2(margin) +
2(magic#).

Now in LayoutStringsImpl, ScOutputData::GetOutputArea gets the column width as
112 (112.994). Then aAreaParam.mnColWidth becomes 111 with
    --nMergeSizeX; // leave out the grid horizontally, also for alignment
and that is getting compared against GetNeededSize of 114 [112 + 2(margin)]
and so aAreaParam.mbLeftClip is set because nMissing = 3.

When mbLeftClip and the format is not General (because we pressed 'Add Decimal
Place'), then when we call
    bHasHashText = aVars.SetTextToWidthOrHash( aCell, aAreaParam.mnColWidth -
nTotalMargin );
we get a hash regardless of the width because
        // Not 'General' number format.  Set hash text and bail out.
        SetHashText();


The key of course is that GetTextWidth returns different results under
different circumstances.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to