diff options
Diffstat (limited to 'sfx2/source/appl')
-rw-r--r-- | sfx2/source/appl/appcfg.cxx | 24 | ||||
-rw-r--r-- | sfx2/source/appl/appserv.cxx | 19 | ||||
-rw-r--r-- | sfx2/source/appl/sfxhelp.cxx | 162 |
3 files changed, 3 insertions, 202 deletions
diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx index 03aaf69c2e0b..8b0022aec34c 100644 --- a/sfx2/source/appl/appcfg.cxx +++ b/sfx2/source/appl/appcfg.cxx @@ -270,16 +270,6 @@ sal_Bool SfxApplication::GetOptions( SfxItemSet& rSet ) aHelpOptions.IsHelpTips() ) ) ) bRet = sal_True; break; - case SID_ATTR_AUTOHELPAGENT : - if(rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_ATTR_AUTOHELPAGENT ), - aHelpOptions.IsHelpAgentAutoStartMode() ) ) ) - bRet = sal_True; - break; - case SID_HELPAGENT_TIMEOUT : - if ( rSet.Put( SfxInt32Item( rPool.GetWhich( SID_HELPAGENT_TIMEOUT ), - aHelpOptions.GetHelpAgentTimeoutPeriod() ) ) ) - bRet = sal_True; - break; case SID_ATTR_WELCOMESCREEN : if(rSet.Put( SfxBoolItem ( rPool.GetWhich( SID_ATTR_WELCOMESCREEN ), aHelpOptions.IsWelcomeScreen() ) ) ) @@ -638,20 +628,6 @@ void SfxApplication::SetOptions_Impl( const SfxItemSet& rSet ) aHelpOptions.SetHelpTips(((const SfxBoolItem *)pItem)->GetValue()); } - // AutoHelpAgent - if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_AUTOHELPAGENT ), sal_True, &pItem)) - { - DBG_ASSERT(pItem->ISA(SfxBoolItem), "BoolItem expected"); - aHelpOptions.SetHelpAgentAutoStartMode( ((const SfxBoolItem *)pItem)->GetValue() ); - } - - // help agent timeout - if ( SFX_ITEM_SET == rSet.GetItemState( rPool.GetWhich( SID_HELPAGENT_TIMEOUT ), sal_True, &pItem ) ) - { - DBG_ASSERT(pItem->ISA(SfxInt32Item), "Int32Item expected"); - aHelpOptions.SetHelpAgentTimeoutPeriod( ( (const SfxInt32Item*)pItem )->GetValue() ); - } - // WelcomeScreen if ( SFX_ITEM_SET == rSet.GetItemState(rPool.GetWhich(SID_ATTR_WELCOMESCREEN ), sal_True, &pItem)) { diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 825125d0d48f..8914037f0ec3 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -528,20 +528,6 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - case SID_HELP_PI: - { - SvtHelpOptions aHelpOpt; - SFX_REQUEST_ARG(rReq, pOnItem, SfxBoolItem, SID_HELP_PI, sal_False); - sal_Bool bOn = pOnItem - ? ((SfxBoolItem*)pOnItem)->GetValue() - : !aHelpOpt.IsHelpAgentAutoStartMode(); - aHelpOpt.SetHelpAgentAutoStartMode( bOn ); - Invalidate(SID_HELP_PI); - bDone = true; - break; - } - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - case SID_ABOUT: { SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); @@ -766,11 +752,6 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet) rSet.Put( SfxBoolItem( SID_HELPBALLOONS, Help::IsBalloonHelpEnabled() ) ); } break; - case SID_HELP_PI: - { - rSet.Put( SfxBoolItem( SID_HELP_PI, SvtHelpOptions().IsHelpAgentAutoStartMode() ) ); - } - break; case SID_EXTENDEDHELP: { diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index 0d35063ecba8..cd0676159005 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -96,8 +96,6 @@ void NoHelpErrorBox::RequestHelp( const HelpEvent& ) // do nothing, because no help available } -#define STARTERLIST 0 - static bool impl_hasHelpInstalled( const OUString &rLang ); /// Return the locale we prefer for displaying help @@ -200,115 +198,12 @@ sal_Bool GetHelpAnchor_Impl( const OUString& _rURL, OUString& _rAnchor ) return bRet; } -class SfxHelpOptions_Impl : public utl::ConfigItem -{ -private: - std::set < OString > m_aIds; - -public: - SfxHelpOptions_Impl(); - ~SfxHelpOptions_Impl(); - - bool HasId( const OString& rId ) { return m_aIds.size() ? m_aIds.find( rId ) != m_aIds.end() : false; } - virtual void Notify( const com::sun::star::uno::Sequence< OUString >& aPropertyNames ); - virtual void Commit(); -}; - -static Sequence< OUString > GetPropertyNames() -{ - Sequence< OUString > aNames( 1 ); - OUString* pNames = aNames.getArray(); - pNames[0] = OUString( "HelpAgentStarterList" ); - - return aNames; -} - -SfxHelpOptions_Impl::SfxHelpOptions_Impl() - : ConfigItem( OUString("Office.SFX/Help") ) -{ - Sequence< OUString > aNames = GetPropertyNames(); - Sequence< Any > aValues = GetProperties( aNames ); - EnableNotification( aNames ); - const Any* pValues = aValues.getConstArray(); - DBG_ASSERT( aValues.getLength() == aNames.getLength(), "GetProperties failed" ); - if ( aValues.getLength() == aNames.getLength() ) - { - for ( int nProp = 0; nProp < aNames.getLength(); nProp++ ) - { - DBG_ASSERT( pValues[nProp].hasValue(), "property value missing" ); - if ( pValues[nProp].hasValue() ) - { - switch ( nProp ) - { - case STARTERLIST : - { - OUString aCodedList; - if ( pValues[nProp] >>= aCodedList ) - { - OString aTmp( - OUStringToOString( - aCodedList, RTL_TEXTENCODING_UTF8)); - sal_Int32 nIndex = 0; - do - { - OString aToken = aTmp.getToken( 0, ',', nIndex ); - if ( !aToken.isEmpty() ) - m_aIds.insert( aToken ); - } - while ( nIndex >= 0 ); - } - else { - SAL_WARN( "sfx2.appl", "Wrong property type!" ); - } - - break; - } - - default: - SAL_WARN( "sfx2.appl", "Wrong property!" ); - break; - } - } - } - } -} - -SfxHelpOptions_Impl::~SfxHelpOptions_Impl() -{ -} - - -void SfxHelpOptions_Impl::Notify( const com::sun::star::uno::Sequence< OUString >& ) -{ -} - -void SfxHelpOptions_Impl::Commit() -{ -} - class SfxHelp_Impl { -private: - SfxHelpOptions_Impl* m_pOpt; // the options - public: - SfxHelp_Impl(); - ~SfxHelp_Impl(); - - SfxHelpOptions_Impl* GetOptions(); - static OUString GetHelpText( const OUString& aCommandURL, const OUString& rModule ); + static OUString GetHelpText( const OUString& aCommandURL, const OUString& rModule ); }; -SfxHelp_Impl::SfxHelp_Impl() : - m_pOpt ( NULL ) -{ -} - -SfxHelp_Impl::~SfxHelp_Impl() -{ - delete m_pOpt; -} - OUString SfxHelp_Impl::GetHelpText( const OUString& aCommandURL, const OUString& rModule ) { // create help url @@ -322,14 +217,6 @@ OUString SfxHelp_Impl::GetHelpText( const OUString& aCommandURL, const OUString& return SfxContentHelper::GetActiveHelpString( aHelpURL.makeStringAndClear() ); } -SfxHelpOptions_Impl* SfxHelp_Impl::GetOptions() -{ - // create if not exists - if ( !m_pOpt ) - m_pOpt = new SfxHelpOptions_Impl; - return m_pOpt; -} - SfxHelp::SfxHelp() : bIsDebug( sal_False ), pImp ( NULL ) @@ -581,7 +468,7 @@ SfxHelpWindow_Impl* impl_createHelp(Reference< XFrame2 >& rHelpTask , OUString SfxHelp::GetHelpText( const OUString& aCommandURL, const Window* pWindow ) { OUString sModuleName = GetHelpModuleName_Impl(); - OUString sHelpText = pImp->GetHelpText( aCommandURL, sModuleName ); + OUString sHelpText = SfxHelp_Impl::GetHelpText( aCommandURL, sModuleName ); OString aNewHelpId; @@ -592,7 +479,7 @@ OUString SfxHelp::GetHelpText( const OUString& aCommandURL, const Window* pWindo while ( pParent ) { aNewHelpId = pParent->GetHelpId(); - sHelpText = pImp->GetHelpText( OStringToOUString(aNewHelpId, RTL_TEXTENCODING_UTF8), sModuleName ); + sHelpText = SfxHelp_Impl::GetHelpText( OStringToOUString(aNewHelpId, RTL_TEXTENCODING_UTF8), sModuleName ); if (!sHelpText.isEmpty()) pParent = NULL; else @@ -793,49 +680,6 @@ OUString SfxHelp::CreateHelpURL(const OUString& aCommandURL, const OUString& rMo return pHelp ? pHelp->CreateHelpURL_Impl( aCommandURL, rModuleName ) : OUString(); } -void SfxHelp::OpenHelpAgent( SfxFrame*, const OString& sHelpId ) -{ - SfxHelp* pHelp = (static_cast< SfxHelp* >(Application::GetHelp()) ); - if ( pHelp ) - pHelp->OpenHelpAgent( sHelpId ); -} - -void SfxHelp::OpenHelpAgent( const OString& sHelpId ) -{ - if ( SvtHelpOptions().IsHelpAgentAutoStartMode() ) - { - SfxHelpOptions_Impl *pOpt = pImp->GetOptions(); - if ( !pOpt->HasId( sHelpId ) ) - return; - - try - { - URL aURL; - aURL.Complete = CreateHelpURL_Impl( OStringToOUString(sHelpId, RTL_TEXTENCODING_UTF8), GetHelpModuleName_Impl() ); - Reference< XURLTransformer > xTrans( URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); - xTrans->parseStrict(aURL); - - Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); - Reference < XFrame > xCurrentFrame = xDesktop->getCurrentFrame(); - - Reference< XDispatchProvider > xDispProv( xCurrentFrame, UNO_QUERY ); - Reference< XDispatch > xHelpDispatch; - if ( xDispProv.is() ) - xHelpDispatch = xDispProv->queryDispatch( - aURL, OUString("_helpagent"), - FrameSearchFlag::PARENT | FrameSearchFlag::SELF ); - - DBG_ASSERT( xHelpDispatch.is(), "OpenHelpAgent: could not get a dispatcher!" ); - if ( xHelpDispatch.is() ) - xHelpDispatch->dispatch( aURL, Sequence< PropertyValue >() ); - } - catch (const Exception&) - { - SAL_WARN( "sfx2.appl", "OpenHelpAgent: caught an exception while executing the dispatch!" ); - } - } -} - OUString SfxHelp::GetDefaultHelpModule() { return getDefaultModule_Impl(); |