Bump version to 6.0-36
[LibreOffice.git] / i18npool / inc / characterclassificationImpl.hxx
blob290418152622a5c678071e45f6238c353e626d59
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_CHARACTERCLASSIFICATIONIMPL_HXX
20 #define INCLUDED_I18NPOOL_INC_CHARACTERCLASSIFICATIONIMPL_HXX
22 #include <com/sun/star/i18n/XCharacterClassification.hpp>
23 #include <cppuhelper/implbase.hxx>
24 #include <vector>
25 #include <com/sun/star/i18n/KCharacterType.hpp>
26 #include <com/sun/star/lang/XServiceInfo.hpp>
27 #include <com/sun/star/uno/XComponentContext.hpp>
29 namespace i18npool {
31 class CharacterClassificationImpl : public cppu::WeakImplHelper
33 css::i18n::XCharacterClassification,
34 css::lang::XServiceInfo
37 public:
39 CharacterClassificationImpl( const css::uno::Reference < css::uno::XComponentContext >& rxContext );
40 virtual ~CharacterClassificationImpl() override;
42 virtual OUString SAL_CALL toUpper( const OUString& Text,
43 sal_Int32 nPos, sal_Int32 nCount, const css::lang::Locale& rLocale ) override;
44 virtual OUString SAL_CALL toLower( const OUString& Text,
45 sal_Int32 nPos, sal_Int32 nCount, const css::lang::Locale& rLocale ) override;
46 virtual OUString SAL_CALL toTitle( const OUString& Text, sal_Int32 nPos,
47 sal_Int32 nCount, const css::lang::Locale& rLocale ) override;
48 virtual sal_Int16 SAL_CALL getType( const OUString& Text, sal_Int32 nPos ) override;
49 virtual sal_Int16 SAL_CALL getCharacterDirection( const OUString& Text, sal_Int32 nPos ) override;
50 virtual sal_Int16 SAL_CALL getScript( const OUString& Text, sal_Int32 nPos ) override;
51 virtual sal_Int32 SAL_CALL getCharacterType( const OUString& text, sal_Int32 nPos,
52 const css::lang::Locale& rLocale ) override;
53 virtual sal_Int32 SAL_CALL getStringType( const OUString& text, sal_Int32 nPos,
54 sal_Int32 nCount, const css::lang::Locale& rLocale ) override;
55 virtual css::i18n::ParseResult SAL_CALL parseAnyToken( const OUString& Text, sal_Int32 nPos,
56 const css::lang::Locale& rLocale, sal_Int32 nStartCharFlags,
57 const OUString& userDefinedCharactersStart, sal_Int32 nContCharFlags,
58 const OUString& userDefinedCharactersCont ) override;
59 virtual css::i18n::ParseResult SAL_CALL parsePredefinedToken( sal_Int32 nTokenType,
60 const OUString& Text, sal_Int32 nPos, const css::lang::Locale& rLocale,
61 sal_Int32 nStartCharFlags, const OUString& userDefinedCharactersStart,
62 sal_Int32 nContCharFlags, const OUString& userDefinedCharactersCont ) override;
64 //XServiceInfo
65 virtual OUString SAL_CALL getImplementationName() override;
66 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
67 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
69 private:
70 struct lookupTableItem {
71 lookupTableItem(const css::lang::Locale& rLocale, const OUString& rName,
72 css::uno::Reference < XCharacterClassification > const & rxCI) :
73 aLocale(rLocale), aName(rName), xCI(rxCI) {};
74 css::lang::Locale aLocale;
75 OUString aName;
76 css::uno::Reference < XCharacterClassification > xCI;
77 bool SAL_CALL equals(const css::lang::Locale& rLocale) {
78 return aLocale.Language == rLocale.Language &&
79 aLocale.Country == rLocale.Country &&
80 aLocale.Variant == rLocale.Variant;
83 std::vector<lookupTableItem*> lookupTable;
84 lookupTableItem *cachedItem;
86 css::uno::Reference < css::uno::XComponentContext > m_xContext;
87 css::uno::Reference < XCharacterClassification > xUCI;
89 /// @throws css::uno::RuntimeException
90 css::uno::Reference < XCharacterClassification > const & SAL_CALL getLocaleSpecificCharacterClassification(const css::lang::Locale& rLocale);
91 bool SAL_CALL createLocaleSpecificCharacterClassification(const OUString& serviceName, const css::lang::Locale& rLocale);
97 #endif
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */