cid#1636693 COPY_INSTEAD_OF_MOVE
[LibreOffice.git] / offapi / com / sun / star / form / validation / XValidatableFormComponent.idl
blobf797ef2521ab5404183891359b2854f52037c290
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 module com { module sun { module star { module form { module validation {
23 interface XFormComponentValidityListener;
26 /** is a convenience interface for accessing several aspects of a form component
27 which supports validation.
29 <p>A validatable form component has two aspects which other parties might
30 be interested in:
31 <ul>
32 <li>The pure validity flag: Whatever the user enters in the component, this is
33 either valid (relative to the active validator), or invalid.</li>
34 <li>The current value: Even if the validity flag does not change with the user
35 input (e.g. because the user replaces one invalid value with another invalid
36 value), observers might be interested in the current value, for example to
37 include it in a feedback message to the user.</li>
38 </ul>
39 </p>
41 <p>An XValidatableFormComponent allows to easily access both of these aspects.</p>
43 <p>Note that all of the information provided at this interface can also obtained by other means,
44 but much more inconveniently.</p>
46 @see XValidatable
47 @see XValidator
49 interface XValidatableFormComponent : XValidatable
51 /** determines whether the current value of the component passed the validity test
52 at the validator.
54 <p>Calling this is equal to calling XValidator::isValid() with
55 the current value (see getCurrentValue()) of the component, where
56 the validator is obtained via XValidatable::getValidator().</p>
58 <p>If no validator has been set (XValidatable::setValidator()), this method
59 returns true.</p>
61 boolean isValid();
63 /** retrieves the current value of the component.
65 <p>The type of the current value, as well as it's semantics, depend on the service
66 implementing this interface.</p>
68 <p>Again, this is a convenience method. For example, for a com::sun::star::form::component::FormattedField,
69 calling this method is equivalent to retrieving the
70 com::sun::star::awt::UnoControlFormattedFieldModel::EffectiveValue.</p>
72 <p>If no validator has been set (XValidatable::setValidator()), the value returned
73 here is defined by the service implementing this interface.</p>
75 any getCurrentValue();
77 /** registers the given listener.
79 <p>XFormComponentValidityListeners are called whenever <em>any</em> of the aspects
80 of the validatable form component (the validity flag, or the value) changed.</p>
82 @throws com::sun::star::lang::NullPointerException
83 if the given listener is `NULL`
85 void addFormComponentValidityListener( [in] XFormComponentValidityListener Listener )
86 raises( com::sun::star::lang::NullPointerException );
88 /** registers the given listener.
90 @throws com::sun::star::lang::NullPointerException
91 if the given listener is `NULL`
93 void removeFormComponentValidityListener( [in] XFormComponentValidityListener Listener )
94 raises( com::sun::star::lang::NullPointerException );
98 }; }; }; }; };
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */