Bug 144991 - EDITING: The "Increase Indent" and "Decrease Indent" increment step should be the width of 3 space chars (using the default style font) when working in an xlsx document
Summary: EDITING: The "Increase Indent" and "Decrease Indent" increment step should be...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.3.0.0 alpha0+
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:xlsx
: 125205 (view as bug list)
Depends on:
Blocks: XLSX
  Show dependency treegraph
 
Reported: 2021-10-08 07:14 UTC by Kevin Suo
Modified: 2022-09-14 14:59 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Suo 2021-10-08 07:14:05 UTC
With the fix of bug 130104 by commit 6b93ee72df1aa42d1a3482ffc396bd0c23134f8b (Mon Oct 04 23:11:30 2021 +0800), now in both xlsx import and export the cell indent is correctly set as the width of 3 space chars. However, now if the user modifies the indent value on the Calc UI using "Increase Indent" and "Decrease Indent" toolbar buttons, the increment step is currently 10pt (200 twips) as defined by SC_INDENT_STEP in sc/inc/global.hxx. This causes the user unable to set a proper indent value to be interoperable with other applications such as Excel. 

Steps to Reproduce:

1. Open attachment 175572 [details] with a LibreOffice version with the commit 6b93ee72df1aa42d1a3482ffc396bd0c23134f8b.

2. Observe that the indent is 7pt for cell A2 and 15pt for cell A3.

3. Put cursor in cell A2, then hit once the "Increase Indent" toolbar button.
Expected: the indent for cell A2 should change to 15pt (i.e., the same as cell A3).
Current: the indent for cell A2 is changed to 17pt (different from cell A3)

4. Put cursor in cell A11, then hit once the "Decrease Indent" toolbar button.
Expected: the indent for cell A11 should change to 67pt (i.e., the same as cell A10).
Current: the indent for cell A11 is changed to 65pt (different from cell A10).

5. Undo all changes, then change the font size of the Default style to 28pt (for both the Western and Asian font in case you have enabled Asian language), then save as another xlsx file.
Expected: the indent for each cell need to be updated to be the new width of 3-space chars when the default font family or size is udpated, thus upon resave the correct cell indent is exported into xlsx file.
Current: when the font for default style is updated, the cell indent is not updated. This causes the indent exported to xlsx file is wrong (now if you reopen the exported xlsx file, the indent for cell A2 changed to zero rather than 1 excel indent unit).
Comment 1 Mike Kaganski 2021-10-08 07:30:45 UTC
(In reply to Kevin Suo from comment #0)
> 5. Undo all changes, then change the font size of the Default style to 28pt
> (for both the Western and Asian font in case you have enabled Asian
> language), then save as another xlsx file.
> Expected: the indent for each cell need to be updated to be the new width of
> 3-space chars when the default font family or size is udpated, thus upon
> resave the correct cell indent is exported into xlsx file.

While I agree with #3 and #4 of the proposal, I don't think that #5 is a reasonable thing to do.

We do not express indents in terms of unnatural units like "default font's space width". That notation (and other places using same approach, like column widths represented in max digit width units) is a worst thing that MS could invent.

It is a reasonable request that when working with Excel file formats, we maybe adjust our default indent size to what would be saved to the file. But #5 requires more than that: it needs to use "space" unit internally in the document model.

Alternatively, #5 would require that on change of the default font, all cell formats are updated to change their indent values proportionally to the space width change.

I would suggest to limit #5 to this:

5. When default font is changed, the "{In|De}crease Indent" toolbar buttons should offer the new (updated) increment value - but all current indents in cells should not be affected.

That would need the change of the default style font to trigger this additional processing:

1. Check if current document is an Excel file format (check medium);
2. If so, calculate the new space width;
3. Then update SC_INDENT_STEP to be 3*new_space_width.

Eike: what do you think?
Comment 2 Heiko Tietze 2021-10-18 11:13:58 UTC
If we don't indent by space (which is reasonable) why would the unit need to vary in respect to the font size? My take: WF.
Comment 3 Heiko Tietze 2021-11-30 09:05:21 UTC
(In reply to Mike Kaganski from comment #1)
> Eike: what do you think?

=> NEEDINFO
Comment 4 Eike Rathke 2021-12-06 15:53:20 UTC
(In reply to Mike Kaganski from comment #1)
> 1. Check if current document is an Excel file format (check medium);
> 2. If so, calculate the new space width;
Of what font?

> 3. Then update SC_INDENT_STEP to be 3*new_space_width.
Relative to some arbitrary not installed font?

Sounds appealing at first, just what are the details/defaults..


(In reply to Heiko Tietze from comment #2)
> If we don't indent by space (which is reasonable) why would the unit need to
> vary in respect to the font size?
Because (something like) that is what Excel does with its ominous "units of default font".
Comment 5 Mike Kaganski 2021-12-06 16:58:56 UTC
(In reply to Eike Rathke from comment #4)
> (In reply to Mike Kaganski from comment #1)
> > 1. Check if current document is an Excel file format (check medium);
> > 2. If so, calculate the new space width;
> Of what font?

Of the same font that would be used to calculate width of indent :)

> > 3. Then update SC_INDENT_STEP to be 3*new_space_width.
> Relative to some arbitrary not installed font?

Yes, see above :)

I don't like the Excel thing myself; I realize that my suggestion is faaaar from perfect - just am trying to produce something to start discussion - and hopefully provide something actionable :)
Comment 6 Eyal Rozenberg 2022-06-21 20:16:08 UTC
A lay-person's question: Why the magic number 3 ? Is 2 or 4 spaces inherently bad, or is this actually configured somehow?
Comment 7 Mike Kaganski 2022-06-21 20:27:46 UTC
(In reply to Eyal Rozenberg from comment #6)
> Why the magic number 3

Because that's what ECMA-376 Part 1 "Office Open XML File Formats — Fundamentals and Markup Language Reference" sect. 18.8.1 "Alignment" tells:

> indent (Indent) An integer value, where an increment of 1 represents 3 spaces.
> Indicates the number of spaces (of the normal style font) of indentation for
> text in a cell. The number of spaces to indent is calculated as following:
> Number of spaces to indent = indent value * 3
Comment 8 Heiko Tietze 2022-06-23 09:43:25 UTC
No brainer if it's a standard.
Comment 9 Kevin Suo 2022-09-14 14:59:53 UTC
*** Bug 125205 has been marked as a duplicate of this bug. ***