diff options
author | Eike Rathke <erack@erack.de> | 2011-08-11 17:22:14 +0200 |
---|---|---|
committer | Eike Rathke <erack@erack.de> | 2011-08-12 18:39:08 +0200 |
commit | 25027d0ba3b5c6fc421330a3157330545c05d7bc (patch) | |
tree | 94f10f60efa3b660132d627f620674ea847001de /svl | |
parent | c19090dd1f4cef9699d80f87db4253a8b25294d9 (diff) |
removed unused stuff from number formatter
Diffstat (limited to 'svl')
-rw-r--r-- | svl/inc/svl/nfsymbol.hxx | 21 | ||||
-rw-r--r-- | svl/inc/svl/zforlist.hxx | 10 | ||||
-rw-r--r-- | svl/inc/svl/zformat.hxx | 14 | ||||
-rw-r--r-- | svl/source/numbers/zforlist.cxx | 58 | ||||
-rw-r--r-- | svl/source/numbers/zformat.cxx | 122 | ||||
-rw-r--r-- | svl/source/numbers/zforscan.cxx | 68 | ||||
-rw-r--r-- | svl/source/numbers/zforscan.hxx | 6 |
7 files changed, 32 insertions, 267 deletions
diff --git a/svl/inc/svl/nfsymbol.hxx b/svl/inc/svl/nfsymbol.hxx index 57b2ddde339e..de11c6d8830e 100644 --- a/svl/inc/svl/nfsymbol.hxx +++ b/svl/inc/svl/nfsymbol.hxx @@ -53,17 +53,16 @@ enum NfSymbolType NF_SYMBOLTYPE_FRAC = -9, // fraction / NF_SYMBOLTYPE_EMPTY = -10, // deleted symbols NF_SYMBOLTYPE_FRACBLANK = -11, // delimiter between integer and fraction - NF_SYMBOLTYPE_COMMENT = -12, // comment is following - NF_SYMBOLTYPE_CURRENCY = -13, // currency symbol - NF_SYMBOLTYPE_CURRDEL = -14, // currency symbol delimiter [$] - NF_SYMBOLTYPE_CURREXT = -15, // currency symbol extension -xxx - NF_SYMBOLTYPE_CALENDAR = -16, // calendar ID - NF_SYMBOLTYPE_CALDEL = -17, // calendar delimiter [~] - NF_SYMBOLTYPE_DATESEP = -18, // date separator - NF_SYMBOLTYPE_TIMESEP = -19, // time separator - NF_SYMBOLTYPE_TIME100SECSEP = -20, // time 100th seconds separator - NF_SYMBOLTYPE_PERCENT = -21, // percent % - NF_SYMBOLTYPE_FRAC_FDIV = -22 // forced divisors + NF_SYMBOLTYPE_CURRENCY = -12, // currency symbol + NF_SYMBOLTYPE_CURRDEL = -13, // currency symbol delimiter [$] + NF_SYMBOLTYPE_CURREXT = -14, // currency symbol extension -xxx + NF_SYMBOLTYPE_CALENDAR = -15, // calendar ID + NF_SYMBOLTYPE_CALDEL = -16, // calendar delimiter [~] + NF_SYMBOLTYPE_DATESEP = -17, // date separator + NF_SYMBOLTYPE_TIMESEP = -18, // time separator + NF_SYMBOLTYPE_TIME100SECSEP = -19, // time 100th seconds separator + NF_SYMBOLTYPE_PERCENT = -20, // percent % + NF_SYMBOLTYPE_FRAC_FDIV = -21 // forced divisors }; } // namespace svt diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx index 34deb795f197..c27f7795b745 100644 --- a/svl/inc/svl/zforlist.hxx +++ b/svl/inc/svl/zforlist.hxx @@ -354,9 +354,6 @@ public: LanguageType eLang ); - /// Depricated ctor without service manager - SvNumberFormatter( LanguageType eLang ); - ~SvNumberFormatter(); /// Set CallBack to ColorTable @@ -544,18 +541,11 @@ public: /// Whether format index nFIndex is of type text or not bool IsTextFormat(sal_uInt32 nFIndex) const; - /// Whether the 4th string subcode of format index nFIndex is present - bool HasTextFormat(sal_uInt32 nFIndex) const; /// Load all formats from a stream bool Load( SvStream& rStream ); /// Save all formats to a stream bool Save( SvStream& rStream ) const; - /// Reset of "Used" flags - void PrepareSave(); - - /// Flag format index as used - void SetFormatUsed(sal_uInt32 nFIndex); /// Get additional info of a format index, e.g. for dialog box void GetFormatSpecialInfo(sal_uInt32 nFormat, bool& bThousand, bool& IsRed, diff --git a/svl/inc/svl/zformat.hxx b/svl/inc/svl/zformat.hxx index 68095ca7be0e..b534f97be002 100644 --- a/svl/inc/svl/zformat.hxx +++ b/svl/inc/svl/zformat.hxx @@ -40,9 +40,6 @@ #include "zforscan.hxx" #endif -// If comment field is also in format code string, was used for SUPD versions 371-372 -#define NF_COMMENT_IN_FORMATSTRING 0 - namespace utl { class DigitGroupingIterator; } @@ -387,20 +384,9 @@ public: sal_Unicode cEscIn = '\0', sal_Unicode cEscOut = '\\' ); void SetComment( const String& rStr ) -#if NF_COMMENT_IN_FORMATSTRING - { SetComment( rStr, sFormatstring, sComment ); } -#else { sComment = rStr; } -#endif const String& GetComment() const { return sComment; } - // Erase "{ "..." }" from format subcode string to get the pure comment (old version) - static void EraseCommentBraces( String& rStr ); - // Set comment rStr in format string rFormat and in rComment (old version) - static void SetComment( const String& rStr, String& rFormat, String& rComment ); - // Erase comment at end of rStr to get pure format code string (old version) - static void EraseComment( String& rStr ); - /** Insert the number of blanks into the string that is needed to simulate the width of character c for underscore formats */ static xub_StrLen InsertBlanks( String& r, xub_StrLen nPos, sal_Unicode c ); diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 9242e76a792d..5bbaf8faca14 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -207,12 +207,6 @@ SvNumberFormatter::SvNumberFormatter( } -SvNumberFormatter::SvNumberFormatter( LanguageType eLang ) -{ - ImpConstruct( eLang ); -} - - SvNumberFormatter::~SvNumberFormatter() { { @@ -484,15 +478,6 @@ bool SvNumberFormatter::IsTextFormat(sal_uInt32 F_Index) const return pFormat->IsTextFormat(); } -bool SvNumberFormatter::HasTextFormat(sal_uInt32 F_Index) const -{ - SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(F_Index); - if (!pFormat) - return false; - else - return pFormat->HasTextFormat(); -} - bool SvNumberFormatter::PutEntry(String& rString, xub_StrLen& nCheckPos, short& nType, @@ -681,23 +666,6 @@ void SvNumberFormatter::DeleteEntry(sal_uInt32 nKey) delete pEntry; } -void SvNumberFormatter::PrepareSave() -{ - SvNumberformat* pFormat = aFTable.First(); - while (pFormat) - { - pFormat->SetUsed(false); - pFormat = aFTable.Next(); - } -} - -void SvNumberFormatter::SetFormatUsed(sal_uInt32 nFIndex) -{ - SvNumberformat* pFormat = (SvNumberformat*) aFTable.Get(nFIndex); - if (pFormat) - pFormat->SetUsed(true); -} - bool SvNumberFormatter::Load( SvStream& rStream ) { LanguageType eSysLang = SvtSysLocale().GetLanguage(); @@ -1004,42 +972,16 @@ sal_uInt32 SvNumberFormatter::ImpIsEntry(const String& rString, sal_uInt32 nCLOffset, LanguageType eLnge) { -#ifndef NF_COMMENT_IN_FORMATSTRING -#error NF_COMMENT_IN_FORMATSTRING not defined (zformat.hxx) -#endif -#if NF_COMMENT_IN_FORMATSTRING - String aStr( rString ); - SvNumberformat::EraseComment( aStr ); -#endif sal_uInt32 res = NUMBERFORMAT_ENTRY_NOT_FOUND; SvNumberformat* pEntry; pEntry = (SvNumberformat*) aFTable.Seek(nCLOffset); while ( res == NUMBERFORMAT_ENTRY_NOT_FOUND && pEntry && pEntry->GetLanguage() == eLnge ) { -#if NF_COMMENT_IN_FORMATSTRING - if ( pEntry->GetComment().Len() ) - { - String aFormat( pEntry->GetFormatstring() ); - SvNumberformat::EraseComment( aFormat ); - if ( aStr == aFormat ) - res = aFTable.GetCurKey(); - else - pEntry = (SvNumberformat*) aFTable.Next(); - } - else - { - if ( aStr == pEntry->GetFormatstring() ) - res = aFTable.GetCurKey(); - else - pEntry = (SvNumberformat*) aFTable.Next(); - } -#else if ( rString == pEntry->GetFormatstring() ) res = aFTable.GetCurKey(); else pEntry = (SvNumberformat*) aFTable.Next(); -#endif } return res; } diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 132051ab37b3..0a5e823b8a53 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -246,6 +246,11 @@ sal_uInt8 SvNumberNatNum::MapDBNumToNatNum( sal_uInt8 nDBNum, LanguageType eLang return nNatNum; } + +/* XXX NOTE: even though the MapNatNumToDBNum method is currently unused please + * don't remove it in case we'd have to use it for some obscure exports to + * Excel. */ + // static sal_uInt8 SvNumberNatNum::MapNatNumToDBNum( sal_uInt8 nNatNum, LanguageType eLang, bool bDate ) { @@ -682,7 +687,6 @@ SvNumberformat::SvNumberformat(String& rString, xub_StrLen nPos = 0; xub_StrLen nPosOld; nCheckPos = 0; - String aComment; // Split into 4 sub formats sal_uInt16 nIndex; @@ -940,7 +944,7 @@ SvNumberformat::SvNumberformat(String& rString, if (sInsertCalendar.Len()) sStr.Insert( sInsertCalendar, 0); - xub_StrLen nStrPos = pSc->ScanFormat( sStr, aComment ); + xub_StrLen nStrPos = pSc->ScanFormat( sStr ); sal_uInt16 nAnz = pSc->GetAnzResStrings(); if (nAnz == 0) // error nStrPos = 1; @@ -1050,8 +1054,7 @@ SvNumberformat::SvNumberformat(String& rString, rString.GetChar(rString.Len()-1) != ';' ) { // No format code => GENERAL but not if specified empty String aAdd( pSc->GetStandardName() ); - String aTmp; - if ( !pSc->ScanFormat( aAdd, aTmp ) ) + if ( !pSc->ScanFormat( aAdd ) ) { sal_uInt16 nAnz = pSc->GetAnzResStrings(); if ( nAnz ) @@ -1069,8 +1072,7 @@ SvNumberformat::SvNumberformat(String& rString, { // No trailing second subformat => GENERAL but not if specified empty // and not if first subformat is GENERAL String aAdd( pSc->GetStandardName() ); - String aTmp; - if ( !pSc->ScanFormat( aAdd, aTmp ) ) + if ( !pSc->ScanFormat( aAdd ) ) { sal_uInt16 nAnz = pSc->GetAnzResStrings(); if ( nAnz ) @@ -1087,8 +1089,7 @@ SvNumberformat::SvNumberformat(String& rString, eOp2 != NUMBERFORMAT_OP_NO ) { // No trailing third subformat => GENERAL but not if specified empty String aAdd( pSc->GetStandardName() ); - String aTmp; - if ( !pSc->ScanFormat( aAdd, aTmp ) ) + if ( !pSc->ScanFormat( aAdd ) ) { sal_uInt16 nAnz = pSc->GetAnzResStrings(); if ( nAnz ) @@ -1102,11 +1103,7 @@ SvNumberformat::SvNumberformat(String& rString, } } sFormatstring = rString; - if ( aComment.Len() ) - { - SetComment( aComment ); // setzt sComment und sFormatstring - rString = sFormatstring; // geaenderten sFormatstring uebernehmen - } + if (NumFor[2].GetCount() == 0 && // kein 3. Teilstring eOp1 == NUMBERFORMAT_OP_GT && eOp2 == NUMBERFORMAT_OP_NO && fLimit1 == 0.0 && fLimit2 == 0.0) @@ -1801,12 +1798,6 @@ void SvNumberformat::Save( SvStream& rStream, ImpSvNumMultipleWriteHeader& rHdr { String aFormatstring( sFormatstring ); String aComment( sComment ); -#if NF_COMMENT_IN_FORMATSTRING - // der Kommentar im Formatstring wird nicht gespeichert, um in alten Versionen - // nicht ins schleudern zu kommen und spaeter getrennte Verarbeitung - // (z.B. im Dialog) zu ermoeglichen - SetComment( "", aFormatstring, aComment ); -#endif bool bNewCurrency = HasNewCurrency(); if ( bNewCurrency ) @@ -3040,6 +3031,12 @@ bool SvNumberformat::ImpFallBackToGregorianCalendar( String& rOrgCalendar, doubl return false; } + +/* XXX NOTE: even if the ImpSwitchToSpecifiedCalendar method is currently + * unused please don't remove it, it would be needed by + * SwitchToSpecifiedCalendar(), see comment in + * ImpSvNumberInputScan::GetDateRef() */ + bool SvNumberformat::ImpSwitchToSpecifiedCalendar( String& rOrgCalendar, double& fOrgDateTime, const ImpSvNumFor& rNumFor ) const { @@ -4628,93 +4625,6 @@ bool SvNumberformat::HasStringNegativeSign( const String& rStr ) } // static -void SvNumberformat::SetComment( const String& rStr, String& rFormat, - String& rComment ) -{ - if ( rComment.Len() ) - { // alten Kommentar aus Formatstring loeschen - //! nicht per EraseComment, der Kommentar muss matchen - String aTmp( '{' ); - aTmp += ' '; - aTmp += rComment; - aTmp += ' '; - aTmp += '}'; - xub_StrLen nCom = 0; - do - { - nCom = rFormat.Search( aTmp, nCom ); - } while ( (nCom != STRING_NOTFOUND) && (nCom + aTmp.Len() != rFormat.Len()) ); - if ( nCom != STRING_NOTFOUND ) - rFormat.Erase( nCom ); - } - if ( rStr.Len() ) - { // neuen Kommentar setzen - rFormat += '{'; - rFormat += ' '; - rFormat += rStr; - rFormat += ' '; - rFormat += '}'; - rComment = rStr; - } -} - -// static -void SvNumberformat::EraseCommentBraces( String& rStr ) -{ - xub_StrLen nLen = rStr.Len(); - if ( nLen && rStr.GetChar(0) == '{' ) - { - rStr.Erase( 0, 1 ); - --nLen; - } - if ( nLen && rStr.GetChar(0) == ' ' ) - { - rStr.Erase( 0, 1 ); - --nLen; - } - if ( nLen && rStr.GetChar( nLen-1 ) == '}' ) - rStr.Erase( --nLen, 1 ); - if ( nLen && rStr.GetChar( nLen-1 ) == ' ' ) - rStr.Erase( --nLen, 1 ); -} - -// static -void SvNumberformat::EraseComment( String& rStr ) -{ - register const sal_Unicode* p = rStr.GetBuffer(); - bool bInString = false; - bool bEscaped = false; - bool bFound = false; - xub_StrLen nPos = 0; - while ( !bFound && *p ) - { - switch ( *p ) - { - case '\\' : - bEscaped = !bEscaped; - break; - case '\"' : - if ( !bEscaped ) - bInString = !bInString; - break; - case '{' : - if ( !bEscaped && !bInString ) - { - bFound = true; - nPos = sal::static_int_cast< xub_StrLen >( - p - rStr.GetBuffer()); - } - break; - } - if ( bEscaped && *p != '\\' ) - bEscaped = false; - ++p; - } - if ( bFound ) - rStr.Erase( nPos ); -} - -// static bool SvNumberformat::IsInQuote( const String& rStr, xub_StrLen nPos, sal_Unicode cQuote, sal_Unicode cEscIn, sal_Unicode cEscOut ) { diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx index 29a0f9bd451d..4e10ddc0cabc 100644 --- a/svl/source/numbers/zforscan.cxx +++ b/svl/source/numbers/zforscan.cxx @@ -588,7 +588,6 @@ short ImpSvNumberformatScan::GetKeyWord( const String& sSymbol, xub_StrLen nPos // | @ # 0 ? / . , % [ | Symbol = Zeichen; | // | ] ' Blank | Typ = Steuerzeichen | SsStop // | $ - + ( ) : | Typ = String; | -// | | | Typ = Comment | SsStop // | Sonst | Symbol = Zeichen | SsStop //---------------|-------------------+-----------------------+--------------- // SsGetChar | Sonst | Symbol=Zeichen | SsStop @@ -697,14 +696,6 @@ short ImpSvNumberformatScan::Next_Symbol( const String& rStr, eState = SsGetBlank; } break; -#if NF_COMMENT_IN_FORMATSTRING - case '{': - eType = NF_SYMBOLTYPE_COMMENT; - eState = SsStop; - sSymbol.Append( rStr.GetBuffer() + (nPos-1), rStr.Len() - (nPos-1) ); - nPos = rStr.Len(); - break; -#endif case '"': eType = NF_SYMBOLTYPE_STRING; eState = SsGetString; @@ -1463,7 +1454,7 @@ int ImpSvNumberformatScan::FinalScanGetCalendar( xub_StrLen& nPos, sal_uInt16& i return 0; } -xub_StrLen ImpSvNumberformatScan::FinalScan( String& rString, String& rComment ) +xub_StrLen ImpSvNumberformatScan::FinalScan( String& rString ) { const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData(); @@ -1516,16 +1507,6 @@ xub_StrLen ImpSvNumberformatScan::FinalScan( String& rString, String& rComment ) case NF_SYMBOLTYPE_BLANK: case NF_SYMBOLTYPE_STAR: break; - case NF_SYMBOLTYPE_COMMENT: - { - String& rStr = sStrArray[i]; - nPos = nPos + rStr.Len(); - SvNumberformat::EraseCommentBraces( rStr ); - rComment += rStr; - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - } - break; case NF_KEY_GENERAL : // #77026# "General" is the same as "@" break; default: @@ -2031,16 +2012,6 @@ xub_StrLen ImpSvNumberformatScan::FinalScan( String& rString, String& rComment ) break; } // of switch (Del) } // of else Del - else if ( nTypeArray[i] == NF_SYMBOLTYPE_COMMENT ) - { - String& rStr = sStrArray[i]; - nPos = nPos + rStr.Len(); - SvNumberformat::EraseCommentBraces( rStr ); - rComment += rStr; - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - i++; - } else { DBG_ERRORFILE( "unknown NF_SYMBOLTYPE_..." ); @@ -2147,17 +2118,6 @@ xub_StrLen ImpSvNumberformatScan::FinalScan( String& rString, String& rComment ) nPos = nPos + sStrArray[i].Len(); i++; break; - case NF_SYMBOLTYPE_COMMENT: - { - String& rStr = sStrArray[i]; - nPos = nPos + rStr.Len(); - SvNumberformat::EraseCommentBraces( rStr ); - rComment += rStr; - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - i++; - } - break; case NF_SYMBOLTYPE_DEL: { int nCalRet; @@ -2325,17 +2285,6 @@ xub_StrLen ImpSvNumberformatScan::FinalScan( String& rString, String& rComment ) i++; } break; - case NF_SYMBOLTYPE_COMMENT: - { - String& rStr = sStrArray[i]; - nPos = nPos + rStr.Len(); - SvNumberformat::EraseCommentBraces( rStr ); - rComment += rStr; - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - i++; - } - break; case NF_KEY_AMPM: // AM/PM case NF_KEY_AP: // A/P { @@ -2387,17 +2336,6 @@ xub_StrLen ImpSvNumberformatScan::FinalScan( String& rString, String& rComment ) nPos = nPos + sStrArray[i].Len(); i++; break; - case NF_SYMBOLTYPE_COMMENT: - { - String& rStr = sStrArray[i]; - nPos = nPos + rStr.Len(); - SvNumberformat::EraseCommentBraces( rStr ); - rComment += rStr; - nTypeArray[i] = NF_SYMBOLTYPE_EMPTY; - nAnzResStrings--; - i++; - } - break; case NF_SYMBOLTYPE_DEL: { int nCalRet; @@ -2776,13 +2714,13 @@ xub_StrLen ImpSvNumberformatScan::RemoveQuotes( String& rStr ) return 0; } -xub_StrLen ImpSvNumberformatScan::ScanFormat( String& rString, String& rComment ) +xub_StrLen ImpSvNumberformatScan::ScanFormat( String& rString ) { xub_StrLen res = Symbol_Division(rString); //lexikalische Analyse if (!res) res = ScanType(rString); // Erkennung des Formattyps if (!res) - res = FinalScan( rString, rComment ); // Typabhaengige Endanalyse + res = FinalScan( rString ); // Typabhaengige Endanalyse return res; // res = Kontrollposition // res = 0 => Format ok } diff --git a/svl/source/numbers/zforscan.hxx b/svl/source/numbers/zforscan.hxx index 45892913ae47..b34a5afdeda8 100644 --- a/svl/source/numbers/zforscan.hxx +++ b/svl/source/numbers/zforscan.hxx @@ -57,7 +57,7 @@ public: // tauscht Referenzdatum aus void ChangeStandardPrec(sal_uInt16 nPrec); // tauscht Standardprecision aus - xub_StrLen ScanFormat( String& rString, String& rComment ); // Aufruf der Scan-Analyse + xub_StrLen ScanFormat( String& rString ); // Aufruf der Scan-Analyse void CopyInfo(ImpSvNumberformatInfo* pInfo, sal_uInt16 nAnz); // Kopiert die FormatInfo @@ -250,8 +250,8 @@ private: // ---- privater Teil String& sSymbol); // Naechstes Symbol xub_StrLen Symbol_Division(const String& rString);// lexikalische Voranalyse xub_StrLen ScanType(const String& rString); // Analyse des Formattyps - xub_StrLen FinalScan( String& rString, String& rComment ); // Endanalyse mit Vorgabe - // des Typs + xub_StrLen FinalScan( String& rString ); // Endanalyse mit Vorgabe des Typs + // -1:= error, return nPos in FinalScan; 0:= no calendar, 1:= calendar found int FinalScanGetCalendar( xub_StrLen& nPos, sal_uInt16& i, sal_uInt16& nAnzResStrings ); |