[Libreoffice-commits] core.git: sfx2/source shell/Library_syssh.mk shell/source

Michael Meeks michael.meeks at collabora.com
Tue Dec 19 17:31:14 UTC 2017


 sfx2/source/appl/openuriexternally.cxx |   15 ++++++++++++++-
 sfx2/source/appl/sfxhelp.cxx           |   26 ++++++++++++++++++++++++++
 shell/Library_syssh.mk                 |    1 +
 shell/source/unix/exec/shellexec.cxx   |    7 +++++++
 4 files changed, 48 insertions(+), 1 deletion(-)

New commits:
commit 7978eb8f6efa64fb0d5fba993f029793672a78ba
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Wed Dec 13 15:09:36 2017 +0000

    LOK: fix URL launching, so that Help buttons work.
    
    Change-Id: I9efe0173c35341043c3402042d9aa364a03e4fc5
    Reviewed-on: https://gerrit.libreoffice.org/46419
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>
    (cherry picked from commit 2ccf578372cd77060abb6db520985165e779de3f)

diff --git a/sfx2/source/appl/openuriexternally.cxx b/sfx2/source/appl/openuriexternally.cxx
index 9518b913441b..5b3e4821b200 100644
--- a/sfx2/source/appl/openuriexternally.cxx
+++ b/sfx2/source/appl/openuriexternally.cxx
@@ -23,14 +23,27 @@
 #include <sfx2/sfxresid.hxx>
 #include <vcl/layout.hxx>
 #include <vcl/svapp.hxx>
-
 #include <openuriexternally.hxx>
+#include <comphelper/lok.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
 
+#include <sfx2/viewsh.hxx>
 #include <sfx2/strings.hrc>
 
 bool sfx2::openUriExternally(
     OUString const & uri, bool handleSystemShellExecuteException)
 {
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        if(SfxViewShell* pViewShell = SfxViewShell::Current())
+        {
+            pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED,
+                                                   uri.toUtf8().getStr());
+            return true;
+        }
+        return false;
+    }
+
     css::uno::Reference< css::system::XSystemShellExecute > exec(
         css::system::SystemShellExecute::create(comphelper::getProcessComponentContext()));
     try {
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index af38b75182cb..4d5a2b240a01 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -56,6 +56,10 @@
 #include <svtools/sfxecode.hxx>
 #include <openuriexternally.hxx>
 
+#include <comphelper/lok.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <sfx2/viewsh.hxx>
+
 #include "newhelp.hxx"
 #include <sfx2/objsh.hxx>
 #include <sfx2/docfac.hxx>
@@ -503,6 +507,9 @@ OUString SfxHelp::GetHelpText( const OUString& aCommandURL, const vcl::Window* p
 /// Check for built-in help
 static bool impl_hasHelpInstalled( const OUString &rLang = OUString() )
 {
+    if (comphelper::LibreOfficeKit::isActive())
+        return false;
+
     OUStringBuffer aHelpRootURL("vnd.sun.star.help://");
     AppendConfigToken(aHelpRootURL, true, rLang);
     std::vector< OUString > aFactories = SfxContentHelper::GetResultSet(aHelpRootURL.makeStringAndClear());
@@ -531,6 +538,19 @@ static bool impl_showOnlineHelp( const OUString& rURL )
 
     aHelpLink += rURL.copy( aInternal.getLength() );
     aHelpLink = aHelpLink.replaceAll("%2F","/");
+
+
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        if(SfxViewShell* pViewShell = SfxViewShell::Current())
+        {
+            pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED,
+                                                   aHelpLink.toUtf8().getStr());
+            return true;
+        }
+        return false;
+    }
+
     try
     {
         sfx2::openUriExternally(aHelpLink, false);
@@ -622,6 +642,12 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const
         }
     }
 
+    if ( comphelper::LibreOfficeKit::isActive() )
+    {
+        impl_showOnlineHelp( aHelpURL );
+        return true;
+    }
+
     if ( !impl_hasHelpInstalled() )
     {
         ScopedVclPtrInstance< MessageDialog > aQueryBox(const_cast< vcl::Window* >( pWindow ),"onlinehelpmanual","sfx/ui/helpmanual.ui");
diff --git a/shell/Library_syssh.mk b/shell/Library_syssh.mk
index c36056a9536b..cd64791f1cd5 100644
--- a/shell/Library_syssh.mk
+++ b/shell/Library_syssh.mk
@@ -14,6 +14,7 @@ $(eval $(call gb_Library_use_sdk_api,syssh))
 $(eval $(call gb_Library_use_libraries,syssh,\
 	cppu \
 	cppuhelper \
+	comphelper \
 	sal \
 ))
 
diff --git a/shell/source/unix/exec/shellexec.cxx b/shell/source/unix/exec/shellexec.cxx
index d66a27668d06..095acec189b1 100644
--- a/shell/source/unix/exec/shellexec.cxx
+++ b/shell/source/unix/exec/shellexec.cxx
@@ -34,6 +34,7 @@
 #include <com/sun/star/uri/ExternalUriReferenceTranslator.hpp>
 #include <com/sun/star/uri/UriReferenceFactory.hpp>
 #include <cppuhelper/supportsservice.hxx>
+#include <comphelper/lok.hxx>
 
 #include <uno/current_context.hxx>
 
@@ -97,6 +98,12 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar
 {
     OStringBuffer aBuffer, aLaunchBuffer;
 
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        SAL_WARN("shell", "Unusual - shell attemp to launch " << aCommand << " with params " << aParameter << " under lok");
+        return;
+    }
+
     // DESKTOP_LAUNCH, see http://freedesktop.org/pipermail/xdg/2004-August/004489.html
     static const char *pDesktopLaunch = getenv( "DESKTOP_LAUNCH" );
 


More information about the Libreoffice-commits mailing list