xref: /aoo4110/main/i18npool/inc/cclass_cjk.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 #ifndef _CCLASS_CJK_H_
24 #define _CCLASS_CJK_H_
25 
26 #include <cclass_unicode.hxx>
27 
28 namespace com { namespace sun { namespace star { namespace i18n {
29 
30 #define MAXLEN 	31		// Define max length for CJK number
31 
32 #define ZERO		0x0030	// Define unicode zero
33 #define ONE		0x0031	// Define unicode one
34 
35 class cclass_CJK : public cclass_Unicode {
36 public:
37 	cclass_CJK( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF );
38 	~cclass_CJK();
39 	i18n::ParseResult SAL_CALL parsePredefinedToken(
40 		sal_Int32 nTokenType,
41 		const rtl::OUString& Text,
42 		sal_Int32 nPos,
43 		const com::sun::star::lang::Locale& rLocale,
44 		sal_Int32 nStartCharFlags,
45 		const rtl::OUString& userDefinedCharactersStart,
46 		sal_Int32 nContCharFlags,
47 		const rtl::OUString& userDefinedCharactersCont )
48 		throw(com::sun::star::uno::RuntimeException);
49 
50 protected:
51 	sal_Int32 size;
52 	rtl::OUString number;
53 	sal_Unicode *text;
54 	sal_Int32 textPos;
55 
56 	sal_Unicode *Upper;
57 	sal_Unicode *Base;
58 	sal_Unicode *Plus;
59 
60 	static sal_Int32 cclass_CJK::upperVal[];
61 	static sal_Int32 cclass_CJK::baseVal[];
62 	static sal_Int32 cclass_CJK::plusVal[];
63 
64 private:
65 	sal_Int32 ToNum();
66 	sal_Int32 ToNum(sal_Unicode *n, sal_Int32 s);
67 	void Init(sal_Unicode *n, sal_Int32 s);
68 	void NumberCopy(sal_Unicode *s, sal_Unicode *t, sal_Int32 n);
69 	void NumberReverse(sal_Unicode *s, sal_Int32 n);
70 	sal_Int32 oneDigit(sal_Unicode s);
71 	sal_Int32 baseDigit(sal_Unicode s);
72 	sal_Int32 plusDigit(sal_Unicode s);
73 };
74 
75 #define CCLASS_CJK( name ) \
76 class name : public cclass_CJK \
77 { \
78 public: \
79 	name ( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ); \
80 };
81 
82 #ifdef CCLASS_ALL
83 CCLASS_CJK(cclass_zh)
84 CCLASS_CJK(cclass_zh_TW)
85 CCLASS_CJK(cclass_ko)
86 #endif
87 #undef CCLASS_CJK
88 
89 } } } }
90 
91 #endif
92