sd/source/ui/app/sdmod1.cxx             |   29 ++++++++++++++---------
 sd/source/ui/remotecontrol/Receiver.cxx |   21 +++++++++++++++++
 sw/inc/swurl.hxx                        |    5 ----
 sw/source/uibase/shells/drwtxtex.cxx    |    2 -
 sw/source/uibase/wrtsh/wrtsh2.cxx       |   39 +++++++++++++++-----------------
 5 files changed, 59 insertions(+), 37 deletions(-)

New commits:
commit 0061e1db4b494d9f19ac7052467c5665285fd2b9
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Wed Nov 22 21:14:41 2023 +0000
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Nov 24 14:36:17 2023 +0100

    reuse AllowedLinkProtocolFromDocument in impress/draw
    
    Change-Id: I73ca4f087946a45dbf92d69a0dc1e769de9b5690
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159843
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    (cherry picked from commit f0942eed2eb328b04856f20613f5226d66b66a20)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159759
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159884
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx
index 573ee853069b..b22feb2d1f21 100644
--- a/sd/source/ui/app/sdmod1.cxx
+++ b/sd/source/ui/app/sdmod1.cxx
@@ -33,6 +33,7 @@
 #include <sfx2/docfile.hxx>
 #include <sfx2/request.hxx>
 #include <sfx2/templatedlg.hxx>
+#include <svl/stritem.hxx>
 #include <editeng/eeitem.hxx>
 
 #include <svx/svxids.hrc>
@@ -192,26 +193,32 @@ void SdModule::Execute(SfxRequest& rReq)
         {
             bool bIntercept = false;
             ::sd::DrawDocShell* pDocShell = dynamic_cast< ::sd::DrawDocShell 
*>( SfxObjectShell::Current() );
-            if (pDocShell)
+            ::sd::ViewShell* pViewShell = pDocShell ? 
pDocShell->GetViewShell() : nullptr;
+            if (pViewShell)
             {
-                ::sd::ViewShell* pViewShell = pDocShell->GetViewShell();
-                if (pViewShell)
+                if( sd::SlideShow::IsRunning( pViewShell->GetViewShellBase() ) 
)
                 {
-                    if( sd::SlideShow::IsRunning( 
pViewShell->GetViewShellBase() ) )
+                    // Prevent documents from opening while the slide
+                    // show is running, except when this request comes
+                    // from a shape interaction.
+                    if (rReq.GetArgs() == nullptr)
                     {
-                        // Prevent documents from opening while the slide
-                        // show is running, except when this request comes
-                        // from a shape interaction.
-                        if (rReq.GetArgs() == nullptr)
-                        {
-                            bIntercept = true;
-                        }
+                        bIntercept = true;
                     }
                 }
             }
 
             if (!bIntercept)
             {
+                if (const SfxStringItem* pURLItem = 
rReq.GetArg<SfxStringItem>(SID_FILE_NAME))
+                {
+                    if (!pViewShell || 
!SfxObjectShell::AllowedLinkProtocolFromDocument(pURLItem->GetValue(),
+                                                                               
         pViewShell->GetObjectShell(),
+                                                                               
         pViewShell->GetFrameWeld()))
+                    {
+                        return;
+                    }
+                }
                 SfxGetpApp()->ExecuteSlot(rReq, SfxGetpApp()->GetInterface());
             }
             else
commit fc307d81e2fd738a901f5afdc9f1cd3cd999a6a2
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Fri Nov 17 08:57:09 2023 +0000
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Thu Nov 23 11:52:30 2023 +0100

    we can have just one LoadURL for writer
    
    Change-Id: Ia0162ee1c275292fcf200bad4662e4c2c6b7b972
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159557
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    (cherry picked from commit 521ca9cf6acbae96cf95d9740859c9682212013d)

diff --git a/sw/inc/swurl.hxx b/sw/inc/swurl.hxx
index ec88a639a4e9..87375f30c8b7 100644
--- a/sw/inc/swurl.hxx
+++ b/sw/inc/swurl.hxx
@@ -23,7 +23,6 @@
 #include <o3tl/typed_flags_set.hxx>
 
 class SwViewShell;
-class SwView;
 
 enum class LoadUrlFlags {
     NONE    = 0x00,
@@ -36,10 +35,6 @@ 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 f31c3980ad94..c51f501841ad 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ b/sw/source/uibase/shells/drwtxtex.cxx
@@ -533,7 +533,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq )
             const SvxFieldData* pField = pOLV->GetFieldAtCursor();
             if (const SvxURLField* pURLField = dynamic_cast<const 
SvxURLField*>(pField))
             {
-                ::LoadURL(GetView(), pURLField->GetURL(), LoadUrlFlags::NONE,
+                ::LoadURL(GetShell(), pURLField->GetURL(), LoadUrlFlags::NONE,
                           pURLField->GetTargetFrame());
             }
         }
diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx 
b/sw/source/uibase/wrtsh/wrtsh2.cxx
index 7a264dd6e09d..4cb726a2e1e4 100644
--- a/sw/source/uibase/wrtsh/wrtsh2.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh2.cxx
@@ -502,26 +502,8 @@ bool SwWrtShell::ClickToINetGrf( const Point& rDocPt, 
LoadUrlFlags nFilter )
     return bRet;
 }
 
-void LoadURL( SwViewShell& rVSh, const OUString& rURL, LoadUrlFlags nFilter,
-              const OUString& rTargetFrameName )
-{
-    OSL_ENSURE( !rURL.isEmpty(), "what should be loaded here?" );
-    if( rURL.isEmpty() )
-        return ;
-
-    // The shell could be 0 also!!!!!
-    if ( dynamic_cast<const SwCursorShell*>( &rVSh) ==  nullptr )
-        return;
-
-    //A CursorShell is always a WrtShell
-    SwWrtShell &rSh = static_cast<SwWrtShell&>(rVSh);
-
-    ::LoadURL(rSh.GetView(), rURL, nFilter, rTargetFrameName);
-
-}
-
-void LoadURL(SwView& rView, const OUString& rURL, LoadUrlFlags nFilter,
-              const OUString& rTargetFrameName)
+static void LoadURL(SwView& rView, const OUString& rURL, LoadUrlFlags nFilter,
+                    const OUString& rTargetFrameName)
 {
     SwDocShell* pDShell = rView.GetDocShell();
     OSL_ENSURE( pDShell, "No DocShell?!");
@@ -577,6 +559,23 @@ void LoadURL(SwView& rView, const OUString& rURL, 
LoadUrlFlags nFilter,
             SfxCallMode::ASYNCHRON|SfxCallMode::RECORD );
 }
 
+void LoadURL( SwViewShell& rVSh, const OUString& rURL, LoadUrlFlags nFilter,
+              const OUString& rTargetFrameName )
+{
+    OSL_ENSURE( !rURL.isEmpty(), "what should be loaded here?" );
+    if( rURL.isEmpty() )
+        return ;
+
+    // The shell could be 0 also!!!!!
+    if ( dynamic_cast<const SwCursorShell*>( &rVSh) ==  nullptr )
+        return;
+
+    //A CursorShell is always a WrtShell
+    SwWrtShell &rSh = static_cast<SwWrtShell&>(rVSh);
+
+    ::LoadURL(rSh.GetView(), rURL, nFilter, rTargetFrameName);
+}
+
 void SwWrtShell::NavigatorPaste( const NaviContentBookmark& rBkmk,
                                     const sal_uInt16 nAction )
 {
commit 35177130c0853a9a982f3cc0c05f0358c65eab91
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Fri Nov 17 15:22:37 2023 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Tue Nov 21 15:40:07 2023 +0100

    sd: remote: check that received commands have expected arguments
    
    Change-Id: If4b5fe0362a40d14d68829bffb79f91ae9745835
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159590
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit 8d87164becccc230e1e0ad5ac51bf645744165a2)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159578
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    (cherry picked from commit 99b8559471c4429df70803cdb358da41888f8d03)

diff --git a/sd/source/ui/remotecontrol/Receiver.cxx 
b/sd/source/ui/remotecontrol/Receiver.cxx
index dd92e8e99d62..bb5881502c4b 100644
--- a/sd/source/ui/remotecontrol/Receiver.cxx
+++ b/sd/source/ui/remotecontrol/Receiver.cxx
@@ -77,6 +77,12 @@ void Receiver::executeCommand( const std::vector<OString> 
&aCommand )
     {
     }
 
+    if (aCommand.empty())
+    {
+        SAL_WARN("sdremote", "Receiver::executeCommand: no command");
+        return;
+    }
+
     if ( aCommand[0] ==  "transition_next" )
     {
         if ( xSlideShowController.is() )
@@ -89,6 +95,11 @@ void Receiver::executeCommand( const std::vector<OString> 
&aCommand )
     }
     else if ( aCommand[0] == "goto_slide" )
     {
+        if (aCommand.size() < 2)
+        {
+            SAL_WARN("sdremote", "Receiver::executeCommand: invalid 
goto_slide");
+            return;
+        }
         // FIXME: if 0 returned, then not a valid number
         sal_Int32 aSlide = aCommand[1].toInt32();
         if ( xSlideShowController.is() &&
@@ -121,6 +132,11 @@ void Receiver::executeCommand( const std::vector<OString> 
&aCommand )
     }
     else if (aCommand[0] == "pointer_started" )
     {
+        if (aCommand.size() < 3)
+        {
+            SAL_WARN("sdremote", "Receiver::executeCommand: invalid 
pointer_started");
+            return;
+        }
         // std::cerr << "pointer_started" << std::endl;
         float x = aCommand[1].toFloat();
         float y = aCommand[2].toFloat();
@@ -175,6 +191,11 @@ void Receiver::executeCommand( const std::vector<OString> 
&aCommand )
     }
     else if (aCommand[0] == "pointer_coordination" )
     {
+        if (aCommand.size() < 3)
+        {
+            SAL_WARN("sdremote", "Receiver::executeCommand: invalid 
pointer_coordination");
+            return;
+        }
         float x = aCommand[1].toFloat();
         float y = aCommand[2].toFloat();
 

Reply via email to