michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsIXULDocument_h___ michael@0: #define nsIXULDocument_h___ michael@0: michael@0: #include "nsISupports.h" michael@0: #include "nsString.h" michael@0: #include "nsCOMArray.h" michael@0: michael@0: class nsIXULTemplateBuilder; michael@0: class nsIContent; michael@0: michael@0: michael@0: // 81ba4be5-6cc5-478a-9b08-b3e7ed524455 michael@0: #define NS_IXULDOCUMENT_IID \ michael@0: {0x81ba4be5, 0x6cc5, 0x478a, {0x9b, 0x08, 0xb3, 0xe7, 0xed, 0x52, 0x44, 0x55}} michael@0: michael@0: michael@0: /* michael@0: * An XUL-specific extension to nsIDocument. Includes methods for michael@0: * setting the root resource of the document content model, a factory michael@0: * method for constructing the children of a node, etc. michael@0: */ michael@0: class nsIXULDocument : public nsISupports michael@0: { michael@0: public: michael@0: NS_DECLARE_STATIC_IID_ACCESSOR(NS_IXULDOCUMENT_IID) michael@0: michael@0: /** michael@0: * Get the elements for a particular resource --- all elements whose 'id' michael@0: * or 'ref' is aID. The nsCOMArray will be truncated and filled in with michael@0: * nsIContent pointers. michael@0: */ michael@0: virtual void GetElementsForID(const nsAString& aID, nsCOMArray& aElements) = 0; michael@0: michael@0: /** michael@0: * Notify the XUL document that a subtree has been added michael@0: */ michael@0: NS_IMETHOD AddSubtreeToDocument(nsIContent* aElement) = 0; michael@0: michael@0: /** michael@0: * Notify the XUL document that a subtree has been removed michael@0: */ michael@0: NS_IMETHOD RemoveSubtreeFromDocument(nsIContent* aElement) = 0; michael@0: michael@0: /** michael@0: * Attach a XUL template builder to the specified content node. michael@0: * @param aBuilder the template builder to attach, or null if michael@0: * the builder is to be removed. michael@0: */ michael@0: NS_IMETHOD SetTemplateBuilderFor(nsIContent* aContent, nsIXULTemplateBuilder* aBuilder) = 0; michael@0: michael@0: /** michael@0: * Retrieve the XUL template builder that's attached to a content michael@0: * node. michael@0: */ michael@0: NS_IMETHOD GetTemplateBuilderFor(nsIContent* aContent, nsIXULTemplateBuilder** aResult) = 0; michael@0: michael@0: /** michael@0: * This is invoked whenever the prototype for this document is loaded michael@0: * and should be walked, regardless of whether the XUL cache is michael@0: * disabled, whether the protototype was loaded, whether the michael@0: * prototype was loaded from the cache or created by parsing the michael@0: * actual XUL source, etc. michael@0: * michael@0: * @param aResumeWalk whether this should also call ResumeWalk(). michael@0: * Sometimes the caller of OnPrototypeLoadDone resumes the walk itself michael@0: */ michael@0: NS_IMETHOD OnPrototypeLoadDone(bool aResumeWalk) = 0; michael@0: michael@0: /** michael@0: * Callback notifying when a document could not be parsed properly. michael@0: */ michael@0: virtual bool OnDocumentParserError() = 0; michael@0: michael@0: /** michael@0: * Reset the document direction so that it is recomputed. michael@0: */ michael@0: virtual void ResetDocumentDirection() = 0; michael@0: michael@0: virtual void ResetDocumentLWTheme() = 0; michael@0: }; michael@0: michael@0: NS_DEFINE_STATIC_IID_ACCESSOR(nsIXULDocument, NS_IXULDOCUMENT_IID) michael@0: michael@0: // factory functions michael@0: nsresult NS_NewXULDocument(nsIXULDocument** result); michael@0: michael@0: #endif // nsIXULDocument_h___