1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SVL_ZFORMAT_HXX
20 #define INCLUDED_SVL_ZFORMAT_HXX
22 #include <svl/svldllapi.h>
23 #include <i18nlangtag/mslangid.hxx>
24 #include <svl/zforlist.hxx>
25 #include <svl/nfkeytab.hxx>
28 class DigitGroupingIterator
;
33 class ImpSvNumberformatScan
; // format code string scanner
34 class ImpSvNumberInputScan
; // input string scanner
35 class SvNumberFormatter
;
37 enum SvNumberformatLimitOps
39 NUMBERFORMAT_OP_NO
= 0, // Undefined, no OP
40 NUMBERFORMAT_OP_EQ
= 1, // Operator =
41 NUMBERFORMAT_OP_NE
= 2, // Operator <>
42 NUMBERFORMAT_OP_LT
= 3, // Operator <
43 NUMBERFORMAT_OP_LE
= 4, // Operator <=
44 NUMBERFORMAT_OP_GT
= 5, // Operator >
45 NUMBERFORMAT_OP_GE
= 6 // Operator >=
48 // SYSTEM-german to SYSTEM-xxx and vice versa conversion hack onLoad
52 NF_CONVERT_GERMAN_ENGLISH
,
53 NF_CONVERT_ENGLISH_GERMAN
56 struct ImpSvNumberformatInfo
// Struct for FormatInfo
58 OUString
* sStrArray
; // Array of symbols
59 short* nTypeArray
; // Array of infos
60 sal_uInt16 nThousand
; // Count of group separator sequences
61 sal_uInt16 nCntPre
; // Count of digits before decimal point
62 sal_uInt16 nCntPost
; // Count of digits after decimal point
63 sal_uInt16 nCntExp
; // Count of exponent digits, or AM/PM
64 short eScannedType
; // Type determined by scan
65 bool bThousand
; // Has group (AKA thousand) separator
67 void Copy( const ImpSvNumberformatInfo
& rNumFor
, sal_uInt16 nAnz
);
70 // NativeNumber, represent numbers using CJK or other digits if nNum>0,
71 // eLang specifies the Locale to use.
76 bool bDBNum
:1; // DBNum, to be converted to NatNum
77 bool bDate
:1; // Used in date? (needed for DBNum/NatNum mapping)
78 bool bSet
:1; // If set, since NatNum0 is possible
82 static sal_uInt8
MapDBNumToNatNum( sal_uInt8 nDBNum
, LanguageType eLang
, bool bDate
);
84 static sal_uInt8
MapNatNumToDBNum( sal_uInt8 nNatNum
, LanguageType eLang
, bool bDate
);
87 SvNumberNatNum() : eLang( LANGUAGE_DONTKNOW
), nNum(0),
88 bDBNum(false), bDate(false), bSet(false) {}
89 bool IsComplete() const { return bSet
&& eLang
!= LANGUAGE_DONTKNOW
; }
90 sal_uInt8
GetRawNum() const { return nNum
; }
91 sal_uInt8
GetNatNum() const { return bDBNum
? MapDBNumToNatNum( nNum
, eLang
, bDate
) : nNum
; }
93 sal_uInt8
GetDBNum() const { return bDBNum
? nNum
: MapNatNumToDBNum( nNum
, eLang
, bDate
); }
95 LanguageType
GetLang() const { return eLang
; }
96 void SetLang( LanguageType e
) { eLang
= e
; }
97 void SetNum( sal_uInt8 nNumber
, bool bDBNumber
)
103 bool IsSet() const { return bSet
; }
104 void SetDate( bool bDateP
) { bDate
= bDateP
; }
109 class ImpSvNumFor
// One of four subformats of the format code string
112 ImpSvNumFor(); // Ctor without filling the Info
115 void Enlarge(sal_uInt16 nAnz
); // Init of arrays to the right size
117 // if pSc is set, it is used to get the Color pointer
118 void Copy( const ImpSvNumFor
& rNumFor
, ImpSvNumberformatScan
* pSc
);
120 // Access to Info; call Enlarge before!
121 ImpSvNumberformatInfo
& Info() { return aI
;}
122 const ImpSvNumberformatInfo
& Info() const { return aI
; }
124 // Get count of substrings (symbols)
125 sal_uInt16
GetCount() const { return nAnzStrings
;}
127 Color
* GetColor() const { return pColor
; }
128 void SetColor( Color
* pCol
, OUString
& rName
)
129 { pColor
= pCol
; sColorName
= rName
; }
130 const OUString
& GetColorName() const { return sColorName
; }
132 // new SYMBOLTYPE_CURRENCY in subformat?
133 bool HasNewCurrency() const;
134 bool GetNewCurrencySymbol( OUString
& rSymbol
, OUString
& rExtension
) const;
136 // [NatNum1], [NatNum2], ...
137 void SetNatNumNum( sal_uInt8 nNum
, bool bDBNum
) { aNatNum
.SetNum( nNum
, bDBNum
); }
138 void SetNatNumLang( LanguageType eLang
) { aNatNum
.SetLang( eLang
); }
139 void SetNatNumDate( bool bDate
) { aNatNum
.SetDate( bDate
); }
140 const SvNumberNatNum
& GetNatNum() const { return aNatNum
; }
143 ImpSvNumberformatInfo aI
; // helper struct for remaining information
144 OUString sColorName
; // color name
145 Color
* pColor
; // pointer to color of subformat
146 sal_uInt16 nAnzStrings
; // count of symbols
147 SvNumberNatNum aNatNum
; // DoubleByteNumber
151 class SVL_DLLPUBLIC SvNumberformat
155 sal_uInt8 mnNumeralShape
;
156 sal_uInt8 mnCalendarType
;
157 LanguageType meLanguage
;
159 OUString
generateCode() const;
162 LocaleType(sal_uInt32 nRawCode
);
167 SvNumberformat( OUString
& rString
,
168 ImpSvNumberformatScan
* pSc
,
169 ImpSvNumberInputScan
* pISc
,
170 sal_Int32
& nCheckPos
,
172 bool bStand
= false );
175 SvNumberformat( SvNumberformat
& rFormat
);
177 // Copy ctor with exchange of format code string scanner (used in merge)
178 SvNumberformat( SvNumberformat
& rFormat
, ImpSvNumberformatScan
& rSc
);
182 /// Get type of format, may include css::util::NumberFormat::DEFINED bit
183 short GetType() const { return eType
; }
185 void SetType(const short eSetType
) { eType
= eSetType
; }
186 // Standard means the I18N defined standard format of this type
187 void SetStandard() { bStandard
= true; }
188 bool IsStandard() const { return bStandard
; }
190 // If this format is an additional built-in format defined by i18n.
191 void SetAdditionalBuiltin() { bAdditionalBuiltin
= true; }
192 bool IsAdditionalBuiltin() const { return bAdditionalBuiltin
; }
194 LanguageType
GetLanguage() const { return maLocale
.meLanguage
;}
196 const OUString
& GetFormatstring() const { return sFormatstring
; }
198 // Build a format string of application defined keywords
199 OUString
GetMappedFormatstring( const NfKeywordTable
& rKeywords
,
200 const LocaleDataWrapper
& rLoc
,
201 bool bDontQuote
= false ) const;
203 void SetUsed(const bool b
) { bIsUsed
= b
; }
204 bool GetUsed() const { return bIsUsed
; }
205 bool IsStarFormatSupported() const { return bStarFlag
; }
206 void SetStarFormatSupport( bool b
) { bStarFlag
= b
; }
209 * Get output string from a numeric value that fits the number of
210 * characters specified.
212 bool GetOutputString( double fNumber
, sal_uInt16 nCharCount
, OUString
& rOutString
) const;
214 bool GetOutputString( double fNumber
, OUString
& OutString
, Color
** ppColor
);
215 bool GetOutputString( const OUString
& sString
, OUString
& OutString
, Color
** ppColor
);
218 bool IsTextFormat() const { return (eType
& css::util::NumberFormat::TEXT
) != 0; }
219 // True if 4th subformat present
220 bool HasTextFormat() const
222 return (NumFor
[3].GetCount() > 0) ||
223 (NumFor
[3].Info().eScannedType
== css::util::NumberFormat::TEXT
);
226 void GetFormatSpecialInfo(bool& bThousand
,
228 sal_uInt16
& nPrecision
,
229 sal_uInt16
& nAnzLeading
) const;
231 /// Count of decimal precision
232 sal_uInt16
GetFormatPrecision() const { return NumFor
[0].Info().nCntPost
; }
234 /// Count of integer digits
235 sal_uInt16
GetFormatIntegerDigits() const { return NumFor
[0].Info().nCntPre
; }
237 //! Read/write access on a special sal_uInt16 component, may only be used on the
238 //! standard format 0, 5000, ... and only by the number formatter!
239 sal_uInt16
GetLastInsertKey() const
240 { return NumFor
[0].Info().nThousand
; }
241 void SetLastInsertKey(sal_uInt16 nKey
)
242 { NumFor
[0].Info().nThousand
= nKey
; }
244 //! Only onLoad: convert from stored to current system language/country
245 void ConvertLanguage( SvNumberFormatter
& rConverter
,
246 LanguageType eConvertFrom
, LanguageType eConvertTo
, bool bSystem
= false );
248 // Substring of a subformat code nNumFor (0..3)
249 // nPos == 0xFFFF => last substring
250 // bString==true: first/last SYMBOLTYPE_STRING or SYMBOLTYPE_CURRENCY
251 const OUString
* GetNumForString( sal_uInt16 nNumFor
, sal_uInt16 nPos
,
252 bool bString
= false ) const;
254 // Subtype of a subformat code nNumFor (0..3)
255 // nPos == 0xFFFF => last substring
256 // bString==true: first/last SYMBOLTYPE_STRING or SYMBOLTYPE_CURRENCY
257 short GetNumForType( sal_uInt16 nNumFor
, sal_uInt16 nPos
, bool bString
= false ) const;
259 sal_Int32
GetForcedDenominatorForType( sal_uInt16 nNumFor
) const;
260 /** If the count of string elements (substrings, ignoring [modifiers] and
261 so on) in a subformat code nNumFor (0..3) is equal to the given number.
262 Used by ImpSvNumberInputScan::IsNumberFormatMain() to detect a matched
264 bool IsNumForStringElementCountEqual( sal_uInt16 nNumFor
, sal_uInt16 nAllCount
,
265 sal_uInt16 nNumCount
) const
269 // First try a simple approach. Note that this is called only
270 // if all MidStrings did match so far, to verify that all
271 // strings of the format were matched and not just the starting
272 // sequence, so we don't have to check if GetnAnz() includes
273 // [modifiers] or anything else if both counts are equal.
274 sal_uInt16 nCnt
= NumFor
[nNumFor
].GetCount();
275 if ( nAllCount
== nCnt
)
277 if ( nAllCount
< nCnt
) // check ignoring [modifiers] and so on
278 return ImpGetNumForStringElementCount( nNumFor
) ==
279 (nAllCount
- nNumCount
);
284 // Whether the second subformat code is really for negative numbers
285 // or another limit set.
286 bool IsSecondSubformatRealNegative() const
288 return fLimit1
== 0.0 && fLimit2
== 0.0 &&
289 ( (eOp1
== NUMBERFORMAT_OP_GE
&& eOp2
== NUMBERFORMAT_OP_NO
) ||
290 (eOp1
== NUMBERFORMAT_OP_GT
&& eOp2
== NUMBERFORMAT_OP_LT
) ||
291 (eOp1
== NUMBERFORMAT_OP_NO
&& eOp2
== NUMBERFORMAT_OP_NO
) );
294 // Whether the first subformat code is really for negative numbers
295 // or another limit set.
296 bool IsFirstSubformatRealNegative() const
298 return fLimit1
== 0.0 && fLimit2
== 0.0 &&
299 ((eOp1
== NUMBERFORMAT_OP_LT
&&
300 (eOp2
== NUMBERFORMAT_OP_GT
|| eOp2
== NUMBERFORMAT_OP_EQ
||
301 eOp2
== NUMBERFORMAT_OP_GE
|| eOp2
== NUMBERFORMAT_OP_NO
)) ||
302 (eOp1
== NUMBERFORMAT_OP_LE
&&
303 (eOp2
== NUMBERFORMAT_OP_NO
|| eOp2
== NUMBERFORMAT_OP_GT
)));
306 // Whether the negative format is without a sign or not
307 bool IsNegativeWithoutSign() const;
309 bool IsNegativeInBracket() const;
311 bool HasPositiveBracketPlaceholder() const;
313 // Whether a new SYMBOLTYPE_CURRENCY is contained in the format
314 bool HasNewCurrency() const;
316 // strip [$-yyy] from all [$xxx-yyy] leaving only xxx's,
317 // if bQuoteSymbol==true the xxx will become "xxx"
318 static OUString
StripNewCurrencyDelimiters( const OUString
& rStr
,
321 // If a new SYMBOLTYPE_CURRENCY is contained if the format is of type
322 // css::util::NumberFormat::CURRENCY, and if so the symbol xxx and the extension nnn
323 // of [$xxx-nnn] are returned
324 bool GetNewCurrencySymbol( OUString
& rSymbol
, OUString
& rExtension
) const;
326 static bool HasStringNegativeSign( const OUString
& rStr
);
329 Whether a character at position nPos is somewhere between two matching
331 If nPos points to a cQuote, a true is returned on an opening cQuote,
332 a false is returned on a closing cQuote.
333 A cQuote between quotes may be escaped by a cEscIn, a cQuote outside of
334 quotes may be escaped by a cEscOut.
335 The default '\0' results in no escapement possible.
336 Defaults are set right according to the "unlogic" of the Numberformatter
338 static bool IsInQuote( const OUString
& rString
, sal_Int32 nPos
,
339 sal_Unicode cQuote
= '"',
340 sal_Unicode cEscIn
= '\0', sal_Unicode cEscOut
= '\\' );
343 Return the position of a matching closing cQuote if the character at
344 position nPos is between two matching cQuote, otherwise return -1.
345 If nPos points to an opening cQuote the position of the matching
346 closing cQuote is returned.
347 If nPos points to a closing cQuote nPos is returned.
348 If nPos points into a part which starts with an opening cQuote but has
349 no closing cQuote, rString.Len() is returned.
350 Uses <method>IsInQuote</method> internally, so you don't have to call
351 that prior to a call of this method.
353 static sal_Int32
GetQuoteEnd( const OUString
& rString
, sal_Int32 nPos
,
354 sal_Unicode cQuote
= '"',
355 sal_Unicode cEscIn
= '\0',
356 sal_Unicode cEscOut
= '\\' );
358 void SetComment( const OUString
& rStr
)
360 const OUString
& GetComment() const { return sComment
; }
362 /** Insert the number of blanks into the string that is needed to simulate
363 the width of character c for underscore formats */
364 static sal_Int32
InsertBlanks( OUString
& r
, sal_Int32 nPos
, sal_Unicode c
)
367 OUStringBuffer
sBuff(r
);
369 result
= InsertBlanks(sBuff
, nPos
, c
);
370 r
= sBuff
.makeStringAndClear();
375 /** Insert the number of blanks into the string that is needed to simulate
376 the width of character c for underscore formats */
377 static sal_Int32
InsertBlanks( OUStringBuffer
& r
, sal_Int32 nPos
, sal_Unicode c
);
379 /// One of YMD,DMY,MDY if date format
380 DateFormat
GetDateOrder() const;
382 /** A coded value of the exact YMD combination used, if date format.
383 For example: YYYY-MM-DD => ('Y' << 16) | ('M' << 8) | 'D'
384 or: MM/YY => ('M' << 8) | 'Y' */
385 sal_uInt32
GetExactDateOrder() const;
387 ImpSvNumberformatScan
& ImpGetScan() const { return rScan
; }
389 // used in XML export
390 void GetConditions( SvNumberformatLimitOps
& rOper1
, double& rVal1
,
391 SvNumberformatLimitOps
& rOper2
, double& rVal2
) const;
392 Color
* GetColor( sal_uInt16 nNumFor
) const;
393 void GetNumForInfo( sal_uInt16 nNumFor
, short& rScannedType
,
394 bool& bThousand
, sal_uInt16
& nPrecision
, sal_uInt16
& nAnzLeading
) const;
396 // rAttr.Number not empty if NatNum attributes are to be stored
398 ::com::sun::star::i18n::NativeNumberXmlAttributes
& rAttr
,
399 sal_uInt16 nNumFor
) const;
401 /** @returns <TRUE/> if E,EE,R,RR,AAA,AAAA in format code of subformat
402 nNumFor (0..3) and <b>no</b> preceding calendar was specified and the
403 currently loaded calendar is "gregorian". */
404 bool IsOtherCalendar( sal_uInt16 nNumFor
) const
407 return ImpIsOtherCalendar( NumFor
[nNumFor
] );
411 /** Switches to the first non-"gregorian" calendar, but only if the current
412 calendar is "gregorian"; original calendar name and date/time returned,
413 but only if calendar switched and rOrgCalendar was empty. */
414 void SwitchToOtherCalendar( OUString
& rOrgCalendar
, double& fOrgDateTime
) const;
416 /** Switches to the "gregorian" calendar, but only if the current calendar
417 is non-"gregorian" and rOrgCalendar is not empty. Thus a preceding
418 ImpSwitchToOtherCalendar() call should have been placed prior to
419 calling this method. */
420 void SwitchToGregorianCalendar( const OUString
& rOrgCalendar
, double fOrgDateTime
) const;
423 /** Switches to the first specified calendar, if any, in subformat nNumFor
424 (0..3). Original calendar name and date/time returned, but only if
425 calendar switched and rOrgCalendar was empty.
428 <TRUE/> if a calendar was specified and switched to,
431 bool SwitchToSpecifiedCalendar( OUString
& rOrgCalendar
, double& fOrgDateTime
,
432 sal_uInt16 nNumFor
) const
435 return ImpSwitchToSpecifiedCalendar( rOrgCalendar
,
436 fOrgDateTime
, NumFor
[nNumFor
] );
441 /// Whether it's a (YY)YY-M(M)-D(D) format.
442 bool IsIso8601( sal_uInt16 nNumFor
)
445 return ImpIsIso8601( NumFor
[nNumFor
]);
450 ImpSvNumFor NumFor
[4]; // Array for the 4 subformats
451 OUString sFormatstring
; // The format code string
452 OUString sComment
; // Comment, since number formatter version 6
453 double fLimit1
; // Value for first condition
454 double fLimit2
; // Value for second condition
455 ImpSvNumberformatScan
& rScan
; // Format code scanner
456 LocaleType maLocale
; // Language/country of the format, numeral shape and calendar type from Excel.
457 SvNumberformatLimitOps eOp1
; // Operator for first condition
458 SvNumberformatLimitOps eOp2
; // Operator for second condition
459 short eType
; // Type of format
460 bool bAdditionalBuiltin
; // If this is an additional built-in format defined by i18n
461 bool bStarFlag
; // Take *n format as ESC n
462 bool bStandard
; // If this is a default standard format
463 bool bIsUsed
; // Flag as used for storing
465 SVL_DLLPRIVATE sal_uInt16
ImpGetNumForStringElementCount( sal_uInt16 nNumFor
) const;
467 SVL_DLLPRIVATE
bool ImpIsOtherCalendar( const ImpSvNumFor
& rNumFor
) const;
470 SVL_DLLPRIVATE
bool ImpSwitchToSpecifiedCalendar( OUString
& rOrgCalendar
,
471 double& fOrgDateTime
,
472 const ImpSvNumFor
& rNumFor
) const;
475 /** Whether to use possessive genitive case month name, or partitive case
476 month name, instead of nominative name (noun).
479 0: execute check <br>
480 set to 1 if nominative case is returned, <br>
481 set to 2 if genitive case is returned, <br>
482 set to 3 if partitive case is returned <br>
483 1: don't execute check, return nominative case <br>
484 2: don't execute check, return genitive case <br>
485 3: don't execute check, return partitive case <br>
488 a NfKeywordIndex, must designate a month type code
490 @returns one of com::sun::star::i18n::CalendarDisplayCode values
491 according to eCodeType and the check executed (or passed).
493 SVL_DLLPRIVATE sal_Int32
ImpUseMonthCase( int & io_nState
, const ImpSvNumFor
& rNumFor
, NfKeywordIndex eCodeType
) const;
495 /// Whether it's a (YY)YY-M(M)-D(D) format.
496 SVL_DLLPRIVATE
bool ImpIsIso8601( const ImpSvNumFor
& rNumFor
);
498 const CharClass
& rChrCls() const;
499 const LocaleDataWrapper
& rLoc() const;
500 CalendarWrapper
& GetCal() const;
501 const SvNumberFormatter
& GetFormatter() const;
503 // divide in substrings and color conditions
504 SVL_DLLPRIVATE
short ImpNextSymbol( OUStringBuffer
& rString
,
508 // read string until ']' and strip blanks (after condition)
509 SVL_DLLPRIVATE
static sal_Int32
ImpGetNumber( OUStringBuffer
& rString
,
514 * Parse the content of '[$-xxx] or '[$-xxxxxxxx]' and extract the locale
515 * type from it. Given the string, start parsing at position specified by
516 * nPos, and store the end position with nPos when the parsing is
517 * complete. The nPos should point to the '$' before the parsing, and to
518 * the closing bracket after the parsing. When the content is [$-xxx],
519 * the xxx part represents the language type (aka LCID) in hex numerals.
520 * When the content is [$-xxxxxxxx] the last 4 digits represent the LCID
521 * (again in hex), the next 2 digits represent the calendar type, and the
522 * 2 highest digits (if exists) is the numeral shape.
525 * http://office.microsoft.com/en-us/excel-help/creating-international-number-formats-HA001034635.aspx
527 * @param rString input string
528 * @param nPos position (see above).
530 * @return struct containing numeral shape, calendar type, and LCID that
531 * specifies language type. See i18nlangtag/lang.h for a complete
532 * list of language types. These numbers also correspond with the
533 * numbers used by Microsoft Office.
535 SVL_DLLPRIVATE
static LocaleType
ImpGetLocaleType( const OUString
& rString
, sal_Int32
& nPos
);
537 /** Obtain calendar and numerals from a LocaleType that was parsed from a
538 LCID with ImpGetLocaleType().
540 Inserts a NatNum modifier to rString at nPos if needed as determined
541 from the numeral code.
543 @ATTENTION: may modify <member>maLocale</member> to make it follow
544 aTmpLocale, in which case also nLang is adapted.
546 @returns a string with the calendar if one was determined from the
547 calendar code, else an empty string. The calendar string needs to be
548 inserted at a proper position to rString after all bracketed prefixes.
550 SVL_DLLPRIVATE OUString
ImpObtainCalendarAndNumerals( OUStringBuffer
& rString
,
552 LanguageType
& nLang
,
553 const LocaleType
& aTmpLocale
);
555 // standard number output
556 SVL_DLLPRIVATE
void ImpGetOutputStandard( double& fNumber
, OUString
& OutString
);
557 SVL_DLLPRIVATE
void ImpGetOutputStandard( double& fNumber
, OUStringBuffer
& OutString
);
558 SVL_DLLPRIVATE
void ImpGetOutputStdToPrecision( double& rNumber
, OUString
& rOutString
, sal_uInt16 nPrecision
) const;
559 // numbers in input line
560 SVL_DLLPRIVATE
void ImpGetOutputInputLine( double fNumber
, OUString
& OutString
);
562 // check subcondition
563 // OP undefined => -1
565 SVL_DLLPRIVATE
short ImpCheckCondition(double& fNumber
,
567 SvNumberformatLimitOps eOp
);
569 SVL_DLLPRIVATE sal_uLong
ImpGGT(sal_uLong x
, sal_uLong y
);
570 SVL_DLLPRIVATE sal_uLong
ImpGGTRound(sal_uLong x
, sal_uLong y
);
572 // Helper function for number strings
573 // append string symbols, insert leading 0 or ' ', or ...
574 SVL_DLLPRIVATE
bool ImpNumberFill( OUStringBuffer
& sStr
,
581 // Helper function to fill in the integer part and the group (AKA thousand) separators
582 SVL_DLLPRIVATE
bool ImpNumberFillWithThousands( OUStringBuffer
& sStr
,
589 // Helper function to fill in the group (AKA thousand) separators
590 // or to skip additional digits
591 SVL_DLLPRIVATE
void ImpDigitFill( OUStringBuffer
& sStr
,
595 sal_Int32
& nDigitCount
,
596 utl::DigitGroupingIterator
& );
598 SVL_DLLPRIVATE
bool ImpDecimalFill( OUStringBuffer
& sStr
,
604 SVL_DLLPRIVATE
bool ImpGetFractionOutput(double fNumber
,
606 OUStringBuffer
& OutString
);
607 SVL_DLLPRIVATE
bool ImpGetScientificOutput(double fNumber
,
609 OUStringBuffer
& OutString
);
611 SVL_DLLPRIVATE
bool ImpGetDateOutput( double fNumber
,
613 OUStringBuffer
& OutString
);
614 SVL_DLLPRIVATE
bool ImpGetTimeOutput( double fNumber
,
616 OUStringBuffer
& OutString
);
617 SVL_DLLPRIVATE
bool ImpGetDateTimeOutput( double fNumber
,
619 OUStringBuffer
& OutString
);
621 // Switches to the "gregorian" calendar if the current calendar is
622 // non-"gregorian" and the era is a "Dummy" era of a calendar which doesn't
623 // know a "before" era (like zh_TW ROC or ja_JP Gengou). If switched and
624 // rOrgCalendar was "gregorian" the string is emptied. If rOrgCalendar was
625 // empty the previous calendar name and date/time are returned.
626 SVL_DLLPRIVATE
bool ImpFallBackToGregorianCalendar( OUString
& rOrgCalendar
, double& fOrgDateTime
);
628 // Append a "G" short era string of the given calendar. In the case of a
629 // Gengou calendar this is a one character abbreviation, for other
630 // calendars the XExtendedCalendar::getDisplayString() method is called.
631 SVL_DLLPRIVATE
static void ImpAppendEraG( OUStringBuffer
& OutStringBuffer
, const CalendarWrapper
& rCal
,
634 SVL_DLLPRIVATE
bool ImpGetNumberOutput( double fNumber
,
636 OUStringBuffer
& OutString
);
638 SVL_DLLPRIVATE
void ImpCopyNumberformat( const SvNumberformat
& rFormat
);
640 // normal digits or other digits, depending on ImpSvNumFor.aNatNum,
641 // [NatNum1], [NatNum2], ...
642 SVL_DLLPRIVATE OUString
ImpGetNatNumString( const SvNumberNatNum
& rNum
, sal_Int32 nVal
,
643 sal_uInt16 nMinDigits
= 0 ) const;
645 OUString
ImpIntToString( sal_uInt16 nIx
, sal_Int32 nVal
, sal_uInt16 nMinDigits
= 0 ) const
647 const SvNumberNatNum
& rNum
= NumFor
[nIx
].GetNatNum();
648 if ( nMinDigits
|| rNum
.IsComplete() )
650 return ImpGetNatNumString( rNum
, nVal
, nMinDigits
);
652 return OUString::number(nVal
);
655 // transliterate according to NativeNumber
656 SVL_DLLPRIVATE OUString
impTransliterateImpl(const OUString
& rStr
, const SvNumberNatNum
& rNum
) const;
657 SVL_DLLPRIVATE
void impTransliterateImpl(OUStringBuffer
& rStr
, const SvNumberNatNum
& rNum
) const;
659 OUString
impTransliterate(const OUString
& rStr
, const SvNumberNatNum
& rNum
) const
661 return rNum
.IsComplete() ? impTransliterateImpl(rStr
, rNum
) : rStr
;
664 SVL_DLLPRIVATE
void impTransliterate(OUStringBuffer
& rStr
, const SvNumberNatNum
& rNum
) const
666 if(rNum
.IsComplete())
668 impTransliterateImpl(rStr
, rNum
);
673 #endif // INCLUDED_SVL_ZFORMAT_HXX
675 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */