Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / i18npool / inc / transliterationImpl.hxx
blob21ffd6c03a569ccc1d94bd0c1c5b78d04f1110b3
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_TRANSLITERATIONIMPL_HXX
20 #define INCLUDED_I18NPOOL_INC_TRANSLITERATIONIMPL_HXX
22 #include <com/sun/star/i18n/XLocaleData4.hpp>
23 #include <com/sun/star/i18n/XExtendedTransliteration.hpp>
24 #include <cppuhelper/implbase.hxx>
25 #include <com/sun/star/uno/XComponentContext.hpp>
26 #include <com/sun/star/lang/XServiceInfo.hpp>
27 #include <sal/types.h>
29 namespace com { namespace sun { namespace star { namespace i18n {
31 class TransliterationImpl : public cppu::WeakImplHelper
33 css::i18n::XExtendedTransliteration,
34 css::lang::XServiceInfo
37 public:
38 // Constructors
39 TransliterationImpl(const css::uno::Reference < css::uno::XComponentContext >& xContext);
40 // Destructor
41 virtual ~TransliterationImpl();
43 // Methods
44 virtual OUString SAL_CALL getName( ) throw(css::uno::RuntimeException, std::exception) override ;
45 virtual sal_Int16 SAL_CALL getType( ) throw(css::uno::RuntimeException, std::exception) override ;
47 virtual void SAL_CALL loadModule( TransliterationModules modName, const css::lang::Locale& rLocale )
48 throw(css::uno::RuntimeException, std::exception) override ;
49 virtual void SAL_CALL loadModuleNew( const css::uno::Sequence< TransliterationModulesNew >& modName,
50 const css::lang::Locale& rLocale ) throw(css::uno::RuntimeException, std::exception) override ;
51 virtual void SAL_CALL loadModuleByImplName( const OUString& implName,
52 const css::lang::Locale& rLocale ) throw(css::uno::RuntimeException, std::exception) override;
53 virtual void SAL_CALL loadModulesByImplNames(const css::uno::Sequence< OUString >& modNamelist,
54 const css::lang::Locale& rLocale) throw(css::uno::RuntimeException, std::exception) override;
56 virtual css::uno::Sequence< OUString > SAL_CALL getAvailableModules(
57 const css::lang::Locale& rLocale, sal_Int16 sType )
58 throw(css::uno::RuntimeException, std::exception) override;
60 virtual OUString SAL_CALL transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount,
61 css::uno::Sequence< sal_Int32 >& offset ) throw(css::uno::RuntimeException, std::exception) override ;
63 virtual OUString SAL_CALL folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount,
64 css::uno::Sequence< sal_Int32 >& offset ) throw(css::uno::RuntimeException, std::exception) override;
66 // Methods in XExtendedTransliteration
67 virtual OUString SAL_CALL transliterateString2String( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount )
68 throw(css::uno::RuntimeException, std::exception) override ;
69 virtual OUString SAL_CALL transliterateChar2String( sal_Unicode inChar )
70 throw(css::uno::RuntimeException, std::exception) override ;
71 virtual sal_Unicode SAL_CALL transliterateChar2Char( sal_Unicode inChar )
72 throw(css::i18n::MultipleCharsOutputException,
73 css::uno::RuntimeException, std::exception) override ;
75 virtual sal_Bool SAL_CALL equals( const OUString& str1, sal_Int32 pos1, sal_Int32 nCount1,
76 sal_Int32& nMatch1, const OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 )
77 throw(css::uno::RuntimeException, std::exception) override;
78 virtual css::uno::Sequence< OUString > SAL_CALL transliterateRange( const OUString& str1,
79 const OUString& str2 ) throw(css::uno::RuntimeException, std::exception) override ;
81 virtual sal_Int32 SAL_CALL compareSubstring( const OUString& s1, sal_Int32 off1, sal_Int32 len1,
82 const OUString& s2, sal_Int32 off2, sal_Int32 len2) throw(css::uno::RuntimeException, std::exception) override;
84 virtual sal_Int32 SAL_CALL compareString( const OUString& s1, const OUString& s2)
85 throw(css::uno::RuntimeException, std::exception) override;
87 //XServiceInfo
88 virtual OUString SAL_CALL getImplementationName() throw( css::uno::RuntimeException, std::exception ) override;
89 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
90 throw( css::uno::RuntimeException, std::exception ) override;
91 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
92 throw( css::uno::RuntimeException, std::exception ) override;
94 private:
95 #define maxCascade 27
96 css::uno::Reference< css::i18n::XExtendedTransliteration > bodyCascade[maxCascade];
97 sal_Int16 numCascade;
98 bool caseignoreOnly;
99 css::uno::Reference< css::uno::XComponentContext > mxContext;
100 css::uno::Reference< XLocaleData4 > mxLocaledata;
101 css::uno::Reference< css::i18n::XExtendedTransliteration > caseignore;
103 bool SAL_CALL loadModuleByName( const OUString& implName,
104 css::uno::Reference<css::i18n::XExtendedTransliteration> & body, const css::lang::Locale& rLocale)
105 throw(css::uno::RuntimeException);
107 void clear();
109 void loadBody( OUString &implName,
110 css::uno::Reference< css::i18n::XExtendedTransliteration >& body )
111 throw (css::uno::RuntimeException);
113 css::uno::Sequence< OUString > SAL_CALL getRange(
114 const css::uno::Sequence< OUString > &inStrs,
115 sal_Int32 length, const sal_Int16 _nCascade)
116 throw(css::uno::RuntimeException);
119 } } } }
121 #endif
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */