summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/appl/appopen.cxx10
-rw-r--r--sfx2/source/appl/appserv.cxx7
-rw-r--r--sfx2/source/appl/lnkbase2.cxx5
-rw-r--r--sfx2/source/appl/newhelp.cxx16
-rw-r--r--sfx2/source/appl/openuriexternally.cxx19
-rw-r--r--sfx2/source/appl/sfxhelp.cxx32
-rw-r--r--sfx2/source/control/templatelocalview.cxx28
-rw-r--r--sfx2/source/control/templatesearchview.cxx14
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx6
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx9
-rw-r--r--sfx2/source/dialog/mailmodel.cxx7
-rw-r--r--sfx2/source/dialog/mgetempl.cxx20
-rw-r--r--sfx2/source/dialog/newstyle.cxx14
-rw-r--r--sfx2/source/dialog/passwd.cxx13
-rw-r--r--sfx2/source/dialog/templdlg.cxx12
-rw-r--r--sfx2/source/doc/QuerySaveDocument.cxx11
-rw-r--r--sfx2/source/doc/guisaveas.cxx15
-rw-r--r--sfx2/source/doc/objmisc.cxx6
-rw-r--r--sfx2/source/doc/objserv.cxx46
-rw-r--r--sfx2/source/doc/objxtor.cxx3
-rw-r--r--sfx2/source/doc/saveastemplatedlg.cxx14
-rw-r--r--sfx2/source/doc/templatedlg.cxx45
-rw-r--r--sfx2/source/inc/alienwarn.hxx2
-rw-r--r--sfx2/source/inc/templdgi.hxx6
-rw-r--r--sfx2/source/view/classificationhelper.cxx16
-rw-r--r--sfx2/source/view/viewfrm.cxx56
-rw-r--r--sfx2/source/view/viewprn.cxx37
-rw-r--r--sfx2/source/view/viewsh.cxx24
28 files changed, 289 insertions, 204 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;
}
}
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index ec4321606bfb..b95a7f60c535 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -23,7 +23,8 @@
#include <unotools/moduleoptions.hxx>
#include <vcl/builderfactory.hxx>
#include <vcl/help.hxx>
-#include <vcl/layout.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/XStorage.hpp>
@@ -281,8 +282,9 @@ IMPL_LINK(TemplateLocalView, ContextMenuSelectHdl, Menu*, pMenu, bool)
break;
case MNI_DELETE:
{
- ScopedVclPtrInstance< MessageDialog > aQueryDlg(this, SfxResId(STR_QMSG_SEL_TEMPLATE_DELETE), VclMessageType::Question, VclButtonsType::YesNo);
- if ( aQueryDlg->Execute() != RET_YES )
+ std::unique_ptr<weld::MessageDialog> xQueryDlg(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo,
+ SfxResId(STR_QMSG_SEL_TEMPLATE_DELETE)));
+ if (xQueryDlg->run() != RET_YES)
break;
maDeleteTemplateHdl.Call(maSelectedItem);
@@ -511,8 +513,9 @@ bool TemplateLocalView::moveTemplate (const ThumbnailViewItem *pItem, const sal_
{
OUString sQuery = SfxResId(STR_MSG_QUERY_COPY).replaceFirst("$1", pViewItem->maTitle).replaceFirst("$2",
getRegionName(nTargetRegion));
- ScopedVclPtrInstance< MessageDialog > aQueryDlg(this, sQuery, VclMessageType::Question, VclButtonsType::YesNo);
- if ( aQueryDlg->Execute() != RET_YES )
+
+ std::unique_ptr<weld::MessageDialog> xQueryDlg(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo, sQuery));
+ if (xQueryDlg->run() != RET_YES)
return false;
if (!mpDocTemplates->Copy(nTargetRegion,nTargetIdx,nSrcRegionId,pViewItem->mnDocId))
@@ -609,13 +612,14 @@ void TemplateLocalView::moveTemplates(const std::set<const ThumbnailViewItem*, s
{
OUString sQuery = SfxResId(STR_MSG_QUERY_COPY).replaceFirst("$1", pViewItem->maTitle).replaceFirst("$2",
getRegionName(nTargetRegion));
- ScopedVclPtrInstance< MessageDialog > aQueryDlg(this, sQuery, VclMessageType::Question, VclButtonsType::YesNo);
-
- if ( aQueryDlg->Execute() != RET_YES )
+ std::unique_ptr<weld::MessageDialog> xQueryDlg(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo, sQuery));
+ if (xQueryDlg->run() != RET_YES)
{
OUString sMsg(SfxResId(STR_MSG_ERROR_LOCAL_MOVE));
sMsg = sMsg.replaceFirst("$1",getRegionName(nTargetRegion));
- ScopedVclPtrInstance<MessageDialog>(this, sMsg.replaceFirst( "$2",pViewItem->maTitle))->Execute();
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, sMsg.replaceFirst( "$2",pViewItem->maTitle)));
+ xBox->run();
return; //return if any single move operation fails
}
@@ -890,9 +894,9 @@ void TemplateLocalView::KeyInput( const KeyEvent& rKEvt )
}
else if( aKeyCode == KEY_DELETE && !mFilteredItemList.empty())
{
- ScopedVclPtrInstance< MessageDialog > aQueryDlg(this, SfxResId(STR_QMSG_SEL_TEMPLATE_DELETE), VclMessageType::Question, VclButtonsType::YesNo);
-
- if ( aQueryDlg->Execute() != RET_YES )
+ std::unique_ptr<weld::MessageDialog> xQueryDlg(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo,
+ SfxResId(STR_QMSG_SEL_TEMPLATE_DELETE)));
+ if (xQueryDlg->run() != RET_YES)
return;
//copy to avoid changing filtered item list during deletion
diff --git a/sfx2/source/control/templatesearchview.cxx b/sfx2/source/control/templatesearchview.cxx
index 374a3b268ef3..ace6b4fcb32e 100644
--- a/sfx2/source/control/templatesearchview.cxx
+++ b/sfx2/source/control/templatesearchview.cxx
@@ -12,7 +12,8 @@
#include <sfx2/templatelocalview.hxx>
#include <sfx2/sfxresid.hxx>
#include <tools/urlobj.hxx>
-#include <vcl/layout.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
#include <sfx2/strings.hrc>
#include <bitmaps.hlst>
@@ -60,9 +61,9 @@ void TemplateSearchView::KeyInput( const KeyEvent& rKEvt )
}
else if( aKeyCode == KEY_DELETE && !mFilteredItemList.empty())
{
- ScopedVclPtrInstance< MessageDialog > aQueryDlg(this, SfxResId(STR_QMSG_SEL_TEMPLATE_DELETE), VclMessageType::Question, VclButtonsType::YesNo);
-
- if ( aQueryDlg->Execute() != RET_YES )
+ std::unique_ptr<weld::MessageDialog> xQueryDlg(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo,
+ SfxResId(STR_QMSG_SEL_TEMPLATE_DELETE)));
+ if (xQueryDlg->run() != RET_YES)
return;
//copy to avoid changing filtered item list during deletion
@@ -159,8 +160,9 @@ IMPL_LINK(TemplateSearchView, ContextMenuSelectHdl, Menu*, pMenu, bool)
break;
case MNI_DELETE:
{
- ScopedVclPtrInstance< MessageDialog > aQueryDlg(this, SfxResId(STR_QMSG_SEL_TEMPLATE_DELETE), VclMessageType::Question, VclButtonsType::YesNo);
- if ( aQueryDlg->Execute() != RET_YES )
+ std::unique_ptr<weld::MessageDialog> xQueryDlg(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo,
+ SfxResId(STR_QMSG_SEL_TEMPLATE_DELETE)));
+ if (xQueryDlg->run() != RET_YES)
break;
maDeleteTemplateHdl.Call(maSelectedItem);
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 91e21b80360a..d7703f62a73e 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -21,9 +21,9 @@
#include <svl/urihelper.hxx>
#include <tools/datetime.hxx>
#include <tools/urlobj.hxx>
-#include <vcl/layout.hxx>
#include <vcl/mnemonic.hxx>
#include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
#include <unotools/localedatawrapper.hxx>
#include <unotools/cmdoptions.hxx>
#include <comphelper/processfactory.hxx>
@@ -1658,7 +1658,9 @@ void CustomPropertiesWindow::ValidateLine( CustomPropertyLine* pLine, bool bIsFr
if ( bIsFromTypeBox ) // LoseFocus of TypeBox
pLine->m_bTypeLostFocus = true;
vcl::Window* pParent = GetParent()->GetParent();
- if (ScopedVclPtrInstance<MessageDialog>(pParent, SfxResId(STR_SFX_QUERY_WRONG_TYPE), VclMessageType::Question, VclButtonsType::OkCancel)->Execute() == RET_OK)
+ std::unique_ptr<weld::MessageDialog> xMessageBox(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr,
+ VclMessageType::Question, VclButtonsType::OkCancel, SfxResId(STR_SFX_QUERY_WRONG_TYPE)));
+ if (xMessageBox->run() == RET_OK)
pLine->m_aTypeBox->SelectEntryPos(pLine->m_aTypeBox->GetEntryPos(reinterpret_cast<void*>(CUSTOM_TYPE_TEXT)));
else
pLine->m_aValueEdit->GrabFocus();
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 3d20a6a3333d..32249bd1db6b 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -51,6 +51,7 @@
#include <comphelper/types.hxx>
#include <tools/urlobj.hxx>
#include <vcl/help.hxx>
+#include <vcl/weld.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <unotools/ucbhelper.hxx>
#include <osl/file.hxx>
@@ -1540,10 +1541,10 @@ ErrCode FileDialogHelper_Impl::execute( std::vector<OUString>& rpURLList,
}
catch( const IllegalArgumentException& )
{
- ScopedVclPtrInstance< MessageDialog > aBox(
- mpPreferredParentWindow,
- SfxResId(RID_SVXSTR_GPG_ENCRYPT_FAILURE));
- aBox->Execute();
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(mpPreferredParentWindow ? mpPreferredParentWindow->GetFrameWeld() : nullptr,
+ VclMessageType::Warning, VclButtonsType::Ok,
+ SfxResId(RID_SVXSTR_GPG_ENCRYPT_FAILURE)));
+ xBox->run();
}
}
diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx
index 00fdcb0a2264..aa712142cf6b 100644
--- a/sfx2/source/dialog/mailmodel.cxx
+++ b/sfx2/source/dialog/mailmodel.cxx
@@ -52,7 +52,7 @@
#include <rtl/uri.h>
#include <rtl/uri.hxx>
#include <rtl/ustrbuf.hxx>
-#include <vcl/layout.hxx>
+#include <vcl/weld.hxx>
#include <sfx2/mailmodelapi.hxx>
#include <sfxtypes.hxx>
@@ -784,8 +784,9 @@ SfxMailModel::SendMailResult SfxMailModel::Send( const css::uno::Reference< css:
SolarMutexGuard aGuard;
VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow( xParentWindow );
- ScopedVclPtrInstance< MessageDialog > aBox(pParentWindow, "ErrorFindEmailDialog", "sfx/ui/errorfindemaildialog.ui");
- aBox->Execute();
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pParentWindow ? pParentWindow->GetFrameWeld() : nullptr, "sfx/ui/errorfindemaildialog.ui"));
+ std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("ErrorFindEmailDialog"));
+ xBox->run();
eResult = SEND_MAIL_CANCELLED;
}
else
diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx
index 1dc87a2c537d..6268c5d61ace 100644
--- a/sfx2/source/dialog/mgetempl.cxx
+++ b/sfx2/source/dialog/mgetempl.cxx
@@ -18,7 +18,7 @@
*/
#include <comphelper/string.hxx>
-#include <vcl/layout.hxx>
+#include <vcl/weld.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/field.hxx>
#include <svl/eitem.hxx>
@@ -602,8 +602,10 @@ DeactivateRC SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet )
if (!pStyle->SetName(comphelper::string::stripStart(m_pNameRw->GetText(), ' ')))
{
- ScopedVclPtrInstance< MessageDialog > aBox(this, SfxResId( STR_TABPAGE_INVALIDNAME ), VclMessageType::Info);
- aBox->Execute();
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Info, VclButtonsType::Ok,
+ SfxResId(STR_TABPAGE_INVALIDNAME)));
+ xBox->run();
m_pNameRw->GrabFocus();
m_pNameRw->SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
return DeactivateRC::KeepPage;
@@ -619,8 +621,10 @@ DeactivateRC SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet )
{
if ( !pStyle->SetFollow( aFollowEntry ) )
{
- ScopedVclPtrInstance< MessageDialog > aBox(this, SfxResId( STR_TABPAGE_INVALIDSTYLE ), VclMessageType::Info);
- aBox->Execute();
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Info, VclButtonsType::Ok,
+ SfxResId(STR_TABPAGE_INVALIDSTYLE)));
+ xBox->run();
m_pFollowLb->GrabFocus();
return DeactivateRC::KeepPage;
}
@@ -639,8 +643,10 @@ DeactivateRC SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet )
{
if ( !pStyle->SetParent( aParentEntry ) )
{
- ScopedVclPtrInstance< MessageDialog > aBox(this, SfxResId( STR_TABPAGE_INVALIDPARENT ), VclMessageType::Info);
- aBox->Execute();
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Info, VclButtonsType::Ok,
+ SfxResId(STR_TABPAGE_INVALIDPARENT)));
+ xBox->run();
m_pBaseLb->GrabFocus();
return DeactivateRC::KeepPage;
}
diff --git a/sfx2/source/dialog/newstyle.cxx b/sfx2/source/dialog/newstyle.cxx
index 76dd62b0539d..e72f454a0795 100644
--- a/sfx2/source/dialog/newstyle.cxx
+++ b/sfx2/source/dialog/newstyle.cxx
@@ -25,6 +25,7 @@
#include <sfx2/strings.hrc>
#include <sfx2/sfxresid.hxx>
#include <vcl/layout.hxx>
+#include <vcl/weld.hxx>
// Private methods ------------------------------------------------------
@@ -40,11 +41,14 @@ IMPL_LINK_NOARG( SfxNewStyleDlg, OKHdl, ComboBox&, void )
{
if ( !pStyle->IsUserDefined() )
{
- ScopedVclPtrInstance<MessageDialog>( this, SfxResId( STR_POOL_STYLE_NAME ), VclMessageType::Info )->Execute();
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Info, VclButtonsType::Ok,
+ SfxResId(STR_POOL_STYLE_NAME)));
+ xBox->run();
return;
}
- if ( RET_YES == aQueryOverwriteBox->Execute() )
+ if (RET_YES == xQueryOverwriteBox->run())
EndDialog( RET_OK );
}
else
@@ -58,8 +62,8 @@ IMPL_LINK( SfxNewStyleDlg, ModifyHdl, Edit&, rBox, void )
SfxNewStyleDlg::SfxNewStyleDlg( vcl::Window* pParent, SfxStyleSheetBasePool& rInPool )
: ModalDialog(pParent, "CreateStyleDialog", "sfx/ui/newstyle.ui")
- , aQueryOverwriteBox(VclPtr<MessageDialog>::Create(this, SfxResId(STR_QUERY_OVERWRITE),
- VclMessageType::Question, VclButtonsType::YesNo))
+ , xQueryOverwriteBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo,
+ SfxResId(STR_QUERY_OVERWRITE)))
, rPool(rInPool)
{
get(m_pColBox, "stylename");
@@ -86,7 +90,7 @@ SfxNewStyleDlg::~SfxNewStyleDlg()
void SfxNewStyleDlg::dispose()
{
- aQueryOverwriteBox.disposeAndClear();
+ xQueryOverwriteBox.reset();
m_pColBox.clear();
m_pOKBtn.clear();
ModalDialog::dispose();
diff --git a/sfx2/source/dialog/passwd.cxx b/sfx2/source/dialog/passwd.cxx
index 347629fc7615..8c0f2378329c 100644
--- a/sfx2/source/dialog/passwd.cxx
+++ b/sfx2/source/dialog/passwd.cxx
@@ -17,16 +17,11 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
-// Include ---------------------------------------------------------------
-#include <vcl/layout.hxx>
-
#include <sfx2/passwd.hxx>
#include <sfxtypes.hxx>
#include <sfx2/sfxresid.hxx>
-
#include <sfx2/strings.hrc>
-
+#include <vcl/weld.hxx>
IMPL_LINK( SfxPasswordDialog, EditModifyHdl, Edit&, rEdit, void )
{
@@ -71,8 +66,10 @@ IMPL_LINK_NOARG(SfxPasswordDialog, OKHdl, Button*, void)
bConfirmFailed = true;
if ( bConfirmFailed )
{
- ScopedVclPtrInstance< MessageDialog > aBox(this, SfxResId(STR_ERROR_WRONG_CONFIRM));
- aBox->Execute();
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok,
+ SfxResId(STR_ERROR_WRONG_CONFIRM)));
+ xBox->run();
mpConfirm1ED->SetText( OUString() );
mpConfirm1ED->GrabFocus();
}
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 38d9fd8b4cc4..412b02f35110 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -1885,14 +1885,10 @@ void SfxCommonTemplateDialog_Impl::DeleteHdl()
// we only want to show the dialog once and if we want to delete a style in use (UX-advice)
if ( bUsedStyle )
{
- #if defined UNX
- ScopedVclPtrInstance<MessageDialog> aBox(SfxGetpApp()->GetTopWindow(), aMsg,
- VclMessageType::Question, VclButtonsType::YesNo);
- #else
- ScopedVclPtrInstance<MessageDialog> aBox(GetWindow(), aMsg,
- VclMessageType::Question, VclButtonsType::YesNo);
- #endif
- aApproved = aBox->Execute() == RET_YES;
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Question, VclButtonsType::YesNo,
+ aMsg));
+ aApproved = xBox->run() == RET_YES;
}
// if there are no used styles selected or the user approved the changes
diff --git a/sfx2/source/doc/QuerySaveDocument.cxx b/sfx2/source/doc/QuerySaveDocument.cxx
index a6f5ec97b73f..9d66a164563c 100644
--- a/sfx2/source/doc/QuerySaveDocument.cxx
+++ b/sfx2/source/doc/QuerySaveDocument.cxx
@@ -18,10 +18,10 @@
*/
#include <sfx2/QuerySaveDocument.hxx>
-#include <vcl/layout.hxx>
#include <vcl/svapp.hxx>
+#include <vcl/weld.hxx>
-short ExecuteQuerySaveDocument(vcl::Window* _pParent, const OUString& _rTitle)
+short ExecuteQuerySaveDocument(weld::Widget* _pParent, const OUString& _rTitle)
{
if (Application::IsHeadlessModeEnabled())
{
@@ -29,9 +29,10 @@ short ExecuteQuerySaveDocument(vcl::Window* _pParent, const OUString& _rTitle)
return RET_NO;
}
- ScopedVclPtrInstance< MessageDialog > aQBox(_pParent, "QuerySaveDialog", "sfx/ui/querysavedialog.ui");
- aQBox->set_primary_text(aQBox->get_primary_text().replaceFirst("$(DOC)", _rTitle));
- return aQBox->Execute();
+ std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(_pParent, "sfx/ui/querysavedialog.ui"));
+ std::unique_ptr<weld::MessageDialog> xQBox(xBuilder->weld_message_dialog("QuerySaveDialog"));
+ xQBox->set_primary_text(xQBox->get_primary_text().replaceFirst("$(DOC)", _rTitle));
+ return xQBox->run();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 4f878d32f14d..824f8598f3cc 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -64,7 +64,7 @@
#include <tools/urlobj.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/mimeconfighelper.hxx>
-#include <vcl/layout.hxx>
+#include <vcl/weld.hxx>
#include <vcl/window.hxx>
#include <toolkit/awt/vclxwindow.hxx>
#include <o3tl/char16_t2wchar_t.hxx>
@@ -666,10 +666,10 @@ sal_Int8 ModelData_Impl::CheckSaveAcceptable( sal_Int8 nCurStatus )
&& GetMediaDescr().find( OUString("VersionComment") ) == GetMediaDescr().end() )
{
// notify the user that SaveAs is going to be done
- vcl::Window* pWin = SfxStoringHelper::GetModelWindow( m_xModel );
- ScopedVclPtrInstance<MessageDialog> aMessageBox(pWin, SfxResId(STR_NEW_FILENAME_SAVE),
- VclMessageType::Question, VclButtonsType::OkCancel);
- if ( aMessageBox->Execute() == RET_OK )
+ vcl::Window* pWin = SfxStoringHelper::GetModelWindow(m_xModel);
+ std::unique_ptr<weld::MessageDialog> xMessageBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+ VclMessageType::Question, VclButtonsType::OkCancel, SfxResId(STR_NEW_FILENAME_SAVE)));
+ if (xMessageBox->run() == RET_OK)
nResult = STATUS_SAVEAS;
else
nResult = STATUS_NO_ACTION;
@@ -1388,8 +1388,9 @@ bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& xMo
|| SignatureState::NOTVALIDATED == nDocumentSignatureState
|| SignatureState::PARTIAL_OK == nDocumentSignatureState)
{
- if (ScopedVclPtrInstance<MessageDialog>(nullptr, SfxResId(RID_SVXSTR_XMLSEC_QUERY_LOSINGSIGNATURE),
- VclMessageType::Question, VclButtonsType::YesNo)->Execute() != RET_YES)
+ std::unique_ptr<weld::MessageDialog> xMessageBox(Application::CreateMessageDialog(nullptr,
+ VclMessageType::Question, VclButtonsType::YesNo, SfxResId(RID_SVXSTR_XMLSEC_QUERY_LOSINGSIGNATURE)));
+ if (xMessageBox->run() != RET_YES)
{
// the user has decided not to store the document
throw task::ErrorCodeIOException(
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 52af0eb7a3c1..2d59f8fc6bbe 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -63,6 +63,7 @@
#include <basic/sbstar.hxx>
#include <basic/basmgr.hxx>
#include <vcl/msgbox.hxx>
+#include <vcl/weld.hxx>
#include <basic/sbx.hxx>
#include <svtools/sfxecode.hxx>
#include <svtools/ehdl.hxx>
@@ -1826,8 +1827,9 @@ bool SfxObjectShell::IsContinueImportOnFilterExceptions(const OUString& aErrMess
if (!aErrMessage.isEmpty())
aMessage += SfxResId(STR_QMSG_ERROR_OPENING_FILE_DETAILS) + aErrMessage;
aMessage += SfxResId(STR_QMSG_ERROR_OPENING_FILE_CONTINUE);
- ScopedVclPtrInstance< MessageDialog > aBox(nullptr, aMessage, VclMessageType::Question, VclButtonsType::YesNo);
- mbContinueImportOnFilterExceptions = (aBox->Execute() == RET_YES) ? yes : no;
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr,
+ VclMessageType::Question, VclButtonsType::YesNo, aMessage));
+ mbContinueImportOnFilterExceptions = (xBox->run() == RET_YES) ? yes : no;
}
else
mbContinueImportOnFilterExceptions = no;
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 51e1a1ecfe16..c69cbe927643 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -45,10 +45,10 @@
#include <com/sun/star/security/DocumentDigitalSignatures.hpp>
#include <tools/urlobj.hxx>
#include <svl/whiter.hxx>
-#include <vcl/layout.hxx>
#include <svl/intitem.hxx>
#include <svl/eitem.hxx>
#include <svl/visitem.hxx>
+#include <vcl/weld.hxx>
#include <vcl/wrkwin.hxx>
#include <svtools/sfxecode.hxx>
#include <svtools/ehdl.hxx>
@@ -319,8 +319,9 @@ void SfxObjectShell::CheckOut( )
}
catch ( const uno::RuntimeException& e )
{
- ScopedVclPtrInstance< MessageDialog > pErrorBox( &GetFrame()->GetWindow(), e.Message );
- pErrorBox->Execute( );
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrame()->GetWindow().GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, e.Message));
+ xBox->run();
}
}
@@ -337,8 +338,9 @@ void SfxObjectShell::CancelCheckOut( )
}
catch ( const uno::RuntimeException& e )
{
- ScopedVclPtrInstance< MessageDialog > pErrorBox(&GetFrame()->GetWindow(), e.Message);
- pErrorBox->Execute( );
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrame()->GetWindow().GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, e.Message));
+ xBox->run();
}
}
@@ -359,8 +361,9 @@ void SfxObjectShell::CheckIn( )
}
catch ( const uno::RuntimeException& e )
{
- ScopedVclPtrInstance< MessageDialog > pErrorBox(&GetFrame()->GetWindow(), e.Message);
- pErrorBox->Execute( );
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrame()->GetWindow().GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, e.Message));
+ xBox->run();
}
}
@@ -373,8 +376,9 @@ uno::Sequence< document::CmisVersion > SfxObjectShell::GetCmisVersions( )
}
catch ( const uno::RuntimeException& e )
{
- ScopedVclPtrInstance< MessageDialog > pErrorBox(&GetFrame()->GetWindow(), e.Message);
- pErrorBox->Execute( );
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrame()->GetWindow().GetFrameWeld(),
+ VclMessageType::Warning, VclButtonsType::Ok, e.Message));
+ xBox->run();
}
return uno::Sequence< document::CmisVersion > ( );
}
@@ -795,7 +799,9 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
}
case SID_CANCELCHECKOUT:
{
- if (ScopedVclPtrInstance<MessageDialog>(nullptr, SfxResId(STR_QUERY_CANCELCHECKOUT), VclMessageType::Question, VclButtonsType::YesNo)->Execute() == RET_YES)
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr,
+ VclMessageType::Question, VclButtonsType::YesNo, SfxResId(STR_QUERY_CANCELCHECKOUT)));
+ if (xBox->run() == RET_YES)
{
CancelCheckOut( );
@@ -1344,7 +1350,10 @@ void SfxObjectShell::ImplSign( bool bScriptingContent )
)
{
// Only OASIS and OOo6.x formats will be handled further
- ScopedVclPtrInstance<MessageDialog>( nullptr, SfxResId( STR_INFO_WRONGDOCFORMAT ), VclMessageType::Info )->Execute();
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr,
+ VclMessageType::Info, VclButtonsType::Ok, SfxResId(STR_INFO_WRONGDOCFORMAT)));
+
+ xBox->run();
return;
}
@@ -1388,9 +1397,12 @@ void SfxObjectShell::ImplSign( bool bScriptingContent )
if ( nVersion >= SvtSaveOptions::ODFVER_012 )
{
+ OUString sQuestion(bHasSign ? SfxResId(STR_XMLSEC_QUERY_SAVESIGNEDBEFORESIGN) : SfxResId(RID_SVXSTR_XMLSEC_QUERY_SAVEBEFORESIGN));
+ std::unique_ptr<weld::MessageDialog> xQuestion(Application::CreateMessageDialog(nullptr,
+ VclMessageType::Question, VclButtonsType::YesNo, sQuestion));
+
- if ( (bHasSign && ScopedVclPtrInstance<MessageDialog>(nullptr, SfxResId(STR_XMLSEC_QUERY_SAVESIGNEDBEFORESIGN), VclMessageType::Question, VclButtonsType::YesNo)->Execute() == RET_YES)
- || (!bHasSign && ScopedVclPtrInstance<MessageDialog>(nullptr, SfxResId(RID_SVXSTR_XMLSEC_QUERY_SAVEBEFORESIGN), VclMessageType::Question, VclButtonsType::YesNo)->Execute() == RET_YES) )
+ if (xQuestion->run() == RET_YES)
{
sal_uInt16 nId = SID_SAVEDOC;
if ( !GetMedium() || GetMedium()->GetName().isEmpty() )
@@ -1406,7 +1418,9 @@ void SfxObjectShell::ImplSign( bool bScriptingContent )
|| SotStorage::GetVersion( GetMedium()->GetStorage() ) <= SOFFICE_FILEFORMAT_60 ) )
{
// Only OASIS format will be handled further
- ScopedVclPtrInstance<MessageDialog>( nullptr, SfxResId( STR_INFO_WRONGDOCFORMAT ), VclMessageType::Info )->Execute();
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr,
+ VclMessageType::Info, VclButtonsType::Ok, SfxResId(STR_INFO_WRONGDOCFORMAT)));
+ xBox->run();
return;
}
}
@@ -1421,7 +1435,9 @@ void SfxObjectShell::ImplSign( bool bScriptingContent )
}
else
{
- ScopedVclPtrInstance<MessageDialog>(nullptr, SfxResId(STR_XMLSEC_ODF12_EXPECTED))->Execute();
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr,
+ VclMessageType::Warning, VclButtonsType::Ok, SfxResId(STR_XMLSEC_ODF12_EXPECTED)));
+ xBox->run();
return;
}
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index f22557e7ce24..53ec4e2af9c6 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -35,6 +35,7 @@
#include <osl/file.hxx>
#include <rtl/instance.hxx>
#include <vcl/msgbox.hxx>
+#include <vcl/weld.hxx>
#include <vcl/wrkwin.hxx>
#include <vcl/svapp.hxx>
#include <svl/eitem.hxx>
@@ -576,7 +577,7 @@ bool SfxObjectShell::PrepareClose
{
const Reference< XTitle > xTitle( *pImpl->pBaseModel.get(), UNO_QUERY_THROW );
const OUString sTitle = xTitle->getTitle ();
- nRet = ExecuteQuerySaveDocument(&pFrame->GetWindow(),sTitle);
+ nRet = ExecuteQuerySaveDocument(pFrame->GetWindow().GetFrameWeld(), sTitle);
}
/*HACK for plugin::destroy()*/
diff --git a/sfx2/source/doc/saveastemplatedlg.cxx b/sfx2/source/doc/saveastemplatedlg.cxx
index 8096f60b9de9..168c39bc7e79 100644
--- a/sfx2/source/doc/saveastemplatedlg.cxx
+++ b/sfx2/source/doc/saveastemplatedlg.cxx
@@ -19,8 +19,8 @@
#include <sfx2/doctempl.hxx>
#include <sfx2/docfilt.hxx>
#include <vcl/edit.hxx>
-#include <vcl/layout.hxx>
#include <vcl/lstbox.hxx>
+#include <vcl/weld.hxx>
#include <sot/storage.hxx>
#include <com/sun/star/frame/DocumentTemplates.hpp>
@@ -77,15 +77,15 @@ void SfxSaveAsTemplateDialog::setDocumentModel(const uno::Reference<frame::XMode
IMPL_LINK_NOARG(SfxSaveAsTemplateDialog, OkClickHdl, Button*, void)
{
- ScopedVclPtrInstance< MessageDialog > aQueryDlg(this, OUString(), VclMessageType::Question, VclButtonsType::YesNo);
-
+ std::unique_ptr<weld::MessageDialog> xQueryDlg(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo,
+ OUString()));
if(!IsTemplateNameUnique())
{
OUString sQueryMsg(SfxResId(STR_QMSG_TEMPLATE_OVERWRITE));
sQueryMsg = sQueryMsg.replaceFirst("$1",msTemplateName);
- aQueryDlg->set_primary_text(sQueryMsg.replaceFirst("$2", msSelectedCategory));
+ xQueryDlg->set_primary_text(sQueryMsg.replaceFirst("$2", msSelectedCategory));
- if( aQueryDlg->Execute() == RET_NO )
+ if (xQueryDlg->run() == RET_NO)
return;
}
@@ -94,7 +94,9 @@ IMPL_LINK_NOARG(SfxSaveAsTemplateDialog, OkClickHdl, Button*, void)
else
{
OUString sText( SfxResId(STR_ERROR_SAVEAS) );
- ScopedVclPtrInstance<MessageDialog>(this, sText.replaceFirst("$1", msTemplateName))->Execute();
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok,
+ sText.replaceFirst("$1", msTemplateName)));
+ xBox->run();
}
}
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 6ab085296433..a5388e1a5649 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -36,9 +36,9 @@
#include <unotools/pathoptions.hxx>
#include <unotools/viewoptions.hxx>
#include <vcl/edit.hxx>
-#include <vcl/layout.hxx>
#include <vcl/toolbox.hxx>
#include <vcl/lstbox.hxx>
+#include <vcl/weld.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/configuration/theDefaultProvider.hpp>
@@ -630,7 +630,9 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg, ImportClickHdl, Button*, void)
else
{
OUString aMsg( SfxResId(STR_CREATE_ERROR) );
- ScopedVclPtrInstance<MessageDialog>(this, aMsg.replaceFirst("$1", sCategory))->Execute();
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok,
+ aMsg.replaceFirst("$1", sCategory)));
+ xBox->run();
return;
}
}
@@ -748,7 +750,9 @@ IMPL_LINK(SfxTemplateManagerDlg, DeleteTemplateHdl, ThumbnailViewItem*, pItem, v
if (!aDeletedTemplate.isEmpty())
{
OUString aMsg( SfxResId(STR_MSG_ERROR_DELETE_TEMPLATE) );
- ScopedVclPtrInstance<MessageDialog>(this, aMsg.replaceFirst("$1",aDeletedTemplate))->Execute();
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok,
+ aMsg.replaceFirst("$1",aDeletedTemplate)));
+ xBox->run();
}
}
@@ -967,7 +971,9 @@ void SfxTemplateManagerDlg::OnTemplateImportCategory(const OUString& sCategory)
{
OUString aMsg(SfxResId(STR_MSG_ERROR_IMPORT));
aMsg = aMsg.replaceFirst("$1",pContItem->maTitle);
- ScopedVclPtrInstance<MessageDialog>(this, aMsg.replaceFirst("$2",aTemplateList))->Execute();
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok,
+ aMsg.replaceFirst("$2",aTemplateList)));
+ xBox->run();
}
}
}
@@ -1056,12 +1062,16 @@ void SfxTemplateManagerDlg::OnTemplateExport()
if (!aTemplateList.isEmpty())
{
OUString aText( SfxResId(STR_MSG_ERROR_EXPORT) );
- ScopedVclPtrInstance<MessageDialog>(this, aText.replaceFirst("$1",aTemplateList))->Execute();
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok,
+ aText.replaceFirst("$1",aTemplateList)));
+ xBox->run();
}
else
{
OUString sText( SfxResId(STR_MSG_EXPORT_SUCCESS) );
- ScopedVclPtrInstance<MessageDialog>(this, sText.replaceFirst("$1", OUString::number(nCount)), VclMessageType::Info)->Execute();
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Info, VclButtonsType::Ok,
+ sText.replaceFirst("$1", OUString::number(nCount))));
+ xBox->run();
}
}
}
@@ -1117,7 +1127,9 @@ void SfxTemplateManagerDlg::OnCategoryNew()
else
{
OUString aMsg( SfxResId(STR_CREATE_ERROR) );
- ScopedVclPtrInstance<MessageDialog>(this, aMsg.replaceFirst("$1", aName))->Execute();
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok,
+ aMsg.replaceFirst("$1", aName)));
+ xBox->run();
}
}
}
@@ -1147,7 +1159,9 @@ void SfxTemplateManagerDlg::OnCategoryRename()
else
{
OUString aMsg( SfxResId(STR_CREATE_ERROR) );
- ScopedVclPtrInstance<MessageDialog>(this, aMsg.replaceFirst("$1", aName))->Execute();
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok,
+ aMsg.replaceFirst("$1", aName)));
+ xBox->run();
}
}
}
@@ -1164,10 +1178,9 @@ void SfxTemplateManagerDlg::OnCategoryDelete()
{
OUString sCategory = aDlg->GetSelectedCategory();
aDlg.disposeAndClear();
- ScopedVclPtrInstance< MessageDialog > popupDlg(this, SfxResId(STR_QMSG_SEL_FOLDER_DELETE),
- VclMessageType::Question, VclButtonsType::YesNo);
-
- if ( popupDlg->Execute() != RET_YES )
+ std::unique_ptr<weld::MessageDialog> popupDlg(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo,
+ SfxResId(STR_QMSG_SEL_FOLDER_DELETE)));
+ if (popupDlg->run() != RET_YES)
return;
sal_Int16 nItemId = mpLocalView->getRegionId(sCategory);
@@ -1175,7 +1188,9 @@ void SfxTemplateManagerDlg::OnCategoryDelete()
if (!mpLocalView->removeRegion(nItemId))
{
OUString sMsg( SfxResId(STR_MSG_ERROR_DELETE_FOLDER) );
- ScopedVclPtrInstance<MessageDialog>(this, sMsg.replaceFirst("$1",sCategory))->Execute();
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok,
+ sMsg.replaceFirst("$1",sCategory)));
+ xBox->run();
}
else
{
@@ -1241,7 +1256,9 @@ void SfxTemplateManagerDlg::localSearchMoveTo(sal_uInt16 nItemId)
OUString sDst = mpLocalView->getRegionItemName(nItemId);
OUString sMsg(SfxResId(STR_MSG_ERROR_LOCAL_MOVE));
sMsg = sMsg.replaceFirst("$1",sDst);
- ScopedVclPtrInstance<MessageDialog>(this, sMsg.replaceFirst( "$2",pItem->maTitle))->Execute();
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Warning, VclButtonsType::Ok,
+ sMsg.replaceFirst( "$2",pItem->maTitle)));
+ xBox->run();
}
}
}
diff --git a/sfx2/source/inc/alienwarn.hxx b/sfx2/source/inc/alienwarn.hxx
index fc4a52bfad1a..7d2414aad8bc 100644
--- a/sfx2/source/inc/alienwarn.hxx
+++ b/sfx2/source/inc/alienwarn.hxx
@@ -20,7 +20,7 @@
#define INCLUDED_SFX2_SOURCE_INC_ALIENWARN_HXX
#include <vcl/button.hxx>
-#include <vcl/layout.hxx>
+#include <vcl/messagedialog.hxx>
class SfxAlienWarningDialog : public MessageDialog
{
diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx
index 381da18b8916..5263a8b74b16 100644
--- a/sfx2/source/inc/templdgi.hxx
+++ b/sfx2/source/inc/templdgi.hxx
@@ -28,6 +28,7 @@ class SfxTemplateControllerItem;
#include <vcl/button.hxx>
#include <vcl/toolbox.hxx>
#include <vcl/lstbox.hxx>
+#include <vcl/weld.hxx>
#include <svl/lstner.hxx>
#include <svtools/treelistbox.hxx>
#include <svl/eitem.hxx>
@@ -316,6 +317,11 @@ public:
return pWindow;
}
+ weld::Widget* GetFrameWeld()
+ {
+ return pWindow ? pWindow->GetFrameWeld() : nullptr;
+ }
+
void EnableTreeDrag(bool b);
void EnableExample_Impl(sal_uInt16 nId, bool bEnable);
SfxStyleFamily GetActualFamily() const;
diff --git a/sfx2/source/view/classificationhelper.cxx b/sfx2/source/view/classificationhelper.cxx
index f167dc8428a8..a642d19b65e8 100644
--- a/sfx2/source/view/classificationhelper.cxx
+++ b/sfx2/source/view/classificationhelper.cxx
@@ -33,7 +33,7 @@
#include <sfx2/viewfrm.hxx>
#include <tools/datetime.hxx>
#include <unotools/datetime.hxx>
-#include <vcl/layout.hxx>
+#include <vcl/weld.hxx>
#include <svl/fstathelper.hxx>
#include <config_folders.h>
@@ -528,14 +528,24 @@ bool SfxClassificationHelper::ShowPasteInfo(SfxClassificationCheckPasteResult eR
case SfxClassificationCheckPasteResult::TargetDocNotClassified:
{
if (!Application::IsHeadlessModeEnabled())
- ScopedVclPtrInstance<MessageDialog>(nullptr, SfxResId(STR_TARGET_DOC_NOT_CLASSIFIED), VclMessageType::Info)->Execute();
+ {
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr,
+ VclMessageType::Info, VclButtonsType::Ok,
+ SfxResId(STR_TARGET_DOC_NOT_CLASSIFIED)));
+ xBox->run();
+ }
return false;
}
break;
case SfxClassificationCheckPasteResult::DocClassificationTooLow:
{
if (!Application::IsHeadlessModeEnabled())
- ScopedVclPtrInstance<MessageDialog>(nullptr, SfxResId(STR_DOC_CLASSIFICATION_TOO_LOW), VclMessageType::Info)->Execute();
+ {
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr,
+ VclMessageType::Info, VclButtonsType::Ok,
+ SfxResId(STR_DOC_CLASSIFICATION_TOO_LOW)));
+ xBox->run();
+ }
return false;
}
break;
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index ea7e02d26475..a7874e1934b0 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -40,7 +40,7 @@
#include <svl/slstitm.hxx>
#include <svl/whiter.hxx>
#include <svl/undo.hxx>
-#include <vcl/layout.hxx>
+#include <vcl/weld.hxx>
#include <svtools/sfxecode.hxx>
#include <svtools/miscopt.hxx>
#include <svtools/ehdl.hxx>
@@ -154,35 +154,25 @@ void SfxViewFrame::InitInterface_Impl()
namespace {
/// Asks the user if editing a read-only document is really wanted.
-class SfxEditDocumentDialog : public MessageDialog
+class SfxEditDocumentDialog
{
private:
- VclPtr<PushButton> m_pEditDocument;
- VclPtr<PushButton> m_pCancel;
+ std::unique_ptr<weld::Builder> m_xBuilder;
+ std::unique_ptr<weld::MessageDialog> m_xDialog;
+ std::unique_ptr<weld::Button> m_xEditDocument;
+ std::unique_ptr<weld::Button> m_xCancel;
public:
- SfxEditDocumentDialog(vcl::Window* pParent);
- ~SfxEditDocumentDialog() override;
- void dispose() override;
+ SfxEditDocumentDialog(weld::Widget* pParent);
+ short run() { return m_xDialog->run(); }
};
-SfxEditDocumentDialog::SfxEditDocumentDialog(vcl::Window* pParent)
- : MessageDialog(pParent, "EditDocumentDialog", "sfx/ui/editdocumentdialog.ui")
+SfxEditDocumentDialog::SfxEditDocumentDialog(weld::Widget* pParent)
+ : m_xBuilder(Application::CreateBuilder(pParent, "sfx/ui/editdocumentdialog.ui"))
+ , m_xDialog(m_xBuilder->weld_message_dialog("EditDocumentDialog"))
+ , m_xEditDocument(m_xBuilder->weld_button("edit"))
+ , m_xCancel(m_xBuilder->weld_button("cancel"))
{
- get(m_pEditDocument, "edit");
- get(m_pCancel, "cancel");
-}
-
-SfxEditDocumentDialog::~SfxEditDocumentDialog()
-{
- disposeOnce();
-}
-
-void SfxEditDocumentDialog::dispose()
-{
- m_pEditDocument.clear();
- m_pCancel.clear();
- MessageDialog::dispose();
}
class SfxQueryOpenAsTemplate : public QueryBox
@@ -588,9 +578,10 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
if ( bDo && GetFrame().DocIsModified_Impl() &&
!rReq.IsAPI() && ( !pSilentItem || !pSilentItem->GetValue() ) )
{
- ScopedVclPtrInstance<MessageDialog> aBox(&GetWindow(), SfxResId(STR_QUERY_LASTVERSION),
- VclMessageType::Question, VclButtonsType::YesNo);
- bDo = ( RET_YES == aBox->Execute() );
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetWindow().GetFrameWeld(),
+ VclMessageType::Question, VclButtonsType::YesNo,
+ SfxResId(STR_QUERY_LASTVERSION)));
+ bDo = RET_YES == xBox->run();
}
if ( bDo )
@@ -756,9 +747,10 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
if ( bForEdit && ( SID_EDITDOC == rReq.GetSlot() || SID_READONLYDOC == rReq.GetSlot() ) )
{
// ask user for opening as template
- ScopedVclPtrInstance<MessageDialog> aBox(&GetWindow(), SfxResId(STR_QUERY_OPENASTEMPLATE),
- VclMessageType::Question, VclButtonsType::YesNo);
- if ( RET_YES == aBox->Execute() )
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetWindow().GetFrameWeld(),
+ VclMessageType::Question, VclButtonsType::YesNo,
+ SfxResId(STR_QUERY_OPENASTEMPLATE)));
+ if (RET_YES == xBox->run())
{
SfxAllItemSet aSet( pApp->GetPool() );
aSet.Put( SfxStringItem( SID_FILE_NAME, pMedium->GetName() ) );
@@ -1345,12 +1337,12 @@ void SfxViewFrame::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
}
}
-IMPL_LINK_NOARG(SfxViewFrame, SwitchReadOnlyHandler, Button*, void)
+IMPL_LINK(SfxViewFrame, SwitchReadOnlyHandler, Button*, pButton, void)
{
if (m_xObjSh.is() && IsSignPDF(m_xObjSh))
{
- ScopedVclPtrInstance<SfxEditDocumentDialog> pDialog(nullptr);
- if (pDialog->Execute() != RET_OK)
+ SfxEditDocumentDialog aDialog(pButton->GetFrameWeld());
+ if (aDialog.run() != RET_OK)
return;
}
GetDispatcher()->Execute(SID_EDITDOC);
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index a5be4fff8b7d..1d070d54e978 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -23,7 +23,7 @@
#include <com/sun/star/view/XRenderable.hpp>
#include <svl/itempool.hxx>
-#include <vcl/layout.hxx>
+#include <vcl/weld.hxx>
#include <svtools/prnsetup.hxx>
#include <svl/flagitem.hxx>
#include <svl/stritem.hxx>
@@ -333,7 +333,13 @@ void SfxPrinterController::jobFinished( css::view::PrintableState nState )
// "real" problem (not simply printing cancelled by user)
OUString aMsg( SfxResId(STR_NOSTARTPRINTER) );
if ( !m_bApi )
- ScopedVclPtrInstance<MessageDialog>(mpViewShell->GetWindow(), aMsg)->Execute();
+ {
+ vcl::Window* pWindow = mpViewShell->GetWindow();
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr,
+ VclMessageType::Warning, VclButtonsType::Ok,
+ aMsg));
+ xBox->run();
+ }
SAL_FALLTHROUGH;
}
case view::PrintableState_JOB_ABORTED :
@@ -505,11 +511,16 @@ void SfxViewShell::SetPrinter_Impl( VclPtr<SfxPrinter>& pNewPrinter )
SfxPrinterChangeFlags nChangedFlags = SfxPrinterChangeFlags::NONE;
// Ask if possible, if page format should be taken over from printer.
- if ( ( bOriChg || bPgSzChg ) &&
- RET_YES == ScopedVclPtrInstance<MessageDialog>(nullptr, aMsg, VclMessageType::Question, VclButtonsType::YesNo)->Execute() )
+ if (bOriChg || bPgSzChg)
{
- // Flags with changes for <SetPrinter(SfxPrinter*)> are maintained
- nChangedFlags |= nNewOpt;
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr,
+ VclMessageType::Question, VclButtonsType::YesNo,
+ aMsg));
+ if (RET_YES == xBox->run())
+ {
+ // Flags with changes for <SetPrinter(SfxPrinter*)> are maintained
+ nChangedFlags |= nNewOpt;
+ }
}
// For the MAC to have its "temporary of class String" in next if()
@@ -778,7 +789,12 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
{
// no valid printer either in ItemSet or at the document
if ( !bSilent )
- ScopedVclPtrInstance<MessageDialog>(nullptr, SfxResId(STR_NODEFPRINTER))->Execute();
+ {
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr,
+ VclMessageType::Warning, VclButtonsType::Ok,
+ SfxResId(STR_NODEFPRINTER)));
+ xBox->run();
+ }
rReq.SetReturnValue(SfxBoolItem(0,false));
@@ -790,7 +806,12 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
{
// if printer is busy, abort configuration
if ( !bSilent )
- ScopedVclPtrInstance<MessageDialog>(nullptr, SfxResId(STR_ERROR_PRINTER_BUSY), VclMessageType::Info)->Execute();
+ {
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr,
+ VclMessageType::Info, VclButtonsType::Ok,
+ SfxResId(STR_ERROR_PRINTER_BUSY)));
+ xBox->run();
+ }
rReq.SetReturnValue(SfxBoolItem(0,false));
return;
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index d7962e72be16..f5b0f7399318 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -22,9 +22,9 @@
#include <svl/stritem.hxx>
#include <svl/eitem.hxx>
#include <svl/whiter.hxx>
-#include <vcl/layout.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/toolbox.hxx>
+#include <vcl/weld.hxx>
#include <svl/intitem.hxx>
#include <svtools/langhelp.hxx>
#include <svtools/sfxecode.hxx>
@@ -497,8 +497,11 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
if ( eResult == SfxMailModel::SEND_MAIL_ERROR )
{
- ScopedVclPtrInstance< MessageDialog > aBox(SfxGetpApp()->GetTopWindow(), SfxResId( STR_ERROR_SEND_MAIL ), VclMessageType::Info);
- aBox->Execute();
+ vcl::Window* pWin = SfxGetpApp()->GetTopWindow();
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+ VclMessageType::Info, VclButtonsType::Ok,
+ SfxResId(STR_ERROR_SEND_MAIL)));
+ xBox->run();
rReq.Ignore();
}
else
@@ -517,9 +520,12 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
SfxMailModel::SendMailResult eResult = aModel.SaveAndSend( xFrame );
if( eResult == SfxMailModel::SEND_MAIL_ERROR )
{
- ScopedVclPtrInstance< MessageDialog > aBox(SfxGetpApp()->GetTopWindow(), SfxResId( STR_ERROR_SEND_MAIL ), VclMessageType::Info);
- aBox->Execute();
- rReq.Ignore();
+ vcl::Window* pWin = SfxGetpApp()->GetTopWindow();
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr,
+ VclMessageType::Info, VclButtonsType::Ok,
+ SfxResId(STR_ERROR_SEND_MAIL)));
+ xBox->run();
+ rReq.Ignore();
}
else
rReq.Done();
@@ -1116,8 +1122,10 @@ bool SfxViewShell::PrepareClose
{
if ( bUI )
{
- ScopedVclPtrInstance< MessageDialog > aInfoBox(&GetViewFrame()->GetWindow(), SfxResId( STR_CANT_CLOSE ), VclMessageType::Info );
- aInfoBox->Execute();
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetViewFrame()->GetWindow().GetFrameWeld(),
+ VclMessageType::Info, VclButtonsType::Ok,
+ SfxResId(STR_CANT_CLOSE)));
+ xBox->run();
}
return false;