Back to index

lightning-sunbird  0.9+nobinonly
nsICSSStyleSheet.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either of the GNU General Public License Version 2 or later (the "GPL"),
00026  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 #ifndef nsICSSStyleSheet_h___
00038 #define nsICSSStyleSheet_h___
00039 
00040 #include "nsIStyleSheet.h"
00041 #include "nsString.h"
00042 
00043 class nsICSSRule;
00044 class nsIDOMNode;
00045 class nsXMLNameSpaceMap;
00046 class nsCSSRuleProcessor;
00047 class nsMediaList;
00048 class nsICSSGroupRule;
00049 class nsICSSImportRule;
00050 
00051 // IID for the nsICSSStyleSheet interface
00052 // 446df065-af5e-46b8-b32f-289bf5906876
00053 #define NS_ICSS_STYLE_SHEET_IID     \
00054 {0x446df065, 0xaf5e, 0x46b8, {0xb3, 0x2f, 0x28, 0x9b, 0xf5, 0x90, 0x68, 0x76}}
00055 
00056 class nsICSSStyleSheet : public nsIStyleSheet {
00057 public:
00058   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICSS_STYLE_SHEET_IID)
00059 
00060   NS_IMETHOD  ContainsStyleSheet(nsIURI* aURL, PRBool& aContains, nsIStyleSheet** aTheChild=nsnull) = 0;
00061 
00062   NS_IMETHOD  AppendStyleSheet(nsICSSStyleSheet* aSheet) = 0;
00063   NS_IMETHOD  InsertStyleSheetAt(nsICSSStyleSheet* aSheet, PRInt32 aIndex) = 0;
00064 
00065   // XXX do these belong here or are they generic?
00066   NS_IMETHOD  PrependStyleRule(nsICSSRule* aRule) = 0;
00067   NS_IMETHOD  AppendStyleRule(nsICSSRule* aRule) = 0;
00068   NS_IMETHOD  ReplaceStyleRule(nsICSSRule* aOld, nsICSSRule* aNew) = 0;
00069 
00070   NS_IMETHOD  StyleRuleCount(PRInt32& aCount) const = 0;
00071   NS_IMETHOD  GetStyleRuleAt(PRInt32 aIndex, nsICSSRule*& aRule) const = 0;
00072 
00073   NS_IMETHOD  DeleteRuleFromGroup(nsICSSGroupRule* aGroup, PRUint32 aIndex) = 0;
00074   NS_IMETHOD  InsertRuleIntoGroup(const nsAString & aRule, nsICSSGroupRule* aGroup, PRUint32 aIndex, PRUint32* _retval) = 0;
00075   NS_IMETHOD  ReplaceRuleInGroup(nsICSSGroupRule* aGroup, nsICSSRule* aOld, nsICSSRule* aNew) = 0;
00076 
00077   NS_IMETHOD  StyleSheetCount(PRInt32& aCount) const = 0;
00078   NS_IMETHOD  GetStyleSheetAt(PRInt32 aIndex, nsICSSStyleSheet*& aSheet) const = 0;
00079 
00085   NS_IMETHOD  SetURIs(nsIURI* aSheetURI, nsIURI* aBaseURI) = 0;
00086   NS_IMETHOD  SetTitle(const nsAString& aTitle) = 0;
00087   NS_IMETHOD  SetMedia(nsMediaList* aMedia) = 0;
00088   NS_IMETHOD  SetOwningNode(nsIDOMNode* aOwningNode) = 0;
00089 
00090   NS_IMETHOD  SetOwnerRule(nsICSSImportRule* aOwnerRule) = 0;
00091   NS_IMETHOD  GetOwnerRule(nsICSSImportRule** aOwnerRule) = 0;
00092   
00093   // get namespace map for sheet
00094   virtual NS_HIDDEN_(nsXMLNameSpaceMap*) GetNameSpaceMap() const = 0;
00095 
00096   NS_IMETHOD  Clone(nsICSSStyleSheet* aCloneParent,
00097                     nsICSSImportRule* aCloneOwnerRule,
00098                     nsIDocument* aCloneDocument,
00099                     nsIDOMNode* aCloneOwningNode,
00100                     nsICSSStyleSheet** aClone) const = 0;
00101 
00102   NS_IMETHOD  IsModified(PRBool* aModified) const = 0; // returns the mDirty status of the sheet
00103   NS_IMETHOD  SetModified(PRBool aModified) = 0;
00104 
00105   NS_IMETHOD  AddRuleProcessor(nsCSSRuleProcessor* aProcessor) = 0;
00106   NS_IMETHOD  DropRuleProcessor(nsCSSRuleProcessor* aProcessor) = 0;
00107 };
00108 
00109 // e4431a5a-5bcb-4c68-80a0-408d34578f54
00110 #define NS_ICSS_STYLE_SHEET_MOZILLA_1_8_BRANCH_IID \
00111 { 0xe4431a5a, 0x5bcb, 0x4c68, \
00112  { 0x80, 0xa0, 0x40, 0x8d, 0x34, 0x57, 0x8f, 0x54 } }
00113 
00114 class nsICSSStyleSheet_MOZILLA_1_8_BRANCH : public nsICSSStyleSheet {
00115 public:
00116   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICSS_STYLE_SHEET_MOZILLA_1_8_BRANCH_IID)
00117 
00118   NS_IMETHOD SetURIs18(nsIURI* aSheetURI, nsIURI* aOriginalSheetURI,
00119                        nsIURI* aBaseURI) = 0;
00120 };
00121 
00122 nsresult
00123 NS_NewCSSStyleSheet(nsICSSStyleSheet** aInstancePtrResult);
00124 
00125 #endif /* nsICSSStyleSheet_h___ */