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_DEFAULT_NUMBERING_PROVIDER_HXX_
24 #define _I18N_DEFAULT_NUMBERING_PROVIDER_HXX_
25 
26 #include <com/sun/star/text/XDefaultNumberingProvider.hpp>
27 #include <com/sun/star/text/XNumberingFormatter.hpp>
28 #include <com/sun/star/text/XNumberingTypeInfo.hpp>
29 #include <com/sun/star/lang/XServiceInfo.hpp>
30 #include <cppuhelper/implbase4.hxx>
31 #include <com/sun/star/i18n/XTransliteration.hpp>
32 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
33 
34 #include <transliterationImpl.hxx>
35 
36 namespace com { namespace sun { namespace star { namespace i18n {
37 
38 class DefaultNumberingProvider : public cppu::WeakImplHelper4
39 <
40 	com::sun::star::text::XDefaultNumberingProvider,
41 	com::sun::star::text::XNumberingFormatter,
42 	com::sun::star::text::XNumberingTypeInfo,
43 	com::sun::star::lang::XServiceInfo
44 >
45 {
46 	void GetCharStrN( sal_Int32 nValue, sal_Int16 nType, rtl::OUString& rStr ) const;
47 	void GetCharStr( sal_Int32 nValue, sal_Int16 nType, rtl::OUString& rStr ) const;
48 	void GetRomanString( sal_Int32 nValue, sal_Int16 nType, rtl::OUString& rStr ) const;
49     void impl_loadTranslit();
50 public:
51 	DefaultNumberingProvider(
52 		const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& xMSF );
53 	~DefaultNumberingProvider();
54 
55 	//XDefaultNumberingProvider
56 	virtual com::sun::star::uno::Sequence< com::sun::star::uno::Reference<
57 		com::sun::star::container::XIndexAccess > > SAL_CALL
58 		getDefaultOutlineNumberings( const com::sun::star::lang::Locale& aLocale )
59 		throw(com::sun::star::uno::RuntimeException);
60 
61 	virtual com::sun::star::uno::Sequence< com::sun::star::uno::Sequence<
62 		com::sun::star::beans::PropertyValue > > SAL_CALL
63 		getDefaultContinuousNumberingLevels( const com::sun::star::lang::Locale& aLocale )
64 		throw(com::sun::star::uno::RuntimeException);
65 
66 	//XNumberingFormatter
67 	virtual rtl::OUString SAL_CALL makeNumberingString(
68 		const com::sun::star::uno::Sequence<
69 		com::sun::star::beans::PropertyValue >& aProperties,
70 		const com::sun::star::lang::Locale& aLocale )
71 		throw(com::sun::star::lang::IllegalArgumentException,
72 		com::sun::star::uno::RuntimeException);
73 
74 	//XNumberingTypeInfo
75 	virtual com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSupportedNumberingTypes(  )
76 		throw(com::sun::star::uno::RuntimeException);
77 	virtual sal_Int16 SAL_CALL getNumberingType( const rtl::OUString& NumberingIdentifier )
78 		throw(com::sun::star::uno::RuntimeException);
79 	virtual sal_Bool SAL_CALL hasNumberingType( const rtl::OUString& NumberingIdentifier )
80 		throw(com::sun::star::uno::RuntimeException);
81 	virtual rtl::OUString SAL_CALL getNumberingIdentifier( sal_Int16 NumberingType )
82 		throw(com::sun::star::uno::RuntimeException);
83 
84 	//XServiceInfo
85 	virtual rtl::OUString SAL_CALL getImplementationName(void)
86                 throw( com::sun::star::uno::RuntimeException );
87 	virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName)
88                 throw( com::sun::star::uno::RuntimeException );
89 	virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void)
90                 throw( com::sun::star::uno::RuntimeException );
91 private:
92 	com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xSMgr;
93 	com::sun::star::uno::Reference < com::sun::star::container::XHierarchicalNameAccess > xHierarchicalNameAccess;
94 	TransliterationImpl* translit;
95 	rtl::OUString SAL_CALL makeNumberingIdentifier( sal_Int16 index )
96 		throw(com::sun::star::uno::RuntimeException);
97 	sal_Bool SAL_CALL isScriptFlagEnabled(const rtl::OUString& aName )
98 		throw(com::sun::star::uno::RuntimeException);
99 };
100 } } } }
101 
102 #endif
103