gecko-dev/content/base/src/nsDocument.h

689 lines
24 KiB
C
Raw Normal View History

/* -*- 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-04-13 20:24:54 +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-04-13 20:24:54 +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-04-13 20:24:54 +00:00
*
* The Original Code is mozilla.org code.
*
* 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.
*
* 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-04-13 20:24:54 +00:00
#ifndef nsDocument_h___
#define nsDocument_h___
#include "nsIDocument.h"
#include "nsWeakReference.h"
#include "nsWeakPtr.h"
1998-04-13 20:24:54 +00:00
#include "nsVoidArray.h"
#include "nsIDOMXMLDocument.h"
#include "nsIDOMDocumentView.h"
2000-06-02 08:13:29 +00:00
#include "nsIDOMDocumentXBL.h"
#include "nsIDOMNSDocument.h"
#include "nsIDOMDocumentStyle.h"
#include "nsIDOMDocumentRange.h"
#include "nsIDOMDocumentTraversal.h"
#include "nsIDocumentObserver.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMStyleSheetList.h"
#include "nsIScriptGlobalObject.h"
#include "nsIDOMEventTarget.h"
1998-08-28 15:57:59 +00:00
#include "nsIContent.h"
#include "nsGenericDOMNodeList.h"
#include "nsIPrincipal.h"
#include "nsIBindingManager.h"
#include "nsINodeInfo.h"
#include "nsIDOMDocumentEvent.h"
#include "nsISupportsArray.h"
#include "nsHashtable.h"
#include "nsIWordBreakerFactory.h"
#include "nsILineBreakerFactory.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsIURI.h"
#include "nsScriptLoader.h"
#include "nsICSSLoader.h"
#include "nsIDOMXPathEvaluator.h"
#include "nsIRadioGroupContainer.h"
1998-04-30 19:53:05 +00:00
#include "pldhash.h"
class nsIEventListenerManager;
class nsDOMStyleSheetList;
class nsIOutputStream;
class nsDocument;
2000-08-28 23:46:11 +00:00
class nsIDTD;
class nsXPathDocumentTearoff;
class nsIRadioVisitor;
class nsIFormControl;
1998-04-13 20:24:54 +00:00
struct nsRadioGroupStruct;
#if 0
class nsPostData : public nsIPostData {
public:
nsPostData(PRBool aIsFile, char* aData);
NS_DECL_ISUPPORTS
virtual PRBool IsFile();
virtual const char* GetData();
virtual PRInt32 GetDataLength();
protected:
virtual ~nsPostData();
PRBool mIsFile;
char* mData;
PRInt32 mDataLen;
};
#endif
class nsDocHeaderData
{
public:
nsDocHeaderData(nsIAtom* aField, const nsAString& aData)
{
mField = aField;
NS_IF_ADDREF(mField);
2000-04-03 11:20:35 +00:00
mData.Assign(aData);
mNext = nsnull;
}
~nsDocHeaderData(void)
{
NS_IF_RELEASE(mField);
if (nsnull != mNext) {
delete mNext;
mNext = nsnull;
}
}
nsIAtom* mField;
nsString mData;
nsDocHeaderData* mNext;
};
// Represents the children of a document (prolog, epilog and
// document element)
class nsDocumentChildNodes : public nsGenericDOMNodeList
{
public:
nsDocumentChildNodes(nsIDocument* aDocument);
~nsDocumentChildNodes();
NS_IMETHOD GetLength(PRUint32* aLength);
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn);
void DropReference();
protected:
nsIDocument* mDocument;
};
class nsDOMStyleSheetList : public nsIDOMStyleSheetList,
public nsIDocumentObserver
{
public:
nsDOMStyleSheetList(nsIDocument *aDocument);
virtual ~nsDOMStyleSheetList();
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMSTYLESHEETLIST
NS_IMETHOD BeginUpdate(nsIDocument *aDocument) { return NS_OK; }
NS_IMETHOD EndUpdate(nsIDocument *aDocument) { return NS_OK; }
NS_IMETHOD BeginLoad(nsIDocument *aDocument) { return NS_OK; }
NS_IMETHOD EndLoad(nsIDocument *aDocument) { return NS_OK; }
NS_IMETHOD BeginReflow(nsIDocument *aDocument,
nsIPresShell* aShell) { return NS_OK; }
NS_IMETHOD EndReflow(nsIDocument *aDocument,
nsIPresShell* aShell) { return NS_OK; }
NS_IMETHOD ContentChanged(nsIDocument *aDocument,
nsIContent* aContent,
nsISupports* aSubContent) { return NS_OK; }
NS_IMETHOD ContentStatesChanged(nsIDocument* aDocument,
nsIContent* aContent1,
nsIContent* aContent2,
PRInt32 aStateMask) { return NS_OK; }
NS_IMETHOD AttributeChanged(nsIDocument *aDocument,
nsIContent* aContent,
PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
2001-08-25 02:01:08 +00:00
PRInt32 aModType,
nsChangeHint aHint) { return NS_OK; }
NS_IMETHOD ContentAppended(nsIDocument *aDocument,
nsIContent* aContainer,
PRInt32 aNewIndexInContainer)
{ return NS_OK; }
NS_IMETHOD ContentInserted(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer) { return NS_OK; }
NS_IMETHOD ContentReplaced(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aOldChild,
nsIContent* aNewChild,
PRInt32 aIndexInContainer) { return NS_OK; }
NS_IMETHOD ContentRemoved(nsIDocument *aDocument,
nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer) { return NS_OK; }
NS_IMETHOD StyleSheetAdded(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet);
NS_IMETHOD StyleSheetRemoved(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet);
NS_IMETHOD StyleSheetDisabledStateChanged(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet,
PRBool aDisabled) { return NS_OK; }
NS_IMETHOD StyleRuleChanged(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule,
nsChangeHint aHint) { return NS_OK; }
NS_IMETHOD StyleRuleAdded(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule) { return NS_OK; }
NS_IMETHOD StyleRuleRemoved(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule) { return NS_OK; }
NS_IMETHOD DocumentWillBeDestroyed(nsIDocument *aDocument);
protected:
PRInt32 mLength;
nsIDocument* mDocument;
void* mScriptObject;
};
// Helper structs for the content->subdoc map
class SubDocMapEntry : public PLDHashEntryHdr
{
public:
// Both of these are strong references
nsIContent *mKey; // must be first, to look like PLDHashEntryStub
nsIDocument *mSubDocument;
};
struct FindContentData
{
FindContentData(nsIDocument *aSubDoc)
: mSubDocument(aSubDoc), mResult(nsnull)
{
}
nsISupports *mSubDocument;
nsIContent *mResult;
};
// Base class for our document implementations.
//
// Note that this class *implements* nsIDOMXMLDocument, but it's not
// really an nsIDOMXMLDocument. The reason for implementing
// nsIDOMXMLDocument on this class is to avoid having to duplicate all
// its inherited methods on document classes that *are*
// nsIDOMXMLDocument's. nsDocument's QI should *not* claim to support
// nsIDOMXMLDocument unless someone writes a real implementation of
// the interface.
class nsDocument : public nsIDocument,
public nsIDOMXMLDocument, // inherits nsIDOMDocument
public nsIDOMNSDocument,
public nsIDOMDocumentEvent,
public nsIDOMDocumentStyle,
public nsIDOMDocumentView,
public nsIDOMDocumentRange,
public nsIDOMDocumentTraversal,
2000-06-02 08:13:29 +00:00
public nsIDOMDocumentXBL,
public nsIDOM3Node,
public nsSupportsWeakReference,
public nsIDOMEventReceiver,
public nsIScriptObjectPrincipal,
public nsIRadioGroupContainer
{
1998-04-13 20:24:54 +00:00
public:
NS_DECL_ISUPPORTS
NS_IMETHOD GetArena(nsIArena** aArena);
1998-04-13 20:24:54 +00:00
NS_IMETHOD Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup);
NS_IMETHOD ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup);
NS_IMETHOD StartDocumentLoad(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
nsIStreamListener **aDocListener,
PRBool aReset = PR_TRUE,
nsIContentSink* aContentSink = nsnull);
Landing changes Vidur made while the tree was closed for beta1 work, here's a list of the changes. r=me [1] Cutting down the size of content. Made nsIJSScriptObject inherit from nsIScriptObjectOwner [2] Cutting down the size of content. Made nsITextContent inherit from nsIContent. [3] Cutting down the size of content. Moved implementation of nsIDOMReceiver to nsListenerManager. This is not true aggregation since it isn't transitive, but it's OK for now. It will be necessary for nsListenerManager to have a reference to its content in the future anyway, so the transitivity could be done. dom/public/nsDOMPropEnums.h,v - bug 12559 dom/public/nsIJSScriptObject.h,v - [1] dom/public/html/MANIFEST,v - bug 12559 dom/public/html/Makefile.in,v - bug 12559 dom/public/html/makefile.win,v - bug 12559 dom/public/html/nsIDOMHTMLInputElement.h,v - bug 17544 dom/public/idl/html/HTMLAnchorElement.idl,v - bug 12559 dom/public/idl/html/HTMLAreaElement.idl,v - bug 12559 dom/public/idl/html/HTMLInputElement.idl,v - bug 17544 dom/src/base/nsGlobalWindow.cpp,v - bug 30700 dom/src/base/nsGlobalWindow.h,v - [1] dom/src/base/nsLocation.cpp,v - [1] dom/src/html/nsJSHTMLAnchorElement.cpp,v - bug 12559 dom/src/html/nsJSHTMLAreaElement.cpp,v - bug 12559 dom/src/html/nsJSHTMLInputElement.cpp,v - bug 17544 layout/base/public/nsIDocument.h,v - bug 27953 layout/base/public/nsITextContent.h,v - [2] layout/base/src/nsCommentNode.cpp,v - [2] layout/base/src/nsDocument.cpp,v - bug 27953 layout/base/src/nsDocument.h,v - bug 27953 layout/base/src/nsDocumentViewer.cpp,v - bug 27953 layout/base/src/nsGenericDOMDataNode.cpp,v - [3] layout/base/src/nsGenericDOMDataNode.h,v - [3] layout/base/src/nsGenericElement.cpp,v - [3] layout/base/src/nsGenericElement.h,v - [3] layout/base/src/nsNameSpaceManager.cpp,v - bug 7834 layout/base/src/nsStyleContext.cpp,v - outline property shouldn't reflow layout/base/src/nsTextNode.cpp,v - [2] layout/events/src/nsEventListenerManager.cpp,v - [3] layout/events/src/nsEventListenerManager.h,v - [3] layout/html/base/src/nsGfxScrollFrame.cpp,v - nsString->nsAutoString layout/html/content/src/nsAttributeContent.cpp,v - [2] layout/html/content/src/nsHTMLAnchorElement.cpp,v - [1][3] layout/html/content/src/nsHTMLAppletElement.cpp,v - [1][3] layout/html/content/src/nsHTMLAreaElement.cpp,v - [1][3] layout/html/content/src/nsHTMLBRElement.cpp,v - [1][3] layout/html/content/src/nsHTMLBaseElement.cpp,v - [1][3] layout/html/content/src/nsHTMLBaseFontElement.cpp,v - [1][3] layout/html/content/src/nsHTMLBodyElement.cpp,v - [1][3] layout/html/content/src/nsHTMLButtonElement.cpp,v - [1][3] layout/html/content/src/nsHTMLDListElement.cpp,v - [1][3] layout/html/content/src/nsHTMLDelElement.cpp,v - [1][3] layout/html/content/src/nsHTMLDirectoryElement.cpp,v - [1][3] layout/html/content/src/nsHTMLDivElement.cpp,v - [1][3] layout/html/content/src/nsHTMLEmbedElement.cpp,v - [1][3] layout/html/content/src/nsHTMLFieldSetElement.cpp,v - [1][3] layout/html/content/src/nsHTMLFontElement.cpp,v - [1][3] layout/html/content/src/nsHTMLFormElement.cpp,v - [1][3] layout/html/content/src/nsHTMLFrameElement.cpp,v - [1][3] layout/html/content/src/nsHTMLFrameSetElement.cpp,v - [1][3] layout/html/content/src/nsHTMLHRElement.cpp,v - [1][3] layout/html/content/src/nsHTMLHeadElement.cpp,v - [1][3] layout/html/content/src/nsHTMLHeadingElement.cpp,v - [1][3] layout/html/content/src/nsHTMLHtmlElement.cpp,v - [1][3] layout/html/content/src/nsHTMLIFrameElement.cpp,v - [1][3] layout/html/content/src/nsHTMLImageElement.cpp,v - [1][3] layout/html/content/src/nsHTMLInputElement.cpp,v - [1][3] layout/html/content/src/nsHTMLInsElement.cpp,v - [1][3] layout/html/content/src/nsHTMLIsIndexElement.cpp,v - [1][3] layout/html/content/src/nsHTMLLIElement.cpp,v - [1][3] layout/html/content/src/nsHTMLLabelElement.cpp,v - [1][3] layout/html/content/src/nsHTMLLayerElement.cpp,v - [1][3] layout/html/content/src/nsHTMLLegendElement.cpp,v - [1][3] layout/html/content/src/nsHTMLLinkElement.cpp,v - [1][3] layout/html/content/src/nsHTMLMapElement.cpp,v - [1][3] layout/html/content/src/nsHTMLMenuElement.cpp,v - [1][3] layout/html/content/src/nsHTMLMetaElement.cpp,v - [1][3] layout/html/content/src/nsHTMLModElement.cpp,v - [1][3] layout/html/content/src/nsHTMLOListElement.cpp,v - [1][3] layout/html/content/src/nsHTMLObjectElement.cpp,v - [1][3] layout/html/content/src/nsHTMLOptGroupElement.cpp,v - [1][3] layout/html/content/src/nsHTMLOptionElement.cpp,v - [1][3] layout/html/content/src/nsHTMLParagraphElement.cpp,v - [1][3] layout/html/content/src/nsHTMLParamElement.cpp,v - [1][3] layout/html/content/src/nsHTMLPreElement.cpp,v - [1][3] layout/html/content/src/nsHTMLQuoteElement.cpp,v - [1][3] layout/html/content/src/nsHTMLScriptElement.cpp,v - [1][3] layout/html/content/src/nsHTMLSelectElement.cpp,v - [1][3] layout/html/content/src/nsHTMLSpacerElement.cpp,v - [1][3] layout/html/content/src/nsHTMLSpanElement.cpp,v - [1][3] layout/html/content/src/nsHTMLStyleElement.cpp,v - [1][3] layout/html/content/src/nsHTMLTableCaptionElement.cpp,v - [1][3] layout/html/content/src/nsHTMLTableCellElement.cpp,v - [1][3] layout/html/content/src/nsHTMLTableColElement.cpp,v - [1][3] layout/html/content/src/nsHTMLTableColGroupElement.cpp,v - [1][3] layout/html/content/src/nsHTMLTableElement.cpp,v - [1][3] layout/html/content/src/nsHTMLTableRowElement.cpp,v - [1][3] layout/html/content/src/nsHTMLTableSectionElement.cpp,v - [1][3] layout/html/content/src/nsHTMLTextAreaElement.cpp,v - [1][3] layout/html/content/src/nsHTMLTitleElement.cpp,v - [1][3] layout/html/content/src/nsHTMLUListElement.cpp,v - [1][3] layout/html/content/src/nsHTMLWBRElement.cpp,v - [1][3] layout/html/document/src/nsHTMLDocument.cpp,v - bug 27953 layout/html/document/src/nsHTMLDocument.h,v - bug 27953 layout/xml/content/src/nsXMLCDATASection.cpp,v - [1][2] layout/xml/content/src/nsXMLDocumentType.cpp,v - [1][2] layout/xml/content/src/nsXMLElement.h,v - [1][2] layout/xml/content/src/nsXMLEntity.cpp,v - [1][2] layout/xml/content/src/nsXMLNotation.cpp,v - [1][2] layout/xml/content/src/nsXMLProcessingInstruction.cpp,v - [1][2] layout/xul/base/src/nsBoxFrame.cpp,v - nsString->nsAutoString layout/xul/base/src/nsSliderFrame.cpp,v - nsString->nsAutoString netwerk/protocol/http/src/nsHTTPRequest.cpp,v - nsString->nsAutoString rdf/content/src/nsXULDocument.cpp,v - bug 27953 rdf/content/src/nsXULDocument.h,v - bug 27953 rdf/content/src/nsXULElement.h,v - [1] xpcom/base/IIDS.h,v - bug 12559
2000-03-17 13:27:00 +00:00
NS_IMETHOD StopDocumentLoad();
1998-04-13 20:24:54 +00:00
/**
* Return the title of the document. May return null.
*/
virtual const nsString* GetDocumentTitle() const;
/**
* Return the URL for the document. May return null.
*/
NS_IMETHOD GetDocumentURL(nsIURI** aURI) const;
1998-04-13 20:24:54 +00:00
/**
* Return the principal responsible for this document.
*/
NS_IMETHOD GetPrincipal(nsIPrincipal **aPrincipal);
/**
* Update principal responsible for this document to the intersection
* of its previous value and aPrincipal, and return its new value.
*/
NS_IMETHOD AddPrincipal(nsIPrincipal *aPrincipal);
/**
* Return the content language of this document.
*/
NS_IMETHOD GetContentLanguage(nsAString& aContentLanguage) const;
1998-10-01 21:43:49 +00:00
/**
* Return the LoadGroup for the document. May return null.
1998-10-01 21:43:49 +00:00
*/
NS_IMETHOD GetDocumentLoadGroup(nsILoadGroup **aGroup) const;
1998-10-01 21:43:49 +00:00
/**
* Return the base URL for relative URLs in the document. May return null (or the document URL).
*/
NS_IMETHOD GetBaseURL(nsIURI*& aURL) const;
NS_IMETHOD SetBaseURL(nsIURI* aURL);
/**
* Get/Set the base target of a link in a document.
*/
NS_IMETHOD GetBaseTarget(nsAString &aBaseTarget);
NS_IMETHOD SetBaseTarget(const nsAString &aBaseTarget);
1998-04-13 20:24:54 +00:00
/**
* Return a standard name for the document's character set. This will
* trigger a startDocumentLoad if necessary to answer the question.
*/
NS_IMETHOD GetDocumentCharacterSet(nsAString& oCharsetID);
NS_IMETHOD SetDocumentCharacterSet(const nsAString& aCharSetID);
1998-04-13 20:24:54 +00:00
NS_IMETHOD GetDocumentCharacterSetSource(PRInt32* aCharsetSource);
NS_IMETHOD SetDocumentCharacterSetSource(PRInt32 aCharsetSource);
/**
* Add an observer that gets notified whenever the charset changes.
*/
NS_IMETHOD AddCharSetObserver(nsIObserver* aObserver);
/**
* Remove a charset observer.
*/
NS_IMETHOD RemoveCharSetObserver(nsIObserver* aObserver);
#ifdef IBMBIDI
/**
* Check if the document contains bidi data.
* If so, we have to apply the Unicode Bidi Algorithm.
*/
NS_IMETHOD GetBidiEnabled(PRBool* aBidiEnabled) const;
/**
* Indicate the document contains RTL characters.
*/
NS_IMETHOD SetBidiEnabled(PRBool aBidiEnabled);
#endif // IBMBIDI
/**
* Return the Line Breaker for the document
*/
NS_IMETHOD GetLineBreaker(nsILineBreaker** aResult) ;
NS_IMETHOD SetLineBreaker(nsILineBreaker* aLineBreaker) ;
NS_IMETHOD GetWordBreaker(nsIWordBreaker** aResult) ;
NS_IMETHOD SetWordBreaker(nsIWordBreaker* aWordBreaker) ;
/**
* Access HTTP header data (this may also get set from other sources, like
* HTML META tags).
*/
NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField,
nsAString& aData) const;
NS_IMETHOD SetHeaderData(nsIAtom* aheaderField,
const nsAString& aData);
1998-04-13 20:24:54 +00:00
/**
* Create a new presentation shell that will use aContext for
* it's presentation context (presentation context's <b>must not</b> be
* shared among multiple presentation shell's).
*/
#if 0
// XXX Temp hack: moved to nsMarkupDocument
1999-07-07 01:19:31 +00:00
NS_IMETHOD CreateShell(nsIPresContext* aContext,
nsIViewManager* aViewManager,
nsIStyleSet* aStyleSet,
nsIPresShell** aInstancePtrResult);
#endif
1998-04-13 20:24:54 +00:00
virtual PRBool DeleteShell(nsIPresShell* aShell);
virtual PRInt32 GetNumberOfShells();
NS_IMETHOD GetShellAt(PRInt32 aIndex, nsIPresShell** aShell);
1998-04-13 20:24:54 +00:00
/**
* Return the parent document of this document. Will return null
* unless this document is within a compound document and has a parent.
*/
NS_IMETHOD GetParentDocument(nsIDocument** aParent);
NS_IMETHOD SetParentDocument(nsIDocument* aParent);
NS_IMETHOD SetSubDocumentFor(nsIContent *aContent, nsIDocument* aSubDoc);
NS_IMETHOD GetSubDocumentFor(nsIContent *aContent, nsIDocument** aSubDoc);
NS_IMETHOD FindContentForSubDocument(nsIDocument *aDocument,
nsIContent **aContent);
1998-04-13 20:24:54 +00:00
/**
* Return the root content object for this document.
*/
NS_IMETHOD GetRootContent(nsIContent** aRoot);
NS_IMETHOD SetRootContent(nsIContent* aRoot);
1998-04-13 20:24:54 +00:00
/**
* Get the direct children of the document - content in
* the prolog, the root content and content in the epilog.
*/
NS_IMETHOD ChildAt(PRInt32 aIndex, nsIContent*& aResult) const;
NS_IMETHOD IndexOf(nsIContent* aPossibleChild, PRInt32& aIndex) const;
NS_IMETHOD GetChildCount(PRInt32& aCount);
1998-04-13 20:24:54 +00:00
/**
* Get the style sheets owned by this document.
1998-09-02 02:02:30 +00:00
* These are ordered, highest priority last
1998-04-13 20:24:54 +00:00
*/
NS_IMETHOD GetNumberOfStyleSheets(PRInt32* aCount);
NS_IMETHOD GetStyleSheetAt(PRInt32 aIndex, nsIStyleSheet** aSheet);
NS_IMETHOD GetIndexOfStyleSheet(nsIStyleSheet* aSheet, PRInt32* aIndex);
virtual void AddStyleSheet(nsIStyleSheet* aSheet, PRUint32 aFlags);
virtual void RemoveStyleSheet(nsIStyleSheet* aSheet);
2000-05-27 20:03:14 +00:00
NS_IMETHOD UpdateStyleSheets(nsISupportsArray* aOldSheets,
nsISupportsArray* aNewSheets);
2000-05-27 20:03:14 +00:00
virtual void AddStyleSheetToStyleSets(nsIStyleSheet* aSheet);
virtual void RemoveStyleSheetFromStyleSets(nsIStyleSheet* aSheet);
NS_IMETHOD InsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex,
PRBool aNotify);
virtual void SetStyleSheetDisabledState(nsIStyleSheet* aSheet,
PRBool mDisabled);
1998-04-13 20:24:54 +00:00
/**
* Set the object from which a document can get a script context.
* This is the context within which all scripts (during document
* creation and during event handling) will run.
*/
NS_IMETHOD GetScriptGlobalObject(nsIScriptGlobalObject** aGlobalObject);
NS_IMETHOD SetScriptGlobalObject(nsIScriptGlobalObject* aGlobalObject);
1998-12-11 02:35:06 +00:00
/**
* Get the name space manager for this document
*/
NS_IMETHOD GetNameSpaceManager(nsINameSpaceManager*& aManager);
/**
* Get the script loader for this document
*/
NS_IMETHOD GetScriptLoader(nsIScriptLoader** aScriptLoader);
1998-04-13 20:24:54 +00:00
/**
* Add a new observer of document change notifications. Whenever
* content is changed, appended, inserted or removed the observers are
* informed.
*/
virtual void AddObserver(nsIDocumentObserver* aObserver);
/**
* Remove an observer of document change notifications. This will
* return false if the observer cannot be found.
*/
virtual PRBool RemoveObserver(nsIDocumentObserver* aObserver);
// Observation hooks used by content nodes to propagate
// notifications to document observers.
NS_IMETHOD BeginUpdate();
NS_IMETHOD EndUpdate();
1998-06-03 15:45:36 +00:00
NS_IMETHOD BeginLoad();
NS_IMETHOD EndLoad();
NS_IMETHOD ContentChanged(nsIContent* aContent,
nsISupports* aSubContent);
NS_IMETHOD ContentStatesChanged(nsIContent* aContent1,
nsIContent* aContent2,
PRInt32 aStateMask);
NS_IMETHOD AttributeWillChange(nsIContent* aChild,
PRInt32 aNameSpaceID,
nsIAtom* aAttribute);
NS_IMETHOD AttributeChanged(nsIContent* aChild,
PRInt32 aNameSpaceID,
nsIAtom* aAttribute,
2001-08-25 02:01:08 +00:00
PRInt32 aModType,
nsChangeHint aHint);
NS_IMETHOD ContentAppended(nsIContent* aContainer,
PRInt32 aNewIndexInContainer);
NS_IMETHOD ContentInserted(nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer);
NS_IMETHOD ContentReplaced(nsIContent* aContainer,
nsIContent* aOldChild,
nsIContent* aNewChild,
PRInt32 aIndexInContainer);
NS_IMETHOD ContentRemoved(nsIContent* aContainer,
nsIContent* aChild,
PRInt32 aIndexInContainer);
1998-04-13 20:24:54 +00:00
1998-11-26 01:34:53 +00:00
NS_IMETHOD StyleRuleChanged(nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule,
nsChangeHint aHint); // See nsStyleConsts fot hint values
1998-11-26 01:34:53 +00:00
NS_IMETHOD StyleRuleAdded(nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule);
NS_IMETHOD StyleRuleRemoved(nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule);
NS_IMETHOD FlushPendingNotifications(PRBool aFlushReflows = PR_TRUE,
PRBool aUpdateViews = PR_FALSE);
NS_IMETHOD GetAndIncrementContentID(PRInt32* aID);
NS_IMETHOD GetBindingManager(nsIBindingManager** aResult);
NS_IMETHOD GetNodeInfoManager(nsINodeInfoManager*& aNodeInfoManager);
NS_IMETHOD AddReference(void *aKey, nsISupports *aReference);
NS_IMETHOD RemoveReference(void *aKey, nsISupports **aOldReference);
NS_IMETHOD SetContainer(nsISupports *aContainer);
NS_IMETHOD GetContainer(nsISupports **aContainer);
// nsIRadioGroupContainer
NS_IMETHOD WalkRadioGroup(const nsAString& aName,
nsIRadioVisitor* aVisitor);
NS_IMETHOD SetCurrentRadioButton(const nsAString& aName,
nsIDOMHTMLInputElement* aRadio);
NS_IMETHOD GetCurrentRadioButton(const nsAString& aName,
nsIDOMHTMLInputElement** aRadio);
NS_IMETHOD AddToRadioGroup(const nsAString& aName,
nsIFormControl* aRadio);
NS_IMETHOD RemoveFromRadioGroup(const nsAString& aName,
nsIFormControl* aRadio);
// for radio group
nsresult GetRadioGroup(const nsAString& aName,
nsRadioGroupStruct **aRadioGroup);
// nsIDOMNode
NS_DECL_NSIDOMNODE
// nsIDOM3Node
NS_DECL_NSIDOM3NODE
// nsIDOMDocument
NS_DECL_NSIDOMDOCUMENT
// nsIDOMXMLDocument
NS_DECL_NSIDOMXMLDOCUMENT
// nsIDOMNSDocument
NS_DECL_NSIDOMNSDOCUMENT
// nsIDOMDocumentEvent
NS_DECL_NSIDOMDOCUMENTEVENT
// nsIDOMDocumentStyle
NS_DECL_NSIDOMDOCUMENTSTYLE
1998-04-13 20:24:54 +00:00
// nsIDOMDocumentView
NS_DECL_NSIDOMDOCUMENTVIEW
// nsIDOMDocumentRange
NS_DECL_NSIDOMDOCUMENTRANGE
2000-06-02 08:13:29 +00:00
// nsIDOMDocumentTraversal
NS_DECL_NSIDOMDOCUMENTTRAVERSAL
// nsIDOMDocumentXBL
NS_DECL_NSIDOMDOCUMENTXBL
// nsIDOMEventReceiver interface
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID);
NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener,
const nsIID& aIID);
NS_IMETHOD GetListenerManager(nsIEventListenerManager** aInstancePtrResult);
NS_IMETHOD HandleEvent(nsIDOMEvent *aEvent);
// nsIDOMEventTarget interface
NS_IMETHOD AddEventListener(const nsAString& aType,
nsIDOMEventListener* aListener,
PRBool aUseCapture);
NS_IMETHOD RemoveEventListener(const nsAString& aType,
nsIDOMEventListener* aListener,
PRBool aUseCapture);
NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent, PRBool *_retval);
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,
nsEvent* aEvent,
nsIDOMEvent** aDOMEvent,
PRUint32 aFlags,
nsEventStatus* aEventStatus);
NS_IMETHOD_(PRBool) EventCaptureRegistration(PRInt32 aCapturerIncrement);
NS_IMETHOD SetDocumentURL(nsIURI* aURI);
virtual nsresult Init();
protected:
// subclass hooks for sheet ordering
virtual void InternalAddStyleSheet(nsIStyleSheet* aSheet,
PRUint32 aFlags);
virtual void InternalInsertStyleSheetAt(nsIStyleSheet* aSheet,
PRInt32 aIndex);
1998-04-13 20:24:54 +00:00
nsDocument();
virtual ~nsDocument();
1998-04-13 20:24:54 +00:00
nsIArena* mArena;
nsString mDocumentTitle;
nsIURI* mDocumentURL;
nsCOMPtr<nsIURI> mDocumentBaseURL;
nsCOMPtr<nsIPrincipal> mPrincipal;
PRUint32 mLoadFlags; // load flags of the document's channel
nsWeakPtr mDocumentLoadGroup;
nsWeakPtr mDocumentContainer;
nsString mCharacterSet;
PRInt32 mCharacterSetSource;
nsVoidArray mCharSetObservers;
1998-04-13 20:24:54 +00:00
nsIDocument* mParentDocument;
PLDHashTable *mSubDocuments;
1998-04-13 20:24:54 +00:00
nsVoidArray mPresShells;
nsCOMPtr<nsISupportsArray> mChildren; // contains owning references
nsIContent* mRootContent; // a weak reference to the only element in
// mChildren, or null if no such element exists.
nsAutoVoidArray mStyleSheets;
nsAutoVoidArray mObservers; // basically always has at least 1 entry
nsCOMPtr<nsIScriptGlobalObject> mScriptGlobalObject;
nsIEventListenerManager* mListenerManager;
PRBool mInDestructor;
nsCOMPtr<nsIDOMStyleSheetList> mDOMStyleSheets;
1998-12-11 02:35:06 +00:00
nsINameSpaceManager* mNameSpaceManager;
nsCOMPtr<nsIScriptLoader> mScriptLoader;
nsDocHeaderData* mHeaderData;
nsCOMPtr<nsILineBreaker> mLineBreaker;
nsCOMPtr<nsIWordBreaker> mWordBreaker;
nsDocumentChildNodes* mChildNodes;
// A content ID counter used to give a monotonically increasing ID to the content
// objects in the document's content model
PRInt32 mNextContentID;
nsHashtable mRadioGroups;
#ifdef IBMBIDI
PRBool mBidiEnabled;
#endif // IBMBIDI
// disk file members
nsCOMPtr<nsIURI> mDocumentURI;
PRInt32 mModCount;
2000-08-28 23:46:11 +00:00
nsIDTD* mDTD;
nsCOMPtr<nsIBindingManager> mBindingManager;
nsCOMPtr<nsINodeInfoManager> mNodeInfoManager; // OWNER
PRBool mIsGoingAway; // True if the document is being destroyed.
nsSupportsHashtable* mBoxObjectTable;
PRInt32 mNumCapturers; //Number of capturing event handlers in doc. Used to optimize event delivery.
nsSupportsHashtable mContentWrapperHash;
nsCOMPtr<nsICSSLoader> mCSSLoader;
nsString mContentLanguage;
nsString mContentType;
private:
// These are not implemented and not supported.
nsDocument(const nsDocument& aOther);
nsDocument& operator=(const nsDocument& aOther);
nsXPathDocumentTearoff* mXPathDocument;
1998-04-13 20:24:54 +00:00
};
1998-04-13 20:24:54 +00:00
#endif /* nsDocument_h___ */