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 _I18N_TRANSLITERATION_TRANSLITERATION_IGNORE_H_ 24cdf0e10cSrcweir #define _I18N_TRANSLITERATION_TRANSLITERATION_IGNORE_H_ 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <transliteration_commonclass.hxx> 27cdf0e10cSrcweir #include <i18nutil/oneToOneMapping.hxx> 28cdf0e10cSrcweir 29cdf0e10cSrcweir typedef sal_Unicode (*TransFunc)(const sal_Unicode); 30cdf0e10cSrcweir 31cdf0e10cSrcweir typedef struct { 32cdf0e10cSrcweir sal_Unicode previousChar; 33cdf0e10cSrcweir sal_Unicode currentChar; 34cdf0e10cSrcweir sal_Unicode replaceChar; 35cdf0e10cSrcweir sal_Bool two2one; 36cdf0e10cSrcweir } Mapping; 37cdf0e10cSrcweir 38cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace i18n { 39cdf0e10cSrcweir 40cdf0e10cSrcweir class transliteration_Ignore : public transliteration_commonclass 41cdf0e10cSrcweir { 42cdf0e10cSrcweir public: 43cdf0e10cSrcweir virtual rtl::OUString SAL_CALL 44cdf0e10cSrcweir folding( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset) 45cdf0e10cSrcweir throw(com::sun::star::uno::RuntimeException); 46cdf0e10cSrcweir 47cdf0e10cSrcweir // This method is shared. 48cdf0e10cSrcweir sal_Bool SAL_CALL 49cdf0e10cSrcweir equals( const rtl::OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1, 50cdf0e10cSrcweir const rtl::OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 ) 51cdf0e10cSrcweir throw(com::sun::star::uno::RuntimeException); 52cdf0e10cSrcweir 53cdf0e10cSrcweir // This method is implemented in sub class if needed. Otherwise, the method implemented in this class will be used. 54cdf0e10cSrcweir com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL 55cdf0e10cSrcweir transliterateRange( const rtl::OUString& str1, const rtl::OUString& str2 ) 56cdf0e10cSrcweir throw(com::sun::star::uno::RuntimeException); 57cdf0e10cSrcweir 58cdf0e10cSrcweir 59cdf0e10cSrcweir // Methods which are shared. 60cdf0e10cSrcweir sal_Int16 SAL_CALL getType( ) throw(com::sun::star::uno::RuntimeException); 61cdf0e10cSrcweir 62cdf0e10cSrcweir rtl::OUString SAL_CALL 63cdf0e10cSrcweir transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset ) 64cdf0e10cSrcweir throw(com::sun::star::uno::RuntimeException); 65cdf0e10cSrcweir 66cdf0e10cSrcweir virtual sal_Unicode SAL_CALL 67cdf0e10cSrcweir transliterateChar2Char( sal_Unicode inChar) 68cdf0e10cSrcweir throw(com::sun::star::uno::RuntimeException, 69cdf0e10cSrcweir com::sun::star::i18n::MultipleCharsOutputException); 70cdf0e10cSrcweir 71cdf0e10cSrcweir com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL 72cdf0e10cSrcweir transliterateRange( const rtl::OUString& str1, const rtl::OUString& str2, XTransliteration& t1, XTransliteration& t2 ) 73cdf0e10cSrcweir throw(com::sun::star::uno::RuntimeException); 74cdf0e10cSrcweir 75cdf0e10cSrcweir protected: 76cdf0e10cSrcweir TransFunc func; 77cdf0e10cSrcweir oneToOneMapping *table; 78cdf0e10cSrcweir Mapping *map; 79cdf0e10cSrcweir }; 80cdf0e10cSrcweir 81cdf0e10cSrcweir #define TRANSLITERATION_IGNORE( name ) \ 82cdf0e10cSrcweir class ignore##name : public transliteration_Ignore {\ 83cdf0e10cSrcweir public:\ 84cdf0e10cSrcweir ignore##name ();\ 85cdf0e10cSrcweir }; 86cdf0e10cSrcweir 87cdf0e10cSrcweir #if defined( TRANSLITERATION_BaFa_ja_JP ) || defined( TRANSLITERATION_ALL ) 88cdf0e10cSrcweir TRANSLITERATION_IGNORE(BaFa_ja_JP) 89cdf0e10cSrcweir #endif 90cdf0e10cSrcweir #if defined( TRANSLITERATION_HyuByu_ja_JP ) || defined( TRANSLITERATION_ALL ) 91cdf0e10cSrcweir TRANSLITERATION_IGNORE(HyuByu_ja_JP) 92cdf0e10cSrcweir #endif 93cdf0e10cSrcweir #if defined( TRANSLITERATION_SeZe_ja_JP ) || defined( TRANSLITERATION_ALL ) 94cdf0e10cSrcweir TRANSLITERATION_IGNORE(SeZe_ja_JP) 95cdf0e10cSrcweir #endif 96cdf0e10cSrcweir #if defined( TRANSLITERATION_TiJi_ja_JP ) || defined( TRANSLITERATION_ALL ) 97cdf0e10cSrcweir TRANSLITERATION_IGNORE(TiJi_ja_JP) 98cdf0e10cSrcweir #endif 99cdf0e10cSrcweir #if defined( TRANSLITERATION_MiddleDot_ja_JP ) || defined( TRANSLITERATION_ALL ) 100cdf0e10cSrcweir TRANSLITERATION_IGNORE(MiddleDot_ja_JP) 101cdf0e10cSrcweir #endif 102cdf0e10cSrcweir #if defined( TRANSLITERATION_MinusSign_ja_JP ) || defined( TRANSLITERATION_ALL ) 103cdf0e10cSrcweir TRANSLITERATION_IGNORE(MinusSign_ja_JP) 104cdf0e10cSrcweir #endif 105cdf0e10cSrcweir #if defined( TRANSLITERATION_Separator_ja_JP ) || defined( TRANSLITERATION_ALL ) 106cdf0e10cSrcweir TRANSLITERATION_IGNORE(Separator_ja_JP) 107cdf0e10cSrcweir #endif 108cdf0e10cSrcweir #if defined( TRANSLITERATION_Space_ja_JP ) || defined( TRANSLITERATION_ALL ) 109cdf0e10cSrcweir TRANSLITERATION_IGNORE(Space_ja_JP) 110cdf0e10cSrcweir #endif 111cdf0e10cSrcweir #if defined( TRANSLITERATION_TraditionalKana_ja_JP ) || defined( TRANSLITERATION_ALL ) 112cdf0e10cSrcweir TRANSLITERATION_IGNORE(TraditionalKana_ja_JP) 113cdf0e10cSrcweir #endif 114cdf0e10cSrcweir #if defined( TRANSLITERATION_TraditionalKanji_ja_JP ) || defined( TRANSLITERATION_ALL ) 115cdf0e10cSrcweir TRANSLITERATION_IGNORE(TraditionalKanji_ja_JP) 116cdf0e10cSrcweir #endif 117cdf0e10cSrcweir #if defined( TRANSLITERATION_ZiZu_ja_JP ) || defined( TRANSLITERATION_ALL ) 118cdf0e10cSrcweir TRANSLITERATION_IGNORE(ZiZu_ja_JP) 119cdf0e10cSrcweir #endif 120cdf0e10cSrcweir #undef TRANSLITERATION_IGNORE 121cdf0e10cSrcweir 122cdf0e10cSrcweir #define TRANSLITERATION_IGNORE( name ) \ 123cdf0e10cSrcweir class ignore##name : public transliteration_Ignore {\ 124cdf0e10cSrcweir public:\ 125cdf0e10cSrcweir ignore##name () {\ 126cdf0e10cSrcweir func = (TransFunc) 0;\ 127cdf0e10cSrcweir table = 0;\ 128cdf0e10cSrcweir map = 0;\ 129cdf0e10cSrcweir transliterationName = "ignore"#name;\ 130cdf0e10cSrcweir implementationName = "com.sun.star.i18n.Transliteration.ignore"#name;\ 131cdf0e10cSrcweir };\ 132cdf0e10cSrcweir rtl::OUString SAL_CALL folding( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, \ 133cdf0e10cSrcweir com::sun::star::uno::Sequence< sal_Int32 >& offset) throw(com::sun::star::uno::RuntimeException); \ 134cdf0e10cSrcweir }; 135cdf0e10cSrcweir 136cdf0e10cSrcweir #if defined( TRANSLITERATION_KiKuFollowedBySa_ja_JP ) || defined( TRANSLITERATION_ALL ) 137cdf0e10cSrcweir TRANSLITERATION_IGNORE(KiKuFollowedBySa_ja_JP) 138cdf0e10cSrcweir #endif 139cdf0e10cSrcweir #if defined( TRANSLITERATION_IandEfollowedByYa_ja_JP ) || defined( TRANSLITERATION_ALL ) 140cdf0e10cSrcweir TRANSLITERATION_IGNORE(IandEfollowedByYa_ja_JP) 141cdf0e10cSrcweir #endif 142cdf0e10cSrcweir #if defined( TRANSLITERATION_IterationMark_ja_JP ) || defined( TRANSLITERATION_ALL ) 143cdf0e10cSrcweir TRANSLITERATION_IGNORE(IterationMark_ja_JP) 144cdf0e10cSrcweir #endif 145cdf0e10cSrcweir #if defined( TRANSLITERATION_ProlongedSoundMark_ja_JP ) || defined( TRANSLITERATION_ALL ) 146cdf0e10cSrcweir TRANSLITERATION_IGNORE(ProlongedSoundMark_ja_JP) 147cdf0e10cSrcweir #endif 148cdf0e10cSrcweir #undef TRANSLITERATION_IGNORE 149cdf0e10cSrcweir 150cdf0e10cSrcweir #define TRANSLITERATION_IGNORE( name ) \ 151cdf0e10cSrcweir class ignore##name : public transliteration_Ignore {\ 152cdf0e10cSrcweir public:\ 153cdf0e10cSrcweir ignore##name () {\ 154cdf0e10cSrcweir func = (TransFunc) 0;\ 155cdf0e10cSrcweir table = 0;\ 156cdf0e10cSrcweir map = 0;\ 157cdf0e10cSrcweir transliterationName = "ignore"#name;\ 158cdf0e10cSrcweir implementationName = "com.sun.star.i18n.Transliteration.ignore"#name;\ 159cdf0e10cSrcweir };\ 160cdf0e10cSrcweir rtl::OUString SAL_CALL folding( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, \ 161cdf0e10cSrcweir com::sun::star::uno::Sequence< sal_Int32 >& offset) throw(com::sun::star::uno::RuntimeException); \ 162cdf0e10cSrcweir using transliteration_Ignore::transliterateRange;\ 163cdf0e10cSrcweir com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL transliterateRange( const rtl::OUString& str1, \ 164cdf0e10cSrcweir const rtl::OUString& str2 ) throw(com::sun::star::uno::RuntimeException); \ 165cdf0e10cSrcweir sal_Unicode SAL_CALL \ 166cdf0e10cSrcweir transliterateChar2Char( sal_Unicode inChar) \ 167cdf0e10cSrcweir throw(com::sun::star::uno::RuntimeException,\ 168cdf0e10cSrcweir com::sun::star::i18n::MultipleCharsOutputException);\ 169cdf0e10cSrcweir }; 170cdf0e10cSrcweir 171cdf0e10cSrcweir #if defined( TRANSLITERATION_Kana ) || defined( TRANSLITERATION_ALL ) 172cdf0e10cSrcweir TRANSLITERATION_IGNORE(Kana) 173cdf0e10cSrcweir #endif 174cdf0e10cSrcweir #if defined( TRANSLITERATION_Width ) || defined( TRANSLITERATION_ALL ) 175cdf0e10cSrcweir TRANSLITERATION_IGNORE(Width) 176cdf0e10cSrcweir #endif 177cdf0e10cSrcweir #if defined( TRANSLITERATION_Size_ja_JP ) || defined( TRANSLITERATION_ALL ) 178cdf0e10cSrcweir TRANSLITERATION_IGNORE(Size_ja_JP) 179cdf0e10cSrcweir #endif 180cdf0e10cSrcweir #undef TRANSLITERATION_IGNORE 181cdf0e10cSrcweir 182cdf0e10cSrcweir } } } } 183cdf0e10cSrcweir 184cdf0e10cSrcweir #endif // _I18N_TRANSLITERATION_TRANSLITERATION_IGNORE_H_ 185