1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef _I18N_TRANSLITERATION_TRANSLITERATION_COMMONCLASS_H_ 28 #define _I18N_TRANSLITERATION_TRANSLITERATION_COMMONCLASS_H_ 29 30 #include <com/sun/star/i18n/XExtendedTransliteration.hpp> 31 #include <com/sun/star/i18n/TransliterationType.hpp> 32 #include <cppuhelper/implbase1.hxx> 33 #include <rtl/ustrbuf.h> 34 #include <rtl/ustring.hxx> 35 #include <i18nutil/x_rtl_ustring.h> 36 37 namespace com { namespace sun { namespace star { namespace i18n { 38 39 class transliteration_commonclass : public cppu::WeakImplHelper1< com::sun::star::i18n::XExtendedTransliteration > 40 { 41 public: 42 transliteration_commonclass(); 43 44 // Methods which are shared. 45 void SAL_CALL 46 loadModule( TransliterationModules modName, const com::sun::star::lang::Locale& rLocale ) 47 throw(com::sun::star::uno::RuntimeException); 48 49 void SAL_CALL 50 loadModuleNew( const com::sun::star::uno::Sequence< TransliterationModulesNew >& modName, const com::sun::star::lang::Locale& rLocale ) 51 throw(com::sun::star::uno::RuntimeException); 52 53 void SAL_CALL 54 loadModuleByImplName( const rtl::OUString& implName, const com::sun::star::lang::Locale& rLocale ) 55 throw(com::sun::star::uno::RuntimeException); 56 57 void SAL_CALL 58 loadModulesByImplNames(const com::sun::star::uno::Sequence< rtl::OUString >& modNamelist, const com::sun::star::lang::Locale& rLocale) 59 throw(com::sun::star::uno::RuntimeException); 60 61 com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL 62 getAvailableModules( const com::sun::star::lang::Locale& rLocale, sal_Int16 sType ) 63 throw(com::sun::star::uno::RuntimeException); 64 65 // Methods which should be implemented in each transliteration module. 66 virtual rtl::OUString SAL_CALL getName() throw(com::sun::star::uno::RuntimeException); 67 68 virtual sal_Int16 SAL_CALL getType( ) throw(com::sun::star::uno::RuntimeException) = 0; 69 70 virtual rtl::OUString SAL_CALL 71 transliterate( 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 virtual rtl::OUString SAL_CALL 75 folding( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, com::sun::star::uno::Sequence< sal_Int32 >& offset) 76 throw(com::sun::star::uno::RuntimeException) = 0; 77 78 // Methods in XExtendedTransliteration 79 virtual rtl::OUString SAL_CALL 80 transliterateString2String( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount ) 81 throw(com::sun::star::uno::RuntimeException); 82 virtual rtl::OUString SAL_CALL 83 transliterateChar2String( sal_Unicode inChar) 84 throw(com::sun::star::uno::RuntimeException); 85 virtual sal_Unicode SAL_CALL 86 transliterateChar2Char( sal_Unicode inChar ) 87 throw(com::sun::star::i18n::MultipleCharsOutputException, 88 com::sun::star::uno::RuntimeException) = 0; 89 90 virtual sal_Bool SAL_CALL 91 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 ) 92 throw(com::sun::star::uno::RuntimeException) = 0; 93 94 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL 95 transliterateRange( const rtl::OUString& str1, const rtl::OUString& str2 ) 96 throw(com::sun::star::uno::RuntimeException) = 0; 97 98 virtual sal_Int32 SAL_CALL 99 compareSubstring( const rtl::OUString& s1, sal_Int32 off1, sal_Int32 len1, const rtl::OUString& s2, sal_Int32 off2, sal_Int32 len2) 100 throw(com::sun::star::uno::RuntimeException); 101 102 virtual sal_Int32 SAL_CALL 103 compareString( const rtl::OUString& s1, const rtl::OUString& s2) 104 throw(com::sun::star::uno::RuntimeException); 105 106 //XServiceInfo 107 virtual rtl::OUString SAL_CALL getImplementationName() 108 throw( com::sun::star::uno::RuntimeException ); 109 virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) 110 throw( com::sun::star::uno::RuntimeException ); 111 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() 112 throw( com::sun::star::uno::RuntimeException ); 113 protected: 114 com::sun::star::lang::Locale aLocale; 115 const sal_Char* transliterationName; 116 const sal_Char* implementationName; 117 sal_Bool useOffset; 118 }; 119 120 } } } } 121 122 #endif // _I18N_TRANSLITERATION_TRANSLITERATION_COMMONCLASS_H_ 123