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 .
21 module com
{ module sun
{ module star
{ module form
{ module binding
{
24 /** is a specialization of the com::sun::star::form::DataAwareControlModel
25 which additionally supports binding to external value suppliers.
27 <p>Control models usually have some kind of value property, which reflects the very current
28 content of the controls associated with this model. For instance, for an
29 com::sun::star::form::component::TextField, this would be the
30 com::sun::star::awt::UnoControlEditModel::Text property of the base
31 service. Similarly, a com::sun::star::form::component::CheckBox has
32 a property com::sun::star::awt::UnoControlCheckBoxModel::State, which
33 reflects the current check state.</p>
35 <p>Usual com::sun::star::form::DataAwareControlModels can be bound to
36 a column of a com::sun::star::form::component::DataForm, and exchange
37 their content with such a column.<br/>
38 In particular, when the com::sun::star::form::component::DataForm
39 is moved to a different record, then the bound control model is updated with the value of
40 it's column in this particular row.<br/>
41 On the other hand, when any change in the control model (e.g. resulting from a user entering
42 data in a control associated with the control model) is committed
43 (com::sun::star::form::XBoundComponent::commit()), then the actual
44 data of the control model is written into the associated
45 com::sun::star::form::component::DataForm column.</p>
47 <p>BindableDataAwareControlModel's additionally support an alternative value
48 binding, which forces them to exchange their value with another foreign instance.
49 In some sense, they are an abstraction of the data aware control models, which only
50 support a specialized, hard-coded value binding (namely the binding to a
51 com::sun::star::form::component::DataForm column).</p>
53 <p>For this, they provide the XBindableValue interface which allows to
54 set an external component to exchange the value with.</p>
56 <p>The following rules apply when a data aware control model is bound to an external value binding:
57 <ul><li><b>Priority</b><br/>
58 External value bindings overrule any active SQL-column binding. If an external
59 component is bound to a control model which currently has an active SQL binding,
60 this SQL binding is suspended, until the external binding is revoked.
62 <li><b>Activation</b><br/>
63 An external value binding becomes effective as soon as it is set. This is a
64 difference to SQL bindings, which only are effective when the parent form
65 of the control model is loaded (com::sun::star::form::XLoadable).
67 <li><b>Immediacy</b><br/>
68 When a BindableDataAwareControlModel is bound to an external value,
69 then every change in the control model's value is <em>immediately</em> reflected
70 in the external binding. This is a difference to SQL bindings of most
71 com::sun::star::form::DataAwareControlModel's, where changes
72 in the control model's value are only propagated to the bound column upon explicit
73 request via com::sun::star::form::XBoundComponent::commit().<br/>
74 Note that this restriction is inherited from the BindableControlModel.
76 <li><b>Cloning</b><br/>
77 com::sun::star::form::FormControlModels support cloning themselves
78 via the com::sun::star::util::XCloneable interface which they
79 inherit from the com::sun::star::awt::UnoControlModel service.<br>
80 When a BindableDataAwareControlModel is cloned while it has an active
81 external value binding, then the clone is also bound to the same binding instance.<br/>
82 Note that this restriction is inherited from the BindableControlModel.
87 <p>When a BindableDataAwareControlModel is being bound to an external value,
88 using XBindableValue::setValueBinding(),
89 then the control model (its value property, respectively) and the external value are
90 initially synchronized by setting the external value (XValueBinding::getValue())
91 at the control model.</p>
94 service BindableDataAwareControlModel
96 /** specifies the functionality for binding the control model to a
97 column of an SQL com::sun::star::form::component::DataForm.
99 service com
::sun
::star
::form
::DataAwareControlModel
;
101 /** specifies the functionality for <em>alternatively</em> binding the control model
102 to an external value.
104 service BindableControlModel
;
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */