[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sfx2/source

Stephan Bergmann sbergman at redhat.com
Fri Jun 15 06:56:28 UTC 2018


 sfx2/source/appl/sfxhelp.cxx |  115 ++++++++++++++++++++++++-------------------
 1 file changed, 65 insertions(+), 50 deletions(-)

New commits:
commit 642e7c6c93f28ef38442b3e06bab033ec9b2a407
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Jun 14 17:21:19 2018 +0200

    tdf#33209: Context-sensitive help for extensions in otherwise HTML-help cases
    
    When extensions bring along help content (in the form of .xhp files), that was
    completely unavailable in --without-help (i.e., defering to online HTML help)
    and --with-help=html (i.e., displaying the new offline HTML help in a browser)
    builds.  (Merely extended tooltips brought along by extensions would work in
    those builds.)
    
    With this change, at least context-sensitive help (i.e., pressing F1 in an
    extension's dialog) will be shown.  Although not integrated with the rest of the
    (browser-based HTML) help, but using LO's own old help viewer.  (Which will then
    of course only offer the combined help content of all the installed extensions,
    not any help content provided by LO itself.  Thus, links from extensions' help
    content to LO help content will not work.)
    
    This is only a cheap stopgap.  If an extension brings along help content other
    than context-sensitive help (which is reachable by pressing F1 in the respective
    context), there is no easy way for the user to reach it.  (That includes help
    pages listed in an extension's help.tree, and index entries.  See the commit
    message of 4a0ca73c31990568bf20a1c3f0906c3a5770a38e "Add some help content to
    test-passive.oxt" for an overview of what help conent an extension can provide.)
    
    Regarding the details of this code change, I left the
    comphelper::LibreOfficeKit::isActive() case alone, assuming that that case never
    wants to display LO's own old help viewer, for one reason or another.  (But
    please correct me/the code if that assumption is wrong.)
    
    Reviewed-on: https://gerrit.libreoffice.org/55816
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    (cherry picked from commit 06a1c2c9fc467604372495023983874fba33ca85)
    Conflicts:
            sfx2/source/appl/sfxhelp.cxx
    
    Change-Id: I2209b1aa48888c5f25674fbe4ce6643eff1268c6
    Reviewed-on: https://gerrit.libreoffice.org/55825
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index cae51357f2a6..c754cdb0d86f 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -812,40 +812,48 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const
         return true;
     }
 
-    if ( impl_hasHTMLHelpInstalled() )
+    // If the HTML or no help is installed, but aHelpURL nevertheless references valid help content,
+    // that implies that that help content belongs to an extension (and thus would not be available
+    // in neither the offline nor online HTML help); in that case, fall through to the "old-help to
+    // display" code below:
+    if (SfxContentHelper::IsHelpErrorDocument(aHelpURL))
     {
-        impl_showOfflineHelp(aHelpURL);
-        return true;
-    }
+        if ( impl_hasHTMLHelpInstalled() )
+        {
+            impl_showOfflineHelp(aHelpURL);
+            return true;
+        }
 
-    if ( !impl_hasHelpInstalled() )
-    {
-        std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWindow ? pWindow->GetFrameWeld() : nullptr, "sfx/ui/helpmanual.ui"));
-        std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("onlinehelpmanual"));
+        if ( !impl_hasHelpInstalled() )
+        {
+            std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWindow ? pWindow->GetFrameWeld() : nullptr, "sfx/ui/helpmanual.ui"));
+            std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("onlinehelpmanual"));
 
-        LanguageTag aLangTag = Application::GetSettings().GetUILanguageTag();
-        OUString sLocaleString = SvtLanguageTable::GetLanguageString( aLangTag.getLanguageType() );
-        OUString sPrimText = xQueryBox->get_primary_text();
-        xQueryBox->set_primary_text(sPrimText.replaceAll("$UILOCALE", sLocaleString));
-        short OnlineHelpBox = xQueryBox->run();
+            LanguageTag aLangTag = Application::GetSettings().GetUILanguageTag();
+            OUString sLocaleString = SvtLanguageTable::GetLanguageString( aLangTag.getLanguageType() );
+            OUString sPrimText = xQueryBox->get_primary_text();
+            xQueryBox->set_primary_text(sPrimText.replaceAll("$UILOCALE", sLocaleString));
+            short OnlineHelpBox = xQueryBox->run();
 
-        if(OnlineHelpBox == RET_OK)
-        {
-            if ( impl_showOnlineHelp( aHelpURL ) )
-                return true;
+            if(OnlineHelpBox == RET_OK)
+            {
+                if ( impl_showOnlineHelp( aHelpURL ) )
+                    return true;
+                else
+                {
+                    NoHelpErrorBox aErrBox(pWindow ? pWindow->GetFrameWeld() : nullptr);
+                    aErrBox.run();
+                    return false;
+                }
+            }
             else
             {
-                NoHelpErrorBox aErrBox(pWindow ? pWindow->GetFrameWeld() : nullptr);
-                aErrBox.run();
                 return false;
             }
-        }
-        else
-        {
-            return false;
-        }
 
+        }
     }
+
     // old-help to display
     Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
 
@@ -954,40 +962,47 @@ bool SfxHelp::Start_Impl(const OUString& rURL, weld::Widget* pWidget, const OUSt
         return true;
     }
 
-    if ( impl_hasHTMLHelpInstalled() )
+    // If the HTML or no help is installed, but aHelpURL nevertheless references valid help content,
+    // that implies that that help content belongs to an extension (and thus would not be available
+    // in neither the offline nor online HTML help); in that case, fall through to the "old-help to
+    // display" code below:
+    if (SfxContentHelper::IsHelpErrorDocument(aHelpURL))
     {
-        impl_showOfflineHelp(aHelpURL);
-        return true;
-    }
+        if ( impl_hasHTMLHelpInstalled() )
+        {
+            impl_showOfflineHelp(aHelpURL);
+            return true;
+        }
 
-    if ( !impl_hasHelpInstalled() )
-    {
-        std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWidget, "sfx/ui/helpmanual.ui"));
-        std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("onlinehelpmanual"));
-
-        LanguageTag aLangTag = Application::GetSettings().GetUILanguageTag();
-        OUString sLocaleString = SvtLanguageTable::GetLanguageString( aLangTag.getLanguageType() );
-        OUString sPrimText = xQueryBox->get_primary_text();
-        xQueryBox->set_primary_text(sPrimText.replaceAll("$UILOCALE", sLocaleString));
-        xQueryBox->connect_help(LINK(nullptr, NoHelpErrorBox, HelpRequestHdl));
-        short OnlineHelpBox = xQueryBox->run();
-        xQueryBox->hide();
-        if (OnlineHelpBox == RET_OK)
+        if ( !impl_hasHelpInstalled() )
         {
-            if (impl_showOnlineHelp( aHelpURL ) )
-                return true;
+            std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWidget, "sfx/ui/helpmanual.ui"));
+            std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("onlinehelpmanual"));
+
+            LanguageTag aLangTag = Application::GetSettings().GetUILanguageTag();
+            OUString sLocaleString = SvtLanguageTable::GetLanguageString( aLangTag.getLanguageType() );
+            OUString sPrimText = xQueryBox->get_primary_text();
+            xQueryBox->set_primary_text(sPrimText.replaceAll("$UILOCALE", sLocaleString));
+            xQueryBox->connect_help(LINK(nullptr, NoHelpErrorBox, HelpRequestHdl));
+            short OnlineHelpBox = xQueryBox->run();
+            xQueryBox->hide();
+            if (OnlineHelpBox == RET_OK)
+            {
+                if (impl_showOnlineHelp( aHelpURL ) )
+                    return true;
+                else
+                {
+                    NoHelpErrorBox aErrBox(pWidget);
+                    aErrBox.run();
+                    return false;
+                }
+            }
             else
             {
-                NoHelpErrorBox aErrBox(pWidget);
-                aErrBox.run();
                 return false;
             }
-        }
-        else
-        {
-            return false;
-        }
 
+        }
     }
 
     // old-help to display


More information about the Libreoffice-commits mailing list