summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2010-12-15 22:56:22 +0100
committerDavid Tardon <dtardon@redhat.com>2010-12-16 07:04:21 +0100
commit55abe868d44218c0af7e55fb83a11d07ecb01894 (patch)
tree8329623f59454121d9e186ac4c911968f2c257e6
parent042933bbfb3ff69a34a0df12105e084cc95961e0 (diff)
wikihelp: Use the right Help ID URL, fdo#32338.feature/helppack
The offline help has a fallback mechanism that (for non-existing Help IDs) tries to traverse the parent windows to find at least something. This is not desired in the case of on-line help, because there we can easily define new redirects, without recompiling LibreOffice. Signed-off-by: David Tardon <dtardon@redhat.com>
-rw-r--r--sfx2/source/appl/sfxhelp.cxx20
1 files changed, 13 insertions, 7 deletions
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index 339e66411b..53c15ce730 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -745,6 +745,17 @@ SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame >& rHelpTask ,
return pHelpWindow;
}
+/// Check for built-in help
+static bool impl_hasHelpInstalled()
+{
+ String aHelpRootURL( DEFINE_CONST_OUSTRING("vnd.sun.star.help://") );
+ AppendConfigToken_Impl( aHelpRootURL, sal_True );
+ Sequence< ::rtl::OUString > aFactories = SfxContentHelper::GetResultSet( aHelpRootURL );
+
+ return ( aFactories.getLength() != 0 );
+}
+
+/// Redirect the vnd.sun.star.help:// urls to http://help.libreoffice.org
static bool impl_showOnlineHelp( const String& rURL )
{
String aInternal( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.help://" ) );
@@ -811,13 +822,8 @@ BOOL SfxHelp::Start( const String& rURL, const Window* pWindow )
}
}
- // check if help is available
- String aHelpRootURL( DEFINE_CONST_OUSTRING("vnd.sun.star.help://") );
- AppendConfigToken_Impl( aHelpRootURL, sal_True );
- Sequence< ::rtl::OUString > aFactories = SfxContentHelper::GetResultSet( aHelpRootURL );
- if ( 0 == aFactories.getLength() )
+ if ( !impl_hasHelpInstalled() )
{
- // no factories -> no help -> try online
if ( impl_showOnlineHelp( aHelpURL ) )
return TRUE;
else
@@ -871,7 +877,7 @@ BOOL SfxHelp::Start( ULONG nHelpId, const Window* pWindow )
{
String aHelpModuleName( GetHelpModuleName_Impl() );
String aHelpURL = CreateHelpURL( nHelpId, aHelpModuleName );
- if ( pWindow && SfxContentHelper::IsHelpErrorDocument( aHelpURL ) )
+ if ( impl_hasHelpInstalled() && pWindow && SfxContentHelper::IsHelpErrorDocument( aHelpURL ) )
{
// no help found -> try with parent help id.
Window* pParent = pWindow->GetParent();