1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
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/
9 : *
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
13 : * License.
14 : *
15 : * The Original Code is mozilla.org code.
16 : *
17 : * The Initial Developer of the Original Code is
18 : * Netscape Communications Corporation.
19 : * Portions created by the Initial Developer are Copyright (C) 1998
20 : * the Initial Developer. All Rights Reserved.
21 : *
22 : * Contributor(s):
23 : *
24 : * Alternatively, the contents of this file may be used under the terms of
25 : * either of the GNU General Public License Version 2 or later (the "GPL"),
26 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 : * in which case the provisions of the GPL or the LGPL are applicable instead
28 : * of those above. If you wish to allow use of your version of this file only
29 : * under the terms of either the GPL or the LGPL, and not to allow others to
30 : * use your version of this file under the terms of the MPL, indicate your
31 : * decision by deleting the provisions above and replace them with the notice
32 : * and other provisions required by the GPL or the LGPL. If you do not delete
33 : * the provisions above, a recipient may use your version of this file under
34 : * the terms of any one of the MPL, the GPL or the LGPL.
35 : *
36 : * ***** END LICENSE BLOCK ***** */
37 : #ifndef nsIForm_h___
38 : #define nsIForm_h___
39 :
40 : #include "nsISupports.h"
41 : #include "nsAString.h"
42 :
43 : class nsIFormControl;
44 : class nsISimpleEnumerator;
45 : class nsIURI;
46 :
47 : #define NS_FORM_METHOD_GET 0
48 : #define NS_FORM_METHOD_POST 1
49 : #define NS_FORM_ENCTYPE_URLENCODED 0
50 : #define NS_FORM_ENCTYPE_MULTIPART 1
51 : #define NS_FORM_ENCTYPE_TEXTPLAIN 2
52 :
53 : // IID for the nsIForm interface
54 : #define NS_IFORM_IID \
55 : { 0x27f1ff6c, 0xeb78, 0x405b, \
56 : { 0xa6, 0xeb, 0xf0, 0xce, 0xa8, 0x30, 0x85, 0x58 } }
57 :
58 : /**
59 : * This interface provides some methods that can be used to access the
60 : * guts of a form. It's being slowly phased out.
61 : */
62 :
63 : class nsIForm : public nsISupports
64 0 : {
65 : public:
66 : NS_DECLARE_STATIC_IID_ACCESSOR(NS_IFORM_IID)
67 :
68 : /**
69 : * Get the element at a specified index position in form.elements
70 : *
71 : * @param aIndex the index
72 : * @param aElement the element at that index
73 : * @return NS_OK if there was an element at that position, -1 otherwise
74 : */
75 : NS_IMETHOD_(nsIFormControl*) GetElementAt(PRInt32 aIndex) const = 0;
76 :
77 : /**
78 : * Get the number of elements in form.elements
79 : *
80 : * @param aCount the number of elements
81 : * @return NS_OK if there was an element at that position, -1 otherwise
82 : */
83 : NS_IMETHOD_(PRUint32) GetElementCount() const = 0;
84 :
85 : /**
86 : * Resolve a name in the scope of the form object, this means find
87 : * form controls in this form with the correct value in the name
88 : * attribute.
89 : *
90 : * @param aElement the element to remove
91 : * @param aName the name or id of the element to remove
92 : * @return NS_OK if the element was successfully removed.
93 : */
94 : NS_IMETHOD_(already_AddRefed<nsISupports>) ResolveName(const nsAString& aName) = 0;
95 :
96 : /**
97 : * Get the index of the given control within form.elements.
98 : * @param aControl the control to find the index of
99 : * @param aIndex the index [OUT]
100 : */
101 : NS_IMETHOD_(PRInt32) IndexOfControl(nsIFormControl* aControl) = 0;
102 :
103 : /**
104 : * Get the default submit element. If there's no default submit element,
105 : * return null.
106 : */
107 : NS_IMETHOD_(nsIFormControl*) GetDefaultSubmitElement() const = 0;
108 : };
109 :
110 : NS_DEFINE_STATIC_IID_ACCESSOR(nsIForm, NS_IFORM_IID)
111 :
112 : #endif /* nsIForm_h___ */
|