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_validation_XValidator_idl__
25#define __com_sun_star_form_validation_XValidator_idl__
26
27#ifndef __com_sun_star_uno_XInterface_idl__
28#include <com/sun/star/uno/XInterface.idl>
29#endif
30
31#ifndef __com_sun_star_lang_NullPointerException_idl__
32#include <com/sun/star/lang/NullPointerException.idl>
33#endif
34
35//=============================================================================
36
37module com {  module sun {  module star {  module form { module validation {
38
39interface XValidityConstraintListener;
40
41//=============================================================================
42
43/** specifies a component able to validate (the content of) other components
44
45    <p>Validators support simple validity checks and retrieving justifications for
46    invalidity.</p>
47
48    <p>Validators may additionally support dynamic validity constraints. In such a case,
49    the validity of a given value may change, without the value changing itself.<br/>
50    To be notified about this, interested components should register as <type>XValidityConstraintListener</type>.
51
52    @see XValidatable
53*/
54interface XValidator : com::sun::star::uno::XInterface
55{
56    /** determines whether the given value is valid
57
58    @param aValue
59        the value to check for validity
60    @return
61        <TRUE/> if and only if the value is considered valid.
62    */
63    boolean isValid( [in] any Value );
64
65    /** retrieves a justification for the invalidity of the given value
66
67    @param aValue
68        the value which has been recognized as being invalid
69    @return
70        a human-readable string, which explains why the given valus is considered invalid.
71    */
72    string explainInvalid( [in] any Value );
73
74    /** registers the given validity listener.
75
76    <p>Usually, an <type>XValidatable</type> instance will also add itself as validity listener,
77    as soon as the validator is introduced to it.</p>
78
79    <p>Implementations which do not support dynamic validity contraints should simply ignore this
80    call.</p>
81
82    @throws <type scope="com::sun::star::lang">NullPointerException</type>
83        if the given listener is <NULL/>
84    @see XValidityConstraintListener
85    */
86    void    addValidityConstraintListener( [in] XValidityConstraintListener Listener )
87                raises( com::sun::star::lang::NullPointerException );
88
89    /** revokes the given validity listener
90
91    @throws <type scope="com::sun::star::lang">NullPointerException</type>
92        if the given listener is <NULL/>
93    @see XValidityConstraintListener
94    */
95    void    removeValidityConstraintListener( [in] XValidityConstraintListener Listener )
96                raises( com::sun::star::lang::NullPointerException );
97};
98
99//=============================================================================
100
101}; }; }; }; };
102
103#endif
104