merge the formfield patch from ooo-build
[ooovba.git] / i18npool / inc / cclass_cjk.hxx
blob42ba6dd09434d0c0f2c465036bdeacd2a1f41aeb
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cclass_cjk.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _CCLASS_CJK_H_
31 #define _CCLASS_CJK_H_
33 #include <cclass_unicode.hxx>
35 namespace com { namespace sun { namespace star { namespace i18n {
37 #define MAXLEN 31 // Define max length for CJK number
39 #define ZERO 0x0030 // Define unicode zero
40 #define ONE 0x0031 // Define unicode one
42 class cclass_CJK : public cclass_Unicode {
43 public:
44 cclass_CJK( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF );
45 ~cclass_CJK();
46 i18n::ParseResult SAL_CALL parsePredefinedToken(
47 sal_Int32 nTokenType,
48 const rtl::OUString& Text,
49 sal_Int32 nPos,
50 const com::sun::star::lang::Locale& rLocale,
51 sal_Int32 nStartCharFlags,
52 const rtl::OUString& userDefinedCharactersStart,
53 sal_Int32 nContCharFlags,
54 const rtl::OUString& userDefinedCharactersCont )
55 throw(com::sun::star::uno::RuntimeException);
57 protected:
58 sal_Int32 size;
59 rtl::OUString number;
60 sal_Unicode *text;
61 sal_Int32 textPos;
63 sal_Unicode *Upper;
64 sal_Unicode *Base;
65 sal_Unicode *Plus;
67 static sal_Int32 cclass_CJK::upperVal[];
68 static sal_Int32 cclass_CJK::baseVal[];
69 static sal_Int32 cclass_CJK::plusVal[];
71 private:
72 sal_Int32 ToNum();
73 sal_Int32 ToNum(sal_Unicode *n, sal_Int32 s);
74 void Init(sal_Unicode *n, sal_Int32 s);
75 void NumberCopy(sal_Unicode *s, sal_Unicode *t, sal_Int32 n);
76 void NumberReverse(sal_Unicode *s, sal_Int32 n);
77 sal_Int32 oneDigit(sal_Unicode s);
78 sal_Int32 baseDigit(sal_Unicode s);
79 sal_Int32 plusDigit(sal_Unicode s);
82 #define CCLASS_CJK( name ) \
83 class name : public cclass_CJK \
84 { \
85 public: \
86 name ( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF ); \
89 #ifdef CCLASS_ALL
90 CCLASS_CJK(cclass_zh)
91 CCLASS_CJK(cclass_zh_TW)
92 CCLASS_CJK(cclass_ko)
93 #endif
94 #undef CCLASS_CJK
96 } } } }
98 #endif