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/uibase | |
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/uibase')
-rw-r--r-- | sw/source/uibase/app/docsh2.cxx | 10 | ||||
-rw-r--r-- | sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx | 15 | ||||
-rw-r--r-- | sw/source/uibase/dochdl/gloshdl.cxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/dochdl/swdtflvr.cxx | 45 | ||||
-rw-r--r-- | sw/source/uibase/docvw/SidebarTxtControl.cxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/docvw/edtwin.cxx | 16 | ||||
-rw-r--r-- | sw/source/uibase/lingu/olmenu.cxx | 9 | ||||
-rw-r--r-- | sw/source/uibase/shells/grfsh.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/shells/grfshex.cxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/shells/tabsh.cxx | 10 | ||||
-rw-r--r-- | sw/source/uibase/uiview/srcview.cxx | 24 | ||||
-rw-r--r-- | sw/source/uibase/uiview/uivwimp.cxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view2.cxx | 44 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewling.cxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewprt.cxx | 16 | ||||
-rw-r--r-- | sw/source/uibase/wrtsh/wrtsh1.cxx | 6 |
16 files changed, 144 insertions, 84 deletions
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; |