/src/libreoffice/i18npool/inc/transliteration_commonclass.hxx
Line | Count | Source |
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 | | #pragma once |
20 | | |
21 | | #include <com/sun/star/i18n/XExtendedTransliteration.hpp> |
22 | | #include <com/sun/star/lang/XServiceInfo.hpp> |
23 | | #include <cppuhelper/implbase.hxx> |
24 | | #include <rtl/ustring.hxx> |
25 | | |
26 | | namespace i18npool { |
27 | | |
28 | | class transliteration_commonclass : public cppu::WeakImplHelper< |
29 | | css::i18n::XExtendedTransliteration, |
30 | | css::lang::XServiceInfo |
31 | | > |
32 | | { |
33 | | public: |
34 | | transliteration_commonclass(); |
35 | | |
36 | | // Methods which are shared. |
37 | | void SAL_CALL |
38 | | loadModule( css::i18n::TransliterationModules modName, const css::lang::Locale& rLocale ) override; |
39 | | |
40 | | void SAL_CALL |
41 | | loadModuleNew( const css::uno::Sequence< css::i18n::TransliterationModulesNew >& modName, const css::lang::Locale& rLocale ) override; |
42 | | |
43 | | void SAL_CALL |
44 | | loadModuleByImplName( const OUString& implName, const css::lang::Locale& rLocale ) override; |
45 | | |
46 | | void SAL_CALL |
47 | | loadModulesByImplNames(const css::uno::Sequence< OUString >& modNamelist, const css::lang::Locale& rLocale) override; |
48 | | |
49 | | css::uno::Sequence< OUString > SAL_CALL |
50 | | getAvailableModules( const css::lang::Locale& rLocale, sal_Int16 sType ) override; |
51 | | |
52 | | // Methods which should be implemented in each transliteration module. |
53 | | virtual OUString SAL_CALL getName() override; |
54 | | |
55 | | virtual sal_Int16 SAL_CALL getType( ) override = 0; |
56 | | |
57 | | virtual OUString SAL_CALL |
58 | | transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset ) override final |
59 | 1.30k | { return transliterateImpl( inStr, startPos, nCount, &offset ); } |
60 | | |
61 | | virtual OUString SAL_CALL |
62 | | folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset) override final |
63 | 0 | { return foldingImpl( inStr, startPos, nCount, &offset ); } |
64 | | |
65 | | // Methods in XExtendedTransliteration |
66 | | virtual OUString SAL_CALL |
67 | | transliterateString2String( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount ) override; |
68 | | virtual OUString SAL_CALL |
69 | | transliterateChar2String( sal_Unicode inChar) override; |
70 | | virtual sal_Unicode SAL_CALL |
71 | | transliterateChar2Char( sal_Unicode inChar ) override = 0; |
72 | | |
73 | | virtual sal_Bool SAL_CALL |
74 | | equals( const OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1, const OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 ) override = 0; |
75 | | |
76 | | virtual css::uno::Sequence< OUString > SAL_CALL |
77 | | transliterateRange( const OUString& str1, const OUString& str2 ) override = 0; |
78 | | |
79 | | virtual sal_Int32 SAL_CALL |
80 | | compareSubstring( const OUString& s1, sal_Int32 off1, sal_Int32 len1, const OUString& s2, sal_Int32 off2, sal_Int32 len2) override; |
81 | | |
82 | | virtual sal_Int32 SAL_CALL |
83 | | compareString( const OUString& s1, const OUString& s2) override; |
84 | | |
85 | | //XServiceInfo |
86 | | virtual OUString SAL_CALL getImplementationName() override; |
87 | | virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; |
88 | | virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; |
89 | | protected: |
90 | | virtual OUString |
91 | | transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset ) = 0; |
92 | | |
93 | | virtual OUString |
94 | | foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >* pOffset ) = 0; |
95 | | |
96 | | css::lang::Locale aLocale; |
97 | | const char* transliterationName; |
98 | | const char* implementationName; |
99 | | }; |
100 | | |
101 | | } |
102 | | |
103 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |