xref: /AOO41X/main/offapi/com/sun/star/form/validation/XValidatableFormComponent.idl (revision d1766043198e81d0bcfc626e12893e7b4d7e31ca)
1*d1766043SAndrew Rist/**************************************************************
2cdf0e10cSrcweir *
3*d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*d1766043SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5*d1766043SAndrew Rist * distributed with this work for additional information
6*d1766043SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7*d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*d1766043SAndrew Rist * "License"); you may not use this file except in compliance
9*d1766043SAndrew Rist * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir *
11*d1766043SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13*d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*d1766043SAndrew Rist * software distributed under the License is distributed on an
15*d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*d1766043SAndrew Rist * KIND, either express or implied.  See the License for the
17*d1766043SAndrew Rist * specific language governing permissions and limitations
18*d1766043SAndrew Rist * under the License.
19cdf0e10cSrcweir *
20*d1766043SAndrew Rist *************************************************************/
21*d1766043SAndrew Rist
22*d1766043SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir#ifndef __com_sun_star_form_validation_XValidatableFormComponent_idl__
25cdf0e10cSrcweir#define __com_sun_star_form_validation_XValidatableFormComponent_idl__
26cdf0e10cSrcweir
27cdf0e10cSrcweir#ifndef __com_sun_star_form_validation_XValidatable_idl__
28cdf0e10cSrcweir#include <com/sun/star/form/validation/XValidatable.idl>
29cdf0e10cSrcweir#endif
30cdf0e10cSrcweir
31cdf0e10cSrcweir#ifndef __com_sun_star_lang_NoSupportException_idl__
32cdf0e10cSrcweir#include <com/sun/star/lang/NoSupportException.idl>
33cdf0e10cSrcweir#endif
34cdf0e10cSrcweir
35cdf0e10cSrcweir#ifndef __com_sun_star_lang_NullPointerException_idl__
36cdf0e10cSrcweir#include <com/sun/star/lang/NullPointerException.idl>
37cdf0e10cSrcweir#endif
38cdf0e10cSrcweir
39cdf0e10cSrcweir//=============================================================================
40cdf0e10cSrcweir
41cdf0e10cSrcweirmodule com {  module sun {  module star {  module form { module validation {
42cdf0e10cSrcweir
43cdf0e10cSrcweirinterface XFormComponentValidityListener;
44cdf0e10cSrcweir
45cdf0e10cSrcweir//=============================================================================
46cdf0e10cSrcweir
47cdf0e10cSrcweir/** is a convenience interface for accessing several aspects of a form component
48cdf0e10cSrcweir    which supports validation.
49cdf0e10cSrcweir
50cdf0e10cSrcweir    <p>A validatable form component has two aspects which other parties might
51cdf0e10cSrcweir    be interested in:
52cdf0e10cSrcweir    <ul>
53cdf0e10cSrcweir        <li>The pure validity flag: Whatever the user enters in the component, this is
54cdf0e10cSrcweir        either valid (relative to the active validator), or invalid.</li>
55cdf0e10cSrcweir        <li>The current value: Even if the validity flag does not change with the user
56cdf0e10cSrcweir        input (e.g. because the user replaces one invalid value with another invalid
57cdf0e10cSrcweir        value), observers might be interested in the current value, for example to
58cdf0e10cSrcweir        include it in a feedback message to the user.</li>
59cdf0e10cSrcweir    </ul>
60cdf0e10cSrcweir    </p>
61cdf0e10cSrcweir
62cdf0e10cSrcweir    <p>An <type>XValidatableFormComponent</type> allows to easily access both of these aspects.</p>
63cdf0e10cSrcweir
64cdf0e10cSrcweir    <p>Note that all of the information provided at this interface can also obtained by other means,
65cdf0e10cSrcweir    but much more inconviniently.</p>
66cdf0e10cSrcweir
67cdf0e10cSrcweir    @see XValidatable
68cdf0e10cSrcweir    @see XValidator
69cdf0e10cSrcweir*/
70cdf0e10cSrcweirinterface XValidatableFormComponent : XValidatable
71cdf0e10cSrcweir{
72cdf0e10cSrcweir    /** determines whether the current value of the component passed the validity test
73cdf0e10cSrcweir        at the validator.
74cdf0e10cSrcweir
75cdf0e10cSrcweir        <p>Calling this is equal to calling <member>XValidator::isValid</member> with
76cdf0e10cSrcweir        the current value (see <member>getCurrentValue</member>) of the component, where
77cdf0e10cSrcweir        the validator is obtained via <member>XValidatable::getValidator</member>.</p>
78cdf0e10cSrcweir
79cdf0e10cSrcweir        <p>If no validator has been set (<member>XValidatable::setValidator</member>), this method
80cdf0e10cSrcweir        returns true.</p>
81cdf0e10cSrcweir    */
82cdf0e10cSrcweir    boolean isValid();
83cdf0e10cSrcweir
84cdf0e10cSrcweir    /** retrieves the current value of the component.
85cdf0e10cSrcweir
86cdf0e10cSrcweir        <p>The type of the current value, as well as it's semantics, depend on the service
87cdf0e10cSrcweir        implementing this interface.</p>
88cdf0e10cSrcweir
89cdf0e10cSrcweir        <p>Again, this is a convenience method. For example, for a <type scope="com::sun::star::form::component">FormattedField</type>,
90cdf0e10cSrcweir        calling this method is equivalent to retrieving the
91cdf0e10cSrcweir        <member scope="com::sun::star::awt">UnoControlFormattedFieldModel::EffectiveValue</member>.</p>
92cdf0e10cSrcweir
93cdf0e10cSrcweir        <p>If no validator has been set (<member>XValidatable::setValidator</member>), the value returned
94cdf0e10cSrcweir        here is defined by the service implementing this interface.</p>
95cdf0e10cSrcweir    */
96cdf0e10cSrcweir    any getCurrentValue();
97cdf0e10cSrcweir
98cdf0e10cSrcweir    /** registers the given listener.
99cdf0e10cSrcweir
100cdf0e10cSrcweir        <p><type>XFormComponentValidityListener</type>s are called whenever <em>any</em> of the aspects
101cdf0e10cSrcweir        of the validatable form component (the validity flag, or the value) changed.</p>
102cdf0e10cSrcweir
103cdf0e10cSrcweir        @throws <type scope="com::sun::star::lang">NullPointerException</type>
104cdf0e10cSrcweir            if the given listener is <NULL/>
105cdf0e10cSrcweir    */
106cdf0e10cSrcweir    void    addFormComponentValidityListener( [in] XFormComponentValidityListener Listener )
107cdf0e10cSrcweir                raises( com::sun::star::lang::NullPointerException );
108cdf0e10cSrcweir
109cdf0e10cSrcweir    /** registers the given listener.
110cdf0e10cSrcweir
111cdf0e10cSrcweir        @throws <type scope="com::sun::star::lang">NullPointerException</type>
112cdf0e10cSrcweir            if the given listener is <NULL/>
113cdf0e10cSrcweir    */
114cdf0e10cSrcweir    void    removeFormComponentValidityListener( [in] XFormComponentValidityListener Listener )
115cdf0e10cSrcweir                raises( com::sun::star::lang::NullPointerException );
116cdf0e10cSrcweir};
117cdf0e10cSrcweir
118cdf0e10cSrcweir//=============================================================================
119cdf0e10cSrcweir
120cdf0e10cSrcweir}; }; }; }; };
121cdf0e10cSrcweir
122cdf0e10cSrcweir#endif
123