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