Bug 105441 - styles don't resize shape with "resize shape to fit text" until turned off by a different style (updated steps in Comment 8)
Summary: styles don't resize shape with "resize shape to fit text" until turned off by...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
5.3.0.1 rc
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 126625 (view as bug list)
Depends on:
Blocks: ImpressDraw-Styles
  Show dependency treegraph
 
Reported: 2017-01-19 20:03 UTC by Justin C
Modified: 2021-09-07 06:21 UTC (History)
3 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 Justin C 2017-01-19 20:03:25 UTC
I actually tested this with version 5.3.0.2 [1].

[1]: http://dev-builds.libreoffice.org/pre-releases/rpm/x86_64/LibreOffice_5.3.0.2_Linux_x86-64_rpm.tar.gz

Bug #93135 fixed the "resize shape to fit text" property as it pertains to the **Format > Text...** menu item.  However, when enabling the same property on a style, the size of the shape remains unaffected under two scenarios:

1.  when "resize shape to fit text" is enabled in the style and then applied to the shape, and

2.  when the style is applied to the shape and then "resize shape to fit text" is enabled in the style.

The fubar nature of styles becomes more apparent when working with files saved in libreoffice 5.2.x, so I'm restricting the steps for reproduction to new files only.  A patch against the steps provided may not affect Draw documents created prior to the patch, and users may need to start a new document.


=== Steps to Reproduce (enable resize then apply style)

1.  Open LibreOffice Draw
2.  Start with a new document.
3.  Draw a square on the page.
4.  Add text to the square, e.g. "Hello world".
5.  Open "Styles and Formatting" sidebar.
6.  Right click on "Default" style and create New style named "Test".
7.  In Style Editor, select "Text" tab, then...
  a) Enable "Resize shape to fit text"
  b) Enable "Fit width to text"
  c) Click "OK"
8.  In "Styles and Formatting" sidebar...
  a) Select "Test" style
  b) Click the "Apply" bucket icon at the top (selecting this tool appears
     to be broken, you may have to select a shape on the page before you
     can use the tool).
9.  Click on the square on the page to apply the "Test" style to the square.
10.  Observe that the shape does not resize around the text:
  a)  immediately after applying the text, or
  b)  after editing the text, or
  c)  after resizing the shape manually.


=== Steps to Reproduce (apply style then enable resize)

1.  Open LibreOffice Draw
2.  Start with a new document.
3.  Draw a square on the page.
4.  Add text to the square, e.g. "Hello world".
5.  Open "Styles and Formatting" sidebar.
6.  Right click on "Default" style and create New style named "Test", and
    close the Style Editor Dialog.
7.  In "Styles and Formatting" sidebar...
  a) Select "Test" style
  b) Click the "Apply" bucket icon at the top (selecting this tool appears
     to be broken, you may have to select a shape on the page before you
     can use the tool).
8.  Click on the square on the page to apply the "Test" style to the square.
9.  Right click the "Test" style in the "Styles and Formatting" sidebar and select "Modify..." to open Style Editor Dialog.
10.  In Style Editor Dialog, select the "Text" tab, then...
  a) Enable "Resize shape to fit text"
  b) Enable "Fit width to text"
  c) Click "OK"
11.  Observe that the shape does not resize around the text:
  a)  immediately after saving the style, or
  b)  after editing the text, or
  c)  after resizing the shape manually.


=== About Info

Version: 5.3.0.2
Build ID: 5ad7b2889021c491af62f7930a4b1cb631392f16
CPU Threads: 8;
OS Version: Linux 4.8;
UI Render: default;
VCL: gtk2;
Layout Engine: new; 
Locale: en-US (en_US.UTF-8);
Calc: group


=== Additional notes

- In some tests, I noticed that applying the "Test" style after enabling
  "resize shape to fit text" might update the height of the shape, but
  not the width, though I could not identify any steps from scratch that 
  reproduced this
  behavior.
Comment 1 Buovjaga 2017-01-24 12:17:16 UTC
Confirmed the settings do not seem to be doing anything. I noticed that these options have been greyed out in previous versions.

Win 7 Pro 64-bit Version: 5.4.0.0.alpha0+
Build ID: 1c27286b9d5331634c073cd3e327bd941e61bbb6
CPU Threads: 4; OS Version: Windows 6.1; UI Render: default; 
TinderBox: Win-x86@39, Branch:master, Time: 2017-01-23_03:24:17
Locale: fi-FI (fi_FI); Calc: group
Comment 2 QA Administrators 2018-06-25 02:40:58 UTC Comment hidden (obsolete)
Comment 3 Justin C 2018-06-25 15:09:43 UTC
Retested with latest release of LibreOffice (6.0.4.2) as requested.

The second set of steps titled "Steps to Reproduce (apply style then enable resize)" now works for me.

The following steps still demonstrate the bug.

=== Steps to Reproduce (enable resize then apply style)

1.  Open LibreOffice Draw
2.  Start with a new document.
3.  Draw a square on the page.
4.  Add text to the square, e.g. "Hello world".
5.  Open "Styles and Formatting" sidebar.
6.  Right click on "Default" style and create New style named "Test".
7.  In Style Editor, select "Text" tab, then...
  a) Enable "Resize shape to fit text"
  b) Enable "Fit width to text"
  c) Click "OK"
8.  In "Styles and Formatting" sidebar...
  a) Select "Test" style
  b) Click the "Apply" bucket icon at the top (selecting this tool appears
     to be broken, you may have to select a shape on the page before you
     can use the tool).
9.  Click on the square on the page to apply the "Test" style to the square.
10.  Observe that the shape does not resize around the text:
  a)  immediately after applying the text, or
  b)  after editing the text, or
  c)  after resizing the shape manually.


