tdf#146562 let toc default size and pos on first launch

so only use resize_to_request when the user toggles the checkbutton

Change-Id: Ib5fdac56da0441fae482bc9f2120d1d3ce173fe8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131104
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx
index 44b13a9..6c2d324 100644
--- a/sw/source/ui/index/cnttab.cxx
+++ b/sw/source/ui/index/cnttab.cxx
@@ -277,7 +277,7 @@ SwMultiTOXTabDialog::SwMultiTOXTabDialog(weld::Widget* pParent, const SfxItemSet
    m_xShowExampleCB->connect_toggled(LINK(this, SwMultiTOXTabDialog, ShowPreviewHdl));
    m_xShowExampleCB->set_active(SW_MOD()->GetModuleConfig()->IsShowIndexPreview());

    ShowPreviewHdl(*m_xShowExampleCB);
    ShowPreview();
}

SwMultiTOXTabDialog::~SwMultiTOXTabDialog()
@@ -409,7 +409,7 @@ std::unique_ptr<SwTOXDescription> SwMultiTOXTabDialog::CreateTOXDescFromTOXBase(
    return pDesc;
}

IMPL_LINK_NOARG(SwMultiTOXTabDialog, ShowPreviewHdl, weld::Toggleable&, void)
void SwMultiTOXTabDialog::ShowPreview()
{
    if (m_xShowExampleCB->get_active())
    {
@@ -449,7 +449,11 @@ IMPL_LINK_NOARG(SwMultiTOXTabDialog, ShowPreviewHdl, weld::Toggleable&, void)
        else
            m_xExampleFrame->Hide();
    }
}

IMPL_LINK_NOARG(SwMultiTOXTabDialog, ShowPreviewHdl, weld::Toggleable&, void)
{
    ShowPreview();
    m_xDialog->resize_to_request();
}

diff --git a/sw/source/uibase/inc/swuicnttab.hxx b/sw/source/uibase/inc/swuicnttab.hxx
index ddf6769..2433c0f 100644
--- a/sw/source/uibase/inc/swuicnttab.hxx
+++ b/sw/source/uibase/inc/swuicnttab.hxx
@@ -82,6 +82,7 @@ class SwMultiTOXTabDialog final : public SfxTabDialogController

    virtual short       Ok() override;
    std::unique_ptr<SwTOXDescription> CreateTOXDescFromTOXBase(const SwTOXBase*pCurTOX);
    void ShowPreview();

    DECL_LINK(CreateExample_Hdl, SwOneExampleFrame&, void);
    DECL_LINK(ShowPreviewHdl, weld::Toggleable&, void);