bump product version to 5.0.4.1
[LibreOffice.git] / i18npool / inc / characterclassificationImpl.hxx
blob59f84b769d1159f4ec44a1ffd1fb9a72aaffad16
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/implbase2.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 com { namespace sun { namespace star { namespace i18n {
31 class CharacterClassificationImpl : public cppu::WeakImplHelper2
33 XCharacterClassification,
34 com::sun::star::lang::XServiceInfo
37 public:
39 CharacterClassificationImpl( const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& rxContext );
40 virtual ~CharacterClassificationImpl();
42 virtual OUString SAL_CALL toUpper( const OUString& Text,
43 sal_Int32 nPos, sal_Int32 nCount, const com::sun::star::lang::Locale& rLocale )
44 throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
45 virtual OUString SAL_CALL toLower( const OUString& Text,
46 sal_Int32 nPos, sal_Int32 nCount, const com::sun::star::lang::Locale& rLocale )
47 throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
48 virtual OUString SAL_CALL toTitle( const OUString& Text, sal_Int32 nPos,
49 sal_Int32 nCount, const com::sun::star::lang::Locale& rLocale )
50 throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
51 virtual sal_Int16 SAL_CALL getType( const OUString& Text, sal_Int32 nPos )
52 throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
53 virtual sal_Int16 SAL_CALL getCharacterDirection( const OUString& Text, sal_Int32 nPos )
54 throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
55 virtual sal_Int16 SAL_CALL getScript( const OUString& Text, sal_Int32 nPos )
56 throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
57 virtual sal_Int32 SAL_CALL getCharacterType( const OUString& text, sal_Int32 nPos,
58 const com::sun::star::lang::Locale& rLocale )
59 throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
60 virtual sal_Int32 SAL_CALL getStringType( const OUString& text, sal_Int32 nPos,
61 sal_Int32 nCount, const com::sun::star::lang::Locale& rLocale )
62 throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
63 virtual ParseResult SAL_CALL parseAnyToken( const OUString& Text, sal_Int32 nPos,
64 const com::sun::star::lang::Locale& rLocale, sal_Int32 nStartCharFlags,
65 const OUString& userDefinedCharactersStart, sal_Int32 nContCharFlags,
66 const OUString& userDefinedCharactersCont )
67 throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
68 virtual ParseResult SAL_CALL parsePredefinedToken( sal_Int32 nTokenType,
69 const OUString& Text, sal_Int32 nPos, const com::sun::star::lang::Locale& rLocale,
70 sal_Int32 nStartCharFlags, const OUString& userDefinedCharactersStart,
71 sal_Int32 nContCharFlags, const OUString& userDefinedCharactersCont )
72 throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
74 //XServiceInfo
75 virtual OUString SAL_CALL getImplementationName()
76 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
77 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName)
78 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
79 virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
80 throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
82 private:
83 struct lookupTableItem {
84 lookupTableItem(const com::sun::star::lang::Locale& rLocale, const OUString& rName,
85 com::sun::star::uno::Reference < XCharacterClassification >& rxCI) :
86 aLocale(rLocale), aName(rName), xCI(rxCI) {};
87 com::sun::star::lang::Locale aLocale;
88 OUString aName;
89 com::sun::star::uno::Reference < XCharacterClassification > xCI;
90 bool SAL_CALL equals(const com::sun::star::lang::Locale& rLocale) {
91 return aLocale.Language == rLocale.Language &&
92 aLocale.Country == rLocale.Country &&
93 aLocale.Variant == rLocale.Variant;
96 std::vector<lookupTableItem*> lookupTable;
97 lookupTableItem *cachedItem;
99 com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > m_xContext;
100 com::sun::star::uno::Reference < XCharacterClassification > xUCI;
102 com::sun::star::uno::Reference < XCharacterClassification > SAL_CALL
103 getLocaleSpecificCharacterClassification(const com::sun::star::lang::Locale& rLocale) throw(com::sun::star::uno::RuntimeException);
104 bool SAL_CALL
105 createLocaleSpecificCharacterClassification(const OUString& serviceName, const com::sun::star::lang::Locale& rLocale);
109 } } } }
111 #endif
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */