include/sfx2/app.hxx                   |    3 +--
 sd/source/ui/app/sdmod1.cxx            |    5 ++---
 sfx2/source/appl/app.cxx               |    9 +++++++--
 sfx2/source/appl/appopen.cxx           |   16 +++++++++-------
 sfx2/source/appl/openuriexternally.cxx |    8 ++++----
 sfx2/source/view/viewsh.cxx            |    8 ++++----
 svx/source/dialog/hyperdlg.cxx         |    7 ++-----
 sw/source/uibase/uiview/view2.cxx      |    8 +++++---
 8 files changed, 34 insertions(+), 30 deletions(-)

New commits:
commit 5262a9e88037decc26da84e7fa62f2955d4cdb85
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun Mar 21 20:43:17 2021 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Mar 22 09:44:47 2021 +0100

    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 <caol...@redhat.com>

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
 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to