weld SwInsertAbstractDlg

Change-Id: Ib3e9d0a7ff7e0fd3b0cf7bf492ca2bf59788fa2a
Reviewed-on: https://gerrit.libreoffice.org/68594
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/solenv/sanitizers/ui/modules/swriter.suppr b/solenv/sanitizers/ui/modules/swriter.suppr
index 27a4d9d..2c7b4fa 100644
--- a/solenv/sanitizers/ui/modules/swriter.suppr
+++ b/solenv/sanitizers/ui/modules/swriter.suppr
@@ -1,8 +1,4 @@
sw/uiconfig/swriter/ui/abstractdialog.ui://GtkLabel[@id='label2'] orphan-label
sw/uiconfig/swriter/ui/abstractdialog.ui://GtkLabel[@id='label3'] orphan-label
sw/uiconfig/swriter/ui/abstractdialog.ui://GtkLabel[@id='label4'] orphan-label
sw/uiconfig/swriter/ui/abstractdialog.ui://GtkSpinButton[@id='outlines'] no-labelled-by
sw/uiconfig/swriter/ui/abstractdialog.ui://GtkSpinButton[@id='paras'] no-labelled-by
sw/uiconfig/swriter/ui/addentrydialog.ui://GtkEntry[@id='entry'] no-labelled-by
sw/uiconfig/swriter/ui/addressblockdialog.ui://GtkButton[@id='toaddr'] button-no-label
sw/uiconfig/swriter/ui/alreadyexistsdialog.ui://GtkEntry[@id='edit1'] no-labelled-by
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index 0eac3d6..bba0b4b 100644
--- a/sw/inc/swabstdlg.hxx
+++ b/sw/inc/swabstdlg.hxx
@@ -369,7 +369,7 @@ public:
    virtual VclPtr<AbstractSwWordCountFloatDlg> CreateSwWordCountDialog(SfxBindings* pBindings,
        SfxChildWindow* pChild, weld::Window *pParent, SfxChildWinInfo* pInfo) = 0;

    virtual VclPtr<AbstractSwInsertAbstractDlg> CreateSwInsertAbstractDlg() = 0;
    virtual VclPtr<AbstractSwInsertAbstractDlg> CreateSwInsertAbstractDlg(weld::Window* pParent) = 0;
    virtual VclPtr<SfxAbstractDialog> CreateSwAddressAbstractDlg(vcl::Window* pParent, const SfxItemSet& rSet) = 0;
    virtual VclPtr<AbstractSwAsciiFilterDlg>  CreateSwAsciiFilterDlg(weld::Window* pParent, SwDocShell& rDocSh,
                                                                SvStream* pStream) = 0;
diff --git a/sw/source/ui/dialog/abstract.cxx b/sw/source/ui/dialog/abstract.cxx
index 0781844..a10ca89 100644
--- a/sw/source/ui/dialog/abstract.cxx
+++ b/sw/source/ui/dialog/abstract.cxx
@@ -22,34 +22,25 @@

#include <abstract.hxx>

SwInsertAbstractDlg::SwInsertAbstractDlg(vcl::Window* pParent)
    : SfxModalDialog(pParent, "AbstractDialog",
        "modules/swriter/ui/abstractdialog.ui")
SwInsertAbstractDlg::SwInsertAbstractDlg(weld::Window* pParent)
    : SfxDialogController(pParent, "modules/swriter/ui/abstractdialog.ui", "AbstractDialog")
    , m_xLevelNF(m_xBuilder->weld_spin_button("outlines"))
    , m_xParaNF(m_xBuilder->weld_spin_button("paras"))
{
    get(m_pLevelNF, "outlines");
    get(m_pParaNF, "paras");
}

SwInsertAbstractDlg::~SwInsertAbstractDlg()
{
    disposeOnce();
}

void SwInsertAbstractDlg::dispose()
{
    m_pLevelNF.clear();
    m_pParaNF.clear();
    SfxModalDialog::dispose();
}

sal_uInt8 SwInsertAbstractDlg::GetLevel() const
{
    return static_cast<sal_uInt8>(m_pLevelNF->GetValue() - 1);
    return static_cast<sal_uInt8>(m_xLevelNF->get_value() - 1);
}

sal_uInt8 SwInsertAbstractDlg::GetPara() const
{
    return static_cast<sal_uInt8>(m_pParaNF->GetValue());
    return static_cast<sal_uInt8>(m_xParaNF->get_value());
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index 378850e..042136c 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -96,7 +96,11 @@ short AbstractSwWordCountFloatDlg_Impl::Execute()
    return m_xDlg->run();
}

