diff options
author | Noel Grandin <noel@peralex.com> | 2012-11-05 11:28:43 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-11-15 08:28:44 +0100 |
commit | d2f6a87ac7adb3f60f7eae7c5a8f8a9076b7a75c (patch) | |
tree | 0bcc19623fa6cda27b78df47c54192bd3e73ef41 /unotools/source/i18n/numberformatcodewrapper.cxx | |
parent | 5837402fb1daa437d9a1a37edc9ede57319944f1 (diff) |
fdo#46808, use service constructor for i18n::NumberFormatMapper
Also create a utility constructor for LocaleDataWrapper, which
simplifies many of the calling sites.
Change-Id: Ic8510b51c4201fa17fc0620e18d3e258e43636ba
Diffstat (limited to 'unotools/source/i18n/numberformatcodewrapper.cxx')
-rw-r--r-- | unotools/source/i18n/numberformatcodewrapper.cxx | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/unotools/source/i18n/numberformatcodewrapper.cxx b/unotools/source/i18n/numberformatcodewrapper.cxx index 444ed5cbd2f7..6c7954f0595b 100644 --- a/unotools/source/i18n/numberformatcodewrapper.cxx +++ b/unotools/source/i18n/numberformatcodewrapper.cxx @@ -19,8 +19,8 @@ #include <unotools/numberformatcodewrapper.hxx> +#include <com/sun/star/i18n/NumberFormatMapper.hpp> #include <tools/debug.hxx> -#include "instance.hxx" using namespace ::com::sun::star; using namespace ::com::sun::star::i18n; @@ -28,17 +28,12 @@ using namespace ::com::sun::star::uno; NumberFormatCodeWrapper::NumberFormatCodeWrapper( - const Reference< lang::XMultiServiceFactory > & xSF, + const Reference< uno::XComponentContext > & rxContext, const lang::Locale& rLocale ) - : - xSMgr( xSF ) { setLocale( rLocale ); - xNFC = Reference< XNumberFormatCode > ( - intl_createInstance( xSMgr, "com.sun.star.i18n.NumberFormatMapper", - "NumberFormatCodeWrapper" ), uno::UNO_QUERY ); - DBG_ASSERT( xNFC.is(), "NumberFormatCodeWrapper: no NumberFormatMapper" ); + xNFC = i18n::NumberFormatMapper::create( rxContext ); } @@ -58,8 +53,7 @@ NumberFormatCodeWrapper::getFormatCode( sal_Int16 formatIndex ) const { try { - if ( xNFC.is() ) - return xNFC->getFormatCode( formatIndex, aLocale ); + return xNFC->getFormatCode( formatIndex, aLocale ); } catch ( const Exception& ) { @@ -74,8 +68,7 @@ NumberFormatCodeWrapper::getAllFormatCode( sal_Int16 formatUsage ) const { try { - if ( xNFC.is() ) - return xNFC->getAllFormatCode( formatUsage, aLocale ); + return xNFC->getAllFormatCode( formatUsage, aLocale ); } catch ( const Exception& ) { @@ -90,8 +83,7 @@ NumberFormatCodeWrapper::getAllFormatCodes() const { try { - if ( xNFC.is() ) - return xNFC->getAllFormatCodes( aLocale ); + return xNFC->getAllFormatCodes( aLocale ); } catch ( const Exception& ) { |