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

Stephan Bergmann sbergman at redhat.com
Fri May 4 10:55:41 UTC 2018


 sfx2/source/appl/sfxhelp.cxx |   99 +++----------------------------------------
 1 file changed, 7 insertions(+), 92 deletions(-)

New commits:
commit 7cb822ca4875704f0a8b3816ad4f23d230848400
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Wed May 2 10:46:31 2018 +0200

    Revert "Enable new Help to be installed as extension"
    
    This reverts commit cdbb14cedb7d07aec0dda47fbb5ab65a02fb0cf6, no longer needed
    after e606179d5722427bc4137838585b38892e01b328 "tdf#116240: Include
    --with-help=html in installation sets".
    
    Change-Id: Iaf26b937aa40a6563589ac182b7365224b455482
    Reviewed-on: https://gerrit.libreoffice.org/53725
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index a45f2ac62b6d..0ebb845b1dcc 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -39,7 +39,6 @@
 #include <com/sun/star/frame/ModuleManager.hpp>
 #include <com/sun/star/system/SystemShellExecute.hpp>
 #include <com/sun/star/system/SystemShellExecuteFlags.hpp>
-#include <com/sun/star/deployment/PackageInformationProvider.hpp>
 #include <unotools/configmgr.hxx>
 #include <unotools/configitem.hxx>
 #include <svtools/helpopt.hxx>
@@ -83,10 +82,6 @@ using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::util;
 using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::system;
-using ::com::sun::star::deployment::PackageInformationProvider;
-using ::com::sun::star::deployment::XPackageInformationProvider;
-
-namespace uno = css::uno ;
 
 class NoHelpErrorBox
 {
@@ -205,78 +200,6 @@ bool impl_hasHTMLHelpInstalled()
     return bOK;
 }
 
-// Root path of the HTML help extension
-OUString getExtensionHTMLHelpRootURL()
-{
-    static OUString s_instURL;
-    if (!s_instURL.isEmpty())
-        return s_instURL;
-
-    static OUString aLocaleStr;
-
-    if (aLocaleStr.isEmpty())
-    {
-        // detect installed locale
-        aLocaleStr = HelpLocaleString();
-    }
-
-    Reference< XComponentContext > m_xContext( comphelper::getProcessComponentContext() );
-    const Reference< XPackageInformationProvider > xPackageInfo = PackageInformationProvider::get(m_xContext);
-
-    s_instURL = xPackageInfo->getPackageLocation(aLocaleStr + ".help.libreoffice.org");
-
-    return s_instURL;
-}
-
-/// Check if HTML help extension is installed
-/// verify extension installed and correct version
-bool impl_hasHTMLHelpExtensionInstalled()
-{
-    if (comphelper::LibreOfficeKit::isActive())
-        return false;
-
-    static OUString aLocaleStr;
-    static OUString aRootURL;
-    static OUString aVersion;
-
-    if (aLocaleStr.isEmpty())
-    {
-        // detect installed locale
-        aLocaleStr = HelpLocaleString();
-    }
-
-    OUString aIdentifier(aLocaleStr + ".help.libreoffice.org");
-
-    if (aRootURL.isEmpty())
-    {
-        Reference< XComponentContext > m_xContext( comphelper::getProcessComponentContext() );
-        const Reference< XPackageInformationProvider > xPackageInfo = PackageInformationProvider::get(m_xContext);
-        aRootURL = xPackageInfo->getPackageLocation(aIdentifier);
-        if(aRootURL.isEmpty())
-        {
-            return false;
-        }
-        uno::Sequence< uno::Sequence< OUString > > aExtensionList (xPackageInfo->getExtensionList());
-
-        if(aExtensionList.hasElements())
-        {
-            for (long i = aExtensionList.getLength() - 1; i >= 0; i--)
-            {
-                SAL_INFO("sfx.appl", aExtensionList[i][0] + " - " + aExtensionList[i][1]) ;
-                if (aExtensionList[i][0] == aIdentifier)
-                {
-                    aVersion = aExtensionList[i][1];
-                    break;
-                }
-            }
-        }
-    }
-
-    bool bOK(!aRootURL.isEmpty() && (aVersion.startsWith(utl::ConfigManager::getProductVersion())));
-
-    return bOK;
-}
-
 } // namespace
 
 /// Return the locale we prefer for displaying help
@@ -767,12 +690,12 @@ static bool impl_showOnlineHelp( const OUString& rURL )
 #define SHTML3 "\"><script type=\"text/javascript\"> window.location.href = \""
 #define SHTML4 "\";</script><title>Help Page Redirection</title></head><body></body></html>"
 
-
-static bool impl_showOfflineHelp( const OUString& rURL, const OUString& rBaseInstallPath)
+static bool impl_showOfflineHelp( const OUString& rURL )
 {
+    OUString aBaseInstallPath = getHelpRootURL();
     OUString const aInternal( "vnd.sun.star.help://"  );
 
-    OUString aHelpLink( rBaseInstallPath + "/index.html?" );
+    OUString aHelpLink( aBaseInstallPath + "/index.html?" );
     aHelpLink += rURL.copy( aInternal.getLength() );
     aHelpLink = aHelpLink.replaceAll("%2F","/").replaceAll("%3A",":");
 
@@ -890,14 +813,10 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const
         impl_showOnlineHelp( aHelpURL );
         return true;
     }
-    if ( impl_hasHTMLHelpExtensionInstalled() )
-    {
-        impl_showOfflineHelp( aHelpURL, getExtensionHTMLHelpRootURL() );
-        return true;
-    }
+
     if ( impl_hasHTMLHelpInstalled() )
     {
-        impl_showOfflineHelp(aHelpURL, getHelpRootURL());
+        impl_showOfflineHelp(aHelpURL);
         return true;
     }
 
@@ -1037,16 +956,12 @@ bool SfxHelp::Start_Impl(const OUString& rURL, weld::Widget* pWidget, const OUSt
         return true;
     }
 
-    if ( impl_hasHTMLHelpExtensionInstalled() )
-    {
-        impl_showOfflineHelp( aHelpURL, getExtensionHTMLHelpRootURL() );
-        return true;
-    }
     if ( impl_hasHTMLHelpInstalled() )
     {
-        impl_showOfflineHelp(aHelpURL, getHelpRootURL());
+        impl_showOfflineHelp(aHelpURL);
         return true;
     }
+
     if ( !impl_hasHelpInstalled() )
     {
         std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWidget, "sfx/ui/helpmanual.ui"));


More information about the Libreoffice-commits mailing list