sd/source/ui/app/sdmod1.cxx |   30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

New commits:
commit 6e2b93e5a10d2270e83255e74cb7a727d09d20c8
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Wed Nov 22 21:14:41 2023 +0000
Commit:     Stephan Bergmann <stephan.bergm...@allotropia.de>
CommitDate: Wed Feb 14 14:06:09 2024 +0100

    reuse AllowedLinkProtocolFromDocument in impress/draw
    
    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>
    (cherry picked from commit 4938e035ff121ec850d5f8c4bae5ab634653ca12)
    Conflicts:
            sd/source/ui/app/sdmod1.cxx
    
    Change-Id: I73ca4f087946a45dbf92d69a0dc1e769de9b5690
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163369
    Tested-by: Stephan Bergmann <stephan.bergm...@allotropia.de>
    Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de>

diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx
index 094becb271fc..ccbb96ebaaec 100644
--- a/sd/source/ui/app/sdmod1.cxx
+++ b/sd/source/ui/app/sdmod1.cxx
@@ -34,6 +34,7 @@
 #include <sfx2/printer.hxx>
 #include <sfx2/docfile.hxx>
 #include <sfx2/templatedlg.hxx>
+#include <svl/stritem.hxx>
 #include <editeng/paperinf.hxx>
 #include <editeng/eeitem.hxx>
 #include <unotools/useroptions.hxx>
@@ -48,6 +49,7 @@
 #include "pres.hxx"
 #include "optsitem.hxx"
 #include "ViewShell.hxx"
+#include "Window.hxx"
 #include "sdattr.hxx"
 #include "sdpage.hxx"
 #include "DrawDocShell.hxx"
@@ -208,26 +210,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->GetActiveWindow()))
+                    {
+                        return;
+                    }
+                }
                 SfxGetpApp()->ExecuteSlot(rReq, SfxGetpApp()->GetInterface());
             }
             else

Reply via email to