xref: /aoo41x/main/i18npool/inc/cclass_cjk.hxx (revision f7bd9df4)
1*f7bd9df4SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*f7bd9df4SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*f7bd9df4SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*f7bd9df4SAndrew Rist  * distributed with this work for additional information
6*f7bd9df4SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*f7bd9df4SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*f7bd9df4SAndrew Rist  * "License"); you may not use this file except in compliance
9*f7bd9df4SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*f7bd9df4SAndrew Rist  *
11*f7bd9df4SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*f7bd9df4SAndrew Rist  *
13*f7bd9df4SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*f7bd9df4SAndrew Rist  * software distributed under the License is distributed on an
15*f7bd9df4SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*f7bd9df4SAndrew Rist  * KIND, either express or implied.  See the License for the
17*f7bd9df4SAndrew Rist  * specific language governing permissions and limitations
18*f7bd9df4SAndrew Rist  * under the License.
19*f7bd9df4SAndrew Rist  *
20*f7bd9df4SAndrew Rist  *************************************************************/
21*f7bd9df4SAndrew Rist 
22*f7bd9df4SAndrew Rist 
23cdf0e10cSrcweir #ifndef _CCLASS_CJK_H_
24cdf0e10cSrcweir #define _CCLASS_CJK_H_
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include <cclass_unicode.hxx>
27cdf0e10cSrcweir 
28cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace i18n {
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #define MAXLEN 	31		// Define max length for CJK number
31cdf0e10cSrcweir 
32cdf0e10cSrcweir #define ZERO		0x0030	// Define unicode zero
33cdf0e10cSrcweir #define ONE		0x0031	// Define unicode one
34cdf0e10cSrcweir 
35cdf0e10cSrcweir class cclass_CJK : public cclass_Unicode {
36cdf0e10cSrcweir public:
37cdf0e10cSrcweir 	cclass_CJK( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF );
38cdf0e10cSrcweir 	~cclass_CJK();
39cdf0e10cSrcweir 	i18n::ParseResult SAL_CALL parsePredefinedToken(
40cdf0e10cSrcweir 		sal_Int32 nTokenType,
41cdf0e10cSrcweir 		const rtl::OUString& Text,
42cdf0e10cSrcweir 		sal_Int32 nPos,
43cdf0e10cSrcweir 		const com::sun::star::lang::Locale& rLocale,
44cdf0e10cSrcweir 		sal_Int32 nStartCharFlags,
45cdf0e10cSrcweir 		const rtl::OUString& userDefinedCharactersStart,
46cdf0e10cSrcweir 		sal_Int32 nContCharFlags,
47cdf0e10cSrcweir 		const rtl::OUString& userDefinedCharactersCont )
48cdf0e10cSrcweir 		throw(com::sun::star::uno::RuntimeException);
49cdf0e10cSrcweir 
50cdf0e10cSrcweir protected:
51cdf0e10cSrcweir 	sal_Int32 size;
52cdf0e10cSrcweir 	rtl::OUString number;
53cdf0e10cSrcweir 	sal_Unicode *text;
54cdf0e10cSrcweir 	sal_Int32 textPos;
55cdf0e10cSrcweir 
56cdf0e10cSrcweir 	sal_Unicode *Upper;
57cdf0e10cSrcweir 	sal_Unicode *Base;
58cdf0e10cSrcweir 	sal_Unicode *Plus;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 	static sal_Int32 cclass_CJK::upperVal[];
61cdf0e10cSrcweir 	static sal_Int32 cclass_CJK::baseVal[];
62cdf0e10cSrcweir 	static sal_Int32 cclass_CJK::plusVal[];
63cdf0e10cSrcweir 
64cdf0e10cSrcweir private:
65cdf0e10cSrcweir 	sal_Int32 ToNum();
66cdf0e10cSrcweir 	sal_Int32 ToNum(sal_Unicode *n, sal_Int32 s);
67cdf0e10cSrcweir 	void Init(sal_Unicode *n, sal_Int32 s);
68cdf0e10cSrcweir 	void NumberCopy(sal_Unicode *s, sal_Unicode *t, sal_Int32 n);
69cdf0e10cSrcweir 	void NumberReverse(sal_Unicode *s, sal_Int32 n);
70cdf0e10cSrcweir 	sal_Int32 oneDigit(sal_Unicode s);
71cdf0e10cSrcweir 	sal_Int32 baseDigit(sal_Unicode s);
72cdf0e10cSrcweir 	sal_Int32 plusDigit(sal_Unicode s);
73cdf0e10cSrcweir };
74cdf0e10cSrcweir 
75cdf0e10cSrcweir #define CCLASS_CJK( name ) \
76cdf0e10cSrcweir class name : public cclass_CJK \
77cdf0e10cSrcweir { \
78cdf0e10cSrcweir public: \
79cdf0e10cSrcweir 	name ( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ); \
80cdf0e10cSrcweir };
81cdf0e10cSrcweir 
82cdf0e10cSrcweir #ifdef CCLASS_ALL
83cdf0e10cSrcweir CCLASS_CJK(cclass_zh)
84cdf0e10cSrcweir CCLASS_CJK(cclass_zh_TW)
85cdf0e10cSrcweir CCLASS_CJK(cclass_ko)
86cdf0e10cSrcweir #endif
87cdf0e10cSrcweir #undef CCLASS_CJK
88cdf0e10cSrcweir 
89cdf0e10cSrcweir } } } }
90cdf0e10cSrcweir 
91cdf0e10cSrcweir #endif
92