Bug Hunting Session
Bug 40469 - Modifed Frame Style Options Not Preserved, "Keep Ratio" Option Unavailable
Summary: Modifed Frame Style Options Not Preserved, "Keep Ratio" Option Unavailable
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected)
Inherited From OOo
Hardware: All All
: medium minor
Assignee: Not Assigned
Keywords: difficultyBeginner, easyHack, skillCpp
: 49323 116847 (view as bug list)
Depends on:
Blocks: Writer-Styles-Frame
  Show dependency treegraph
Reported: 2011-08-29 12:36 UTC by hardy
Modified: 2019-09-10 08:38 UTC (History)
11 users (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description hardy 2011-08-29 12:36:45 UTC
This bug has been inside OpenOffice/LibreOffice for 6.5 years now, it's discussed here for example:


Summary: In the "type (size & position)" tab of "frame styles" definition, at least the following strange behaviors can be observed:
* keep aspect ratio is always greyed out
* the "automatic size" option does not work properly
* the values in "width" and "height" get reset to "0.04cm" 
  (or some other stupid number) every second or third time you use the dialog

This buggy behavior of all "frame styles" basically makes the use of those "frame styles" mostly pointless.

Frame Styles might not be the feature most LO users do use, but it is a very useful feature (and a feature that Word does not have to my knowledge), so why don't me make it work as it's ment to work?

Please to cope with this bug, I'd love to use the frame styles for styling all images consistently in a big document.
Comment 1 Björn Michaelsen 2011-12-23 12:40:51 UTC Comment hidden (obsolete)
Comment 2 hardy 2012-08-10 18:11:15 UTC
Sorry for the delay. I've tested for this bug in LO
But unfortunatelly it still DOES exists there without any improvements.
Please try to eleminate these funny behaviours that make the cool "frame styles" feature of LibreOffice mostly useless at the moment.
Comment 3 Joel Madero 2012-10-19 20:17:26 UTC
I can confirm 1 & 3
* keep aspect ratio is always greyed out
* the values in "width" and "height" get reset to "0.04cm"  (for me it's 0.02")
  (or some other stupid number) every second or third time you use the dialog

* the "automatic size" option does not work properly

Needs to have additional information. What does "does not work properly" mean?

I'm still going to mark as confirmed, we try not to bundle bugs like this but I think that if a developer takes on one, they can easily take on all three (if the third can be verified)

Editing title a bit

Minor -- Forces users to not user specific features in order to have high quality work

Medium - Not a lot of users use frame styles but for those who do this would be very problematic. 

Might be a bit difficult but I think ProposedEasyHack is valid. Preserving options shouldn't be too difficult, keep aspect ratio code is already available, just need to link it up to these settings and allow user to select it.
Comment 4 Joel Madero 2012-10-19 20:17:50 UTC
Confirmed on LibO Bodhi Linux
Comment 5 Michael Stahl (CIB) 2013-04-02 20:46:23 UTC
i can't reproduce the resetting of with/height here.
the "keep ratio" is grayed out though.

it seems a good start to investigate this would be
SwDocShell::Edit in sw/source/ui/app/docst.cxx
Comment 6 Björn Michaelsen 2013-10-04 18:47:38 UTC
adding LibreOffice developer list as CC to unresolved EasyHacks for better visibility.

see e.g. http://nabble.documentfoundation.org/minutes-of-ESC-call-td4076214.html for details
Comment 7 Julien Nabet 2013-11-26 21:30:36 UTC
New link to AOOo:
Comment 8 Julien Nabet 2013-11-26 21:54:22 UTC
Just noticed but when commenting line 885 of sw/source/ui/frmdlg/frmpage.cxx makes the keepratio checkbox enabled:
    881     if (bFormat)
    882     {
    883         // at formats no anchor editing
    884         m_pAnchorFrame->Enable(false);
    885         //m_pFixedRatioCB->Enable(sal_False);
    886     }
More investigation is needed of course.
See http://opengrok.libreoffice.org/xref/core/sw/source/ui/frmdlg/frmpage.cxx#881
Comment 9 Julien Nabet 2013-11-27 22:00:33 UTC
I tried 2 leads:
1) is it normal bFormat = sal_True and gdb session gave me this:
#0  SwFrmPage::SetFormatUsed (this=0x1cb36f0, bFmt=1 '\001') at /home/julien/compile-libreoffice/libo/sw/source/ui/frmdlg/frmpage.cxx:2319
#1  0x00002aaad88ac24a in SwTemplateDlg::PageCreated (this=0x1fa0c30, nId=2, rPage=...) at /home/julien/compile-libreoffice/libo/sw/source/ui/fmtui/tmpdlg.cxx:437
#2  0x00002aaaad9a192c in SfxTabDialog::ActivatePageHdl (this=0x1fa0c30, pTabCtrl=0x1c97100) at /home/julien/compile-libreoffice/libo/sfx2/source/dialog/tabdlg.cxx:1324
#3  0x00002aaaad99fbfb in SfxTabDialog::Start_Impl (this=0x1fa0c30) at /home/julien/compile-libreoffice/libo/sfx2/source/dialog/tabdlg.cxx:747
#4  0x00002aaaad99f7d0 in SfxTabDialog::Execute (this=0x1fa0c30) at /home/julien/compile-libreoffice/libo/sfx2/source/dialog/tabdlg.cxx:678
#5  0x00002aaad8824cad in AbstractTabDialog_Impl::Execute (this=0x18a8cb0) at /home/julien/compile-libreoffice/libo/sw/source/ui/dialog/swdlgfact.cxx:103
#6  0x00002aaac947834c in SwDocShell::Edit (this=0x15f39f0, rName="Frame", rParent="", nFamily=4, nMask=0, bNew=0 '\000', sPage="", pActShell=0x0, bBasic=0 '\000')
    at /home/julien/compile-libreoffice/libo/sw/source/ui/app/docst.cxx:749

2) if it's normal that ratio is disabled if bFormat = true
git history shows it's been like this since the initial import (in 2000)

