Related: tdf#127782 resize the print dialog to its optimum size...

after expander is activated

Change-Id: I3f87243f0502829e048173987c8998898d351adf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86575
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
diff --git a/vcl/inc/printdlg.hxx b/vcl/inc/printdlg.hxx
index 9facdcf..4b6772a 100644
--- a/vcl/inc/printdlg.hxx
+++ b/vcl/inc/printdlg.hxx
@@ -186,6 +186,8 @@
        std::unique_ptr<weld::CustomWeld>       mxNupOrderWin;
        /// border around each page
        std::unique_ptr<weld::CheckButton>      mxBorderCB;
        std::unique_ptr<weld::Expander>         mxRangeExpander;
        std::unique_ptr<weld::Expander>         mxLayoutExpander;
        std::unique_ptr<weld::Widget>           mxCustom;

        OUString const                          maPrintToFileText;
@@ -234,6 +236,8 @@
        DECL_LINK( UIOption_SpinModifyHdl, weld::SpinButton&, void );
        DECL_LINK( UIOption_EntryModifyHdl, weld::Entry&, void );

        DECL_LINK( ExpandHdl, weld::Expander&, void );

        css::beans::PropertyValue* getValueForWindow(weld::Widget*) const;

        void preparePreview( bool i_bMayUseCache );
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index b42a1ce..cbba1ac 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -566,6 +566,8 @@
    , mxNupOrder(new ShowNupOrderWindow)
    , mxNupOrderWin(new weld::CustomWeld(*m_xBuilder, "orderpreview", *mxNupOrder))
    , mxBorderCB(m_xBuilder->weld_check_button("bordercb"))
    , mxRangeExpander(m_xBuilder->weld_expander("exRangeExpander"))
    , mxLayoutExpander(m_xBuilder->weld_expander("exLayoutExpander"))
    , mxCustom(m_xBuilder->weld_widget("customcontents"))
    , maPrintToFileText( VclResId( SV_PRINT_TOFILE_TXT ) )
    , maDefPrtText( VclResId( SV_PRINT_DEFPRT_TXT ) )
@@ -695,9 +697,16 @@
    mxPageMarginEdt->connect_value_changed( LINK( this, PrintDialog, MetricSpinModifyHdl ) );
    mxSheetMarginEdt->connect_value_changed( LINK( this, PrintDialog, MetricSpinModifyHdl ) );

    mxRangeExpander->connect_expanded(LINK( this, PrintDialog, ExpandHdl));
    mxLayoutExpander->connect_expanded(LINK( this, PrintDialog, ExpandHdl));

    updateNupFromPages();
}

IMPL_LINK_NOARG(PrintDialog, ExpandHdl, weld::Expander&, void)
{
    m_xDialog->resize_to_request();
}

PrintDialog::~PrintDialog()
{
diff --git a/vcl/uiconfig/ui/printdialog.ui b/vcl/uiconfig/ui/printdialog.ui
index fc98a18..d4de595 100644
--- a/vcl/uiconfig/ui/printdialog.ui
+++ b/vcl/uiconfig/ui/printdialog.ui
@@ -596,7 +596,6 @@
                                        <property name="visible">True</property>
                                        <property name="can_focus">True</property>
                                        <property name="hexpand">True</property>
                                        <property name="resize_toplevel">True</property>
                                        <child>
                                          <object class="GtkGrid" id="gdCopiesExtra">
                                            <property name="visible">True</property>
@@ -875,7 +874,6 @@
                                        <property name="visible">True</property>
                                        <property name="can_focus">True</property>
                                        <property name="hexpand">True</property>
                                        <property name="resize_toplevel">True</property>
                                        <child>
                                          <object class="GtkGrid">
                                            <property name="visible">True</property>