diff options
author | Noel Grandin <noel@peralex.com> | 2012-10-30 14:02:56 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-10-31 15:31:36 +0100 |
commit | 0ac9a10d312dc8f12a74720ce211823ce4addf7b (patch) | |
tree | 2c812432eca9315170af8b5b6b7ae5bcbf828d5b /i18npool | |
parent | d27c92961b78da138d3563ab596cca416af9eb38 (diff) |
fdo#46808, Deprecate configuration::ConfigurationProvider old-style service
...in favor of existing new-style configuration::theDefaultProvider singleton.
Theoretically, ConfigurationProvider instances can be created with specific
Locale and EnableAsync arguments, but this is hardly used in practice, and thus
effectively all uses of the ConfigurationProvider service use the
theDefaultProvider instance, anyway.
theDefaultProvider is restricted to the XMultiServiceFactory interface, while
ConfigurationProvider also makes available XComponent. However, dispose must
not be called manually on theDefaultProvider singleton anyway, and calls to
add-/removeEventListener are so few (and in dubious code that should better be
cleaned up) that requiring an explicit queryInterface does not really hurt
there.
This commit originated as a patch by Noel Grandin to "Adapt
configuration::ConfigurationProvider UNO service to new style [by creating] a
merged XConfigurationProvider interface for this service to implement." It was
then modified by Stephan Bergmann by deprecating ConfigurationProvider instead
of adding XConfigurationProvider and by replacing calls to
ConfigurationProvider::create with calls to theDefaultProvider::get.
Change-Id: I9c16700afe0faff1ef6f20338a66bd7a9af990bd
Diffstat (limited to 'i18npool')
-rw-r--r-- | i18npool/inc/defaultnumberingprovider.hxx | 4 | ||||
-rw-r--r-- | i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx | 12 | ||||
-rw-r--r-- | i18npool/source/registerservices/registerservices.cxx | 2 |
3 files changed, 8 insertions, 10 deletions
diff --git a/i18npool/inc/defaultnumberingprovider.hxx b/i18npool/inc/defaultnumberingprovider.hxx index a67ac1e3e072..53f56e5158dd 100644 --- a/i18npool/inc/defaultnumberingprovider.hxx +++ b/i18npool/inc/defaultnumberingprovider.hxx @@ -45,7 +45,7 @@ class DefaultNumberingProvider : public cppu::WeakImplHelper4 void impl_loadTranslit(); public: DefaultNumberingProvider( - const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& xMSF ); + const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& rxContext ); ~DefaultNumberingProvider(); //XDefaultNumberingProvider @@ -85,7 +85,7 @@ public: virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( com::sun::star::uno::RuntimeException ); private: - com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xSMgr; + com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > m_xContext; com::sun::star::uno::Reference < com::sun::star::container::XHierarchicalNameAccess > xHierarchicalNameAccess; TransliterationImpl* translit; rtl::OUString SAL_CALL makeNumberingIdentifier( sal_Int16 index ) diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx index e0ef03abec16..66145ef6b944 100644 --- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx +++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx @@ -20,6 +20,7 @@ #include <defaultnumberingprovider.hxx> #include <com/sun/star/style/NumberingType.hpp> #include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/configuration/theDefaultProvider.hpp> #include <com/sun/star/text/HoriOrientation.hpp> #include <localedata.hxx> #include <nativenumbersupplier.hxx> @@ -259,7 +260,7 @@ static sal_Unicode table_PersianWord_decadeX[][8]={ }; -DefaultNumberingProvider::DefaultNumberingProvider( const Reference < XMultiServiceFactory >& xMSF ) : xSMgr(xMSF),translit(NULL) +DefaultNumberingProvider::DefaultNumberingProvider( const Reference < XComponentContext >& rxContext ) : m_xContext(rxContext),translit(NULL) { } @@ -272,7 +273,7 @@ DefaultNumberingProvider::~DefaultNumberingProvider() void DefaultNumberingProvider::impl_loadTranslit() { if ( !translit ) - translit = new TransliterationImpl(comphelper::getComponentContext(xSMgr)); + translit = new TransliterationImpl(m_xContext); } Sequence< Reference<container::XIndexAccess> > @@ -966,11 +967,8 @@ sal_Bool SAL_CALL DefaultNumberingProvider::isScriptFlagEnabled(const OUString& aName) throw(RuntimeException) { if (! xHierarchicalNameAccess.is()) { - Reference< XInterface > xInterface; - - xInterface = xSMgr->createInstance(OUString("com.sun.star.configuration.ConfigurationProvider")); Reference< XMultiServiceFactory > xConfigProvider = - Reference< XMultiServiceFactory >(xInterface, UNO_QUERY ); + configuration::theDefaultProvider::get(m_xContext); if (! xConfigProvider.is()) throw RuntimeException(); @@ -981,7 +979,7 @@ DefaultNumberingProvider::isScriptFlagEnabled(const OUString& aName) throw(Runti aPath.Value <<= OUString("/org.openoffice.Office.Common/I18N"), aArgs[0] <<= aPath; - xInterface = xConfigProvider->createInstanceWithArguments( + Reference<XInterface> xInterface = xConfigProvider->createInstanceWithArguments( OUString("com.sun.star.configuration.ConfigurationAccess"), aArgs); xHierarchicalNameAccess.set(xInterface, UNO_QUERY); diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx index 6345b916690a..c83702218c8c 100644 --- a/i18npool/source/registerservices/registerservices.cxx +++ b/i18npool/source/registerservices/registerservices.cxx @@ -130,7 +130,7 @@ using namespace ::com::sun::star::i18n; IMPL_CREATEINSTANCE_CTX( NumberFormatCodeMapper ) IMPL_CREATEINSTANCE( NativeNumberSupplier ) IMPL_CREATEINSTANCE( LocaleData ) -IMPL_CREATEINSTANCE_MSF( DefaultNumberingProvider ) +IMPL_CREATEINSTANCE_CTX( DefaultNumberingProvider ) IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier ) IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_asian ) IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_ja_phonetic_alphanumeric_first_by_syllable ) |