summaryrefslogtreecommitdiff
path: root/sfx2/source/appl/sfxhelp.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/source/appl/sfxhelp.cxx')
-rw-r--r--sfx2/source/appl/sfxhelp.cxx583
1 files changed, 321 insertions, 262 deletions
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index d5e6f24c72..b281b5135b 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -29,7 +29,7 @@
#include "precompiled_sfx2.hxx"
#include "sfxhelp.hxx"
-
+#include <set>
#include <algorithm>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/frame/XFrame.hpp>
@@ -76,6 +76,7 @@
#include <sfx2/sfxuno.hxx>
#include <vcl/svapp.hxx>
#include <sfx2/frame.hxx>
+#include <rtl/string.hxx>
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::frame;
@@ -221,13 +222,13 @@ sal_Bool GetHelpAnchor_Impl( const String& _rURL, String& _rAnchor )
class SfxHelpOptions_Impl : public utl::ConfigItem
{
private:
- SvULongsSort* m_pIds;
+ std::set < rtl::OString > m_aIds;
public:
SfxHelpOptions_Impl();
~SfxHelpOptions_Impl();
- BOOL HasId( ULONG nId ) { USHORT nDummy; return m_pIds ? m_pIds->Seek_Entry( nId, &nDummy ) : FALSE; }
+ bool HasId( const rtl::OString& rId ) { return m_aIds.size() ? m_aIds.find( rId ) != m_aIds.end() : false; }
virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames );
virtual void Commit();
};
@@ -254,7 +255,6 @@ static Sequence< ::rtl::OUString > GetPropertyNames()
SfxHelpOptions_Impl::SfxHelpOptions_Impl()
: ConfigItem( ::rtl::OUString::createFromAscii("Office.SFX/Help") )
- , m_pIds( NULL )
{
Sequence< ::rtl::OUString > aNames = GetPropertyNames();
Sequence< Any > aValues = GetProperties( aNames );
@@ -275,11 +275,15 @@ SfxHelpOptions_Impl::SfxHelpOptions_Impl()
::rtl::OUString aCodedList;
if ( pValues[nProp] >>= aCodedList )
{
- String aTmp( aCodedList );
- USHORT nCount = aTmp.GetTokenCount( ',' );
- m_pIds = new SvULongsSort();
- for ( USHORT n=0; n<nCount; n++ )
- m_pIds->Insert( (ULONG) aTmp.GetToken( n, ',' ).ToInt64() );
+ rtl::OString aTmp( aCodedList, aCodedList.getLength(), RTL_TEXTENCODING_UTF8 );
+ sal_Int32 nIndex = 0;
+ do
+ {
+ rtl::OString aToken = aTmp.getToken( 0, ',', nIndex );
+ if ( aToken.getLength() )
+ m_aIds.insert( aToken );
+ }
+ while ( nIndex >= 0 );
}
else {
DBG_ERRORFILE( "Wrong property type!" );
@@ -299,7 +303,6 @@ SfxHelpOptions_Impl::SfxHelpOptions_Impl()
SfxHelpOptions_Impl::~SfxHelpOptions_Impl()
{
- delete m_pIds;
}
@@ -326,8 +329,7 @@ public:
~SfxHelp_Impl();
SfxHelpOptions_Impl* GetOptions();
- String GetHelpText( ULONG nHelpId, const String& rModule ); // get "Active Help"
- String GetHelpText( const rtl::OUString& aCommandURL, const String& rModule );
+ static String GetHelpText( const rtl::OUString& aCommandURL, const String& rModule );
sal_Bool HasModule( const ::rtl::OUString& rModule ); // module installed
sal_Bool IsHelpInstalled(); // module list not empty
};
@@ -370,16 +372,6 @@ void SfxHelp_Impl::Load()
}
}
-String SfxHelp_Impl::GetHelpText( ULONG nHelpId, const String& rModule )
-{
- // create help url
- String aHelpURL = SfxHelp::CreateHelpURL( nHelpId, rModule );
- // added 'active' parameter
- aHelpURL.Insert( String( DEFINE_CONST_UNICODE("&Active=true") ), aHelpURL.SearchBackward( '#' ) );
- // load help string
- return SfxContentHelper::GetActiveHelpString( aHelpURL );
-}
-
String SfxHelp_Impl::GetHelpText( const rtl::OUString& aCommandURL, const String& rModule )
{
// create help url
@@ -413,6 +405,199 @@ sal_Bool SfxHelp_Impl::IsHelpInstalled()
}
// class SfxHelp ---------------------------------------------------------
+/* some test code for HID conversion - please don't remove
+
+#include <tools/stream.hxx>
+void TestHids()
+{
+ static const char* aModules[] =
+ {
+ "swriter",
+ "scalc",
+ "simpress",
+ "sdraw",
+ "sdatabase",
+ "smath",
+ "schart",
+ "sbasic"
+ };
+
+ SvFileStream* pOut[] =
+ {
+ 0,0,0,0,0,0,0,0,0
+ };
+
+ String aIn = String::CreateFromAscii("/data/OOo/replacer/hidsin.lst");
+ String aOut = String::CreateFromAscii("/data/OOo/replacer/");
+ SvFileStream aInStrm( aIn, STREAM_READ );
+ ByteString aBuffer;
+ while ( aInStrm.ReadLine( aBuffer ) )
+ {
+ ByteString aHid = aBuffer.GetToken(0, ' ');
+ ByteString aNr = aBuffer.GetToken(1, ' ');
+ bool bFound=false;
+ for (sal_Int32 n= 0; n<8; n++)
+ {
+ bFound = false;
+ String aHelpURL = SfxHelp::CreateHelpURL( String( aNr, RTL_TEXTENCODING_UTF8 ), String( aModules[n], RTL_TEXTENCODING_UTF8 ) );
+ if ( !SfxContentHelper::IsHelpErrorDocument( aHelpURL ) )
+ {
+ if (!pOut[n])
+ {
+ String aTmp( aOut );
+ aTmp += String( aModules[n], RTL_TEXTENCODING_UTF8 );
+ aTmp += String::CreateFromAscii(".lst");
+ pOut[n] = new SvFileStream( aTmp, STREAM_WRITE | STREAM_TRUNC );
+ }
+ pOut[n]->WriteLine( aHid );
+ bFound = true;
+ break;
+ }
+ }
+
+ if (!bFound)
+ {
+ if (!pOut[8])
+ {
+ String aTmp( aOut );
+ aTmp += String( "notfound", RTL_TEXTENCODING_UTF8 );
+ aTmp += String::CreateFromAscii(".lst");
+ pOut[8] = new SvFileStream( aTmp, STREAM_WRITE | STREAM_TRUNC );
+ }
+ pOut[8]->WriteLine( aHid );
+ }
+ }
+
+ for (sal_Int32 n= 0; n<9; n++)
+ DELETEZ( pOut[n] );
+}
+
+void TestHids2()
+{
+ static const char* aModules[] =
+ {
+ "swriter",
+ "scalc",
+ "simpress",
+ "smath",
+ "sbasic"
+ };
+
+ String aOut = String::CreateFromAscii("/data/OOo/replacer/");
+ aOut += String::CreateFromAscii("lost.lst");
+ SvFileStream aOutStrm( aOut, STREAM_WRITE | STREAM_TRUNC );
+ for (sal_Int32 n= 0; n<5; n++)
+ {
+ String aIn = String::CreateFromAscii("/data/OOo/replacer/help/");
+ aIn += String::CreateFromAscii( aModules[n] );
+ aIn += String::CreateFromAscii(".lst");
+ SvFileStream aInStrm( aIn, STREAM_READ );
+ ByteString aBuffer;
+ while ( aInStrm.ReadLine( aBuffer ) )
+ {
+ String aHelpURL = SfxHelp::CreateHelpURL( String( aBuffer, RTL_TEXTENCODING_UTF8 ), String( aModules[n], RTL_TEXTENCODING_UTF8 ) );
+ if ( SfxContentHelper::IsHelpErrorDocument( aHelpURL ) )
+ aOutStrm.WriteLine( aBuffer );
+ }
+ }
+}
+
+#include <tools/stream.hxx>
+void TestHids3()
+{
+ static const char* aModules[] =
+ {
+ "swriter",
+ "scalc",
+ "simpress",
+ "sdraw",
+ "sdatabase",
+ "smath",
+ "schart",
+ "sbasic"
+ };
+
+ SvFileStream* pOut[] =
+ {
+ 0,0,0,0,0,0,0,0,0
+ };
+
+ String aIn = String::CreateFromAscii("/data/OOo/replacer/hidsin.lst");
+ String aOut = String::CreateFromAscii("/data/OOo/replacer/quickhelp/");
+ SvFileStream aInStrm( aIn, STREAM_READ );
+ ByteString aBuffer;
+ while ( aInStrm.ReadLine( aBuffer ) )
+ {
+ ByteString aHid = aBuffer.GetToken(0, ' ');
+ ByteString aNr = aBuffer.GetToken(1, ' ');
+ bool bFound=false;
+ for (sal_Int32 n= 0; n<8; n++)
+ {
+ bFound = false;
+ String aHelpURL = SfxHelp::CreateHelpURL( String( aNr, RTL_TEXTENCODING_UTF8 ), String( aModules[n], RTL_TEXTENCODING_UTF8 ) );
+ if ( SfxContentHelper::GetActiveHelpString( aHelpURL ).Len() )
+// if ( SfxHelp_Impl::GetHelpText( String( aNr, RTL_TEXTENCODING_UTF8 ), String( aModules[n], RTL_TEXTENCODING_UTF8 ) ).Len() )
+ {
+ if (!pOut[n])
+ {
+ String aTmp( aOut );
+ aTmp += String( aModules[n], RTL_TEXTENCODING_UTF8 );
+ aTmp += String::CreateFromAscii(".lst");
+ pOut[n] = new SvFileStream( aTmp, STREAM_WRITE | STREAM_TRUNC );
+ }
+ pOut[n]->WriteLine( aHid );
+ bFound = true;
+ break;
+ }
+ }
+
+ if (!bFound)
+ {
+ if (!pOut[8])
+ {
+ String aTmp( aOut );
+ aTmp += String( "notfound", RTL_TEXTENCODING_UTF8 );
+ aTmp += String::CreateFromAscii(".lst");
+ pOut[8] = new SvFileStream( aTmp, STREAM_WRITE | STREAM_TRUNC );
+ }
+ pOut[8]->WriteLine( aHid );
+ }
+ }
+
+ for (sal_Int32 n= 0; n<9; n++)
+ DELETEZ( pOut[n] );
+}
+
+void TestHids4()
+{
+ static const char* aModules[] =
+ {
+ "swriter",
+ "scalc",
+ "simpress",
+ "smath",
+ "sbasic"
+ };
+
+ String aOut = String::CreateFromAscii("/data/OOo/replacer/quickhelp/");
+ aOut += String::CreateFromAscii("lost.lst");
+ SvFileStream aOutStrm( aOut, STREAM_WRITE | STREAM_TRUNC );
+ for (sal_Int32 n= 0; n<5; n++)
+ {
+ String aIn = String::CreateFromAscii("/data/OOo/replacer/quickhelp/");
+ aIn += String::CreateFromAscii( aModules[n] );
+ aIn += String::CreateFromAscii(".lst");
+ SvFileStream aInStrm( aIn, STREAM_READ );
+ ByteString aBuffer;
+ while ( aInStrm.ReadLine( aBuffer ) )
+ {
+ String aHelpURL = SfxHelp::CreateHelpURL( String( aBuffer, RTL_TEXTENCODING_UTF8 ), String( aModules[n], RTL_TEXTENCODING_UTF8 ) );
+ if ( !SfxContentHelper::GetActiveHelpString( aHelpURL ).Len() )
+ aOutStrm.WriteLine( aBuffer );
+ }
+ }
+}
+*/
SfxHelp::SfxHelp() :
@@ -581,76 +766,6 @@ String SfxHelp::GetHelpModuleName_Impl()
return sModuleName;
}
-String SfxHelp::CreateHelpURL_Impl( ULONG nHelpId, const String& rModuleName )
-{
- String aModuleName( rModuleName );
- if ( aModuleName.Len() == 0 )
- aModuleName = getDefaultModule_Impl();
-
- // build up the help URL
- String aHelpURL;
- if ( aTicket.Len() )
- {
- // if there is a ticket, we are inside a plugin, so a special Help URL must be sent
- aHelpURL = DEFINE_CONST_UNICODE("vnd.sun.star.cmd:help?");
- aHelpURL += DEFINE_CONST_UNICODE("HELP_Request_Mode=contextIndex&HELP_Session_Mode=context&HELP_CallMode=portal&HELP_Device=html");
-
- if ( !nHelpId )
- {
- // no help id -> start page
- aHelpURL += DEFINE_CONST_UNICODE("&HELP_ContextID=start");
- }
- else
- {
- aHelpURL += DEFINE_CONST_UNICODE("&HELP_ContextID=");
- aHelpURL += String::CreateFromInt64( nHelpId );
- }
-
- aHelpURL += DEFINE_CONST_UNICODE("&HELP_ProgramID=");
- aHelpURL += aModuleName;
- aHelpURL += DEFINE_CONST_UNICODE("&HELP_User=");
- aHelpURL += aUser;
- aHelpURL += DEFINE_CONST_UNICODE("&HELP_Ticket=");
- aHelpURL += aTicket;
- aHelpURL += DEFINE_CONST_UNICODE("&HELP_Language=");
- aHelpURL += aLanguageStr;
- if ( aCountryStr.Len() )
- {
- aHelpURL += DEFINE_CONST_UNICODE("&HELP_Country=");
- aHelpURL += aCountryStr;
- }
- }
- else
- {
- sal_Bool bHasAnchor = sal_False;
- String aAnchor;
- aHelpURL = String::CreateFromAscii("vnd.sun.star.help://");
- aHelpURL += aModuleName;
-
- if ( !nHelpId )
- aHelpURL += String::CreateFromAscii("/start");
- else
- {
- aHelpURL += '/';
- aHelpURL += String::CreateFromInt64( nHelpId );
-
- String aTempURL = aHelpURL;
- AppendConfigToken_Impl( aTempURL, sal_True );
- bHasAnchor = GetHelpAnchor_Impl( aTempURL, aAnchor );
- }
-
- AppendConfigToken_Impl( aHelpURL, sal_True );
-
- if ( bHasAnchor )
- {
- aHelpURL += '#';
- aHelpURL += aAnchor;
- }
- }
-
- return aHelpURL;
-}
-
String SfxHelp::CreateHelpURL_Impl( const String& aCommandURL, const String& rModuleName )
{
// build up the help URL
@@ -660,28 +775,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;
@@ -694,7 +788,7 @@ String SfxHelp::CreateHelpURL_Impl( const String& aCommandURL, const String& rMo
aHelpURL += String( rtl::Uri::encode( aCommandURL,
rtl_UriCharClassRelSegment,
rtl_UriEncodeKeepEscapes,
- RTL_TEXTENCODING_ASCII_US ));
+ RTL_TEXTENCODING_UTF8 ));
String aTempURL = aHelpURL;
AppendConfigToken_Impl( aTempURL, sal_True );
@@ -762,8 +856,60 @@ SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame >& rHelpTask ,
return pHelpWindow;
}
+XubString SfxHelp::GetHelpText( const String& aCommandURL, const Window* pWindow )
+{
+ String sModuleName = GetHelpModuleName_Impl();
+ String sHelpText = pImp->GetHelpText( aCommandURL, sModuleName );
+
+ ByteString aNewHelpId;
+
+ if ( pWindow && !sHelpText.Len() )
+ {
+ // no help text found -> try with parent help id.
+ Window* pParent = pWindow->GetParent();
+ while ( pParent )
+ {
+ aNewHelpId = pParent->GetHelpId();
+ sHelpText = pImp->GetHelpText( String( aNewHelpId, RTL_TEXTENCODING_UTF8 ), sModuleName );
+ if ( sHelpText.Len() > 0 )
+ pParent = NULL;
+ else
+ pParent = pParent->GetParent();
+ }
+
+ if ( bIsDebug && !sHelpText.Len() )
+ aNewHelpId.Erase();
+ }
+
+ // add some debug information?
+ if ( bIsDebug )
+ {
+ sHelpText += DEFINE_CONST_UNICODE("\n-------------\n");
+ sHelpText += String( sModuleName );
+ sHelpText += DEFINE_CONST_UNICODE(": ");
+ sHelpText += aCommandURL;
+ if ( aNewHelpId.Len() )
+ {
+ sHelpText += DEFINE_CONST_UNICODE(" - ");
+ sHelpText += String( aNewHelpId, RTL_TEXTENCODING_UTF8 );
+ }
+ }
+
+ return sHelpText;
+}
+
+BOOL SfxHelp::SearchKeyword( const XubString& rKeyword )
+{
+ return Start_Impl( String(), NULL, rKeyword );
+}
+
BOOL SfxHelp::Start( const String& rURL, const Window* pWindow )
{
+ return Start_Impl( rURL, pWindow, String() );
+}
+
+BOOL SfxHelp::Start_Impl( const String& rURL, const Window* pWindow, const String& rKeyword )
+{
// check if help is available
String aHelpRootURL( DEFINE_CONST_OUSTRING("vnd.sun.star.help://") );
AppendConfigToken_Impl( aHelpRootURL, sal_True );
@@ -776,54 +922,60 @@ BOOL SfxHelp::Start( const String& rURL, const Window* pWindow )
return FALSE;
}
- // check if it's an URL or a jump mark!
- String aHelpURL(rURL );
- INetURLObject aParser (aHelpURL);
- ::rtl::OUString sKeyword;
+ /* rURL may be
+ - a "real" URL
+ - a HelpID (formerly a long, now a string)
+ If rURL is a URL, CreateHelpURL should be called for this URL
+ If rURL is an arbitrary string, the same should happen, but the URL should be tried out
+ if it delivers real help content. In case only the Help Error Document is returned, the
+ parent of the window for that help was called, is asked for its HelpID.
+ For compatibility reasons this upward search is not implemented for "real" URLs.
+ Help keyword search now is implemented as own method; in former versions it
+ was done via Help::Start, but this implementation conflicted with the upward search.
+ */
+ String aHelpURL;
+ INetURLObject aParser( rURL );
INetProtocol nProtocol = aParser.GetProtocol();
- if ( nProtocol != INET_PROT_VND_SUN_STAR_HELP )
+ String aHelpModuleName( GetHelpModuleName_Impl() );
+ switch ( nProtocol )
{
- // #i90162 Accept anything that is not invalid as help id, as both
- // uno: URLs used as commands/help ids in the Office and the scheme
- // used in extension help ids (e.g. com.foocorp.foo-ext:FooDialogButton)
- // are accepted as INET_PROT_UNO respectively INET_PROT_GENERIC
- bool bAcceptAsURL = ( nProtocol != INET_PROT_NOT_VALID );
-
- // #i94891 As in some extensions help ids like foo.bar.dummy without
- // any : have been used that worked before the fix of #i90162 (see
- // above) strings containing . will be also accepted to avoid brea-
- // king the help of existing extensions.
- if( !bAcceptAsURL )
- bAcceptAsURL = ( rURL.Search( '.' ) != STRING_NOTFOUND );
-
- if ( bAcceptAsURL )
+ case INET_PROT_VND_SUN_STAR_HELP:
+ // already a vnd.sun.star.help URL -> nothing to do
+ aHelpURL = rURL;
+ break;
+ default:
{
- aHelpURL = CreateHelpURL_Impl( rURL, GetHelpModuleName_Impl( ) );
- }
- else
- {
- 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
- static const String sHelpIdScheme( DEFINE_CONST_OUSTRING(".HelpId:") );
- if ( rURL.Search( sHelpIdScheme ) != 0 )
- sKeyword = ::rtl::OUString( rURL );
+ // no URL, just a HelpID (maybe empty in case of keyword search)
+ aHelpURL = CreateHelpURL_Impl( rURL, aHelpModuleName );
+ if ( pWindow && SfxContentHelper::IsHelpErrorDocument( aHelpURL ) )
+ {
+ // no help found -> try with parent help id.
+ Window* pParent = pWindow->GetParent();
+ while ( pParent )
+ {
+ ByteString aHelpId = pParent->GetHelpId();
+ aHelpURL = CreateHelpURL( String( aHelpId, RTL_TEXTENCODING_UTF8 ), aHelpModuleName );
+ if ( !SfxContentHelper::IsHelpErrorDocument( aHelpURL ) )
+ break;
+ else
+ {
+ pParent = pParent->GetParent();
+ if ( !pParent )
+ // create help url of start page ( helpid == 0 -> start page)
+ aHelpURL = CreateHelpURL( String(), aHelpModuleName );
+ }
+ }
+ }
+ break;
}
}
Reference < XFrame > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance(
DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY );
- // check if help is still open
- // If not - create new one and return acces directly
- // to the internal sub frame, which shows the help content.
-
- // Note further: We search for this sub frame here directly instead of
- // the real top level help task ... It's needed to have the same
- // sub frame available - so we can use it for loading (which is done
- // in both cases)!
-
+ // check if help window is still open
+ // If not, create a new one and return access directly to the internal sub frame showing the help content
+ // search must be done here; search one desktop level could return an arbitraty frame
Reference< XFrame > xHelp = xDesktop->findFrame(
::rtl::OUString(DEFINE_CONST_UNICODE("OFFICE_HELP_TASK")),
FrameSearchFlag::CHILDREN);
@@ -839,10 +991,16 @@ BOOL SfxHelp::Start( const String& rURL, const Window* pWindow )
if (!xHelp.is() || !xHelpContent.is() || !pHelpWindow)
return FALSE;
+#ifdef DBG_UTIL
+ ByteString aTmp("SfxHelp: HelpId = ");
+ aTmp += ByteString( aHelpURL, RTL_TEXTENCODING_UTF8 );
+ DBG_TRACE( aTmp.GetBuffer() );
+#endif
+
pHelpWindow->SetHelpURL( aHelpURL );
pHelpWindow->loadHelpContent(aHelpURL);
- if ( sKeyword.getLength() > 0 )
- pHelpWindow->OpenKeyword( sKeyword );
+ if ( rKeyword.Len() )
+ pHelpWindow->OpenKeyword( rKeyword );
Reference < ::com::sun::star::awt::XTopWindow > xTopWindow( xHelp->getContainerWindow(), UNO_QUERY );
if ( xTopWindow.is() )
@@ -851,101 +1009,6 @@ BOOL SfxHelp::Start( const String& rURL, const Window* pWindow )
return TRUE;
}
-BOOL SfxHelp::Start( ULONG nHelpId, const Window* pWindow )
-{
- String aHelpModuleName( GetHelpModuleName_Impl() );
- String aHelpURL = CreateHelpURL( nHelpId, aHelpModuleName );
- if ( pWindow && SfxContentHelper::IsHelpErrorDocument( aHelpURL ) )
- {
- // no help found -> try with parent help id.
- Window* pParent = pWindow->GetParent();
- while ( pParent )
- {
- nHelpId = pParent->GetSmartUniqueOrHelpId().GetNum();
- aHelpURL = CreateHelpURL( nHelpId, aHelpModuleName );
-
- if ( !SfxContentHelper::IsHelpErrorDocument( aHelpURL ) )
- break;
- else
- {
- pParent = pParent->GetParent();
- if ( !pParent )
- // create help url of start page ( helpid == 0 -> start page)
- aHelpURL = CreateHelpURL( 0, aHelpModuleName );
- }
- }
- }
-
- return Start( aHelpURL, pWindow );
-}
-
-XubString SfxHelp::GetHelpText( ULONG nHelpId, const Window* pWindow )
-{
- String aModuleName = GetHelpModuleName_Impl();
- String aHelpText = pImp->GetHelpText( nHelpId, aModuleName );
- ULONG nNewHelpId = 0;
-
- if ( pWindow && aHelpText.Len() == 0 )
- {
- // no help text found -> try with parent help id.
- Window* pParent = pWindow->GetParent();
- while ( pParent )
- {
- nNewHelpId = pParent->GetHelpId();
- aHelpText = pImp->GetHelpText( nNewHelpId, aModuleName );
-
- if ( aHelpText.Len() > 0 )
- pParent = NULL;
- else
- pParent = pParent->GetParent();
- }
-
- if ( bIsDebug && aHelpText.Len() == 0 )
- nNewHelpId = 0;
- }
-
- if ( bIsDebug )
- {
- aHelpText += DEFINE_CONST_UNICODE("\n\n");
- aHelpText += aModuleName;
- aHelpText += DEFINE_CONST_UNICODE(" - ");
- aHelpText += String::CreateFromInt64( nHelpId );
- if ( nNewHelpId )
- {
- aHelpText += DEFINE_CONST_UNICODE(" - ");
- aHelpText += String::CreateFromInt64( nNewHelpId );
- }
- }
-
- return aHelpText;
-}
-
-XubString SfxHelp::GetHelpText( const String& aCommandURL, const Window* )
-{
- String sModuleName = GetHelpModuleName_Impl();
- String sHelpText = pImp->GetHelpText( aCommandURL, sModuleName );
-
- // add some debug information?
- if ( bIsDebug )
- {
- sHelpText += DEFINE_CONST_UNICODE("\n-------------\n");
- sHelpText += String( sModuleName );
- sHelpText += DEFINE_CONST_UNICODE(": ");
- sHelpText += aCommandURL;
- }
-
- return sHelpText;
-}
-
-String SfxHelp::CreateHelpURL( ULONG nHelpId, const String& rModuleName )
-{
- String aURL;
- SfxHelp* pHelp = SAL_STATIC_CAST( SfxHelp*, Application::GetHelp() );
- if ( pHelp )
- aURL = pHelp->CreateHelpURL_Impl( nHelpId, rModuleName );
- return aURL;
-}
-
String SfxHelp::CreateHelpURL( const String& aCommandURL, const String& rModuleName )
{
String aURL;
@@ -955,28 +1018,25 @@ String SfxHelp::CreateHelpURL( const String& aCommandURL, const String& rModuleN
return aURL;
}
-void SfxHelp::OpenHelpAgent( SfxFrame*, ULONG nHelpId )
+void SfxHelp::OpenHelpAgent( SfxFrame*, const rtl::OString& sHelpId )
{
- SfxHelp* pHelp = SAL_STATIC_CAST( SfxHelp*, Application::GetHelp() );
- if ( pHelp )
- pHelp->OpenHelpAgent( nHelpId );
+ SfxHelp* pHelp = SAL_STATIC_CAST( SfxHelp*, Application::GetHelp() );
+ if ( pHelp )
+ pHelp->OpenHelpAgent( sHelpId );
}
-void SfxHelp::OpenHelpAgent( ULONG nHelpId )
+void SfxHelp::OpenHelpAgent( const rtl::OString& sHelpId )
{
if ( SvtHelpOptions().IsHelpAgentAutoStartMode() )
{
-// SfxHelp* pHelp = SAL_STATIC_CAST( SfxHelp*, Application::GetHelp() );
-// if ( pHelp )
-// {
SfxHelpOptions_Impl *pOpt = pImp->GetOptions();
- if ( !pOpt->HasId( nHelpId ) )
+ if ( !pOpt->HasId( sHelpId ) )
return;
try
{
URL aURL;
- aURL.Complete = CreateHelpURL_Impl( nHelpId, GetHelpModuleName_Impl() );
+ aURL.Complete = CreateHelpURL_Impl( String( ByteString(sHelpId), RTL_TEXTENCODING_UTF8 ), GetHelpModuleName_Impl() );
Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance(
::rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" ) ), UNO_QUERY );
xTrans->parseStrict(aURL);
@@ -1002,7 +1062,6 @@ void SfxHelp::OpenHelpAgent( ULONG nHelpId )
{
DBG_ERRORFILE( "OpenHelpAgent: caught an exception while executing the dispatch!" );
}
-// }
}
}