1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is Mozilla XForms support.
17 * The Initial Developer of the Original Code is
19 * Portions created by the Initial Developer are Copyright (C) 2006
20 * the Initial Developer. All Rights Reserved.
23 * Aaron Reed <aaronr@us.ibm.com>
24 * Alexander Surkov <surkov.alexander@gmail.com>
26 * Alternatively, the contents of this file may be used under the terms of
27 * either the GNU General Public License Version 2 or later (the "GPL"), or
28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
38 * ***** END LICENSE BLOCK ***** */
40 #ifndef nsIXFormsUtilityService_h
41 #define nsIXFormsUtilityService_h
43 #include "nsISupports.h"
49 /* For IDL files that don't want to include root IDL files. */
54 /* nsIXFormsUtilityService */
55 #define NS_IXFORMSUTILITYSERVICE_IID_STR "cd3457b6-cb6a-496c-bdfa-6cfecb2bd5fb"
56 #define NS_IXFORMSUTILITYSERVICE_IID \
57 { 0xcd3457b6, 0xcb6a, 0x496c, \
58 { 0xbd, 0xfa, 0x6c, 0xfe, 0xcb, 0x2b, 0xd5, 0xfb } }
62 * Private interface implemented by the nsXFormsUtilityService in XForms
65 class NS_NO_VTABLE nsIXFormsUtilityService
: public nsISupports
{
68 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IXFORMSUTILITYSERVICE_IID
)
77 * Returns the name of the builtin type of the instance node that aElement is
78 * bound to. Fails if aElement doesn't have a bound node.
80 NS_IMETHOD
GetBuiltinTypeName(nsIDOMNode
*aElement
, nsAString
& aName
) = 0;
83 * Return true if instance node that element is bound to is readonly.
85 NS_IMETHOD
IsReadonly(nsIDOMNode
*aElement
, PRBool
*aState
) = 0;
88 * Return true if instance node that element is bound to is relevant.
90 NS_IMETHOD
IsRelevant(nsIDOMNode
*aElement
, PRBool
*aState
) = 0;
93 * Return true if instance node that element is bound to is required.
95 NS_IMETHOD
IsRequired(nsIDOMNode
*aElement
, PRBool
*aState
) = 0;
98 * Return true if instance node that element is bound to is valid.
100 NS_IMETHOD
IsValid(nsIDOMNode
*aElement
, PRBool
*aState
) = 0;
103 * Return constant declared above that indicates whether instance node that
104 * element is bound to is out of range, is in range or neither. The last value
105 * is used if element can't have in-range or out-of-range state, for exmple,
108 NS_IMETHOD
IsInRange(nsIDOMNode
*aElement
, PRUint32
*aState
) = 0;
111 * Return value of instance node that given node is bound to. If given node is
112 * xforms:item element then the method returns item value.
114 NS_IMETHOD
GetValue(nsIDOMNode
*aElement
, nsAString
& aValue
) = 0;
117 * Set the focus to xforms element.
119 NS_IMETHOD
Focus(nsIDOMNode
*aElement
) = 0;
122 * Return @start attribute value of xforms:range element. Failure if
123 * given element is not xforms:range.
125 NS_IMETHOD
GetRangeStart(nsIDOMNode
*aElement
, nsAString
& aValue
) = 0;
128 * Return @end attribute value of xforms:range element. Failure if
129 * given element is not xforms:range.
131 NS_IMETHOD
GetRangeEnd(nsIDOMNode
*aElement
, nsAString
& aValue
) = 0;
134 * Return @step attribute value of xforms:range element. Failure if
135 * given element is not xforms:range.
137 NS_IMETHOD
GetRangeStep(nsIDOMNode
*aElement
, nsAString
& aValue
) = 0;
140 * Return nsIEditor for xforms element if element is editable, null if it is
141 * not editable. Failure if given element doesn't support editing.
143 NS_IMETHOD
GetEditor(nsIDOMNode
*aElement
, nsIEditor
**aEditor
) = 0;
146 * Return true if dropmarker is in open state (combobox popup is open),
147 * otherwise false. Failure if given 'aElement' node is not direct child of
148 * combobox element or is not combobox itself.
150 NS_IMETHOD
IsDropmarkerOpen(nsIDOMNode
*aElement
, PRBool
* aIsOpen
) = 0;
153 * Toggles dropmarker state (close/open combobox popup). Failure if given
154 * 'aElement' node is not direct child of combobox element or is not combobox
157 NS_IMETHOD
ToggleDropmarkerState(nsIDOMNode
*aElement
) = 0;
160 * Get selected xforms:item element for xforms:select1. Failure if
161 * given 'aElement' node is not xforms:select1.
163 NS_IMETHOD
GetSelectedItemForSelect1(nsIDOMNode
*aElement
,
164 nsIDOMNode
** aItem
) = 0;
167 * Set selected xforms:item element for xforms:select1. Failure if
168 * given 'aElement' node is not xforms:select1.
170 NS_IMETHOD
SetSelectedItemForSelect1(nsIDOMNode
*aElement
,
171 nsIDOMNode
*aItem
) = 0;
174 * Get the list of selected xforms:item elements from the xforms:select.
175 * Failure if given 'aElement' node is not xforms:select.
177 NS_IMETHOD
GetSelectedItemsForSelect(nsIDOMNode
*aElement
,
178 nsIDOMNodeList
**aItems
) = 0;
181 * Add xforms:item element to selection of xforms:select. Failure if
182 * given 'aElement' node is not xforms:select.
184 NS_IMETHOD
AddItemToSelectionForSelect(nsIDOMNode
*aElement
,
185 nsIDOMNode
*Item
) = 0;
188 * Remove xforms:item element from selection of xforms:select. Failure if
189 * given 'aElement' node is not xforms:select.
191 NS_IMETHOD
RemoveItemFromSelectionForSelect(nsIDOMNode
*aElement
,
192 nsIDOMNode
*Item
) = 0;
195 * Deslect all xforms:item elements contained in the given xforms:select.
196 * Failure if given 'aElement' node is not xforms:select.
198 NS_IMETHOD
ClearSelectionForSelect(nsIDOMNode
*aElement
) = 0;
201 * Select all xforms:item elements of xforms:select. Failure if
202 * given 'aElement' node is not xforms:select.
204 NS_IMETHOD
SelectAllItemsForSelect(nsIDOMNode
*aElement
) = 0;
207 * Return true if given xforms:item element of xforms:select is selected,
208 * otherwise return false. Failure if given 'aElement' node is not
211 NS_IMETHOD
IsSelectItemSelected(nsIDOMNode
*aElement
, nsIDOMNode
*aItem
,
212 PRBool
*aIsSelected
) = 0;
215 * Return the list of xforms:item or xforms:choices elements that are children
216 * of the given 'aElement' node. 'aElement' node may be a xforms:select,
217 * xforms:select1, xforms:choices or xforms:itemset element. Otherwise
220 NS_IMETHOD
GetSelectChildrenFor(nsIDOMNode
*aElement
,
221 nsIDOMNodeList
**aNodeList
) = 0;
224 NS_DEFINE_STATIC_IID_ACCESSOR(nsIXFormsUtilityService
,
225 NS_IXFORMSUTILITYSERVICE_IID
)
227 #endif /* nsIXFormsUtilityService_h */