summaryrefslogtreecommitdiff
path: root/unotools/source
diff options
context:
space:
mode:
Diffstat (limited to 'unotools/source')
-rw-r--r--unotools/source/i18n/intlwrapper.cxx3
-rw-r--r--unotools/source/i18n/localedatawrapper.cxx23
-rw-r--r--unotools/source/i18n/numberformatcodewrapper.cxx20
-rw-r--r--unotools/source/misc/syslocale.cxx2
4 files changed, 26 insertions, 22 deletions
diff --git a/unotools/source/i18n/intlwrapper.cxx b/unotools/source/i18n/intlwrapper.cxx
index f68f4ea803cb..092c90bb07fd 100644
--- a/unotools/source/i18n/intlwrapper.cxx
+++ b/unotools/source/i18n/intlwrapper.cxx
@@ -21,6 +21,7 @@
#include "unotools/intlwrapper.hxx"
#include <com/sun/star/i18n/CollatorOptions.hpp>
#include <i18npool/mslangid.hxx>
+#include <comphelper/processfactory.hxx>
IntlWrapper::IntlWrapper(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xSF,
@@ -60,7 +61,7 @@ IntlWrapper::~IntlWrapper()
void IntlWrapper::ImplNewLocaleData() const
{
- ((IntlWrapper*)this)->pLocaleData = new LocaleDataWrapper( xSMgr, aLocale );
+ ((IntlWrapper*)this)->pLocaleData = new LocaleDataWrapper( comphelper::getComponentContext(xSMgr), aLocale );
}
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index bdeb2d661471..e224f194a179 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -66,18 +66,29 @@ namespace
sal_uInt8 LocaleDataWrapper::nLocaleDataChecking = 0;
LocaleDataWrapper::LocaleDataWrapper(
- const Reference< lang::XMultiServiceFactory > & xSF,
+ const Reference< uno::XComponentContext > & rxContext,
const lang::Locale& rLocale
)
:
- xSMgr( xSF ),
- xLD( LocaleData::create(comphelper::getComponentContext(xSMgr)) ),
+ m_xContext( rxContext ),
+ xLD( LocaleData::create(rxContext) ),
bLocaleDataItemValid( sal_False ),
bReservedWordValid( sal_False )
{
setLocale( rLocale );
}
+LocaleDataWrapper::LocaleDataWrapper(
+ const lang::Locale& rLocale
+ )
+ :
+ m_xContext( comphelper::getProcessComponentContext() ),
+ xLD( LocaleData::create(m_xContext) ),
+ bLocaleDataItemValid( sal_False ),
+ bReservedWordValid( sal_False )
+{
+ setLocale( rLocale );
+}
LocaleDataWrapper::~LocaleDataWrapper()
{
@@ -240,7 +251,7 @@ void LocaleDataWrapper::invalidateData()
if ( !rInstalledLocales.getLength() )
{
- LocaleDataWrapper aLDW( ::comphelper::getProcessServiceFactory(), lang::Locale() );
+ LocaleDataWrapper aLDW( ::comphelper::getProcessComponentContext(), lang::Locale() );
aLDW.getAllInstalledLocaleNames();
}
return rInstalledLocales;
@@ -698,7 +709,7 @@ void LocaleDataWrapper::scanCurrFormatImpl( const rtl::OUString& rCode,
void LocaleDataWrapper::getCurrFormatsImpl()
{
- NumberFormatCodeWrapper aNumberFormatCode( xSMgr, getLocale() );
+ NumberFormatCodeWrapper aNumberFormatCode( m_xContext, getLocale() );
uno::Sequence< NumberFormatCode > aFormatSeq
= aNumberFormatCode.getAllFormatCode( KNumberFormatUsage::CURRENCY );
sal_Int32 nCnt = aFormatSeq.getLength();
@@ -955,7 +966,7 @@ DateFormat LocaleDataWrapper::scanDateFormatImpl( const rtl::OUString& rCode )
void LocaleDataWrapper::getDateFormatsImpl()
{
- NumberFormatCodeWrapper aNumberFormatCode( xSMgr, getLocale() );
+ NumberFormatCodeWrapper aNumberFormatCode( m_xContext, getLocale() );
uno::Sequence< NumberFormatCode > aFormatSeq
= aNumberFormatCode.getAllFormatCode( KNumberFormatUsage::DATE );
sal_Int32 nCnt = aFormatSeq.getLength();
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& )
{
diff --git a/unotools/source/misc/syslocale.cxx b/unotools/source/misc/syslocale.cxx
index 43950737e4b5..a769e8ba4593 100644
--- a/unotools/source/misc/syslocale.cxx
+++ b/unotools/source/misc/syslocale.cxx
@@ -57,7 +57,7 @@ private:
SvtSysLocale_Impl::SvtSysLocale_Impl() : pCharClass(NULL)
{
- pLocaleData = new LocaleDataWrapper( ::comphelper::getProcessServiceFactory(), aSysLocaleOptions.GetRealLocale() );
+ pLocaleData = new LocaleDataWrapper( aSysLocaleOptions.GetRealLocale() );
setDateAcceptancePatternsConfig();
// listen for further changes