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_NATIVENUMBERSUPPLIER_HXX_ 24 #define _I18N_NATIVENUMBERSUPPLIER_HXX_ 25 26 #include <com/sun/star/i18n/XNativeNumberSupplier.hpp> 27 #include <com/sun/star/i18n/NativeNumberMode.hpp> 28 #include <com/sun/star/i18n/NativeNumberXmlAttributes.hpp> 29 #include <cppuhelper/implbase2.hxx> // helper for implementations 30 #include <com/sun/star/lang/XServiceInfo.hpp> 31 32 namespace com { namespace sun { namespace star { namespace i18n { 33 34 // ---------------------------------------------------- 35 // class NativeNumberSupplier 36 // ---------------------------------------------------- 37 class NativeNumberSupplier : public cppu::WeakImplHelper2 38 < 39 com::sun::star::i18n::XNativeNumberSupplier, 40 com::sun::star::lang::XServiceInfo 41 > 42 { 43 public: NativeNumberSupplier(sal_Bool _useOffset=sal_False)44 NativeNumberSupplier(sal_Bool _useOffset = sal_False) : useOffset(_useOffset) {} 45 46 // Methods 47 virtual ::rtl::OUString SAL_CALL getNativeNumberString( const ::rtl::OUString& aNumberString, 48 const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nNativeNumberMode ); 49 50 virtual sal_Bool SAL_CALL isValidNatNum( const ::com::sun::star::lang::Locale& aLocale, 51 sal_Int16 nNativeNumberMode ); 52 53 virtual ::com::sun::star::i18n::NativeNumberXmlAttributes SAL_CALL convertToXmlAttributes( 54 const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nNativeNumberMode ); 55 56 virtual sal_Int16 SAL_CALL convertFromXmlAttributes( 57 const ::com::sun::star::i18n::NativeNumberXmlAttributes& aAttr ); 58 59 //XServiceInfo 60 virtual rtl::OUString SAL_CALL getImplementationName(); 61 virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName); 62 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(); 63 64 // following methods are not for XNativeNumberSupplier, they are for calling from transliterations 65 ::rtl::OUString SAL_CALL getNativeNumberString( const ::rtl::OUString& aNumberString, 66 const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nNativeNumberMode, 67 com::sun::star::uno::Sequence< sal_Int32 >& offset ); 68 sal_Unicode SAL_CALL getNativeNumberChar( const sal_Unicode inChar, 69 const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nNativeNumberMode ) ; 70 71 private: 72 ::com::sun::star::lang::Locale aLocale; 73 sal_Bool useOffset; 74 }; 75 76 } } } } 77 78 #endif 79