sw/inc/swurl.hxx                     |    5 +++++
 sw/source/uibase/shells/drwtxtex.cxx |    8 ++------
 sw/source/uibase/wrtsh/wrtsh2.cxx    |   28 ++++++++++++++++++----------
 3 files changed, 25 insertions(+), 16 deletions(-)

New commits:
commit 502f7958d99e3aa27f4c1c1f33f4827055459da8
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Wed Nov 15 21:15:54 2023 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Thu Nov 16 12:19:53 2023 +0100

    pass a frame to use as parent for any dialog that may need to appear
    
    which avoids: sfx2/source/appl/appserv.cxx:314: no parent for dialogs
    
    Change-Id: I71734b42f3206fc724e5a3d5538072dc775f0b68
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159490
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx 
b/sw/source/uibase/wrtsh/wrtsh2.cxx
index 6f7d1a2ee232..d2451442c600 100644
--- a/sw/source/uibase/wrtsh/wrtsh2.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh2.cxx
@@ -615,17 +615,18 @@ void LoadURL(SwView& rView, const OUString& rURL, 
LoadUrlFlags nFilter,
     if ((nFilter & LoadUrlFlags::NewView) && 
!comphelper::LibreOfficeKit::isActive())
         aTargetFrameName.SetValue( "_blank" );
 
-    const SfxPoolItem* aArr[] = {
+    SfxUnoFrameItem aDocFrame(SID_FILLFRAME, 
rViewFrame.GetFrame().GetFrameInterface());
+
+    rViewFrame.GetDispatcher()->ExecuteList(SID_OPENDOC,
+            SfxCallMode::ASYNCHRON|SfxCallMode::RECORD,
+            {
                 &aName,
                 &aNewView, /*&aSilent,*/
                 &aReferer,
                 &aView, &aTargetFrameName,
-                &aBrowse,
-                nullptr
-    };
-
-    rViewFrame.GetDispatcher()->GetBindings()->Execute( SID_OPENDOC, aArr,
-            SfxCallMode::ASYNCHRON|SfxCallMode::RECORD );
+                &aBrowse
+            },
+            { &aDocFrame } );
 }
 
 void SwWrtShell::NavigatorPaste( const NaviContentBookmark& rBkmk,
commit 0df175ccc6ea542bc5801f631ff72bed187042eb
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Wed Nov 15 21:01:48 2023 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Thu Nov 16 12:19:46 2023 +0100

    combine these hyperlink dispatchers into one call
    
    Change-Id: Icb7822e811013de648ccf2fbb23a5f0be9e29bb0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159489
    Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sw/inc/swurl.hxx b/sw/inc/swurl.hxx
index 87375f30c8b7..ec88a639a4e9 100644
--- a/sw/inc/swurl.hxx
+++ b/sw/inc/swurl.hxx
@@ -23,6 +23,7 @@
 #include <o3tl/typed_flags_set.hxx>
 
 class SwViewShell;
+class SwView;
 
 enum class LoadUrlFlags {
     NONE    = 0x00,
@@ -35,6 +36,10 @@ namespace o3tl {
 void LoadURL( SwViewShell& rSh, const OUString& rName,
               LoadUrlFlags nFilter, const OUString& rTargetFrameName );
 
+void LoadURL( SwView& rView, const OUString& rName,
+              LoadUrlFlags nFilter, const OUString& rTargetFrameName );
+
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/shells/drwtxtex.cxx 
b/sw/source/uibase/shells/drwtxtex.cxx
index 9c4218567e22..aac07e855f05 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ b/sw/source/uibase/shells/drwtxtex.cxx
@@ -499,12 +499,8 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
             const SvxFieldData* pField = pFieldItem ? pFieldItem->GetField() : 
nullptr;
             if (const SvxURLField* pURLField = dynamic_cast<const 
SvxURLField*>(pField))
             {
-                SfxStringItem aUrl(SID_FILE_NAME, pURLField->GetURL());
-                SfxStringItem aTarget(SID_TARGETNAME, 
pURLField->GetTargetFrame());
-                SfxBoolItem aNewView(SID_OPEN_NEW_VIEW, false);
-                SfxBoolItem aBrowsing(SID_BROWSE, true);
-                GetView().GetViewFrame().GetDispatcher()->ExecuteList(
-                    SID_OPENDOC, SfxCallMode::SYNCHRON, { &aUrl, &aTarget, 
&aNewView, &aBrowsing });
+                ::LoadURL(GetView(), pURLField->GetURL(), LoadUrlFlags::NONE,
+                          pURLField->GetTargetFrame());
             }
         }
         break;
diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx 
b/sw/source/uibase/wrtsh/wrtsh2.cxx
index 91d97c119064..6f7d1a2ee232 100644
--- a/sw/source/uibase/wrtsh/wrtsh2.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh2.cxx
@@ -567,9 +567,16 @@ void LoadURL( SwViewShell& rVSh, const OUString& rURL, 
LoadUrlFlags nFilter,
     //A CursorShell is always a WrtShell
     SwWrtShell &rSh = static_cast<SwWrtShell&>(rVSh);
 
-    SwDocShell* pDShell = rSh.GetView().GetDocShell();
+    ::LoadURL(rSh.GetView(), rURL, nFilter, rTargetFrameName);
+
+}
+
+void LoadURL(SwView& rView, const OUString& rURL, LoadUrlFlags nFilter,
+              const OUString& rTargetFrameName)
+{
+    SwDocShell* pDShell = rView.GetDocShell();
     OSL_ENSURE( pDShell, "No DocShell?!");
-    SfxViewFrame& rViewFrame = rSh.GetView().GetViewFrame();
+    SfxViewFrame& rViewFrame = rView.GetViewFrame();
 
     if (!SfxObjectShell::AllowedLinkProtocolFromDocument(rURL, pDShell, 
rViewFrame.GetFrameWeld()))
         return;
@@ -578,7 +585,7 @@ void LoadURL( SwViewShell& rVSh, const OUString& rURL, 
LoadUrlFlags nFilter,
     // unless we are jumping to a TOC mark.
     if (comphelper::LibreOfficeKit::isActive() && !rURL.startsWith("#"))
     {
-        
rVSh.GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED,
 rURL.toUtf8());
+        rView.libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, 
rURL.toUtf8());
         return;
     }
 

Reply via email to