basctl/source/basicide/basides1.cxx | 14 - basctl/source/basicide/basidesh.cxx | 8 basic/source/runtime/basrdll.cxx | 6 basic/source/runtime/methods.cxx | 187 +++++++-------- chart2/source/controller/main/ChartController_Window.cxx | 6 cui/source/customize/cfg.cxx | 2 cui/source/dialogs/SpellDialog.cxx | 3 cui/source/dialogs/cuigaldlg.cxx | 8 cui/source/dialogs/multipat.cxx | 11 cui/source/options/optdict.cxx | 4 cui/source/options/treeopt.cxx | 7 cui/source/tabpages/backgrnd.cxx | 2 dbaccess/source/ui/dlg/generalpage.cxx | 8 dbaccess/source/ui/dlg/sqlmessage.cxx | 2 dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx | 7 editeng/source/editeng/editdbg.cxx | 9 editeng/source/editeng/editeng.cxx | 8 editeng/source/misc/unolingu.cxx | 10 extensions/source/propctrlr/propcontroller.cxx | 7 extensions/source/update/ui/updatecheckui.cxx | 4 filter/source/graphicfilter/eps/eps.cxx | 7 filter/source/xsltdialog/xmlfiltersettingsdialog.cxx | 15 - include/editeng/unolingu.hxx | 4 include/svtools/ehdl.hxx | 6 include/vcl/builder.hxx | 2 include/vcl/dialog.hxx | 8 include/vcl/errinf.hxx | 11 include/vcl/messagedialog.hxx | 7 include/vcl/msgbox.hxx | 12 include/vcl/weld.hxx | 2 sc/source/core/data/dpobject.cxx | 9 sc/source/ui/dbgui/consdlg.cxx | 20 + sc/source/ui/dbgui/scendlg.cxx | 12 sc/source/ui/docshell/arealink.cxx | 10 sc/source/ui/docshell/dbdocfun.cxx | 9 sc/source/ui/docshell/dbdocimp.cxx | 9 sc/source/ui/docshell/docfunc.cxx | 21 + sc/source/ui/docshell/docsh3.cxx | 8 sc/source/ui/docshell/docsh4.cxx | 19 - sc/source/ui/docshell/docsh5.cxx | 33 +- sc/source/ui/docshell/docsh6.cxx | 9 sc/source/ui/docshell/impex.cxx | 9 sc/source/ui/optdlg/tpusrlst.cxx | 5 sc/source/ui/view/cellsh1.cxx | 8 sc/source/ui/view/spelleng.cxx | 10 sc/source/ui/view/tabview2.cxx | 9 sc/source/ui/view/viewfun4.cxx | 10 sd/source/ui/dlg/PhotoAlbumDialog.cxx | 7 sd/source/ui/func/fudraw.cxx | 7 sd/source/ui/func/futhes.cxx | 2 sd/source/ui/view/drawview.cxx | 9 sd/source/ui/view/drviews2.cxx | 69 ++++- sd/source/ui/view/drviewse.cxx | 26 +- sd/source/ui/view/drviewsi.cxx | 11 sd/source/ui/view/sdview4.cxx | 11 sd/source/ui/view/viewshe2.cxx | 3 sfx2/source/bastyp/fltfnc.cxx | 11 sfx2/source/dialog/securitypage.cxx | 8 sfx2/source/doc/new.cxx | 2 sfx2/source/view/ipclient.cxx | 3 svtools/source/graphic/provider.cxx | 2 svtools/source/misc/ehdl.cxx | 80 +++--- svx/source/dialog/imapdlg.cxx | 2 svx/source/svdraw/svdedtv1.cxx | 8 svx/source/svdraw/svdedxv.cxx | 7 svx/source/svdraw/svdpntv.cxx | 7 sw/source/core/frmedt/fetab.cxx | 30 +- sw/source/ui/index/cnttab.cxx | 11 sw/source/ui/misc/bookmark.cxx | 7 sw/source/uibase/app/docsh.cxx | 12 sw/source/uibase/app/docsh2.cxx | 5 sw/source/uibase/dochdl/gloshdl.cxx | 8 sw/source/uibase/lingu/hyp.cxx | 9 sw/source/uibase/lingu/olmenu.cxx | 4 sw/source/uibase/uiview/viewling.cxx | 4 sw/source/uibase/utlui/unotools.cxx | 7 toolkit/source/awt/vclxtoolkit.cxx | 13 + uui/source/iahndl-errorhandler.cxx | 21 + uui/source/iahndl.cxx | 5 uui/source/sslwarndlg.cxx | 22 - uui/source/sslwarndlg.hxx | 10 uui/uiconfig/ui/sslwarndialog.ui | 1 vcl/source/app/salvtables.cxx | 13 + vcl/source/window/builder.cxx | 53 ---- vcl/source/window/dialog.cxx | 112 ++++++++ vcl/source/window/errinf.cxx | 8 vcl/source/window/layout.cxx | 99 +------ vcl/source/window/msgbox.cxx | 24 - vcl/unx/gtk3/gtk3gtkinst.cxx | 33 ++ xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx | 14 - 90 files changed, 862 insertions(+), 535 deletions(-)
New commits: commit d75144cf44779a8f6cc9bccf9b0a6328b94a5b90 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Feb 21 21:20:15 2018 +0000 convert remaining InfoBox to weld::MessageDialog Change-Id: I91d828e38d96264cf4a76f30940942556b8f78d8 Reviewed-on: https://gerrit.libreoffice.org/50205 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index 22afa37f5d2a..5fce14ec5114 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -48,6 +48,7 @@ #include <svl/visitem.hxx> #include <svl/whiter.hxx> #include <vcl/xtextedt.hxx> +#include <vcl/svapp.hxx> #include <vcl/msgbox.hxx> #include <vcl/weld.hxx> @@ -114,7 +115,11 @@ void Shell::ExecuteCurrent( SfxRequest& rReq ) OUString aReplStr(IDEResId(RID_STR_SEARCHREPLACES)); aReplStr = aReplStr.replaceAll("XX", OUString::number(nFound)); - ScopedVclPtrInstance<InfoBox>(pCurWin, aReplStr)->Execute(); + + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pCurWin->GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + aReplStr)); + xInfoBox->run(); } else { @@ -181,7 +186,12 @@ void Shell::ExecuteCurrent( SfxRequest& rReq ) SetCurWindow( pWin, true ); } if ( !nFound && !bCanceled ) - ScopedVclPtrInstance<InfoBox>(pCurWin, IDEResId(RID_STR_SEARCHNOTFOUND))->Execute(); + { + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pCurWin->GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + IDEResId(RID_STR_SEARCHNOTFOUND))); + xInfoBox->run(); + } } rReq.Done(); diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx index e4791604572b..58b4d42c50c7 100644 --- a/basctl/source/basicide/basidesh.cxx +++ b/basctl/source/basicide/basidesh.cxx @@ -62,7 +62,7 @@ #include <com/sun/star/container/XContainer.hpp> #include <svx/xmlsecctrl.hxx> #include <sfx2/viewfac.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <vcl/settings.hxx> #include <cppuhelper/implbase.hxx> @@ -386,8 +386,10 @@ bool Shell::PrepareClose( bool bUI ) { if( bUI ) { - vcl::Window *pParent = &GetViewFrame()->GetWindow(); - ScopedVclPtrInstance<InfoBox>(pParent, IDEResId(RID_STR_CANNOTCLOSE))->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetViewFrame()->GetWindow().GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + IDEResId(RID_STR_CANNOTCLOSE))); + xInfoBox->run(); } return false; } diff --git a/basic/source/runtime/basrdll.cxx b/basic/source/runtime/basrdll.cxx index e7a639a5a069..b5949524ccc8 100644 --- a/basic/source/runtime/basrdll.cxx +++ b/basic/source/runtime/basrdll.cxx @@ -22,6 +22,7 @@ #include <svl/solar.hrc> #include <tools/debug.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <vcl/settings.hxx> #include <basic/sbstar.hxx> @@ -97,7 +98,10 @@ void BasicDLL::BasicBreak() { bJustStopping = true; StarBASIC::Stop(); - ScopedVclPtrInstance<InfoBox>(nullptr, BasResId(IDS_SBERR_TERMINATED))->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + BasResId(IDS_SBERR_TERMINATED))); + xInfoBox->run(); bJustStopping = false; } } diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 5f53992360ff..fed8450f8d5b 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -28,7 +28,8 @@ #include <vcl/settings.hxx> #include <vcl/sound.hxx> #include <tools/wintypes.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/button.hxx> +#include <vcl/weld.hxx> #include <basic/sbx.hxx> #include <svl/zforlist.hxx> #include <rtl/character.hxx> @@ -4207,75 +4208,30 @@ void SbRtl_SavePicture(StarBASIC *, SbxArray & rPar, bool) void SbRtl_MsgBox(StarBASIC *, SbxArray & rPar, bool) { - static const MessBoxStyle nStyleMap[] = - { - MessBoxStyle::Ok, // MB_OK - MessBoxStyle::OkCancel, // MB_OKCANCEL - MessBoxStyle::AbortRetryIgnore, // MB_ABORTRETRYIGNORE - MessBoxStyle::YesNoCancel, // MB_YESNOCANCEL - MessBoxStyle::YesNo, // MB_YESNO - MessBoxStyle::RetryCancel // MB_RETRYCANCEL - }; - static const sal_Int16 nButtonMap[] = - { - 2, // RET_CANCEL is 0 - 1, // RET_OK is 1 - 6, // RET_YES is 2 - 7, // RET_NO is 3 - 4 // RET_RETRY is 4 - }; - - sal_uInt16 nArgCount = rPar.Count(); if( nArgCount < 2 || nArgCount > 6 ) { StarBASIC::Error( ERRCODE_BASIC_BAD_ARGUMENT ); return; } - MessBoxStyle nWinBits; WinBits nType = 0; // MB_OK if( nArgCount >= 3 ) nType = static_cast<WinBits>(rPar.Get(2)->GetInteger()); WinBits nStyle = nType; nStyle &= 15; // delete bits 4-16 - if( nStyle > 5 ) - { + if (nStyle > 5) nStyle = 0; - } - nWinBits = nStyleMap[ nStyle ]; - MessBoxStyle nWinDefBits = MessBoxStyle::DefaultOk | MessBoxStyle::DefaultRetry | MessBoxStyle::DefaultYes; - if( nType & 256 ) - { - if( nStyle == 5 ) - { - nWinDefBits = MessBoxStyle::DefaultCancel; - } - else if( nStyle == 2 ) - { - nWinDefBits = MessBoxStyle::DefaultRetry; - } - else - { - nWinDefBits = (MessBoxStyle::DefaultCancel | MessBoxStyle::DefaultRetry | MessBoxStyle::DefaultNo); - } - } - else if( nType & 512 ) + enum BasicResponse { - if( nStyle == 2) - { - nWinDefBits = MessBoxStyle::DefaultIgnore; - } - else - { - nWinDefBits = MessBoxStyle::DefaultCancel; - } - } - else if( nStyle == 2) - { - nWinDefBits = MessBoxStyle::DefaultCancel; - } - nWinBits |= nWinDefBits; + Ok = 1, + Cancel = 2, + Abort = 3, + Retry = 4, + Ignore = 5, + Yes = 6, + No = 7 + }; OUString aMsg = rPar.Get(1)->GetOUString(); OUString aTitle; @@ -4288,46 +4244,99 @@ void SbRtl_MsgBox(StarBASIC *, SbxArray & rPar, bool) aTitle = Application::GetDisplayName(); } - nType &= (16+32+64); - VclPtr<MessBox> pBox; + WinBits nDialogType = nType & (16+32+64); SolarMutexGuard aSolarGuard; + vcl::Window* pParentWin = Application::GetDefDialogParent(); + weld::Widget* pParent = pParentWin ? pParentWin->GetFrameWeld() : nullptr; - vcl::Window* pParent = Application::GetDefDialogParent(); - switch( nType ) - { - case 16: - pBox.reset(VclPtr<ErrorBox>::Create( pParent, nWinBits, aMsg )); - break; - case 32: - pBox.reset(VclPtr<QueryBox>::Create( pParent, nWinBits, aMsg )); - break; - case 48: - pBox.reset(VclPtr<WarningBox>::Create( pParent, nWinBits, aMsg )); - break; - case 64: - pBox.reset(VclPtr<InfoBox>::Create( pParent, nWinBits, aMsg )); - break; - default: - pBox.reset(VclPtr<MessBox>::Create( pParent, nWinBits, 0, aTitle, aMsg )); - } - pBox->SetText( aTitle ); - short nRet = pBox->Execute(); - sal_Int16 nMappedRet; - if( nStyle == 2 ) + VclMessageType eType = VclMessageType::Info; + + switch (nDialogType) { - nMappedRet = nRet; - if( nMappedRet == 0 ) - { - nMappedRet = 3; // Abort - } + case 16: + eType = VclMessageType::Error; + break; + case 32: + eType = VclMessageType::Question; + break; + case 48: + eType = VclMessageType::Warning; + break; + case 64: + default: + eType = VclMessageType::Info; + break; } - else + + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent, + eType, VclButtonsType::NONE, aMsg)); + + switch (nStyle) { - nMappedRet = nButtonMap[ nRet ]; + case 0: // MB_OK + default: + xBox->add_button(Button::GetStandardText(StandardButtonType::OK), BasicResponse::Ok); + break; + case 1: // MB_OKCANCEL + xBox->add_button(Button::GetStandardText(StandardButtonType::OK), BasicResponse::Ok); + xBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), BasicResponse::Cancel); + + if (nType & 256 || nType & 512) + xBox->set_default_response(BasicResponse::Cancel); + else + xBox->set_default_response(BasicResponse::Ok); + + break; + case 2: // MB_ABORTRETRYIGNORE + xBox->add_button(Button::GetStandardText(StandardButtonType::Abort), BasicResponse::Abort); + xBox->add_button(Button::GetStandardText(StandardButtonType::Retry), BasicResponse::Retry); + xBox->add_button(Button::GetStandardText(StandardButtonType::Ignore), BasicResponse::Ignore); + + if (nType & 256) + xBox->set_default_response(BasicResponse::Retry); + else if (nType & 512) + xBox->set_default_response(BasicResponse::Ignore); + else + xBox->set_default_response(BasicResponse::Cancel); + + break; + case 3: // MB_YESNOCANCEL + xBox->add_button(Button::GetStandardText(StandardButtonType::Yes), BasicResponse::Yes); + xBox->add_button(Button::GetStandardText(StandardButtonType::No), BasicResponse::No); + xBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), BasicResponse::Cancel); + + if (nType & 256 || nType & 512) + xBox->set_default_response(BasicResponse::Cancel); + else + xBox->set_default_response(BasicResponse::Yes); + + break; + case 4: // MB_YESNO + xBox->add_button(Button::GetStandardText(StandardButtonType::Yes), BasicResponse::Yes); + xBox->add_button(Button::GetStandardText(StandardButtonType::No), BasicResponse::No); + + if (nType & 256 || nType & 512) + xBox->set_default_response(BasicResponse::No); + else + xBox->set_default_response(BasicResponse::Yes); + + break; + case 5: // MB_RETRYCANCEL + xBox->add_button(Button::GetStandardText(StandardButtonType::Retry), BasicResponse::Retry); + xBox->add_button(Button::GetStandardText(StandardButtonType::Cancel), BasicResponse::Cancel); + + if (nType & 256 || nType & 512) + xBox->set_default_response(BasicResponse::Cancel); + else + xBox->set_default_response(BasicResponse::Retry); + + break; } - rPar.Get(0)->PutInteger( nMappedRet ); - pBox.disposeAndClear(); + + xBox->set_title(aTitle); + sal_Int16 nRet = xBox->run(); + rPar.Get(0)->PutInteger(nRet); } void SbRtl_SetAttr(StarBASIC *, SbxArray & rPar, bool) diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index 151b916b37be..d00f9e73a2dc 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -73,6 +73,7 @@ #include <vcl/svapp.hxx> #include <vcl/settings.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <rtl/math.hxx> #include <svtools/acceleratorexecute.hxx> @@ -1536,7 +1537,10 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) bReturn = executeDispatch_Delete(); if( ! bReturn ) { - ScopedVclPtrInstance<InfoBox>(pChartWindow, SchResId(STR_ACTION_NOTPOSSIBLE))->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pChartWindow ? pChartWindow->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SchResId(STR_ACTION_NOTPOSSIBLE))); + xInfoBox->run(); } } diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx index 94b02b86b56d..7d5ce9d4da6b 100644 --- a/cui/source/customize/cfg.cxx +++ b/cui/source/customize/cfg.cxx @@ -3478,7 +3478,7 @@ SvxIconChangeDialog::SvxIconChangeDialog( pLineEditDescription->set_width_request(aSize.Width()); pLineEditDescription->set_height_request(aSize.Height()); - pFImageInfo->SetImage(InfoBox::GetStandardImage()); + pFImageInfo->SetImage(GetStandardInfoBoxImage()); pLineEditDescription->SetControlBackground( GetSettings().GetStyleSettings().GetDialogColor() ); pLineEditDescription->SetText(aMessage); } diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index 95e611a313cb..2bc16dc0df0e 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -18,6 +18,7 @@ */ #include <memory> +#include <vcl/weld.hxx> #include <vcl/wrkwin.hxx> #include <vcl/menu.hxx> #include <vcl/layout.hxx> @@ -900,7 +901,7 @@ void SpellDialog::AddToDictionaryExecute( sal_uInt16 nItemId, PopupMenu const *p } if (DictionaryError::NONE != nAddRes) { - SvxDicError( this, nAddRes ); + SvxDicError(GetFrameWeld(), nAddRes); return; // don't continue } diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx index ef138dc257a2..7c64d613c1b6 100644 --- a/cui/source/dialogs/cuigaldlg.cxx +++ b/cui/source/dialogs/cuigaldlg.cxx @@ -25,7 +25,7 @@ #include <vcl/errinf.hxx> #include <ucbhelper/content.hxx> #include <vcl/svapp.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <vcl/weld.hxx> #include <avmedia/mediawindow.hxx> #include <unotools/pathoptions.hxx> @@ -562,8 +562,10 @@ IMPL_LINK_NOARG(GalleryIdDialog, ClickOkHdl, Button*, void) aStr += " (" + pInfo->GetThemeName() + ")"; - ScopedVclPtrInstance< InfoBox > aBox( this, aStr ); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + aStr)); + xInfoBox->run(); m_pLbResName->GrabFocus(); bDifferentThemeExists = true; } diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx index 27f576713467..eccc81553ebd 100644 --- a/cui/source/dialogs/multipat.cxx +++ b/cui/source/dialogs/multipat.cxx @@ -21,7 +21,8 @@ #include <osl/file.hxx> #include <tools/urlobj.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <sfx2/filedlghelper.hxx> #include <multipat.hxx> @@ -92,7 +93,9 @@ IMPL_LINK_NOARG(SvxMultiPathDialog, AddHdl_Impl, Button*, void) { OUString sMsg( CuiResId( RID_MULTIPATH_DBL_ERR ) ); sMsg = sMsg.replaceFirst( "%1", sInsPath ); - ScopedVclPtrInstance<InfoBox>(this, sMsg)->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, sMsg)); + xInfoBox->run(); } SelectHdl_Impl( nullptr ); @@ -116,7 +119,9 @@ IMPL_LINK_NOARG(SvxPathSelectDialog, AddHdl_Impl, Button*, void) { OUString sMsg( CuiResId( RID_MULTIPATH_DBL_ERR ) ); sMsg = sMsg.replaceFirst( "%1", sInsPath ); - ScopedVclPtrInstance<InfoBox>(this, sMsg)->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, sMsg)); + xInfoBox->run(); } else { diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx index 7b4e4ea5797e..30eb207acbc2 100644 --- a/cui/source/options/optdict.cxx +++ b/cui/source/options/optdict.cxx @@ -180,7 +180,7 @@ IMPL_LINK_NOARG(SvxNewDictionaryDialog, OKHdl_Impl, Button*, void) xNewDic = nullptr; // error: couldn't create new dictionary SfxErrorContext aContext( ERRCTX_SVX_LINGU_DICTIONARY, OUString(), - this, RID_SVXERRCTX, SvxResLocale() ); + GetFrameWeld(), RID_SVXERRCTX, SvxResLocale() ); ErrorHandler::HandleError( *new StringErrorInfo( ERRCODE_SVX_LINGU_DICT_NOTWRITEABLE, sDict ) ); EndDialog(); @@ -646,7 +646,7 @@ bool SvxEditDictionaryDialog::NewDelHdl(void const * pBtn) } } if (DictionaryError::NONE != nAddRes) - SvxDicError( this, nAddRes ); + SvxDicError(GetFrameWeld(), nAddRes); if(DictionaryError::NONE == nAddRes && !sEntry.isEmpty()) { diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index 877f2cfa6a95..8bfd3462b8c9 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -101,7 +101,7 @@ #include <unotools/viewoptions.hxx> #include <vcl/help.hxx> #include <vcl/layout.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <vcl/waitobj.hxx> #include <vcl/settings.hxx> #include <svtools/treelistentry.hxx> @@ -974,7 +974,10 @@ void OfaTreeOptionsDialog::SelectHdl_Impl() if(!pGroupInfo->m_pModule) { pGroupInfo->m_bLoadError = true; - ScopedVclPtrInstance<InfoBox>(pBox, sNotLoadedError)->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pBox->GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + sNotLoadedError)); + xInfoBox->run(); return; } if(bIdentical) diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx index ddf8dcb024b4..a89591b092de 100644 --- a/cui/source/tabpages/backgrnd.cxx +++ b/cui/source/tabpages/backgrnd.cxx @@ -880,7 +880,7 @@ void SvxBackgroundTabPage::RaiseLoadError_Impl() { SfxErrorContext aContext( ERRCTX_SVX_BACKGROUND, OUString(), - this, + GetFrameWeld(), RID_SVXERRCTX, SvxResLocale() ); diff --git a/dbaccess/source/ui/dlg/generalpage.cxx b/dbaccess/source/ui/dlg/generalpage.cxx index 28a79c048981..12b1e62f4fe9 100644 --- a/dbaccess/source/ui/dlg/generalpage.cxx +++ b/dbaccess/source/ui/dlg/generalpage.cxx @@ -29,7 +29,7 @@ #include <sfx2/filedlghelper.hxx> #include <sfx2/docfilt.hxx> #include <vcl/stdtext.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <svl/stritem.hxx> #include <vcl/waitobj.hxx> #include <com/sun/star/sdbc/XDriverAccess.hpp> @@ -717,8 +717,10 @@ namespace dbaui if ( aFileDlg.GetCurrentFilter() != pFilter->GetUIName() || !pFilter->GetWildcard().Matches(sPath) ) { OUString sMessage(DBA_RES(STR_ERR_USE_CONNECT_TO)); - ScopedVclPtrInstance< InfoBox > aError(this, sMessage); - aError->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + sMessage)); + xInfoBox->run(); m_pRB_ConnectDatabase->Check(); OnSetupModeSelected( m_pRB_ConnectDatabase ); return; diff --git a/dbaccess/source/ui/dlg/sqlmessage.cxx b/dbaccess/source/ui/dlg/sqlmessage.cxx index 469102a47886..315bae099e57 100644 --- a/dbaccess/source/ui/dlg/sqlmessage.cxx +++ b/dbaccess/source/ui/dlg/sqlmessage.cxx @@ -622,7 +622,7 @@ void OSQLMessageBox::Construct( MessBoxStyle _nStyle, MessageType _eImage ) OSL_FAIL( "OSQLMessageBox::impl_initImage: unsupported image type!" ); SAL_FALLTHROUGH; case Info: - m_aInfoImage->SetImage(InfoBox::GetStandardImage()); + m_aInfoImage->SetImage(GetStandardInfoBoxImage()); break; case Warning: m_aInfoImage->SetImage(WarningBox::GetStandardImage()); diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index 5351959eceb8..8937943db748 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -36,7 +36,7 @@ #include <com/sun/star/container/XNameAccess.hpp> #include <stringconstants.hxx> #include "QTableWindow.hxx" -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <vcl/settings.hxx> #include "QueryDesignFieldUndoAct.hxx" #include <sqlmessage.hxx> @@ -523,7 +523,10 @@ void OSelectionBrowseBox::InitController(CellControllerRef& /*rController*/, lon m_pVisibleCell->GetBox().EnableInput(false); OUString aMessage(DBA_RES(STR_QRY_ORDERBY_UNRELATED)); OQueryDesignView* paDView = getDesignView(); - ScopedVclPtrInstance<InfoBox>(paDView, aMessage)->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(paDView ? paDView->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + aMessage)); + xInfoBox->run(); } } break; case BROW_ORDER_ROW: diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx index 297fbf7a98dd..3dbdadb6af22 100644 --- a/editeng/source/editeng/editdbg.cxx +++ b/editeng/source/editeng/editdbg.cxx @@ -21,7 +21,7 @@ #include <memory> #include <vcl/wrkwin.hxx> #include <vcl/dialog.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <vcl/svapp.hxx> #include <editeng/lspcitem.hxx> @@ -482,7 +482,12 @@ void EditDbg::ShowEditEngineData( EditEngine* pEE, bool bInfoBox ) } fclose( fp ); if ( bInfoBox ) - ScopedVclPtrInstance<InfoBox>(nullptr, OUString( "D:\\DEBUG.LOG !" ) )->Execute(); + { + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + "D:\\DEBUG.LOG !" )); + xInfoBox->run(); + } } #endif diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index a822a23406ef..0e5fdd3e596a 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -21,7 +21,7 @@ #include <comphelper/lok.hxx> #include <vcl/wrkwin.hxx> #include <vcl/dialog.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <vcl/svapp.hxx> #include <svtools/ctrltool.hxx> @@ -1042,7 +1042,11 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v bDebugPaint = !bDebugPaint; OStringBuffer aInfo("DebugPaint: "); aInfo.append(bDebugPaint ? "On" : "Off"); - ScopedVclPtrInstance<InfoBox>(nullptr, OStringToOUString(aInfo.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US))->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + OStringToOUString(aInfo.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US))); + xInfoBox->run(); + } bDone = false; } diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx index 57c03f20d26a..6263a0db5398 100644 --- a/editeng/source/misc/unolingu.cxx +++ b/editeng/source/misc/unolingu.cxx @@ -44,8 +44,8 @@ #include <unotools/localfilehelper.hxx> #include <ucbhelper/commandenvironment.hxx> #include <ucbhelper/content.hxx> -#include <vcl/msgbox.hxx> #include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <linguistic/misc.hxx> #include <editeng/eerdll.hxx> #include <editeng/editrids.hrc> @@ -727,7 +727,7 @@ SvxDicListChgClamp::~SvxDicListChgClamp() } } -short SvxDicError( vcl::Window *pParent, linguistic::DictionaryError nError ) +short SvxDicError(weld::Window *pParent, linguistic::DictionaryError nError) { short nRes = 0; if (linguistic::DictionaryError::NONE != nError) @@ -741,7 +741,11 @@ short SvxDicError( vcl::Window *pParent, linguistic::DictionaryError nError ) pRid = RID_SVXSTR_DIC_ERR_UNKNOWN; SAL_WARN("editeng", "unexpected case"); } - nRes = ScopedVclPtrInstance<InfoBox>(pParent, EditResId(pRid))->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pParent, + VclMessageType::Info, VclButtonsType::Ok, + EditResId(pRid))); + nRes = xInfoBox->run(); + } return nRes; } diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx index 539e5be292d6..6b19672c004b 100644 --- a/extensions/source/propctrlr/propcontroller.cxx +++ b/extensions/source/propctrlr/propcontroller.cxx @@ -42,7 +42,7 @@ #include <toolkit/awt/vclxwindow.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <comphelper/property.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <vcl/svapp.hxx> #include <vcl/tabpage.hxx> #include <osl/mutex.hxx> @@ -1376,7 +1376,10 @@ namespace pcr } catch(const PropertyVetoException& eVetoException) { - ScopedVclPtrInstance<InfoBox>(m_pView, eVetoException.Message)->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_pView ? m_pView->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + eVetoException.Message)); + xInfoBox->run(); PropertyHandlerRef handler = impl_getHandlerForProperty_throw( rName ); Any aNormalizedValue = handler->getPropertyValue( rName ); getPropertyBox().SetPropertyValue( rName, aNormalizedValue, false ); diff --git a/extensions/source/update/ui/updatecheckui.cxx b/extensions/source/update/ui/updatecheckui.cxx index 82e8e55a750a..b633fa7d2b58 100644 --- a/extensions/source/update/ui/updatecheckui.cxx +++ b/extensions/source/update/ui/updatecheckui.cxx @@ -269,7 +269,7 @@ Image UpdateCheckUI::GetBubbleImage( OUString const &rURL ) } if ( aImage.GetSizePixel().Width() == 0 ) - aImage = InfoBox::GetStandardImage(); + aImage = GetStandardInfoBoxImage(); return aImage; } @@ -777,7 +777,6 @@ void BubbleWindow::Paint(vcl::RenderContext& /*rRenderContext*/, const tools::Re aThickLine ); SetLineColor( aOldLine ); - //Image aImage = InfoBox::GetStandardImage(); Size aImgSize = maBubbleImage.GetSizePixel(); DrawImage( Point( BUBBLE_BORDER, BUBBLE_BORDER + TIP_HEIGHT ), maBubbleImage ); @@ -820,7 +819,6 @@ void BubbleWindow::Show( bool bVisible, ShowFlags nFlags ) Size aWindowSize = GetSizePixel(); - // Image aImage = InfoBox::GetStandardImage(); Size aImgSize = maBubbleImage.GetSizePixel(); RecalcTextRects(); diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx index 4a47345a14b5..8dc125837701 100644 --- a/filter/source/graphicfilter/eps/eps.cxx +++ b/filter/source/graphicfilter/eps/eps.cxx @@ -39,6 +39,7 @@ #include <vcl/fltcall.hxx> #include <vcl/FilterConfigItem.hxx> #include <vcl/graphictools.hxx> +#include <vcl/weld.hxx> #include <strings.hrc> #include <math.h> @@ -439,8 +440,10 @@ bool PSWriter::WritePS( const Graphic& rGraphic, SvStream& rTargetStream, Filter if ( mbStatus && mnLevelWarning && pFilterConfigItem ) { std::locale loc = Translate::Create("flt"); - ScopedVclPtrInstance< InfoBox > aInfoBox(nullptr, Translate::get(KEY_VERSION_CHECK, loc)); - aInfoBox->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + Translate::get(KEY_VERSION_CHECK, loc))); + xInfoBox->run(); } if ( xStatusIndicator.is() ) diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx index 80023a48e089..88918bcdac29 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx @@ -30,9 +30,10 @@ #include <unotools/pathoptions.hxx> #include <osl/file.hxx> #include <o3tl/enumrange.hxx> +#include <vcl/builderfactory.hxx> #include <vcl/msgbox.hxx> #include <vcl/svapp.hxx> -#include <vcl/builderfactory.hxx> +#include <vcl/weld.hxx> #include <sfx2/filedlghelper.hxx> #include <svtools/treelistentry.hxx> @@ -902,8 +903,10 @@ void XMLFilterSettingsDialog::onSave() aMsg = aMsg.replaceFirst( sPlaceholder, aURL.GetName() ); } - ScopedVclPtrInstance< InfoBox > aBox(this, aMsg ); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + aMsg)); + xInfoBox->run(); } } @@ -967,8 +970,10 @@ void XMLFilterSettingsDialog::onOpen() aMsg = aMsg.replaceFirst( sPlaceholder, OUString::number( nFilters ) ); } - ScopedVclPtrInstance< InfoBox > aBox(this, aMsg ); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + aMsg)); + xInfoBox->run(); } } diff --git a/include/editeng/unolingu.hxx b/include/editeng/unolingu.hxx index 78807780da17..4575e201d5ac 100644 --- a/include/editeng/unolingu.hxx +++ b/include/editeng/unolingu.hxx @@ -34,7 +34,7 @@ class LinguMgrExitLstnr; -namespace vcl { class Window; } +namespace weld { class Window; } namespace linguistic { enum class DictionaryError; } @@ -125,7 +125,7 @@ public: ~SvxDicListChgClamp(); }; -EDITENG_DLLPUBLIC short SvxDicError( vcl::Window *pParent, linguistic::DictionaryError nError ); +EDITENG_DLLPUBLIC short SvxDicError(weld::Window *pParent, linguistic::DictionaryError nError); #endif diff --git a/include/svtools/ehdl.hxx b/include/svtools/ehdl.hxx index 2042d70184eb..2efbb761f4ba 100644 --- a/include/svtools/ehdl.hxx +++ b/include/svtools/ehdl.hxx @@ -29,16 +29,16 @@ typedef std::pair<const char*, ErrCode> ErrMsgCode; SVT_DLLPUBLIC extern const ErrMsgCode RID_ERRHDL[]; SVT_DLLPUBLIC extern const ErrMsgCode RID_ERRCTX[]; -namespace vcl { class Window; } +namespace weld { class Window; } class SVT_DLLPUBLIC SfxErrorContext : private ErrorContext { public: SfxErrorContext( - sal_uInt16 nCtxIdP, vcl::Window *pWin=nullptr, + sal_uInt16 nCtxIdP, weld::Window *pWin=nullptr, const ErrMsgCode* pIds = nullptr, const std::locale& rResLocaleP = SvtResLocale()); SfxErrorContext( - sal_uInt16 nCtxIdP, const OUString &aArg1, vcl::Window *pWin=nullptr, + sal_uInt16 nCtxIdP, const OUString &aArg1, weld::Window *pWin=nullptr, const ErrMsgCode* pIds = nullptr, const std::locale& rResLocaleP = SvtResLocale()); bool GetString(ErrCode nErrId, OUString &rStr) override; diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx index d9d500051116..bb66872e786d 100644 --- a/include/vcl/builder.hxx +++ b/include/vcl/builder.hxx @@ -126,12 +126,10 @@ private: { OString m_sID; VclPtr<vcl::Window> m_pWindow; - short m_nResponseId; PackingData m_aPackingData; WinAndId(const OString &rId, vcl::Window *pWindow, bool bVertical) : m_sID(rId) , m_pWindow(pWindow) - , m_nResponseId(RET_CANCEL) , m_aPackingData(bVertical) { } diff --git a/include/vcl/dialog.hxx b/include/vcl/dialog.hxx index 24e0dfd7378f..8695cc4fa632 100644 --- a/include/vcl/dialog.hxx +++ b/include/vcl/dialog.hxx @@ -29,6 +29,7 @@ #include <vcl/abstdlg.hxx> struct DialogImpl; +class PushButton; class VclBox; class VclButtonBox; @@ -69,7 +70,8 @@ private: SAL_DLLPRIVATE Dialog (const Dialog &) = delete; SAL_DLLPRIVATE Dialog & operator= (const Dialog &) = delete; - DECL_DLLPRIVATE_LINK( ImplAsyncCloseHdl, void*, void ); + DECL_DLLPRIVATE_LINK(ImplAsyncCloseHdl, void*, void); + DECL_DLLPRIVATE_LINK(ResponseHdl, Button*, void); protected: using Window::ImplInit; @@ -78,6 +80,7 @@ protected: public: SAL_DLLPRIVATE bool IsInClose() const { return mbInClose; } virtual void doDeferredInit(WinBits nBits) override; + SAL_DLLPRIVATE void disposeOwnedButtons(); protected: explicit Dialog( WindowType nType ); @@ -170,6 +173,9 @@ public: void GrabFocusToFirstControl(); virtual void Resize() override; + + void add_button(PushButton* pButton, int nResponse, bool bTransferOwnership); + void set_default_response(int nResponse); }; class VCL_DLLPUBLIC ModelessDialog : public Dialog diff --git a/include/vcl/errinf.hxx b/include/vcl/errinf.hxx index f4edc53d46fd..95e16213981b 100644 --- a/include/vcl/errinf.hxx +++ b/include/vcl/errinf.hxx @@ -31,6 +31,7 @@ #include <limits.h> namespace vcl { class Window; } +namespace weld { class Window; } class ErrorHandler; class ErrorContext; @@ -43,7 +44,7 @@ enum class DialogMask; typedef void (* DisplayFnPtr)(); typedef DialogMask WindowDisplayErrorFunc( - vcl::Window*, DialogMask eMask, const OUString &rErr, const OUString &rAction); + weld::Window*, DialogMask eMask, const OUString &rErr, const OUString &rAction); typedef void BasicDisplayErrorFunc( const OUString &rErr, const OUString &rAction); @@ -99,7 +100,7 @@ namespace o3tl } typedef DialogMask WindowDisplayErrorFunc( - vcl::Window*, DialogMask nMask, const OUString &rErr, const OUString &rAction); + weld::Window*, DialogMask nMask, const OUString &rErr, const OUString &rAction); typedef void BasicDisplayErrorFunc( const OUString &rErr, const OUString &rAction); @@ -128,7 +129,7 @@ public: @return what sort of dialog to use, with what buttons */ - static DialogMask HandleError(ErrCode nId, vcl::Window* pParent = nullptr, DialogMask nMask = DialogMask::MAX); + static DialogMask HandleError(ErrCode nId, weld::Window* pParent = nullptr, DialogMask nMask = DialogMask::MAX); static bool GetErrorString(ErrCode nId, OUString& rStr); protected: @@ -204,11 +205,11 @@ class SAL_WARN_UNUSED VCL_DLLPUBLIC ErrorContext friend class ErrorHandler; public: - ErrorContext(vcl::Window *pWin); + ErrorContext(weld::Window *pWin); virtual ~ErrorContext(); virtual bool GetString(ErrCode nErrId, OUString& rCtxStr) = 0; - vcl::Window* GetParent(); + weld::Window* GetParent(); static ErrorContext* GetContext(); diff --git a/include/vcl/messagedialog.hxx b/include/vcl/messagedialog.hxx index 6de75a9fb9a6..1cce2f41009e 100644 --- a/include/vcl/messagedialog.hxx +++ b/include/vcl/messagedialog.hxx @@ -26,13 +26,8 @@ private: VclPtr<FixedImage> m_pImage; VclPtr<VclMultiLineEdit> m_pPrimaryMessage; VclPtr<VclMultiLineEdit> m_pSecondaryMessage; - std::vector<VclPtr<PushButton>> m_aOwnedButtons; - std::map<VclPtr<const vcl::Window>, short> m_aResponses; OUString m_sPrimaryString; OUString m_sSecondaryString; - DECL_DLLPRIVATE_LINK(ButtonHdl, Button*, void); - void setButtonHandlers(VclButtonBox const* pButtonBox); - short get_response(const vcl::Window* pWindow) const; void create_owned_areas(); friend class VclPtr<MessageDialog>; @@ -45,8 +40,6 @@ public: 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; - ///Emitted when an action widget is clicked - virtual void response(short nResponseId); OUString const& get_primary_text() const; OUString const& get_secondary_text() const; void set_primary_text(const OUString& rPrimaryString); diff --git a/include/vcl/msgbox.hxx b/include/vcl/msgbox.hxx index 7c982cc5a996..203d3ea36d80 100644 --- a/include/vcl/msgbox.hxx +++ b/include/vcl/msgbox.hxx @@ -88,16 +88,8 @@ public: virtual Size GetOptimalSize() const override; }; -class VCL_DLLPUBLIC InfoBox : public MessBox -{ -public: - InfoBox( vcl::Window* pParent, const OUString& rMessage ); - InfoBox( vcl::Window* pParent, MessBoxStyle nStyle, - const OUString& rMessage ); - - static Image const & GetStandardImage(); - static OUString GetStandardText(); -}; +VCL_DLLPUBLIC Image const & GetStandardInfoBoxImage(); +VCL_DLLPUBLIC OUString GetStandardInfoBoxText(); class VCL_DLLPUBLIC WarningBox : public MessBox { diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index bfc6a7e10214..69674ab9ba17 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -96,6 +96,8 @@ class VCL_DLLPUBLIC Dialog : virtual public Window public: virtual int run() = 0; virtual void response(int response) = 0; + virtual void add_button(const OUString& rText, int response) = 0; + virtual void set_default_response(int response) = 0; }; class VCL_DLLPUBLIC MessageDialog : virtual public Dialog diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index 0bafb21b85ca..c806f05aae6e 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -73,7 +73,8 @@ #include <tools/debug.hxx> #include <tools/diagnose_ex.h> #include <svl/zforlist.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <utility> #include <vector> @@ -3308,8 +3309,10 @@ uno::Reference<sdbc::XRowSet> ScDPCollection::DBCaches::createRowSet( catch ( const sdbc::SQLException& rError ) { //! store error message - ScopedVclPtrInstance< InfoBox > aInfoBox( nullptr, rError.Message ); - aInfoBox->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + rError.Message)); + xInfoBox->run(); } catch ( uno::Exception& ) { diff --git a/sc/source/ui/dbgui/consdlg.cxx b/sc/source/ui/dbgui/consdlg.cxx index 7d1ccc0f6b33..0e3e09839892 100644 --- a/sc/source/ui/dbgui/consdlg.cxx +++ b/sc/source/ui/dbgui/consdlg.cxx @@ -32,9 +32,19 @@ #include <strings.hrc> #include <consdlg.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> -#define INFOBOX(id) ScopedVclPtrInstance<InfoBox>(this, ScGlobal::GetRscString(id))->Execute() +namespace +{ + void INFOBOX(weld::Window* pWindow, const char* id) + { + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWindow, + VclMessageType::Info, VclButtonsType::Ok, + ScGlobal::GetRscString(id))); + xInfoBox->run(); + } +} class ScAreaData { @@ -406,7 +416,7 @@ IMPL_LINK_NOARG(ScConsolidateDlg, OkHdl, Button*, void) } else { - INFOBOX( STR_INVALID_TABREF ); + INFOBOX(GetFrameWeld(), STR_INVALID_TABREF); pEdDestArea->GrabFocus(); } } @@ -461,11 +471,11 @@ IMPL_LINK( ScConsolidateDlg, ClickHdl, Button*, pBtn, void ) if ( pLbConsAreas->GetEntryPos( aNewArea ) == LISTBOX_ENTRY_NOTFOUND ) pLbConsAreas->InsertEntry( aNewArea ); else - INFOBOX( STR_AREA_ALREADY_INSERTED ); + INFOBOX(GetFrameWeld(), STR_AREA_ALREADY_INSERTED); } else { - INFOBOX( STR_INVALID_TABREF ); + INFOBOX(GetFrameWeld(), STR_INVALID_TABREF); pEdDataArea->GrabFocus(); } } diff --git a/sc/source/ui/dbgui/scendlg.cxx b/sc/source/ui/dbgui/scendlg.cxx index b914ed2609a7..77eb9ba6f610 100644 --- a/sc/source/ui/dbgui/scendlg.cxx +++ b/sc/source/ui/dbgui/scendlg.cxx @@ -26,7 +26,7 @@ #include <svx/xtable.hxx> #include <sfx2/objsh.hxx> #include <unotools/useroptions.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <unotools/localedatawrapper.hxx> #include <global.hxx> @@ -151,12 +151,18 @@ IMPL_LINK_NOARG(ScNewScenarioDlg, OkHdl, Button*, void) if ( !ScDocument::ValidTabName( aName ) ) { - ScopedVclPtrInstance<InfoBox>(this, ScGlobal::GetRscString(STR_INVALIDTABNAME))->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_INVALIDTABNAME))); + xInfoBox->run(); m_pEdName->GrabFocus(); } else if ( !bIsEdit && !pDoc->ValidNewTabName( aName ) ) { - ScopedVclPtrInstance<InfoBox>(this, ScGlobal::GetRscString(STR_NEWTABNAMENOTUNIQUE))->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_NEWTABNAMENOTUNIQUE))); + xInfoBox->run(); m_pEdName->GrabFocus(); } else diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx index 63ea2ad325f0..e9ce36f11ac9 100644 --- a/sc/source/ui/docshell/arealink.cxx +++ b/sc/source/ui/docshell/arealink.cxx @@ -23,7 +23,7 @@ #include <sfx2/fcontnr.hxx> #include <sfx2/linkmgr.hxx> #include <svl/stritem.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <arealink.hxx> @@ -463,9 +463,11 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter, //! Link dialog must set default parent // "cannot insert rows" - ScopedVclPtrInstance<InfoBox> aBox( Application::GetDefDialogParent(), - ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_2 ) ); - aBox->Execute(); + vcl::Window* pWin = Application::GetDefDialogParent(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_MSSG_DOSUBTOTALS_2))); + xInfoBox->run(); } // clean up diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index 50e0f5b514e6..1c413903a35a 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -19,6 +19,7 @@ #include <sfx2/app.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <vcl/waitobj.hxx> #include <svx/dataaccessdescriptor.hxx> #include <svx/svdpage.hxx> @@ -1670,9 +1671,11 @@ void ScDBDocFunc::UpdateImport( const OUString& rTarget, const svx::ODataAccessD const ScDBData* pData = rDBColl.getNamedDBs().findByUpperName(ScGlobal::pCharClass->uppercase(rTarget)); if (!pData) { - ScopedVclPtrInstance<InfoBox> aInfoBox( ScDocShell::GetActiveDialogParent(), - ScGlobal::GetRscString( STR_TARGETNOTFOUND ) ); - aInfoBox->Execute(); + vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_TARGETNOTFOUND))); + xInfoBox->run(); return; } diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx index d83fb8be69f4..ad0481942934 100644 --- a/sc/source/ui/docshell/dbdocimp.cxx +++ b/sc/source/ui/docshell/dbdocimp.cxx @@ -20,7 +20,7 @@ #include <vcl/errinf.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/types.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <svx/dataaccessdescriptor.hxx> #include <sfx2/viewfrm.hxx> @@ -616,8 +616,11 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, pErrStringId = STR_MSSG_IMPORTDATA_0; aErrorMessage = ScGlobal::GetRscString(pErrStringId); } - ScopedVclPtrInstance< InfoBox > aInfoBox( ScDocShell::GetActiveDialogParent(), aErrorMessage ); - aInfoBox->Execute(); + vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + aErrorMessage)); + xInfoBox->run(); } delete pImportDoc; diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 430da19d4fa8..4ac78e1b67a0 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -25,6 +25,7 @@ #include <sfx2/linkmgr.hxx> #include <sfx2/bindings.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <vcl/virdev.hxx> #include <vcl/waitobj.hxx> #include <svl/PasswordHelper.hxx> @@ -394,8 +395,10 @@ bool ScDocFunc::DetectiveMarkInvalid(SCTAB nTab) aModificator.SetDocumentModified(); if ( bOverflow ) { - ScopedVclPtrInstance<InfoBox>( nullptr, - ScGlobal::GetRscString( STR_DETINVALID_OVERFLOW ) )->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_DETINVALID_OVERFLOW))); + xInfoBox->run(); } } else @@ -3911,8 +3914,11 @@ bool ScDocFunc::Unprotect( SCTAB nTab, const OUString& rPassword, bool bApi ) { if (!bApi) { - ScopedVclPtrInstance< InfoBox > aBox( ScDocShell::GetActiveDialogParent(), ScResId( SCSTR_WRONGPASSWORD ) ); - aBox->Execute(); + vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + ScResId(SCSTR_WRONGPASSWORD))); + xInfoBox->run(); } return false; } @@ -3941,8 +3947,11 @@ bool ScDocFunc::Unprotect( SCTAB nTab, const OUString& rPassword, bool bApi ) { if (!bApi) { - ScopedVclPtrInstance< InfoBox > aBox( ScDocShell::GetActiveDialogParent(), ScResId( SCSTR_WRONGPASSWORD ) ); - aBox->Execute(); + vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + ScResId(SCSTR_WRONGPASSWORD))); + xInfoBox->run(); } return false; } diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index 8eae0400beee..f13a23113498 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -34,6 +34,7 @@ #include <unotools/misccfg.hxx> #include <vcl/virdev.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <docsh.hxx> #include "docshimp.hxx" @@ -1317,8 +1318,11 @@ bool ScDocShell::MergeSharedDocument( ScDocShell* pSharedDocShell ) PostPaintExtras(); PostPaintGridAll(); - ScopedVclPtrInstance< InfoBox > aInfoBox( GetActiveDialogParent(), ScGlobal::GetRscString( STR_DOC_UPDATED ) ); - aInfoBox->Execute(); + vcl::Window* pWin = GetActiveDialogParent(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_DOC_UPDATED))); + xInfoBox->run(); } return ( pThisAction != nullptr ); diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 8721cecc6a97..749ec29784a7 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -44,6 +44,7 @@ using namespace ::com::sun::star; #include <svx/ofaitem.hxx> #include <svl/whiter.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <vcl/waitobj.hxx> #include <svx/dataaccessdescriptor.hxx> #include <svx/drawitem.hxx> @@ -1293,9 +1294,11 @@ bool ScDocShell::ExecuteChangeProtectionDialog( bool bJustQueryIfProtected ) } else { - ScopedVclPtrInstance<InfoBox> aBox( GetActiveDialogParent(), - ScResId( SCSTR_WRONGPASSWORD ) ); - aBox->Execute(); + vcl::Window* pWin = ScDocShell::GetActiveDialogParent(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + ScResId(SCSTR_WRONGPASSWORD))); + xInfoBox->run(); } } else @@ -1629,10 +1632,12 @@ void ScDocShell::PageStyleModified( const OUString& rStyleName, bool bApi ) if (bWarn && !bApi) { - ScWaitCursorOff aWaitOff( GetActiveDialogParent() ); - ScopedVclPtrInstance<InfoBox> aInfoBox(GetActiveDialogParent(), - ScGlobal::GetRscString(STR_PRINT_INVALID_AREA)); - aInfoBox->Execute(); + vcl::Window* pWin = GetActiveDialogParent(); + ScWaitCursorOff aWaitOff(pWin); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_PRINT_INVALID_AREA))); + xInfoBox->run(); } } diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx index d55f0f29f9c5..8b1730af3a0d 100644 --- a/sc/source/ui/docshell/docsh5.cxx +++ b/sc/source/ui/docshell/docsh5.cxx @@ -23,7 +23,7 @@ #include <cassert> #include <scitems.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <vcl/waitobj.hxx> #include <sfx2/app.hxx> #include <sfx2/bindings.hxx> @@ -82,8 +82,11 @@ void ScDocShell::ErrorMessage(const char* pGlobStrId) } } - ScopedVclPtrInstance< InfoBox > aBox( pParent, ScGlobal::GetRscString(pGlobStrId)); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + ScGlobal::GetRscString(pGlobStrId))); + xInfoBox->run(); + if (bFocus) pParent->GrabFocus(); } @@ -519,9 +522,11 @@ void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, bool bRecord ) if (bErr) { - ScopedVclPtrInstance<InfoBox> aBox( GetActiveDialogParent(), - ScGlobal::GetRscString( STR_CONSOLIDATE_ERR1 ) ); - aBox->Execute(); + vcl::Window* pWin = GetActiveDialogParent(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_CONSOLIDATE_ERR1))); + xInfoBox->run(); return; } @@ -729,16 +734,20 @@ void ScDocShell::UseScenario( SCTAB nTab, const OUString& rName, bool bRecord ) } else { - ScopedVclPtrInstance<InfoBox> aBox( GetActiveDialogParent(), - ScGlobal::GetRscString( STR_PROTECTIONERR ) ); - aBox->Execute(); + vcl::Window* pWin = GetActiveDialogParent(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_PROTECTIONERR))); + xInfoBox->run(); } } else { - ScopedVclPtrInstance<InfoBox> aBox(GetActiveDialogParent(), - ScGlobal::GetRscString( STR_SCENARIO_NOTFOUND ) ); - aBox->Execute(); + vcl::Window* pWin = GetActiveDialogParent(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_SCENARIO_NOTFOUND))); + xInfoBox->run(); } } else diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx index 508ea9f5b882..8e3a28280e2a 100644 --- a/sc/source/ui/docshell/docsh6.cxx +++ b/sc/source/ui/docshell/docsh6.cxx @@ -37,7 +37,8 @@ #include <interpre.hxx> #include <calcconfig.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <memory> #include <utility> @@ -499,8 +500,10 @@ void ScDocShell::CheckConfigOptions() if (pViewShell) { vcl::Window* pParent = pViewShell->GetFrameWin(); - ScopedVclPtrInstance< InfoBox > aBox(pParent, ScGlobal::GetRscString(STR_OPTIONS_WARN_SEPARATORS)); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_OPTIONS_WARN_SEPARATORS))); + xInfoBox->run(); } // For now, this is the only option setting that could launch info diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 146c097626e1..e39abc0dc479 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -57,6 +57,7 @@ #include <tools/svlibrary.h> #include <unotools/configmgr.hxx> #include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <memory> #include <osl/endian.h> @@ -227,9 +228,11 @@ bool ScImportExport::StartPaste() ScEditableTester aTester( pDoc, aRange ); if ( !aTester.IsEditable() ) { - ScopedVclPtrInstance<InfoBox> aInfoBox( Application::GetDefDialogParent(), - ScGlobal::GetRscString( aTester.GetMessageId() ) ); - aInfoBox->Execute(); + vcl::Window* pWin = Application::GetDefDialogParent(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + ScGlobal::GetRscString(aTester.GetMessageId()))); + xInfoBox->run(); return false; } } diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx index 4eb077076728..52e671bcb33d 100644 --- a/sc/source/ui/optdlg/tpusrlst.cxx +++ b/sc/source/ui/optdlg/tpusrlst.cxx @@ -420,7 +420,10 @@ void ScTpUserLists::CopyListFromArea( const ScRefAddress& rStartPos, if ( bValueIgnored ) { - ScopedVclPtrInstance<InfoBox>(this, aStrCopyErr)->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + aStrCopyErr)); + xInfoBox->run(); } } diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 99227a5dbd7f..f24c6b4c60a6 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -35,6 +35,7 @@ #include <sfx2/dispatch.hxx> #include <sfx2/request.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <svx/svxdlg.hxx> #include <sot/formats.hxx> #include <svx/postattr.hxx> @@ -2960,8 +2961,11 @@ void ScCellShell::ExecuteDataPilotDialog() if (pSrcErrorId) { // Error occurred during data creation. Launch an error and bail out. - ScopedVclPtrInstance< InfoBox > aBox(pTabViewShell->GetDialogParent(), ScGlobal::GetRscString(pSrcErrorId)); - aBox->Execute(); + vcl::Window* pWin = pTabViewShell->GetDialogParent(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + ScGlobal::GetRscString(pSrcErrorId))); + xInfoBox->run(); return; } diff --git a/sc/source/ui/view/spelleng.cxx b/sc/source/ui/view/spelleng.cxx index 15fedc1f9733..9e39ea9dfa61 100644 --- a/sc/source/ui/view/spelleng.cxx +++ b/sc/source/ui/view/spelleng.cxx @@ -27,9 +27,10 @@ #include <editeng/editobj.hxx> #include <editeng/editview.hxx> #include <sfx2/viewfrm.hxx> -#include <vcl/msgbox.hxx> -#include <vcl/svapp.hxx> #include <vcl/settings.hxx> +#include <vcl/svapp.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <spelldialog.hxx> #include <tabvwsh.hxx> @@ -316,7 +317,10 @@ void ScSpellingEngine::ShowFinishDialog() { vcl::Window* pParent = GetDialogParent(); ScWaitCursorOff aWaitOff( pParent ); - ScopedVclPtrInstance<InfoBox>( pParent, ScGlobal::GetRscString( STR_SPELLING_STOP_OK ) )->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + ScGlobal::GetRscString(STR_SPELLING_STOP_OK))); + xInfoBox->run(); } vcl::Window* ScSpellingEngine::GetDialogParent() diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index 17d562836124..4aa52f586910 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -20,7 +20,7 @@ #include <scitems.hxx> #include <editeng/eeitem.hxx> #include <vcl/timer.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <sfx2/app.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/bindings.hxx> @@ -1434,8 +1434,11 @@ void ScTabView::ErrorMessage(const char* pGlobStrId) } } - ScopedVclPtrInstance<InfoBox> aBox(pParent, ScGlobal::GetRscString(pGlobStrId)); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + ScGlobal::GetRscString(pGlobStrId))); + xInfoBox->run(); + if (bFocus) pParent->GrabFocus(); } diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index f59e4b25db5c..78bdd8eb7cc2 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -41,7 +41,7 @@ #include <svtools/transfer.hxx> #include <svl/urlbmk.hxx> #include <svl/sharedstringpool.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <avmedia/mediawindow.hxx> #include <comphelper/storagehelper.hxx> @@ -399,8 +399,12 @@ void ScViewFunc::DoThesaurus() LanguageType eLnge = ScViewUtil::GetEffLanguage( &rDoc, ScAddress( nCol, nRow, nTab ) ); OUString aErr = SvtLanguageTable::GetLanguageString(eLnge); aErr += ScGlobal::GetRscString( STR_SPELLING_NO_LANG ); - ScopedVclPtrInstance< InfoBox > aBox( GetViewData().GetDialogParent(), aErr ); - aBox->Execute(); + + vcl::Window* pWin = GetViewData().GetDialogParent(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + aErr)); + xInfoBox->run(); } if (pThesaurusEngine->IsModified()) { diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx b/sd/source/ui/dlg/PhotoAlbumDialog.cxx index 18978ee448c8..adf5a386ee9f 100644 --- a/sd/source/ui/dlg/PhotoAlbumDialog.cxx +++ b/sd/source/ui/dlg/PhotoAlbumDialog.cxx @@ -26,6 +26,7 @@ #include <officecfg/Office/Impress.hxx> #include <svx/svdview.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <svx/unoshape.hxx> #include <svx/xfltrit.hxx> #include <svx/xfillit.hxx> @@ -490,8 +491,10 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl, Button*, void) } else { - ScopedVclPtrInstance< InfoBox > aInfo(this, OUString("Function is not implemented!")); - aInfo->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + "Function is not implemented!")); + xInfoBox->run(); } EndDialog(); } diff --git a/sd/source/ui/func/fudraw.cxx b/sd/source/ui/func/fudraw.cxx index 8d507f4302e1..f25836ae459d 100644 --- a/sd/source/ui/func/fudraw.cxx +++ b/sd/source/ui/func/fudraw.cxx @@ -58,7 +58,7 @@ #include <drawview.hxx> #include <fusel.hxx> #include <svl/aeitem.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <slideshow.hxx> #include <svx/sdrhittesthelper.hxx> @@ -339,7 +339,10 @@ bool FuDraw::KeyInput(const KeyEvent& rKEvt) { if (mpView->IsPresObjSelected(false, true, false, true)) { - ScopedVclPtrInstance<InfoBox>(mpWindow, SdResId(STR_ACTION_NOTPOSSIBLE))->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(mpWindow->GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SdResId(STR_ACTION_NOTPOSSIBLE))); + xInfoBox->run(); } else { diff --git a/sd/source/ui/func/futhes.cxx b/sd/source/ui/func/futhes.cxx index ad1907648d2c..02fca91226bb 100644 --- a/sd/source/ui/func/futhes.cxx +++ b/sd/source/ui/func/futhes.cxx @@ -67,7 +67,7 @@ rtl::Reference<FuPoor> FuThesaurus::Create( ViewShell* pViewSh, ::sd::Window* pW void FuThesaurus::DoExecute( SfxRequest& ) { SfxErrorContext aContext(ERRCTX_SVX_LINGU_THESAURUS, OUString(), - mpWindow, RID_SVXERRCTX, SvxResLocale()); + mpWindow->GetFrameWeld(), RID_SVXERRCTX, SvxResLocale()); if (mpViewShell && dynamic_cast< DrawViewShell *>( mpViewShell ) != nullptr) { diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx index 7620a2cec268..d1b2832c2cc4 100644 --- a/sd/source/ui/view/drawview.cxx +++ b/sd/source/ui/view/drawview.cxx @@ -18,7 +18,7 @@ */ #include <sfx2/dispatch.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <svx/svdpagv.hxx> #include <sfx2/request.hxx> #include <svl/style.hxx> @@ -433,8 +433,11 @@ bool DrawView::SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAtt { if (IsPresObjSelected(false)) { - ScopedVclPtrInstance<InfoBox>(mpDrawViewShell->GetActiveWindow(), - SdResId(STR_ACTION_NOTPOSSIBLE))->Execute(); + vcl::Window* pWin = mpDrawViewShell->GetActiveWindow(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SdResId(STR_ACTION_NOTPOSSIBLE))); + xInfoBox->run(); bResult = false; } else diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 615bfb9e9a00..6d6dcad9e855 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -958,7 +958,10 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) if ( mpDrawView->IsPresObjSelected() ) { ::sd::Window* pWindow = GetActiveWindow(); - ScopedVclPtrInstance<InfoBox>(pWindow, SdResId(STR_ACTION_NOTPOSSIBLE))->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SdResId(STR_ACTION_NOTPOSSIBLE))); + xInfoBox->run(); } else { @@ -1003,7 +1006,10 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) if ( mpDrawView->IsPresObjSelected() ) { ::sd::Window* pWindow = GetActiveWindow(); - ScopedVclPtrInstance<InfoBox>(pWindow, SdResId(STR_ACTION_NOTPOSSIBLE))->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SdResId(STR_ACTION_NOTPOSSIBLE))); + xInfoBox->run(); } else { @@ -1031,7 +1037,10 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) if ( mpDrawView->IsPresObjSelected(true,true,true) ) { ::sd::Window* pWindow = GetActiveWindow(); - ScopedVclPtrInstance<InfoBox>(pWindow, SdResId(STR_ACTION_NOTPOSSIBLE))->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SdResId(STR_ACTION_NOTPOSSIBLE))); + xInfoBox->run(); } else { @@ -1545,7 +1554,10 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) if ( mpDrawView->IsPresObjSelected(false) ) { ::sd::Window* pWindow = GetActiveWindow(); - ScopedVclPtrInstance<InfoBox>(pWindow, SdResId(STR_ACTION_NOTPOSSIBLE))->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SdResId(STR_ACTION_NOTPOSSIBLE))); + xInfoBox->run(); } else { @@ -1724,11 +1736,16 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) if( !bDone ) { ::sd::Window* pWindow = GetActiveWindow(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, #ifndef UNX - ScopedVclPtrInstance<InfoBox>(pWindow, SdResId(STR_TWAIN_NO_SOURCE))->Execute(); + SdResId(STR_TWAIN_NO_SOURCE) #else - ScopedVclPtrInstance<InfoBox>(pWindow, SdResId(STR_TWAIN_NO_SOURCE_UNX))->Execute(); + SdResId(STR_TWAIN_NO_SOURCE_UNX) #endif + )); + xInfoBox->run(); + } else { @@ -2449,7 +2466,10 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) if ( mpDrawView->IsPresObjSelected( true, true, true ) ) { ::sd::Window* pWindow = GetActiveWindow(); - ScopedVclPtrInstance<InfoBox>(pWindow, SdResId(STR_ACTION_NOTPOSSIBLE))->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SdResId(STR_ACTION_NOTPOSSIBLE))); + xInfoBox->run(); } else { @@ -2568,7 +2588,10 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) if ( mpDrawView->IsPresObjSelected() ) { ::sd::Window* pWindow = GetActiveWindow(); - ScopedVclPtrInstance<InfoBox>(pWindow, SdResId(STR_ACTION_NOTPOSSIBLE))->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SdResId(STR_ACTION_NOTPOSSIBLE))); + xInfoBox->run(); } else { @@ -2585,7 +2608,10 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) if ( mpDrawView->IsPresObjSelected() ) { ::sd::Window* pWindow = GetActiveWindow(); - ScopedVclPtrInstance<InfoBox>(pWindow, SdResId(STR_ACTION_NOTPOSSIBLE))->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SdResId(STR_ACTION_NOTPOSSIBLE))); + xInfoBox->run(); } else { @@ -2605,7 +2631,10 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) if ( mpDrawView->IsPresObjSelected() ) { ::sd::Window* pWindow = GetActiveWindow(); - ScopedVclPtrInstance<InfoBox>(pWindow, SdResId(STR_ACTION_NOTPOSSIBLE))->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SdResId(STR_ACTION_NOTPOSSIBLE))); + xInfoBox->run(); } else { @@ -2626,7 +2655,10 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) if ( mpDrawView->IsPresObjSelected() ) { ::sd::Window* pWindow = GetActiveWindow(); - ScopedVclPtrInstance<InfoBox>(pWindow, SdResId(STR_ACTION_NOTPOSSIBLE))->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SdResId(STR_ACTION_NOTPOSSIBLE))); + xInfoBox->run(); } else { @@ -2647,7 +2679,10 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) if ( mpDrawView->IsPresObjSelected() ) { ::sd::Window* pWindow = GetActiveWindow(); - ScopedVclPtrInstance<InfoBox>(pWindow, SdResId(STR_ACTION_NOTPOSSIBLE))->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SdResId(STR_ACTION_NOTPOSSIBLE))); + xInfoBox->run(); } else { @@ -2689,7 +2724,10 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) if ( mpDrawView->IsPresObjSelected() ) { ::sd::Window* pWindow = GetActiveWindow(); - ScopedVclPtrInstance<InfoBox>(pWindow, SdResId(STR_ACTION_NOTPOSSIBLE))->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SdResId(STR_ACTION_NOTPOSSIBLE))); + xInfoBox->run(); } else { @@ -2781,7 +2819,10 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) if ( mpDrawView->IsPresObjSelected() ) { ::sd::Window* pWindow = GetActiveWindow(); - ScopedVclPtrInstance<InfoBox>(pWindow, SdResId(STR_ACTION_NOTPOSSIBLE))->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SdResId(STR_ACTION_NOTPOSSIBLE))); + xInfoBox->run(); } else { diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx index becb587d9e33..151c1fa10c47 100644 --- a/sd/source/ui/view/drviewse.cxx +++ b/sd/source/ui/view/drviewse.cxx @@ -34,6 +34,7 @@ #include <svl/aeitem.hxx> #include <editeng/editstat.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <svl/urlbmk.hxx> #include <svx/svdpagv.hxx> #include <svx/fmshell.hxx> @@ -328,7 +329,10 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq) if ( mpDrawView->IsPresObjSelected() ) { ::sd::Window* pWindow = GetActiveWindow(); - ScopedVclPtrInstance<InfoBox>(pWindow, SdResId(STR_ACTION_NOTPOSSIBLE) )->Execute(); + 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) @@ -365,7 +369,10 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq) if ( mpDrawView->IsPresObjSelected() ) { ::sd::Window* pWindow = GetActiveWindow(); - ScopedVclPtrInstance<InfoBox>(pWindow, SdResId(STR_ACTION_NOTPOSSIBLE) )->Execute(); + 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) @@ -671,7 +678,10 @@ void DrawViewShell::FuDeleteSelectedObjects() if (mpDrawView->IsPresObjSelected(false, true, false, true)) { ::sd::Window* pWindow = GetActiveWindow(); - ScopedVclPtrInstance<InfoBox>(pWindow, SdResId(STR_ACTION_NOTPOSSIBLE) )->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SdResId(STR_ACTION_NOTPOSSIBLE))); + xInfoBox->run(); bConsumed = true; } @@ -785,7 +795,10 @@ void DrawViewShell::FuSupport(SfxRequest& rReq) if ( mpDrawView->IsPresObjSelected(false, true, false, true) ) { ::sd::Window* pWindow = GetActiveWindow(); - ScopedVclPtrInstance<InfoBox>(pWindow, SdResId(STR_ACTION_NOTPOSSIBLE))->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SdResId(STR_ACTION_NOTPOSSIBLE))); + xInfoBox->run(); } else { @@ -807,7 +820,10 @@ void DrawViewShell::FuSupport(SfxRequest& rReq) if ( mpDrawView->IsPresObjSelected(false, true, false, true) ) { ::sd::Window* pWindow = GetActiveWindow(); - ScopedVclPtrInstance<InfoBox>(pWindow, SdResId(STR_ACTION_NOTPOSSIBLE))->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SdResId(STR_ACTION_NOTPOSSIBLE))); + xInfoBox->run(); } else { diff --git a/sd/source/ui/view/drviewsi.cxx b/sd/source/ui/view/drviewsi.cxx index 0212473ddffb..ebd27be7672b 100644 --- a/sd/source/ui/view/drviewsi.cxx +++ b/sd/source/ui/view/drviewsi.cxx @@ -33,7 +33,7 @@ #include <svx/float3d.hxx> #include <svx/f3dchild.hxx> #include <svx/dialogs.hrc> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <app.hrc> #include <strings.hrc> @@ -162,10 +162,11 @@ void DrawViewShell::AssignFrom3DWindow() } else { - ScopedVclPtrInstance<InfoBox> aInfoBox ( - GetActiveWindow(), - SdResId(STR_ACTION_NOTPOSSIBLE)); - aInfoBox->Execute(); + vcl::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(); } // get focus back diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx index 37366b5bf9cb..1fa41a3485dc 100644 --- a/sd/source/ui/view/sdview4.cxx +++ b/sd/source/ui/view/sdview4.cxx @@ -26,7 +26,7 @@ #include <sfx2/docfilt.hxx> #include <sfx2/fcontnr.hxx> #include <sfx2/docfile.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <svl/urlbmk.hxx> #include <svx/svdpagv.hxx> #include <svx/xfillit.hxx> @@ -377,7 +377,8 @@ IMPL_LINK_NOARG(View, DropInsertFileHdl, Timer *, void) if( !mpViewSh ) return; - SfxErrorContext aEc( ERRCTX_ERROR, mpViewSh->GetActiveWindow(), RID_SO_ERRCTX ); + vcl::Window* pWindow = mpViewSh->GetActiveWindow(); + SfxErrorContext aEc( ERRCTX_ERROR, pWindow ? pWindow->GetFrameWeld() : nullptr, RID_SO_ERRCTX ); ErrCode nError = ERRCODE_NONE; ::std::vector< OUString >::const_iterator aIter( maDropFileVector.begin() ); @@ -570,7 +571,11 @@ IMPL_LINK_NOARG(View, DropInsertFileHdl, Timer *, void) */ IMPL_LINK_NOARG(View, DropErrorHdl, Timer *, void) { - ScopedVclPtrInstance<InfoBox>( mpViewSh ? mpViewSh->GetActiveWindow() : nullptr, SdResId(STR_ACTION_NOTPOSSIBLE) )->Execute(); + vcl::Window* pWin = mpViewSh ? mpViewSh->GetActiveWindow() : nullptr; + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SdResId(STR_ACTION_NOTPOSSIBLE))); + xInfoBox->run(); } /** diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx index 2f31191df6f1..861bb2d1db82 100644 --- a/sd/source/ui/view/viewshe2.cxx +++ b/sd/source/ui/view/viewshe2.cxx @@ -718,7 +718,8 @@ bool ViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb) { ErrCode aErrCode = ERRCODE_NONE; - SfxErrorContext aEC(ERRCTX_SO_DOVERB, GetActiveWindow(), RID_SO_ERRCTX); + vcl::Window* pWindow = GetActiveWindow(); + SfxErrorContext aEC(ERRCTX_SO_DOVERB, pWindow ? pWindow->GetFrameWeld() : nullptr, RID_SO_ERRCTX); bool bAbort = false; GetDocSh()->SetWaitCursor( true ); SfxViewShell* pViewShell = GetViewShell(); diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx index ba7cc8ac9330..d28c4ca27dad 100644 --- a/sfx2/source/bastyp/fltfnc.cxx +++ b/sfx2/source/bastyp/fltfnc.cxx @@ -37,6 +37,7 @@ #include <basic/sbxmeth.hxx> #include <basic/sbxcore.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <rtl/ustring.hxx> #include <rtl/ustrbuf.hxx> #include <svl/eitem.hxx> @@ -490,7 +491,10 @@ bool SfxFilterMatcher::IsFilterInstalled_Impl( const std::shared_ptr<const SfxFi { #ifdef DBG_UTIL // Start Setup - ScopedVclPtrInstance<InfoBox>( nullptr, "Here should the Setup now be starting!" )->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + "Here should the Setup now be starting!")); + xInfoBox->run(); #endif // Installation must still give feedback if it worked or not, // then the Filterflag be deleted @@ -502,7 +506,10 @@ bool SfxFilterMatcher::IsFilterInstalled_Impl( const std::shared_ptr<const SfxFi { OUString aText( SfxResId(STR_FILTER_CONSULT_SERVICE) ); aText = aText.replaceFirst( "$(FILTER)", pFilter->GetUIName() ); - ScopedVclPtrInstance<InfoBox>( nullptr, aText )->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + aText)); + xInfoBox->run(); return false; } else diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx index cfc79b606335..eb45d935591d 100644 --- a/sfx2/source/dialog/securitypage.cxx +++ b/sfx2/source/dialog/securitypage.cxx @@ -32,6 +32,7 @@ #include <vcl/edit.hxx> #include <vcl/fixed.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <svl/eitem.hxx> #include <svl/poolitem.hxx> #include <svl/intitem.hxx> @@ -123,7 +124,12 @@ static bool lcl_IsPasswordCorrect( const OUString &rPassword ) if (SvPasswordHelper::CompareHashPassword( aPasswordHash, rPassword )) bRes = true; // password was correct else - ScopedVclPtrInstance<InfoBox>(nullptr, SfxResId(RID_SVXSTR_INCORRECT_PASSWORD))->Execute(); + { + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SfxResId(RID_SVXSTR_INCORRECT_PASSWORD))); + xInfoBox->run(); + } return bRes; } diff --git a/sfx2/source/doc/new.cxx b/sfx2/source/doc/new.cxx index 122b06eac288..cd78f4b524ca 100644 --- a/sfx2/source/doc/new.cxx +++ b/sfx2/source/doc/new.cxx @@ -214,7 +214,7 @@ IMPL_LINK_NOARG(SfxNewFileDialog_Impl, Update, Timer*, void) if (!xDocShell.Is()) { - SfxErrorContext eEC(ERRCTX_SFX_LOADTEMPLATE,pAntiImpl); + SfxErrorContext eEC(ERRCTX_SFX_LOADTEMPLATE, pAntiImpl->GetFrameWeld()); SfxApplication *pSfxApp = SfxGetpApp(); SfxItemSet* pSet = new SfxAllItemSet(pSfxApp->GetPool()); pSet->Put(SfxBoolItem(SID_TEMPLATE, true)); diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index 86aa5fa35625..81d93b38f55b 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -856,7 +856,8 @@ sal_Int64 SfxInPlaceClient::GetAspect() const ErrCode SfxInPlaceClient::DoVerb( long nVerb ) { - SfxErrorContext aEc(ERRCTX_SO_DOVERB, m_pViewSh->GetWindow(), RID_SO_ERRCTX); + vcl::Window* pWin = m_pViewSh->GetWindow(); + SfxErrorContext aEc(ERRCTX_SO_DOVERB, pWin ? pWin->GetFrameWeld() : nullptr, RID_SO_ERRCTX); ErrCode nError = ERRCODE_NONE; if ( m_xImp->m_xObject.is() ) diff --git a/svtools/source/graphic/provider.cxx b/svtools/source/graphic/provider.cxx index f0dddfc5610c..3cbbd6ba752b 100644 --- a/svtools/source/graphic/provider.cxx +++ b/svtools/source/graphic/provider.cxx @@ -198,7 +198,7 @@ uno::Reference< ::graphic::XGraphic > GraphicProvider::implLoadStandardImage( co OUString sImageName( rResourceURL.copy( nIndex ) ); if ( sImageName == "info" ) { - xRet = Graphic(InfoBox::GetStandardImage().GetBitmapEx()).GetXGraphic(); + xRet = Graphic(GetStandardInfoBoxImage().GetBitmapEx()).GetXGraphic(); } else if ( sImageName == "warning" ) { diff --git a/svtools/source/misc/ehdl.cxx b/svtools/source/misc/ehdl.cxx index dfd28ac168d6..3ab4c7cedb9c 100644 --- a/svtools/source/misc/ehdl.cxx +++ b/svtools/source/misc/ehdl.cxx @@ -18,9 +18,9 @@ */ #include <unotools/resmgr.hxx> -#include <tools/wintypes.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/button.hxx> #include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <vcl/settings.hxx> #include <svtools/ehdl.hxx> @@ -33,7 +33,7 @@ #include <strings.hxx> static DialogMask aWndFunc( - vcl::Window *pWin, // Parent of the dialog + weld::Window *pWin, // Parent of the dialog DialogMask nFlags, const OUString &rErr, // error text const OUString &rAction) // action text @@ -52,33 +52,17 @@ static DialogMask aWndFunc( SolarMutexGuard aGuard; // determine necessary WinBits from the flags - MessBoxStyle eBits = MessBoxStyle::NONE; + VclButtonsType eButtonsType = VclButtonsType::NONE; + bool bAddRetry = false; if ( (nFlags & (DialogMask::ButtonsCancel | DialogMask::ButtonsRetry)) == (DialogMask::ButtonsCancel | DialogMask::ButtonsRetry)) - eBits = MessBoxStyle::RetryCancel; - else if ( (nFlags & DialogMask::ButtonsOk) == DialogMask::ButtonsOk ) - eBits = MessBoxStyle::Ok; - else if ( (nFlags & DialogMask::ButtonsYesNo) == DialogMask::ButtonsYesNo ) - eBits = MessBoxStyle::YesNo; - - switch(nFlags & DialogMask(0x0f00)) { - case DialogMask::ButtonDefaultsOk: - eBits |= MessBoxStyle::DefaultOk; - break; - - case DialogMask::ButtonDefaultsCancel: - eBits |= MessBoxStyle::DefaultCancel; - break; - - case DialogMask::ButtonDefaultsYes: - eBits |= MessBoxStyle::DefaultYes; - break; - - case DialogMask::ButtonDefaultsNo: - eBits |= MessBoxStyle::DefaultNo; - break; - default: break; + bAddRetry = true; + eButtonsType = VclButtonsType::Cancel; } + else if ( (nFlags & DialogMask::ButtonsOk) == DialogMask::ButtonsOk ) + eButtonsType = VclButtonsType::Ok; + else if ( (nFlags & DialogMask::ButtonsYesNo) == DialogMask::ButtonsYesNo ) + eButtonsType = VclButtonsType::YesNo; OUString aErr("$(ACTION)$(ERROR)"); OUString aAction(rAction); @@ -87,19 +71,19 @@ static DialogMask aWndFunc( aErr = aErr.replaceAll("$(ACTION)", aAction); aErr = aErr.replaceAll("$(ERROR)", rErr); - VclPtr<MessBox> pBox; - switch ( nFlags & DialogMask(0xf000) ) + VclMessageType eMessageType; + switch (nFlags & DialogMask(0xf000)) { case DialogMask::MessageError: - pBox.reset(VclPtr<ErrorBox>::Create(pWin, eBits, aErr)); + eMessageType = VclMessageType::Error; break; case DialogMask::MessageWarning: - pBox.reset(VclPtr<WarningBox>::Create(pWin, eBits, aErr)); + eMessageType = VclMessageType::Warning; break; case DialogMask::MessageInfo: - pBox.reset(VclPtr<InfoBox>::Create(pWin, aErr)); + eMessageType = VclMessageType::Info; break; default: @@ -109,8 +93,32 @@ static DialogMask aWndFunc( } } + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin, + eMessageType, eButtonsType, aErr)); + + if (bAddRetry) + xBox->add_button(Button::GetStandardText(StandardButtonType::Retry), RET_RETRY); + + switch(nFlags & DialogMask(0x0f00)) + { + case DialogMask::ButtonDefaultsOk: + xBox->set_default_response(RET_OK); + break; + case DialogMask::ButtonDefaultsCancel: + xBox->set_default_response(RET_CANCEL); + break; + case DialogMask::ButtonDefaultsYes: + xBox->set_default_response(RET_YES); + break; + case DialogMask::ButtonDefaultsNo: + xBox->set_default_response(RET_NO); + break; + default: + break; + } + DialogMask nRet = DialogMask::NONE; - switch ( pBox->Execute() ) + switch (xBox->run()) { case RET_OK: nRet = DialogMask::ButtonsOk; @@ -131,7 +139,7 @@ static DialogMask aWndFunc( SAL_WARN( "svtools.misc", "Unknown MessBox return value" ); break; } - pBox.disposeAndClear(); + return nRet; } @@ -234,7 +242,7 @@ bool SfxErrorHandler::GetErrorString(ErrCode lErrId, OUString &rStr) const } SfxErrorContext::SfxErrorContext( - sal_uInt16 nCtxIdP, vcl::Window *pWindow, const ErrMsgCode* pIdsP, const std::locale& rResLocaleP) + sal_uInt16 nCtxIdP, weld::Window *pWindow, const ErrMsgCode* pIdsP, const std::locale& rResLocaleP) : ErrorContext(pWindow), nCtxId(nCtxIdP), pIds(pIdsP), aResLocale(rResLocaleP) { if (!pIds) @@ -243,7 +251,7 @@ SfxErrorContext::SfxErrorContext( SfxErrorContext::SfxErrorContext( - sal_uInt16 nCtxIdP, const OUString &aArg1P, vcl::Window *pWindow, + sal_uInt16 nCtxIdP, const OUString &aArg1P, weld::Window *pWindow, const ErrMsgCode* pIdsP, const std::locale& rResLocaleP) : ErrorContext(pWindow), nCtxId(nCtxIdP), pIds(pIdsP), aResLocale(rResLocaleP), aArg1(aArg1P) diff --git a/svx/source/dialog/imapdlg.cxx b/svx/source/dialog/imapdlg.cxx index e910cd964b40..1e200a128d18 100644 --- a/svx/source/dialog/imapdlg.cxx +++ b/svx/source/dialog/imapdlg.cxx @@ -476,7 +476,7 @@ void SvxIMapDlg::DoOpen() if( pIStm->GetError() ) { - SfxErrorContext eEC(ERRCTX_ERROR, this); + SfxErrorContext eEC(ERRCTX_ERROR, GetFrameWeld()); ErrorHandler::HandleError( ERRCODE_IO_GENERAL ); } else diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx index beb7abfeabda..b3bc7bcea969 100644 --- a/svx/source/svdraw/svdedtv1.cxx +++ b/svx/source/svdraw/svdedtv1.cxx @@ -26,7 +26,8 @@ #include <svl/itemiter.hxx> #include <svl/whiter.hxx> #include <tools/bigint.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <getallcharpropids.hxx> #include <svdglob.hxx> @@ -964,7 +965,10 @@ void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, bool bReplaceAll) if(bHasEEFeatureItems) { OUString aMessage("SdrEditView::SetAttrToMarked(): Setting EE_FEATURE items at the SdrView does not make sense! It only leads to overhead and unreadable documents."); - ScopedVclPtrInstance<InfoBox>(nullptr, aMessage)->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + aMessage)); + xInfoBox->run(); } } #endif diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 0539648713d6..f01dd86a3d2c 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -22,7 +22,7 @@ #include <svx/svdedxv.hxx> #include <svl/solar.hrc> #include <svl/itemiter.hxx> -#include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <vcl/hatch.hxx> #include <svl/whiter.hxx> #include <svl/style.hxx> @@ -2076,7 +2076,10 @@ bool SdrObjEditView::SetAttributes(const SfxItemSet& rSet, bool bReplaceAll) if(bHasEEFeatureItems) { OUString aMessage("SdrObjEditView::SetAttributes(): Setting EE_FEATURE items at the SdrView does not make sense! It only leads to overhead and unreadable documents."); - ScopedVclPtrInstance<InfoBox>(nullptr, aMessage)->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(nullptr, ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits