diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-02-19 16:33:35 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-02-22 22:07:38 +0100 |
commit | 6a4c464b49dbfa2801818ead1b50bc9580824d00 (patch) | |
tree | 3d6381b6b13576bc536670992b36784436486e95 /sw/source | |
parent | f7733528e88a6619f82b54b59e92a9bca72c0a89 (diff) |
weld native message dialogs
just the straight-forward MessageDialog cases first
a) remove border_width from message dialog .ui so as to take
the default border width
b) retain 12 as default message dialog border for vcl widget case
c) remove layour_style from message dialog button boxes so as to
take the default mode (a no-op for vcl widget case)
d) use gtk response ids (vcl builder will converts to vcl ones)
Change-Id: I7de281093a1b64f92f71ca11e7cbba42bb658154
Reviewed-on: https://gerrit.libreoffice.org/50143
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source')
28 files changed, 237 insertions, 128 deletions
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index 5de324db4c85..1f2641b89b0a 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -20,7 +20,8 @@ #include <config_features.h> #include <vcl/dialog.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> +#include <vcl/svapp.hxx> #include <vcl/wrkwin.hxx> #include <vcl/settings.hxx> #include <viewopt.hxx> @@ -691,8 +692,9 @@ short SwShellCursor::MaxReplaceArived() } vActionCounts.push_back(nActCnt); } - nRet = ScopedVclPtrInstance<MessageDialog>(pDlg, "AskSearchDialog", - "modules/swriter/ui/asksearchdialog.ui")->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pDlg->GetFrameWeld(), "modules/swriter/ui/asksearchdialog.ui")); + std::unique_ptr<weld::MessageDialog> xDialog(xBuilder->weld_message_dialog("AskSearchDialog")); + nRet = xDialog->run(); auto pActionCount = vActionCounts.begin(); for(SwViewShell& rShell : const_cast< SwCursorShell* >( GetShell() )->GetRingContainer()) { diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index 166152f275b7..923bb541952c 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -29,7 +29,8 @@ #include <strings.hrc> #include <swmodule.hxx> #include <editsh.hxx> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <comphelper/flagguard.hxx> using namespace com::sun::star; @@ -2709,8 +2710,9 @@ void DocumentRedlineManager::checkRedlining(RedlineFlags& _rReadlineMode) if ( pParent && !mbReadlineChecked && rRedlineTable.size() > MAX_REDLINE_COUNT && ((_rReadlineMode & RedlineFlags::ShowDelete) != RedlineFlags::ShowDelete) ) { - ScopedVclPtrInstance< MessageDialog > aQuery(pParent, "QueryShowChangesDialog", "modules/swriter/ui/queryshowchangesdialog.ui"); - sal_uInt16 nResult = aQuery->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pParent->GetFrameWeld(), "modules/swriter/ui/queryshowchangesdialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("QueryShowChangesDialog")); + sal_uInt16 nResult = xQuery->run(); mbReadlineChecked = true; if ( nResult == RET_YES ) { diff --git a/sw/source/ui/config/optcomp.cxx b/sw/source/ui/config/optcomp.cxx index 688125e3202a..c02c74ce3851 100644 --- a/sw/source/ui/config/optcomp.cxx +++ b/sw/source/ui/config/optcomp.cxx @@ -28,7 +28,7 @@ #include <globals.hrc> #include <unotools/configmgr.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <sfx2/docfile.hxx> #include <sfx2/docfilt.hxx> #include <sfx2/fcontnr.hxx> @@ -260,9 +260,9 @@ IMPL_LINK_NOARG(SwCompatibilityOptPage, SelectHdl, ListBox&, void) IMPL_LINK_NOARG(SwCompatibilityOptPage, UseAsDefaultHdl, Button*, void) { - ScopedVclPtrInstance<MessageDialog> aQuery(this, "QueryDefaultCompatDialog", - "modules/swriter/ui/querydefaultcompatdialog.ui"); - if (aQuery->Execute() == RET_YES) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/swriter/ui/querydefaultcompatdialog.ui")); + std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("QueryDefaultCompatDialog")); + if (xQueryBox->run() == RET_YES) { for ( vector< SvtCompatibilityEntry >::iterator pItem = m_pImpl->m_aList.begin(); pItem != m_pImpl->m_aList.end(); ++pItem ) diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx index ded560e5bdb0..853574e67eb2 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.cxx +++ b/sw/source/ui/dbui/mmaddressblockpage.cxx @@ -21,7 +21,7 @@ #include <mailmergewizard.hxx> #include <swtypes.hxx> #include "addresslistdialog.hxx" -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/txtattr.hxx> #include <vcl/xtextedt.hxx> #include <vcl/builderfactory.hxx> @@ -183,7 +183,9 @@ IMPL_LINK_NOARG(SwMailMergeAddressBlockPage, AddressListHdl_Impl, Button*, void) catch (const uno::Exception& e) { SAL_WARN("sw", e); - ScopedVclPtrInstance<MessageDialog>(this, e.Message)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, e.Message)); + xBox->run(); } } diff --git a/sw/source/ui/dbui/mmoutputtypepage.cxx b/sw/source/ui/dbui/mmoutputtypepage.cxx index 3adfa2970897..6212ae20cf5c 100644 --- a/sw/source/ui/dbui/mmoutputtypepage.cxx +++ b/sw/source/ui/dbui/mmoutputtypepage.cxx @@ -21,6 +21,7 @@ #include <mailmergewizard.hxx> #include <mmconfigitem.hxx> #include <vcl/msgbox.hxx> +#include <vcl/messagedialog.hxx> #include <dbui.hrc> #include <strings.hrc> #include <bitmaps.hlst> diff --git a/sw/source/ui/dialog/swmessdialog.cxx b/sw/source/ui/dialog/swmessdialog.cxx index 79aba4459af6..c57f23534eb8 100644 --- a/sw/source/ui/dialog/swmessdialog.cxx +++ b/sw/source/ui/dialog/swmessdialog.cxx @@ -11,7 +11,7 @@ #include <vcl/button.hxx> #include <vcl/edit.hxx> #include <vcl/fixed.hxx> -#include <vcl/layout.hxx> +#include <vcl/messagedialog.hxx> #include <vcl/msgbox.hxx> #include <vcl/vclmedit.hxx> diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index aac5e2c1dfd1..1096103092da 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -22,7 +22,7 @@ #include <svl/urihelper.hxx> #include <svl/PasswordHelper.hxx> #include <vcl/svapp.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <svl/stritem.hxx> #include <svl/eitem.hxx> #include <sfx2/passwd.hxx> @@ -422,7 +422,10 @@ bool SwEditRegionDlg::CheckPasswd(CheckBox* pBox) } else { - ScopedVclPtrInstance<MessageDialog>(this, SwResId(STR_WRONG_PASSWORD), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_WRONG_PASSWORD))); + xInfoBox->run(); } } } @@ -989,7 +992,10 @@ IMPL_LINK( SwEditRegionDlg, UseFileHdl, Button *, pButton, void ) bool bContent = pSectRepr->IsContent(); if( pBox->IsChecked() && bContent && rSh.HasSelection() ) { - if (RET_NO == ScopedVclPtrInstance<MessageDialog>(this, SwResId(STR_QUERY_CONNECT), VclMessageType::Question, VclButtonsType::YesNo)->Execute()) + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + SwResId(STR_QUERY_CONNECT))); + if (RET_NO == xQueryBox->run()) pBox->Check( false ); } if( bFile ) @@ -1265,7 +1271,10 @@ IMPL_LINK( SwEditRegionDlg, ChangePasswdHdl, Button *, pBox, void ) } else { - ScopedVclPtrInstance<MessageDialog>(pBox, SwResId(STR_WRONG_PASSWD_REPEAT), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pBox->GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_WRONG_PASSWD_REPEAT))); + xInfoBox->run(); ChangePasswdHdl(pBox); break; } @@ -1702,7 +1711,10 @@ IMPL_LINK( SwInsertSectionTabPage, ChangePasswdHdl, Button *, pButton, void ) } else { - ScopedVclPtrInstance<MessageDialog>(pButton, SwResId(STR_WRONG_PASSWD_REPEAT), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pButton->GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_WRONG_PASSWD_REPEAT))); + xInfoBox->run(); } } else if(!bChange) @@ -1725,9 +1737,14 @@ IMPL_LINK( SwInsertSectionTabPage, UseFileHdl, Button *, pButton, void ) CheckBox* pBox = static_cast<CheckBox*>(pButton); if( pBox->IsChecked() ) { - if( m_pWrtSh->HasSelection() && - RET_NO == ScopedVclPtrInstance<MessageDialog>(this, SwResId(STR_QUERY_CONNECT), VclMessageType::Question, VclButtonsType::YesNo)->Execute()) - pBox->Check( false ); + if (m_pWrtSh->HasSelection()) + { + std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + SwResId(STR_QUERY_CONNECT))); + if (RET_NO == xQueryBox->run()) + pBox->Check( false ); + } } bool bFile = pBox->IsChecked(); diff --git a/sw/source/ui/envelp/labfmt.cxx b/sw/source/ui/envelp/labfmt.cxx index 18c4b2feb4bd..82a5b754f9c7 100644 --- a/sw/source/ui/envelp/labfmt.cxx +++ b/sw/source/ui/envelp/labfmt.cxx @@ -18,7 +18,7 @@ */ #include <tools/poly.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/settings.hxx> #include <vcl/builderfactory.hxx> @@ -639,19 +639,20 @@ IMPL_LINK_NOARG(SwSaveLabelDlg, OkHdl, Button*, void) if ( rCfg.IsPredefinedLabel(sMake, sType) ) { SAL_WARN( "sw.envelp", "label is predefined and cannot be overwritten" ); - ScopedVclPtrInstance<MessageDialog>(this, "CannotSaveLabelDialog", "modules/swriter/ui/cannotsavelabeldialog.ui")->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/swriter/ui/cannotsavelabeldialog.ui")); + std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("CannotSaveLabelDialog")); + xBox->run(); return; } - ScopedVclPtrInstance<MessageDialog> aQuery(this, "QuerySaveLabelDialog", - "modules/swriter/ui/querysavelabeldialog.ui"); - - aQuery->set_primary_text(aQuery->get_primary_text(). + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/swriter/ui/querysavelabeldialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("QuerySaveLabelDialog")); + xQuery->set_primary_text(xQuery->get_primary_text(). replaceAll("%1", sMake).replaceAll("%2", sType)); - aQuery->set_secondary_text(aQuery->get_secondary_text(). + xQuery->set_secondary_text(xQuery->get_secondary_text(). replaceAll("%1", sMake).replaceAll("%2", sType)); - if (RET_YES != aQuery->Execute()) + if (RET_YES != xQuery->run()) return; } rLabRec.m_aType = sType; diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index 4de77fd36e65..c5628740ffdb 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -30,7 +30,7 @@ #include <com/sun/star/util/SearchFlags.hpp> #include <i18nutil/searchopt.hxx> #include <svl/stritem.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <sfx2/dispatch.hxx> #include <svl/eitem.hxx> #include <unotools/textsearch.hxx> @@ -1219,8 +1219,10 @@ IMPL_LINK_NOARG(SwAuthorMarkPane, InsertHdl, Button*, void) bDifferent |= m_sFields[i] != pEntry->GetAuthorField(static_cast<ToxAuthorityField>(i)); if(bDifferent) { - ScopedVclPtrInstance< MessageDialog > aQuery(&m_rDialog, SwResId(STR_QUERY_CHANGE_AUTH_ENTRY), VclMessageType::Question, VclButtonsType::YesNo); - if(RET_YES != aQuery->Execute()) + std::unique_ptr<weld::MessageDialog> xQuery(Application::CreateMessageDialog(m_rDialog.GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + SwResId(STR_QUERY_CHANGE_AUTH_ENTRY))); + if (RET_YES != xQuery->run()) return; } } diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index e69802781349..53eade41ba0c 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -21,7 +21,7 @@ #include <o3tl/any.hxx> #include <vcl/menu.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/help.hxx> #include <vcl/builderfactory.hxx> #include <svl/stritem.hxx> @@ -461,7 +461,10 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn, bool ) const OUString aShortName(m_pShortNameEdit->GetText()); if(pGlossaryHdl->HasShortName(aShortName)) { - ScopedVclPtrInstance<MessageDialog>(this, SwResId(STR_DOUBLE_SHORTNAME), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_DOUBLE_SHORTNAME))); + xInfoBox->run(); m_pShortNameEdit->SetSelection(Selection(0, SELECTION_MAX)); m_pShortNameEdit->GrabFocus(); return true; @@ -589,7 +592,10 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn, bool ) Init(); else { - ScopedVclPtrInstance<MessageDialog>(this, SwResId( STR_NO_GLOSSARIES ), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_NO_GLOSSARIES))); + xInfoBox->run(); } } } @@ -668,9 +674,10 @@ IMPL_LINK_NOARG(SwGlossaryDlg, BibHdl, Button*, void) } else { - ScopedVclPtrInstance< MessageDialog > aBox(this, sReadonlyPath, VclMessageType::Question, VclButtonsType::YesNo); - - if(RET_YES == aBox->Execute()) + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + sReadonlyPath)); + if (RET_YES == xBox->run()) PathHdl(m_pPathBtn); } } @@ -802,7 +809,10 @@ IMPL_LINK_NOARG(SwNewGlosNameDlg, Rename, Button*, void) if( pDlg->pGlossaryHdl->HasShortName(m_pNewShort->GetText()) && sNew != m_pOldShort->GetText() ) { - ScopedVclPtrInstance<MessageDialog>(this, SwResId(STR_DOUBLE_SHORTNAME), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_DOUBLE_SHORTNAME))); + xBox->run(); m_pNewShort->GrabFocus(); } else @@ -1138,8 +1148,10 @@ void SwGlossaryDlg::DeleteEntry() const bool bExists = nullptr != pChild; const bool bIsGroup = pEntry && !pParent; - ScopedVclPtrInstance< MessageDialog > aQuery(this, SwResId(STR_QUERY_DELETE), VclMessageType::Question, VclButtonsType::YesNo); - if (bExists && !bIsGroup && RET_YES == aQuery->Execute()) + std::unique_ptr<weld::MessageDialog> xQuery(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + SwResId(STR_QUERY_DELETE))); + if (bExists && !bIsGroup && RET_YES == xQuery->run()) { if (!aTitle.isEmpty() && pGlossaryHdl->DelGlossary(aShortName)) { diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx index e20fb410a7bb..da09f637d51e 100644 --- a/sw/source/ui/misc/srtdlg.cxx +++ b/sw/source/ui/misc/srtdlg.cxx @@ -23,6 +23,7 @@ #include <vcl/lstbox.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <svl/intitem.hxx> #include <svl/eitem.hxx> #include <sfx2/dispatch.hxx> @@ -366,7 +367,13 @@ void SwSortDlg::Apply() } if( !bRet ) - ScopedVclPtrInstance<MessageDialog>(GetParent(), SwResId(STR_SRTERR), VclMessageType::Info)->Execute(); + { + vcl::Window* pWin = GetParent(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_SRTERR))); + xInfoBox->run(); + } } IMPL_LINK( SwSortDlg, DelimHdl, Button*, pButton, void ) diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index fe915df54d11..c7d65cb6f2db 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -19,7 +19,7 @@ #include <hintids.hxx> #include <comphelper/string.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/msgbox.hxx> #include <svl/stritem.hxx> #include <svl/intitem.hxx> @@ -633,7 +633,10 @@ DeactivateRC SwFormatTablePage::DeactivatePage( SfxItemSet* _pSet ) OUString sTableName = m_pNameED->GetText(); if(sTableName.indexOf(' ') != -1) { - ScopedVclPtrInstance<MessageDialog>(this, SwResId(STR_WRONG_TABLENAME), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_WRONG_TABLENAME))); + xInfoBox->run(); m_pNameED->GrabFocus(); return DeactivateRC::KeepPage; } diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 870766a2312e..c52304ff341a 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -30,8 +30,9 @@ #include <tools/urlobj.hxx> #include <unotools/tempfile.hxx> #include <unotools/configmgr.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <vcl/wrkwin.hxx> -#include <vcl/msgbox.hxx> #include <svl/lckbitem.hxx> #include <svl/eitem.hxx> #include <svl/zforlist.hxx> @@ -608,10 +609,9 @@ void SwDocShell::Execute(SfxRequest& rReq) std::shared_ptr<const SfxFilter> pFlt = GetMedium()->GetFilter(); if(!pFlt || pFlt->GetUserData() != pHtmlFlt->GetUserData()) { - ScopedVclPtrInstance<MessageDialog> aQuery(&pViewFrame->GetWindow(), - "SaveAsHTMLDialog", "modules/swriter/ui/saveashtmldialog.ui"); - - if(RET_YES == aQuery->Execute()) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pViewFrame->GetWindow().GetFrameWeld(), "modules/swriter/ui/saveashtmldialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("SaveAsHTMLDialog")); + if (RET_YES == xQuery->run()) bLocalHasName = false; else break; diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx index 2ebbe2be324d..dd2ee979dad6 100644 --- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx +++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx @@ -19,7 +19,8 @@ #include <memory> #include <SwSpellDialogChildWindow.hxx> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <editeng/svxacorr.hxx> #include <editeng/acorrcfg.hxx> #include <svx/svxids.hrc> @@ -386,9 +387,10 @@ The code below would only be part of the solution. if(m_pSpellState->m_xStartRange.is()) { LockFocusNotification( true ); - sal_uInt16 nRet = ScopedVclPtrInstance<MessageDialog>(GetWindow(), SwResId(STR_QUERY_SPELL_CONTINUE), - VclMessageType::Question, VclButtonsType::YesNo)->Execute(); - if(RET_YES == nRet) + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetWindow()->GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, SwResId(STR_QUERY_SPELL_CONTINUE))); + sal_uInt16 nRet = xBox->run(); + if (RET_YES == nRet) { SwUnoInternalPaM aPam(*pWrtShell->GetDoc()); if (::sw::XTextRangeToSwPaM(aPam, @@ -415,8 +417,9 @@ The code below would only be part of the solution. LockFocusNotification( true ); OUString sInfo(SwResId(STR_SPELLING_COMPLETED)); // #i84610# - vcl::Window* pTemp = GetWindow(); // temporary needed for g++ 3.3.5 - ScopedVclPtrInstance<MessageDialog>(pTemp, sInfo, VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetWindow()->GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, sInfo)); + xBox->run(); LockFocusNotification( false ); // take care that the now valid selection is stored LoseFocus(); diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx index 494c348a6465..e583f189d5dc 100644 --- a/sw/source/uibase/dochdl/gloshdl.cxx +++ b/sw/source/uibase/dochdl/gloshdl.cxx @@ -47,7 +47,8 @@ #include <strings.hrc> #include <swerror.h> #include <frmmgr.hxx> -#include <vcl/layout.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <vcl/lstbox.hxx> #include <editeng/acorrcfg.hxx> @@ -321,7 +322,9 @@ bool SwGlossaryHdl::NewGlossary(const OUString& rName, const OUString& rShortNam rCfg.IsSaveRelFile(), pOnlyText ); if(nSuccess == sal_uInt16(-1) ) { - ScopedVclPtrInstance<MessageDialog>(pWrtShell->GetView().GetWindow(), SwResId(STR_ERR_INSERT_GLOS), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWrtShell->GetView().GetWindow()->GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, SwResId(STR_ERR_INSERT_GLOS))); + xBox->run(); } if( !pCurGrp ) delete pTmp; diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 42c82b5e7550..34fe1fa3855a 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -42,7 +42,7 @@ #include <sfx2/linkmgr.hxx> #include <tools/urlobj.hxx> #include <vcl/wrkwin.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/msgbox.hxx> #include <sfx2/dispatch.hxx> #include <svl/stritem.hxx> @@ -378,10 +378,9 @@ namespace sal_uInt16 aRotation = aMetadata.getRotation(); if (aRotation != 0) { - ScopedVclPtrInstance< MessageDialog > aQueryBox( - nullptr, "QueryRotateIntoStandardOrientationDialog", - "modules/swriter/ui/queryrotateintostandarddialog.ui"); - if (aQueryBox->Execute() == RET_YES) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, "modules/swriter/ui/queryrotateintostandarddialog.ui")); + std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("QueryRotateIntoStandardOrientationDialog")); + if (xQueryBox->run() == RET_YES) { GraphicNativeTransform aTransform( aGraphic ); aTransform.rotate( aRotation ); @@ -1700,7 +1699,10 @@ bool SwTransferable::PasteFileContent( TransferableDataHelper& rData, if (bMsg && pResId) { - ScopedVclPtrInstance<MessageDialog>(nullptr, SwResId(pResId), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SwResId(pResId))); + xBox->run(); } return bRet; } @@ -1774,7 +1776,12 @@ bool SwTransferable::PasteOLE( TransferableDataHelper& rData, SwWrtShell& rSh, if( ! aReader.Read( *pRead ).IsError() ) bRet = true; else if( bMsg ) - ScopedVclPtrInstance<MessageDialog>(nullptr, SwResId(STR_ERROR_CLPBRD_READ), VclMessageType::Info)->Execute(); + { + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_ERROR_CLPBRD_READ))); + xBox->run(); + } } else { @@ -2152,7 +2159,12 @@ bool SwTransferable::PasteDDE( TransferableDataHelper& rData, if (nRows > SAL_MAX_UINT16 || nCols > SAL_MAX_UINT16) { if( bMsg ) - ScopedVclPtrInstance<MessageDialog>(nullptr, SwResId(STR_TABLE_TOO_LARGE), VclMessageType::Info)->Execute(); + { + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_TABLE_TOO_LARGE))); + xBox->run(); + } pDDETyp = nullptr; break; } @@ -2161,7 +2173,12 @@ bool SwTransferable::PasteDDE( TransferableDataHelper& rData, if( !nRows || !nCols ) { if( bMsg ) - ScopedVclPtrInstance<MessageDialog>(nullptr, SwResId(STR_NO_TABLE), VclMessageType::Info)->Execute(); + { + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_NO_TABLE))); + xBox->run(); + } pDDETyp = nullptr; break; } @@ -2707,7 +2724,10 @@ bool SwTransferable::PasteDBData( TransferableDataHelper& rData, } else if( bMsg ) { - ScopedVclPtrInstance<MessageDialog>(nullptr, SwResId(STR_CLPBRD_FORMAT_ERROR), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_CLPBRD_FORMAT_ERROR))); + xBox->run(); } return bRet; } @@ -2746,7 +2766,10 @@ bool SwTransferable::PasteFileList( TransferableDataHelper& rData, } else if( bMsg ) { - ScopedVclPtrInstance<MessageDialog>(nullptr, SwResId(STR_CLPBRD_FORMAT_ERROR), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_CLPBRD_FORMAT_ERROR))); + xBox->run(); } return bRet; } diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx index 132387b9ff6b..38493c9587b8 100644 --- a/sw/source/uibase/docvw/SidebarTxtControl.cxx +++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx @@ -37,7 +37,7 @@ #include <vcl/svapp.hxx> #include <vcl/help.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/msgbox.hxx> #include <vcl/gradient.hxx> #include <vcl/scrbar.hxx> @@ -271,8 +271,9 @@ void SidebarTextControl::KeyInput( const KeyEvent& rKeyEvt ) } else { - ScopedVclPtrInstance<MessageDialog>(this, "InfoReadonlyDialog", - "modules/swriter/ui/inforeadonlydialog.ui")->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/swriter/ui/inforeadonlydialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("InfoReadonlyDialog")); + xQuery->run(); } } if (bDone) diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 6168e4fde52f..8c33ce4e5ba3 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -34,6 +34,7 @@ #include <vcl/help.hxx> #include <vcl/graph.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <sot/storage.hxx> #include <svl/macitem.hxx> #include <unotools/securityoptions.hxx> @@ -1848,8 +1849,9 @@ KEYINPUT_CHECKTABLE_INSDEL: } else if (!rSh.IsCursorInParagraphMetadataField()) { - ScopedVclPtrInstance<MessageDialog>(this, "InfoReadonlyDialog", - "modules/swriter/ui/inforeadonlydialog.ui")->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/swriter/ui/inforeadonlydialog.ui")); + std::unique_ptr<weld::MessageDialog> xInfo(xBuilder->weld_message_dialog("InfoReadonlyDialog")); + xInfo->run(); eKeyState = SwKeyState::End; } break; @@ -2024,8 +2026,9 @@ KEYINPUT_CHECKTABLE_INSDEL: } else if (!rSh.IsCursorInParagraphMetadataField()) { - ScopedVclPtrInstance<MessageDialog>(this, "InfoReadonlyDialog", - "modules/swriter/ui/inforeadonlydialog.ui")->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/swriter/ui/inforeadonlydialog.ui")); + std::unique_ptr<weld::MessageDialog> xInfo(xBuilder->weld_message_dialog("InfoReadonlyDialog")); + xInfo->run(); eKeyState = SwKeyState::End; } break; @@ -2471,8 +2474,9 @@ KEYINPUT_CHECKTABLE_INSDEL: } else { - ScopedVclPtrInstance<MessageDialog>(this, "InfoReadonlyDialog", - "modules/swriter/ui/inforeadonlydialog.ui")->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetFrameWeld(), "modules/swriter/ui/inforeadonlydialog.ui")); + std::unique_ptr<weld::MessageDialog> xInfo(xBuilder->weld_message_dialog("InfoReadonlyDialog")); + xInfo->run(); eKeyState = SwKeyState::End; } break; diff --git a/sw/source/uibase/lingu/olmenu.cxx b/sw/source/uibase/lingu/olmenu.cxx index 109b4f4d86dc..405f27a27a57 100644 --- a/sw/source/uibase/lingu/olmenu.cxx +++ b/sw/source/uibase/lingu/olmenu.cxx @@ -59,6 +59,8 @@ #include <rtl/string.hxx> #include <vcl/commandinfoprovider.hxx> #include <vcl/graphicfilter.hxx> +#include <vcl/svapp.hxx> +#include <vcl/weld.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/request.hxx> #include <sfx2/sfxdlg.hxx> @@ -795,9 +797,10 @@ void SwSpellPopup::Execute( sal_uInt16 nId ) uno::Any exc( ::cppu::getCaughtException() ); OUString msg( ::comphelper::anyToString( exc ) ); const SolarMutexGuard guard; - ScopedVclPtrInstance< MessageDialog > aErrorBox(nullptr, msg); - aErrorBox->SetText( "Explanations" ); - aErrorBox->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(m_pSh->GetView().GetViewFrame()->GetWindow().GetFrameWeld(), + VclMessageType::Warning, VclButtonsType::Ok, msg)); + xBox->set_title("Explanations"); + xBox->run(); } } else if (nId == m_nRedlineAcceptId || nId == m_nRedlineRejectId diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx index 3d2e439b1083..e536f5bab523 100644 --- a/sw/source/uibase/shells/grfsh.cxx +++ b/sw/source/uibase/shells/grfsh.cxx @@ -161,7 +161,7 @@ void SwGrfShell::Execute(SfxRequest &rReq) vcl::Window* pWin = GetView().GetWindow(); if (pWin) { - nState = GraphicHelper::HasToSaveTransformedImage(pWin); + nState = GraphicHelper::HasToSaveTransformedImage(pWin->GetFrameWeld()); } } else diff --git a/sw/source/uibase/shells/grfshex.cxx b/sw/source/uibase/shells/grfshex.cxx index 0d842fe8f8fd..faebe58c21fd 100644 --- a/sw/source/uibase/shells/grfshex.cxx +++ b/sw/source/uibase/shells/grfshex.cxx @@ -35,6 +35,7 @@ #include <frmfmt.hxx> #include <frmmgr.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <svx/svdomedia.hxx> #include <svx/svdview.hxx> #include <svx/svdpagv.hxx> @@ -87,7 +88,7 @@ bool SwTextShell::InsertMediaDlg( SfxRequest const & rReq ) pWindow->LeaveWait(); if( !bAPI ) - ::avmedia::MediaWindow::executeFormatErrorBox( pWindow ); + ::avmedia::MediaWindow::executeFormatErrorBox(pWindow ? pWindow->GetFrameWeld() : nullptr); } else { diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index 7e5c43c3e188..022bb8b4dd44 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -40,7 +40,7 @@ #include <svx/svxdlg.hxx> #include <svl/zformat.hxx> #include <sfx2/bindings.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/msgbox.hxx> #include <sfx2/request.hxx> #include <sfx2/dispatch.hxx> @@ -763,9 +763,11 @@ void SwTableShell::Execute(SfxRequest &rReq) break; case TableMergeErr::TooComplex: { - ScopedVclPtrInstance<MessageDialog> aInfoBox( GetView().GetWindow(), - SwResId( STR_ERR_TABLE_MERGE ), VclMessageType::Info ); - aInfoBox->Execute(); + vcl::Window* pWin = GetView().GetWindow(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_ERR_TABLE_MERGE))); + xInfoBox->run(); break; } default: diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx index a3775558fed1..fa3fe1ee1dae 100644 --- a/sw/source/uibase/uiview/srcview.cxx +++ b/sw/source/uibase/uiview/srcview.cxx @@ -23,7 +23,7 @@ #include <unotools/tempfile.hxx> #include <tools/urlobj.hxx> #include <vcl/errinf.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/print.hxx> #include <vcl/msgbox.hxx> #include <vcl/wrkwin.hxx> @@ -612,8 +612,9 @@ void SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem, { if(bNotFoundMessage) { - ScopedVclPtrInstance<MessageDialog>(nullptr, "InfoNotFoundDialog", - "modules/swriter/ui/infonotfounddialog.ui")->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, "modules/swriter/ui/infonotfounddialog.ui")); + std::unique_ptr<weld::MessageDialog> xInfoBox(xBuilder->weld_message_dialog("InfoNotFoundDialog")); + xInfoBox->run(); } else if(!bRecursive) { @@ -621,13 +622,15 @@ void SwSrcView::StartSearchAndReplace(const SvxSearchItem& rSearchItem, if (!bForward) { - nRet = ScopedVclPtrInstance<MessageDialog>(nullptr, "QueryContinueEndDialog", - "modules/swriter/ui/querycontinueenddialog.ui")->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, "modules/swriter/ui/querycontinueenddialog.ui")); + std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("QueryContinueEndDialog")); + nRet = xQueryBox->run(); } else { - nRet = ScopedVclPtrInstance<MessageDialog>(nullptr, "QueryContinueBeginDialog", - "modules/swriter/ui/querycontinuebegindialog.ui")->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(nullptr, "modules/swriter/ui/querycontinuebegindialog.ui")); + std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("QueryContinueBeginDialog")); + nRet = xQueryBox->run(); } if (nRet == RET_YES) @@ -804,8 +807,11 @@ void SwSrcView::Load(SwDocShell* pDocShell) } else { - vcl::Window *pTmpWindow = &GetViewFrame()->GetWindow(); - ScopedVclPtrInstance<MessageDialog>(pTmpWindow, SwResId(STR_ERR_SRCSTREAM), VclMessageType::Info)->Execute(); + vcl::Window& rTmpWindow = GetViewFrame()->GetWindow(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(rTmpWindow.GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_ERR_SRCSTREAM))); + xBox->run(); } } else diff --git a/sw/source/uibase/uiview/uivwimp.cxx b/sw/source/uibase/uiview/uivwimp.cxx index a758545edebc..a3e6107aa71b 100644 --- a/sw/source/uibase/uiview/uivwimp.cxx +++ b/sw/source/uibase/uiview/uivwimp.cxx @@ -25,7 +25,7 @@ #include <com/sun/star/scanner/XScannerManager2.hpp> #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> #include <comphelper/processfactory.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/svapp.hxx> #include <vcl/wrkwin.hxx> #include <vcl/msgbox.hxx> @@ -172,7 +172,10 @@ void SwView_Impl::ExecuteScan( SfxRequest& rReq ) if( !bDone ) { - ScopedVclPtrInstance<MessageDialog>(nullptr, SwResId(STR_SCAN_NOSOURCE), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_SCAN_NOSOURCE))); + xBox->run(); rReq.Ignore(); } else diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 62212cae6083..31f7deb72e16 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -55,7 +55,7 @@ #include <editeng/lrspitem.hxx> #include <unotools/textsearch.hxx> #include <editeng/unolingu.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/msgbox.hxx> #include <editeng/tstpitem.hxx> #include <sfx2/event.hxx> @@ -228,8 +228,10 @@ ErrCode SwView::InsertGraphic( const OUString &rPath, const OUString &rFilter, const sal_uInt16 aRotation = aMetadata.getRotation(); if (aRotation != 0) { - ScopedVclPtrInstance< MessageDialog > aQueryBox( GetWindow(),"QueryRotateIntoStandardOrientationDialog","modules/swriter/ui/queryrotateintostandarddialog.ui"); - if (aQueryBox->Execute() == RET_YES) + vcl::Window* pWin = GetWindow(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWin ? pWin->GetFrameWeld() : nullptr, "modules/swriter/ui/queryrotateintostandarddialog.ui")); + std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("QueryRotateIntoStandardOrientationDialog")); + if (xQueryBox->run() == RET_YES) { GraphicNativeTransform aTransform( aGraphic ); aTransform.rotate( aRotation ); @@ -426,8 +428,9 @@ bool SwView::InsertGraphicDlg( SfxRequest& rReq ) // really store as link only? if( bAsLink && SvtMiscOptions().ShowLinkWarningDialog() ) { - ScopedVclPtrInstance< SvxLinkWarningDialog > aWarnDlg(GetWindow(),pFileDlg->GetPath()); - if( aWarnDlg->Execute() != RET_OK ) + vcl::Window* pWin = GetWindow(); + SvxLinkWarningDialog aWarnDlg(pWin ? pWin->GetFrameWeld() : nullptr, pFileDlg->GetPath()); + if(aWarnDlg.run() != RET_OK) bAsLink=false; // don't store as link } } @@ -482,8 +485,11 @@ bool SwView::InsertGraphicDlg( SfxRequest& rReq ) { if( bShowError ) { - ScopedVclPtrInstance< MessageDialog > aInfoBox( GetWindow(), SwResId(pResId), VclMessageType::Info); - aInfoBox->Execute(); + vcl::Window* pWin = GetWindow(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + VclMessageType::Info, VclButtonsType::Ok, + SwResId(pResId))); + xInfoBox->run(); } rReq.Ignore(); } @@ -2224,8 +2230,10 @@ long SwView::InsertMedium( sal_uInt16 nSlotId, SfxMedium* pMedium, sal_Int16 nVe if (!bCompare && !nFound) { - vcl::Window* pWin = &GetEditWin(); - ScopedVclPtrInstance<MessageDialog>(pWin, SwResId(STR_NO_MERGE_ENTRY), VclMessageType::Info)->Execute(); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetEditWin().GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_NO_MERGE_ENTRY))); + xInfoBox->run(); } if( nRet==2 && xDocSh.is() ) xDocSh->DoClose(); @@ -2278,11 +2286,10 @@ void SwView::GenerateFormLetter(bool bUseCurrentDocument) if ( lcl_NeedAdditionalDataSource( xDBContext ) ) { // no data sources are available - create a new one - ScopedVclPtrInstance<MessageDialog> aQuery(&GetViewFrame()->GetWindow(), - "DataSourcesUnavailableDialog", - "modules/swriter/ui/datasourcesunavailabledialog.ui"); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetViewFrame()->GetWindow().GetFrameWeld(), "modules/swriter/ui/datasourcesunavailabledialog.ui")); + std::unique_ptr<weld::MessageDialog> xQuery(xBuilder->weld_message_dialog("DataSourcesUnavailableDialog")); // no cancel allowed - if (RET_OK != aQuery->Execute()) + if (RET_OK != xQuery->run()) return; bCallAddressPilot = true; } @@ -2327,12 +2334,11 @@ void SwView::GenerateFormLetter(bool bUseCurrentDocument) OUString sSource; if(!GetWrtShell().IsFieldDataSourceAvailable(sSource)) { - ScopedVclPtrInstance<MessageDialog> aWarning(&GetViewFrame()->GetWindow(), - "WarnDataSourceDialog", - "modules/swriter/ui/warndatasourcedialog.ui"); - OUString sTmp(aWarning->get_primary_text()); - aWarning->set_primary_text(sTmp.replaceFirst("%1", sSource)); - if (RET_OK == aWarning->Execute()) + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetViewFrame()->GetWindow().GetFrameWeld(), "modules/swriter/ui/warndatasourcedialog.ui")); + std::unique_ptr<weld::MessageDialog> xWarning(xBuilder->weld_message_dialog("WarnDataSourceDialog")); + OUString sTmp(xWarning->get_primary_text()); + xWarning->set_primary_text(sTmp.replaceFirst("%1", sSource)); + if (RET_OK == xWarning->run()) { SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); if ( pFact ) diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index 1bcd1e5c6872..895bf7e2ddab 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -31,6 +31,7 @@ #include <comphelper/scopeguard.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <vcl/msgbox.hxx> +#include <vcl/weld.hxx> #include <svtools/ehdl.hxx> #include <svl/stritem.hxx> #include <sfx2/dispatch.hxx> @@ -445,8 +446,10 @@ void SwView::HyphenateDocument() // turned on no special area { // I want also in special areas hyphenation - ScopedVclPtrInstance< MessageDialog > aBox(&GetEditWin(), SwResId(STR_QUERY_SPECIAL_FORCED), VclMessageType::Question, VclButtonsType::YesNo); - if( aBox->Execute() == RET_YES ) + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(GetEditWin().GetFrameWeld(), + VclMessageType::Question, VclButtonsType::YesNo, + SwResId(STR_QUERY_SPECIAL_FORCED))); + if (xBox->run() == RET_YES) { bOther = true; if (xProp.is()) diff --git a/sw/source/uibase/uiview/viewprt.cxx b/sw/source/uibase/uiview/viewprt.cxx index fc2f4645235f..9c4b94c53c2b 100644 --- a/sw/source/uibase/uiview/viewprt.cxx +++ b/sw/source/uibase/uiview/viewprt.cxx @@ -23,7 +23,7 @@ #include <sfx2/request.hxx> #include <sfx2/progress.hxx> #include <sfx2/app.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include <vcl/oldprintadaptor.hxx> #include <sfx2/printer.hxx> #include <sfx2/prnmon.hxx> @@ -176,10 +176,12 @@ void SwView::ExecutePrint(SfxRequest& rReq) } else { - ScopedVclPtrInstance< MessageDialog > aInfoBox(&GetEditWin(), SwResId(STR_ERR_NO_FAX), VclMessageType::Info); + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(GetEditWin().GetFrameWeld(), + VclMessageType::Info, VclButtonsType::Ok, + SwResId(STR_ERR_NO_FAX))); const char* pResId = bWeb ? STR_WEBOPTIONS : STR_TEXTOPTIONS; - aInfoBox->set_primary_text(aInfoBox->get_primary_text().replaceFirst("%1", SwResId(pResId))); - aInfoBox->Execute(); + xInfoBox->set_primary_text(xInfoBox->get_primary_text().replaceFirst("%1", SwResId(pResId))); + xInfoBox->run(); SfxUInt16Item aDefPage(SID_SW_EDITOPTIONS, TP_OPTPRINT_PAGE); GetViewFrame()->GetDispatcher()->ExecuteList(SID_SW_EDITOPTIONS, SfxCallMode::SYNCHRON|SfxCallMode::RECORD, @@ -201,9 +203,9 @@ void SwView::ExecutePrint(SfxRequest& rReq) if(!bSilent && !bFromMerge && SW_MOD()->GetModuleConfig()->IsAskForMailMerge() && pSh->IsAnyDatabaseFieldInDoc()) { - ScopedVclPtrInstance<MessageDialog> aBox(&GetEditWin(), "PrintMergeDialog", - "modules/swriter/ui/printmergedialog.ui"); - short nRet = aBox->Execute(); + std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(GetEditWin().GetFrameWeld(), "modules/swriter/ui/printmergedialog.ui")); + std::unique_ptr<weld::MessageDialog> xBox(xBuilder->weld_message_dialog("PrintMergeDialog")); + short nRet = xBox->run(); if(RET_NO != nRet) { if(RET_YES == nRet) diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index b68b4b77df00..697adae10c90 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -1782,12 +1782,12 @@ void SwWrtShell::ChangeHeaderOrFooter( //Actions have to be closed while the dialog is showing EndAllAction(); - vcl::Window* pParent = &GetView().GetViewFrame()->GetWindow(); + weld::Window* pParent = GetView().GetViewFrame()->GetWindow().GetFrameWeld(); short nResult; if (bHeader) { - nResult = ScopedVclPtrInstance<DeleteHeaderDialog>(pParent)->Execute(); + nResult = DeleteHeaderDialog(pParent).run(); } else { - nResult = ScopedVclPtrInstance<DeleteFooterDialog>(pParent)->Execute(); + nResult = DeleteFooterDialog(pParent).run(); } bExecute = nResult == RET_YES; |