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) 1999
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 :
38 :
39 : /**
40 : * MODULE NOTES:
41 : * @created kmcclusk 10/19/99
42 : *
43 : */
44 :
45 : #ifndef nsIFormProcessor_h__
46 : #define nsIFormProcessor_h__
47 :
48 : #include "nsISupports.h"
49 : #include "prtypes.h"
50 :
51 : #include "nsIDOMHTMLInputElement.h"
52 : #include "nsTArray.h"
53 :
54 : class nsString;
55 :
56 : // {0ae53c0f-8ea2-4916-bedc-717443c3e185}
57 : #define NS_FORMPROCESSOR_CID \
58 : { 0x0ae53c0f, 0x8ea2, 0x4916, { 0xbe, 0xdc, 0x71, 0x74, 0x43, 0xc3, 0xe1, 0x85 } }
59 :
60 : #define NS_FORMPROCESSOR_CONTRACTID "@mozilla.org/layout/form-processor;1"
61 :
62 : // 6d4ea1aa-a6b2-43bd-a19d-3f0f26750df3
63 : #define NS_IFORMPROCESSOR_IID \
64 : { 0x6d4ea1aa, 0xa6b2, 0x43bd, \
65 : { 0xa1, 0x9d, 0x3f, 0x0f, 0x26, 0x75, 0x0d, 0xf3 } }
66 :
67 :
68 :
69 :
70 : // XXX:In the future, we should examine combining this interface with nsIFormSubmitObserver.
71 : // nsIFormSubmitObserver could have a before, during, and after form submission methods.
72 : // The before and after methods would be passed a nsISupports interface. The During would
73 : // Have the same method signature as ProcessValue.
74 :
75 :
76 0 : class nsIFormProcessor : public nsISupports {
77 : public:
78 : NS_DECLARE_STATIC_IID_ACCESSOR(NS_IFORMPROCESSOR_IID)
79 :
80 : /* ProcessValue is called for each name value pair that is
81 : * about to be submitted for both "get" and "post" form submissions.
82 : *
83 : * The formprocessor is registered as a service that gets called for
84 : * every form submission.
85 : *
86 : * @param aElement element which the attribute/value pair is submitted for
87 : * @param aName value of the form element name attribute about to be submitted
88 : * @param aValue On entry it contains the value about to be submitted for aName.
89 : * On exit it contains the value which will actually be submitted for aName.
90 : *
91 : */
92 : NS_IMETHOD ProcessValue(nsIDOMHTMLElement *aElement,
93 : const nsAString& aName,
94 : nsAString& aValue) = 0;
95 :
96 : /* Provide content for a form element. This method provides a mechanism to provide
97 : * content which comes from a source other than the document (i.e. a local database)
98 : *
99 : * @param aFormType Type of form to get content for.
100 : * @param aOptions List of nsStrings which define the contents for the form element
101 : * @param aAttr Attribute to be attached to the form element. It is used to identify
102 : * the form element contains non-standard content.
103 : */
104 :
105 : NS_IMETHOD ProvideContent(const nsAString& aFormType,
106 : nsTArray<nsString>& aContent,
107 : nsAString& aAttribute) = 0;
108 :
109 : };
110 :
111 : NS_DEFINE_STATIC_IID_ACCESSOR(nsIFormProcessor, NS_IFORMPROCESSOR_IID)
112 :
113 : #endif /* nsIFormProcessor_h__ */
114 :
|