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>
diff --git a/include/sfx2/app.hxx b/include/sfx2/app.hxx
index b3b1761..b4770f4 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 35bf5eb..01d36ee 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 9f9909f..227cae7 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 0253168..03a94e0 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 ebff445..f8c5eda 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 735da5c..d3554ed 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 153e6d4..6d94d8a 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 83ea79d..3759e96 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
}