diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-02-23 09:35:08 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-02-26 15:27:09 +0000 |
commit | 942f05996bc287923cdbcae12c64e57adf8ec975 (patch) | |
tree | 7005380763a9ecb93f5f27c28174633b9774abb7 /sc | |
parent | c410a3dcfeb68ba2247c0d879727afe4ca8ed3da (diff) |
convert remaining ErrorBox to weld::MessageDialog
and
convert remaining QueryBox to weld::MessageDialog
Change-Id: Ifb4c316dee8eabf57c4940c44e29c65a2781aa6c
Diffstat (limited to 'sc')
-rw-r--r-- | sc/UIConfig_scalc.mk | 1 | ||||
-rw-r--r-- | sc/inc/globstr.hrc | 1 | ||||
-rw-r--r-- | sc/source/filter/oox/workbookfragment.cxx | 30 | ||||
-rw-r--r-- | sc/source/ui/dbgui/dbnamdlg.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/docshell/dbdocfun.cxx | 39 | ||||
-rw-r--r-- | sc/source/ui/docshell/docfunc.cxx | 11 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 28 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh3.cxx | 9 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh4.cxx | 27 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/crnrdlg.cxx | 16 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/scuiautofmt.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/navipi/scenwnd.cxx | 9 | ||||
-rw-r--r-- | sc/source/ui/optdlg/tpusrlst.cxx | 11 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh1.cxx | 21 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh3.cxx | 19 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwshf.cxx | 23 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun3.cxx | 12 | ||||
-rw-r--r-- | sc/source/ui/view/viewfunc.cxx | 12 | ||||
-rw-r--r-- | sc/uiconfig/scalc/ui/recalcquerydialog.ui | 46 |
19 files changed, 240 insertions, 95 deletions
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> |