1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_UCB_SOURCE_CORE_PROVPROX_HXX
21 #define INCLUDED_UCB_SOURCE_CORE_PROVPROX_HXX
23 #include <osl/mutex.hxx>
24 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
25 #include <com/sun/star/lang/XTypeProvider.hpp>
26 #include <com/sun/star/lang/XServiceInfo.hpp>
27 #include <com/sun/star/ucb/XContentProviderFactory.hpp>
28 #include <com/sun/star/ucb/XContentProvider.hpp>
29 #include <com/sun/star/ucb/XParameterizedContentProvider.hpp>
30 #include <com/sun/star/ucb/XContentProviderSupplier.hpp>
31 #include <cppuhelper/weak.hxx>
32 #include <ucbhelper/macros.hxx>
33 #include <cppuhelper/implbase2.hxx>
37 #define PROVIDER_FACTORY_SERVICE_NAME \
38 "com.sun.star.ucb.ContentProviderProxyFactory"
39 #define PROVIDER_PROXY_SERVICE_NAME \
40 "com.sun.star.ucb.ContentProviderProxy"
44 // class UcbContentProviderProxyFactory.
48 class UcbContentProviderProxyFactory
: public cppu::WeakImplHelper2
<
49 css::lang::XServiceInfo
,
50 css::ucb::XContentProviderFactory
>
52 com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
>
56 UcbContentProviderProxyFactory(
57 const com::sun::star::uno::Reference
<
58 com::sun::star::lang::XMultiServiceFactory
>& rxSMgr
);
59 virtual ~UcbContentProviderProxyFactory();
62 virtual OUString SAL_CALL
getImplementationName()
63 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
64 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
65 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
66 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
67 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
69 static OUString
getImplementationName_Static();
70 static css::uno::Sequence
< OUString
> getSupportedServiceNames_Static();
72 static css::uno::Reference
< css::lang::XSingleServiceFactory
>
73 createServiceFactory( const css::uno::Reference
<
74 css::lang::XMultiServiceFactory
>& rxServiceMgr
);
76 // XContentProviderFactory
77 virtual ::com::sun::star::uno::Reference
<
78 ::com::sun::star::ucb::XContentProvider
> SAL_CALL
79 createContentProvider( const OUString
& Service
)
80 throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
85 // class UcbContentProviderProxy.
89 class UcbContentProviderProxy
:
90 public cppu::OWeakObject
,
91 public com::sun::star::lang::XTypeProvider
,
92 public com::sun::star::lang::XServiceInfo
,
93 public com::sun::star::ucb::XContentProviderSupplier
,
94 public com::sun::star::ucb::XContentProvider
,
95 public com::sun::star::ucb::XParameterizedContentProvider
97 ::osl::Mutex m_aMutex
;
100 OUString m_aArguments
;
104 com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
>
106 com::sun::star::uno::Reference
< com::sun::star::ucb::XContentProvider
>
108 com::sun::star::uno::Reference
< com::sun::star::ucb::XContentProvider
>
112 UcbContentProviderProxy(
113 const com::sun::star::uno::Reference
<
114 com::sun::star::lang::XMultiServiceFactory
>& rxSMgr
,
115 const OUString
& Service
);
116 virtual ~UcbContentProviderProxy();
119 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& rType
)
120 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
121 virtual void SAL_CALL
acquire()
122 throw() SAL_OVERRIDE
;
123 virtual void SAL_CALL
release()
124 throw() SAL_OVERRIDE
;
127 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId()
128 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
129 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes()
130 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
133 virtual OUString SAL_CALL
getImplementationName()
134 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
135 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
136 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
137 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames()
138 throw( css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
140 static OUString
getImplementationName_Static();
141 static css::uno::Sequence
< OUString
> getSupportedServiceNames_Static();
143 // XContentProviderSupplier
144 virtual ::com::sun::star::uno::Reference
<
145 ::com::sun::star::ucb::XContentProvider
> SAL_CALL
147 throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
150 virtual ::com::sun::star::uno::Reference
<
151 ::com::sun::star::ucb::XContent
> SAL_CALL
152 queryContent( const ::com::sun::star::uno::Reference
<
153 ::com::sun::star::ucb::XContentIdentifier
>& Identifier
)
154 throw( ::com::sun::star::ucb::IllegalIdentifierException
,
155 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
156 virtual sal_Int32 SAL_CALL
157 compareContentIds( const ::com::sun::star::uno::Reference
<
158 ::com::sun::star::ucb::XContentIdentifier
>& Id1
,
159 const ::com::sun::star::uno::Reference
<
160 ::com::sun::star::ucb::XContentIdentifier
>& Id2
)
161 throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
163 // XParameterizedContentProvider
164 virtual ::com::sun::star::uno::Reference
<
165 ::com::sun::star::ucb::XContentProvider
> SAL_CALL
166 registerInstance( const OUString
& Template
,
167 const OUString
& Arguments
,
168 sal_Bool ReplaceExisting
)
169 throw( ::com::sun::star::lang::IllegalArgumentException
,
170 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
171 virtual ::com::sun::star::uno::Reference
<
172 ::com::sun::star::ucb::XContentProvider
> SAL_CALL
173 deregisterInstance( const OUString
& Template
,
174 const OUString
& Arguments
)
175 throw( ::com::sun::star::lang::IllegalArgumentException
,
176 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
179 #endif // INCLUDED_UCB_SOURCE_CORE_PROVPROX_HXX
181 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */