cid#1640468 Dereference after null check
[LibreOffice.git] / offapi / com / sun / star / form / component / DatabaseListBox.idl
blob4bc5ca7fa52c9c2486232a9a33f6f8baa0577358
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
22 module com { module sun { module star { module form { module component {
25 /** This service specifies a data-aware list box control model.
27 <p>The base service for list boxes (ListBox) offers only
28 one possibility to specify the list entries:
29 The display strings in the
30 com::sun::star::awt::UnoControlListBoxModel::StringItemList
31 property and the corresponding values in the ListBox::ListSource
32 property.</p>
34 <p>This service here extends this mimic. It allows to fill the list from a data source.
35 This means that a second result set is opened, which works on the same connection as the
36 form which the list box belongs to, but can be based on an arbitrary table or SQL statement.</p>
38 <p>For instance, you may have a form which is bound to a table <em>invoice</em>, and you use it
39 to enter invoices for your customers. Probably, you will have a second table (say <em>customer</em>),
40 which (among other data) contains a unique key for identifying customers. In your invoice table, you will
41 have a foreign key referring to these customers.<br/>
42 Now, besides the result set the form is based on (all your invoices), the list box can be instructed
43 to open a second result set, this time for the <em>customer</em> table, and fill its list with entries
44 from this result set.<br/>
45 Additionally, it allows to model the relation between the two tables: When the user selects a customer from
46 the list, this customer has the unique id we just talked about (which is not necessarily visible to the
47 user in any way). The list box then automatically transfers this id into the foreign key column of
48 <em>invoice</em>, thus allowing the user to transparently work with human-readable strings instead of
49 pure numbers.<br/>
50 Let's call this result set the list is filled from the <em>list result set</em> here ...</p>
52 <p>The display strings are always taken from the first column of that result set,
53 and the corresponding value as per the BoundColumn property.</p>
55 published service DatabaseListBox
57 service com::sun::star::form::component::ListBox;
59 service com::sun::star::form::DataAwareControlModel;
62 /** specifies which column of the list result set should be used for data exchange.
64 <p>When you make a selection from a list box, the "BoundColumn"
65 property reflects which column value of a result set should
66 be used as the value of the component. If the control is bound
67 to a database field, the column value is stored in the
68 database field identified by the property
69 com::sun::star::form::DataAwareControlModel::DataField.
71 <dl>
72 <dt>-1</dt>
73 <dd>The index (starting at 0) of the selected list box entry
74 is stored in the current database field.</dd>
76 <dt>0 or greater</dt>
77 <dd>The column value of the result set at the position
78 (0-indexed) is stored in the current database field.
79 In particular, for value 0, the selected (displayed)
80 list box string is stored.</dd>
81 </dl></p>
83 <p>The bound column property is only used if a list source is defined
84 and the list source matches with the types
85 com::sun::star::form::ListSourceType::TABLE,
86 com::sun::star::form::ListSourceType::QUERY,
87 com::sun::star::form::ListSourceType::SQL or
88 com::sun::star::form::ListSourceType::SQLPASSTHROUGH.
89 Otherwise the property is ignored, as there is no result set from which to
90 get the column values.</p>
92 [property] short BoundColumn;
95 /** describes the kind of list source used.
97 <p>Depending on the value of this property, the way the value of ListBox::ListSource
98 is evaluated varies.
99 <dl>
100 <dt>com::sun::star::form::ListSourceType::VALUELIST</dt>
101 <dd>The elements in the string sequence in ListBox::ListSource
102 build up the entry list.</dd>
104 <dt>com::sun::star::form::ListSourceType::TABLE</dt>
105 <dd>The first element of the string sequence in ListBox::ListSource
106 determines the table which the list result set should be based on.</dd>
108 <dt>com::sun::star::form::ListSourceType::QUERY</dt>
109 <dd>The first element of the string sequence in ListBox::ListSource
110 determines the query which the list result set should be based on.<br/>
111 For retrieving the query, the connection which the data form is working with
112 (com::sun::star::sdb::RowSet::ActiveConnection) is queried for
113 the com::sun::star::sdb::XQueriesSupplier interface.</dd>
115 <dt>com::sun::star::form::ListSourceType::SQL</dt>
116 <dd>The first element of the string sequence in ListBox::ListSource
117 contains the SQL statement which the list result set should be based on.</p>
119 <dt>com::sun::star::form::ListSourceType::SQLPASSTHROUGH</dt>
120 <dd>The first element of the string sequence in ListBox::ListSource
121 contains the SQL statement which the list result set should be based on.<br/>
122 The statement is not analyzed by the parser. This means that you can use database specific
123 SQL features here, but, on the other hand, lose features like parameter value substitution.</dd>
125 <dt>com::sun::star::form::ListSourceType::TABLEFIELDS</dt>
126 <dd>The first element of the string sequence in ListBox::ListSource
127 determines the table whose column names should fill the list.</dd>
128 </dl>
129 </p>
132 [property] com::sun::star::form::ListSourceType ListSourceType;
134 /** The selected values.
136 [property, transient, optional] sequence< any > SelectedValues;
138 /** The selected value, if there is at most one.
140 [property, transient, optional] any SelectedValue;
145 }; }; }; }; };
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */