[Libreoffice-commits] .: 3 commits - sfx2/source

Jan Holesovsky kendy at kemper.freedesktop.org
Tue Nov 30 02:14:04 PST 2010


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

New commits:
commit 29c460d124dba19c95f3deda42a5810e7509073b
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Tue Nov 30 11:13:07 2010 +0100

    help: Avoid some copy-n-paste.

diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index 3655fe2..fa0f01e 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -643,28 +643,7 @@ String	SfxHelp::CreateHelpURL_Impl( const String& aCommandURL, const String& rMo
 
     String aModuleName( rModuleName );
     if ( aModuleName.Len() == 0 )
-    {
-        // no active module (quicklaunch?) -> detect default module
-        SvtModuleOptions aModOpt;
-        if ( aModOpt.IsModuleInstalled( SvtModuleOptions::E_SWRITER ) )
-            aModuleName = DEFINE_CONST_UNICODE("swriter");
-        else if ( aModOpt.IsModuleInstalled( SvtModuleOptions::E_SCALC ) )
-            aModuleName = DEFINE_CONST_UNICODE("scalc");
-        else if ( aModOpt.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) )
-            aModuleName = DEFINE_CONST_UNICODE("simpress");
-        else if ( aModOpt.IsModuleInstalled( SvtModuleOptions::E_SDRAW ) )
-            aModuleName = DEFINE_CONST_UNICODE("sdraw");
-        else if ( aModOpt.IsModuleInstalled( SvtModuleOptions::E_SMATH ) )
-            aModuleName = DEFINE_CONST_UNICODE("smath");
-        else if ( aModOpt.IsModuleInstalled( SvtModuleOptions::E_SCHART ) )
-            aModuleName = DEFINE_CONST_UNICODE("schart");
-        else if ( aModOpt.IsModuleInstalled( SvtModuleOptions::E_SBASIC ) )
-            aModuleName = DEFINE_CONST_UNICODE("sbasic");
-        else
-        {
-            DBG_ERRORFILE( "no installed module found" );
-        }
-    }
+        aModuleName = getDefaultModule_Impl();
 
     aHelpURL = String::CreateFromAscii("vnd.sun.star.help://");
     aHelpURL += aModuleName;
commit cd8e51b83dfb61cd6f55cf0fad8a8d7e09ca9f38
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Tue Nov 30 09:43:35 2010 +0100

    wikihelp: Check for the built-in help availability after creating URL.
    
    This is to have the full help URL even for stuff like .uno:Something, when we
    use the on-line help instead of the built-in one.

diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index 78a050c..3655fe2 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -778,23 +778,6 @@ BOOL SfxHelp::Start( const String& rURL, const Window* pWindow )
     INetURLObject aParser( aHelpURL );
     INetProtocol nProtocol = aParser.GetProtocol();
 
-    // 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() )
-    {
-        // no factories -> no help -> try online
-        if ( nProtocol == INET_PROT_VND_SUN_STAR_HELP && impl_showOnlineHelp( rURL ) )
-            return TRUE;
-        else
-        {
-            NoHelpErrorBox aErrBox( const_cast< Window* >( pWindow ) );
-            aErrBox.Execute();
-            return FALSE;
-        }
-    }
-
     // check if it's an URL or a jump mark!
     ::rtl::OUString sKeyword;
     if ( nProtocol != INET_PROT_VND_SUN_STAR_HELP )
@@ -818,7 +801,7 @@ BOOL SfxHelp::Start( const String& rURL, const Window* pWindow )
         }
         else
         {
-            aHelpURL  = CreateHelpURL_Impl( 0, GetHelpModuleName_Impl( ) );
+            aHelpURL = CreateHelpURL_Impl( 0, GetHelpModuleName_Impl( ) );
 
             // pb i91715: strings begin with ".HelpId:" are not words of the basic ide
             // they are helpid-strings used by the testtool -> so we ignore them
@@ -828,6 +811,23 @@ 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() )
+    {
+        // no factories -> no help -> try online
+        if ( impl_showOnlineHelp( aHelpURL ) )
+            return TRUE;
+        else
+        {
+            NoHelpErrorBox aErrBox( const_cast< Window* >( pWindow ) );
+            aErrBox.Execute();
+            return FALSE;
+        }
+    }
+
     Reference < XFrame > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance(
         DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY );
 
commit eb14a00d4538da480cd57c1f9a37dad383308e69
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Mon Nov 29 18:17:06 2010 +0100

    wikihelp: Small update from the libreoffice-3-3 branch.
    
    Cherry-picked to avoid conflicts later.

diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index 835738b..78a050c 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -747,11 +747,11 @@ SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame >& rHelpTask   ,
 
 static bool impl_showOnlineHelp( const String& rURL )
 {
-    String aInternal( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.help:/" ) );
-    if ( rURL.Len() < aInternal.Len() || rURL.Copy( 0, aInternal.Len() ) != aInternal )
+    String aInternal( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.help://" ) );
+    if ( rURL.Len() <= aInternal.Len() || rURL.Copy( 0, aInternal.Len() ) != aInternal )
         return false;
 
-    rtl::OUString aHelpLink( RTL_CONSTASCII_USTRINGPARAM( "http://help.libreoffice.org" ) );
+    rtl::OUString aHelpLink( RTL_CONSTASCII_USTRINGPARAM( "http://help.libreoffice.org/" ) );
     aHelpLink += rURL.Copy( aInternal.Len() );
     try
     {


More information about the Libreoffice-commits mailing list