Created attachment 160517 [details] Sample Java extension to reproduce the issue The method calcAdjustedSize() of the UNO interface does not return proper height/width for mutline checkboxes and hyperlinks. A sample extension is attached. # Steps to reproduce: 1) install the attached sample extension "StarterProject.oxt" 2) start LO Writer 3) in the menu, select "Test Extension" -> "Show Dialog" to show the sample dialog 4) press the "Resize" button, which calls the 'calcAdjustedSize' method (with value 500 for width and 50 for the height) to calculate the proper size for the form controls, then resizes to the returned size using 'setPosSize' 5) check the text shown next to the checkbox (second last control) and the hyperlink (last control) # Result: * The text to the checkbox is much wider than the expected width of 500, and still cut off, since it does not fit into one line. * The text for the hyperlink control is incomplete, since it is just one line, but cut off at width 500. A screenshot will be attached. # Expected result: Both, the text for the checkbox and that for the hyperlink control should be complete, split over multiple lines, and not exceed the width of 500. # Version used Version: 7.0.0.0.alpha0+ Build ID: 934fd1c617d1f7fba90f922bf2d526ea3f35f9b7 CPU threads: 4; OS: Linux 5.6; UI render: default; VCL: gtk3; Locale: en-GB (en_GB.UTF-8); UI-Language: en-US Calc: threaded and the result is similar when using the gen/x11 VCL plugin instead. # More information/notes The relevant Java method from the extension to do the resizing looks as follows (whole extension source code will be attached): public ActionOneDialog(XComponentContext xContext) { this.dialog = DialogHelper.createDialog("ActionOneDialog.xdl", xContext, this); XButton button = DialogHelper.getButton(dialog, "Resize"); button.addActionListener(new XActionListener() { @Override public void disposing(EventObject arg0) { } @Override public void actionPerformed(ActionEvent arg0) { String output = "Control: %s, calculated Width %d, maximum Width %d, calculated Height %d"; Size max = new Size(500, 50); Size size; XLayoutConstrains lc; XWindow window; Rectangle r = null; XFixedText label = DialogHelper.getLabel(dialog, "Label1"); lc = UnoRuntime.queryInterface(XLayoutConstrains.class, label); size = lc.calcAdjustedSize(max); System.out.println(String.format(output, "Label1", size.Width, max.Width, size.Height)); window = UnoRuntime.queryInterface(XWindow.class, label); r = window.getPosSize(); window.setPosSize(r.X, r.Y, size.Width, size.Height, PosSize.POSSIZE); XTextComponent text = DialogHelper.getEditField(dialog, "TextField1"); lc = UnoRuntime.queryInterface(XLayoutConstrains.class, text); size = lc.calcAdjustedSize(max); System.out.println(String.format(output, "TextField1", size.Width, max.Width, size.Height)); window = UnoRuntime.queryInterface(XWindow.class, text); r = window.getPosSize(); window.setPosSize(r.X, r.Y, size.Width, size.Height, PosSize.POSSIZE); XListBox list = DialogHelper.getListBox(dialog, "ListBox1"); lc = UnoRuntime.queryInterface(XLayoutConstrains.class, list); size = lc.calcAdjustedSize(max); System.out.println(String.format(output, "ListBox1", size.Width, max.Width, size.Height)); window = UnoRuntime.queryInterface(XWindow.class, list); r = window.getPosSize(); window.setPosSize(r.X, r.Y, size.Width, size.Height, PosSize.POSSIZE); XComboBox combo = DialogHelper.getCombobox(dialog, "ComboBox1"); lc = UnoRuntime.queryInterface(XLayoutConstrains.class, combo); size = lc.calcAdjustedSize(max); System.out.println(String.format(output, "ComboBox1", size.Width, max.Width, size.Height)); window = UnoRuntime.queryInterface(XWindow.class, combo); r = window.getPosSize(); window.setPosSize(r.X, r.Y, size.Width, size.Height, PosSize.POSSIZE); XCheckBox check = DialogHelper.getCheckBox(dialog, "CheckBox1"); lc = UnoRuntime.queryInterface(XLayoutConstrains.class, check); size = lc.calcAdjustedSize(max); System.out.println(String.format(output, "CheckBox1", size.Width, max.Width, size.Height)); window = UnoRuntime.queryInterface(XWindow.class, check); r = window.getPosSize(); window.setPosSize(r.X, r.Y, size.Width, size.Height, PosSize.POSSIZE); XFixedHyperlink link = DialogHelper.getLink(dialog, "Hyper1"); lc = UnoRuntime.queryInterface(XLayoutConstrains.class, link); size = lc.calcAdjustedSize(max); System.out.println(String.format(output, "Hyper1", size.Width, max.Width, size.Height)); window = UnoRuntime.queryInterface(XWindow.class, link); r = window.getPosSize(); window.setPosSize(r.X, r.Y, size.Width, size.Height, PosSize.POSSIZE); } }); }
Created attachment 160518 [details] Source code of sample extension
Created attachment 160519 [details] Screenshot after resizing This bug was initially reported to me by another person inside our organization. I'm currently taking a look.
Michael Weghorn committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/2539f1d142e0077dfeec36ef349a1f5443f1c94b tdf#132832 calcAdjustedSize: Take max width into account It will be available in 7.0.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Fixed on master, backport for 6.4 pending at https://gerrit.libreoffice.org/c/core/+/93798
Michael Weghorn committed a patch related to this issue. It has been pushed to "libreoffice-6-4": https://git.libreoffice.org/core/commit/ae6d48c94da8d29fa0f34f801f99131fe6206f83 tdf#132832 calcAdjustedSize: Take max width into account It will be available in 6.4.5. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.