svtools/source/uno/wizard/wizardpagecontroller.cxx |   19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

New commits:
commit 9c978e4c75e342b2345ff4fcbd1b5751627d8baf
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Feb 21 09:59:31 2023 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Tue Feb 21 11:55:29 2023 +0000

    Related: tdf#132110 use the container child size as default size
    
    if the container size wasn't changed
    
    Change-Id: I0bd4843768b727b8b75cbcb7ec92bd2b501b550d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147382
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/svtools/source/uno/wizard/wizardpagecontroller.cxx 
b/svtools/source/uno/wizard/wizardpagecontroller.cxx
index 850d9b102c7a..57ed08c6f164 100644
--- a/svtools/source/uno/wizard/wizardpagecontroller.cxx
+++ b/svtools/source/uno/wizard/wizardpagecontroller.cxx
@@ -51,18 +51,27 @@ namespace svt::uno
         {
             // Plug a toplevel SalFrame into the native page which can host 
our awt widgetry
             css::uno::Reference<css::awt::XWindow> xChildFrame = 
pParent->CreateChildFrame();
-            // 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 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);
             }
 
-            Reference< XWindow > xPageWindow(m_xWizardPage->getWindow(), 
UNO_SET_THROW);
-            xPageWindow->setVisible( true );
+            xPageWindow->setVisible(true);
         }
         catch( const Exception& )
         {

Reply via email to