return weld widgets by std::unique_ptr from builder

Change-Id: I20c007b13dae2d1155034711ad1ad48bfdfd0ba8
Reviewed-on: https://gerrit.libreoffice.org/59288
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx
index 54fb29d..cf31b01 100644
--- a/cui/source/dialogs/insdlg.cxx
+++ b/cui/source/dialogs/insdlg.cxx
@@ -357,20 +357,20 @@ SfxInsertFloatingFrameDialog::SfxInsertFloatingFrameDialog(weld::Window *pParent

void SfxInsertFloatingFrameDialog::Init()
{
    m_xEDName.reset(m_xBuilder->weld_entry("edname"));
    m_xEDURL.reset(m_xBuilder->weld_entry("edurl"));
    m_xBTOpen.reset(m_xBuilder->weld_button("buttonbrowse"));
    m_xRBScrollingOn.reset(m_xBuilder->weld_radio_button("scrollbaron"));
    m_xRBScrollingOff.reset(m_xBuilder->weld_radio_button("scrollbaroff"));
    m_xRBScrollingAuto.reset(m_xBuilder->weld_radio_button("scrollbarauto"));
    m_xRBFrameBorderOn.reset(m_xBuilder->weld_radio_button("borderon"));
    m_xRBFrameBorderOff.reset(m_xBuilder->weld_radio_button("borderoff"));
    m_xFTMarginWidth.reset(m_xBuilder->weld_label("widthlabel"));
    m_xNMMarginWidth.reset(m_xBuilder->weld_spin_button("width"));
    m_xCBMarginWidthDefault.reset(m_xBuilder->weld_check_button("defaultwidth"));
    m_xFTMarginHeight.reset(m_xBuilder->weld_label("heightlabel"));
    m_xNMMarginHeight.reset(m_xBuilder->weld_spin_button("height"));
    m_xCBMarginHeightDefault.reset(m_xBuilder->weld_check_button("defaultheight"));
    m_xEDName = m_xBuilder->weld_entry("edname");
    m_xEDURL = m_xBuilder->weld_entry("edurl");
    m_xBTOpen = m_xBuilder->weld_button("buttonbrowse");
    m_xRBScrollingOn = m_xBuilder->weld_radio_button("scrollbaron");
    m_xRBScrollingOff = m_xBuilder->weld_radio_button("scrollbaroff");
    m_xRBScrollingAuto = m_xBuilder->weld_radio_button("scrollbarauto");
    m_xRBFrameBorderOn = m_xBuilder->weld_radio_button("borderon");
    m_xRBFrameBorderOff = m_xBuilder->weld_radio_button("borderoff");
    m_xFTMarginWidth = m_xBuilder->weld_label("widthlabel");
    m_xNMMarginWidth = m_xBuilder->weld_spin_button("width");
    m_xCBMarginWidthDefault = m_xBuilder->weld_check_button("defaultwidth");
    m_xFTMarginHeight = m_xBuilder->weld_label("heightlabel");
    m_xNMMarginHeight = m_xBuilder->weld_spin_button("height");
    m_xCBMarginHeightDefault = m_xBuilder->weld_check_button("defaultheight");

    Link<weld::Button&, void> aLink(LINK(this, SfxInsertFloatingFrameDialog, CheckHdl));
    m_xCBMarginWidthDefault->connect_clicked(aLink);
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index a746afe..c427c10c 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -312,17 +312,17 @@ public:
        if (nRID == EID_NUM_PRE_BREAK)
        {
            m_xBeforeFrame->show();
            m_xBreakNF.reset(m_xBuilder->weld_spin_button("beforebreak"));
            m_xBreakNF = m_xBuilder->weld_spin_button("beforebreak");
        }
        else if(nRID == EID_NUM_POST_BREAK)
        {
            m_xAfterFrame->show();
            m_xBreakNF.reset(m_xBuilder->weld_spin_button("afterbreak"));
            m_xBreakNF = m_xBuilder->weld_spin_button("afterbreak");
        }
        else if(nRID == EID_NUM_MIN_WORDLEN)
        {
            m_xMinimalFrame->show();
            m_xBreakNF.reset(m_xBuilder->weld_spin_button("wordlength"));
            m_xBreakNF = m_xBuilder->weld_spin_button("wordlength");
        }
    }

diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx
index d3c9479..a9a368f 100644
--- a/cui/source/tabpages/transfrm.cxx
+++ b/cui/source/tabpages/transfrm.cxx
@@ -414,11 +414,11 @@ SvxSlantTabPage::SvxSlantTabPage(TabPageParent pParent, const SfxItemSet& rInAtt
{
    for (int i = 0; i < 2; ++i)
    {
        m_aControlGroups[i].reset(m_xBuilder->weld_widget("controlgroups" + OString::number(i+1)));
        m_aControlGroupX[i].reset(m_xBuilder->weld_widget("controlgroupx" + OString::number(i+1)));
        m_aControlX[i].reset(m_xBuilder->weld_metric_spin_button("controlx" + OString::number(i+1), FUNIT_CM));
        m_aControlGroupY[i].reset(m_xBuilder->weld_widget("controlgroupy" + OString::number(i+1)));
        m_aControlY[i].reset(m_xBuilder->weld_metric_spin_button("controly" + OString::number(i+1), FUNIT_CM));
        m_aControlGroups[i] = m_xBuilder->weld_widget("controlgroups" + OString::number(i+1));
        m_aControlGroupX[i] = m_xBuilder->weld_widget("controlgroupx" + OString::number(i+1));
        m_aControlX[i] = m_xBuilder->weld_metric_spin_button("controlx" + OString::number(i+1), FUNIT_CM);
        m_aControlGroupY[i] = m_xBuilder->weld_widget("controlgroupy" + OString::number(i+1));
        m_aControlY[i] = m_xBuilder->weld_metric_spin_button("controly" + OString::number(i+1), FUNIT_CM);
    }

    // this page needs ExchangeSupport
diff --git a/include/svtools/inettbc.hxx b/include/svtools/inettbc.hxx
index 18764ec..6cba183 100644
--- a/include/svtools/inettbc.hxx
+++ b/include/svtools/inettbc.hxx
@@ -112,7 +112,7 @@ class SVT_DLLPUBLIC URLBox
    SVT_DLLPRIVATE void             Init();

public:
    URLBox(weld::ComboBoxText* pWidget);
    URLBox(std::unique_ptr<weld::ComboBoxText> pWidget);
    ~URLBox();

    void                            SetText(const OUString& rStr) { m_xWidget->set_entry_text(rStr); }
diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx
index 9d774063..1e2921b 100644
--- a/include/svtools/valueset.hxx
+++ b/include/svtools/valueset.hxx
@@ -475,7 +475,7 @@ protected:
    virtual css::uno::Reference<css::accessibility::XAccessible> CreateAccessible() override;

public:
    SvtValueSet(weld::ScrolledWindow* pScrolledWindow);
    SvtValueSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow);
    virtual         ~SvtValueSet() override;

    virtual void    SetDrawingArea(weld::DrawingArea* pDrawingArea) override;
diff --git a/include/svx/SvxColorValueSet.hxx b/include/svx/SvxColorValueSet.hxx
index a1098fb..4231520 100644
--- a/include/svx/SvxColorValueSet.hxx
+++ b/include/svx/SvxColorValueSet.hxx
@@ -45,7 +45,7 @@ public:
class SVX_DLLPUBLIC ColorValueSet : public SvtValueSet
{
public:
    ColorValueSet(weld::ScrolledWindow* pWindow);
    ColorValueSet(std::unique_ptr<weld::ScrolledWindow> pWindow);

    virtual void Resize() override;

diff --git a/include/svx/charmap.hxx b/include/svx/charmap.hxx
index 5101b23..6871aae 100644
--- a/include/svx/charmap.hxx
+++ b/include/svx/charmap.hxx
@@ -65,7 +65,7 @@ protected:
    vcl::Font maFont;
    std::unique_ptr<weld::ScrolledWindow> mxScrollArea;
public:
    SvxShowCharSet(weld::ScrolledWindow* pScrollArea, const VclPtr<VirtualDevice>& rVirDev);
    SvxShowCharSet(std::unique_ptr<weld::ScrolledWindow> pScrollArea, const VclPtr<VirtualDevice>& rVirDev);
    virtual ~SvxShowCharSet() override;

    virtual void            RecalculateFont(vcl::RenderContext& rRenderContext);
diff --git a/include/svx/colorbox.hxx b/include/svx/colorbox.hxx
index a4aa9de..efa949d 100644
--- a/include/svx/colorbox.hxx
+++ b/include/svx/colorbox.hxx
@@ -110,7 +110,7 @@ private:
    void LockWidthRequest();
    ColorWindow* getColorWindow() const;
public:
    ColorListBox(weld::MenuButton* pControl, weld::Window* pWindow, bool bInterimBuilder = false);
    ColorListBox(std::unique_ptr<weld::MenuButton> pControl, weld::Window* pWindow, bool bInterimBuilder = false);
    ~ColorListBox();

    void SetSelectHdl(const Link<ColorListBox&, void>& rLink)
diff --git a/include/svx/frmdirlbox.hxx b/include/svx/frmdirlbox.hxx
index 600a324..fb2208f 100644
--- a/include/svx/frmdirlbox.hxx
+++ b/include/svx/frmdirlbox.hxx
@@ -58,8 +58,8 @@ class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxFrameDirectionListBox
private:
    std::unique_ptr<weld::ComboBoxText> m_xControl;
public:
    explicit            SvxFrameDirectionListBox(weld::ComboBoxText* pControl)
        : m_xControl(pControl)
    explicit SvxFrameDirectionListBox(std::unique_ptr<weld::ComboBoxText> pControl)
        : m_xControl(std::move(pControl))
    {
    }

diff --git a/include/svx/hexcolorcontrol.hxx b/include/svx/hexcolorcontrol.hxx
index 3030237..8e6b34c 100644
--- a/include/svx/hexcolorcontrol.hxx
+++ b/include/svx/hexcolorcontrol.hxx
@@ -41,7 +41,7 @@ private:

    DECL_LINK(ImplProcessInputHdl, OUString&, bool);
public:
    HexColorControl(weld::Entry* pEdit);
    HexColorControl(std::unique_ptr<weld::Entry> pEdit);

    void connect_changed(const Link<Entry&, void>& rLink) { m_xEntry->connect_changed(rLink); }

diff --git a/include/svx/langbox.hxx b/include/svx/langbox.hxx
index 848d93a..9b13055 100644
--- a/include/svx/langbox.hxx
+++ b/include/svx/langbox.hxx
@@ -160,7 +160,7 @@ private:
    SVX_DLLPRIVATE void ImplClear();
    DECL_LINK(ChangeHdl, weld::ComboBoxText&, void);
public:
    LanguageBox(weld::ComboBoxText* pControl);
    LanguageBox(std::unique_ptr<weld::ComboBoxText> pControl);
    void            SetLanguageList( SvxLanguageListFlags nLangList,
                            bool bHasLangNone, bool bLangNoneIsLangAll = false );
    void            AddLanguages( const std::vector< LanguageType >& rLanguageTypes, SvxLanguageListFlags nLangList );
diff --git a/include/svx/pagenumberlistbox.hxx b/include/svx/pagenumberlistbox.hxx
index 4d15369..51cc94e 100644
--- a/include/svx/pagenumberlistbox.hxx
+++ b/include/svx/pagenumberlistbox.hxx
@@ -39,7 +39,7 @@ class SVX_DLLPUBLIC SvxPageNumberListBox
private:
    std::unique_ptr<weld::ComboBoxText> m_xControl;
public:
    SvxPageNumberListBox(weld::ComboBoxText* pControl);
    SvxPageNumberListBox(std::unique_ptr<weld::ComboBoxText> pControl);
    int get_count() const { return m_xControl->get_count(); }
    OUString get_id(int pos) const { return m_xControl->get_id(pos); }
    int get_active() const { return m_xControl->get_active(); }
diff --git a/include/svx/papersizelistbox.hxx b/include/svx/papersizelistbox.hxx
index d9ed3b4..0ba2de1 100644
--- a/include/svx/papersizelistbox.hxx
+++ b/include/svx/papersizelistbox.hxx
@@ -48,7 +48,7 @@ class SVX_DLLPUBLIC SvxPaperSizeListBox
private:
    std::unique_ptr<weld::ComboBoxText> m_xControl;
public:
    SvxPaperSizeListBox(weld::ComboBoxText *pControl);
    SvxPaperSizeListBox(std::unique_ptr<weld::ComboBoxText> pControl);

    void FillPaperSizeEntries(PaperSizeApp eApp);
    void SetSelection(Paper eSize);
diff --git a/include/svx/relfld.hxx b/include/svx/relfld.hxx
index 8b4d505..00b8ade 100644
--- a/include/svx/relfld.hxx
+++ b/include/svx/relfld.hxx
@@ -45,7 +45,7 @@ private:
    DECL_LINK(ModifyHdl, weld::Entry&, void);

public:
    RelativeField(weld::MetricSpinButton* pControl);
    RelativeField(std::unique_ptr<weld::MetricSpinButton> pControl);

    void            EnableRelativeMode( sal_uInt16 nMin, sal_uInt16 nMax );
    void            SetRelative( bool bRelative );
diff --git a/include/svx/searchcharmap.hxx b/include/svx/searchcharmap.hxx
index bcc4ac2..7cdebe6 100644
--- a/include/svx/searchcharmap.hxx
+++ b/include/svx/searchcharmap.hxx
@@ -53,7 +53,7 @@ class ScrollBar;
class SVX_DLLPUBLIC SvxSearchCharSet : public SvxShowCharSet
{
public:
    SvxSearchCharSet(weld::ScrolledWindow* pScrolledWindow, const VclPtr<VirtualDevice> &rDevice);
    SvxSearchCharSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow, const VclPtr<VirtualDevice> &rDevice);
    virtual ~SvxSearchCharSet() override;

    virtual void                        RecalculateFont(vcl::RenderContext& rRenderContext) override;
diff --git a/include/svx/txencbox.hxx b/include/svx/txencbox.hxx
index 4555b7d3..294362c 100644
--- a/include/svx/txencbox.hxx
+++ b/include/svx/txencbox.hxx
@@ -95,7 +95,7 @@ private:
    std::unique_ptr<weld::ComboBoxText> m_xControl;

public:
    TextEncodingBox(weld::ComboBoxText* pControl);
    TextEncodingBox(std::unique_ptr<weld::ComboBoxText> pControl);

    ~TextEncodingBox();

diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 0277b3c..b864231 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -17,6 +17,7 @@
#include <vcl/field.hxx>
#include <vcl/vclenum.hxx>
#include <vcl/virdev.hxx>
#include <o3tl/make_unique.hxx>

#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>

@@ -590,9 +591,9 @@ protected:
    void update_width_chars();

public:
    MetricSpinButton(SpinButton* pSpinButton, FieldUnit eSrcUnit)
    MetricSpinButton(std::unique_ptr<SpinButton> pSpinButton, FieldUnit eSrcUnit)
        : m_eSrcUnit(eSrcUnit)
        , m_xSpinButton(pSpinButton)
        , m_xSpinButton(std::move(pSpinButton))
    {
        update_width_chars();
        m_xSpinButton->connect_output(LINK(this, MetricSpinButton, spin_button_output));
@@ -748,9 +749,9 @@ protected:
    void update_width_chars();

public:
    TimeSpinButton(SpinButton* pSpinButton, TimeFieldFormat eFormat)
    TimeSpinButton(std::unique_ptr<SpinButton> pSpinButton, TimeFieldFormat eFormat)
        : m_eFormat(eFormat)
        , m_xSpinButton(pSpinButton)
        , m_xSpinButton(std::move(pSpinButton))
    {
        update_width_chars();
        m_xSpinButton->connect_output(LINK(this, TimeSpinButton, spin_button_output));
@@ -920,43 +921,67 @@ public:
            m_sHelpRoot = m_sHelpRoot.copy(0, nIdx);
        m_sHelpRoot = m_sHelpRoot + OString('/');
    }
    virtual MessageDialog* weld_message_dialog(const OString& id, bool bTakeOwnership = true) = 0;
    virtual Dialog* weld_dialog(const OString& id, bool bTakeOwnership = true) = 0;
    virtual Window* weld_window(const OString& id, bool bTakeOwnership = true) = 0;
    virtual Widget* weld_widget(const OString& id, bool bTakeOwnership = false) = 0;
    virtual Container* weld_container(const OString& id, bool bTakeOwnership = false) = 0;
    virtual Button* weld_button(const OString& id, bool bTakeOwnership = false) = 0;
    virtual MenuButton* weld_menu_button(const OString& id, bool bTakeOwnership = false) = 0;
    virtual Frame* weld_frame(const OString& id, bool bTakeOwnership = false) = 0;
    virtual ScrolledWindow* weld_scrolled_window(const OString& id, bool bTakeOwnership = false)
    virtual std::unique_ptr<MessageDialog> weld_message_dialog(const OString& id,
                                                               bool bTakeOwnership = true)
        = 0;
    virtual Notebook* weld_notebook(const OString& id, bool bTakeOwnership = false) = 0;
    virtual ToggleButton* weld_toggle_button(const OString& id, bool bTakeOwnership = false) = 0;
    virtual RadioButton* weld_radio_button(const OString& id, bool bTakeOwnership = false) = 0;
    virtual CheckButton* weld_check_button(const OString& id, bool bTakeOwnership = false) = 0;
    virtual SpinButton* weld_spin_button(const OString& id, bool bTakeOwnership = false) = 0;
    MetricSpinButton* weld_metric_spin_button(const OString& id, FieldUnit eUnit,
                                              bool bTakeOwnership = false)
    virtual std::unique_ptr<Dialog> weld_dialog(const OString& id, bool bTakeOwnership = true) = 0;
    virtual std::unique_ptr<Window> weld_window(const OString& id, bool bTakeOwnership = true) = 0;
    virtual std::unique_ptr<Widget> weld_widget(const OString& id, bool bTakeOwnership = false) = 0;
    virtual std::unique_ptr<Container> weld_container(const OString& id,
                                                      bool bTakeOwnership = false)
        = 0;
    virtual std::unique_ptr<Button> weld_button(const OString& id, bool bTakeOwnership = false) = 0;
    virtual std::unique_ptr<MenuButton> weld_menu_button(const OString& id,
                                                         bool bTakeOwnership = false)
        = 0;
    virtual std::unique_ptr<Frame> weld_frame(const OString& id, bool bTakeOwnership = false) = 0;
    virtual std::unique_ptr<ScrolledWindow> weld_scrolled_window(const OString& id,
                                                                 bool bTakeOwnership = false)
        = 0;
    virtual std::unique_ptr<Notebook> weld_notebook(const OString& id, bool bTakeOwnership = false)
        = 0;
    virtual std::unique_ptr<ToggleButton> weld_toggle_button(const OString& id,
                                                             bool bTakeOwnership = false)
        = 0;
    virtual std::unique_ptr<RadioButton> weld_radio_button(const OString& id,
                                                           bool bTakeOwnership = false)
        = 0;
    virtual std::unique_ptr<CheckButton> weld_check_button(const OString& id,
                                                           bool bTakeOwnership = false)
        = 0;
    virtual std::unique_ptr<SpinButton> weld_spin_button(const OString& id,
                                                         bool bTakeOwnership = false)
        = 0;
    std::unique_ptr<MetricSpinButton> weld_metric_spin_button(const OString& id, FieldUnit eUnit,
                                                              bool bTakeOwnership = false)
    {
        return new MetricSpinButton(weld_spin_button(id, bTakeOwnership), eUnit);
        return o3tl::make_unique<MetricSpinButton>(weld_spin_button(id, bTakeOwnership), eUnit);
    }
    virtual TimeSpinButton* weld_time_spin_button(const OString& id, TimeFieldFormat eFormat,
                                                  bool bTakeOwnership = false)
    virtual std::unique_ptr<TimeSpinButton>
    weld_time_spin_button(const OString& id, TimeFieldFormat eFormat, bool bTakeOwnership = false)
        = 0;
    virtual ComboBoxText* weld_combo_box_text(const OString& id, bool bTakeOwnership = false) = 0;
    virtual TreeView* weld_tree_view(const OString& id, bool bTakeOwnership = false) = 0;
    virtual Label* weld_label(const OString& id, bool bTakeOwnership = false) = 0;
    virtual TextView* weld_text_view(const OString& id, bool bTakeOwnership = false) = 0;
    virtual Expander* weld_expander(const OString& id, bool bTakeOwnership = false) = 0;
    virtual Entry* weld_entry(const OString& id, bool bTakeOwnership = false) = 0;
    virtual Scale* weld_scale(const OString& id, bool bTakeOwnership = false) = 0;
    virtual ProgressBar* weld_progress_bar(const OString& id, bool bTakeOwnership = false) = 0;
    virtual DrawingArea* weld_drawing_area(const OString& id, const a11yref& rA11yImpl = nullptr,
                                           FactoryFunction pUITestFactoryFunction = nullptr,
                                           void* pUserData = nullptr, bool bTakeOwnership = false)
    virtual std::unique_ptr<ComboBoxText> weld_combo_box_text(const OString& id,
                                                              bool bTakeOwnership = false)
        = 0;
    virtual Menu* weld_menu(const OString& id, bool bTakeOwnership = true) = 0;
    virtual SizeGroup* create_size_group() = 0;
    virtual std::unique_ptr<TreeView> weld_tree_view(const OString& id, bool bTakeOwnership = false)
        = 0;
    virtual std::unique_ptr<Label> weld_label(const OString& id, bool bTakeOwnership = false) = 0;
    virtual std::unique_ptr<TextView> weld_text_view(const OString& id, bool bTakeOwnership = false)
        = 0;
    virtual std::unique_ptr<Expander> weld_expander(const OString& id, bool bTakeOwnership = false)
        = 0;
    virtual std::unique_ptr<Entry> weld_entry(const OString& id, bool bTakeOwnership = false) = 0;
    virtual std::unique_ptr<Scale> weld_scale(const OString& id, bool bTakeOwnership = false) = 0;
    virtual std::unique_ptr<ProgressBar> weld_progress_bar(const OString& id,
                                                           bool bTakeOwnership = false)
        = 0;
    virtual std::unique_ptr<DrawingArea>
    weld_drawing_area(const OString& id, const a11yref& rA11yImpl = nullptr,
                      FactoryFunction pUITestFactoryFunction = nullptr, void* pUserData = nullptr,
                      bool bTakeOwnership = false)
        = 0;
    virtual std::unique_ptr<Menu> weld_menu(const OString& id, bool bTakeOwnership = true) = 0;
    virtual std::unique_ptr<SizeGroup> create_size_group() = 0;
    virtual ~Builder() {}
};

diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index 0ac617c..fcd58a9 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -1964,10 +1964,10 @@ void SfxTabDialogController::setPreviewsToSamePlace()
            continue;
        if (!pDataObject->pTabPage->m_xBuilder)
            continue;
        weld::Widget* pGrid = pDataObject->pTabPage->m_xBuilder->weld_widget("maingrid");
        std::unique_ptr<weld::Widget> pGrid = pDataObject->pTabPage->m_xBuilder->weld_widget("maingrid");
        if (!pGrid)
            continue;
        aGrids.emplace_back(pGrid);
        aGrids.emplace_back(std::move(pGrid));
    }

    m_xSizeGroup.reset();
@@ -1975,7 +1975,7 @@ void SfxTabDialogController::setPreviewsToSamePlace()
    if (aGrids.size() <= 1)
        return;

    m_xSizeGroup.reset(m_xBuilder->create_size_group());
    m_xSizeGroup = m_xBuilder->create_size_group();
    for (auto& rGrid : aGrids)
        m_xSizeGroup->add_widget(rGrid.get());
}
diff --git a/starmath/inc/dialog.hxx b/starmath/inc/dialog.hxx
index 81f043c..37dcbd5 100644
--- a/starmath/inc/dialog.hxx
+++ b/starmath/inc/dialog.hxx
@@ -280,7 +280,7 @@ class SmShowSymbolSet : public weld::CustomWidgetController
    DECL_LINK(ScrollHdl, weld::ScrolledWindow&, void);

public:
    SmShowSymbolSet(weld::ScrolledWindow* pScrolledWindow);
    SmShowSymbolSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow);

    virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override
    {
diff --git a/starmath/inc/utility.hxx b/starmath/inc/utility.hxx
index 63871c3..9f9e0b0 100644
--- a/starmath/inc/utility.hxx
+++ b/starmath/inc/utility.hxx
@@ -142,7 +142,7 @@ private:
    DECL_LINK(SelectHdl, weld::ComboBoxText&, void);

public:
    SmFontPickListBox(weld::ComboBoxText* pWidget);
    SmFontPickListBox(std::unique_ptr<weld::ComboBoxText> pWidget);
    SmFontPickListBox& operator = (const SmFontPickList& rList);
    virtual void    Insert(const vcl::Font &rFont) override;
};
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index 27860ce..eea95ab 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -610,7 +610,7 @@ SmCategoryDesc::SmCategoryDesc(weld::Builder& rBuilder, sal_uInt16 nCategoryIdx)
        if (xLabel)
        {
            Strings[i] = xLabel->get_label();
            Graphics[i].reset(rBuilder.weld_widget(OString::number(nCategoryIdx)+"image"+OString::number(i+1)));
            Graphics[i] = rBuilder.weld_widget(OString::number(nCategoryIdx)+"image"+OString::number(i+1));
        }
        else
        {
@@ -959,14 +959,14 @@ void SmAlignDialog::WriteTo(SmFormat &rFormat) const
    rFormat.RequestApplyChanges();
}

