summaryrefslogtreecommitdiff
path: root/unotools/source/i18n/nativenumberwrapper.cxx
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@novell.com>2011-08-19 10:28:42 +0100
committerMichael Meeks <michael.meeks@novell.com>2011-08-19 12:27:18 +0100
commitd27d1489770666fe1d44f832882b67ac507033cd (patch)
treed0a32605a43b68ccd3b75d0ff35242b1ffaf0019 /unotools/source/i18n/nativenumberwrapper.cxx
parent1ee8a779c21e8d6f6a85a4e0bcefee227bff5a94 (diff)
remove legacy explicit library loading fallbacks, and clean
centralise cut/paste coding designed to explicitly load i18n and i18npool libraries if UNO is not bootstrapped. Instead fallback to the process service manager, and require this to be initialized, even for small tools.
Diffstat (limited to 'unotools/source/i18n/nativenumberwrapper.cxx')
-rw-r--r--unotools/source/i18n/nativenumberwrapper.cxx46
1 files changed, 4 insertions, 42 deletions
diff --git a/unotools/source/i18n/nativenumberwrapper.cxx b/unotools/source/i18n/nativenumberwrapper.cxx
index 71e74fd0c249..b1a8c8c7591b 100644
--- a/unotools/source/i18n/nativenumberwrapper.cxx
+++ b/unotools/source/i18n/nativenumberwrapper.cxx
@@ -31,57 +31,19 @@
#include <unotools/nativenumberwrapper.hxx>
#include <tools/debug.hxx>
-
-#include <comphelper/componentfactory.hxx>
-#include <com/sun/star/uno/XInterface.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
-#define LOCALEDATA_LIBRARYNAME "i18npool"
-#define LOCALEDATA_SERVICENAME "com.sun.star.i18n.NativeNumberSupplier"
+#include "instance.hxx"
using namespace ::com::sun::star;
-
NativeNumberWrapper::NativeNumberWrapper(
const uno::Reference< lang::XMultiServiceFactory > & xSF
)
:
xSMgr( xSF )
{
- if ( xSMgr.is() )
- {
- try
- {
- xNNS = uno::Reference< i18n::XNativeNumberSupplier > ( xSMgr->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( LOCALEDATA_SERVICENAME ) ) ),
- uno::UNO_QUERY );
- }
- catch ( uno::Exception& e )
- {
- (void)e;
- DBG_ERRORFILE( "NativeNumberWrapper ctor: Exception caught!" );
- }
- }
- else
- { // try to get an instance somehow
- DBG_ERRORFILE( "NativeNumberWrapper: no service manager, trying own" );
- try
- {
- uno::Reference< uno::XInterface > xI = ::comphelper::getComponentInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( LLCF_LIBNAME( LOCALEDATA_LIBRARYNAME ) ) ),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( LOCALEDATA_SERVICENAME ) ) );
- if ( xI.is() )
- {
- uno::Any x = xI->queryInterface( ::getCppuType((const uno::Reference< i18n::XNativeNumberSupplier >*)0) );
- x >>= xNNS;
- }
- }
- catch ( uno::Exception& e )
- {
- (void)e;
- DBG_ERRORFILE( "getComponentInstance: Exception caught!" );
- }
- }
+ xNNS = uno::Reference< i18n::XNativeNumberSupplier > (
+ intl_createInstance( xSMgr, "com.sun.star.i18n.NativeNumberSupplier",
+ "NativeNumberWrapper"), uno::UNO_QUERY );
DBG_ASSERT( xNNS.is(), "NativeNumberWrapper: no NativeNumberSupplier" );
}