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_TRANSLITERATIONIMPL_HXX_ 24 #define _I18N_TRANSLITERATIONIMPL_HXX_ 25 26 #include <com/sun/star/i18n/XLocaleData.hpp> 27 #include <com/sun/star/i18n/XExtendedTransliteration.hpp> 28 #include <cppuhelper/implbase2.hxx> // helper for implementations 29 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 30 #include <com/sun/star/lang/XServiceInfo.hpp> 31 #include <sal/types.h> 32 33 namespace com { namespace sun { namespace star { namespace i18n { 34 35 #if OSL_DEBUG_LEVEL > 1 36 #define RETURN_DEBUG_STRING (rtl::OUString::createFromAscii("return from transliterationImpl")); 37 #define RETURN_DEBUG_NUMBER 'TRAN' 38 #else 39 #define RETURN_DEBUG_STRING 40 #define RETURN_DEBUG_NUMBER 41 #endif 42 43 class TransliterationImpl : public cppu::WeakImplHelper2 44 < 45 com::sun::star::i18n::XExtendedTransliteration, 46 com::sun::star::lang::XServiceInfo 47 > 48 { 49 public: 50 // Constructors 51 TransliterationImpl(const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& xMSF); 52 // Destructor 53 ~TransliterationImpl(); 54 55 // Methods 56 virtual rtl::OUString SAL_CALL getName( ) throw(com::sun::star::uno::RuntimeException) ; 57 virtual sal_Int16 SAL_CALL getType( ) throw(com::sun::star::uno::RuntimeException) ; 58 59 virtual void SAL_CALL loadModule( TransliterationModules modName, const com::sun::star::lang::Locale& rLocale ) 60 throw(com::sun::star::uno::RuntimeException) ; 61 virtual void SAL_CALL loadModuleNew( const com::sun::star::uno::Sequence< TransliterationModulesNew >& modName, 62 const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException) ; 63 virtual void SAL_CALL loadModuleByImplName( const rtl::OUString& implName, 64 const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException); 65 virtual void SAL_CALL loadModulesByImplNames(const com::sun::star::uno::Sequence< rtl::OUString >& modNamelist, 66 const com::sun::star::lang::Locale& rLocale) throw(com::sun::star::uno::RuntimeException); 67 68 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getAvailableModules( 69 const com::sun::star::lang::Locale& rLocale, sal_Int16 sType ) 70 throw(com::sun::star::uno::RuntimeException); 71 72 virtual rtl::OUString SAL_CALL transliterate( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, 73 com::sun::star::uno::Sequence< sal_Int32 >& offset ) throw(com::sun::star::uno::RuntimeException) ; 74 75 virtual rtl::OUString SAL_CALL folding( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, 76 com::sun::star::uno::Sequence< sal_Int32 >& offset ) throw(com::sun::star::uno::RuntimeException); 77 78 // Methods in XExtendedTransliteration 79 virtual rtl::OUString SAL_CALL transliterateString2String( const rtl::OUString& inStr, sal_Int32 startPos, sal_Int32 nCount ) 80 throw(com::sun::star::uno::RuntimeException) ; 81 virtual rtl::OUString SAL_CALL transliterateChar2String( sal_Unicode inChar ) 82 throw(com::sun::star::uno::RuntimeException) ; 83 virtual sal_Unicode SAL_CALL transliterateChar2Char( sal_Unicode inChar ) 84 throw(com::sun::star::i18n::MultipleCharsOutputException, 85 com::sun::star::uno::RuntimeException) ; 86 87 /* 88 virtual void SAL_CALL createCascadeInstance( const com::sun::star::uno::Sequence< rtl::OUString >& modNamelist, 89 const com::sun::star::lang::Locale& rLocale ) throw(com::sun::star::uno::RuntimeException) ; 90 virtual rtl::OUString SAL_CALL folding_reverse( const rtl::OUString& inStr, sal_Int32 startPos, 91 sal_Int32 nCount ) throw(com::sun::star::uno::RuntimeException); 92 virtual sal_Int32 SAL_CALL transliterateMatch( const rtl::OUString& content, sal_Int32 pos1, sal_Int32 nCount1, 93 const rtl::OUString& pattern, sal_Int32 pos2, sal_Int32 nCount2 ) 94 throw(com::sun::star::uno::RuntimeException); 95 */ 96 virtual sal_Bool SAL_CALL equals( const rtl::OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, 97 sal_Int32& nMatch1, const rtl::OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 ) 98 throw(com::sun::star::uno::RuntimeException); 99 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL transliterateRange( const rtl::OUString& str1, 100 const rtl::OUString& str2 ) throw(com::sun::star::uno::RuntimeException) ; 101 102 virtual sal_Int32 SAL_CALL compareSubstring( const rtl::OUString& s1, sal_Int32 off1, sal_Int32 len1, 103 const rtl::OUString& s2, sal_Int32 off2, sal_Int32 len2) throw(com::sun::star::uno::RuntimeException); 104 105 virtual sal_Int32 SAL_CALL compareString( const rtl::OUString& s1, const rtl::OUString& s2) 106 throw(com::sun::star::uno::RuntimeException); 107 108 //XServiceInfo 109 virtual rtl::OUString SAL_CALL getImplementationName(void) throw( com::sun::star::uno::RuntimeException ); 110 virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName) 111 throw( com::sun::star::uno::RuntimeException ); 112 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void) 113 throw( com::sun::star::uno::RuntimeException ); 114 115 private: 116 #define maxCascade 27 117 com::sun::star::uno::Reference< com::sun::star::i18n::XExtendedTransliteration > bodyCascade[maxCascade]; 118 sal_Int16 numCascade; 119 sal_Bool caseignoreOnly; 120 com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xSMgr; 121 com::sun::star::uno::Reference< XLocaleData > localedata; 122 com::sun::star::uno::Reference< com::sun::star::i18n::XExtendedTransliteration > caseignore; 123 124 virtual sal_Bool SAL_CALL loadModuleByName( const rtl::OUString& implName, 125 com::sun::star::uno::Reference<com::sun::star::i18n::XExtendedTransliteration> & body, const com::sun::star::lang::Locale& rLocale) 126 throw(com::sun::star::uno::RuntimeException); 127 128 void clear(); 129 130 void loadBody( ::rtl::OUString &implName, 131 ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XExtendedTransliteration >& body ) 132 throw (::com::sun::star::uno::RuntimeException); 133 134 com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getRange( 135 const com::sun::star::uno::Sequence< rtl::OUString > &inStrs, 136 sal_Int32 length, const sal_Int16 _nCascade) 137 throw(com::sun::star::uno::RuntimeException); 138 }; 139 140 } } } } 141 142 #endif 143