svtools/source/uno/wizard/wizardpagecontroller.cxx | 26 +++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-)
New commits: commit f933248c042e6fa8ed29daf19fd8bba47a5cc3d6 Author: Ilhan Yesil <ilhanye...@gmx.de> AuthorDate: Fri Dec 16 07:30:13 2022 +0100 Commit: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> CommitDate: Thu Mar 9 12:41:57 2023 +0000 Related: tdf#132110 use the container child size as default size if the container size wasn't changed Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147382 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit 9c978e4c75e342b2345ff4fcbd1b5751627d8baf) also includes: tdf#152508 Initiate container request size after call of createPage As the container's request size of wizard pages can't be changed directly by the UNO call setPosSize, the UNO caller can set the size in the callback function createPage, this size will then taken as request size. This doesn't solve the problem entirely as descriped in tdf#152508, but the most important is, that the wizard page can be initialized with an appropriate size at startup. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144287 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> (cherry picked from commit aef2ee893c7b76794bc9db869f08bbbea60606a8) Change-Id: I0bd4843768b727b8b75cbcb7ec92bd2b501b550d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147412 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> diff --git a/svtools/source/uno/wizard/wizardpagecontroller.cxx b/svtools/source/uno/wizard/wizardpagecontroller.cxx index 333d7ce27351..57ed08c6f164 100644 --- a/svtools/source/uno/wizard/wizardpagecontroller.cxx +++ b/svtools/source/uno/wizard/wizardpagecontroller.cxx @@ -50,10 +50,28 @@ namespace svt::uno try { // Plug a toplevel SalFrame into the native page which can host our awt widgetry - m_xWizardPage.set(m_xController->createPage(pParent->CreateChildFrame(), i_nPageId), UNO_SET_THROW); - - Reference< XWindow > xPageWindow(m_xWizardPage->getWindow(), UNO_SET_THROW); - xPageWindow->setVisible( true ); + css::uno::Reference<css::awt::XWindow> xChildFrame = pParent->CreateChildFrame(); + com::sun::star::awt::Rectangle r0 = xChildFrame->getPosSize(); + m_xWizardPage.set(m_xController->createPage(xChildFrame, i_nPageId), UNO_SET_THROW); + + css::uno::Reference<css::awt::XWindow> xPageWindow(m_xWizardPage->getWindow(), UNO_SET_THROW); + + // If size of page is changed by createPage, then the requested size of the container + // should also be set to this size, to avoid annoying resizings. + com::sun::star::awt::Rectangle r1 = xChildFrame->getPosSize(); + + if (r0.Width != r1.Width || r0.Height != r1.Height) + pParent->set_size_request(r1.Width, r1.Height); + else + { + // tdf#132110 If the parent size wasn't overridden, then use + // the size of the child if that was set + com::sun::star::awt::Rectangle aChildRect = xPageWindow->getPosSize(); + if (aChildRect.Width && aChildRect.Height) + pParent->set_size_request(aChildRect.Width, aChildRect.Height); + } + + xPageWindow->setVisible(true); } catch( const Exception& ) {