IMPL_ABSTDLG_BASE(AbstractSwInsertAbstractDlg_Impl);
short AbstractSwInsertAbstractDlg_Impl::Execute()
{
    return m_xDlg->run();
}

IMPL_ABSTDLG_BASE(SwAbstractSfxDialog_Impl);

short SwAbstractSfxController_Impl::Execute()
@@ -297,12 +301,12 @@ void AbstractApplyTabController_Impl::SetApplyHdl( const Link<LinkParamNone*,voi

sal_uInt8 AbstractSwInsertAbstractDlg_Impl::GetLevel() const
{
    return pDlg->GetLevel();
    return m_xDlg->GetLevel();
}

sal_uInt8 AbstractSwInsertAbstractDlg_Impl::GetPara() const
{
    return pDlg->GetPara();
    return m_xDlg->GetPara();
}

const SfxItemSet* SwAbstractSfxDialog_Impl::GetOutputItemSet() const
@@ -740,10 +744,9 @@ sal_uInt16 AbstractMailMergeWizard_Impl::GetRestartPage() const
    return pDlg->GetRestartPage();
}

VclPtr<AbstractSwInsertAbstractDlg> SwAbstractDialogFactory_Impl::CreateSwInsertAbstractDlg()
VclPtr<AbstractSwInsertAbstractDlg> SwAbstractDialogFactory_Impl::CreateSwInsertAbstractDlg(weld::Window* pParent)
{
    VclPtr<SwInsertAbstractDlg> pDlg = VclPtr<SwInsertAbstractDlg>::Create(nullptr);
    return VclPtr<AbstractSwInsertAbstractDlg_Impl>::Create(pDlg);
    return VclPtr<AbstractSwInsertAbstractDlg_Impl>::Create(std::make_unique<SwInsertAbstractDlg>(pParent));
}

