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_XValidatableFormComponent_idl__ 29#define __com_sun_star_form_validation_XValidatableFormComponent_idl__ 30 31#ifndef __com_sun_star_form_validation_XValidatable_idl__ 32#include <com/sun/star/form/validation/XValidatable.idl> 33#endif 34 35#ifndef __com_sun_star_lang_NoSupportException_idl__ 36#include <com/sun/star/lang/NoSupportException.idl> 37#endif 38 39#ifndef __com_sun_star_lang_NullPointerException_idl__ 40#include <com/sun/star/lang/NullPointerException.idl> 41#endif 42 43//============================================================================= 44 45module com { module sun { module star { module form { module validation { 46 47interface XFormComponentValidityListener; 48 49//============================================================================= 50 51/** is a convenience interface for accessing several aspects of a form component 52 which supports validation. 53 54 <p>A validatable form component has two aspects which other parties might 55 be interested in: 56 <ul> 57 <li>The pure validity flag: Whatever the user enters in the component, this is 58 either valid (relative to the active validator), or invalid.</li> 59 <li>The current value: Even if the validity flag does not change with the user 60 input (e.g. because the user replaces one invalid value with another invalid 61 value), observers might be interested in the current value, for example to 62 include it in a feedback message to the user.</li> 63 </ul> 64 </p> 65 66 <p>An <type>XValidatableFormComponent</type> allows to easily access both of these aspects.</p> 67 68 <p>Note that all of the information provided at this interface can also obtained by other means, 69 but much more inconviniently.</p> 70 71 @see XValidatable 72 @see XValidator 73*/ 74interface XValidatableFormComponent : XValidatable 75{ 76 /** determines whether the current value of the component passed the validity test 77 at the validator. 78 79 <p>Calling this is equal to calling <member>XValidator::isValid</member> with 80 the current value (see <member>getCurrentValue</member>) of the component, where 81 the validator is obtained via <member>XValidatable::getValidator</member>.</p> 82 83 <p>If no validator has been set (<member>XValidatable::setValidator</member>), this method 84 returns true.</p> 85 */ 86 boolean isValid(); 87 88 /** retrieves the current value of the component. 89 90 <p>The type of the current value, as well as it's semantics, depend on the service 91 implementing this interface.</p> 92 93 <p>Again, this is a convenience method. For example, for a <type scope="com::sun::star::form::component">FormattedField</type>, 94 calling this method is equivalent to retrieving the 95 <member scope="com::sun::star::awt">UnoControlFormattedFieldModel::EffectiveValue</member>.</p> 96 97 <p>If no validator has been set (<member>XValidatable::setValidator</member>), the value returned 98 here is defined by the service implementing this interface.</p> 99 */ 100 any getCurrentValue(); 101 102 /** registers the given listener. 103 104 <p><type>XFormComponentValidityListener</type>s are called whenever <em>any</em> of the aspects 105 of the validatable form component (the validity flag, or the value) changed.</p> 106 107 @throws <type scope="com::sun::star::lang">NullPointerException</type> 108 if the given listener is <NULL/> 109 */ 110 void addFormComponentValidityListener( [in] XFormComponentValidityListener Listener ) 111 raises( com::sun::star::lang::NullPointerException ); 112 113 /** registers the given listener. 114 115 @throws <type scope="com::sun::star::lang">NullPointerException</type> 116 if the given listener is <NULL/> 117 */ 118 void removeFormComponentValidityListener( [in] XFormComponentValidityListener Listener ) 119 raises( com::sun::star::lang::NullPointerException ); 120}; 121 122//============================================================================= 123 124}; }; }; }; }; 125 126#endif 127