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
This commit is contained in:
Noel Grandin 2012-11-05 11:28:43 +02:00 committed by Stephan Bergmann
parent 5837402fb1
commit d2f6a87ac7
56 changed files with 155 additions and 164 deletions

View File

@ -30,6 +30,9 @@
class SfxBindings;
class SdrView;
class SfxViewShell;
namespace com { namespace sun { namespace star { namespace lang {
class XMultiServiceFactory;
}}}}
namespace basctl
{

View File

@ -124,7 +124,7 @@ SvxPostItDialog::SvxPostItDialog( Window* pParent,
}
else
{
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
LocaleDataWrapper aLocaleWrapper( Application::GetSettings().GetLocale() );
aDateStr = aLocaleWrapper.getDate( Date( Date::SYSTEM ) );
}
@ -212,7 +212,7 @@ IMPL_LINK_NOARG(SvxPostItDialog, Stamp)
Date aDate( Date::SYSTEM );
Time aTime( Time::SYSTEM );
String aTmp( SvtUserOptions().GetID() );
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
LocaleDataWrapper aLocaleWrapper( Application::GetSettings().GetLocale() );
String aStr( aEditED.GetText() );
aStr.AppendAscii( RTL_CONSTASCII_STRINGPARAM( "\n---- " ) );
@ -239,7 +239,7 @@ IMPL_LINK_NOARG(SvxPostItDialog, Stamp)
IMPL_LINK_NOARG(SvxPostItDialog, OKHdl)
{
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
LocaleDataWrapper aLocaleWrapper( Application::GetSettings().GetLocale() );
pOutSet = new SfxItemSet( rSet );
pOutSet->Put( SvxPostItAuthorItem( SvtUserOptions().GetID(),
rSet.GetPool()->GetWhich( SID_ATTR_POSTIT_AUTHOR ) ) );

View File

@ -349,8 +349,7 @@ IMPL_LINK_NOARG(SvxAsianLayoutPage, LanguageHdl)
}
if(!bAvail)
{
Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
LocaleDataWrapper aWrap( xMSF, aLocale );
LocaleDataWrapper aWrap( aLocale );
ForbiddenCharacters aForbidden = aWrap.getForbiddenCharacters();
sStart = aForbidden.beginLine;
sEnd = aForbidden.endLine;

View File

@ -1697,7 +1697,7 @@ void OfaLanguagesTabPage::Reset( const SfxItemSet& rSet )
{
Locale aTempLocale;
SvxLanguageToLocale( aTempLocale, Application::GetSettings().GetLanguage());
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), aTempLocale );
LocaleDataWrapper aLocaleWrapper( aTempLocale );
aDatePatternsString = lcl_getDatePatternsConfigString( aLocaleWrapper);
}
aDatePatternsED.SetText( aDatePatternsString);
@ -1894,7 +1894,7 @@ IMPL_LINK( OfaLanguagesTabPage, LocaleSettingHdl, SvxLanguageBox*, pBox )
// obtain corresponding locale data
Locale aTempLocale;
SvxLanguageToLocale( aTempLocale, eLang );
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), aTempLocale );
LocaleDataWrapper aLocaleWrapper( aTempLocale );
// update the decimal separator key of the related CheckBox
String sTempLabel(sDecimalSeparatorLabel);

View File

@ -186,7 +186,7 @@ SvxTabulatorTabPage::SvxTabulatorTabPage( Window* pParent,
aFillChar.SetAccessibleRelationLabeledBy(&aFillSpecial);
// Get the default decimal char from the system
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
LocaleDataWrapper aLocaleWrapper( Application::GetSettings().GetLocale() );
aAktTab.GetDecimal() = aLocaleWrapper.getNumDecimalSep()[0];
FreeResource();
}

View File

