Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : : #ifndef _UCBHELPER_REGISTERUCB_HXX_
21 : : #define _UCBHELPER_REGISTERUCB_HXX_
22 : :
23 : : #include <com/sun/star/uno/RuntimeException.hpp>
24 : : #include <com/sun/star/uno/Reference.h>
25 : : #include <com/sun/star/ucb/XContentProvider.hpp>
26 : : #include <com/sun/star/ucb/XContentProviderManager.hpp>
27 : : #include <vector>
28 : :
29 : : #include "ucbhelper/ucbhelperdllapi.h"
30 : :
31 : : namespace com { namespace sun { namespace star {
32 : : namespace lang { class XMultiServiceFactory; }
33 : : } } }
34 : :
35 : : namespace rtl { class OUString; }
36 : :
37 : : namespace ucbhelper {
38 : :
39 : : //============================================================================
40 : : /** Information about a registered content provider.
41 : : */
42 : : struct ContentProviderRegistrationInfo
43 : : {
44 : : /** The registered content provider (or null if registration failed).
45 : : */
46 : : com::sun::star::uno::Reference< com::sun::star::ucb::XContentProvider >
47 : : m_xProvider;
48 : :
49 : : /** The arguments the content provider was instantiated with.
50 : : */
51 : : rtl::OUString m_aArguments;
52 : :
53 : : /** The URL template the content provider is registered on.
54 : : */
55 : : rtl::OUString m_aTemplate;
56 : : };
57 : :
58 : : typedef std::vector< ContentProviderRegistrationInfo >
59 : : ContentProviderRegistrationInfoList;
60 : :
61 : : //============================================================================
62 : : /** Information about a content provider, passed to
63 : : <method>configureUcb</method>.
64 : : */
65 : 20589 : struct ContentProviderData
66 : : {
67 : : /** The UNO service name to use to instanciate the content provider.
68 : : */
69 : : rtl::OUString ServiceName;
70 : :
71 : : /** The URL template to use to instanciate the content provider.
72 : : */
73 : : rtl::OUString URLTemplate;
74 : :
75 : : /** The arguments to use to instanciate the content provider.
76 : : */
77 : : rtl::OUString Arguments;
78 : :
79 : 3711 : ContentProviderData() {};
80 : : ContentProviderData( const rtl::OUString & rService,
81 : : const rtl::OUString & rTemplate,
82 : : const rtl::OUString & rArgs )
83 : : : ServiceName( rService ), URLTemplate( rTemplate ), Arguments( rArgs ) {}
84 : : };
85 : :
86 : : typedef std::vector< ContentProviderData > ContentProviderDataList;
87 : : //============================================================================
88 : : /** Register a content provider at a Universal Content Broker.
89 : :
90 : : @param rManager A content provider manager (normally, this would be a
91 : : UCB). May be null, which is only useful if the content provider is an
92 : : <type>XParamterizedContentProvider</type>s.
93 : :
94 : : @param rServiceFactory A factory through which to obtain the required
95 : : services.
96 : :
97 : : @param rName The service name of the content provider.
98 : :
99 : : @param rArguments Any arguments to instantiate the content provider with.
100 : :
101 : : @param rTemplate The URL template to register the content provider on.
102 : :
103 : : @param pInfo If not null, this output parameter is filled with
104 : : information about the (atemptively) registered provider.
105 : : */
106 : :
107 : : UCBHELPER_DLLPUBLIC bool registerAtUcb(
108 : : com::sun::star::uno::Reference<
109 : : com::sun::star::ucb::XContentProviderManager > const &
110 : : rManager,
111 : : com::sun::star::uno::Reference<
112 : : com::sun::star::lang::XMultiServiceFactory > const &
113 : : rServiceFactory,
114 : : rtl::OUString const & rName,
115 : : rtl::OUString const & rArguments,
116 : : rtl::OUString const & rTemplate,
117 : : ContentProviderRegistrationInfo * pInfo)
118 : : throw (com::sun::star::uno::RuntimeException);
119 : :
120 : : }
121 : : #endif // _UCBHELPER_REGISTERUCB_HXX_
122 : :
123 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|