SmShowSymbolSet::SmShowSymbolSet(weld::ScrolledWindow* pScrolledWindow)
SmShowSymbolSet::SmShowSymbolSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow)
    : nLen(0)
    , nRows(0)
    , nColumns(0)
    , nXOffset(0)
    , nYOffset(0)
    , nSelectSymbol(SYMBOL_NONE)
    , m_xScrolledWindow(pScrolledWindow)
    , m_xScrolledWindow(std::move(pScrolledWindow))
{
    m_xScrolledWindow->set_user_managed_scrolling();
    m_xScrolledWindow->connect_vadjustment_changed(LINK(this, SmShowSymbolSet, ScrollHdl));
diff --git a/starmath/source/utility.cxx b/starmath/source/utility.cxx
index 015257b..4214e60 100644
--- a/starmath/source/utility.cxx
+++ b/starmath/source/utility.cxx
@@ -120,9 +120,9 @@ void SmFontPickList::WriteTo(SmFontDialog& rDialog) const

/**************************************************************************/

SmFontPickListBox::SmFontPickListBox(weld::ComboBoxText* pWidget)
SmFontPickListBox::SmFontPickListBox(std::unique_ptr<weld::ComboBoxText> pWidget)
    : SmFontPickList(4)
    , m_xWidget(pWidget)
    , m_xWidget(std::move(pWidget))
{
    m_xWidget->connect_changed(LINK(this, SmFontPickListBox, SelectHdl));
}
diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx
index cf7f7c7..25e7076 100644
--- a/svtools/source/control/inettbc.cxx
+++ b/svtools/source/control/inettbc.cxx
@@ -2009,9 +2009,9 @@ IMPL_LINK_NOARG(URLBox, TryAutoComplete, Timer *, void)
        m_xWidget->clear();
}

