2004-10-13 13:51:52 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is Mozilla XForms support.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* IBM Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2004
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Brian Ryner <bryner@brianryner.com>
|
2005-06-26 22:30:17 +04:00
|
|
|
* Olli Pettay <Olli.Pettay@helsinki.fi>
|
2004-10-13 13:51:52 +04:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
#ifndef nsXFormsModelElement_h_
|
|
|
|
#define nsXFormsModelElement_h_
|
|
|
|
|
2004-11-04 03:24:40 +03:00
|
|
|
#include "nsXFormsStubElement.h"
|
2004-10-26 04:34:03 +04:00
|
|
|
#include "nsIModelElementPrivate.h"
|
2005-10-25 21:29:56 +04:00
|
|
|
#include "nsIXFormsNSModelElement.h"
|
2004-12-15 22:46:10 +03:00
|
|
|
#include "nsIDOMEventListener.h"
|
2004-10-13 13:51:52 +04:00
|
|
|
#include "nsISchema.h"
|
|
|
|
#include "nsCOMArray.h"
|
|
|
|
#include "nsVoidArray.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIDOMDocument.h"
|
2005-10-25 21:29:56 +04:00
|
|
|
#include "nsIDOMNodeList.h"
|
2004-11-13 03:22:30 +03:00
|
|
|
#include "nsXFormsMDGEngine.h"
|
2005-05-05 11:09:40 +04:00
|
|
|
#include "nsXFormsUtils.h"
|
2005-10-25 21:29:56 +04:00
|
|
|
#include "nsIClassInfo.h"
|
2004-10-13 13:51:52 +04:00
|
|
|
|
|
|
|
#include "nsISchemaLoader.h"
|
|
|
|
#include "nsISchema.h"
|
2005-06-20 23:08:46 +04:00
|
|
|
#include "nsIXFormsContextControl.h"
|
2006-08-02 01:21:27 +04:00
|
|
|
#include "nsDataHashtable.h"
|
2004-10-13 13:51:52 +04:00
|
|
|
|
|
|
|
class nsIDOMElement;
|
|
|
|
class nsIDOMNode;
|
2006-07-13 18:21:53 +04:00
|
|
|
class nsIDOMXPathEvaluator;
|
2004-11-13 03:22:30 +03:00
|
|
|
class nsIDOMXPathResult;
|
2004-10-13 13:51:52 +04:00
|
|
|
class nsXFormsControl;
|
2005-10-25 21:29:56 +04:00
|
|
|
class nsXFormsModelInstanceDocuments;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implementation of the instance node list returned by
|
|
|
|
* nsIXFormsModel::getInstanceDocuments.
|
|
|
|
*
|
|
|
|
* Manages the list of all instance elements that belong to a given
|
|
|
|
* nsXFormsModelElement.
|
|
|
|
*/
|
|
|
|
class nsXFormsModelInstanceDocuments : public nsIDOMNodeList,
|
|
|
|
public nsIClassInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsXFormsModelInstanceDocuments();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSICLASSINFO
|
|
|
|
NS_DECL_NSIDOMNODELIST
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add an instance element
|
|
|
|
*
|
|
|
|
* @param aInstance The new instance element
|
|
|
|
*/
|
|
|
|
void AddInstance(nsIInstanceElementPrivate *aInstance);
|
|
|
|
|
2006-02-08 14:03:27 +03:00
|
|
|
/**
|
|
|
|
* Remove an instance element
|
|
|
|
*
|
|
|
|
* @param aInstance The instance element
|
|
|
|
*/
|
|
|
|
void RemoveInstance(nsIInstanceElementPrivate *aInstance);
|
|
|
|
|
2005-10-25 21:29:56 +04:00
|
|
|
/**
|
|
|
|
* Get the instance document at a given index
|
|
|
|
*
|
|
|
|
* @note Does NOT addref the returned element!
|
|
|
|
*
|
|
|
|
* @param aIndex The index
|
|
|
|
* @return The instance element (or nsnull if not found)
|
|
|
|
*/
|
|
|
|
nsIInstanceElementPrivate* GetInstanceAt(PRUint32 aIndex);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Instructs the class to drop references to all instance elements
|
|
|
|
*/
|
|
|
|
void DropReferences();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
/** The array holding the instance elements */
|
|
|
|
nsCOMArray<nsIInstanceElementPrivate> mInstanceList;
|
|
|
|
};
|
2004-10-13 13:51:52 +04:00
|
|
|
|
2006-03-29 14:49:28 +04:00
|
|
|
/**
|
|
|
|
* A class for storing pointers to XForms controls added to an XForms
|
|
|
|
* model. Organized as a tree, with pointers to first child and next sibling.
|
|
|
|
*
|
|
|
|
* Notes:
|
|
|
|
* 1) The root node is special; only has children and a nsnull mNode.
|
|
|
|
* 2) All functions operate on the node they are called on, and its
|
|
|
|
* subtree. Functions will never go up (as in: nearer the root) in the tree.
|
|
|
|
*/
|
|
|
|
class nsXFormsControlListItem
|
|
|
|
{
|
|
|
|
/** The XForms control itself */
|
|
|
|
nsCOMPtr<nsIXFormsControl> mNode;
|
|
|
|
|
|
|
|
/** The next sibling of the node */
|
|
|
|
nsXFormsControlListItem *mNextSibling;
|
|
|
|
|
|
|
|
/** The first child of the node */
|
|
|
|
nsXFormsControlListItem *mFirstChild;
|
|
|
|
|
2006-08-02 01:21:27 +04:00
|
|
|
nsDataHashtable<nsISupportsHashKey,nsXFormsControlListItem *> *mControlListHash;
|
|
|
|
|
2006-03-29 14:49:28 +04:00
|
|
|
public:
|
2006-08-02 01:21:27 +04:00
|
|
|
|
|
|
|
/** The constructor takes a hashtable pointer, which needs to point to the
|
|
|
|
* model's hashtable. This is so that each item in the control list has
|
|
|
|
* access to the same hashtable and can add/remove items from it and find
|
|
|
|
* items in it.
|
|
|
|
*/
|
|
|
|
nsXFormsControlListItem(
|
|
|
|
nsIXFormsControl* aControl,
|
|
|
|
nsDataHashtable<nsISupportsHashKey,nsXFormsControlListItem *> *aHash);
|
|
|
|
nsXFormsControlListItem();
|
2006-03-29 14:49:28 +04:00
|
|
|
~nsXFormsControlListItem();
|
|
|
|
nsXFormsControlListItem(const nsXFormsControlListItem& aCopy);
|
|
|
|
|
|
|
|
/** Clear contents of current node, all siblings, and all children */
|
|
|
|
void Clear();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a control from the current (sub-) tree. Will search from that node
|
|
|
|
* and down in the tree for the node.
|
|
|
|
*
|
|
|
|
* @param aControl The control to remove
|
|
|
|
* @param aRemoved Was the control found and removed?
|
|
|
|
*/
|
|
|
|
nsresult RemoveControl(nsIXFormsControl *aControl, PRBool &aRemoved);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a control to the (sub-) tree as a child to the given |aParent|. If
|
|
|
|
* there is no |aParent|, it will insert it as a sibling to |this|. If
|
|
|
|
* |aParent| is not found, it will bail.
|
|
|
|
*
|
|
|
|
* @param aControl The control to insert
|
|
|
|
* @param aParent The (eventual) parent to insert it under
|
|
|
|
*/
|
|
|
|
nsresult AddControl(nsIXFormsControl *aControl,
|
|
|
|
nsIXFormsControl *aParent);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Find a control in the (sub-) tree.
|
|
|
|
*
|
|
|
|
* @param aControl The control to find
|
|
|
|
*/
|
|
|
|
nsXFormsControlListItem* FindControl(nsIXFormsControl *aControl);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the nsIXFormsControl that this node contains.
|
|
|
|
*/
|
|
|
|
already_AddRefed<nsIXFormsControl> Control();
|
|
|
|
|
|
|
|
/** Return the first child of the node */
|
|
|
|
nsXFormsControlListItem* FirstChild() { return mFirstChild; };
|
|
|
|
|
|
|
|
/** Return the next sibling of the node */
|
|
|
|
nsXFormsControlListItem* NextSibling() { return mNextSibling; };
|
|
|
|
|
|
|
|
/**
|
|
|
|
* An iterator implementation for the class.
|
|
|
|
*/
|
|
|
|
class iterator
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
/** The control the iterator is currently pointing at */
|
|
|
|
nsXFormsControlListItem *mCur;
|
|
|
|
|
|
|
|
/** A stack of non-visited nodes */
|
|
|
|
nsVoidArray mStack;
|
|
|
|
|
|
|
|
public:
|
|
|
|
iterator();
|
2006-03-31 12:36:52 +04:00
|
|
|
iterator(const iterator&);
|
2006-03-29 14:49:28 +04:00
|
|
|
iterator operator=(nsXFormsControlListItem*);
|
|
|
|
bool operator!=(const nsXFormsControlListItem*);
|
|
|
|
iterator operator++();
|
|
|
|
nsXFormsControlListItem* operator*();
|
|
|
|
};
|
2006-03-31 12:36:52 +04:00
|
|
|
friend class nsXFormsControlListItem::iterator;
|
2006-03-29 14:49:28 +04:00
|
|
|
|
|
|
|
/** The begining position for the node (itself) */
|
|
|
|
nsXFormsControlListItem* begin();
|
|
|
|
|
|
|
|
/** The end position for the node (nsnull) */
|
|
|
|
nsXFormsControlListItem* end();
|
|
|
|
};
|
|
|
|
|
2004-11-05 00:12:22 +03:00
|
|
|
/**
|
|
|
|
* Implementation of the XForms \<model\> element.
|
|
|
|
*
|
|
|
|
* This includes all of the code for loading the model's external resources and
|
|
|
|
* initializing the model and its controls.
|
|
|
|
*
|
|
|
|
* @see http://www.w3.org/TR/xforms/slice3.html#structure-model
|
|
|
|
*/
|
2004-11-04 03:24:40 +03:00
|
|
|
class nsXFormsModelElement : public nsXFormsStubElement,
|
2004-10-26 04:34:03 +04:00
|
|
|
public nsIModelElementPrivate,
|
2005-10-25 21:29:56 +04:00
|
|
|
public nsIXFormsNSModelElement,
|
2004-10-13 13:51:52 +04:00
|
|
|
public nsISchemaLoadListener,
|
2005-06-20 23:08:46 +04:00
|
|
|
public nsIDOMEventListener,
|
|
|
|
public nsIXFormsContextControl
|
2004-10-13 13:51:52 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsXFormsModelElement() NS_HIDDEN;
|
|
|
|
|
2004-11-04 03:24:40 +03:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2004-10-13 13:51:52 +04:00
|
|
|
NS_DECL_NSIXFORMSMODELELEMENT
|
2004-10-26 04:34:03 +04:00
|
|
|
NS_DECL_NSIMODELELEMENTPRIVATE
|
2005-10-25 21:29:56 +04:00
|
|
|
NS_DECL_NSIXFORMSNSMODELELEMENT
|
2004-10-13 13:51:52 +04:00
|
|
|
NS_DECL_NSISCHEMALOADLISTENER
|
|
|
|
NS_DECL_NSIWEBSERVICEERRORHANDLER
|
|
|
|
NS_DECL_NSIDOMEVENTLISTENER
|
2005-06-20 23:08:46 +04:00
|
|
|
NS_DECL_NSIXFORMSCONTEXTCONTROL
|
2004-10-13 13:51:52 +04:00
|
|
|
|
2006-10-08 18:15:02 +04:00
|
|
|
// nsIXTFElement overrides
|
2004-11-04 03:24:40 +03:00
|
|
|
NS_IMETHOD OnDestroyed();
|
|
|
|
NS_IMETHOD GetScriptingInterfaces(PRUint32 *aCount, nsIID ***aArray);
|
|
|
|
NS_IMETHOD WillChangeDocument(nsIDOMDocument *aNewDocument);
|
|
|
|
NS_IMETHOD DocumentChanged(nsIDOMDocument *aNewDocument);
|
|
|
|
NS_IMETHOD DoneAddingChildren();
|
|
|
|
NS_IMETHOD HandleDefault(nsIDOMEvent *aEvent, PRBool *aHandled);
|
2006-10-08 18:15:02 +04:00
|
|
|
NS_IMETHOD OnCreated(nsIXTFElementWrapper *aWrapper);
|
2004-11-04 03:24:40 +03:00
|
|
|
|
2005-06-21 20:47:29 +04:00
|
|
|
// nsIXFormsControlBase overrides
|
2006-05-22 13:06:14 +04:00
|
|
|
NS_IMETHOD Bind(PRBool *aContextChanged) {
|
2005-06-21 20:47:29 +04:00
|
|
|
// dummy method, so does nothing
|
|
|
|
return NS_OK;
|
|
|
|
};
|
|
|
|
|
2006-05-15 18:14:52 +04:00
|
|
|
NS_IMETHOD GetOnDeferredBindList(PRBool *onList) {
|
|
|
|
// dummy method, so does nothing
|
|
|
|
return NS_OK;
|
|
|
|
};
|
|
|
|
|
|
|
|
NS_IMETHOD SetOnDeferredBindList(PRBool putOnList) {
|
|
|
|
// dummy method, so does nothing
|
|
|
|
return NS_OK;
|
|
|
|
};
|
|
|
|
|
2004-10-13 13:51:52 +04:00
|
|
|
// Called after nsXFormsAtoms is registered
|
|
|
|
static NS_HIDDEN_(void) Startup();
|
|
|
|
|
2005-05-17 15:30:43 +04:00
|
|
|
/**
|
|
|
|
* The models are not ready for binding, so defer the binding of the control
|
|
|
|
* by storing it as a property on the document. The models will run through
|
|
|
|
* this list when they are ready for binding.
|
|
|
|
*
|
|
|
|
* @param aControl XForms control waiting to be bound
|
|
|
|
*/
|
2006-06-06 17:52:03 +04:00
|
|
|
static NS_HIDDEN_(nsresult) DeferElementBind(nsIXFormsControl *aControl);
|
2005-05-17 15:30:43 +04:00
|
|
|
|
2005-06-26 22:30:17 +04:00
|
|
|
static nsresult NeedsPostRefresh(nsIXFormsControl* aControl);
|
2006-05-15 18:14:52 +04:00
|
|
|
|
|
|
|
// Sometimes a child that is on the post refresh list will want to force
|
|
|
|
// its containing xforms control to refresh. Like if an xf:item's label
|
|
|
|
// refreshes, it wants to reflect any of its changes in the xf:select or
|
|
|
|
// xf:select1 that contains it. This function will try to minimize that by
|
|
|
|
// allowing xforms controls that function as containers (like select/select1)
|
|
|
|
// to defer their refresh until most or all of its children have refreshed.
|
|
|
|
// Well, at least until every control on the sPostRefreshList has been
|
|
|
|
// processed. This will return PR_TRUE if the refresh will be deferred.
|
|
|
|
static PRBool ContainerNeedsPostRefresh(nsIXFormsControl* aControl);
|
2005-06-26 22:30:17 +04:00
|
|
|
static void CancelPostRefresh(nsIXFormsControl* aControl);
|
2006-04-05 12:05:25 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the DOM element for the model.
|
|
|
|
*/
|
|
|
|
already_AddRefed<nsIDOMElement> GetDOMElement();
|
|
|
|
|
2004-10-13 13:51:52 +04:00
|
|
|
private:
|
2004-10-26 04:34:03 +04:00
|
|
|
|
|
|
|
NS_HIDDEN_(already_AddRefed<nsIDOMDocument>)
|
|
|
|
FindInstanceDocument(const nsAString &aID);
|
2005-02-01 02:56:27 +03:00
|
|
|
NS_HIDDEN_(void) Reset();
|
|
|
|
NS_HIDDEN_(void) BackupOrRestoreInstanceData(PRBool restore);
|
2004-10-26 04:34:03 +04:00
|
|
|
|
2005-02-01 19:02:54 +03:00
|
|
|
/** Initializes the MIPs on all form controls */
|
2005-05-05 11:09:40 +04:00
|
|
|
NS_HIDDEN_(nsresult) InitializeControls();
|
2005-02-01 19:02:54 +03:00
|
|
|
|
2005-10-28 22:52:56 +04:00
|
|
|
NS_HIDDEN_(nsresult) InitializeInstances();
|
|
|
|
|
2005-02-01 02:41:00 +03:00
|
|
|
NS_HIDDEN_(nsresult) ProcessBindElements();
|
2004-10-13 13:51:52 +04:00
|
|
|
NS_HIDDEN_(nsresult) FinishConstruction();
|
2005-02-01 19:02:54 +03:00
|
|
|
NS_HIDDEN_(nsresult) ConstructDone();
|
2004-12-15 22:46:10 +03:00
|
|
|
NS_HIDDEN_(void) MaybeNotifyCompletion();
|
2004-10-26 04:34:03 +04:00
|
|
|
|
2006-07-13 18:21:53 +04:00
|
|
|
NS_HIDDEN_(nsresult) ProcessBind(nsIDOMXPathEvaluator *aEvaluator,
|
|
|
|
nsIDOMNode *aContextNode,
|
|
|
|
PRInt32 aContextPosition,
|
|
|
|
PRInt32 aContextSize,
|
|
|
|
nsIDOMElement *aBindElement,
|
|
|
|
PRBool aIsOuter = PR_FALSE);
|
2004-10-13 13:51:52 +04:00
|
|
|
|
|
|
|
NS_HIDDEN_(void) RemoveModelFromDocument();
|
|
|
|
|
2005-05-05 11:09:40 +04:00
|
|
|
/**
|
|
|
|
* Sets the state of a specific state.
|
|
|
|
*
|
|
|
|
* @param aElement The element to dispatch events to and set states on
|
|
|
|
* @param aState The state value
|
|
|
|
* @param aOnEvent The on event for the state.
|
|
|
|
*/
|
|
|
|
NS_HIDDEN_(void) SetSingleState(nsIDOMElement *aElement,
|
|
|
|
PRBool aState,
|
2005-10-19 11:39:36 +04:00
|
|
|
nsXFormsEvent aOnEvent);
|
2005-01-19 19:05:31 +03:00
|
|
|
|
2005-05-17 15:30:43 +04:00
|
|
|
/**
|
2006-05-22 13:06:14 +04:00
|
|
|
* Handle controls bindings which was deferred because the model was not
|
|
|
|
* ready.
|
|
|
|
*
|
|
|
|
* @note Only registers the controls with the model. Does not setup
|
|
|
|
* bindings, etc.
|
2005-05-17 15:30:43 +04:00
|
|
|
*
|
|
|
|
* @param aDoc Document that contains the XForms control
|
|
|
|
*/
|
|
|
|
static NS_HIDDEN_(void) ProcessDeferredBinds(nsIDOMDocument *aDoc);
|
|
|
|
|
2004-12-15 22:46:10 +03:00
|
|
|
// Returns true when all external documents have been loaded
|
2004-11-11 02:24:23 +03:00
|
|
|
PRBool IsComplete() const { return (mSchemaTotal == mSchemaCount
|
2004-10-13 13:51:52 +04:00
|
|
|
&& mPendingInstanceCount == 0); }
|
|
|
|
|
2005-12-14 00:19:58 +03:00
|
|
|
/**
|
|
|
|
* Called by HandleEvent. Event handler for the 'DOMContentLoaded' event.
|
|
|
|
*/
|
|
|
|
NS_HIDDEN_(nsresult) HandleLoad(nsIDOMEvent *aEvent);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called by HandleEvent. Event handler for the 'unload' event.
|
|
|
|
*/
|
|
|
|
NS_HIDDEN_(nsresult) HandleUnload(nsIDOMEvent *aEvent);
|
|
|
|
|
2006-03-29 14:49:28 +04:00
|
|
|
NS_HIDDEN_(nsresult) RefreshSubTree(nsXFormsControlListItem *aCurrent,
|
2006-04-05 20:51:11 +04:00
|
|
|
PRBool aForceRebind);
|
|
|
|
|
|
|
|
NS_HIDDEN_(nsresult) ValidateDocument(nsIDOMDocument *aInstanceDocument,
|
|
|
|
PRBool *aResult);
|
2006-03-29 14:49:28 +04:00
|
|
|
|
2006-05-22 12:51:06 +04:00
|
|
|
/**
|
|
|
|
* Request to send an update event to the model. If an update is already
|
|
|
|
* running, the event will be queued, and sent after that. If multiple
|
|
|
|
* events are queued, they will be dispatched FIFO order.
|
|
|
|
*
|
|
|
|
* @param aEvent The requested event
|
|
|
|
*/
|
|
|
|
NS_HIDDEN_(nsresult) RequestUpdateEvent(nsXFormsEvent aEvent);
|
|
|
|
|
2006-05-24 09:29:30 +04:00
|
|
|
/**
|
|
|
|
* Returns true if a schema has already been registered to address the same
|
|
|
|
* namespace as aSchemaElement. Per section 3.3.1 of the XForms spec:
|
|
|
|
* Within each XForms Model, there is a limit of one Schema per namespace
|
|
|
|
* declaration, including inline and linked Schemas.
|
|
|
|
*
|
|
|
|
* @param aSchemaElement The schema element
|
|
|
|
*/
|
|
|
|
PRBool IsDuplicateSchema(nsIDOMElement *aSchemaElement);
|
|
|
|
|
2006-05-31 11:47:58 +04:00
|
|
|
/**
|
|
|
|
* Validate all the instance documents.
|
|
|
|
*/
|
|
|
|
void ValidateInstanceDocuments();
|
|
|
|
|
2006-08-11 01:41:25 +04:00
|
|
|
/**
|
|
|
|
* Starting with aType, walks through the builtin derived types back to the
|
|
|
|
* builtin primative type, appending the datatype URIs to the string array as
|
|
|
|
* it goes
|
|
|
|
*/
|
|
|
|
NS_HIDDEN_(nsresult) AppendBuiltinTypes(PRUint16 aType,
|
|
|
|
nsStringArray *aBuiltinType);
|
|
|
|
/**
|
|
|
|
* Starting from aType, walks the chain of datatype extension/derivation to
|
|
|
|
* gather information.
|
|
|
|
*
|
|
|
|
* @param aType The type we are trying to find datatype information
|
|
|
|
* for
|
|
|
|
* @param aBuiltinType If non-null, we'll return the root primative type
|
|
|
|
* of aType in this buffer
|
|
|
|
* @param aTypeArray If aBuiltinType is nsnull, we'll build a string
|
|
|
|
* array of datatype URIs and put them in aTypeArray.
|
|
|
|
*/
|
|
|
|
NS_HIDDEN_(nsresult) WalkTypeChainInternal(nsISchemaType *aType,
|
|
|
|
PRUint16 *aBuiltinType,
|
|
|
|
nsStringArray *aTypeArray);
|
|
|
|
/**
|
|
|
|
* Returns the primative type that aSchemaType is derived/extended from
|
|
|
|
*/
|
|
|
|
NS_HIDDEN_(nsresult) BuiltinTypeToPrimative(nsISchemaBuiltinType *aSchemaType,
|
|
|
|
PRUint16 *aPrimType);
|
|
|
|
|
2004-11-11 02:24:23 +03:00
|
|
|
nsIDOMElement *mElement;
|
|
|
|
nsCOMPtr<nsISchemaLoader> mSchemas;
|
2004-12-15 22:46:10 +03:00
|
|
|
nsStringArray mPendingInlineSchemas;
|
2006-03-29 14:49:28 +04:00
|
|
|
nsXFormsControlListItem mFormControls;
|
2006-08-02 01:21:27 +04:00
|
|
|
nsDataHashtable<nsISupportsHashKey,nsXFormsControlListItem *> mControlListHash;
|
2004-10-13 13:51:52 +04:00
|
|
|
|
|
|
|
PRInt32 mSchemaCount;
|
2004-11-11 02:24:23 +03:00
|
|
|
PRInt32 mSchemaTotal;
|
2004-10-13 13:51:52 +04:00
|
|
|
PRInt32 mPendingInstanceCount;
|
2004-12-15 22:46:10 +03:00
|
|
|
|
2005-01-19 19:05:31 +03:00
|
|
|
/** The MDG for this model */
|
2004-11-13 03:22:30 +03:00
|
|
|
nsXFormsMDGEngine mMDG;
|
2004-12-15 22:46:10 +03:00
|
|
|
|
2005-02-01 23:23:41 +03:00
|
|
|
/**
|
|
|
|
* List of changed nodes, ie. nodes that have not been informed about
|
|
|
|
* changes yet
|
|
|
|
*/
|
2005-02-24 17:35:27 +03:00
|
|
|
nsCOMArray<nsIDOMNode> mChangedNodes;
|
2005-01-19 19:05:31 +03:00
|
|
|
|
2006-05-22 12:51:06 +04:00
|
|
|
/**
|
|
|
|
* This flag indicates whether or not the document has fired
|
|
|
|
* DOMContentLoaded
|
|
|
|
*/
|
|
|
|
PRPackedBool mDocumentLoaded;
|
2005-04-15 13:44:06 +04:00
|
|
|
|
2006-05-22 12:51:06 +04:00
|
|
|
/**
|
|
|
|
* Indicates whether all controls should be refreshed on the next Refresh()
|
|
|
|
* run.
|
|
|
|
*/
|
2006-05-22 13:06:14 +04:00
|
|
|
PRPackedBool mRebindAllControls;
|
2005-06-29 22:14:43 +04:00
|
|
|
|
2006-05-22 12:51:06 +04:00
|
|
|
/**
|
|
|
|
* Indicates whether instance elements have been initialized
|
|
|
|
*/
|
|
|
|
PRPackedBool mInstancesInitialized;
|
2005-10-28 22:52:56 +04:00
|
|
|
|
2006-02-08 14:03:27 +03:00
|
|
|
/**
|
2006-03-22 21:05:49 +03:00
|
|
|
* Indicates whether the model has handled the xforms-ready event
|
2006-02-08 14:03:27 +03:00
|
|
|
*/
|
2006-05-22 12:51:06 +04:00
|
|
|
PRPackedBool mReadyHandled;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates whether the model's instance was built by lazy authoring
|
|
|
|
*/
|
|
|
|
PRPackedBool mLazyModel;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates whether the model has handled the xforms-model-construct-done
|
|
|
|
* event
|
|
|
|
*/
|
|
|
|
PRPackedBool mConstructDoneHandled;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates whether the model is currently processing an update event,
|
|
|
|
* ie. xforms-rebuild, xforms-recalculate, xforms-revalidate, or
|
|
|
|
* xforms-refresh.
|
|
|
|
*/
|
|
|
|
PRPackedBool mProcessingUpdateEvent;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A list of update events that have been queued, because they were
|
|
|
|
* requested while another update was running.
|
|
|
|
*/
|
|
|
|
nsVoidArray mUpdateEventQueue;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The maximum allowed number of iterations of queued event dispatching in
|
|
|
|
* RequestUpdateEvent(), before there is believe to be a loop, and
|
|
|
|
* processing stops.
|
|
|
|
*/
|
|
|
|
PRInt32 mLoopMax;
|
2006-02-08 14:03:27 +03:00
|
|
|
|
2005-06-29 22:14:43 +04:00
|
|
|
/**
|
2005-10-25 21:29:56 +04:00
|
|
|
* All instance documents contained by this model, including lazy-authored
|
|
|
|
* instance documents.
|
2005-06-29 22:14:43 +04:00
|
|
|
*/
|
2005-10-25 21:29:56 +04:00
|
|
|
nsRefPtr<nsXFormsModelInstanceDocuments> mInstanceDocuments;
|
2005-06-29 22:14:43 +04:00
|
|
|
|
2006-02-17 13:14:10 +03:00
|
|
|
/**
|
|
|
|
* Type information for nodes, with their type set through \<xforms:bind\>.
|
|
|
|
*
|
|
|
|
* @see http://www.w3.org/TR/xforms/slice6.html#model-prop-type
|
|
|
|
*/
|
|
|
|
nsClassHashtable<nsISupportsHashKey, nsString> mNodeToType;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* P3P type information for nodes, with their type set through
|
|
|
|
* \<xforms:bind\>.
|
|
|
|
|
|
|
|
* @see http://www.w3.org/TR/xforms/slice6.html#model-prop-p3ptype
|
|
|
|
*/
|
|
|
|
nsClassHashtable<nsISupportsHashKey, nsString> mNodeToP3PType;
|
2006-03-22 21:05:49 +03:00
|
|
|
|
2006-05-22 12:51:06 +04:00
|
|
|
friend class Updating;
|
2004-10-13 13:51:52 +04:00
|
|
|
};
|
|
|
|
|
2005-06-26 22:30:17 +04:00
|
|
|
/**
|
|
|
|
* nsPostRefresh is needed by the UI Controls, which are implemented in
|
|
|
|
* XBL and used inside \<repeat\>. It is needed to refresh the controls,
|
|
|
|
* because XBL bindings are attached to XForms controls *after* refreshing
|
|
|
|
* the \<repeat\>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
class nsPostRefresh {
|
|
|
|
public:
|
|
|
|
nsPostRefresh();
|
|
|
|
~nsPostRefresh();
|
2005-08-03 22:43:45 +04:00
|
|
|
static const nsVoidArray* PostRefreshList();
|
2005-06-26 22:30:17 +04:00
|
|
|
};
|
|
|
|
|
2004-10-13 13:51:52 +04:00
|
|
|
NS_HIDDEN_(nsresult) NS_NewXFormsModelElement(nsIXTFElement **aResult);
|
|
|
|
|
|
|
|
#endif
|