diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-03-08 09:49:36 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-03-09 13:47:52 +0100 |
commit | 48bca65f1cf381cba7cb7a4c3916155a1bca0955 (patch) | |
tree | df461652450b3e095e37a3290cbe54ab20cedfae /sfx2 | |
parent | c468b6910bf77e332647725da70e3cb248a9de0e (diff) |
inherit welded dialogs from a common ancestor
Change-Id: Ifa6c871a134cf89bfba71b1049a115cf7c953c42
Reviewed-on: https://gerrit.libreoffice.org/50936
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 'sfx2')
-rw-r--r-- | sfx2/inc/saveastemplatedlg.hxx | 5 | ||||
-rw-r--r-- | sfx2/source/appl/appserv.cxx | 24 | ||||
-rw-r--r-- | sfx2/source/dialog/alienwarn.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/dialog/inputdlg.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/dialog/passwd.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/dialog/securitypage.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/docinsert.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/new.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/doc/saveastemplatedlg.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/inc/alienwarn.hxx | 7 | ||||
-rw-r--r-- | sfx2/source/view/viewfrm.cxx | 9 |
11 files changed, 22 insertions, 45 deletions
diff --git a/sfx2/inc/saveastemplatedlg.hxx b/sfx2/inc/saveastemplatedlg.hxx index 8e7af6d3a448..cbd695be24cb 100644 --- a/sfx2/inc/saveastemplatedlg.hxx +++ b/sfx2/inc/saveastemplatedlg.hxx @@ -15,11 +15,9 @@ #include <vcl/weld.hxx> // class SfxSaveAsTemplateDialog ------------------------------------------------------------------- -class SfxSaveAsTemplateDialog +class SfxSaveAsTemplateDialog : public weld::GenericDialogController { private: - std::unique_ptr<weld::Builder> m_xBuilder; - std::unique_ptr<weld::Dialog> m_xDialog; std::unique_ptr<weld::TreeView> m_xLBCategory; std::unique_ptr<weld::CheckButton> m_xCBXDefault; std::unique_ptr<weld::Entry> m_xTemplateNameEdit; @@ -51,7 +49,6 @@ public: public: SfxSaveAsTemplateDialog(weld::Window* pParent, const css::uno::Reference<css::frame::XModel>& rModel); - short run() { return m_xDialog->run(); } }; #endif // INCLUDED_SFX2_INC_SAVEASTEMPLATEDLG_HXX diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 550578327d0b..f7765defa192 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -304,22 +304,18 @@ namespace return nullptr; } - class LicenseDialog + class LicenseDialog : public weld::GenericDialogController { - private: - std::unique_ptr<weld::Builder> m_xBuilder; - std::unique_ptr<weld::Dialog> m_xDialog; std::unique_ptr<weld::Label> m_xLabel; public: LicenseDialog(weld::Window* pParent) - : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/licensedialog.ui")) - , m_xDialog(m_xBuilder->weld_dialog("LicenseDialog")) + : GenericDialogController(pParent, "sfx/ui/licensedialog.ui", "LicenseDialog") , m_xLabel(m_xBuilder->weld_label("label")) { m_xLabel->set_label(Translate::GetReadStringHook()(m_xLabel->get_label())); } - short run() + short execute() { short nRet = m_xDialog->run(); if (nRet == RET_OK) @@ -328,20 +324,16 @@ namespace } }; - class SafeModeQueryDialog + class SafeModeQueryDialog : public weld::MessageDialogController { - private: - std::unique_ptr<weld::Builder> m_xBuilder; - std::unique_ptr<weld::MessageDialog> m_xDialog; public: SafeModeQueryDialog(weld::Window* pParent) - : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/safemodequerydialog.ui")) - , m_xDialog(m_xBuilder->weld_message_dialog("SafeModeQueryDialog")) + : MessageDialogController(pParent, "sfx/ui/safemodequerydialog.ui", "SafeModeQueryDialog") { m_xDialog->set_primary_text(Translate::GetReadStringHook()(m_xDialog->get_primary_text())); } - short run() + short execute() { short nRet = m_xDialog->run(); if (nRet == RET_OK) @@ -572,7 +564,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) case SID_SHOW_LICENSE: { LicenseDialog aDialog(rReq.GetFrameWeld()); - aDialog.run(); + aDialog.execute(); break; } @@ -1036,7 +1028,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) case SID_SAFE_MODE: { SafeModeQueryDialog aDialog(rReq.GetFrameWeld()); - aDialog.run(); + aDialog.execute(); break; } diff --git a/sfx2/source/dialog/alienwarn.cxx b/sfx2/source/dialog/alienwarn.cxx index dd88541fbb29..d9eeed1bd956 100644 --- a/sfx2/source/dialog/alienwarn.cxx +++ b/sfx2/source/dialog/alienwarn.cxx @@ -27,8 +27,7 @@ SfxAlienWarningDialog::SfxAlienWarningDialog(weld::Window* pParent, const OUString& _rFormatName, const OUString& _rDefaultExtension, bool rDefaultIsAlien) - : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/alienwarndialog.ui")) - , m_xDialog(m_xBuilder->weld_message_dialog("AlienWarnDialog")) + : MessageDialogController(pParent, "sfx/ui/alienwarndialog.ui", "AlienWarnDialog") , m_xKeepCurrentBtn(m_xBuilder->weld_button("save")) , m_xUseDefaultFormatBtn(m_xBuilder->weld_button("cancel")) , m_xWarningOnBox(m_xBuilder->weld_check_button("ask")) diff --git a/sfx2/source/dialog/inputdlg.cxx b/sfx2/source/dialog/inputdlg.cxx index ff864ddd01a5..33015e788f9d 100644 --- a/sfx2/source/dialog/inputdlg.cxx +++ b/sfx2/source/dialog/inputdlg.cxx @@ -12,8 +12,7 @@ #include <vcl/svapp.hxx> InputDialog::InputDialog(weld::Window* pParent, const OUString &rLabelText) - : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/inputdialog.ui")) - , m_xDialog(m_xBuilder->weld_dialog("InputDialog")) + : GenericDialogController(pParent, "sfx/ui/inputdialog.ui", "InputDialog") , m_xEntry(m_xBuilder->weld_entry("entry")) , m_xLabel(m_xBuilder->weld_label("label")) , m_xHelp(m_xBuilder->weld_button("help")) diff --git a/sfx2/source/dialog/passwd.cxx b/sfx2/source/dialog/passwd.cxx index 7b4f236f39af..71df5e7d8d72 100644 --- a/sfx2/source/dialog/passwd.cxx +++ b/sfx2/source/dialog/passwd.cxx @@ -82,8 +82,7 @@ IMPL_LINK_NOARG(SfxPasswordDialog, OKHdl, weld::Button&, void) // CTOR / DTOR ----------------------------------------------------------- SfxPasswordDialog::SfxPasswordDialog(weld::Window* pParent, const OUString* pGroupText) - : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/password.ui")) - , m_xDialog(m_xBuilder->weld_dialog("PasswordDialog")) + : GenericDialogController(pParent, "sfx/ui/password.ui", "PasswordDialog") , m_xPassword1Box(m_xBuilder->weld_frame("password1frame")) , m_xUserFT(m_xBuilder->weld_label("userft")) , m_xUserED(m_xBuilder->weld_entry("usered")) @@ -151,7 +150,7 @@ void SfxPasswordDialog::ShowMinLengthText(bool bShow) m_xMinLengthFT->show(bShow); } -short SfxPasswordDialog::run() +short SfxPasswordDialog::execute() { m_xUserFT->hide(); m_xUserED->hide(); @@ -192,5 +191,4 @@ short SfxPasswordDialog::run() return m_xDialog->run(); } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx index fcd78d3f0ab5..8633a5e0eff9 100644 --- a/sfx2/source/dialog/securitypage.cxx +++ b/sfx2/source/dialog/securitypage.cxx @@ -101,7 +101,7 @@ static bool lcl_GetPassword( aPasswdDlg.SetMinLen(1); if (bProtect) aPasswdDlg.ShowExtras( SfxShowExtras::CONFIRM ); - if (RET_OK == aPasswdDlg.run() && !aPasswdDlg.GetPassword().isEmpty()) + if (RET_OK == aPasswdDlg.execute() && !aPasswdDlg.GetPassword().isEmpty()) { rPassword = aPasswdDlg.GetPassword(); bRes = true; diff --git a/sfx2/source/doc/docinsert.cxx b/sfx2/source/doc/docinsert.cxx index 2f53b7519163..bdb083a58334 100644 --- a/sfx2/source/doc/docinsert.cxx +++ b/sfx2/source/doc/docinsert.cxx @@ -218,7 +218,7 @@ IMPL_LINK_NOARG(DocumentInserter, DialogClosedHdl, sfx2::FileDialogHelper*, void // ask for the password SfxPasswordDialog aPasswordDlg(m_xParent ? m_xParent->GetFrameWeld() : nullptr); aPasswordDlg.ShowExtras( SfxShowExtras::CONFIRM ); - short nRet = aPasswordDlg.run(); + short nRet = aPasswordDlg.execute(); if ( RET_OK == nRet ) { m_pItemSet->Put( SfxStringItem( SID_PASSWORD, aPasswordDlg.GetPassword() ) ); diff --git a/sfx2/source/doc/new.cxx b/sfx2/source/doc/new.cxx index 2a50c964bc71..eed042b7d60e 100644 --- a/sfx2/source/doc/new.cxx +++ b/sfx2/source/doc/new.cxx @@ -237,8 +237,7 @@ sal_uInt16 SfxNewFileDialog::GetSelectedTemplatePos() const } SfxNewFileDialog::SfxNewFileDialog(weld::Window *pParent, SfxNewFileDialogMode nFlags) - : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/loadtemplatedialog.ui")) - , m_xDialog(m_xBuilder->weld_dialog("LoadTemplateDialog")) + : GenericDialogController(pParent, "sfx/ui/loadtemplatedialog.ui", "LoadTemplateDialog") , m_xRegionLb(m_xBuilder->weld_tree_view("categories")) , m_xTemplateLb(m_xBuilder->weld_tree_view("templates")) , m_xTextStyleCB(m_xBuilder->weld_check_button("text")) diff --git a/sfx2/source/doc/saveastemplatedlg.cxx b/sfx2/source/doc/saveastemplatedlg.cxx index efdb861d86a8..e1f8101fa78d 100644 --- a/sfx2/source/doc/saveastemplatedlg.cxx +++ b/sfx2/source/doc/saveastemplatedlg.cxx @@ -34,8 +34,7 @@ using namespace ::com::sun::star::frame; // Class SfxSaveAsTemplateDialog -------------------------------------------------- SfxSaveAsTemplateDialog::SfxSaveAsTemplateDialog(weld::Window* pParent, const uno::Reference<frame::XModel> &rModel) - : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/saveastemplatedlg.ui")) - , m_xDialog(m_xBuilder->weld_dialog("SaveAsTemplateDialog")) + : GenericDialogController(pParent, "sfx/ui/saveastemplatedlg.ui", "SaveAsTemplateDialog") , m_xLBCategory(m_xBuilder->weld_tree_view("categorylb")) , m_xCBXDefault(m_xBuilder->weld_check_button("defaultcb")) , m_xTemplateNameEdit(m_xBuilder->weld_entry("name_entry")) diff --git a/sfx2/source/inc/alienwarn.hxx b/sfx2/source/inc/alienwarn.hxx index 05f5a3835aee..5b93430882d8 100644 --- a/sfx2/source/inc/alienwarn.hxx +++ b/sfx2/source/inc/alienwarn.hxx @@ -21,11 +21,9 @@ #include <vcl/weld.hxx> -class SfxAlienWarningDialog +class SfxAlienWarningDialog : public weld::MessageDialogController { private: - std::unique_ptr<weld::Builder> m_xBuilder; - std::unique_ptr<weld::MessageDialog> m_xDialog; std::unique_ptr<weld::Button> m_xKeepCurrentBtn; std::unique_ptr<weld::Button> m_xUseDefaultFormatBtn; std::unique_ptr<weld::CheckButton> m_xWarningOnBox; @@ -36,8 +34,7 @@ private: public: SfxAlienWarningDialog(weld::Window* pParent, const OUString& _rFormatName, const OUString& _rDefaultExtension, bool rDefaultIsAlien); - short run() { return m_xDialog->run(); } - ~SfxAlienWarningDialog(); + virtual ~SfxAlienWarningDialog() override; }; #endif // INCLUDED_SFX2_SOURCE_INC_ALIENWARN_HXX diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index b640f5f4aff9..dd37efc0016e 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -154,22 +154,19 @@ void SfxViewFrame::InitInterface_Impl() namespace { /// Asks the user if editing a read-only document is really wanted. -class SfxEditDocumentDialog +class SfxEditDocumentDialog : public weld::MessageDialogController { private: - std::unique_ptr<weld::Builder> m_xBuilder; - std::unique_ptr<weld::MessageDialog> m_xDialog; std::unique_ptr<weld::Button> m_xEditDocument; std::unique_ptr<weld::Button> m_xCancel; public: SfxEditDocumentDialog(weld::Widget* pParent); - short run() { return m_xDialog->run(); } }; SfxEditDocumentDialog::SfxEditDocumentDialog(weld::Widget* pParent) - : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/editdocumentdialog.ui")) - , m_xDialog(m_xBuilder->weld_message_dialog("EditDocumentDialog")) + : MessageDialogController(pParent, "sfx/ui/editdocumentdialog.ui", + "EditDocumentDialog") , m_xEditDocument(m_xBuilder->weld_button("edit")) , m_xCancel(m_xBuilder->weld_button("cancel")) { |