xref: /trunk/main/ucb/source/core/provprox.hxx (revision 6df1ea1f)
1*6df1ea1fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*6df1ea1fSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*6df1ea1fSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*6df1ea1fSAndrew Rist  * distributed with this work for additional information
6*6df1ea1fSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*6df1ea1fSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*6df1ea1fSAndrew Rist  * "License"); you may not use this file except in compliance
9*6df1ea1fSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*6df1ea1fSAndrew Rist  *
11*6df1ea1fSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*6df1ea1fSAndrew Rist  *
13*6df1ea1fSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*6df1ea1fSAndrew Rist  * software distributed under the License is distributed on an
15*6df1ea1fSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*6df1ea1fSAndrew Rist  * KIND, either express or implied.  See the License for the
17*6df1ea1fSAndrew Rist  * specific language governing permissions and limitations
18*6df1ea1fSAndrew Rist  * under the License.
19*6df1ea1fSAndrew Rist  *
20*6df1ea1fSAndrew Rist  *************************************************************/
21*6df1ea1fSAndrew Rist 
22*6df1ea1fSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _PROVPROX_HXX
25cdf0e10cSrcweir #define _PROVPROX_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <osl/mutex.hxx>
28cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
29cdf0e10cSrcweir #include <com/sun/star/lang/XTypeProvider.hpp>
30cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
31cdf0e10cSrcweir #include <com/sun/star/ucb/XContentProviderFactory.hpp>
32cdf0e10cSrcweir #include <com/sun/star/ucb/XContentProvider.hpp>
33cdf0e10cSrcweir #include <com/sun/star/ucb/XParameterizedContentProvider.hpp>
34cdf0e10cSrcweir #include <com/sun/star/ucb/XContentProviderSupplier.hpp>
35cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
36cdf0e10cSrcweir #include <ucbhelper/macros.hxx>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir //=========================================================================
39cdf0e10cSrcweir 
40cdf0e10cSrcweir #define PROVIDER_FACTORY_SERVICE_NAME \
41cdf0e10cSrcweir 							"com.sun.star.ucb.ContentProviderProxyFactory"
42cdf0e10cSrcweir #define PROVIDER_PROXY_SERVICE_NAME \
43cdf0e10cSrcweir 							"com.sun.star.ucb.ContentProviderProxy"
44cdf0e10cSrcweir 
45cdf0e10cSrcweir //============================================================================
46cdf0e10cSrcweir //
47cdf0e10cSrcweir // class UcbContentProviderProxyFactory.
48cdf0e10cSrcweir //
49cdf0e10cSrcweir //============================================================================
50cdf0e10cSrcweir 
51cdf0e10cSrcweir class UcbContentProviderProxyFactory :
52cdf0e10cSrcweir 				public cppu::OWeakObject,
53cdf0e10cSrcweir 				public com::sun::star::lang::XTypeProvider,
54cdf0e10cSrcweir 				public com::sun::star::lang::XServiceInfo,
55cdf0e10cSrcweir 				public com::sun::star::ucb::XContentProviderFactory
56cdf0e10cSrcweir {
57cdf0e10cSrcweir 	com::sun::star::uno::Reference<	com::sun::star::lang::XMultiServiceFactory >
58cdf0e10cSrcweir 								m_xSMgr;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir public:
61cdf0e10cSrcweir 	UcbContentProviderProxyFactory(
62cdf0e10cSrcweir 			const com::sun::star::uno::Reference<
63cdf0e10cSrcweir 				com::sun::star::lang::XMultiServiceFactory >& rxSMgr );
64cdf0e10cSrcweir 	virtual ~UcbContentProviderProxyFactory();
65cdf0e10cSrcweir 
66cdf0e10cSrcweir 	// XInterface
67cdf0e10cSrcweir 	XINTERFACE_DECL()
68cdf0e10cSrcweir 
69cdf0e10cSrcweir 	// XTypeProvider
70cdf0e10cSrcweir 	XTYPEPROVIDER_DECL()
71cdf0e10cSrcweir 
72cdf0e10cSrcweir     // XServiceInfo
73cdf0e10cSrcweir 	XSERVICEINFO_DECL()
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 	// XContentProviderFactory
76cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
77cdf0e10cSrcweir 		::com::sun::star::ucb::XContentProvider > SAL_CALL
78cdf0e10cSrcweir 	createContentProvider( const ::rtl::OUString& Service )
79cdf0e10cSrcweir 		throw( ::com::sun::star::uno::RuntimeException );
80cdf0e10cSrcweir };
81cdf0e10cSrcweir 
82cdf0e10cSrcweir //============================================================================
83cdf0e10cSrcweir //
84cdf0e10cSrcweir // class UcbContentProviderProxy.
85cdf0e10cSrcweir //
86cdf0e10cSrcweir //============================================================================
87cdf0e10cSrcweir 
88cdf0e10cSrcweir class UcbContentProviderProxy :
89cdf0e10cSrcweir 				public cppu::OWeakObject,
90cdf0e10cSrcweir 				public com::sun::star::lang::XTypeProvider,
91cdf0e10cSrcweir 				public com::sun::star::lang::XServiceInfo,
92cdf0e10cSrcweir 				public com::sun::star::ucb::XContentProviderSupplier,
93cdf0e10cSrcweir 				public com::sun::star::ucb::XContentProvider,
94cdf0e10cSrcweir 				public com::sun::star::ucb::XParameterizedContentProvider
95cdf0e10cSrcweir {
96cdf0e10cSrcweir 	::osl::Mutex 	m_aMutex;
97cdf0e10cSrcweir 	::rtl::OUString m_aService;
98cdf0e10cSrcweir 	::rtl::OUString m_aTemplate;
99cdf0e10cSrcweir 	::rtl::OUString m_aArguments;
100cdf0e10cSrcweir 	sal_Bool		m_bReplace;
101cdf0e10cSrcweir 	sal_Bool		m_bRegister;
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 	com::sun::star::uno::Reference<	com::sun::star::lang::XMultiServiceFactory >
104cdf0e10cSrcweir 								m_xSMgr;
105cdf0e10cSrcweir 	com::sun::star::uno::Reference<	com::sun::star::ucb::XContentProvider >
106cdf0e10cSrcweir 								m_xProvider;
107cdf0e10cSrcweir 	com::sun::star::uno::Reference<	com::sun::star::ucb::XContentProvider >
108cdf0e10cSrcweir 								m_xTargetProvider;
109cdf0e10cSrcweir 
110cdf0e10cSrcweir public:
111cdf0e10cSrcweir 	UcbContentProviderProxy(
112cdf0e10cSrcweir 			const com::sun::star::uno::Reference<
113cdf0e10cSrcweir 				com::sun::star::lang::XMultiServiceFactory >& rxSMgr,
114cdf0e10cSrcweir 			const ::rtl::OUString& Service );
115cdf0e10cSrcweir 	virtual ~UcbContentProviderProxy();
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 	// XInterface
118cdf0e10cSrcweir 	XINTERFACE_DECL()
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 	// XTypeProvider
121cdf0e10cSrcweir 	XTYPEPROVIDER_DECL()
122cdf0e10cSrcweir 
123cdf0e10cSrcweir     // XServiceInfo
124cdf0e10cSrcweir 	XSERVICEINFO_NOFACTORY_DECL()
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 	// XContentProviderSupplier
127cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
128cdf0e10cSrcweir 		::com::sun::star::ucb::XContentProvider > SAL_CALL
129cdf0e10cSrcweir 	getContentProvider()
130cdf0e10cSrcweir 		throw( ::com::sun::star::uno::RuntimeException );
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 	// XContentProvider
133cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
134cdf0e10cSrcweir 		::com::sun::star::ucb::XContent > SAL_CALL
135cdf0e10cSrcweir 	queryContent( const ::com::sun::star::uno::Reference<
136cdf0e10cSrcweir 					::com::sun::star::ucb::XContentIdentifier >& Identifier )
137cdf0e10cSrcweir 		throw( ::com::sun::star::ucb::IllegalIdentifierException,
138cdf0e10cSrcweir 			   ::com::sun::star::uno::RuntimeException );
139cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL
140cdf0e10cSrcweir 	compareContentIds( const ::com::sun::star::uno::Reference<
141cdf0e10cSrcweir 						::com::sun::star::ucb::XContentIdentifier >& Id1,
142cdf0e10cSrcweir 					   const ::com::sun::star::uno::Reference<
143cdf0e10cSrcweir 					   	::com::sun::star::ucb::XContentIdentifier >& Id2 )
144cdf0e10cSrcweir 		throw( ::com::sun::star::uno::RuntimeException );
145cdf0e10cSrcweir 
146cdf0e10cSrcweir 	// XParameterizedContentProvider
147cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
148cdf0e10cSrcweir 		::com::sun::star::ucb::XContentProvider > SAL_CALL
149cdf0e10cSrcweir 	registerInstance( const ::rtl::OUString& Template,
150cdf0e10cSrcweir 					  const ::rtl::OUString& Arguments,
151cdf0e10cSrcweir 					  sal_Bool ReplaceExisting )
152cdf0e10cSrcweir 		throw( ::com::sun::star::lang::IllegalArgumentException,
153cdf0e10cSrcweir 			   ::com::sun::star::uno::RuntimeException );
154cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference<
155cdf0e10cSrcweir 		::com::sun::star::ucb::XContentProvider > SAL_CALL
156cdf0e10cSrcweir 	deregisterInstance( const ::rtl::OUString& Template,
157cdf0e10cSrcweir 						const ::rtl::OUString& Arguments )
158cdf0e10cSrcweir 		throw( ::com::sun::star::lang::IllegalArgumentException,
159cdf0e10cSrcweir 			   ::com::sun::star::uno::RuntimeException );
160cdf0e10cSrcweir };
161cdf0e10cSrcweir 
162cdf0e10cSrcweir #endif /* !_PROVPROX_HXX */
163