URLBox::URLBox(weld::ComboBoxText* pWidget)
URLBox::URLBox(std::unique_ptr<weld::ComboBoxText> pWidget)
    : bHistoryDisabled(false)
    , m_xWidget(pWidget)
    , m_xWidget(std::move(pWidget))
{
    Init();

diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index 34f980b..50e674b 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -2276,9 +2276,9 @@ void ValueSet::SetEdgeBlending(bool bNew)
    }
}

SvtValueSet::SvtValueSet(weld::ScrolledWindow* pScrolledWindow)
SvtValueSet::SvtValueSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow)
    : maVirDev( VclPtr<VirtualDevice>::Create())
    , mxScrolledWindow(pScrolledWindow)
    , mxScrolledWindow(std::move(pScrolledWindow))
    , maColor(COL_TRANSPARENT)
    , mnStyle(0)
    , mbFormat(true)
diff --git a/svtools/source/dialogs/restartdialog.cxx b/svtools/source/dialogs/restartdialog.cxx
index 122f314..47a3ee9 100644
--- a/svtools/source/dialogs/restartdialog.cxx
+++ b/svtools/source/dialogs/restartdialog.cxx
@@ -30,37 +30,37 @@ public:
    {
        switch (reason) {
        case svtools::RESTART_REASON_JAVA:
            reason_.reset(m_xBuilder->weld_widget("reason_java"));
            reason_ = m_xBuilder->weld_widget("reason_java");
            break;
        case svtools::RESTART_REASON_PDF_AS_STANDARD_JOB_FORMAT:
            reason_.reset(m_xBuilder->weld_widget("reason_pdf"));
            reason_ = m_xBuilder->weld_widget("reason_pdf");
            break;
        case svtools::RESTART_REASON_BIBLIOGRAPHY_INSTALL:
            reason_.reset(m_xBuilder->weld_widget("reason_bibliography_install"));
            reason_ = m_xBuilder->weld_widget("reason_bibliography_install");
            break;
        case svtools::RESTART_REASON_MAILMERGE_INSTALL:
            reason_.reset(m_xBuilder->weld_widget("reason_mailmerge_install"));
            reason_ = m_xBuilder->weld_widget("reason_mailmerge_install");
            break;
        case svtools::RESTART_REASON_LANGUAGE_CHANGE:
            reason_.reset(m_xBuilder->weld_widget("reason_language_change"));
            reason_ = m_xBuilder->weld_widget("reason_language_change");
            break;
        case svtools::RESTART_REASON_ADDING_PATH:
            reason_.reset(m_xBuilder->weld_widget("reason_adding_path"));
            reason_ = m_xBuilder->weld_widget("reason_adding_path");
            break;
        case svtools::RESTART_REASON_ASSIGNING_JAVAPARAMETERS:
            reason_.reset(m_xBuilder->weld_widget("reason_assigning_javaparameters"));
            reason_ = m_xBuilder->weld_widget("reason_assigning_javaparameters");
            break;
        case svtools::RESTART_REASON_ASSIGNING_FOLDERS:
            reason_.reset(m_xBuilder->weld_widget("reason_assigning_folders"));
            reason_ = m_xBuilder->weld_widget("reason_assigning_folders");
            break;
        case svtools::RESTART_REASON_EXP_FEATURES:
            reason_.reset(m_xBuilder->weld_widget("reason_exp_features"));
            reason_ = m_xBuilder->weld_widget("reason_exp_features");
            break;
        case svtools::RESTART_REASON_EXTENSION_INSTALL:
            reason_.reset(m_xBuilder->weld_widget("reason_extension_install"));
            reason_ = m_xBuilder->weld_widget("reason_extension_install");
            break;
        case svtools::RESTART_REASON_OPENGL:
            reason_.reset(m_xBuilder->weld_widget("reason_opengl"));
            reason_ = m_xBuilder->weld_widget("reason_opengl");
            break;
        default:
            assert(false); // this cannot happen
diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx
index 1f1f469..20d5cc11 100644
--- a/svx/source/dialog/charmap.cxx
+++ b/svx/source/dialog/charmap.cxx
@@ -62,9 +62,9 @@ FactoryFunction SvxShowCharSet::GetUITestFactory() const
    return SvxShowCharSetUIObject::create;
}

SvxShowCharSet::SvxShowCharSet(weld::ScrolledWindow* pScrolledWindow, const VclPtr<VirtualDevice>& rVirDev)
SvxShowCharSet::SvxShowCharSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow, const VclPtr<VirtualDevice>& rVirDev)
    : mxVirDev(rVirDev)
    , mxScrollArea(pScrolledWindow)
    , mxScrollArea(std::move(pScrolledWindow))
    , mxContext(comphelper::getProcessComponentContext())
    , nX(0)
    , nY(0)
