LibreOffice Module i18npool (master) 1
transliterationImpl.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#pragma once
20
21#include <com/sun/star/i18n/XExtendedTransliteration.hpp>
23#include <com/sun/star/lang/XServiceInfo.hpp>
24#include <sal/types.h>
25
26namespace com::sun::star::i18n { class XLocaleData5; }
27namespace com::sun::star::uno { class XComponentContext; }
28
29namespace i18npool {
30
31class TransliterationImpl final : public cppu::WeakImplHelper
32<
33 css::i18n::XExtendedTransliteration,
34 css::lang::XServiceInfo
35>
36{
37public:
38 // Constructors
39 TransliterationImpl(const css::uno::Reference < css::uno::XComponentContext >& xContext);
40 // Destructor
41 virtual ~TransliterationImpl() override;
42
43 // Methods
44 virtual OUString SAL_CALL getName( ) override ;
45 virtual sal_Int16 SAL_CALL getType( ) override ;
46
47 virtual void SAL_CALL loadModule( css::i18n::TransliterationModules modName, const css::lang::Locale& rLocale ) override ;
48 virtual void SAL_CALL loadModuleNew( const css::uno::Sequence< css::i18n::TransliterationModulesNew >& modName,
49 const css::lang::Locale& rLocale ) override ;
50 virtual void SAL_CALL loadModuleByImplName( const OUString& implName,
51 const css::lang::Locale& rLocale ) override;
52 virtual void SAL_CALL loadModulesByImplNames(const css::uno::Sequence< OUString >& modNamelist,
53 const css::lang::Locale& rLocale) override;
54
55 virtual css::uno::Sequence< OUString > SAL_CALL getAvailableModules(
56 const css::lang::Locale& rLocale, sal_Int16 sType ) override;
57
58 virtual OUString SAL_CALL transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount,
59 css::uno::Sequence< sal_Int32 >& offset ) override ;
60
61 virtual OUString SAL_CALL folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount,
62 css::uno::Sequence< sal_Int32 >& offset ) override;
63
64 // Methods in XExtendedTransliteration
65 virtual OUString SAL_CALL transliterateString2String( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount ) override ;
66 virtual OUString SAL_CALL transliterateChar2String( sal_Unicode inChar ) override ;
67 virtual sal_Unicode SAL_CALL transliterateChar2Char( sal_Unicode inChar ) override ;
68
69 virtual sal_Bool SAL_CALL equals( const OUString& str1, sal_Int32 pos1, sal_Int32 nCount1,
70 sal_Int32& nMatch1, const OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 ) override;
71 virtual css::uno::Sequence< OUString > SAL_CALL transliterateRange( const OUString& str1,
72 const OUString& str2 ) override ;
73
74 virtual sal_Int32 SAL_CALL compareSubstring( const OUString& s1, sal_Int32 off1, sal_Int32 len1,
75 const OUString& s2, sal_Int32 off2, sal_Int32 len2) override;
76
77 virtual sal_Int32 SAL_CALL compareString( const OUString& s1, const OUString& s2) override;
78
79 //XServiceInfo
80 virtual OUString SAL_CALL getImplementationName() override;
81 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
82 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
83
84private:
85#define maxCascade 27
86 css::uno::Reference< css::i18n::XExtendedTransliteration > bodyCascade[maxCascade];
87 sal_Int16 numCascade;
89 css::uno::Reference< css::uno::XComponentContext > mxContext;
90 css::uno::Reference< css::i18n::XLocaleData5 > mxLocaledata;
91 css::uno::Reference< css::i18n::XExtendedTransliteration > caseignore;
92
94 bool loadModuleByName( std::u16string_view implName,
95 css::uno::Reference<css::i18n::XExtendedTransliteration> & body, const css::lang::Locale& rLocale);
96
97 void clear();
98
100 void loadBody( OUString const &implName,
101 css::uno::Reference< css::i18n::XExtendedTransliteration >& body );
102
104 css::uno::Sequence< OUString > getRange(
105 const css::uno::Sequence< OUString > &inStrs,
106 sal_Int32 length, const sal_Int16 _nCascade);
107};
108
109}
110
111/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OptionalString sType
css::uno::Reference< css::i18n::XExtendedTransliteration > caseignore
virtual OUString SAL_CALL folding(const OUString &inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 > &offset) override
virtual void SAL_CALL loadModuleNew(const css::uno::Sequence< css::i18n::TransliterationModulesNew > &modName, const css::lang::Locale &rLocale) override
virtual void SAL_CALL loadModulesByImplNames(const css::uno::Sequence< OUString > &modNamelist, const css::lang::Locale &rLocale) override
virtual sal_Int32 SAL_CALL compareString(const OUString &s1, const OUString &s2) override
virtual OUString SAL_CALL transliterateString2String(const OUString &inStr, sal_Int32 startPos, sal_Int32 nCount) override
virtual css::uno::Sequence< OUString > SAL_CALL transliterateRange(const OUString &str1, const OUString &str2) override
virtual OUString SAL_CALL transliterateChar2String(sal_Unicode inChar) override
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
virtual sal_Unicode SAL_CALL transliterateChar2Char(sal_Unicode inChar) override
virtual OUString SAL_CALL getName() override
css::uno::Sequence< OUString > getRange(const css::uno::Sequence< OUString > &inStrs, sal_Int32 length, const sal_Int16 _nCascade)
virtual OUString SAL_CALL transliterate(const OUString &inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 > &offset) override
virtual void SAL_CALL loadModule(css::i18n::TransliterationModules modName, const css::lang::Locale &rLocale) override
virtual void SAL_CALL loadModuleByImplName(const OUString &implName, const css::lang::Locale &rLocale) override
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
virtual sal_Int16 SAL_CALL getType() override
TransliterationImpl(const css::uno::Reference< css::uno::XComponentContext > &xContext)
virtual css::uno::Sequence< OUString > SAL_CALL getAvailableModules(const css::lang::Locale &rLocale, sal_Int16 sType) override
void loadBody(OUString const &implName, css::uno::Reference< css::i18n::XExtendedTransliteration > &body)
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual OUString SAL_CALL getImplementationName() override
css::uno::Reference< css::uno::XComponentContext > mxContext
bool loadModuleByName(std::u16string_view implName, css::uno::Reference< css::i18n::XExtendedTransliteration > &body, const css::lang::Locale &rLocale)
css::uno::Reference< css::i18n::XLocaleData5 > mxLocaledata
css::uno::Reference< css::i18n::XExtendedTransliteration > bodyCascade[maxCascade]
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
int nCount
Constant values shared between i18npool and, for example, the number formatter.
const char * implName
#define maxCascade
unsigned char sal_Bool
sal_uInt16 sal_Unicode