1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/implbase2.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 #if OSL_DEBUG_LEVEL > 1
32 #define RETURN_DEBUG_STRING ("return from transliterationImpl");
33 #define RETURN_DEBUG_NUMBER 'TRAN'
35 #define RETURN_DEBUG_STRING
36 #define RETURN_DEBUG_NUMBER
39 class TransliterationImpl
: public cppu::WeakImplHelper2
41 com::sun::star::i18n::XExtendedTransliteration
,
42 com::sun::star::lang::XServiceInfo
47 TransliterationImpl(const com::sun::star::uno::Reference
< com::sun::star::uno::XComponentContext
>& xContext
);
49 virtual ~TransliterationImpl();
52 virtual OUString SAL_CALL
getName( ) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
53 virtual sal_Int16 SAL_CALL
getType( ) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
55 virtual void SAL_CALL
loadModule( TransliterationModules modName
, const com::sun::star::lang::Locale
& rLocale
)
56 throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
57 virtual void SAL_CALL
loadModuleNew( const com::sun::star::uno::Sequence
< TransliterationModulesNew
>& modName
,
58 const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
59 virtual void SAL_CALL
loadModuleByImplName( const OUString
& implName
,
60 const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
61 virtual void SAL_CALL
loadModulesByImplNames(const com::sun::star::uno::Sequence
< OUString
>& modNamelist
,
62 const com::sun::star::lang::Locale
& rLocale
) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
64 virtual com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getAvailableModules(
65 const com::sun::star::lang::Locale
& rLocale
, sal_Int16 sType
)
66 throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
68 virtual OUString SAL_CALL
transliterate( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
,
69 com::sun::star::uno::Sequence
< sal_Int32
>& offset
) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
71 virtual OUString SAL_CALL
folding( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
,
72 com::sun::star::uno::Sequence
< sal_Int32
>& offset
) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
74 // Methods in XExtendedTransliteration
75 virtual OUString SAL_CALL
transliterateString2String( const OUString
& inStr
, sal_Int32 startPos
, sal_Int32 nCount
)
76 throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
77 virtual OUString SAL_CALL
transliterateChar2String( sal_Unicode inChar
)
78 throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
79 virtual sal_Unicode SAL_CALL
transliterateChar2Char( sal_Unicode inChar
)
80 throw(com::sun::star::i18n::MultipleCharsOutputException
,
81 com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
83 virtual sal_Bool SAL_CALL
equals( const OUString
& str1
, sal_Int32 pos1
, sal_Int32 nCount1
,
84 sal_Int32
& nMatch1
, const OUString
& str2
, sal_Int32 pos2
, sal_Int32 nCount2
, sal_Int32
& nMatch2
)
85 throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
86 virtual com::sun::star::uno::Sequence
< OUString
> SAL_CALL
transliterateRange( const OUString
& str1
,
87 const OUString
& str2
) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
89 virtual sal_Int32 SAL_CALL
compareSubstring( const OUString
& s1
, sal_Int32 off1
, sal_Int32 len1
,
90 const OUString
& s2
, sal_Int32 off2
, sal_Int32 len2
) throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
92 virtual sal_Int32 SAL_CALL
compareString( const OUString
& s1
, const OUString
& s2
)
93 throw(com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
96 virtual OUString SAL_CALL
getImplementationName() throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
97 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
)
98 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
99 virtual com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
100 throw( com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
103 #define maxCascade 27
104 com::sun::star::uno::Reference
< com::sun::star::i18n::XExtendedTransliteration
> bodyCascade
[maxCascade
];
105 sal_Int16 numCascade
;
107 com::sun::star::uno::Reference
< com::sun::star::uno::XComponentContext
> mxContext
;
108 com::sun::star::uno::Reference
< XLocaleData4
> mxLocaledata
;
109 com::sun::star::uno::Reference
< com::sun::star::i18n::XExtendedTransliteration
> caseignore
;
111 virtual bool SAL_CALL
loadModuleByName( const OUString
& implName
,
112 com::sun::star::uno::Reference
<com::sun::star::i18n::XExtendedTransliteration
> & body
, const com::sun::star::lang::Locale
& rLocale
)
113 throw(com::sun::star::uno::RuntimeException
);
117 void loadBody( OUString
&implName
,
118 ::com::sun::star::uno::Reference
< ::com::sun::star::i18n::XExtendedTransliteration
>& body
)
119 throw (::com::sun::star::uno::RuntimeException
);
121 com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getRange(
122 const com::sun::star::uno::Sequence
< OUString
> &inStrs
,
123 sal_Int32 length
, const sal_Int16 _nCascade
)
124 throw(com::sun::star::uno::RuntimeException
);
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */