Issue 98734 - Image control in dialog does not obey Scale : Keep Ratio
Summary: Image control in dialog does not obey Scale : Keep Ratio
Alias: None
Product: General
Classification: Code
Component: code (show other issues)
Version: DEV300m39
Hardware: PC All
: P3 Trivial with 3 votes (vote)
Target Milestone: 4.2.0
Assignee: AOO issues mailing list
QA Contact:
Keywords: oooqa
Depends on:
Reported: 2009-02-02 11:07 UTC by bmarcelly
Modified: 2015-01-26 09:12 UTC (History)
4 users (show)

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

Patch to support ScaleMode export and import for Image control (7.88 KB, patch)
2014-01-25 12:29 UTC, hanya
no flags Details | Diff
Document contains test macro to verify (12.01 KB, application/vnd.oasis.opendocument.text)
2015-01-26 09:11 UTC, hanya
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description bmarcelly 2009-02-02 11:07:49 UTC
Since DEV300M37 the feature requested in Issue 93264 is introduced.
It works OK on Image controls in Forms.

In an dialog, an image control keeps ratio in the IDE, but not when 
executing the dialog, and not in Test mode.

Steps to reproduce:
In the IDE, insert a new Basic dialog.
Put an image control on the dialog.
In the Properties panel, set Graphics to an image. Make sure that Scale is : Keep 
Set the dimensions of the image control different from the image.
You can see the image keeps correct proportions in the IDE.
Click button Test Mode On/Off : the displayed image does not have correct proportions.
Same when executing the dialog.
Comment 1 Frank Schönheit 2009-02-02 11:32:13 UTC
fs->ab: oops, this property slipped into the dialog editor by accident only.
Since dialogs use a positive-list during export (i.e. only properties on that
list are exported), every new AWT-level property needs explicit handling in the
dialog editor, which is why I usually disable new properties there :)
Comment 2 lohmaier 2010-03-19 20:31:07 UTC
confirmed by fs → setting to new.
Comment 3 bmarcelly 2011-01-27 10:34:53 UTC
11 months later, this bug is still not corrected in OOo 3.3. There is not even a
target milestone set.
This control is nearly unusable in dialogs.
Comment 4 hanya 2014-01-25 12:29:50 UTC
Created attachment 82390 [details]
Patch to support ScaleMode export and import for Image control

ScaleMode property is not exported/imported to xdl file from ImageControl 
when the dialog is stored.
The attached patch contains the changes to support ScaleMode property for 

There is a problem between ScaleImage and ScaleMode property during createPeer call.
Dialog importer loads xdl file and construct dialog model and loads properties from 
the file. It is happend before the peer created of the dialog.
When the peer is created by calling UnoControl::createPeer method, 
in the method, the control is updated from properties of the model by updateFromModel method. 
This makes the property change event fired, so UnoControl::ImplModelPropertiesChanged respond to it.
The problem is happend at the end of this method, ImplSetPeerProperty method 
is called for each properties should be to set to the peer.
VCLXImageControl::setProperty method is called for ScaleImage property and 
the value from ScaleMode property is overwritten.
Comment 5 Frank Schönheit 2014-02-19 05:31:15 UTC
ob clause: The following should be read with keeping in mind that it is a few years ago when I last really  worked on the OOo codebase...

ImplModelPropertiesChanged has that DoesDependOnOthers call, which is already used for the purpose of deferring certain properties, so they're set only after other props have been set. That mechanism is ugly, but works. Maybe you can just return sal_True in that method, for the ScaleMode.
Comment 6 hanya 2015-01-26 09:04:37 UTC
Thanks, Frank. Works well now with bDependsOnOthers == true.
Comment 7 SVN Robot 2015-01-26 09:06:53 UTC
"hanya" committed SVN revision 1654744 into trunk:
#i98734# store and load ScaleMode property of image control on dialogs
Comment 8 hanya 2015-01-26 09:11:43 UTC
Created attachment 84470 [details]
Document contains test macro to verify

To verify the fix, 
- open the attached document
- click "Execute" field on the writer document
-> opens the dialog having three image controls with the image placed on the writer document
The middle image having label "Keep ratio" should be shown with correct image ratio. 
On AOO 4.1.1, the middle image is shown like the same with "Fit to size".
Comment 9 hanya 2015-01-26 09:12:36 UTC
Fixed on trunk.