xref: /aoo4110/main/svl/inc/svl/nfkeytab.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef INCLUDED_SVTOOLS_NFKEYTAB_HXX
25 #define INCLUDED_SVTOOLS_NFKEYTAB_HXX
26 
27 #include <vector>
28 #include <tools/string.hxx>
29 
30 //! For ImpSvNumberformatScan: first the short symbols, then the long symbols!
31 //! e.g. first TT then TTTT
32 //! The internal order is essentially for the format code string scanner!
33 //! New keywords MUST NOT be inserted, only the NF_KEY_UNUSEDn may be used,
34 //! NF_KEY_LASTKEYWORD must be adjusted accordingly. Otherwise old versions
35 //! will fail upon reading these entries. Nevertheless, old versions are NOT
36 //! able to display those new keywords => blank display.
37 //
38 // Note: 2005-09-02: the above applies to the binary file format.
39 //
40 // ER 15.12.99: This table is externally only to be used with method
41 // String SvNumberformat::GetMappedFormatstring( const NfKeywordTable&, const LocaleDataWrapper& );
42 // and method
43 // void SvNumberFormatter::FillKeywordTable( NfKeywordTable&, LanguageType );
44 enum NfKeywordIndex
45 {
46     NF_KEY_NONE = 0,
47     NF_KEY_E,           // exponential symbol
48     NF_KEY_AMPM,        // AM/PM
49     NF_KEY_AP,          // a/p
50     NF_KEY_MI,          // minute       (!)
51     NF_KEY_MMI,         // minute 02    (!)
52     NF_KEY_M,           // month        (!)
53     NF_KEY_MM,          // month 02     (!)
54     NF_KEY_MMM,         // month short name
55     NF_KEY_MMMM,        // month long name
56     NF_KEY_H,           // hour
57     NF_KEY_HH,          // hour 02
58     NF_KEY_S,           // second
59     NF_KEY_SS,          // second 02
60     NF_KEY_Q,           // quarter
61     NF_KEY_QQ,          // quarter 02
62     NF_KEY_D,           // day of month
63     NF_KEY_DD,          // day of month 02
64     NF_KEY_DDD,         // day of week short
65     NF_KEY_DDDD,        // day of week long
66     NF_KEY_YY,          // year two digits
67     NF_KEY_YYYY,        // year four digits
68     NF_KEY_NN,          // day of week short
69     NF_KEY_NNNN,        // day of week long with separator
70     NF_KEY_CCC,         // currency bank symbol (old version)
71     NF_KEY_GENERAL,     // General / Standard
72     NF_KEY_LASTOLDKEYWORD = NF_KEY_GENERAL,
73     NF_KEY_NNN,         // day of week long without separator, as of version 6, 10.10.97
74     NF_KEY_WW,          // week of year, as of version 8, 19.06.98
75     NF_KEY_MMMMM,       // first letter of month name
76     NF_KEY_LASTKEYWORD = NF_KEY_MMMMM,
77     NF_KEY_UNUSED4,
78     NF_KEY_QUARTER,     // was quarter word, not used anymore from SRC631 on (26.04.01)
79     NF_KEY_TRUE,        // boolean true
80     NF_KEY_FALSE,       // boolean false
81     NF_KEY_BOOLEAN,     // boolean
82     NF_KEY_COLOR,       // color
83     NF_KEY_FIRSTCOLOR,
84     NF_KEY_BLACK = NF_KEY_FIRSTCOLOR,   // you do know colors, don't you?
85     NF_KEY_BLUE,
86     NF_KEY_GREEN,
87     NF_KEY_CYAN,
88     NF_KEY_RED,
89     NF_KEY_MAGENTA,
90     NF_KEY_BROWN,
91     NF_KEY_GREY,
92     NF_KEY_YELLOW,
93     NF_KEY_WHITE,
94     NF_KEY_LASTCOLOR = NF_KEY_WHITE,
95     NF_KEY_LASTKEYWORD_SO5 = NF_KEY_LASTCOLOR,
96     //! Keys from here on can't be saved in SO5 file format and MUST be
97     //! converted to string which means losing any information.
98     NF_KEY_AAA,         // abbreviated day name from Japanese Xcl, same as DDD or NN English
99     NF_KEY_AAAA,        // full day name from Japanese Xcl, same as DDDD or NNN English
100     NF_KEY_EC,          // E non-gregorian calendar year without preceding 0
101     NF_KEY_EEC,         // EE non-gregorian calendar year with preceding 0 (two digit)
102     NF_KEY_G,           // abbreviated era name, latin characters M T S or H for Gengou calendar
103     NF_KEY_GG,          // abbreviated era name
104     NF_KEY_GGG,         // full era name
105     NF_KEY_R,           // acts as EE (Xcl) => GR==GEE, GGR==GGEE, GGGR==GGGEE
106     NF_KEY_RR,          // acts as GGGEE (Xcl)
107     NF_KEY_THAI_T,      // Thai T modifier, speciality of Thai Excel, only used with Thai locale and converted to [NatNum1]
108     NF_KEYWORD_ENTRIES_COUNT
109 };
110 
111 class NfKeywordTable
112 {
113     typedef ::std::vector<String> Keywords_t;
114     Keywords_t m_keywords;
115 
116 public:
NfKeywordTable()117     NfKeywordTable() : m_keywords(NF_KEYWORD_ENTRIES_COUNT) {};
~NfKeywordTable()118     virtual ~NfKeywordTable() {}
119 
operator [](Keywords_t::size_type n)120     String & operator[] (Keywords_t::size_type n) { return m_keywords[n]; }
operator [](Keywords_t::size_type n) const121     const String & operator[] (Keywords_t::size_type n) const { return m_keywords[n]; }
122 };
123 
124 #endif // INCLUDED_SVTOOLS_NFKEYTAB_HXX
125 
126