=== About Info

Version: 6.0.4.2
Build ID: 9b0d9b32d5dcda91d2f1a96dc04c645c450872bf
CPU threads: 8;
OS: Linux 4.15;
UI render: default;
VCL: gtk2; 
Locale: en-US (en_US.UTF-8);
Calc: CL
Comment 4 Justin C 2018-06-25 15:34:55 UTC
Tested again with LibreOffice Beta.

Perhaps I don't understand what the bucket tool in the Styles pane is for.  In LO 5.3, the icon was a bucket and the tooltip, if I recall correctly, was "Apply".  In LO 6.0 and 6.1 beta, the bucket icon is replaced with a Paint Brush and tooltip of "Fill Format Mode".  My expectation was that the tool would apply the selected style to any shape I later clicked on (allowing for a style to be quickly applied to multiple shapes), but the behavior of the tool suggests that might not be the case.  E.g.  "Fill Format Mode" is disabled until I select a shape on the page.

If I enable resize, then apply the style by 1) selecting the shape, then 2) double-clicking the style, the shape resizes to fit the text as expected.

=== Revised steps that work (enable resize then apply style)

1.  Open LibreOffice Draw
2.  Start with a new document.
3.  Draw a square on the page.
4.  Add text to the square, e.g. "Hello world".
5.  Open "Styles and Formatting" sidebar.
6.  Right click on "Default" style and create New style named "Test".
7.  In Style Editor, select "Text" tab, then...
  a) Enable "Resize shape to fit text"
  b) Enable "Fit width to text"
  c) Click "OK"
8.  Select the square with the select tool.  Resize handles should appear on
    the shape.
9.  In "Styles and Formatting" sidebar...
  a) Double-click the "Test" style to apply it to the square.
10.  Observe that the shape DOES resize around the text:
  a)  immediately after applying the text, or
  b)  after editing the text, or
  c)  after attempts to resize the shape manually.


=== About

Version: 6.1.0.0.beta1
Build ID: 8c76dfe1284e211954c30f219b3a38dcdd82f8a0
CPU threads: 8;
OS: Linux 4.15;
UI render: default;
VCL: gtk2; 
Locale: en-US (en_US.UTF-8);
Calc: CL
Comment 5 QA Administrators 2019-06-26 02:45:31 UTC Comment hidden (obsolete)
Comment 6 QA Administrators 2021-06-26 03:28:25 UTC Comment hidden (obsolete)
Comment 7 Stéphane Guillou (stragu) 2021-09-06 23:59:26 UTC
*** Bug 126625 has been marked as a duplicate of this bug. ***
Comment 8 Stéphane Guillou (stragu) 2021-09-07 01:15:55 UTC
Still (partially) reproducible in 7.2, but I will try to clarify what is going in here.

First of all, note that in 7.2, the Default Drawing Style has the following options on by default in the "Text" tab:

- Fit height to text
- Word wrap text in shape
- Resize shape to fit text

When creating a rectangle and adding some text to it, it has the style "Default Drawing Style". (You can confirm that with right-click on the shape > Edit Style...)

So, to start with, it seems that a rectangle with some text in it doesn't follow the default style's options by resizing it to the text.

(The issue with "Fit width to text" seems to be that it is ignored entirely in all cases, which should probably be a separate bug. I am ignoring it here, and only focusing on "Resize shape to fit text", to keep things as simple as possible. It needs further investigating.)

Updated steps for LO 7.2.0.4:

=== Steps to Reproduce ===

0.  Restore everything to factory settings
1.  Open LibreOffice Draw
2.  Start with a new document
3.  Draw two rectangles on the page
4.  Add text to both rectangles, e.g. "apply style" for the first one, and "modify style" for the second one. Notice that the rectangle does not adapt to the size of the text (even though that is the default in the style).
5.  Open "Styles" sidebar
6.  Create two styles:
   a)  Right-click on "Default Drawing Style" and create New style named "resize on". Click "OK" (it is a copy of the original).
   b)  Right-click on "Default Drawing Style" and create New style named "resize off". Untick "Resize shape to fit text". Click "OK".
7.  Select first shape on page
8.  Double-click on "resize on" style: nothing happens, it still doesn't shrink to the size of the text.
9.  Double-click on "resize off" style: nothing happens, as expected. However:
10. Double-click on "resize on" once more: now, the shape shrinks to the text. The option needed to be off in the style applied first, before being taken into account when turned on!
11. Now onto the _modification_ of the default style: modify the Default Drawing Style by unticking "Resize shape to fit text", click "OK". The second shape does not change, as expected.
12. Modify the Default Drawing Style again by turning "Resize shape to fit text" back on, click "OK". The second shape still does not shrink to the text size.
13. However, if you apply the style "resize off" to that second shape, and then turn on "Resize shape to fit text" in the "resize off" style, you'll see it does shrink to the size of the text.

=== Conclusion ===

So, trying to summarise in one sentence: the style setting "resize shape to fit text" is not taken into account _until_ it is turned off by applying a _separate style_ that has it off.

I hope I was able to summarise accurately in this comment...

Version used:

Version: 7.2.0.4 / LibreOffice Community
Build ID: 9a9c6381e3f7a62afc1329bd359cc48accb6435b
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded
Comment 9 Stéphane Guillou (stragu) 2021-09-07 06:21:30 UTC
Also reproduced as described in Comment 8 on Windows 10:

Version: 7.2.1.1 (x64) / LibreOffice Community
Build ID: 3cfc32d9754d2d239bd8ce2941029c12873010c1
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: default; VCL: win
Locale: en-AU (en_AU); UI: en-US
Calc: threaded