1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Original Code is Mozilla Communicator client code.
16 : *
17 : * The Initial Developer of the Original Code is
18 : * Netscape Communications Corporation.
19 : * Portions created by the Initial Developer are Copyright (C) 1998
20 : * the Initial Developer. All Rights Reserved.
21 : *
22 : * Contributor(s):
23 : *
24 : * Alternatively, the contents of this file may be used under the terms of
25 : * either of the GNU General Public License Version 2 or later (the "GPL"),
26 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 : * in which case the provisions of the GPL or the LGPL are applicable instead
28 : * of those above. If you wish to allow use of your version of this file only
29 : * under the terms of either the GPL or the LGPL, and not to allow others to
30 : * use your version of this file under the terms of the MPL, indicate your
31 : * decision by deleting the provisions above and replace them with the notice
32 : * and other provisions required by the GPL or the LGPL. If you do not delete
33 : * the provisions above, a recipient may use your version of this file under
34 : * the terms of any one of the MPL, the GPL or the LGPL.
35 : *
36 : * ***** END LICENSE BLOCK ***** */
37 :
38 : #ifndef nsIXULDocument_h___
39 : #define nsIXULDocument_h___
40 :
41 : #include "nsISupports.h"
42 : #include "nsString.h"
43 : #include "nsCOMArray.h"
44 :
45 : class nsIXULTemplateBuilder;
46 : class nsIContent;
47 : class nsIScriptGlobalObjectOwner;
48 :
49 :
50 : // 3e872e97-b678-418e-a7e3-41b8305d4e75
51 : #define NS_IXULDOCUMENT_IID \
52 : { 0x3e872e97, 0xb678, 0x418e, \
53 : { 0xa7, 0xe3, 0x41, 0xb8, 0x30, 0x5d, 0x4e, 0x75 } }
54 :
55 :
56 : /*
57 : * An XUL-specific extension to nsIDocument. Includes methods for
58 : * setting the root resource of the document content model, a factory
59 : * method for constructing the children of a node, etc.
60 : */
61 : class nsIXULDocument : public nsISupports
62 0 : {
63 : public:
64 : NS_DECLARE_STATIC_IID_ACCESSOR(NS_IXULDOCUMENT_IID)
65 :
66 : /**
67 : * Get the elements for a particular resource --- all elements whose 'id'
68 : * or 'ref' is aID. The nsCOMArray will be truncated and filled in with
69 : * nsIContent pointers.
70 : */
71 : virtual void GetElementsForID(const nsAString& aID, nsCOMArray<nsIContent>& aElements) = 0;
72 :
73 : /**
74 : * Get the nsIScriptGlobalObjectOwner for this document.
75 : */
76 : NS_IMETHOD GetScriptGlobalObjectOwner(nsIScriptGlobalObjectOwner** aGlobalOwner) = 0;
77 :
78 : /**
79 : * Notify the XUL document that a subtree has been added
80 : */
81 : NS_IMETHOD AddSubtreeToDocument(nsIContent* aElement) = 0;
82 :
83 : /**
84 : * Notify the XUL document that a subtree has been removed
85 : */
86 : NS_IMETHOD RemoveSubtreeFromDocument(nsIContent* aElement) = 0;
87 :
88 : /**
89 : * Attach a XUL template builder to the specified content node.
90 : * @param aBuilder the template builder to attach, or null if
91 : * the builder is to be removed.
92 : */
93 : NS_IMETHOD SetTemplateBuilderFor(nsIContent* aContent, nsIXULTemplateBuilder* aBuilder) = 0;
94 :
95 : /**
96 : * Retrieve the XUL template builder that's attached to a content
97 : * node.
98 : */
99 : NS_IMETHOD GetTemplateBuilderFor(nsIContent* aContent, nsIXULTemplateBuilder** aResult) = 0;
100 :
101 : /**
102 : * This is invoked whenever the prototype for this document is loaded
103 : * and should be walked, regardless of whether the XUL cache is
104 : * disabled, whether the protototype was loaded, whether the
105 : * prototype was loaded from the cache or created by parsing the
106 : * actual XUL source, etc.
107 : *
108 : * @param aResumeWalk whether this should also call ResumeWalk().
109 : * Sometimes the caller of OnPrototypeLoadDone resumes the walk itself
110 : */
111 : NS_IMETHOD OnPrototypeLoadDone(bool aResumeWalk) = 0;
112 :
113 : /**
114 : * Callback notifying when a document could not be parsed properly.
115 : */
116 : virtual bool OnDocumentParserError() = 0;
117 :
118 : /**
119 : * Reset the document direction so that it is recomputed.
120 : */
121 : virtual void ResetDocumentDirection() = 0;
122 :
123 : virtual void ResetDocumentLWTheme() = 0;
124 : };
125 :
126 : NS_DEFINE_STATIC_IID_ACCESSOR(nsIXULDocument, NS_IXULDOCUMENT_IID)
127 :
128 : // factory functions
129 : nsresult NS_NewXULDocument(nsIXULDocument** result);
130 :
131 : #endif // nsIXULDocument_h___
|