diff --git a/svx/source/dialog/compressgraphicdialog.cxx b/svx/source/dialog/compressgraphicdialog.cxx
index 3ba0bfb..1fe8e3e 100644
--- a/svx/source/dialog/compressgraphicdialog.cxx
+++ b/svx/source/dialog/compressgraphicdialog.cxx
@@ -71,23 +71,23 @@ CompressGraphicsDialog::~CompressGraphicsDialog()

void CompressGraphicsDialog::Initialize()
{
    m_xLabelGraphicType.reset(m_xBuilder->weld_label("label-graphic-type"));
    m_xFixedText2.reset(m_xBuilder->weld_label("label-original-size"));
    m_xFixedText3.reset(m_xBuilder->weld_label("label-view-size"));
    m_xFixedText5.reset(m_xBuilder->weld_label("label-image-capacity"));
    m_xFixedText6.reset(m_xBuilder->weld_label("label-new-capacity"));
    m_xJpegCompRB.reset(m_xBuilder->weld_radio_button("radio-jpeg"));
    m_xCompressionMF.reset(m_xBuilder->weld_spin_button("spin-compression"));
    m_xCompressionSlider.reset(m_xBuilder->weld_scale("scale-compression"));
    m_xLosslessRB.reset(m_xBuilder->weld_radio_button("radio-lossless"));
    m_xQualityMF.reset(m_xBuilder->weld_spin_button("spin-quality"));
    m_xQualitySlider.reset(m_xBuilder->weld_scale("scale-quality"));
    m_xReduceResolutionCB.reset(m_xBuilder->weld_check_button("checkbox-reduce-resolution"));
    m_xMFNewWidth.reset(m_xBuilder->weld_spin_button("spin-new-width"));
    m_xMFNewHeight.reset(m_xBuilder->weld_spin_button("spin-new-height"));
    m_xResolutionLB.reset(m_xBuilder->weld_combo_box_text("combo-resolution"));
    m_xBtnCalculate.reset(m_xBuilder->weld_button("calculate"));
    m_xInterpolationCombo.reset(m_xBuilder->weld_combo_box_text("interpolation-method-combo"));
    m_xLabelGraphicType = m_xBuilder->weld_label("label-graphic-type");
    m_xFixedText2 = m_xBuilder->weld_label("label-original-size");
    m_xFixedText3 = m_xBuilder->weld_label("label-view-size");
    m_xFixedText5 = m_xBuilder->weld_label("label-image-capacity");
    m_xFixedText6 = m_xBuilder->weld_label("label-new-capacity");
    m_xJpegCompRB = m_xBuilder->weld_radio_button("radio-jpeg");
    m_xCompressionMF = m_xBuilder->weld_spin_button("spin-compression");
    m_xCompressionSlider = m_xBuilder->weld_scale("scale-compression");
    m_xLosslessRB = m_xBuilder->weld_radio_button("radio-lossless");
    m_xQualityMF = m_xBuilder->weld_spin_button("spin-quality");
    m_xQualitySlider = m_xBuilder->weld_scale("scale-quality");
    m_xReduceResolutionCB = m_xBuilder->weld_check_button("checkbox-reduce-resolution");
    m_xMFNewWidth = m_xBuilder->weld_spin_button("spin-new-width");
    m_xMFNewHeight = m_xBuilder->weld_spin_button("spin-new-height");
    m_xResolutionLB = m_xBuilder->weld_combo_box_text("combo-resolution");
    m_xBtnCalculate = m_xBuilder->weld_button("calculate");
    m_xInterpolationCombo = m_xBuilder->weld_combo_box_text("interpolation-method-combo");

    m_xInterpolationCombo->set_active_text("Lanczos");

diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx
index 955586a..7ca86e2 100644
--- a/svx/source/dialog/hdft.cxx
+++ b/svx/source/dialog/hdft.cxx
@@ -154,8 +154,8 @@ SvxHFPage::SvxHFPage(TabPageParent pParent, const SfxItemSet& rSet, sal_uInt16 n
    //swap header <-> footer in UI
    if (nId == SID_ATTR_PAGE_FOOTERSET)
    {
        m_xPageLbl.reset(m_xBuilder->weld_label("labelFooterFormat"));
        m_xTurnOnBox.reset(m_xBuilder->weld_check_button("checkFooterOn"));
        m_xPageLbl = m_xBuilder->weld_label("labelFooterFormat");
        m_xTurnOnBox = m_xBuilder->weld_check_button("checkFooterOn");

        /* Set custom HIDs for the Footer help page (shared/01/05040400.xhp)
        otherwise it would display the same extended help
@@ -172,8 +172,8 @@ SvxHFPage::SvxHFPage(TabPageParent pParent, const SfxItemSet& rSet, sal_uInt16 n
    }
    else //Header
    {
        m_xPageLbl.reset(m_xBuilder->weld_label("labelHeaderFormat"));
        m_xTurnOnBox.reset(m_xBuilder->weld_check_button("checkHeaderOn"));
        m_xPageLbl = m_xBuilder->weld_label("labelHeaderFormat");
        m_xTurnOnBox = m_xBuilder->weld_check_button("checkHeaderOn");
    }
    m_xTurnOnBox->show();
    m_xPageLbl->show();
diff --git a/svx/source/dialog/hexcolorcontrol.cxx b/svx/source/dialog/hexcolorcontrol.cxx
index afb9107..71e69a5 100644
--- a/svx/source/dialog/hexcolorcontrol.cxx
+++ b/svx/source/dialog/hexcolorcontrol.cxx
@@ -21,8 +21,8 @@

namespace weld {

HexColorControl::HexColorControl(weld::Entry* pEntry)
    : m_xEntry(pEntry)
HexColorControl::HexColorControl(std::unique_ptr<weld::Entry> pEntry)
    : m_xEntry(std::move(pEntry))
{
    m_xEntry->set_max_length(6);
    m_xEntry->set_width_chars(6);
diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx
index 7c9511c..28960c0 100644
--- a/svx/source/dialog/langbox.cxx
+++ b/svx/source/dialog/langbox.cxx
@@ -754,8 +754,8 @@ IMPL_LINK(LanguageBox, ChangeHdl, weld::ComboBoxText&, rControl, void)
    }
}

LanguageBox::LanguageBox(weld::ComboBoxText* pControl)
    : m_xControl(pControl)
LanguageBox::LanguageBox(std::unique_ptr<weld::ComboBoxText> pControl)
    : m_xControl(std::move(pControl))
    , m_aAllString(SvxResId(RID_SVXSTR_LANGUAGE_ALL))
    , m_bHasLangNone(false)
    , m_bLangNoneIsLangAll(false)
diff --git a/svx/source/dialog/pagenumberlistbox.cxx b/svx/source/dialog/pagenumberlistbox.cxx
index f42b9c1..1c8b71f 100644
--- a/svx/source/dialog/pagenumberlistbox.cxx
+++ b/svx/source/dialog/pagenumberlistbox.cxx
@@ -74,8 +74,8 @@ Size PageNumberListBox::GetOptimalSize() const
    return Size(150, ListBox::GetOptimalSize().Height());
}

SvxPageNumberListBox::SvxPageNumberListBox(weld::ComboBoxText* pControl)
    : m_xControl(pControl)
SvxPageNumberListBox::SvxPageNumberListBox(std::unique_ptr<weld::ComboBoxText> pControl)
    : m_xControl(std::move(pControl))
{
    m_xControl->set_size_request(150, -1);

diff --git a/svx/source/dialog/papersizelistbox.cxx b/svx/source/dialog/papersizelistbox.cxx
index 8f9807f..5e52dc2 100644
--- a/svx/source/dialog/papersizelistbox.cxx
+++ b/svx/source/dialog/papersizelistbox.cxx
@@ -84,8 +84,8 @@ Size PaperSizeListBox::GetOptimalSize() const
    return Size(150, ListBox::GetOptimalSize().Height());
}

SvxPaperSizeListBox::SvxPaperSizeListBox(weld::ComboBoxText* pControl)
    : m_xControl(pControl)
SvxPaperSizeListBox::SvxPaperSizeListBox(std::unique_ptr<weld::ComboBoxText> pControl)
    : m_xControl(std::move(pControl))
{
    m_xControl->set_size_request(150, -1);
}
diff --git a/svx/source/dialog/relfld.cxx b/svx/source/dialog/relfld.cxx
index b0ffcb6..53648d7 100644
--- a/svx/source/dialog/relfld.cxx
+++ b/svx/source/dialog/relfld.cxx
@@ -40,8 +40,8 @@ extern "C" SAL_DLLPUBLIC_EXPORT void makeSvxRelativeField(VclPtr<vcl::Window> & 
                                            eUnit);
}

RelativeField::RelativeField(weld::MetricSpinButton* pControl)
    : m_xSpinButton(pControl)
RelativeField::RelativeField(std::unique_ptr<weld::MetricSpinButton> pControl)
    : m_xSpinButton(std::move(pControl))
    , nRelMin(0)
    , nRelMax(0)
    , bRelativeMode(false)
diff --git a/svx/source/dialog/searchcharmap.cxx b/svx/source/dialog/searchcharmap.cxx
index 74a9095..b7361e8 100644
--- a/svx/source/dialog/searchcharmap.cxx
+++ b/svx/source/dialog/searchcharmap.cxx
@@ -44,8 +44,8 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star;


SvxSearchCharSet::SvxSearchCharSet(weld::ScrolledWindow* pScrolledWindow, const VclPtr<VirtualDevice>& rVirDev)
    : SvxShowCharSet(pScrolledWindow, rVirDev)
SvxSearchCharSet::SvxSearchCharSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow, const VclPtr<VirtualDevice>& rVirDev)
    : SvxShowCharSet(std::move(pScrolledWindow), rVirDev)
    , nCount(0)
{
}
diff --git a/svx/source/dialog/txencbox.cxx b/svx/source/dialog/txencbox.cxx
index 857dfe7..6e8a7d9 100644
--- a/svx/source/dialog/txencbox.cxx
+++ b/svx/source/dialog/txencbox.cxx
@@ -224,8 +224,8 @@ void SvxTextEncodingBox::SelectTextEncoding( const rtl_TextEncoding nEnc )
        SelectEntryPos( nAt );
}

TextEncodingBox::TextEncodingBox(weld::ComboBoxText* pControl)
    : m_xControl(pControl)
TextEncodingBox::TextEncodingBox(std::unique_ptr<weld::ComboBoxText> pControl)
    : m_xControl(std::move(pControl))
{
    m_xControl->make_sorted();
}
diff --git a/svx/source/tbxctrls/SvxColorValueSet.cxx b/svx/source/tbxctrls/SvxColorValueSet.cxx
index d762210..ef7a6c5 100644
--- a/svx/source/tbxctrls/SvxColorValueSet.cxx
+++ b/svx/source/tbxctrls/SvxColorValueSet.cxx
@@ -29,8 +29,8 @@ SvxColorValueSet::SvxColorValueSet(vcl::Window* _pParent, WinBits nWinStyle)
    SetEdgeBlending(true);
}

ColorValueSet::ColorValueSet(weld::ScrolledWindow* pWindow)
    : SvtValueSet(pWindow)
ColorValueSet::ColorValueSet(std::unique_ptr<weld::ScrolledWindow> pWindow)
    : SvtValueSet(std::move(pWindow))
{
    SetEdgeBlending(true);
}
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 3453335..68282f4 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -3734,8 +3734,8 @@ void SvxColorListBox::SelectEntry(const Color& rColor)
    ShowPreview(m_aSelectedColor);
}

ColorListBox::ColorListBox(weld::MenuButton* pControl, weld::Window* pTopLevel, bool bInterimBuilder)
    : m_xButton(pControl)
ColorListBox::ColorListBox(std::unique_ptr<weld::MenuButton> pControl, weld::Window* pTopLevel, bool bInterimBuilder)
    : m_xButton(std::move(pControl))
    , m_pTopLevel(pTopLevel)
    , m_aColorWrapper(this)
    , m_aAutoDisplayColor(Application::GetSettings().GetStyleSettings().GetDialogColor())
diff --git a/sw/source/ui/envelp/envprt.cxx b/sw/source/ui/envelp/envprt.cxx
index c25a1ff..9807e76 100644
--- a/sw/source/ui/envelp/envprt.cxx
+++ b/sw/source/ui/envelp/envprt.cxx
@@ -39,18 +39,18 @@ SwEnvPrtPage::SwEnvPrtPage(TabPageParent pParent, const SfxItemSet& rSet)
    , m_xDownField(m_xBuilder->weld_metric_spin_button("down", FUNIT_CM))
    , m_xPrinterInfo(m_xBuilder->weld_label("printername"))
    , m_xPrtSetup(m_xBuilder->weld_button("setup"))
    , m_aIdsL { std::unique_ptr<weld::RadioButton>(m_xBuilder->weld_radio_button("horileftl")),
                std::unique_ptr<weld::RadioButton>(m_xBuilder->weld_radio_button("horicenterl")),
                std::unique_ptr<weld::RadioButton>(m_xBuilder->weld_radio_button("horirightl")),
                std::unique_ptr<weld::RadioButton>(m_xBuilder->weld_radio_button("vertleftl")),
                std::unique_ptr<weld::RadioButton>(m_xBuilder->weld_radio_button("vertcenterl")),
                std::unique_ptr<weld::RadioButton>(m_xBuilder->weld_radio_button("vertrightl")) }
    , m_aIdsU { std::unique_ptr<weld::RadioButton>(m_xBuilder->weld_radio_button("horileftu")),
                std::unique_ptr<weld::RadioButton>(m_xBuilder->weld_radio_button("horicenteru")),
                std::unique_ptr<weld::RadioButton>(m_xBuilder->weld_radio_button("horirightu")),
                std::unique_ptr<weld::RadioButton>(m_xBuilder->weld_radio_button("vertleftu")),
                std::unique_ptr<weld::RadioButton>(m_xBuilder->weld_radio_button("vertcenteru")),
                std::unique_ptr<weld::RadioButton>(m_xBuilder->weld_radio_button("vertrightu")) }
    , m_aIdsL { m_xBuilder->weld_radio_button("horileftl"),
                m_xBuilder->weld_radio_button("horicenterl"),
                m_xBuilder->weld_radio_button("horirightl"),
                m_xBuilder->weld_radio_button("vertleftl"),
                m_xBuilder->weld_radio_button("vertcenterl"),
                m_xBuilder->weld_radio_button("vertrightl") }
    , m_aIdsU { m_xBuilder->weld_radio_button("horileftu"),
                m_xBuilder->weld_radio_button("horicenteru"),
                m_xBuilder->weld_radio_button("horirightu"),
                m_xBuilder->weld_radio_button("vertleftu"),
                m_xBuilder->weld_radio_button("vertcenteru"),
                m_xBuilder->weld_radio_button("vertrightu") }
{
    SetExchangeSupport();

diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx
index 81a7648..dd1d887 100644
--- a/sw/source/ui/index/swuiidxmrk.cxx
+++ b/sw/source/ui/index/swuiidxmrk.cxx
@@ -1517,7 +1517,7 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(weld::Window* pParent,
        m_aFixedTexts.back()->show();
        if( AUTH_FIELD_AUTHORITY_TYPE == aCurInfo.nToxField )
        {
            m_xTypeListBox.reset(m_aBuilders.back()->weld_combo_box_text("listbox"));
            m_xTypeListBox = m_aBuilders.back()->weld_combo_box_text("listbox");
            if (bLeft)
                m_aOrigContainers.back()->move(m_xTypeListBox.get(), m_xLeft.get());
            else
@@ -1539,7 +1539,7 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(weld::Window* pParent,
        }
        else if(AUTH_FIELD_IDENTIFIER == aCurInfo.nToxField && !m_bNewEntryMode)
        {
            m_xIdentifierBox.reset(m_aBuilders.back()->weld_combo_box_text("combobox"));
            m_xIdentifierBox = m_aBuilders.back()->weld_combo_box_text("combobox");
            if (bLeft)
                m_aOrigContainers.back()->move(m_xIdentifierBox.get(), m_xLeft.get());
            else
@@ -1567,7 +1567,7 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(weld::Window* pParent,
        }
        else
        {
            pEdits[nIndex].reset(m_aBuilders.back()->weld_entry("entry"));
            pEdits[nIndex] = m_aBuilders.back()->weld_entry("entry");
            if (bLeft)
                m_aOrigContainers.back()->move(pEdits[nIndex].get(), m_xLeft.get());
            else
diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx
index 1690504..ba617f7 100644
--- a/sw/source/ui/table/tabledlg.cxx
+++ b/sw/source/ui/table/tabledlg.cxx
@@ -713,12 +713,12 @@ SwTableColumnPage::SwTableColumnPage(TabPageParent pParent, const SfxItemSet& rS
                    m_xBuilder->weld_metric_spin_button("width4", FUNIT_CM),
                    m_xBuilder->weld_metric_spin_button("width5", FUNIT_CM),
                    m_xBuilder->weld_metric_spin_button("width6", FUNIT_CM) }
    , m_aTextArr { std::unique_ptr<weld::Label>(m_xBuilder->weld_label("1")),
                   std::unique_ptr<weld::Label>(m_xBuilder->weld_label("2")),
                   std::unique_ptr<weld::Label>(m_xBuilder->weld_label("3")),
                   std::unique_ptr<weld::Label>(m_xBuilder->weld_label("4")),
                   std::unique_ptr<weld::Label>(m_xBuilder->weld_label("5")),
                   std::unique_ptr<weld::Label>(m_xBuilder->weld_label("6")) }
    , m_aTextArr { m_xBuilder->weld_label("1"),
                   m_xBuilder->weld_label("2"),
                   m_xBuilder->weld_label("3"),
                   m_xBuilder->weld_label("4"),
                   m_xBuilder->weld_label("5"),
                   m_xBuilder->weld_label("6") }
    , m_xModifyTableCB(m_xBuilder->weld_check_button("adaptwidth"))
    , m_xProportionalCB(m_xBuilder->weld_check_button("adaptcolumns"))
    , m_xSpaceFT(m_xBuilder->weld_label("spaceft"))
diff --git a/sw/source/uibase/inc/numberingtypelistbox.hxx b/sw/source/uibase/inc/numberingtypelistbox.hxx
index 030196c..ed704e5 100644
--- a/sw/source/uibase/inc/numberingtypelistbox.hxx
+++ b/sw/source/uibase/inc/numberingtypelistbox.hxx
@@ -47,7 +47,7 @@ class SW_DLLPUBLIC SwNumberingTypeListBox
    std::unique_ptr<SwNumberingTypeListBox_Impl> m_xImpl;

public:
    SwNumberingTypeListBox(weld::ComboBoxText* pWidget);
    SwNumberingTypeListBox(std::unique_ptr<weld::ComboBoxText> pWidget);
    ~SwNumberingTypeListBox();

    void connect_changed(const Link<weld::ComboBoxText&, void>& rLink) { m_xWidget->connect_changed(rLink); }
diff --git a/sw/source/uibase/inc/prcntfld.hxx b/sw/source/uibase/inc/prcntfld.hxx
index 5ee2a6f..20aa83a 100644
--- a/sw/source/uibase/inc/prcntfld.hxx
+++ b/sw/source/uibase/inc/prcntfld.hxx
@@ -109,7 +109,7 @@ class SW_DLLPUBLIC SwPercentField

public:

    SwPercentField(weld::MetricSpinButton* pControl);
    SwPercentField(std::unique_ptr<weld::MetricSpinButton> pControl);
    const weld::MetricSpinButton* get() const { return m_pField.get(); }
    weld::MetricSpinButton* get() { return m_pField.get(); }
    void connect_value_changed(const Link<weld::MetricSpinButton&, void>& rLink) { m_pField->connect_value_changed(rLink); }
diff --git a/sw/source/uibase/misc/numberingtypelistbox.cxx b/sw/source/uibase/misc/numberingtypelistbox.cxx
index 1f314ad..5f824d9 100644
--- a/sw/source/uibase/misc/numberingtypelistbox.cxx
+++ b/sw/source/uibase/misc/numberingtypelistbox.cxx
@@ -38,8 +38,8 @@ struct SwNumberingTypeListBox_Impl
    uno::Reference<text::XNumberingTypeInfo> xInfo;
};

SwNumberingTypeListBox::SwNumberingTypeListBox(weld::ComboBoxText* pWidget)
    : m_xWidget(pWidget)
SwNumberingTypeListBox::SwNumberingTypeListBox(std::unique_ptr<weld::ComboBoxText> pWidget)
    : m_xWidget(std::move(pWidget))
    , m_xImpl(new SwNumberingTypeListBox_Impl)
{
    uno::Reference<uno::XComponentContext>          xContext( ::comphelper::getProcessComponentContext() );
diff --git a/sw/source/uibase/utlui/prcntfld.cxx b/sw/source/uibase/utlui/prcntfld.cxx
index 76715f8..2375d60 100644
--- a/sw/source/uibase/utlui/prcntfld.cxx
+++ b/sw/source/uibase/utlui/prcntfld.cxx
@@ -279,8 +279,8 @@ sal_Int64 PercentField::Convert(sal_Int64 nValue, FieldUnit eInUnit, FieldUnit e
    return MetricField::ConvertValue(nValue, 0, nOldDigits, eInUnit, eOutUnit);
}

SwPercentField::SwPercentField(weld::MetricSpinButton* pControl)
    : m_pField(pControl)
SwPercentField::SwPercentField(std::unique_ptr<weld::MetricSpinButton> pControl)
    : m_pField(std::move(pControl))
    , nOldMax(0)
    , nOldMin(0)
    , nLastPercent(-1)
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index e4a0f8d..44d2aee 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -2265,10 +2265,10 @@ public:
    {
    }

    virtual weld::MessageDialog* weld_message_dialog(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::MessageDialog> weld_message_dialog(const OString &id, bool bTakeOwnership) override
    {
        MessageDialog* pMessageDialog = m_xBuilder->get<MessageDialog>(id);
        weld::MessageDialog* pRet = pMessageDialog ? new SalInstanceMessageDialog(pMessageDialog, false) : nullptr;
        std::unique_ptr<weld::MessageDialog> pRet(pMessageDialog ? new SalInstanceMessageDialog(pMessageDialog, false) : nullptr);
        if (bTakeOwnership && pMessageDialog)
        {
            assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed");
@@ -2278,10 +2278,10 @@ public:
        return pRet;
    }

    virtual weld::Dialog* weld_dialog(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::Dialog> weld_dialog(const OString &id, bool bTakeOwnership) override
    {
        Dialog* pDialog = m_xBuilder->get<Dialog>(id);
        weld::Dialog* pRet = pDialog ? new SalInstanceDialog(pDialog, false) : nullptr;
        std::unique_ptr<weld::Dialog> pRet(pDialog ? new SalInstanceDialog(pDialog, false) : nullptr);
        if (bTakeOwnership && pDialog)
        {
            assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed");
@@ -2291,28 +2291,28 @@ public:
        return pRet;
    }

    virtual weld::Window* weld_window(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::Window> weld_window(const OString &id, bool bTakeOwnership) override
    {
        SystemWindow* pWindow = m_xBuilder->get<SystemWindow>(id);
        return pWindow ? new SalInstanceWindow(pWindow, bTakeOwnership) : nullptr;
        return pWindow ? o3tl::make_unique<SalInstanceWindow>(pWindow, bTakeOwnership) : nullptr;
    }

    virtual weld::Widget* weld_widget(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::Widget> weld_widget(const OString &id, bool bTakeOwnership) override
    {
        vcl::Window* pWidget = m_xBuilder->get<vcl::Window>(id);
        return pWidget ? new SalInstanceWidget(pWidget, bTakeOwnership) : nullptr;
        return pWidget ? o3tl::make_unique<SalInstanceWidget>(pWidget, bTakeOwnership) : nullptr;
    }

    virtual weld::Container* weld_container(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::Container> weld_container(const OString &id, bool bTakeOwnership) override
    {
        vcl::Window* pContainer = m_xBuilder->get<vcl::Window>(id);
        return pContainer ? new SalInstanceContainer(pContainer, bTakeOwnership) : nullptr;
        return pContainer ? o3tl::make_unique<SalInstanceContainer>(pContainer, bTakeOwnership) : nullptr;
    }

    virtual weld::Frame* weld_frame(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::Frame> weld_frame(const OString &id, bool bTakeOwnership) override
    {
        VclFrame* pFrame = m_xBuilder->get<VclFrame>(id);
        weld::Frame* pRet = pFrame ? new SalInstanceFrame(pFrame, false) : nullptr;
        std::unique_ptr<weld::Frame> pRet(pFrame ? new SalInstanceFrame(pFrame, false) : nullptr);
        if (bTakeOwnership && pFrame)
        {
            assert(!m_aOwnedToplevel && "only one toplevel per .ui allowed");
@@ -2322,132 +2322,132 @@ public:
        return pRet;
    }

    virtual weld::ScrolledWindow* weld_scrolled_window(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::ScrolledWindow> weld_scrolled_window(const OString &id, bool bTakeOwnership) override
    {
        VclScrolledWindow* pScrolledWindow = m_xBuilder->get<VclScrolledWindow>(id);
        return pScrolledWindow ? new SalInstanceScrolledWindow(pScrolledWindow, bTakeOwnership) : nullptr;
        return pScrolledWindow ? o3tl::make_unique<SalInstanceScrolledWindow>(pScrolledWindow, bTakeOwnership) : nullptr;
    }

    virtual weld::Notebook* weld_notebook(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::Notebook> weld_notebook(const OString &id, bool bTakeOwnership) override
    {
        TabControl* pNotebook = m_xBuilder->get<TabControl>(id);
        return pNotebook ? new SalInstanceNotebook(pNotebook, bTakeOwnership) : nullptr;
        return pNotebook ? o3tl::make_unique<SalInstanceNotebook>(pNotebook, bTakeOwnership) : nullptr;
    }

    virtual weld::Button* weld_button(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::Button> weld_button(const OString &id, bool bTakeOwnership) override
    {
        Button* pButton = m_xBuilder->get<Button>(id);
        return pButton ? new SalInstanceButton(pButton, bTakeOwnership) : nullptr;
        return pButton ? o3tl::make_unique<SalInstanceButton>(pButton, bTakeOwnership) : nullptr;
    }

    virtual weld::MenuButton* weld_menu_button(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::MenuButton> weld_menu_button(const OString &id, bool bTakeOwnership) override
    {
        MenuButton* pButton = m_xBuilder->get<MenuButton>(id);
        return pButton ? new SalInstanceMenuButton(pButton, bTakeOwnership) : nullptr;
        return pButton ? o3tl::make_unique<SalInstanceMenuButton>(pButton, bTakeOwnership) : nullptr;
    }

    virtual weld::ToggleButton* weld_toggle_button(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::ToggleButton> weld_toggle_button(const OString &id, bool bTakeOwnership) override
    {
        PushButton* pToggleButton = m_xBuilder->get<PushButton>(id);
        return pToggleButton ? new SalInstanceToggleButton(pToggleButton, bTakeOwnership) : nullptr;
        return pToggleButton ? o3tl::make_unique<SalInstanceToggleButton>(pToggleButton, bTakeOwnership) : nullptr;
    }

    virtual weld::RadioButton* weld_radio_button(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::RadioButton> weld_radio_button(const OString &id, bool bTakeOwnership) override
    {
        RadioButton* pRadioButton = m_xBuilder->get<RadioButton>(id);
        return pRadioButton ? new SalInstanceRadioButton(pRadioButton, bTakeOwnership) : nullptr;
        return pRadioButton ? o3tl::make_unique<SalInstanceRadioButton>(pRadioButton, bTakeOwnership) : nullptr;
    }

    virtual weld::CheckButton* weld_check_button(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::CheckButton> weld_check_button(const OString &id, bool bTakeOwnership) override
    {
        CheckBox* pCheckButton = m_xBuilder->get<CheckBox>(id);
        return pCheckButton ? new SalInstanceCheckButton(pCheckButton, bTakeOwnership) : nullptr;
        return pCheckButton ? o3tl::make_unique<SalInstanceCheckButton>(pCheckButton, bTakeOwnership) : nullptr;
    }

    virtual weld::Scale* weld_scale(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::Scale> weld_scale(const OString &id, bool bTakeOwnership) override
    {
        Slider* pSlider = m_xBuilder->get<Slider>(id);
        return pSlider ? new SalInstanceScale(pSlider, bTakeOwnership) : nullptr;
        return pSlider ? o3tl::make_unique<SalInstanceScale>(pSlider, bTakeOwnership) : nullptr;
    }

    virtual weld::ProgressBar* weld_progress_bar(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::ProgressBar> weld_progress_bar(const OString &id, bool bTakeOwnership) override
    {
        ::ProgressBar* pProgress = m_xBuilder->get<::ProgressBar>(id);
        return pProgress ? new SalInstanceProgressBar(pProgress, bTakeOwnership) : nullptr;
        return pProgress ? o3tl::make_unique<SalInstanceProgressBar>(pProgress, bTakeOwnership) : nullptr;
    }

    virtual weld::Entry* weld_entry(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::Entry> weld_entry(const OString &id, bool bTakeOwnership) override
    {
        Edit* pEntry = m_xBuilder->get<Edit>(id);
        return pEntry ? new SalInstanceEntry(pEntry, bTakeOwnership) : nullptr;
        return pEntry ? o3tl::make_unique<SalInstanceEntry>(pEntry, bTakeOwnership) : nullptr;
    }

    virtual weld::SpinButton* weld_spin_button(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::SpinButton> weld_spin_button(const OString &id, bool bTakeOwnership) override
    {
        NumericField* pSpinButton = m_xBuilder->get<NumericField>(id);
        return pSpinButton ? new SalInstanceSpinButton(pSpinButton, bTakeOwnership) : nullptr;
        return pSpinButton ? o3tl::make_unique<SalInstanceSpinButton>(pSpinButton, bTakeOwnership) : nullptr;
    }

    virtual weld::TimeSpinButton* weld_time_spin_button(const OString& id, TimeFieldFormat eFormat,
    virtual std::unique_ptr<weld::TimeSpinButton> weld_time_spin_button(const OString& id, TimeFieldFormat eFormat,
                                                        bool bTakeOwnership) override
    {
        weld::TimeSpinButton* pRet = new weld::TimeSpinButton(weld_spin_button(id, bTakeOwnership), eFormat);
        std::unique_ptr<weld::TimeSpinButton> pRet(new weld::TimeSpinButton(weld_spin_button(id, bTakeOwnership), eFormat));
        SalInstanceSpinButton& rButton = dynamic_cast<SalInstanceSpinButton&>(pRet->get_widget());
        rButton.DisableRemainderFactor(); //so with hh::mm::ss, incrementing mm will not reset ss
        return pRet;
    }

    virtual weld::ComboBoxText* weld_combo_box_text(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::ComboBoxText> weld_combo_box_text(const OString &id, bool bTakeOwnership) override
    {
        vcl::Window* pComboBoxText = m_xBuilder->get<vcl::Window>(id);
        ComboBox* pComboBox = dynamic_cast<ComboBox*>(pComboBoxText);
        if (pComboBox)
            return new SalInstanceComboBoxTextWithEdit(pComboBox, bTakeOwnership);
            return o3tl::make_unique<SalInstanceComboBoxTextWithEdit>(pComboBox, bTakeOwnership);
        ListBox* pListBox = dynamic_cast<ListBox*>(pComboBoxText);
        return pListBox ? new SalInstanceComboBoxTextWithoutEdit(pListBox, bTakeOwnership) : nullptr;
        return pListBox ? o3tl::make_unique<SalInstanceComboBoxTextWithoutEdit>(pListBox, bTakeOwnership) : nullptr;
    }

    virtual weld::TreeView* weld_tree_view(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::TreeView> weld_tree_view(const OString &id, bool bTakeOwnership) override
    {
        ListBox* pTreeView = m_xBuilder->get<ListBox>(id);
        return pTreeView ? new SalInstanceTreeView(pTreeView, bTakeOwnership) : nullptr;
        return pTreeView ? o3tl::make_unique<SalInstanceTreeView>(pTreeView, bTakeOwnership) : nullptr;
    }

    virtual weld::Label* weld_label(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::Label> weld_label(const OString &id, bool bTakeOwnership) override
    {
        FixedText* pLabel = m_xBuilder->get<FixedText>(id);
        return pLabel ? new SalInstanceLabel(pLabel, bTakeOwnership) : nullptr;
        return pLabel ? o3tl::make_unique<SalInstanceLabel>(pLabel, bTakeOwnership) : nullptr;
    }

    virtual weld::TextView* weld_text_view(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::TextView> weld_text_view(const OString &id, bool bTakeOwnership) override
    {
        VclMultiLineEdit* pTextView = m_xBuilder->get<VclMultiLineEdit>(id);
        return pTextView ? new SalInstanceTextView(pTextView, bTakeOwnership) : nullptr;
        return pTextView ? o3tl::make_unique<SalInstanceTextView>(pTextView, bTakeOwnership) : nullptr;
    }

    virtual weld::Expander* weld_expander(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::Expander> weld_expander(const OString &id, bool bTakeOwnership) override
    {
        VclExpander* pExpander = m_xBuilder->get<VclExpander>(id);
        return pExpander ? new SalInstanceExpander(pExpander, bTakeOwnership) : nullptr;
        return pExpander ? o3tl::make_unique<SalInstanceExpander>(pExpander, bTakeOwnership) : nullptr;
    }

    virtual weld::DrawingArea* weld_drawing_area(const OString &id, const a11yref& rA11yImpl,
    virtual std::unique_ptr<weld::DrawingArea> weld_drawing_area(const OString &id, const a11yref& rA11yImpl,
            FactoryFunction pUITestFactoryFunction, void* pUserData, bool bTakeOwnership) override
    {
        VclDrawingArea* pDrawingArea = m_xBuilder->get<VclDrawingArea>(id);
        return pDrawingArea ? new SalInstanceDrawingArea(pDrawingArea, rA11yImpl,
        return pDrawingArea ? o3tl::make_unique<SalInstanceDrawingArea>(pDrawingArea, rA11yImpl,
                pUITestFactoryFunction, pUserData, bTakeOwnership) : nullptr;
    }

    virtual weld::Menu* weld_menu(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::Menu> weld_menu(const OString &id, bool bTakeOwnership) override
    {
        PopupMenu* pMenu = m_xBuilder->get_menu(id);
        return pMenu ? new SalInstanceMenu(pMenu, bTakeOwnership) : nullptr;
        return pMenu ? o3tl::make_unique<SalInstanceMenu>(pMenu, bTakeOwnership) : nullptr;
    }

    virtual weld::SizeGroup* create_size_group() override
    virtual std::unique_ptr<weld::SizeGroup> create_size_group() override
    {
        return new SalInstanceSizeGroup;
        return o3tl::make_unique<SalInstanceSizeGroup>();
    }

    virtual ~SalInstanceBuilder() override
@@ -2544,7 +2544,7 @@ namespace weld
    {
        if (!rRelocateId.isEmpty())
        {
            m_xRelocate.reset(m_xBuilder->weld_container(rRelocateId));
            m_xRelocate = m_xBuilder->weld_container(rRelocateId);
            m_xOrigParent.reset(m_xRelocate->weld_parent());
            //fdo#75121, a bit tricky because the widgets we want to align with
            //don't actually exist in the ui description, they're implied
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 56f5289..f1a8d59 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -5116,228 +5116,228 @@ public:
            gtk_container_add(GTK_CONTAINER(m_pParentWidget), pWidget);
    }

    virtual weld::MessageDialog* weld_message_dialog(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::MessageDialog> weld_message_dialog(const OString &id, bool bTakeOwnership) override
    {
        GtkMessageDialog* pMessageDialog = GTK_MESSAGE_DIALOG(gtk_builder_get_object(m_pBuilder, id.getStr()));
        if (!pMessageDialog)
            return nullptr;
        gtk_window_set_transient_for(GTK_WINDOW(pMessageDialog), GTK_WINDOW(gtk_widget_get_toplevel(m_pParentWidget)));
        return new GtkInstanceMessageDialog(pMessageDialog, bTakeOwnership);
        return o3tl::make_unique<GtkInstanceMessageDialog>(pMessageDialog, bTakeOwnership);
    }

    virtual weld::Dialog* weld_dialog(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::Dialog> weld_dialog(const OString &id, bool bTakeOwnership) override
    {
        GtkDialog* pDialog = GTK_DIALOG(gtk_builder_get_object(m_pBuilder, id.getStr()));
        if (!pDialog)
            return nullptr;
        gtk_window_set_transient_for(GTK_WINDOW(pDialog), GTK_WINDOW(gtk_widget_get_toplevel(m_pParentWidget)));
        return new GtkInstanceDialog(pDialog, bTakeOwnership);
        return o3tl::make_unique<GtkInstanceDialog>(pDialog, bTakeOwnership);
    }

    virtual weld::Window* weld_window(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::Window> weld_window(const OString &id, bool bTakeOwnership) override
    {
        GtkWindow* pWindow = GTK_WINDOW(gtk_builder_get_object(m_pBuilder, id.getStr()));
        return pWindow ? new GtkInstanceWindow(pWindow, bTakeOwnership) : nullptr;
        return pWindow ? o3tl::make_unique<GtkInstanceWindow>(pWindow, bTakeOwnership) : nullptr;
    }

    virtual weld::Widget* weld_widget(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::Widget> weld_widget(const OString &id, bool bTakeOwnership) override
    {
        GtkWidget* pWidget = GTK_WIDGET(gtk_builder_get_object(m_pBuilder, id.getStr()));
        if (!pWidget)
            return nullptr;
        auto_add_parentless_widgets_to_container(pWidget);
        return new GtkInstanceWidget(pWidget, bTakeOwnership);
        return o3tl::make_unique<GtkInstanceWidget>(pWidget, bTakeOwnership);
    }

    virtual weld::Container* weld_container(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::Container> weld_container(const OString &id, bool bTakeOwnership) override
    {
        GtkContainer* pContainer = GTK_CONTAINER(gtk_builder_get_object(m_pBuilder, id.getStr()));
        if (!pContainer)
            return nullptr;
        auto_add_parentless_widgets_to_container(GTK_WIDGET(pContainer));
        return new GtkInstanceContainer(pContainer, bTakeOwnership);
        return o3tl::make_unique<GtkInstanceContainer>(pContainer, bTakeOwnership);
    }

    virtual weld::Frame* weld_frame(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::Frame> weld_frame(const OString &id, bool bTakeOwnership) override
    {
        GtkFrame* pFrame = GTK_FRAME(gtk_builder_get_object(m_pBuilder, id.getStr()));
        if (!pFrame)
            return nullptr;
        auto_add_parentless_widgets_to_container(GTK_WIDGET(pFrame));
        return new GtkInstanceFrame(pFrame, bTakeOwnership);
        return o3tl::make_unique<GtkInstanceFrame>(pFrame, bTakeOwnership);
    }

    virtual weld::ScrolledWindow* weld_scrolled_window(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::ScrolledWindow> weld_scrolled_window(const OString &id, bool bTakeOwnership) override
    {
        GtkScrolledWindow* pScrolledWindow = GTK_SCROLLED_WINDOW(gtk_builder_get_object(m_pBuilder, id.getStr()));
        if (!pScrolledWindow)
            return nullptr;
        auto_add_parentless_widgets_to_container(GTK_WIDGET(pScrolledWindow));
        return new GtkInstanceScrolledWindow(pScrolledWindow, bTakeOwnership);
        return o3tl::make_unique<GtkInstanceScrolledWindow>(pScrolledWindow, bTakeOwnership);
    }

    virtual weld::Notebook* weld_notebook(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::Notebook> weld_notebook(const OString &id, bool bTakeOwnership) override
    {
        GtkNotebook* pNotebook = GTK_NOTEBOOK(gtk_builder_get_object(m_pBuilder, id.getStr()));
        if (!pNotebook)
            return nullptr;
        auto_add_parentless_widgets_to_container(GTK_WIDGET(pNotebook));
        return new GtkInstanceNotebook(pNotebook, bTakeOwnership);
        return o3tl::make_unique<GtkInstanceNotebook>(pNotebook, bTakeOwnership);
    }

    virtual weld::Button* weld_button(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::Button> weld_button(const OString &id, bool bTakeOwnership) override
    {
        GtkButton* pButton = GTK_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr()));
        if (!pButton)
            return nullptr;
        auto_add_parentless_widgets_to_container(GTK_WIDGET(pButton));
        return new GtkInstanceButton(pButton, bTakeOwnership);
        return o3tl::make_unique<GtkInstanceButton>(pButton, bTakeOwnership);
    }

    virtual weld::MenuButton* weld_menu_button(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::MenuButton> weld_menu_button(const OString &id, bool bTakeOwnership) override
    {
        GtkMenuButton* pButton = GTK_MENU_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr()));
        if (!pButton)
            return nullptr;
        auto_add_parentless_widgets_to_container(GTK_WIDGET(pButton));
        return new GtkInstanceMenuButton(pButton, bTakeOwnership);
        return o3tl::make_unique<GtkInstanceMenuButton>(pButton, bTakeOwnership);
    }

    virtual weld::ToggleButton* weld_toggle_button(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::ToggleButton> weld_toggle_button(const OString &id, bool bTakeOwnership) override
    {
        GtkToggleButton* pToggleButton = GTK_TOGGLE_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr()));
        if (!pToggleButton)
            return nullptr;
        auto_add_parentless_widgets_to_container(GTK_WIDGET(pToggleButton));
        return new GtkInstanceToggleButton(pToggleButton, bTakeOwnership);
        return o3tl::make_unique<GtkInstanceToggleButton>(pToggleButton, bTakeOwnership);
    }

    virtual weld::RadioButton* weld_radio_button(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::RadioButton> weld_radio_button(const OString &id, bool bTakeOwnership) override
    {
        GtkRadioButton* pRadioButton = GTK_RADIO_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr()));
        if (!pRadioButton)
            return nullptr;
        auto_add_parentless_widgets_to_container(GTK_WIDGET(pRadioButton));
        return new GtkInstanceRadioButton(pRadioButton, bTakeOwnership);
        return o3tl::make_unique<GtkInstanceRadioButton>(pRadioButton, bTakeOwnership);
    }

    virtual weld::CheckButton* weld_check_button(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::CheckButton> weld_check_button(const OString &id, bool bTakeOwnership) override
    {
        GtkCheckButton* pCheckButton = GTK_CHECK_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr()));
        if (!pCheckButton)
            return nullptr;
        auto_add_parentless_widgets_to_container(GTK_WIDGET(pCheckButton));
        return new GtkInstanceCheckButton(pCheckButton, bTakeOwnership);
        return o3tl::make_unique<GtkInstanceCheckButton>(pCheckButton, bTakeOwnership);
    }

    virtual weld::Scale* weld_scale(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::Scale> weld_scale(const OString &id, bool bTakeOwnership) override
    {
        GtkScale* pScale = GTK_SCALE(gtk_builder_get_object(m_pBuilder, id.getStr()));
        if (!pScale)
            return nullptr;
        auto_add_parentless_widgets_to_container(GTK_WIDGET(pScale));
        return new GtkInstanceScale(pScale, bTakeOwnership);
        return o3tl::make_unique<GtkInstanceScale>(pScale, bTakeOwnership);
    }

    virtual weld::ProgressBar* weld_progress_bar(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::ProgressBar> weld_progress_bar(const OString &id, bool bTakeOwnership) override
    {
        GtkProgressBar* pProgressBar = GTK_PROGRESS_BAR(gtk_builder_get_object(m_pBuilder, id.getStr()));
        if (!pProgressBar)
            return nullptr;
        auto_add_parentless_widgets_to_container(GTK_WIDGET(pProgressBar));
        return new GtkInstanceProgressBar(pProgressBar, bTakeOwnership);
        return o3tl::make_unique<GtkInstanceProgressBar>(pProgressBar, bTakeOwnership);
    }

    virtual weld::Entry* weld_entry(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::Entry> weld_entry(const OString &id, bool bTakeOwnership) override
    {
        GtkEntry* pEntry = GTK_ENTRY(gtk_builder_get_object(m_pBuilder, id.getStr()));
        if (!pEntry)
            return nullptr;
        auto_add_parentless_widgets_to_container(GTK_WIDGET(pEntry));
        return new GtkInstanceEntry(pEntry, bTakeOwnership);
        return o3tl::make_unique<GtkInstanceEntry>(pEntry, bTakeOwnership);
    }

    virtual weld::SpinButton* weld_spin_button(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::SpinButton> weld_spin_button(const OString &id, bool bTakeOwnership) override
    {
        GtkSpinButton* pSpinButton = GTK_SPIN_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr()));
        if (!pSpinButton)
            return nullptr;
        auto_add_parentless_widgets_to_container(GTK_WIDGET(pSpinButton));
        return new GtkInstanceSpinButton(pSpinButton, bTakeOwnership);
        return o3tl::make_unique<GtkInstanceSpinButton>(pSpinButton, bTakeOwnership);
    }

    virtual weld::TimeSpinButton* weld_time_spin_button(const OString& id, TimeFieldFormat eFormat,
    virtual std::unique_ptr<weld::TimeSpinButton> weld_time_spin_button(const OString& id, TimeFieldFormat eFormat,
                                                        bool bTakeOwnership) override
    {
        return new weld::TimeSpinButton(weld_spin_button(id, bTakeOwnership), eFormat);
        return o3tl::make_unique<weld::TimeSpinButton>(weld_spin_button(id, bTakeOwnership), eFormat);
    }

    virtual weld::ComboBoxText* weld_combo_box_text(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::ComboBoxText> weld_combo_box_text(const OString &id, bool bTakeOwnership) override
    {
        GtkComboBoxText* pComboBoxText = GTK_COMBO_BOX_TEXT(gtk_builder_get_object(m_pBuilder, id.getStr()));
        if (!pComboBoxText)
            return nullptr;
        auto_add_parentless_widgets_to_container(GTK_WIDGET(pComboBoxText));
        return new GtkInstanceComboBoxText(pComboBoxText, bTakeOwnership);
        return o3tl::make_unique<GtkInstanceComboBoxText>(pComboBoxText, bTakeOwnership);
    }

    virtual weld::TreeView* weld_tree_view(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::TreeView> weld_tree_view(const OString &id, bool bTakeOwnership) override
    {
        GtkTreeView* pTreeView = GTK_TREE_VIEW(gtk_builder_get_object(m_pBuilder, id.getStr()));
        if (!pTreeView)
            return nullptr;
        auto_add_parentless_widgets_to_container(GTK_WIDGET(pTreeView));
        return new GtkInstanceTreeView(pTreeView, bTakeOwnership);
        return o3tl::make_unique<GtkInstanceTreeView>(pTreeView, bTakeOwnership);
    }

    virtual weld::Label* weld_label(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::Label> weld_label(const OString &id, bool bTakeOwnership) override
    {
        GtkLabel* pLabel = GTK_LABEL(gtk_builder_get_object(m_pBuilder, id.getStr()));
        if (!pLabel)
            return nullptr;
        auto_add_parentless_widgets_to_container(GTK_WIDGET(pLabel));
        return new GtkInstanceLabel(pLabel, bTakeOwnership);
        return o3tl::make_unique<GtkInstanceLabel>(pLabel, bTakeOwnership);
    }

    virtual weld::TextView* weld_text_view(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::TextView> weld_text_view(const OString &id, bool bTakeOwnership) override
    {
        GtkTextView* pTextView = GTK_TEXT_VIEW(gtk_builder_get_object(m_pBuilder, id.getStr()));
        if (!pTextView)
            return nullptr;
        auto_add_parentless_widgets_to_container(GTK_WIDGET(pTextView));
        return new GtkInstanceTextView(pTextView, bTakeOwnership);
        return o3tl::make_unique<GtkInstanceTextView>(pTextView, bTakeOwnership);
    }

    virtual weld::Expander* weld_expander(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::Expander> weld_expander(const OString &id, bool bTakeOwnership) override
    {
        GtkExpander* pExpander = GTK_EXPANDER(gtk_builder_get_object(m_pBuilder, id.getStr()));
        if (!pExpander)
            return nullptr;
        auto_add_parentless_widgets_to_container(GTK_WIDGET(pExpander));
        return new GtkInstanceExpander(pExpander, bTakeOwnership);
        return o3tl::make_unique<GtkInstanceExpander>(pExpander, bTakeOwnership);
    }

    virtual weld::DrawingArea* weld_drawing_area(const OString &id, const a11yref& rA11y,
    virtual std::unique_ptr<weld::DrawingArea> weld_drawing_area(const OString &id, const a11yref& rA11y,
            FactoryFunction /*pUITestFactoryFunction*/, void* /*pUserData*/, bool bTakeOwnership) override
    {
        GtkDrawingArea* pDrawingArea = GTK_DRAWING_AREA(gtk_builder_get_object(m_pBuilder, id.getStr()));
        if (!pDrawingArea)
            return nullptr;
        auto_add_parentless_widgets_to_container(GTK_WIDGET(pDrawingArea));
        return new GtkInstanceDrawingArea(pDrawingArea, rA11y, bTakeOwnership);
        return o3tl::make_unique<GtkInstanceDrawingArea>(pDrawingArea, rA11y, bTakeOwnership);
    }

    virtual weld::Menu* weld_menu(const OString &id, bool bTakeOwnership) override
    virtual std::unique_ptr<weld::Menu> weld_menu(const OString &id, bool bTakeOwnership) override
    {
        GtkMenu* pMenu = GTK_MENU(gtk_builder_get_object(m_pBuilder, id.getStr()));
        if (!pMenu)
            return nullptr;
        return new GtkInstanceMenu(pMenu, bTakeOwnership);
        return o3tl::make_unique<GtkInstanceMenu>(pMenu, bTakeOwnership);
    }

    virtual weld::SizeGroup* create_size_group() override
    virtual std::unique_ptr<weld::SizeGroup> create_size_group() override
    {
        return new GtkInstanceSizeGroup;
        return o3tl::make_unique<GtkInstanceSizeGroup>();
    }
};