2001-09-25 01:32:19 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
1998-11-11 22:06:16 +00:00
|
|
|
*
|
2001-09-25 01:32:19 +00:00
|
|
|
* The contents of this file are subject to the Netscape 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/NPL/
|
1998-11-11 22:06:16 +00:00
|
|
|
*
|
2001-09-25 01:32:19 +00:00
|
|
|
* 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.
|
1998-11-11 22:06:16 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Communicator client code.
|
|
|
|
*
|
2001-09-25 01:32:19 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 03:40:37 +00:00
|
|
|
*
|
2001-09-25 01:32:19 +00:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* 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 NPL, 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 NPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1998-11-11 22:06:16 +00:00
|
|
|
|
|
|
|
#ifndef nsXMLDocument_h___
|
|
|
|
#define nsXMLDocument_h___
|
|
|
|
|
2003-03-26 07:41:30 +00:00
|
|
|
#include "nsDocument.h"
|
1998-11-12 07:54:12 +00:00
|
|
|
#include "nsIHTMLContentContainer.h"
|
2000-12-09 02:04:36 +00:00
|
|
|
#include "nsIInterfaceRequestor.h"
|
2001-09-05 21:28:38 +00:00
|
|
|
#include "nsIInterfaceRequestorUtils.h"
|
2001-05-11 21:05:08 +00:00
|
|
|
#include "nsIHttpEventSink.h"
|
2001-09-21 01:07:53 +00:00
|
|
|
#include "nsIDOMXMLDocument.h"
|
2002-06-14 23:54:18 +00:00
|
|
|
#include "nsIScriptContext.h"
|
2002-12-11 14:58:13 +00:00
|
|
|
#include "nsIHTMLStyleSheet.h"
|
2002-12-11 15:06:40 +00:00
|
|
|
#include "nsIHTMLCSSStyleSheet.h"
|
2003-03-21 19:22:52 +00:00
|
|
|
#include "nsIEventQueueService.h"
|
1998-11-11 22:06:16 +00:00
|
|
|
|
|
|
|
class nsIParser;
|
1999-01-19 23:07:33 +00:00
|
|
|
class nsIDOMNode;
|
1999-05-18 23:16:26 +00:00
|
|
|
class nsICSSLoader;
|
2001-04-30 23:35:09 +00:00
|
|
|
class nsIURI;
|
1998-11-11 22:06:16 +00:00
|
|
|
|
2003-03-26 07:41:30 +00:00
|
|
|
class nsXMLDocument : public nsDocument,
|
2000-12-09 02:04:36 +00:00
|
|
|
public nsIHTMLContentContainer,
|
|
|
|
public nsIInterfaceRequestor,
|
2001-10-26 02:23:56 +00:00
|
|
|
public nsIHttpEventSink
|
1998-11-11 22:06:16 +00:00
|
|
|
{
|
|
|
|
public:
|
2000-06-21 00:53:26 +00:00
|
|
|
nsXMLDocument();
|
1998-11-11 22:06:16 +00:00
|
|
|
virtual ~nsXMLDocument();
|
|
|
|
|
|
|
|
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
|
|
|
|
|
|
|
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
|
|
|
NS_IMETHOD_(nsrefcnt) Release(void);
|
|
|
|
|
2003-10-22 06:09:48 +00:00
|
|
|
virtual void Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup);
|
2001-03-12 06:39:27 +00:00
|
|
|
|
2003-03-26 07:41:30 +00:00
|
|
|
NS_IMETHOD StartDocumentLoad(const char* aCommand, nsIChannel* channel,
|
1999-07-20 08:46:33 +00:00
|
|
|
nsILoadGroup* aLoadGroup,
|
1999-11-15 22:17:54 +00:00
|
|
|
nsISupports* aContainer,
|
2000-05-01 06:58:53 +00:00
|
|
|
nsIStreamListener **aDocListener,
|
2001-11-02 01:53:13 +00:00
|
|
|
PRBool aReset = PR_TRUE,
|
|
|
|
nsIContentSink* aSink = nsnull);
|
1998-11-11 22:06:16 +00:00
|
|
|
|
2003-10-22 06:09:48 +00:00
|
|
|
virtual void EndLoad();
|
1998-11-11 22:06:16 +00:00
|
|
|
|
2003-10-22 06:09:48 +00:00
|
|
|
virtual void GetBaseTarget(nsAString &aBaseTarget) const;
|
|
|
|
virtual void SetBaseTarget(const nsAString &aBaseTarget);
|
2001-04-30 23:35:09 +00:00
|
|
|
|
2000-06-21 23:56:52 +00:00
|
|
|
// nsIDOMNode interface
|
|
|
|
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn);
|
|
|
|
|
1998-11-11 22:06:16 +00:00
|
|
|
// nsIDOMDocument interface
|
2003-03-26 07:41:30 +00:00
|
|
|
NS_IMETHOD GetDoctype(nsIDOMDocumentType** aDocumentType);
|
|
|
|
NS_IMETHOD CreateCDATASection(const nsAString& aData,
|
|
|
|
nsIDOMCDATASection** aReturn);
|
|
|
|
NS_IMETHOD CreateEntityReference(const nsAString& aName,
|
|
|
|
nsIDOMEntityReference** aReturn);
|
|
|
|
NS_IMETHOD CreateProcessingInstruction(const nsAString& aTarget,
|
|
|
|
const nsAString& aData,
|
|
|
|
nsIDOMProcessingInstruction** aReturn);
|
|
|
|
NS_IMETHOD CreateElement(const nsAString& aTagName, nsIDOMElement** aReturn);
|
|
|
|
NS_IMETHOD ImportNode(nsIDOMNode* aImportedNode, PRBool aDeep,
|
|
|
|
nsIDOMNode** aReturn);
|
|
|
|
NS_IMETHOD CreateElementNS(const nsAString& aNamespaceURI,
|
|
|
|
const nsAString& aQualifiedName,
|
|
|
|
nsIDOMElement** aReturn);
|
|
|
|
NS_IMETHOD CreateAttributeNS(const nsAString& aNamespaceURI,
|
2002-03-23 22:46:13 +00:00
|
|
|
const nsAString& aQualifiedName,
|
2003-03-26 07:41:30 +00:00
|
|
|
nsIDOMAttr** aReturn);
|
|
|
|
NS_IMETHOD GetElementById(const nsAString& aElementId,
|
|
|
|
nsIDOMElement** aReturn);
|
1998-11-11 22:06:16 +00:00
|
|
|
|
1998-11-12 07:54:12 +00:00
|
|
|
// nsIHTMLContentContainer
|
1998-11-11 22:06:16 +00:00
|
|
|
NS_IMETHOD GetAttributeStyleSheet(nsIHTMLStyleSheet** aResult);
|
1998-12-02 00:39:10 +00:00
|
|
|
NS_IMETHOD GetInlineStyleSheet(nsIHTMLCSSStyleSheet** aResult);
|
1999-05-18 23:16:26 +00:00
|
|
|
NS_IMETHOD GetCSSLoader(nsICSSLoader*& aLoader);
|
1998-11-11 22:06:16 +00:00
|
|
|
|
2000-12-09 02:04:36 +00:00
|
|
|
// nsIInterfaceRequestor
|
2003-03-26 07:41:30 +00:00
|
|
|
NS_DECL_NSIINTERFACEREQUESTOR
|
2000-12-09 02:04:36 +00:00
|
|
|
|
|
|
|
// nsIHTTPEventSink
|
2001-04-27 21:05:52 +00:00
|
|
|
NS_DECL_NSIHTTPEVENTSINK
|
2000-12-09 02:04:36 +00:00
|
|
|
|
2001-09-21 01:07:53 +00:00
|
|
|
// nsIDOMXMLDocument
|
|
|
|
NS_DECL_NSIDOMXMLDOCUMENT
|
|
|
|
|
2003-03-26 07:41:30 +00:00
|
|
|
virtual nsresult Init();
|
|
|
|
|
1998-11-11 22:06:16 +00:00
|
|
|
protected:
|
2002-03-15 09:45:31 +00:00
|
|
|
// subclass hooks for sheet ordering
|
|
|
|
virtual void InternalAddStyleSheet(nsIStyleSheet* aSheet, PRUint32 aFlags);
|
1999-05-18 23:16:26 +00:00
|
|
|
virtual void InternalInsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex);
|
2003-10-22 06:09:48 +00:00
|
|
|
virtual nsIStyleSheet* InternalGetStyleSheetAt(PRInt32 aIndex) const;
|
|
|
|
virtual PRInt32 InternalGetNumberOfStyleSheets() const;
|
1998-12-02 00:39:10 +00:00
|
|
|
|
2001-11-17 05:32:30 +00:00
|
|
|
nsresult CreateElement(nsINodeInfo *aNodeInfo, nsIDOMElement** aResult);
|
2003-04-02 21:44:39 +00:00
|
|
|
|
|
|
|
virtual nsresult GetLoadGroup(nsILoadGroup **aLoadGroup);
|
2003-03-26 07:41:30 +00:00
|
|
|
|
2003-04-22 21:57:25 +00:00
|
|
|
nsresult SetDefaultStylesheets(nsIURI* aUrl);
|
|
|
|
|
1998-11-11 22:06:16 +00:00
|
|
|
// For HTML elements in our content model
|
2001-04-30 23:35:09 +00:00
|
|
|
// XXX This is not clean, but is there a better way?
|
2002-12-11 14:24:49 +00:00
|
|
|
nsCOMPtr<nsIHTMLStyleSheet> mAttrStyleSheet;
|
|
|
|
nsCOMPtr<nsIHTMLCSSStyleSheet> mInlineStyleSheet;
|
2002-03-15 09:45:31 +00:00
|
|
|
// For additional catalog sheets (if any) needed to layout the XML vocabulary
|
|
|
|
// of the document. Catalog sheets are kept at the beginning of our array of
|
|
|
|
// style sheets and this counter is used as an offset to distinguish them
|
2003-03-26 07:41:30 +00:00
|
|
|
PRInt32 mCatalogSheetCount;
|
2001-04-30 23:35:09 +00:00
|
|
|
nsString mBaseTarget;
|
1998-11-11 22:06:16 +00:00
|
|
|
|
2003-03-21 19:22:52 +00:00
|
|
|
nsCOMPtr<nsIEventQueueService> mEventQService;
|
|
|
|
|
2002-06-14 23:54:18 +00:00
|
|
|
nsCOMPtr<nsIScriptContext> mScriptContext;
|
2002-08-13 18:41:16 +00:00
|
|
|
PRPackedBool mCrossSiteAccessEnabled;
|
2003-01-14 22:32:18 +00:00
|
|
|
PRPackedBool mLoadedAsData;
|
2003-03-21 19:22:52 +00:00
|
|
|
PRPackedBool mAsync;
|
|
|
|
PRPackedBool mLoopingForSyncLoad;
|
1998-11-11 22:06:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // nsXMLDocument_h___
|