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 INCLUDED_I18NPOOL_INC_TRANSLITERATION_IGNORE_HXX
20 : #define INCLUDED_I18NPOOL_INC_TRANSLITERATION_IGNORE_HXX
21 :
22 : #include <transliteration_commonclass.hxx>
23 : #include <i18nutil/oneToOneMapping.hxx>
24 :
25 : typedef sal_Unicode (*TransFunc)(const sal_Unicode);
26 :
27 : namespace com { namespace sun { namespace star { namespace i18n {
28 :
29 555 : class transliteration_Ignore : public transliteration_commonclass
30 : {
31 : public:
32 : virtual OUString SAL_CALL
33 : folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset)
34 : throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
35 :
36 : // This method is shared.
37 : sal_Bool SAL_CALL
38 : equals( const OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1,
39 : const OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 )
40 : throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
41 :
42 : // This method is implemented in sub class if needed. Otherwise, the method implemented in this class will be used.
43 : com::sun::star::uno::Sequence< OUString > SAL_CALL
44 : transliterateRange( const OUString& str1, const OUString& str2 )
45 : throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
46 :
47 :
48 : // Methods which are shared.
49 : sal_Int16 SAL_CALL getType( ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
50 :
51 : OUString SAL_CALL
52 : transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset )
53 : throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
54 :
55 : virtual sal_Unicode SAL_CALL
56 : transliterateChar2Char( sal_Unicode inChar)
57 : throw(com::sun::star::uno::RuntimeException,
58 : com::sun::star::i18n::MultipleCharsOutputException, std::exception) SAL_OVERRIDE;
59 :
60 : com::sun::star::uno::Sequence< OUString > SAL_CALL
61 : transliterateRange( const OUString& str1, const OUString& str2, XTransliteration& t1, XTransliteration& t2 )
62 : throw(com::sun::star::uno::RuntimeException);
63 :
64 : struct Mapping {
65 : sal_Unicode previousChar;
66 : sal_Unicode currentChar;
67 : sal_Unicode replaceChar;
68 : bool two2one;
69 : };
70 :
71 : protected:
72 : TransFunc func;
73 : oneToOneMapping *table;
74 : const Mapping *map;
75 : };
76 :
77 : #define TRANSLITERATION_IGNORE( name ) \
78 : class ignore##name : public transliteration_Ignore {\
79 : public:\
80 : ignore##name ();\
81 : };
82 :
83 0 : TRANSLITERATION_IGNORE(BaFa_ja_JP)
84 0 : TRANSLITERATION_IGNORE(HyuByu_ja_JP)
85 0 : TRANSLITERATION_IGNORE(SeZe_ja_JP)
86 0 : TRANSLITERATION_IGNORE(TiJi_ja_JP)
87 0 : TRANSLITERATION_IGNORE(MiddleDot_ja_JP)
88 0 : TRANSLITERATION_IGNORE(MinusSign_ja_JP)
89 0 : TRANSLITERATION_IGNORE(Separator_ja_JP)
90 0 : TRANSLITERATION_IGNORE(Space_ja_JP)
91 0 : TRANSLITERATION_IGNORE(TraditionalKana_ja_JP)
92 0 : TRANSLITERATION_IGNORE(TraditionalKanji_ja_JP)
93 0 : TRANSLITERATION_IGNORE(ZiZu_ja_JP)
94 8 : TRANSLITERATION_IGNORE(Diacritics_CTL)
95 8 : TRANSLITERATION_IGNORE(Kashida_CTL)
96 :
97 : #undef TRANSLITERATION_IGNORE
98 :
99 : #define TRANSLITERATION_IGNORE( name ) \
100 : class ignore##name : public transliteration_Ignore {\
101 : public:\
102 : ignore##name () {\
103 : func = (TransFunc) 0;\
104 : table = 0;\
105 : map = 0;\
106 : transliterationName = "ignore"#name;\
107 : implementationName = "com.sun.star.i18n.Transliteration.ignore"#name;\
108 : };\
109 : OUString SAL_CALL folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, \
110 : com::sun::star::uno::Sequence< sal_Int32 >& offset) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; \
111 : };
112 :
113 0 : TRANSLITERATION_IGNORE(KiKuFollowedBySa_ja_JP)
114 0 : TRANSLITERATION_IGNORE(IandEfollowedByYa_ja_JP)
115 0 : TRANSLITERATION_IGNORE(IterationMark_ja_JP)
116 0 : TRANSLITERATION_IGNORE(ProlongedSoundMark_ja_JP)
117 :
118 : #undef TRANSLITERATION_IGNORE
119 :
120 : #define TRANSLITERATION_IGNORE( name ) \
121 : class ignore##name : public transliteration_Ignore {\
122 : public:\
123 : ignore##name () {\
124 : func = (TransFunc) 0;\
125 : table = 0;\
126 : map = 0;\
127 : transliterationName = "ignore"#name;\
128 : implementationName = "com.sun.star.i18n.Transliteration.ignore"#name;\
129 : };\
130 : OUString SAL_CALL folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, \
131 : com::sun::star::uno::Sequence< sal_Int32 >& offset) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; \
132 : using transliteration_Ignore::transliterateRange;\
133 : com::sun::star::uno::Sequence< OUString > SAL_CALL transliterateRange( const OUString& str1, \
134 : const OUString& str2 ) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; \
135 : sal_Unicode SAL_CALL \
136 : transliterateChar2Char( sal_Unicode inChar) \
137 : throw(com::sun::star::uno::RuntimeException,\
138 : com::sun::star::i18n::MultipleCharsOutputException, std::exception) SAL_OVERRIDE;\
139 : };
140 :
141 252 : TRANSLITERATION_IGNORE(Kana)
142 552 : TRANSLITERATION_IGNORE(Width)
143 0 : TRANSLITERATION_IGNORE(Size_ja_JP)
144 :
145 : #undef TRANSLITERATION_IGNORE
146 :
147 : } } } }
148 :
149 : #endif // INCLUDED_I18NPOOL_INC_TRANSLITERATION_IGNORE_HXX
150 :
151 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|