Thanks Miklos for your feedback.
I found the code for Draw both in SdrObject::ImpDragCalcRect [1] and
SdrTextObj::ImpDragCalcRect [2]
But it is not used for charts. I noticed that the rules to make
proportional with or without Shift are different between drawing objets
and charts :
- for Drawing objects: default is not proportional
- for Chart and Pictures: default is proportional for corners handles
and not proportional for edge handles
Does anyone has some code pointers for resizing a picture or a chart?
Best regards
Laurent
[1]
https://opengrok.libreoffice.org/xref/core/svx/source/svdraw/svdobj.cxx?r=1c2df42580f381ccfdd1863bc1da4c81314533aa#1252
[2]
https://opengrok.libreoffice.org/xref/core/svx/source/svdraw/svdotxdr.cxx?r=5e55d482b19812e2fc3063eb7e718d7013635b33#74
Le 01/04/2025 à 10:54, Miklos Vajna a écrit :
Hi Laurent,
On Mon, Mar 31, 2025 at 07:37:49PM +0200, Laurent Balland
<[email protected]> wrote:
I'm working on bug 163816 [1] to preserve ratio Width/Height of an OLE
object (such as a chart in Calc) when Shift is pressed. Work under progress
is here [2].
I suppose that such behavior is already coded somewhere in LibO (for
instance when resizing an object in Draw). Can someone provide some
interesting code pointers?
I believe SdrSnapView::SetOrtho() is related, also Writer's
SwWrtShell::Drag() is related, this is called "proportional" resizing.
See the code at
<https://github.com/libreoffice/core/blob/3e88456b7135ef2cd0f0121d46cc56436ce56ee5/sw/source/uibase/docvw/edtwin.cxx#L4510-L4543>,
hopefully some of that is also relevant for Calc.
Regards,
Miklos