1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef _I18N_TRANSLITERATION_TRANSLITERATION_COMMONCLASS_H_ 24 #define _I18N_TRANSLITERATION_TRANSLITERATION_COMMONCLASS_H_ 25 26 #include <com/sun/star/i18n/XExtendedTransliteration.hpp> 27 #include <com/sun/star/i18n/TransliterationType.hpp> 28 #include <cppuhelper/implbase1.hxx> 29 #include <rtl/ustrbuf.h> 30 #include <rtl/ustring.hxx> 31 #include <i18nutil/x_rtl_ustring.h> 32 33 namespace com { namespace sun { namespace star { namespace i18n { 34 35 class transliteration_commonclass : public cppu::WeakImplHelper1< com::sun::star::i18n::XExtendedTransliteration > 36 { 37 public: 38 transliteration_commonclass(); 39 40 // Methods which are shared. 41 void SAL_CALL 42 loadModule( TransliterationModules modName, const com::sun::star::lang::Locale& rLocale ) 43 throw(com::sun::star::uno::RuntimeException); 44 45 void SAL_CALL 46 loadModuleNew( const com::sun::star::uno::Sequence< TransliterationModulesNew >& modName, const com::sun::star::lang::Locale& rLocale ) 47 throw(com::sun::star::uno::RuntimeException); 48 49 void SAL_CALL 50 loadModuleByImplName( const rtl::OUString& implName, const com::sun::star::lang::Locale& rLocale ) 51 throw(com::sun::star::uno::RuntimeException); 52 53 void SAL_CALL 54 loadModulesByImplNames(const com::sun::star::uno::Sequence< rtl::OUString >& modNamelist, const com::sun::star::lang::Locale& rLocale) 55 throw(com::sun::star::uno::RuntimeException); 56 57 com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL 58 getAvailableModules( const com::sun::star::lang::Locale& rLocale, sal_Int16 sType ) 59 throw(com::sun::star::uno::RuntimeException); 60 61 // Methods which should be implemented in each transliteration module. 62 virtual rtl::OUString SAL_CALL getName() throw(com::sun::star::uno::RuntimeException); 63 64 virtual sal_Int16 SAL_CALL getType( ) throw(com::sun::star::uno::RuntimeException) = 0; 65 66 virtual rtl::OUString SAL_CALL 67 transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset ) 68 throw(com::sun::star::uno::RuntimeException) = 0; 69 70 virtual rtl::OUString SAL_CALL 71 folding( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset) 72 throw(com::sun::star::uno::RuntimeException) = 0; 73 74 // Methods in XExtendedTransliteration 75 virtual rtl::OUString SAL_CALL 76 transliterateString2String( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount ) 77 throw(com::sun::star::uno::RuntimeException); 78 virtual rtl::OUString SAL_CALL 79 transliterateChar2String( sal_Unicode inChar) 80 throw(com::sun::star::uno::RuntimeException); 81 virtual sal_Unicode SAL_CALL 82 transliterateChar2Char( sal_Unicode inChar ) 83 throw(com::sun::star::i18n::MultipleCharsOutputException, 84 com::sun::star::uno::RuntimeException) = 0; 85 86 virtual sal_Bool SAL_CALL 87 equals( const rtl::OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1, const rtl::OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 ) 88 throw(com::sun::star::uno::RuntimeException) = 0; 89 90 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL 91 transliterateRange( const rtl::OUString& str1, const rtl::OUString& str2 ) 92 throw(com::sun::star::uno::RuntimeException) = 0; 93 94 virtual sal_Int32 SAL_CALL 95 compareSubstring( const rtl::OUString& s1, sal_Int32 off1, sal_Int32 len1, const rtl::OUString& s2, sal_Int32 off2, sal_Int32 len2) 96 throw(com::sun::star::uno::RuntimeException); 97 98 virtual sal_Int32 SAL_CALL 99 compareString( const rtl::OUString& s1, const rtl::OUString& s2) 100 throw(com::sun::star::uno::RuntimeException); 101 102 //XServiceInfo 103 virtual rtl::OUString SAL_CALL getImplementationName() 104 throw( com::sun::star::uno::RuntimeException ); 105 virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) 106 throw( com::sun::star::uno::RuntimeException ); 107 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() 108 throw( com::sun::star::uno::RuntimeException ); 109 protected: 110 com::sun::star::lang::Locale aLocale; 111 const sal_Char* transliterationName; 112 const sal_Char* implementationName; 113 sal_Bool useOffset; 114 }; 115 116 } } } } 117 118 #endif // _I18N_TRANSLITERATION_TRANSLITERATION_COMMONCLASS_H_ 119