[Libreoffice-commits] core.git: include/sfx2 sfx2/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sun Mar 21 14:31:56 UTC 2021


 include/sfx2/request.hxx     |    2 --
 sfx2/source/appl/appserv.cxx |   35 +++++++----------------------------
 2 files changed, 7 insertions(+), 30 deletions(-)

New commits:
commit e9054a0ec00c4281c8f908ffb9cbe7d9e199c35b
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sat Mar 20 15:45:56 2021 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun Mar 21 15:30:21 2021 +0100

    elide extracting vcl::Window from awt::XWindow
    
    Change-Id: Ifb44471b996e20007ae49d09b212016ee77a4618
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112816
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/sfx2/request.hxx b/include/sfx2/request.hxx
index 90058a5b1f7f..e6411d2d3ec1 100644
--- a/include/sfx2/request.hxx
+++ b/include/sfx2/request.hxx
@@ -38,7 +38,6 @@ enum class SfxCallMode : sal_uInt16;
 namespace com::sun::star::beans { struct PropertyValue; }
 namespace com::sun::star::frame { class XDispatchRecorder; }
 namespace com::sun::star::uno { template <class E> class Sequence; }
-namespace vcl { class Window; }
 namespace weld { class Window; }
 
 class SFX2_DLLPUBLIC SfxRequest final : public SfxHint
@@ -115,7 +114,6 @@ public:
 
     /** Return the window that should be used as the parent for any dialogs this request creates
     */
-    vcl::Window* GetFrameWindow() const;
     weld::Window* GetFrameWeld() const;
 private:
     const SfxRequest&   operator=(const SfxRequest &) = delete;
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 74c3767c405e..cf875e1d16c1 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -67,7 +67,6 @@
 
 #include <unotools/moduleoptions.hxx>
 #include <svtools/helpopt.hxx>
-#include <toolkit/helper/vclunohelper.hxx>
 #include <rtl/bootstrap.hxx>
 
 #include <com/sun/star/frame/ModuleManager.hpp>
@@ -252,26 +251,6 @@ namespace
         return xFrame;
     }
 
-    vcl::Window* getFrameWindow(const Reference<XFrame>& rFrame)
-    {
-        if (rFrame.is())
-        {
-            try
-            {
-                Reference< awt::XWindow > xContainerWindow(rFrame->getContainerWindow(), UNO_SET_THROW);
-                VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xContainerWindow);
-                return pWindow;
-            }
-            catch (const Exception&)
-            {
-                DBG_UNHANDLED_EXCEPTION("sfx.appl");
-            }
-        }
-
-        SAL_WARN( "sfx.appl", "no parent for dialogs" );
-        return nullptr;
-    }
-
     class LicenseDialog : public weld::GenericDialogController
     {
     public:
@@ -312,11 +291,6 @@ namespace
     };
 }
 
-vcl::Window* SfxRequest::GetFrameWindow() const
-{
-    return getFrameWindow(GetRequestFrame(*this));
-}
-
 weld::Window* SfxRequest::GetFrameWeld() const
 {
     const SfxItemSet* pIntArgs = GetInternalArgs_Impl();
@@ -330,8 +304,13 @@ weld::Window* SfxRequest::GetFrameWeld() const
         return Application::GetFrameWeld(xWindow);
     }
 
-    vcl::Window* pWin = GetFrameWindow();
-    return pWin ? pWin->GetFrameWeld() : nullptr;
+    Reference<XFrame> xFrame(GetRequestFrame(*this));
+    if (!xFrame)
+    {
+        SAL_WARN("sfx.appl", "no parent for dialogs");
+        return nullptr;
+    }
+    return Application::GetFrameWeld(xFrame->getContainerWindow());
 }
 
 void SfxApplication::MiscExec_Impl( SfxRequest& rReq )


More information about the Libreoffice-commits mailing list