summaryrefslogtreecommitdiff
path: root/svl/source/numbers/zforscan.cxx
diff options
context:
space:
mode:
authorMuthu Subramanian K <sumuthu@novell.com>2010-12-09 17:24:10 +0530
committerMuthu Subramanian K <sumuthu@novell.com>2010-12-09 17:27:56 +0530
commitdcdeded09767c8cf97f371c65ae577053846ea60 (patch)
tree4d33a49458ba4456801409783712694b022c594d /svl/source/numbers/zforscan.cxx
parent3dc4b5a88adc062fb1c78f34ff85e129022bef08 (diff)
New number formats (?/4, ?/100 and ?/[n]). n#655214
?/4 is for quarters representation ?/100 is for hunderds representation ?/[n] is for forcing the divisor to be 'n' e.g. ?/5
Diffstat (limited to 'svl/source/numbers/zforscan.cxx')
-rw-r--r--svl/source/numbers/zforscan.cxx39
1 files changed, 22 insertions, 17 deletions
diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index 77f5eab0efd1..6741e8ed6d8e 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -123,7 +123,6 @@ ImpSvNumberformatScan::~ImpSvNumberformatScan()
Reset();
}
-
void ImpSvNumberformatScan::ChangeIntl()
{
bKeywordsNeedInit = TRUE;
@@ -133,7 +132,6 @@ void ImpSvNumberformatScan::ChangeIntl()
sKeyword[NF_KEY_FALSE].Erase();
}
-
void ImpSvNumberformatScan::InitSpecialKeyword( NfKeywordIndex eIdx ) const
{
switch ( eIdx )
@@ -163,7 +161,6 @@ void ImpSvNumberformatScan::InitSpecialKeyword( NfKeywordIndex eIdx ) const
}
}
-
void ImpSvNumberformatScan::InitCompatCur() const
{
ImpSvNumberformatScan* pThis = (ImpSvNumberformatScan*)this;
@@ -174,7 +171,6 @@ void ImpSvNumberformatScan::InitCompatCur() const
bCompatCurNeedInit = FALSE;
}
-
void ImpSvNumberformatScan::InitKeywords() const
{
if ( !bKeywordsNeedInit )
@@ -183,7 +179,6 @@ void ImpSvNumberformatScan::InitKeywords() const
bKeywordsNeedInit = FALSE;
}
-
/** Extract the name of General, Standard, Whatever, ignoring leading modifiers
such as [NatNum1]. */
static String lcl_extractStandardGeneralName( const ::rtl::OUString & rCode )
@@ -227,7 +222,6 @@ static String lcl_extractStandardGeneralName( const ::rtl::OUString & rCode )
return aStr;
}
-
void ImpSvNumberformatScan::SetDependentKeywords()
{
using namespace ::com::sun::star;
@@ -455,7 +449,6 @@ void ImpSvNumberformatScan::SetDependentKeywords()
InitCompatCur();
}
-
void ImpSvNumberformatScan::ChangeNullDate(USHORT nDay, USHORT nMonth, USHORT nYear)
{
if ( pNullDate )
@@ -535,7 +528,6 @@ Color* ImpSvNumberformatScan::GetColor(String& sStr)
return pResult;
}
-
short ImpSvNumberformatScan::GetKeyWord( const String& sSymbol, xub_StrLen nPos )
{
String sString = pFormatter->GetCharClass()->toUpper( sSymbol, nPos, sSymbol.Len() - nPos );
@@ -956,7 +948,6 @@ void ImpSvNumberformatScan::SkipStrings(USHORT& i, xub_StrLen& nPos)
}
}
-
USHORT ImpSvNumberformatScan::PreviousKeyword(USHORT i)
{
short res = 0;
@@ -1088,7 +1079,6 @@ void ImpSvNumberformatScan::Reset()
nNatNumModifier = 0;
}
-
BOOL ImpSvNumberformatScan::Is100SecZero( USHORT i, BOOL bHadDecSep )
{
USHORT nIndexPre = PreviousKeyword( i );
@@ -1098,7 +1088,6 @@ BOOL ImpSvNumberformatScan::Is100SecZero( USHORT i, BOOL bHadDecSep )
// SS"any"00 take "any" as a valid decimal separator
}
-
xub_StrLen ImpSvNumberformatScan::ScanType(const String&)
{
const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData();
@@ -1407,7 +1396,6 @@ xub_StrLen ImpSvNumberformatScan::ScanType(const String&)
return 0; // Alles ok
}
-
bool ImpSvNumberformatScan::InsertSymbol( USHORT & nPos, svt::NfSymbolType eType, const String& rStr )
{
if (nAnzStrings >= NF_MAX_FORMAT_SYMBOLS || nPos > nAnzStrings)
@@ -1429,7 +1417,6 @@ bool ImpSvNumberformatScan::InsertSymbol( USHORT & nPos, svt::NfSymbolType eType
return true;
}
-
int ImpSvNumberformatScan::FinalScanGetCalendar( xub_StrLen& nPos, USHORT& i,
USHORT& rAnzResStrings )
{
@@ -1561,6 +1548,8 @@ xub_StrLen ImpSvNumberformatScan::FinalScan( String& rString, String& rComment )
sal_Unicode cThousandFill = ' ';
while (i < nAnzStrings)
{
+ // TODO: rechecking eScannedType is unnecessary.
+ // This switch-case is for eScannedType == NUMBERFORMAT_FRACTION anyway
if (eScannedType == NUMBERFORMAT_FRACTION && // special case
nTypeArray[i] == NF_SYMBOLTYPE_DEL && // # ### #/#
StringEqualsChar( sOldThousandSep, ' ' ) && // e.g. France or Sweden
@@ -1571,7 +1560,6 @@ xub_StrLen ImpSvNumberformatScan::FinalScan( String& rString, String& rComment )
nTypeArray[i] = NF_SYMBOLTYPE_STRING; // del->string
} // kein Taus.p.
-
if (nTypeArray[i] == NF_SYMBOLTYPE_BLANK ||
nTypeArray[i] == NF_SYMBOLTYPE_STAR ||
nTypeArray[i] == NF_KEY_CCC || // CCC
@@ -1622,6 +1610,26 @@ xub_StrLen ImpSvNumberformatScan::FinalScan( String& rString, String& rComment )
bThaiT = true;
sStrArray[i] = sKeyword[nTypeArray[i]];
}
+ else if (sStrArray[i].GetChar(0) >= '0' &&
+ sStrArray[i].GetChar(0) <= '9')
+ {
+ rtl::OUString sDiv;
+ USHORT j = i;
+ while(j < nAnzStrings)
+ sDiv += sStrArray[j++];
+ if (rtl::OUString::valueOf(sDiv.toInt32()) == sDiv)
+ {
+ /* Found a Divisor */
+ sal_Int32 nDiv = sDiv.toInt32();
+ while (i < j)
+ nTypeArray[i++] = NF_SYMBOLTYPE_FRAC_FDIV;
+ i = j - 1; // Stop the loop
+ if (nCntPost)
+ nCounter = nCntPost;
+ else if (nCntPre)
+ nCounter = nCntPre;
+ }
+ }
else
nTypeArray[i] = NF_SYMBOLTYPE_STRING;
nPos = nPos + sStrArray[i].Len();
@@ -2748,7 +2756,6 @@ xub_StrLen ImpSvNumberformatScan::FinalScan( String& rString, String& rComment )
return 0;
}
-
xub_StrLen ImpSvNumberformatScan::RemoveQuotes( String& rStr )
{
if ( rStr.Len() > 1 )
@@ -2770,7 +2777,6 @@ xub_StrLen ImpSvNumberformatScan::RemoveQuotes( String& rStr )
return 0;
}
-
xub_StrLen ImpSvNumberformatScan::ScanFormat( String& rString, String& rComment )
{
xub_StrLen res = Symbol_Division(rString); //lexikalische Analyse
@@ -2805,5 +2811,4 @@ void ImpSvNumberformatScan::CopyInfo(ImpSvNumberformatInfo* pInfo, USHORT nAnz)
pInfo->nCntExp = nCntExp;
}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */