Apache OpenOffice (AOO) Bugzilla – Issue 98734
Image control in dialog does not obey Scale : Keep Ratio
Last modified: 2015-01-26 09:12:36 UTC
Since DEV300M37 the feature requested in Issue 93264 is introduced. It works OK on Image controls in Forms. In an OpenOffice.org 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 Ratio. 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.
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 :)
confirmed by fs → setting to new.
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.
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 ImageControl. 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.
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.
Thanks, Frank. Works well now with bDependsOnOthers == true.
"hanya" committed SVN revision 1654744 into trunk: #i98734# store and load ScaleMode property of image control on dialogs
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".
Fixed on trunk.