diff options
author | Noel Grandin <noel@peralex.com> | 2013-06-05 10:35:22 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-06-05 14:48:19 +0200 |
commit | 27c6434fccfec5fb4184c1efa2057595c8716fad (patch) | |
tree | c0c65b6653853b345d066324a5e847daa1347fa8 /xmlhelp | |
parent | b83edcf00d4ccd0c734731ed66d167286bf89d6b (diff) |
fdo#46808, Replace usage of SpecialConfigManager
with usage of the underlying SvtPathOptions. The service is just
a thing wrapper that serves no real purpose.
Change-Id: Id762edf71ba0f699ef091261905c88c2d93e1c12
Diffstat (limited to 'xmlhelp')
-rw-r--r-- | xmlhelp/Library_tvhlp1.mk | 1 | ||||
-rw-r--r-- | xmlhelp/Library_ucpchelp1.mk | 1 | ||||
-rw-r--r-- | xmlhelp/source/cxxhelp/provider/provider.cxx | 24 | ||||
-rw-r--r-- | xmlhelp/source/treeview/tvfactory.cxx | 9 | ||||
-rw-r--r-- | xmlhelp/source/treeview/tvfactory.hxx | 4 | ||||
-rw-r--r-- | xmlhelp/source/treeview/tvread.cxx | 38 | ||||
-rw-r--r-- | xmlhelp/source/treeview/tvread.hxx | 8 |
7 files changed, 25 insertions, 60 deletions
diff --git a/xmlhelp/Library_tvhlp1.mk b/xmlhelp/Library_tvhlp1.mk index 58487dd61158..9ef9f20f801c 100644 --- a/xmlhelp/Library_tvhlp1.mk +++ b/xmlhelp/Library_tvhlp1.mk @@ -23,6 +23,7 @@ $(eval $(call gb_Library_use_libraries,tvhlp1,\ cppu \ cppuhelper \ sal \ + tl \ utl \ i18nlangtag \ )) diff --git a/xmlhelp/Library_ucpchelp1.mk b/xmlhelp/Library_ucpchelp1.mk index f559cb1f5360..0c4aab98a9b8 100644 --- a/xmlhelp/Library_ucpchelp1.mk +++ b/xmlhelp/Library_ucpchelp1.mk @@ -51,6 +51,7 @@ $(eval $(call gb_Library_use_libraries,ucpchelp1,\ cppuhelper \ helplinker \ sal \ + tl \ ucbhelper \ utl \ i18nlangtag \ diff --git a/xmlhelp/source/cxxhelp/provider/provider.cxx b/xmlhelp/source/cxxhelp/provider/provider.cxx index e2ee1dbe6b39..057e30b2f72f 100644 --- a/xmlhelp/source/cxxhelp/provider/provider.cxx +++ b/xmlhelp/source/cxxhelp/provider/provider.cxx @@ -38,6 +38,7 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <comphelper/processfactory.hxx> #include <unotools/configmgr.hxx> +#include <unotools/pathoptions.hxx> #include <rtl/bootstrap.hxx> #include "databases.hxx" @@ -442,27 +443,8 @@ ContentProvider::getBooleanKey( void ContentProvider::subst( OUString& instpath ) const { - uno::Reference< frame::XConfigManager > xCfgMgr; - if( m_xContext.is() ) - { - try - { - xCfgMgr = - uno::Reference< frame::XConfigManager >( - m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.config.SpecialConfigManager", m_xContext), - uno::UNO_QUERY ); - } - catch( const uno::Exception&) - { - OSL_ENSURE( xCfgMgr.is(), - "cant instantiate the special config manager " ); - } - } - - OSL_ENSURE( xCfgMgr.is(), "specialconfigmanager not found\n" ); - - if( xCfgMgr.is() ) - instpath = xCfgMgr->substituteVariables( instpath ); + SvtPathOptions aOptions; + instpath = aOptions.SubstituteVariable( instpath ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlhelp/source/treeview/tvfactory.cxx b/xmlhelp/source/treeview/tvfactory.cxx index 02b0a237f005..5cee589c8cac 100644 --- a/xmlhelp/source/treeview/tvfactory.cxx +++ b/xmlhelp/source/treeview/tvfactory.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/container/XHierarchicalNameAccess.hpp> #include <com/sun/star/beans/PropertyValue.hpp> +#include <comphelper/processfactory.hxx> #include "tvfactory.hxx" #include "tvread.hxx" @@ -34,8 +35,8 @@ using namespace com::sun::star::container; -TVFactory::TVFactory( const uno::Reference< XMultiServiceFactory >& xMSF ) - : m_xMSF( xMSF ) +TVFactory::TVFactory( const uno::Reference< XComponentContext >& xContext ) + : m_xContext( xContext ) { } @@ -157,7 +158,7 @@ TVFactory::createInstanceWithArguments( if( ! m_xHDS.is() ) { - cppu::OWeakObject* p = new TVChildTarget( m_xMSF ); + cppu::OWeakObject* p = new TVChildTarget( m_xContext ); m_xHDS = Reference< XInterface >( p ); } @@ -241,7 +242,7 @@ Reference< XInterface > SAL_CALL TVFactory::CreateInstance( const Reference< XMultiServiceFactory >& xMultiServiceFactory ) { - XServiceInfo* xP = (XServiceInfo*) new TVFactory( xMultiServiceFactory ); + XServiceInfo* xP = (XServiceInfo*) new TVFactory( comphelper::getComponentContext(xMultiServiceFactory) ); return Reference< XInterface >::query( xP ); } diff --git a/xmlhelp/source/treeview/tvfactory.hxx b/xmlhelp/source/treeview/tvfactory.hxx index 30c6c7ff2af5..da765330f80c 100644 --- a/xmlhelp/source/treeview/tvfactory.hxx +++ b/xmlhelp/source/treeview/tvfactory.hxx @@ -41,7 +41,7 @@ namespace treeview { { public: - TVFactory( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xMSF ); + TVFactory( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& xContext ); ~TVFactory(); @@ -120,7 +120,7 @@ namespace treeview { private: // Members - com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xMSF; + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext; com::sun::star::uno::Reference< com::sun::star::uno::XInterface > m_xHDS; }; diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx index 83ebfd7ca012..8a2d494d4cbe 100644 --- a/xmlhelp/source/treeview/tvread.cxx +++ b/xmlhelp/source/treeview/tvread.cxx @@ -36,6 +36,7 @@ #include <com/sun/star/uri/XVndSunStarExpandUrl.hpp> #include <i18nlangtag/languagetag.hxx> #include <comphelper/string.hxx> +#include <unotools/pathoptions.hxx> namespace treeview { @@ -492,9 +493,9 @@ TVChildTarget::TVChildTarget( const ConfigData& configData,TVDom* tvDom ) Elements[i] = new TVRead( configData,tvDom->children[i] ); } -TVChildTarget::TVChildTarget( const Reference< XMultiServiceFactory >& xMSF ) +TVChildTarget::TVChildTarget( const Reference< XComponentContext >& xContext ) { - ConfigData configData = init( xMSF ); + ConfigData configData = init( xContext ); if( configData.locale.isEmpty() || configData.system.isEmpty() ) return; @@ -710,10 +711,10 @@ TVChildTarget::hasByHierarchicalName( const OUString& aName ) -ConfigData TVChildTarget::init( const Reference< XMultiServiceFactory >& xSMgr ) +ConfigData TVChildTarget::init( const Reference< XComponentContext >& xContext ) { ConfigData configData; - Reference< XMultiServiceFactory > sProvider( getConfiguration(comphelper::getComponentContext(xSMgr)) ); + Reference< XMultiServiceFactory > sProvider( getConfiguration(xContext) ); /**********************************************************************/ /* reading Office.Common */ @@ -729,7 +730,7 @@ ConfigData TVChildTarget::init( const Reference< XMultiServiceFactory >& xSMgr ) instPath = OUString( "$(instpath)/help" ); // replace anything like $(instpath); - subst( xSMgr,instPath ); + subst( instPath ); /**********************************************************************/ /* reading setup */ @@ -743,7 +744,7 @@ ConfigData TVChildTarget::init( const Reference< XMultiServiceFactory >& xSMgr ) try { - Reference< lang::XMultiServiceFactory > xConfigProvider = theDefaultProvider::get( comphelper::getComponentContext(xSMgr) ); + Reference< lang::XMultiServiceFactory > xConfigProvider = theDefaultProvider::get( xContext ); uno::Sequence < uno::Any > lParams(1); beans::PropertyValue aParam ; @@ -978,29 +979,10 @@ TVChildTarget::getBooleanKey(const Reference< } -void TVChildTarget::subst( const Reference< XMultiServiceFactory >& m_xSMgr, - OUString& instpath ) const +void TVChildTarget::subst( OUString& instpath ) const { - Reference< XConfigManager > xCfgMgr; - if( m_xSMgr.is() ) - { - try - { - xCfgMgr = - Reference< XConfigManager >( - m_xSMgr->createInstance( OUString( "com.sun.star.config.SpecialConfigManager" ) ), - UNO_QUERY ); - } - catch( const com::sun::star::uno::Exception& ) - { - OSL_ENSURE( xCfgMgr.is()," cant instantiate the special config manager " ); - } - } - - OSL_ENSURE( xCfgMgr.is(), "specialconfigmanager not found\n" ); - - if( xCfgMgr.is() ) - instpath = xCfgMgr->substituteVariables( instpath ); + SvtPathOptions aOptions; + instpath = aOptions.SubstituteVariable( instpath ); } diff --git a/xmlhelp/source/treeview/tvread.hxx b/xmlhelp/source/treeview/tvread.hxx index 1a9649b8edb0..0b2eb6eeb5dd 100644 --- a/xmlhelp/source/treeview/tvread.hxx +++ b/xmlhelp/source/treeview/tvread.hxx @@ -252,7 +252,7 @@ namespace treeview { TVChildTarget( const ConfigData& configData,TVDom* tvDom ); - TVChildTarget( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xMSF ); + TVChildTarget( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& xContext ); ~TVChildTarget(); @@ -287,7 +287,7 @@ namespace treeview { std::vector< rtl::Reference< TVRead > > Elements; ConfigData init( - const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xMSF ); + const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& xContext ); ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getConfiguration( @@ -306,9 +306,7 @@ namespace treeview { const ::com::sun::star::uno::Reference< ::com::sun::star::container::XHierarchicalNameAccess >& xHierAccess, const char* key) const; - void subst( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSgr, - OUString& instpath ) const; + void subst( OUString& instpath ) const; bool SearchAndInsert(TVDom* p, TVDom* tvDom); |