Back to index

lightning-sunbird  0.9+nobinonly
nsIXFormsUtilityService.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is Mozilla XForms support.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * IBM Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 2004
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *  Aaron Reed <aaronr@us.ibm.com>
00024  *  Merle Sterling <msterlin@us.ibm.com>
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either the GNU General Public License Version 2 or later (the "GPL"), or
00028  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 
00040 #ifndef nsIXFormsUtilityService_h
00041 #define nsIXFormsUtilityService_h
00042 
00043 
00044 #include "nsISupports.h"
00045 #include "nsCOMArray.h"
00046 
00047 /* For IDL files that don't want to include root IDL files. */
00048 #ifndef NS_NO_VTABLE
00049 #define NS_NO_VTABLE
00050 #endif
00051 class nsIDOMNode; /* forward declaration */
00052 
00053 class nsIXFormsModelElement; /* forward declaration */
00054 
00055 /* starting interface:    nsIXFormsUtilityService */
00056 
00057 #define NS_IXFORMSUTILITYSERVICE_IID_STR "4903f4d8-df4d-454b-b9e7-7c45314af085"
00058 
00059 #define NS_IXFORMSUTILITYSERVICE_IID \
00060   {0x4903f4d8, 0xdf4d, 0x454b, \
00061     { 0xb9, 0xe7, 0x7c, 0x45, 0x31, 0x4a, 0xf0, 0x85 }}
00062 
00063 #define NS_XFORMS_UTILITY_CONTRACTID   "@mozilla.org/xforms-utility-service;1"
00064 
00065 /* Use this macro when declaring classes that implement this interface. */
00066 #define NS_DECL_NSIXFORMSUTILITYSERVICE \
00067   NS_IMETHOD GetModelFromNode(nsIDOMNode *node, nsIDOMNode **_retval); \
00068   NS_IMETHOD IsNodeAssocWithModel(nsIDOMNode *aNode, nsIDOMNode *aModel, PRBool *_retval); \
00069   NS_IMETHOD GetInstanceDocumentRoot(const nsAString & aID, nsIDOMNode *aModelNode, nsIDOMNode **_retval); \
00070   NS_IMETHOD ValidateString(const nsAString & aValue, const nsAString & aType, const nsAString & aNamespace, PRBool *_retval); \
00071   NS_IMETHOD GetRepeatIndexById(nsIDOMNode *aResolverNode, const nsAString &aId, PRInt32 *aIndex); \
00072   NS_IMETHOD GetMonths(const nsAString & aValue, PRInt32 *aMonths); \
00073   NS_IMETHOD GetSeconds(const nsAString & aValue, double *aSeconds); \
00074   NS_IMETHOD GetSecondsFromDateTime(const nsAString & aValue, double *aSeconds); \
00075   NS_IMETHOD GetDaysFromDateTime(const nsAString & aValue, PRInt32 *aDays); \
00076   NS_IMETHOD GetEventContextInfo(const nsAString & aContextName, nsIDOMNode *aNode, nsCOMArray<nsIDOMNode> *aResult); \
00077   NS_IMETHOD GetTime(nsAString & aValue, PRBool aUTC); \
00078   NS_IMETHOD Context(nsIDOMNode *aResolverNode, nsIDOMNode **aResult); \
00079   NS_IMETHOD IsCardNumber(const nsAString & aNumber, PRBool *aResult); \
00080   NS_IMETHOD Digest(const nsAString & aData, const nsAString & aAlgorithm, const nsAString & aEncoding, nsIDOMNode *aResolverNode, nsAString & aResult); \
00081   NS_IMETHOD AdjustDateTimeToTimezone(const nsAString & aDateTime, nsAString & aResult);
00082 
00087 class NS_NO_VTABLE nsIXFormsUtilityService : public nsISupports {
00088  public: 
00089 
00090   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IXFORMSUTILITYSERVICE_IID)
00091 
00092   
00096   /* nsIDOMNode getModelFromNode (in nsIDOMNode node); */
00097   NS_IMETHOD GetModelFromNode(nsIDOMNode *node, nsIDOMNode **_retval) = 0;
00098 
00114   /* PRBool isNodeAssocWithModel (in nsIDOMNode aNode, in nsIDOMNode aModel); */
00115   NS_IMETHOD IsNodeAssocWithModel(nsIDOMNode *aNode, nsIDOMNode *aModel, PRBool *_retval) = 0;
00116 
00122   /* nsIDOMNode getInstanceDocumentRoot (in DOMString aID, in nsIDOMNode aModelNode); */
00123   NS_IMETHOD GetInstanceDocumentRoot(const nsAString & aID, nsIDOMNode *aModelNode, nsIDOMNode **_retval) = 0;
00124 
00129   /* boolean validateString (in AString aValue, in AString aType, in AString aNamespace); */
00130   NS_IMETHOD ValidateString(const nsAString & aValue, const nsAString & aType, const nsAString & aNamespace, PRBool *_retval) = 0;
00131 
00135   /* unsigned long getRepeatIndexById (in nsIDOMNode aResolverNode, in AString aRepeat); */
00136   NS_IMETHOD GetRepeatIndexById(nsIDOMNode *aResolverNode, const nsAString &aId, PRInt32 *aIndex) = 0;
00137 
00142   /* long getMonths (in DOMString aValue); */
00143   NS_IMETHOD GetMonths(const nsAString & aValue, PRInt32 *aMonths) = 0;
00144 
00149   /* AString getSeconds (in DOMString aValue); */
00150   NS_IMETHOD GetSeconds(const nsAString & aValue, double *aSeconds) = 0;
00151 
00156   /* AString getSecondsFromDateTime (in DOMString aValue); */
00157   NS_IMETHOD GetSecondsFromDateTime(const nsAString & aValue, 
00158                                     double *aSeconds) = 0;
00159 
00164   /* AString getDaysFromDateTime (in DOMString aValue); */
00165   NS_IMETHOD GetDaysFromDateTime(const nsAString & aValue, 
00166                                  PRInt32         * aDays) = 0;
00167 
00171   /* nsCOMArray getEventContextInfo (in DOMString aContextName, in nsIDOMNode aNode); */
00172   NS_IMETHOD GetEventContextInfo(const nsAString & aContextName, nsIDOMNode *aNode,
00173                                  nsCOMArray<nsIDOMNode> *aResult) = 0;
00174 
00180   /* void getTime(out DOMString, PRBool aUTC); */
00181   NS_IMETHOD GetTime(nsAString & aValue, PRBool aUTC) = 0;
00182 
00187   /* nsIDOMNode context (in nsIDOMNode aResolverNode); */
00188   NS_IMETHOD Context(nsIDOMNode *aResolverNode, nsIDOMNode **aResult) = 0;
00189 
00194   /* PRBool(in DOMString); */
00195   NS_IMETHOD IsCardNumber(const nsAString & aNumber, PRBool *aResult) = 0;
00196 
00202   NS_IMETHOD Digest(const nsAString & aData, const nsAString & aAlgorithm,
00203                     const nsAString & aEncoding, nsIDOMNode *aResolverNode,
00204                     nsAString & aResult) = 0;
00205 
00209   /* DOMString AdjustDateTimeToTimezone(in DOMString aDateTime); */
00210   NS_IMETHOD AdjustDateTimeToTimezone(const nsAString & aDateTime,
00211                                       nsAString & aResult) = 0;
00212 };
00213 
00214 #define NS_ERROR_XFORMS_CALCUATION_EXCEPTION \
00215                        NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GENERAL, 3001)
00216 
00217 #endif /* nsIXFormsUtilityService_h */