Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / i18npool / inc / transliteration_Ignore.hxx
blob4f46d10131c96e8bd2e20767ba91ab1285fb36b1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_I18NPOOL_INC_TRANSLITERATION_IGNORE_HXX
20 #define INCLUDED_I18NPOOL_INC_TRANSLITERATION_IGNORE_HXX
22 #include "transliteration_commonclass.hxx"
23 #include <i18nutil/oneToOneMapping.hxx>
24 #include <unicode/translit.h>
26 typedef sal_Unicode (*TransFunc)(const sal_Unicode);
28 namespace i18npool {
30 class transliteration_Ignore : public transliteration_commonclass
32 public:
33 virtual OUString
34 foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override;
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 ) override;
41 // This method is implemented in sub class if needed. Otherwise, the method implemented in this class will be used.
42 css::uno::Sequence< OUString > SAL_CALL
43 transliterateRange( const OUString& str1, const OUString& str2 ) override;
46 // Methods which are shared.
47 sal_Int16 SAL_CALL getType( ) override;
49 OUString
50 transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override;
52 virtual sal_Unicode SAL_CALL
53 transliterateChar2Char( sal_Unicode inChar) override;
55 /// @throws css::uno::RuntimeException
56 static css::uno::Sequence< OUString >
57 transliterateRange( const OUString& str1, const OUString& str2, XTransliteration& t1, XTransliteration& t2 );
59 struct Mapping {
60 sal_Unicode previousChar;
61 sal_Unicode currentChar;
62 sal_Unicode replaceChar;
63 bool two2one;
66 protected:
67 TransFunc func;
68 i18nutil::oneToOneMapping *table;
69 const Mapping *map;
72 #define TRANSLITERATION_IGNORE( name ) \
73 class ignore##name : public transliteration_Ignore {\
74 public:\
75 ignore##name ();\
78 TRANSLITERATION_IGNORE(BaFa_ja_JP)
79 TRANSLITERATION_IGNORE(HyuByu_ja_JP)
80 TRANSLITERATION_IGNORE(SeZe_ja_JP)
81 TRANSLITERATION_IGNORE(TiJi_ja_JP)
82 TRANSLITERATION_IGNORE(MiddleDot_ja_JP)
83 TRANSLITERATION_IGNORE(MinusSign_ja_JP)
84 TRANSLITERATION_IGNORE(Separator_ja_JP)
85 TRANSLITERATION_IGNORE(Space_ja_JP)
86 TRANSLITERATION_IGNORE(TraditionalKana_ja_JP)
87 TRANSLITERATION_IGNORE(TraditionalKanji_ja_JP)
88 TRANSLITERATION_IGNORE(ZiZu_ja_JP)
89 TRANSLITERATION_IGNORE(Kashida_CTL)
91 class ignoreDiacritics_CTL : public transliteration_Ignore
93 icu::Transliterator* m_transliterator;
95 public:
96 ignoreDiacritics_CTL();
98 OUString
99 foldingImpl(const OUString& rInStr, sal_Int32 nStartPos, sal_Int32 nCount, css::uno::Sequence<sal_Int32>& rOffset, bool useOffset) override;
101 sal_Unicode SAL_CALL
102 transliterateChar2Char(sal_Unicode nInChar) override;
105 #undef TRANSLITERATION_IGNORE
107 #define TRANSLITERATION_IGNORE( name ) \
108 class ignore##name : public transliteration_Ignore {\
109 public:\
110 ignore##name () {\
111 func = nullptr;\
112 table = nullptr;\
113 map = nullptr;\
114 transliterationName = "ignore"#name;\
115 implementationName = "com.sun.star.i18n.Transliteration.ignore"#name;\
117 OUString foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, \
118 css::uno::Sequence< sal_Int32 >& offset, bool useOffset) override; \
121 TRANSLITERATION_IGNORE(KiKuFollowedBySa_ja_JP)
122 TRANSLITERATION_IGNORE(IandEfollowedByYa_ja_JP)
123 TRANSLITERATION_IGNORE(IterationMark_ja_JP)
124 TRANSLITERATION_IGNORE(ProlongedSoundMark_ja_JP)
126 #undef TRANSLITERATION_IGNORE
128 #define TRANSLITERATION_IGNORE( name ) \
129 class ignore##name : public transliteration_Ignore {\
130 public:\
131 ignore##name () {\
132 func = nullptr;\
133 table = nullptr;\
134 map = nullptr;\
135 transliterationName = "ignore"#name;\
136 implementationName = "com.sun.star.i18n.Transliteration.ignore"#name;\
138 OUString foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, \
139 css::uno::Sequence< sal_Int32 >& offset, bool useOffset) override; \
140 using transliteration_Ignore::transliterateRange;\
141 css::uno::Sequence< OUString > SAL_CALL transliterateRange( const OUString& str1, \
142 const OUString& str2 ) override; \
143 sal_Unicode SAL_CALL \
144 transliterateChar2Char( sal_Unicode inChar) \
145 override;\
148 TRANSLITERATION_IGNORE(Kana)
149 TRANSLITERATION_IGNORE(Width)
150 TRANSLITERATION_IGNORE(Size_ja_JP)
152 #undef TRANSLITERATION_IGNORE
156 #endif // INCLUDED_I18NPOOL_INC_TRANSLITERATION_IGNORE_HXX
158 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */