diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-10-22 10:36:14 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-10-22 12:05:19 +0200 |
commit | 426be29029ffec9a721f83d65d0d320455ff9503 (patch) | |
tree | 77f7710c6963b588bf7eff650158e08d419dd0d4 /vcl | |
parent | de0581c77228eb00ff84a3996bfd252d6928a056 (diff) |
return weld::Builder by unique_ptr
Change-Id: Ifa4f5951d200eaad6c8aebd3f29eed053c927ff0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124051
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/jsdialog/jsdialogbuilder.hxx | 25 | ||||
-rw-r--r-- | vcl/inc/salinst.hxx | 4 | ||||
-rw-r--r-- | vcl/inc/unx/gtk/gtkinst.hxx | 4 | ||||
-rw-r--r-- | vcl/jsdialog/jsdialogbuilder.cxx | 38 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 14 | ||||
-rw-r--r-- | vcl/source/control/InterimItemWindow.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/builder.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/printdlg.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtkinst.cxx | 8 |
9 files changed, 53 insertions, 50 deletions
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index 282857341cdf..3d14a1150576 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -221,6 +221,7 @@ class JSInstanceBuilder final : public SalInstanceBuilder, public JSDialogSender void RememberWidget(const OString& id, weld::Widget* pWidget); static weld::Widget* FindWeldWidgetsMap(sal_uInt64 nWindowId, const OString& rWidget); +public: /// used for dialogs or popups JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile, bool bPopup = false); @@ -234,21 +235,21 @@ class JSInstanceBuilder final : public SalInstanceBuilder, public JSDialogSender /// for autofilter dropdown JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile); -public: - static JSInstanceBuilder* CreateDialogBuilder(weld::Widget* pParent, const OUString& rUIRoot, - const OUString& rUIFile); - static JSInstanceBuilder* + static std::unique_ptr<JSInstanceBuilder> + CreateDialogBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile); + static std::unique_ptr<JSInstanceBuilder> CreateNotebookbarBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile, const css::uno::Reference<css::frame::XFrame>& rFrame, sal_uInt64 nWindowId = 0); - static JSInstanceBuilder* CreateAutofilterWindowBuilder(vcl::Window* pParent, - const OUString& rUIRoot, - const OUString& rUIFile); - static JSInstanceBuilder* CreateSidebarBuilder(weld::Widget* pParent, const OUString& rUIRoot, - const OUString& rUIFile, - sal_uInt64 nLOKWindowId = 0); - static JSInstanceBuilder* CreatePopupBuilder(weld::Widget* pParent, const OUString& rUIRoot, - const OUString& rUIFile); + static std::unique_ptr<JSInstanceBuilder> + CreateAutofilterWindowBuilder(vcl::Window* pParent, const OUString& rUIRoot, + const OUString& rUIFile); + static std::unique_ptr<JSInstanceBuilder> CreateSidebarBuilder(weld::Widget* pParent, + const OUString& rUIRoot, + const OUString& rUIFile, + sal_uInt64 nLOKWindowId = 0); + static std::unique_ptr<JSInstanceBuilder> + CreatePopupBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile); virtual ~JSInstanceBuilder() override; virtual std::unique_ptr<weld::MessageDialog> weld_message_dialog(const OString& id) override; diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx index 9694d30f4939..7d42cb51011b 100644 --- a/vcl/inc/salinst.hxx +++ b/vcl/inc/salinst.hxx @@ -161,8 +161,8 @@ public: // also needs to set m_bSupportsOpenGL = true in your SalInstance implementation! virtual OpenGLContext* CreateOpenGLContext(); - virtual weld::Builder* CreateBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile); - virtual weld::Builder* CreateInterimBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile, + virtual std::unique_ptr<weld::Builder> CreateBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile); + virtual std::unique_ptr<weld::Builder> CreateInterimBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile, bool bAllowCycleFocusOut, sal_uInt64 nLOKWindowId = 0); virtual weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString& rPrimaryMessage); diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx index 581b1fe212c5..d40779d7f18f 100644 --- a/vcl/inc/unx/gtk/gtkinst.hxx +++ b/vcl/inc/unx/gtk/gtkinst.hxx @@ -289,8 +289,8 @@ public: virtual css::uno::Reference< css::uno::XInterface > CreateDragSource() override; virtual css::uno::Reference< css::uno::XInterface > CreateDropTarget() override; virtual OpenGLContext* CreateOpenGLContext() override; - virtual weld::Builder* CreateBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile) override; - virtual weld::Builder* CreateInterimBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile, + virtual std::unique_ptr<weld::Builder> CreateBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile) override; + virtual std::unique_ptr<weld::Builder> CreateInterimBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile, bool bAllowCycleFocusOut, sal_uInt64 nLOKWindowId = 0) override; virtual weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage) override; virtual weld::Window* GetFrameWeld(const css::uno::Reference<css::awt::XWindow>& rWindow) override; diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index 3471efd6f0ad..e4718f7302ac 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -602,40 +602,40 @@ JSInstanceBuilder::JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRo sendFullUpdate(); } -JSInstanceBuilder* JSInstanceBuilder::CreateDialogBuilder(weld::Widget* pParent, - const OUString& rUIRoot, - const OUString& rUIFile) +std::unique_ptr<JSInstanceBuilder> JSInstanceBuilder::CreateDialogBuilder(weld::Widget* pParent, + const OUString& rUIRoot, + const OUString& rUIFile) { - return new JSInstanceBuilder(pParent, rUIRoot, rUIFile); + return std::make_unique<JSInstanceBuilder>(pParent, rUIRoot, rUIFile); } -JSInstanceBuilder* JSInstanceBuilder::CreateNotebookbarBuilder( +std::unique_ptr<JSInstanceBuilder> JSInstanceBuilder::CreateNotebookbarBuilder( vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile, const css::uno::Reference<css::frame::XFrame>& rFrame, sal_uInt64 nWindowId) { - return new JSInstanceBuilder(pParent, rUIRoot, rUIFile, rFrame, nWindowId); + return std::make_unique<JSInstanceBuilder>(pParent, rUIRoot, rUIFile, rFrame, nWindowId); } -JSInstanceBuilder* JSInstanceBuilder::CreateAutofilterWindowBuilder(vcl::Window* pParent, - const OUString& rUIRoot, - const OUString& rUIFile) +std::unique_ptr<JSInstanceBuilder> +JSInstanceBuilder::CreateAutofilterWindowBuilder(vcl::Window* pParent, const OUString& rUIRoot, + const OUString& rUIFile) { - return new JSInstanceBuilder(pParent, rUIRoot, rUIFile); + return std::make_unique<JSInstanceBuilder>(pParent, rUIRoot, rUIFile); } -JSInstanceBuilder* JSInstanceBuilder::CreateSidebarBuilder(weld::Widget* pParent, - const OUString& rUIRoot, - const OUString& rUIFile, - sal_uInt64 nLOKWindowId) +std::unique_ptr<JSInstanceBuilder> JSInstanceBuilder::CreateSidebarBuilder(weld::Widget* pParent, + const OUString& rUIRoot, + const OUString& rUIFile, + sal_uInt64 nLOKWindowId) { - return new JSInstanceBuilder(pParent, rUIRoot, rUIFile, nLOKWindowId); + return std::make_unique<JSInstanceBuilder>(pParent, rUIRoot, rUIFile, nLOKWindowId); } -JSInstanceBuilder* JSInstanceBuilder::CreatePopupBuilder(weld::Widget* pParent, - const OUString& rUIRoot, - const OUString& rUIFile) +std::unique_ptr<JSInstanceBuilder> JSInstanceBuilder::CreatePopupBuilder(weld::Widget* pParent, + const OUString& rUIRoot, + const OUString& rUIFile) { - return new JSInstanceBuilder(pParent, rUIRoot, rUIFile, true); + return std::make_unique<JSInstanceBuilder>(pParent, rUIRoot, rUIFile, true); } JSInstanceBuilder::~JSInstanceBuilder() diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index f783841991c3..792534a92517 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -7094,18 +7094,20 @@ SalInstanceBuilder::~SalInstanceBuilder() m_aOwnedToplevel.disposeAndClear(); } -weld::Builder* SalInstance::CreateBuilder(weld::Widget* pParent, const OUString& rUIRoot, - const OUString& rUIFile) +std::unique_ptr<weld::Builder> +SalInstance::CreateBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile) { SalInstanceWidget* pParentInstance = dynamic_cast<SalInstanceWidget*>(pParent); vcl::Window* pParentWidget = pParentInstance ? pParentInstance->getWidget() : nullptr; - return new SalInstanceBuilder(pParentWidget, rUIRoot, rUIFile); + return std::make_unique<SalInstanceBuilder>(pParentWidget, rUIRoot, rUIFile); } -weld::Builder* SalInstance::CreateInterimBuilder(vcl::Window* pParent, const OUString& rUIRoot, - const OUString& rUIFile, bool, sal_uInt64) +std::unique_ptr<weld::Builder> SalInstance::CreateInterimBuilder(vcl::Window* pParent, + const OUString& rUIRoot, + const OUString& rUIFile, bool, + sal_uInt64) { - return new SalInstanceBuilder(pParent, rUIRoot, rUIFile); + return std::make_unique<SalInstanceBuilder>(pParent, rUIRoot, rUIFile); } void SalInstanceWindow::help() diff --git a/vcl/source/control/InterimItemWindow.cxx b/vcl/source/control/InterimItemWindow.cxx index ac7c2ab44596..d47da4a02d19 100644 --- a/vcl/source/control/InterimItemWindow.cxx +++ b/vcl/source/control/InterimItemWindow.cxx @@ -22,8 +22,8 @@ InterimItemWindow::InterimItemWindow(vcl::Window* pParent, const OUString& rUIXM m_xVclContentArea = VclPtr<VclVBox>::Create(this); m_xVclContentArea->Show(); - m_xBuilder.reset(Application::CreateInterimBuilder(m_xVclContentArea, rUIXMLDescription, - bAllowCycleFocusOut, nLOKWindowId)); + m_xBuilder = Application::CreateInterimBuilder(m_xVclContentArea, rUIXMLDescription, + bAllowCycleFocusOut, nLOKWindowId); m_xContainer = m_xBuilder->weld_container(rID); SetBackground(); diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index a1e4f4bedf97..1e0e8a047f81 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -178,7 +178,7 @@ namespace } -weld::Builder* Application::CreateBuilder(weld::Widget* pParent, const OUString &rUIFile, bool bMobile, sal_uInt64 nLOKWindowId) +std::unique_ptr<weld::Builder> Application::CreateBuilder(weld::Widget* pParent, const OUString &rUIFile, bool bMobile, sal_uInt64 nLOKWindowId) { if (comphelper::LibreOfficeKit::isActive()) { @@ -193,7 +193,7 @@ weld::Builder* Application::CreateBuilder(weld::Widget* pParent, const OUString return ImplGetSVData()->mpDefInst->CreateBuilder(pParent, AllSettings::GetUIRootDir(), rUIFile); } -weld::Builder* Application::CreateInterimBuilder(vcl::Window* pParent, const OUString &rUIFile, bool bAllowCycleFocusOut, sal_uInt64 nLOKWindowId) +std::unique_ptr<weld::Builder> Application::CreateInterimBuilder(vcl::Window* pParent, const OUString &rUIFile, bool bAllowCycleFocusOut, sal_uInt64 nLOKWindowId) { // Notebookbar sub controls if (comphelper::LibreOfficeKit::isActive() && jsdialog::isInterimBuilderEnabledForNotebookbar(rUIFile)) diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 6f1e2a008c2d..9909b087e02d 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -1342,7 +1342,7 @@ void PrintDialog::setupOptionalUI() { OUString sOptionsUIFile; rOption.Value >>= sOptionsUIFile; - mxCustomOptionsUIBuilder.reset(Application::CreateBuilder(mxCustom.get(), sOptionsUIFile)); + mxCustomOptionsUIBuilder = Application::CreateBuilder(mxCustom.get(), sOptionsUIFile); std::unique_ptr<weld::Container> xWindow = mxCustomOptionsUIBuilder->weld_container("box"); xWindow->show(); continue; diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 6a69b9909b7f..f2dc45eca6c4 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -22876,11 +22876,11 @@ void GtkInstanceWidget::help_hierarchy_foreach(const std::function<bool(const OS } } -weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile) +std::unique_ptr<weld::Builder> GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile) { GtkInstanceWidget* pParentWidget = dynamic_cast<GtkInstanceWidget*>(pParent); GtkWidget* pBuilderParent = pParentWidget ? pParentWidget->getWidget() : nullptr; - return new GtkInstanceBuilder(pBuilderParent, rUIRoot, rUIFile, nullptr, true); + return std::make_unique<GtkInstanceBuilder>(pBuilderParent, rUIRoot, rUIFile, nullptr, true); } #if !GTK_CHECK_VERSION(4, 0, 0) @@ -22938,7 +22938,7 @@ gboolean GtkSalFrame::NativeWidgetHelpPressed(GtkAccelGroup*, GObject*, guint, G } #endif -weld::Builder* GtkInstance::CreateInterimBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile, +std::unique_ptr<weld::Builder> GtkInstance::CreateInterimBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile, bool bAllowCycleFocusOut, sal_uInt64) { // Create a foreign window which we know is a GtkGrid and make the native widgets a child of that, so we can @@ -22961,7 +22961,7 @@ weld::Builder* GtkInstance::CreateInterimBuilder(vcl::Window* pParent, const OUS #endif // build the widget tree as a child of the GtkEventBox GtkGrid parent - return new GtkInstanceBuilder(pWindow, rUIRoot, rUIFile, xEmbedWindow.get(), bAllowCycleFocusOut); + return std::make_unique<GtkInstanceBuilder>(pWindow, rUIRoot, rUIFile, xEmbedWindow.get(), bAllowCycleFocusOut); } weld::MessageDialog* GtkInstance::CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType, VclButtonsType eButtonsType, const OUString &rPrimaryMessage) |