Re: Problems with SetSnapRect() for rotated and/or sheared custom shapes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

next steps in SetSnapRect().

Working on tdf#119191, I have noticed, that there the caller of SetSnapRect() assumes, that the shape shrinks/grows so, that it fits into its anchor cell. That works for a legacy rectangle, for example, but it does not work for custom shapes, which are rotated and/or sheared.

So there are at least two use cases, where SetSnapRect() is applied:
(1) Rescue a pos/size and apply it later.
(2) Fit a shape into a given rectangle.

SetSnapRect() is in most cases used in the form SdrObject->SetSnapRect() and the actual shape type is determined in last binding. So I think it is very error-prone to change SetSnapRect() now.

I have a different idea, that should work at least intermediately:
There exists the method AdjustToMaxRect()
https://opengrok.libreoffice.org/xref/core/include/svx/svdobj.hxx?r=7eb26ece#624
It would solve the use case (2). When ever there is a caller, that wants to fit a custom shape into a given rectangle, it can use AdjustToMaxRect() instead of SetSnapRect(). Later it would still be possible to move the calculations from AdjustToMaxRect() to SetSnapRect(), if someone wants to clear up the use of SetSnapRect().

I have now implemented AdjustToMaxRect() for custom shapes and changed two callers in sc to use this instead of SetSnapRect().

It would be nice, if you look, whether you like this idea.

The proposal is in https://gerrit.libreoffice.org/#/c/84216/.

Kind regards
Regina
_______________________________________________
LibreOffice mailing list
LibreOffice@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/libreoffice




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux