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                 throw (::com::sun::star::uno::RuntimeException);
50 
51         virtual sal_Bool SAL_CALL isValidNatNum( const ::com::sun::star::lang::Locale& aLocale,
52                 sal_Int16 nNativeNumberMode )
53                 throw (::com::sun::star::uno::RuntimeException);
54 
55         virtual ::com::sun::star::i18n::NativeNumberXmlAttributes SAL_CALL convertToXmlAttributes(
56                 const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nNativeNumberMode )
57                 throw (::com::sun::star::uno::RuntimeException);
58 
59         virtual sal_Int16 SAL_CALL convertFromXmlAttributes(
60                 const ::com::sun::star::i18n::NativeNumberXmlAttributes& aAttr )
61                 throw (::com::sun::star::uno::RuntimeException);
62 
63         //XServiceInfo
64         virtual rtl::OUString SAL_CALL getImplementationName()
65                 throw( com::sun::star::uno::RuntimeException );
66         virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName)
67                 throw( com::sun::star::uno::RuntimeException );
68         virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames()
69                 throw( com::sun::star::uno::RuntimeException );
70 
71         // following methods are not for XNativeNumberSupplier, they are for calling from transliterations
72         ::rtl::OUString SAL_CALL getNativeNumberString( const ::rtl::OUString& aNumberString,
73                 const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nNativeNumberMode,
74                 com::sun::star::uno::Sequence< sal_Int32 >& offset  )
75                 throw (::com::sun::star::uno::RuntimeException);
76         sal_Unicode SAL_CALL getNativeNumberChar( const sal_Unicode inChar,
77                 const ::com::sun::star::lang::Locale& aLocale, sal_Int16 nNativeNumberMode )
78                 throw(com::sun::star::uno::RuntimeException) ;
79 
80 private:
81         ::com::sun::star::lang::Locale aLocale;
82         sal_Bool useOffset;
83 };
84 
85 } } } }
86 
87 #endif
88