VclPtr<SfxAbstractDialog> SwAbstractDialogFactory_Impl::CreateSwAddressAbstractDlg(vcl::Window* pParent,
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index ee6e32c..1e67b9b 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -89,7 +89,13 @@ public:

class AbstractSwInsertAbstractDlg_Impl : public AbstractSwInsertAbstractDlg
{
    DECL_ABSTDLG_BASE(AbstractSwInsertAbstractDlg_Impl,SwInsertAbstractDlg)
    std::unique_ptr<SwInsertAbstractDlg> m_xDlg;
public:
    explicit AbstractSwInsertAbstractDlg_Impl(std::unique_ptr<SwInsertAbstractDlg> p)
        : m_xDlg(std::move(p))
    {
    }
    virtual short Execute() override;
    virtual sal_uInt8   GetLevel() const override ;
    virtual sal_uInt8   GetPara() const override ;
};
@@ -587,7 +593,7 @@ public:
    virtual VclPtr<SfxAbstractDialog> CreateSwBackgroundDialog(weld::Window* pParent, const SfxItemSet& rSet) override;
    virtual VclPtr<AbstractSwWordCountFloatDlg> CreateSwWordCountDialog(SfxBindings* pBindings,
        SfxChildWindow* pChild, weld::Window *pParent, SfxChildWinInfo* pInfo) override;
    virtual VclPtr<AbstractSwInsertAbstractDlg> CreateSwInsertAbstractDlg() override;
    virtual VclPtr<AbstractSwInsertAbstractDlg> CreateSwInsertAbstractDlg(weld::Window* pParent) override;
    virtual VclPtr<SfxAbstractDialog> CreateSwAddressAbstractDlg(vcl::Window* pParent, const SfxItemSet& rSet) override;
    virtual VclPtr<AbstractSwAsciiFilterDlg>  CreateSwAsciiFilterDlg(weld::Window* pParent, SwDocShell& rDocSh,
                                                                SvStream* pStream) override;
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 5f4f72a..8a1d56f 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -768,7 +768,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
        case FN_ABSTRACT_NEWDOC:
        {
            SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
            ScopedVclPtr<AbstractSwInsertAbstractDlg> pDlg(pFact->CreateSwInsertAbstractDlg());
            ScopedVclPtr<AbstractSwInsertAbstractDlg> pDlg(pFact->CreateSwInsertAbstractDlg(GetView()->GetViewFrame()->GetWindow().GetFrameWeld()));
            if(RET_OK == pDlg->Execute())
            {
                sal_uInt8 nLevel = pDlg->GetLevel();
diff --git a/sw/source/uibase/inc/abstract.hxx b/sw/source/uibase/inc/abstract.hxx
index 1fc899b..6d6f6ba 100644
--- a/sw/source/uibase/inc/abstract.hxx
+++ b/sw/source/uibase/inc/abstract.hxx
@@ -21,17 +21,14 @@

#include <sfx2/basedlgs.hxx>

#include <vcl/field.hxx>

class SwInsertAbstractDlg : public SfxModalDialog
class SwInsertAbstractDlg : public SfxDialogController
{
    VclPtr<NumericField> m_pLevelNF;
    VclPtr<NumericField> m_pParaNF;
    std::unique_ptr<weld::SpinButton> m_xLevelNF;
    std::unique_ptr<weld::SpinButton> m_xParaNF;

public:
    SwInsertAbstractDlg( vcl::Window* pParent );
    SwInsertAbstractDlg(weld::Window* pParent);
    virtual ~SwInsertAbstractDlg() override;
    virtual void dispose() override;

    sal_uInt8   GetLevel() const;
    sal_uInt8   GetPara() const;
diff --git a/sw/uiconfig/swriter/ui/abstractdialog.ui b/sw/uiconfig/swriter/ui/abstractdialog.ui
index c332b6e..bdf26fd 100644
--- a/sw/uiconfig/swriter/ui/abstractdialog.ui
+++ b/sw/uiconfig/swriter/ui/abstractdialog.ui
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface domain="sw">
  <requires lib="gtk+" version="3.18"/>
  <object class="GtkAdjustment" id="adjustment1">
@@ -19,7 +20,13 @@
    <property name="can_focus">False</property>
    <property name="border_width">6</property>
    <property name="title" translatable="yes" context="abstractdialog|AbstractDialog">Create AutoAbstract</property>
    <property name="modal">True</property>
    <property name="default_width">0</property>
    <property name="default_height">0</property>
    <property name="type_hint">dialog</property>
    <child>
      <placeholder/>
    </child>
    <child internal-child="vbox">
      <object class="GtkBox" id="dialog-vbox1">
        <property name="can_focus">False</property>
@@ -71,6 +78,7 @@
                <property name="expand">False</property>
                <property name="fill">True</property>
                <property name="position">2</property>
                <property name="secondary">True</property>
              </packing>
            </child>
          </object>
@@ -110,15 +118,14 @@
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <property name="hexpand">True</property>
                        <property name="xalign">0</property>
                        <property name="label" translatable="yes" context="abstractdialog|label2">Included outline levels</property>
                        <property name="use_underline">True</property>
                        <property name="mnemonic_widget">outlines</property>
                        <property name="xalign">0</property>
                      </object>
                      <packing>
                        <property name="left_attach">0</property>
                        <property name="top_attach">0</property>
                        <property name="width">1</property>
                        <property name="height">1</property>
                      </packing>
                    </child>
                    <child>
@@ -126,15 +133,14 @@
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <property name="hexpand">True</property>
                        <property name="xalign">0</property>
                        <property name="label" translatable="yes" context="abstractdialog|label3">Paragraphs per level</property>
                        <property name="use_underline">True</property>
                        <property name="mnemonic_widget">paras</property>
                        <property name="xalign">0</property>
                      </object>
                      <packing>
                        <property name="left_attach">0</property>
                        <property name="top_attach">1</property>
                        <property name="width">1</property>
                        <property name="height">1</property>
                      </packing>
                    </child>
                    <child>
@@ -142,17 +148,17 @@
                        <property name="visible">True</property>
                        <property name="can_focus">False</property>
                        <property name="hexpand">True</property>
                        <property name="xalign">0</property>
                        <property name="label" translatable="yes" context="abstractdialog|label4">The abstract contains the selected number of paragraphs from the included outline levels.</property>
                        <property name="use_underline">True</property>
                        <property name="wrap">True</property>
                        <property name="width_chars">52</property>
                        <property name="max_width_chars">52</property>
                        <property name="xalign">0</property>
                      </object>
                      <packing>
                        <property name="left_attach">0</property>
                        <property name="top_attach">2</property>
                        <property name="width">2</property>
                        <property name="height">1</property>
                      </packing>
                    </child>
                    <child>
@@ -165,8 +171,6 @@
                      <packing>
                        <property name="left_attach">1</property>
                        <property name="top_attach">0</property>
                        <property name="width">1</property>
                        <property name="height">1</property>
                      </packing>
                    </child>
                    <child>
@@ -179,8 +183,6 @@
                      <packing>
                        <property name="left_attach">1</property>
                        <property name="top_attach">1</property>
                        <property name="width">1</property>
                        <property name="height">1</property>
                      </packing>
                    </child>
                  </object>