update dev300-m58
[ooovba.git] / i18npool / inc / characterclassificationImpl.hxx
blob377175d8ae8f62d9284d1d58aae139329d7b180c
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: characterclassificationImpl.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _I18N_CHARACTERCLASSIFICATIONIMPL_HXX_
31 #define _I18N_CHARACTERCLASSIFICATIONIMPL_HXX_
33 #include <com/sun/star/i18n/XCharacterClassification.hpp>
34 #include <cppuhelper/implbase2.hxx> // helper for implementations
35 #include <vector>
36 #include <com/sun/star/i18n/KCharacterType.hpp>
37 #include <com/sun/star/lang/XServiceInfo.hpp>
39 namespace com { namespace sun { namespace star { namespace i18n {
41 class CharacterClassificationImpl : public cppu::WeakImplHelper2
43 XCharacterClassification,
44 com::sun::star::lang::XServiceInfo
47 public:
49 CharacterClassificationImpl( const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& rxMSF );
50 virtual ~CharacterClassificationImpl();
52 virtual rtl::OUString SAL_CALL toUpper( const rtl::OUString& Text,
53 sal_Int32 nPos, sal_Int32 nCount, const com::sun::star::lang::Locale& rLocale )
54 throw(com::sun::star::uno::RuntimeException);
55 virtual rtl::OUString SAL_CALL toLower( const rtl::OUString& Text,
56 sal_Int32 nPos, sal_Int32 nCount, const com::sun::star::lang::Locale& rLocale )
57 throw(com::sun::star::uno::RuntimeException);
58 virtual rtl::OUString SAL_CALL toTitle( const rtl::OUString& Text, sal_Int32 nPos,
59 sal_Int32 nCount, const com::sun::star::lang::Locale& rLocale )
60 throw(com::sun::star::uno::RuntimeException);
61 virtual sal_Int16 SAL_CALL getType( const rtl::OUString& Text, sal_Int32 nPos )
62 throw(com::sun::star::uno::RuntimeException);
63 virtual sal_Int16 SAL_CALL getCharacterDirection( const rtl::OUString& Text, sal_Int32 nPos )
64 throw(com::sun::star::uno::RuntimeException);
65 virtual sal_Int16 SAL_CALL getScript( const rtl::OUString& Text, sal_Int32 nPos )
66 throw(com::sun::star::uno::RuntimeException);
67 virtual sal_Int32 SAL_CALL getCharacterType( const rtl::OUString& text, sal_Int32 nPos,
68 const com::sun::star::lang::Locale& rLocale )
69 throw(com::sun::star::uno::RuntimeException);
70 virtual sal_Int32 SAL_CALL getStringType( const rtl::OUString& text, sal_Int32 nPos,
71 sal_Int32 nCount, const com::sun::star::lang::Locale& rLocale )
72 throw(com::sun::star::uno::RuntimeException);
73 virtual ParseResult SAL_CALL parseAnyToken( const rtl::OUString& Text, sal_Int32 nPos,
74 const com::sun::star::lang::Locale& rLocale, sal_Int32 nStartCharFlags,
75 const rtl::OUString& userDefinedCharactersStart, sal_Int32 nContCharFlags,
76 const rtl::OUString& userDefinedCharactersCont )
77 throw(com::sun::star::uno::RuntimeException);
78 virtual ParseResult SAL_CALL parsePredefinedToken( sal_Int32 nTokenType,
79 const rtl::OUString& Text, sal_Int32 nPos, const com::sun::star::lang::Locale& rLocale,
80 sal_Int32 nStartCharFlags, const rtl::OUString& userDefinedCharactersStart,
81 sal_Int32 nContCharFlags, const rtl::OUString& userDefinedCharactersCont )
82 throw(com::sun::star::uno::RuntimeException);
84 //XServiceInfo
85 virtual rtl::OUString SAL_CALL getImplementationName(void)
86 throw( com::sun::star::uno::RuntimeException );
87 virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName)
88 throw( com::sun::star::uno::RuntimeException );
89 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void)
90 throw( com::sun::star::uno::RuntimeException );
92 private:
93 struct lookupTableItem {
94 lookupTableItem(const com::sun::star::lang::Locale& rLocale, const rtl::OUString& rName,
95 com::sun::star::uno::Reference < XCharacterClassification >& rxCI) :
96 aLocale(rLocale), aName(rName), xCI(rxCI) {};
97 com::sun::star::lang::Locale aLocale;
98 rtl::OUString aName;
99 com::sun::star::uno::Reference < XCharacterClassification > xCI;
100 sal_Bool SAL_CALL equals(const com::sun::star::lang::Locale& rLocale) {
101 return aLocale.Language == rLocale.Language &&
102 aLocale.Country == rLocale.Country &&
103 aLocale.Variant == rLocale.Variant;
106 std::vector<lookupTableItem*> lookupTable;
107 lookupTableItem *cachedItem;
109 com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xMSF;
110 com::sun::star::uno::Reference < XCharacterClassification > xUCI;
112 com::sun::star::uno::Reference < XCharacterClassification > SAL_CALL
113 getLocaleSpecificCharacterClassification(const com::sun::star::lang::Locale& rLocale) throw(com::sun::star::uno::RuntimeException);
114 sal_Bool SAL_CALL
115 createLocaleSpecificCharacterClassification(const rtl::OUString& serviceName, const com::sun::star::lang::Locale& rLocale);
119 } } } }
121 #endif