summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-06-14 17:21:19 +0200
committerStephan Bergmann <sbergman@redhat.com>2018-06-15 08:56:03 +0200
commit642e7c6c93f28ef38442b3e06bab033ec9b2a407 (patch)
treef6efe70577adeda0608a64e5fe117d73d1bc67a6
parent9bec4997fe6bceabf381e07793d2c8ba38ee19da (diff)
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@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@redhat.com>
-rw-r--r--sfx2/source/appl/sfxhelp.cxx115
1 files changed, 65 insertions, 50 deletions
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