Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsISupports.idl" |
michael@0 | 7 | |
michael@0 | 8 | %{C++ |
michael@0 | 9 | class nsCSSStyleSheet; |
michael@0 | 10 | %} |
michael@0 | 11 | |
michael@0 | 12 | [ptr] native nsCSSStyleSheet(nsCSSStyleSheet); |
michael@0 | 13 | |
michael@0 | 14 | [scriptable, uuid(4805e682-49b9-11d3-9ce4-ed60bd6cb5bc)] |
michael@0 | 15 | |
michael@0 | 16 | interface nsIEditorStyleSheets : nsISupports |
michael@0 | 17 | { |
michael@0 | 18 | /** Load and apply the style sheet, specified by aURL, to the |
michael@0 | 19 | * editor's document, replacing the last style sheet added (if any). |
michael@0 | 20 | * This is always asynchronous, and may cause network I/O. |
michael@0 | 21 | * |
michael@0 | 22 | * @param aURL The style sheet to be loaded and applied. |
michael@0 | 23 | */ |
michael@0 | 24 | void replaceStyleSheet(in AString aURL); |
michael@0 | 25 | |
michael@0 | 26 | /** Add the given style sheet to the editor's document, |
michael@0 | 27 | * on top of any that are already there. |
michael@0 | 28 | * This is always asynchronous, and may cause network I/O. |
michael@0 | 29 | * |
michael@0 | 30 | * @param aURL The style sheet to be loaded and applied. |
michael@0 | 31 | */ |
michael@0 | 32 | void addStyleSheet(in AString aURL); |
michael@0 | 33 | |
michael@0 | 34 | /** Load and apply the override style sheet, specified by aURL, to the |
michael@0 | 35 | * editor's document, replacing the last override style sheet added (if any). |
michael@0 | 36 | * This is always synchronous, so aURL should be a local file with only |
michael@0 | 37 | * local @imports. This action is not undoable. It is not intended for |
michael@0 | 38 | * "user" style sheets, only for editor developers to add sheets to change |
michael@0 | 39 | * display behavior for editing (like showing special cursors) that will |
michael@0 | 40 | * not be affected by loading "document" style sheets with addStyleSheet or |
michael@0 | 41 | * especially replaceStyleSheet. |
michael@0 | 42 | * |
michael@0 | 43 | * @param aURL The style sheet to be loaded and applied. |
michael@0 | 44 | */ |
michael@0 | 45 | void replaceOverrideStyleSheet(in AString aURL); |
michael@0 | 46 | |
michael@0 | 47 | /** Load and apply an override style sheet, specified by aURL, to |
michael@0 | 48 | * the editor's document, on top of any that are already there. |
michael@0 | 49 | * This is always synchronous, so the same caveats about local files and no |
michael@0 | 50 | * non-local @import as replaceOverrideStyleSheet apply here, too. |
michael@0 | 51 | * |
michael@0 | 52 | * @param aURL The style sheet to be loaded and applied. |
michael@0 | 53 | */ |
michael@0 | 54 | void addOverrideStyleSheet(in AString aURL); |
michael@0 | 55 | |
michael@0 | 56 | /** Remove the given style sheet from the editor's document |
michael@0 | 57 | * This is always synchronous |
michael@0 | 58 | * |
michael@0 | 59 | * @param aURL The style sheet to be removed |
michael@0 | 60 | */ |
michael@0 | 61 | void removeStyleSheet(in AString aURL); |
michael@0 | 62 | |
michael@0 | 63 | /** Remove the given override style sheet from the editor's document |
michael@0 | 64 | * This is always synchronous |
michael@0 | 65 | * |
michael@0 | 66 | * @param aURL The style sheet to be removed. |
michael@0 | 67 | */ |
michael@0 | 68 | void removeOverrideStyleSheet(in AString aURL); |
michael@0 | 69 | |
michael@0 | 70 | /** Enable or disable the given style sheet from the editor's document |
michael@0 | 71 | * This is always synchronous |
michael@0 | 72 | * |
michael@0 | 73 | * @param aURL The style sheet to be enabled or disabled |
michael@0 | 74 | * @param aEnable true to enable, or false to disable the style sheet |
michael@0 | 75 | */ |
michael@0 | 76 | void enableStyleSheet(in AString aURL, in boolean aEnable); |
michael@0 | 77 | |
michael@0 | 78 | /** Get the nsCSSStyleSheet associated with the given URL. |
michael@0 | 79 | * |
michael@0 | 80 | * @param aURL The style sheet's URL |
michael@0 | 81 | * @return the style sheet |
michael@0 | 82 | */ |
michael@0 | 83 | [noscript] nsCSSStyleSheet getStyleSheetForURL(in AString aURL); |
michael@0 | 84 | |
michael@0 | 85 | /** Get the URL associated with the given nsCSSStyleSheet. |
michael@0 | 86 | * |
michael@0 | 87 | * @param aStyleSheet The style sheet |
michael@0 | 88 | * @return the style sheet's URL |
michael@0 | 89 | */ |
michael@0 | 90 | [noscript] AString getURLForStyleSheet(in nsCSSStyleSheet aStyleSheet); |
michael@0 | 91 | }; |