I don't know what to conclude with all this however.
Comment 10 Gilvan Vilarim 2014-05-17 20:32:32 UTC
Comfirmed in LO 4.2.4.  The frame styles do not have thwe same behavior and some options do not have effect on graphics.

You cannot apply frame styles to a bunch of inserted pictures, because formatting optios inside frame style do not work well.
Comment 11 Andrei Furtuna 2014-05-20 14:38:46 UTC
Cannot identify described bug in version 4.3 dev, "keep ration" option is available and working properly. 

Gilvan Vilarim, can you describe more detailed the bug situation you got?
Comment 12 Gilvan Vilarim 2014-05-23 23:08:44 UTC
1 - Create or open a text document

2 - Go to Insert > Image > From File

3 - Choose an image and clik Open (note: this dialog box always chooses a default frame style for graphics, which is "Graphics")
The image is inserted and you can use the Stylist to see that the frame style "graphics" was applied automatically.

4 - Try to apply another frame style to image (e.g.: Formula). Select image and double-click on a different frame style.

Expected behavior: the image should follow the attributes of the Formula style

Actual behavior: the new style is applied, but some attributes become grayed inside the style (right-click on Formula frame style > Type); the image also gets stretched/shrinked, and position parameteres (To... combobox) do not show the same options as in other frame styles. It looks like an erratic behavior.

I guess frame styles should have the same behavior. The decision to use Graphics, Formula, OLE (etc) styles should only be a matter of categorization.

What I (and many others) really need is: apply the same frame style to all images inside a text document, then realign and anchor them to paragraphs, not anchor to pages. I could not do that with styles.

