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 | |
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
-rw-r--r-- | filter/Library_xmlfa.mk | 3 | ||||
-rw-r--r-- | filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx | 6 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfilterjar.cxx | 25 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfilterjar.hxx | 1 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltersettingsdialog.cxx | 8 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltertabdialog.cxx | 2 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltertabpagexslt.cxx | 15 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltertabpagexslt.hxx | 2 | ||||
-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 |
15 files changed, 47 insertions, 100 deletions
diff --git a/filter/Library_xmlfa.mk b/filter/Library_xmlfa.mk index fe1dfae81440..0f6cddcfd385 100644 --- a/filter/Library_xmlfa.mk +++ b/filter/Library_xmlfa.mk @@ -26,11 +26,12 @@ $(eval $(call gb_Library_use_external,xmlfa,boost_headers)) $(eval $(call gb_Library_use_sdk_api,xmlfa)) $(eval $(call gb_Library_use_libraries,xmlfa,\ - tl \ comphelper \ cppuhelper \ cppu \ sal \ + tl \ + utl \ $(gb_UWINAPI) \ )) diff --git a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx index 19dfbb1f620b..bba852d2d94e 100644 --- a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx +++ b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx @@ -49,6 +49,7 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <comphelper/genericpropertyset.hxx> #include <comphelper/propertysetinfo.hxx> +#include <unotools/pathoptions.hxx> using namespace comphelper; using namespace com::sun::star::uno; @@ -160,9 +161,8 @@ sal_Bool SAL_CALL XmlFilterAdaptor::importImpl( const Sequence< ::com::sun::star //Load the Styles from the Template URL Supplied in the TypeDetection file if(msTemplateName.indexOf(OUString( "file:" ))==-1) { - Reference< XConfigManager >xCfgMgr ( mxContext->getServiceManager()->createInstanceWithContext( - "com.sun.star.config.SpecialConfigManager", mxContext ), UNO_QUERY ); - OUString PathString(xCfgMgr->substituteVariables(OUString("$(progurl)"))); + SvtPathOptions aOptions; + OUString PathString = aOptions.SubstituteVariable(OUString("$(progurl)")); PathString = PathString.concat(OUString( "/" )); msTemplateName=PathString.concat(msTemplateName); } diff --git a/filter/source/xsltdialog/xmlfilterjar.cxx b/filter/source/xsltdialog/xmlfilterjar.cxx index a0c6159d09de..0e0dd4cbbde5 100644 --- a/filter/source/xsltdialog/xmlfilterjar.cxx +++ b/filter/source/xsltdialog/xmlfilterjar.cxx @@ -32,12 +32,13 @@ #include <comphelper/processfactory.hxx> #include <comphelper/oslfile2streamwrap.hxx> #include <comphelper/storagehelper.hxx> +#include <osl/file.hxx> +#include <unotools/pathoptions.hxx> #include <unotools/streamwrap.hxx> -#include <tools/stream.hxx> -#include <tools/urlobj.hxx> #include <unotools/tempfile.hxx> #include <svl/urihelper.hxx> -#include <osl/file.hxx> +#include <tools/stream.hxx> +#include <tools/urlobj.hxx> #include <rtl/uri.hxx> @@ -65,23 +66,13 @@ XMLFilterJarHelper::XMLFilterJarHelper( const Reference< XComponentContext >& rx sVndSunStarPackage( "vnd.sun.star.Package:" ), sXSLTPath( "$(user)/xslt/" ), sTemplatePath( "$(user)/template/" ), - sSpecialConfigManager( "com.sun.star.config.SpecialConfigManager" ), sPump( "com.sun.star.io.Pump" ), sProgPath( "$(prog)/" ) { - try - { - Reference< XConfigManager > xCfgMgr( rxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.config.SpecialConfigManager", rxContext ), UNO_QUERY ); - if( xCfgMgr.is() ) - { - sProgPath = xCfgMgr->substituteVariables( sProgPath ); - sXSLTPath = xCfgMgr->substituteVariables( sXSLTPath ); - sTemplatePath = xCfgMgr->substituteVariables( sTemplatePath ); - } - } - catch(const Exception&) - { - } + SvtPathOptions aOptions; + sProgPath = aOptions.SubstituteVariable( sProgPath ); + sXSLTPath = aOptions.SubstituteVariable( sXSLTPath ); + sTemplatePath = aOptions.SubstituteVariable( sTemplatePath ); } static OUString encodeZipUri( const OUString& rURI ) diff --git a/filter/source/xsltdialog/xmlfilterjar.hxx b/filter/source/xsltdialog/xmlfilterjar.hxx index 6681e186684a..7179f9d4e910 100644 --- a/filter/source/xsltdialog/xmlfilterjar.hxx +++ b/filter/source/xsltdialog/xmlfilterjar.hxx @@ -48,7 +48,6 @@ private: OUString sVndSunStarPackage; OUString sXSLTPath; OUString sTemplatePath; - OUString sSpecialConfigManager; OUString sPump; OUString sProgPath; }; diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx index cad9278be875..4f4469a4e045 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx @@ -27,6 +27,7 @@ #include <tools/urlobj.hxx> #include <svtools/headbar.hxx> #include <unotools/streamwrap.hxx> +#include <unotools/pathoptions.hxx> #include <osl/file.hxx> #include <vcl/msgbox.hxx> #include <sfx2/filedlghelper.hxx> @@ -93,11 +94,8 @@ XMLFilterSettingsDialog::XMLFilterSettingsDialog(Window* pParent, mxTypeDetection = Reference< XNameContainer >::query( rxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.document.TypeDetection", rxContext ) ); mxExtendedTypeDetection = Reference< XNameContainer >::query( rxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.document.ExtendedTypeDetectionFactory", rxContext ) ); - Reference< XConfigManager > xCfgMgr( rxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.config.SpecialConfigManager", rxContext ), UNO_QUERY ); - if( xCfgMgr.is() ) - { - m_sTemplatePath = xCfgMgr->substituteVariables( m_sTemplatePath ); - } + SvtPathOptions aOptions; + m_sTemplatePath = aOptions.SubstituteVariable( m_sTemplatePath ); } catch(const Exception&) { diff --git a/filter/source/xsltdialog/xmlfiltertabdialog.cxx b/filter/source/xsltdialog/xmlfiltertabdialog.cxx index 6ed8e501433e..b7abdc7f929d 100644 --- a/filter/source/xsltdialog/xmlfiltertabdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertabdialog.cxx @@ -82,7 +82,7 @@ XMLFilterTabDialog::XMLFilterTabDialog( Window *pParent, ResMgr& rResMgr, const aCtrlSiz = aSiz; } - mpXSLTPage = new XMLFilterTabPageXSLT( &maTabCtrl, mrResMgr, mxContext ); + mpXSLTPage = new XMLFilterTabPageXSLT( &maTabCtrl, mrResMgr ); mpXSLTPage->SetInfo( mpNewInfo ); maTabCtrl.SetTabPage( RID_XML_FILTER_TABPAGE_XSLT, mpXSLTPage ); diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx index 04bc14139ef2..87e699470354 100644 --- a/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx +++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.cxx @@ -22,6 +22,7 @@ #include "com/sun/star/ui/dialogs/TemplateDescription.hpp" #include <sfx2/filedlghelper.hxx> #include <unotools/localfilehelper.hxx> +#include <unotools/pathoptions.hxx> #include <osl/file.hxx> #include <svl/urihelper.hxx> @@ -35,7 +36,7 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::frame; using namespace ::com::sun::star::lang; -XMLFilterTabPageXSLT::XMLFilterTabPageXSLT( Window* pParent, ResMgr& rResMgr, const css::uno::Reference< XComponentContext >& rxContext ) : +XMLFilterTabPageXSLT::XMLFilterTabPageXSLT( Window* pParent, ResMgr& rResMgr ) : TabPage( pParent, ResId( RID_XML_FILTER_TABPAGE_XSLT, rResMgr ) ), maFTDocType( this, ResId( FT_XML_DOCTYPE, rResMgr ) ), @@ -64,16 +65,8 @@ XMLFilterTabPageXSLT::XMLFilterTabPageXSLT( Window* pParent, ResMgr& rResMgr, co { FreeResource(); - try - { - css::uno::Reference< XConfigManager > xCfgMgr( rxContext->getServiceManager()->createInstanceWithContext( "com.sun.star.config.SpecialConfigManager", rxContext ), UNO_QUERY ); - if( xCfgMgr.is() ) - sInstPath = xCfgMgr->substituteVariables( sInstPath ); - } - catch(const Exception&) - { - OSL_FAIL( "XMLFilterTabPageXSLT::XMLFilterTabPageXSLT exception catched!" ); - } + SvtPathOptions aOptions; + sInstPath = aOptions.SubstituteVariable( sInstPath ); maPBExprotXSLT.SetClickHdl( LINK ( this, XMLFilterTabPageXSLT, ClickBrowseHdl_Impl ) ); maPBImportXSLT.SetClickHdl( LINK ( this, XMLFilterTabPageXSLT, ClickBrowseHdl_Impl ) ); diff --git a/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx b/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx index 57e1b19028e3..6e71a42053cc 100644 --- a/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx +++ b/filter/source/xsltdialog/xmlfiltertabpagexslt.hxx @@ -33,7 +33,7 @@ class filter_info_impl; class XMLFilterTabPageXSLT : public TabPage { public: - XMLFilterTabPageXSLT( Window* pParent, ResMgr& rResMgr, const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext ); + XMLFilterTabPageXSLT( Window* pParent, ResMgr& rResMgr ); virtual ~XMLFilterTabPageXSLT(); bool FillInfo( filter_info_impl* pInfo ); 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); |