Issue 115391 - resizing a group of shapes set to "resize shape to fit text" messes up connectors and sizes
Summary: resizing a group of shapes set to "resize shape to fit text" messes up connec...
Alias: None
Product: Draw
Classification: Application
Component: formatting (show other issues)
Version: OOO330m9
Hardware: All All
: P3 Critical with 2 votes (vote)
Target Milestone: 4.1.0
Assignee: Armin Le Grand
QA Contact: Oliver-Rainer Wittmann
Depends on:
Reported: 2010-11-04 09:39 UTC by axonis
Modified: 2017-05-20 10:35 UTC (History)
1 user (show)

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

Resize this group of shapes and you'll see that sizes and connectors get messed up (8.81 KB, application/
2010-11-04 09:44 UTC, axonis
no flags Details
Resize this group of shapes and you'll see that sizes and connectors get messed up -- this is a better sample. Tested for OOO330M13. (9.06 KB, application/
2010-11-04 09:54 UTC, axonis
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description axonis 2010-11-04 09:39:00 UTC
When a group of shapes that have been set to resize to fit text is resized, the
sizes of the shapes and the connectors get completely messed up. See the linked
youtube video. The bug still exists in OOO330m13.
Comment 1 axonis 2010-11-04 09:44:32 UTC
Created attachment 72846 [details]
Resize this group of shapes and you'll see that sizes and connectors get messed up
Comment 2 axonis 2010-11-04 09:54:15 UTC
Created attachment 72847 [details]
Resize this group of shapes and you'll see that sizes and connectors get messed up -- this is a better sample. Tested for OOO330M13.
Comment 3 wolframgarten 2010-11-08 08:16:21 UTC
Reproducible. Reassigned.
Comment 4 axonis 2013-09-16 09:45:37 UTC
Changed the importance to critical as

"The bug make it impossible to work with the version of test on a feature."

It is impossible to resize a drawing that contains connected shapes that are set with the "resize shape to fit text" option.

Once the drawing is messed up, UNDO doesn't work. That leads to formatting loss which in the case of a flowchart is actual DATA LOSS.
Comment 5 Armin Le Grand 2013-09-17 10:53:43 UTC
ALG: Tried with connectors removed, same effect. Tried with single CoustomShapes, works well. Tried with a single CustomShape in a group, looks better, but undo does not go back to former size. Problem seems to be the resize on grouped CustomShapes, even with a single one. Taking a look...
Comment 6 Armin Le Grand 2013-09-17 12:24:41 UTC
ALG: There are differences in the interaction handling for CustomShapes; when not a group object, the overlay geometry is created based on the fallback-geometry of the CustomShape defined by SdrObjects where none of these uses a bTextFrame flag. When in a group, directly SdrObjCustomShape::Resize is used which has bTextFrame set. Wit bTextFrame set there seem to be errors in the handling of SdrTextObj::NbcResize at the bottom, the SetRectsDirty call is too late and the rcecalculations of MinTextSize fittings are based on the wrong (the old) rectangle. Checking if this can be cured with invalidating these rects early...
Comment 7 Armin Le Grand 2013-09-17 13:57:34 UTC
ALG: Problem is indeed the lower part of SdrTextObj::NbcResize; it uses NbcSetMinTextFrameWidth and NbcSetMinTextFrameHeight to adapt the sizes, but these trigger recalculations (over the path triggered by ItemChange) and thus lands in NbcAdjustTextFrameWidthAndHeight between these two calls (the call is triggered by hand afterwards anyways). Thus, the calulation is done with MinTextFrameWidth set but MinTextFrameHeight not. This leads to landing at SdrObjCustomShape::ImpCalculateTextFrame where in the 2nd if strange back-calculations are triggered which then create the wrong text frame sizes.
Checking why/what/which/how/...
Comment 8 Armin Le Grand 2013-09-18 13:13:16 UTC
ALG: This is hard (old) stuff; the bool bTextFrame which is used to decide if e.g. NbcResize will update AutoGrowWidth/Height is used as a flag for the 'resize shape to fit text' setting; when this is set, bTextFrame is used at SdrTextObj (the class CustomShape is derived from) to change the behaviour to be close to a TextFrame. Also the Item used to remember that state is SdrTextAutoGrowHeightItem; this is *reused* compared to SdrTextObj where it does what the name says, see comment in svdoashp.hxx line 2556:

// in context with the SdrObjCustomShape the SdrTextAutoGrowHeightItem == true -> Resize Shape to fit text,
//									   the SdrTextAutoGrowWidthItem  == true -> Word wrap text in Shape

Ahhh(!). Also MinTextFrameWidth/Height for CustomShape relies on the text frame specific to the CustomShape (is fetched using GetTextBounds), not on the internal rect of the TextObject, thus all changes in the 'resize shape to fit text' mode wrongly resetted MinFrameTextWidth/Height to wrong values anyways.
Experimenting now with different local virtual methods for adapting MinFrameTextWidth/Height for Text and CustomShapes...
Comment 9 Armin Le Grand 2013-09-18 16:04:56 UTC
ALG: I have now found a way to get it work as intended (resize group, but CustomShapes in mode 'resize shape to fit text' will stay at their size). This needs thorough testing of all CustomShape, TextShape and DrawShape stuff (since CustomShape and DrawShape are derived from TextShape, so both may be influenced). It's a tough problem (I told at the CustomShape development not to derive from SdrTextObj, and I will have to do this complex change in parallel in aw080 where most of the involved stuff is changed heavily)...
Comment 10 axonis 2013-09-18 16:38:15 UTC
(In reply to Armin Le Grand from comment #9)
> CustomShapes in mode 'resize shape to fit text' will stay at their size).

This is the expected behavior. If the user wishes to change the sizes of shapes that derive from font size then he should change the size of the fonts or the complete object instead.

Thanks. Really. This bug is preventing me from using Drawing for 7 years...
Comment 11 Armin Le Grand 2013-09-19 09:49:33 UTC
ALG: @axonis: Thanks for your ack, I fully agree. Good idea with the font size change, tried that out, works well :-)

Did intense tests with all kinds of shapes, looks good. Preparing commit...
Comment 12 Armin Le Grand 2013-09-19 11:56:56 UTC
ALG: Committed, added some changes during adaption to aw080 (ongoing). Done in trunk, though.
Comment 13 SVN Robot 2013-09-20 13:05:12 UTC
"alg" committed SVN revision 1524700 into trunk:
i115391 corected from isLocked to IsPasteResize which was used in modifiers f...
Comment 14 SVN Robot 2013-09-20 13:05:22 UTC
"alg" committed SVN revision 1524698 into trunk:
i115391 corected from SetObejctItem to usage of local SfxItemSet
Comment 15 SVN Robot 2013-09-20 13:05:38 UTC
"alg" committed SVN revision 1524675 into trunk:
i115391 better support for MinTextSize settings for TextShapes and CustomShapes
Comment 16 Oliver-Rainer Wittmann 2014-02-26 10:02:53 UTC
taking over for verification
Comment 17 Oliver-Rainer Wittmann 2014-02-26 12:51:10 UTC
Using recent Windows build bot installation set (rev. 1571677) I can verify the made fix.
Resizing does not change the size of the 'resize to fit text' shapes inside the group. Undo works, too.
Unset 'resize to fit text' for one of the shapes and resizing the group also results in the expected behavior.

--> verified