2001-09-25 22:53:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 14:21:17 +00:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1999-08-19 13:19:10 +00:00
|
|
|
*
|
2004-04-18 14:21:17 +00:00
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
1999-08-19 13:19:10 +00:00
|
|
|
*
|
2001-09-25 22:53:13 +00:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1999-08-19 13:19:10 +00:00
|
|
|
*
|
1999-11-06 03:43:54 +00:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-18 14:21:17 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-25 22:53:13 +00:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 03:43:54 +00:00
|
|
|
*
|
2001-09-25 22:53:13 +00:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 14:21:17 +00:00
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
2001-09-25 22:53:13 +00:00
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
2004-04-18 14:21:17 +00:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-25 22:53:13 +00:00
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
2004-04-18 14:21:17 +00:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-25 22:53:13 +00:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1999-08-19 13:19:10 +00:00
|
|
|
|
|
|
|
#ifndef nsHTMLEditorLog_h__
|
|
|
|
#define nsHTMLEditorLog_h__
|
|
|
|
|
|
|
|
#include "nsHTMLEditor.h"
|
|
|
|
#include "nsIEditorLogging.h"
|
2001-01-09 22:47:02 +00:00
|
|
|
#include "nsIFileStreams.h"
|
1999-08-19 13:19:10 +00:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
|
2001-01-09 22:47:02 +00:00
|
|
|
class nsIFile;
|
1999-08-19 13:19:10 +00:00
|
|
|
class nsEditorTxnLog;
|
|
|
|
|
|
|
|
/** implementation of a transaction listener object.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
class nsHTMLEditorLog : public nsHTMLEditor,
|
2000-02-16 03:14:20 +00:00
|
|
|
public nsIEditorLogging
|
1999-08-19 13:19:10 +00:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
|
2003-01-18 04:21:04 +00:00
|
|
|
nsCOMPtr<nsIOutputStream> mFileStream;
|
1999-08-19 13:19:10 +00:00
|
|
|
nsEditorTxnLog *mEditorTxnLog;
|
|
|
|
PRInt32 mLocked;
|
|
|
|
PRInt32 mDepth;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
// Interfaces for AddRef, Release, and QueryInterface.
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
nsHTMLEditorLog();
|
|
|
|
virtual ~nsHTMLEditorLog();
|
|
|
|
|
|
|
|
/* nsIHTMLEditor method implementations. */
|
|
|
|
NS_IMETHOD SetInlineProperty(nsIAtom *aProperty,
|
2002-03-23 22:08:20 +00:00
|
|
|
const nsAString & aAttribute,
|
|
|
|
const nsAString & aValue);
|
2001-05-02 23:19:29 +00:00
|
|
|
NS_IMETHOD SetParagraphFormat(const nsAString& aParagraphFormat);
|
2002-03-23 22:08:20 +00:00
|
|
|
NS_IMETHOD RemoveInlineProperty(nsIAtom *aProperty, const nsAString& aAttribute);
|
1999-12-07 08:30:19 +00:00
|
|
|
NS_IMETHOD DeleteSelection(nsIEditor::EDirection aAction);
|
2002-03-23 22:08:20 +00:00
|
|
|
NS_IMETHOD InsertText(const nsAString& aStringToInsert);
|
2000-11-17 00:25:31 +00:00
|
|
|
NS_IMETHOD InsertLineBreak();
|
1999-08-19 13:19:10 +00:00
|
|
|
NS_IMETHOD Undo(PRUint32 aCount);
|
|
|
|
NS_IMETHOD Redo(PRUint32 aCount);
|
|
|
|
NS_IMETHOD BeginTransaction();
|
|
|
|
NS_IMETHOD EndTransaction();
|
|
|
|
NS_IMETHOD SelectAll();
|
|
|
|
NS_IMETHOD BeginningOfDocument();
|
|
|
|
NS_IMETHOD EndOfDocument();
|
|
|
|
|
|
|
|
NS_IMETHOD Cut();
|
|
|
|
NS_IMETHOD Copy();
|
2000-04-14 23:38:21 +00:00
|
|
|
NS_IMETHOD Paste(PRInt32 aSelectionType);
|
|
|
|
NS_IMETHOD PasteAsQuotation(PRInt32 aSelectionType);
|
|
|
|
NS_IMETHOD PasteAsPlaintextQuotation(PRInt32 aSelectionType);
|
2002-03-23 22:08:20 +00:00
|
|
|
NS_IMETHOD PasteAsCitedQuotation(const nsAString& aCitation,
|
2000-04-14 23:38:21 +00:00
|
|
|
PRInt32 aSelectionType);
|
2002-03-23 22:08:20 +00:00
|
|
|
NS_IMETHOD InsertAsQuotation(const nsAString& aQuotedText, nsIDOMNode** aNodeInserted);
|
2002-10-08 21:22:27 +00:00
|
|
|
NS_IMETHOD InsertAsPlaintextQuotation(const nsAString& aQuotedText,
|
|
|
|
PRBool aAddCites,
|
|
|
|
nsIDOMNode** aNodeInserted);
|
2002-03-23 22:08:20 +00:00
|
|
|
NS_IMETHOD InsertAsCitedQuotation(const nsAString& aQuotedText, const nsAString& aCitation,
|
2003-06-12 14:51:37 +00:00
|
|
|
PRBool aInsertHTML,
|
2001-04-07 00:45:26 +00:00
|
|
|
nsIDOMNode** aNodeInserted);
|
|
|
|
|
2002-03-23 22:08:20 +00:00
|
|
|
NS_IMETHOD SetDocumentTitle(const nsAString& aTitle);
|
2001-04-07 00:45:26 +00:00
|
|
|
|
2002-03-23 22:08:20 +00:00
|
|
|
NS_IMETHOD SetBackgroundColor(const nsAString& aColor);
|
|
|
|
NS_IMETHOD SetBodyAttribute(const nsAString& aAttr, const nsAString& aValue);
|
|
|
|
NS_IMETHOD MakeOrChangeList(const nsAString& aListType, PRBool entireList, const nsAString& aBulletType);
|
|
|
|
NS_IMETHOD Indent(const nsAString& aIndent);
|
|
|
|
NS_IMETHOD Align(const nsAString& aAlign);
|
1999-10-14 00:13:27 +00:00
|
|
|
NS_IMETHOD InsertElementAtSelection(nsIDOMElement* aElement, PRBool aDeleteSelection);
|
1999-08-19 13:19:10 +00:00
|
|
|
NS_IMETHOD InsertLinkAroundSelection(nsIDOMElement* aAnchorElement);
|
2000-02-10 05:14:52 +00:00
|
|
|
|
|
|
|
/* Table Editing */
|
|
|
|
NS_IMETHOD InsertTableCell(PRInt32 aNumber, PRBool aAfter);
|
|
|
|
NS_IMETHOD InsertTableColumn(PRInt32 aNumber, PRBool aAfter);
|
|
|
|
NS_IMETHOD InsertTableRow(PRInt32 aNumber, PRBool aAfter);
|
|
|
|
NS_IMETHOD DeleteTable();
|
|
|
|
NS_IMETHOD DeleteTableCell(PRInt32 aNumber);
|
|
|
|
NS_IMETHOD DeleteTableCellContents();
|
|
|
|
NS_IMETHOD DeleteTableColumn(PRInt32 aNumber);
|
|
|
|
NS_IMETHOD DeleteTableRow(PRInt32 aNumber);
|
2000-07-01 00:37:12 +00:00
|
|
|
NS_IMETHOD JoinTableCells(PRBool aMergeNonContiguousContents);
|
2000-05-04 22:32:24 +00:00
|
|
|
NS_IMETHOD SplitTableCell();
|
2000-02-10 05:14:52 +00:00
|
|
|
NS_IMETHOD NormalizeTable(nsIDOMElement *aTable);
|
2000-07-01 00:37:12 +00:00
|
|
|
NS_IMETHOD SwitchTableCellHeaderType(nsIDOMElement *aSourceCell, nsIDOMElement **aNewCell);
|
1999-08-19 13:19:10 +00:00
|
|
|
|
2001-01-09 22:47:02 +00:00
|
|
|
NS_IMETHOD StartLogging(nsIFile *aLogFile);
|
1999-08-19 13:19:10 +00:00
|
|
|
NS_IMETHOD StopLogging();
|
|
|
|
|
|
|
|
/* nsHTMLEditorLog public methods. */
|
|
|
|
nsresult Write(const char *aBuffer);
|
2002-11-18 15:43:19 +00:00
|
|
|
nsresult WriteInt(PRInt32 aInt);
|
1999-08-19 13:19:10 +00:00
|
|
|
nsresult Flush();
|
2002-03-23 22:08:20 +00:00
|
|
|
nsresult PrintUnicode(const nsAString &aString);
|
1999-08-19 13:19:10 +00:00
|
|
|
nsresult PrintSelection();
|
|
|
|
nsresult PrintNode(nsIDOMNode *aNode, PRInt32 aDepth=0);
|
|
|
|
nsresult PrintElementNode(nsIDOMNode *aNode, PRInt32 aDepth);
|
|
|
|
nsresult PrintTextNode(nsIDOMNode *aNode, PRInt32 aDepth);
|
|
|
|
nsresult PrintAttributeNode(nsIDOMNode *aNode, PRInt32 aDepth=0);
|
|
|
|
nsresult PrintNodeChildren(nsIDOMNode *aNode, PRInt32 aDepth=0);
|
|
|
|
nsresult GetNodeTreeOffsets(nsIDOMNode *aNode, PRInt32 **aResult, PRInt32 *aLength);
|
|
|
|
nsresult Lock();
|
|
|
|
nsresult Unlock();
|
|
|
|
};
|
|
|
|
|
|
|
|
class nsAutoHTMLEditorLogLock
|
|
|
|
{
|
|
|
|
nsHTMLEditorLog *mLog;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
nsAutoHTMLEditorLogLock(nsHTMLEditorLog *aLog)
|
|
|
|
{
|
|
|
|
mLog = aLog;
|
|
|
|
|
|
|
|
if (mLog)
|
|
|
|
mLog->Lock();
|
|
|
|
}
|
|
|
|
|
|
|
|
~nsAutoHTMLEditorLogLock()
|
|
|
|
{
|
|
|
|
if (mLog)
|
|
|
|
mLog->Unlock();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsHTMLEditorLog_h__
|