xref: /AOO41X/main/offapi/com/sun/star/form/validation/XValidator.idl (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1/*************************************************************************
2 *
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
6 *
7 * OpenOffice.org - a multi-platform office productivity suite
8 *
9 * This file is part of OpenOffice.org.
10 *
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
14 *
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org.  If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
25 *
26 ************************************************************************/
27
28#ifndef __com_sun_star_form_validation_XValidator_idl__
29#define __com_sun_star_form_validation_XValidator_idl__
30
31#ifndef __com_sun_star_uno_XInterface_idl__
32#include <com/sun/star/uno/XInterface.idl>
33#endif
34
35#ifndef __com_sun_star_lang_NullPointerException_idl__
36#include <com/sun/star/lang/NullPointerException.idl>
37#endif
38
39//=============================================================================
40
41module com {  module sun {  module star {  module form { module validation {
42
43interface XValidityConstraintListener;
44
45//=============================================================================
46
47/** specifies a component able to validate (the content of) other components
48
49    <p>Validators support simple validity checks and retrieving justifications for
50    invalidity.</p>
51
52    <p>Validators may additionally support dynamic validity constraints. In such a case,
53    the validity of a given value may change, without the value changing itself.<br/>
54    To be notified about this, interested components should register as <type>XValidityConstraintListener</type>.
55
56    @see XValidatable
57*/
58interface XValidator : com::sun::star::uno::XInterface
59{
60    /** determines whether the given value is valid
61
62    @param aValue
63        the value to check for validity
64    @return
65        <TRUE/> if and only if the value is considered valid.
66    */
67    boolean isValid( [in] any Value );
68
69    /** retrieves a justification for the invalidity of the given value
70
71    @param aValue
72        the value which has been recognized as being invalid
73    @return
74        a human-readable string, which explains why the given valus is considered invalid.
75    */
76    string explainInvalid( [in] any Value );
77
78    /** registers the given validity listener.
79
80    <p>Usually, an <type>XValidatable</type> instance will also add itself as validity listener,
81    as soon as the validator is introduced to it.</p>
82
83    <p>Implementations which do not support dynamic validity contraints should simply ignore this
84    call.</p>
85
86    @throws <type scope="com::sun::star::lang">NullPointerException</type>
87        if the given listener is <NULL/>
88    @see XValidityConstraintListener
89    */
90    void    addValidityConstraintListener( [in] XValidityConstraintListener Listener )
91                raises( com::sun::star::lang::NullPointerException );
92
93    /** revokes the given validity listener
94
95    @throws <type scope="com::sun::star::lang">NullPointerException</type>
96        if the given listener is <NULL/>
97    @see XValidityConstraintListener
98    */
99    void    removeValidityConstraintListener( [in] XValidityConstraintListener Listener )
100                raises( com::sun::star::lang::NullPointerException );
101};
102
103//=============================================================================
104
105}; }; }; }; };
106
107#endif
108