Best regards,
Comment 13 Gilvan Vilarim 2014-05-24 00:22:41 UTC
This bus seems to have something to do with bug #79160
Comment 14 MartinPC 2015-01-02 20:18:24 UTC
CONFIRMED: The inability to preserve inserted images' aspect ratio in frame styles in LibreOffice Writer on Windows 7 x64. The "Keep ratio" checkbox is grayed-out.

This is actually a *major* problem for users who must insert a large number of disparately dimensioned images into a document and set them at either a uniform width or uniform height, without stretching or squishing them. The time required to format (or re-format) hundreds of inserted images individually is hundreds of time higher than the time required to modify a single style.

A potential distant-second-best workaround might be to write a macro to apply initial or subsequently modified frame properties to inserted images individually. While still very tedious and time-consuming, this would cut down on the time required by a factor of, say, 10 to 20, and would reduce the potential for isolated typing mistakes even more. Unfortunately for ordinary (non-coder) users, setting frame properties doesn't seem to be amenable to recording: when I tried it, non-default settings in only one tab were recorded -- and I'm not sure all of *them* were -- and after a second or third attempt, the record macro feature stopped working. (Clicking the "Stop recording" button closed the box without offering the user a chance to name the macro.) I haven't searched for this bug yet or fully explored it myself, but I mention it as it's relevant here. 

Ideally, in the Frame Style dialog box's Type tab, the user should be able to specify *either* width *or* height, click the "Keep ratio" checkbox, and have the unspecified dimension left blank and free to be calculated on the fly for each inserted image the frame style is applied to.
Comment 15 Tor Lillqvist 2015-01-05 09:28:30 UTC
Andrei, are you actually working on this any more? Keeping the bug in the "assigned" state if you are not working on it is counter-productive, as it likely prevents others interested in an EasyHack from working on it.
Comment 16 Robinson Tryon (qubit) 2015-12-13 10:58:05 UTC Comment hidden (obsolete)
Comment 17 jani 2016-02-17 07:14:41 UTC
Andrei@ A polite ping are you still working on this ?
Comment 18 Andrei Furtuna 2016-02-17 07:49:12 UTC
Sorry community, I didn't figure it out. And I'm not working more at this bug. I'm changing the status. (In reply to jan iversen from comment #17)
> Andrei@ A polite ping are you still working on this ?
Comment 19 Robinson Tryon (qubit) 2016-02-18 14:52:30 UTC Comment hidden (obsolete)
Comment 20 Cor Nouws 2016-09-28 08:10:22 UTC
*** Bug 49323 has been marked as a duplicate of this bug. ***
Comment 21 charan 2017-02-20 21:54:35 UTC
I want to work on this.But i am not very clear about what to implement
Comment 22 jani 2017-02-20 21:56:27 UTC
(In reply to charan from comment #21)
> I want to work on this.But i am not very clear about what to implement

If you are not sure what to implement, maybe choosing another easyhack would be simpler. The easyhack are supposed to be easy and explained in the comments.
Comment 23 Gwangyeon 2017-08-17 11:02:41 UTC
Does it mean that "Keep ratio" option of type tap of Frame... of Frame of Insert does not properly work? I can't see the problem in this section
Comment 24 Koen Roggemans 2017-12-18 13:26:16 UTC
If you create a new frame style (image, formula, ...), you can't select to keep the ratio.
The only thing that works for me is to import an image first, then set the image how you want the frame style to be and then create a new style from the selected image.
Comment 25 raal 2018-04-09 12:13:20 UTC
*** Bug 116847 has been marked as a duplicate of this bug. ***
Comment 26 Julien Nabet 2019-09-10 08:38:11 UTC
On Win10 with LO, "keep ratio" isn't disabled, I can enable it.

Then if I change width, it changes the height
if I change height, it changes the width
so as expected.

I don't know anything about frame style so can't test really.

Could someone give it a new try with a recent LO version or provide to me a step by step process to reproduce the faulty behaviour?