summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-11-05 11:28:43 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-11-15 08:28:44 +0100
commitd2f6a87ac7adb3f60f7eae7c5a8f8a9076b7a75c (patch)
tree0bcc19623fa6cda27b78df47c54192bd3e73ef41 /sw
parent5837402fb1daa437d9a1a37edc9ede57319944f1 (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 'sw')
-rw-r--r--sw/inc/breakit.hxx8
-rw-r--r--sw/source/core/bastyp/breakit.cxx16
-rw-r--r--sw/source/core/bastyp/calc.cxx8
-rw-r--r--sw/source/core/bastyp/init.cxx4
-rw-r--r--sw/source/core/doc/doc.cxx10
-rw-r--r--sw/source/core/doc/docsort.cxx3
-rw-r--r--sw/source/core/fields/docufld.cxx1
-rw-r--r--sw/source/core/fields/reffld.cxx4
-rw-r--r--sw/source/filter/ww8/ww8atr.cxx2
-rw-r--r--sw/source/filter/ww8/ww8scan.cxx2
10 files changed, 21 insertions, 37 deletions
diff --git a/sw/inc/breakit.hxx b/sw/inc/breakit.hxx
index 4ed10f99b0f8..1ce59f76b4b8 100644
--- a/sw/inc/breakit.hxx
+++ b/sw/inc/breakit.hxx
@@ -31,7 +31,7 @@
#include <boost/noncopyable.hpp>
#include <com/sun/star/uno/Reference.h>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/i18n/XBreakIterator.hpp>
#include <com/sun/star/i18n/XScriptTypeDetector.hpp>
#include <com/sun/star/i18n/ForbiddenCharacters.hpp>
@@ -45,7 +45,7 @@
class SW_DLLPUBLIC SwBreakIt : private ::boost::noncopyable
{
- com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xMSF;
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext;
mutable com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > xBreak;
com::sun::star::lang::Locale * m_pLocale;
@@ -61,13 +61,13 @@ class SW_DLLPUBLIC SwBreakIt : private ::boost::noncopyable
// private (see @ _Create, _Delete).
explicit SwBreakIt(
- const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rxMSF);
+ const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > & rxContext);
~SwBreakIt();
public:
// private (see @ source/core/bastyp/init.cxx).
static void _Create(
- const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rxMSF);
+ const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > & rxContext);
static void _Delete();
public:
diff --git a/sw/source/core/bastyp/breakit.cxx b/sw/source/core/bastyp/breakit.cxx
index 7ed2c5749ba6..b4c42753ef55 100644
--- a/sw/source/core/bastyp/breakit.cxx
+++ b/sw/source/core/bastyp/breakit.cxx
@@ -43,9 +43,9 @@ using namespace com::sun::star;
SwBreakIt* pBreakIt = 0;
-void SwBreakIt::_Create( const uno::Reference<lang::XMultiServiceFactory> & rxMSF )
+void SwBreakIt::_Create( const uno::Reference<uno::XComponentContext> & rxContext )
{
- delete pBreakIt, pBreakIt = new SwBreakIt( rxMSF );
+ delete pBreakIt, pBreakIt = new SwBreakIt( rxContext );
}
void SwBreakIt::_Delete()
@@ -58,14 +58,14 @@ SwBreakIt * SwBreakIt::Get()
return pBreakIt;
}
-SwBreakIt::SwBreakIt( const uno::Reference<lang::XMultiServiceFactory> & rxMSF )
- : m_xMSF( rxMSF ),
+SwBreakIt::SwBreakIt( const uno::Reference<uno::XComponentContext> & rxContext )
+ : m_xContext( rxContext ),
m_pLocale( NULL ),
m_pForbidden( NULL ),
aLast( LANGUAGE_DONTKNOW ),
aForbiddenLang( LANGUAGE_DONTKNOW )
{
- OSL_ENSURE( m_xMSF.is(), "SwBreakIt: no MultiServiceFactory" );
+ OSL_ENSURE( m_xContext.is(), "SwBreakIt: no MultiServiceFactory" );
}
SwBreakIt::~SwBreakIt()
@@ -76,8 +76,8 @@ SwBreakIt::~SwBreakIt()
void SwBreakIt::createBreakIterator() const
{
- if ( m_xMSF.is() && !xBreak.is() )
- xBreak.set( i18n::BreakIterator::create(comphelper::getComponentContext(m_xMSF)) );
+ if ( m_xContext.is() && !xBreak.is() )
+ xBreak.set( i18n::BreakIterator::create(m_xContext) );
}
void SwBreakIt::_GetLocale( const LanguageType aLang )
@@ -89,7 +89,7 @@ void SwBreakIt::_GetLocale( const LanguageType aLang )
void SwBreakIt::_GetForbidden( const LanguageType aLang )
{
- LocaleDataWrapper aWrap( m_xMSF, GetLocale( aLang ) );
+ LocaleDataWrapper aWrap( m_xContext, GetLocale( aLang ) );
aForbiddenLang = aLang;
delete m_pForbidden;
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index 434069dbe116..b484381ec38e 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -258,10 +258,8 @@ SwCalc::SwCalc( SwDoc& rD )
eLang != SvxLocaleToLanguage( pCharClass->getLocale() ) )
{
::com::sun::star::lang::Locale aLocale( SvxCreateLocale( eLang ));
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF(
- ::comphelper::getProcessServiceFactory() );
pCharClass = new CharClass( ::comphelper::getProcessComponentContext(), aLocale );
- pLclData = new LocaleDataWrapper( xMSF, aLocale );
+ pLclData = new LocaleDataWrapper( aLocale );
}
sCurrSym = comphelper::string::strip(pLclData->getCurrSymbol(), ' ');
@@ -1543,9 +1541,7 @@ bool SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
if (eLang !=
SvxLocaleToLanguage(aSysLocale.GetLocaleData().getLocale()))
{
- pLclD.reset( new LocaleDataWrapper(
- ::comphelper::getProcessServiceFactory(),
- SvxCreateLocale( eLang ) ) );
+ pLclD.reset( new LocaleDataWrapper( SvxCreateLocale( eLang ) ) );
}
}
diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx
index 117b7e02f3ef..ede0dbdb1f6f 100644
--- a/sw/source/core/bastyp/init.cxx
+++ b/sw/source/core/bastyp/init.cxx
@@ -701,9 +701,7 @@ void _InitCore()
for ( i = 38; i <= 136; ++i )
SwAttrPool::pVersionMap6[ i-1 ] = i + 3;
- uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
-
- SwBreakIt::_Create( xMSF );
+ SwBreakIt::_Create( ::comphelper::getProcessComponentContext() );
pCheckIt = NULL;
_FrmInit();
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index bfdfca27403c..26ba1a9d21ab 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -425,10 +425,7 @@ void SwDoc::setForbiddenCharacters(/*[in]*/ sal_uInt16 nLang,
{
if( !xForbiddenCharsTable.is() )
{
- uno::Reference<
- lang::XMultiServiceFactory > xMSF =
- ::comphelper::getProcessServiceFactory();
- xForbiddenCharsTable = new SvxForbiddenCharactersTable( xMSF );
+ xForbiddenCharsTable = new SvxForbiddenCharactersTable( ::comphelper::getProcessComponentContext() );
}
xForbiddenCharsTable->SetForbiddenCharacters( nLang, rFChars );
if( pDrawModel )
@@ -453,10 +450,7 @@ rtl::Reference<SvxForbiddenCharactersTable>& SwDoc::getForbiddenCharacterTable()
{
if( !xForbiddenCharsTable.is() )
{
- uno::Reference<
- lang::XMultiServiceFactory > xMSF =
- ::comphelper::getProcessServiceFactory();
- xForbiddenCharsTable = new SvxForbiddenCharactersTable( xMSF );
+ xForbiddenCharsTable = new SvxForbiddenCharactersTable( ::comphelper::getProcessComponentContext() );
}
return xForbiddenCharsTable;
}
diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx
index d028a30e9ff2..363594b42fa6 100644
--- a/sw/source/core/doc/docsort.cxx
+++ b/sw/source/core/doc/docsort.cxx
@@ -117,8 +117,7 @@ SwSortElement::~SwSortElement()
double SwSortElement::StrToDouble( const String& rStr ) const
{
if( !pLclData )
- pLclData = new LocaleDataWrapper(
- ::comphelper::getProcessServiceFactory(), *pLocale );
+ pLclData = new LocaleDataWrapper( *pLocale );
rtl_math_ConversionStatus eStatus;
sal_Int32 nEnd;
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index d3550fd200bf..c0c88e9c3225 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -895,7 +895,6 @@ static void lcl_GetLocalDataWrapper( sal_uLong nLang,
*ppLocalData = *ppAppLocalData;
if( nLang != SvxLocaleToLanguage( (*ppLocalData)->getLocale() ) )
*ppLocalData = new LocaleDataWrapper(
- ::comphelper::getProcessServiceFactory(),
SvxCreateLocale( static_cast<LanguageType>(nLang) ) );
}
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index 485a72411b5d..6690cead08fc 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -470,9 +470,7 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr )
if( !pFldTxtAttr || !pFldTxtAttr->GetpTxtNode() )
break;
- LocaleDataWrapper aLocaleData(
- ::comphelper::getProcessServiceFactory(),
- SvxCreateLocale( GetLanguage() ) );
+ LocaleDataWrapper aLocaleData( SvxCreateLocale( GetLanguage() ) );
// erstmal ein "Kurz" - Test - falls beide im selben
// Node stehen!
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index b4d08a89b97d..fe875092398d 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -2342,7 +2342,7 @@ bool MSWordExportBase::GetNumberFmt(const SwField& rFld, String& rStr)
if( pNumFmt )
{
sal_uInt16 nLng = rFld.GetLanguage();
- LocaleDataWrapper aLocDat(pNFmtr->GetServiceManager(),
+ LocaleDataWrapper aLocDat(comphelper::getComponentContext(pNFmtr->GetServiceManager()),
MsLangId::convertLanguageToLocale(nLng));
String sFmt(pNumFmt->GetMappedFormatstring(GetNfKeywordTable(),
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 8bb57ba606ec..f74bd1dc4702 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -5590,7 +5590,7 @@ WW8Fib::WW8Fib(sal_uInt8 nVer)
Locale aTempLocale;
SvxLanguageToLocale( aTempLocale, lid );
- LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), aTempLocale );
+ LocaleDataWrapper aLocaleWrapper( aTempLocale );
nNumDecimalSep = aLocaleWrapper.getNumDecimalSep()[0];
}