diff --git a/mozilla/editor/base/nsEditor.cpp b/mozilla/editor/base/nsEditor.cpp index 33c48222e7b..e9a5e4b5709 100644 --- a/mozilla/editor/base/nsEditor.cpp +++ b/mozilla/editor/base/nsEditor.cpp @@ -51,12 +51,20 @@ #include "nsIStyleContext.h" #include "nsIEditActionListener.h" +#include "nsICSSLoader.h" +#include "nsICSSStyleSheet.h" +#include "nsIHTMLContentContainer.h" +#include "nsIStyleSet.h" +#include "nsIDocumentObserver.h" + #ifdef NECKO #include "nsIIOService.h" #include "nsIURL.h" #include "nsIServiceManager.h" static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); +#else +#include "nsIURL.h" #endif // NECKO #include "nsEditorShell.h" @@ -1332,6 +1340,117 @@ NS_IMETHODIMP nsEditor::InsertAsQuotation(const nsString& aQuotedText) return InsertText(aQuotedText); } +extern "C" void +ApplyStyleSheetToPresShellDocument(nsICSSStyleSheet* aSheet, void *aData) +{ + nsresult rv; + + nsIPresShell *presShell = (nsIPresShell *)aData; + + if (presShell) { + nsCOMPtr styleSet; + + rv = presShell->GetStyleSet(getter_AddRefs(styleSet)); + + if (NS_SUCCEEDED(rv) && styleSet) { + styleSet->AppendOverrideStyleSheet(aSheet); + + nsCOMPtr observer = do_QueryInterface(presShell); + nsCOMPtr styleSheet = do_QueryInterface(aSheet); + nsCOMPtr document; + + rv = presShell->GetDocument(getter_AddRefs(document)); + + if (NS_SUCCEEDED(rv) && document && observer && styleSheet) + rv = observer->StyleSheetAdded(document, styleSheet); + } + } +} + +NS_IMETHODIMP nsEditor::ApplyStyleSheet(const nsString& aURL) +{ +#ifdef ENABLE_JS_EDITOR_LOG + nsAutoJSEditorLogLock logLock(mJSEditorLog); + + if (mJSEditorLog) + mJSEditorLog->ApplyStyleSheet(aURL); +#endif // ENABLE_JS_EDITOR_LOG + + // XXX: Note that this is not an undo-able action yet! + + nsresult rv = NS_OK; + nsIURI* uaURL = 0; + +#ifndef NECKO + rv = NS_NewURL(&uaURL, aURL); +#else + NS_WITH_SERVICE(nsIIOService, service, kIOServiceCID, &rv); + if (NS_FAILED(rv)) return rv; + + nsIURI *uri = nsnull; + rv = service->NewURI(aURL, nsnull, &uri); + if (NS_FAILED(rv)) return rv; + + rv = uri->QueryInterface(nsIURI::GetIID(), (void**)&uaURL); + NS_RELEASE(uri); +#endif // NECKO + + if (NS_SUCCEEDED(rv)) { + nsCOMPtr document; + + rv = mPresShell->GetDocument(getter_AddRefs(document)); + + if (NS_SUCCEEDED(rv)) { + if (document) { + nsCOMPtr container = do_QueryInterface(document); + + if (container) { + nsICSSLoader *cssLoader = 0; + nsICSSStyleSheet *cssStyleSheet = 0; + + rv = container->GetCSSLoader(cssLoader); + + if (NS_SUCCEEDED(rv)) { + if (cssLoader) { + PRBool complete; + + rv = cssLoader->LoadAgentSheet(uaURL, cssStyleSheet, complete, + ApplyStyleSheetToPresShellDocument, + mPresShell); + + if (NS_SUCCEEDED(rv)) { + if (complete) { + if (cssStyleSheet) { + ApplyStyleSheetToPresShellDocument(cssStyleSheet, + mPresShell); + } + else + rv = NS_ERROR_NULL_POINTER; + } + + // + // If not complete, we will be notified later + // with a call to AddStyleSheetToEditorDocument(). + // + } + } + else + rv = NS_ERROR_NULL_POINTER; + } + } + else + rv = NS_ERROR_NULL_POINTER; + } + else + rv = NS_ERROR_NULL_POINTER; + } + + NS_RELEASE(uaURL); + } + + return rv; +} + NS_IMETHODIMP nsEditor::AddEditActionListener(nsIEditActionListener *aListener) { diff --git a/mozilla/editor/base/nsEditor.h b/mozilla/editor/base/nsEditor.h index 484460844cc..72ac3c294fd 100644 --- a/mozilla/editor/base/nsEditor.h +++ b/mozilla/editor/base/nsEditor.h @@ -229,6 +229,8 @@ public: NS_IMETHOD InsertAsQuotation(const nsString& aQuotedText); + NS_IMETHOD ApplyStyleSheet(const nsString& aURL); + NS_IMETHOD AddEditActionListener(nsIEditActionListener *aListener); NS_IMETHOD RemoveEditActionListener(nsIEditActionListener *aListener); diff --git a/mozilla/editor/base/nsEditorShell.cpp b/mozilla/editor/base/nsEditorShell.cpp index c75d25953ad..f582406e5c6 100644 --- a/mozilla/editor/base/nsEditorShell.cpp +++ b/mozilla/editor/base/nsEditorShell.cpp @@ -90,7 +90,6 @@ #include "nsITransferable.h" #include "nsISupportsArray.h" - /* Define Class IDs */ static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID); static NS_DEFINE_IID(kEditorAppCoreCID, NS_EDITORAPPCORE_CID); @@ -616,6 +615,35 @@ NS_IMETHODIMP nsEditorShell::SetBackgroundColor(const PRUnichar *color) return result; } +NS_IMETHODIMP nsEditorShell::ApplyStyleSheet(const PRUnichar *url) +{ + nsresult result = NS_NOINTERFACE; + + nsAutoString aURL(url); + + switch (mEditorType) + { + case ePlainTextEditorType: + { + nsCOMPtr textEditor = do_QueryInterface(mEditor); + if (textEditor) + result = textEditor->ApplyStyleSheet(aURL); + } + break; + case eHTMLTextEditorType: + { + nsCOMPtr htmlEditor = do_QueryInterface(mEditor); + if (htmlEditor) + result = htmlEditor->ApplyStyleSheet(aURL); + } + break; + default: + result = NS_ERROR_NOT_IMPLEMENTED; + } + + return result; +} + NS_IMETHODIMP nsEditorShell::SetBodyAttribute(const PRUnichar *attr, const PRUnichar *value) { nsresult result = NS_NOINTERFACE; diff --git a/mozilla/editor/base/nsEditorShell.h b/mozilla/editor/base/nsEditorShell.h index 1d44439cad7..ff15f19d66c 100644 --- a/mozilla/editor/base/nsEditorShell.h +++ b/mozilla/editor/base/nsEditorShell.h @@ -161,6 +161,8 @@ class nsEditorShell : public nsIEditorShell, NS_IMETHOD SetBodyAttribute(const PRUnichar *attr, const PRUnichar *value); NS_IMETHOD SetBackgroundColor(const PRUnichar *color); + NS_IMETHOD ApplyStyleSheet(const PRUnichar *url); + /* string GetLocalFileURL (in nsIDOMWindow parent, in string filterType); */ NS_IMETHOD GetLocalFileURL(nsIDOMWindow *parent, const PRUnichar *filterType, PRUnichar **_retval); diff --git a/mozilla/editor/base/nsHTMLEditor.cpp b/mozilla/editor/base/nsHTMLEditor.cpp index c9db5065b00..ac64e7ac9ca 100644 --- a/mozilla/editor/base/nsHTMLEditor.cpp +++ b/mozilla/editor/base/nsHTMLEditor.cpp @@ -708,6 +708,12 @@ nsHTMLEditor::CopyAttributes(nsIDOMNode *aDestNode, nsIDOMNode *aSourceNode) return nsTextEditor::CopyAttributes(aDestNode, aSourceNode); } +NS_IMETHODIMP +nsHTMLEditor::ApplyStyleSheet(const nsString& aURL) +{ + return nsTextEditor::ApplyStyleSheet(aURL); +} + //================================================================ // HTML Editor methods // diff --git a/mozilla/editor/base/nsHTMLEditor.h b/mozilla/editor/base/nsHTMLEditor.h index c59daa964e0..ce2267f3a98 100644 --- a/mozilla/editor/base/nsHTMLEditor.h +++ b/mozilla/editor/base/nsHTMLEditor.h @@ -113,6 +113,9 @@ public: NS_IMETHOD OutputTextToStream(nsIOutputStream* aOutputStream,nsString* aCharsetOverride, PRBool aSelectionOnly); NS_IMETHOD OutputHTMLToStream(nsIOutputStream* aOutputStream,nsString* aCharsetOverride, PRBool aSelectionOnly); +// Miscellaneous + NS_IMETHOD ApplyStyleSheet(const nsString& aURL); + // Logging methods NS_IMETHOD StartLogging(nsIFileSpec *aLogFile); diff --git a/mozilla/editor/base/nsJSEditorLog.cpp b/mozilla/editor/base/nsJSEditorLog.cpp index 0e6d7190e17..f503aa793dc 100644 --- a/mozilla/editor/base/nsJSEditorLog.cpp +++ b/mozilla/editor/base/nsJSEditorLog.cpp @@ -839,6 +839,18 @@ nsJSEditorLog::EndComposition(void) return NS_ERROR_NOT_IMPLEMENTED; } +NS_IMETHODIMP +nsJSEditorLog::ApplyStyleSheet(const nsString& aURL) +{ + Write("window.editorShell.ApplyStyleSheet(\""); + PrintUnicode(aURL); + Write("\");\n"); + + Flush(); + + return NS_OK; +} + NS_IMETHODIMP nsJSEditorLog::StartLogging(nsIFileSpec *aLogFile) { diff --git a/mozilla/editor/base/nsJSEditorLog.h b/mozilla/editor/base/nsJSEditorLog.h index cc530c2a871..be6f0134ee4 100644 --- a/mozilla/editor/base/nsJSEditorLog.h +++ b/mozilla/editor/base/nsJSEditorLog.h @@ -104,6 +104,8 @@ public: NS_IMETHOD OutputTextToStream(nsIOutputStream* aOutputStream, nsString* aCharsetOverride, PRBool aSelectionOnly); NS_IMETHOD OutputHTMLToStream(nsIOutputStream* aOutputStream, nsString* aCharsetOverride, PRBool aSelectionOnly); + NS_IMETHOD ApplyStyleSheet(const nsString& aURL); + NS_IMETHOD GetLocalFileURL(nsIDOMWindow* aParent, const nsString& aFilterType, nsString& aReturn); NS_IMETHOD SetBackgroundColor(const nsString& aColor); NS_IMETHOD SetBodyAttribute(const nsString& aAttr, const nsString& aValue); diff --git a/mozilla/editor/base/nsTextEditor.cpp b/mozilla/editor/base/nsTextEditor.cpp index 083fbbfa45c..ffe87186122 100644 --- a/mozilla/editor/base/nsTextEditor.cpp +++ b/mozilla/editor/base/nsTextEditor.cpp @@ -1505,6 +1505,11 @@ NS_IMETHODIMP nsTextEditor::SetBodyWrapWidth(PRInt32 aWrapColumn) return res; } +NS_IMETHODIMP nsTextEditor::ApplyStyleSheet(const nsString& aURL) +{ + return nsEditor::ApplyStyleSheet(aURL); +} + NS_IMETHODIMP nsTextEditor::OutputTextToString(nsString& aOutputString, PRBool aSelectionOnly) { PRBool cancel; @@ -1705,7 +1710,6 @@ NS_IMETHODIMP nsTextEditor::OutputHTMLToStream(nsIOutputStream* aOutputStream,ns return encoder->EncodeToStream(aOutputStream); } - nsCOMPtr nsTextEditor::FindPreElement() { diff --git a/mozilla/editor/base/nsTextEditor.h b/mozilla/editor/base/nsTextEditor.h index a8b2390e59a..15e056a2887 100644 --- a/mozilla/editor/base/nsTextEditor.h +++ b/mozilla/editor/base/nsTextEditor.h @@ -122,6 +122,9 @@ public: NS_IMETHOD GetBodyWrapWidth(PRInt32 *aWrapColumn); NS_IMETHOD SetBodyWrapWidth(PRInt32 aWrapColumn); +// Miscellaneous + NS_IMETHOD ApplyStyleSheet(const nsString& aURL); + // Logging methods NS_IMETHOD StartLogging(nsIFileSpec *aLogFile); diff --git a/mozilla/editor/composer/src/nsEditorShell.cpp b/mozilla/editor/composer/src/nsEditorShell.cpp index c75d25953ad..f582406e5c6 100644 --- a/mozilla/editor/composer/src/nsEditorShell.cpp +++ b/mozilla/editor/composer/src/nsEditorShell.cpp @@ -90,7 +90,6 @@ #include "nsITransferable.h" #include "nsISupportsArray.h" - /* Define Class IDs */ static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID); static NS_DEFINE_IID(kEditorAppCoreCID, NS_EDITORAPPCORE_CID); @@ -616,6 +615,35 @@ NS_IMETHODIMP nsEditorShell::SetBackgroundColor(const PRUnichar *color) return result; } +NS_IMETHODIMP nsEditorShell::ApplyStyleSheet(const PRUnichar *url) +{ + nsresult result = NS_NOINTERFACE; + + nsAutoString aURL(url); + + switch (mEditorType) + { + case ePlainTextEditorType: + { + nsCOMPtr textEditor = do_QueryInterface(mEditor); + if (textEditor) + result = textEditor->ApplyStyleSheet(aURL); + } + break; + case eHTMLTextEditorType: + { + nsCOMPtr htmlEditor = do_QueryInterface(mEditor); + if (htmlEditor) + result = htmlEditor->ApplyStyleSheet(aURL); + } + break; + default: + result = NS_ERROR_NOT_IMPLEMENTED; + } + + return result; +} + NS_IMETHODIMP nsEditorShell::SetBodyAttribute(const PRUnichar *attr, const PRUnichar *value) { nsresult result = NS_NOINTERFACE; diff --git a/mozilla/editor/composer/src/nsEditorShell.h b/mozilla/editor/composer/src/nsEditorShell.h index 1d44439cad7..ff15f19d66c 100644 --- a/mozilla/editor/composer/src/nsEditorShell.h +++ b/mozilla/editor/composer/src/nsEditorShell.h @@ -161,6 +161,8 @@ class nsEditorShell : public nsIEditorShell, NS_IMETHOD SetBodyAttribute(const PRUnichar *attr, const PRUnichar *value); NS_IMETHOD SetBackgroundColor(const PRUnichar *color); + NS_IMETHOD ApplyStyleSheet(const PRUnichar *url); + /* string GetLocalFileURL (in nsIDOMWindow parent, in string filterType); */ NS_IMETHOD GetLocalFileURL(nsIDOMWindow *parent, const PRUnichar *filterType, PRUnichar **_retval); diff --git a/mozilla/editor/idl/nsIEditorShell.idl b/mozilla/editor/idl/nsIEditorShell.idl index fc038d10ccf..24f92c984e3 100644 --- a/mozilla/editor/idl/nsIEditorShell.idl +++ b/mozilla/editor/idl/nsIEditorShell.idl @@ -107,6 +107,8 @@ interface nsIEditorShell : nsISupports void GetTextProperty(in wstring prop, in wstring attr, in wstring value, out wstring firstHas, out wstring anyHas, out wstring allHas); void SetBodyAttribute(in wstring attr, in wstring value); void SetBackgroundColor(in wstring color); + + void ApplyStyleSheet(in wstring url); /* Utility */ wstring GetLocalFileURL(in nsIDOMWindow parent, in wstring filterType); diff --git a/mozilla/editor/libeditor/base/nsEditor.cpp b/mozilla/editor/libeditor/base/nsEditor.cpp index 33c48222e7b..e9a5e4b5709 100644 --- a/mozilla/editor/libeditor/base/nsEditor.cpp +++ b/mozilla/editor/libeditor/base/nsEditor.cpp @@ -51,12 +51,20 @@ #include "nsIStyleContext.h" #include "nsIEditActionListener.h" +#include "nsICSSLoader.h" +#include "nsICSSStyleSheet.h" +#include "nsIHTMLContentContainer.h" +#include "nsIStyleSet.h" +#include "nsIDocumentObserver.h" + #ifdef NECKO #include "nsIIOService.h" #include "nsIURL.h" #include "nsIServiceManager.h" static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); +#else +#include "nsIURL.h" #endif // NECKO #include "nsEditorShell.h" @@ -1332,6 +1340,117 @@ NS_IMETHODIMP nsEditor::InsertAsQuotation(const nsString& aQuotedText) return InsertText(aQuotedText); } +extern "C" void +ApplyStyleSheetToPresShellDocument(nsICSSStyleSheet* aSheet, void *aData) +{ + nsresult rv; + + nsIPresShell *presShell = (nsIPresShell *)aData; + + if (presShell) { + nsCOMPtr styleSet; + + rv = presShell->GetStyleSet(getter_AddRefs(styleSet)); + + if (NS_SUCCEEDED(rv) && styleSet) { + styleSet->AppendOverrideStyleSheet(aSheet); + + nsCOMPtr observer = do_QueryInterface(presShell); + nsCOMPtr styleSheet = do_QueryInterface(aSheet); + nsCOMPtr document; + + rv = presShell->GetDocument(getter_AddRefs(document)); + + if (NS_SUCCEEDED(rv) && document && observer && styleSheet) + rv = observer->StyleSheetAdded(document, styleSheet); + } + } +} + +NS_IMETHODIMP nsEditor::ApplyStyleSheet(const nsString& aURL) +{ +#ifdef ENABLE_JS_EDITOR_LOG + nsAutoJSEditorLogLock logLock(mJSEditorLog); + + if (mJSEditorLog) + mJSEditorLog->ApplyStyleSheet(aURL); +#endif // ENABLE_JS_EDITOR_LOG + + // XXX: Note that this is not an undo-able action yet! + + nsresult rv = NS_OK; + nsIURI* uaURL = 0; + +#ifndef NECKO + rv = NS_NewURL(&uaURL, aURL); +#else + NS_WITH_SERVICE(nsIIOService, service, kIOServiceCID, &rv); + if (NS_FAILED(rv)) return rv; + + nsIURI *uri = nsnull; + rv = service->NewURI(aURL, nsnull, &uri); + if (NS_FAILED(rv)) return rv; + + rv = uri->QueryInterface(nsIURI::GetIID(), (void**)&uaURL); + NS_RELEASE(uri); +#endif // NECKO + + if (NS_SUCCEEDED(rv)) { + nsCOMPtr document; + + rv = mPresShell->GetDocument(getter_AddRefs(document)); + + if (NS_SUCCEEDED(rv)) { + if (document) { + nsCOMPtr container = do_QueryInterface(document); + + if (container) { + nsICSSLoader *cssLoader = 0; + nsICSSStyleSheet *cssStyleSheet = 0; + + rv = container->GetCSSLoader(cssLoader); + + if (NS_SUCCEEDED(rv)) { + if (cssLoader) { + PRBool complete; + + rv = cssLoader->LoadAgentSheet(uaURL, cssStyleSheet, complete, + ApplyStyleSheetToPresShellDocument, + mPresShell); + + if (NS_SUCCEEDED(rv)) { + if (complete) { + if (cssStyleSheet) { + ApplyStyleSheetToPresShellDocument(cssStyleSheet, + mPresShell); + } + else + rv = NS_ERROR_NULL_POINTER; + } + + // + // If not complete, we will be notified later + // with a call to AddStyleSheetToEditorDocument(). + // + } + } + else + rv = NS_ERROR_NULL_POINTER; + } + } + else + rv = NS_ERROR_NULL_POINTER; + } + else + rv = NS_ERROR_NULL_POINTER; + } + + NS_RELEASE(uaURL); + } + + return rv; +} + NS_IMETHODIMP nsEditor::AddEditActionListener(nsIEditActionListener *aListener) { diff --git a/mozilla/editor/libeditor/base/nsEditor.h b/mozilla/editor/libeditor/base/nsEditor.h index 484460844cc..72ac3c294fd 100644 --- a/mozilla/editor/libeditor/base/nsEditor.h +++ b/mozilla/editor/libeditor/base/nsEditor.h @@ -229,6 +229,8 @@ public: NS_IMETHOD InsertAsQuotation(const nsString& aQuotedText); + NS_IMETHOD ApplyStyleSheet(const nsString& aURL); + NS_IMETHOD AddEditActionListener(nsIEditActionListener *aListener); NS_IMETHOD RemoveEditActionListener(nsIEditActionListener *aListener); diff --git a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp index c9db5065b00..ac64e7ac9ca 100644 --- a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp @@ -708,6 +708,12 @@ nsHTMLEditor::CopyAttributes(nsIDOMNode *aDestNode, nsIDOMNode *aSourceNode) return nsTextEditor::CopyAttributes(aDestNode, aSourceNode); } +NS_IMETHODIMP +nsHTMLEditor::ApplyStyleSheet(const nsString& aURL) +{ + return nsTextEditor::ApplyStyleSheet(aURL); +} + //================================================================ // HTML Editor methods // diff --git a/mozilla/editor/libeditor/html/nsHTMLEditor.h b/mozilla/editor/libeditor/html/nsHTMLEditor.h index c59daa964e0..ce2267f3a98 100644 --- a/mozilla/editor/libeditor/html/nsHTMLEditor.h +++ b/mozilla/editor/libeditor/html/nsHTMLEditor.h @@ -113,6 +113,9 @@ public: NS_IMETHOD OutputTextToStream(nsIOutputStream* aOutputStream,nsString* aCharsetOverride, PRBool aSelectionOnly); NS_IMETHOD OutputHTMLToStream(nsIOutputStream* aOutputStream,nsString* aCharsetOverride, PRBool aSelectionOnly); +// Miscellaneous + NS_IMETHOD ApplyStyleSheet(const nsString& aURL); + // Logging methods NS_IMETHOD StartLogging(nsIFileSpec *aLogFile); diff --git a/mozilla/editor/public/nsIEditor.h b/mozilla/editor/public/nsIEditor.h index 17298b51b17..8c300ca1d1c 100644 --- a/mozilla/editor/public/nsIEditor.h +++ b/mozilla/editor/public/nsIEditor.h @@ -378,6 +378,12 @@ public: */ NS_IMETHOD InsertAsQuotation(const nsString& aQuotedText)=0; + /** load and apply the style sheet, specified by aURL, to + * the editor's document. + * @param aURL The style sheet to be loaded and applied. + */ + NS_IMETHOD ApplyStyleSheet(const nsString& aURL)=0; + /** add an EditActionListener to the editors list of listeners. */ NS_IMETHOD AddEditActionListener(nsIEditActionListener *aListener)=0; diff --git a/mozilla/editor/public/nsIHTMLEditor.h b/mozilla/editor/public/nsIHTMLEditor.h index 9bd05296602..bcd8c062962 100644 --- a/mozilla/editor/public/nsIHTMLEditor.h +++ b/mozilla/editor/public/nsIHTMLEditor.h @@ -108,6 +108,8 @@ public: NS_IMETHOD OutputTextToStream(nsIOutputStream* aOutputStream, nsString* aCharsetOverride, PRBool aSelectionOnly)=0; NS_IMETHOD OutputHTMLToStream(nsIOutputStream* aOutputStream, nsString* aCharsetOverride, PRBool aSelectionOnly)=0; + NS_IMETHOD ApplyStyleSheet(const nsString& aURL)=0; + // Miscellaneous Methods /** Set the background color of the selected table cell, row, columne, or table, * or the document background if not in a table diff --git a/mozilla/editor/public/nsITextEditor.h b/mozilla/editor/public/nsITextEditor.h index 3cda7ccecd1..769b9546b82 100644 --- a/mozilla/editor/public/nsITextEditor.h +++ b/mozilla/editor/public/nsITextEditor.h @@ -348,10 +348,16 @@ public: * -1 = no wrap at all * */ - NS_IMETHOD GetBodyWrapWidth(PRUint32 *aWrapColumn)=0; - NS_IMETHOD SetBodyWrapWidth(PRUint32 aWrapColumn)=0; + NS_IMETHOD GetBodyWrapWidth(PRInt32 *aWrapColumn)=0; + NS_IMETHOD SetBodyWrapWidth(PRInt32 aWrapColumn)=0; // Miscellaneous Methods + + /** Apply the style sheet, specified by aURL, to the + * text editor's document. + */ + NS_IMETHOD ApplyStyleSheet(const nsString& aURL)=0; + /* NS_IMETHOD CheckSpelling()=0; NS_IMETHOD SpellingLanguage(nsIAtom *aLanguage)=0; diff --git a/mozilla/editor/ui/composer/content/EditorCommands.js b/mozilla/editor/ui/composer/content/EditorCommands.js index 2b64fab25ef..bd5ed3f715a 100644 --- a/mozilla/editor/ui/composer/content/EditorCommands.js +++ b/mozilla/editor/ui/composer/content/EditorCommands.js @@ -436,6 +436,14 @@ function OnCreateAlignmentPopup() // --------------------------- Debug stuff --------------------------- +function EditorApplyStyleSheet(url) +{ + if (window.editorShell) + { + window.editorShell.ApplyStyleSheet(url); + } +} + function EditorExecuteScript(fileSpec) { fileSpec.openStreamForReading();