diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-12-11 00:02:35 +0100 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-12-11 00:02:35 +0100 |
commit | 3244b62441dbb4f32c21a95ba2b135fbb119d558 (patch) | |
tree | f296d6b1f940f7907472ce8eca4f9d610b891d32 /sfx2 | |
parent | 4517f686e9019ead3177ed94ec0016e1461b3c4b (diff) |
#i107450#: HelpAgent now can be started without linking against sfx2
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/inc/sfxhelp.hxx | 1 | ||||
-rw-r--r-- | sfx2/source/appl/sfxhelp.cxx | 42 |
2 files changed, 25 insertions, 18 deletions
diff --git a/sfx2/inc/sfxhelp.hxx b/sfx2/inc/sfxhelp.hxx index ce0921c23a23..c86ac6d61e6a 100644 --- a/sfx2/inc/sfxhelp.hxx +++ b/sfx2/inc/sfxhelp.hxx @@ -50,6 +50,7 @@ class SFX2_DLLPUBLIC SfxHelp : public Help private: SAL_DLLPRIVATE virtual BOOL Start( ULONG nHelpId, const Window* pWindow ); SAL_DLLPRIVATE virtual BOOL Start( const String& rURL, const Window* pWindow ); + SAL_DLLPRIVATE virtual void OpenHelpAgent( ULONG nHelpId ); SAL_DLLPRIVATE String GetHelpModuleName_Impl(); SAL_DLLPRIVATE String CreateHelpURL_Impl( ULONG nHelpId, const String& rModuleName ); diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 491de2138917..e6f04749be84 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -38,9 +38,7 @@ #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/lang/XComponent.hpp> -#ifndef _UNOTOOLS_PROCESSFACTORY_HXX #include <comphelper/processfactory.hxx> -#endif #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/awt/XTopWindow.hpp> #include <com/sun/star/awt/PosSize.hpp> @@ -60,13 +58,11 @@ #include <tools/urlobj.hxx> #include <unotools/configmgr.hxx> #include <ucbhelper/content.hxx> - #include <unotools/pathoptions.hxx> #include <rtl/ustring.hxx> #include <osl/process.h> #include <osl/file.hxx> #include <unotools/bootstrap.hxx> - #include <rtl/uri.hxx> #include <vcl/msgbox.hxx> #include <svtools/ehdl.hxx> @@ -76,16 +72,13 @@ #define _SVSTDARR_ULONGSSORT #include <svl/svstdarr.hxx> -#include <sfx2/sfxsids.hrc> -#include <sfx2/app.hxx> -#include <sfx2/viewfrm.hxx> -#include <sfx2/msgpool.hxx> #include "newhelp.hxx" -#include <sfx2/objsh.hxx> -#include <sfx2/docfac.hxx> #include "sfxresid.hxx" #include "helper.hxx" #include "app.hrc" +#include <sfx2/sfxuno.hxx> +#include <vcl/svapp.hxx> +#include <sfx2/frame.hxx> using namespace ::com::sun::star::beans; using namespace ::com::sun::star::frame; @@ -967,26 +960,39 @@ String SfxHelp::CreateHelpURL( const String& aCommandURL, const String& rModuleN return aURL; } -void SfxHelp::OpenHelpAgent( SfxFrame *pFrame, ULONG nHelpId ) +void SfxHelp::OpenHelpAgent( SfxFrame*, ULONG nHelpId ) { - if ( SvtHelpOptions().IsHelpAgentAutoStartMode() ) - { SfxHelp* pHelp = SAL_STATIC_CAST( SfxHelp*, Application::GetHelp() ); if ( pHelp ) - { - SfxHelpOptions_Impl *pOpt = pHelp->pImp->GetOptions(); + pHelp->OpenHelpAgent( nHelpId ); +} + +void SfxHelp::OpenHelpAgent( ULONG nHelpId ) +{ + if ( SvtHelpOptions().IsHelpAgentAutoStartMode() ) + { +// SfxHelp* pHelp = SAL_STATIC_CAST( SfxHelp*, Application::GetHelp() ); +// if ( pHelp ) +// { + SfxHelpOptions_Impl *pOpt = pImp->GetOptions(); if ( !pOpt->HasId( nHelpId ) ) return; try { URL aURL; - aURL.Complete = pHelp->CreateHelpURL_Impl( nHelpId, pHelp->GetHelpModuleName_Impl() ); + aURL.Complete = CreateHelpURL_Impl( nHelpId, GetHelpModuleName_Impl() ); Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" ) ), UNO_QUERY ); xTrans->parseStrict(aURL); - Reference< XDispatchProvider > xDispProv( pFrame->GetTopFrame()->GetFrameInterface(), UNO_QUERY ); + Reference < XFrame > xCurrentFrame; + Reference < XDesktop > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance( + DEFINE_CONST_UNICODE("com.sun.star.frame.Desktop") ), UNO_QUERY ); + if ( xDesktop.is() ) + xCurrentFrame = xDesktop->getCurrentFrame(); + + Reference< XDispatchProvider > xDispProv( xCurrentFrame, UNO_QUERY ); Reference< XDispatch > xHelpDispatch; if ( xDispProv.is() ) xHelpDispatch = xDispProv->queryDispatch( @@ -1001,7 +1007,7 @@ void SfxHelp::OpenHelpAgent( SfxFrame *pFrame, ULONG nHelpId ) { DBG_ERRORFILE( "OpenHelpAgent: caught an exception while executing the dispatch!" ); } - } +// } } } |