Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef _I18N_TRANSLITERATION_TRANSLITERATION_IGNORE_H_
20 : #define _I18N_TRANSLITERATION_TRANSLITERATION_IGNORE_H_
21 :
22 : #include <transliteration_commonclass.hxx>
23 : #include <i18nutil/oneToOneMapping.hxx>
24 :
25 : typedef sal_Unicode (*TransFunc)(const sal_Unicode);
26 :
27 : typedef struct {
28 : sal_Unicode previousChar;
29 : sal_Unicode currentChar;
30 : sal_Unicode replaceChar;
31 : sal_Bool two2one;
32 : } Mapping;
33 :
34 : namespace com { namespace sun { namespace star { namespace i18n {
35 :
36 36 : class transliteration_Ignore : public transliteration_commonclass
37 : {
38 : public:
39 : virtual rtl::OUString SAL_CALL
40 : folding( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset)
41 : throw(com::sun::star::uno::RuntimeException);
42 :
43 : // This method is shared.
44 : sal_Bool SAL_CALL
45 : equals( const rtl::OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1,
46 : const rtl::OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 )
47 : throw(com::sun::star::uno::RuntimeException);
48 :
49 : // This method is implemented in sub class if needed. Otherwise, the method implemented in this class will be used.
50 : com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
51 : transliterateRange( const rtl::OUString& str1, const rtl::OUString& str2 )
52 : throw(com::sun::star::uno::RuntimeException);
53 :
54 :
55 : // Methods which are shared.
56 : sal_Int16 SAL_CALL getType( ) throw(com::sun::star::uno::RuntimeException);
57 :
58 : rtl::OUString SAL_CALL
59 : transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset )
60 : throw(com::sun::star::uno::RuntimeException);
61 :
62 : virtual sal_Unicode SAL_CALL
63 : transliterateChar2Char( sal_Unicode inChar)
64 : throw(com::sun::star::uno::RuntimeException,
65 : com::sun::star::i18n::MultipleCharsOutputException);
66 :
67 : com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
68 : transliterateRange( const rtl::OUString& str1, const rtl::OUString& str2, XTransliteration& t1, XTransliteration& t2 )
69 : throw(com::sun::star::uno::RuntimeException);
70 :
71 : protected:
72 : TransFunc func;
73 : oneToOneMapping *table;
74 : Mapping *map;
75 : };
76 :
77 : #define TRANSLITERATION_IGNORE( name ) \
78 : class ignore##name : public transliteration_Ignore {\
79 : public:\
80 : ignore##name ();\
81 : };
82 :
83 : #if defined( TRANSLITERATION_BaFa_ja_JP ) || defined( TRANSLITERATION_ALL )
84 0 : TRANSLITERATION_IGNORE(BaFa_ja_JP)
85 : #endif
86 : #if defined( TRANSLITERATION_HyuByu_ja_JP ) || defined( TRANSLITERATION_ALL )
87 0 : TRANSLITERATION_IGNORE(HyuByu_ja_JP)
88 : #endif
89 : #if defined( TRANSLITERATION_SeZe_ja_JP ) || defined( TRANSLITERATION_ALL )
90 0 : TRANSLITERATION_IGNORE(SeZe_ja_JP)
91 : #endif
92 : #if defined( TRANSLITERATION_TiJi_ja_JP ) || defined( TRANSLITERATION_ALL )
93 0 : TRANSLITERATION_IGNORE(TiJi_ja_JP)
94 : #endif
95 : #if defined( TRANSLITERATION_MiddleDot_ja_JP ) || defined( TRANSLITERATION_ALL )
96 0 : TRANSLITERATION_IGNORE(MiddleDot_ja_JP)
97 : #endif
98 : #if defined( TRANSLITERATION_MinusSign_ja_JP ) || defined( TRANSLITERATION_ALL )
99 0 : TRANSLITERATION_IGNORE(MinusSign_ja_JP)
100 : #endif
101 : #if defined( TRANSLITERATION_Separator_ja_JP ) || defined( TRANSLITERATION_ALL )
102 0 : TRANSLITERATION_IGNORE(Separator_ja_JP)
103 : #endif
104 : #if defined( TRANSLITERATION_Space_ja_JP ) || defined( TRANSLITERATION_ALL )
105 0 : TRANSLITERATION_IGNORE(Space_ja_JP)
106 : #endif
107 : #if defined( TRANSLITERATION_TraditionalKana_ja_JP ) || defined( TRANSLITERATION_ALL )
108 0 : TRANSLITERATION_IGNORE(TraditionalKana_ja_JP)
109 : #endif
110 : #if defined( TRANSLITERATION_TraditionalKanji_ja_JP ) || defined( TRANSLITERATION_ALL )
111 0 : TRANSLITERATION_IGNORE(TraditionalKanji_ja_JP)
112 : #endif
113 : #if defined( TRANSLITERATION_ZiZu_ja_JP ) || defined( TRANSLITERATION_ALL )
114 0 : TRANSLITERATION_IGNORE(ZiZu_ja_JP)
115 : #endif
116 : #undef TRANSLITERATION_IGNORE
117 :
118 : #define TRANSLITERATION_IGNORE( name ) \
119 : class ignore##name : public transliteration_Ignore {\
120 : public:\
121 : ignore##name () {\
122 : func = (TransFunc) 0;\
123 : table = 0;\
124 : map = 0;\
125 : transliterationName = "ignore"#name;\
126 : implementationName = "com.sun.star.i18n.Transliteration.ignore"#name;\
127 : };\
128 : rtl::OUString SAL_CALL folding( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, \
129 : com::sun::star::uno::Sequence< sal_Int32 >& offset) throw(com::sun::star::uno::RuntimeException); \
130 : };
131 :
132 : #if defined( TRANSLITERATION_KiKuFollowedBySa_ja_JP ) || defined( TRANSLITERATION_ALL )
133 0 : TRANSLITERATION_IGNORE(KiKuFollowedBySa_ja_JP)
134 : #endif
135 : #if defined( TRANSLITERATION_IandEfollowedByYa_ja_JP ) || defined( TRANSLITERATION_ALL )
136 0 : TRANSLITERATION_IGNORE(IandEfollowedByYa_ja_JP)
137 : #endif
138 : #if defined( TRANSLITERATION_IterationMark_ja_JP ) || defined( TRANSLITERATION_ALL )
139 0 : TRANSLITERATION_IGNORE(IterationMark_ja_JP)
140 : #endif
141 : #if defined( TRANSLITERATION_ProlongedSoundMark_ja_JP ) || defined( TRANSLITERATION_ALL )
142 0 : TRANSLITERATION_IGNORE(ProlongedSoundMark_ja_JP)
143 : #endif
144 : #undef TRANSLITERATION_IGNORE
145 :
146 : #define TRANSLITERATION_IGNORE( name ) \
147 : class ignore##name : public transliteration_Ignore {\
148 : public:\
149 : ignore##name () {\
150 : func = (TransFunc) 0;\
151 : table = 0;\
152 : map = 0;\
153 : transliterationName = "ignore"#name;\
154 : implementationName = "com.sun.star.i18n.Transliteration.ignore"#name;\
155 : };\
156 : rtl::OUString SAL_CALL folding( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, \
157 : com::sun::star::uno::Sequence< sal_Int32 >& offset) throw(com::sun::star::uno::RuntimeException); \
158 : using transliteration_Ignore::transliterateRange;\
159 : com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL transliterateRange( const rtl::OUString& str1, \
160 : const rtl::OUString& str2 ) throw(com::sun::star::uno::RuntimeException); \
161 : sal_Unicode SAL_CALL \
162 : transliterateChar2Char( sal_Unicode inChar) \
163 : throw(com::sun::star::uno::RuntimeException,\
164 : com::sun::star::i18n::MultipleCharsOutputException);\
165 : };
166 :
167 : #if defined( TRANSLITERATION_Kana ) || defined( TRANSLITERATION_ALL )
168 27 : TRANSLITERATION_IGNORE(Kana)
169 : #endif
170 : #if defined( TRANSLITERATION_Width ) || defined( TRANSLITERATION_ALL )
171 27 : TRANSLITERATION_IGNORE(Width)
172 : #endif
173 : #if defined( TRANSLITERATION_Size_ja_JP ) || defined( TRANSLITERATION_ALL )
174 0 : TRANSLITERATION_IGNORE(Size_ja_JP)
175 : #endif
176 : #undef TRANSLITERATION_IGNORE
177 :
178 : } } } }
179 :
180 : #endif // _I18N_TRANSLITERATION_TRANSLITERATION_IGNORE_H_
181 :
182 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|