From 2fb266bb77722cd45af7346e99a8f214c3f8b198 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 16 Mar 2018 20:35:23 +0000 Subject: unify the message dialogs with extra widgets cases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I9ad3573b15d24c3d1737b9f450792952ae20a31b Reviewed-on: https://gerrit.libreoffice.org/51476 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- extensions/source/bibliography/bibview.cxx | 36 ++++--- include/vcl/weld.hxx | 8 +- sc/source/filter/oox/workbookfragment.cxx | 37 ++++--- sc/source/ui/docshell/docsh.cxx | 60 ++++------- sc/source/ui/inc/warnbox.hxx | 3 - sc/source/ui/miscdlgs/warnbox.cxx | 16 +-- sfx2/source/dialog/alienwarn.cxx | 11 +- sfx2/source/inc/alienwarn.hxx | 3 - sw/source/ui/dbui/mmresultdialogs.cxx | 73 +++++++------ sw/source/ui/dialog/swmessdialog.cxx | 36 +------ sw/source/uibase/inc/swmessdialog.hxx | 20 +--- sw/uiconfig/swriter/ui/alreadyexistsdialog.ui | 144 ++++++------------------- sw/uiconfig/swriter/ui/attachnamedialog.ui | 144 ++++++------------------- sw/uiconfig/swriter/ui/subjectdialog.ui | 146 +++++++------------------- vcl/source/app/salvtables.cxx | 22 +++- 15 files changed, 241 insertions(+), 518 deletions(-) diff --git a/extensions/source/bibliography/bibview.cxx b/extensions/source/bibliography/bibview.cxx index 308c37ca4f24..c8e87a954dfe 100644 --- a/extensions/source/bibliography/bibview.cxx +++ b/extensions/source/bibliography/bibview.cxx @@ -41,6 +41,21 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::uno; +namespace +{ + class MessageWithCheck : public weld::MessageDialogController + { + private: + std::unique_ptr m_xWarningOnBox; + public: + MessageWithCheck(weld::Window *pParent) + : weld::MessageDialogController(pParent, "modules/sbibliography/ui/querydialog.ui", "QueryDialog", "ask") + , m_xWarningOnBox(m_xBuilder->weld_check_button("ask")) + { + } + bool get_active() const { return m_xWarningOnBox->get_active(); } + }; +} namespace bib { @@ -139,24 +154,11 @@ namespace bib sErrorString += "\n"; sErrorString += BibResId(RID_MAP_QUESTION); - std::unique_ptr xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/sbibliography/ui/querydialog.ui")); - std::unique_ptr xQueryBox(xBuilder->weld_message_dialog("QueryDialog")); - xQueryBox->set_primary_text(sErrorString); - std::unique_ptr xWarningOnBox(xBuilder->weld_check_button("ask")); - - //fdo#75121, a bit tricky because the widgets we want to align with - //don't actually exist in the ui description, they're implied - std::unique_ptr xOrigParent(xWarningOnBox->weld_parent()); - std::unique_ptr xContentArea(xQueryBox->weld_message_area()); - xOrigParent->remove(xWarningOnBox.get()); - xContentArea->add(xWarningOnBox.get()); - - short nResult = xQueryBox->run(); - BibModul::GetConfig()->SetShowColumnAssignmentWarning(!xWarningOnBox->get_active()); + MessageWithCheck aQueryBox(GetFrameWeld()); + aQueryBox.set_primary_text(sErrorString); - //put them back as they were - xContentArea->remove(xWarningOnBox.get()); - xOrigParent->add(xWarningOnBox.get()); + short nResult = aQueryBox.run(); + BibModul::GetConfig()->SetShowColumnAssignmentWarning(!aQueryBox.get_active()); if( RET_YES != nResult ) { diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index eb1f8501cf04..b6c635e89e57 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -613,13 +613,19 @@ private: protected: std::unique_ptr m_xBuilder; std::unique_ptr m_xDialog; + std::unique_ptr m_xContentArea; + std::unique_ptr m_xRelocate; + std::unique_ptr m_xOrigParent; public: MessageDialogController(weld::Widget* pParent, const OUString& rUIFile, - const OString& rDialogId); + const OString& rDialogId, const OString& rRelocateId = OString()); ~MessageDialogController() override; void set_title(const OUString& rTitle) { m_xDialog->set_title(rTitle); } void set_help_id(const OString& rHelpId) { m_xDialog->set_help_id(rHelpId); } + void set_primary_text(const OUString& rText) { m_xDialog->set_primary_text(rText); } + OUString get_primary_text() const { return m_xDialog->get_primary_text(); } + void set_default_response(int response) { m_xDialog->set_default_response(response); } }; } #endif diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx index 7a57a2a04402..d1fef597ae2f 100644 --- a/sc/source/filter/oox/workbookfragment.cxx +++ b/sc/source/filter/oox/workbookfragment.cxx @@ -516,6 +516,19 @@ ScDocShell& getDocShell(const ScDocument& rDoc) return static_cast(*rDoc.GetDocumentShell()); } +class MessageWithCheck : public weld::MessageDialogController +{ +private: + std::unique_ptr m_xWarningOnBox; +public: + MessageWithCheck(weld::Window *pParent, const OUString& rUIFile, const OString& rDialogId) + : weld::MessageDialogController(pParent, rUIFile, rDialogId, "ask") + , m_xWarningOnBox(m_xBuilder->weld_check_button("ask")) + { + } + bool get_active() const { return m_xWarningOnBox->get_active(); } +}; + } void WorkbookFragment::recalcFormulaCells() @@ -534,27 +547,13 @@ void WorkbookFragment::recalcFormulaCells() // Ask the user if full re-calculation is desired. vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); - std::unique_ptr xBuilder(Application::CreateBuilder(pWin ? pWin->GetFrameWeld() : nullptr, - "modules/scalc/ui/recalcquerydialog.ui")); - std::unique_ptr xQueryBox(xBuilder->weld_message_dialog("RecalcQueryDialog")); - xQueryBox->set_primary_text(ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_XLS)); - xQueryBox->set_default_response(RET_YES); - std::unique_ptr xWarningOnBox(xBuilder->weld_check_button("ask")); - - //fdo#75121, a bit tricky because the widgets we want to align with - //don't actually exist in the ui description, they're implied - std::unique_ptr xOrigParent(xWarningOnBox->weld_parent()); - std::unique_ptr xContentArea(xQueryBox->weld_message_area()); - xOrigParent->remove(xWarningOnBox.get()); - xContentArea->add(xWarningOnBox.get()); - - bHardRecalc = xQueryBox->run() == RET_YES; + MessageWithCheck aQueryBox(pWin ? pWin->GetFrameWeld() : nullptr, "modules/scalc/ui/recalcquerydialog.ui", "RecalcQueryDialog"); + aQueryBox.set_primary_text(ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_XLS)); + aQueryBox.set_default_response(RET_YES); - //put them back as they were - xContentArea->remove(xWarningOnBox.get()); - xOrigParent->add(xWarningOnBox.get()); + bHardRecalc = aQueryBox.run() == RET_YES; - if (xWarningOnBox->get_active()) + if (aQueryBox.get_active()) { // Always perform selected action in the future. std::shared_ptr batch(comphelper::ConfigurationChanges::create()); diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index ec9505da8840..e59ee43400e8 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -428,6 +428,19 @@ void processDataStream( ScDocShell& rShell, const sc::ImportPostProcessData& rDa rMgr.setDataStream(pStrm); } +class MessageWithCheck : public weld::MessageDialogController +{ +private: + std::unique_ptr m_xWarningOnBox; +public: + MessageWithCheck(weld::Window *pParent, const OUString& rUIFile, const OString& rDialogId) + : weld::MessageDialogController(pParent, rUIFile, rDialogId, "ask") + , m_xWarningOnBox(m_xBuilder->weld_check_button("ask")) + { + } + bool get_active() const { return m_xWarningOnBox->get_active(); } +}; + } bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const css::uno::Reference< css::embed::XStorage >& xStor ) @@ -475,27 +488,14 @@ bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const css::uno::Reference< css // full re-calculation. vcl::Window* pWin = GetActiveDialogParent(); - std::unique_ptr xBuilder(Application::CreateBuilder(pWin ? pWin->GetFrameWeld() : nullptr, - "modules/scalc/ui/recalcquerydialog.ui")); - std::unique_ptr xQueryBox(xBuilder->weld_message_dialog("RecalcQueryDialog")); - xQueryBox->set_primary_text(ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_ODS)); - xQueryBox->set_default_response(RET_YES); - std::unique_ptr xWarningOnBox(xBuilder->weld_check_button("ask")); - - //fdo#75121, a bit tricky because the widgets we want to align with - //don't actually exist in the ui description, they're implied - std::unique_ptr xOrigParent(xWarningOnBox->weld_parent()); - std::unique_ptr xContentArea(xQueryBox->weld_message_area()); - xOrigParent->remove(xWarningOnBox.get()); - xContentArea->add(xWarningOnBox.get()); - - bHardRecalc = xQueryBox->run() == RET_YES; + MessageWithCheck aQueryBox(pWin ? pWin->GetFrameWeld() : nullptr, + "modules/scalc/ui/recalcquerydialog.ui", "RecalcQueryDialog"); + aQueryBox.set_primary_text(ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_ODS)); + aQueryBox.set_default_response(RET_YES); - //put them back as they were - xContentArea->remove(xWarningOnBox.get()); - xOrigParent->add(xWarningOnBox.get()); + bHardRecalc = aQueryBox.run() == RET_YES; - if (xWarningOnBox->get_active()) + if (aQueryBox.get_active()) { // Always perform selected action in the future. std::shared_ptr batch(comphelper::ConfigurationChanges::create()); @@ -725,25 +725,11 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) { vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); - std::unique_ptr xBuilder(Application::CreateBuilder(pWin ? pWin->GetFrameWeld() : nullptr, - "modules/scalc/ui/sharedwarningdialog.ui")); - std::unique_ptr xWarningBox(xBuilder->weld_message_dialog("SharedWarningDialog")); - std::unique_ptr xWarningOnBox(xBuilder->weld_check_button("ask")); - - //fdo#75121, a bit tricky because the widgets we want to align with - //don't actually exist in the ui description, they're implied - std::unique_ptr xOrigParent(xWarningOnBox->weld_parent()); - std::unique_ptr xContentArea(xWarningBox->weld_message_area()); - xOrigParent->remove(xWarningOnBox.get()); - xContentArea->add(xWarningOnBox.get()); - - xWarningBox->run(); - - //put them back as they were - xContentArea->remove(xWarningOnBox.get()); - xOrigParent->add(xWarningOnBox.get()); + MessageWithCheck aWarningBox(pWin ? pWin->GetFrameWeld() : nullptr, + "modules/scalc/ui/sharedwarningdialog.ui", "SharedWarningDialog"); + aWarningBox.run(); - bool bChecked = xWarningOnBox->get_active(); + bool bChecked = aWarningBox.get_active(); if (bChecked) { aAppOptions.SetShowSharedDocumentWarning( !bChecked ); diff --git a/sc/source/ui/inc/warnbox.hxx b/sc/source/ui/inc/warnbox.hxx index 54bdd269ebeb..02fea50e181a 100644 --- a/sc/source/ui/inc/warnbox.hxx +++ b/sc/source/ui/inc/warnbox.hxx @@ -27,11 +27,8 @@ class ScReplaceWarnBox : public weld::MessageDialogController { std::unique_ptr m_xWarningOnBox; - std::unique_ptr m_xOrigParent; - std::unique_ptr m_xContentArea; public: ScReplaceWarnBox(weld::Window* pParent); - virtual ~ScReplaceWarnBox() override; /** Opens dialog if IsDialogEnabled() returns true. @descr If after executing the dialog the checkbox "Do not show again" is set, diff --git a/sc/source/ui/miscdlgs/warnbox.cxx b/sc/source/ui/miscdlgs/warnbox.cxx index bc0302c4bcbd..279639c7996f 100644 --- a/sc/source/ui/miscdlgs/warnbox.cxx +++ b/sc/source/ui/miscdlgs/warnbox.cxx @@ -27,26 +27,12 @@ ScReplaceWarnBox::ScReplaceWarnBox(weld::Window* pParent) : MessageDialogController(pParent, "modules/scalc/ui/checkwarningdialog.ui", - "CheckWarningDialog") + "CheckWarningDialog", "ask") // By default, the check box is ON, and the user needs to un-check it to // disable all future warnings. , m_xWarningOnBox(m_xBuilder->weld_check_button("ask")) - , m_xOrigParent(m_xWarningOnBox->weld_parent()) - , m_xContentArea(m_xDialog->weld_message_area()) { m_xDialog->set_default_response(RET_YES); - - //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->remove(m_xWarningOnBox.get()); - m_xContentArea->add(m_xWarningOnBox.get()); -} - -ScReplaceWarnBox::~ScReplaceWarnBox() -{ - //put them back as they were - m_xContentArea->remove(m_xWarningOnBox.get()); - m_xOrigParent->add(m_xWarningOnBox.get()); } short ScReplaceWarnBox::execute() diff --git a/sfx2/source/dialog/alienwarn.cxx b/sfx2/source/dialog/alienwarn.cxx index d9eeed1bd956..d5b45ba091a6 100644 --- a/sfx2/source/dialog/alienwarn.cxx +++ b/sfx2/source/dialog/alienwarn.cxx @@ -27,18 +27,11 @@ SfxAlienWarningDialog::SfxAlienWarningDialog(weld::Window* pParent, const OUString& _rFormatName, const OUString& _rDefaultExtension, bool rDefaultIsAlien) - : MessageDialogController(pParent, "sfx/ui/alienwarndialog.ui", "AlienWarnDialog") + : MessageDialogController(pParent, "sfx/ui/alienwarndialog.ui", "AlienWarnDialog", "ask") , m_xKeepCurrentBtn(m_xBuilder->weld_button("save")) , m_xUseDefaultFormatBtn(m_xBuilder->weld_button("cancel")) , m_xWarningOnBox(m_xBuilder->weld_check_button("ask")) - , m_xOrigParent(m_xWarningOnBox->weld_parent()) - , m_xContentArea(m_xDialog->weld_message_area()) { - //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->remove(m_xWarningOnBox.get()); - m_xContentArea->add(m_xWarningOnBox.get()); - OUString aExtension = "ODF"; // replace formatname (text) @@ -70,8 +63,6 @@ SfxAlienWarningDialog::SfxAlienWarningDialog(weld::Window* pParent, const OUStri SfxAlienWarningDialog::~SfxAlienWarningDialog() { - m_xContentArea->remove(m_xWarningOnBox.get()); - m_xOrigParent->add(m_xWarningOnBox.get()); // save value of "warning off" checkbox, if necessary SvtSaveOptions aSaveOpt; bool bChecked = m_xWarningOnBox->get_active(); diff --git a/sfx2/source/inc/alienwarn.hxx b/sfx2/source/inc/alienwarn.hxx index 5b93430882d8..eeda0fedfe1d 100644 --- a/sfx2/source/inc/alienwarn.hxx +++ b/sfx2/source/inc/alienwarn.hxx @@ -28,9 +28,6 @@ private: std::unique_ptr m_xUseDefaultFormatBtn; std::unique_ptr m_xWarningOnBox; - std::unique_ptr m_xOrigParent; - std::unique_ptr m_xContentArea; - public: SfxAlienWarningDialog(weld::Window* pParent, const OUString& _rFormatName, const OUString& _rDefaultExtension, bool rDefaultIsAlien); diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx index 708f4718b6e9..732cc26ae4ed 100644 --- a/sw/source/ui/dbui/mmresultdialogs.cxx +++ b/sw/source/ui/dbui/mmresultdialogs.cxx @@ -120,74 +120,73 @@ static OUString lcl_GetColumnValueOf(const OUString& rColumn, Reference < contai class SwSaveWarningBox_Impl : public SwMessageAndEditDialog { - DECL_LINK( ModifyHdl, Edit&, void); + DECL_LINK( ModifyHdl, weld::Entry&, void); public: - SwSaveWarningBox_Impl(vcl::Window* pParent, const OUString& rFileName); + SwSaveWarningBox_Impl(weld::Window* pParent, const OUString& rFileName); OUString GetFileName() const { - return m_pEdit->GetText(); + return m_xEdit->get_text(); } }; class SwSendQueryBox_Impl : public SwMessageAndEditDialog { bool bIsEmptyAllowed; - DECL_LINK( ModifyHdl, Edit&, void); + DECL_LINK( ModifyHdl, weld::Entry&, void); public: - SwSendQueryBox_Impl(vcl::Window* pParent, const OUString& rID, + SwSendQueryBox_Impl(weld::Window* pParent, const OString& rID, const OUString& rUIXMLDescription); void SetValue(const OUString& rSet) { - m_pEdit->SetText(rSet); - ModifyHdl(*m_pEdit); + m_xEdit->set_text(rSet); + ModifyHdl(*m_xEdit); } OUString GetValue() const { - return m_pEdit->GetText(); + return m_xEdit->get_text(); } void SetIsEmptyTextAllowed(bool bSet) { bIsEmptyAllowed = bSet; - ModifyHdl(*m_pEdit); + ModifyHdl(*m_xEdit); } }; -SwSaveWarningBox_Impl::SwSaveWarningBox_Impl(vcl::Window* pParent, const OUString& rFileName) +SwSaveWarningBox_Impl::SwSaveWarningBox_Impl(weld::Window* pParent, const OUString& rFileName) : SwMessageAndEditDialog(pParent, "AlreadyExistsDialog", "modules/swriter/ui/alreadyexistsdialog.ui") { - m_pEdit->SetText(rFileName); - m_pEdit->SetModifyHdl(LINK(this, SwSaveWarningBox_Impl, ModifyHdl)); + m_xEdit->set_text(rFileName); + m_xEdit->connect_changed(LINK(this, SwSaveWarningBox_Impl, ModifyHdl)); INetURLObject aTmp(rFileName); - m_pPrimaryMessage->SetText(m_pPrimaryMessage->GetText().replaceAll("%1", aTmp.getName( + m_xDialog->set_primary_text(m_xDialog->get_primary_text().replaceAll("%1", aTmp.getName( INetURLObject::LAST_SEGMENT, true, INetURLObject::DecodeMechanism::WithCharset))); - ModifyHdl(*m_pEdit); + ModifyHdl(*m_xEdit); } -IMPL_LINK( SwSaveWarningBox_Impl, ModifyHdl, Edit&, rEdit, void) +IMPL_LINK( SwSaveWarningBox_Impl, ModifyHdl, weld::Entry&, rEdit, void) { - m_pOKPB->Enable(!rEdit.GetText().isEmpty()); + m_xOKPB->set_sensitive(!rEdit.get_text().isEmpty()); } -SwSendQueryBox_Impl::SwSendQueryBox_Impl(vcl::Window* pParent, const OUString& rID, +SwSendQueryBox_Impl::SwSendQueryBox_Impl(weld::Window* pParent, const OString& rID, const OUString& rUIXMLDescription) : SwMessageAndEditDialog(pParent, rID, rUIXMLDescription) , bIsEmptyAllowed(true) { - m_pImageIM->SetImage(GetStandardQueryBoxImage()); - m_pEdit->SetModifyHdl(LINK(this, SwSendQueryBox_Impl, ModifyHdl)); - ModifyHdl(*m_pEdit); + m_xEdit->connect_changed(LINK(this, SwSendQueryBox_Impl, ModifyHdl)); + ModifyHdl(*m_xEdit); } -IMPL_LINK( SwSendQueryBox_Impl, ModifyHdl, Edit&, rEdit, void) +IMPL_LINK( SwSendQueryBox_Impl, ModifyHdl, weld::Entry&, rEdit, void) { - m_pOKPB->Enable(bIsEmptyAllowed || !rEdit.GetText().isEmpty()); + m_xOKPB->set_sensitive(bIsEmptyAllowed || !rEdit.get_text().isEmpty()); } class SwCopyToDialog : public SfxModalDialog @@ -734,9 +733,9 @@ IMPL_LINK(SwMMResultSaveDialog, SaveOutputHdl_Impl, Button*, pButton, void) if(bFailed) { - ScopedVclPtrInstance< SwSaveWarningBox_Impl > aWarning( pButton, sOutPath ); - if(RET_OK == aWarning->Execute()) - sOutPath = aWarning->GetFileName(); + std::unique_ptr xWarning(new SwSaveWarningBox_Impl(pButton->GetFrameWeld(), sOutPath)); + if (RET_OK == xWarning->run()) + sOutPath = xWarning->GetFileName(); else { xTempDocShell->DoClose(); @@ -1011,26 +1010,26 @@ IMPL_LINK(SwMMResultEmailDialog, SendDocumentsHdl_Impl, Button*, pButton, void) if(m_pSubjectED->GetText().isEmpty()) { - ScopedVclPtrInstance aQuery(pButton, "SubjectDialog", - "modules/swriter/ui/subjectdialog.ui"); - aQuery->SetIsEmptyTextAllowed(true); - aQuery->SetValue(""); - if(RET_OK == aQuery->Execute()) + std::unique_ptr xQuery(new SwSendQueryBox_Impl(pButton->GetFrameWeld(), "SubjectDialog", + "modules/swriter/ui/subjectdialog.ui")); + xQuery->SetIsEmptyTextAllowed(true); + xQuery->SetValue(""); + if(RET_OK == xQuery->run()) { - if(!aQuery->GetValue().isEmpty()) - m_pSubjectED->SetText(aQuery->GetValue()); + if(!xQuery->GetValue().isEmpty()) + m_pSubjectED->SetText(xQuery->GetValue()); } else return; // back to the dialog } if(!bAsBody && m_pAttachmentED->GetText().isEmpty()) { - ScopedVclPtrInstance aQuery(pButton, "AttachNameDialog", - "modules/swriter/ui/attachnamedialog.ui"); - aQuery->SetIsEmptyTextAllowed(false); - if(RET_OK == aQuery->Execute()) + std::unique_ptr xQuery(new SwSendQueryBox_Impl(pButton->GetFrameWeld(), "AttachNameDialog", + "modules/swriter/ui/attachnamedialog.ui")); + xQuery->SetIsEmptyTextAllowed(false); + if (RET_OK == xQuery->run()) { - OUString sAttach(aQuery->GetValue()); + OUString sAttach(xQuery->GetValue()); sal_Int32 nTokenCount = comphelper::string::getTokenCount(sAttach, '.'); if (2 > nTokenCount) { diff --git a/sw/source/ui/dialog/swmessdialog.cxx b/sw/source/ui/dialog/swmessdialog.cxx index 85ad95643832..d244dd7b8392 100644 --- a/sw/source/ui/dialog/swmessdialog.cxx +++ b/sw/source/ui/dialog/swmessdialog.cxx @@ -8,41 +8,13 @@ */ #include -#include -#include -#include -#include -#include -#include -SwMessageAndEditDialog::SwMessageAndEditDialog(vcl::Window* pParent, const OUString& rID, +SwMessageAndEditDialog::SwMessageAndEditDialog(weld::Window* pParent, const OString& rID, const OUString& rUIXMLDescription) - : ModalDialog(pParent, rID, rUIXMLDescription) + : MessageDialogController(pParent, rUIXMLDescription, rID, "grid") + , m_xEdit(m_xBuilder->weld_entry("edit")) + , m_xOKPB(m_xBuilder->weld_button("ok")) { - get(m_pOKPB, "ok"); - get(m_pPrimaryMessage, "primarymessage"); - m_pPrimaryMessage->SetPaintTransparent(true); - get(m_pSecondaryMessage, "secondarymessage"); - m_pSecondaryMessage->SetPaintTransparent(true); - MessageDialog::SetMessagesWidths(this, m_pPrimaryMessage, m_pSecondaryMessage); - get(m_pImageIM, "image"); - m_pImageIM->SetImage(GetStandardWarningBoxImage()); - get(m_pEdit, "edit"); -} - -SwMessageAndEditDialog::~SwMessageAndEditDialog() -{ - disposeOnce(); -} - -void SwMessageAndEditDialog::dispose() -{ - m_pOKPB.clear(); - m_pImageIM.clear(); - m_pPrimaryMessage.clear(); - m_pSecondaryMessage.clear(); - m_pEdit.clear(); - ModalDialog::dispose(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/uibase/inc/swmessdialog.hxx b/sw/source/uibase/inc/swmessdialog.hxx index cc5315f4df49..0c95e5e6a4b6 100644 --- a/sw/source/uibase/inc/swmessdialog.hxx +++ b/sw/source/uibase/inc/swmessdialog.hxx @@ -10,26 +10,16 @@ #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_SWMESSDIALOG_HXX #define INCLUDED_SW_SOURCE_UIBASE_INC_SWMESSDIALOG_HXX -#include +#include -class Edit; -class FixedImage; -class OKButton; -class VclMultiLineEdit; - -class SwMessageAndEditDialog : public ModalDialog +class SwMessageAndEditDialog : public weld::MessageDialogController { protected: - VclPtr m_pOKPB; - VclPtr m_pImageIM; - VclPtr m_pPrimaryMessage; - VclPtr m_pSecondaryMessage; - VclPtr m_pEdit; + std::unique_ptr m_xEdit; + std::unique_ptr m_xOKPB; public: - SwMessageAndEditDialog(vcl::Window* pParent, const OUString& rID, + SwMessageAndEditDialog(weld::Window* pParent, const OString& rID, const OUString& rUIXMLDescription); - virtual ~SwMessageAndEditDialog() override; - virtual void dispose() override; }; #endif // INCLUDED_SW_SOURCE_UIBASE_INC_SWMESSDIALOG_HXX diff --git a/sw/uiconfig/swriter/ui/alreadyexistsdialog.ui b/sw/uiconfig/swriter/ui/alreadyexistsdialog.ui index db9d47db0a10..c91eb989ee71 100644 --- a/sw/uiconfig/swriter/ui/alreadyexistsdialog.ui +++ b/sw/uiconfig/swriter/ui/alreadyexistsdialog.ui @@ -1,53 +1,50 @@ - + - - A document with the name '%1' already exists. - - - Please save this document under a different name. - - + False - 6 File already exists + 0 + 0 dialog + warning + A document with the name '%1' already exists. + Please save this document under a different name. - + False vertical 24 - + False - end - - gtk-ok + + gtk-cancel True True - True - True - True + False True - False + True True 0 - - gtk-cancel + + gtk-ok True True + True + True True True - False + True True 1 @@ -55,127 +52,56 @@ False - True - end + False 0 - + True False True - True - 12 - 12 + 7 - + True - False - True - 6 - - - True - True - True - False - word - False - textbuffer1 - False - - - 0 - 0 - - - - - True - True - True - False - word - False - textbuffer2 - False - - - 0 - 1 - - - - - 1 - 0 - - - - - True - False + True True - 7 - - - True - False - 0 - New document name: - True - edit - - - 0 - 0 - - - - - True - True - True - - - - 0 - 1 - - + True - 1 + 0 1 - + True False - center - start - 6 + Subject: + True + 0 0 0 - 2 - True + False True - 1 + 2 - ok cancel + ok + + + diff --git a/sw/uiconfig/swriter/ui/attachnamedialog.ui b/sw/uiconfig/swriter/ui/attachnamedialog.ui index b1f4b8aa3fd3..5716a0fa6b00 100644 --- a/sw/uiconfig/swriter/ui/attachnamedialog.ui +++ b/sw/uiconfig/swriter/ui/attachnamedialog.ui @@ -1,53 +1,50 @@ - + - - You did not specify a new name for the attachment. - - - If you would like to provide one, please type it now. - - + False - 6 No Attachment Name + 0 + 0 dialog + question + You did not specify a new name for the attachment. + If you would like to provide one, please type it now. - + False vertical 24 - + False - end - - gtk-ok + + gtk-cancel True True - True - True - True + False True - False + True True 0 - - gtk-cancel + + gtk-ok True True + True + True True True - False + True True 1 @@ -55,127 +52,56 @@ False - True - end + False 0 - + True False True - True - 12 - 12 + 7 - + True - False - True - 6 - - - True - True - True - False - word - False - textbuffer1 - False - - - 0 - 0 - - - - - True - True - True - False - word - False - textbuffer2 - False - - - 0 - 1 - - - - - 1 - 0 - - - - - True - False + True True - 7 - - - True - True - True - - - - 0 - 1 - - - - - True - False - 0 - Name: - True - edit - - - 0 - 0 - - + True - 1 + 0 1 - + True False - center - start - 6 + Name: + True + 0 0 0 - 2 - True + False True - 1 + 2 - ok cancel + ok + + + diff --git a/sw/uiconfig/swriter/ui/subjectdialog.ui b/sw/uiconfig/swriter/ui/subjectdialog.ui index 1f255199b03e..8fecc10b0b07 100644 --- a/sw/uiconfig/swriter/ui/subjectdialog.ui +++ b/sw/uiconfig/swriter/ui/subjectdialog.ui @@ -1,53 +1,51 @@ - + - - You did not specify a subject for this message. - - - If you would like to provide one, please type it now. - - + False - 6 No Subject + 0 + 0 dialog + question + You did not specify a subject for this message. + If you would like to provide one, please type it now. - + False vertical 24 - + False - end + True - - gtk-ok + + gtk-cancel True True - True - True - True + False True - False + True True 0 - - gtk-cancel + + gtk-ok True True + True + True True True - False + True True 1 @@ -55,127 +53,57 @@ False - True - end + False 0 - + True False True - True - 12 - 12 + 7 - + True - False - True - 6 - - - True - True - True - False - word - False - textbuffer1 - False - - - 0 - 0 - - - - - True - True - True - False - word - False - textbuffer2 - False - - - 0 - 1 - - - - - 1 - 0 - - - - - True - False + True True - 7 - - - True - True - True - - - - 0 - 1 - - - - - True - False - 0 - Subject: - True - edit - - - 0 - 0 - - + True - 1 + 0 1 - + True False - center - start - 6 + Subject: + True + edit + 0 0 0 - 2 - True + False True - 1 + 2 - ok cancel + ok + + + diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index ed2f3b2d08cf..bb66da6b4fb5 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -1598,13 +1598,31 @@ namespace weld Dialog* MessageDialogController::getDialog() { return m_xDialog.get(); } - MessageDialogController::MessageDialogController(weld::Widget* pParent, const OUString &rUIFile, const OString& rDialogId) + MessageDialogController::MessageDialogController(weld::Widget* pParent, const OUString &rUIFile, const OString& rDialogId, + const OString& rRelocateId) : m_xBuilder(Application::CreateBuilder(pParent, rUIFile)) , m_xDialog(m_xBuilder->weld_message_dialog(rDialogId)) + , m_xContentArea(m_xDialog->weld_message_area()) { + if (!rRelocateId.isEmpty()) + { + m_xRelocate.reset(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 + m_xOrigParent->remove(m_xRelocate.get()); + m_xContentArea->add(m_xRelocate.get()); + } } - MessageDialogController::~MessageDialogController() = default; + MessageDialogController::~MessageDialogController() + { + if (m_xRelocate) + { + m_xContentArea->remove(m_xRelocate.get()); + m_xOrigParent->add(m_xRelocate.get()); + } + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit