1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24#ifndef __com_sun_star_form_binding_BindableDataAwareControlModel_idl__ 25#define __com_sun_star_form_binding_BindableDataAwareControlModel_idl__ 26 27#ifndef __com_sun_star_form_DataAwareControlModel_idl__ 28#include <com/sun/star/form/DataAwareControlModel.idl> 29#endif 30 31#ifndef __com_sun_star_form_binding_BindableControlModel_idl__ 32#include <com/sun/star/form/binding/BindableControlModel.idl> 33#endif 34 35//============================================================================= 36 37module com { module sun { module star { module form { module binding { 38 39//============================================================================= 40 41/** is a specialization of the <type scope="com::sun::star::form">DataAwareControlModel</type> 42 which additionally supports binding to external value suppliers. 43 44 <p>Control models usually have some kind of value property, which reflects the very current 45 content of the controls associated with this model. For instance, for an 46 <type scope="com::sun::star::form::component">TextField</type>, this would be the 47 <member scope="com::sun::star::awt">UnoControlEditModel::Text</member> property of the base 48 service. Similarily, a <type scope="com::sun::star::form::component">CheckBox</type> has 49 a property <member scope="com::sun::star::awt">UnoControlCheckBoxModel::State</member>, which 50 reflects the current check state.</p> 51 52 <p>Usual <type scope="com::sun::star::form">DataAwareControlModel</type>s can be bound to 53 a column of a <type scope="com::sun::star::form::component">DataForm</type>, and exchange 54 their content with such a column.<br/> 55 In particular, when the <type scope="com::sun::star::form::component">DataForm</type> 56 is moved to a different record, then the bound control model is updated with the value of 57 it's column in this particular row.<br/> 58 On the other hand, when any change in the control model (e.g. resulting from a user entering 59 data in a control associated with the control model) is committed 60 (<member scope="com::sun::star::form">XBoundComponent::commit</member>), then the actual 61 data of the control model is written into the associated 62 <type scope="com::sun::star::form::component">DataForm</type> column.</p> 63 64 <p><type>BindableDataAwareControlModel</type>'s additionally support an alternative value 65 binding, which forces them to exchange their value with another foreign instance. 66 In some sense, they are an abstraction of the data aware control models, which only 67 support a specialized, hard-coded value binding (namely the binding to a 68 <type scope="com::sun::star::form::component">DataForm</type> column).</p> 69 70 <p>For this, they provide the <type>XBindableValue</type> interface which allows to 71 set an external component to exchange the value with.</p> 72 73 <p>The following rules apply when a data aware control model is bound to an external value binding: 74 <ul><li><b>Priority</b><br/> 75 External value bindings overrule any active SQL-column binding. If an external 76 component is bound to a control model which currently has an active SQL binding, 77 this SQL binding is suspended, until the external binding is revoked. 78 </li> 79 <li><b>Activation</b><br/> 80 An external value binding becomes effective as soon as it is set. This is a 81 difference to SQL bindings, which only are effective when the parent form 82 of the control model is loaded (<type scope="com::sun::star::form">XLoadable</type>). 83 </li> 84 <li><b>Immediacy</b><br/> 85 When a <type>BindableDataAwareControlModel</type> is bound to an external value, 86 then every change in the control model's value is <em>immediately</em> reflected 87 in the external binding. This is a difference to SQL bindings of most 88 <type scope="com::sun::star::form">DataAwareControlModel</type>'s, where changes 89 in the control model's value are only propagated to the bound column upon explicit 90 request via <member scope="com::sun::star::form">XBoundComponent::commit</member>.<br/> 91 Note that this restriction is inherited from the <type>BindableControlModel</type>. 92 </li> 93 <li><b>Cloning</b><br/> 94 <type scope="com::sun::star::form">FormControlModel</type>s support cloning themself 95 via the <type scope="com::sun::star::util">XCloneable</type> interface which they 96 inherit from the <type scope="com::sun::star::awt">UnoControlModel</type> service.</br> 97 When a <type>BindableDataAwareControlModel</type> is cloned while it has an active 98 external value binding, then the clone is also bound to the same binding instance.<br/> 99 Note that this restriction is inherited from the <type>BindableControlModel</type>. 100 </li> 101 </ul> 102 </p> 103 104 <p>When a <type>BindableDataAwareControlModel</type> is being bound to an external value, 105 using <member>XBindableValue::setValueBinding</member>, 106 then the control model (it's value property, respectively) and the external value are 107 initially synchronized by setting the external value (<member>XValueBinding::getValue</member>) 108 at the control model.</p> 109 110*/ 111service BindableDataAwareControlModel 112{ 113 /** specifies the functionality for binding the control model to a 114 column of an SQL <type scope="com::sun::star::form::component">DataForm</type>. 115 */ 116 service com::sun::star::form::DataAwareControlModel; 117 118 /** specifies the functionality for <em>alternatively</em> binding the control model 119 to an external value. 120 */ 121 service BindableControlModel; 122}; 123 124//============================================================================= 125 126}; }; }; }; }; 127 128#endif 129