[Solved] Keep ratio check box in "Position and Size" dialog?

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Serg St
Posts: 4
Joined: Wed Feb 07, 2018 9:07 pm

[Solved] Keep ratio check box in "Position and Size" dialog?

Post by Serg St »

Hello,
I need to select or unselect "Keep ratio" check box in "Position and Size" dialog window programmatically for embedded image in LibreOffice Calc with Basic macro.
Could you provide some code example?
Last edited by Serg St on Mon Apr 02, 2018 3:06 pm, edited 2 times in total.
LibreOffice 6.0.0.3 on Windows 7 Professional 32 bit
User avatar
Zizi64
Volunteer
Posts: 11359
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: "Keep ratio" check box in "Position and Size" dialog?

Post by Zizi64 »

Just two tips:

Apply a predefined style by your macro (instead of the direct formatting commands).

Install and use one of the existing object inspection tools:
MRI
XrayTool
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
Posts: 11359
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: "Keep ratio" check box in "Position and Size" dialog?

Post by Zizi64 »

There are two properties of the picture objects (I just Xrayed them):
Ratio.png
But when you modify the width or height of a picture by macro, you need to calculate the original ratio, and must calculate the new another size parameter.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Serg St
Posts: 4
Joined: Wed Feb 07, 2018 9:07 pm

Re: "Keep ratio" check box in "Position and Size" dialog?

Post by Serg St »

I tried to use Xray.
I saved properties of the object com.sun.star.comp.sc.ScShapeObj to the first text file (the "Keep ratio" checkbox was not checked).
Then i check "Keep ratio", explored object properties again with Xray and saved the result to second text file.
Then i compared this two text files - they was absolutely equal - so Xray didn't show the change of "Keep ratio" checkbox.
What else can i do?
LibreOffice 6.0.0.3 on Windows 7 Professional 32 bit
Serg St
Posts: 4
Joined: Wed Feb 07, 2018 9:07 pm

Re: "Keep ratio" check box in "Position and Size" dialog?

Post by Serg St »

I cannot find sufficient property for "Keep ratio" check box.
I tried to do it with MRI and XRay.

But i found the answer here:
viewtopic.php?f=10&t=234

They said in that topic:
"The "Keep ratio" option only affects the dimensions as you enter them in the dialog. If you type 4" for the height, OOo will calculate the appropriate width for that height and put that in the width entry. It has no effect whatsoever on the graphical (mouse) resizing.
If you need that when using the mouse, hold down the shift key while you drag a corner."

From that topic i can make a decision that picture object has no property "Keep ratio" cause this check box only affects the behaviour of "Position and Size" dialog box.

Anyway, thank you Tibor for help.
LibreOffice 6.0.0.3 on Windows 7 Professional 32 bit
Post Reply