1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: provprox.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 #include <osl/mutex.hxx>
35 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
36 #include <com/sun/star/lang/XTypeProvider.hpp>
37 #include <com/sun/star/lang/XServiceInfo.hpp>
38 #include <com/sun/star/ucb/XContentProviderFactory.hpp>
39 #include <com/sun/star/ucb/XContentProvider.hpp>
40 #include <com/sun/star/ucb/XParameterizedContentProvider.hpp>
41 #include <com/sun/star/ucb/XContentProviderSupplier.hpp>
42 #include <cppuhelper/weak.hxx>
43 #include <ucbhelper/macros.hxx>
45 //=========================================================================
47 #define PROVIDER_FACTORY_SERVICE_NAME \
48 "com.sun.star.ucb.ContentProviderProxyFactory"
49 #define PROVIDER_PROXY_SERVICE_NAME \
50 "com.sun.star.ucb.ContentProviderProxy"
52 //============================================================================
54 // class UcbContentProviderProxyFactory.
56 //============================================================================
58 class UcbContentProviderProxyFactory
:
59 public cppu::OWeakObject
,
60 public com::sun::star::lang::XTypeProvider
,
61 public com::sun::star::lang::XServiceInfo
,
62 public com::sun::star::ucb::XContentProviderFactory
64 com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
>
68 UcbContentProviderProxyFactory(
69 const com::sun::star::uno::Reference
<
70 com::sun::star::lang::XMultiServiceFactory
>& rxSMgr
);
71 virtual ~UcbContentProviderProxyFactory();
82 // XContentProviderFactory
83 virtual ::com::sun::star::uno::Reference
<
84 ::com::sun::star::ucb::XContentProvider
> SAL_CALL
85 createContentProvider( const ::rtl::OUString
& Service
)
86 throw( ::com::sun::star::uno::RuntimeException
);
89 //============================================================================
91 // class UcbContentProviderProxy.
93 //============================================================================
95 class UcbContentProviderProxy
:
96 public cppu::OWeakObject
,
97 public com::sun::star::lang::XTypeProvider
,
98 public com::sun::star::lang::XServiceInfo
,
99 public com::sun::star::ucb::XContentProviderSupplier
,
100 public com::sun::star::ucb::XContentProvider
,
101 public com::sun::star::ucb::XParameterizedContentProvider
103 ::osl::Mutex m_aMutex
;
104 ::rtl::OUString m_aService
;
105 ::rtl::OUString m_aTemplate
;
106 ::rtl::OUString m_aArguments
;
108 sal_Bool m_bRegister
;
110 com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
>
112 com::sun::star::uno::Reference
< com::sun::star::ucb::XContentProvider
>
114 com::sun::star::uno::Reference
< com::sun::star::ucb::XContentProvider
>
118 UcbContentProviderProxy(
119 const com::sun::star::uno::Reference
<
120 com::sun::star::lang::XMultiServiceFactory
>& rxSMgr
,
121 const ::rtl::OUString
& Service
);
122 virtual ~UcbContentProviderProxy();
131 XSERVICEINFO_NOFACTORY_DECL()
133 // XContentProviderSupplier
134 virtual ::com::sun::star::uno::Reference
<
135 ::com::sun::star::ucb::XContentProvider
> SAL_CALL
137 throw( ::com::sun::star::uno::RuntimeException
);
140 virtual ::com::sun::star::uno::Reference
<
141 ::com::sun::star::ucb::XContent
> SAL_CALL
142 queryContent( const ::com::sun::star::uno::Reference
<
143 ::com::sun::star::ucb::XContentIdentifier
>& Identifier
)
144 throw( ::com::sun::star::ucb::IllegalIdentifierException
,
145 ::com::sun::star::uno::RuntimeException
);
146 virtual sal_Int32 SAL_CALL
147 compareContentIds( const ::com::sun::star::uno::Reference
<
148 ::com::sun::star::ucb::XContentIdentifier
>& Id1
,
149 const ::com::sun::star::uno::Reference
<
150 ::com::sun::star::ucb::XContentIdentifier
>& Id2
)
151 throw( ::com::sun::star::uno::RuntimeException
);
153 // XParameterizedContentProvider
154 virtual ::com::sun::star::uno::Reference
<
155 ::com::sun::star::ucb::XContentProvider
> SAL_CALL
156 registerInstance( const ::rtl::OUString
& Template
,
157 const ::rtl::OUString
& Arguments
,
158 sal_Bool ReplaceExisting
)
159 throw( ::com::sun::star::lang::IllegalArgumentException
,
160 ::com::sun::star::uno::RuntimeException
);
161 virtual ::com::sun::star::uno::Reference
<
162 ::com::sun::star::ucb::XContentProvider
> SAL_CALL
163 deregisterInstance( const ::rtl::OUString
& Template
,
164 const ::rtl::OUString
& Arguments
)
165 throw( ::com::sun::star::lang::IllegalArgumentException
,
166 ::com::sun::star::uno::RuntimeException
);
169 #endif /* !_PROVPROX_HXX */