diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-03-21 20:43:17 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-03-22 09:44:47 +0100 |
commit | 5262a9e88037decc26da84e7fa62f2955d4cdb85 (patch) | |
tree | 0e5deb22353b1bfd7e5ddb8666bd2a30c7231a24 | |
parent | 2cf71e61f087f2155b7542da709189bcf4d0795a (diff) |
change SfxApplication::GetTopWindow to weld::Window
Change-Id: I19906f2a9d820c99375e2e5677a484d4e2e25fdb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112857
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | include/sfx2/app.hxx | 3 | ||||
-rw-r--r-- | sd/source/ui/app/sdmod1.cxx | 5 | ||||
-rw-r--r-- | sfx2/source/appl/app.cxx | 9 | ||||
-rw-r--r-- | sfx2/source/appl/appopen.cxx | 16 | ||||
-rw-r--r-- | sfx2/source/appl/openuriexternally.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 8 | ||||
-rw-r--r-- | svx/source/dialog/hyperdlg.cxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view2.cxx | 8 |
8 files changed, 34 insertions, 30 deletions
diff --git a/include/sfx2/app.hxx b/include/sfx2/app.hxx index b3b1761baece..b4770f409f24 100644 --- a/include/sfx2/app.hxx +++ b/include/sfx2/app.hxx @@ -55,7 +55,6 @@ class StarBASIC; class SfxWorkWindow; class SfxFilterMatcher; class SfxModule; -namespace vcl { class Window; } struct SfxChildWinFactory; struct SfxStbCtrlFactory; struct SfxTbxCtrlFactory; @@ -134,7 +133,7 @@ public: * @param pArgs Takes ownership */ ErrCode LoadTemplate( SfxObjectShellLock& xDoc, const OUString& rFileName, std::unique_ptr<SfxItemSet> pArgs ); - vcl::Window* GetTopWindow() const; + weld::Window* GetTopWindow() const; // members SfxFilterMatcher& GetFilterMatcher(); diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx index 35bf5ebfb5ea..01d36ee93155 100644 --- a/sd/source/ui/app/sdmod1.cxx +++ b/sd/source/ui/app/sdmod1.cxx @@ -477,11 +477,10 @@ SfxFrame* SdModule::ExecuteNewDocument( SfxRequest const & rReq ) } } - if(bStartWithTemplate) + if (bStartWithTemplate) { //Launch TemplateSelectionDialog - vcl::Window* pTopLevel = SfxGetpApp()->GetTopWindow(); - SfxTemplateSelectionDlg aTemplDlg(pTopLevel ? pTopLevel->GetFrameWeld() : nullptr); + SfxTemplateSelectionDlg aTemplDlg(SfxGetpApp()->GetTopWindow()); aTemplDlg.run(); //check to disable the dialog diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx index 9f9909ff6bfa..227cae7f240b 100644 --- a/sfx2/source/appl/app.cxx +++ b/sfx2/source/appl/app.cxx @@ -328,10 +328,15 @@ void SfxApplication::ReleaseIndex(sal_uInt16 i) } -vcl::Window* SfxApplication::GetTopWindow() const +weld::Window* SfxApplication::GetTopWindow() const { SfxWorkWindow* pWork = GetWorkWindow_Impl( SfxViewFrame::Current() ); - return pWork ? pWork->GetWindow() : nullptr; + if (!pWork) + return nullptr; + vcl::Window* pWindow = pWork->GetWindow(); + if (!pWindow) + return nullptr; + return pWindow->GetFrameWeld(); } SfxTbxCtrlFactArr_Impl& SfxApplication::GetTbxCtrlFactories_Impl() const diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 025316846d3d..03a94e0811b1 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -452,7 +452,7 @@ void SfxApplication::NewDocExec_Impl( SfxRequest& rReq ) if ( !pTemplNameItem && !pTemplFileNameItem ) { bool bNewWin = false; - vcl::Window* pTopWin = GetTopWindow(); + weld::Window* pTopWin = GetTopWindow(); SfxObjectShell* pCurrentShell = SfxObjectShell::Current(); Reference<XModel> xModel; @@ -476,10 +476,12 @@ void SfxApplication::NewDocExec_Impl( SfxRequest& rReq ) } } - if ( bNewWin && pTopWin ) + if (bNewWin && pTopWin) + { // after the destruction of the dialogue its parent comes to top, // but we want that the new document is on top - pTopWin->ToTop(); + pTopWin->present(); + } return; } @@ -648,8 +650,8 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) if ( pDenyListItem ) pDenyListItem->GetStringList( aDenyList ); - vcl::Window* pTopWindow = GetTopWindow(); - ErrCode nErr = sfx2::FileOpenDialog_Impl(pTopWindow ? pTopWindow->GetFrameWeld() : nullptr, + weld::Window* pTopWindow = GetTopWindow(); + ErrCode nErr = sfx2::FileOpenDialog_Impl(pTopWindow, nDialogType, eDialogFlags, aURLList, aFilter, pSet, &aPath, nDialog, sStandardDir, aDenyList); @@ -833,9 +835,9 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) if ( eMode == SvtExtendedSecurityOptions::OPEN_NEVER && aINetProtocol != INetProtocol::VndSunStarHelp ) { SolarMutexGuard aGuard; - vcl::Window *pWindow = SfxGetpApp()->GetTopWindow(); + weld::Window *pWindow = SfxGetpApp()->GetTopWindow(); - std::unique_ptr<weld::MessageDialog> xSecurityWarningBox(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xSecurityWarningBox(Application::CreateMessageDialog(pWindow, VclMessageType::Warning, VclButtonsType::Ok, SfxResId(STR_SECURITY_WARNING_NO_HYPERLINKS))); xSecurityWarningBox->set_title(SfxResId(RID_SECURITY_WARNING_TITLE)); xSecurityWarningBox->run(); diff --git a/sfx2/source/appl/openuriexternally.cxx b/sfx2/source/appl/openuriexternally.cxx index ebff4452a1c7..f8c5eda0c500 100644 --- a/sfx2/source/appl/openuriexternally.cxx +++ b/sfx2/source/appl/openuriexternally.cxx @@ -92,8 +92,8 @@ IMPL_LINK_NOARG(URITools, onOpenURI, Timer*, void) "unexpected IllegalArgumentException: " + e.Message); } SolarMutexGuard g; - vcl::Window *pWindow = SfxGetpApp()->GetTopWindow(); - std::unique_ptr<weld::MessageDialog> eb(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + weld::Window *pWindow = SfxGetpApp()->GetTopWindow(); + std::unique_ptr<weld::MessageDialog> eb(Application::CreateMessageDialog(pWindow, VclMessageType::Warning, VclButtonsType::Ok, SfxResId(STR_NO_ABS_URI_REF))); eb->set_primary_text(eb->get_primary_text().replaceFirst("$(ARG1)", msURI)); @@ -103,8 +103,8 @@ IMPL_LINK_NOARG(URITools, onOpenURI, Timer*, void) throw; } SolarMutexGuard g; - vcl::Window *pWindow = SfxGetpApp()->GetTopWindow(); - std::unique_ptr<weld::MessageDialog> eb(Application::CreateMessageDialog(pWindow ? pWindow->GetFrameWeld() : nullptr, + weld::Window *pWindow = SfxGetpApp()->GetTopWindow(); + std::unique_ptr<weld::MessageDialog> eb(Application::CreateMessageDialog(pWindow, VclMessageType::Warning, VclButtonsType::Ok, SfxResId(STR_NO_WEBBROWSER_FOUND))); eb->set_primary_text( diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 735da5c265e8..d3554ed0be1a 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -490,8 +490,8 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) if ( eResult == SfxMailModel::SEND_MAIL_ERROR ) { - vcl::Window* pWin = SfxGetpApp()->GetTopWindow(); - std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + weld::Window* pWin = SfxGetpApp()->GetTopWindow(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin, VclMessageType::Info, VclButtonsType::Ok, SfxResId(STR_ERROR_SEND_MAIL))); xBox->run(); @@ -513,8 +513,8 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq ) SfxMailModel::SendMailResult eResult = aModel.SaveAndSend( xFrame ); if( eResult == SfxMailModel::SEND_MAIL_ERROR ) { - vcl::Window* pWin = SfxGetpApp()->GetTopWindow(); - std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin ? pWin->GetFrameWeld() : nullptr, + weld::Window* pWin = SfxGetpApp()->GetTopWindow(); + std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pWin, VclMessageType::Info, VclButtonsType::Ok, SfxResId(STR_ERROR_SEND_MAIL))); xBox->run(); diff --git a/svx/source/dialog/hyperdlg.cxx b/svx/source/dialog/hyperdlg.cxx index 153e6d4c4f7d..6d94d8add6c8 100644 --- a/svx/source/dialog/hyperdlg.cxx +++ b/svx/source/dialog/hyperdlg.cxx @@ -22,12 +22,9 @@ #include <sfx2/app.hxx> #include <sfx2/sfxsids.hrc> - //# # //# Childwindow-Wrapper-Class # //# # - - SFX_IMPL_CHILDWINDOW_WITHID(SvxHlinkDlgWrapper, SID_HYPERLINK_DIALOG) SvxHlinkDlgWrapper::SvxHlinkDlgWrapper( vcl::Window* _pParent, sal_uInt16 nId, @@ -45,12 +42,12 @@ SvxHlinkDlgWrapper::SvxHlinkDlgWrapper( vcl::Window* _pParent, sal_uInt16 nId, if ( !pInfo->aSize.IsEmpty() ) { - vcl::Window* pTopWindow = SfxGetpApp()->GetTopWindow(); + weld::Window* pTopWindow = SfxGetpApp()->GetTopWindow(); if (pTopWindow) { weld::Dialog* pDialog = GetController()->getDialog(); - Size aParentSize( pTopWindow->GetSizePixel() ); + Size aParentSize(pTopWindow->get_size()); Size aDlgSize(pDialog->get_size()); if( aParentSize.Width() < pInfo->aPos.X() ) diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 83ea79dc3beb..3759e967ff64 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -2666,7 +2666,7 @@ void SwView::GenerateFormLetter(bool bUseCurrentDocument) { // call documents and template dialog SfxApplication* pSfxApp = SfxGetpApp(); - vcl::Window* pTopWin = pSfxApp->GetTopWindow(); + weld::Window* pTopWin = pSfxApp->GetTopWindow(); SfxTemplateManagerDlg aDocTemplDlg(GetFrameWeld()); int nRet = aDocTemplDlg.run(); @@ -2681,10 +2681,12 @@ void SwView::GenerateFormLetter(bool bUseCurrentDocument) } } - if ( bNewWin ) + if (bNewWin) + { // after the destruction of the dialogue its parent comes to top, // but we want that the new document is on top - pTopWin->ToTop(); + pTopWin->present(); + } } #endif } |