Implemented nsHTMLEditor. Changed prototypes to be use NS_IMETHOD and NS_IMETHODIMP. Started table editing transactions

git-svn-id: svn://10.0.0.236/trunk@22534 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
cmanske%netscape.com 1999-03-02 05:30:53 +00:00
parent 0217662ca2
commit 202c5b89dc
97 changed files with 1676 additions and 1385 deletions

View File

@ -25,7 +25,7 @@ ChangeAttributeTxn::ChangeAttributeTxn()
{
}
nsresult ChangeAttributeTxn::Init(nsIEditor *aEditor,
NS_IMETHODIMP ChangeAttributeTxn::Init(nsIEditor *aEditor,
nsIDOMElement *aElement,
const nsString& aAttribute,
const nsString& aValue,
@ -46,7 +46,7 @@ nsresult ChangeAttributeTxn::Init(nsIEditor *aEditor,
return NS_ERROR_NULL_POINTER;
}
nsresult ChangeAttributeTxn::Do(void)
NS_IMETHODIMP ChangeAttributeTxn::Do(void)
{
// need to get the current value of the attribute and save it, and set mAttributeWasSet
const int stringlen=100;
@ -72,7 +72,7 @@ nsresult ChangeAttributeTxn::Do(void)
return result;
}
nsresult ChangeAttributeTxn::Undo(void)
NS_IMETHODIMP ChangeAttributeTxn::Undo(void)
{
nsresult result=NS_OK;
if (PR_TRUE==mAttributeWasSet)
@ -83,7 +83,7 @@ nsresult ChangeAttributeTxn::Undo(void)
return result;
}
nsresult ChangeAttributeTxn::Redo(void)
NS_IMETHODIMP ChangeAttributeTxn::Redo(void)
{
nsresult result;
@ -95,19 +95,19 @@ nsresult ChangeAttributeTxn::Redo(void)
return result;
}
nsresult ChangeAttributeTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP ChangeAttributeTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
if (nsnull!=aDidMerge)
*aDidMerge=PR_FALSE;
return NS_OK;
}
nsresult ChangeAttributeTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP ChangeAttributeTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult ChangeAttributeTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP ChangeAttributeTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -120,7 +120,7 @@ nsresult ChangeAttributeTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult ChangeAttributeTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP ChangeAttributeTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{

View File

@ -44,30 +44,30 @@ public:
* @param aValue the new value for aAttribute, if aRemoveAttribute is false
* @param aRemoveAttribute if PR_TRUE, remove aAttribute from aNode
*/
virtual nsresult Init(nsIEditor *aEditor,
nsIDOMElement *aNode,
const nsString& aAttribute,
const nsString& aValue,
PRBool aRemoveAttribute);
NS_IMETHOD Init(nsIEditor *aEditor,
nsIDOMElement *aNode,
const nsString& aAttribute,
const nsString& aValue,
PRBool aRemoveAttribute);
private:
ChangeAttributeTxn();
public:
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
virtual nsresult Redo(void);
NS_IMETHOD Redo(void);
virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
protected:

View File

@ -27,7 +27,7 @@ CreateElementTxn::CreateElementTxn()
{
}
nsresult CreateElementTxn::Init(nsIEditor *aEditor,
NS_IMETHODIMP CreateElementTxn::Init(nsIEditor *aEditor,
const nsString& aTag,
nsIDOMNode *aParent,
PRUint32 aOffsetInParent)
@ -59,7 +59,7 @@ CreateElementTxn::~CreateElementTxn()
{
}
nsresult CreateElementTxn::Do(void)
NS_IMETHODIMP CreateElementTxn::Do(void)
{
NS_ASSERTION(mEditor, "bad state -- null editor");
nsresult result = NS_ERROR_NULL_POINTER;
@ -112,7 +112,7 @@ nsresult CreateElementTxn::Do(void)
return result;
}
nsresult CreateElementTxn::Undo(void)
NS_IMETHODIMP CreateElementTxn::Undo(void)
{
nsCOMPtr<nsIDOMNode> resultNode;
nsresult result = mParent->RemoveChild(mNewNode, getter_AddRefs(resultNode));
@ -132,7 +132,7 @@ nsresult CreateElementTxn::Undo(void)
return result;
}
nsresult CreateElementTxn::Redo(void)
NS_IMETHODIMP CreateElementTxn::Redo(void)
{
nsCOMPtr<nsIDOMNode> resultNode;
nsresult result = mParent->InsertBefore(mNewNode, mRefNode, getter_AddRefs(resultNode));
@ -152,19 +152,19 @@ nsresult CreateElementTxn::Redo(void)
return result;
}
nsresult CreateElementTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP CreateElementTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
if (nsnull!=aDidMerge)
*aDidMerge=PR_FALSE;
return NS_OK;
}
nsresult CreateElementTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP CreateElementTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult CreateElementTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP CreateElementTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -174,7 +174,7 @@ nsresult CreateElementTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult CreateElementTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP CreateElementTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -184,7 +184,7 @@ nsresult CreateElementTxn::GetRedoString(nsString **aString)
return NS_OK;
}
nsresult CreateElementTxn::GetNewNode(nsIDOMNode **aNewNode)
NS_IMETHODIMP CreateElementTxn::GetNewNode(nsIDOMNode **aNewNode)
{
if (!aNewNode)
return NS_ERROR_NULL_POINTER;

View File

@ -46,10 +46,10 @@ public:
* @param aOffsetInParent the location in aParent to insert the new element
* if eAppend, the new element is appended as the last child
*/
virtual nsresult Init(nsIEditor *aEditor,
const nsString& aTag,
nsIDOMNode *aParent,
PRUint32 aOffsetInParent);
NS_IMETHOD Init(nsIEditor *aEditor,
const nsString& aTag,
nsIDOMNode *aParent,
PRUint32 aOffsetInParent);
private:
CreateElementTxn();
@ -58,21 +58,21 @@ public:
virtual ~CreateElementTxn();
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
virtual nsresult Redo(void);
NS_IMETHOD Redo(void);
virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
virtual nsresult GetNewNode(nsIDOMNode **aNewNode);
NS_IMETHOD GetNewNode(nsIDOMNode **aNewNode);
protected:

View File

@ -33,7 +33,7 @@ DeleteElementTxn::DeleteElementTxn()
{
}
nsresult DeleteElementTxn::Init(nsIDOMNode *aElement)
NS_IMETHODIMP DeleteElementTxn::Init(nsIDOMNode *aElement)
{
if (nsnull!=aElement) {
mElement = do_QueryInterface(aElement);
@ -48,7 +48,7 @@ DeleteElementTxn::~DeleteElementTxn()
{
}
nsresult DeleteElementTxn::Do(void)
NS_IMETHODIMP DeleteElementTxn::Do(void)
{
if (!mElement)
return NS_ERROR_NULL_POINTER;
@ -94,7 +94,7 @@ nsresult DeleteElementTxn::Do(void)
return result;
}
nsresult DeleteElementTxn::Undo(void)
NS_IMETHODIMP DeleteElementTxn::Undo(void)
{
if (!mParent || !mElement)
return NS_ERROR_NULL_POINTER;
@ -104,7 +104,7 @@ nsresult DeleteElementTxn::Undo(void)
return result;
}
nsresult DeleteElementTxn::Redo(void)
NS_IMETHODIMP DeleteElementTxn::Redo(void)
{
if (!mParent || !mElement)
return NS_ERROR_NULL_POINTER;
@ -114,19 +114,19 @@ nsresult DeleteElementTxn::Redo(void)
return result;
}
nsresult DeleteElementTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP DeleteElementTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
if (nsnull!=aDidMerge)
*aDidMerge=PR_FALSE;
return NS_OK;
}
nsresult DeleteElementTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP DeleteElementTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult DeleteElementTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP DeleteElementTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -135,7 +135,7 @@ nsresult DeleteElementTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult DeleteElementTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP DeleteElementTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{

View File

@ -38,7 +38,7 @@ public:
/** initialize the transaction.
* @param aElement the node to delete
*/
virtual nsresult Init(nsIDOMNode *aElement);
NS_IMETHOD Init(nsIDOMNode *aElement);
private:
DeleteElementTxn();
@ -47,19 +47,19 @@ public:
virtual ~DeleteElementTxn();
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
virtual nsresult Redo(void);
NS_IMETHOD Redo(void);
virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
protected:

View File

@ -45,7 +45,7 @@ DeleteRangeTxn::DeleteRangeTxn()
{
}
nsresult DeleteRangeTxn::Init(nsIEditor *aEditor, nsIDOMRange *aRange)
NS_IMETHODIMP DeleteRangeTxn::Init(nsIEditor *aEditor, nsIDOMRange *aRange)
{
if (aEditor && aRange)
{
@ -103,7 +103,7 @@ DeleteRangeTxn::~DeleteRangeTxn()
{
}
nsresult DeleteRangeTxn::Do(void)
NS_IMETHODIMP DeleteRangeTxn::Do(void)
{
if (!mStartParent || !mEndParent || !mCommonParent)
return NS_ERROR_NULL_POINTER;
@ -149,7 +149,7 @@ nsresult DeleteRangeTxn::Do(void)
return result;
}
nsresult DeleteRangeTxn::Undo(void)
NS_IMETHODIMP DeleteRangeTxn::Undo(void)
{
if (!mStartParent || !mEndParent || !mCommonParent)
return NS_ERROR_NULL_POINTER;
@ -168,7 +168,7 @@ nsresult DeleteRangeTxn::Undo(void)
return result;
}
nsresult DeleteRangeTxn::Redo(void)
NS_IMETHODIMP DeleteRangeTxn::Redo(void)
{
if (!mStartParent || !mEndParent || !mCommonParent)
return NS_ERROR_NULL_POINTER;
@ -187,19 +187,19 @@ nsresult DeleteRangeTxn::Redo(void)
return result;
}
nsresult DeleteRangeTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP DeleteRangeTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
if (nsnull!=aDidMerge)
*aDidMerge=PR_FALSE;
return NS_OK;
}
nsresult DeleteRangeTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP DeleteRangeTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult DeleteRangeTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP DeleteRangeTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -208,7 +208,7 @@ nsresult DeleteRangeTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult DeleteRangeTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP DeleteRangeTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -217,7 +217,7 @@ nsresult DeleteRangeTxn::GetRedoString(nsString **aString)
return NS_OK;
}
nsresult DeleteRangeTxn::CreateTxnsToDeleteBetween(nsIDOMNode *aStartParent,
NS_IMETHODIMP DeleteRangeTxn::CreateTxnsToDeleteBetween(nsIDOMNode *aStartParent,
PRUint32 aStartOffset,
PRUint32 aEndOffset)
{
@ -272,7 +272,7 @@ nsresult DeleteRangeTxn::CreateTxnsToDeleteBetween(nsIDOMNode *aStartParent,
return result;
}
nsresult DeleteRangeTxn::CreateTxnsToDeleteContent(nsIDOMNode *aParent,
NS_IMETHODIMP DeleteRangeTxn::CreateTxnsToDeleteContent(nsIDOMNode *aParent,
PRUint32 aOffset,
nsIEditor::Direction aDir)
{
@ -361,7 +361,7 @@ nsresult DeleteRangeTxn::CreateTxnsToDeleteContent(nsIDOMNode *aParent,
return result;
}
nsresult DeleteRangeTxn::CreateTxnsToDeleteNodesBetween(nsIDOMNode *aCommonParent,
NS_IMETHODIMP DeleteRangeTxn::CreateTxnsToDeleteNodesBetween(nsIDOMNode *aCommonParent,
nsIDOMNode *aFirstChild,
nsIDOMNode *aLastChild)
{
@ -509,7 +509,7 @@ nsresult DeleteRangeTxn::CreateTxnsToDeleteNodesBetween(nsIDOMNode *aCommonParen
}
// XXX: probably want to move this to editor as a standard support method
nsresult DeleteRangeTxn::BuildAncestorList(nsIDOMNode *aNode, nsISupportsArray *aList)
NS_IMETHODIMP DeleteRangeTxn::BuildAncestorList(nsIDOMNode *aNode, nsISupportsArray *aList)
{
nsresult result=NS_OK;
if (nsnull!=aNode && nsnull!=aList)

View File

@ -44,7 +44,7 @@ public:
* @param aEditor the object providing basic editing operations
* @param aRange the range to delete
*/
virtual nsresult Init(nsIEditor *aEditor, nsIDOMRange *aRange);
NS_IMETHOD Init(nsIEditor *aEditor, nsIDOMRange *aRange);
private:
DeleteRangeTxn();
@ -53,35 +53,35 @@ public:
virtual ~DeleteRangeTxn();
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
virtual nsresult Redo(void);
NS_IMETHOD Redo(void);
virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
protected:
virtual nsresult CreateTxnsToDeleteBetween(nsIDOMNode *aStartParent,
NS_IMETHOD CreateTxnsToDeleteBetween(nsIDOMNode *aStartParent,
PRUint32 aStartOffset,
PRUint32 aEndOffset);
virtual nsresult CreateTxnsToDeleteNodesBetween(nsIDOMNode *aParent,
NS_IMETHOD CreateTxnsToDeleteNodesBetween(nsIDOMNode *aParent,
nsIDOMNode *aFirstChild,
nsIDOMNode *aLastChild);
virtual nsresult CreateTxnsToDeleteContent(nsIDOMNode *aParent,
NS_IMETHOD CreateTxnsToDeleteContent(nsIDOMNode *aParent,
PRUint32 aOffset,
nsIEditor::Direction aDir);
virtual nsresult BuildAncestorList(nsIDOMNode *aNode,
NS_IMETHOD BuildAncestorList(nsIDOMNode *aNode,
nsISupportsArray *aList);
protected:

View File

@ -40,17 +40,17 @@ DeleteTableCellTxn::DeleteTableCellTxn()
{
}
nsresult DeleteTableCellTxn::Init(nsIDOMCharacterData *aElement,
NS_IMETHODIMP DeleteTableCellTxn::Init(nsIDOMCharacterData *aElement,
nsIDOMNode *aNode,
nsIPresShell* aPresShell)
{
mElement = aElement;
mElement = do_QueryInterface(aElement);
mNodeToInsert = aNode;
mPresShell = aPresShell;
return NS_OK;
}
nsresult DeleteTableCellTxn::Do(void)
NS_IMETHODIMP DeleteTableCellTxn::Do(void)
{
//nsresult res = mElement->InsertData(mOffset, mStringToInsert);
// advance caret: This requires the presentation shell to get the selection.
@ -64,7 +64,7 @@ nsresult DeleteTableCellTxn::Do(void)
return res;
}
nsresult DeleteTableCellTxn::Undo(void)
NS_IMETHODIMP DeleteTableCellTxn::Undo(void)
{
nsresult result = NS_ERROR_FAILURE;
#if 0
@ -83,7 +83,7 @@ nsresult DeleteTableCellTxn::Undo(void)
}
#if 0
nsresult DeleteTableCellTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP DeleteTableCellTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
// set out param default value
if (nsnull!=aDidMerge)
@ -134,12 +134,12 @@ nsresult DeleteTableCellTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransacti
}
#endif
nsresult DeleteTableCellTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP DeleteTableCellTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult DeleteTableCellTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP DeleteTableCellTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -148,7 +148,7 @@ nsresult DeleteTableCellTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult DeleteTableCellTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP DeleteTableCellTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -159,7 +159,7 @@ nsresult DeleteTableCellTxn::GetRedoString(nsString **aString)
/* ============= nsISupports implementation ====================== */
nsresult
NS_IMETHODIMP
DeleteTableCellTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (nsnull == aInstancePtr) {

View File

@ -49,9 +49,9 @@ public:
* @param aNode the new Table to insert
* @param aPresShell used to get and set the selection
*/
virtual nsresult Init(nsIDOMCharacterData *aElement,
nsIDOMNode *aNode,
nsIPresShell* aPresShell);
NS_IMETHOD Init(nsIDOMCharacterData *aElement,
nsIDOMNode *aNode,
nsIPresShell* aPresShell);
private:
@ -59,17 +59,17 @@ private:
public:
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
//virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
//NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
// nsISupports declarations
@ -80,7 +80,7 @@ public:
/** return the string data associated with this transaction */
// virtual nsresult GetData(nsString& aResult);
// NS_IMETHOD GetData(nsString& aResult);
/** must be called before any DeleteTableCellTxn is instantiated */
static nsresult ClassInit();

View File

@ -40,17 +40,17 @@ DeleteTableColumnTxn::DeleteTableColumnTxn()
{
}
nsresult DeleteTableColumnTxn::Init(nsIDOMCharacterData *aElement,
NS_IMETHODIMP DeleteTableColumnTxn::Init(nsIDOMCharacterData *aElement,
nsIDOMNode *aNode,
nsIPresShell* aPresShell)
{
mElement = aElement;
mElement = do_QueryInterface(aElement);
mNodeToInsert = aNode;
mPresShell = aPresShell;
return NS_OK;
}
nsresult DeleteTableColumnTxn::Do(void)
NS_IMETHODIMP DeleteTableColumnTxn::Do(void)
{
//nsresult res = mElement->InsertData(mOffset, mStringToInsert);
// advance caret: This requires the presentation shell to get the selection.
@ -64,7 +64,7 @@ nsresult DeleteTableColumnTxn::Do(void)
return res;
}
nsresult DeleteTableColumnTxn::Undo(void)
NS_IMETHODIMP DeleteTableColumnTxn::Undo(void)
{
nsresult result = NS_ERROR_FAILURE;
#if 0
@ -83,7 +83,7 @@ nsresult DeleteTableColumnTxn::Undo(void)
}
#if 0
nsresult DeleteTableColumnTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP DeleteTableColumnTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
// set out param default value
if (nsnull!=aDidMerge)
@ -134,12 +134,12 @@ nsresult DeleteTableColumnTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransac
}
#endif
nsresult DeleteTableColumnTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP DeleteTableColumnTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult DeleteTableColumnTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP DeleteTableColumnTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -148,7 +148,7 @@ nsresult DeleteTableColumnTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult DeleteTableColumnTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP DeleteTableColumnTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -159,7 +159,7 @@ nsresult DeleteTableColumnTxn::GetRedoString(nsString **aString)
/* ============= nsISupports implementation ====================== */
nsresult
NS_IMETHODIMP
DeleteTableColumnTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (nsnull == aInstancePtr) {

View File

@ -49,9 +49,9 @@ public:
* @param aNode the new Table to insert
* @param aPresShell used to get and set the selection
*/
virtual nsresult Init(nsIDOMCharacterData *aElement,
nsIDOMNode *aNode,
nsIPresShell* aPresShell);
NS_IMETHOD Init(nsIDOMCharacterData *aElement,
nsIDOMNode *aNode,
nsIPresShell* aPresShell);
private:
@ -59,17 +59,17 @@ private:
public:
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
//virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
//NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
// nsISupports declarations
@ -80,7 +80,7 @@ public:
/** return the string data associated with this transaction */
// virtual nsresult GetData(nsString& aResult);
// NS_IMETHOD GetData(nsString& aResult);
/** must be called before any DeleteTableColumnTxn is instantiated */
static nsresult ClassInit();

View File

@ -40,17 +40,17 @@ DeleteTableRowTxn::DeleteTableRowTxn()
{
}
nsresult DeleteTableRowTxn::Init(nsIDOMCharacterData *aElement,
NS_IMETHODIMP DeleteTableRowTxn::Init(nsIDOMCharacterData *aElement,
nsIDOMNode *aNode,
nsIPresShell* aPresShell)
{
mElement = aElement;
mElement = do_QueryInterface(aElement);
mNodeToInsert = aNode;
mPresShell = aPresShell;
return NS_OK;
}
nsresult DeleteTableRowTxn::Do(void)
NS_IMETHODIMP DeleteTableRowTxn::Do(void)
{
//nsresult res = mElement->InsertData(mOffset, mStringToInsert);
// advance caret: This requires the presentation shell to get the selection.
@ -64,7 +64,7 @@ nsresult DeleteTableRowTxn::Do(void)
return res;
}
nsresult DeleteTableRowTxn::Undo(void)
NS_IMETHODIMP DeleteTableRowTxn::Undo(void)
{
nsresult result = NS_ERROR_FAILURE;
#if 0
@ -83,7 +83,7 @@ nsresult DeleteTableRowTxn::Undo(void)
}
#if 0
nsresult DeleteTableRowTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP DeleteTableRowTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
// set out param default value
if (nsnull!=aDidMerge)
@ -134,12 +134,12 @@ nsresult DeleteTableRowTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransactio
}
#endif
nsresult DeleteTableRowTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP DeleteTableRowTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult DeleteTableRowTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP DeleteTableRowTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -148,7 +148,7 @@ nsresult DeleteTableRowTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult DeleteTableRowTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP DeleteTableRowTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -159,7 +159,7 @@ nsresult DeleteTableRowTxn::GetRedoString(nsString **aString)
/* ============= nsISupports implementation ====================== */
nsresult
NS_IMETHODIMP
DeleteTableRowTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (nsnull == aInstancePtr) {

View File

@ -50,9 +50,9 @@ public:
* @param aNode the new Table to insert
* @param aPresShell used to get and set the selection
*/
virtual nsresult Init(nsIDOMCharacterData *aElement,
nsIDOMNode *aNode,
nsIPresShell* aPresShell);
NS_IMETHOD Init(nsIDOMCharacterData *aElement,
nsIDOMNode *aNode,
nsIPresShell* aPresShell);
private:
@ -60,17 +60,17 @@ private:
public:
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
//virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
//NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
// nsISupports declarations
@ -81,7 +81,7 @@ public:
/** return the string data associated with this transaction */
// virtual nsresult GetData(nsString& aResult);
// NS_IMETHOD GetData(nsString& aResult);
/** must be called before any DeleteTableRowTxn is instantiated */
static nsresult ClassInit();

View File

@ -40,17 +40,17 @@ DeleteTableTxn::DeleteTableTxn()
{
}
nsresult DeleteTableTxn::Init(nsIDOMCharacterData *aElement,
NS_IMETHODIMP DeleteTableTxn::Init(nsIDOMCharacterData *aElement,
nsIDOMNode *aNode,
nsIPresShell* aPresShell)
{
mElement = aElement;
mElement = do_QueryInterface(aElement);
mNodeToInsert = aNode;
mPresShell = aPresShell;
return NS_OK;
}
nsresult DeleteTableTxn::Do(void)
NS_IMETHODIMP DeleteTableTxn::Do(void)
{
//nsresult res = mElement->InsertData(mOffset, mStringToInsert);
// advance caret: This requires the presentation shell to get the selection.
@ -64,7 +64,7 @@ nsresult DeleteTableTxn::Do(void)
return res;
}
nsresult DeleteTableTxn::Undo(void)
NS_IMETHODIMP DeleteTableTxn::Undo(void)
{
nsresult result = NS_ERROR_FAILURE;
#if 0
@ -82,12 +82,12 @@ nsresult DeleteTableTxn::Undo(void)
return result;
}
nsresult DeleteTableTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP DeleteTableTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult DeleteTableTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP DeleteTableTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -96,7 +96,7 @@ nsresult DeleteTableTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult DeleteTableTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP DeleteTableTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -107,7 +107,7 @@ nsresult DeleteTableTxn::GetRedoString(nsString **aString)
/* ============= nsISupports implementation ====================== */
nsresult
NS_IMETHODIMP
DeleteTableTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (nsnull == aInstancePtr) {

View File

@ -49,9 +49,9 @@ public:
* @param aNode the new Table to insert
* @param aPresShell used to get and set the selection
*/
virtual nsresult Init(nsIDOMCharacterData *aElement,
nsIDOMNode *aNode,
nsIPresShell* aPresShell);
NS_IMETHOD Init(nsIDOMCharacterData *aElement,
nsIDOMNode *aNode,
nsIPresShell* aPresShell);
private:
@ -59,17 +59,17 @@ private:
public:
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
//virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
//NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
// nsISupports declarations
@ -80,7 +80,7 @@ public:
/** return the string data associated with this transaction */
// virtual nsresult GetData(nsString& aResult);
// NS_IMETHOD GetData(nsString& aResult);
/** must be called before any DeleteTableTxn is instantiated */
static nsresult ClassInit();

View File

@ -26,7 +26,7 @@ DeleteTextTxn::DeleteTextTxn()
{
}
nsresult DeleteTextTxn::Init(nsIEditor *aEditor,
NS_IMETHODIMP DeleteTextTxn::Init(nsIEditor *aEditor,
nsIDOMCharacterData *aElement,
PRUint32 aOffset,
PRUint32 aNumCharsToDelete)
@ -40,7 +40,7 @@ nsresult DeleteTextTxn::Init(nsIEditor *aEditor,
return NS_OK;
}
nsresult DeleteTextTxn::Do(void)
NS_IMETHODIMP DeleteTextTxn::Do(void)
{
nsresult result = NS_ERROR_NULL_POINTER;
if (mEditor && mElement)
@ -66,7 +66,7 @@ nsresult DeleteTextTxn::Do(void)
//XXX: we may want to store the selection state and restore it properly
// was it an insertion point or an extended selection?
nsresult DeleteTextTxn::Undo(void)
NS_IMETHODIMP DeleteTextTxn::Undo(void)
{
nsresult result = NS_ERROR_NULL_POINTER;
if (mEditor && mElement)
@ -87,19 +87,19 @@ nsresult DeleteTextTxn::Undo(void)
return result;
}
nsresult DeleteTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP DeleteTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
if (nsnull!=aDidMerge)
*aDidMerge=PR_FALSE;
return NS_OK;
}
nsresult DeleteTextTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP DeleteTextTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult DeleteTextTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP DeleteTextTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -109,7 +109,7 @@ nsresult DeleteTextTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult DeleteTextTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP DeleteTextTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{

View File

@ -42,27 +42,27 @@ public:
* @param aOffset the location in aElement to begin the deletion
* @param aNumCharsToDelete the number of characters to delete. Not the number of bytes!
*/
virtual nsresult Init(nsIEditor *aEditor,
nsIDOMCharacterData *aElement,
PRUint32 aOffset,
PRUint32 aNumCharsToDelete);
NS_IMETHOD Init(nsIEditor *aEditor,
nsIDOMCharacterData *aElement,
PRUint32 aOffset,
PRUint32 aNumCharsToDelete);
private:
DeleteTextTxn();
public:
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
protected:

View File

@ -43,7 +43,7 @@ EditAggregateTxn::~EditAggregateTxn()
}
}
nsresult EditAggregateTxn::Do(void)
NS_IMETHODIMP EditAggregateTxn::Do(void)
{
nsresult result=NS_OK; // it's legal (but not very useful) to have an empty child list
if (nsnull!=mChildren)
@ -61,7 +61,7 @@ nsresult EditAggregateTxn::Do(void)
return result;
}
nsresult EditAggregateTxn::Undo(void)
NS_IMETHODIMP EditAggregateTxn::Undo(void)
{
nsresult result=NS_OK; // it's legal (but not very useful) to have an empty child list
if (nsnull!=mChildren)
@ -80,7 +80,7 @@ nsresult EditAggregateTxn::Undo(void)
return result;
}
nsresult EditAggregateTxn::Redo(void)
NS_IMETHODIMP EditAggregateTxn::Redo(void)
{
nsresult result=NS_OK; // it's legal (but not very useful) to have an empty child list
if (nsnull!=mChildren)
@ -98,14 +98,14 @@ nsresult EditAggregateTxn::Redo(void)
return result;
}
nsresult EditAggregateTxn::GetIsTransient(PRBool *aIsTransient)
NS_IMETHODIMP EditAggregateTxn::GetIsTransient(PRBool *aIsTransient)
{
if (nsnull!=aIsTransient)
*aIsTransient = PR_FALSE;
return NS_OK;
}
nsresult EditAggregateTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP EditAggregateTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
nsresult result=NS_OK; // it's legal (but not very useful) to have an empty child list
if (nsnull!=aDidMerge)
@ -124,26 +124,26 @@ nsresult EditAggregateTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction
}
nsresult EditAggregateTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP EditAggregateTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult EditAggregateTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP EditAggregateTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
*aString=nsnull;
return NS_OK;
}
nsresult EditAggregateTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP EditAggregateTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
*aString=nsnull;
return NS_OK;
}
nsresult EditAggregateTxn::AppendChild(EditTxn *aTxn)
NS_IMETHODIMP EditAggregateTxn::AppendChild(EditTxn *aTxn)
{
if ((nsnull!=mChildren) && (nsnull!=aTxn))
{
@ -153,13 +153,13 @@ nsresult EditAggregateTxn::AppendChild(EditTxn *aTxn)
return NS_ERROR_NULL_POINTER;
}
nsresult EditAggregateTxn::SetName(nsIAtom *aName)
NS_IMETHODIMP EditAggregateTxn::SetName(nsIAtom *aName)
{
mName = do_QueryInterface(aName);
return NS_OK;
}
nsresult EditAggregateTxn::GetName(nsIAtom **aName)
NS_IMETHODIMP EditAggregateTxn::GetName(nsIAtom **aName)
{
if (aName)
{
@ -173,7 +173,7 @@ nsresult EditAggregateTxn::GetName(nsIAtom **aName)
return NS_ERROR_NULL_POINTER;
}
nsresult EditAggregateTxn::GetCount(PRInt32 *aCount)
NS_IMETHODIMP EditAggregateTxn::GetCount(PRInt32 *aCount)
{
if (!aCount) {
return NS_ERROR_NULL_POINTER;
@ -185,7 +185,7 @@ nsresult EditAggregateTxn::GetCount(PRInt32 *aCount)
return NS_OK;
}
nsresult EditAggregateTxn::GetTxnAt(PRInt32 aIndex, EditTxn **aTxn)
NS_IMETHODIMP EditAggregateTxn::GetTxnAt(PRInt32 aIndex, EditTxn **aTxn)
{
if (!aTxn) {
return NS_ERROR_NULL_POINTER;

View File

@ -42,40 +42,40 @@ public:
virtual ~EditAggregateTxn();
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
virtual nsresult Redo(void);
NS_IMETHOD Redo(void);
virtual nsresult GetIsTransient(PRBool *aIsTransient);
NS_IMETHOD GetIsTransient(PRBool *aIsTransient);
virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
/** append a transaction to this aggregate */
virtual nsresult AppendChild(EditTxn *aTxn);
NS_IMETHOD AppendChild(EditTxn *aTxn);
/** get the number of nested txns.
* This is the number of top-level txns, it does not do recursive decent.
*/
virtual nsresult GetCount(PRInt32 *aCount);
NS_IMETHOD GetCount(PRInt32 *aCount);
/** get the txn at index aIndex.
* returns NS_ERROR_UNEXPECTED if there is no txn at aIndex.
*/
virtual nsresult GetTxnAt(PRInt32 aIndex, EditTxn **aTxn);
NS_IMETHOD GetTxnAt(PRInt32 aIndex, EditTxn **aTxn);
/** set the name assigned to this aggregate txn */
virtual nsresult SetName(nsIAtom *aName);
NS_IMETHOD SetName(nsIAtom *aName);
/** get the name assigned to this aggregate txn */
virtual nsresult GetName(nsIAtom **aName);
NS_IMETHOD GetName(nsIAtom **aName);
protected:

View File

@ -76,7 +76,7 @@ static NS_DEFINE_IID(kJoinTableCellsTxnIID, JOIN_CELLS_TXN_IID);
// Table Editing methods -- for testing, hooked up to Tool Menu items
// Modeled after nsEditor::InsertText()
nsresult nsHTMLEditor::InsertTable()
NS_IMETHODIMP nsHTMLEditor::InsertTable()
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
#if 0
@ -132,7 +132,7 @@ nsresult nsHTMLEditor::InsertTable()
#endif
}
nsresult nsHTMLEditor::CreateTxnForInsertTable(const nsIDOMElement *aTableNode, InsertTableTxn ** aTxn)
NS_IMETHODIMP nsHTMLEditor::CreateTxnForInsertTable(const nsIDOMElement *aTableNode, InsertTableTxn ** aTxn)
{
if (mEditor==nsnull)
{
@ -191,7 +191,7 @@ nsresult nsHTMLEditor::CreateTxnForInsertTable(const nsIDOMElement *aTableNode,
return result;
}
nsresult nsHTMLEditor::InsertTableCell(PRInt32 aNumber, PRBool aAfter)
NS_IMETHODIMP nsHTMLEditor::InsertTableCell(PRInt32 aNumber, PRBool aAfter)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -201,7 +201,7 @@ nsresult nsHTMLEditor::InsertTableCell(PRInt32 aNumber, PRBool aAfter)
return result;
}
nsresult nsHTMLEditor::InsertTableColumn(PRInt32 aNumber, PRBool aAfter)
NS_IMETHODIMP nsHTMLEditor::InsertTableColumn(PRInt32 aNumber, PRBool aAfter)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -211,7 +211,7 @@ nsresult nsHTMLEditor::InsertTableColumn(PRInt32 aNumber, PRBool aAfter)
return result;
}
nsresult nsHTMLEditor::InsertTableRow(PRInt32 aNumber, PRBool aAfter)
NS_IMETHODIMP nsHTMLEditor::InsertTableRow(PRInt32 aNumber, PRBool aAfter)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -221,7 +221,7 @@ nsresult nsHTMLEditor::InsertTableRow(PRInt32 aNumber, PRBool aAfter)
return result;
}
nsresult nsHTMLEditor::DeleteTable()
NS_IMETHODIMP nsHTMLEditor::DeleteTable()
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -231,7 +231,7 @@ nsresult nsHTMLEditor::DeleteTable()
return result;
}
nsresult nsHTMLEditor::DeleteTableCell(PRInt32 aNumber)
NS_IMETHODIMP nsHTMLEditor::DeleteTableCell(PRInt32 aNumber)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -241,7 +241,7 @@ nsresult nsHTMLEditor::DeleteTableCell(PRInt32 aNumber)
return result;
}
nsresult nsHTMLEditor::DeleteTableColumn(PRInt32 aNumber)
NS_IMETHODIMP nsHTMLEditor::DeleteTableColumn(PRInt32 aNumber)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -251,7 +251,7 @@ nsresult nsHTMLEditor::DeleteTableColumn(PRInt32 aNumber)
return result;
}
nsresult nsHTMLEditor::DeleteTableRow(PRInt32 aNumber)
NS_IMETHODIMP nsHTMLEditor::DeleteTableRow(PRInt32 aNumber)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -261,7 +261,7 @@ nsresult nsHTMLEditor::DeleteTableRow(PRInt32 aNumber)
return result;
}
nsresult nsHTMLEditor::JoinTableCells(PRBool aCellToRight)
NS_IMETHODIMP nsHTMLEditor::JoinTableCells(PRBool aCellToRight)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -271,7 +271,7 @@ nsresult nsHTMLEditor::JoinTableCells(PRBool aCellToRight)
return result;
}
nsresult nsHTMLEditor::GetColIndexForCell(nsIDOMNode *aCellNode, PRInt32 &aCellIndex)
NS_IMETHODIMP nsHTMLEditor::GetColIndexForCell(nsIDOMNode *aCellNode, PRInt32 &aCellIndex)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -295,7 +295,7 @@ nsresult nsHTMLEditor::GetColIndexForCell(nsIDOMNode *aCellNode, PRInt32 &aCellI
return result;
}
nsresult nsHTMLEditor::GetRowIndexForCell(nsIDOMNode *aCellNode, PRInt32 &aCellIndex)
NS_IMETHODIMP nsHTMLEditor::GetRowIndexForCell(nsIDOMNode *aCellNode, PRInt32 &aCellIndex)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -306,7 +306,7 @@ nsresult nsHTMLEditor::GetRowIndexForCell(nsIDOMNode *aCellNode, PRInt32 &aCellI
}
nsresult nsHTMLEditor::GetFirstCellInColumn(nsIDOMNode *aCurrentCellNode, nsIDOMNode* &aFirstCellNode)
NS_IMETHODIMP nsHTMLEditor::GetFirstCellInColumn(nsIDOMNode *aCurrentCellNode, nsIDOMNode* &aFirstCellNode)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -317,7 +317,7 @@ nsresult nsHTMLEditor::GetFirstCellInColumn(nsIDOMNode *aCurrentCellNode, nsIDOM
}
nsresult nsHTMLEditor::GetNextCellInColumn(nsIDOMNode *aCurrentCellNode, nsIDOMNode* &aNextCellNode)
NS_IMETHODIMP nsHTMLEditor::GetNextCellInColumn(nsIDOMNode *aCurrentCellNode, nsIDOMNode* &aNextCellNode)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -328,7 +328,7 @@ nsresult nsHTMLEditor::GetNextCellInColumn(nsIDOMNode *aCurrentCellNode, nsIDOMN
}
nsresult nsHTMLEditor::GetFirstCellInRow(nsIDOMNode *aCurrentCellNode, nsIDOMNode* &aCellNode)
NS_IMETHODIMP nsHTMLEditor::GetFirstCellInRow(nsIDOMNode *aCurrentCellNode, nsIDOMNode* &aCellNode)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -339,7 +339,7 @@ nsresult nsHTMLEditor::GetFirstCellInRow(nsIDOMNode *aCurrentCellNode, nsIDOMNod
}
nsresult nsHTMLEditor::GetNextCellInRow(nsIDOMNode *aCurrentCellNode, nsIDOMNode* &aNextCellNode)
NS_IMETHODIMP nsHTMLEditor::GetNextCellInRow(nsIDOMNode *aCurrentCellNode, nsIDOMNode* &aNextCellNode)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)

View File

@ -33,53 +33,53 @@ EditTxn::EditTxn()
NS_INIT_REFCNT();
}
nsresult EditTxn::Do(void)
NS_IMETHODIMP EditTxn::Do(void)
{
return NS_OK;
}
nsresult EditTxn::Undo(void)
NS_IMETHODIMP EditTxn::Undo(void)
{
return NS_OK;
}
nsresult EditTxn::Redo(void)
NS_IMETHODIMP EditTxn::Redo(void)
{
return Do();
}
nsresult EditTxn::GetIsTransient(PRBool *aIsTransient)
NS_IMETHODIMP EditTxn::GetIsTransient(PRBool *aIsTransient)
{
if (nsnull!=aIsTransient)
*aIsTransient = PR_FALSE;
return NS_OK;
}
nsresult EditTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP EditTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
return NS_OK;
}
nsresult EditTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP EditTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult EditTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP EditTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
*aString=nsnull;
return NS_OK;
}
nsresult EditTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP EditTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
*aString=nsnull;
return NS_OK;
}
nsresult
NS_IMETHODIMP
EditTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {

View File

@ -40,21 +40,21 @@ public:
EditTxn();
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
virtual nsresult Redo(void);
NS_IMETHOD Redo(void);
virtual nsresult GetIsTransient(PRBool *aIsTransient);
NS_IMETHOD GetIsTransient(PRBool *aIsTransient);
virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
};

View File

@ -30,9 +30,9 @@ InsertElementTxn::InsertElementTxn()
{
}
nsresult InsertElementTxn::Init(nsIDOMNode *aNode,
nsIDOMNode *aParent,
PRInt32 aOffset)
NS_IMETHODIMP InsertElementTxn::Init(nsIDOMNode *aNode,
nsIDOMNode *aParent,
PRInt32 aOffset)
{
if (!aNode || !aParent)
return NS_ERROR_NULL_POINTER;
@ -48,7 +48,7 @@ InsertElementTxn::~InsertElementTxn()
{
}
nsresult InsertElementTxn::Do(void)
NS_IMETHODIMP InsertElementTxn::Do(void)
{
if (!mNode || !mParent)
return NS_ERROR_NULL_POINTER;
@ -78,7 +78,7 @@ nsresult InsertElementTxn::Do(void)
return result;
}
nsresult InsertElementTxn::Undo(void)
NS_IMETHODIMP InsertElementTxn::Undo(void)
{
if (!mNode || !mParent)
return NS_ERROR_NULL_POINTER;
@ -88,19 +88,19 @@ nsresult InsertElementTxn::Undo(void)
return result;
}
nsresult InsertElementTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP InsertElementTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
if (nsnull!=aDidMerge)
*aDidMerge=PR_FALSE;
return NS_OK;
}
nsresult InsertElementTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP InsertElementTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult InsertElementTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP InsertElementTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -109,7 +109,7 @@ nsresult InsertElementTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult InsertElementTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP InsertElementTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{

View File

@ -40,9 +40,9 @@ public:
* @param aParent the node to insert into
* @param aOffset the offset in aParent to insert aNode
*/
virtual nsresult Init(nsIDOMNode *aNode,
nsIDOMNode *aParent,
PRInt32 aOffset);
NS_IMETHOD Init(nsIDOMNode *aNode,
nsIDOMNode *aParent,
PRInt32 aOffset);
private:
InsertElementTxn();
@ -51,17 +51,17 @@ public:
virtual ~InsertElementTxn();
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
protected:

View File

@ -40,19 +40,19 @@ InsertTableCellTxn::InsertTableCellTxn()
{
}
nsresult InsertTableCellTxn::Init(nsIDOMCharacterData *aElement,
NS_IMETHODIMP InsertTableCellTxn::Init(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
nsIDOMNode *aNode,
nsIPresShell* aPresShell)
{
mElement = aElement;
mElement = do_QueryInterface(aElement);
mOffset = aOffset;
mNodeToInsert = aNode;
mPresShell = aPresShell;
return NS_OK;
}
nsresult InsertTableCellTxn::Do(void)
NS_IMETHODIMP InsertTableCellTxn::Do(void)
{
//nsresult res = mElement->InsertData(mOffset, mStringToInsert);
// advance caret: This requires the presentation shell to get the selection.
@ -66,7 +66,7 @@ nsresult InsertTableCellTxn::Do(void)
return res;
}
nsresult InsertTableCellTxn::Undo(void)
NS_IMETHODIMP InsertTableCellTxn::Undo(void)
{
nsresult result = NS_ERROR_FAILURE;
#if 0
@ -85,7 +85,7 @@ nsresult InsertTableCellTxn::Undo(void)
}
#if 0
nsresult InsertTableCellTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP InsertTableCellTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
// set out param default value
if (nsnull!=aDidMerge)
@ -136,12 +136,12 @@ nsresult InsertTableCellTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransacti
}
#endif
nsresult InsertTableCellTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP InsertTableCellTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult InsertTableCellTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP InsertTableCellTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -150,7 +150,7 @@ nsresult InsertTableCellTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult InsertTableCellTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP InsertTableCellTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -161,7 +161,7 @@ nsresult InsertTableCellTxn::GetRedoString(nsString **aString)
/* ============= nsISupports implementation ====================== */
nsresult
NS_IMETHODIMP
InsertTableCellTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (nsnull == aInstancePtr) {

View File

@ -50,10 +50,10 @@ public:
* @param aNode the new Table to insert
* @param aPresShell used to get and set the selection
*/
virtual nsresult Init(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
nsIDOMNode *aNode,
nsIPresShell* aPresShell);
NS_IMETHOD Init(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
nsIDOMNode *aNode,
nsIPresShell* aPresShell);
private:
@ -61,17 +61,17 @@ private:
public:
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
//virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
//NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
// nsISupports declarations
@ -82,7 +82,7 @@ public:
/** return the string data associated with this transaction */
// virtual nsresult GetData(nsString& aResult);
// NS_IMETHOD GetData(nsString& aResult);
/** must be called before any InsertTableCellTxn is instantiated */
static nsresult ClassInit();

View File

@ -40,19 +40,19 @@ InsertTableColumnTxn::InsertTableColumnTxn()
{
}
nsresult InsertTableColumnTxn::Init(nsIDOMCharacterData *aElement,
NS_IMETHODIMP InsertTableColumnTxn::Init(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
nsIDOMNode *aNode,
nsIPresShell* aPresShell)
{
mElement = aElement;
mOffset = aOffset;
mElement = do_QueryInterface(aElement);
mOffset = aOffset;
mNodeToInsert = aNode;
mPresShell = aPresShell;
return NS_OK;
}
nsresult InsertTableColumnTxn::Do(void)
NS_IMETHODIMP InsertTableColumnTxn::Do(void)
{
//nsresult res = mElement->InsertData(mOffset, mStringToInsert);
// advance caret: This requires the presentation shell to get the selection.
@ -66,7 +66,7 @@ nsresult InsertTableColumnTxn::Do(void)
return res;
}
nsresult InsertTableColumnTxn::Undo(void)
NS_IMETHODIMP InsertTableColumnTxn::Undo(void)
{
nsresult result = NS_ERROR_FAILURE;
#if 0
@ -85,7 +85,7 @@ nsresult InsertTableColumnTxn::Undo(void)
}
#if 0
nsresult InsertTableColumnTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP InsertTableColumnTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
// set out param default value
if (nsnull!=aDidMerge)
@ -136,12 +136,12 @@ nsresult InsertTableColumnTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransac
}
#endif
nsresult InsertTableColumnTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP InsertTableColumnTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult InsertTableColumnTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP InsertTableColumnTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -150,7 +150,7 @@ nsresult InsertTableColumnTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult InsertTableColumnTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP InsertTableColumnTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -161,7 +161,7 @@ nsresult InsertTableColumnTxn::GetRedoString(nsString **aString)
/* ============= nsISupports implementation ====================== */
nsresult
NS_IMETHODIMP
InsertTableColumnTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (nsnull == aInstancePtr) {

View File

@ -51,10 +51,10 @@ public:
* @param aNode the new Table to insert
* @param aPresShell used to get and set the selection
*/
virtual nsresult Init(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
nsIDOMNode *aNode,
nsIPresShell* aPresShell);
NS_IMETHOD Init(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
nsIDOMNode *aNode,
nsIPresShell* aPresShell);
private:
@ -62,17 +62,17 @@ private:
public:
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
//virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
//NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
// nsISupports declarations
@ -83,7 +83,7 @@ public:
/** return the string data associated with this transaction */
// virtual nsresult GetData(nsString& aResult);
// NS_IMETHOD GetData(nsString& aResult);
/** must be called before any InsertTableColumnTxn is instantiated */
static nsresult ClassInit();

View File

@ -40,19 +40,19 @@ InsertTableRowTxn::InsertTableRowTxn()
{
}
nsresult InsertTableRowTxn::Init(nsIDOMCharacterData *aElement,
NS_IMETHODIMP InsertTableRowTxn::Init(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
nsIDOMNode *aNode,
nsIPresShell* aPresShell)
{
mElement = aElement;
mElement = do_QueryInterface(aElement);
mOffset = aOffset;
mNodeToInsert = aNode;
mPresShell = aPresShell;
return NS_OK;
}
nsresult InsertTableRowTxn::Do(void)
NS_IMETHODIMP InsertTableRowTxn::Do(void)
{
//nsresult res = mElement->InsertData(mOffset, mStringToInsert);
// advance caret: This requires the presentation shell to get the selection.
@ -66,7 +66,7 @@ nsresult InsertTableRowTxn::Do(void)
return res;
}
nsresult InsertTableRowTxn::Undo(void)
NS_IMETHODIMP InsertTableRowTxn::Undo(void)
{
nsresult result = NS_ERROR_FAILURE;
#if 0
@ -85,7 +85,7 @@ nsresult InsertTableRowTxn::Undo(void)
}
#if 0
nsresult InsertTableRowTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP InsertTableRowTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
// set out param default value
if (nsnull!=aDidMerge)
@ -136,12 +136,12 @@ nsresult InsertTableRowTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransactio
}
#endif
nsresult InsertTableRowTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP InsertTableRowTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult InsertTableRowTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP InsertTableRowTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -150,7 +150,7 @@ nsresult InsertTableRowTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult InsertTableRowTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP InsertTableRowTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -161,7 +161,7 @@ nsresult InsertTableRowTxn::GetRedoString(nsString **aString)
/* ============= nsISupports implementation ====================== */
nsresult
NS_IMETHODIMP
InsertTableRowTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (nsnull == aInstancePtr) {

View File

@ -51,10 +51,10 @@ public:
* @param aNode the new Table to insert
* @param aPresShell used to get and set the selection
*/
virtual nsresult Init(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
nsIDOMNode *aNode,
nsIPresShell* aPresShell);
NS_IMETHOD Init(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
nsIDOMNode *aNode,
nsIPresShell* aPresShell);
private:
@ -62,17 +62,17 @@ private:
public:
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
//virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
//NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
// nsISupports declarations
@ -83,7 +83,7 @@ public:
/** return the string data associated with this transaction */
// virtual nsresult GetData(nsString& aResult);
// NS_IMETHOD GetData(nsString& aResult);
/** must be called before any InsertTableRowTxn is instantiated */
static nsresult ClassInit();

View File

@ -40,19 +40,19 @@ InsertTableTxn::InsertTableTxn()
{
}
nsresult InsertTableTxn::Init(nsIDOMCharacterData *aElement,
NS_IMETHODIMP InsertTableTxn::Init(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
nsIDOMNode *aNode,
nsIPresShell* aPresShell)
{
mElement = aElement;
mElement = do_QueryInterface(aElement);
mOffset = aOffset;
mTableToInsert = aNode;
mPresShell = aPresShell;
return NS_OK;
}
nsresult InsertTableTxn::Do(void)
NS_IMETHODIMP InsertTableTxn::Do(void)
{
//nsresult res = mElement->InsertData(mOffset, mStringToInsert);
// advance caret: This requires the presentation shell to get the selection.
@ -66,7 +66,7 @@ nsresult InsertTableTxn::Do(void)
return res;
}
nsresult InsertTableTxn::Undo(void)
NS_IMETHODIMP InsertTableTxn::Undo(void)
{
nsresult result = NS_ERROR_FAILURE;
#if 0
@ -84,7 +84,7 @@ nsresult InsertTableTxn::Undo(void)
return result;
}
nsresult InsertTableTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP InsertTableTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
#if 0
// set out param default value
@ -136,12 +136,12 @@ nsresult InsertTableTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
return NS_OK;
}
nsresult InsertTableTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP InsertTableTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult InsertTableTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP InsertTableTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -150,7 +150,7 @@ nsresult InsertTableTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult InsertTableTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP InsertTableTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -161,7 +161,7 @@ nsresult InsertTableTxn::GetRedoString(nsString **aString)
/* ============= nsISupports implementation ====================== */
nsresult
NS_IMETHODIMP
InsertTableTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (nsnull == aInstancePtr) {

View File

@ -50,10 +50,10 @@ public:
* @param aNode the new Table to insert
* @param aPresShell used to get and set the selection
*/
virtual nsresult Init(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
nsIDOMNode *aNode,
nsIPresShell* aPresShell);
NS_IMETHOD Init(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
nsIDOMNode *aNode,
nsIPresShell* aPresShell);
private:
@ -61,17 +61,17 @@ private:
public:
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
// nsISupports declarations
@ -82,7 +82,7 @@ public:
/** return the string data associated with this transaction */
// virtual nsresult GetData(nsString& aResult);
// NS_IMETHOD GetData(nsString& aResult);
/** must be called before any InsertTableTxn is instantiated */
static nsresult ClassInit();

View File

@ -40,7 +40,7 @@ InsertTextTxn::InsertTextTxn()
{
}
nsresult InsertTextTxn::Init(nsIDOMCharacterData *aElement,
NS_IMETHODIMP InsertTextTxn::Init(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
const nsString& aStringToInsert,
nsIPresShell* aPresShell)
@ -52,7 +52,7 @@ nsresult InsertTextTxn::Init(nsIDOMCharacterData *aElement,
return NS_OK;
}
nsresult InsertTextTxn::Do(void)
NS_IMETHODIMP InsertTextTxn::Do(void)
{
// advance caret: This requires the presentation shell to get the selection.
nsCOMPtr<nsIDOMSelection> selection;
@ -70,7 +70,7 @@ nsresult InsertTextTxn::Do(void)
return result;
}
nsresult InsertTextTxn::Undo(void)
NS_IMETHODIMP InsertTextTxn::Undo(void)
{
nsresult result;
PRUint32 length = mStringToInsert.Length();
@ -89,7 +89,7 @@ nsresult InsertTextTxn::Undo(void)
return result;
}
nsresult InsertTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP InsertTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
// set out param default value
if (nsnull!=aDidMerge)
@ -141,12 +141,12 @@ nsresult InsertTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
return result;
}
nsresult InsertTextTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP InsertTextTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult InsertTextTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP InsertTextTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -156,7 +156,7 @@ nsresult InsertTextTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult InsertTextTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP InsertTextTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -168,7 +168,7 @@ nsresult InsertTextTxn::GetRedoString(nsString **aString)
/* ============= nsISupports implementation ====================== */
nsresult
NS_IMETHODIMP
InsertTextTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (nsnull == aInstancePtr) {
@ -184,7 +184,7 @@ InsertTextTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr)
/* ============ protected methods ================== */
nsresult InsertTextTxn::GetData(nsString& aResult)
NS_IMETHODIMP InsertTextTxn::GetData(nsString& aResult)
{
aResult = mStringToInsert;
return NS_OK;

View File

@ -48,10 +48,10 @@ public:
* @param aString the new text to insert
* @param aPresShell used to get and set the selection
*/
virtual nsresult Init(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
const nsString& aString,
nsIPresShell* aPresShell);
NS_IMETHOD Init(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
const nsString& aString,
nsIPresShell* aPresShell);
private:
@ -59,17 +59,17 @@ private:
public:
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
// nsISupports declarations
@ -80,7 +80,7 @@ public:
/** return the string data associated with this transaction */
virtual nsresult GetData(nsString& aResult);
NS_IMETHOD GetData(nsString& aResult);
/** must be called before any InsertTextTxn is instantiated */
static nsresult ClassInit();

View File

@ -28,7 +28,7 @@ JoinElementTxn::JoinElementTxn()
{
}
nsresult JoinElementTxn::Init(nsIEditor *aEditor,
NS_IMETHODIMP JoinElementTxn::Init(nsIEditor *aEditor,
nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode)
{
@ -43,7 +43,7 @@ JoinElementTxn::~JoinElementTxn()
{
}
nsresult JoinElementTxn::Do(void)
NS_IMETHODIMP JoinElementTxn::Do(void)
{
nsresult result;
@ -82,7 +82,7 @@ nsresult JoinElementTxn::Do(void)
}
nsresult JoinElementTxn::Undo(void)
NS_IMETHODIMP JoinElementTxn::Undo(void)
{
nsresult result;
nsCOMPtr<nsIEditorSupport> editor;
@ -96,13 +96,13 @@ nsresult JoinElementTxn::Undo(void)
return result;
}
nsresult JoinElementTxn::Redo(void)
NS_IMETHODIMP JoinElementTxn::Redo(void)
{
nsresult result = mEditor->JoinNodes(mLeftNode, mRightNode, mParent, PR_FALSE);
return result;
}
nsresult JoinElementTxn::GetIsTransient(PRBool *aIsTransient)
NS_IMETHODIMP JoinElementTxn::GetIsTransient(PRBool *aIsTransient)
{
if (nsnull!=aIsTransient)
*aIsTransient = PR_FALSE;
@ -116,12 +116,12 @@ nsresult JoinElementTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
return NS_OK;
}
nsresult JoinElementTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP JoinElementTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult JoinElementTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP JoinElementTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -130,7 +130,7 @@ nsresult JoinElementTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult JoinElementTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP JoinElementTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{

View File

@ -43,9 +43,9 @@ public:
* @param aLeftNode the first of two nodes to join
* @param aRightNode the second of two nodes to join
*/
virtual nsresult Init(nsIEditor *aEditor,
nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode);
NS_IMETHOD Init(nsIEditor *aEditor,
nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode);
protected:
JoinElementTxn();
@ -53,21 +53,21 @@ public:
virtual ~JoinElementTxn();
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
virtual nsresult Redo(void);
NS_IMETHOD Redo(void);
virtual nsresult GetIsTransient(PRBool *aIsTransient);
NS_IMETHOD GetIsTransient(PRBool *aIsTransient);
virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
protected:

View File

@ -40,17 +40,17 @@ JoinTableCellsTxn::JoinTableCellsTxn()
{
}
nsresult JoinTableCellsTxn::Init(nsIDOMCharacterData *aElement,
NS_IMETHODIMP JoinTableCellsTxn::Init(nsIDOMCharacterData *aElement,
nsIDOMNode *aNode,
nsIPresShell* aPresShell)
{
mElement = aElement;
mElement = do_QueryInterface(aElement);
mNodeToInsert = aNode;
mPresShell = aPresShell;
return NS_OK;
}
nsresult JoinTableCellsTxn::Do(void)
NS_IMETHODIMP JoinTableCellsTxn::Do(void)
{
//nsresult res = mElement->InsertData(mOffset, mStringToInsert);
// advance caret: This requires the presentation shell to get the selection.
@ -64,7 +64,7 @@ nsresult JoinTableCellsTxn::Do(void)
return res;
}
nsresult JoinTableCellsTxn::Undo(void)
NS_IMETHODIMP JoinTableCellsTxn::Undo(void)
{
nsresult result = NS_ERROR_FAILURE;
#if 0
@ -82,12 +82,12 @@ nsresult JoinTableCellsTxn::Undo(void)
return result;
}
nsresult JoinTableCellsTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP JoinTableCellsTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult JoinTableCellsTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP JoinTableCellsTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -96,7 +96,7 @@ nsresult JoinTableCellsTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult JoinTableCellsTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP JoinTableCellsTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -107,7 +107,7 @@ nsresult JoinTableCellsTxn::GetRedoString(nsString **aString)
/* ============= nsISupports implementation ====================== */
nsresult
NS_IMETHODIMP
JoinTableCellsTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (nsnull == aInstancePtr) {

View File

@ -48,9 +48,9 @@ public:
* @param aNode the new Table to insert
* @param aPresShell used to get and set the selection
*/
virtual nsresult Init(nsIDOMCharacterData *aElement,
nsIDOMNode *aNode,
nsIPresShell* aPresShell);
NS_IMETHOD Init(nsIDOMCharacterData *aElement,
nsIDOMNode *aNode,
nsIPresShell* aPresShell);
private:
@ -58,17 +58,17 @@ private:
public:
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
//virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
//NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
// nsISupports declarations
@ -79,7 +79,7 @@ public:
/** return the string data associated with this transaction */
// virtual nsresult GetData(nsString& aResult);
// NS_IMETHOD GetData(nsString& aResult);
/** must be called before any JoinTableCellsTxn is instantiated */
static nsresult ClassInit();

View File

@ -30,10 +30,22 @@ CPPSRCS = \
nsEditorEventListeners.cpp \
nsEditProperty.cpp \
nsEditFactory.cpp \
nsHTMLEditFactory.cpp \
nsHTMLEditor.cpp \
nsTextEditFactory.cpp \
ChangeAttributeTxn.cpp \
EditTxn.cpp \
EditAggregateTxn.cpp \
EditTable.cpp \
InsertTableTxn.cpp \
InsertTableCellTxn.cpp \
InsertTableColumnTxn.cpp \
InsertTableRowTxn.cpp \
DeleteTableTxn.cpp \
DeleteTableCellTxn.cpp \
DeleteTableColumnTxn.cpp \
DeleteTableRowTxn.cpp \
JoinTableCellsTxn.cpp \
InsertTextTxn.cpp \
DeleteTextTxn.cpp \
CreateElementTxn.cpp \

View File

@ -29,7 +29,7 @@ SplitElementTxn::SplitElementTxn()
{
}
nsresult SplitElementTxn::Init(nsIEditor *aEditor,
NS_IMETHODIMP SplitElementTxn::Init(nsIEditor *aEditor,
nsIDOMNode *aNode,
PRInt32 aOffset)
{
@ -43,7 +43,7 @@ SplitElementTxn::~SplitElementTxn()
{
}
nsresult SplitElementTxn::Do(void)
NS_IMETHODIMP SplitElementTxn::Do(void)
{
// create a new node
nsresult result = mExistingRightNode->CloneNode(PR_FALSE, getter_AddRefs(mNewLeftNode));
@ -69,7 +69,7 @@ nsresult SplitElementTxn::Do(void)
return result;
}
nsresult SplitElementTxn::Undo(void)
NS_IMETHODIMP SplitElementTxn::Undo(void)
{
// this assumes Do inserted the new node in front of the prior existing node
nsresult result;
@ -84,7 +84,7 @@ nsresult SplitElementTxn::Undo(void)
return result;
}
nsresult SplitElementTxn::Redo(void)
NS_IMETHODIMP SplitElementTxn::Redo(void)
{
nsresult result;
nsCOMPtr<nsIEditorSupport> editor;
@ -98,19 +98,19 @@ nsresult SplitElementTxn::Redo(void)
return result;
}
nsresult SplitElementTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP SplitElementTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
if (nsnull!=aDidMerge)
*aDidMerge=PR_FALSE;
return NS_OK;
}
nsresult SplitElementTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP SplitElementTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult SplitElementTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP SplitElementTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -119,7 +119,7 @@ nsresult SplitElementTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult SplitElementTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP SplitElementTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -128,7 +128,7 @@ nsresult SplitElementTxn::GetRedoString(nsString **aString)
return NS_OK;
}
nsresult SplitElementTxn::GetNewNode(nsIDOMNode **aNewNode)
NS_IMETHODIMP SplitElementTxn::GetNewNode(nsIDOMNode **aNewNode)
{
if (!aNewNode)
return NS_ERROR_NULL_POINTER;

View File

@ -44,30 +44,30 @@ public:
* aOffset may refer to children of aNode, or content of aNode.
* The left node will have child|content 0..aOffset-1.
*/
virtual nsresult Init (nsIEditor *aEditor,
nsIDOMNode *aNode,
PRInt32 aOffset);
NS_IMETHOD Init (nsIEditor *aEditor,
nsIDOMNode *aNode,
PRInt32 aOffset);
protected:
SplitElementTxn();
public:
virtual ~SplitElementTxn();
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
virtual nsresult Redo(void);
NS_IMETHOD Redo(void);
virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
virtual nsresult GetNewNode(nsIDOMNode **aNewNode);
NS_IMETHOD GetNewNode(nsIDOMNode **aNewNode);
protected:

View File

@ -28,6 +28,15 @@
#include "ChangeAttributeTxn.h"
#include "SplitElementTxn.h"
#include "JoinElementTxn.h"
#include "InsertTableTxn.h"
#include "InsertTableCellTxn.h"
#include "InsertTableColumnTxn.h"
#include "InsertTableRowTxn.h"
#include "DeleteTableTxn.h"
#include "DeleteTableCellTxn.h"
#include "DeleteTableColumnTxn.h"
#include "DeleteTableRowTxn.h"
#include "JoinTableCellsTxn.h"
static NS_DEFINE_IID(kEditAggregateTxnIID, EDIT_AGGREGATE_TXN_IID);
static NS_DEFINE_IID(kInsertTextTxnIID, INSERT_TEXT_TXN_IID);
@ -39,6 +48,15 @@ static NS_DEFINE_IID(kDeleteRangeTxnIID, DELETE_RANGE_TXN_IID);
static NS_DEFINE_IID(kChangeAttributeTxnIID,CHANGE_ATTRIBUTE_TXN_IID);
static NS_DEFINE_IID(kSplitElementTxnIID, SPLIT_ELEMENT_TXN_IID);
static NS_DEFINE_IID(kJoinElementTxnIID, JOIN_ELEMENT_TXN_IID);
static NS_DEFINE_IID(kInsertTableTxnIID, INSERT_TABLE_TXN_IID);
static NS_DEFINE_IID(kInsertTableCellTxnIID, INSERT_CELL_TXN_IID);
static NS_DEFINE_IID(kInsertTableColumnTxnIID, INSERT_COLUMN_TXN_IID);
static NS_DEFINE_IID(kInsertTableRowTxnIID, INSERT_ROW_TXN_IID);
static NS_DEFINE_IID(kDeleteTableTxnIID, DELETE_TABLE_TXN_IID);
static NS_DEFINE_IID(kDeleteTableCellTxnIID, DELETE_CELL_TXN_IID);
static NS_DEFINE_IID(kDeleteTableColumnTxnIID, DELETE_COLUMN_TXN_IID);
static NS_DEFINE_IID(kDeleteTableRowTxnIID, DELETE_ROW_TXN_IID);
static NS_DEFINE_IID(kJoinTableCellsTxnIID, JOIN_CELLS_TXN_IID);
TransactionFactory::TransactionFactory()
{

View File

@ -39,6 +39,18 @@ CPPSRCS = \
SplitElementTxn.cpp \
JoinElementTxn.cpp \
TransactionFactory.cpp \
nsHTMLEditor.cpp \
nsHTMLEditFactory.cpp \
EditTable.cpp \
InsertTableTxn.cpp \
InsertTableCellTxn.cpp \
InsertTableColumnTxn.cpp \
InsertTableRowTxn.cpp \
DeleteTableTxn.cpp \
DeleteTableCellTxn.cpp \
DeleteTableColumnTxn.cpp \
DeleteTableRowTxn.cpp \
JoinTableCellsTxn.cpp \
$(NULL)
CPP_OBJS = \
@ -60,6 +72,18 @@ CPP_OBJS = \
.\$(OBJDIR)\SplitElementTxn.obj \
.\$(OBJDIR)\JoinElementTxn.obj \
.\$(OBJDIR)\TransactionFactory.obj \
.\$(OBJDIR)\nsHTMLEditor.obj \
.\$(OBJDIR)\nsHTMLEditFactory.obj \
.\$(OBJDIR)\EditTable.obj \
.\$(OBJDIR)\InsertTableTxn.obj \
.\$(OBJDIR)\InsertTableCellTxn.obj \
.\$(OBJDIR)\InsertTableColumnTxn.obj \
.\$(OBJDIR)\InsertTableRowTxn.obj \
.\$(OBJDIR)\DeleteTableTxn.obj \
.\$(OBJDIR)\DeleteTableCellTxn.obj \
.\$(OBJDIR)\DeleteTableColumnTxn.obj \
.\$(OBJDIR)\DeleteTableRowTxn.obj \
.\$(OBJDIR)\JoinTableCellsTxn.obj \
$(NULL)
MODULE=editor

View File

@ -32,16 +32,13 @@ struct nsCtxTupple
class nsEditorDefaultLoader : public nsIContextLoader{
public:
virtual nsresult Lookup(PRUint32 aIndex1, PRUint32 aIndex2, PRUint32 **aResult)= 0;
NS_IMETHOD Lookup(PRUint32 aIndex1, PRUint32 aIndex2, PRUint32 **aResult)= 0;
private:
nsCtxTupple *mCtxArray;
};
nsresult NS_MakeEditorLoader(nsIContextLoader **aResult);
nsresult NS_MakeEditorLoader(nsIContextLoader **aResult)
{
return NS_ERROR_NOT_IMPLEMENTED;

View File

@ -29,7 +29,7 @@ NS_IMPL_RELEASE(nsEditProperty)
nsIAtom * nsIEditProperty::bold = NS_NewAtom("BOLD");
nsIAtom * nsIEditProperty::italic = NS_NewAtom("ITALIC");
nsresult
NS_IMETHODIMP
nsEditProperty::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (nsnull == aInstancePtr) {

View File

@ -39,10 +39,10 @@ protected:
virtual ~nsEditProperty();
public:
virtual nsresult Init(nsIAtom *aPropName, nsIAtom *aValue, PRBool aAppliesToAll);
virtual nsresult GetProperty(nsIAtom **aProperty) const;
virtual nsresult GetValue(nsIAtom **aValue) const;
virtual nsresult GetAppliesToAll(PRBool *aAppliesToAll) const;
NS_IMETHOD Init(nsIAtom *aPropName, nsIAtom *aValue, PRBool aAppliesToAll);
NS_IMETHOD GetProperty(nsIAtom **aProperty) const;
NS_IMETHOD GetValue(nsIAtom **aValue) const;
NS_IMETHOD GetAppliesToAll(PRBool *aAppliesToAll) const;
protected:
nsCOMPtr<nsIAtom>mProperty;

View File

@ -29,6 +29,7 @@
#include "nsIServiceManager.h"
#include "nsEditFactory.h"
#include "nsTextEditFactory.h"
#include "nsHTMLEditFactory.h"
#include "nsEditorCID.h"
#include "nsTransactionManagerCID.h"
#include "nsITransactionManager.h"
@ -40,8 +41,7 @@
#include "nsVoidArray.h"
#include "nsICaret.h"
#include "nsIContent.h" // for temp method GetColIndexForCell, to be removed
#include "nsITableCellLayout.h" // for temp method GetColIndexForCell, to be removed
#include "nsIContent.h" // for method GetLayoutObject
// transactions the editor knows how to build
#include "TransactionFactory.h"
@ -71,6 +71,7 @@ static NS_DEFINE_IID(kIEditorSupportIID, NS_IEDITORSUPPORT_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kEditorCID, NS_EDITOR_CID);
static NS_DEFINE_CID(kTextEditorCID, NS_TEXTEDITOR_CID);
static NS_DEFINE_CID(kHTMLEditorCID, NS_HTMLEDITOR_CID);
// transaction manager
static NS_DEFINE_IID(kITransactionManagerIID, NS_ITRANSACTIONMANAGER_IID);
static NS_DEFINE_CID(kCTransactionManagerFactoryCID, NS_TRANSACTION_MANAGER_FACTORY_CID);
@ -86,7 +87,6 @@ static NS_DEFINE_IID(kChangeAttributeTxnIID,CHANGE_ATTRIBUTE_TXN_IID);
static NS_DEFINE_IID(kSplitElementTxnIID, SPLIT_ELEMENT_TXN_IID);
static NS_DEFINE_IID(kJoinElementTxnIID, JOIN_ELEMENT_TXN_IID);
#ifdef XP_PC
#define TRANSACTION_MANAGER_DLL "txmgr.dll"
#else
@ -102,8 +102,7 @@ static NS_DEFINE_IID(kJoinElementTxnIID, JOIN_ELEMENT_TXN_IID);
/* ----- TEST METHODS DECLARATIONS ----- */
// Methods defined here are TEMPORARY
nsresult
GetColIndexForCell(nsIPresShell *aPresShell, nsIDOMNode *aCellNode, PRInt32 &aCellIndex);
//NS_IMETHODIMP GetColIndexForCell(nsIPresShell *aPresShell, nsIDOMNode *aCellNode, PRInt32 &aCellIndex);
/* ----- END TEST METHOD DECLARATIONS ----- */
@ -149,6 +148,9 @@ extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports * aServiceMgr,
else if (aClass.Equals(kTextEditorCID)) {
return GetTextEditFactory(aFactory, aClass);
}
else if (aClass.Equals(kHTMLEditorCID)) {
return GetHTMLEditFactory(aFactory, aClass);
}
return NS_NOINTERFACE;
}
@ -208,7 +210,7 @@ NS_IMPL_RELEASE(nsEditor)
nsresult
NS_IMETHODIMP
nsEditor::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (nsnull == aInstancePtr) {
@ -236,7 +238,7 @@ nsEditor::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
NS_IMETHODIMP
nsEditor::GetDocument(nsIDOMDocument **aDoc)
{
*aDoc = nsnull; // init out param
@ -246,7 +248,8 @@ nsEditor::GetDocument(nsIDOMDocument **aDoc)
return mDoc->QueryInterface(kIDOMDocumentIID, (void **)aDoc);
}
nsresult
NS_IMETHODIMP
nsEditor::GetSelection(nsIDOMSelection **aSelection)
{
if (!aSelection)
@ -256,7 +259,7 @@ nsEditor::GetSelection(nsIDOMSelection **aSelection)
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell)
{
NS_PRECONDITION(nsnull!=aDoc && nsnull!=aPresShell, "bad arg");
@ -279,11 +282,11 @@ nsEditor::Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell)
}
NS_POSTCONDITION(mDoc && mPresShell, "bad state");
return NS_OK;
}
nsresult
NS_IMETHODIMP
nsEditor::EnableUndo(PRBool aEnable)
{
nsITransactionManager *txnMgr = 0;
@ -318,7 +321,7 @@ nsEditor::EnableUndo(PRBool aEnable)
return result;
}
nsresult nsEditor::CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo)
NS_IMETHODIMP nsEditor::CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo)
{
aIsEnabled = ((PRBool)((nsITransactionManager *)0!=mTxnMgr.get()));
if (aIsEnabled)
@ -333,7 +336,7 @@ nsresult nsEditor::CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo)
return NS_OK;
}
nsresult nsEditor::CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo)
NS_IMETHODIMP nsEditor::CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo)
{
aIsEnabled = ((PRBool)((nsITransactionManager *)0!=mTxnMgr.get()));
if (aIsEnabled)
@ -348,7 +351,7 @@ nsresult nsEditor::CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo)
return NS_OK;
}
nsresult
NS_IMETHODIMP
nsEditor::SetProperties(nsVoidArray *aPropList)
{
return NS_OK;
@ -356,14 +359,14 @@ nsEditor::SetProperties(nsVoidArray *aPropList)
nsresult
NS_IMETHODIMP
nsEditor::GetProperties(nsVoidArray *aPropList)
{
return NS_OK;
}
nsresult
NS_IMETHODIMP
nsEditor::SetAttribute(nsIDOMElement *aElement, const nsString& aAttribute, const nsString& aValue)
{
ChangeAttributeTxn *txn;
@ -375,7 +378,7 @@ nsEditor::SetAttribute(nsIDOMElement *aElement, const nsString& aAttribute, cons
}
nsresult
NS_IMETHODIMP
nsEditor::CreateTxnForSetAttribute(nsIDOMElement *aElement,
const nsString& aAttribute,
const nsString& aValue,
@ -392,7 +395,7 @@ nsEditor::CreateTxnForSetAttribute(nsIDOMElement *aElement,
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::GetAttributeValue(nsIDOMElement *aElement,
const nsString& aAttribute,
nsString& aResultValue,
@ -413,7 +416,7 @@ nsEditor::GetAttributeValue(nsIDOMElement *aElement,
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::RemoveAttribute(nsIDOMElement *aElement, const nsString& aAttribute)
{
ChangeAttributeTxn *txn;
@ -424,7 +427,7 @@ nsEditor::RemoveAttribute(nsIDOMElement *aElement, const nsString& aAttribute)
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::CreateTxnForRemoveAttribute(nsIDOMElement *aElement,
const nsString& aAttribute,
ChangeAttributeTxn ** aTxn)
@ -442,7 +445,7 @@ nsEditor::CreateTxnForRemoveAttribute(nsIDOMElement *aElement,
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::InsertBreak(PRBool aCtrlKey)
{
if (aCtrlKey)
@ -462,7 +465,7 @@ nsEditor::InsertBreak(PRBool aCtrlKey)
//BEGIN nsEditor Private methods
nsresult
NS_IMETHODIMP
nsEditor::GetFirstNodeOfType(nsIDOMNode *aStartNode, const nsString &aTag, nsIDOMNode **aResult)
{
nsresult result=NS_OK;
@ -518,7 +521,7 @@ nsEditor::GetFirstNodeOfType(nsIDOMNode *aStartNode, const nsString &aTag, nsIDO
nsresult
NS_IMETHODIMP
nsEditor::GetFirstTextNode(nsIDOMNode *aNode, nsIDOMNode **aRetNode)
{
if (!aNode || !aRetNode)
@ -566,7 +569,7 @@ nsEditor::GetFirstTextNode(nsIDOMNode *aNode, nsIDOMNode **aRetNode)
return NS_OK;
}
nsresult
NS_IMETHODIMP
nsEditor::Do(nsITransaction *aTxn)
{
nsresult result = NS_OK;
@ -582,7 +585,7 @@ nsEditor::Do(nsITransaction *aTxn)
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::Undo(PRUint32 aCount)
{
nsresult result = NS_OK;
@ -599,7 +602,7 @@ nsEditor::Undo(PRUint32 aCount)
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::Redo(PRUint32 aCount)
{
nsresult result = NS_OK;
@ -616,7 +619,7 @@ nsEditor::Redo(PRUint32 aCount)
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::BeginTransaction()
{
NS_PRECONDITION(mUpdateCount>=0, "bad state");
@ -633,7 +636,7 @@ nsEditor::BeginTransaction()
return NS_OK;
}
nsresult
NS_IMETHODIMP
nsEditor::EndTransaction()
{
NS_PRECONDITION(mUpdateCount>0, "bad state");
@ -650,7 +653,7 @@ nsEditor::EndTransaction()
return NS_OK;
}
nsresult nsEditor::ScrollIntoView(PRBool aScrollToBegin)
NS_IMETHODIMP nsEditor::ScrollIntoView(PRBool aScrollToBegin)
{
return NS_OK; //mjudge we should depricate this method
/* nsresult result;
@ -690,7 +693,7 @@ nsresult nsEditor::ScrollIntoView(PRBool aScrollToBegin)
}
nsresult nsEditor::CreateNode(const nsString& aTag,
NS_IMETHODIMP nsEditor::CreateNode(const nsString& aTag,
nsIDOMNode * aParent,
PRInt32 aPosition,
nsIDOMNode ** aNewNode)
@ -709,7 +712,7 @@ nsresult nsEditor::CreateNode(const nsString& aTag,
return result;
}
nsresult nsEditor::CreateTxnForCreateElement(const nsString& aTag,
NS_IMETHODIMP nsEditor::CreateTxnForCreateElement(const nsString& aTag,
nsIDOMNode *aParent,
PRInt32 aPosition,
CreateElementTxn ** aTxn)
@ -725,7 +728,7 @@ nsresult nsEditor::CreateTxnForCreateElement(const nsString& aTag,
return result;
}
nsresult nsEditor::InsertNode(nsIDOMNode * aNode,
NS_IMETHODIMP nsEditor::InsertNode(nsIDOMNode * aNode,
nsIDOMNode * aParent,
PRInt32 aPosition)
{
@ -737,7 +740,7 @@ nsresult nsEditor::InsertNode(nsIDOMNode * aNode,
return result;
}
nsresult nsEditor::CreateTxnForInsertElement(nsIDOMNode * aNode,
NS_IMETHODIMP nsEditor::CreateTxnForInsertElement(nsIDOMNode * aNode,
nsIDOMNode * aParent,
PRInt32 aPosition,
InsertElementTxn ** aTxn)
@ -753,7 +756,7 @@ nsresult nsEditor::CreateTxnForInsertElement(nsIDOMNode * aNode,
return result;
}
nsresult nsEditor::DeleteNode(nsIDOMNode * aElement)
NS_IMETHODIMP nsEditor::DeleteNode(nsIDOMNode * aElement)
{
DeleteElementTxn *txn;
nsresult result = CreateTxnForDeleteElement(aElement, &txn);
@ -763,7 +766,7 @@ nsresult nsEditor::DeleteNode(nsIDOMNode * aElement)
return result;
}
nsresult nsEditor::CreateTxnForDeleteElement(nsIDOMNode * aElement,
NS_IMETHODIMP nsEditor::CreateTxnForDeleteElement(nsIDOMNode * aElement,
DeleteElementTxn ** aTxn)
{
nsresult result = NS_ERROR_NULL_POINTER;
@ -777,31 +780,63 @@ nsresult nsEditor::CreateTxnForDeleteElement(nsIDOMNode * aElement,
return result;
}
nsresult
nsEditor::InsertText(const nsString& aStringToInsert)
NS_IMETHODIMP nsEditor::CreateAggregateTxnForDeleteSelection(nsIAtom *aTxnName, nsISupports **aAggTxn)
{
nsresult result;
EditAggregateTxn *aggTxn;
result = TransactionFactory::GetNewTransaction(kEditAggregateTxnIID, (EditTxn **)&aggTxn);
if ((NS_FAILED(result)) || (nsnull==aggTxn)) {
return NS_ERROR_OUT_OF_MEMORY;
}
aggTxn->SetName(InsertTextTxn::gInsertTextTxnName);
nsCOMPtr<nsIDOMSelection> selection;
result = mPresShell->GetSelection(getter_AddRefs(selection));
if (NS_SUCCEEDED(result) && selection)
nsresult result = NS_ERROR_NULL_POINTER;
if (aAggTxn)
{
PRBool collapsed;
result = selection->IsCollapsed(&collapsed);
if (NS_SUCCEEDED(result) && !collapsed) {
EditAggregateTxn *delSelTxn;
result = CreateTxnForDeleteSelection(nsIEditor::eLTR, &delSelTxn);
if (NS_SUCCEEDED(result) && delSelTxn) {
aggTxn->AppendChild(delSelTxn);
*aAggTxn = nsnull;
EditAggregateTxn *aTxn = nsnull;
result = TransactionFactory::GetNewTransaction(kEditAggregateTxnIID, (EditTxn**)&aTxn);
if ((NS_FAILED(result)) || !aTxn) {
return NS_ERROR_OUT_OF_MEMORY;
}
// Return transaction pointer
*aAggTxn = (nsISupports*)aTxn;
#if 0
//Test to be sure the Return the transaction pointer as nsISupports*
result = aTxn->QueryInterface(kISupportsIID, (void**)aAggTxn);
if (!NS_SUCCEEDED(result))
return NS_ERROR_UNEXPECTED;
#endif
// Set the name for the aggregate transaction
aTxn->SetName(aTxnName);
// Get current selection and setup txn to delete it,
// but only if selection exists (is not a collapsed "caret" state)
nsCOMPtr<nsIDOMSelection> selection;
result = mPresShell->GetSelection(getter_AddRefs(selection));
if (NS_SUCCEEDED(result) && selection)
{
PRBool collapsed;
result = selection->IsCollapsed(&collapsed);
if (NS_SUCCEEDED(result) && !collapsed) {
EditAggregateTxn *delSelTxn;
result = CreateTxnForDeleteSelection(nsIEditor::eLTR, &delSelTxn);
if (NS_SUCCEEDED(result) && delSelTxn) {
aTxn->AppendChild(delSelTxn);
}
}
}
}
return result;
}
NS_IMETHODIMP
nsEditor::InsertText(const nsString& aStringToInsert)
{
EditAggregateTxn *aggTxn = nsnull;
// Create the "delete current selection" txn
nsresult result = CreateAggregateTxnForDeleteSelection(InsertTextTxn::gInsertTextTxnName, (nsISupports**)&aggTxn);
if ((NS_FAILED(result)) || (nsnull==aggTxn)) {
return NS_ERROR_OUT_OF_MEMORY;
}
InsertTextTxn *txn;
result = CreateTxnForInsertText(aStringToInsert, &txn);
if ((NS_SUCCEEDED(result)) && txn) {
@ -811,7 +846,7 @@ nsEditor::InsertText(const nsString& aStringToInsert)
return result;
}
nsresult nsEditor::CreateTxnForInsertText(const nsString & aStringToInsert,
NS_IMETHODIMP nsEditor::CreateTxnForInsertText(const nsString & aStringToInsert,
InsertTextTxn ** aTxn)
{
nsresult result;
@ -862,7 +897,7 @@ nsresult nsEditor::CreateTxnForInsertText(const nsString & aStringToInsert,
return result;
}
nsresult nsEditor::DeleteText(nsIDOMCharacterData *aElement,
NS_IMETHODIMP nsEditor::DeleteText(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
PRUint32 aLength)
{
@ -875,7 +910,7 @@ nsresult nsEditor::DeleteText(nsIDOMCharacterData *aElement,
}
nsresult nsEditor::CreateTxnForDeleteText(nsIDOMCharacterData *aElement,
NS_IMETHODIMP nsEditor::CreateTxnForDeleteText(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
PRUint32 aLength,
DeleteTextTxn **aTxn)
@ -902,7 +937,7 @@ nsresult nsEditor::CreateTxnForDeleteText(nsIDOMCharacterData *aElement,
*/
#if 0 // THIS CODE WILL BE REMOVED. WE ARE GOING TO IMPLEMENT
// A GENERIC HANDLER SYSTEM.
nsresult nsEditor::CreateTxnToHandleEnterKey(EditAggregateTxn **aTxn)
NS_IMETHODIMP nsEditor::CreateTxnToHandleEnterKey(EditAggregateTxn **aTxn)
{
// allocate the out-param transaction
nsresult result = TransactionFactory::GetNewTransaction(kEditAggregateTxnIID, (EditTxn **)aTxn);
@ -969,9 +1004,57 @@ nsresult nsEditor::CreateTxnToHandleEnterKey(EditAggregateTxn **aTxn)
}
#endif
NS_IMETHODIMP nsEditor::DeleteSelectionAndCreateNode(const nsString& aTag, nsIDOMNode ** aNewNode)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
nsCOMPtr<nsIDOMSelection> selection;
result = GetSelection(getter_AddRefs(selection));
if ((NS_SUCCEEDED(result)) && selection)
{
PRBool collapsed;
result = selection->IsCollapsed(&collapsed);
if (NS_SUCCEEDED(result) && !collapsed)
{
result = DeleteSelection(nsIEditor::eLTR);
// get the new selection
result = GetSelection(getter_AddRefs(selection));
#ifdef NS_DEBUG
PRBool testCollapsed;
result = selection->IsCollapsed(&testCollapsed);
NS_ASSERTION(PR_TRUE==testCollapsed, "selection not reset after deletion");
#endif
}
// split the text node
nsCOMPtr<nsIDOMNode> node;
PRInt32 offset;
result = selection->GetAnchorNodeAndOffset(getter_AddRefs(node), &offset);
if ((NS_SUCCEEDED(result)) && node)
{
nsCOMPtr<nsIDOMNode> parentNode;
result = node->GetParentNode(getter_AddRefs(parentNode));
if ((NS_SUCCEEDED(result)) && parentNode)
{
nsCOMPtr<nsIDOMNode> newNode;
result = SplitNode(node, offset, getter_AddRefs(newNode));
if (NS_SUCCEEDED(result))
{ // now get the node's offset in it's parent, and insert the new tag there
result = nsIEditorSupport::GetChildOffset(node, parentNode, offset);
if (NS_SUCCEEDED(result))
{
result = CreateNode(aTag, parentNode, offset, getter_AddRefs(newNode));
selection->Collapse(parentNode, offset);
*aNewNode = newNode;
}
}
}
}
}
return result;
}
#define DELETE_SELECTION_DOESNT_GO_THROUGH_RANGE
nsresult
NS_IMETHODIMP
nsEditor::DeleteSelection(nsIEditor::Direction aDir)
{
nsresult result;
@ -993,7 +1076,7 @@ nsEditor::DeleteSelection(nsIEditor::Direction aDir)
return result;
}
nsresult nsEditor::CreateTxnForDeleteSelection(nsIEditor::Direction aDir,
NS_IMETHODIMP nsEditor::CreateTxnForDeleteSelection(nsIEditor::Direction aDir,
EditAggregateTxn ** aTxn)
{
if (!aTxn)
@ -1055,7 +1138,7 @@ nsresult nsEditor::CreateTxnForDeleteSelection(nsIEditor::Direction aDir,
//XXX: currently, this doesn't handle edge conditions because GetNext/GetPrior are not implemented
nsresult
NS_IMETHODIMP
nsEditor::CreateTxnForDeleteInsertionPoint(nsIDOMRange *aRange,
nsIEditor::Direction aDir,
EditAggregateTxn *aTxn)
@ -1083,7 +1166,7 @@ nsEditor::CreateTxnForDeleteInsertionPoint(nsIDOMRange *aRange,
PRUint32 count;
nodeAsText->GetLength(&count);
isFirst = PRBool(0==offset);
isLast = PRBool(count==offset);
isLast = PRBool(count==(PRUint32)offset);
}
else
{
@ -1195,7 +1278,7 @@ nsEditor::CreateTxnForDeleteInsertionPoint(nsIDOMRange *aRange,
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::GetPriorNode(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode)
{
nsresult result;
@ -1226,7 +1309,7 @@ nsEditor::GetPriorNode(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode)
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::GetNextNode(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode)
{
nsresult result;
@ -1256,7 +1339,7 @@ nsEditor::GetNextNode(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode)
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::GetRightmostChild(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode)
{
nsresult result = NS_OK;
@ -1277,7 +1360,7 @@ nsEditor::GetRightmostChild(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode)
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::GetLeftmostChild(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode)
{
nsresult result = NS_OK;
@ -1298,7 +1381,7 @@ nsEditor::GetLeftmostChild(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode)
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::SplitNode(nsIDOMNode * aNode,
PRInt32 aOffset,
nsIDOMNode **aNewLeftNode)
@ -1317,7 +1400,7 @@ nsEditor::SplitNode(nsIDOMNode * aNode,
return result;
}
nsresult nsEditor::CreateTxnForSplitNode(nsIDOMNode *aNode,
NS_IMETHODIMP nsEditor::CreateTxnForSplitNode(nsIDOMNode *aNode,
PRUint32 aOffset,
SplitElementTxn **aTxn)
{
@ -1332,7 +1415,7 @@ nsresult nsEditor::CreateTxnForSplitNode(nsIDOMNode *aNode,
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::JoinNodes(nsIDOMNode * aNodeToKeep,
nsIDOMNode * aNodeToJoin,
nsIDOMNode * aParent,
@ -1346,7 +1429,7 @@ nsEditor::JoinNodes(nsIDOMNode * aNodeToKeep,
return result;
}
nsresult nsEditor::CreateTxnForJoinNode(nsIDOMNode *aLeftNode,
NS_IMETHODIMP nsEditor::CreateTxnForJoinNode(nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode,
JoinElementTxn **aTxn)
{
@ -1361,7 +1444,7 @@ nsresult nsEditor::CreateTxnForJoinNode(nsIDOMNode *aLeftNode,
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::SplitNodeImpl(nsIDOMNode * aExistingRightNode,
PRInt32 aOffset,
nsIDOMNode* aNewLeftNode,
@ -1428,7 +1511,7 @@ nsEditor::SplitNodeImpl(nsIDOMNode * aExistingRightNode,
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::JoinNodesImpl(nsIDOMNode * aNodeToKeep,
nsIDOMNode * aNodeToJoin,
nsIDOMNode * aParent,
@ -1545,18 +1628,37 @@ nsresult nsIEditorSupport::GetChildOffset(nsIDOMNode *aChild, nsIDOMNode *aParen
return result;
}
NS_IMETHODIMP nsEditor::GetLayoutObject(nsIDOMNode *aNode, nsISupports **aLayoutObject)
{
nsresult result = NS_ERROR_FAILURE; // we return an error unless we get the index
if( mPresShell != nsnull )
{
if ((nsnull!=aNode))
{ // get the content interface
nsCOMPtr<nsIContent> nodeAsContent(aNode);
if (nodeAsContent)
{ // get the frame from the content interface
nsISupports *layoutObject=nsnull; // frames are not ref counted, so don't use an nsCOMPtr
*aLayoutObject = nsnull;
return (NS_SUCCEEDED(mPresShell->GetLayoutObjectFor(nodeAsContent, &layoutObject)));
}
}
else {
result = NS_ERROR_NULL_POINTER;
}
}
return result;
}
//END nsEditor Private methods
/* ----- TEST METHODS ----- */
// Methods defined here are TEMPORARY
nsresult
GetColIndexForCell(nsIPresShell *aPresShell, nsIDOMNode *aCellNode, PRInt32 &aCellIndex)
/* ORIGINAL version by Steve - KEEP FOR REFERENCE
NS_IMETHODIMP GetColIndexForCell(nsIPresShell *aPresShell, nsIDOMNode *aCellNode, PRInt32 &aCellIndex)
{
aCellIndex=0; // initialize out param
nsresult result = NS_ERROR_FAILURE; // we return an error unless we get the index
@ -1583,6 +1685,7 @@ GetColIndexForCell(nsIPresShell *aPresShell, nsIDOMNode *aCellNode, PRInt32 &aCe
}
return result;
}
*/
/* ----- END TEST METHODS ----- */

View File

@ -82,69 +82,73 @@ public:
/*interfaces for addref and release and queryinterface*/
NS_DECL_ISUPPORTS
virtual nsresult Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell);
NS_IMETHOD Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell);
virtual nsresult GetDocument(nsIDOMDocument **aDoc);
NS_IMETHOD GetDocument(nsIDOMDocument **aDoc);
virtual nsresult GetSelection(nsIDOMSelection **aSelection);
NS_IMETHOD GetSelection(nsIDOMSelection **aSelection);
virtual nsresult SetProperties(nsVoidArray *aPropList);
NS_IMETHOD SetProperties(nsVoidArray *aPropList);
virtual nsresult GetProperties(nsVoidArray *aPropList);
NS_IMETHOD GetProperties(nsVoidArray *aPropList);
virtual nsresult SetAttribute(nsIDOMElement * aElement,
const nsString& aAttribute,
const nsString& aValue);
NS_IMETHOD SetAttribute(nsIDOMElement * aElement,
const nsString& aAttribute,
const nsString& aValue);
virtual nsresult GetAttributeValue(nsIDOMElement * aElement,
const nsString& aAttribute,
nsString& aResultValue,
PRBool& aResultIsSet);
NS_IMETHOD GetAttributeValue(nsIDOMElement * aElement,
const nsString& aAttribute,
nsString& aResultValue,
PRBool& aResultIsSet);
virtual nsresult RemoveAttribute(nsIDOMElement *aElement, const nsString& aAttribute);
NS_IMETHOD RemoveAttribute(nsIDOMElement *aElement, const nsString& aAttribute);
virtual nsresult CreateNode(const nsString& aTag,
nsIDOMNode * aParent,
PRInt32 aPosition,
nsIDOMNode ** aNewNode);
NS_IMETHOD CreateNode(const nsString& aTag,
nsIDOMNode * aParent,
PRInt32 aPosition,
nsIDOMNode ** aNewNode);
virtual nsresult InsertNode(nsIDOMNode * aNode,
nsIDOMNode * aParent,
PRInt32 aPosition);
virtual nsresult InsertText(const nsString& aStringToInsert);
NS_IMETHOD InsertNode(nsIDOMNode * aNode,
nsIDOMNode * aParent,
PRInt32 aPosition);
NS_IMETHOD InsertText(const nsString& aStringToInsert);
virtual nsresult DeleteNode(nsIDOMNode * aChild);
NS_IMETHOD DeleteNode(nsIDOMNode * aChild);
virtual nsresult DeleteSelection(nsIEditor::Direction aDir);
NS_IMETHOD DeleteSelection(nsIEditor::Direction aDir);
virtual nsresult SplitNode(nsIDOMNode * aExistingRightNode,
PRInt32 aOffset,
nsIDOMNode ** aNewLeftNode);
NS_IMETHOD DeleteSelectionAndCreateNode(const nsString& aTag, nsIDOMNode ** aNewNode);
virtual nsresult JoinNodes(nsIDOMNode * aNodeToKeep,
nsIDOMNode * aNodeToJoin,
nsIDOMNode * aParent,
PRBool aNodeToKeepIsFirst);
NS_IMETHOD SplitNode(nsIDOMNode * aExistingRightNode,
PRInt32 aOffset,
nsIDOMNode ** aNewLeftNode);
NS_IMETHOD JoinNodes(nsIDOMNode * aNodeToKeep,
nsIDOMNode * aNodeToJoin,
nsIDOMNode * aParent,
PRBool aNodeToKeepIsFirst);
virtual nsresult InsertBreak(PRBool aCtrlKey);
NS_IMETHOD InsertBreak(PRBool aCtrlKey);
virtual nsresult EnableUndo(PRBool aEnable);
NS_IMETHOD EnableUndo(PRBool aEnable);
virtual nsresult Do(nsITransaction *aTxn);
NS_IMETHOD Do(nsITransaction *aTxn);
virtual nsresult Undo(PRUint32 aCount);
NS_IMETHOD Undo(PRUint32 aCount);
virtual nsresult CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo);
NS_IMETHOD CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo);
virtual nsresult Redo(PRUint32 aCount);
NS_IMETHOD Redo(PRUint32 aCount);
virtual nsresult CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo);
NS_IMETHOD CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo);
virtual nsresult BeginTransaction();
NS_IMETHOD BeginTransaction();
virtual nsresult EndTransaction();
NS_IMETHOD EndTransaction();
virtual nsresult ScrollIntoView(PRBool aScrollToBegin);
NS_IMETHOD GetLayoutObject(nsIDOMNode *aNode, nsISupports **aLayoutObject);
NS_IMETHOD ScrollIntoView(PRBool aScrollToBegin);
/*END nsIEditor interfaces*/
@ -161,7 +165,7 @@ public:
*
* NOTE: this method will probably be removed.
*/
nsresult GetFirstTextNode(nsIDOMNode *aNode, nsIDOMNode **aRetNode);
NS_IMETHOD GetFirstTextNode(nsIDOMNode *aNode, nsIDOMNode **aRetNode);
/** GetFirstNodeOfType ADDREFFS and will get the next available node from the passed
* in aStartNode parameter of type aTag.
@ -170,84 +174,86 @@ public:
* @param nsIAtom *aTag is the type of node we are searching for
* @param nsIDOMNode **aResult is the node we found, or nsnull if there is none
*/
nsresult GetFirstNodeOfType(nsIDOMNode *aStartNode, const nsString &aTag, nsIDOMNode **aResult);
NS_IMETHOD GetFirstNodeOfType(nsIDOMNode *aStartNode, const nsString &aTag, nsIDOMNode **aResult);
/*END public methods of nsEditor*/
/*BEGIN private methods used by the implementations of the above functions*/
protected:
virtual nsresult CreateTxnForSetAttribute(nsIDOMElement *aElement,
const nsString& aAttribute,
const nsString& aValue,
ChangeAttributeTxn ** aTxn);
NS_IMETHOD CreateTxnForSetAttribute(nsIDOMElement *aElement,
const nsString& aAttribute,
const nsString& aValue,
ChangeAttributeTxn ** aTxn);
virtual nsresult CreateTxnForRemoveAttribute(nsIDOMElement *aElement,
const nsString& aAttribute,
ChangeAttributeTxn ** aTxn);
NS_IMETHOD CreateTxnForRemoveAttribute(nsIDOMElement *aElement,
const nsString& aAttribute,
ChangeAttributeTxn ** aTxn);
virtual nsresult CreateTxnForCreateElement(const nsString& aTag,
nsIDOMNode *aParent,
PRInt32 aPosition,
CreateElementTxn ** aTxn);
NS_IMETHOD CreateTxnForCreateElement(const nsString& aTag,
nsIDOMNode *aParent,
PRInt32 aPosition,
CreateElementTxn ** aTxn);
virtual nsresult CreateTxnForInsertElement(nsIDOMNode * aNode,
nsIDOMNode * aParent,
PRInt32 aOffset,
InsertElementTxn ** aTxn);
NS_IMETHOD CreateTxnForInsertElement(nsIDOMNode * aNode,
nsIDOMNode * aParent,
PRInt32 aOffset,
InsertElementTxn ** aTxn);
virtual nsresult CreateTxnForDeleteElement(nsIDOMNode * aElement,
DeleteElementTxn ** aTxn);
NS_IMETHOD CreateTxnForDeleteElement(nsIDOMNode * aElement,
DeleteElementTxn ** aTxn);
virtual nsresult CreateTxnForInsertText(const nsString & aStringToInsert,
InsertTextTxn ** aTxn);
NS_IMETHOD CreateTxnForInsertText(const nsString & aStringToInsert,
InsertTextTxn ** aTxn);
virtual nsresult DeleteText(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
PRUint32 aLength);
NS_IMETHOD DeleteText(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
PRUint32 aLength);
virtual nsresult CreateTxnForDeleteText(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
PRUint32 aLength,
DeleteTextTxn **aTxn);
NS_IMETHOD CreateTxnForDeleteText(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
PRUint32 aLength,
DeleteTextTxn **aTxn);
virtual nsresult CreateTxnForDeleteSelection(nsIEditor::Direction aDir,
EditAggregateTxn ** aTxn);
NS_IMETHOD CreateTxnForDeleteSelection(nsIEditor::Direction aDir,
EditAggregateTxn ** aTxn);
virtual nsresult CreateTxnForDeleteInsertionPoint(nsIDOMRange *aRange,
nsIEditor::Direction aDir,
EditAggregateTxn *aTxn);
NS_IMETHOD CreateTxnForDeleteInsertionPoint(nsIDOMRange *aRange,
nsIEditor::Direction aDir,
EditAggregateTxn *aTxn);
virtual nsresult CreateTxnForSplitNode(nsIDOMNode *aNode,
PRUint32 aOffset,
SplitElementTxn **aTxn);
NS_IMETHOD CreateTxnForSplitNode(nsIDOMNode *aNode,
PRUint32 aOffset,
SplitElementTxn **aTxn);
virtual nsresult SplitNodeImpl(nsIDOMNode * aExistingRightNode,
PRInt32 aOffset,
nsIDOMNode * aNewLeftNode,
nsIDOMNode * aParent);
NS_IMETHOD SplitNodeImpl(nsIDOMNode * aExistingRightNode,
PRInt32 aOffset,
nsIDOMNode * aNewLeftNode,
nsIDOMNode * aParent);
virtual nsresult CreateTxnForJoinNode(nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode,
JoinElementTxn **aTxn);
NS_IMETHOD CreateTxnForJoinNode(nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode,
JoinElementTxn **aTxn);
virtual nsresult JoinNodesImpl(nsIDOMNode * aNodeToKeep,
nsIDOMNode * aNodeToJoin,
nsIDOMNode * aParent,
PRBool aNodeToKeepIsFirst);
NS_IMETHOD JoinNodesImpl(nsIDOMNode * aNodeToKeep,
nsIDOMNode * aNodeToJoin,
nsIDOMNode * aParent,
PRBool aNodeToKeepIsFirst);
NS_IMETHOD CreateAggregateTxnForDeleteSelection(nsIAtom *aTxnName, nsISupports **aAggTxn);
#if 0
nsresult CreateTxnToHandleEnterKey(EditAggregateTxn **aTxn);
NS_IMETHOD CreateTxnToHandleEnterKey(EditAggregateTxn **aTxn);
#endif
nsresult GetPriorNode(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode);
NS_IMETHOD GetPriorNode(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode);
nsresult GetNextNode(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode);
NS_IMETHOD GetNextNode(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode);
nsresult GetRightmostChild(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode);
NS_IMETHOD GetRightmostChild(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode);
nsresult GetLeftmostChild(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode);
NS_IMETHOD GetLeftmostChild(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode);
};

View File

@ -51,7 +51,7 @@ GetHTMLEditFactory(nsIFactory **aFactory, const nsCID & aClass)
////////////////////////////////////////////////////////////////////////////
// from nsISupports
NS_METHOD
NS_IMETHODIMP
nsHTMLEditFactory::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (nsnull == aInstancePtr) {
@ -74,7 +74,7 @@ NS_IMPL_RELEASE(nsHTMLEditFactory)
////////////////////////////////////////////////////////////////////////////
// from nsIFactory:
NS_METHOD
NS_IMETHODIMP
nsHTMLEditFactory::CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
*aResult = nsnull;
@ -99,7 +99,7 @@ nsHTMLEditFactory::CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aRe
NS_METHOD
NS_IMETHODIMP
nsHTMLEditFactory::LockFactory(PRBool aLock)
{
return NS_OK;

View File

@ -81,9 +81,9 @@ nsHTMLEditor::~nsHTMLEditor()
#endif
}
nsresult nsHTMLEditor::InitHTMLEditor(nsIDOMDocument *aDoc,
nsIPresShell *aPresShell,
nsIEditorCallback *aCallback)
NS_IMETHODIMP nsHTMLEditor::InitHTMLEditor(nsIDOMDocument *aDoc,
nsIPresShell *aPresShell,
nsIEditorCallback *aCallback)
{
NS_PRECONDITION(nsnull!=aDoc && nsnull!=aPresShell, "bad arg");
nsresult result=NS_ERROR_NULL_POINTER;
@ -96,7 +96,7 @@ nsresult nsHTMLEditor::InitHTMLEditor(nsIDOMDocument *aDoc,
if (NS_FAILED(result) || !aTextEditor) {
return NS_ERROR_OUT_OF_MEMORY;
}
mTextEditor = aTextEditor; // CreateInstance did our addRef
mTextEditor = do_QueryInterface(aTextEditor); // CreateInstance did our addRef
// Initialize nsTextEditor -- this will create and initialize the base nsEditor
// Note: nsTextEditor adds its own key, mouse, and DOM listners -- is that OK?
@ -116,7 +116,7 @@ nsresult nsHTMLEditor::InitHTMLEditor(nsIDOMDocument *aDoc,
return result;
}
nsresult nsHTMLEditor::SetTextProperties(nsISupportsArray *aPropList)
NS_IMETHODIMP nsHTMLEditor::SetTextProperties(nsISupportsArray *aPropList)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -126,7 +126,7 @@ nsresult nsHTMLEditor::SetTextProperties(nsISupportsArray *aPropList)
return result;
}
nsresult nsHTMLEditor::GetTextProperties(nsISupportsArray *aPropList)
NS_IMETHODIMP nsHTMLEditor::GetTextProperties(nsISupportsArray *aPropList)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -136,7 +136,7 @@ nsresult nsHTMLEditor::GetTextProperties(nsISupportsArray *aPropList)
return result;
}
nsresult nsHTMLEditor::RemoveTextProperties(nsISupportsArray *aPropList)
NS_IMETHODIMP nsHTMLEditor::RemoveTextProperties(nsISupportsArray *aPropList)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -146,7 +146,7 @@ nsresult nsHTMLEditor::RemoveTextProperties(nsISupportsArray *aPropList)
return result;
}
nsresult nsHTMLEditor::DeleteSelection(nsIEditor::Direction aDir)
NS_IMETHODIMP nsHTMLEditor::DeleteSelection(nsIEditor::Direction aDir)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -156,7 +156,7 @@ nsresult nsHTMLEditor::DeleteSelection(nsIEditor::Direction aDir)
return result;
}
nsresult nsHTMLEditor::InsertText(const nsString& aStringToInsert)
NS_IMETHODIMP nsHTMLEditor::InsertText(const nsString& aStringToInsert)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -166,7 +166,7 @@ nsresult nsHTMLEditor::InsertText(const nsString& aStringToInsert)
return result;
}
nsresult nsHTMLEditor::InsertBreak(PRBool aCtrlKey)
NS_IMETHODIMP nsHTMLEditor::InsertBreak(PRBool aCtrlKey)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -178,7 +178,7 @@ nsresult nsHTMLEditor::InsertBreak(PRBool aCtrlKey)
// Methods shared with the base editor.
// Note: We could call each of these via nsTextEditor -- is that better?
nsresult nsHTMLEditor::EnableUndo(PRBool aEnable)
NS_IMETHODIMP nsHTMLEditor::EnableUndo(PRBool aEnable)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -188,7 +188,7 @@ nsresult nsHTMLEditor::EnableUndo(PRBool aEnable)
return result;
}
nsresult nsHTMLEditor::Undo(PRUint32 aCount)
NS_IMETHODIMP nsHTMLEditor::Undo(PRUint32 aCount)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -198,7 +198,7 @@ nsresult nsHTMLEditor::Undo(PRUint32 aCount)
return result;
}
nsresult nsHTMLEditor::CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo)
NS_IMETHODIMP nsHTMLEditor::CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -208,7 +208,7 @@ nsresult nsHTMLEditor::CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo)
return result;
}
nsresult nsHTMLEditor::Redo(PRUint32 aCount)
NS_IMETHODIMP nsHTMLEditor::Redo(PRUint32 aCount)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -218,7 +218,7 @@ nsresult nsHTMLEditor::Redo(PRUint32 aCount)
return result;
}
nsresult nsHTMLEditor::CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo)
NS_IMETHODIMP nsHTMLEditor::CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -228,7 +228,7 @@ nsresult nsHTMLEditor::CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo)
return result;
}
nsresult nsHTMLEditor::BeginTransaction()
NS_IMETHODIMP nsHTMLEditor::BeginTransaction()
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -238,7 +238,7 @@ nsresult nsHTMLEditor::BeginTransaction()
return result;
}
nsresult nsHTMLEditor::EndTransaction()
NS_IMETHODIMP nsHTMLEditor::EndTransaction()
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -248,7 +248,7 @@ nsresult nsHTMLEditor::EndTransaction()
return result;
}
nsresult nsHTMLEditor::MoveSelectionUp(nsIAtom *aIncrement, PRBool aExtendSelection)
NS_IMETHODIMP nsHTMLEditor::MoveSelectionUp(nsIAtom *aIncrement, PRBool aExtendSelection)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -258,7 +258,7 @@ nsresult nsHTMLEditor::MoveSelectionUp(nsIAtom *aIncrement, PRBool aExtendSelect
return result;
}
nsresult nsHTMLEditor::MoveSelectionDown(nsIAtom *aIncrement, PRBool aExtendSelection)
NS_IMETHODIMP nsHTMLEditor::MoveSelectionDown(nsIAtom *aIncrement, PRBool aExtendSelection)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -268,7 +268,7 @@ nsresult nsHTMLEditor::MoveSelectionDown(nsIAtom *aIncrement, PRBool aExtendSele
return result;
}
nsresult nsHTMLEditor::MoveSelectionNext(nsIAtom *aIncrement, PRBool aExtendSelection)
NS_IMETHODIMP nsHTMLEditor::MoveSelectionNext(nsIAtom *aIncrement, PRBool aExtendSelection)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -278,7 +278,7 @@ nsresult nsHTMLEditor::MoveSelectionNext(nsIAtom *aIncrement, PRBool aExtendSele
return result;
}
nsresult nsHTMLEditor::MoveSelectionPrevious(nsIAtom *aIncrement, PRBool aExtendSelection)
NS_IMETHODIMP nsHTMLEditor::MoveSelectionPrevious(nsIAtom *aIncrement, PRBool aExtendSelection)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -288,7 +288,7 @@ nsresult nsHTMLEditor::MoveSelectionPrevious(nsIAtom *aIncrement, PRBool aExtend
return result;
}
nsresult nsHTMLEditor::SelectNext(nsIAtom *aIncrement, PRBool aExtendSelection)
NS_IMETHODIMP nsHTMLEditor::SelectNext(nsIAtom *aIncrement, PRBool aExtendSelection)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -298,7 +298,7 @@ nsresult nsHTMLEditor::SelectNext(nsIAtom *aIncrement, PRBool aExtendSelection)
return result;
}
nsresult nsHTMLEditor::SelectPrevious(nsIAtom *aIncrement, PRBool aExtendSelection)
NS_IMETHODIMP nsHTMLEditor::SelectPrevious(nsIAtom *aIncrement, PRBool aExtendSelection)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -308,7 +308,7 @@ nsresult nsHTMLEditor::SelectPrevious(nsIAtom *aIncrement, PRBool aExtendSelecti
return result;
}
nsresult nsHTMLEditor::ScrollUp(nsIAtom *aIncrement)
NS_IMETHODIMP nsHTMLEditor::ScrollUp(nsIAtom *aIncrement)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -318,7 +318,7 @@ nsresult nsHTMLEditor::ScrollUp(nsIAtom *aIncrement)
return result;
}
nsresult nsHTMLEditor::ScrollDown(nsIAtom *aIncrement)
NS_IMETHODIMP nsHTMLEditor::ScrollDown(nsIAtom *aIncrement)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -328,7 +328,7 @@ nsresult nsHTMLEditor::ScrollDown(nsIAtom *aIncrement)
return result;
}
nsresult nsHTMLEditor::ScrollIntoView(PRBool aScrollToBegin)
NS_IMETHODIMP nsHTMLEditor::ScrollIntoView(PRBool aScrollToBegin)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -338,7 +338,7 @@ nsresult nsHTMLEditor::ScrollIntoView(PRBool aScrollToBegin)
return result;
}
nsresult nsHTMLEditor::Insert(nsIInputStream *aInputStream)
NS_IMETHODIMP nsHTMLEditor::Insert(nsIInputStream *aInputStream)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -348,7 +348,7 @@ nsresult nsHTMLEditor::Insert(nsIInputStream *aInputStream)
return result;
}
nsresult nsHTMLEditor::OutputText(nsIOutputStream *aOutputStream)
NS_IMETHODIMP nsHTMLEditor::OutputText(nsIOutputStream *aOutputStream)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -358,7 +358,7 @@ nsresult nsHTMLEditor::OutputText(nsIOutputStream *aOutputStream)
return result;
}
nsresult nsHTMLEditor::OutputHTML(nsIOutputStream *aOutputStream)
NS_IMETHODIMP nsHTMLEditor::OutputHTML(nsIOutputStream *aOutputStream)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -373,7 +373,7 @@ NS_IMPL_ADDREF(nsHTMLEditor)
NS_IMPL_RELEASE(nsHTMLEditor)
nsresult
NS_IMETHODIMP
nsHTMLEditor::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (nsnull == aInstancePtr) {

View File

@ -39,67 +39,67 @@ public:
//Initialization
nsHTMLEditor();
virtual nsresult InitHTMLEditor(nsIDOMDocument *aDoc,
nsIPresShell *aPresShell,
nsIEditorCallback *aCallback=nsnull);
NS_IMETHOD InitHTMLEditor(nsIDOMDocument *aDoc,
nsIPresShell *aPresShell,
nsIEditorCallback *aCallback=nsnull);
virtual ~nsHTMLEditor();
//============================================================================
// Methods that are duplicates of nsTextEditor -- exposed here for convenience
// Editing Operations
virtual nsresult SetTextProperties(nsISupportsArray *aPropList);
virtual nsresult GetTextProperties(nsISupportsArray *aPropList);
virtual nsresult RemoveTextProperties(nsISupportsArray *aPropList);
virtual nsresult DeleteSelection(nsIEditor::Direction aDir);
virtual nsresult InsertText(const nsString& aStringToInsert);
virtual nsresult InsertBreak(PRBool aCtrlKey);
NS_IMETHOD SetTextProperties(nsISupportsArray *aPropList);
NS_IMETHOD GetTextProperties(nsISupportsArray *aPropList);
NS_IMETHOD RemoveTextProperties(nsISupportsArray *aPropList);
NS_IMETHOD DeleteSelection(nsIEditor::Direction aDir);
NS_IMETHOD InsertText(const nsString& aStringToInsert);
NS_IMETHOD InsertBreak(PRBool aCtrlKey);
// Transaction control
virtual nsresult EnableUndo(PRBool aEnable);
virtual nsresult Undo(PRUint32 aCount);
virtual nsresult CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo);
virtual nsresult Redo(PRUint32 aCount);
virtual nsresult CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo);
virtual nsresult BeginTransaction();
virtual nsresult EndTransaction();
NS_IMETHOD EnableUndo(PRBool aEnable);
NS_IMETHOD Undo(PRUint32 aCount);
NS_IMETHOD CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo);
NS_IMETHOD Redo(PRUint32 aCount);
NS_IMETHOD CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo);
NS_IMETHOD BeginTransaction();
NS_IMETHOD EndTransaction();
// Selection and navigation -- exposed here for convenience
virtual nsresult MoveSelectionUp(nsIAtom *aIncrement, PRBool aExtendSelection);
virtual nsresult MoveSelectionDown(nsIAtom *aIncrement, PRBool aExtendSelection);
virtual nsresult MoveSelectionNext(nsIAtom *aIncrement, PRBool aExtendSelection);
virtual nsresult MoveSelectionPrevious(nsIAtom *aIncrement, PRBool aExtendSelection);
virtual nsresult SelectNext(nsIAtom *aIncrement, PRBool aExtendSelection);
virtual nsresult SelectPrevious(nsIAtom *aIncrement, PRBool aExtendSelection);
virtual nsresult ScrollUp(nsIAtom *aIncrement);
virtual nsresult ScrollDown(nsIAtom *aIncrement);
virtual nsresult ScrollIntoView(PRBool aScrollToBegin);
NS_IMETHOD MoveSelectionUp(nsIAtom *aIncrement, PRBool aExtendSelection);
NS_IMETHOD MoveSelectionDown(nsIAtom *aIncrement, PRBool aExtendSelection);
NS_IMETHOD MoveSelectionNext(nsIAtom *aIncrement, PRBool aExtendSelection);
NS_IMETHOD MoveSelectionPrevious(nsIAtom *aIncrement, PRBool aExtendSelection);
NS_IMETHOD SelectNext(nsIAtom *aIncrement, PRBool aExtendSelection);
NS_IMETHOD SelectPrevious(nsIAtom *aIncrement, PRBool aExtendSelection);
NS_IMETHOD ScrollUp(nsIAtom *aIncrement);
NS_IMETHOD ScrollDown(nsIAtom *aIncrement);
NS_IMETHOD ScrollIntoView(PRBool aScrollToBegin);
// Input/Output
virtual nsresult Insert(nsIInputStream *aInputStream);
virtual nsresult OutputText(nsIOutputStream *aOutputStream);
virtual nsresult OutputHTML(nsIOutputStream *aOutputStream);
NS_IMETHOD Insert(nsIInputStream *aInputStream);
NS_IMETHOD OutputText(nsIOutputStream *aOutputStream);
NS_IMETHOD OutputHTML(nsIOutputStream *aOutputStream);
//=====================================
// HTML Editing methods
// Table Editing (implemented in EditTable.cpp)
virtual nsresult CreateTxnForInsertTable(const nsIDOMElement *aTableNode, InsertTableTxn ** aTxn);
virtual nsresult GetColIndexForCell(nsIDOMNode *aCellNode, PRInt32 &aCellIndex);
virtual nsresult GetRowIndexForCell(nsIDOMNode *aCellNode, PRInt32 &aCellIndex);
virtual nsresult GetFirstCellInColumn(nsIDOMNode *aCurrentCellNode, nsIDOMNode* &aFirstCellNode);
virtual nsresult GetNextCellInColumn(nsIDOMNode *aCurrentCellNode, nsIDOMNode* &aNextCellNode);
virtual nsresult GetFirstCellInRow(nsIDOMNode *aCurrentCellNode, nsIDOMNode* &aCellNode);
virtual nsresult GetNextCellInRow(nsIDOMNode *aCurrentCellNode, nsIDOMNode* &aNextCellNode);
virtual nsresult InsertTable();
virtual nsresult InsertTableCell(PRInt32 aNumber, PRBool aAfter);
virtual nsresult InsertTableColumn(PRInt32 aNumber, PRBool aAfter);
virtual nsresult InsertTableRow(PRInt32 aNumber, PRBool aAfter);
virtual nsresult DeleteTable();
virtual nsresult DeleteTableCell(PRInt32 aNumber);
virtual nsresult DeleteTableColumn(PRInt32 aNumber);
virtual nsresult DeleteTableRow(PRInt32 aNumber);
virtual nsresult JoinTableCells(PRBool aCellToRight);
NS_IMETHOD CreateTxnForInsertTable(const nsIDOMElement *aTableNode, InsertTableTxn ** aTxn);
NS_IMETHOD GetColIndexForCell(nsIDOMNode *aCellNode, PRInt32 &aCellIndex);
NS_IMETHOD GetRowIndexForCell(nsIDOMNode *aCellNode, PRInt32 &aCellIndex);
NS_IMETHOD GetFirstCellInColumn(nsIDOMNode *aCurrentCellNode, nsIDOMNode* &aFirstCellNode);
NS_IMETHOD GetNextCellInColumn(nsIDOMNode *aCurrentCellNode, nsIDOMNode* &aNextCellNode);
NS_IMETHOD GetFirstCellInRow(nsIDOMNode *aCurrentCellNode, nsIDOMNode* &aCellNode);
NS_IMETHOD GetNextCellInRow(nsIDOMNode *aCurrentCellNode, nsIDOMNode* &aNextCellNode);
NS_IMETHOD InsertTable();
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 DeleteTableColumn(PRInt32 aNumber);
NS_IMETHOD DeleteTableRow(PRInt32 aNumber);
NS_IMETHOD JoinTableCells(PRBool aCellToRight);
// Data members
protected:

View File

@ -37,10 +37,10 @@ class nsIEditProperty : public nsISupports
public:
static const nsIID& IID() { static nsIID iid = NS_IEDITPROPERTY_IID; return iid; }
virtual nsresult Init(nsIAtom *aPropName, nsIAtom *aValue, PRBool aAppliesToAll)=0;
virtual nsresult GetProperty(nsIAtom **aProperty) const =0;
virtual nsresult GetValue(nsIAtom **aValue) const =0;
virtual nsresult GetAppliesToAll(PRBool *aAppliesToAll) const =0;
NS_IMETHOD Init(nsIAtom *aPropName, nsIAtom *aValue, PRBool aAppliesToAll)=0;
NS_IMETHOD GetProperty(nsIAtom **aProperty) const =0;
NS_IMETHOD GetValue(nsIAtom **aValue) const =0;
NS_IMETHOD GetAppliesToAll(PRBool *aAppliesToAll) const =0;
/* we're still trying to decide how edit atoms will work. Until then, use these */
// XXX: fix ASAP!

View File

@ -47,10 +47,10 @@ public:
* @param aNewLeftNode [OUT] the new node resulting from the split, becomes aExistingRightNode's previous sibling.
* @param aParent the parent of aExistingRightNode
*/
virtual nsresult SplitNodeImpl(nsIDOMNode * aExistingRightNode,
PRInt32 aOffset,
nsIDOMNode * aNewLeftNode,
nsIDOMNode * aParent)=0;
NS_IMETHOD SplitNodeImpl(nsIDOMNode * aExistingRightNode,
PRInt32 aOffset,
nsIDOMNode * aNewLeftNode,
nsIDOMNode * aParent)=0;
/**
* JoinNodes() takes 2 nodes and merge their content|children.
@ -61,10 +61,10 @@ public:
* @param aNodeToKeepIsFirst if PR_TRUE, the contents|children of aNodeToKeep come before the
* contents|children of aNodeToJoin, otherwise their positions are switched.
*/
virtual nsresult JoinNodesImpl(nsIDOMNode *aNodeToKeep,
nsIDOMNode *aNodeToJoin,
nsIDOMNode *aParent,
PRBool aNodeToKeepIsFirst)=0;
NS_IMETHOD JoinNodesImpl(nsIDOMNode *aNodeToKeep,
nsIDOMNode *aNodeToJoin,
nsIDOMNode *aParent,
PRBool aNodeToKeepIsFirst)=0;
static nsresult GetChildOffset(nsIDOMNode *aChild, nsIDOMNode *aParent, PRInt32 &aOffset);

View File

@ -51,7 +51,7 @@ GetTextEditFactory(nsIFactory **aFactory, const nsCID & aClass)
////////////////////////////////////////////////////////////////////////////
// from nsISupports
NS_METHOD
nsresult
nsTextEditFactory::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (nsnull == aInstancePtr) {
@ -74,7 +74,7 @@ NS_IMPL_RELEASE(nsTextEditFactory)
////////////////////////////////////////////////////////////////////////////
// from nsIFactory:
NS_METHOD
NS_IMETHODIMP
nsTextEditFactory::CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
*aResult = nsnull;
@ -99,7 +99,7 @@ nsTextEditFactory::CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aRe
NS_METHOD
NS_IMETHODIMP
nsTextEditFactory::LockFactory(PRBool aLock)
{
return NS_OK;

View File

@ -51,7 +51,6 @@ public:
////////////////////////////////////////////////////////////////////////////
// from nsTextEditFactory:
virtual ~nsTextEditFactory(void);
private:

View File

@ -49,7 +49,6 @@ static NS_DEFINE_IID(kITextEditorIID, NS_ITEXTEDITOR_IID);
static NS_DEFINE_CID(kTextEditorCID, NS_TEXTEDITOR_CID);
nsTextEditor::nsTextEditor()
{
NS_INIT_REFCNT();
@ -82,7 +81,7 @@ nsTextEditor::~nsTextEditor()
}
}
nsresult nsTextEditor::InitTextEditor(nsIDOMDocument *aDoc,
NS_IMETHODIMP nsTextEditor::InitTextEditor(nsIDOMDocument *aDoc,
nsIPresShell *aPresShell,
nsIEditorCallback *aCallback)
{
@ -130,7 +129,7 @@ nsresult nsTextEditor::InitTextEditor(nsIDOMDocument *aDoc,
// this is a total hack for now. We don't yet have a way of getting the style properties
// of the current selection, so we can't do anything useful here except show off a little.
nsresult nsTextEditor::SetTextProperties(nsISupportsArray *aPropList)
NS_IMETHODIMP nsTextEditor::SetTextProperties(nsISupportsArray *aPropList)
{
if (!aPropList)
return NS_ERROR_NULL_POINTER;
@ -234,7 +233,7 @@ nsresult nsTextEditor::SetTextProperties(nsISupportsArray *aPropList)
return result;
}
nsresult nsTextEditor::GetTextProperties(nsISupportsArray *aPropList)
NS_IMETHODIMP nsTextEditor::GetTextProperties(nsISupportsArray *aPropList)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -244,7 +243,7 @@ nsresult nsTextEditor::GetTextProperties(nsISupportsArray *aPropList)
return result;
}
nsresult nsTextEditor::RemoveTextProperties(nsISupportsArray *aPropList)
NS_IMETHODIMP nsTextEditor::RemoveTextProperties(nsISupportsArray *aPropList)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -254,7 +253,7 @@ nsresult nsTextEditor::RemoveTextProperties(nsISupportsArray *aPropList)
return result;
}
nsresult nsTextEditor::DeleteSelection(nsIEditor::Direction aDir)
NS_IMETHODIMP nsTextEditor::DeleteSelection(nsIEditor::Direction aDir)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -264,7 +263,7 @@ nsresult nsTextEditor::DeleteSelection(nsIEditor::Direction aDir)
return result;
}
nsresult nsTextEditor::InsertText(const nsString& aStringToInsert)
NS_IMETHODIMP nsTextEditor::InsertText(const nsString& aStringToInsert)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -274,64 +273,28 @@ nsresult nsTextEditor::InsertText(const nsString& aStringToInsert)
return result;
}
nsresult nsTextEditor::InsertBreak(PRBool aCtrlKey)
NS_IMETHODIMP nsTextEditor::InsertBreak(PRBool aCtrlKey)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
{
PRBool beganTransaction = PR_FALSE;
nsCOMPtr<nsIDOMSelection> selection;
result = mEditor->GetSelection(getter_AddRefs(selection));
if ((NS_SUCCEEDED(result)) && selection)
{
beganTransaction = PR_TRUE;
result = mEditor->BeginTransaction();
PRBool collapsed;
result = selection->IsCollapsed(&collapsed);
if (NS_SUCCEEDED(result) && !collapsed)
{
result = mEditor->DeleteSelection(nsIEditor::eLTR);
// get the new selection
result = mEditor->GetSelection(getter_AddRefs(selection));
#ifdef NS_DEBUG
PRBool testCollapsed;
result = selection->IsCollapsed(&testCollapsed);
NS_ASSERTION(PR_TRUE==testCollapsed, "selection not reset after deletion");
#endif
}
// split the text node
nsCOMPtr<nsIDOMNode> node;
PRInt32 offset;
result = selection->GetAnchorNodeAndOffset(getter_AddRefs(node), &offset);
if ((NS_SUCCEEDED(result)) && node)
{
nsCOMPtr<nsIDOMNode> parentNode;
nsCOMPtr<nsIDOMNode> newNode;
result = node->GetParentNode(getter_AddRefs(parentNode));
if ((NS_SUCCEEDED(result)) && parentNode)
{
result = mEditor->SplitNode(node, offset, getter_AddRefs(newNode));
if (NS_SUCCEEDED(result))
{ // now get the node's offset in it's parent, and insert the new BR there
result = nsIEditorSupport::GetChildOffset(node, parentNode, offset);
if (NS_SUCCEEDED(result))
{
nsAutoString tag("BR");
result = mEditor->CreateNode(tag, parentNode, offset, getter_AddRefs(newNode));
selection->Collapse(parentNode, offset);
}
}
}
}
}
if (PR_TRUE==beganTransaction) {
result = mEditor->EndTransaction();
}
// Note: Code that does most of the deletion work was
// moved to nsEditor::DeleteSelectionAndCreateNode
// Only difference is we now do BeginTransaction()/EndTransaction()
// even if we fail to get a selection
result = mEditor->BeginTransaction();
nsCOMPtr<nsIDOMNode> newNode;
nsAutoString tag("BR");
mEditor->DeleteSelectionAndCreateNode(tag, getter_AddRefs(newNode));
// Are we supposed to release newNode?
result = mEditor->EndTransaction();
}
return result;
}
nsresult nsTextEditor::EnableUndo(PRBool aEnable)
NS_IMETHODIMP nsTextEditor::EnableUndo(PRBool aEnable)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -341,7 +304,7 @@ nsresult nsTextEditor::EnableUndo(PRBool aEnable)
return result;
}
nsresult nsTextEditor::Undo(PRUint32 aCount)
NS_IMETHODIMP nsTextEditor::Undo(PRUint32 aCount)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor) {
@ -350,7 +313,7 @@ nsresult nsTextEditor::Undo(PRUint32 aCount)
return result;
}
nsresult nsTextEditor::CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo)
NS_IMETHODIMP nsTextEditor::CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -360,7 +323,7 @@ nsresult nsTextEditor::CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo)
return result;
}
nsresult nsTextEditor::Redo(PRUint32 aCount)
NS_IMETHODIMP nsTextEditor::Redo(PRUint32 aCount)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -370,7 +333,7 @@ nsresult nsTextEditor::Redo(PRUint32 aCount)
return result;
}
nsresult nsTextEditor::CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo)
NS_IMETHODIMP nsTextEditor::CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -380,7 +343,7 @@ nsresult nsTextEditor::CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo)
return result;
}
nsresult nsTextEditor::BeginTransaction()
NS_IMETHODIMP nsTextEditor::BeginTransaction()
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -390,7 +353,7 @@ nsresult nsTextEditor::BeginTransaction()
return result;
}
nsresult nsTextEditor::EndTransaction()
NS_IMETHODIMP nsTextEditor::EndTransaction()
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -400,7 +363,7 @@ nsresult nsTextEditor::EndTransaction()
return result;
}
nsresult nsTextEditor::MoveSelectionUp(nsIAtom *aIncrement, PRBool aExtendSelection)
NS_IMETHODIMP nsTextEditor::MoveSelectionUp(nsIAtom *aIncrement, PRBool aExtendSelection)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -410,7 +373,7 @@ nsresult nsTextEditor::MoveSelectionUp(nsIAtom *aIncrement, PRBool aExtendSelect
return result;
}
nsresult nsTextEditor::MoveSelectionDown(nsIAtom *aIncrement, PRBool aExtendSelection)
NS_IMETHODIMP nsTextEditor::MoveSelectionDown(nsIAtom *aIncrement, PRBool aExtendSelection)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -420,7 +383,7 @@ nsresult nsTextEditor::MoveSelectionDown(nsIAtom *aIncrement, PRBool aExtendSele
return result;
}
nsresult nsTextEditor::MoveSelectionNext(nsIAtom *aIncrement, PRBool aExtendSelection)
NS_IMETHODIMP nsTextEditor::MoveSelectionNext(nsIAtom *aIncrement, PRBool aExtendSelection)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -430,7 +393,7 @@ nsresult nsTextEditor::MoveSelectionNext(nsIAtom *aIncrement, PRBool aExtendSele
return result;
}
nsresult nsTextEditor::MoveSelectionPrevious(nsIAtom *aIncrement, PRBool aExtendSelection)
NS_IMETHODIMP nsTextEditor::MoveSelectionPrevious(nsIAtom *aIncrement, PRBool aExtendSelection)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -440,7 +403,7 @@ nsresult nsTextEditor::MoveSelectionPrevious(nsIAtom *aIncrement, PRBool aExtend
return result;
}
nsresult nsTextEditor::SelectNext(nsIAtom *aIncrement, PRBool aExtendSelection)
NS_IMETHODIMP nsTextEditor::SelectNext(nsIAtom *aIncrement, PRBool aExtendSelection)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -450,7 +413,7 @@ nsresult nsTextEditor::SelectNext(nsIAtom *aIncrement, PRBool aExtendSelection)
return result;
}
nsresult nsTextEditor::SelectPrevious(nsIAtom *aIncrement, PRBool aExtendSelection)
NS_IMETHODIMP nsTextEditor::SelectPrevious(nsIAtom *aIncrement, PRBool aExtendSelection)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -460,7 +423,7 @@ nsresult nsTextEditor::SelectPrevious(nsIAtom *aIncrement, PRBool aExtendSelecti
return result;
}
nsresult nsTextEditor::ScrollUp(nsIAtom *aIncrement)
NS_IMETHODIMP nsTextEditor::ScrollUp(nsIAtom *aIncrement)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -470,7 +433,7 @@ nsresult nsTextEditor::ScrollUp(nsIAtom *aIncrement)
return result;
}
nsresult nsTextEditor::ScrollDown(nsIAtom *aIncrement)
NS_IMETHODIMP nsTextEditor::ScrollDown(nsIAtom *aIncrement)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -480,7 +443,7 @@ nsresult nsTextEditor::ScrollDown(nsIAtom *aIncrement)
return result;
}
nsresult nsTextEditor::ScrollIntoView(PRBool aScrollToBegin)
NS_IMETHODIMP nsTextEditor::ScrollIntoView(PRBool aScrollToBegin)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -490,7 +453,7 @@ nsresult nsTextEditor::ScrollIntoView(PRBool aScrollToBegin)
return result;
}
nsresult nsTextEditor::Insert(nsIInputStream *aInputStream)
NS_IMETHODIMP nsTextEditor::Insert(nsIInputStream *aInputStream)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -500,7 +463,7 @@ nsresult nsTextEditor::Insert(nsIInputStream *aInputStream)
return result;
}
nsresult nsTextEditor::OutputText(nsIOutputStream *aOutputStream)
NS_IMETHODIMP nsTextEditor::OutputText(nsIOutputStream *aOutputStream)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -510,7 +473,7 @@ nsresult nsTextEditor::OutputText(nsIOutputStream *aOutputStream)
return result;
}
nsresult nsTextEditor::OutputHTML(nsIOutputStream *aOutputStream)
NS_IMETHODIMP nsTextEditor::OutputHTML(nsIOutputStream *aOutputStream)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -525,7 +488,7 @@ NS_IMPL_ADDREF(nsTextEditor)
NS_IMPL_RELEASE(nsTextEditor)
nsresult
NS_IMETHODIMP
nsTextEditor::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (nsnull == aInstancePtr) {
@ -541,11 +504,19 @@ nsTextEditor::QueryInterface(REFNSIID aIID, void** aInstancePtr)
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(kIEditorIID) && (mEditor)) {
nsCOMPtr<nsIEditor> editor;
nsresult result = mEditor->QueryInterface(kIEditorIID, getter_AddRefs(editor));
if (NS_SUCCEEDED(result) && editor) {
*aInstancePtr = (void*)editor;
return NS_OK;
}
}
return NS_NOINTERFACE;
}
nsresult nsTextEditor::SetTextPropertiesForNode(nsIDOMNode *aNode,
NS_IMETHODIMP nsTextEditor::SetTextPropertiesForNode(nsIDOMNode *aNode,
nsIDOMNode *aParent,
PRInt32 aStartOffset,
PRInt32 aEndOffset,
@ -600,7 +571,7 @@ nsresult nsTextEditor::SetTextPropertiesForNode(nsIDOMNode *aNode,
return result;
}
nsresult
NS_IMETHODIMP
nsTextEditor::SetTextPropertiesForNodesWithSameParent(nsIDOMNode *aStartNode,
PRInt32 aStartOffset,
nsIDOMNode *aEndNode,
@ -695,7 +666,7 @@ nsTextEditor::SetTextPropertiesForNodesWithSameParent(nsIDOMNode *aStartNode,
return result;
}
nsresult
NS_IMETHODIMP
nsTextEditor::SetTextPropertiesForNodeWithDifferentParents(nsIDOMNode *aStartNode,
PRInt32 aStartOffset,
nsIDOMNode *aEndNode,
@ -709,7 +680,7 @@ nsTextEditor::SetTextPropertiesForNodeWithDifferentParents(nsIDOMNode *aStartNod
nsresult
NS_IMETHODIMP
nsTextEditor::SetTagFromProperty(nsAutoString &aTag, nsIAtom *aPropName) const
{
if (!aPropName) {

View File

@ -41,67 +41,67 @@ public:
//Initialization
nsTextEditor();
virtual nsresult InitTextEditor(nsIDOMDocument *aDoc,
nsIPresShell *aPresShell,
nsIEditorCallback *aCallback=nsnull);
NS_IMETHOD InitTextEditor(nsIDOMDocument *aDoc,
nsIPresShell *aPresShell,
nsIEditorCallback *aCallback=nsnull);
virtual ~nsTextEditor();
// Editing Operations
virtual nsresult SetTextProperties(nsISupportsArray *aPropList);
virtual nsresult GetTextProperties(nsISupportsArray *aPropList);
virtual nsresult RemoveTextProperties(nsISupportsArray *aPropList);
virtual nsresult DeleteSelection(nsIEditor::Direction aDir);
virtual nsresult InsertText(const nsString& aStringToInsert);
virtual nsresult InsertBreak(PRBool aCtrlKey);
NS_IMETHOD SetTextProperties(nsISupportsArray *aPropList);
NS_IMETHOD GetTextProperties(nsISupportsArray *aPropList);
NS_IMETHOD RemoveTextProperties(nsISupportsArray *aPropList);
NS_IMETHOD DeleteSelection(nsIEditor::Direction aDir);
NS_IMETHOD InsertText(const nsString& aStringToInsert);
NS_IMETHOD InsertBreak(PRBool aCtrlKey);
// Transaction control
virtual nsresult EnableUndo(PRBool aEnable);
virtual nsresult Undo(PRUint32 aCount);
virtual nsresult CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo);
virtual nsresult Redo(PRUint32 aCount);
virtual nsresult CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo);
virtual nsresult BeginTransaction();
virtual nsresult EndTransaction();
NS_IMETHOD EnableUndo(PRBool aEnable);
NS_IMETHOD Undo(PRUint32 aCount);
NS_IMETHOD CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo);
NS_IMETHOD Redo(PRUint32 aCount);
NS_IMETHOD CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo);
NS_IMETHOD BeginTransaction();
NS_IMETHOD EndTransaction();
// Selection and navigation -- exposed here for convenience
virtual nsresult MoveSelectionUp(nsIAtom *aIncrement, PRBool aExtendSelection);
virtual nsresult MoveSelectionDown(nsIAtom *aIncrement, PRBool aExtendSelection);
virtual nsresult MoveSelectionNext(nsIAtom *aIncrement, PRBool aExtendSelection);
virtual nsresult MoveSelectionPrevious(nsIAtom *aIncrement, PRBool aExtendSelection);
virtual nsresult SelectNext(nsIAtom *aIncrement, PRBool aExtendSelection);
virtual nsresult SelectPrevious(nsIAtom *aIncrement, PRBool aExtendSelection);
virtual nsresult ScrollUp(nsIAtom *aIncrement);
virtual nsresult ScrollDown(nsIAtom *aIncrement);
virtual nsresult ScrollIntoView(PRBool aScrollToBegin);
NS_IMETHOD MoveSelectionUp(nsIAtom *aIncrement, PRBool aExtendSelection);
NS_IMETHOD MoveSelectionDown(nsIAtom *aIncrement, PRBool aExtendSelection);
NS_IMETHOD MoveSelectionNext(nsIAtom *aIncrement, PRBool aExtendSelection);
NS_IMETHOD MoveSelectionPrevious(nsIAtom *aIncrement, PRBool aExtendSelection);
NS_IMETHOD SelectNext(nsIAtom *aIncrement, PRBool aExtendSelection);
NS_IMETHOD SelectPrevious(nsIAtom *aIncrement, PRBool aExtendSelection);
NS_IMETHOD ScrollUp(nsIAtom *aIncrement);
NS_IMETHOD ScrollDown(nsIAtom *aIncrement);
NS_IMETHOD ScrollIntoView(PRBool aScrollToBegin);
// Input/Output
virtual nsresult Insert(nsIInputStream *aInputStream);
virtual nsresult OutputText(nsIOutputStream *aOutputStream);
virtual nsresult OutputHTML(nsIOutputStream *aOutputStream);
NS_IMETHOD Insert(nsIInputStream *aInputStream);
NS_IMETHOD OutputText(nsIOutputStream *aOutputStream);
NS_IMETHOD OutputHTML(nsIOutputStream *aOutputStream);
protected:
// Utility Methods
virtual nsresult SetTextPropertiesForNode(nsIDOMNode *aNode,
nsIDOMNode *aParent,
PRInt32 aStartOffset,
PRInt32 aEndOffset,
nsIAtom *aPropName);
NS_IMETHOD SetTextPropertiesForNode(nsIDOMNode *aNode,
nsIDOMNode *aParent,
PRInt32 aStartOffset,
PRInt32 aEndOffset,
nsIAtom *aPropName);
virtual nsresult SetTextPropertiesForNodesWithSameParent(nsIDOMNode *aStartNode,
PRInt32 aStartOffset,
nsIDOMNode *aEndNode,
PRInt32 aEndOffset,
nsIDOMNode *aParent,
nsIAtom *aPropName);
NS_IMETHOD SetTextPropertiesForNodesWithSameParent(nsIDOMNode *aStartNode,
PRInt32 aStartOffset,
nsIDOMNode *aEndNode,
PRInt32 aEndOffset,
nsIDOMNode *aParent,
nsIAtom *aPropName);
virtual nsresult SetTextPropertiesForNodeWithDifferentParents(nsIDOMNode *aStartNode,
PRInt32 aStartOffset,
nsIDOMNode *aEndNode,
PRInt32 aEndOffset,
nsIDOMNode *aParent,
nsIAtom *aPropName);
NS_IMETHOD SetTextPropertiesForNodeWithDifferentParents(nsIDOMNode *aStartNode,
PRInt32 aStartOffset,
nsIDOMNode *aEndNode,
PRInt32 aEndOffset,
nsIDOMNode *aParent,
nsIAtom *aPropName);
virtual nsresult SetTagFromProperty(nsAutoString &aTag, nsIAtom *aPropName) const;
NS_IMETHOD SetTagFromProperty(nsAutoString &aTag, nsIAtom *aPropName) const;
// Data members
protected:

View File

@ -36,7 +36,7 @@ nsEditGuiManager::~nsEditGuiManager()
NS_IMPL_ADDREF(nsEditGuiManager)
NS_IMPL_RELEASE(nsEditGuiManager)
nsresult
NS_IMETHODIMP
nsEditGuiManager::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {

View File

@ -25,7 +25,7 @@ ChangeAttributeTxn::ChangeAttributeTxn()
{
}
nsresult ChangeAttributeTxn::Init(nsIEditor *aEditor,
NS_IMETHODIMP ChangeAttributeTxn::Init(nsIEditor *aEditor,
nsIDOMElement *aElement,
const nsString& aAttribute,
const nsString& aValue,
@ -46,7 +46,7 @@ nsresult ChangeAttributeTxn::Init(nsIEditor *aEditor,
return NS_ERROR_NULL_POINTER;
}
nsresult ChangeAttributeTxn::Do(void)
NS_IMETHODIMP ChangeAttributeTxn::Do(void)
{
// need to get the current value of the attribute and save it, and set mAttributeWasSet
const int stringlen=100;
@ -72,7 +72,7 @@ nsresult ChangeAttributeTxn::Do(void)
return result;
}
nsresult ChangeAttributeTxn::Undo(void)
NS_IMETHODIMP ChangeAttributeTxn::Undo(void)
{
nsresult result=NS_OK;
if (PR_TRUE==mAttributeWasSet)
@ -83,7 +83,7 @@ nsresult ChangeAttributeTxn::Undo(void)
return result;
}
nsresult ChangeAttributeTxn::Redo(void)
NS_IMETHODIMP ChangeAttributeTxn::Redo(void)
{
nsresult result;
@ -95,19 +95,19 @@ nsresult ChangeAttributeTxn::Redo(void)
return result;
}
nsresult ChangeAttributeTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP ChangeAttributeTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
if (nsnull!=aDidMerge)
*aDidMerge=PR_FALSE;
return NS_OK;
}
nsresult ChangeAttributeTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP ChangeAttributeTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult ChangeAttributeTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP ChangeAttributeTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -120,7 +120,7 @@ nsresult ChangeAttributeTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult ChangeAttributeTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP ChangeAttributeTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{

View File

@ -44,30 +44,30 @@ public:
* @param aValue the new value for aAttribute, if aRemoveAttribute is false
* @param aRemoveAttribute if PR_TRUE, remove aAttribute from aNode
*/
virtual nsresult Init(nsIEditor *aEditor,
nsIDOMElement *aNode,
const nsString& aAttribute,
const nsString& aValue,
PRBool aRemoveAttribute);
NS_IMETHOD Init(nsIEditor *aEditor,
nsIDOMElement *aNode,
const nsString& aAttribute,
const nsString& aValue,
PRBool aRemoveAttribute);
private:
ChangeAttributeTxn();
public:
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
virtual nsresult Redo(void);
NS_IMETHOD Redo(void);
virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
protected:

View File

@ -27,7 +27,7 @@ CreateElementTxn::CreateElementTxn()
{
}
nsresult CreateElementTxn::Init(nsIEditor *aEditor,
NS_IMETHODIMP CreateElementTxn::Init(nsIEditor *aEditor,
const nsString& aTag,
nsIDOMNode *aParent,
PRUint32 aOffsetInParent)
@ -59,7 +59,7 @@ CreateElementTxn::~CreateElementTxn()
{
}
nsresult CreateElementTxn::Do(void)
NS_IMETHODIMP CreateElementTxn::Do(void)
{
NS_ASSERTION(mEditor, "bad state -- null editor");
nsresult result = NS_ERROR_NULL_POINTER;
@ -112,7 +112,7 @@ nsresult CreateElementTxn::Do(void)
return result;
}
nsresult CreateElementTxn::Undo(void)
NS_IMETHODIMP CreateElementTxn::Undo(void)
{
nsCOMPtr<nsIDOMNode> resultNode;
nsresult result = mParent->RemoveChild(mNewNode, getter_AddRefs(resultNode));
@ -132,7 +132,7 @@ nsresult CreateElementTxn::Undo(void)
return result;
}
nsresult CreateElementTxn::Redo(void)
NS_IMETHODIMP CreateElementTxn::Redo(void)
{
nsCOMPtr<nsIDOMNode> resultNode;
nsresult result = mParent->InsertBefore(mNewNode, mRefNode, getter_AddRefs(resultNode));
@ -152,19 +152,19 @@ nsresult CreateElementTxn::Redo(void)
return result;
}
nsresult CreateElementTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP CreateElementTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
if (nsnull!=aDidMerge)
*aDidMerge=PR_FALSE;
return NS_OK;
}
nsresult CreateElementTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP CreateElementTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult CreateElementTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP CreateElementTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -174,7 +174,7 @@ nsresult CreateElementTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult CreateElementTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP CreateElementTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -184,7 +184,7 @@ nsresult CreateElementTxn::GetRedoString(nsString **aString)
return NS_OK;
}
nsresult CreateElementTxn::GetNewNode(nsIDOMNode **aNewNode)
NS_IMETHODIMP CreateElementTxn::GetNewNode(nsIDOMNode **aNewNode)
{
if (!aNewNode)
return NS_ERROR_NULL_POINTER;

View File

@ -46,10 +46,10 @@ public:
* @param aOffsetInParent the location in aParent to insert the new element
* if eAppend, the new element is appended as the last child
*/
virtual nsresult Init(nsIEditor *aEditor,
const nsString& aTag,
nsIDOMNode *aParent,
PRUint32 aOffsetInParent);
NS_IMETHOD Init(nsIEditor *aEditor,
const nsString& aTag,
nsIDOMNode *aParent,
PRUint32 aOffsetInParent);
private:
CreateElementTxn();
@ -58,21 +58,21 @@ public:
virtual ~CreateElementTxn();
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
virtual nsresult Redo(void);
NS_IMETHOD Redo(void);
virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
virtual nsresult GetNewNode(nsIDOMNode **aNewNode);
NS_IMETHOD GetNewNode(nsIDOMNode **aNewNode);
protected:

View File

@ -33,7 +33,7 @@ DeleteElementTxn::DeleteElementTxn()
{
}
nsresult DeleteElementTxn::Init(nsIDOMNode *aElement)
NS_IMETHODIMP DeleteElementTxn::Init(nsIDOMNode *aElement)
{
if (nsnull!=aElement) {
mElement = do_QueryInterface(aElement);
@ -48,7 +48,7 @@ DeleteElementTxn::~DeleteElementTxn()
{
}
nsresult DeleteElementTxn::Do(void)
NS_IMETHODIMP DeleteElementTxn::Do(void)
{
if (!mElement)
return NS_ERROR_NULL_POINTER;
@ -94,7 +94,7 @@ nsresult DeleteElementTxn::Do(void)
return result;
}
nsresult DeleteElementTxn::Undo(void)
NS_IMETHODIMP DeleteElementTxn::Undo(void)
{
if (!mParent || !mElement)
return NS_ERROR_NULL_POINTER;
@ -104,7 +104,7 @@ nsresult DeleteElementTxn::Undo(void)
return result;
}
nsresult DeleteElementTxn::Redo(void)
NS_IMETHODIMP DeleteElementTxn::Redo(void)
{
if (!mParent || !mElement)
return NS_ERROR_NULL_POINTER;
@ -114,19 +114,19 @@ nsresult DeleteElementTxn::Redo(void)
return result;
}
nsresult DeleteElementTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP DeleteElementTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
if (nsnull!=aDidMerge)
*aDidMerge=PR_FALSE;
return NS_OK;
}
nsresult DeleteElementTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP DeleteElementTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult DeleteElementTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP DeleteElementTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -135,7 +135,7 @@ nsresult DeleteElementTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult DeleteElementTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP DeleteElementTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{

View File

@ -38,7 +38,7 @@ public:
/** initialize the transaction.
* @param aElement the node to delete
*/
virtual nsresult Init(nsIDOMNode *aElement);
NS_IMETHOD Init(nsIDOMNode *aElement);
private:
DeleteElementTxn();
@ -47,19 +47,19 @@ public:
virtual ~DeleteElementTxn();
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
virtual nsresult Redo(void);
NS_IMETHOD Redo(void);
virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
protected:

View File

@ -45,7 +45,7 @@ DeleteRangeTxn::DeleteRangeTxn()
{
}
nsresult DeleteRangeTxn::Init(nsIEditor *aEditor, nsIDOMRange *aRange)
NS_IMETHODIMP DeleteRangeTxn::Init(nsIEditor *aEditor, nsIDOMRange *aRange)
{
if (aEditor && aRange)
{
@ -103,7 +103,7 @@ DeleteRangeTxn::~DeleteRangeTxn()
{
}
nsresult DeleteRangeTxn::Do(void)
NS_IMETHODIMP DeleteRangeTxn::Do(void)
{
if (!mStartParent || !mEndParent || !mCommonParent)
return NS_ERROR_NULL_POINTER;
@ -149,7 +149,7 @@ nsresult DeleteRangeTxn::Do(void)
return result;
}
nsresult DeleteRangeTxn::Undo(void)
NS_IMETHODIMP DeleteRangeTxn::Undo(void)
{
if (!mStartParent || !mEndParent || !mCommonParent)
return NS_ERROR_NULL_POINTER;
@ -168,7 +168,7 @@ nsresult DeleteRangeTxn::Undo(void)
return result;
}
nsresult DeleteRangeTxn::Redo(void)
NS_IMETHODIMP DeleteRangeTxn::Redo(void)
{
if (!mStartParent || !mEndParent || !mCommonParent)
return NS_ERROR_NULL_POINTER;
@ -187,19 +187,19 @@ nsresult DeleteRangeTxn::Redo(void)
return result;
}
nsresult DeleteRangeTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP DeleteRangeTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
if (nsnull!=aDidMerge)
*aDidMerge=PR_FALSE;
return NS_OK;
}
nsresult DeleteRangeTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP DeleteRangeTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult DeleteRangeTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP DeleteRangeTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -208,7 +208,7 @@ nsresult DeleteRangeTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult DeleteRangeTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP DeleteRangeTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -217,7 +217,7 @@ nsresult DeleteRangeTxn::GetRedoString(nsString **aString)
return NS_OK;
}
nsresult DeleteRangeTxn::CreateTxnsToDeleteBetween(nsIDOMNode *aStartParent,
NS_IMETHODIMP DeleteRangeTxn::CreateTxnsToDeleteBetween(nsIDOMNode *aStartParent,
PRUint32 aStartOffset,
PRUint32 aEndOffset)
{
@ -272,7 +272,7 @@ nsresult DeleteRangeTxn::CreateTxnsToDeleteBetween(nsIDOMNode *aStartParent,
return result;
}
nsresult DeleteRangeTxn::CreateTxnsToDeleteContent(nsIDOMNode *aParent,
NS_IMETHODIMP DeleteRangeTxn::CreateTxnsToDeleteContent(nsIDOMNode *aParent,
PRUint32 aOffset,
nsIEditor::Direction aDir)
{
@ -361,7 +361,7 @@ nsresult DeleteRangeTxn::CreateTxnsToDeleteContent(nsIDOMNode *aParent,
return result;
}
nsresult DeleteRangeTxn::CreateTxnsToDeleteNodesBetween(nsIDOMNode *aCommonParent,
NS_IMETHODIMP DeleteRangeTxn::CreateTxnsToDeleteNodesBetween(nsIDOMNode *aCommonParent,
nsIDOMNode *aFirstChild,
nsIDOMNode *aLastChild)
{
@ -509,7 +509,7 @@ nsresult DeleteRangeTxn::CreateTxnsToDeleteNodesBetween(nsIDOMNode *aCommonParen
}
// XXX: probably want to move this to editor as a standard support method
nsresult DeleteRangeTxn::BuildAncestorList(nsIDOMNode *aNode, nsISupportsArray *aList)
NS_IMETHODIMP DeleteRangeTxn::BuildAncestorList(nsIDOMNode *aNode, nsISupportsArray *aList)
{
nsresult result=NS_OK;
if (nsnull!=aNode && nsnull!=aList)

View File

@ -44,7 +44,7 @@ public:
* @param aEditor the object providing basic editing operations
* @param aRange the range to delete
*/
virtual nsresult Init(nsIEditor *aEditor, nsIDOMRange *aRange);
NS_IMETHOD Init(nsIEditor *aEditor, nsIDOMRange *aRange);
private:
DeleteRangeTxn();
@ -53,35 +53,35 @@ public:
virtual ~DeleteRangeTxn();
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
virtual nsresult Redo(void);
NS_IMETHOD Redo(void);
virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
protected:
virtual nsresult CreateTxnsToDeleteBetween(nsIDOMNode *aStartParent,
NS_IMETHOD CreateTxnsToDeleteBetween(nsIDOMNode *aStartParent,
PRUint32 aStartOffset,
PRUint32 aEndOffset);
virtual nsresult CreateTxnsToDeleteNodesBetween(nsIDOMNode *aParent,
NS_IMETHOD CreateTxnsToDeleteNodesBetween(nsIDOMNode *aParent,
nsIDOMNode *aFirstChild,
nsIDOMNode *aLastChild);
virtual nsresult CreateTxnsToDeleteContent(nsIDOMNode *aParent,
NS_IMETHOD CreateTxnsToDeleteContent(nsIDOMNode *aParent,
PRUint32 aOffset,
nsIEditor::Direction aDir);
virtual nsresult BuildAncestorList(nsIDOMNode *aNode,
NS_IMETHOD BuildAncestorList(nsIDOMNode *aNode,
nsISupportsArray *aList);
protected:

View File

@ -26,7 +26,7 @@ DeleteTextTxn::DeleteTextTxn()
{
}
nsresult DeleteTextTxn::Init(nsIEditor *aEditor,
NS_IMETHODIMP DeleteTextTxn::Init(nsIEditor *aEditor,
nsIDOMCharacterData *aElement,
PRUint32 aOffset,
PRUint32 aNumCharsToDelete)
@ -40,7 +40,7 @@ nsresult DeleteTextTxn::Init(nsIEditor *aEditor,
return NS_OK;
}
nsresult DeleteTextTxn::Do(void)
NS_IMETHODIMP DeleteTextTxn::Do(void)
{
nsresult result = NS_ERROR_NULL_POINTER;
if (mEditor && mElement)
@ -66,7 +66,7 @@ nsresult DeleteTextTxn::Do(void)
//XXX: we may want to store the selection state and restore it properly
// was it an insertion point or an extended selection?
nsresult DeleteTextTxn::Undo(void)
NS_IMETHODIMP DeleteTextTxn::Undo(void)
{
nsresult result = NS_ERROR_NULL_POINTER;
if (mEditor && mElement)
@ -87,19 +87,19 @@ nsresult DeleteTextTxn::Undo(void)
return result;
}
nsresult DeleteTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP DeleteTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
if (nsnull!=aDidMerge)
*aDidMerge=PR_FALSE;
return NS_OK;
}
nsresult DeleteTextTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP DeleteTextTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult DeleteTextTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP DeleteTextTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -109,7 +109,7 @@ nsresult DeleteTextTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult DeleteTextTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP DeleteTextTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{

View File

@ -42,27 +42,27 @@ public:
* @param aOffset the location in aElement to begin the deletion
* @param aNumCharsToDelete the number of characters to delete. Not the number of bytes!
*/
virtual nsresult Init(nsIEditor *aEditor,
nsIDOMCharacterData *aElement,
PRUint32 aOffset,
PRUint32 aNumCharsToDelete);
NS_IMETHOD Init(nsIEditor *aEditor,
nsIDOMCharacterData *aElement,
PRUint32 aOffset,
PRUint32 aNumCharsToDelete);
private:
DeleteTextTxn();
public:
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
protected:

View File

@ -43,7 +43,7 @@ EditAggregateTxn::~EditAggregateTxn()
}
}
nsresult EditAggregateTxn::Do(void)
NS_IMETHODIMP EditAggregateTxn::Do(void)
{
nsresult result=NS_OK; // it's legal (but not very useful) to have an empty child list
if (nsnull!=mChildren)
@ -61,7 +61,7 @@ nsresult EditAggregateTxn::Do(void)
return result;
}
nsresult EditAggregateTxn::Undo(void)
NS_IMETHODIMP EditAggregateTxn::Undo(void)
{
nsresult result=NS_OK; // it's legal (but not very useful) to have an empty child list
if (nsnull!=mChildren)
@ -80,7 +80,7 @@ nsresult EditAggregateTxn::Undo(void)
return result;
}
nsresult EditAggregateTxn::Redo(void)
NS_IMETHODIMP EditAggregateTxn::Redo(void)
{
nsresult result=NS_OK; // it's legal (but not very useful) to have an empty child list
if (nsnull!=mChildren)
@ -98,14 +98,14 @@ nsresult EditAggregateTxn::Redo(void)
return result;
}
nsresult EditAggregateTxn::GetIsTransient(PRBool *aIsTransient)
NS_IMETHODIMP EditAggregateTxn::GetIsTransient(PRBool *aIsTransient)
{
if (nsnull!=aIsTransient)
*aIsTransient = PR_FALSE;
return NS_OK;
}
nsresult EditAggregateTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP EditAggregateTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
nsresult result=NS_OK; // it's legal (but not very useful) to have an empty child list
if (nsnull!=aDidMerge)
@ -124,26 +124,26 @@ nsresult EditAggregateTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction
}
nsresult EditAggregateTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP EditAggregateTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult EditAggregateTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP EditAggregateTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
*aString=nsnull;
return NS_OK;
}
nsresult EditAggregateTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP EditAggregateTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
*aString=nsnull;
return NS_OK;
}
nsresult EditAggregateTxn::AppendChild(EditTxn *aTxn)
NS_IMETHODIMP EditAggregateTxn::AppendChild(EditTxn *aTxn)
{
if ((nsnull!=mChildren) && (nsnull!=aTxn))
{
@ -153,13 +153,13 @@ nsresult EditAggregateTxn::AppendChild(EditTxn *aTxn)
return NS_ERROR_NULL_POINTER;
}
nsresult EditAggregateTxn::SetName(nsIAtom *aName)
NS_IMETHODIMP EditAggregateTxn::SetName(nsIAtom *aName)
{
mName = do_QueryInterface(aName);
return NS_OK;
}
nsresult EditAggregateTxn::GetName(nsIAtom **aName)
NS_IMETHODIMP EditAggregateTxn::GetName(nsIAtom **aName)
{
if (aName)
{
@ -173,7 +173,7 @@ nsresult EditAggregateTxn::GetName(nsIAtom **aName)
return NS_ERROR_NULL_POINTER;
}
nsresult EditAggregateTxn::GetCount(PRInt32 *aCount)
NS_IMETHODIMP EditAggregateTxn::GetCount(PRInt32 *aCount)
{
if (!aCount) {
return NS_ERROR_NULL_POINTER;
@ -185,7 +185,7 @@ nsresult EditAggregateTxn::GetCount(PRInt32 *aCount)
return NS_OK;
}
nsresult EditAggregateTxn::GetTxnAt(PRInt32 aIndex, EditTxn **aTxn)
NS_IMETHODIMP EditAggregateTxn::GetTxnAt(PRInt32 aIndex, EditTxn **aTxn)
{
if (!aTxn) {
return NS_ERROR_NULL_POINTER;

View File

@ -42,40 +42,40 @@ public:
virtual ~EditAggregateTxn();
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
virtual nsresult Redo(void);
NS_IMETHOD Redo(void);
virtual nsresult GetIsTransient(PRBool *aIsTransient);
NS_IMETHOD GetIsTransient(PRBool *aIsTransient);
virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
/** append a transaction to this aggregate */
virtual nsresult AppendChild(EditTxn *aTxn);
NS_IMETHOD AppendChild(EditTxn *aTxn);
/** get the number of nested txns.
* This is the number of top-level txns, it does not do recursive decent.
*/
virtual nsresult GetCount(PRInt32 *aCount);
NS_IMETHOD GetCount(PRInt32 *aCount);
/** get the txn at index aIndex.
* returns NS_ERROR_UNEXPECTED if there is no txn at aIndex.
*/
virtual nsresult GetTxnAt(PRInt32 aIndex, EditTxn **aTxn);
NS_IMETHOD GetTxnAt(PRInt32 aIndex, EditTxn **aTxn);
/** set the name assigned to this aggregate txn */
virtual nsresult SetName(nsIAtom *aName);
NS_IMETHOD SetName(nsIAtom *aName);
/** get the name assigned to this aggregate txn */
virtual nsresult GetName(nsIAtom **aName);
NS_IMETHOD GetName(nsIAtom **aName);
protected:

View File

@ -33,53 +33,53 @@ EditTxn::EditTxn()
NS_INIT_REFCNT();
}
nsresult EditTxn::Do(void)
NS_IMETHODIMP EditTxn::Do(void)
{
return NS_OK;
}
nsresult EditTxn::Undo(void)
NS_IMETHODIMP EditTxn::Undo(void)
{
return NS_OK;
}
nsresult EditTxn::Redo(void)
NS_IMETHODIMP EditTxn::Redo(void)
{
return Do();
}
nsresult EditTxn::GetIsTransient(PRBool *aIsTransient)
NS_IMETHODIMP EditTxn::GetIsTransient(PRBool *aIsTransient)
{
if (nsnull!=aIsTransient)
*aIsTransient = PR_FALSE;
return NS_OK;
}
nsresult EditTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP EditTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
return NS_OK;
}
nsresult EditTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP EditTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult EditTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP EditTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
*aString=nsnull;
return NS_OK;
}
nsresult EditTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP EditTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
*aString=nsnull;
return NS_OK;
}
nsresult
NS_IMETHODIMP
EditTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (NULL == aInstancePtr) {

View File

@ -40,21 +40,21 @@ public:
EditTxn();
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
virtual nsresult Redo(void);
NS_IMETHOD Redo(void);
virtual nsresult GetIsTransient(PRBool *aIsTransient);
NS_IMETHOD GetIsTransient(PRBool *aIsTransient);
virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
};

View File

@ -30,9 +30,9 @@ InsertElementTxn::InsertElementTxn()
{
}
nsresult InsertElementTxn::Init(nsIDOMNode *aNode,
nsIDOMNode *aParent,
PRInt32 aOffset)
NS_IMETHODIMP InsertElementTxn::Init(nsIDOMNode *aNode,
nsIDOMNode *aParent,
PRInt32 aOffset)
{
if (!aNode || !aParent)
return NS_ERROR_NULL_POINTER;
@ -48,7 +48,7 @@ InsertElementTxn::~InsertElementTxn()
{
}
nsresult InsertElementTxn::Do(void)
NS_IMETHODIMP InsertElementTxn::Do(void)
{
if (!mNode || !mParent)
return NS_ERROR_NULL_POINTER;
@ -78,7 +78,7 @@ nsresult InsertElementTxn::Do(void)
return result;
}
nsresult InsertElementTxn::Undo(void)
NS_IMETHODIMP InsertElementTxn::Undo(void)
{
if (!mNode || !mParent)
return NS_ERROR_NULL_POINTER;
@ -88,19 +88,19 @@ nsresult InsertElementTxn::Undo(void)
return result;
}
nsresult InsertElementTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP InsertElementTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
if (nsnull!=aDidMerge)
*aDidMerge=PR_FALSE;
return NS_OK;
}
nsresult InsertElementTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP InsertElementTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult InsertElementTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP InsertElementTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -109,7 +109,7 @@ nsresult InsertElementTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult InsertElementTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP InsertElementTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{

View File

@ -40,9 +40,9 @@ public:
* @param aParent the node to insert into
* @param aOffset the offset in aParent to insert aNode
*/
virtual nsresult Init(nsIDOMNode *aNode,
nsIDOMNode *aParent,
PRInt32 aOffset);
NS_IMETHOD Init(nsIDOMNode *aNode,
nsIDOMNode *aParent,
PRInt32 aOffset);
private:
InsertElementTxn();
@ -51,17 +51,17 @@ public:
virtual ~InsertElementTxn();
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
protected:

View File

@ -40,7 +40,7 @@ InsertTextTxn::InsertTextTxn()
{
}
nsresult InsertTextTxn::Init(nsIDOMCharacterData *aElement,
NS_IMETHODIMP InsertTextTxn::Init(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
const nsString& aStringToInsert,
nsIPresShell* aPresShell)
@ -52,7 +52,7 @@ nsresult InsertTextTxn::Init(nsIDOMCharacterData *aElement,
return NS_OK;
}
nsresult InsertTextTxn::Do(void)
NS_IMETHODIMP InsertTextTxn::Do(void)
{
// advance caret: This requires the presentation shell to get the selection.
nsCOMPtr<nsIDOMSelection> selection;
@ -70,7 +70,7 @@ nsresult InsertTextTxn::Do(void)
return result;
}
nsresult InsertTextTxn::Undo(void)
NS_IMETHODIMP InsertTextTxn::Undo(void)
{
nsresult result;
PRUint32 length = mStringToInsert.Length();
@ -89,7 +89,7 @@ nsresult InsertTextTxn::Undo(void)
return result;
}
nsresult InsertTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP InsertTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
// set out param default value
if (nsnull!=aDidMerge)
@ -141,12 +141,12 @@ nsresult InsertTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
return result;
}
nsresult InsertTextTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP InsertTextTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult InsertTextTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP InsertTextTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -156,7 +156,7 @@ nsresult InsertTextTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult InsertTextTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP InsertTextTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -168,7 +168,7 @@ nsresult InsertTextTxn::GetRedoString(nsString **aString)
/* ============= nsISupports implementation ====================== */
nsresult
NS_IMETHODIMP
InsertTextTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (nsnull == aInstancePtr) {
@ -184,7 +184,7 @@ InsertTextTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr)
/* ============ protected methods ================== */
nsresult InsertTextTxn::GetData(nsString& aResult)
NS_IMETHODIMP InsertTextTxn::GetData(nsString& aResult)
{
aResult = mStringToInsert;
return NS_OK;

View File

@ -48,10 +48,10 @@ public:
* @param aString the new text to insert
* @param aPresShell used to get and set the selection
*/
virtual nsresult Init(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
const nsString& aString,
nsIPresShell* aPresShell);
NS_IMETHOD Init(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
const nsString& aString,
nsIPresShell* aPresShell);
private:
@ -59,17 +59,17 @@ private:
public:
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
// nsISupports declarations
@ -80,7 +80,7 @@ public:
/** return the string data associated with this transaction */
virtual nsresult GetData(nsString& aResult);
NS_IMETHOD GetData(nsString& aResult);
/** must be called before any InsertTextTxn is instantiated */
static nsresult ClassInit();

View File

@ -28,7 +28,7 @@ JoinElementTxn::JoinElementTxn()
{
}
nsresult JoinElementTxn::Init(nsIEditor *aEditor,
NS_IMETHODIMP JoinElementTxn::Init(nsIEditor *aEditor,
nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode)
{
@ -43,7 +43,7 @@ JoinElementTxn::~JoinElementTxn()
{
}
nsresult JoinElementTxn::Do(void)
NS_IMETHODIMP JoinElementTxn::Do(void)
{
nsresult result;
@ -82,7 +82,7 @@ nsresult JoinElementTxn::Do(void)
}
nsresult JoinElementTxn::Undo(void)
NS_IMETHODIMP JoinElementTxn::Undo(void)
{
nsresult result;
nsCOMPtr<nsIEditorSupport> editor;
@ -96,13 +96,13 @@ nsresult JoinElementTxn::Undo(void)
return result;
}
nsresult JoinElementTxn::Redo(void)
NS_IMETHODIMP JoinElementTxn::Redo(void)
{
nsresult result = mEditor->JoinNodes(mLeftNode, mRightNode, mParent, PR_FALSE);
return result;
}
nsresult JoinElementTxn::GetIsTransient(PRBool *aIsTransient)
NS_IMETHODIMP JoinElementTxn::GetIsTransient(PRBool *aIsTransient)
{
if (nsnull!=aIsTransient)
*aIsTransient = PR_FALSE;
@ -116,12 +116,12 @@ nsresult JoinElementTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
return NS_OK;
}
nsresult JoinElementTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP JoinElementTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult JoinElementTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP JoinElementTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -130,7 +130,7 @@ nsresult JoinElementTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult JoinElementTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP JoinElementTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{

View File

@ -43,9 +43,9 @@ public:
* @param aLeftNode the first of two nodes to join
* @param aRightNode the second of two nodes to join
*/
virtual nsresult Init(nsIEditor *aEditor,
nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode);
NS_IMETHOD Init(nsIEditor *aEditor,
nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode);
protected:
JoinElementTxn();
@ -53,21 +53,21 @@ public:
virtual ~JoinElementTxn();
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
virtual nsresult Redo(void);
NS_IMETHOD Redo(void);
virtual nsresult GetIsTransient(PRBool *aIsTransient);
NS_IMETHOD GetIsTransient(PRBool *aIsTransient);
virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
protected:

View File

@ -29,7 +29,7 @@ SplitElementTxn::SplitElementTxn()
{
}
nsresult SplitElementTxn::Init(nsIEditor *aEditor,
NS_IMETHODIMP SplitElementTxn::Init(nsIEditor *aEditor,
nsIDOMNode *aNode,
PRInt32 aOffset)
{
@ -43,7 +43,7 @@ SplitElementTxn::~SplitElementTxn()
{
}
nsresult SplitElementTxn::Do(void)
NS_IMETHODIMP SplitElementTxn::Do(void)
{
// create a new node
nsresult result = mExistingRightNode->CloneNode(PR_FALSE, getter_AddRefs(mNewLeftNode));
@ -69,7 +69,7 @@ nsresult SplitElementTxn::Do(void)
return result;
}
nsresult SplitElementTxn::Undo(void)
NS_IMETHODIMP SplitElementTxn::Undo(void)
{
// this assumes Do inserted the new node in front of the prior existing node
nsresult result;
@ -84,7 +84,7 @@ nsresult SplitElementTxn::Undo(void)
return result;
}
nsresult SplitElementTxn::Redo(void)
NS_IMETHODIMP SplitElementTxn::Redo(void)
{
nsresult result;
nsCOMPtr<nsIEditorSupport> editor;
@ -98,19 +98,19 @@ nsresult SplitElementTxn::Redo(void)
return result;
}
nsresult SplitElementTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
NS_IMETHODIMP SplitElementTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
{
if (nsnull!=aDidMerge)
*aDidMerge=PR_FALSE;
return NS_OK;
}
nsresult SplitElementTxn::Write(nsIOutputStream *aOutputStream)
NS_IMETHODIMP SplitElementTxn::Write(nsIOutputStream *aOutputStream)
{
return NS_OK;
}
nsresult SplitElementTxn::GetUndoString(nsString **aString)
NS_IMETHODIMP SplitElementTxn::GetUndoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -119,7 +119,7 @@ nsresult SplitElementTxn::GetUndoString(nsString **aString)
return NS_OK;
}
nsresult SplitElementTxn::GetRedoString(nsString **aString)
NS_IMETHODIMP SplitElementTxn::GetRedoString(nsString **aString)
{
if (nsnull!=aString)
{
@ -128,7 +128,7 @@ nsresult SplitElementTxn::GetRedoString(nsString **aString)
return NS_OK;
}
nsresult SplitElementTxn::GetNewNode(nsIDOMNode **aNewNode)
NS_IMETHODIMP SplitElementTxn::GetNewNode(nsIDOMNode **aNewNode)
{
if (!aNewNode)
return NS_ERROR_NULL_POINTER;

View File

@ -44,30 +44,30 @@ public:
* aOffset may refer to children of aNode, or content of aNode.
* The left node will have child|content 0..aOffset-1.
*/
virtual nsresult Init (nsIEditor *aEditor,
nsIDOMNode *aNode,
PRInt32 aOffset);
NS_IMETHOD Init (nsIEditor *aEditor,
nsIDOMNode *aNode,
PRInt32 aOffset);
protected:
SplitElementTxn();
public:
virtual ~SplitElementTxn();
virtual nsresult Do(void);
NS_IMETHOD Do(void);
virtual nsresult Undo(void);
NS_IMETHOD Undo(void);
virtual nsresult Redo(void);
NS_IMETHOD Redo(void);
virtual nsresult Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
NS_IMETHOD Merge(PRBool *aDidMerge, nsITransaction *aTransaction);
virtual nsresult Write(nsIOutputStream *aOutputStream);
NS_IMETHOD Write(nsIOutputStream *aOutputStream);
virtual nsresult GetUndoString(nsString **aString);
NS_IMETHOD GetUndoString(nsString **aString);
virtual nsresult GetRedoString(nsString **aString);
NS_IMETHOD GetRedoString(nsString **aString);
virtual nsresult GetNewNode(nsIDOMNode **aNewNode);
NS_IMETHOD GetNewNode(nsIDOMNode **aNewNode);
protected:

View File

@ -28,6 +28,15 @@
#include "ChangeAttributeTxn.h"
#include "SplitElementTxn.h"
#include "JoinElementTxn.h"
#include "InsertTableTxn.h"
#include "InsertTableCellTxn.h"
#include "InsertTableColumnTxn.h"
#include "InsertTableRowTxn.h"
#include "DeleteTableTxn.h"
#include "DeleteTableCellTxn.h"
#include "DeleteTableColumnTxn.h"
#include "DeleteTableRowTxn.h"
#include "JoinTableCellsTxn.h"
static NS_DEFINE_IID(kEditAggregateTxnIID, EDIT_AGGREGATE_TXN_IID);
static NS_DEFINE_IID(kInsertTextTxnIID, INSERT_TEXT_TXN_IID);
@ -39,6 +48,15 @@ static NS_DEFINE_IID(kDeleteRangeTxnIID, DELETE_RANGE_TXN_IID);
static NS_DEFINE_IID(kChangeAttributeTxnIID,CHANGE_ATTRIBUTE_TXN_IID);
static NS_DEFINE_IID(kSplitElementTxnIID, SPLIT_ELEMENT_TXN_IID);
static NS_DEFINE_IID(kJoinElementTxnIID, JOIN_ELEMENT_TXN_IID);
static NS_DEFINE_IID(kInsertTableTxnIID, INSERT_TABLE_TXN_IID);
static NS_DEFINE_IID(kInsertTableCellTxnIID, INSERT_CELL_TXN_IID);
static NS_DEFINE_IID(kInsertTableColumnTxnIID, INSERT_COLUMN_TXN_IID);
static NS_DEFINE_IID(kInsertTableRowTxnIID, INSERT_ROW_TXN_IID);
static NS_DEFINE_IID(kDeleteTableTxnIID, DELETE_TABLE_TXN_IID);
static NS_DEFINE_IID(kDeleteTableCellTxnIID, DELETE_CELL_TXN_IID);
static NS_DEFINE_IID(kDeleteTableColumnTxnIID, DELETE_COLUMN_TXN_IID);
static NS_DEFINE_IID(kDeleteTableRowTxnIID, DELETE_ROW_TXN_IID);
static NS_DEFINE_IID(kJoinTableCellsTxnIID, JOIN_CELLS_TXN_IID);
TransactionFactory::TransactionFactory()
{

View File

@ -29,6 +29,7 @@
#include "nsIServiceManager.h"
#include "nsEditFactory.h"
#include "nsTextEditFactory.h"
#include "nsHTMLEditFactory.h"
#include "nsEditorCID.h"
#include "nsTransactionManagerCID.h"
#include "nsITransactionManager.h"
@ -40,8 +41,7 @@
#include "nsVoidArray.h"
#include "nsICaret.h"
#include "nsIContent.h" // for temp method GetColIndexForCell, to be removed
#include "nsITableCellLayout.h" // for temp method GetColIndexForCell, to be removed
#include "nsIContent.h" // for method GetLayoutObject
// transactions the editor knows how to build
#include "TransactionFactory.h"
@ -71,6 +71,7 @@ static NS_DEFINE_IID(kIEditorSupportIID, NS_IEDITORSUPPORT_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kEditorCID, NS_EDITOR_CID);
static NS_DEFINE_CID(kTextEditorCID, NS_TEXTEDITOR_CID);
static NS_DEFINE_CID(kHTMLEditorCID, NS_HTMLEDITOR_CID);
// transaction manager
static NS_DEFINE_IID(kITransactionManagerIID, NS_ITRANSACTIONMANAGER_IID);
static NS_DEFINE_CID(kCTransactionManagerFactoryCID, NS_TRANSACTION_MANAGER_FACTORY_CID);
@ -86,7 +87,6 @@ static NS_DEFINE_IID(kChangeAttributeTxnIID,CHANGE_ATTRIBUTE_TXN_IID);
static NS_DEFINE_IID(kSplitElementTxnIID, SPLIT_ELEMENT_TXN_IID);
static NS_DEFINE_IID(kJoinElementTxnIID, JOIN_ELEMENT_TXN_IID);
#ifdef XP_PC
#define TRANSACTION_MANAGER_DLL "txmgr.dll"
#else
@ -102,8 +102,7 @@ static NS_DEFINE_IID(kJoinElementTxnIID, JOIN_ELEMENT_TXN_IID);
/* ----- TEST METHODS DECLARATIONS ----- */
// Methods defined here are TEMPORARY
nsresult
GetColIndexForCell(nsIPresShell *aPresShell, nsIDOMNode *aCellNode, PRInt32 &aCellIndex);
//NS_IMETHODIMP GetColIndexForCell(nsIPresShell *aPresShell, nsIDOMNode *aCellNode, PRInt32 &aCellIndex);
/* ----- END TEST METHOD DECLARATIONS ----- */
@ -149,6 +148,9 @@ extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports * aServiceMgr,
else if (aClass.Equals(kTextEditorCID)) {
return GetTextEditFactory(aFactory, aClass);
}
else if (aClass.Equals(kHTMLEditorCID)) {
return GetHTMLEditFactory(aFactory, aClass);
}
return NS_NOINTERFACE;
}
@ -208,7 +210,7 @@ NS_IMPL_RELEASE(nsEditor)
nsresult
NS_IMETHODIMP
nsEditor::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (nsnull == aInstancePtr) {
@ -236,7 +238,7 @@ nsEditor::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
NS_IMETHODIMP
nsEditor::GetDocument(nsIDOMDocument **aDoc)
{
*aDoc = nsnull; // init out param
@ -246,7 +248,8 @@ nsEditor::GetDocument(nsIDOMDocument **aDoc)
return mDoc->QueryInterface(kIDOMDocumentIID, (void **)aDoc);
}
nsresult
NS_IMETHODIMP
nsEditor::GetSelection(nsIDOMSelection **aSelection)
{
if (!aSelection)
@ -256,7 +259,7 @@ nsEditor::GetSelection(nsIDOMSelection **aSelection)
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell)
{
NS_PRECONDITION(nsnull!=aDoc && nsnull!=aPresShell, "bad arg");
@ -279,11 +282,11 @@ nsEditor::Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell)
}
NS_POSTCONDITION(mDoc && mPresShell, "bad state");
return NS_OK;
}
nsresult
NS_IMETHODIMP
nsEditor::EnableUndo(PRBool aEnable)
{
nsITransactionManager *txnMgr = 0;
@ -318,7 +321,7 @@ nsEditor::EnableUndo(PRBool aEnable)
return result;
}
nsresult nsEditor::CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo)
NS_IMETHODIMP nsEditor::CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo)
{
aIsEnabled = ((PRBool)((nsITransactionManager *)0!=mTxnMgr.get()));
if (aIsEnabled)
@ -333,7 +336,7 @@ nsresult nsEditor::CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo)
return NS_OK;
}
nsresult nsEditor::CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo)
NS_IMETHODIMP nsEditor::CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo)
{
aIsEnabled = ((PRBool)((nsITransactionManager *)0!=mTxnMgr.get()));
if (aIsEnabled)
@ -348,7 +351,7 @@ nsresult nsEditor::CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo)
return NS_OK;
}
nsresult
NS_IMETHODIMP
nsEditor::SetProperties(nsVoidArray *aPropList)
{
return NS_OK;
@ -356,14 +359,14 @@ nsEditor::SetProperties(nsVoidArray *aPropList)
nsresult
NS_IMETHODIMP
nsEditor::GetProperties(nsVoidArray *aPropList)
{
return NS_OK;
}
nsresult
NS_IMETHODIMP
nsEditor::SetAttribute(nsIDOMElement *aElement, const nsString& aAttribute, const nsString& aValue)
{
ChangeAttributeTxn *txn;
@ -375,7 +378,7 @@ nsEditor::SetAttribute(nsIDOMElement *aElement, const nsString& aAttribute, cons
}
nsresult
NS_IMETHODIMP
nsEditor::CreateTxnForSetAttribute(nsIDOMElement *aElement,
const nsString& aAttribute,
const nsString& aValue,
@ -392,7 +395,7 @@ nsEditor::CreateTxnForSetAttribute(nsIDOMElement *aElement,
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::GetAttributeValue(nsIDOMElement *aElement,
const nsString& aAttribute,
nsString& aResultValue,
@ -413,7 +416,7 @@ nsEditor::GetAttributeValue(nsIDOMElement *aElement,
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::RemoveAttribute(nsIDOMElement *aElement, const nsString& aAttribute)
{
ChangeAttributeTxn *txn;
@ -424,7 +427,7 @@ nsEditor::RemoveAttribute(nsIDOMElement *aElement, const nsString& aAttribute)
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::CreateTxnForRemoveAttribute(nsIDOMElement *aElement,
const nsString& aAttribute,
ChangeAttributeTxn ** aTxn)
@ -442,7 +445,7 @@ nsEditor::CreateTxnForRemoveAttribute(nsIDOMElement *aElement,
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::InsertBreak(PRBool aCtrlKey)
{
if (aCtrlKey)
@ -462,7 +465,7 @@ nsEditor::InsertBreak(PRBool aCtrlKey)
//BEGIN nsEditor Private methods
nsresult
NS_IMETHODIMP
nsEditor::GetFirstNodeOfType(nsIDOMNode *aStartNode, const nsString &aTag, nsIDOMNode **aResult)
{
nsresult result=NS_OK;
@ -518,7 +521,7 @@ nsEditor::GetFirstNodeOfType(nsIDOMNode *aStartNode, const nsString &aTag, nsIDO
nsresult
NS_IMETHODIMP
nsEditor::GetFirstTextNode(nsIDOMNode *aNode, nsIDOMNode **aRetNode)
{
if (!aNode || !aRetNode)
@ -566,7 +569,7 @@ nsEditor::GetFirstTextNode(nsIDOMNode *aNode, nsIDOMNode **aRetNode)
return NS_OK;
}
nsresult
NS_IMETHODIMP
nsEditor::Do(nsITransaction *aTxn)
{
nsresult result = NS_OK;
@ -582,7 +585,7 @@ nsEditor::Do(nsITransaction *aTxn)
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::Undo(PRUint32 aCount)
{
nsresult result = NS_OK;
@ -599,7 +602,7 @@ nsEditor::Undo(PRUint32 aCount)
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::Redo(PRUint32 aCount)
{
nsresult result = NS_OK;
@ -616,7 +619,7 @@ nsEditor::Redo(PRUint32 aCount)
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::BeginTransaction()
{
NS_PRECONDITION(mUpdateCount>=0, "bad state");
@ -633,7 +636,7 @@ nsEditor::BeginTransaction()
return NS_OK;
}
nsresult
NS_IMETHODIMP
nsEditor::EndTransaction()
{
NS_PRECONDITION(mUpdateCount>0, "bad state");
@ -650,7 +653,7 @@ nsEditor::EndTransaction()
return NS_OK;
}
nsresult nsEditor::ScrollIntoView(PRBool aScrollToBegin)
NS_IMETHODIMP nsEditor::ScrollIntoView(PRBool aScrollToBegin)
{
return NS_OK; //mjudge we should depricate this method
/* nsresult result;
@ -690,7 +693,7 @@ nsresult nsEditor::ScrollIntoView(PRBool aScrollToBegin)
}
nsresult nsEditor::CreateNode(const nsString& aTag,
NS_IMETHODIMP nsEditor::CreateNode(const nsString& aTag,
nsIDOMNode * aParent,
PRInt32 aPosition,
nsIDOMNode ** aNewNode)
@ -709,7 +712,7 @@ nsresult nsEditor::CreateNode(const nsString& aTag,
return result;
}
nsresult nsEditor::CreateTxnForCreateElement(const nsString& aTag,
NS_IMETHODIMP nsEditor::CreateTxnForCreateElement(const nsString& aTag,
nsIDOMNode *aParent,
PRInt32 aPosition,
CreateElementTxn ** aTxn)
@ -725,7 +728,7 @@ nsresult nsEditor::CreateTxnForCreateElement(const nsString& aTag,
return result;
}
nsresult nsEditor::InsertNode(nsIDOMNode * aNode,
NS_IMETHODIMP nsEditor::InsertNode(nsIDOMNode * aNode,
nsIDOMNode * aParent,
PRInt32 aPosition)
{
@ -737,7 +740,7 @@ nsresult nsEditor::InsertNode(nsIDOMNode * aNode,
return result;
}
nsresult nsEditor::CreateTxnForInsertElement(nsIDOMNode * aNode,
NS_IMETHODIMP nsEditor::CreateTxnForInsertElement(nsIDOMNode * aNode,
nsIDOMNode * aParent,
PRInt32 aPosition,
InsertElementTxn ** aTxn)
@ -753,7 +756,7 @@ nsresult nsEditor::CreateTxnForInsertElement(nsIDOMNode * aNode,
return result;
}
nsresult nsEditor::DeleteNode(nsIDOMNode * aElement)
NS_IMETHODIMP nsEditor::DeleteNode(nsIDOMNode * aElement)
{
DeleteElementTxn *txn;
nsresult result = CreateTxnForDeleteElement(aElement, &txn);
@ -763,7 +766,7 @@ nsresult nsEditor::DeleteNode(nsIDOMNode * aElement)
return result;
}
nsresult nsEditor::CreateTxnForDeleteElement(nsIDOMNode * aElement,
NS_IMETHODIMP nsEditor::CreateTxnForDeleteElement(nsIDOMNode * aElement,
DeleteElementTxn ** aTxn)
{
nsresult result = NS_ERROR_NULL_POINTER;
@ -777,31 +780,63 @@ nsresult nsEditor::CreateTxnForDeleteElement(nsIDOMNode * aElement,
return result;
}
nsresult
nsEditor::InsertText(const nsString& aStringToInsert)
NS_IMETHODIMP nsEditor::CreateAggregateTxnForDeleteSelection(nsIAtom *aTxnName, nsISupports **aAggTxn)
{
nsresult result;
EditAggregateTxn *aggTxn;
result = TransactionFactory::GetNewTransaction(kEditAggregateTxnIID, (EditTxn **)&aggTxn);
if ((NS_FAILED(result)) || (nsnull==aggTxn)) {
return NS_ERROR_OUT_OF_MEMORY;
}
aggTxn->SetName(InsertTextTxn::gInsertTextTxnName);
nsCOMPtr<nsIDOMSelection> selection;
result = mPresShell->GetSelection(getter_AddRefs(selection));
if (NS_SUCCEEDED(result) && selection)
nsresult result = NS_ERROR_NULL_POINTER;
if (aAggTxn)
{
PRBool collapsed;
result = selection->IsCollapsed(&collapsed);
if (NS_SUCCEEDED(result) && !collapsed) {
EditAggregateTxn *delSelTxn;
result = CreateTxnForDeleteSelection(nsIEditor::eLTR, &delSelTxn);
if (NS_SUCCEEDED(result) && delSelTxn) {
aggTxn->AppendChild(delSelTxn);
*aAggTxn = nsnull;
EditAggregateTxn *aTxn = nsnull;
result = TransactionFactory::GetNewTransaction(kEditAggregateTxnIID, (EditTxn**)&aTxn);
if ((NS_FAILED(result)) || !aTxn) {
return NS_ERROR_OUT_OF_MEMORY;
}
// Return transaction pointer
*aAggTxn = (nsISupports*)aTxn;
#if 0
//Test to be sure the Return the transaction pointer as nsISupports*
result = aTxn->QueryInterface(kISupportsIID, (void**)aAggTxn);
if (!NS_SUCCEEDED(result))
return NS_ERROR_UNEXPECTED;
#endif
// Set the name for the aggregate transaction
aTxn->SetName(aTxnName);
// Get current selection and setup txn to delete it,
// but only if selection exists (is not a collapsed "caret" state)
nsCOMPtr<nsIDOMSelection> selection;
result = mPresShell->GetSelection(getter_AddRefs(selection));
if (NS_SUCCEEDED(result) && selection)
{
PRBool collapsed;
result = selection->IsCollapsed(&collapsed);
if (NS_SUCCEEDED(result) && !collapsed) {
EditAggregateTxn *delSelTxn;
result = CreateTxnForDeleteSelection(nsIEditor::eLTR, &delSelTxn);
if (NS_SUCCEEDED(result) && delSelTxn) {
aTxn->AppendChild(delSelTxn);
}
}
}
}
return result;
}
NS_IMETHODIMP
nsEditor::InsertText(const nsString& aStringToInsert)
{
EditAggregateTxn *aggTxn = nsnull;
// Create the "delete current selection" txn
nsresult result = CreateAggregateTxnForDeleteSelection(InsertTextTxn::gInsertTextTxnName, (nsISupports**)&aggTxn);
if ((NS_FAILED(result)) || (nsnull==aggTxn)) {
return NS_ERROR_OUT_OF_MEMORY;
}
InsertTextTxn *txn;
result = CreateTxnForInsertText(aStringToInsert, &txn);
if ((NS_SUCCEEDED(result)) && txn) {
@ -811,7 +846,7 @@ nsEditor::InsertText(const nsString& aStringToInsert)
return result;
}
nsresult nsEditor::CreateTxnForInsertText(const nsString & aStringToInsert,
NS_IMETHODIMP nsEditor::CreateTxnForInsertText(const nsString & aStringToInsert,
InsertTextTxn ** aTxn)
{
nsresult result;
@ -862,7 +897,7 @@ nsresult nsEditor::CreateTxnForInsertText(const nsString & aStringToInsert,
return result;
}
nsresult nsEditor::DeleteText(nsIDOMCharacterData *aElement,
NS_IMETHODIMP nsEditor::DeleteText(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
PRUint32 aLength)
{
@ -875,7 +910,7 @@ nsresult nsEditor::DeleteText(nsIDOMCharacterData *aElement,
}
nsresult nsEditor::CreateTxnForDeleteText(nsIDOMCharacterData *aElement,
NS_IMETHODIMP nsEditor::CreateTxnForDeleteText(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
PRUint32 aLength,
DeleteTextTxn **aTxn)
@ -902,7 +937,7 @@ nsresult nsEditor::CreateTxnForDeleteText(nsIDOMCharacterData *aElement,
*/
#if 0 // THIS CODE WILL BE REMOVED. WE ARE GOING TO IMPLEMENT
// A GENERIC HANDLER SYSTEM.
nsresult nsEditor::CreateTxnToHandleEnterKey(EditAggregateTxn **aTxn)
NS_IMETHODIMP nsEditor::CreateTxnToHandleEnterKey(EditAggregateTxn **aTxn)
{
// allocate the out-param transaction
nsresult result = TransactionFactory::GetNewTransaction(kEditAggregateTxnIID, (EditTxn **)aTxn);
@ -969,9 +1004,57 @@ nsresult nsEditor::CreateTxnToHandleEnterKey(EditAggregateTxn **aTxn)
}
#endif
NS_IMETHODIMP nsEditor::DeleteSelectionAndCreateNode(const nsString& aTag, nsIDOMNode ** aNewNode)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
nsCOMPtr<nsIDOMSelection> selection;
result = GetSelection(getter_AddRefs(selection));
if ((NS_SUCCEEDED(result)) && selection)
{
PRBool collapsed;
result = selection->IsCollapsed(&collapsed);
if (NS_SUCCEEDED(result) && !collapsed)
{
result = DeleteSelection(nsIEditor::eLTR);
// get the new selection
result = GetSelection(getter_AddRefs(selection));
#ifdef NS_DEBUG
PRBool testCollapsed;
result = selection->IsCollapsed(&testCollapsed);
NS_ASSERTION(PR_TRUE==testCollapsed, "selection not reset after deletion");
#endif
}
// split the text node
nsCOMPtr<nsIDOMNode> node;
PRInt32 offset;
result = selection->GetAnchorNodeAndOffset(getter_AddRefs(node), &offset);
if ((NS_SUCCEEDED(result)) && node)
{
nsCOMPtr<nsIDOMNode> parentNode;
result = node->GetParentNode(getter_AddRefs(parentNode));
if ((NS_SUCCEEDED(result)) && parentNode)
{
nsCOMPtr<nsIDOMNode> newNode;
result = SplitNode(node, offset, getter_AddRefs(newNode));
if (NS_SUCCEEDED(result))
{ // now get the node's offset in it's parent, and insert the new tag there
result = nsIEditorSupport::GetChildOffset(node, parentNode, offset);
if (NS_SUCCEEDED(result))
{
result = CreateNode(aTag, parentNode, offset, getter_AddRefs(newNode));
selection->Collapse(parentNode, offset);
*aNewNode = newNode;
}
}
}
}
}
return result;
}
#define DELETE_SELECTION_DOESNT_GO_THROUGH_RANGE
nsresult
NS_IMETHODIMP
nsEditor::DeleteSelection(nsIEditor::Direction aDir)
{
nsresult result;
@ -993,7 +1076,7 @@ nsEditor::DeleteSelection(nsIEditor::Direction aDir)
return result;
}
nsresult nsEditor::CreateTxnForDeleteSelection(nsIEditor::Direction aDir,
NS_IMETHODIMP nsEditor::CreateTxnForDeleteSelection(nsIEditor::Direction aDir,
EditAggregateTxn ** aTxn)
{
if (!aTxn)
@ -1055,7 +1138,7 @@ nsresult nsEditor::CreateTxnForDeleteSelection(nsIEditor::Direction aDir,
//XXX: currently, this doesn't handle edge conditions because GetNext/GetPrior are not implemented
nsresult
NS_IMETHODIMP
nsEditor::CreateTxnForDeleteInsertionPoint(nsIDOMRange *aRange,
nsIEditor::Direction aDir,
EditAggregateTxn *aTxn)
@ -1083,7 +1166,7 @@ nsEditor::CreateTxnForDeleteInsertionPoint(nsIDOMRange *aRange,
PRUint32 count;
nodeAsText->GetLength(&count);
isFirst = PRBool(0==offset);
isLast = PRBool(count==offset);
isLast = PRBool(count==(PRUint32)offset);
}
else
{
@ -1195,7 +1278,7 @@ nsEditor::CreateTxnForDeleteInsertionPoint(nsIDOMRange *aRange,
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::GetPriorNode(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode)
{
nsresult result;
@ -1226,7 +1309,7 @@ nsEditor::GetPriorNode(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode)
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::GetNextNode(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode)
{
nsresult result;
@ -1256,7 +1339,7 @@ nsEditor::GetNextNode(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode)
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::GetRightmostChild(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode)
{
nsresult result = NS_OK;
@ -1277,7 +1360,7 @@ nsEditor::GetRightmostChild(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode)
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::GetLeftmostChild(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode)
{
nsresult result = NS_OK;
@ -1298,7 +1381,7 @@ nsEditor::GetLeftmostChild(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode)
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::SplitNode(nsIDOMNode * aNode,
PRInt32 aOffset,
nsIDOMNode **aNewLeftNode)
@ -1317,7 +1400,7 @@ nsEditor::SplitNode(nsIDOMNode * aNode,
return result;
}
nsresult nsEditor::CreateTxnForSplitNode(nsIDOMNode *aNode,
NS_IMETHODIMP nsEditor::CreateTxnForSplitNode(nsIDOMNode *aNode,
PRUint32 aOffset,
SplitElementTxn **aTxn)
{
@ -1332,7 +1415,7 @@ nsresult nsEditor::CreateTxnForSplitNode(nsIDOMNode *aNode,
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::JoinNodes(nsIDOMNode * aNodeToKeep,
nsIDOMNode * aNodeToJoin,
nsIDOMNode * aParent,
@ -1346,7 +1429,7 @@ nsEditor::JoinNodes(nsIDOMNode * aNodeToKeep,
return result;
}
nsresult nsEditor::CreateTxnForJoinNode(nsIDOMNode *aLeftNode,
NS_IMETHODIMP nsEditor::CreateTxnForJoinNode(nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode,
JoinElementTxn **aTxn)
{
@ -1361,7 +1444,7 @@ nsresult nsEditor::CreateTxnForJoinNode(nsIDOMNode *aLeftNode,
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::SplitNodeImpl(nsIDOMNode * aExistingRightNode,
PRInt32 aOffset,
nsIDOMNode* aNewLeftNode,
@ -1428,7 +1511,7 @@ nsEditor::SplitNodeImpl(nsIDOMNode * aExistingRightNode,
return result;
}
nsresult
NS_IMETHODIMP
nsEditor::JoinNodesImpl(nsIDOMNode * aNodeToKeep,
nsIDOMNode * aNodeToJoin,
nsIDOMNode * aParent,
@ -1545,18 +1628,37 @@ nsresult nsIEditorSupport::GetChildOffset(nsIDOMNode *aChild, nsIDOMNode *aParen
return result;
}
NS_IMETHODIMP nsEditor::GetLayoutObject(nsIDOMNode *aNode, nsISupports **aLayoutObject)
{
nsresult result = NS_ERROR_FAILURE; // we return an error unless we get the index
if( mPresShell != nsnull )
{
if ((nsnull!=aNode))
{ // get the content interface
nsCOMPtr<nsIContent> nodeAsContent(aNode);
if (nodeAsContent)
{ // get the frame from the content interface
nsISupports *layoutObject=nsnull; // frames are not ref counted, so don't use an nsCOMPtr
*aLayoutObject = nsnull;
return (NS_SUCCEEDED(mPresShell->GetLayoutObjectFor(nodeAsContent, &layoutObject)));
}
}
else {
result = NS_ERROR_NULL_POINTER;
}
}
return result;
}
//END nsEditor Private methods
/* ----- TEST METHODS ----- */
// Methods defined here are TEMPORARY
nsresult
GetColIndexForCell(nsIPresShell *aPresShell, nsIDOMNode *aCellNode, PRInt32 &aCellIndex)
/* ORIGINAL version by Steve - KEEP FOR REFERENCE
NS_IMETHODIMP GetColIndexForCell(nsIPresShell *aPresShell, nsIDOMNode *aCellNode, PRInt32 &aCellIndex)
{
aCellIndex=0; // initialize out param
nsresult result = NS_ERROR_FAILURE; // we return an error unless we get the index
@ -1583,6 +1685,7 @@ GetColIndexForCell(nsIPresShell *aPresShell, nsIDOMNode *aCellNode, PRInt32 &aCe
}
return result;
}
*/
/* ----- END TEST METHODS ----- */

View File

@ -82,69 +82,73 @@ public:
/*interfaces for addref and release and queryinterface*/
NS_DECL_ISUPPORTS
virtual nsresult Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell);
NS_IMETHOD Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell);
virtual nsresult GetDocument(nsIDOMDocument **aDoc);
NS_IMETHOD GetDocument(nsIDOMDocument **aDoc);
virtual nsresult GetSelection(nsIDOMSelection **aSelection);
NS_IMETHOD GetSelection(nsIDOMSelection **aSelection);
virtual nsresult SetProperties(nsVoidArray *aPropList);
NS_IMETHOD SetProperties(nsVoidArray *aPropList);
virtual nsresult GetProperties(nsVoidArray *aPropList);
NS_IMETHOD GetProperties(nsVoidArray *aPropList);
virtual nsresult SetAttribute(nsIDOMElement * aElement,
const nsString& aAttribute,
const nsString& aValue);
NS_IMETHOD SetAttribute(nsIDOMElement * aElement,
const nsString& aAttribute,
const nsString& aValue);
virtual nsresult GetAttributeValue(nsIDOMElement * aElement,
const nsString& aAttribute,
nsString& aResultValue,
PRBool& aResultIsSet);
NS_IMETHOD GetAttributeValue(nsIDOMElement * aElement,
const nsString& aAttribute,
nsString& aResultValue,
PRBool& aResultIsSet);
virtual nsresult RemoveAttribute(nsIDOMElement *aElement, const nsString& aAttribute);
NS_IMETHOD RemoveAttribute(nsIDOMElement *aElement, const nsString& aAttribute);
virtual nsresult CreateNode(const nsString& aTag,
nsIDOMNode * aParent,
PRInt32 aPosition,
nsIDOMNode ** aNewNode);
NS_IMETHOD CreateNode(const nsString& aTag,
nsIDOMNode * aParent,
PRInt32 aPosition,
nsIDOMNode ** aNewNode);
virtual nsresult InsertNode(nsIDOMNode * aNode,
nsIDOMNode * aParent,
PRInt32 aPosition);
virtual nsresult InsertText(const nsString& aStringToInsert);
NS_IMETHOD InsertNode(nsIDOMNode * aNode,
nsIDOMNode * aParent,
PRInt32 aPosition);
NS_IMETHOD InsertText(const nsString& aStringToInsert);
virtual nsresult DeleteNode(nsIDOMNode * aChild);
NS_IMETHOD DeleteNode(nsIDOMNode * aChild);
virtual nsresult DeleteSelection(nsIEditor::Direction aDir);
NS_IMETHOD DeleteSelection(nsIEditor::Direction aDir);
virtual nsresult SplitNode(nsIDOMNode * aExistingRightNode,
PRInt32 aOffset,
nsIDOMNode ** aNewLeftNode);
NS_IMETHOD DeleteSelectionAndCreateNode(const nsString& aTag, nsIDOMNode ** aNewNode);
virtual nsresult JoinNodes(nsIDOMNode * aNodeToKeep,
nsIDOMNode * aNodeToJoin,
nsIDOMNode * aParent,
PRBool aNodeToKeepIsFirst);
NS_IMETHOD SplitNode(nsIDOMNode * aExistingRightNode,
PRInt32 aOffset,
nsIDOMNode ** aNewLeftNode);
NS_IMETHOD JoinNodes(nsIDOMNode * aNodeToKeep,
nsIDOMNode * aNodeToJoin,
nsIDOMNode * aParent,
PRBool aNodeToKeepIsFirst);
virtual nsresult InsertBreak(PRBool aCtrlKey);
NS_IMETHOD InsertBreak(PRBool aCtrlKey);
virtual nsresult EnableUndo(PRBool aEnable);
NS_IMETHOD EnableUndo(PRBool aEnable);
virtual nsresult Do(nsITransaction *aTxn);
NS_IMETHOD Do(nsITransaction *aTxn);
virtual nsresult Undo(PRUint32 aCount);
NS_IMETHOD Undo(PRUint32 aCount);
virtual nsresult CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo);
NS_IMETHOD CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo);
virtual nsresult Redo(PRUint32 aCount);
NS_IMETHOD Redo(PRUint32 aCount);
virtual nsresult CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo);
NS_IMETHOD CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo);
virtual nsresult BeginTransaction();
NS_IMETHOD BeginTransaction();
virtual nsresult EndTransaction();
NS_IMETHOD EndTransaction();
virtual nsresult ScrollIntoView(PRBool aScrollToBegin);
NS_IMETHOD GetLayoutObject(nsIDOMNode *aNode, nsISupports **aLayoutObject);
NS_IMETHOD ScrollIntoView(PRBool aScrollToBegin);
/*END nsIEditor interfaces*/
@ -161,7 +165,7 @@ public:
*
* NOTE: this method will probably be removed.
*/
nsresult GetFirstTextNode(nsIDOMNode *aNode, nsIDOMNode **aRetNode);
NS_IMETHOD GetFirstTextNode(nsIDOMNode *aNode, nsIDOMNode **aRetNode);
/** GetFirstNodeOfType ADDREFFS and will get the next available node from the passed
* in aStartNode parameter of type aTag.
@ -170,84 +174,86 @@ public:
* @param nsIAtom *aTag is the type of node we are searching for
* @param nsIDOMNode **aResult is the node we found, or nsnull if there is none
*/
nsresult GetFirstNodeOfType(nsIDOMNode *aStartNode, const nsString &aTag, nsIDOMNode **aResult);
NS_IMETHOD GetFirstNodeOfType(nsIDOMNode *aStartNode, const nsString &aTag, nsIDOMNode **aResult);
/*END public methods of nsEditor*/
/*BEGIN private methods used by the implementations of the above functions*/
protected:
virtual nsresult CreateTxnForSetAttribute(nsIDOMElement *aElement,
const nsString& aAttribute,
const nsString& aValue,
ChangeAttributeTxn ** aTxn);
NS_IMETHOD CreateTxnForSetAttribute(nsIDOMElement *aElement,
const nsString& aAttribute,
const nsString& aValue,
ChangeAttributeTxn ** aTxn);
virtual nsresult CreateTxnForRemoveAttribute(nsIDOMElement *aElement,
const nsString& aAttribute,
ChangeAttributeTxn ** aTxn);
NS_IMETHOD CreateTxnForRemoveAttribute(nsIDOMElement *aElement,
const nsString& aAttribute,
ChangeAttributeTxn ** aTxn);
virtual nsresult CreateTxnForCreateElement(const nsString& aTag,
nsIDOMNode *aParent,
PRInt32 aPosition,
CreateElementTxn ** aTxn);
NS_IMETHOD CreateTxnForCreateElement(const nsString& aTag,
nsIDOMNode *aParent,
PRInt32 aPosition,
CreateElementTxn ** aTxn);
virtual nsresult CreateTxnForInsertElement(nsIDOMNode * aNode,
nsIDOMNode * aParent,
PRInt32 aOffset,
InsertElementTxn ** aTxn);
NS_IMETHOD CreateTxnForInsertElement(nsIDOMNode * aNode,
nsIDOMNode * aParent,
PRInt32 aOffset,
InsertElementTxn ** aTxn);
virtual nsresult CreateTxnForDeleteElement(nsIDOMNode * aElement,
DeleteElementTxn ** aTxn);
NS_IMETHOD CreateTxnForDeleteElement(nsIDOMNode * aElement,
DeleteElementTxn ** aTxn);
virtual nsresult CreateTxnForInsertText(const nsString & aStringToInsert,
InsertTextTxn ** aTxn);
NS_IMETHOD CreateTxnForInsertText(const nsString & aStringToInsert,
InsertTextTxn ** aTxn);
virtual nsresult DeleteText(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
PRUint32 aLength);
NS_IMETHOD DeleteText(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
PRUint32 aLength);
virtual nsresult CreateTxnForDeleteText(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
PRUint32 aLength,
DeleteTextTxn **aTxn);
NS_IMETHOD CreateTxnForDeleteText(nsIDOMCharacterData *aElement,
PRUint32 aOffset,
PRUint32 aLength,
DeleteTextTxn **aTxn);
virtual nsresult CreateTxnForDeleteSelection(nsIEditor::Direction aDir,
EditAggregateTxn ** aTxn);
NS_IMETHOD CreateTxnForDeleteSelection(nsIEditor::Direction aDir,
EditAggregateTxn ** aTxn);
virtual nsresult CreateTxnForDeleteInsertionPoint(nsIDOMRange *aRange,
nsIEditor::Direction aDir,
EditAggregateTxn *aTxn);
NS_IMETHOD CreateTxnForDeleteInsertionPoint(nsIDOMRange *aRange,
nsIEditor::Direction aDir,
EditAggregateTxn *aTxn);
virtual nsresult CreateTxnForSplitNode(nsIDOMNode *aNode,
PRUint32 aOffset,
SplitElementTxn **aTxn);
NS_IMETHOD CreateTxnForSplitNode(nsIDOMNode *aNode,
PRUint32 aOffset,
SplitElementTxn **aTxn);
virtual nsresult SplitNodeImpl(nsIDOMNode * aExistingRightNode,
PRInt32 aOffset,
nsIDOMNode * aNewLeftNode,
nsIDOMNode * aParent);
NS_IMETHOD SplitNodeImpl(nsIDOMNode * aExistingRightNode,
PRInt32 aOffset,
nsIDOMNode * aNewLeftNode,
nsIDOMNode * aParent);
virtual nsresult CreateTxnForJoinNode(nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode,
JoinElementTxn **aTxn);
NS_IMETHOD CreateTxnForJoinNode(nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode,
JoinElementTxn **aTxn);
virtual nsresult JoinNodesImpl(nsIDOMNode * aNodeToKeep,
nsIDOMNode * aNodeToJoin,
nsIDOMNode * aParent,
PRBool aNodeToKeepIsFirst);
NS_IMETHOD JoinNodesImpl(nsIDOMNode * aNodeToKeep,
nsIDOMNode * aNodeToJoin,
nsIDOMNode * aParent,
PRBool aNodeToKeepIsFirst);
NS_IMETHOD CreateAggregateTxnForDeleteSelection(nsIAtom *aTxnName, nsISupports **aAggTxn);
#if 0
nsresult CreateTxnToHandleEnterKey(EditAggregateTxn **aTxn);
NS_IMETHOD CreateTxnToHandleEnterKey(EditAggregateTxn **aTxn);
#endif
nsresult GetPriorNode(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode);
NS_IMETHOD GetPriorNode(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode);
nsresult GetNextNode(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode);
NS_IMETHOD GetNextNode(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode);
nsresult GetRightmostChild(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode);
NS_IMETHOD GetRightmostChild(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode);
nsresult GetLeftmostChild(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode);
NS_IMETHOD GetLeftmostChild(nsIDOMNode *aCurrentNode, nsIDOMNode **aResultNode);
};

View File

@ -37,10 +37,10 @@ class nsIEditProperty : public nsISupports
public:
static const nsIID& IID() { static nsIID iid = NS_IEDITPROPERTY_IID; return iid; }
virtual nsresult Init(nsIAtom *aPropName, nsIAtom *aValue, PRBool aAppliesToAll)=0;
virtual nsresult GetProperty(nsIAtom **aProperty) const =0;
virtual nsresult GetValue(nsIAtom **aValue) const =0;
virtual nsresult GetAppliesToAll(PRBool *aAppliesToAll) const =0;
NS_IMETHOD Init(nsIAtom *aPropName, nsIAtom *aValue, PRBool aAppliesToAll)=0;
NS_IMETHOD GetProperty(nsIAtom **aProperty) const =0;
NS_IMETHOD GetValue(nsIAtom **aValue) const =0;
NS_IMETHOD GetAppliesToAll(PRBool *aAppliesToAll) const =0;
/* we're still trying to decide how edit atoms will work. Until then, use these */
// XXX: fix ASAP!

View File

@ -47,10 +47,10 @@ public:
* @param aNewLeftNode [OUT] the new node resulting from the split, becomes aExistingRightNode's previous sibling.
* @param aParent the parent of aExistingRightNode
*/
virtual nsresult SplitNodeImpl(nsIDOMNode * aExistingRightNode,
PRInt32 aOffset,
nsIDOMNode * aNewLeftNode,
nsIDOMNode * aParent)=0;
NS_IMETHOD SplitNodeImpl(nsIDOMNode * aExistingRightNode,
PRInt32 aOffset,
nsIDOMNode * aNewLeftNode,
nsIDOMNode * aParent)=0;
/**
* JoinNodes() takes 2 nodes and merge their content|children.
@ -61,10 +61,10 @@ public:
* @param aNodeToKeepIsFirst if PR_TRUE, the contents|children of aNodeToKeep come before the
* contents|children of aNodeToJoin, otherwise their positions are switched.
*/
virtual nsresult JoinNodesImpl(nsIDOMNode *aNodeToKeep,
nsIDOMNode *aNodeToJoin,
nsIDOMNode *aParent,
PRBool aNodeToKeepIsFirst)=0;
NS_IMETHOD JoinNodesImpl(nsIDOMNode *aNodeToKeep,
nsIDOMNode *aNodeToJoin,
nsIDOMNode *aParent,
PRBool aNodeToKeepIsFirst)=0;
static nsresult GetChildOffset(nsIDOMNode *aChild, nsIDOMNode *aParent, PRInt32 &aOffset);

View File

@ -29,7 +29,7 @@ NS_IMPL_RELEASE(nsEditProperty)
nsIAtom * nsIEditProperty::bold = NS_NewAtom("BOLD");
nsIAtom * nsIEditProperty::italic = NS_NewAtom("ITALIC");
nsresult
NS_IMETHODIMP
nsEditProperty::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (nsnull == aInstancePtr) {

View File

@ -39,10 +39,10 @@ protected:
virtual ~nsEditProperty();
public:
virtual nsresult Init(nsIAtom *aPropName, nsIAtom *aValue, PRBool aAppliesToAll);
virtual nsresult GetProperty(nsIAtom **aProperty) const;
virtual nsresult GetValue(nsIAtom **aValue) const;
virtual nsresult GetAppliesToAll(PRBool *aAppliesToAll) const;
NS_IMETHOD Init(nsIAtom *aPropName, nsIAtom *aValue, PRBool aAppliesToAll);
NS_IMETHOD GetProperty(nsIAtom **aProperty) const;
NS_IMETHOD GetValue(nsIAtom **aValue) const;
NS_IMETHOD GetAppliesToAll(PRBool *aAppliesToAll) const;
protected:
nsCOMPtr<nsIAtom>mProperty;

View File

@ -81,9 +81,9 @@ nsHTMLEditor::~nsHTMLEditor()
#endif
}
nsresult nsHTMLEditor::InitHTMLEditor(nsIDOMDocument *aDoc,
nsIPresShell *aPresShell,
nsIEditorCallback *aCallback)
NS_IMETHODIMP nsHTMLEditor::InitHTMLEditor(nsIDOMDocument *aDoc,
nsIPresShell *aPresShell,
nsIEditorCallback *aCallback)
{
NS_PRECONDITION(nsnull!=aDoc && nsnull!=aPresShell, "bad arg");
nsresult result=NS_ERROR_NULL_POINTER;
@ -96,7 +96,7 @@ nsresult nsHTMLEditor::InitHTMLEditor(nsIDOMDocument *aDoc,
if (NS_FAILED(result) || !aTextEditor) {
return NS_ERROR_OUT_OF_MEMORY;
}
mTextEditor = aTextEditor; // CreateInstance did our addRef
mTextEditor = do_QueryInterface(aTextEditor); // CreateInstance did our addRef
// Initialize nsTextEditor -- this will create and initialize the base nsEditor
// Note: nsTextEditor adds its own key, mouse, and DOM listners -- is that OK?
@ -116,7 +116,7 @@ nsresult nsHTMLEditor::InitHTMLEditor(nsIDOMDocument *aDoc,
return result;
}
nsresult nsHTMLEditor::SetTextProperties(nsISupportsArray *aPropList)
NS_IMETHODIMP nsHTMLEditor::SetTextProperties(nsISupportsArray *aPropList)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -126,7 +126,7 @@ nsresult nsHTMLEditor::SetTextProperties(nsISupportsArray *aPropList)
return result;
}
nsresult nsHTMLEditor::GetTextProperties(nsISupportsArray *aPropList)
NS_IMETHODIMP nsHTMLEditor::GetTextProperties(nsISupportsArray *aPropList)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -136,7 +136,7 @@ nsresult nsHTMLEditor::GetTextProperties(nsISupportsArray *aPropList)
return result;
}
nsresult nsHTMLEditor::RemoveTextProperties(nsISupportsArray *aPropList)
NS_IMETHODIMP nsHTMLEditor::RemoveTextProperties(nsISupportsArray *aPropList)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -146,7 +146,7 @@ nsresult nsHTMLEditor::RemoveTextProperties(nsISupportsArray *aPropList)
return result;
}
nsresult nsHTMLEditor::DeleteSelection(nsIEditor::Direction aDir)
NS_IMETHODIMP nsHTMLEditor::DeleteSelection(nsIEditor::Direction aDir)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -156,7 +156,7 @@ nsresult nsHTMLEditor::DeleteSelection(nsIEditor::Direction aDir)
return result;
}
nsresult nsHTMLEditor::InsertText(const nsString& aStringToInsert)
NS_IMETHODIMP nsHTMLEditor::InsertText(const nsString& aStringToInsert)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -166,7 +166,7 @@ nsresult nsHTMLEditor::InsertText(const nsString& aStringToInsert)
return result;
}
nsresult nsHTMLEditor::InsertBreak(PRBool aCtrlKey)
NS_IMETHODIMP nsHTMLEditor::InsertBreak(PRBool aCtrlKey)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -178,7 +178,7 @@ nsresult nsHTMLEditor::InsertBreak(PRBool aCtrlKey)
// Methods shared with the base editor.
// Note: We could call each of these via nsTextEditor -- is that better?
nsresult nsHTMLEditor::EnableUndo(PRBool aEnable)
NS_IMETHODIMP nsHTMLEditor::EnableUndo(PRBool aEnable)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -188,7 +188,7 @@ nsresult nsHTMLEditor::EnableUndo(PRBool aEnable)
return result;
}
nsresult nsHTMLEditor::Undo(PRUint32 aCount)
NS_IMETHODIMP nsHTMLEditor::Undo(PRUint32 aCount)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -198,7 +198,7 @@ nsresult nsHTMLEditor::Undo(PRUint32 aCount)
return result;
}
nsresult nsHTMLEditor::CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo)
NS_IMETHODIMP nsHTMLEditor::CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -208,7 +208,7 @@ nsresult nsHTMLEditor::CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo)
return result;
}
nsresult nsHTMLEditor::Redo(PRUint32 aCount)
NS_IMETHODIMP nsHTMLEditor::Redo(PRUint32 aCount)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -218,7 +218,7 @@ nsresult nsHTMLEditor::Redo(PRUint32 aCount)
return result;
}
nsresult nsHTMLEditor::CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo)
NS_IMETHODIMP nsHTMLEditor::CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -228,7 +228,7 @@ nsresult nsHTMLEditor::CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo)
return result;
}
nsresult nsHTMLEditor::BeginTransaction()
NS_IMETHODIMP nsHTMLEditor::BeginTransaction()
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -238,7 +238,7 @@ nsresult nsHTMLEditor::BeginTransaction()
return result;
}
nsresult nsHTMLEditor::EndTransaction()
NS_IMETHODIMP nsHTMLEditor::EndTransaction()
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -248,7 +248,7 @@ nsresult nsHTMLEditor::EndTransaction()
return result;
}
nsresult nsHTMLEditor::MoveSelectionUp(nsIAtom *aIncrement, PRBool aExtendSelection)
NS_IMETHODIMP nsHTMLEditor::MoveSelectionUp(nsIAtom *aIncrement, PRBool aExtendSelection)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -258,7 +258,7 @@ nsresult nsHTMLEditor::MoveSelectionUp(nsIAtom *aIncrement, PRBool aExtendSelect
return result;
}
nsresult nsHTMLEditor::MoveSelectionDown(nsIAtom *aIncrement, PRBool aExtendSelection)
NS_IMETHODIMP nsHTMLEditor::MoveSelectionDown(nsIAtom *aIncrement, PRBool aExtendSelection)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -268,7 +268,7 @@ nsresult nsHTMLEditor::MoveSelectionDown(nsIAtom *aIncrement, PRBool aExtendSele
return result;
}
nsresult nsHTMLEditor::MoveSelectionNext(nsIAtom *aIncrement, PRBool aExtendSelection)
NS_IMETHODIMP nsHTMLEditor::MoveSelectionNext(nsIAtom *aIncrement, PRBool aExtendSelection)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -278,7 +278,7 @@ nsresult nsHTMLEditor::MoveSelectionNext(nsIAtom *aIncrement, PRBool aExtendSele
return result;
}
nsresult nsHTMLEditor::MoveSelectionPrevious(nsIAtom *aIncrement, PRBool aExtendSelection)
NS_IMETHODIMP nsHTMLEditor::MoveSelectionPrevious(nsIAtom *aIncrement, PRBool aExtendSelection)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -288,7 +288,7 @@ nsresult nsHTMLEditor::MoveSelectionPrevious(nsIAtom *aIncrement, PRBool aExtend
return result;
}
nsresult nsHTMLEditor::SelectNext(nsIAtom *aIncrement, PRBool aExtendSelection)
NS_IMETHODIMP nsHTMLEditor::SelectNext(nsIAtom *aIncrement, PRBool aExtendSelection)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -298,7 +298,7 @@ nsresult nsHTMLEditor::SelectNext(nsIAtom *aIncrement, PRBool aExtendSelection)
return result;
}
nsresult nsHTMLEditor::SelectPrevious(nsIAtom *aIncrement, PRBool aExtendSelection)
NS_IMETHODIMP nsHTMLEditor::SelectPrevious(nsIAtom *aIncrement, PRBool aExtendSelection)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -308,7 +308,7 @@ nsresult nsHTMLEditor::SelectPrevious(nsIAtom *aIncrement, PRBool aExtendSelecti
return result;
}
nsresult nsHTMLEditor::ScrollUp(nsIAtom *aIncrement)
NS_IMETHODIMP nsHTMLEditor::ScrollUp(nsIAtom *aIncrement)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -318,7 +318,7 @@ nsresult nsHTMLEditor::ScrollUp(nsIAtom *aIncrement)
return result;
}
nsresult nsHTMLEditor::ScrollDown(nsIAtom *aIncrement)
NS_IMETHODIMP nsHTMLEditor::ScrollDown(nsIAtom *aIncrement)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -328,7 +328,7 @@ nsresult nsHTMLEditor::ScrollDown(nsIAtom *aIncrement)
return result;
}
nsresult nsHTMLEditor::ScrollIntoView(PRBool aScrollToBegin)
NS_IMETHODIMP nsHTMLEditor::ScrollIntoView(PRBool aScrollToBegin)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -338,7 +338,7 @@ nsresult nsHTMLEditor::ScrollIntoView(PRBool aScrollToBegin)
return result;
}
nsresult nsHTMLEditor::Insert(nsIInputStream *aInputStream)
NS_IMETHODIMP nsHTMLEditor::Insert(nsIInputStream *aInputStream)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -348,7 +348,7 @@ nsresult nsHTMLEditor::Insert(nsIInputStream *aInputStream)
return result;
}
nsresult nsHTMLEditor::OutputText(nsIOutputStream *aOutputStream)
NS_IMETHODIMP nsHTMLEditor::OutputText(nsIOutputStream *aOutputStream)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -358,7 +358,7 @@ nsresult nsHTMLEditor::OutputText(nsIOutputStream *aOutputStream)
return result;
}
nsresult nsHTMLEditor::OutputHTML(nsIOutputStream *aOutputStream)
NS_IMETHODIMP nsHTMLEditor::OutputHTML(nsIOutputStream *aOutputStream)
{
nsresult result=NS_ERROR_NOT_INITIALIZED;
if (mEditor)
@ -373,7 +373,7 @@ NS_IMPL_ADDREF(nsHTMLEditor)
NS_IMPL_RELEASE(nsHTMLEditor)
nsresult
NS_IMETHODIMP
nsHTMLEditor::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
if (nsnull == aInstancePtr) {

View File

@ -39,67 +39,67 @@ public:
//Initialization
nsHTMLEditor();
virtual nsresult InitHTMLEditor(nsIDOMDocument *aDoc,
nsIPresShell *aPresShell,
nsIEditorCallback *aCallback=nsnull);
NS_IMETHOD InitHTMLEditor(nsIDOMDocument *aDoc,
nsIPresShell *aPresShell,
nsIEditorCallback *aCallback=nsnull);
virtual ~nsHTMLEditor();
//============================================================================
// Methods that are duplicates of nsTextEditor -- exposed here for convenience
// Editing Operations
virtual nsresult SetTextProperties(nsISupportsArray *aPropList);
virtual nsresult GetTextProperties(nsISupportsArray *aPropList);
virtual nsresult RemoveTextProperties(nsISupportsArray *aPropList);
virtual nsresult DeleteSelection(nsIEditor::Direction aDir);
virtual nsresult InsertText(const nsString& aStringToInsert);
virtual nsresult InsertBreak(PRBool aCtrlKey);
NS_IMETHOD SetTextProperties(nsISupportsArray *aPropList);
NS_IMETHOD GetTextProperties(nsISupportsArray *aPropList);
NS_IMETHOD RemoveTextProperties(nsISupportsArray *aPropList);
NS_IMETHOD DeleteSelection(nsIEditor::Direction aDir);
NS_IMETHOD InsertText(const nsString& aStringToInsert);
NS_IMETHOD InsertBreak(PRBool aCtrlKey);
// Transaction control
virtual nsresult EnableUndo(PRBool aEnable);
virtual nsresult Undo(PRUint32 aCount);
virtual nsresult CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo);
virtual nsresult Redo(PRUint32 aCount);
virtual nsresult CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo);
virtual nsresult BeginTransaction();
virtual nsresult EndTransaction();
NS_IMETHOD EnableUndo(PRBool aEnable);
NS_IMETHOD Undo(PRUint32 aCount);
NS_IMETHOD CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo);
NS_IMETHOD Redo(PRUint32 aCount);
NS_IMETHOD CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo);
NS_IMETHOD BeginTransaction();
NS_IMETHOD EndTransaction();
// Selection and navigation -- exposed here for convenience
virtual nsresult MoveSelectionUp(nsIAtom *aIncrement, PRBool aExtendSelection);
virtual nsresult MoveSelectionDown(nsIAtom *aIncrement, PRBool aExtendSelection);
virtual nsresult MoveSelectionNext(nsIAtom *aIncrement, PRBool aExtendSelection);
virtual nsresult MoveSelectionPrevious(nsIAtom *aIncrement, PRBool aExtendSelection);
virtual nsresult SelectNext(nsIAtom *aIncrement, PRBool aExtendSelection);
virtual nsresult SelectPrevious(nsIAtom *aIncrement, PRBool aExtendSelection);
virtual nsresult ScrollUp(nsIAtom *aIncrement);
virtual nsresult ScrollDown(nsIAtom *aIncrement);
virtual nsresult ScrollIntoView(PRBool aScrollToBegin);
NS_IMETHOD MoveSelectionUp(nsIAtom *aIncrement, PRBool aExtendSelection);
NS_IMETHOD MoveSelectionDown(nsIAtom *aIncrement, PRBool aExtendSelection);
NS_IMETHOD MoveSelectionNext(nsIAtom *aIncrement, PRBool aExtendSelection);
NS_IMETHOD MoveSelectionPrevious(nsIAtom *aIncrement, PRBool aExtendSelection);
NS_IMETHOD SelectNext(nsIAtom *aIncrement, PRBool aExtendSelection);
NS_IMETHOD SelectPrevious(nsIAtom *aIncrement, PRBool aExtendSelection);
NS_IMETHOD ScrollUp(nsIAtom *aIncrement);
NS_IMETHOD ScrollDown(nsIAtom *aIncrement);
NS_IMETHOD ScrollIntoView(PRBool aScrollToBegin);
// Input/Output
virtual nsresult Insert(nsIInputStream *aInputStream);
virtual nsresult OutputText(nsIOutputStream *aOutputStream);
virtual nsresult OutputHTML(nsIOutputStream *aOutputStream);
NS_IMETHOD Insert(nsIInputStream *aInputStream);
NS_IMETHOD OutputText(nsIOutputStream *aOutputStream);
NS_IMETHOD OutputHTML(nsIOutputStream *aOutputStream);
//=====================================
// HTML Editing methods
// Table Editing (implemented in EditTable.cpp)
virtual nsresult CreateTxnForInsertTable(const nsIDOMElement *aTableNode, InsertTableTxn ** aTxn);
virtual nsresult GetColIndexForCell(nsIDOMNode *aCellNode, PRInt32 &aCellIndex);
virtual nsresult GetRowIndexForCell(nsIDOMNode *aCellNode, PRInt32 &aCellIndex);
virtual nsresult GetFirstCellInColumn(nsIDOMNode *aCurrentCellNode, nsIDOMNode* &aFirstCellNode);
virtual nsresult GetNextCellInColumn(nsIDOMNode *aCurrentCellNode, nsIDOMNode* &aNextCellNode);
virtual nsresult GetFirstCellInRow(nsIDOMNode *aCurrentCellNode, nsIDOMNode* &aCellNode);
virtual nsresult GetNextCellInRow(nsIDOMNode *aCurrentCellNode, nsIDOMNode* &aNextCellNode);
virtual nsresult InsertTable();
virtual nsresult InsertTableCell(PRInt32 aNumber, PRBool aAfter);
virtual nsresult InsertTableColumn(PRInt32 aNumber, PRBool aAfter);
virtual nsresult InsertTableRow(PRInt32 aNumber, PRBool aAfter);
virtual nsresult DeleteTable();
virtual nsresult DeleteTableCell(PRInt32 aNumber);
virtual nsresult DeleteTableColumn(PRInt32 aNumber);
virtual nsresult DeleteTableRow(PRInt32 aNumber);
virtual nsresult JoinTableCells(PRBool aCellToRight);
NS_IMETHOD CreateTxnForInsertTable(const nsIDOMElement *aTableNode, InsertTableTxn ** aTxn);
NS_IMETHOD GetColIndexForCell(nsIDOMNode *aCellNode, PRInt32 &aCellIndex);
NS_IMETHOD GetRowIndexForCell(nsIDOMNode *aCellNode, PRInt32 &aCellIndex);
NS_IMETHOD GetFirstCellInColumn(nsIDOMNode *aCurrentCellNode, nsIDOMNode* &aFirstCellNode);
NS_IMETHOD GetNextCellInColumn(nsIDOMNode *aCurrentCellNode, nsIDOMNode* &aNextCellNode);
NS_IMETHOD GetFirstCellInRow(nsIDOMNode *aCurrentCellNode, nsIDOMNode* &aCellNode);
NS_IMETHOD GetNextCellInRow(nsIDOMNode *aCurrentCellNode, nsIDOMNode* &aNextCellNode);
NS_IMETHOD InsertTable();
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 DeleteTableColumn(PRInt32 aNumber);
NS_IMETHOD DeleteTableRow(PRInt32 aNumber);
NS_IMETHOD JoinTableCells(PRBool aCellToRight);
// Data members
protected:

View File

@ -20,3 +20,4 @@ nsIEditor.h
nsITextEditor.h
nsEditorCID.h
nsIContextLoader.h
nsIHTMLEditor.h

View File

@ -25,6 +25,7 @@ include $(DEPTH)/config/autoconf.mk
EXPORTS = \
nsIContextLoader.h \
nsIEditor.h \
nsIHTMLEditor.h \
nsITextEditor.h \
nsEditorCID.h \
$(NULL)

View File

@ -21,6 +21,7 @@ IGNORE_MANIFEST=1
EXPORTS = \
nsIEditor.h \
nsITextEditor.h \
nsIHTMLEditor.h \
nsEditorCID.h \
nsIContextLoader.h \
$(NULL)

View File

@ -52,7 +52,7 @@ class nsIContextLoader : public nsISupports{
* @param aIndex2 second index to lookup the result
* @param aResult place to put the result of the lookup
*/
virtual nsresult Lookup(PRUint32 aIndex1, PRUint32 aIndex2, PRUint32 **aResult)= 0;
NS_IMETHOD Lookup(PRUint32 aIndex1, PRUint32 aIndex2, PRUint32 **aResult)= 0;
};

View File

@ -19,7 +19,9 @@
#ifndef nsIEditor_h__
#define nsIEditor_h__
#include "nsISupports.h"
#include "nscore.h"
class nsIAtom;
class nsIDOMElement;
class nsIDOMNode;
class nsITransaction;
@ -43,6 +45,12 @@ Editor interface to outside world
0x4a1f5ce0, 0xc1f9, 0x11d2, \
{ 0x8f, 0x4c, 0x0, 0x60, 0x8, 0x15, 0x9b, 0xc } }
#define NS_IHTMLEDITORFACTORY_IID \
{ /* BD62F312-CB8A-11d2-983A-00805F8AA8B8 */ \
0xbd62f312, 0xcb8a, 0x11d2, \
{ 0x98, 0x3a, 0x0, 0x80, 0x5f, 0x8a, 0xa8, 0xb8 } }
class nsIDOMDocument;
class nsIDOMSelection;
class nsIPresShell;
@ -70,7 +78,7 @@ public:
* this will no longer be necessary and the editor will no longer be
* linked to a single pres shell.
*/
virtual nsresult Init(nsIDOMDocument *aDomInterface,
NS_IMETHOD Init(nsIDOMDocument *aDomInterface,
nsIPresShell *aPresShell) = 0;
/**
@ -78,14 +86,14 @@ public:
*
* @param aDoc [OUT] the dom interface being observed, refcounted
*/
virtual nsresult GetDocument(nsIDOMDocument **aDoc)=0;
NS_IMETHOD GetDocument(nsIDOMDocument **aDoc)=0;
/**
* return the DOM Selection for the presentation shell that has focus
* (or most recently had focus.)
* @param aSelection [OUT] the dom interface for the selection
*/
virtual nsresult GetSelection(nsIDOMSelection **aSelection)=0;
NS_IMETHOD GetSelection(nsIDOMSelection **aSelection)=0;
/**
* SetAttribute() sets the attribute of aElement.
@ -96,7 +104,7 @@ public:
* @param aAttribute the string representation of the attribute to set
* @param aValue the value to set aAttribute to
*/
virtual nsresult SetAttribute(nsIDOMElement * aElement,
NS_IMETHOD SetAttribute(nsIDOMElement * aElement,
const nsString& aAttribute,
const nsString& aValue)=0;
@ -108,7 +116,7 @@ public:
* @param aResultValue the value of aAttribute. only valid if aResultIsSet is PR_TRUE
* @param aResultIsSet PR_TRUE if aAttribute is set on the current node, PR_FALSE if it is not.
*/
virtual nsresult GetAttributeValue(nsIDOMElement * aElement,
NS_IMETHOD GetAttributeValue(nsIDOMElement * aElement,
const nsString& aAttribute,
nsString& aResultValue,
PRBool& aResultIsSet)=0;
@ -120,7 +128,7 @@ public:
* @param aElement the content element to operate on
* @param aAttribute the string representation of the attribute to get
*/
virtual nsresult RemoveAttribute(nsIDOMElement * aElement,
NS_IMETHOD RemoveAttribute(nsIDOMElement * aElement,
const nsString& aAttribute)=0;
/**
@ -130,7 +138,7 @@ public:
* @param aPosition The place in aParent to insert the new node
* @param aNewNode [OUT] The node created. Caller must release aNewNode.
*/
virtual nsresult CreateNode(const nsString& aTag,
NS_IMETHOD CreateNode(const nsString& aTag,
nsIDOMNode * aParent,
PRInt32 aPosition,
nsIDOMNode ** aNewNode)=0;
@ -143,7 +151,7 @@ public:
* @param aParent The node to insert the new object into
* @param aPosition The place in aParent to insert the new node
*/
virtual nsresult InsertNode(nsIDOMNode * aNode,
NS_IMETHOD InsertNode(nsIDOMNode * aNode,
nsIDOMNode * aParent,
PRInt32 aPosition)=0;
@ -157,21 +165,29 @@ public:
*
* @param aString the string to be inserted
*/
virtual nsresult InsertText(const nsString& aStringToInsert)=0;
NS_IMETHOD InsertText(const nsString& aStringToInsert)=0;
/**
* DeleteNode removes aChild from aParent.
* If aChild is not a child of aParent, nothing is done and an error is returned.
* @param aChild The node to delete
*/
virtual nsresult DeleteNode(nsIDOMNode * aChild)=0;
NS_IMETHOD DeleteNode(nsIDOMNode * aChild)=0;
/**
* DeleteSelection removes all nodes in the current selection.
* @param aDir if eLTR, delete to the right (for example, the DEL key)
* if eRTL, delete to the left (for example, the BACKSPACE key)
*/
virtual nsresult DeleteSelection(nsIEditor::Direction aDir)=0;
NS_IMETHOD DeleteSelection(nsIEditor::Direction aDir)=0;
/**
* DeleteSelectionAndCreateNode combines DeleteSelection and CreateNode
* It deletes only if there is something selected (doesn't do DEL, BACKSPACE action)
* @param aTag The type of object to create
* @param aNewNode [OUT] The node created. Caller must release aNewNode.
*/
NS_IMETHOD DeleteSelectionAndCreateNode(const nsString& aTag, nsIDOMNode ** aNewNode)=0;
/**
* SplitNode() creates a new node identical to an existing node, and split the contents between the two nodes
@ -179,7 +195,7 @@ public:
* @param aOffset the offset of aExistingRightNode's content|children to do the split at
* @param aNewLeftNode [OUT] the new node resulting from the split, becomes aExistingRightNode's previous sibling.
*/
virtual nsresult SplitNode(nsIDOMNode * aExistingRightNode,
NS_IMETHOD SplitNode(nsIDOMNode * aExistingRightNode,
PRInt32 aOffset,
nsIDOMNode ** aNewLeftNode)=0;
@ -192,17 +208,17 @@ public:
* @param aNodeToKeepIsFirst if PR_TRUE, the contents|children of aNodeToKeep come before the
* contents|children of aNodeToJoin, otherwise their positions are switched.
*/
virtual nsresult JoinNodes(nsIDOMNode *aNodeToKeep,
nsIDOMNode *aNodeToJoin,
nsIDOMNode *aParent,
PRBool aNodeToKeepIsFirst)=0;
NS_IMETHOD JoinNodes(nsIDOMNode *aNodeToKeep,
nsIDOMNode *aNodeToJoin,
nsIDOMNode *aParent,
PRBool aNodeToKeepIsFirst)=0;
/**
* The handler for RETURN keys and CTRL-RETURN keys.<br>
* It may enter a character, split a node in the tree, etc.
* @param aCtrlKey was the CtrlKey down?
*/
virtual nsresult InsertBreak(PRBool aCtrlKey)=0;
NS_IMETHOD InsertBreak(PRBool aCtrlKey)=0;
/** turn the undo system on or off
* @param aEnable if PR_TRUE, the undo system is turned on if it is available
@ -210,7 +226,7 @@ public:
* @return if aEnable is PR_TRUE, returns NS_OK if the undo system could be initialized properly
* if aEnable is PR_FALSE, returns NS_OK.
*/
virtual nsresult EnableUndo(PRBool aEnable)=0;
NS_IMETHOD EnableUndo(PRBool aEnable)=0;
/** Do() fires a transaction. It is provided here so clients can create their own transactions.
* If a transaction manager is present, it is used.
@ -218,7 +234,7 @@ public:
*
* @param aTxn the transaction to execute
*/
virtual nsresult Do(nsITransaction *aTxn)=0;
NS_IMETHOD Do(nsITransaction *aTxn)=0;
/** Undo reverses the effects of the last Do operation, if Undo is enabled in the editor.
* It is provided here so clients need no knowledge of whether the editor has a transaction manager or not.
@ -227,13 +243,13 @@ public:
* Otherwise, the Undo request is ignored and an error NS_ERROR_NOT_AVAILABLE is returned.
*
*/
virtual nsresult Undo(PRUint32 aCount)=0;
NS_IMETHOD Undo(PRUint32 aCount)=0;
/** returns state information about the undo system.
* @param aIsEnabled [OUT] PR_TRUE if undo is enabled
* @param aCanUndo [OUT] PR_TRUE if at least one transaction is currently ready to be undone.
*/
virtual nsresult CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo)=0;
NS_IMETHOD CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo)=0;
/** Redo reverses the effects of the last Undo operation
* It is provided here so clients need no knowledge of whether the editor has a transaction manager or not.
@ -243,13 +259,13 @@ public:
* the Redo request is ignored and an error NS_ERROR_NOT_AVAILABLE is returned.
*
*/
virtual nsresult Redo(PRUint32 aCount)=0;
NS_IMETHOD Redo(PRUint32 aCount)=0;
/** returns state information about the redo system.
* @param aIsEnabled [OUT] PR_TRUE if redo is enabled
* @param aCanRedo [OUT] PR_TRUE if at least one transaction is currently ready to be redone.
*/
virtual nsresult CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo)=0;
NS_IMETHOD CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo)=0;
/** BeginTransaction is a signal from the caller to the editor that the caller will execute multiple updates
* to the content tree that should be treated as a single logical operation,
@ -259,21 +275,36 @@ public:
* EndTransaction must be called after BeginTransaction.<br>
* Calls to BeginTransaction can be nested, as long as EndTransaction is called once per BeginUpdate.
*/
virtual nsresult BeginTransaction()=0;
NS_IMETHOD BeginTransaction()=0;
/** EndTransaction is a signal to the editor that the caller is finished updating the content model.<br>
* BeginUpdate must be called before EndTransaction is called.<br>
* Calls to BeginTransaction can be nested, as long as EndTransaction is called once per BeginTransaction.
*/
virtual nsresult EndTransaction()=0;
NS_IMETHOD EndTransaction()=0;
/** Get the layout's frame object associated with the node
* Needed when we must get geometric layout info, such as what column a table cell is in.
* @param aNode The DOM node we need the frame for
* @param aLayoutObject The pointer where the resulting object is placed
*/
NS_IMETHOD GetLayoutObject(nsIDOMNode *aNode, nsISupports **aLayoutObject)=0;
/** scroll the viewport so the selection is in view.
* @param aScrollToBegin PR_TRUE if the beginning of the selection is to be scrolled into view.
* PR_FALSE if the end of the selection is to be scrolled into view
*/
virtual nsresult ScrollIntoView(PRBool aScrollToBegin)=0;
NS_IMETHOD ScrollIntoView(PRBool aScrollToBegin)=0;
/** Create an aggregate transaction for deleting current selection
* Used by all methods that need to delete current selection,
* then insert something new to replace it
* @param nsString& aTxnName is the name of the aggregated transaction
* @param EditTxn **aAggTxn is the return location of the aggregate TXN,
* with the DeleteSelectionTxn as the first child ONLY
* if there was a selection to delete.
*/
NS_IMETHOD CreateAggregateTxnForDeleteSelection(nsIAtom *aTxnName, nsISupports **aAggTxn)=0;
};
#endif //nsIEditor_h__

View File

@ -46,42 +46,42 @@ public:
/** Initialize the text editor
*
*/
virtual nsresult InitHTMLEditor(nsIDOMDocument *aDoc,
nsIPresShell *aPresShell,
nsIEditorCallback *aCallback=nsnull)=0;
NS_IMETHOD InitHTMLEditor(nsIDOMDocument *aDoc,
nsIPresShell *aPresShell,
nsIEditorCallback *aCallback=nsnull)=0;
// Methods shared with nsITextEditor (see nsITextEditor.h for details)
virtual nsresult SetTextProperties(nsISupportsArray *aPropList)=0;
virtual nsresult GetTextProperties(nsISupportsArray *aPropList)=0;
virtual nsresult RemoveTextProperties(nsISupportsArray *aPropList)=0;
virtual nsresult DeleteSelection(nsIEditor::Direction aDir)=0;
virtual nsresult InsertText(const nsString& aStringToInsert)=0;
virtual nsresult InsertBreak(PRBool aCtrlKey)=0;
virtual nsresult EnableUndo(PRBool aEnable)=0;
virtual nsresult Undo(PRUint32 aCount)=0;
virtual nsresult CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo)=0;
virtual nsresult Redo(PRUint32 aCount)=0;
virtual nsresult CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo)=0;
virtual nsresult BeginTransaction()=0;
virtual nsresult EndTransaction()=0;
virtual nsresult MoveSelectionUp(nsIAtom *aIncrement, PRBool aExtendSelection)=0;
virtual nsresult MoveSelectionDown(nsIAtom *aIncrement, PRBool aExtendSelection)=0;
virtual nsresult MoveSelectionNext(nsIAtom *aIncrement, PRBool aExtendSelection)=0;
virtual nsresult MoveSelectionPrevious(nsIAtom *aIncrement, PRBool aExtendSelection)=0;
virtual nsresult SelectNext(nsIAtom *aIncrement, PRBool aExtendSelection)=0;
virtual nsresult SelectPrevious(nsIAtom *aIncrement, PRBool aExtendSelection)=0;
virtual nsresult ScrollUp(nsIAtom *aIncrement)=0;
virtual nsresult ScrollDown(nsIAtom *aIncrement)=0;
virtual nsresult ScrollIntoView(PRBool aScrollToBegin)=0;
NS_IMETHOD SetTextProperties(nsISupportsArray *aPropList)=0;
NS_IMETHOD GetTextProperties(nsISupportsArray *aPropList)=0;
NS_IMETHOD RemoveTextProperties(nsISupportsArray *aPropList)=0;
NS_IMETHOD DeleteSelection(nsIEditor::Direction aDir)=0;
NS_IMETHOD InsertText(const nsString& aStringToInsert)=0;
NS_IMETHOD InsertBreak(PRBool aCtrlKey)=0;
NS_IMETHOD EnableUndo(PRBool aEnable)=0;
NS_IMETHOD Undo(PRUint32 aCount)=0;
NS_IMETHOD CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo)=0;
NS_IMETHOD Redo(PRUint32 aCount)=0;
NS_IMETHOD CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo)=0;
NS_IMETHOD BeginTransaction()=0;
NS_IMETHOD EndTransaction()=0;
NS_IMETHOD MoveSelectionUp(nsIAtom *aIncrement, PRBool aExtendSelection)=0;
NS_IMETHOD MoveSelectionDown(nsIAtom *aIncrement, PRBool aExtendSelection)=0;
NS_IMETHOD MoveSelectionNext(nsIAtom *aIncrement, PRBool aExtendSelection)=0;
NS_IMETHOD MoveSelectionPrevious(nsIAtom *aIncrement, PRBool aExtendSelection)=0;
NS_IMETHOD SelectNext(nsIAtom *aIncrement, PRBool aExtendSelection)=0;
NS_IMETHOD SelectPrevious(nsIAtom *aIncrement, PRBool aExtendSelection)=0;
NS_IMETHOD ScrollUp(nsIAtom *aIncrement)=0;
NS_IMETHOD ScrollDown(nsIAtom *aIncrement)=0;
NS_IMETHOD ScrollIntoView(PRBool aScrollToBegin)=0;
virtual nsresult Insert(nsIInputStream *aInputStream)=0;
virtual nsresult OutputText(nsIOutputStream *aOutputStream)=0;
virtual nsresult OutputHTML(nsIOutputStream *aOutputStream)=0;
NS_IMETHOD Insert(nsIInputStream *aInputStream)=0;
NS_IMETHOD OutputText(nsIOutputStream *aOutputStream)=0;
NS_IMETHOD OutputHTML(nsIOutputStream *aOutputStream)=0;
// Miscellaneous Methods
/*
virtual nsresult CheckSpelling()=0;
virtual nsresult SpellingLanguage(nsIAtom *aLanguage)=0;
NS_IMETHOD CheckSpelling()=0;
NS_IMETHOD SpellingLanguage(nsIAtom *aLanguage)=0;
*/
/* The editor doesn't know anything about specific services like SpellChecking.
* Services can be invoked on the content, and these services can use the editor if they choose
@ -92,15 +92,15 @@ public:
// Table editing Methods
virtual nsresult InsertTable()=0;
virtual nsresult InsertTableCell(PRInt32 aNumber, PRBool aAfter)=0;
virtual nsresult InsertTableColumn(PRInt32 aNumber, PRBool aAfter)=0;
virtual nsresult InsertTableRow(PRInt32 aNumber, PRBool aAfter)=0;
virtual nsresult DeleteTable()=0;
virtual nsresult DeleteTableCell(PRInt32 aNumber)=0;
virtual nsresult DeleteTableColumn(PRInt32 aNumber)=0;
virtual nsresult DeleteTableRow(PRInt32 aNumber)=0;
virtual nsresult JoinTableCells(PRBool aCellToRight)=0;
NS_IMETHOD InsertTable()=0;
NS_IMETHOD InsertTableCell(PRInt32 aNumber, PRBool aAfter)=0;
NS_IMETHOD InsertTableColumn(PRInt32 aNumber, PRBool aAfter)=0;
NS_IMETHOD InsertTableRow(PRInt32 aNumber, PRBool aAfter)=0;
NS_IMETHOD DeleteTable()=0;
NS_IMETHOD DeleteTableCell(PRInt32 aNumber)=0;
NS_IMETHOD DeleteTableColumn(PRInt32 aNumber)=0;
NS_IMETHOD DeleteTableRow(PRInt32 aNumber)=0;
NS_IMETHOD JoinTableCells(PRBool aCellToRight)=0;
};
#endif //nsIEditor_h__

View File

@ -53,9 +53,9 @@ public:
/** Initialize the text editor
*
*/
virtual nsresult InitTextEditor(nsIDOMDocument *aDoc,
nsIPresShell *aPresShell,
nsIEditorCallback *aCallback=nsnull)=0;
NS_IMETHOD InitTextEditor(nsIDOMDocument *aDoc,
nsIPresShell *aPresShell,
nsIEditorCallback *aCallback=nsnull)=0;
/**
* SetTextProperties() sets the aggregate properties on the current selection
@ -63,7 +63,7 @@ public:
* @param aPropList a list of properties to set across the selection
* NOTE: this method is experimental, expect it to change.
*/
virtual nsresult SetTextProperties(nsISupportsArray *aPropList)=0;
NS_IMETHOD SetTextProperties(nsISupportsArray *aPropList)=0;
/**
* GetTextProperties() gets the aggregate properties of the current selection.
@ -74,7 +74,7 @@ public:
* in the current selection. Each item in aPropList is an nsEditProperty.
* NOTE: this method is experimental, expect it to change.
*/
virtual nsresult GetTextProperties(nsISupportsArray *aPropList)=0;
NS_IMETHOD GetTextProperties(nsISupportsArray *aPropList)=0;
/**
* RemoveTextProperties() deletes the properties from all text in the current selection.
@ -83,14 +83,14 @@ public:
* @param aElement the content element to operate on
* @param aAttribute the string representation of the attribute to get
*/
virtual nsresult RemoveTextProperties(nsISupportsArray *aPropList)=0;
NS_IMETHOD RemoveTextProperties(nsISupportsArray *aPropList)=0;
/**
* DeleteSelection removes all nodes in the current selection.
* @param aDir if eLTR, delete to the right (for example, the DEL key)
* if eRTL, delete to the left (for example, the BACKSPACE key)
*/
virtual nsresult DeleteSelection(nsIEditor::Direction aDir)=0;
NS_IMETHOD DeleteSelection(nsIEditor::Direction aDir)=0;
/**
* InsertText() Inserts a string at the current location, given by the selection.
@ -102,7 +102,7 @@ public:
*
* @param aString the string to be inserted
*/
virtual nsresult InsertText(const nsString& aStringToInsert)=0;
NS_IMETHOD InsertText(const nsString& aStringToInsert)=0;
/**
* The handler for the ENTER key.
@ -110,7 +110,7 @@ public:
* It may insert a <BR> or a <P> or activate the properties of the element
* @param aCtrlKey was the CtrlKey down?
*/
virtual nsresult InsertBreak(PRBool aCtrlKey)=0;
NS_IMETHOD InsertBreak(PRBool aCtrlKey)=0;
/** turn the undo system on or off
* @param aEnable if PR_TRUE, the undo system is turned on if it is available
@ -118,7 +118,7 @@ public:
* @return if aEnable is PR_TRUE, returns NS_OK if the undo system could be initialized properly
* if aEnable is PR_FALSE, returns NS_OK.
*/
virtual nsresult EnableUndo(PRBool aEnable)=0;
NS_IMETHOD EnableUndo(PRBool aEnable)=0;
/** Undo reverses the effects of the last Do operation, if Undo is enabled in the editor.
* It is provided here so clients need no knowledge of whether the editor has a transaction manager or not.
@ -127,13 +127,13 @@ public:
* Otherwise, the Undo request is ignored and an error NS_ERROR_NOT_AVAILABLE is returned.
*
*/
virtual nsresult Undo(PRUint32 aCount)=0;
NS_IMETHOD Undo(PRUint32 aCount)=0;
/** returns state information about the undo system.
* @param aIsEnabled [OUT] PR_TRUE if undo is enabled
* @param aCanUndo [OUT] PR_TRUE if at least one transaction is currently ready to be undone.
*/
virtual nsresult CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo)=0;
NS_IMETHOD CanUndo(PRBool &aIsEnabled, PRBool &aCanUndo)=0;
/** Redo reverses the effects of the last Undo operation
* It is provided here so clients need no knowledge of whether the editor has a transaction manager or not.
@ -143,13 +143,13 @@ public:
* the Redo request is ignored and an error NS_ERROR_NOT_AVAILABLE is returned.
*
*/
virtual nsresult Redo(PRUint32 aCount)=0;
NS_IMETHOD Redo(PRUint32 aCount)=0;
/** returns state information about the redo system.
* @param aIsEnabled [OUT] PR_TRUE if redo is enabled
* @param aCanRedo [OUT] PR_TRUE if at least one transaction is currently ready to be redone.
*/
virtual nsresult CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo)=0;
NS_IMETHOD CanRedo(PRBool &aIsEnabled, PRBool &aCanRedo)=0;
/** BeginTransaction is a signal to the editor that the caller will execute multiple updates
* to the content tree that should be treated as a single operation,
@ -159,13 +159,13 @@ public:
* EndTransaction must be called after BeginTransaction.<br>
* Calls to BeginTransaction can be nested, as long as EndTransaction is called once per BeginTransaction.
*/
virtual nsresult BeginTransaction()=0;
NS_IMETHOD BeginTransaction()=0;
/** EndTransaction is a signal to the editor that the caller is finished updating the content model.
* BeginTransaction must be called before EndTransaction is called.
* Calls to BeginTransaction can be nested, as long as EndTransaction is called once per BeginTransaction.
*/
virtual nsresult EndTransaction()=0;
NS_IMETHOD EndTransaction()=0;
/* the following methods are the convenience methods to make text editing easy for the embedding App
* all simple getter and setter methods use Get/Set/RemoveProperties
@ -179,13 +179,13 @@ public:
* @param aIncrement the amount to move the Selection
* legal values are nsIEditor::Line, nsIEditor::Page
*/
virtual nsresult MoveSelectionUp(nsIAtom *aIncrement, PRBool aExtendSelection)=0;
NS_IMETHOD MoveSelectionUp(nsIAtom *aIncrement, PRBool aExtendSelection)=0;
/** move the selection down (towards the end of the document.)
* @param aIncrement the amount to move the Selection
* legal values are nsIEditor::Line, nsIEditor::Page
*/
virtual nsresult MoveSelectionDown(nsIAtom *aIncrement, PRBool aExtendSelection)=0;
NS_IMETHOD MoveSelectionDown(nsIAtom *aIncrement, PRBool aExtendSelection)=0;
/** move the selection by some increment.
* The dir attribute for the document is used to decide if "next" is LTR or RTL
@ -193,9 +193,9 @@ public:
* legal values are nsIEditor::Word, nsIEditor::Sentence, nsIEditor::Paragraph
* @param aExtendSelection
*/
virtual nsresult MoveSelectionNext(nsIAtom *aIncrement, PRBool aExtendSelection)=0;
NS_IMETHOD MoveSelectionNext(nsIAtom *aIncrement, PRBool aExtendSelection)=0;
virtual nsresult MoveSelectionPrevious(nsIAtom *aIncrement, PRBool aExtendSelection)=0;
NS_IMETHOD MoveSelectionPrevious(nsIAtom *aIncrement, PRBool aExtendSelection)=0;
/** select the next portion of the document
* The dir attribute for the document is used to decide if "next" is LTR or RTL
@ -204,7 +204,7 @@ public:
* nsIEditor::Document
* @param aExtendSelection
*/
virtual nsresult SelectNext(nsIAtom *aIncrement, PRBool aExtendSelection)=0;
NS_IMETHOD SelectNext(nsIAtom *aIncrement, PRBool aExtendSelection)=0;
/** select the previous portion of the document
* The dir attribute for the document is used to decide if "next" is LTR or RTL
@ -213,36 +213,36 @@ public:
* nsIEditor::Document
* @param aExtendSelection
*/
virtual nsresult SelectPrevious(nsIAtom *aIncrement, PRBool aExtendSelection)=0;
NS_IMETHOD SelectPrevious(nsIAtom *aIncrement, PRBool aExtendSelection)=0;
/** scroll the viewport up (towards the beginning of the document.)
* @param aIncrement the amount to scroll
* legal values are nsIEditor::Line, nsIEditor::Page
*/
virtual nsresult ScrollUp(nsIAtom *aIncrement)=0;
NS_IMETHOD ScrollUp(nsIAtom *aIncrement)=0;
/** scroll the viewport down (towards the end of the document.)
* @param aIncrement the amount to scroll
* legal values are nsIEditor::Line, nsIEditor::Page
*/
virtual nsresult ScrollDown(nsIAtom *aIncrement)=0;
NS_IMETHOD ScrollDown(nsIAtom *aIncrement)=0;
/** scroll the viewport so the selection is in view.
* @param aScrollToBegin PR_TRUE if the beginning of the selection is to be scrolled into view.
* PR_FALSE if the end of the selection is to be scrolled into view
*/
virtual nsresult ScrollIntoView(PRBool aScrollToBegin)=0;
NS_IMETHOD ScrollIntoView(PRBool aScrollToBegin)=0;
// Input/Output
// nsString will be a stream, as soon as I can figure out what kind of stream we should be using
virtual nsresult Insert(nsIInputStream *aInputStream)=0;
virtual nsresult OutputText(nsIOutputStream *aOutputStream)=0;
virtual nsresult OutputHTML(nsIOutputStream *aOutputStream)=0;
NS_IMETHOD Insert(nsIInputStream *aInputStream)=0;
NS_IMETHOD OutputText(nsIOutputStream *aOutputStream)=0;
NS_IMETHOD OutputHTML(nsIOutputStream *aOutputStream)=0;
// Miscellaneous Methods
/*
virtual nsresult CheckSpelling()=0;
virtual nsresult SpellingLanguage(nsIAtom *aLanguage)=0;
NS_IMETHOD CheckSpelling()=0;
NS_IMETHOD SpellingLanguage(nsIAtom *aLanguage)=0;
*/
/* The editor doesn't know anything about specific services like SpellChecking.
* Services can be invoked on the content, and these services can use the editor if they choose