1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/xul/document/public/nsIXULDocument.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,92 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef nsIXULDocument_h___ 1.10 +#define nsIXULDocument_h___ 1.11 + 1.12 +#include "nsISupports.h" 1.13 +#include "nsString.h" 1.14 +#include "nsCOMArray.h" 1.15 + 1.16 +class nsIXULTemplateBuilder; 1.17 +class nsIContent; 1.18 + 1.19 + 1.20 +// 81ba4be5-6cc5-478a-9b08-b3e7ed524455 1.21 +#define NS_IXULDOCUMENT_IID \ 1.22 + {0x81ba4be5, 0x6cc5, 0x478a, {0x9b, 0x08, 0xb3, 0xe7, 0xed, 0x52, 0x44, 0x55}} 1.23 + 1.24 + 1.25 +/* 1.26 + * An XUL-specific extension to nsIDocument. Includes methods for 1.27 + * setting the root resource of the document content model, a factory 1.28 + * method for constructing the children of a node, etc. 1.29 + */ 1.30 +class nsIXULDocument : public nsISupports 1.31 +{ 1.32 +public: 1.33 + NS_DECLARE_STATIC_IID_ACCESSOR(NS_IXULDOCUMENT_IID) 1.34 + 1.35 + /** 1.36 + * Get the elements for a particular resource --- all elements whose 'id' 1.37 + * or 'ref' is aID. The nsCOMArray will be truncated and filled in with 1.38 + * nsIContent pointers. 1.39 + */ 1.40 + virtual void GetElementsForID(const nsAString& aID, nsCOMArray<nsIContent>& aElements) = 0; 1.41 + 1.42 + /** 1.43 + * Notify the XUL document that a subtree has been added 1.44 + */ 1.45 + NS_IMETHOD AddSubtreeToDocument(nsIContent* aElement) = 0; 1.46 + 1.47 + /** 1.48 + * Notify the XUL document that a subtree has been removed 1.49 + */ 1.50 + NS_IMETHOD RemoveSubtreeFromDocument(nsIContent* aElement) = 0; 1.51 + 1.52 + /** 1.53 + * Attach a XUL template builder to the specified content node. 1.54 + * @param aBuilder the template builder to attach, or null if 1.55 + * the builder is to be removed. 1.56 + */ 1.57 + NS_IMETHOD SetTemplateBuilderFor(nsIContent* aContent, nsIXULTemplateBuilder* aBuilder) = 0; 1.58 + 1.59 + /** 1.60 + * Retrieve the XUL template builder that's attached to a content 1.61 + * node. 1.62 + */ 1.63 + NS_IMETHOD GetTemplateBuilderFor(nsIContent* aContent, nsIXULTemplateBuilder** aResult) = 0; 1.64 + 1.65 + /** 1.66 + * This is invoked whenever the prototype for this document is loaded 1.67 + * and should be walked, regardless of whether the XUL cache is 1.68 + * disabled, whether the protototype was loaded, whether the 1.69 + * prototype was loaded from the cache or created by parsing the 1.70 + * actual XUL source, etc. 1.71 + * 1.72 + * @param aResumeWalk whether this should also call ResumeWalk(). 1.73 + * Sometimes the caller of OnPrototypeLoadDone resumes the walk itself 1.74 + */ 1.75 + NS_IMETHOD OnPrototypeLoadDone(bool aResumeWalk) = 0; 1.76 + 1.77 + /** 1.78 + * Callback notifying when a document could not be parsed properly. 1.79 + */ 1.80 + virtual bool OnDocumentParserError() = 0; 1.81 + 1.82 + /** 1.83 + * Reset the document direction so that it is recomputed. 1.84 + */ 1.85 + virtual void ResetDocumentDirection() = 0; 1.86 + 1.87 + virtual void ResetDocumentLWTheme() = 0; 1.88 +}; 1.89 + 1.90 +NS_DEFINE_STATIC_IID_ACCESSOR(nsIXULDocument, NS_IXULDOCUMENT_IID) 1.91 + 1.92 +// factory functions 1.93 +nsresult NS_NewXULDocument(nsIXULDocument** result); 1.94 + 1.95 +#endif // nsIXULDocument_h___