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 24 #ifndef _VCL_I18NHELP_HXX 25 #define _VCL_I18NHELP_HXX 26 27 #include <com/sun/star/uno/Reference.h> 28 #include <com/sun/star/lang/Locale.hpp> 29 #include <osl/mutex.hxx> 30 #include <tools/string.hxx> 31 #include <vcl/dllapi.h> 32 33 namespace com { 34 namespace sun { 35 namespace star { 36 namespace lang { 37 class XMultiServiceFactory; 38 } 39 }}} 40 41 namespace utl { 42 class TransliterationWrapper; 43 } 44 45 class LocaleDataWrapper; 46 47 class Date; 48 49 namespace vcl 50 { 51 52 class VCL_DLLPUBLIC I18nHelper 53 { 54 private: 55 ::osl::Mutex maMutex; 56 ::com::sun::star::lang::Locale maLocale; 57 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF; 58 59 LocaleDataWrapper* mpLocaleDataWrapper; 60 utl::TransliterationWrapper* mpTransliterationWrapper; 61 62 sal_Bool mbTransliterateIgnoreCase; 63 64 SAL_DLLPRIVATE void ImplDestroyWrappers(); 65 66 protected: GetMutex()67 ::osl::Mutex& GetMutex() { return maMutex; } 68 69 SAL_DLLPRIVATE utl::TransliterationWrapper& ImplGetTransliterationWrapper() const; 70 SAL_DLLPRIVATE LocaleDataWrapper& ImplGetLocaleDataWrapper() const; 71 72 public: 73 74 I18nHelper( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMSF, const ::com::sun::star::lang::Locale& rLocale ); 75 ~I18nHelper(); 76 77 const ::com::sun::star::lang::Locale& getLocale() const; 78 79 sal_Int32 CompareString( const String& rStr1, const String& rStr2 ) const; 80 81 sal_Bool MatchString( const String& rStr1, const String& rStr2 ) const; 82 sal_Bool MatchMnemonic( const String& rString, sal_Unicode cMnemonicChar ) const; 83 84 String GetDate( const Date& rDate ) const; 85 String GetNum( long nNumber, sal_uInt16 nDecimals, sal_Bool bUseThousandSep = sal_True, sal_Bool bTrailingZeros = sal_True ) const; 86 87 static String filterFormattingChars( const String& ); 88 }; 89 90 } // namespace vcl 91 92 #endif // _VCL_I18NHELP_HXX 93 94