Kaydet (Commit) 89a95f5f authored tarafından Noel Grandin's avatar Noel Grandin

return by unique_ptr from weld_parent

Change-Id: I3582b3000330fab96f6abef0f412b648b0573af4
Reviewed-on: https://gerrit.libreoffice.org/69793
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst b859e9f6
......@@ -211,7 +211,7 @@ public:
virtual void freeze() = 0;
virtual void thaw() = 0;
virtual Container* weld_parent() const = 0;
virtual std::unique_ptr<Container> weld_parent() const = 0;
//iterate upwards through the hierarchy starting at this widgets parent,
//calling func with their helpid until func returns true or we run out of
......
......@@ -649,7 +649,7 @@ OUString SfxHelp::GetHelpText(const OUString& aCommandURL, const weld::Widget* p
if (!sHelpText.isEmpty())
xParent.reset();
else
xParent.reset(xParent->weld_parent());
xParent = xParent->weld_parent();
}
if (bIsDebug && sHelpText.isEmpty())
......
......@@ -593,7 +593,7 @@ public:
m_xWidget->SetUpdateMode(true);
}
virtual weld::Container* weld_parent() const override;
virtual std::unique_ptr<weld::Container> weld_parent() const override;
virtual ~SalInstanceWidget() override
{
......@@ -832,10 +832,12 @@ public:
}
};
weld::Container* SalInstanceWidget::weld_parent() const
std::unique_ptr<weld::Container> SalInstanceWidget::weld_parent() const
{
vcl::Window* pParent = m_xWidget->GetParent();
return pParent ? new SalInstanceContainer(pParent, m_pBuilder, false) : nullptr;
if (!pParent)
return nullptr;
return std::make_unique<SalInstanceContainer>(pParent, m_pBuilder, false);
}
class SalInstanceWindow : public SalInstanceContainer, public virtual weld::Window
......@@ -4686,7 +4688,7 @@ namespace weld
if (!rRelocateId.isEmpty())
{
m_xRelocate = m_xBuilder->weld_container(rRelocateId);
m_xOrigParent.reset(m_xRelocate->weld_parent());
m_xOrigParent = 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
m_xOrigParent->move(m_xRelocate.get(), m_xContentArea.get());
......
......@@ -1809,7 +1809,7 @@ public:
return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8);
}
virtual weld::Container* weld_parent() const override;
virtual std::unique_ptr<weld::Container> weld_parent() const override;
virtual OString get_buildable_name() const override
{
......@@ -2368,10 +2368,12 @@ public:
}
};
weld::Container* GtkInstanceWidget::weld_parent() const
std::unique_ptr<weld::Container> GtkInstanceWidget::weld_parent() const
{
GtkWidget* pParent = gtk_widget_get_parent(m_pWidget);
return pParent ? new GtkInstanceContainer(GTK_CONTAINER(pParent), m_pBuilder, false) : nullptr;
if (!pParent)
return nullptr;
return std::make_unique<GtkInstanceContainer>(GTK_CONTAINER(pParent), m_pBuilder, false);
}
class GtkInstanceWindow : public GtkInstanceContainer, public virtual weld::Window
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment