LibreOffice Module i18npool (master)  1
transliteration_commonclass.hxx
Go to the documentation of this file.
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_COMMONCLASS_HXX
20 #define INCLUDED_I18NPOOL_INC_TRANSLITERATION_COMMONCLASS_HXX
21 
22 #include <com/sun/star/i18n/XExtendedTransliteration.hpp>
23 #include <com/sun/star/lang/XServiceInfo.hpp>
24 #include <cppuhelper/implbase.hxx>
25 #include <rtl/ustring.hxx>
26 
27 namespace i18npool {
28 
29 class transliteration_commonclass : public cppu::WeakImplHelper<
30  css::i18n::XExtendedTransliteration,
31  css::lang::XServiceInfo
32  >
33 {
34 public:
36 
37  // Methods which are shared.
38  void SAL_CALL
39  loadModule( css::i18n::TransliterationModules modName, const css::lang::Locale& rLocale ) override;
40 
41  void SAL_CALL
42  loadModuleNew( const css::uno::Sequence< css::i18n::TransliterationModulesNew >& modName, const css::lang::Locale& rLocale ) override;
43 
44  void SAL_CALL
45  loadModuleByImplName( const OUString& implName, const css::lang::Locale& rLocale ) override;
46 
47  void SAL_CALL
48  loadModulesByImplNames(const css::uno::Sequence< OUString >& modNamelist, const css::lang::Locale& rLocale) override;
49 
50  css::uno::Sequence< OUString > SAL_CALL
51  getAvailableModules( const css::lang::Locale& rLocale, sal_Int16 sType ) override;
52 
53  // Methods which should be implemented in each transliteration module.
54  virtual OUString SAL_CALL getName() override;
55 
56  virtual sal_Int16 SAL_CALL getType( ) override = 0;
57 
58  virtual OUString SAL_CALL
59  transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset ) override final
60  { return transliterateImpl( inStr, startPos, nCount, offset, true ); }
61 
62  virtual OUString SAL_CALL
63  folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset) override final
64  { return foldingImpl( inStr, startPos, nCount, offset, true ); }
65 
66  // Methods in XExtendedTransliteration
67  virtual OUString SAL_CALL
68  transliterateString2String( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount ) override;
69  virtual OUString SAL_CALL
70  transliterateChar2String( sal_Unicode inChar) override;
71  virtual sal_Unicode SAL_CALL
72  transliterateChar2Char( sal_Unicode inChar ) override = 0;
73 
74  virtual sal_Bool SAL_CALL
75  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;
76 
77  virtual css::uno::Sequence< OUString > SAL_CALL
78  transliterateRange( const OUString& str1, const OUString& str2 ) override = 0;
79 
80  virtual sal_Int32 SAL_CALL
81  compareSubstring( const OUString& s1, sal_Int32 off1, sal_Int32 len1, const OUString& s2, sal_Int32 off2, sal_Int32 len2) override;
82 
83  virtual sal_Int32 SAL_CALL
84  compareString( const OUString& s1, const OUString& s2) override;
85 
86  //XServiceInfo
87  virtual OUString SAL_CALL getImplementationName() override;
88  virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
89  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
90 protected:
91  virtual OUString
92  transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) = 0;
93 
94  virtual OUString
95  foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) = 0;
96 
97  css::lang::Locale aLocale;
98  const char* transliterationName;
99  const char* implementationName;
100 };
101 
102 }
103 
104 #endif // INCLUDED_I18NPOOL_INC_TRANSLITERATION_COMMONCLASS_HXX
105 
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual OUString SAL_CALL folding(const OUString &inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 > &offset) override final
void SAL_CALL loadModuleNew(const css::uno::Sequence< css::i18n::TransliterationModulesNew > &modName, const css::lang::Locale &rLocale) override
virtual OUString SAL_CALL getImplementationName() override
virtual sal_Unicode SAL_CALL transliterateChar2Char(sal_Unicode inChar) override=0
virtual sal_Int32 SAL_CALL compareSubstring(const OUString &s1, sal_Int32 off1, sal_Int32 len1, const OUString &s2, sal_Int32 off2, sal_Int32 len2) override
void SAL_CALL loadModulesByImplNames(const css::uno::Sequence< OUString > &modNamelist, const css::lang::Locale &rLocale) override
css::uno::Sequence< OUString > SAL_CALL getAvailableModules(const css::lang::Locale &rLocale, sal_Int16 sType) override
sal_uInt16 sal_Unicode
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
int nCount
virtual OUString SAL_CALL transliterateString2String(const OUString &inStr, sal_Int32 startPos, sal_Int32 nCount) override
virtual sal_Int32 SAL_CALL compareString(const OUString &s1, const OUString &s2) override
void SAL_CALL loadModuleByImplName(const OUString &implName, const css::lang::Locale &rLocale) override
OptionalString sType
virtual css::uno::Sequence< OUString > SAL_CALL transliterateRange(const OUString &str1, const OUString &str2) override=0
virtual OUString SAL_CALL getName() override
virtual sal_Int16 SAL_CALL getType() override=0
unsigned char sal_Bool
virtual sal_Bool SAL_CALL 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
Constant values shared between i18npool and, for example, the number formatter.
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual OUString SAL_CALL transliterate(const OUString &inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 > &offset) override final
virtual OUString transliterateImpl(const OUString &inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 > &offset, bool useOffset)=0
virtual OUString foldingImpl(const OUString &inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 > &offset, bool useOffset)=0
virtual OUString SAL_CALL transliterateChar2String(sal_Unicode inChar) override
void SAL_CALL loadModule(css::i18n::TransliterationModules modName, const css::lang::Locale &rLocale) override
const char * implName