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
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.