1*b3b486c3SAndrew Rist /**************************************************************
2*b3b486c3SAndrew Rist  *
3*b3b486c3SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*b3b486c3SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*b3b486c3SAndrew Rist  * distributed with this work for additional information
6*b3b486c3SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*b3b486c3SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*b3b486c3SAndrew Rist  * "License"); you may not use this file except in compliance
9*b3b486c3SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*b3b486c3SAndrew Rist  *
11*b3b486c3SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*b3b486c3SAndrew Rist  *
13*b3b486c3SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*b3b486c3SAndrew Rist  * software distributed under the License is distributed on an
15*b3b486c3SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b3b486c3SAndrew Rist  * KIND, either express or implied.  See the License for the
17*b3b486c3SAndrew Rist  * specific language governing permissions and limitations
18*b3b486c3SAndrew Rist  * under the License.
19*b3b486c3SAndrew Rist  *
20*b3b486c3SAndrew Rist  *************************************************************/
21*b3b486c3SAndrew Rist 
22*b3b486c3SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _UCBHELPER_REGISTERUCB_HXX_
25cdf0e10cSrcweir #define _UCBHELPER_REGISTERUCB_HXX_
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/uno/RuntimeException.hpp>
28cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h>
29cdf0e10cSrcweir #include <com/sun/star/ucb/XContentProvider.hpp>
30cdf0e10cSrcweir #include <com/sun/star/ucb/XContentProviderManager.hpp>
31cdf0e10cSrcweir #include <vector>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include "ucbhelper/ucbhelperdllapi.h"
34cdf0e10cSrcweir 
35cdf0e10cSrcweir namespace com { namespace sun { namespace star {
36cdf0e10cSrcweir 	namespace lang { class XMultiServiceFactory; }
37cdf0e10cSrcweir } } }
38cdf0e10cSrcweir 
39cdf0e10cSrcweir namespace rtl { class OUString; }
40cdf0e10cSrcweir 
41cdf0e10cSrcweir namespace ucbhelper {
42cdf0e10cSrcweir 
43cdf0e10cSrcweir //============================================================================
44cdf0e10cSrcweir /** Information about a registered content provider.
45cdf0e10cSrcweir  */
46cdf0e10cSrcweir struct ContentProviderRegistrationInfo
47cdf0e10cSrcweir {
48cdf0e10cSrcweir 	/** The registered content provider (or null if registration failed).
49cdf0e10cSrcweir 	 */
50cdf0e10cSrcweir 	com::sun::star::uno::Reference< com::sun::star::ucb::XContentProvider >
51cdf0e10cSrcweir 	    m_xProvider;
52cdf0e10cSrcweir 
53cdf0e10cSrcweir 	/** The arguments the content provider was instantiated with.
54cdf0e10cSrcweir 	 */
55cdf0e10cSrcweir 	rtl::OUString m_aArguments;
56cdf0e10cSrcweir 
57cdf0e10cSrcweir 	/** The URL template the content provider is registered on.
58cdf0e10cSrcweir 	 */
59cdf0e10cSrcweir 	rtl::OUString m_aTemplate;
60cdf0e10cSrcweir };
61cdf0e10cSrcweir 
62cdf0e10cSrcweir typedef std::vector< ContentProviderRegistrationInfo >
63cdf0e10cSrcweir                                     ContentProviderRegistrationInfoList;
64cdf0e10cSrcweir 
65cdf0e10cSrcweir //============================================================================
66cdf0e10cSrcweir /** Information about a content provider, passed to
67cdf0e10cSrcweir     <method>configureUcb</method>.
68cdf0e10cSrcweir  */
69cdf0e10cSrcweir struct ContentProviderData
70cdf0e10cSrcweir {
71cdf0e10cSrcweir     /** The UNO service name to use to instanciate the content provider.
72cdf0e10cSrcweir 	 */
73cdf0e10cSrcweir 	rtl::OUString ServiceName;
74cdf0e10cSrcweir 
75cdf0e10cSrcweir     /** The URL template to use to instanciate the content provider.
76cdf0e10cSrcweir 	 */
77cdf0e10cSrcweir     rtl::OUString URLTemplate;
78cdf0e10cSrcweir 
79cdf0e10cSrcweir     /** The arguments to use to instanciate the content provider.
80cdf0e10cSrcweir 	 */
81cdf0e10cSrcweir     rtl::OUString Arguments;
82cdf0e10cSrcweir 
ContentProviderDataucbhelper::ContentProviderData83cdf0e10cSrcweir 	ContentProviderData() {};
ContentProviderDataucbhelper::ContentProviderData84cdf0e10cSrcweir 	ContentProviderData( const rtl::OUString & rService,
85cdf0e10cSrcweir 						 const rtl::OUString & rTemplate,
86cdf0e10cSrcweir 						 const rtl::OUString & rArgs )
87cdf0e10cSrcweir 	: ServiceName( rService ), URLTemplate( rTemplate ), Arguments( rArgs ) {}
88cdf0e10cSrcweir };
89cdf0e10cSrcweir 
90cdf0e10cSrcweir typedef std::vector< ContentProviderData > ContentProviderDataList;
91cdf0e10cSrcweir //============================================================================
92cdf0e10cSrcweir /** Register a content provider at a Universal Content Broker.
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 	@param rManager  A content provider manager (normally, this would be a
95cdf0e10cSrcweir 	UCB).  May be null, which is only useful if the content provider is an
96cdf0e10cSrcweir 	<type>XParamterizedContentProvider</type>s.
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 	@param rServiceFactory  A factory through which to obtain the required
99cdf0e10cSrcweir 	services.
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 	@param rName  The service name of the content provider.
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 	@param rArguments  Any arguments to instantiate the content provider with.
104cdf0e10cSrcweir 
105cdf0e10cSrcweir 	@param rTemplate  The URL template to register the content provider on.
106cdf0e10cSrcweir 
107cdf0e10cSrcweir 	@param pInfo  If not null, this output parameter is filled with
108cdf0e10cSrcweir 	information about the (atemptively) registered provider.
109cdf0e10cSrcweir  */
110cdf0e10cSrcweir 
111cdf0e10cSrcweir UCBHELPER_DLLPUBLIC bool registerAtUcb(
112cdf0e10cSrcweir     com::sun::star::uno::Reference<
113cdf0e10cSrcweir 	        com::sun::star::ucb::XContentProviderManager > const &
114cdf0e10cSrcweir 	    rManager,
115cdf0e10cSrcweir 	com::sun::star::uno::Reference<
116cdf0e10cSrcweir 	        com::sun::star::lang::XMultiServiceFactory > const &
117cdf0e10cSrcweir 	    rServiceFactory,
118cdf0e10cSrcweir 	rtl::OUString const & rName,
119cdf0e10cSrcweir 	rtl::OUString const & rArguments,
120cdf0e10cSrcweir 	rtl::OUString const & rTemplate,
121cdf0e10cSrcweir 	ContentProviderRegistrationInfo * pInfo)
122cdf0e10cSrcweir 	throw (com::sun::star::uno::RuntimeException);
123cdf0e10cSrcweir 
124cdf0e10cSrcweir }
125cdf0e10cSrcweir #endif // _UCBHELPER_REGISTERUCB_HXX_
126