diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-03-21 10:33:23 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-03-21 15:48:12 +0100 |
commit | 12efe34abb984ac37abae59ccac83a4f86a27e77 (patch) | |
tree | d0b72087fe2911e9ce73a31b955582186f2ca7d8 /include/svtools | |
parent | 718c82d1de44d2d7c16e4299b61171b72186f50b (diff) |
support both vcl and weld in genericunodialog for interim
Change-Id: Ife85dd7a4bd27260514b390ca3928152db0d688f
Reviewed-on: https://gerrit.libreoffice.org/51699
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include/svtools')
-rw-r--r-- | include/svtools/genericunodialog.hxx | 59 |
1 files changed, 54 insertions, 5 deletions
diff --git a/include/svtools/genericunodialog.hxx b/include/svtools/genericunodialog.hxx index a5ec54f4cf79..89d10a124540 100644 --- a/include/svtools/genericunodialog.hxx +++ b/include/svtools/genericunodialog.hxx @@ -38,10 +38,10 @@ #include <comphelper/propertycontainer.hxx> #include <comphelper/broadcasthelper.hxx> #include <tools/link.hxx> +#include <vcl/dialog.hxx> #include <vcl/vclptr.hxx> +#include <vcl/weld.hxx> -class Dialog; -namespace vcl { class Window; } class VclWindowEvent; @@ -55,7 +55,6 @@ namespace svt #define UNODIALOG_PROPERTY_TITLE "Title" #define UNODIALOG_PROPERTY_PARENT "ParentWindow" - typedef cppu::WeakImplHelper< css::ui::dialogs::XExecutableDialog, css::lang::XServiceInfo, css::lang::XInitialization > OGenericUnoDialogBase; @@ -67,8 +66,58 @@ namespace svt ,public ::comphelper::OMutexAndBroadcastHelper ,public ::comphelper::OPropertyContainer { + public: + struct Dialog + { + VclPtr<::Dialog> m_xVclDialog; + std::unique_ptr<weld::DialogController> m_xWeldDialog; + + Dialog() + { + } + + Dialog(const VclPtr<::Dialog>& rVclDialog) + : m_xVclDialog(rVclDialog) + { + } + + Dialog(weld::DialogController* pWeldDialog) + : m_xWeldDialog(pWeldDialog) + { + } + + explicit operator bool() const + { + return m_xVclDialog || m_xWeldDialog; + } + + void set_title(const OUString& rTitle) + { + if (m_xWeldDialog) + m_xWeldDialog->set_title(rTitle); + else if (m_xVclDialog) + m_xVclDialog->SetText(rTitle); + } + + OString get_help_id() const + { + if (m_xWeldDialog) + return m_xWeldDialog->get_help_id(); + else if (m_xVclDialog) + return m_xVclDialog->GetHelpId(); + return OString(); + } + + void set_help_id(const OString& rHelpId) + { + if (m_xWeldDialog) + return m_xWeldDialog->set_help_id(rHelpId); + else if (m_xVclDialog) + return m_xVclDialog->SetHelpId(rHelpId); + } + }; protected: - VclPtr<Dialog> m_pDialog; /// the dialog to execute + OGenericUnoDialog::Dialog m_aDialog; /// the dialog to execute bool m_bExecuting : 1; /// we're currently executing the dialog bool m_bTitleAmbiguous : 1; /// m_sTitle has not been set yet bool m_bInitialized : 1; /// has "initialize" been called? @@ -118,7 +167,7 @@ namespace svt but the application-wide solar mutex is (to guard the not thread-safe ctor of the dialog). @param pParent the parent window for the new dialog */ - virtual VclPtr<Dialog> createDialog(vcl::Window* _pParent) = 0; + virtual OGenericUnoDialog::Dialog createDialog(vcl::Window* _pParent) = 0; /// called to destroy the dialog used. deletes m_pDialog and resets it to NULL void destroyDialog(); |