From 2bd49a37422ef769345df87065c5419baa50517e Mon Sep 17 00:00:00 2001 From: "sfraser%netscape.com" Date: Fri, 2 Jul 1999 03:56:25 +0000 Subject: [PATCH] First Checked In. git-svn-id: svn://10.0.0.236/trunk@37962 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/editor/base/nsStyleSheetTxns.cpp | 297 ++++++++++++++++++ mozilla/editor/base/nsStyleSheetTxns.h | 120 +++++++ .../libeditor/base/nsStyleSheetTxns.cpp | 297 ++++++++++++++++++ .../editor/libeditor/base/nsStyleSheetTxns.h | 120 +++++++ .../ui/composer/content/EditorStyles1.css | 79 +++++ 5 files changed, 913 insertions(+) create mode 100644 mozilla/editor/base/nsStyleSheetTxns.cpp create mode 100644 mozilla/editor/base/nsStyleSheetTxns.h create mode 100644 mozilla/editor/libeditor/base/nsStyleSheetTxns.cpp create mode 100644 mozilla/editor/libeditor/base/nsStyleSheetTxns.h create mode 100644 mozilla/editor/ui/composer/content/EditorStyles1.css diff --git a/mozilla/editor/base/nsStyleSheetTxns.cpp b/mozilla/editor/base/nsStyleSheetTxns.cpp new file mode 100644 index 00000000000..4a2830cf332 --- /dev/null +++ b/mozilla/editor/base/nsStyleSheetTxns.cpp @@ -0,0 +1,297 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + + +#include "nsEditor.h" + +#include "nsIPresShell.h" +#include "nsICSSStyleSheet.h" +#include "nsIStyleSet.h" +#include "nsIDocument.h" +#include "nsIDocumentObserver.h" + + +#include "nsStyleSheetTxns.h" + + + +AddStyleSheetTxn::AddStyleSheetTxn() +: mEditor(NULL) +{ +} + +AddStyleSheetTxn::~AddStyleSheetTxn() +{ +} + +NS_IMETHODIMP +AddStyleSheetTxn::Init(nsIEditor *aEditor, nsICSSStyleSheet *aSheet) +{ + if (!aEditor) + return NS_ERROR_INVALID_ARG; + + if (!aSheet) + return NS_ERROR_INVALID_ARG; + + mEditor = aEditor; + mSheet = do_QueryInterface(aSheet); + + return NS_OK; +} + + +NS_IMETHODIMP +AddStyleSheetTxn::Do() +{ + if (!mEditor || !mSheet) + return NS_ERROR_NOT_INITIALIZED; + + nsCOMPtr presShell; + mEditor->GetPresShell(getter_AddRefs(presShell)); + if (!presShell) + return NS_ERROR_UNEXPECTED; + + nsCOMPtr styleSet; + nsresult rv = presShell->GetStyleSet(getter_AddRefs(styleSet)); + + if (NS_SUCCEEDED(rv) && styleSet) + { + styleSet->AppendOverrideStyleSheet(mSheet); + + nsCOMPtr observer = do_QueryInterface(presShell); + nsCOMPtr styleSheet = do_QueryInterface(mSheet); + nsCOMPtr document; + + rv = presShell->GetDocument(getter_AddRefs(document)); + + if (NS_SUCCEEDED(rv) && document && observer && styleSheet) + rv = observer->StyleSheetAdded(document, styleSheet); + } + + return rv; +} + +NS_IMETHODIMP +AddStyleSheetTxn::Undo() +{ + if (!mEditor || !mSheet) + return NS_ERROR_NOT_INITIALIZED; + + nsCOMPtr presShell; + mEditor->GetPresShell(getter_AddRefs(presShell)); + if (!presShell) + return NS_ERROR_UNEXPECTED; + + nsCOMPtr styleSet; + nsresult rv = presShell->GetStyleSet(getter_AddRefs(styleSet)); + + if (NS_SUCCEEDED(rv) && styleSet) + { + styleSet->RemoveOverrideStyleSheet(mSheet); + + nsCOMPtr observer = do_QueryInterface(presShell); + nsCOMPtr styleSheet = do_QueryInterface(mSheet); + nsCOMPtr document; + + rv = presShell->GetDocument(getter_AddRefs(document)); + + if (NS_SUCCEEDED(rv) && document && observer && styleSheet) + rv = observer->StyleSheetRemoved(document, styleSheet); + } + + return rv; +} + +NS_IMETHODIMP +AddStyleSheetTxn::Redo() +{ + return Do(); +} + +NS_IMETHODIMP +AddStyleSheetTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction) +{ + // set out param default value + if (!aDidMerge) + return NS_ERROR_NULL_POINTER; + + *aDidMerge = PR_FALSE; + return NS_OK; +} + +NS_IMETHODIMP +AddStyleSheetTxn::Write(nsIOutputStream *aOutputStream) +{ + return NS_OK; +} + +NS_IMETHODIMP +AddStyleSheetTxn::GetUndoString(nsString *aString) +{ + if (aString) + { + *aString="Remove Style Sheet"; + } + return NS_OK; +} + +NS_IMETHODIMP +AddStyleSheetTxn::GetRedoString(nsString *aString) +{ + if (aString) + { + *aString="Add Style Sheet"; + } + return NS_OK; +} + + +#ifdef XP_MAC +#pragma mark - +#endif + + +RemoveStyleSheetTxn::RemoveStyleSheetTxn() +: mEditor(NULL) +{ +} + +RemoveStyleSheetTxn::~RemoveStyleSheetTxn() +{ +} + +NS_IMETHODIMP +RemoveStyleSheetTxn::Init(nsIEditor *aEditor, nsICSSStyleSheet *aSheet) +{ + if (!aEditor) + return NS_ERROR_INVALID_ARG; + + if (!aSheet) + return NS_ERROR_INVALID_ARG; + + mEditor = aEditor; + mSheet = do_QueryInterface(aSheet); + + return NS_OK; +} + + +NS_IMETHODIMP +RemoveStyleSheetTxn::Do() +{ + if (!mEditor || !mSheet) + return NS_ERROR_NOT_INITIALIZED; + + nsCOMPtr presShell; + mEditor->GetPresShell(getter_AddRefs(presShell)); + if (!presShell) + return NS_ERROR_UNEXPECTED; + + nsCOMPtr styleSet; + nsresult rv = presShell->GetStyleSet(getter_AddRefs(styleSet)); + + if (NS_SUCCEEDED(rv) && styleSet) + { + styleSet->RemoveOverrideStyleSheet(mSheet); + + nsCOMPtr observer = do_QueryInterface(presShell); + nsCOMPtr styleSheet = do_QueryInterface(mSheet); + nsCOMPtr document; + + rv = presShell->GetDocument(getter_AddRefs(document)); + + if (NS_SUCCEEDED(rv) && document && observer && styleSheet) + rv = observer->StyleSheetRemoved(document, styleSheet); + } + + return rv; +} + +NS_IMETHODIMP +RemoveStyleSheetTxn::Undo() +{ + if (!mEditor || !mSheet) + return NS_ERROR_NOT_INITIALIZED; + + nsCOMPtr presShell; + mEditor->GetPresShell(getter_AddRefs(presShell)); + if (!presShell) + return NS_ERROR_UNEXPECTED; + + nsCOMPtr styleSet; + nsresult rv = presShell->GetStyleSet(getter_AddRefs(styleSet)); + + if (NS_SUCCEEDED(rv) && styleSet) + { + styleSet->AppendOverrideStyleSheet(mSheet); + + nsCOMPtr observer = do_QueryInterface(presShell); + nsCOMPtr styleSheet = do_QueryInterface(mSheet); + nsCOMPtr document; + + rv = presShell->GetDocument(getter_AddRefs(document)); + + if (NS_SUCCEEDED(rv) && document && observer && styleSheet) + rv = observer->StyleSheetAdded(document, styleSheet); + } + + return rv; +} + +NS_IMETHODIMP +RemoveStyleSheetTxn::Redo() +{ + return Do(); +} + +NS_IMETHODIMP +RemoveStyleSheetTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction) +{ + // set out param default value + if (!aDidMerge) + return NS_ERROR_NULL_POINTER; + + *aDidMerge = PR_FALSE; + return NS_OK; +} + +NS_IMETHODIMP +RemoveStyleSheetTxn::Write(nsIOutputStream *aOutputStream) +{ + return NS_OK; +} + +NS_IMETHODIMP +RemoveStyleSheetTxn::GetUndoString(nsString *aString) +{ + if (aString) + { + *aString="Add Style Sheet"; + } + return NS_OK; +} + +NS_IMETHODIMP +RemoveStyleSheetTxn::GetRedoString(nsString *aString) +{ + if (aString) + { + *aString="Remove Style Sheet"; + } + return NS_OK; +} diff --git a/mozilla/editor/base/nsStyleSheetTxns.h b/mozilla/editor/base/nsStyleSheetTxns.h new file mode 100644 index 00000000000..9f96d86d6a1 --- /dev/null +++ b/mozilla/editor/base/nsStyleSheetTxns.h @@ -0,0 +1,120 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#ifndef nsStylesheetTxns_h__ +#define nsStylesheetTxns_h__ + +#include "EditTxn.h" +#include "nsCOMPtr.h" +#include "nsIEditor.h" + +#define ADD_STYLESHEET_TXN_IID \ +{/* d05e2980-2fbe-11d3-9ce4-e8393835307c */ \ +0xd05e2980, 0x2fbe, 0x11d3, { 0x9c, 0xe4, 0xe8, 0x39, 0x38, 0x35, 0x30, 0x7c } } + +#define REMOVE_STYLESHEET_TXN_IID \ +{/* d05e2981-2fbe-11d3-9ce4-e8393835307c */ \ +0xd05e2981, 0x2fbe, 0x11d3, { 0x9c, 0xe4, 0xe8, 0x39, 0x38, 0x35, 0x30, 0x7c } } + + +class nsICSSStyleSheet; + +class AddStyleSheetTxn : public EditTxn +{ + friend class TransactionFactory; + +public: + + virtual ~AddStyleSheetTxn(); + + /** Initialize the transaction. + * @param aEditor the object providing core editing operations + * @param aSheet the stylesheet to add + */ + NS_IMETHOD Init(nsIEditor *aEditor, + nsICSSStyleSheet *aSheet); + +private: + AddStyleSheetTxn(); + +public: + + NS_IMETHOD Do(void); + + NS_IMETHOD Undo(void); + + NS_IMETHOD Redo(void); + + NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction); + + NS_IMETHOD Write(nsIOutputStream *aOutputStream); + + NS_IMETHOD GetUndoString(nsString *aString); + + NS_IMETHOD GetRedoString(nsString *aString); + +protected: + + nsIEditor* mEditor; // the editor that created this transaction + nsCOMPtr mSheet; // the style sheet to add + +}; + + +class RemoveStyleSheetTxn : public EditTxn +{ + friend class TransactionFactory; + +public: + virtual ~RemoveStyleSheetTxn(); + + /** Initialize the transaction. + * @param aEditor the object providing core editing operations + * @param aSheet the stylesheet to remove + */ + NS_IMETHOD Init(nsIEditor *aEditor, + nsICSSStyleSheet *aSheet); + +private: + RemoveStyleSheetTxn(); + +public: + + NS_IMETHOD Do(void); + + NS_IMETHOD Undo(void); + + NS_IMETHOD Redo(void); + + NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction); + + NS_IMETHOD Write(nsIOutputStream *aOutputStream); + + NS_IMETHOD GetUndoString(nsString *aString); + + NS_IMETHOD GetRedoString(nsString *aString); + +protected: + + nsIEditor* mEditor; // the editor that created this transaction + nsCOMPtr mSheet; // the style sheet to remove + +}; + + +#endif /* nsStylesheetTxns_h__ */ diff --git a/mozilla/editor/libeditor/base/nsStyleSheetTxns.cpp b/mozilla/editor/libeditor/base/nsStyleSheetTxns.cpp new file mode 100644 index 00000000000..4a2830cf332 --- /dev/null +++ b/mozilla/editor/libeditor/base/nsStyleSheetTxns.cpp @@ -0,0 +1,297 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + + +#include "nsEditor.h" + +#include "nsIPresShell.h" +#include "nsICSSStyleSheet.h" +#include "nsIStyleSet.h" +#include "nsIDocument.h" +#include "nsIDocumentObserver.h" + + +#include "nsStyleSheetTxns.h" + + + +AddStyleSheetTxn::AddStyleSheetTxn() +: mEditor(NULL) +{ +} + +AddStyleSheetTxn::~AddStyleSheetTxn() +{ +} + +NS_IMETHODIMP +AddStyleSheetTxn::Init(nsIEditor *aEditor, nsICSSStyleSheet *aSheet) +{ + if (!aEditor) + return NS_ERROR_INVALID_ARG; + + if (!aSheet) + return NS_ERROR_INVALID_ARG; + + mEditor = aEditor; + mSheet = do_QueryInterface(aSheet); + + return NS_OK; +} + + +NS_IMETHODIMP +AddStyleSheetTxn::Do() +{ + if (!mEditor || !mSheet) + return NS_ERROR_NOT_INITIALIZED; + + nsCOMPtr presShell; + mEditor->GetPresShell(getter_AddRefs(presShell)); + if (!presShell) + return NS_ERROR_UNEXPECTED; + + nsCOMPtr styleSet; + nsresult rv = presShell->GetStyleSet(getter_AddRefs(styleSet)); + + if (NS_SUCCEEDED(rv) && styleSet) + { + styleSet->AppendOverrideStyleSheet(mSheet); + + nsCOMPtr observer = do_QueryInterface(presShell); + nsCOMPtr styleSheet = do_QueryInterface(mSheet); + nsCOMPtr document; + + rv = presShell->GetDocument(getter_AddRefs(document)); + + if (NS_SUCCEEDED(rv) && document && observer && styleSheet) + rv = observer->StyleSheetAdded(document, styleSheet); + } + + return rv; +} + +NS_IMETHODIMP +AddStyleSheetTxn::Undo() +{ + if (!mEditor || !mSheet) + return NS_ERROR_NOT_INITIALIZED; + + nsCOMPtr presShell; + mEditor->GetPresShell(getter_AddRefs(presShell)); + if (!presShell) + return NS_ERROR_UNEXPECTED; + + nsCOMPtr styleSet; + nsresult rv = presShell->GetStyleSet(getter_AddRefs(styleSet)); + + if (NS_SUCCEEDED(rv) && styleSet) + { + styleSet->RemoveOverrideStyleSheet(mSheet); + + nsCOMPtr observer = do_QueryInterface(presShell); + nsCOMPtr styleSheet = do_QueryInterface(mSheet); + nsCOMPtr document; + + rv = presShell->GetDocument(getter_AddRefs(document)); + + if (NS_SUCCEEDED(rv) && document && observer && styleSheet) + rv = observer->StyleSheetRemoved(document, styleSheet); + } + + return rv; +} + +NS_IMETHODIMP +AddStyleSheetTxn::Redo() +{ + return Do(); +} + +NS_IMETHODIMP +AddStyleSheetTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction) +{ + // set out param default value + if (!aDidMerge) + return NS_ERROR_NULL_POINTER; + + *aDidMerge = PR_FALSE; + return NS_OK; +} + +NS_IMETHODIMP +AddStyleSheetTxn::Write(nsIOutputStream *aOutputStream) +{ + return NS_OK; +} + +NS_IMETHODIMP +AddStyleSheetTxn::GetUndoString(nsString *aString) +{ + if (aString) + { + *aString="Remove Style Sheet"; + } + return NS_OK; +} + +NS_IMETHODIMP +AddStyleSheetTxn::GetRedoString(nsString *aString) +{ + if (aString) + { + *aString="Add Style Sheet"; + } + return NS_OK; +} + + +#ifdef XP_MAC +#pragma mark - +#endif + + +RemoveStyleSheetTxn::RemoveStyleSheetTxn() +: mEditor(NULL) +{ +} + +RemoveStyleSheetTxn::~RemoveStyleSheetTxn() +{ +} + +NS_IMETHODIMP +RemoveStyleSheetTxn::Init(nsIEditor *aEditor, nsICSSStyleSheet *aSheet) +{ + if (!aEditor) + return NS_ERROR_INVALID_ARG; + + if (!aSheet) + return NS_ERROR_INVALID_ARG; + + mEditor = aEditor; + mSheet = do_QueryInterface(aSheet); + + return NS_OK; +} + + +NS_IMETHODIMP +RemoveStyleSheetTxn::Do() +{ + if (!mEditor || !mSheet) + return NS_ERROR_NOT_INITIALIZED; + + nsCOMPtr presShell; + mEditor->GetPresShell(getter_AddRefs(presShell)); + if (!presShell) + return NS_ERROR_UNEXPECTED; + + nsCOMPtr styleSet; + nsresult rv = presShell->GetStyleSet(getter_AddRefs(styleSet)); + + if (NS_SUCCEEDED(rv) && styleSet) + { + styleSet->RemoveOverrideStyleSheet(mSheet); + + nsCOMPtr observer = do_QueryInterface(presShell); + nsCOMPtr styleSheet = do_QueryInterface(mSheet); + nsCOMPtr document; + + rv = presShell->GetDocument(getter_AddRefs(document)); + + if (NS_SUCCEEDED(rv) && document && observer && styleSheet) + rv = observer->StyleSheetRemoved(document, styleSheet); + } + + return rv; +} + +NS_IMETHODIMP +RemoveStyleSheetTxn::Undo() +{ + if (!mEditor || !mSheet) + return NS_ERROR_NOT_INITIALIZED; + + nsCOMPtr presShell; + mEditor->GetPresShell(getter_AddRefs(presShell)); + if (!presShell) + return NS_ERROR_UNEXPECTED; + + nsCOMPtr styleSet; + nsresult rv = presShell->GetStyleSet(getter_AddRefs(styleSet)); + + if (NS_SUCCEEDED(rv) && styleSet) + { + styleSet->AppendOverrideStyleSheet(mSheet); + + nsCOMPtr observer = do_QueryInterface(presShell); + nsCOMPtr styleSheet = do_QueryInterface(mSheet); + nsCOMPtr document; + + rv = presShell->GetDocument(getter_AddRefs(document)); + + if (NS_SUCCEEDED(rv) && document && observer && styleSheet) + rv = observer->StyleSheetAdded(document, styleSheet); + } + + return rv; +} + +NS_IMETHODIMP +RemoveStyleSheetTxn::Redo() +{ + return Do(); +} + +NS_IMETHODIMP +RemoveStyleSheetTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction) +{ + // set out param default value + if (!aDidMerge) + return NS_ERROR_NULL_POINTER; + + *aDidMerge = PR_FALSE; + return NS_OK; +} + +NS_IMETHODIMP +RemoveStyleSheetTxn::Write(nsIOutputStream *aOutputStream) +{ + return NS_OK; +} + +NS_IMETHODIMP +RemoveStyleSheetTxn::GetUndoString(nsString *aString) +{ + if (aString) + { + *aString="Add Style Sheet"; + } + return NS_OK; +} + +NS_IMETHODIMP +RemoveStyleSheetTxn::GetRedoString(nsString *aString) +{ + if (aString) + { + *aString="Remove Style Sheet"; + } + return NS_OK; +} diff --git a/mozilla/editor/libeditor/base/nsStyleSheetTxns.h b/mozilla/editor/libeditor/base/nsStyleSheetTxns.h new file mode 100644 index 00000000000..9f96d86d6a1 --- /dev/null +++ b/mozilla/editor/libeditor/base/nsStyleSheetTxns.h @@ -0,0 +1,120 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#ifndef nsStylesheetTxns_h__ +#define nsStylesheetTxns_h__ + +#include "EditTxn.h" +#include "nsCOMPtr.h" +#include "nsIEditor.h" + +#define ADD_STYLESHEET_TXN_IID \ +{/* d05e2980-2fbe-11d3-9ce4-e8393835307c */ \ +0xd05e2980, 0x2fbe, 0x11d3, { 0x9c, 0xe4, 0xe8, 0x39, 0x38, 0x35, 0x30, 0x7c } } + +#define REMOVE_STYLESHEET_TXN_IID \ +{/* d05e2981-2fbe-11d3-9ce4-e8393835307c */ \ +0xd05e2981, 0x2fbe, 0x11d3, { 0x9c, 0xe4, 0xe8, 0x39, 0x38, 0x35, 0x30, 0x7c } } + + +class nsICSSStyleSheet; + +class AddStyleSheetTxn : public EditTxn +{ + friend class TransactionFactory; + +public: + + virtual ~AddStyleSheetTxn(); + + /** Initialize the transaction. + * @param aEditor the object providing core editing operations + * @param aSheet the stylesheet to add + */ + NS_IMETHOD Init(nsIEditor *aEditor, + nsICSSStyleSheet *aSheet); + +private: + AddStyleSheetTxn(); + +public: + + NS_IMETHOD Do(void); + + NS_IMETHOD Undo(void); + + NS_IMETHOD Redo(void); + + NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction); + + NS_IMETHOD Write(nsIOutputStream *aOutputStream); + + NS_IMETHOD GetUndoString(nsString *aString); + + NS_IMETHOD GetRedoString(nsString *aString); + +protected: + + nsIEditor* mEditor; // the editor that created this transaction + nsCOMPtr mSheet; // the style sheet to add + +}; + + +class RemoveStyleSheetTxn : public EditTxn +{ + friend class TransactionFactory; + +public: + virtual ~RemoveStyleSheetTxn(); + + /** Initialize the transaction. + * @param aEditor the object providing core editing operations + * @param aSheet the stylesheet to remove + */ + NS_IMETHOD Init(nsIEditor *aEditor, + nsICSSStyleSheet *aSheet); + +private: + RemoveStyleSheetTxn(); + +public: + + NS_IMETHOD Do(void); + + NS_IMETHOD Undo(void); + + NS_IMETHOD Redo(void); + + NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction); + + NS_IMETHOD Write(nsIOutputStream *aOutputStream); + + NS_IMETHOD GetUndoString(nsString *aString); + + NS_IMETHOD GetRedoString(nsString *aString); + +protected: + + nsIEditor* mEditor; // the editor that created this transaction + nsCOMPtr mSheet; // the style sheet to remove + +}; + + +#endif /* nsStylesheetTxns_h__ */ diff --git a/mozilla/editor/ui/composer/content/EditorStyles1.css b/mozilla/editor/ui/composer/content/EditorStyles1.css new file mode 100644 index 00000000000..038eb75edf8 --- /dev/null +++ b/mozilla/editor/ui/composer/content/EditorStyles1.css @@ -0,0 +1,79 @@ +/* This stylesheet is designed to be hacked on, to test the editor with + various styles applied. +*/ + +h2 +{ + border: solid black 1px; + background-color: white; +} + +h3:before +{ + content: "Chapter " counter(chapter) ". "; + counter-increment: chapter; + counter-reset: section; +} + +body +{ + background-color: white; +} + +p +{ + background-color: #CCCCCC; +} + +p:first-letter +{ + font-size: 200%; + font-weight: bold; + float: left; +} + +p.note +{ + background-color: pink; + padding-top: 10px; + padding-bottom: 10px; + padding-left: 10px; + padding-right: 10px; + text-align: justify; +} + +p.note:before +{ + content: "Note: " +} + +div +{ + margin-left: 10pt; +} + +blockquote.poem +{ + padding-left: 20pt; + border-left: solid blue 2px; +} + +li:first-child +{ + background-color: yellow; +} + +table#bigtable +{ + border: solid grey 5px; +} + +pre +{ + background-color: white; +} + +ol.roman +{ + list-style-type: lower-roman; +}