Date: prev next · Thread: first prev next last
2010 Archives by date, by thread · List index


Hi,

https://bugs.freedesktop.org/show_bug.cgi?id=32338

Can you please review, sign-off and push the attached patch to
libreoffice-3-3?  The root of the problem is that in case of the
built-in help, when a help-id is not referenced there, the code tries to
traverse over the parent windows to find at least something.

In the case of the on-line help, we rather want to directly use that
(potentially missing) help id directly - otherwise we always end up on
the 'main' help page.  [And also we can fix the missing help id in the
wikihelp, without the app recompilation.]

Regards,
Kendy
From 3be61d6854441af24f52f1b306a91537ba289174 Mon Sep 17 00:00:00 2001
From: Jan Holesovsky <kendy@suse.cz>
Date: Wed, 15 Dec 2010 22:56:22 +0100
Subject: [PATCH] wikihelp: Use the right Help ID URL, fdo#32338.

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.
---
 sfx2/source/appl/sfxhelp.cxx |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index 339e664..2fb3e01 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();
-- 
1.7.3.1


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.