summaryrefslogtreecommitdiff
path: root/unotools/source/i18n/charclass.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/charclass.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/charclass.cxx')
-rw-r--r--unotools/source/i18n/charclass.cxx48
1 files changed, 4 insertions, 44 deletions
diff --git a/unotools/source/i18n/charclass.cxx b/unotools/source/i18n/charclass.cxx
index d4a9be17929a..a8343d98eec3 100644
--- a/unotools/source/i18n/charclass.cxx
+++ b/unotools/source/i18n/charclass.cxx
@@ -33,11 +33,8 @@
#include <tools/string.hxx>
#include <tools/debug.hxx>
-#include <comphelper/componentfactory.hxx>
-#include <com/sun/star/uno/XInterface.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include "instance.hxx"
-#define CHARCLASS_LIBRARYNAME "i18n"
#define CHARCLASS_SERVICENAME "com.sun.star.i18n.CharacterClassification"
using namespace ::com::sun::star;
@@ -53,23 +50,7 @@ CharClass::CharClass(
xSMgr( xSF )
{
setLocale( rLocale );
- if ( xSMgr.is() )
- {
- try
- {
- xCC = Reference< XCharacterClassification > ( xSMgr->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CHARCLASS_SERVICENAME ) ) ),
- uno::UNO_QUERY );
- }
- catch ( const Exception& )
- {
- DBG_ERRORFILE( "CharClass ctor: Exception caught!" );
- }
- }
- else
- { // try to get an instance somehow
- getComponentInstance();
- }
+ xCC = Reference< XCharacterClassification > ( intl_createInstance( xSMgr, CHARCLASS_SERVICENAME, "CharClass" ), uno::UNO_QUERY );
}
@@ -77,7 +58,8 @@ CharClass::CharClass(
const ::com::sun::star::lang::Locale& rLocale )
{
setLocale( rLocale );
- getComponentInstance();
+ Reference< lang::XMultiServiceFactory > xNil;
+ xCC = Reference< XCharacterClassification > ( intl_createInstance( xNil, CHARCLASS_SERVICENAME, "CharClass" ), uno::UNO_QUERY );
}
@@ -86,28 +68,6 @@ CharClass::~CharClass()
}
-void CharClass::getComponentInstance()
-{
- try
- {
- // CharClass may be needed by "small tools" like the Setup
- // => maybe no service manager => loadLibComponentFactory
- Reference < XInterface > xI = ::comphelper::getComponentInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( LLCF_LIBNAME( CHARCLASS_LIBRARYNAME ) ) ),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( CHARCLASS_SERVICENAME ) ) );
- if ( xI.is() )
- {
- Any x = xI->queryInterface( ::getCppuType((const Reference< XCharacterClassification >*)0) );
- x >>= xCC;
- }
- }
- catch ( const Exception& )
- {
- DBG_ERRORFILE( "getComponentInstance: Exception caught!" );
- }
-}
-
-
void CharClass::setLocale( const ::com::sun::star::lang::Locale& rLocale )
{
::osl::MutexGuard aGuard( aMutex );