@ -29,8 +29,8 @@
namespace com {
namespace sun {
namespace star {
namespace lang {
class XMultiServiceFactory;
namespace uno {
class XComponentContext;
}}}}
class EDITENG_DLLPUBLIC SvxForbiddenCharactersTable : public salhelper::SimpleReferenceObject
@ -39,10 +39,10 @@ public:
typedef std::map<sal_uInt16, com::sun::star::i18n::ForbiddenCharacters> Map;
private:
Map maMap;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
public:
SvxForbiddenCharactersTable( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF);
SvxForbiddenCharactersTable( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext);
~SvxForbiddenCharactersTable() {}
Map& GetMap() { return maMap; }

View File

@ -1365,12 +1365,12 @@ sal_Bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditVie
lang::Locale aLocale( MsLangId::convertLanguageToLocale( eLang));
if (!pImpEditEngine->xLocaleDataWrapper.isInitialized())
pImpEditEngine->xLocaleDataWrapper.init( SvtSysLocale().GetLocaleData().getServiceFactory(), aLocale, eLang);
pImpEditEngine->xLocaleDataWrapper.init( SvtSysLocale().GetLocaleData().getComponentContext(), aLocale, eLang);
else
pImpEditEngine->xLocaleDataWrapper.changeLocale( aLocale, eLang);
if (!pImpEditEngine->xTransliterationWrapper.isInitialized())
pImpEditEngine->xTransliterationWrapper.init( SvtSysLocale().GetLocaleData().getServiceFactory(), eLang, i18n::TransliterationModules_IGNORE_CASE);
pImpEditEngine->xTransliterationWrapper.init( SvtSysLocale().GetLocaleData().getComponentContext(), eLang, i18n::TransliterationModules_IGNORE_CASE);
else
pImpEditEngine->xTransliterationWrapper.changeLocale( eLang);

View File

@ -172,8 +172,7 @@ rtl::Reference<SvxForbiddenCharactersTable> GlobalEditData::GetForbiddenCharsTab
{
if ( !xForbiddenCharsTable.is() )
{
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
xForbiddenCharsTable = new SvxForbiddenCharactersTable( xMSF );
xForbiddenCharsTable = new SvxForbiddenCharactersTable( ::comphelper::getProcessComponentContext() );
}
return xForbiddenCharsTable;
}

View File

@ -25,9 +25,9 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
SvxForbiddenCharactersTable::SvxForbiddenCharactersTable( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xMSF)
SvxForbiddenCharactersTable::SvxForbiddenCharactersTable( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext)
{
mxMSF = xMSF;
m_xContext = rxContext;
}
const com::sun::star::i18n::ForbiddenCharacters* SvxForbiddenCharactersTable::GetForbiddenCharacters( sal_uInt16 nLanguage, sal_Bool bGetDefault )
@ -36,9 +36,9 @@ const com::sun::star::i18n::ForbiddenCharacters* SvxForbiddenCharactersTable::Ge
Map::iterator it = maMap.find( nLanguage );
if ( it != maMap.end() )
pForbiddenCharacters = &(it->second);
else if ( bGetDefault && mxMSF.is() )
else if ( bGetDefault && m_xContext.is() )
{
LocaleDataWrapper aWrapper( mxMSF, SvxCreateLocale( nLanguage ) );
LocaleDataWrapper aWrapper( m_xContext, SvxCreateLocale( nLanguage ) );
maMap[ nLanguage ] = aWrapper.getForbiddenCharacters();
pForbiddenCharacters = &maMap[ nLanguage ];
}

View File

@ -202,8 +202,7 @@ static sal_uInt16 GetAppLang()
}
static LocaleDataWrapper& GetLocaleDataWrapper( sal_uInt16 nLang )
{
static LocaleDataWrapper aLclDtWrp( GetProcessFact(),
SvxCreateLocale( GetAppLang() ) );
static LocaleDataWrapper aLclDtWrp( SvxCreateLocale( GetAppLang() ) );
::com::sun::star::lang::Locale aLcl( SvxCreateLocale( nLang ));
const ::com::sun::star::lang::Locale& rLcl = aLclDtWrp.getLoadedLocale();
if( aLcl.Language != rLcl.Language ||

View File

@ -78,7 +78,6 @@ osl::Mutex & GetLinguMutex()
LocaleDataWrapper & GetLocaleDataWrapper( sal_Int16 nLang )
{
static LocaleDataWrapper aLclDtaWrp(
comphelper::getProcessServiceFactory(),
CreateLocale( SvtSysLocale().GetUILanguage() ) );
const Locale &rLcl = aLclDtaWrp.getLoadedLocale();

View File

@ -147,6 +147,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/i18n,\
CharacterClassification \
LocaleCalendar \
LocaleData \
NumberFormatMapper \
TextConversion \
Transliteration \
))
@ -861,7 +862,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/i18n,\
IndexEntrySupplier \
InputSequenceChecker \
NativeNumberSupplier \
NumberFormatMapper \
OrdinalSuffix \
))
$(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/image,\

View File

@ -26,6 +26,10 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/report/meta/XFormulaParser.hpp>
namespace com { namespace sun { namespace star { namespace lang {
class XMultiServiceFactory;
} } } }
//============================================================================
namespace rptui
{

View File

@ -2300,7 +2300,7 @@ void ScXMLImport::ExamineDefaultStyle()
aDecSep = ScGlobal::pLocaleData->getNumDecimalSep();
else
{
LocaleDataWrapper aLocaleData( pDoc->GetServiceManager(),
LocaleDataWrapper aLocaleData( comphelper::getComponentContext(pDoc->GetServiceManager()),
MsLangId::convertLanguageToLocale( nFormatLang ) );
aDecSep = aLocaleData.getNumDecimalSep();
}
@ -2520,7 +2520,7 @@ sal_Int32 ScXMLImport::SetCurrencySymbol(const sal_Int32 nKey, const rtl::OUStri
{
{
ScXMLImport::MutexGuard aGuard(*this);
LocaleDataWrapper aLocaleData( GetDocument()->GetServiceManager(), aLocale );
LocaleDataWrapper aLocaleData( comphelper::getComponentContext(GetDocument()->GetServiceManager()), aLocale );
rtl::OUStringBuffer aBuffer(15);
aBuffer.appendAscii("#");
aBuffer.append( aLocaleData.getNumThousandSep() );

View File

@ -136,7 +136,7 @@ void ScDocShell::InitItems()
if (aLocales.getLength())
{
rtl::Reference<SvxForbiddenCharactersTable> xForbiddenTable =
new SvxForbiddenCharactersTable( aDocument.GetServiceManager() );
new SvxForbiddenCharactersTable( comphelper::getComponentContext(aDocument.GetServiceManager()) );
const lang::Locale* pLocales = aLocales.getConstArray();
for (sal_Int32 i = 0; i < aLocales.getLength(); i++)

View File

@ -47,7 +47,7 @@ static rtl::Reference<SvxForbiddenCharactersTable> lcl_GetForbidden( ScDocShell*
// create an empty SvxForbiddenCharactersTable for SvxUnoForbiddenCharsTable,
// so changes can be stored.
xRet = new SvxForbiddenCharactersTable( pDoc->GetServiceManager() );
xRet = new SvxForbiddenCharactersTable( comphelper::getComponentContext(pDoc->GetServiceManager()) );
pDoc->SetForbiddenCharacters( xRet );
}
}

View File

@ -263,7 +263,7 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh)
if( xHyphenator.is() )
rOutliner.SetHyphenator( xHyphenator );
SetForbiddenCharsTable( new SvxForbiddenCharactersTable( ::comphelper::getProcessServiceFactory() ) );
SetForbiddenCharsTable( new SvxForbiddenCharactersTable( ::comphelper::getProcessComponentContext() ) );
}
catch(...)
{

View File

@ -712,7 +712,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
void SfxApplication::MiscState_Impl(SfxItemSet &rSet)
{
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
LocaleDataWrapper aLocaleWrapper( Application::GetSettings().GetLocale() );
const sal_uInt16 *pRanges = rSet.GetRanges();
DBG_ASSERT(pRanges && *pRanges, "Set without range");
while ( *pRanges )

View File

@ -724,7 +724,7 @@ namespace
{
String GetDateTimeString( sal_Int32 _nDate, sal_Int32 _nTime )
{
LocaleDataWrapper aWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
LocaleDataWrapper aWrapper( Application::GetSettings().GetLocale() );
Date aDate( _nDate );
Time aTime( _nTime );
@ -878,7 +878,7 @@ IMPL_LINK_NOARG(SfxDocumentPage, DeleteHdl)
String aName;
if ( bEnableUseUserData && aUseUserDataCB.IsChecked() )
aName = SvtUserOptions().GetFullName();
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
LocaleDataWrapper aLocaleWrapper( Application::GetSettings().GetLocale() );
DateTime now( DateTime::SYSTEM );
util::DateTime uDT(
now.Get100Sec(), now.GetSec(), now.GetMin(), now.GetHour(),
@ -1148,7 +1148,7 @@ void SfxDocumentPage::Reset( const SfxItemSet& rSet )
// handle access data
sal_Bool m_bUseUserData = pInfoItem->IsUseUserData();
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
LocaleDataWrapper aLocaleWrapper( Application::GetSettings().GetLocale() );
aCreateValFt.SetText( ConvertDateTime_Impl( pInfoItem->getAuthor(),
pInfoItem->getCreationDate(), aLocaleWrapper ) );
util::DateTime aTime( pInfoItem->getModificationDate() );

View File

@ -316,8 +316,7 @@ void SfxVersionDialog::RecalcDateColumn()
{
// recalculate the datetime column width
DateTime aNow( DateTime::SYSTEM );
mpLocaleWrapper = new LocaleDataWrapper(
::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
mpLocaleWrapper = new LocaleDataWrapper( Application::GetSettings().GetLocale() );
String sDateTime = ConvertDateTime_Impl( aNow, *mpLocaleWrapper );
long nWidth = aVersionBox.GetTextWidth( sDateTime );
nWidth += 15; // a little offset
@ -451,7 +450,7 @@ SfxViewVersionDialog_Impl::SfxViewVersionDialog_Impl ( Window *pParent, SfxVersi
{
FreeResource();
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
LocaleDataWrapper aLocaleWrapper( Application::GetSettings().GetLocale() );
aDateTimeText.SetText( aDateTimeText.GetText().Append(ConvertDateTime_Impl( pInfo->aCreationDate, aLocaleWrapper )) );
aSavedByText.SetText( aSavedByText.GetText().Append(pInfo->aAuthor) );
aEdit.SetText( rInfo.aComment );

View File

@ -953,8 +953,7 @@ sal_Int32 SAL_CALL SmModel::getRendererCount(
static Size lcl_GuessPaperSize()
{
Size aRes;
Reference< XMultiServiceFactory > xMgr( getProcessServiceFactory() );
LocaleDataWrapper aLocWrp( xMgr, AllSettings().GetLocale() );
LocaleDataWrapper aLocWrp( AllSettings().GetLocale() );
if( MEASURE_METRIC == aLocWrp.getMeasurementSystemEnum() )
{
// in 100th mm

View File

@ -54,7 +54,7 @@
class OnDemandLocaleDataWrapper
{
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
SvtSysLocale aSysLocale;
LanguageType eCurrentLanguage;
LanguageType eLastAnyLanguage;
@ -75,7 +75,7 @@ public:
eCurrentLanguage = LANGUAGE_SYSTEM;
}
OnDemandLocaleDataWrapper(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
::com::sun::star::lang::Locale& rLocale,
LanguageType eLang
)
@ -85,7 +85,7 @@ public:
, bInitialized(false)
{
pSystem = aSysLocale.GetLocaleDataPtr();
init( rxSMgr, rLocale, eLang );
init( rxContext, rLocale, eLang );
}
~OnDemandLocaleDataWrapper()
{
@ -98,12 +98,12 @@ public:
bool is() const { return pCurrent != NULL; }
void init(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
::com::sun::star::lang::Locale& rLocale,
LanguageType eLang
)
{
xSMgr = rxSMgr;
m_xContext = rxContext;
changeLocale( rLocale, eLang );
bInitialized = true;
}
@ -117,13 +117,13 @@ public:
break;
case LANGUAGE_ENGLISH_US :
if ( !pEnglish )
pEnglish = new LocaleDataWrapper( xSMgr, rLocale );
pEnglish = new LocaleDataWrapper( m_xContext, rLocale );
pCurrent = pEnglish;
break;
default:
if ( !pAny )
{
pAny = new LocaleDataWrapper( xSMgr, rLocale );
pAny = new LocaleDataWrapper( m_xContext, rLocale );
eLastAnyLanguage = eLang;
}
else if ( eLastAnyLanguage != eLang )
@ -143,7 +143,7 @@ public:
{
if ( !pAny )
{
pAny = new LocaleDataWrapper( xSMgr, pCurrent->getLocale() );
pAny = new LocaleDataWrapper( m_xContext, pCurrent->getLocale() );
eLastAnyLanguage = eCurrentLanguage;
}
else if ( pCurrent != pAny )
@ -240,7 +240,7 @@ public:
*/
class OnDemandTransliterationWrapper
{
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
LanguageType eLanguage;
::com::sun::star::i18n::TransliterationModules nType;
mutable ::utl::TransliterationWrapper* pPtr;
@ -255,14 +255,14 @@ public:
, bInitialized(false)
{}
OnDemandTransliterationWrapper(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
LanguageType eLang,
::com::sun::star::i18n::TransliterationModules nTypeP
)
: bValid(false)
, bInitialized(false)
{
init( rxSMgr, eLang, nTypeP );
init( rxContext, eLang, nTypeP );
}
~OnDemandTransliterationWrapper()
{
@ -274,12 +274,12 @@ public:
bool is() const { return pPtr != NULL; }
void init(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
LanguageType eLang,
::com::sun::star::i18n::TransliterationModules nTypeP
)
{
xSMgr = rxSMgr;
m_xContext = rxContext;
nType = nTypeP;
changeLocale( eLang );
if ( pPtr )
@ -301,7 +301,7 @@ public:
if ( !bValid )
{
if ( !pPtr )
pPtr = new ::utl::TransliterationWrapper( comphelper::getComponentContext(xSMgr), nType );
pPtr = new ::utl::TransliterationWrapper( m_xContext, nType );
pPtr->loadModuleIfNeeded( eLanguage );
bValid = true;
}
@ -311,7 +311,7 @@ public:
const ::utl::TransliterationWrapper* getForModule( const String& rModule, LanguageType eLang ) const
{
if ( !pPtr )
pPtr = new ::utl::TransliterationWrapper( comphelper::getComponentContext(xSMgr), nType );
pPtr = new ::utl::TransliterationWrapper( m_xContext, nType );
pPtr->loadModuleByImplName( rModule, eLang );
bValid = false; // reforce settings change in get()
return pPtr;

View File

@ -235,9 +235,9 @@ void SvNumberFormatter::ImpConstruct( LanguageType eLang )
aLocale = MsLangId::convertLanguageToLocale( eLang );
pCharClass = new CharClass( comphelper::getComponentContext(xServiceManager), aLocale );
xLocaleData.init( xServiceManager, aLocale, eLang );
xLocaleData.init( comphelper::getComponentContext(xServiceManager), aLocale, eLang );
xCalendar.init( comphelper::getComponentContext(xServiceManager), aLocale );
xTransliteration.init( xServiceManager, eLang,
xTransliteration.init( comphelper::getComponentContext(xServiceManager), eLang,
::com::sun::star::i18n::TransliterationModules_IGNORE_CASE );
xNatNum.init( xServiceManager );
@ -449,7 +449,7 @@ void SvNumberFormatter::ReplaceSystemCL( LanguageType eOldLanguage )
pStdFormat->SetLastInsertKey( sal_uInt16(nLastKey - nCLOffset) );
// append new system additional formats
NumberFormatCodeWrapper aNumberFormatCode( xServiceManager, GetLocale() );
NumberFormatCodeWrapper aNumberFormatCode( comphelper::getComponentContext(xServiceManager), GetLocale() );
ImpGenerateAdditionalFormats( nCLOffset, aNumberFormatCode, true );
}
@ -744,7 +744,7 @@ bool SvNumberFormatter::Load( SvStream& rStream )
// generate additional i18n standard formats for all used locales
LanguageType eOldLanguage = ActLnge;
NumberFormatCodeWrapper aNumberFormatCode( xServiceManager, GetLocale() );
NumberFormatCodeWrapper aNumberFormatCode( comphelper::getComponentContext(xServiceManager), GetLocale() );
std::vector<sal_uInt16> aList;
GetUsedLanguages( aList );
for ( std::vector<sal_uInt16>::const_iterator it(aList.begin()); it != aList.end(); ++it )
@ -2163,7 +2163,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio
if (bOldConvertMode)
pFormatScanner->SetConvertMode(false); // switch off for this function
NumberFormatCodeWrapper aNumberFormatCode( xServiceManager, GetLocale() );
NumberFormatCodeWrapper aNumberFormatCode( comphelper::getComponentContext(xServiceManager), GetLocale() );
xub_StrLen nCheckPos = 0;
SvNumberformat* pNewFormat = NULL;
@ -3546,7 +3546,7 @@ void SvNumberFormatter::ImpInitCurrencyTable()
LanguageType eSysLang = SvtSysLocale().GetLanguage();
LocaleDataWrapper* pLocaleData = new LocaleDataWrapper(
::comphelper::getProcessServiceFactory(),
::comphelper::getProcessComponentContext(),
MsLangId::convertLanguageToLocale( eSysLang ) );
// get user configured currency
String aConfiguredCurrencyAbbrev;

View File

@ -223,7 +223,7 @@ void ImpSvNumberformatScan::SetDependentKeywords()
// requested Locale, otherwise number format codes might not match
lang::Locale aLoadedLocale = pLocaleData->getLoadedLocale();
LanguageType eLang = MsLangId::convertLocaleToLanguage( aLoadedLocale );
NumberFormatCodeWrapper aNumberFormatCode( pFormatter->GetServiceManager(), aLoadedLocale );
NumberFormatCodeWrapper aNumberFormatCode( comphelper::getComponentContext(pFormatter->GetServiceManager()), aLoadedLocale );
i18n::NumberFormatCode aFormat = aNumberFormatCode.getFormatCode( NF_NUMBER_STANDARD );
sNameStandardFormat = lcl_extractStandardGeneralName( aFormat.Code);

View File

@ -164,9 +164,7 @@ void ODocumentInfoPreview::insertDateTime(
Time(
value.Hours, value.Minutes, value.Seconds, value.HundredthSeconds));
if (aToolsDT.IsValidAndGregorian()) {
LocaleDataWrapper aLocaleWrapper(
comphelper::getProcessServiceFactory(),
Application::GetSettings().GetLocale());
LocaleDataWrapper aLocaleWrapper( Application::GetSettings().GetLocale() );
rtl::OUStringBuffer buf(aLocaleWrapper.getDate(aToolsDT));
buf.appendAscii(RTL_CONSTASCII_STRINGPARAM(", "));
buf.append(aLocaleWrapper.getTime(aToolsDT));

View File

@ -257,7 +257,7 @@ void Calendar::ImplInitSettings()
Calendar::Calendar( Window* pParent, WinBits nWinStyle ) :
Control( pParent, nWinStyle & (WB_TABSTOP | WB_GROUP | WB_BORDER | WB_3DLOOK | WB_RANGESELECT | WB_MULTISELECT) ),
maCalendarWrapper( comphelper::getComponentContext(Application::GetAppLocaleDataWrapper().getServiceFactory()) ),
maCalendarWrapper( Application::GetAppLocaleDataWrapper().getComponentContext() ),
maOldFormatFirstDate( 0, 0, 1900 ),
maOldFormatLastDate( 0, 0, 1900 ),
maFirstDate( 0, 0, 1900 ),

View File

@ -1146,7 +1146,7 @@ void DoubleNumericField::ResetConformanceTester()
{
Locale aLocale;
MsLangId::convertLanguageToLocale( pFormatEntry->GetLanguage(), aLocale );
LocaleDataWrapper aLocaleInfo(::comphelper::getProcessServiceFactory(), aLocale);
LocaleDataWrapper aLocaleInfo( aLocale );
String sSeparator = aLocaleInfo.getNumThousandSep();
if (sSeparator.Len())
@ -1238,7 +1238,7 @@ void DoubleCurrencyField::UpdateCurrencyFormat()
// build a new format string with the base class' and my own settings
Locale aLocale;
MsLangId::convertLanguageToLocale( eLanguage, aLocale );
LocaleDataWrapper aLocaleInfo(::comphelper::getProcessServiceFactory(), aLocale);
LocaleDataWrapper aLocaleInfo( aLocale );
XubString sNewFormat;
if (bThSep)

View File

@ -568,7 +568,7 @@ IMPL_LINK( SvxSuperContourDlg, MousePosHdl, ContourWindow*, pWnd )
String aStr;
const FieldUnit eFieldUnit = GetBindings().GetDispatcher()->GetModule()->GetFieldUnit();
const Point& rMousePos = pWnd->GetMousePos();
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
LocaleDataWrapper aLocaleWrapper( Application::GetSettings().GetLocale() );
const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep()[0];
aStr.Assign( GetUnitString( rMousePos.X(), eFieldUnit, cSep ) );
@ -585,7 +585,7 @@ IMPL_LINK( SvxSuperContourDlg, GraphSizeHdl, ContourWindow*, pWnd )
String aStr;
const FieldUnit eFieldUnit = GetBindings().GetDispatcher()->GetModule()->GetFieldUnit();
const Size& rSize = pWnd->GetGraphicSize();
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
LocaleDataWrapper aLocaleWrapper( Application::GetSettings().GetLocale() );
const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep()[0];
aStr.Assign( GetUnitString( rSize.Width(), eFieldUnit, cSep ) );

View File

@ -106,7 +106,7 @@ CompressGraphicsDialog::~CompressGraphicsDialog()
void CompressGraphicsDialog::Update()
{
const FieldUnit eFieldUnit = m_rBindings.GetDispatcher()->GetModule()->GetFieldUnit();
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
LocaleDataWrapper aLocaleWrapper( Application::GetSettings().GetLocale() );
sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep()[0];
VirtualDevice* pDummyVDev = new VirtualDevice();

View File

@ -665,7 +665,7 @@ IMPL_LINK( SvxIMapDlg, MousePosHdl, IMapWindow*, pWnd )
String aStr;
const FieldUnit eFieldUnit = GetBindings().GetDispatcher()->GetModule()->GetFieldUnit();
const Point& rMousePos = pWnd->GetMousePos();
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
LocaleDataWrapper aLocaleWrapper( Application::GetSettings().GetLocale() );
const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep()[0];
aStr.Assign( GetUnitString( rMousePos.X(), eFieldUnit, cSep ) );
@ -682,7 +682,7 @@ IMPL_LINK( SvxIMapDlg, GraphSizeHdl, IMapWindow*, pWnd )
String aStr;
const FieldUnit eFieldUnit = GetBindings().GetDispatcher()->GetModule()->GetFieldUnit();
const Size& rSize = pWnd->GetGraphicSize();
LocaleDataWrapper aLocaleWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
LocaleDataWrapper aLocaleWrapper( Application::GetSettings().GetLocale() );
const sal_Unicode cSep = aLocaleWrapper.getNumDecimalSep()[0];
aStr.Assign( GetUnitString( rSize.Width(), eFieldUnit, cSep ) );

View File

@ -3172,7 +3172,7 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos)
Reference< XNumberFormatter> xFormatter( NumberFormatter::create(m_aContext.getUNOContext()), UNO_QUERY_THROW );
xFormatter->attachNumberFormatsSupplier(xFormatSupplier);
Locale aAppLocale = Application::GetSettings().GetUILocale();
LocaleDataWrapper aLocaleWrapper( m_aContext.getLegacyServiceFactory(), aAppLocale );
LocaleDataWrapper aLocaleWrapper( m_aContext.getUNOContext(), aAppLocale );
// retrieving the filter
const Sequence < PropertyValue >* pRow = aFilterRows.getConstArray();

View File

@ -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:

View File

@ -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;

View File

@ -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 ) ) );
}
}

View File

@ -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();

View File

@ -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;
}

View File

@ -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;

View File

@ -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) ) );
}

View File

@ -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!

View File

@ -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(),

View File

@ -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];
}

View File

@ -337,7 +337,7 @@ sal_Bool UnoControlModel::ImplHasProperty( sal_uInt16 nPropId ) const
aLocale.Country = sDefaultCurrency.copy( nSepPos + 1 );
}
LocaleDataWrapper aLocaleInfo( maContext.getLegacyServiceFactory(), aLocale );
LocaleDataWrapper aLocaleInfo( maContext.getUNOContext(), aLocale );
if ( sBankSymbol.isEmpty() )
sBankSymbol = aLocaleInfo.getCurrBankSymbol();

View File

@ -30,8 +30,8 @@
#include "unotools/unotoolsdllapi.h"
namespace com { namespace sun { namespace star {
namespace lang {
class XMultiServiceFactory;
namespace uno {
class XComponentContext;
}
}}}
class Date;
@ -56,7 +56,7 @@ class UNOTOOLS_DLLPUBLIC LocaleDataWrapper : private boost::noncopyable
{
static sal_uInt8 nLocaleDataChecking; // 0:=dontknow, 1:=yes, 2:=no
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
::com::sun::star::uno::Reference< ::com::sun::star::i18n::XLocaleData4 > xLD;
::com::sun::star::lang::Locale aLocale;
::boost::shared_ptr< ::com::sun::star::i18n::Calendar2 > xDefaultCalendar;
@ -111,7 +111,10 @@ class UNOTOOLS_DLLPUBLIC LocaleDataWrapper : private boost::noncopyable
public:
LocaleDataWrapper(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xSF,
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rxContext,
const ::com::sun::star::lang::Locale& rLocale
);
LocaleDataWrapper(
const ::com::sun::star::lang::Locale& rLocale
);
~LocaleDataWrapper();
@ -122,8 +125,8 @@ public:
lives "on the grassland". The CalendarWrapper ctor can handle that
though. */
const ::com::sun::star::uno::Reference<
::com::sun::star::lang::XMultiServiceFactory > & getServiceFactory()
const { return xSMgr; }
::com::sun::star::uno::XComponentContext > & getComponentContext()
const { return m_xContext; }
/// set a new Locale to request
void setLocale( const ::com::sun::star::lang::Locale& rLocale );

View File

@ -24,15 +24,14 @@
#include "unotools/unotoolsdllapi.h"
namespace com { namespace sun { namespace star {
namespace lang {
class XMultiServiceFactory;
namespace uno {
class XComponentContext;
}
}}}
class UNOTOOLS_DLLPUBLIC NumberFormatCodeWrapper
{
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xSMgr;
::com::sun::star::uno::Reference< ::com::sun::star::i18n::XNumberFormatCode > xNFC;
::com::sun::star::lang::Locale aLocale;
@ -42,7 +41,7 @@ class UNOTOOLS_DLLPUBLIC NumberFormatCodeWrapper
public:
NumberFormatCodeWrapper(
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xSF,
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rxContext,
const ::com::sun::star::lang::Locale& rLocale
);

View File

@ -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 );
}

View File

@ -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();

View File

@ -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,7 +53,6 @@ NumberFormatCodeWrapper::getFormatCode( sal_Int16 formatIndex ) const
{
try
{
if ( xNFC.is() )
return xNFC->getFormatCode( formatIndex, aLocale );
}
catch ( const Exception& )
@ -74,7 +68,6 @@ NumberFormatCodeWrapper::getAllFormatCode( sal_Int16 formatUsage ) const
{
try
{
if ( xNFC.is() )
return xNFC->getAllFormatCode( formatUsage, aLocale );
}
catch ( const Exception& )
@ -90,7 +83,6 @@ NumberFormatCodeWrapper::getAllFormatCodes() const
{
try
{
if ( xNFC.is() )
return xNFC->getAllFormatCodes( aLocale );
}
catch ( const Exception& )

View File

@ -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

View File

@ -29,8 +29,8 @@
namespace com {
namespace sun {
namespace star {
namespace lang {
class XMultiServiceFactory;
namespace uno {
class XComponentContext;
}
}}}
@ -50,7 +50,7 @@ class VCL_DLLPUBLIC I18nHelper
private:
::osl::Mutex maMutex;
::com::sun::star::lang::Locale maLocale;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
LocaleDataWrapper* mpLocaleDataWrapper;
utl::TransliterationWrapper* mpTransliterationWrapper;
@ -67,7 +67,7 @@ protected:
public:
I18nHelper( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMSF, const ::com::sun::star::lang::Locale& rLocale );
I18nHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::lang::Locale& rLocale );
~I18nHelper();
sal_Int32 CompareString( const rtl::OUString& rStr1, const rtl::OUString& rStr2 ) const;

View File

@ -33,9 +33,9 @@
using namespace ::com::sun::star;
vcl::I18nHelper::I18nHelper( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMSF, const ::com::sun::star::lang::Locale& rLocale )
vcl::I18nHelper::I18nHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::lang::Locale& rLocale )
{
mxMSF = rxMSF;
m_xContext = rxContext;
maLocale = rLocale;
mpLocaleDataWrapper = NULL;
mpTransliterationWrapper= NULL;
@ -64,7 +64,7 @@ utl::TransliterationWrapper& vcl::I18nHelper::ImplGetTransliterationWrapper() co
if ( mbTransliterateIgnoreCase )
nModules |= i18n::TransliterationModules_IGNORE_CASE;
((vcl::I18nHelper*)this)->mpTransliterationWrapper = new utl::TransliterationWrapper( comphelper::getComponentContext(mxMSF), (i18n::TransliterationModules)nModules );
((vcl::I18nHelper*)this)->mpTransliterationWrapper = new utl::TransliterationWrapper( m_xContext, (i18n::TransliterationModules)nModules );
((vcl::I18nHelper*)this)->mpTransliterationWrapper->loadModuleIfNeeded( MsLangId::convertLocaleToLanguage( maLocale ) );
}
return *mpTransliterationWrapper;
@ -74,7 +74,7 @@ LocaleDataWrapper& vcl::I18nHelper::ImplGetLocaleDataWrapper() const
{
if ( !mpLocaleDataWrapper )
{
((vcl::I18nHelper*)this)->mpLocaleDataWrapper = new LocaleDataWrapper( mxMSF, maLocale );
((vcl::I18nHelper*)this)->mpLocaleDataWrapper = new LocaleDataWrapper( m_xContext, maLocale );
}
return *mpLocaleDataWrapper;
}

View File

@ -1579,7 +1579,7 @@ LanguageType AllSettings::GetUILanguage() const
const LocaleDataWrapper& AllSettings::GetLocaleDataWrapper() const
{
if ( !mpData->mpLocaleDataWrapper )
((AllSettings*)this)->mpData->mpLocaleDataWrapper = new LocaleDataWrapper( comphelper::getProcessServiceFactory(), GetLocale() );
((AllSettings*)this)->mpData->mpLocaleDataWrapper = new LocaleDataWrapper( comphelper::getProcessComponentContext(), GetLocale() );
return *mpData->mpLocaleDataWrapper;
}
@ -1588,7 +1588,7 @@ const LocaleDataWrapper& AllSettings::GetLocaleDataWrapper() const
const LocaleDataWrapper& AllSettings::GetUILocaleDataWrapper() const
{
if ( !mpData->mpUILocaleDataWrapper )
((AllSettings*)this)->mpData->mpUILocaleDataWrapper = new LocaleDataWrapper( comphelper::getProcessServiceFactory(), GetUILocale() );
((AllSettings*)this)->mpData->mpUILocaleDataWrapper = new LocaleDataWrapper( comphelper::getProcessComponentContext(), GetUILocale() );
return *mpData->mpUILocaleDataWrapper;
}
@ -1597,8 +1597,7 @@ const LocaleDataWrapper& AllSettings::GetUILocaleDataWrapper() const
const vcl::I18nHelper& AllSettings::GetLocaleI18nHelper() const
{
if ( !mpData->mpI18nHelper ) {
::com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> aFactory(comphelper::getProcessServiceFactory());
((AllSettings*)this)->mpData->mpI18nHelper = new vcl::I18nHelper( aFactory, GetLocale() );
((AllSettings*)this)->mpData->mpI18nHelper = new vcl::I18nHelper( comphelper::getProcessComponentContext(), GetLocale() );
}
return *mpData->mpI18nHelper;
}
@ -1608,8 +1607,7 @@ const vcl::I18nHelper& AllSettings::GetLocaleI18nHelper() const
const vcl::I18nHelper& AllSettings::GetUILocaleI18nHelper() const
{
if ( !mpData->mpUII18nHelper ) {
::com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> aFactory(comphelper::getProcessServiceFactory());
((AllSettings*)this)->mpData->mpUII18nHelper = new vcl::I18nHelper( aFactory, GetUILocale() );
((AllSettings*)this)->mpData->mpUII18nHelper = new vcl::I18nHelper( comphelper::getProcessComponentContext(), GetUILocale() );
}
return *mpData->mpUII18nHelper;
}

View File

@ -309,7 +309,7 @@ LocaleDataWrapper& FormatterBase::ImplGetLocaleDataWrapper() const
{
if ( !mpLocaleDataWrapper )
{
((FormatterBase*)this)->mpLocaleDataWrapper = new LocaleDataWrapper( comphelper::getProcessServiceFactory(), GetLocale() );
((FormatterBase*)this)->mpLocaleDataWrapper = new LocaleDataWrapper( GetLocale() );
}
return *mpLocaleDataWrapper;
}

View File

@ -2970,7 +2970,7 @@ void TextEngine::SetLocale( const ::com::sun::star::lang::Locale& rLocale )
LocaleDataWrapper* TextEngine::ImpGetLocaleDataWrapper()
{
if ( !mpLocaleDataWrapper )
mpLocaleDataWrapper = new LocaleDataWrapper( comphelper::getProcessServiceFactory(), GetLocale() );
mpLocaleDataWrapper = new LocaleDataWrapper( GetLocale() );
return mpLocaleDataWrapper;
}

View File

@ -71,6 +71,10 @@ class SvXMLStylesContext;
struct SvXMLNumberInfo;
class SvNumberFormatter;
class SvtSysLocale;
namespace com { namespace sun { namespace star { namespace lang {
class XMultiServiceFactory;
}}}}
// use SvXMLNumFmtHelper in the context for <office:styles> to create
// child contexts for data styles

View File

@ -247,7 +247,7 @@ SvXMLNumFmtExport::SvXMLNumFmtExport(
{
pCharClass = new CharClass( comphelper::getComponentContext(pFormatter->GetServiceManager()),
pFormatter->GetLocale() );
pLocaleData = new LocaleDataWrapper( pFormatter->GetServiceManager(),
pLocaleData = new LocaleDataWrapper( comphelper::getComponentContext(pFormatter->GetServiceManager()),
pFormatter->GetLocale() );
}
else
@ -255,7 +255,7 @@ SvXMLNumFmtExport::SvXMLNumFmtExport(
lang::Locale aLocale( MsLangId::convertLanguageToLocale( MsLangId::getSystemLanguage() ) );
pCharClass = new CharClass( comphelper::getComponentContext(rExport.getServiceFactory()), aLocale );
pLocaleData = new LocaleDataWrapper( rExport.getServiceFactory(), aLocale );
pLocaleData = new LocaleDataWrapper( comphelper::getComponentContext(rExport.getServiceFactory()), aLocale );
}
pUsedList = new SvXMLNumUsedList_Impl;
@ -282,7 +282,7 @@ SvXMLNumFmtExport::SvXMLNumFmtExport(
{
pCharClass = new CharClass( comphelper::getComponentContext(pFormatter->GetServiceManager()),
pFormatter->GetLocale() );
pLocaleData = new LocaleDataWrapper( pFormatter->GetServiceManager(),
pLocaleData = new LocaleDataWrapper( comphelper::getComponentContext(pFormatter->GetServiceManager()),
pFormatter->GetLocale() );
}
else
@ -290,7 +290,7 @@ SvXMLNumFmtExport::SvXMLNumFmtExport(
lang::Locale aLocale( MsLangId::convertLanguageToLocale( MsLangId::getSystemLanguage() ) );
pCharClass = new CharClass( comphelper::getComponentContext(rExport.getServiceFactory()), aLocale );
pLocaleData = new LocaleDataWrapper( rExport.getServiceFactory(), aLocale );
pLocaleData = new LocaleDataWrapper( comphelper::getComponentContext(rExport.getServiceFactory()), aLocale );
}
pUsedList = new SvXMLNumUsedList_Impl;

View File

@ -609,8 +609,8 @@ const LocaleDataWrapper& SvXMLNumImpData::GetLocaleData( LanguageType nLang )
{
if ( !pLocaleData )
pLocaleData = new LocaleDataWrapper(
(pFormatter ? pFormatter->GetServiceManager() :
mxServiceFactory),
comphelper::getComponentContext(
pFormatter ? pFormatter->GetServiceManager() : mxServiceFactory),
MsLangId::convertLanguageToLocale( nLang ) );
else
pLocaleData->setLocale( MsLangId::convertLanguageToLocale( nLang ) );