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.org 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 : #ifndef nsIStyleSheetLinkingElement_h__
38 : #define nsIStyleSheetLinkingElement_h__
39 :
40 :
41 : #include "nsISupports.h"
42 :
43 : class nsIDocument;
44 : class nsICSSLoaderObserver;
45 : class nsIURI;
46 :
47 : #define NS_ISTYLESHEETLINKINGELEMENT_IID \
48 : { 0xd753c84a, 0x17fd, 0x4d5f, \
49 : { 0xb2, 0xe9, 0x63, 0x52, 0x8c, 0x87, 0x99, 0x7a } }
50 :
51 : class nsIStyleSheet;
52 :
53 62 : class nsIStyleSheetLinkingElement : public nsISupports {
54 : public:
55 : NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISTYLESHEETLINKINGELEMENT_IID)
56 :
57 : /**
58 : * Used to make the association between a style sheet and
59 : * the element that linked it to the document.
60 : *
61 : * @param aStyleSheet the style sheet associated with this
62 : * element.
63 : */
64 : NS_IMETHOD SetStyleSheet(nsIStyleSheet* aStyleSheet) = 0;
65 :
66 : /**
67 : * Used to obtain the style sheet linked in by this element.
68 : *
69 : * @param aStyleSheet out parameter that returns the style
70 : * sheet associated with this element.
71 : */
72 : NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aStyleSheet) = 0;
73 :
74 : /**
75 : * Initialize the stylesheet linking element. If aDontLoadStyle is
76 : * true the element will ignore the first modification to the
77 : * element that would cause a stylesheet to be loaded. Subsequent
78 : * modifications to the element will not be ignored.
79 : */
80 : NS_IMETHOD InitStyleLinkElement(bool aDontLoadStyle) = 0;
81 :
82 : /**
83 : * Tells this element to update the stylesheet.
84 : *
85 : * @param aObserver observer to notify once the stylesheet is loaded.
86 : * This will be passed to the CSSLoader
87 : * @param [out] aWillNotify whether aObserver will be notified when the sheet
88 : * loads. If this is false, then either we didn't
89 : * start the sheet load at all, the load failed, or
90 : * this was an inline sheet that completely finished
91 : * loading. In the case when the load failed the
92 : * failure code will be returned.
93 : * @param [out] whether the sheet is an alternate sheet. This value is only
94 : * meaningful if aWillNotify is true.
95 : */
96 : NS_IMETHOD UpdateStyleSheet(nsICSSLoaderObserver* aObserver,
97 : bool *aWillNotify,
98 : bool *aIsAlternate) = 0;
99 :
100 : /**
101 : * Tells this element whether to update the stylesheet when the
102 : * element's properties change.
103 : *
104 : * @param aEnableUpdates update on changes or not.
105 : */
106 : NS_IMETHOD SetEnableUpdates(bool aEnableUpdates) = 0;
107 :
108 : /**
109 : * Gets the charset that the element claims the style sheet is in
110 : *
111 : * @param aCharset the charset
112 : */
113 : NS_IMETHOD GetCharset(nsAString& aCharset) = 0;
114 :
115 : /**
116 : * Tells this element to use a different base URI. This is used for
117 : * proper loading of xml-stylesheet processing instructions in XUL overlays
118 : * and is only currently used by nsXMLStylesheetPI.
119 : *
120 : * @param aNewBaseURI the new base URI, nsnull to use the default base URI.
121 : */
122 : virtual void OverrideBaseURI(nsIURI* aNewBaseURI) = 0;
123 :
124 : // This doesn't entirely belong here since they only make sense for
125 : // some types of linking elements, but it's a better place than
126 : // anywhere else.
127 : virtual void SetLineNumber(PRUint32 aLineNumber) = 0;
128 : };
129 :
130 : NS_DEFINE_STATIC_IID_ACCESSOR(nsIStyleSheetLinkingElement,
131 : NS_ISTYLESHEETLINKINGELEMENT_IID)
132 :
133 : #endif // nsILinkingElement_h__
|