Kaydet (Commit) b306f535 authored tarafından Eike Rathke's avatar Eike Rathke

force SvNumberformat::FormatterPrivateAccess for Get/SetLastInsertKey

... so only SvNumberFormatter can use it, as intended.

Change-Id: I91875dfd00d1f83b3ae988bda922782336489f73
üst f2b4d849
...@@ -226,10 +226,11 @@ public: ...@@ -226,10 +226,11 @@ public:
sal_uInt16 GetFormatIntegerDigits() const { return NumFor[0].Info().nCntPre; } sal_uInt16 GetFormatIntegerDigits() const { return NumFor[0].Info().nCntPre; }
//! Read/write access on a special sal_uInt16 component, may only be used on the //! Read/write access on a special sal_uInt16 component, may only be used on the
//! standard format 0, 5000, ... and only by the number formatter! //! standard format 0, 10000, ... and only by the number formatter!
sal_uInt16 GetLastInsertKey() const struct FormatterPrivateAccess { friend SvNumberFormatter; private: FormatterPrivateAccess() {} };
sal_uInt16 GetLastInsertKey( const FormatterPrivateAccess& ) const
{ return NumFor[0].Info().nThousand; } { return NumFor[0].Info().nThousand; }
void SetLastInsertKey(sal_uInt16 nKey) void SetLastInsertKey( sal_uInt16 nKey, const FormatterPrivateAccess& )
{ NumFor[0].Info().nThousand = nKey; } { NumFor[0].Info().nThousand = nKey; }
//! Only onLoad: convert from stored to current system language/country //! Only onLoad: convert from stored to current system language/country
......
...@@ -514,7 +514,7 @@ void SvNumberFormatter::ReplaceSystemCL( LanguageType eOldLanguage ) ...@@ -514,7 +514,7 @@ void SvNumberFormatter::ReplaceSystemCL( LanguageType eOldLanguage )
delete pOldEntry; delete pOldEntry;
} }
pFormatScanner->SetConvertMode(false); pFormatScanner->SetConvertMode(false);
pStdFormat->SetLastInsertKey( sal_uInt16(nLastKey - nCLOffset) ); pStdFormat->SetLastInsertKey( sal_uInt16(nLastKey - nCLOffset), SvNumberformat::FormatterPrivateAccess() );
// append new system additional formats // append new system additional formats
css::uno::Reference< css::i18n::XNumberFormatCode > xNFC = i18n::NumberFormatMapper::create( m_xContext ); css::uno::Reference< css::i18n::XNumberFormatCode > xNFC = i18n::NumberFormatMapper::create( m_xContext );
...@@ -605,7 +605,7 @@ bool SvNumberFormatter::PutEntry(OUString& rString, ...@@ -605,7 +605,7 @@ bool SvNumberFormatter::PutEntry(OUString& rString,
else else
{ {
SvNumberformat* pStdFormat = GetFormatEntry(CLOffset + ZF_STANDARD); SvNumberformat* pStdFormat = GetFormatEntry(CLOffset + ZF_STANDARD);
sal_uInt32 nPos = CLOffset + pStdFormat->GetLastInsertKey(); sal_uInt32 nPos = CLOffset + pStdFormat->GetLastInsertKey( SvNumberformat::FormatterPrivateAccess() );
if (nPos+1 - CLOffset >= SV_COUNTRY_LANGUAGE_OFFSET) if (nPos+1 - CLOffset >= SV_COUNTRY_LANGUAGE_OFFSET)
{ {
SAL_WARN( "svl.numbers", "SvNumberFormatter::PutEntry: too many formats for CL"); SAL_WARN( "svl.numbers", "SvNumberFormatter::PutEntry: too many formats for CL");
...@@ -620,7 +620,7 @@ bool SvNumberFormatter::PutEntry(OUString& rString, ...@@ -620,7 +620,7 @@ bool SvNumberFormatter::PutEntry(OUString& rString,
{ {
bCheck = true; bCheck = true;
nKey = nPos+1; nKey = nPos+1;
pStdFormat->SetLastInsertKey((sal_uInt16) (nKey-CLOffset)); pStdFormat->SetLastInsertKey((sal_uInt16) (nKey-CLOffset), SvNumberformat::FormatterPrivateAccess());
} }
} }
} }
...@@ -2265,7 +2265,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio ...@@ -2265,7 +2265,7 @@ void SvNumberFormatter::ImpGenerateFormats( sal_uInt32 CLOffset, bool bNoAdditio
} }
pStdFormat->SetType( css::util::NumberFormat::NUMBER ); pStdFormat->SetType( css::util::NumberFormat::NUMBER );
pStdFormat->SetStandard(); pStdFormat->SetStandard();
pStdFormat->SetLastInsertKey( SV_MAX_ANZ_STANDARD_FORMATE ); pStdFormat->SetLastInsertKey( SV_MAX_ANZ_STANDARD_FORMATE, SvNumberformat::FormatterPrivateAccess() );
} }
else else
{ {
...@@ -2683,7 +2683,7 @@ void SvNumberFormatter::ImpGenerateAdditionalFormats( sal_uInt32 CLOffset, ...@@ -2683,7 +2683,7 @@ void SvNumberFormatter::ImpGenerateAdditionalFormats( sal_uInt32 CLOffset,
SAL_WARN( "svl.numbers", "ImpGenerateAdditionalFormats: no GENERAL format" ); SAL_WARN( "svl.numbers", "ImpGenerateAdditionalFormats: no GENERAL format" );
return ; return ;
} }
sal_uInt32 nPos = CLOffset + pStdFormat->GetLastInsertKey(); sal_uInt32 nPos = CLOffset + pStdFormat->GetLastInsertKey( SvNumberformat::FormatterPrivateAccess() );
css::lang::Locale aLocale = GetLanguageTag().getLocale(); css::lang::Locale aLocale = GetLanguageTag().getLocale();
sal_Int32 j; sal_Int32 j;
...@@ -2751,7 +2751,7 @@ void SvNumberFormatter::ImpGenerateAdditionalFormats( sal_uInt32 CLOffset, ...@@ -2751,7 +2751,7 @@ void SvNumberFormatter::ImpGenerateAdditionalFormats( sal_uInt32 CLOffset,
} }
} }
pStdFormat->SetLastInsertKey( (sal_uInt16)(nPos - CLOffset) ); pStdFormat->SetLastInsertKey( (sal_uInt16)(nPos - CLOffset), SvNumberformat::FormatterPrivateAccess() );
} }
...@@ -3114,7 +3114,7 @@ SvNumberFormatterIndexTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter ...@@ -3114,7 +3114,7 @@ SvNumberFormatterIndexTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter
else else
{ {
SvNumberformat* pStdFormat = GetFormatEntry(nCLOffset + ZF_STANDARD); SvNumberformat* pStdFormat = GetFormatEntry(nCLOffset + ZF_STANDARD);
sal_uInt32 nPos = nCLOffset + pStdFormat->GetLastInsertKey(); sal_uInt32 nPos = nCLOffset + pStdFormat->GetLastInsertKey( SvNumberformat::FormatterPrivateAccess() );
nNewKey = nPos+1; nNewKey = nPos+1;
if (nNewKey - nCLOffset >= SV_COUNTRY_LANGUAGE_OFFSET) if (nNewKey - nCLOffset >= SV_COUNTRY_LANGUAGE_OFFSET)
{ {
...@@ -3128,7 +3128,8 @@ SvNumberFormatterIndexTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter ...@@ -3128,7 +3128,8 @@ SvNumberFormatterIndexTable* SvNumberFormatter::MergeFormatter(SvNumberFormatter
} }
else else
{ {
pStdFormat->SetLastInsertKey((sal_uInt16) (nNewKey - nCLOffset)); pStdFormat->SetLastInsertKey((sal_uInt16) (nNewKey - nCLOffset),
SvNumberformat::FormatterPrivateAccess());
} }
} }
if (nNewKey != nOldKey) // new index if (nNewKey != nOldKey) // new index
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment