xref: /trunk/main/svl/source/numbers/supservs.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _SVTOOLS_NUMBERS_SUPPLIERSERVICE_HXX_
29 #define _SVTOOLS_NUMBERS_SUPPLIERSERVICE_HXX_
30 
31 #include <svl/numuno.hxx>
32 #include <svl/zforlist.hxx>
33 #include <com/sun/star/lang/XInitialization.hpp>
34 #include <com/sun/star/lang/XServiceInfo.hpp>
35 #include <com/sun/star/io/XPersistObject.hpp>
36 
37 //=========================================================================
38 //= SvNumberFormatsSupplierServiceObject - a number formats supplier which
39 //=				- can be instantiated as an service
40 //=				- supports the ::com::sun::star::io::XPersistObject interface
41 //=				- works with it's own SvNumberFormatter instance
42 //=				- can be initialized (::com::sun::star::lang::XInitialization)
43 //=					with a specific language (i.e. ::com::sun::star::lang::Locale)
44 //=========================================================================
45 class SvNumberFormatsSupplierServiceObject
46 			:protected SvNumberFormatsSupplierObj
47 			,public ::com::sun::star::lang::XInitialization
48 			,public ::com::sun::star::io::XPersistObject
49 			,public ::com::sun::star::lang::XServiceInfo
50 {	// don't want the Set-/GetNumberFormatter to be accessable from outside
51 
52 	friend ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
53 		SAL_CALL SvNumberFormatsSupplierServiceObject_CreateInstance(
54 			const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&);
55 
56 protected:
57 	SvNumberFormatter*	m_pOwnFormatter;
58 	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
59 						m_xORB;
60 
61 public:
62 	SvNumberFormatsSupplierServiceObject(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB);
63 	~SvNumberFormatsSupplierServiceObject();
64 
65 	// XInterface
66 	virtual void SAL_CALL acquire() throw() { SvNumberFormatsSupplierObj::acquire(); }
67 	virtual void SAL_CALL release() throw() { SvNumberFormatsSupplierObj::release(); }
68 	virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException)
69 		{ return SvNumberFormatsSupplierObj::queryInterface(_rType); }
70 
71 	// XAggregation
72 	virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException);
73 
74 	// XInitialization
75 	virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
76 
77 	// XServiceInfo
78     virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw(::com::sun::star::uno::RuntimeException);
79     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException);
80     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw(::com::sun::star::uno::RuntimeException);
81 
82 	// XPersistObject
83     virtual ::rtl::OUString SAL_CALL getServiceName(  ) throw(::com::sun::star::uno::RuntimeException);
84     virtual void SAL_CALL write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
85     virtual void SAL_CALL read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
86 
87 	// XNumberFormatsSupplier
88 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL
89 				getNumberFormatSettings() throw(::com::sun::star::uno::RuntimeException);
90 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats > SAL_CALL
91 				getNumberFormats() throw(::com::sun::star::uno::RuntimeException);
92 
93 	// XUnoTunnler
94     virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw (::com::sun::star::uno::RuntimeException);
95 
96 protected:
97 	void implEnsureFormatter();
98 };
99 
100 
101 #endif // _SVTOOLS_NUMBERS_SUPPLIERSERVICE_HXX_
102 
103