diff options
Diffstat (limited to 'sfx2/source/appl')
-rw-r--r-- | sfx2/source/appl/appopen.cxx | 10 | ||||
-rw-r--r-- | sfx2/source/appl/appserv.cxx | 7 | ||||
-rw-r--r-- | sfx2/source/appl/lnkbase2.cxx | 5 | ||||
-rw-r--r-- | sfx2/source/appl/newhelp.cxx | 16 | ||||
-rw-r--r-- | sfx2/source/appl/openuriexternally.cxx | 19 | ||||
-rw-r--r-- | sfx2/source/appl/sfxhelp.cxx | 32 |
6 files changed, 42 insertions, 47 deletions
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index c9a4d8ace070..2f3744e3fc04 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -65,6 +65,7 @@ #include <unotools/extendedsecurityoptions.hxx> #include <comphelper/docpasswordhelper.hxx> #include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <sfx2/app.hxx> #include <sfx2/bindings.hxx> @@ -837,11 +838,10 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) SolarMutexGuard aGuard; vcl::Window *pWindow = SfxGetpApp()->GetTopWindow(); - ScopedVclPtrInstance<MessageDialog> aSecurityWarningBox(pWindow, - SfxResId(STR_SECURITY_WARNING_NO_HYPERLINKS), - VclMessageType::Warning); - aSecurityWarningBox->SetText( SfxResId(RID_SECURITY_WARNING_TITLE) ); - aSecurityWarningBox->Execute(); + std::unique_ptr<weld::MessageDialog> xSecurityWarningBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, SfxResId(STR_SECURITY_WARNING_NO_HYPERLINKS))); + xSecurityWarningBox->set_title(SfxResId(RID_SECURITY_WARNING_TITLE)); + xSecurityWarningBox->run(); return; } diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index e118bbafae24..f8b08137a326 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -59,8 +59,8 @@ #include <unotools/configmgr.hxx> #include <tools/svlibrary.h> #include <tools/diagnose_ex.h> -#include <vcl/layout.hxx> #include <vcl/sysdata.hxx> +#include <vcl/weld.hxx> #include <svl/intitem.hxx> #include <svl/eitem.hxx> #include <svl/stritem.hxx> @@ -1605,7 +1605,10 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) SvtModuleOptions aModuleOpt; if ( !aModuleOpt.IsImpress() ) { - ScopedVclPtrInstance<MessageDialog>( nullptr, SfxResId( STR_MODULENOTINSTALLED ))->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + SfxResId(STR_MODULENOTINSTALLED))); + xBox->run(); return; } diff --git a/sfx2/source/appl/lnkbase2.cxx b/sfx2/source/appl/lnkbase2.cxx index cf59639cde9e..82c6129b11bf 100644 --- a/sfx2/source/appl/lnkbase2.cxx +++ b/sfx2/source/appl/lnkbase2.cxx @@ -27,6 +27,7 @@ #include <vcl/layout.hxx> #include <sfx2/linkmgr.hxx> #include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <sfx2/strings.hrc> #include <sfx2/sfxresid.hxx> #include <sfx2/filedlghelper.hxx> @@ -515,7 +516,9 @@ bool SvBaseLink::ExecuteEdit( const OUString& _rNewName ) else return false; - ScopedVclPtrInstance<MessageDialog>(pImpl->m_pParentWin, sError)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pImpl->m_pParentWin->GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, sError)); + xBox->run(); } } else if( !pImpl->m_bIsConnect ) diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index 9ecbf4672d46..61ef0588bf30 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -89,10 +89,11 @@ #include <svtools/miscopt.hxx> #include <svtools/imgdef.hxx> #include <vcl/builderfactory.hxx> -#include <vcl/layout.hxx> #include <vcl/unohelp.hxx> #include <vcl/i18nhelp.hxx> +#include <vcl/layout.hxx> #include <vcl/settings.hxx> +#include <vcl/weld.hxx> #include <ucbhelper/content.hxx> #include <vcl/msgbox.hxx> @@ -1046,8 +1047,10 @@ IMPL_LINK_NOARG(SearchTabPage_Impl, SearchHdl, LinkParamNone*, void) if ( aFactories.empty() ) { - ScopedVclPtrInstance< MessageDialog > aBox(this, SfxResId( STR_INFO_NOSEARCHRESULTS ), VclMessageType::Info); - aBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SfxResId(STR_INFO_NOSEARCHRESULTS))); + xBox->run(); } } } @@ -2265,9 +2268,10 @@ void SfxHelpTextWindow_Impl::FindHdl(sfx2::SearchDialog* pDlg) } else { - DBG_ASSERT( pSrchDlg, "no search dialog" ); - ScopedVclPtrInstance< MessageDialog > aBox(pSrchDlg, SfxResId( STR_INFO_NOSEARCHTEXTFOUND ), VclMessageType::Info); - aBox->Execute(); + assert(pSrchDlg && "no search dialog"); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pSrchDlg->GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, SfxResId(STR_INFO_NOSEARCHTEXTFOUND))); + xBox->run(); pSrchDlg->SetFocusOnEdit(); } } diff --git a/sfx2/source/appl/openuriexternally.cxx b/sfx2/source/appl/openuriexternally.cxx index 5b3e4821b200..c412d40aeb39 100644 --- a/sfx2/source/appl/openuriexternally.cxx +++ b/sfx2/source/appl/openuriexternally.cxx @@ -21,8 +21,8 @@ #include <rtl/ustring.hxx> #include <sfx2/app.hxx> #include <sfx2/sfxresid.hxx> -#include <vcl/layout.hxx> #include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <openuriexternally.hxx> #include <comphelper/lok.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> @@ -57,24 +57,27 @@ bool sfx2::openUriExternally( "unexpected IllegalArgumentException: " + e.Message); } SolarMutexGuard g; - ScopedVclPtrInstance<MessageDialog> eb( - SfxGetpApp()->GetTopWindow(), SfxResId(STR_NO_ABS_URI_REF)); + vcl::Window *pWindow = SfxGetpApp()->GetTopWindow(); + std::unique_ptr<weld::MessageDialog> eb(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + SfxResId(STR_NO_ABS_URI_REF))); eb->set_primary_text(eb->get_primary_text().replaceFirst("$(ARG1)", uri)); - eb->Execute(); + eb->run(); } catch (css::system::SystemShellExecuteException & e) { if (!handleSystemShellExecuteException) { throw; } SolarMutexGuard g; - ScopedVclPtrInstance<MessageDialog> eb( - SfxGetpApp()->GetTopWindow(), - SfxResId(STR_NO_WEBBROWSER_FOUND)); + vcl::Window *pWindow = SfxGetpApp()->GetTopWindow(); + std::unique_ptr<weld::MessageDialog> eb(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + VclMessageType::Warning, VclButtonsType::Ok, + SfxResId(STR_NO_WEBBROWSER_FOUND))); eb->set_primary_text( eb->get_primary_text().replaceFirst("$(ARG1)", uri) .replaceFirst("$(ARG2)", OUString::number(e.PosixError)) .replaceFirst("$(ARG3)", e.Message)); //TODO: avoid subsequent replaceFirst acting on previous replacement - eb->Execute(); + eb->run(); } return false; } diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 9803d63fdb75..7fe8d968dbe7 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -83,24 +83,6 @@ using namespace ::com::sun::star::util; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::system; -namespace old -{ - class NoHelpErrorBox : public MessageDialog - { - public: - explicit NoHelpErrorBox(vcl::Window* _pParent) - : MessageDialog(_pParent, SfxResId(RID_STR_HLPFILENOTEXIST)) - { - // Error message: "No help available" - } - - virtual void RequestHelp( const HelpEvent& ) override - { - // do nothing, because no help available - } - }; -} - class NoHelpErrorBox { private: @@ -836,14 +818,14 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const if ( !impl_hasHelpInstalled() ) { - ScopedVclPtrInstance< MessageDialog > aQueryBox(const_cast< vcl::Window* >( pWindow ), - "onlinehelpmanual", "sfx/ui/helpmanual.ui"); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWindow ? pWindow->GetFrameWeld() : nullptr, "sfx/ui/helpmanual.ui")); + std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("onlinehelpmanual")); LanguageTag aLangTag = Application::GetSettings().GetUILanguageTag(); OUString sLocaleString = SvtLanguageTable::GetLanguageString( aLangTag.getLanguageType() ); - OUString sPrimTex = aQueryBox->get_primary_text(); - aQueryBox->set_primary_text(sPrimTex.replaceAll("$UILOCALE", sLocaleString)); - short OnlineHelpBox = aQueryBox->Execute(); + OUString sPrimTex = xQueryBox->get_primary_text(); + xQueryBox->set_primary_text(sPrimTex.replaceAll("$UILOCALE", sLocaleString)); + short OnlineHelpBox = xQueryBox->run(); if(OnlineHelpBox == RET_OK) { @@ -851,8 +833,8 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const return true; else { - ScopedVclPtrInstance< old::NoHelpErrorBox > aErrBox(const_cast< vcl::Window* >( pWindow )); - aErrBox->Execute(); + NoHelpErrorBox aErrBox(pWindow ? pWindow->GetFrameWeld() : nullptr); + aErrBox.run(); return false; } } |