1*b1cdbd2cSJim Jagielski/**************************************************************
2*b1cdbd2cSJim Jagielski *
3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski * or more contributor license agreements.  See the NOTICE file
5*b1cdbd2cSJim Jagielski * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski * regarding copyright ownership.  The ASF licenses this file
7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski * with the License.  You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski *
11*b1cdbd2cSJim Jagielski *   http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski *
13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski * KIND, either express or implied.  See the License for the
17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski * under the License.
19*b1cdbd2cSJim Jagielski *
20*b1cdbd2cSJim Jagielski *************************************************************/
21*b1cdbd2cSJim Jagielski
22*b1cdbd2cSJim Jagielski
23*b1cdbd2cSJim Jagielski
24*b1cdbd2cSJim Jagielski
25*b1cdbd2cSJim Jagielski#ifndef __com_sun_star_sdb_DataSourceBrowser_idl__
26*b1cdbd2cSJim Jagielski#define __com_sun_star_sdb_DataSourceBrowser_idl__
27*b1cdbd2cSJim Jagielski
28*b1cdbd2cSJim Jagielski#ifndef __com_sun_star_frame_XController_idl__
29*b1cdbd2cSJim Jagielski#include <com/sun/star/frame/XController.idl>
30*b1cdbd2cSJim Jagielski#endif
31*b1cdbd2cSJim Jagielski#ifndef __com_sun_star_lang_XInitialization_idl__
32*b1cdbd2cSJim Jagielski#include <com/sun/star/lang/XInitialization.idl>
33*b1cdbd2cSJim Jagielski#endif
34*b1cdbd2cSJim Jagielski#ifndef __com_sun_star_frame_XDispatchProvider_idl__
35*b1cdbd2cSJim Jagielski#include <com/sun/star/frame/XDispatchProvider.idl>
36*b1cdbd2cSJim Jagielski#endif
37*b1cdbd2cSJim Jagielski#ifndef __com_sun_star_form_FormController_idl__
38*b1cdbd2cSJim Jagielski#include <com/sun/star/form/FormController.idl>
39*b1cdbd2cSJim Jagielski#endif
40*b1cdbd2cSJim Jagielski#ifndef __com_sun_star_ui_XContextMenuInterception_idl__
41*b1cdbd2cSJim Jagielski#include <com/sun/star/ui/XContextMenuInterception.idl>
42*b1cdbd2cSJim Jagielski#endif
43*b1cdbd2cSJim Jagielski
44*b1cdbd2cSJim Jagielskimodule com {  module sun {  module star {  module sdb {
45*b1cdbd2cSJim Jagielski
46*b1cdbd2cSJim Jagielski//=============================================================================
47*b1cdbd2cSJim Jagielski/** implements a component which allows browsing the data sources registered on the system.
48*b1cdbd2cSJim Jagielski
49*b1cdbd2cSJim Jagielski	<p>
50*b1cdbd2cSJim Jagielski	This service implements a user interface for browsing data sources registered on the
51*b1cdbd2cSJim Jagielski	<type scope="com::sun::star::sdb">
52*b1cdbd2cSJim Jagielski	DatabaseContext
53*b1cdbd2cSJim Jagielski	</type>
54*b1cdbd2cSJim Jagielski	instance of the system.
55*b1cdbd2cSJim Jagielski	</p>
56*b1cdbd2cSJim Jagielski
57*b1cdbd2cSJim Jagielski	<p>
58*b1cdbd2cSJim Jagielski	It is possible to navigate through all the data sources, it's queries and it's tables.
59*b1cdbd2cSJim Jagielski	The queries/tables can be displayed in a grid-like view, where functionality for searching,
60*b1cdbd2cSJim Jagielski	sorting, filtering, and such is provided.
61*b1cdbd2cSJim Jagielski	</p>
62*b1cdbd2cSJim Jagielski
63*b1cdbd2cSJim Jagielski	<p>
64*b1cdbd2cSJim Jagielski	Usually, you won't instantiate this service directly, instead you use the dispatch mechanisms
65*b1cdbd2cSJim Jagielski	of the application framework to load the URL <b>.component:DB/DataSourceBrowser</b> into an arbitrary
66*b1cdbd2cSJim Jagielski	frame. This should involve a
67*b1cdbd2cSJim Jagielski	<type scope="com::sun::star::sdb">
68*b1cdbd2cSJim Jagielski	ContentLoader
69*b1cdbd2cSJim Jagielski	</type>
70*b1cdbd2cSJim Jagielski	service, which creates and initializes
71*b1cdbd2cSJim Jagielski	the browser.
72*b1cdbd2cSJim Jagielski	</p>
73*b1cdbd2cSJim Jagielski
74*b1cdbd2cSJim Jagielski	<p>
75*b1cdbd2cSJim Jagielski	Some aspects of the browser can be controlled from outside, eg.,
76*b1cdbd2cSJim Jagielski	it is possible to dispatch a sort or filter
77*b1cdbd2cSJim Jagielski	request, if a table or query is being displayed.
78*b1cdbd2cSJim Jagielski	</p>
79*b1cdbd2cSJim Jagielski
80*b1cdbd2cSJim Jagielski	<p
81*b1cdbd2cSJim Jagielski	>The communication between the browser and external instances works in two ways.
82*b1cdbd2cSJim Jagielski	<br/>
83*b1cdbd2cSJim Jagielski	The way <em>in</em> is provided by the
84*b1cdbd2cSJim Jagielski	<type scope="com::sun::star::frame">XDispatchProvider</type>
85*b1cdbd2cSJim Jagielski	interface the service exports (Please see below for more details on this).
86*b1cdbd2cSJim Jagielski	<br/>
87*b1cdbd2cSJim Jagielski	The way <em>out</em> works in another way. There are several URL's which an external
88*b1cdbd2cSJim Jagielski	instance can provide dispatches for (usually by implementing a
89*b1cdbd2cSJim Jagielski	<type scope="com::sun::star::frame">XDispatchProviderInterceptor</type>
90*b1cdbd2cSJim Jagielski	for the parent frame of the browser), thus indicating that the browser should provide special functionality.
91*b1cdbd2cSJim Jagielski	<br/>
92*b1cdbd2cSJim Jagielski	In this case, the browser displays and maintains some additional slots (to be more concrete: toolbox items), which,
93*b1cdbd2cSJim Jagielski	upon triggering, call the
94*b1cdbd2cSJim Jagielski	<member scope="com::sun::star::frame">XDispatch::dispatch()</member>methodoftheobject
95*b1cdbd2cSJim Jagielski	provided by the external instance.
96*b1cdbd2cSJim Jagielski	</p>
97*b1cdbd2cSJim Jagielski
98*b1cdbd2cSJim Jagielski	<p>
99*b1cdbd2cSJim Jagielski		In particular, the supported URL's for communicating to an external instance are:
100*b1cdbd2cSJim Jagielski		<ul>
101*b1cdbd2cSJim Jagielski			<li><b>.uno:DataSourceBrowser/InsertColumns</b>
102*b1cdbd2cSJim Jagielski			<br/>
103*b1cdbd2cSJim Jagielski			Available whenever an external instance provides a dispatcher (
104*b1cdbd2cSJim Jagielski			<type scope="com::sun::star::frame">XDispatch</type>)
105*b1cdbd2cSJim Jagielski			for this URL.
106*b1cdbd2cSJim Jagielski			<br/>
107*b1cdbd2cSJim Jagielski			Enabled, if at least one row in the grid view of a table or query is selected.
108*b1cdbd2cSJim Jagielski			<br/>
109*b1cdbd2cSJim Jagielski			It is the task of the external instance to provide functionality for this URL, but usually it is used
110*b1cdbd2cSJim Jagielski			to implement some kind of "Data To Text" functionality.
111*b1cdbd2cSJim Jagielski			<br/>
112*b1cdbd2cSJim Jagielski			</li>
113*b1cdbd2cSJim Jagielski			<li><b>.uno:DataSourceBrowser/InsertContent</b>
114*b1cdbd2cSJim Jagielski			<br/>
115*b1cdbd2cSJim Jagielski			Available whenever an external instance provides a dispatcher(
116*b1cdbd2cSJim Jagielski			<type scope="com::sun::star::frame">XDispatch</type>
117*b1cdbd2cSJim Jagielski			) for this URL.
118*b1cdbd2cSJim Jagielski			<br/>
119*b1cdbd2cSJim Jagielski			Enabled, if at least one row in the grid view of a table or query is selected.
120*b1cdbd2cSJim Jagielski			<br/>
121*b1cdbd2cSJim Jagielski			It is the task of the external instance to provide functionality for this URL, but usually it is used
122*b1cdbd2cSJim Jagielski			to implement some kind of "Data To Fields" functionality.
123*b1cdbd2cSJim Jagielski			<br/>
124*b1cdbd2cSJim Jagielski			</li>
125*b1cdbd2cSJim Jagielski			<li><b>.uno:DataSourceBrowser/FormLetter</b>
126*b1cdbd2cSJim Jagielski			<br/>
127*b1cdbd2cSJim Jagielski			Available whenever an external instance provides a dispatcher (
128*b1cdbd2cSJim Jagielski			<type scope="com::sun::star::frame">XDispatch</type>)forthisURL.
129*b1cdbd2cSJim Jagielski			<br/>
130*b1cdbd2cSJim Jagielski			It is the task of the external instance to provide functionality for this URL, but usually it is used
131*b1cdbd2cSJim Jagielski			to implement some kind of "Form Letter" functionality.
132*b1cdbd2cSJim Jagielski			<br/>
133*b1cdbd2cSJim Jagielski			</li>
134*b1cdbd2cSJim Jagielski		</ul>
135*b1cdbd2cSJim Jagielski	</p>
136*b1cdbd2cSJim Jagielski	<p>For all kinds of URL's, the parameters supplied during dispatching build up a <type>DataAccessDescriptor</type>,
137*b1cdbd2cSJim Jagielski	where the following properties are present:
138*b1cdbd2cSJim Jagielski	<ul>
139*b1cdbd2cSJim Jagielski		<li><member>DataAccessDescriptor::DataSourceName</member></li>
140*b1cdbd2cSJim Jagielski		<li><member>DataAccessDescriptor::Command</member></li>
141*b1cdbd2cSJim Jagielski		<li><member>DataAccessDescriptor::CommandType</member></li>
142*b1cdbd2cSJim Jagielski		<li><em>optional</em> <member>DataAccessDescriptor::Selection</member></li>
143*b1cdbd2cSJim Jagielski		<li><em>optional</em> <member>DataAccessDescriptor::BookmarkSelection</member></li>
144*b1cdbd2cSJim Jagielski		<li><em>optional</em> <member>DataAccessDescriptor::ResultSet</member></li>
145*b1cdbd2cSJim Jagielski	</ul>
146*b1cdbd2cSJim Jagielski	</p>
147*b1cdbd2cSJim Jagielski	<p>The default for <member>DataAccessDescriptor::Selection</member> is to contain bookmarks, if not specified
148*b1cdbd2cSJim Jagielski	otherwise by <member>DataAccessDescriptor::BookmarkSelection</member>.</pr>
149*b1cdbd2cSJim Jagielski	</p>
150*b1cdbd2cSJim Jagielski
151*b1cdbd2cSJim Jagielski	@see com::sun::star::sdb::ContentLoader
152*b1cdbd2cSJim Jagielski	@see com::sun::star::sdb::DatabaseContext
153*b1cdbd2cSJim Jagielski	@see com::sun::star::sdb::DataSource
154*b1cdbd2cSJim Jagielski	@see com::sun::star::frame::XDispatch
155*b1cdbd2cSJim Jagielski	@see com::sun::star::frame::XDispatchProvider
156*b1cdbd2cSJim Jagielski	@see com::sun::star::frame::XDispatchProviderInterceptor
157*b1cdbd2cSJim Jagielski*/
158*b1cdbd2cSJim Jagielskipublished service DataSourceBrowser
159*b1cdbd2cSJim Jagielski{
160*b1cdbd2cSJim Jagielski	/** implements basic form controller functionality.
161*b1cdbd2cSJim Jagielski		<p>
162*b1cdbd2cSJim Jagielski		With a data source browser implementing this interface, external components have access to
163*b1cdbd2cSJim Jagielski		<ul><li>the grid control which is used to display the currently selected table/query
164*b1cdbd2cSJim Jagielski			(see <method scope="com::sun::star::awt">XTabController::getControls</method>)
165*b1cdbd2cSJim Jagielski			</li>
166*b1cdbd2cSJim Jagielski			<li>the data form used for displaying objects. As always for components implementing this service,
167*b1cdbd2cSJim Jagielski			the object returned by
168*b1cdbd2cSJim Jagielski			<method scope="com::sun::star::awt">XTabController::getModel</method>is a dataform.
169*b1cdbd2cSJim Jagielski			</li>
170*b1cdbd2cSJim Jagielski		</ul>
171*b1cdbd2cSJim Jagielski		</p>
172*b1cdbd2cSJim Jagielski	*/
173*b1cdbd2cSJim Jagielski	[optional] service com::sun::star::form::FormController;
174*b1cdbd2cSJim Jagielski
175*b1cdbd2cSJim Jagielski	/** allows the component to be plugged into frames.
176*b1cdbd2cSJim Jagielski	*/
177*b1cdbd2cSJim Jagielski	interface com::sun::star::frame::XController;
178*b1cdbd2cSJim Jagielski
179*b1cdbd2cSJim Jagielski	/** is used to initialize the browser.
180*b1cdbd2cSJim Jagielski
181*b1cdbd2cSJim Jagielski		<p>
182*b1cdbd2cSJim Jagielski		Parameters (passed to the method <member scope="com::sun::star::lang">XInitialization::initialize()</member>)
183*b1cdbd2cSJim Jagielski		have to be instances of <type scope="com::sun::star::beans">PropertyValue</type>, or
184*b1cdbd2cSJim Jagielski        instances of <type scope="com::sun::star::beans">NamedValue</type>, where the <code>Name</code> member
185*b1cdbd2cSJim Jagielski        specifies what the parameter controls, with the <code>Value</code> member containing the value to be used.
186*b1cdbd2cSJim Jagielski		<br/>
187*b1cdbd2cSJim Jagielski		Recognized parameters are:
188*b1cdbd2cSJim Jagielski		<ul>
189*b1cdbd2cSJim Jagielski			<li><b>Frame</b><br/>
190*b1cdbd2cSJim Jagielski			has to be an  <type scope="com::sun::star::frame">XFrame</type> interface specifying the frame to
191*b1cdbd2cSJim Jagielski            plug the browser component into.</li>
192*b1cdbd2cSJim Jagielski
193*b1cdbd2cSJim Jagielski            <li><b>DataSourceName</b><br/>
194*b1cdbd2cSJim Jagielski			The name of the globally registered <type>DataSource</type> to be used for initial display. It is only
195*b1cdbd2cSJim Jagielski			meaningful together with the other parameters specifying the object to display.</li>
196*b1cdbd2cSJim Jagielski
197*b1cdbd2cSJim Jagielski            <li><b>CommandType</b><br/>
198*b1cdbd2cSJim Jagielski			This has to be a <type>CommandType</type> value, specifying the type of the object to display initially.
199*b1cdbd2cSJim Jagielski			It is only meaningful together with the <em>DataSourceName</em> and the <em>Command</em> parameters.</li>
200*b1cdbd2cSJim Jagielski
201*b1cdbd2cSJim Jagielski            <li><b>Command</b><br/>
202*b1cdbd2cSJim Jagielski			This is a string giving the name of the object to display initially. Whether it is table name, a query
203*b1cdbd2cSJim Jagielski			name or a SQL string is controller by the <em>CommandType</em> parameter.</li>
204*b1cdbd2cSJim Jagielski
205*b1cdbd2cSJim Jagielski            <li><b>EnableBrowser</b><br/>
206*b1cdbd2cSJim Jagielski            is a boolean value (defaulting to <TRUE/>), which specifies whether to enable the data source browser
207*b1cdbd2cSJim Jagielski            control. This is a tree control on the left hand side of the view, which allows to browse all registered
208*b1cdbd2cSJim Jagielski            data sources, including their tables and queries.</li>
209*b1cdbd2cSJim Jagielski
210*b1cdbd2cSJim Jagielski            <li><b>ShowBrowser</b><br/>
211*b1cdbd2cSJim Jagielski            is a boolean value (defaulting to <TRUE/>), which specifies whether to initially show the data source
212*b1cdbd2cSJim Jagielski            browser control. If <code>EnableBrowser</code> is <FALSE/>, then this parameter is ignored. If
213*b1cdbd2cSJim Jagielski            <code>EnableBrowser</code> is <TRUE/>, and <code>ShowBrowser</code> is <FALSE/>, then the control
214*b1cdbd2cSJim Jagielski            is initially hidden, but can be toggled by a toolbar button.</p>
215*b1cdbd2cSJim Jagielski
216*b1cdbd2cSJim Jagielski            <li><b>ShowMenu</b><br/>
217*b1cdbd2cSJim Jagielski            is a boolean value (defaulting to <TRUE/>), specifying whether or not to show a menu in the frame
218*b1cdbd2cSJim Jagielski            where the component is plugged.</li>
219*b1cdbd2cSJim Jagielski		</ul>
220*b1cdbd2cSJim Jagielski		</p>
221*b1cdbd2cSJim Jagielski	*/
222*b1cdbd2cSJim Jagielski	interface com::sun::star::lang::XInitialization;
223*b1cdbd2cSJim Jagielski
224*b1cdbd2cSJim Jagielski	/** is used to control the browser from outside.
225*b1cdbd2cSJim Jagielski
226*b1cdbd2cSJim Jagielski	<p>
227*b1cdbd2cSJim Jagielski	You may use the
228*b1cdbd2cSJim Jagielski	<member scope="com::sun::star::frame">XDispatchProvider::queryDispatch</member>
229*b1cdbd2cSJim Jagielski	method
230*b1cdbd2cSJim Jagielski	to query for objects which implement the
231*b1cdbd2cSJim Jagielski	<type scope="com::sun::star::frame">XDispatch</type>
232*b1cdbd2cSJim Jagielski	interface,
233*b1cdbd2cSJim Jagielski	and which allow you to be notified on status changes and to dispatch special requests.
234*b1cdbd2cSJim Jagielski	</p>
235*b1cdbd2cSJim Jagielski	<p>
236*b1cdbd2cSJim Jagielski	The recognized URLs are:
237*b1cdbd2cSJim Jagielski		<ul>
238*b1cdbd2cSJim Jagielski			<li><b>.uno:Copy</b>
239*b1cdbd2cSJim Jagielski			<br/>
240*b1cdbd2cSJim Jagielski			implements the usual <em>Copy</em> command. Enabled if the grid view has the focus and text in any cell
241*b1cdbd2cSJim Jagielski			is selected.
242*b1cdbd2cSJim Jagielski			</li>
243*b1cdbd2cSJim Jagielski			<li><b>.uno:Cut</b>
244*b1cdbd2cSJim Jagielski			<br/>
245*b1cdbd2cSJim Jagielski			implements the usual <em>Cut</em> command. Enabled if the grid view has the focus and text in any cell
246*b1cdbd2cSJim Jagielski			is selected.
247*b1cdbd2cSJim Jagielski			</li>
248*b1cdbd2cSJim Jagielski			<li><b>.uno:Paste</b>
249*b1cdbd2cSJim Jagielski			<br/>
250*b1cdbd2cSJim Jagielski			implements the usual <em>Paste</em> command. Enabled if the grid view has the focus and a cell which
251*b1cdbd2cSJim Jagielski			allows text input is being edited.
252*b1cdbd2cSJim Jagielski			</li>
253*b1cdbd2cSJim Jagielski			<li><b>.uno:EditDoc</b>
254*b1cdbd2cSJim Jagielski			<br/>
255*b1cdbd2cSJim Jagielski			allows switching the edit mode of the grid view. Enabled if editing the data is allowed in general.
256*b1cdbd2cSJim Jagielski			</li>
257*b1cdbd2cSJim Jagielski			<li><b>.uno:Undo</b>
258*b1cdbd2cSJim Jagielski			<br/>
259*b1cdbd2cSJim Jagielski			revokes any changes done in the current row.
260*b1cdbd2cSJim Jagielski			</li>
261*b1cdbd2cSJim Jagielski			<li><b>.uno:Save</b><br/>
262*b1cdbd2cSJim Jagielski			saves the changes done in the current row.
263*b1cdbd2cSJim Jagielski			</li>
264*b1cdbd2cSJim Jagielski		</ul>
265*b1cdbd2cSJim Jagielski	</p>
266*b1cdbd2cSJim Jagielski	*/
267*b1cdbd2cSJim Jagielski	interface com::sun::star::frame::XDispatchProvider;
268*b1cdbd2cSJim Jagielski
269*b1cdbd2cSJim Jagielski    /** allows to intercept user-triggered context menus in the data source browser
270*b1cdbd2cSJim Jagielski
271*b1cdbd2cSJim Jagielski        <p>Context menu interception is currently supported only for the brower control where the registered
272*b1cdbd2cSJim Jagielski        data sources and all their tables and queries are displayed in a tree view.</p>
273*b1cdbd2cSJim Jagielski
274*b1cdbd2cSJim Jagielski        <p>The selection supplied by <member scope="com::sun::star::ui">ContextMenuExecuteEvent::Selection</member>,
275*b1cdbd2cSJim Jagielski        in the event structure passed to the context menu interceptors, actually is a value from the
276*b1cdbd2cSJim Jagielski        <type scope="com::sun::star::sdb::application">NamedDatabaseObject</type> group.</p>
277*b1cdbd2cSJim Jagielski
278*b1cdbd2cSJim Jagielski        @since OpenOffice 3.0
279*b1cdbd2cSJim Jagielski    */
280*b1cdbd2cSJim Jagielski    [optional] interface ::com::sun::star::ui::XContextMenuInterception;
281*b1cdbd2cSJim Jagielski};
282*b1cdbd2cSJim Jagielski
283*b1cdbd2cSJim Jagielski//=============================================================================
284*b1cdbd2cSJim Jagielski}; }; }; };
285*b1cdbd2cSJim Jagielski
286*b1cdbd2cSJim Jagielski#endif
287