basctl/source/basicide/baside2b.cxx | 7 basctl/source/basicide/baside3.cxx | 5 basctl/source/basicide/basides1.cxx | 21 - chart2/source/controller/dialogs/DataBrowser.cxx | 8 cui/source/customize/SvxMenuConfigPage.cxx | 8 cui/source/customize/SvxToolbarConfigPage.cxx | 7 cui/source/dialogs/linkdlg.cxx | 16 cui/source/options/optinet2.cxx | 10 cui/source/options/personalization.cxx | 27 - cui/source/tabpages/page.cxx | 8 dbaccess/source/ui/dlg/CollectionView.cxx | 9 dbaccess/source/ui/dlg/ConnectionHelper.cxx | 19 - dbaccess/source/ui/dlg/sqlmessage.cxx | 4 dbaccess/source/ui/querydesign/querycontroller.cxx | 10 extensions/UIConfig_sbibliography.mk | 1 extensions/source/bibliography/bibview.cxx | 27 + extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx | 12 extensions/uiconfig/sbibliography/ui/querydialog.ui | 46 ++ filter/source/pdf/impdialog.cxx | 2 forms/source/runtime/formoperations.cxx | 28 - framework/source/services/autorecovery.cxx | 12 include/sfx2/linkmgr.hxx | 8 include/vcl/builder.hxx | 3 include/vcl/messagedialog.hxx | 5 include/vcl/msgbox.hxx | 29 - include/vcl/weld.hxx | 9 sc/UIConfig_scalc.mk | 1 sc/inc/globstr.hrc | 1 sc/source/filter/oox/workbookfragment.cxx | 30 + sc/source/ui/dbgui/dbnamdlg.cxx | 10 sc/source/ui/docshell/dbdocfun.cxx | 39 +- sc/source/ui/docshell/docfunc.cxx | 11 sc/source/ui/docshell/docsh.cxx | 28 + sc/source/ui/docshell/docsh3.cxx | 9 sc/source/ui/docshell/docsh4.cxx | 27 - sc/source/ui/miscdlgs/crnrdlg.cxx | 16 sc/source/ui/miscdlgs/scuiautofmt.cxx | 10 sc/source/ui/navipi/scenwnd.cxx | 9 sc/source/ui/optdlg/tpusrlst.cxx | 11 sc/source/ui/view/cellsh1.cxx | 21 - sc/source/ui/view/cellsh3.cxx | 19 - sc/source/ui/view/tabvwshf.cxx | 23 - sc/source/ui/view/viewfun3.cxx | 12 sc/source/ui/view/viewfunc.cxx | 12 sc/uiconfig/scalc/ui/recalcquerydialog.ui | 46 ++ sd/source/core/drawdoc3.cxx | 6 sd/source/ui/annotations/annotationmanager.cxx | 10 sd/source/ui/view/drviews4.cxx | 8 sd/source/ui/view/drviewse.cxx | 37 +- sfx2/source/appl/linkmgr2.cxx | 12 sfx2/source/bastyp/fltfnc.cxx | 9 sfx2/source/dialog/alienwarn.cxx | 52 +- sfx2/source/dialog/recfloat.cxx | 14 sfx2/source/doc/guisaveas.cxx | 4 sfx2/source/doc/querytemplate.cxx | 2 sfx2/source/inc/alienwarn.hxx | 22 - sfx2/source/view/viewfrm.cxx | 38 -- svtools/source/graphic/provider.cxx | 4 svx/source/dialog/prtqry.cxx | 2 svx/source/form/databaselocationinput.cxx | 13 sw/source/core/doc/DocumentLinksAdministrationManager.cxx | 2 sw/source/core/edit/edfcol.cxx | 8 sw/source/ui/dbui/mmoutputtypepage.cxx | 2 sw/source/ui/dbui/mmresultdialogs.cxx | 10 sw/source/ui/misc/glosbib.cxx | 11 sw/source/uibase/shells/textsh1.cxx | 2 toolkit/source/awt/vclxtoolkit.cxx | 26 + uui/source/alreadyopen.cxx | 2 uui/source/filechanged.cxx | 2 uui/source/iahndl-errorhandler.cxx | 151 +++----- uui/source/iahndl-ssl.cxx | 23 - uui/source/lockcorrupt.cxx | 2 uui/source/lockfailed.cxx | 2 uui/source/openlocked.cxx | 2 uui/source/sslwarndlg.cxx | 23 - uui/source/sslwarndlg.hxx | 20 - uui/source/trylater.cxx | 2 uui/source/unknownauthdlg.cxx | 50 -- uui/source/unknownauthdlg.hxx | 27 - uui/uiconfig/ui/unknownauthdialog.ui | 3 vcl/inc/strings.hrc | 1 vcl/source/app/salvtables.cxx | 35 + vcl/source/window/builder.cxx | 8 vcl/source/window/layout.cxx | 203 +++++------ vcl/source/window/msgbox.cxx | 68 --- vcl/unx/gtk3/gtk3gtkinst.cxx | 34 + xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx | 6 87 files changed, 963 insertions(+), 671 deletions(-)
New commits: commit 942f05996bc287923cdbcae12c64e57adf8ec975 Author: Caolán McNamara <caol...@redhat.com> Date: Fri Feb 23 09:35:08 2018 +0000 convert remaining ErrorBox to weld::MessageDialog and convert remaining QueryBox to weld::MessageDialog Change-Id: Ifb4c316dee8eabf57c4940c44e29c65a2781aa6c diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index f25e60c91a23..b7e0fbe518ad 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -37,7 +37,7 @@ #include <comphelper/string.hxx> #include <officecfg/Office/Common.hxx> #include <sfx2/dispatch.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <svl/urihelper.hxx> #include <svx/svxids.hrc> #include <vcl/xtextedt.hxx> @@ -479,7 +479,10 @@ bool EditorWindow::ImpCanModify() { // If in Trace-mode, abort the trace or refuse input // Remove markers in the modules in Notify at Basic::Stopped - if (ScopedVclPtrInstance<QueryBox>(nullptr, MessBoxStyle::OkCancel, IDEResId(RID_STR_WILLSTOPPRG))->Execute() == RET_OK) + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Question, VclButtonsType::OkCancel, + IDEResId(RID_STR_WILLSTOPPRG))); + if (xQueryBox->run() == RET_OK) { rModulWindow.GetBasicStatus().bIsRunning = false; StopBasic(); diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx index fa23eca1a822..322097b38105 100644 --- a/basctl/source/basicide/baside3.cxx +++ b/basctl/source/basicide/baside3.cxx @@ -803,7 +803,7 @@ NameClashQueryBox::NameClashQueryBox( vcl::Window* pParent, AddButton( IDEResId(RID_STR_DLGIMP_CLASH_REPLACE), RET_NO ); AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel ); - SetImage( QueryBox::GetStandardImage() ); + SetImage(GetStandardQueryBoxImage()); } @@ -828,10 +828,9 @@ LanguageMismatchQueryBox::LanguageMismatchQueryBox( vcl::Window* pParent, AddButton( StandardButtonType::Cancel, RET_CANCEL, ButtonDialogFlags::Cancel ); AddButton( StandardButtonType::Help, RET_HELP, ButtonDialogFlags::Help, 4 ); - SetImage( QueryBox::GetStandardImage() ); + SetImage(GetStandardQueryBoxImage() ); } - bool implImportDialog( vcl::Window* pWin, const OUString& rCurPath, const ScriptDocument& rDocument, const OUString& aLibName ) { bool bDone = false; diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index 5fce14ec5114..a1f4f07f18cf 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -49,7 +49,6 @@ #include <svl/whiter.hxx> #include <vcl/xtextedt.hxx> #include <vcl/svapp.hxx> -#include <vcl/msgbox.hxx> #include <vcl/weld.hxx> namespace basctl @@ -102,7 +101,17 @@ void Shell::ExecuteCurrent( SfxRequest& rReq ) nActModWindows++; } - if ( nActModWindows <= 1 || ( !rSearchItem.GetSelection() && ScopedVclPtrInstance<QueryBox>(pCurWin, MessBoxStyle::YesNo|MessBoxStyle::DefaultYes, IDEResId(RID_STR_SEARCHALLMODULES))->Execute() == RET_YES ) ) + bool bAllModules = nActModWindows <= 1; + if (!bAllModules) + { + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pCurWin ? pCurWin->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + IDEResId(RID_STR_SEARCHALLMODULES))); + xQueryBox->set_default_response(RET_YES); + bAllModules = xQueryBox->run() == RET_YES; + } + + if (bAllModules) { for (auto const& window : aWindowTable) { @@ -145,8 +154,12 @@ void Shell::ExecuteCurrent( SfxRequest& rReq ) SfxViewFrame* pViewFrame = GetViewFrame(); SfxChildWindow* pChildWin = pViewFrame ? pViewFrame->GetChildWindow( SID_SEARCH_DLG ) : nullptr; vcl::Window* pParent = pChildWin ? pChildWin->GetWindow() : nullptr; - ScopedVclPtrInstance< QueryBox > aQuery(pParent, MessBoxStyle::YesNo|MessBoxStyle::DefaultYes, IDEResId(RID_STR_SEARCHFROMSTART)); - if ( aQuery->Execute() == RET_YES ) + + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + IDEResId(RID_STR_SEARCHFROMSTART))); + xQueryBox->set_default_response(RET_YES); + if (xQueryBox->run() == RET_YES) { it = aWindowTable.begin(); if ( it != aWindowTable.end() ) diff --git a/chart2/source/controller/dialogs/DataBrowser.cxx b/chart2/source/controller/dialogs/DataBrowser.cxx index 2a7a41e754cd..b16a20a57401 100644 --- a/chart2/source/controller/dialogs/DataBrowser.cxx +++ b/chart2/source/controller/dialogs/DataBrowser.cxx @@ -37,6 +37,7 @@ #include <vcl/image.hxx> #include <vcl/layout.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <vcl/settings.hxx> #include <rtl/math.hxx> @@ -757,9 +758,10 @@ void DataBrowser::ShowWarningBox() bool DataBrowser::ShowQueryBox() { - ScopedVclPtrInstance<QueryBox> pQueryBox(this, MessBoxStyle::YesNo, SchResId(STR_DATA_EDITOR_INCORRECT_INPUT)); - - return pQueryBox->Execute() == RET_YES; + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + SchResId(STR_DATA_EDITOR_INCORRECT_INPUT))); + return xQueryBox->run() == RET_YES; } bool DataBrowser::IsDataValid() diff --git a/cui/source/customize/SvxMenuConfigPage.cxx b/cui/source/customize/SvxMenuConfigPage.cxx index 1c2ad24094d6..a979233168b2 100644 --- a/cui/source/customize/SvxMenuConfigPage.cxx +++ b/cui/source/customize/SvxMenuConfigPage.cxx @@ -27,7 +27,6 @@ #include <vcl/commandinfoprovider.hxx> #include <vcl/help.hxx> #include <vcl/weld.hxx> -#include <vcl/msgbox.hxx> #include <vcl/decoview.hxx> #include <vcl/toolbox.hxx> #include <vcl/scrbar.hxx> @@ -286,9 +285,10 @@ short SvxMenuConfigPage::QueryReset() OUString label = SvxConfigPageHelper::replaceSaveInName( msg, saveInName ); - ScopedVclPtrInstance<QueryBox> qbox( this, MessBoxStyle::YesNo, label ); - - return qbox->Execute(); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + label)); + return xQueryBox->run(); } IMPL_LINK_NOARG( SvxMenuConfigPage, SelectMenu, ListBox&, void ) diff --git a/cui/source/customize/SvxToolbarConfigPage.cxx b/cui/source/customize/SvxToolbarConfigPage.cxx index 49c4349c459b..dcd70890d45c 100644 --- a/cui/source/customize/SvxToolbarConfigPage.cxx +++ b/cui/source/customize/SvxToolbarConfigPage.cxx @@ -723,9 +723,10 @@ short SvxToolbarConfigPage::QueryReset() OUString label = SvxConfigPageHelper::replaceSaveInName( msg, saveInName ); - ScopedVclPtrInstance< QueryBox > qbox( this, MessBoxStyle::YesNo, label ); - - return qbox->Execute(); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + label)); + return xQueryBox->run(); } IMPL_LINK_NOARG( SvxToolbarConfigPage, SelectToolbar, ListBox&, void ) diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx index 73e3e4021be9..9b2478f8f746 100644 --- a/cui/source/dialogs/linkdlg.cxx +++ b/cui/source/dialogs/linkdlg.cxx @@ -27,7 +27,7 @@ #include <vcl/fixed.hxx> #include <vcl/group.hxx> #include <vcl/lstbox.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <vcl/timer.hxx> #include <vcl/idle.hxx> #include <svtools/svtabbx.hxx> @@ -416,9 +416,12 @@ IMPL_LINK_NOARG( SvBaseLinksDlg, BreakLinkClickHdl, Button*, void ) if( !xLink.is() ) return; - ScopedVclPtrInstance< QueryBox > aBox( this, MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, aStrCloselinkmsg ); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + aStrCloselinkmsg)); + xQueryBox->set_default_response(RET_YES); - if( RET_YES == aBox->Execute() ) + if (RET_YES == xQueryBox->run()) { m_pTbLinks->GetModel()->Remove( m_pTbLinks->GetEntry( nPos ) ); @@ -447,9 +450,12 @@ IMPL_LINK_NOARG( SvBaseLinksDlg, BreakLinkClickHdl, Button*, void ) } else { - ScopedVclPtrInstance< QueryBox > aBox( this, MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, aStrCloselinkmsgMulti ); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + aStrCloselinkmsgMulti)); + xQueryBox->set_default_response(RET_YES); - if( RET_YES == aBox->Execute() ) + if (RET_YES == xQueryBox->run()) { SvBaseLinkMemberList aLinkList; diff --git a/cui/source/options/optinet2.cxx b/cui/source/options/optinet2.cxx index 1b4161575e67..19de5d14b8ad 100644 --- a/cui/source/options/optinet2.cxx +++ b/cui/source/options/optinet2.cxx @@ -23,7 +23,7 @@ #include <officecfg/Office/Common.hxx> #include <officecfg/Office/Security.hxx> #include <tools/config.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <svl/intitem.hxx> #include <svl/stritem.hxx> #include <svl/eitem.hxx> @@ -663,8 +663,12 @@ IMPL_LINK_NOARG(SvxSecurityTabPage, SavePasswordHdl, Button*, void) } else { - ScopedVclPtrInstance< QueryBox > aQuery( this, MessBoxStyle::YesNo|MessBoxStyle::DefaultNo, m_sPasswordStoringDeactivateStr ); - sal_uInt16 nRet = aQuery->Execute(); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + m_sPasswordStoringDeactivateStr)); + xQueryBox->set_default_response(RET_NO); + + sal_uInt16 nRet = xQueryBox->run(); if( RET_YES == nRet ) { diff --git a/cui/source/options/personalization.cxx b/cui/source/options/personalization.cxx index 9b3e482b55d2..b6af6903d0c7 100644 --- a/cui/source/options/personalization.cxx +++ b/cui/source/options/personalization.cxx @@ -21,7 +21,7 @@ #include <rtl/strbuf.hxx> #include <tools/urlobj.hxx> #include <vcl/edit.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <vcl/lstbox.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> @@ -709,8 +709,11 @@ void SearchAndParseThread::execute() sError = CuiResId(RID_SVXSTR_SEARCHERROR); sError = sError.replaceAll("%1", m_aURL); m_pPersonaDialog->SetProgress( OUString() ); - ScopedVclPtrInstance< ErrorBox > aBox( nullptr, MessBoxStyle::Ok, sError); - aBox->Execute(); + + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Error, VclButtonsType::Ok, + sError)); + xBox->run(); return; } } @@ -722,8 +725,10 @@ void SearchAndParseThread::execute() sError = CuiResId(RID_SVXSTR_SEARCHERROR); sError = sError.replaceAll("%1", m_aURL); m_pPersonaDialog->SetProgress( OUString() ); - ScopedVclPtrInstance< ErrorBox > aBox( nullptr, MessBoxStyle::Ok, sError ); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Error, VclButtonsType::Ok, + sError)); + xBox->run(); return; } @@ -763,8 +768,10 @@ void SearchAndParseThread::execute() sError = CuiResId(RID_SVXSTR_SEARCHERROR); sError = sError.replaceAll("%1", m_aURL); m_pPersonaDialog->SetProgress( OUString() ); - ScopedVclPtrInstance< ErrorBox > aBox( nullptr, MessBoxStyle::Ok, sError); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Error, VclButtonsType::Ok, + sError)); + xBox->run(); return; } continue; @@ -847,8 +854,10 @@ void SearchAndParseThread::execute() sError = CuiResId( RID_SVXSTR_SEARCHERROR ); sError = sError.replaceAll("%1", m_aURL); m_pPersonaDialog->SetProgress( OUString() ); - ScopedVclPtrInstance< ErrorBox > aBox( nullptr, MessBoxStyle::Ok, sError); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Error, VclButtonsType::Ok, + sError)); + xBox->run(); return; } diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx index dbde0bf2dc9c..97aab18fd870 100644 --- a/cui/source/tabpages/page.cxx +++ b/cui/source/tabpages/page.cxx @@ -25,7 +25,7 @@ #include <sfx2/viewsh.hxx> #include <svl/itemiter.hxx> #include <svl/languageoptions.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <unotools/configitem.hxx> #include <sfx2/htmlmode.hxx> #include <sal/macros.h> @@ -1375,7 +1375,11 @@ DeactivateRC SvxPageDescPage::DeactivatePage( SfxItemSet* _pSet ) if ( ePaper != PAPER_SCREEN_4_3 && ePaper != PAPER_SCREEN_16_9 && ePaper != PAPER_SCREEN_16_10 && IsMarginOutOfRange() ) { - if (ScopedVclPtrInstance<QueryBox>(this, MessBoxStyle::YesNo | MessBoxStyle::DefaultNo, m_pPrintRangeQueryText->GetText())->Execute() == RET_NO) + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + m_pPrintRangeQueryText->GetText())); + xQueryBox->set_default_response(RET_NO); + if (xQueryBox->run() == RET_NO) { MetricField* pField = nullptr; if ( IsPrinterRangeOverflow( *m_pLeftMarginEdit, nFirstLeftMargin, nLastLeftMargin, MARGIN_LEFT ) ) diff --git a/dbaccess/source/ui/dlg/CollectionView.cxx b/dbaccess/source/ui/dlg/CollectionView.cxx index ebdd01a8bd23..764d4d43de0c 100644 --- a/dbaccess/source/ui/dlg/CollectionView.cxx +++ b/dbaccess/source/ui/dlg/CollectionView.cxx @@ -32,7 +32,8 @@ #include <com/sun/star/container/XChild.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/beans/PropertyValue.hpp> -#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <stringconstants.hxx> #include <bitmaps.hlst> #include <UITools.hxx> @@ -175,8 +176,10 @@ IMPL_LINK_NOARG(OCollectionView, Save_Click, Button*, void) { if ( xNameContainer->hasByName(sName) ) { - ScopedVclPtrInstance< QueryBox > aBox(this, MessBoxStyle::YesNo, DBA_RES(STR_ALREADYEXISTOVERWRITE)); - if ( aBox->Execute() != RET_YES ) + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + DBA_RES(STR_ALREADYEXISTOVERWRITE))); + if (xQueryBox->run() != RET_YES) return; } m_pName->SetText(sName); diff --git a/dbaccess/source/ui/dlg/ConnectionHelper.cxx b/dbaccess/source/ui/dlg/ConnectionHelper.cxx index a933efe269a4..cf41e45b01e3 100644 --- a/dbaccess/source/ui/dlg/ConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/ConnectionHelper.cxx @@ -33,6 +33,7 @@ #include <osl/process.h> #include <osl/diagnose.h> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <sfx2/filedlghelper.hxx> #include <dbadmin.hxx> #include <comphelper/types.hxx> @@ -475,8 +476,12 @@ namespace dbaui sQuery = sQuery.replaceFirst("$path$", aTransformer.get(OFileNotation::N_SYSTEM)); m_bUserGrabFocus = false; - ScopedVclPtrInstance< QueryBox > aQuery(GetParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, sQuery); - sal_Int32 nQueryResult = aQuery->Execute(); + vcl::Window* pWin = GetParent(); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + sQuery)); + xQueryBox->set_default_response(RET_YES); + sal_Int32 nQueryResult = xQueryBox->run(); m_bUserGrabFocus = true; switch (nQueryResult) @@ -492,8 +497,14 @@ namespace dbaui sQuery = sQuery.replaceFirst("$name$", aTransformer.get(OFileNotation::N_SYSTEM)); m_bUserGrabFocus = false; - ScopedVclPtrInstance< QueryBox > aWhatToDo(GetParent(), MessBoxStyle::RetryCancel | MessBoxStyle::DefaultRetry, sQuery); - nQueryResult = aWhatToDo->Execute(); + + std::unique_ptr<weld::MessageDialog> xWhatToDo(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::NONE, + sQuery)); + xWhatToDo->add_button(Button::GetStandardText(StandardButtonType::Retry), RET_RETRY); + xWhatToDo->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL); + xWhatToDo->set_default_response(RET_RETRY); + nQueryResult = xWhatToDo->run(); m_bUserGrabFocus = true; if (RET_RETRY == nQueryResult) diff --git a/dbaccess/source/ui/dlg/sqlmessage.cxx b/dbaccess/source/ui/dlg/sqlmessage.cxx index 315bae099e57..5981fcb33ebe 100644 --- a/dbaccess/source/ui/dlg/sqlmessage.cxx +++ b/dbaccess/source/ui/dlg/sqlmessage.cxx @@ -628,10 +628,10 @@ void OSQLMessageBox::Construct( MessBoxStyle _nStyle, MessageType _eImage ) m_aInfoImage->SetImage(WarningBox::GetStandardImage()); break; case Error: - m_aInfoImage->SetImage(ErrorBox::GetStandardImage()); + m_aInfoImage->SetImage(GetStandardErrorBoxImage()); break; case Query: - m_aInfoImage->SetImage(QueryBox::GetStandardImage()); + m_aInfoImage->SetImage(GetStandardQueryBoxImage()); break; } diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx index 94ffa557bcad..0102620d8f11 100644 --- a/dbaccess/source/ui/querydesign/querycontroller.cxx +++ b/dbaccess/source/ui/querydesign/querycontroller.cxx @@ -80,6 +80,7 @@ #include <osl/diagnose.h> #include <vcl/msgbox.hxx> #include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <osl/mutex.hxx> #include <rtl/strbuf.hxx> #include <memory> @@ -1738,9 +1739,14 @@ short OQueryController::saveModified() ) { OUString sMessageText( lcl_getObjectResourceString( STR_QUERY_SAVEMODIFIED, m_nCommandType ) ); - ScopedVclPtrInstance< QueryBox > aQry( getView(), MessBoxStyle::YesNoCancel | MessBoxStyle::DefaultYes, sMessageText ); - nRet = aQry->Execute(); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(getFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + sMessageText)); + xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL); + xQueryBox->set_default_response(RET_YES); + + nRet = xQueryBox->run(); if ( ( nRet == RET_YES ) && !doSaveAsDoc( false ) ) diff --git a/extensions/UIConfig_sbibliography.mk b/extensions/UIConfig_sbibliography.mk index 0a25c8f0035e..00375d9fae1e 100644 --- a/extensions/UIConfig_sbibliography.mk +++ b/extensions/UIConfig_sbibliography.mk @@ -16,6 +16,7 @@ $(eval $(call gb_UIConfig_add_menubarfiles,modules/sbibliography,\ $(eval $(call gb_UIConfig_add_uifiles,modules/sbibliography,\ extensions/uiconfig/sbibliography/ui/choosedatasourcedialog \ extensions/uiconfig/sbibliography/ui/generalpage \ + extensions/uiconfig/sbibliography/ui/querydialog \ extensions/uiconfig/sbibliography/ui/mappingdialog \ extensions/uiconfig/sbibliography/ui/toolbar \ )) diff --git a/extensions/source/bibliography/bibview.cxx b/extensions/source/bibliography/bibview.cxx index 33a0df0d564d..308c37ca4f24 100644 --- a/extensions/source/bibliography/bibview.cxx +++ b/extensions/source/bibliography/bibview.cxx @@ -32,7 +32,7 @@ #include <vcl/svapp.hxx> #include <com/sun/star/sdbc/XResultSetUpdate.hpp> #include <com/sun/star/form/XLoadable.hpp> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <tools/debug.hxx> using namespace ::com::sun::star; @@ -138,11 +138,26 @@ namespace bib { sErrorString += "\n"; sErrorString += BibResId(RID_MAP_QUESTION); - ScopedVclPtrInstance< QueryBox > aQuery(this, MessBoxStyle::YesNo, sErrorString); - aQuery->SetDefaultCheckBoxText(); - short nResult = aQuery->Execute(); - BibModul::GetConfig()->SetShowColumnAssignmentWarning( - !aQuery->GetCheckBoxState()); + + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/sbibliography/ui/querydialog.ui")); + std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("QueryDialog")); + xQueryBox->set_primary_text(sErrorString); + std::unique_ptr<weld::CheckButton> 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<weld::Container> xOrigParent(xWarningOnBox->weld_parent()); + std::unique_ptr<weld::Container> xContentArea(xQueryBox->weld_message_area()); + xOrigParent->remove(xWarningOnBox.get()); + xContentArea->add(xWarningOnBox.get()); + + short nResult = xQueryBox->run(); + BibModul::GetConfig()->SetShowColumnAssignmentWarning(!xWarningOnBox->get_active()); + + //put them back as they were + xContentArea->remove(xWarningOnBox.get()); + xOrigParent->add(xWarningOnBox.get()); + if( RET_YES != nResult ) { bExecute = false; diff --git a/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx b/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx index 7203c638f353..2f5d063ddc4d 100644 --- a/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx +++ b/extensions/source/propctrlr/xsdvalidationpropertyhandler.cxx @@ -40,7 +40,8 @@ #include <com/sun/star/beans/Optional.hpp> #include <com/sun/star/inspection/XObjectInspectorUI.hpp> #include <com/sun/star/inspection/PropertyLineElement.hpp> -#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <tools/debug.hxx> #include <sal/macros.h> @@ -510,7 +511,6 @@ namespace pcr m_pHelper->setValidatingDataTypeByName( _rNewName ); } - bool XSDValidationPropertyHandler::implPrepareRemoveCurrentDataType() { OSL_PRECOND( m_pHelper.get(), "XSDValidationPropertyHandler::implPrepareRemoveCurrentDataType: this will crash!" ); @@ -525,14 +525,16 @@ namespace pcr // confirmation message OUString sConfirmation( PcrRes( RID_STR_CONFIRM_DELETE_DATA_TYPE ) ); sConfirmation = sConfirmation.replaceFirst( "#type#", pType->getName() ); - ScopedVclPtrInstance<QueryBox> aQuery( nullptr, MessBoxStyle::YesNo, sConfirmation ); // TODO/eForms: proper parent - if ( aQuery->Execute() != RET_YES ) + + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(nullptr, // TODO/eForms: proper parent + VclMessageType::Question, VclButtonsType::YesNo, + sConfirmation)); + if (xQueryBox->run() != RET_YES) return false; return true; } - bool XSDValidationPropertyHandler::implDoRemoveCurrentDataType() { OSL_PRECOND( m_pHelper.get(), "XSDValidationPropertyHandler::implDoRemoveCurrentDataType: this will crash!" ); diff --git a/extensions/uiconfig/sbibliography/ui/querydialog.ui b/extensions/uiconfig/sbibliography/ui/querydialog.ui new file mode 100644 index 000000000000..1c641670ab73 --- /dev/null +++ b/extensions/uiconfig/sbibliography/ui/querydialog.ui @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.20.2 --> +<interface domain="pcr"> + <requires lib="gtk+" version="3.20"/> + <object class="GtkMessageDialog" id="QueryDialog"> + <property name="can_focus">False</property> + <property name="type_hint">dialog</property> + <property name="message_type">question</property> + <property name="buttons">yes-no</property> + <child internal-child="vbox"> + <object class="GtkBox"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">2</property> + <child internal-child="action_area"> + <object class="GtkButtonBox"> + <property name="can_focus">False</property> + <property name="homogeneous">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="ask"> + <property name="label" translatable="yes" context="querydialog|ask">Do not show this question again.</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + </child> + <child> + <placeholder/> + </child> + </object> +</interface> diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx index 5aef8a4695ff..7cdc56634414 100644 --- a/filter/source/pdf/impdialog.cxx +++ b/filter/source/pdf/impdialog.cxx @@ -1655,6 +1655,8 @@ ImplErrorDialog::ImplErrorDialog(const std::set< vcl::PDFWriter::ErrorCode >& rE } m_pErrors->SetSelectHdl( LINK( this, ImplErrorDialog, SelectHdl ) ); + + create_message_area(); } diff --git a/forms/source/runtime/formoperations.cxx b/forms/source/runtime/formoperations.cxx index 3597486f07ae..94684287a4b2 100644 --- a/forms/source/runtime/formoperations.cxx +++ b/forms/source/runtime/formoperations.cxx @@ -50,7 +50,8 @@ #include <connectivity/dbexception.hxx> #include <vcl/svapp.hxx> #include <vcl/stdtext.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/button.hxx> +#include <vcl/weld.hxx> #include <vcl/waitobj.hxx> #include <tools/diagnose_ex.h> #include <comphelper/container.hxx> @@ -434,17 +435,22 @@ namespace frm if(needConfirmation) { // TODO: shouldn't this be done with an interaction handler? - ScopedVclPtrInstance< QueryBox > aQuery( nullptr, MessBoxStyle::YesNoCancel | MessBoxStyle::DefaultYes, FRM_RES_STRING( RID_STR_QUERY_SAVE_MODIFIED_ROW ) ); - switch ( aQuery->Execute() ) + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + FRM_RES_STRING(RID_STR_QUERY_SAVE_MODIFIED_ROW))); + xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL); + xQueryBox->set_default_response(RET_YES); + + switch (xQueryBox->run()) { - case RET_NO: - shouldCommit = false; - SAL_FALLTHROUGH; // don't ask again! - case RET_YES: - needConfirmation = false; - return true; - case RET_CANCEL: - return false; + case RET_NO: + shouldCommit = false; + SAL_FALLTHROUGH; // don't ask again! + case RET_YES: + needConfirmation = false; + return true; + case RET_CANCEL: + return false; } } return true; diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index f85756fe9016..a7698055e9e5 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -88,7 +88,7 @@ #include <ucbhelper/content.hxx> #include <osl/time.h> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <osl/file.hxx> #include <unotools/bootstrap.hxx> #include <unotools/configmgr.hxx> @@ -4087,11 +4087,11 @@ void AutoRecovery::impl_showFullDiscError() if (sBackupPath.getLength() < 1) sBackupPath = sBackupURL; - ScopedVclPtrInstance<ErrorBox> dlgError( - nullptr, MessBoxStyle::Ok, - sMsg.replaceAll("%PATH", sBackupPath)); - dlgError->SetButtonText(dlgError->GetButtonId(0), sBtn); - dlgError->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Error, VclButtonsType::NONE, + sMsg.replaceAll("%PATH", sBackupPath))); + xBox->add_button(sBtn, RET_OK); + xBox->run(); } void AutoRecovery::impl_establishProgress(const AutoRecovery::TDocumentInfo& rInfo , diff --git a/include/sfx2/linkmgr.hxx b/include/sfx2/linkmgr.hxx index a7def55012e5..b1057aef5f1a 100644 --- a/include/sfx2/linkmgr.hxx +++ b/include/sfx2/linkmgr.hxx @@ -37,6 +37,8 @@ namespace com { namespace sun { namespace star { } }}} +namespace weld { class Window; } + namespace sfx2 { // For the link to receive information about the status of graphics that @@ -126,9 +128,9 @@ public: static SvLinkSourceRef CreateObj( SvBaseLink const * ); - void UpdateAllLinks( bool bAskUpdate, - bool bUpdateGrfLinks, - vcl::Window* pParentWin ); + void UpdateAllLinks(bool bAskUpdate, + bool bUpdateGrfLinks, + weld::Window* pParentWin); // Call for list of links (eg for link-dialog) const SvBaseLinks& GetLinks() const { return aLinkTbl; } diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx index bb66872e786d..6e47c022b844 100644 --- a/include/vcl/builder.hxx +++ b/include/vcl/builder.hxx @@ -36,6 +36,7 @@ class Button; class ListBox; +class MessageDialog; class NumericFormatter; class PopupMenu; class SalInstanceBuilder; @@ -276,6 +277,8 @@ private: std::vector< VclPtr<VclExpander> > m_aExpanderWidgets; + std::vector< VclPtr<MessageDialog> > m_aMessageDialogs; + sal_uInt16 m_nLastToolbarId; sal_uInt16 m_nLastMenuItemId; diff --git a/include/vcl/messagedialog.hxx b/include/vcl/messagedialog.hxx index 1cce2f41009e..f7fc3c98bc9b 100644 --- a/include/vcl/messagedialog.hxx +++ b/include/vcl/messagedialog.hxx @@ -23,6 +23,7 @@ private: VclPtr<VclBox> m_pOwnedContentArea; VclPtr<VclButtonBox> m_pOwnedActionArea; VclPtr<VclGrid> m_pGrid; + VclPtr<VclVBox> m_pMessageBox; VclPtr<FixedImage> m_pImage; VclPtr<VclMultiLineEdit> m_pPrimaryMessage; VclPtr<VclMultiLineEdit> m_pSecondaryMessage; @@ -39,7 +40,6 @@ public: VclButtonsType eButtonsType = VclButtonsType::Ok); MessageDialog(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription); virtual bool set_property(const OString& rKey, const OUString& rValue) override; - virtual short Execute() override; OUString const& get_primary_text() const; OUString const& get_secondary_text() const; void set_primary_text(const OUString& rPrimaryString); @@ -47,6 +47,9 @@ public: virtual ~MessageDialog() override; virtual void dispose() override; + void create_message_area(); + VclContainer* get_message_area() const { return m_pMessageBox.get(); } + static void SetMessagesWidths(vcl::Window const* pParent, VclMultiLineEdit* pPrimaryMessage, VclMultiLineEdit* pSecondaryMessage); }; diff --git a/include/vcl/msgbox.hxx b/include/vcl/msgbox.hxx index 203d3ea36d80..5df7a5f81437 100644 --- a/include/vcl/msgbox.hxx +++ b/include/vcl/msgbox.hxx @@ -105,32 +105,11 @@ public: static OUString GetStandardText(); }; -class VCL_DLLPUBLIC ErrorBox : public MessBox -{ -public: - ErrorBox( vcl::Window* pParent, const OUString& rMessage ); - ErrorBox( vcl::Window* pParent, MessBoxStyle nStyle, - const OUString& rMessage ); - ErrorBox( vcl::Window* pParent, MessBoxStyle nStyle, WinBits n, - const OUString& rMessage ); +VCL_DLLPUBLIC Image const & GetStandardErrorBoxImage(); +VCL_DLLPUBLIC OUString GetStandardErrorBoxText(); - static Image GetStandardImage(); - static OUString GetStandardText(); -}; - -class VCL_DLLPUBLIC QueryBox : public MessBox -{ -public: - QueryBox( vcl::Window* pParent, MessBoxStyle nStyle, - const OUString& rMessage ); - QueryBox( vcl::Window* pParent, MessBoxStyle nStyle, WinBits n, - const OUString& rMessage ); - - void SetDefaultCheckBoxText(); - - static Image const & GetStandardImage(); - static OUString GetStandardText(); -}; +VCL_DLLPUBLIC Image const & GetStandardQueryBoxImage(); +VCL_DLLPUBLIC OUString GetStandardQueryBoxText(); #endif // INCLUDED_VCL_MSGBOX_HXX diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 69674ab9ba17..5c87a005fe61 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -19,6 +19,8 @@ namespace weld { +class Container; + class VCL_DLLPUBLIC Widget { public: @@ -44,13 +46,16 @@ public: virtual Size get_pixel_size(const OUString& rText) const = 0; virtual OString get_buildable_name() const = 0; virtual OString get_help_id() const = 0; - virtual Widget* weld_parent() const = 0; + virtual Container* weld_parent() const = 0; virtual ~Widget() {} }; class VCL_DLLPUBLIC Container : virtual public Widget { +public: + virtual void remove(weld::Widget* pWidget) = 0; + virtual void add(weld::Widget* pWidget) = 0; }; class VCL_DLLPUBLIC Frame : virtual public Container @@ -107,6 +112,7 @@ public: virtual OUString get_primary_text() const = 0; virtual void set_secondary_text(const OUString& rText) = 0; virtual OUString get_secondary_text() const = 0; + virtual Container* weld_message_area() = 0; }; class VCL_DLLPUBLIC ComboBoxText : virtual public Container @@ -160,6 +166,7 @@ public: virtual void insert(const OUString& rText, int pos) = 0; virtual int n_children() const = 0; virtual void select(int pos) = 0; + using Container::remove; virtual void remove(int pos) = 0; virtual int find(const OUString& rText) const = 0; virtual void set_top_entry(int pos) = 0; diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk index 2e8c1ad945c3..78a0674eab40 100644 --- a/sc/UIConfig_scalc.mk +++ b/sc/UIConfig_scalc.mk @@ -180,6 +180,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\ sc/uiconfig/scalc/ui/protectsheetdlg \ sc/uiconfig/scalc/ui/queryrunstreamscriptdialog \ sc/uiconfig/scalc/ui/randomnumbergenerator \ + sc/uiconfig/scalc/ui/recalcquerydialog \ sc/uiconfig/scalc/ui/regressiondialog \ sc/uiconfig/scalc/ui/retypepassdialog \ sc/uiconfig/scalc/ui/retypepassworddialog \ diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc index 75085e29bd75..cf29d865364f 100644 --- a/sc/inc/globstr.hrc +++ b/sc/inc/globstr.hrc @@ -469,7 +469,6 @@ #define STR_EDIT_EXISTING_COND_FORMATS NC_("STR_EDIT_EXISTING_COND_FORMATS", "The selected cell already contains conditional formatting. You can either edit the existing conditional format or you define a new overlapping conditional format.\n\n Do you want to edit the existing conditional format?") #define STR_QUERY_FORMULA_RECALC_ONLOAD_ODS NC_("STR_QUERY_FORMULA_RECALC_ONLOAD_ODS", "This document was last saved by an application other than %PRODUCTNAME. Some formula cells may produce different results when recalculated.\n\nDo you want to recalculate all formula cells in this document now?") #define STR_QUERY_FORMULA_RECALC_ONLOAD_XLS NC_("STR_QUERY_FORMULA_RECALC_ONLOAD_XLS", "This document was last saved by Excel. Some formula cells may produce different results when recalculated.\n\nDo you want to recalculate all formula cells now?") -#define STR_ALWAYS_PERFORM_SELECTED NC_("STR_ALWAYS_PERFORM_SELECTED", "Always perform this without prompt in the future.") #define STR_NO_INSERT_DELETE_OVER_PIVOT_TABLE NC_("STR_NO_INSERT_DELETE_OVER_PIVOT_TABLE", "You cannot insert or delete cells when the affected range intersects with pivot table.") #define STR_DPFIELD_GROUP_BY_SECONDS NC_("STR_DPFIELD_GROUP_BY_SECONDS", "Seconds") #define STR_DPFIELD_GROUP_BY_MINUTES NC_("STR_DPFIELD_GROUP_BY_MINUTES", "Minutes") diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx index d80b594c730e..7a57a2a04402 100644 --- a/sc/source/filter/oox/workbookfragment.cxx +++ b/sc/source/filter/oox/workbookfragment.cxx @@ -57,7 +57,7 @@ #include <vcl/svapp.hxx> #include <vcl/timer.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <oox/core/fastparser.hxx> #include <salhelper/thread.hxx> @@ -532,15 +532,29 @@ void WorkbookFragment::recalcFormulaCells() if (rDoc.IsUserInteractionEnabled()) { // Ask the user if full re-calculation is desired. - ScopedVclPtrInstance<QueryBox> aBox( - ScDocShell::GetActiveDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, - ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_XLS)); - aBox->SetCheckBoxText(ScGlobal::GetRscString(STR_ALWAYS_PERFORM_SELECTED)); + vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); - sal_Int32 nRet = aBox->Execute(); - bHardRecalc = nRet == RET_YES; + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWin ? pWin->GetFrameWeld() : nullptr, + "modules/scalc/ui/recalcquerydialog.ui")); + std::unique_ptr<weld::MessageDialog> 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<weld::CheckButton> xWarningOnBox(xBuilder->weld_check_button("ask")); - if (aBox->GetCheckBoxState()) + //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<weld::Container> xOrigParent(xWarningOnBox->weld_parent()); + std::unique_ptr<weld::Container> xContentArea(xQueryBox->weld_message_area()); + xOrigParent->remove(xWarningOnBox.get()); + xContentArea->add(xWarningOnBox.get()); + + bHardRecalc = xQueryBox->run() == RET_YES; + + //put them back as they were + xContentArea->remove(xWarningOnBox.get()); + xOrigParent->add(xWarningOnBox.get()); + + if (xWarningOnBox->get_active()) { // Always perform selected action in the future. std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx index 5df04c90d1ae..45de6c7a64b8 100644 --- a/sc/source/ui/dbgui/dbnamdlg.cxx +++ b/sc/source/ui/dbgui/dbnamdlg.cxx @@ -23,7 +23,7 @@ #include <cassert> #include <comphelper/string.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> #include <vcl/weld.hxx> #include <reffact.hxx> @@ -533,9 +533,11 @@ IMPL_LINK_NOARG(ScDbNameDlg, RemoveBtnHdl, Button*, void) aBuf.append(aStrDelMsg.getToken(0, '#')); aBuf.append(aStrEntry); aBuf.append(aStrDelMsg.getToken(1, '#')); - ScopedVclPtrInstance< QueryBox > aBox(this, MessBoxStyle::YesNo|MessBoxStyle::DefaultYes, aBuf.makeStringAndClear()); - - if (RET_YES == aBox->Execute()) + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + aBuf.makeStringAndClear())); + xQueryBox->set_default_response(RET_YES); + if (RET_YES == xQueryBox->run()) { SCTAB nTab; SCCOL nColStart, nColEnd; diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index 1c413903a35a..841b1c792486 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -1298,9 +1298,12 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb // OutRange of pOldObj (pDestObj) is still old area if (!lcl_EmptyExcept(&rDoc, aNewOut, pOldObj->GetOutRange())) { - ScopedVclPtrInstance<QueryBox> aBox( ScDocShell::GetActiveDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, - ScGlobal::GetRscString(STR_PIVOT_NOTEMPTY) ); - if (aBox->Execute() == RET_NO) + vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + ScGlobal::GetRscString(STR_PIVOT_NOTEMPTY))); + xQueryBox->set_default_response(RET_YES); + if (xQueryBox->run() == RET_NO) { //! like above (not editable) *pOldObj = aUndoDPObj; @@ -1349,10 +1352,12 @@ bool ScDBDocFunc::RemovePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi) if (pModel && !aListOfObjects.empty()) { - ScopedVclPtrInstance<QueryBox> aBox( - ScDocShell::GetActiveDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, - ScGlobal::GetRscString(STR_PIVOT_REMOVE_PIVOTCHART)); - if (aBox->Execute() == RET_NO) + vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + ScGlobal::GetRscString(STR_PIVOT_REMOVE_PIVOTCHART))); + xQueryBox->set_default_response(RET_YES); + if (xQueryBox->run() == RET_NO) { return false; } @@ -1493,11 +1498,12 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool if (!bEmpty) { - ScopedVclPtrInstance<QueryBox> aBox( - ScDocShell::GetActiveDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, - ScGlobal::GetRscString(STR_PIVOT_NOTEMPTY)); - - if (aBox->Execute() == RET_NO) + vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + ScGlobal::GetRscString(STR_PIVOT_NOTEMPTY))); + xQueryBox->set_default_response(RET_YES); + if (xQueryBox->run() == RET_NO) { //! like above (not editable) return false; @@ -1567,9 +1573,12 @@ bool ScDBDocFunc::UpdatePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi) { if (!lcl_EmptyExcept(&rDoc, aNewOut, rDPObj.GetOutRange())) { - ScopedVclPtrInstance<QueryBox> aBox( ScDocShell::GetActiveDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, - ScGlobal::GetRscString(STR_PIVOT_NOTEMPTY) ); - if (aBox->Execute() == RET_NO) + vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + ScGlobal::GetRscString(STR_PIVOT_NOTEMPTY))); + xQueryBox->set_default_response(RET_YES); + if (xQueryBox->run() == RET_NO) { rDPObj = aUndoDPObj; return false; diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 4ac78e1b67a0..e8705d760aa0 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -5106,9 +5106,14 @@ void ScDocFunc::CreateOneName( ScRangeName& rList, aMessage += aName; aMessage += aTemplate.getToken( 1, '#' ); - short nResult = ScopedVclPtrInstance<QueryBox>( ScDocShell::GetActiveDialogParent(), - MessBoxStyle::YesNoCancel | MessBoxStyle::DefaultYes, - aMessage )->Execute(); + vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + aMessage)); + xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL); + xQueryBox->set_default_response(RET_YES); + + short nResult = xQueryBox->run(); if ( nResult == RET_YES ) { rList.erase(*pOld); diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 7815e68d5566..767d5a502827 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -26,6 +26,7 @@ #include <comphelper/classids.hxx> #include <formula/errorcodes.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <vcl/virdev.hxx> #include <vcl/waitobj.hxx> #include <rtl/bootstrap.hxx> @@ -473,14 +474,29 @@ bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const css::uno::Reference< css { // Generator is not LibreOffice. Ask if the user wants to perform // full re-calculation. - ScopedVclPtrInstance<QueryBox> aBox( - GetActiveDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, - ScGlobal::GetRscString(STR_QUERY_FORMULA_RECALC_ONLOAD_ODS)); - aBox->SetCheckBoxText(ScGlobal::GetRscString(STR_ALWAYS_PERFORM_SELECTED)); + vcl::Window* pWin = GetActiveDialogParent(); - bHardRecalc = aBox->Execute() == RET_YES; + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWin ? pWin->GetFrameWeld() : nullptr, + "modules/scalc/ui/recalcquerydialog.ui")); + std::unique_ptr<weld::MessageDialog> 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<weld::CheckButton> xWarningOnBox(xBuilder->weld_check_button("ask")); - if (aBox->GetCheckBoxState()) + //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<weld::Container> xOrigParent(xWarningOnBox->weld_parent()); + std::unique_ptr<weld::Container> xContentArea(xQueryBox->weld_message_area()); + xOrigParent->remove(xWarningOnBox.get()); + xContentArea->add(xWarningOnBox.get()); + + bHardRecalc = xQueryBox->run() == RET_YES; + + //put them back as they were + xContentArea->remove(xWarningOnBox.get()); + xOrigParent->add(xWarningOnBox.get()); + + if (xWarningOnBox->get_active()) { // Always perform selected action in the future. std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index f13a23113498..582f39aad829 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -1204,9 +1204,12 @@ bool ScDocShell::MergeSharedDocument( ScDocShell* pSharedDocShell ) ScopedVclPtrInstance< ScConflictsDlg > aDlg( GetActiveDialogParent(), GetViewData(), &rSharedDoc, aConflictsList ); if ( aDlg->Execute() == RET_CANCEL ) { - ScopedVclPtrInstance<QueryBox> aBox( GetActiveDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, - ScGlobal::GetRscString( STR_DOC_WILLNOTBESAVED ) ); - if ( aBox->Execute() == RET_YES ) + vcl::Window* pWin = GetActiveDialogParent(); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + ScGlobal::GetRscString(STR_DOC_WILLNOTBESAVED))); + xQueryBox->set_default_response(RET_YES); + if (xQueryBox->run() == RET_YES) { return false; } diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 749ec29784a7..17f597270876 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -261,8 +261,11 @@ void ScDocShell::Execute( SfxRequest& rReq ) aMessage += sTarget; aMessage += aTemplate.getToken( 1, '#' ); - ScopedVclPtrInstance< QueryBox > aBox( nullptr, MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, aMessage ); - bDo = ( aBox->Execute() == RET_YES ); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + aMessage)); + xQueryBox->set_default_response(RET_YES); + bDo = xQueryBox->run() == RET_YES; } if (bDo) @@ -521,9 +524,12 @@ void ScDocShell::Execute( SfxRequest& rReq ) OSL_ENSURE(pViewSh,"SID_REIMPORT_AFTER_LOAD: no View"); if (pViewSh && pDBColl) { - ScopedVclPtrInstance<QueryBox> aBox( GetActiveDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, - ScGlobal::GetRscString(STR_REIMPORT_AFTER_LOAD) ); - if (aBox->Execute() == RET_YES) + vcl::Window* pWin = GetActiveDialogParent(); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + ScGlobal::GetRscString(STR_REIMPORT_AFTER_LOAD))); + xQueryBox->set_default_response(RET_YES); + if (xQueryBox->run() == RET_YES) { ScDBCollection::NamedDBs& rDBs = pDBColl->getNamedDBs(); ScDBCollection::NamedDBs::iterator itr = rDBs.begin(), itrEnd = rDBs.end(); @@ -973,11 +979,12 @@ void ScDocShell::Execute( SfxRequest& rReq ) bool bContinue = true; if ( HasName() ) { - ScopedVclPtrInstance<QueryBox> aBox( - GetActiveDialogParent(), - MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, - ScGlobal::GetRscString( STR_DOC_WILLBESAVED ) ); - if ( aBox->Execute() == RET_NO ) + vcl::Window* pWin = GetActiveDialogParent(); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + ScGlobal::GetRscString(STR_REIMPORT_AFTER_LOAD))); + xQueryBox->set_default_response(RET_YES); + if (xQueryBox->run() == RET_NO) { bContinue = false; } diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx b/sc/source/ui/miscdlgs/crnrdlg.cxx index 7eae143a4565..1c464898b75b 100644 --- a/sc/source/ui/miscdlgs/crnrdlg.cxx +++ b/sc/source/ui/miscdlgs/crnrdlg.cxx @@ -23,7 +23,6 @@ #include <globstr.hrc> #include <docsh.hxx> #include <crnrdlg.hxx> -#include <vcl/msgbox.hxx> #include <vcl/weld.hxx> #include <memory> @@ -34,10 +33,19 @@ namespace std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, VclMessageType::Warning, VclButtonsType::Ok, rString)); + xBox->run(); } -} -#define QUERYBOX(m) ScopedVclPtrInstance<QueryBox>(this, MessBoxStyle::YesNo|MessBoxStyle::DefaultYes, m)->Execute() + int QUERYBOX(weld::Window* pParent, const OUString& rString) + { + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, + VclMessageType::Question, VclButtonsType::YesNo, + rString)); + xBox->set_default_response(RET_YES); + return xBox->run(); + } + +} const sal_uLong nEntryDataCol = 0; const sal_uLong nEntryDataRow = 1; @@ -606,7 +614,7 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, RemoveBtnHdl, Button*, void) + aRangeStr + aStrDelMsg.getToken( 1, '#' ); - if ( RET_YES == QUERYBOX(aMsg) ) + if (RET_YES == QUERYBOX(GetFrameWeld(), aMsg)) { if ( bColName ) xColNameRanges->Remove( pPair ); diff --git a/sc/source/ui/miscdlgs/scuiautofmt.cxx b/sc/source/ui/miscdlgs/scuiautofmt.cxx index 455091f6f86e..57579606eaa0 100644 --- a/sc/source/ui/miscdlgs/scuiautofmt.cxx +++ b/sc/source/ui/miscdlgs/scuiautofmt.cxx @@ -32,7 +32,7 @@ #include <editeng/udlnitem.hxx> #include <editeng/wghtitem.hxx> #include <svl/zforlist.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> #include <vcl/weld.hxx> #include <comphelper/processfactory.hxx> #include <sfx2/strings.hrc> @@ -286,8 +286,12 @@ IMPL_LINK_NOARG(ScAutoFormatDlg, RemoveHdl, Button*, void) + m_pLbFormat->GetSelectedEntry() + aStrDelMsg.getToken( 1, '#' ); - if ( RET_YES == - ScopedVclPtrInstance<QueryBox>( this, MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, aMsg )->Execute() ) + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + aMsg)); + xQueryBox->set_default_response(RET_YES); + + if (RET_YES == xQueryBox->run()) { m_pLbFormat->RemoveEntry( nIndex ); m_pLbFormat->SelectEntryPos( nIndex-1 ); diff --git a/sc/source/ui/navipi/scenwnd.cxx b/sc/source/ui/navipi/scenwnd.cxx index ea9dd1af7205..b0ffd8b125ab 100644 --- a/sc/source/ui/navipi/scenwnd.cxx +++ b/sc/source/ui/navipi/scenwnd.cxx @@ -24,6 +24,7 @@ #include <svl/stritem.hxx> #include <vcl/msgbox.hxx> #include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <vcl/settings.hxx> #include <navipi.hxx> #include <scresid.hxx> @@ -183,8 +184,14 @@ void ScScenarioListBox::EditScenario() void ScScenarioListBox::DeleteScenario() { if( GetSelectedEntryCount() > 0 ) - if( ScopedVclPtrInstance<QueryBox>( nullptr, MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, ScGlobal::GetRscString( STR_QUERY_DELSCENARIO ) )->Execute() == RET_YES ) + { + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + ScGlobal::GetRscString(STR_QUERY_DELSCENARIO))); + xQueryBox->set_default_response(RET_YES); + if (xQueryBox->run() == RET_YES) ExecuteScenarioSlot( SID_DELETE_SCENARIO ); + } } // class ScScenarioWindow ------------------------------------------------ diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx index 52e671bcb33d..1d76dd9ca94f 100644 --- a/sc/source/ui/optdlg/tpusrlst.cxx +++ b/sc/source/ui/optdlg/tpusrlst.cxx @@ -20,7 +20,6 @@ #undef SC_DLLIMPLEMENTATION #include <comphelper/string.hxx> -#include <vcl/msgbox.hxx> #include <vcl/weld.hxx> #include <global.hxx> @@ -617,10 +616,12 @@ IMPL_LINK( ScTpUserLists, BtnClickHdl, Button*, pBtn, void ) + mpLbLists->GetEntry( nRemovePos ) + aStrQueryRemove.getToken( 1, '#' ); - if ( RET_YES == ScopedVclPtrInstance<QueryBox>( this, - MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, - aMsg - )->Execute() ) + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + aMsg)); + xQueryBox->set_default_response(RET_YES); + + if (RET_YES == xQueryBox->run()) { RemoveList( nRemovePos ); UpdateUserListBox(); diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index f24c6b4c60a6..8c8ecb6b4426 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -34,7 +34,6 @@ #include <svl/zformat.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/request.hxx> -#include <vcl/msgbox.hxx> #include <vcl/weld.hxx> #include <svx/svxdlg.hxx> #include <sot/formats.hxx> @@ -2015,9 +2014,12 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) // or should create a new overlapping conditional format if(!bCondFormatDlg && bContainsExistingCondFormat) { - ScopedVclPtrInstance<QueryBox> aBox( pTabViewShell->GetDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, - ScGlobal::GetRscString(STR_EDIT_EXISTING_COND_FORMATS) ); - bool bEditExisting = aBox->Execute() == RET_YES; + vcl::Window* pWin = pTabViewShell->GetDialogParent(); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + ScGlobal::GetRscString(STR_EDIT_EXISTING_COND_FORMATS))); + xQueryBox->set_default_response(RET_YES); + bool bEditExisting = xQueryBox->run() == RET_YES; if(bEditExisting) { // differentiate between ranges where one conditional format is defined @@ -2930,11 +2932,12 @@ void ScCellShell::ExecuteDataPilotDialog() if ( pDoc->HasSubTotalCells( aRange ) ) { // confirm selection if it contains SubTotal cells - - ScopedVclPtrInstance<QueryBox> aBox( pTabViewShell->GetDialogParent(), - MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, - ScGlobal::GetRscString(STR_DATAPILOT_SUBTOTAL) ); - if (aBox->Execute() == RET_NO) + vcl::Window* pWin = pTabViewShell->GetDialogParent(); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + ScGlobal::GetRscString(STR_DATAPILOT_SUBTOTAL))); + xQueryBox->set_default_response(RET_YES); + if (xQueryBox->run() == RET_NO) bOK = false; } if (bOK) diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index ce2c030ac55c..3322d1701c56 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -25,7 +25,6 @@ #include <sfx2/dispatch.hxx> #include <sfx2/request.hxx> #include <svl/stritem.hxx> -#include <vcl/msgbox.hxx> #include <vcl/weld.hxx> #include <sfx2/app.hxx> #include <globstr.hrc> @@ -418,11 +417,19 @@ void ScCellShell::Execute( SfxRequest& rReq ) rMark.MarkToMulti(); if ( rMark.IsMultiMarked() ) { - if ( rReq.IsAPI() - || RET_YES == - ScopedVclPtrInstance<QueryBox>( pTabViewShell->GetDialogParent(), MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, - ScGlobal::GetRscString(STR_UPDATE_SCENARIO) )-> - Execute() ) + + bool bExtend = rReq.IsAPI(); + if (!bExtend) + { + vcl::Window* pWin = pTabViewShell->GetDialogParent(); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + ScGlobal::GetRscString(STR_UPDATE_SCENARIO))); + xQueryBox->set_default_response(RET_YES); + bExtend = xQueryBox->run() == RET_YES; + } + + if (bExtend) { pTabViewShell->ExtendScenario(); rReq.Done(); diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx index 75f2d375a2cb..2549dbc8caad 100644 --- a/sc/source/ui/view/tabvwshf.cxx +++ b/sc/source/ui/view/tabvwshf.cxx @@ -29,7 +29,7 @@ #include <svl/languageoptions.hxx> #include <svl/stritem.hxx> #include <svl/whiter.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> #include <vcl/weld.hxx> #include <sfx2/objface.hxx> #include <svx/svxdlg.hxx> @@ -621,21 +621,26 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) } } + vcl::Window* pWin = GetDialogParent(); if (bTabWithPivotTable) { + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + ScGlobal::GetRscString(STR_QUERY_PIVOTTABLE_DELTAB))); + xQueryBox->set_default_response(RET_NO); + // Hard warning as there is potential of data loss on deletion - bDoIt = ( RET_YES == - ScopedVclPtrInstance<QueryBox>( GetDialogParent(), - MessBoxStyle::YesNo | MessBoxStyle::DefaultNo, - ScGlobal::GetRscString(STR_QUERY_PIVOTTABLE_DELTAB))->Execute() ); + bDoIt = (RET_YES == xQueryBox->run()); } else { + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + ScGlobal::GetRscString(STR_QUERY_DELTAB))); + xQueryBox->set_default_response(RET_YES); + // no parameter given, ask for confirmation - bDoIt = ( RET_YES == - ScopedVclPtrInstance<QueryBox>( GetDialogParent(), - MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, - ScGlobal::GetRscString(STR_QUERY_DELTAB))->Execute() ); + bDoIt = (RET_YES == xQueryBox->run()); } } diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 83b3a51edd86..623966231e62 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -32,7 +32,7 @@ #include <sot/storage.hxx> #include <vcl/graph.hxx> #include <vcl/virdev.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <tools/urlobj.hxx> #include <sot/exchange.hxx> #include <memory> @@ -1052,9 +1052,13 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc, { ScWaitCursorOff aWaitOff( GetFrameWin() ); OUString aMessage = ScGlobal::GetRscString( STR_PASTE_BIGGER ); - ScopedVclPtrInstance<QueryBox> aBox( GetViewData().GetDialogParent(), - MessBoxStyle::YesNo | MessBoxStyle::DefaultNo, aMessage ); - if ( aBox->Execute() != RET_YES ) + + vcl::Window* pWin = GetViewData().GetDialogParent(); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + aMessage)); + xQueryBox->set_default_response(RET_NO); + if (xQueryBox->run() != RET_YES) { return false; } diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 4dd346c5d3ab..bd21e085d265 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -34,7 +34,7 @@ #include <sfx2/bindings.hxx> #include <svl/zforlist.hxx> #include <svl/zformat.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <vcl/virdev.hxx> #include <vcl/waitobj.hxx> #include <vcl/wrkwin.hxx> @@ -442,9 +442,13 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, { OUString aMessage( ScResId( SCSTR_FORMULA_AUTOCORRECTION ) ); aMessage += aCorrectedFormula; - nResult = ScopedVclPtrInstance<QueryBox>( GetViewData().GetDialogParent(), - MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, - aMessage )->Execute(); + + vcl::Window* pWin = GetViewData().GetDialogParent(); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + aMessage)); + xQueryBox->set_default_response(RET_YES); + nResult = xQueryBox->run(); } if ( nResult == RET_YES ) { diff --git a/sc/uiconfig/scalc/ui/recalcquerydialog.ui b/sc/uiconfig/scalc/ui/recalcquerydialog.ui new file mode 100644 index 000000000000..3c21f9663c49 --- /dev/null +++ b/sc/uiconfig/scalc/ui/recalcquerydialog.ui @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.20.2 --> +<interface domain="pcr"> + <requires lib="gtk+" version="3.20"/> + <object class="GtkMessageDialog" id="RecalcQueryDialog"> + <property name="can_focus">False</property> + <property name="type_hint">dialog</property> + <property name="message_type">question</property> + <property name="buttons">yes-no</property> + <child internal-child="vbox"> + <object class="GtkBox"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">2</property> + <child internal-child="action_area"> + <object class="GtkButtonBox"> + <property name="can_focus">False</property> + <property name="homogeneous">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="ask"> + <property name="label" translatable="yes" context="recalcquerydialog|ask">Always perform this without prompt in the future.</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + </child> + <child> + <placeholder/> + </child> + </object> +</interface> diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx index 3e50db1f9643..bd731f255465 100644 --- a/sd/source/core/drawdoc3.cxx +++ b/sd/source/core/drawdoc3.cxx @@ -466,7 +466,11 @@ bool SdDrawDocument::InsertBookmarkAsPage( pBMPage->GetLowerBorder() != pRefPage->GetLowerBorder()) { OUString aStr(SdResId(STR_SCALE_OBJECTS)); - sal_uInt16 nBut = ScopedVclPtrInstance<QueryBox>(nullptr, MessBoxStyle::YesNoCancel, aStr)->Execute(); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + aStr)); + xQueryBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), RET_CANCEL); + sal_uInt16 nBut = xQueryBox->run(); bScaleObjects = nBut == RET_YES; bContinue = nBut != RET_CANCEL; diff --git a/sd/source/ui/annotations/annotationmanager.cxx b/sd/source/ui/annotations/annotationmanager.cxx index d12e80d2e91a..2294115c0394 100644 --- a/sd/source/ui/annotations/annotationmanager.cxx +++ b/sd/source/ui/annotations/annotationmanager.cxx @@ -33,7 +33,7 @@ #include <vcl/commandinfoprovider.hxx> #include <vcl/settings.hxx> #include <vcl/menu.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <sal/macros.h> #include <svl/style.hxx> @@ -837,9 +837,11 @@ void AnnotationManagerImpl::SelectNextAnnotation(bool bForeward) // Pop up question box that asks the user whether to wrap around. // The dialog is made modal with respect to the whole application. - ScopedVclPtrInstance< QueryBox > aQuestionBox( nullptr, (MessBoxStyle::YesNo | MessBoxStyle::DefaultYes), SdResId(pStringId)); - aQuestionBox->SetImage( QueryBox::GetStandardImage() ); - if (aQuestionBox->Execute() != RET_YES) + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + SdResId(pStringId))); + xQueryBox->set_default_response(RET_YES); + if (xQueryBox->run() != RET_YES) break; } while( true ); diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx index 84ae97063822..5638ab8e3bdf 100644 --- a/sd/source/ui/view/drviews4.cxx +++ b/sd/source/ui/view/drviews4.cxx @@ -20,7 +20,7 @@ #include <com/sun/star/drawing/XDrawPagesSupplier.hpp> #include <DrawViewShell.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <svl/urlbmk.hxx> #include <svx/svdpagv.hxx> #include <svx/svdundo.hxx> @@ -105,7 +105,11 @@ void DrawViewShell::DeleteActualLayer() // replace placeholder aString = aString.replaceFirst("$", rName); - if (ScopedVclPtrInstance<QueryBox>(GetActiveWindow(), MessBoxStyle::YesNo, aString)->Execute() == RET_YES) + vcl::Window* pWin = GetActiveWindow(); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + aString)); + if (xQueryBox->run() == RET_YES) { const SdrLayer* pLayer = rAdmin.GetLayer(rName); mpDrawView->DeleteLayer( pLayer->GetName() ); diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx index 151c1fa10c47..7abbb36c82a9 100644 --- a/sd/source/ui/view/drviewse.cxx +++ b/sd/source/ui/view/drviewse.cxx @@ -33,7 +33,6 @@ #include <vcl/waitobj.hxx> #include <svl/aeitem.hxx> #include <editeng/editstat.hxx> -#include <vcl/msgbox.hxx> #include <vcl/weld.hxx> #include <svl/urlbmk.hxx> #include <svx/svdpagv.hxx> @@ -326,21 +325,25 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq) if ( mpDrawView->GetMarkedObjectList().GetMarkCount() > 0 && !mpDrawView->IsCrookAllowed( mpDrawView->IsCrookNoContortion() ) ) { + ::sd::Window* pWindow = GetActiveWindow(); if ( mpDrawView->IsPresObjSelected() ) { - ::sd::Window* pWindow = GetActiveWindow(); std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, VclMessageType::Info, VclButtonsType::Ok, SdResId(STR_ACTION_NOTPOSSIBLE))); xInfoBox->run(); } - else if ( ScopedVclPtrInstance<QueryBox>(GetActiveWindow(), MessBoxStyle::YesNo, - SdResId(STR_ASK_FOR_CONVERT_TO_BEZIER) - )->Execute() == RET_YES ) + else { - // implicit transformation into bezier - WaitObject aWait( GetActiveWindow() ); - mpDrawView->ConvertMarkedToPathObj(false); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + SdResId(STR_ASK_FOR_CONVERT_TO_BEZIER))); + if (xQueryBox->run() == RET_YES ) + { + // implicit transformation into bezier + WaitObject aWait( GetActiveWindow() ); + mpDrawView->ConvertMarkedToPathObj(false); + } } } } @@ -366,21 +369,25 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq) if ( nMarkCnt > 0 && !b3DObjMarked && (!mpDrawView->IsShearAllowed() || !mpDrawView->IsDistortAllowed()) ) { + ::sd::Window* pWindow = GetActiveWindow(); if ( mpDrawView->IsPresObjSelected() ) { - ::sd::Window* pWindow = GetActiveWindow(); std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, VclMessageType::Info, VclButtonsType::Ok, SdResId(STR_ACTION_NOTPOSSIBLE))); xInfoBox->run(); } - else if ( ScopedVclPtrInstance<QueryBox>(GetActiveWindow(), MessBoxStyle::YesNo, - SdResId(STR_ASK_FOR_CONVERT_TO_BEZIER) - )->Execute() == RET_YES ) + else { - // implicit transformation into bezier - WaitObject aWait( GetActiveWindow() ); - mpDrawView->ConvertMarkedToPathObj(false); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + SdResId(STR_ASK_FOR_CONVERT_TO_BEZIER))); + if (xQueryBox->run() == RET_YES) + { + // implicit transformation into bezier + WaitObject aWait( GetActiveWindow() ); + mpDrawView->ConvertMarkedToPathObj(false); + } } } } diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx index b6d5d4eb91fb..9ca22e8256e1 100644 --- a/sfx2/source/appl/linkmgr2.cxx +++ b/sfx2/source/appl/linkmgr2.cxx @@ -28,7 +28,8 @@ #include <tools/urlobj.hxx> #include <sot/exchange.hxx> #include <tools/debug.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <sfx2/lnkbase.hxx> #include <sfx2/app.hxx> #include <vcl/graph.hxx> @@ -271,7 +272,7 @@ bool LinkManager::GetDisplayNames( const SvBaseLink * pLink, void LinkManager::UpdateAllLinks( bool bAskUpdate, bool bUpdateGrfLinks, - vcl::Window* pParentWin ) + weld::Window* pParentWin ) { // First make a copy of the array in order to update links // links in ... no contact between them! @@ -308,7 +309,12 @@ void LinkManager::UpdateAllLinks( if( bAskUpdate ) { - int nRet = ScopedVclPtrInstance<QueryBox>(pParentWin, MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, SfxResId( STR_QUERY_UPDATE_LINKS ))->Execute(); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pParentWin, + VclMessageType::Question, VclButtonsType::YesNo, + SfxResId(STR_QUERY_UPDATE_LINKS))); + xQueryBox->set_default_response(RET_YES); + + int nRet = xQueryBox->run(); if( RET_YES != nRet ) { SfxObjectShell* pShell = pLink->GetLinkManager()->GetPersist(); diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx index d28c4ca27dad..5bbdfed0b7eb 100644 --- a/sfx2/source/bastyp/fltfnc.cxx +++ b/sfx2/source/bastyp/fltfnc.cxx @@ -36,7 +36,6 @@ #include <basic/sbxobj.hxx> #include <basic/sbxmeth.hxx> #include <basic/sbxcore.hxx> -#include <vcl/msgbox.hxx> #include <vcl/weld.hxx> #include <rtl/ustring.hxx> #include <rtl/ustrbuf.hxx> @@ -485,8 +484,12 @@ bool SfxFilterMatcher::IsFilterInstalled_Impl( const std::shared_ptr<const SfxFi // Here could a re-installation be offered OUString aText( SfxResId(STR_FILTER_NOT_INSTALLED) ); aText = aText.replaceFirst( "$(FILTER)", pFilter->GetUIName() ); - ScopedVclPtrInstance< QueryBox > aQuery(nullptr, MessBoxStyle::YesNo | MessBoxStyle::DefaultYes, aText); - short nRet = aQuery->Execute(); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + aText)); + xQueryBox->set_default_response(RET_YES); + + short nRet = xQueryBox->run(); if ( nRet == RET_YES ) { #ifdef DBG_UTIL diff --git a/sfx2/source/dialog/alienwarn.cxx b/sfx2/source/dialog/alienwarn.cxx index 66c9424067be..dd88541fbb29 100644 --- a/sfx2/source/dialog/alienwarn.cxx +++ b/sfx2/source/dialog/alienwarn.cxx @@ -22,66 +22,62 @@ #include <sfx2/sfxresid.hxx> #include <sfx2/sfxuno.hxx> #include <unotools/saveopt.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> #include <alienwarn.hxx> -SfxAlienWarningDialog::SfxAlienWarningDialog(vcl::Window* pParent, const OUString& _rFormatName, +SfxAlienWarningDialog::SfxAlienWarningDialog(weld::Window* pParent, const OUString& _rFormatName, const OUString& _rDefaultExtension, bool rDefaultIsAlien) - : MessageDialog(pParent, "AlienWarnDialog", "sfx/ui/alienwarndialog.ui") + : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/alienwarndialog.ui")) + , m_xDialog(m_xBuilder->weld_message_dialog("AlienWarnDialog")) + , 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()) { - get(m_pWarningOnBox, "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 - m_pWarningOnBox->set_margin_left(QueryBox::GetStandardImage().GetSizePixel().Width() + 12); - - get(m_pKeepCurrentBtn, "save"); - get(m_pUseDefaultFormatBtn, "cancel"); + m_xOrigParent->remove(m_xWarningOnBox.get()); + m_xContentArea->add(m_xWarningOnBox.get()); OUString aExtension = "ODF"; // replace formatname (text) - OUString sInfoText = get_primary_text(); + OUString sInfoText = m_xDialog->get_primary_text(); sInfoText = sInfoText.replaceAll( "%FORMATNAME", _rFormatName ); - set_primary_text(sInfoText); + m_xDialog->set_primary_text(sInfoText); // replace formatname (button) - sInfoText = m_pKeepCurrentBtn->GetText(); + sInfoText = m_xKeepCurrentBtn->get_label(); sInfoText = sInfoText.replaceAll( "%FORMATNAME", _rFormatName ); - m_pKeepCurrentBtn->SetText( sInfoText ); + m_xKeepCurrentBtn->set_label(sInfoText); // hide ODF explanation if default format is alien // and set the proper extension in the button if( rDefaultIsAlien ) { - set_secondary_text(OUString()); + m_xDialog->set_secondary_text(OUString()); aExtension = _rDefaultExtension.toAsciiUpperCase(); } // replace defaultextension (button) - sInfoText = m_pUseDefaultFormatBtn->GetText(); + sInfoText = m_xUseDefaultFormatBtn->get_label(); sInfoText = sInfoText.replaceAll( "%DEFAULTEXTENSION", aExtension ); - m_pUseDefaultFormatBtn->SetText( sInfoText ); + m_xUseDefaultFormatBtn->set_label(sInfoText); // load value of "warning on" checkbox from save options - m_pWarningOnBox->Check( SvtSaveOptions().IsWarnAlienFormat() ); + m_xWarningOnBox->set_active(SvtSaveOptions().IsWarnAlienFormat()); } SfxAlienWarningDialog::~SfxAlienWarningDialog() { - disposeOnce(); -} - -void SfxAlienWarningDialog::dispose() -{ + 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_pWarningOnBox->IsChecked(); - if ( aSaveOpt.IsWarnAlienFormat() != bChecked ) - aSaveOpt.SetWarnAlienFormat( bChecked ); - m_pKeepCurrentBtn.clear(); - m_pUseDefaultFormatBtn.clear(); - m_pWarningOnBox.clear(); - MessageDialog::dispose(); + bool bChecked = m_xWarningOnBox->get_active(); + if (aSaveOpt.IsWarnAlienFormat() != bChecked) + aSaveOpt.SetWarnAlienFormat(bChecked); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/recfloat.cxx b/sfx2/source/dialog/recfloat.cxx index 09fbdce65552..d023348f4548 100644 --- a/sfx2/source/dialog/recfloat.cxx +++ b/sfx2/source/dialog/recfloat.cxx @@ -18,7 +18,8 @@ */ #include <svl/eitem.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <recfloat.hxx> #include <sfx2/strings.hrc> @@ -59,9 +60,14 @@ bool SfxRecordingFloatWrapper_Impl::QueryClose() css::uno::Reference< css::frame::XDispatchRecorder > xRecorder = pBindings->GetRecorder(); if ( xRecorder.is() && !xRecorder->getRecordedMacro().isEmpty() ) { - ScopedVclPtrInstance< QueryBox > aBox(GetWindow(), MessBoxStyle::YesNo | MessBoxStyle::DefaultNo , SfxResId(STR_MACRO_LOSS)); - aBox->SetText( SfxResId(STR_CANCEL_RECORDING) ); - bRet = ( aBox->Execute() == RET_YES ); + vcl::Window* pWin = GetWindow(); + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Question, VclButtonsType::YesNo, + SfxResId(STR_MACRO_LOSS))); + xQueryBox->set_default_response(RET_NO); + + xQueryBox->set_title(SfxResId(STR_CANCEL_RECORDING)); + bRet = (xQueryBox->run() == RET_YES); } return bRet; diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 824f8598f3cc..cbdde2efbb52 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -1803,9 +1803,9 @@ bool SfxStoringHelper::WarnUnacceptableFormat( const uno::Reference< frame::XMod return true; vcl::Window* pWin = SfxStoringHelper::GetModelWindow( xModel ); - ScopedVclPtrInstance< SfxAlienWarningDialog > aDlg( pWin, aOldUIName, aDefExtension, bDefIsAlien ); + SfxAlienWarningDialog aDlg(pWin ? pWin->GetFrameWeld() : nullptr, aOldUIName, aDefExtension, bDefIsAlien); - return aDlg->Execute() == RET_OK; + return aDlg.run() == RET_OK; } vcl::Window* SfxStoringHelper::GetModelWindow( const uno::Reference< frame::XModel >& xModel ) diff --git a/sfx2/source/doc/querytemplate.cxx b/sfx2/source/doc/querytemplate.cxx index 9eef613c96e5..bc9ff49bf977 100644 --- a/sfx2/source/doc/querytemplate.cxx +++ b/sfx2/source/doc/querytemplate.cxx @@ -30,7 +30,7 @@ namespace sfx2 QueryTemplateBox::QueryTemplateBox( vcl::Window* pParent, const OUString& rMessage ) : MessBox ( pParent, MessBoxStyle::NONE, 0, Application::GetDisplayName(), rMessage ) { - SetImage( QueryBox::GetStandardImage() ); + SetImage(GetStandardQueryBoxImage()); SetHelpId( HID_QUERY_LOAD_TEMPLATE ); AddButton( SfxResId( STR_QRYTEMPL_UPDATE_BTN ), RET_YES, diff --git a/sfx2/source/inc/alienwarn.hxx b/sfx2/source/inc/alienwarn.hxx index 7d2414aad8bc..05f5a3835aee 100644 --- a/sfx2/source/inc/alienwarn.hxx +++ b/sfx2/source/inc/alienwarn.hxx @@ -19,21 +19,25 @@ #ifndef INCLUDED_SFX2_SOURCE_INC_ALIENWARN_HXX #define INCLUDED_SFX2_SOURCE_INC_ALIENWARN_HXX -#include <vcl/button.hxx> -#include <vcl/messagedialog.hxx> +#include <vcl/weld.hxx> -class SfxAlienWarningDialog : public MessageDialog +class SfxAlienWarningDialog { private: - VclPtr<PushButton> m_pKeepCurrentBtn; - VclPtr<PushButton> m_pUseDefaultFormatBtn; - VclPtr<CheckBox> m_pWarningOnBox; + 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; + + std::unique_ptr<weld::Container> m_xOrigParent; + std::unique_ptr<weld::Container> m_xContentArea; public: - SfxAlienWarningDialog(vcl::Window* pParent, const OUString& _rFormatName, + SfxAlienWarningDialog(weld::Window* pParent, const OUString& _rFormatName, const OUString& _rDefaultExtension, bool rDefaultIsAlien); - virtual ~SfxAlienWarningDialog() override; - virtual void dispose() override; + short run() { return m_xDialog->run(); } + ~SfxAlienWarningDialog(); }; #endif // INCLUDED_SFX2_SOURCE_INC_ALIENWARN_HXX diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 33978818fa44..c72f6a47a4a1 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -134,7 +134,8 @@ using ::com::sun::star::container::XIndexContainer; #include <sfx2/minfitem.hxx> #include <sfx2/strings.hrc> #include "impviewframe.hxx" -#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #define SfxViewFrame #include <sfxslots.hxx> @@ -175,28 +176,23 @@ SfxEditDocumentDialog::SfxEditDocumentDialog(weld::Widget* pParent) { } -class SfxQueryOpenAsTemplate : public QueryBox +class SfxQueryOpenAsTemplate { +private: + std::unique_ptr<weld::MessageDialog> m_xQueryBox; public: - SfxQueryOpenAsTemplate(vcl::Window* pParent, MessBoxStyle nStyle, bool bAllowIgnoreLock); -}; - -SfxQueryOpenAsTemplate::SfxQueryOpenAsTemplate(vcl::Window* pParent, MessBoxStyle nStyle, bool bAllowIgnoreLock) - : QueryBox(pParent, nStyle, SfxResId(bAllowIgnoreLock ? STR_QUERY_OPENASTEMPLATE_ALLOW_IGNORE : STR_QUERY_OPENASTEMPLATE)) -{ - AddButton(SfxResId(STR_QUERY_OPENASTEMPLATE_OPENCOPY_BTN), RET_YES, - ButtonDialogFlags::Default | ButtonDialogFlags::OK | ButtonDialogFlags::Focus); - SetButtonHelpText(RET_YES, OUString()); - - if (bAllowIgnoreLock) + SfxQueryOpenAsTemplate(weld::Window* pParent, bool bAllowIgnoreLock) + : m_xQueryBox(Application::CreateMessageDialog(pParent, VclMessageType::Question, VclButtonsType::NONE, + SfxResId(bAllowIgnoreLock ? STR_QUERY_OPENASTEMPLATE_ALLOW_IGNORE : STR_QUERY_OPENASTEMPLATE))) { - AddButton(SfxResId(STR_QUERY_OPENASTEMPLATE_OPEN_BTN), RET_IGNORE); - SetButtonHelpText(RET_IGNORE, OUString()); + m_xQueryBox->add_button(SfxResId(STR_QUERY_OPENASTEMPLATE_OPENCOPY_BTN), RET_YES); + if (bAllowIgnoreLock) + m_xQueryBox->add_button(SfxResId(STR_QUERY_OPENASTEMPLATE_OPEN_BTN), RET_IGNORE); + m_xQueryBox->add_button(Button::GetStandardText( StandardButtonType::Cancel ), RET_CANCEL); + m_xQueryBox->set_default_response(RET_YES); } - - AddButton(StandardButtonType::Cancel, RET_CANCEL); - SetButtonHelpText(RET_CANCEL, OUString()); -} + short run() { return m_xQueryBox->run(); } +}; /// Is this read-only object shell opened via .uno:SignPDF? bool IsSignPDF(const SfxObjectShellRef& xObjSh) @@ -463,9 +459,9 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq ) if (nOpenMode == SFX_STREAM_READWRITE && !rReq.IsAPI()) { // css::sdbcx::User offering to open it as a template - ScopedVclPtrInstance<SfxQueryOpenAsTemplate> aBox(&GetWindow(), MessBoxStyle::NONE, bRetryIgnoringLock); + SfxQueryOpenAsTemplate aBox(GetWindow().GetFrameWeld(), bRetryIgnoringLock); - short nUserAnswer = aBox->Execute(); + short nUserAnswer = aBox.run(); bOpenTemplate = RET_YES == nUserAnswer; // Always reset this here to avoid infinite loop bRetryIgnoringLock = RET_IGNORE == nUserAnswer; diff --git a/solenv/bin/pack_images.py b/solenv/bin/pack_images.py old mode 100644 new mode 100755 diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx index 3cbbd6ba752b..2afef15a646f 100644 --- a/svtools/source/graphic/provider.cxx +++ b/svtools/source/graphic/provider.cxx @@ -206,11 +206,11 @@ uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadStandardImage( co } else if ( sImageName == "error" ) { - xRet = Graphic(ErrorBox::GetStandardImage().GetBitmapEx()).GetXGraphic(); ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits