128903: Clean up the editor IDL, and anyone who uses them. r=brade,cmanske,ducarroz (for mail); sr=sfraser; a=dbaron
git-svn-id: svn://10.0.0.236/trunk@116581 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -1399,7 +1399,7 @@ nsHighlightColorStateCommand::IsCommandEnabled(const nsAReadableString & aComman
|
||||
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(editor);
|
||||
if (!htmlEditor) return NS_ERROR_FAILURE;
|
||||
PRBool useCSS;
|
||||
htmlEditor->IsCSSEnabled(&useCSS);
|
||||
htmlEditor->GetIsCSSEnabled(&useCSS);
|
||||
|
||||
*outCmdEnabled = useCSS;
|
||||
}
|
||||
|
||||
@@ -251,12 +251,12 @@ nsEditorShell::nsEditorShell()
|
||||
, mCloseWindowWhenLoaded(PR_FALSE)
|
||||
, mCantEditReason(eCantEditNoReason)
|
||||
, mEditorType(eUninitializedEditorType)
|
||||
, mEditorTypeString(NS_LITERAL_STRING("html"))
|
||||
, mContentMIMEType("text/html")
|
||||
, mContentTypeKnown(PR_FALSE)
|
||||
, mWrapColumn(0)
|
||||
, mSuggestedWordIndex(0)
|
||||
, mDictionaryIndex(0)
|
||||
, mEditorTypeString(NS_LITERAL_STRING("html"))
|
||||
{
|
||||
//TODO:Save last-used display mode in prefs so new window inherits?
|
||||
NS_INIT_REFCNT();
|
||||
@@ -3674,7 +3674,7 @@ nsEditorShell::GetRowIndex(nsIDOMElement *cellElement, PRInt32 *_retval)
|
||||
{
|
||||
// Get both row and column indexes - return just row
|
||||
PRInt32 colIndex;
|
||||
result = tableEditor->GetCellIndexes(cellElement, *_retval, colIndex);
|
||||
result = tableEditor->GetCellIndexes(cellElement, _retval, &colIndex);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -3700,7 +3700,7 @@ nsEditorShell::GetColumnIndex(nsIDOMElement *cellElement, PRInt32 *_retval)
|
||||
{
|
||||
// Get both row and column indexes - return just column
|
||||
PRInt32 rowIndex;
|
||||
result = tableEditor->GetCellIndexes(cellElement, rowIndex, *_retval);
|
||||
result = tableEditor->GetCellIndexes(cellElement, &rowIndex, _retval);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -3727,7 +3727,7 @@ nsEditorShell::GetTableRowCount(nsIDOMElement *tableElement, PRInt32 *_retval)
|
||||
{
|
||||
// This returns both the number of rows and columns: return just rows
|
||||
PRInt32 cols;
|
||||
result = tableEditor->GetTableSize(tableElement, *_retval, cols);
|
||||
result = tableEditor->GetTableSize(tableElement, _retval, &cols);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -3754,7 +3754,7 @@ nsEditorShell::GetTableColumnCount(nsIDOMElement *tableElement, PRInt32 *_retval
|
||||
{
|
||||
// This returns both the number of rows and columns: return just columns
|
||||
PRInt32 rows;
|
||||
result = tableEditor->GetTableSize(tableElement, rows, *_retval);
|
||||
result = tableEditor->GetTableSize(tableElement, &rows, _retval);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -3817,10 +3817,10 @@ nsEditorShell::GetCellDataAt(nsIDOMElement *tableElement, PRInt32 rowIndex, PRIn
|
||||
nsCOMPtr<nsITableEditor> tableEditor = do_QueryInterface(mEditor);
|
||||
if (tableEditor)
|
||||
result = tableEditor->GetCellDataAt(tableElement, rowIndex, colIndex, _retval,
|
||||
*aStartRowIndex, *aStartColIndex,
|
||||
*aRowSpan, *aColSpan,
|
||||
*aActualRowSpan, *aActualColSpan,
|
||||
*aIsSelected);
|
||||
aStartRowIndex, aStartColIndex,
|
||||
aRowSpan, aColSpan,
|
||||
aActualRowSpan, aActualColSpan,
|
||||
aIsSelected);
|
||||
// Don't return NS_EDITOR_ELEMENT_NOT_FOUND (passes NS_SUCCEEDED macro)
|
||||
// to JavaScript
|
||||
if(NS_SUCCEEDED(result)) return NS_OK;
|
||||
@@ -3892,7 +3892,9 @@ nsEditorShell::GetSelectedOrParentTableElement(PRUnichar **aTagName, PRInt32 *aS
|
||||
nsCOMPtr<nsITableEditor> tableEditor = do_QueryInterface(mEditor);
|
||||
nsAutoString TagName(*aTagName);
|
||||
if (tableEditor)
|
||||
result = tableEditor->GetSelectedOrParentTableElement(*_retval, TagName, *aSelectedCount);
|
||||
result = tableEditor->GetSelectedOrParentTableElement(_retval,
|
||||
TagName,
|
||||
aSelectedCount);
|
||||
*aTagName = ToNewUnicode(TagName);
|
||||
}
|
||||
break;
|
||||
@@ -3915,7 +3917,7 @@ nsEditorShell::GetSelectedCellsType(nsIDOMElement *aElement, PRUint32 *_retval)
|
||||
{
|
||||
nsCOMPtr<nsITableEditor> tableEditor = do_QueryInterface(mEditor);
|
||||
if (tableEditor)
|
||||
result = tableEditor->GetSelectedCellsType(aElement, *_retval);
|
||||
result = tableEditor->GetSelectedCellsType(aElement, _retval);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -34,3 +34,6 @@ nsICiter.idl
|
||||
nsIEditActionListener.idl
|
||||
nsIEditorIMESupport.idl
|
||||
nsIEditorObserver.idl
|
||||
nsIEditorMailSupport.idl
|
||||
nsIEditorStyleSheets.idl
|
||||
nsITableEditor.idl
|
||||
|
||||
@@ -35,12 +35,15 @@ XPIDLSRCS = \
|
||||
nsIEditorController.idl \
|
||||
nsIEditor.idl \
|
||||
nsIEditorIMESupport.idl \
|
||||
nsIEditorMailSupport.idl \
|
||||
nsIEditorObserver.idl \
|
||||
nsIEditorService.idl \
|
||||
nsIEditorShell.idl \
|
||||
nsIEditorSpellCheck.idl \
|
||||
nsIEditorStyleSheets.idl \
|
||||
nsIHTMLEditor.idl \
|
||||
nsIPlaintextEditor.idl \
|
||||
nsITableEditor.idl \
|
||||
nsIURIRefObject.idl \
|
||||
nsPIEditorTransaction.idl \
|
||||
$(NULL)
|
||||
|
||||
@@ -32,12 +32,15 @@ XPIDLSRCS = .\nsICiter.idl \
|
||||
.\nsIEditorController.idl \
|
||||
.\nsIEditor.idl \
|
||||
.\nsIEditorIMESupport.idl \
|
||||
.\nsIEditorMailSupport.idl \
|
||||
.\nsIEditorObserver.idl \
|
||||
.\nsIEditorService.idl \
|
||||
.\nsIEditorShell.idl \
|
||||
.\nsIEditorSpellCheck.idl \
|
||||
.\nsIEditorStyleSheets.idl \
|
||||
.\nsIHTMLEditor.idl \
|
||||
.\nsIPlaintextEditor.idl \
|
||||
.\nsITableEditor.idl \
|
||||
.\nsIURIRefObject.idl \
|
||||
.\nsPIEditorTransaction.idl \
|
||||
$(NULL)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
@@ -18,6 +18,7 @@
|
||||
*
|
||||
* Contributor(s):
|
||||
* Daniel Glazman <glazman@netscape.com>
|
||||
* Akkana Peck <akkana@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
@@ -38,9 +39,6 @@ interface nsIEditActionListener;
|
||||
|
||||
#include "nsAWritableString.h"
|
||||
|
||||
//class nsIDOMDocument;
|
||||
//class nsIDOMElement;
|
||||
//class nsIDOMNode;
|
||||
class nsIPresShell;
|
||||
class nsIContent;
|
||||
typedef short EDirection;
|
||||
@@ -66,71 +64,60 @@ interface nsIEditor : nsISupports
|
||||
const short eToBeginningOfLine = 5;
|
||||
const short eToEndOfLine = 6;
|
||||
|
||||
readonly attribute nsISelection selection;
|
||||
|
||||
/**
|
||||
* Init is to tell the implementation of nsIEditor to begin its services
|
||||
* @param aDoc The dom document interface being observed
|
||||
* @param aPresShell TEMP: The presentation shell displaying the document
|
||||
* once events can tell us from what pres shell they originated,
|
||||
* this will no longer be necessary and the editor will no longer be
|
||||
* linked to a single pres shell.
|
||||
* @param aRoot This is the root of the editable section of this document. if it is null then we get root from document body.
|
||||
* @param aSelCon this should be used to get the selection location
|
||||
* @param aFlags A bitmask of flags for specifying the behavior of the editor.
|
||||
* @param aDoc The dom document interface being observed
|
||||
* @param aPresShell TEMP: The presentation shell displaying the document.
|
||||
* Once events can tell us from what pres shell
|
||||
* they originated, this will no longer be
|
||||
* necessary, and the editor will no longer be
|
||||
* linked to a single pres shell.
|
||||
* @param aRoot This is the root of the editable section of this
|
||||
* document. If it is null then we get root
|
||||
* from document body.
|
||||
* @param aSelCon this should be used to get the selection location
|
||||
* @param aFlags A bitmask of flags for specifying the behavior
|
||||
* of the editor.
|
||||
*/
|
||||
[noscript] void Init(in nsIDOMDocument doc, in nsIPresShellPtr shell, in nsIContentPtr aRoot, in nsISelectionController aSelCon, in unsigned long aFlags);
|
||||
[noscript] void init(in nsIDOMDocument doc, in nsIPresShellPtr shell,
|
||||
in nsIContentPtr aRoot,
|
||||
in nsISelectionController aSelCon,
|
||||
in unsigned long aFlags);
|
||||
|
||||
void SetAttributeOrEquivalent(in nsIDOMElement element, in DOMString sourceAttrName, in DOMString sourceAttrValue);
|
||||
/**
|
||||
* PostCreate should be called after Init, and is the time that the editor tells
|
||||
* its documentStateObservers that the document has been created.
|
||||
*/
|
||||
void PostCreate();
|
||||
void setAttributeOrEquivalent(in nsIDOMElement element,
|
||||
in AString sourceAttrName,
|
||||
in AString sourceAttrValue);
|
||||
|
||||
/**
|
||||
* PreDestroy is called before the editor goes away, and gives the editor a chance
|
||||
* to tell its documentStateObservers that the document is going away.
|
||||
* postCreate should be called after Init, and is the time that the editor
|
||||
* tells its documentStateObservers that the document has been created.
|
||||
*/
|
||||
void PreDestroy();
|
||||
|
||||
/** return the edit flags for this editor */
|
||||
void GetFlags(out unsigned long flags);
|
||||
|
||||
/** set the edit flags for this editor. May be called at any time. */
|
||||
void SetFlags(in unsigned long aFlags);
|
||||
void postCreate();
|
||||
|
||||
/**
|
||||
* return the DOM Document this editor is associated with
|
||||
*
|
||||
* @param aDoc [OUT] the dom interface being observed, refcounted
|
||||
* preDestroy is called before the editor goes away, and gives the editor a
|
||||
* chance to tell its documentStateObservers that the document is going away.
|
||||
*/
|
||||
void GetDocument(out nsIDOMDocument doc);
|
||||
void preDestroy();
|
||||
|
||||
/** return the body element
|
||||
* @param aElement return value for the root of the editable document
|
||||
*/
|
||||
void GetRootElement(out nsIDOMElement element);
|
||||
/** edit flags for this editor. May be set at any time. */
|
||||
attribute unsigned long flags;
|
||||
|
||||
/**
|
||||
* return the presentation shell this editor is associated with
|
||||
*
|
||||
* @param aPS [OUT] the pres shell, refcounted
|
||||
* the DOM Document this editor is associated with, refcounted.
|
||||
*/
|
||||
//NS_IMETHOD GetPresShell(nsIPresShell **aPS);
|
||||
readonly attribute nsIDOMDocument document;
|
||||
|
||||
/** the body element, i.e. the root of the editable document.
|
||||
*/
|
||||
readonly attribute nsIDOMElement rootElement;
|
||||
|
||||
/**
|
||||
* return the selection controller for the current presentation
|
||||
*
|
||||
* @param aSelCon [OUT] the selection controller, refcounted
|
||||
* the selection controller for the current presentation, refcounted.
|
||||
*/
|
||||
void GetSelectionController(out nsISelectionController selectioncontroller);
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
void GetSelection(out nsISelection selection);
|
||||
readonly attribute nsISelectionController selectionController;
|
||||
|
||||
|
||||
/* ------------ Selected content removal -------------- */
|
||||
@@ -140,121 +127,135 @@ interface nsIEditor : nsISupports
|
||||
* @param aDir if eLTR, delete to the right (for example, the DEL key)
|
||||
* if eRTL, delete to the left (for example, the BACKSPACE key)
|
||||
*/
|
||||
void DeleteSelection(in short action);
|
||||
void deleteSelection(in short action);
|
||||
|
||||
|
||||
/* ------------ Document info and file methods -------------- */
|
||||
|
||||
/** Returns true if the document has no *meaningful* content */
|
||||
void GetDocumentIsEmpty(out boolean documentIsEmpty);
|
||||
readonly attribute boolean documentIsEmpty;
|
||||
|
||||
/** Returns true if the document is modifed and needs saving */
|
||||
void GetDocumentModified(out boolean outDocModified);
|
||||
|
||||
/** Returns the current 'Save' document character set */
|
||||
void GetDocumentCharacterSet(out DOMString characterSet);
|
||||
readonly attribute boolean documentModified;
|
||||
|
||||
/** Sets the current 'Save' document character set */
|
||||
void SetDocumentCharacterSet(in DOMString characterSet);
|
||||
attribute AString documentCharacterSet;
|
||||
|
||||
/** to be used ONLY when we need to override the doc's modification state (such as when it's saved)
|
||||
/** to be used ONLY when we need to override the doc's modification
|
||||
* state (such as when it's saved).
|
||||
*/
|
||||
void ResetModificationCount();
|
||||
void resetModificationCount();
|
||||
|
||||
/** Gets the modification count of the document we are editing. Zero means unchanged.
|
||||
* @return the modification count of the document being edited. Zero means unchanged.
|
||||
/** Gets the modification count of the document we are editing.
|
||||
* @return the modification count of the document being edited.
|
||||
* Zero means unchanged.
|
||||
*/
|
||||
long GetModificationCount();
|
||||
long getModificationCount();
|
||||
|
||||
/** called each time we modify the document. Increments the modification count of the document.
|
||||
* @param aModCount the number of modifications to increase or decrease count by
|
||||
/** called each time we modify the document.
|
||||
* Increments the modification count of the document.
|
||||
* @param aModCount the number of modifications by which
|
||||
* to increase or decrease the count
|
||||
*/
|
||||
void IncrementModificationCount(in long aModCount);
|
||||
void incrementModificationCount(in long aModCount);
|
||||
|
||||
/* ------------ Transaction methods -------------- */
|
||||
|
||||
/** GetTransactionManagerDo() Get the transaction manager
|
||||
*
|
||||
* @return aTxnManager the transaction manager that the editor is using
|
||||
/** transactionManager Get the transaction manager the editor is using.
|
||||
*/
|
||||
void GetTransactionManager(out nsITransactionManager txnManager);
|
||||
readonly attribute nsITransactionManager transactionManager;
|
||||
|
||||
/** Do() fires a transaction. It is provided here so clients can create their own transactions.
|
||||
/** do() fires a transaction.
|
||||
* It is provided here so clients can create their own transactions.
|
||||
* If a transaction manager is present, it is used.
|
||||
* Otherwise, the transaction is just executed directly.
|
||||
*
|
||||
* @param aTxn the transaction to execute
|
||||
*/
|
||||
void Do(in nsITransaction txn);
|
||||
void do(in nsITransaction txn);
|
||||
|
||||
|
||||
/** turn the undo system on or off
|
||||
* @param aEnable if PR_TRUE, the undo system is turned on if it is available
|
||||
* if PR_FALSE the undo system is turned off if it was previously on
|
||||
* @return if aEnable is PR_TRUE, returns NS_OK if the undo system could be initialized properly
|
||||
* @param aEnable if PR_TRUE, the undo system is turned on if available
|
||||
* if PR_FALSE the undo system is turned off if it
|
||||
* was previously on
|
||||
* @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.
|
||||
*/
|
||||
void EnableUndo(in boolean enable);
|
||||
void enableUndo(in boolean enable);
|
||||
|
||||
/** 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.
|
||||
* If a transaction manager is present, it is told to undo and the result of
|
||||
* that undo is returned.
|
||||
* Otherwise, the Undo request is ignored and an error NS_ERROR_NOT_AVAILABLE is returned.
|
||||
/** 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.
|
||||
* If a transaction manager is present, it is told to undo,
|
||||
* and the result of that undo is returned.
|
||||
* Otherwise, the Undo request is ignored and an
|
||||
* error NS_ERROR_NOT_AVAILABLE is returned.
|
||||
*
|
||||
*/
|
||||
void Undo(in unsigned long count);
|
||||
void undo(in unsigned long count);
|
||||
|
||||
/** 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.
|
||||
* @param aCanUndo [OUT] PR_TRUE if at least one transaction is
|
||||
* currently ready to be undone.
|
||||
*/
|
||||
void CanUndo(out boolean isEnabled, out boolean canUndo);
|
||||
void canUndo(out boolean isEnabled, out boolean canUndo);
|
||||
|
||||
/** 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.
|
||||
* If a transaction manager is present, it is told to redo and the result of the previously undone
|
||||
* transaction is reapplied to the document.
|
||||
* If no transaction is available for Redo, or if the document has no transaction manager,
|
||||
* the Redo request is ignored and an error NS_ERROR_NOT_AVAILABLE is returned.
|
||||
/** 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.
|
||||
* If a transaction manager is present, it is told to redo and the
|
||||
* result of the previously undone transaction is reapplied to the document.
|
||||
* If no transaction is available for Redo, or if the document
|
||||
* has no transaction manager, the Redo request is ignored and an
|
||||
* error NS_ERROR_NOT_AVAILABLE is returned.
|
||||
*
|
||||
*/
|
||||
void Redo(in unsigned long count);
|
||||
void redo(in unsigned long count);
|
||||
|
||||
/** 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.
|
||||
* @param aCanRedo [OUT] PR_TRUE if at least one transaction is
|
||||
currently ready to be redone.
|
||||
*/
|
||||
void CanRedo(out boolean isEnabled, out boolean canRedo);
|
||||
void canRedo(out boolean isEnabled, out boolean canRedo);
|
||||
|
||||
/** 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,
|
||||
/** 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,
|
||||
* in the most efficient way possible.<br>
|
||||
* All transactions executed between a call to BeginTransaction and EndTransaction will be undoable as
|
||||
* an atomic action.<br>
|
||||
* EndTransaction must be called after BeginTransaction.<br>
|
||||
* Calls to BeginTransaction can be nested, as long as EndTransaction is called once per BeginUpdate.
|
||||
* All transactions executed between a call to beginTransaction and
|
||||
* endTransaction will be undoable as an atomic action.<br>
|
||||
* endTransaction must be called after beginTransaction.<br>
|
||||
* Calls to beginTransaction can be nested, as long as endTransaction
|
||||
* is called once per beginUpdate.
|
||||
*/
|
||||
void BeginTransaction();
|
||||
void beginTransaction();
|
||||
|
||||
/** 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.
|
||||
/** 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.
|
||||
*/
|
||||
void EndTransaction();
|
||||
void endTransaction();
|
||||
|
||||
void BeginPlaceHolderTransaction(in nsIAtom name);
|
||||
void EndPlaceHolderTransaction();
|
||||
void ShouldTxnSetSelection(out boolean result);
|
||||
void beginPlaceHolderTransaction(in nsIAtom name);
|
||||
void endPlaceHolderTransaction();
|
||||
boolean shouldTxnSetSelection();
|
||||
|
||||
/** Set the flag that prevents InsertElementTxn from changing the selection
|
||||
/** Set the flag that prevents insertElementTxn from changing the selection
|
||||
* @param should Set false to suppress changing the selection;
|
||||
* i.e., before using InsertElement() to insert under <head> element
|
||||
* i.e., before using InsertElement() to insert
|
||||
* under <head> element
|
||||
* WARNING: You must be very careful to reset back to PR_TRUE after
|
||||
* setting PR_FALSE, else selection/caret is trashed
|
||||
* for further editing
|
||||
* for further editing.
|
||||
*/
|
||||
void SetShouldTxnSetSelection(in boolean should);
|
||||
void setShouldTxnSetSelection(in boolean should);
|
||||
|
||||
/* ------------ Clipboard methods -------------- */
|
||||
|
||||
@@ -263,72 +264,69 @@ interface nsIEditor : nsISupports
|
||||
* What about mixed selections?
|
||||
* What are the clipboard formats?
|
||||
*/
|
||||
void Cut();
|
||||
void cut();
|
||||
|
||||
/** Can we cut? True if the doc is modifiable, and we have a non-
|
||||
* collapsed selection.
|
||||
*/
|
||||
void CanCut(out boolean canCut);
|
||||
boolean canCut();
|
||||
|
||||
/** copy the currently selected text, putting it into the OS clipboard
|
||||
* What if no text is selected?
|
||||
* What about mixed selections?
|
||||
* What are the clipboard formats?
|
||||
*/
|
||||
void Copy();
|
||||
void copy();
|
||||
|
||||
/** Can we copy? True if we have a non-collapsed selection.
|
||||
*/
|
||||
void CanCopy(out boolean aCanCopy);
|
||||
boolean canCopy();
|
||||
|
||||
/** paste the text in the OS clipboard at the cursor position, replacing
|
||||
* the selected text (if any)
|
||||
*/
|
||||
void Paste(in long aSelectionType);
|
||||
void paste(in long aSelectionType);
|
||||
|
||||
/** Can we paste? True if the doc is modifiable, and we have
|
||||
* pasteable data in the clipboard.
|
||||
*/
|
||||
void CanPaste(in long aSelectionType, out boolean aCanPaste);
|
||||
boolean canPaste(in long aSelectionType);
|
||||
|
||||
/* ------------ Selection methods -------------- */
|
||||
|
||||
/** sets the document selection to the entire contents of the document */
|
||||
void SelectAll();
|
||||
void selectAll();
|
||||
|
||||
/** sets the document selection to the beginning of the document */
|
||||
void BeginningOfDocument();
|
||||
void beginningOfDocument();
|
||||
|
||||
/** sets the document selection to the end of the document */
|
||||
void EndOfDocument();
|
||||
void endOfDocument();
|
||||
|
||||
/** Can we paste? True if the doc is modifiable, and we have
|
||||
* pasteable data in the clipboard.
|
||||
*/
|
||||
/* ------------ Drag/Drop methods -------------- */
|
||||
|
||||
/**
|
||||
* CanDrag decides if a drag should be started
|
||||
* canDrag decides if a drag should be started
|
||||
* (for example, based on the current selection and mousepoint).
|
||||
*/
|
||||
void CanDrag(in nsIDOMEvent aEvent, out boolean aCanDrag);
|
||||
boolean canDrag(in nsIDOMEvent aEvent);
|
||||
|
||||
/**
|
||||
* DoDrag transfers the relevant data (as appropriate)
|
||||
* doDrag transfers the relevant data (as appropriate)
|
||||
* to a transferable so it can later be dropped.
|
||||
*/
|
||||
void DoDrag(in nsIDOMEvent aEvent);
|
||||
void doDrag(in nsIDOMEvent aEvent);
|
||||
|
||||
/**
|
||||
* InsertFromDrop looks for a dragsession and inserts the
|
||||
* insertFromDrop looks for a dragsession and inserts the
|
||||
* relevant data in response to a drop.
|
||||
*/
|
||||
void InsertFromDrop(in nsIDOMEvent aEvent);
|
||||
void insertFromDrop(in nsIDOMEvent aEvent);
|
||||
|
||||
/* ------------ Node manipulation methods -------------- */
|
||||
|
||||
/**
|
||||
* SetAttribute() sets the attribute of aElement.
|
||||
* setAttribute() sets the attribute of aElement.
|
||||
* No checking is done to see if aAttribute is a legal attribute of the node,
|
||||
* or if aValue is a legal value of aAttribute.
|
||||
*
|
||||
@@ -336,142 +334,149 @@ interface nsIEditor : nsISupports
|
||||
* @param aAttribute the string representation of the attribute to set
|
||||
* @param aValue the value to set aAttribute to
|
||||
*/
|
||||
void SetAttribute(in nsIDOMElement aElement, in DOMString attributestr, in DOMString attvalue);
|
||||
void setAttribute(in nsIDOMElement aElement, in AString attributestr,
|
||||
in AString attvalue);
|
||||
|
||||
/**
|
||||
* GetAttributeValue() retrieves the attribute's value for aElement.
|
||||
* getAttributeValue() retrieves the attribute's value for aElement.
|
||||
*
|
||||
* @param aElement the content element to operate on
|
||||
* @param aAttribute the string representation of the attribute to get
|
||||
* @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.
|
||||
* @param aResultValue [OUT] the value of aAttribute.
|
||||
* Only valid if aResultIsSet is PR_TRUE
|
||||
* @return PR_TRUE if aAttribute is set on the current node,
|
||||
* PR_FALSE if it is not.
|
||||
*/
|
||||
void GetAttributeValue(in nsIDOMElement aElement,
|
||||
in DOMString attributestr,
|
||||
out DOMString resultValue,
|
||||
out boolean resultIsSet);
|
||||
boolean getAttributeValue(in nsIDOMElement aElement,
|
||||
in AString attributestr,
|
||||
out AString resultValue);
|
||||
|
||||
/**
|
||||
* RemoveAttribute() deletes aAttribute from the attribute list of aElement.
|
||||
* removeAttribute() deletes aAttribute from the attribute list of aElement.
|
||||
* If aAttribute is not an attribute of aElement, nothing is done.
|
||||
*
|
||||
* @param aElement the content element to operate on
|
||||
* @param aAttribute the string representation of the attribute to get
|
||||
*/
|
||||
void RemoveAttribute(in nsIDOMElement aElement,
|
||||
in DOMString aAttribute);
|
||||
void removeAttribute(in nsIDOMElement aElement,
|
||||
in AString aAttribute);
|
||||
|
||||
/**
|
||||
* CloneAttributes() is similar to nsIDOMNode::cloneNode(),
|
||||
* it assures the attribute nodes of the destination are identical with the source node
|
||||
* by copying all existing attributes from the source and deleting those not in the source.
|
||||
* cloneAttributes() is similar to nsIDOMNode::cloneNode(),
|
||||
* it assures the attribute nodes of the destination are identical
|
||||
* with the source node by copying all existing attributes from the
|
||||
* source and deleting those not in the source.
|
||||
* This is used when the destination node (element) already exists
|
||||
*
|
||||
* The supplied nodes MUST BE ELEMENTS (most callers are working with nodes)
|
||||
* @param aDestNode the destination element to operate on
|
||||
* @param aSourceNode the source element to copy attributes from
|
||||
*/
|
||||
void CloneAttributes(in nsIDOMNode destNode, in nsIDOMNode sourceNode);
|
||||
void cloneAttributes(in nsIDOMNode destNode, in nsIDOMNode sourceNode);
|
||||
|
||||
/**
|
||||
* CreateNode instantiates a new element of type aTag and inserts it into aParent at aPosition.
|
||||
* createNode instantiates a new element of type aTag and inserts it
|
||||
* into aParent at aPosition.
|
||||
* @param aTag The type of object to create
|
||||
* @param aParent The node to insert the new object into
|
||||
* @param aPosition The place in aParent to insert the new node
|
||||
* @param aNewNode [OUT] The node created. Caller must release aNewNode.
|
||||
* @return The node created. Caller must release aNewNode.
|
||||
*/
|
||||
void CreateNode(in DOMString tag,
|
||||
nsIDOMNode createNode(in AString tag,
|
||||
in nsIDOMNode parent,
|
||||
in long position,
|
||||
out nsIDOMNode newNode);
|
||||
in long position);
|
||||
|
||||
/**
|
||||
* InsertNode inserts aNode into aParent at aPosition.
|
||||
* No checking is done to verify the legality of the insertion. That is the
|
||||
* responsibility of the caller.
|
||||
* insertNode inserts aNode into aParent at aPosition.
|
||||
* No checking is done to verify the legality of the insertion.
|
||||
* That is the responsibility of the caller.
|
||||
* @param aNode The DOM Node to insert.
|
||||
* @param aParent The node to insert the new object into
|
||||
* @param aPosition The place in aParent to insert the new node
|
||||
* 0=first child, 1=second child, etc.
|
||||
* any number > number of current children = last child
|
||||
*/
|
||||
void InsertNode(in nsIDOMNode vode,
|
||||
in nsIDOMNode parent,
|
||||
in long aPosition);
|
||||
void insertNode(in nsIDOMNode node,
|
||||
in nsIDOMNode parent,
|
||||
in long aPosition);
|
||||
|
||||
|
||||
/**
|
||||
* SplitNode() creates a new node identical to an existing node, and split the contents between the two nodes
|
||||
* @param aExistingRightNode the node to split. It will become the new node's next sibling.
|
||||
* @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.
|
||||
* splitNode() creates a new node identical to an existing node,
|
||||
* and split the contents between the two nodes
|
||||
* @param aExistingRightNode the node to split.
|
||||
* It will become the new node's next sibling.
|
||||
* @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.
|
||||
*/
|
||||
void SplitNode(in nsIDOMNode existingRightNode,
|
||||
in long offset,
|
||||
out nsIDOMNode newLeftNode);
|
||||
void splitNode(in nsIDOMNode existingRightNode,
|
||||
in long offset,
|
||||
out nsIDOMNode newLeftNode);
|
||||
|
||||
/**
|
||||
* JoinNodes() takes 2 nodes and merge their content|children.
|
||||
* joinNodes() takes 2 nodes and merge their content|children.
|
||||
* @param aLeftNode The left node. It will be deleted.
|
||||
* @param aRightNode The right node. It will remain after the join.
|
||||
* @param aParent The parent of aExistingRightNode
|
||||
*
|
||||
* There is no requirement that the two nodes be of the same type.
|
||||
* However, a text node can be merged only with another text node.
|
||||
* There is no requirement that the two nodes be
|
||||
* of the same type. However, a text node can be
|
||||
* merged only with another text node.
|
||||
*/
|
||||
void JoinNodes(in nsIDOMNode leftNode,
|
||||
in nsIDOMNode rightNode,
|
||||
in nsIDOMNode parent);
|
||||
|
||||
void joinNodes(in nsIDOMNode leftNode,
|
||||
in nsIDOMNode rightNode,
|
||||
in nsIDOMNode parent);
|
||||
|
||||
/**
|
||||
* DeleteNode removes aChild from aParent.
|
||||
* deleteNode removes aChild from aParent.
|
||||
* @param aChild The node to delete
|
||||
*/
|
||||
void DeleteNode(in nsIDOMNode child);
|
||||
void deleteNode(in nsIDOMNode child);
|
||||
|
||||
/**
|
||||
* InsertFormattingForNode() sets a special dirty attribute on the node.
|
||||
* markNodeDirty() sets a special dirty attribute on the node.
|
||||
* Usually this will be called immediately after creating a new node.
|
||||
* @param aNode The node for which to insert formatting.
|
||||
*/
|
||||
void MarkNodeDirty(in nsIDOMNode node);
|
||||
void markNodeDirty(in nsIDOMNode node);
|
||||
|
||||
/* ------------ Output methods -------------- */
|
||||
|
||||
/* ------------ Output methods -------------- */
|
||||
|
||||
/**
|
||||
* Output methods:
|
||||
* aFormatType is a mime type, like text/plain.
|
||||
*/
|
||||
void OutputToString(out DOMString outputString,
|
||||
[const]in DOMString formatType,
|
||||
in unsigned long flags);
|
||||
void OutputToStream(in nsIOutputStream aStream,
|
||||
[const] in DOMString formatType,
|
||||
[const] in DOMString charsetOverride,
|
||||
in unsigned long flags);
|
||||
|
||||
void outputToString(out AString outputString,
|
||||
in AString formatType,
|
||||
in unsigned long flags);
|
||||
void outputToStream(in nsIOutputStream aStream,
|
||||
in AString formatType,
|
||||
in AString charsetOverride,
|
||||
in unsigned long flags);
|
||||
|
||||
|
||||
/* ------------ Various listeners methods -------------- */
|
||||
|
||||
/** add an EditorObserver to the editors list of observers. */
|
||||
void AddEditorObserver(in nsIEditorObserver observer);
|
||||
void addEditorObserver(in nsIEditorObserver observer);
|
||||
|
||||
/** Remove an EditorObserver from the editor's list of observers. */
|
||||
void RemoveEditorObserver(in nsIEditorObserver observer);
|
||||
void removeEditorObserver(in nsIEditorObserver observer);
|
||||
|
||||
/** add an EditActionListener to the editors list of listeners. */
|
||||
void AddEditActionListener(in nsIEditActionListener listener);
|
||||
void addEditActionListener(in nsIEditActionListener listener);
|
||||
|
||||
/** Remove an EditActionListener from the editor's list of listeners. */
|
||||
void RemoveEditActionListener(in nsIEditActionListener listener);
|
||||
void removeEditActionListener(in nsIEditActionListener listener);
|
||||
|
||||
/** Add a DocumentStateListener to the editors list of doc state listeners. */
|
||||
void AddDocumentStateListener(in nsIDocumentStateListener listener);
|
||||
void addDocumentStateListener(in nsIDocumentStateListener listener);
|
||||
|
||||
/** Remove a DocumentStateListener to the editors list of doc state listeners. */
|
||||
void RemoveDocumentStateListener(in nsIDocumentStateListener listener);
|
||||
void removeDocumentStateListener(in nsIDocumentStateListener listener);
|
||||
|
||||
|
||||
/* ------------ Debug methods -------------- */
|
||||
@@ -479,12 +484,11 @@ interface nsIEditor : nsISupports
|
||||
/**
|
||||
* And a debug method -- show us what the tree looks like right now
|
||||
*/
|
||||
void DumpContentTree();
|
||||
void dumpContentTree();
|
||||
|
||||
/** Dumps a text representation of the content tree to standard out */
|
||||
void DebugDumpContent() ;
|
||||
void debugDumpContent() ;
|
||||
|
||||
/* Run unit tests. Noop in optimized builds */
|
||||
void DebugUnitTests(out long outNumTests, out long outNumTestsFailed);
|
||||
|
||||
void debugUnitTests(out long outNumTests, out long outNumTestsFailed);
|
||||
};
|
||||
|
||||
105
mozilla/editor/idl/nsIEditorMailSupport.idl
Normal file
105
mozilla/editor/idl/nsIEditorMailSupport.idl
Normal file
@@ -0,0 +1,105 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998-2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Akkana Peck <akkana@netscape.com>
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsISupportsArray;
|
||||
interface nsIDOMNode;
|
||||
|
||||
[scriptable, uuid(fdf23301-4a94-11d3-9ce4-9960496c41bc)]
|
||||
|
||||
interface nsIEditorMailSupport : nsISupports
|
||||
{
|
||||
/** Paste the text in the OS clipboard at the cursor position,
|
||||
* as a quotation (whose representation is dependant on the editor type),
|
||||
* replacing the selected text (if any).
|
||||
* @param aSelectionType Text or html?
|
||||
*/
|
||||
void pasteAsQuotation(in long aSelectionType);
|
||||
|
||||
/** Insert a string as quoted text
|
||||
* (whose representation is dependant on the editor type),
|
||||
* replacing the selected text (if any).
|
||||
* @param aQuotedText The actual text to be quoted
|
||||
* @return The node which was inserted
|
||||
*/
|
||||
nsIDOMNode insertAsQuotation(in AString aQuotedText);
|
||||
|
||||
/** Paste a string as quoted text,
|
||||
* as a quotation (whose representation is dependant on the editor type),
|
||||
* replacing the selected text (if any)
|
||||
* @param aCitation The "mid" URL of the source message
|
||||
* @param aSelectionType Text or html?
|
||||
*/
|
||||
void pasteAsCitedQuotation(in AString aCitation,
|
||||
in long aSelectionType);
|
||||
|
||||
/** Insert a string as quoted text
|
||||
* (whose representation is dependant on the editor type),
|
||||
* replacing the selected text (if any),
|
||||
* including, if possible, a "cite" attribute.
|
||||
* @param aQuotedText The actual text to be quoted
|
||||
* @param aCitation The "mid" URL of the source message
|
||||
* @param aInsertHTML Insert as html? (vs plaintext)
|
||||
* @param aCharset The charset of the text to be inserted
|
||||
* @return The node which was inserted
|
||||
*/
|
||||
nsIDOMNode insertAsCitedQuotation(in AString aQuotedText,
|
||||
in AString aCitation,
|
||||
in boolean aInsertHTML,
|
||||
in AString aCharset);
|
||||
|
||||
/**
|
||||
* Rewrap the selected part of the document, re-quoting if necessary.
|
||||
* @param aRespectNewlines Try to maintain newlines in the original?
|
||||
*/
|
||||
void rewrap(in boolean aRespectNewlines);
|
||||
|
||||
/**
|
||||
* Strip any citations in the selected part of the document.
|
||||
*/
|
||||
void stripCites();
|
||||
|
||||
|
||||
/**
|
||||
* Get a list of IMG and OBJECT tags in the current document.
|
||||
*/
|
||||
nsISupportsArray getEmbeddedObjects();
|
||||
};
|
||||
|
||||
@@ -50,6 +50,11 @@ interface nsIDOMNode;
|
||||
interface nsIEditor;
|
||||
interface nsISupportsArray;
|
||||
|
||||
/**
|
||||
* nsIEditorShell is a DEPRECATED INTERFACE.
|
||||
* Please use the editor classes (nsIEditor, nsIHTMLEditor, etc.)
|
||||
* directly whenever possible.
|
||||
*/
|
||||
[scriptable, uuid(9afff72b-ca9a-11d2-96c9-0060b0fb9956)]
|
||||
interface nsIEditorShell : nsISupports
|
||||
{
|
||||
@@ -175,7 +180,7 @@ interface nsIEditorShell : nsISupports
|
||||
|
||||
/** Rebuild the entire document from source HTML
|
||||
* Needed to be able to edit HEAD and other outside-of-BODY content
|
||||
* param source: HTML source string of the entire new document
|
||||
* @param source: HTML source string of the entire new document
|
||||
*/
|
||||
void RebuildDocumentFromSource(in wstring source);
|
||||
|
||||
@@ -190,7 +195,7 @@ interface nsIEditorShell : nsISupports
|
||||
|
||||
/** Let editor handle clicking on a non-text element
|
||||
* to do selection, property editing, etc.
|
||||
* Returns true if we "consumed" the event
|
||||
* @return true if we "consumed" the event
|
||||
*/
|
||||
boolean HandleMouseClickOnElement(in nsIDOMElement element, in PRInt32 clickCount, in PRInt32 x, in PRInt32 y);
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Akkana Peck <akkana@netscape.com>
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
@@ -36,23 +37,25 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
%{C++
|
||||
class nsICSSStyleSheet;
|
||||
%}
|
||||
|
||||
[ptr] native nsICSSStyleSheet(nsICSSStyleSheet);
|
||||
|
||||
[scriptable, uuid(4805e682-49b9-11d3-9ce4-ed60bd6cb5bc)]
|
||||
|
||||
|
||||
interface nsIEditorStyleSheets : nsISupports
|
||||
{
|
||||
/** load and apply the style sheet, specified by aURL, to
|
||||
* the editor's document. This can involve asynchronous
|
||||
* network I/O
|
||||
* @param aURL The style sheet to be loaded and applied.
|
||||
* @param aStyleSheet Optional: if not null, return the style sheet created from aURL
|
||||
* @return the style sheet created from aURL
|
||||
*/
|
||||
void ApplyStyleSheet([const]in wstring, out nsICSSStyleSheet **aStyleSheet);
|
||||
[noscript] nsICSSStyleSheet applyStyleSheet(in AString aURL);
|
||||
|
||||
/** load and apply an Override style sheet, specified by aURL, to
|
||||
* the editor's document.
|
||||
@@ -65,26 +68,26 @@ interface nsIEditorStyleSheets : nsISupports
|
||||
* loaded using ApplyStyleSheet.
|
||||
*
|
||||
* @param aURL The style sheet to be loaded and applied.
|
||||
* @param aStyleSheet Optional: if not null, return the style sheet created from aURL
|
||||
* @return the style sheet created from aURL
|
||||
*/
|
||||
NS_IMETHOD ApplyOverrideStyleSheet(const nsString& aURL, nsICSSStyleSheet **aStyleSheet)=0;
|
||||
[noscript] nsICSSStyleSheet applyOverrideStyleSheet(in AString aURL);
|
||||
|
||||
/** Add the given Style Sheet to the editor's document
|
||||
* This is always synchronous
|
||||
* @param aSheet The style sheet to be applied.
|
||||
*/
|
||||
NS_IMETHOD AddStyleSheet(nsICSSStyleSheet* aSheet)=0;
|
||||
[noscript] void addStyleSheet(in nsICSSStyleSheet aSheet);
|
||||
|
||||
/** Remove the given Style Sheet from the editor's document
|
||||
* This is always synchronous
|
||||
* @param aSheet The style sheet to be removed
|
||||
*/
|
||||
NS_IMETHOD RemoveStyleSheet(nsICSSStyleSheet* aSheet)=0;
|
||||
[noscript] void removeStyleSheet(in nsICSSStyleSheet aSheet);
|
||||
|
||||
/** Remove the given Override Style Sheet from the editor's document
|
||||
* This is always synchronous
|
||||
* @param aSheet The style sheet to be removed.
|
||||
*/
|
||||
NS_IMETHOD RemoveOverrideStyleSheet(nsICSSStyleSheet* aSheet)=0;
|
||||
[noscript] void removeOverrideStyleSheet(in nsICSSStyleSheet aSheet);
|
||||
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
*
|
||||
* Contributor(s):
|
||||
* Daniel Glazman <glazman@netscape.com>
|
||||
*
|
||||
* Akkana Peck <akkana@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
@@ -37,8 +37,6 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "domstubs.idl"
|
||||
#include "nsIAtom.idl"
|
||||
@@ -72,115 +70,131 @@ interface nsIHTMLEditor : nsISupports
|
||||
* SetInlineProperty() sets the aggregate properties on the current selection
|
||||
*
|
||||
* @param aProperty the property to set on the selection
|
||||
* @param aAttribute the attribute of the property, if applicable. May be null.
|
||||
* @param aAttribute the attribute of the property, if applicable.
|
||||
* May be null.
|
||||
* Example: aProperty="font", aAttribute="color"
|
||||
* @param aValue if aAttribute is not null, the value of the attribute. May be null.
|
||||
* Example: aProperty="font", aAttribute="color", aValue="0x00FFFF"
|
||||
* @param aValue if aAttribute is not null, the value of the attribute.
|
||||
* May be null.
|
||||
* Example: aProperty="font", aAttribute="color",
|
||||
* aValue="0x00FFFF"
|
||||
*/
|
||||
void SetCSSInlineProperty(in nsIAtom aProperty,
|
||||
in DOMString aAttribute,
|
||||
in DOMString aValue);
|
||||
void SetInlineProperty(in nsIAtom aProperty,
|
||||
in DOMString aAttribute,
|
||||
in DOMString aValue);
|
||||
void setCSSInlineProperty(in nsIAtom aProperty,
|
||||
in AString aAttribute,
|
||||
in AString aValue);
|
||||
void setInlineProperty(in nsIAtom aProperty,
|
||||
in AString aAttribute,
|
||||
in AString aValue);
|
||||
|
||||
/**
|
||||
* GetInlineProperty() gets the aggregate properties of the current selection.
|
||||
* getInlineProperty() gets aggregate properties of the current selection.
|
||||
* All object in the current selection are scanned and their attributes are
|
||||
* represented in a list of Property object.
|
||||
*
|
||||
* @param aProperty the property to get on the selection
|
||||
* @param aAttribute the attribute of the property, if applicable. May be null.
|
||||
* @param aAttribute the attribute of the property, if applicable.
|
||||
* May be null.
|
||||
* Example: aProperty="font", aAttribute="color"
|
||||
* @param aValue if aAttribute is not null, the value of the attribute. May be null.
|
||||
* Example: aProperty="font", aAttribute="color", aValue="0x00FFFF"
|
||||
* @param aFirst [OUT] PR_TRUE if the first text node in the selection has the property
|
||||
* @param aAny [OUT] PR_TRUE if any of the text nodes in the selection have the property
|
||||
* @param aAll [OUT] PR_TRUE if all of the text nodes in the selection have the property
|
||||
* @param aValue if aAttribute is not null, the value of the attribute.
|
||||
* May be null.
|
||||
* Example: aProperty="font", aAttribute="color",
|
||||
* aValue="0x00FFFF"
|
||||
* @param aFirst [OUT] PR_TRUE if the first text node in the
|
||||
* selection has the property
|
||||
* @param aAny [OUT] PR_TRUE if any of the text nodes in the
|
||||
* selection have the property
|
||||
* @param aAll [OUT] PR_TRUE if all of the text nodes in the
|
||||
* selection have the property
|
||||
*/
|
||||
void GetInlineProperty(in nsIAtom aProperty,
|
||||
in DOMString aAttribute,
|
||||
in DOMString aValue,
|
||||
out boolean aFirst, out boolean aAny, out boolean aAll);
|
||||
void getInlineProperty(in nsIAtom aProperty,
|
||||
in AString aAttribute,
|
||||
in AString aValue,
|
||||
out boolean aFirst,
|
||||
out boolean aAny,
|
||||
out boolean aAll);
|
||||
|
||||
void GetInlinePropertyWithAttrValue(in nsIAtom aProperty,
|
||||
in DOMString aAttribute,
|
||||
in DOMString aValue,
|
||||
out boolean aFirst, out boolean aAny, out boolean aAll,
|
||||
out DOMString outValue);
|
||||
AString getInlinePropertyWithAttrValue(in nsIAtom aProperty,
|
||||
in AString aAttribute,
|
||||
in AString aValue,
|
||||
out boolean aFirst,
|
||||
out boolean aAny,
|
||||
out boolean aAll);
|
||||
|
||||
/**
|
||||
* RemoveAllInlineProperties() deletes all the inline properties from all
|
||||
* removeAllInlineProperties() deletes all the inline properties from all
|
||||
* text in the current selection.
|
||||
*/
|
||||
void RemoveAllInlineProperties();
|
||||
void removeAllInlineProperties();
|
||||
|
||||
|
||||
/**
|
||||
* RemoveInlineProperty() deletes the properties from all text in the current selection.
|
||||
* If aProperty is not set on the selection, nothing is done.
|
||||
* removeInlineProperty() deletes the properties from all text in the current
|
||||
* selection. If aProperty is not set on the selection, nothing is done.
|
||||
*
|
||||
* @param aProperty the property to remove from the selection
|
||||
* All atoms are for normal HTML tags (e.g.: nsIEditorProptery::font)
|
||||
* except when you want to remove just links and not named anchors
|
||||
* For that, use nsIEditorProperty::href
|
||||
* @param aAttribute the attribute of the property, if applicable. May be null.
|
||||
* Example: aProperty=nsIEditorProptery::font, aAttribute="color"
|
||||
* nsIEditProperty::allAttributes is special. It indicates that
|
||||
* all content-based text properties are to be removed from the selection.
|
||||
* All atoms are for normal HTML tags (e.g.:
|
||||
* nsIEditorProperty::font) except when you want to
|
||||
* remove just links and not named anchors.
|
||||
* For that, use nsIEditorProperty::href
|
||||
* @param aAttribute the attribute of the property, if applicable.
|
||||
* May be null.
|
||||
* Example: aProperty=nsIEditorProptery::font,
|
||||
* aAttribute="color"
|
||||
* nsIEditProperty::allAttributes is special.
|
||||
* It indicates that all content-based text properties
|
||||
* are to be removed from the selection.
|
||||
*/
|
||||
void RemoveInlineProperty(in nsIAtom aProperty, in DOMString aAttribute);
|
||||
void removeInlineProperty(in nsIAtom aProperty, in AString aAttribute);
|
||||
|
||||
/**
|
||||
* Increase font size for text in selection by 1 HTML unit
|
||||
* All existing text is scanned for existing <FONT SIZE> attributes
|
||||
* so they will be incremented instead of inserting new <FONT> tag
|
||||
* so they will be incremented instead of inserting new <FONT> tag
|
||||
*/
|
||||
void IncreaseFontSize();
|
||||
void increaseFontSize();
|
||||
|
||||
/**
|
||||
* Decrease font size for text in selection by 1 HTML unit
|
||||
* All existing text is scanned for existing <FONT SIZE> attributes
|
||||
* so they will be decreased instead of inserting new <FONT> tag
|
||||
* so they will be decreased instead of inserting new <FONT> tag
|
||||
*/
|
||||
void DecreaseFontSize();
|
||||
void decreaseFontSize();
|
||||
|
||||
/* ------------ Drag/Drop methods -------------- */
|
||||
|
||||
/**
|
||||
* CanDrag decides if a drag should be started
|
||||
* canDrag decides if a drag should be started
|
||||
* (for example, based on the current selection and mousepoint).
|
||||
*/
|
||||
void CanDrag(in nsIDOMEvent aEvent, out boolean aCanDrag);
|
||||
boolean canDrag(in nsIDOMEvent aEvent);
|
||||
|
||||
/**
|
||||
* DoDrag transfers the relevant data (as appropriate)
|
||||
* doDrag transfers the relevant data (as appropriate)
|
||||
* to a transferable so it can later be dropped.
|
||||
*/
|
||||
void DoDrag(in nsIDOMEvent aEvent);
|
||||
void doDrag(in nsIDOMEvent aEvent);
|
||||
|
||||
/**
|
||||
* InsertFromDrop looks for a dragsession and inserts the
|
||||
* insertFromDrop looks for a dragsession and inserts the
|
||||
* relevant data in response to a drop.
|
||||
*/
|
||||
void InsertFromDrop(in nsIDOMEvent aEvent);
|
||||
void insertFromDrop(in nsIDOMEvent aEvent);
|
||||
|
||||
/* ------------ HTML content methods -------------- */
|
||||
|
||||
/**
|
||||
* Tests if a node is a BLOCK element according the the HTML 4.0 DTD
|
||||
* Tests if a node is a BLOCK element according the the HTML 4.0 DTD.
|
||||
* This does NOT consider CSS effect on display type
|
||||
*
|
||||
* @param aNode the node to test
|
||||
*/
|
||||
void NodeIsBlock(in nsIDOMNode node, out boolean isBlock);
|
||||
boolean nodeIsBlock(in nsIDOMNode node);
|
||||
|
||||
/**
|
||||
* Insert some HTML source at the current location
|
||||
*
|
||||
* @param aInputString the string to be inserted
|
||||
*/
|
||||
void InsertHTML(in DOMString aInputString);
|
||||
void insertHTML(in AString aInputString);
|
||||
|
||||
|
||||
/** Rebuild the entire document from source HTML
|
||||
@@ -188,7 +202,7 @@ interface nsIHTMLEditor : nsISupports
|
||||
*
|
||||
* @param aSourceString HTML source string of the entire new document
|
||||
*/
|
||||
void RebuildDocumentFromSource(in DOMString aSourceString);
|
||||
void rebuildDocumentFromSource(in AString aSourceString);
|
||||
|
||||
/**
|
||||
* Insert some HTML source, interpreting
|
||||
@@ -199,8 +213,8 @@ interface nsIHTMLEditor : nsISupports
|
||||
* @param aParentNode Parent to insert under.
|
||||
* If null, insert at the current location.
|
||||
*/
|
||||
void InsertHTMLWithCharset(in DOMString aInputString,
|
||||
in DOMString aCharset);
|
||||
void insertHTMLWithCharset(in AString aInputString,
|
||||
in AString aCharset);
|
||||
|
||||
|
||||
/** Insert an element, which may have child nodes, at the selection
|
||||
@@ -214,11 +228,12 @@ interface nsIHTMLEditor : nsISupports
|
||||
* after the end of the selection for all element except
|
||||
* Named Anchors, which insert before the selection
|
||||
*/
|
||||
void InsertElementAtSelection(in nsIDOMElement aElement, in boolean aDeleteSelection);
|
||||
void insertElementAtSelection(in nsIDOMElement aElement,
|
||||
in boolean aDeleteSelection);
|
||||
|
||||
/** Set the documents title.
|
||||
*/
|
||||
void SetDocumentTitle(in DOMString aTitle);
|
||||
void setDocumentTitle(in AString aTitle);
|
||||
|
||||
/* ------------ Selection manipulation -------------- */
|
||||
/* Should these be moved to nsISelection? */
|
||||
@@ -227,7 +242,7 @@ interface nsIHTMLEditor : nsISupports
|
||||
*
|
||||
* @param aElement An element in the document
|
||||
*/
|
||||
void SelectElement(in nsIDOMElement aElement);
|
||||
void selectElement(in nsIDOMElement aElement);
|
||||
|
||||
/** Create a collapsed selection just after aElement
|
||||
*
|
||||
@@ -240,53 +255,53 @@ interface nsIHTMLEditor : nsISupports
|
||||
*
|
||||
* @param aElement An element in the document
|
||||
*/
|
||||
void SetCaretAfterElement(in nsIDOMElement aElement);
|
||||
void setCaretAfterElement(in nsIDOMElement aElement);
|
||||
|
||||
/**
|
||||
* SetParagraphFormat Insert a block paragraph tag around selection
|
||||
* @param aParagraphFormat "p", "h1" to "h6", "address", "pre", or "blockquote"
|
||||
*/
|
||||
void SetParagraphFormat(in DOMString aParagraphFormat);
|
||||
void setParagraphFormat(in AString aParagraphFormat);
|
||||
|
||||
/**
|
||||
* GetParagraphState returns what block tag paragraph format is in the selection.
|
||||
* getParagraphState returns what block tag paragraph format is in
|
||||
* the selection.
|
||||
* @param aMixed True if there is more than one format
|
||||
* @param outState Name of block tag. "" is returned for none.
|
||||
* @return Name of block tag. "" is returned for none.
|
||||
*/
|
||||
void GetParagraphState(out boolean aMixed,out DOMString outState);
|
||||
AString getParagraphState(out boolean aMixed);
|
||||
|
||||
/**
|
||||
* GetFontFaceState returns what font face is in the selection.
|
||||
* getFontFaceState returns what font face is in the selection.
|
||||
* @param aMixed True if there is more than one font face
|
||||
* @param outFace Name of face. Note: "tt" is returned for
|
||||
* @return Name of face. Note: "tt" is returned for
|
||||
* tt tag. "" is returned for none.
|
||||
*/
|
||||
void GetFontFaceState(out boolean aMixed,out DOMString outFont);
|
||||
AString getFontFaceState(out boolean aMixed);
|
||||
|
||||
/**
|
||||
* GetFontColorState returns what font face is in the selection.
|
||||
* getFontColorState returns what font face is in the selection.
|
||||
* @param aMixed True if there is more than one font color
|
||||
* @param outColor Color string. "" is returned for none.
|
||||
* @return Color string. "" is returned for none.
|
||||
*/
|
||||
void GetFontColorState(out boolean aMixed,out DOMString outColor);
|
||||
AString getFontColorState(out boolean aMixed);
|
||||
|
||||
/**
|
||||
* GetFontColorState returns what font face is in the selection.
|
||||
* getFontColorState returns what font face is in the selection.
|
||||
* @param aMixed True if there is more than one font color
|
||||
* @param outColor Color string. "" is returned for none.
|
||||
* @return Color string. "" is returned for none.
|
||||
*/
|
||||
void GetBackgroundColorState(out boolean aMixed,out DOMString outColor);
|
||||
AString getBackgroundColorState(out boolean aMixed);
|
||||
|
||||
/**
|
||||
* GetHighlightColorState returns what the highlight color of the selection.
|
||||
* getHighlightColorState returns what the highlight color of the selection.
|
||||
* @param aMixed True if there is more than one font color
|
||||
* @param outColor Color string. "" is returned for none.
|
||||
* @return Color string. "" is returned for none.
|
||||
*/
|
||||
void GetHighlightColorState(out boolean aMixed,out DOMString outColor);
|
||||
wstring GetHighlightColor(out boolean mixed);
|
||||
AString getHighlightColorState(out boolean aMixed);
|
||||
|
||||
/**
|
||||
* GetListState returns what list type is in the selection.
|
||||
* getListState returns what list type is in the selection.
|
||||
* @param aMixed True if there is more than one type of list, or
|
||||
* if there is some list and non-list
|
||||
* @param aOL The company that employs me. No, really, it's
|
||||
@@ -294,55 +309,59 @@ interface nsIHTMLEditor : nsISupports
|
||||
* @param aUL true if an "ul" list is selected.
|
||||
* @param aDL true if a "dl" list is selected.
|
||||
*/
|
||||
void GetListState(out boolean aMixed, out boolean aOL, out boolean aUL, out boolean aDL);
|
||||
void getListState(out boolean aMixed, out boolean aOL, out boolean aUL,
|
||||
out boolean aDL);
|
||||
|
||||
/**
|
||||
* GetListItemState returns what list item type is in the selection.
|
||||
* getListItemState returns what list item type is in the selection.
|
||||
* @param aMixed True if there is more than one type of list item, or
|
||||
* if there is some list and non-list
|
||||
* @param aLI true if "li" list items are selected.
|
||||
* @param aDT true if "dt" list items are selected.
|
||||
* @param aDD true if "dd" list items are selected.
|
||||
*/
|
||||
void GetListItemState(out boolean aMixed, out boolean aLI, out boolean aDT, out boolean aDD);
|
||||
void getListItemState(out boolean aMixed, out boolean aLI,
|
||||
out boolean aDT, out boolean aDD);
|
||||
|
||||
/**
|
||||
* GetAlignment returns what alignment is in the selection.
|
||||
* getAlignment returns what alignment is in the selection.
|
||||
* @param aMixed True if there is more than one type of list item, or
|
||||
* if there is some list and non-list
|
||||
* @param aAlign enum value for first encountered alignment (left/center/right)
|
||||
* @param aAlign enum value for first encountered alignment
|
||||
* (left/center/right)
|
||||
*/
|
||||
void GetAlignment(out boolean aMixed, out short aAlign);
|
||||
void getAlignment(out boolean aMixed, out short aAlign);
|
||||
|
||||
/**
|
||||
* Document me!
|
||||
*
|
||||
*/
|
||||
void GetIndentState(out boolean aCanIndent, out boolean aCanOutdent);
|
||||
void getIndentState(out boolean aCanIndent, out boolean aCanOutdent);
|
||||
|
||||
/**
|
||||
* Document me!
|
||||
*
|
||||
*/
|
||||
void MakeOrChangeList(in DOMString aListType, in boolean entireList, in DOMString aBulletType);
|
||||
void makeOrChangeList(in AString aListType, in boolean entireList,
|
||||
in AString aBulletType);
|
||||
|
||||
/**
|
||||
* Document me!
|
||||
*
|
||||
*/
|
||||
void RemoveList(in DOMString aListType);
|
||||
void removeList(in AString aListType);
|
||||
|
||||
/**
|
||||
* Document me!
|
||||
*
|
||||
*/
|
||||
void Indent(in DOMString aIndent);
|
||||
void indent(in AString aIndent);
|
||||
|
||||
/**
|
||||
* Document me!
|
||||
*
|
||||
*/
|
||||
void Align(in DOMString aAlign);
|
||||
void align(in AString aAlign);
|
||||
|
||||
/** Return the input node or a parent matching the given aTagName,
|
||||
* starting the search at the supplied node.
|
||||
@@ -358,18 +377,21 @@ interface nsIHTMLEditor : nsISupports
|
||||
* Use "list" to get an OL, UL, or DL list node
|
||||
* Use "td" to get either a TD or TH cell node
|
||||
*
|
||||
* @param aNode The node in the document to start the search
|
||||
* If it is null, the anchor node of the current selection is used
|
||||
* Returns NS_EDITOR_ELEMENT_NOT_FOUND if an element is not found (passes NS_SUCCEEDED macro)
|
||||
* @param aNode The node in the document to start the search.
|
||||
* If it is null, the anchor node of the current selection is used.
|
||||
* @return NS_EDITOR_ELEMENT_NOT_FOUND if an element is not found
|
||||
* (passes NS_SUCCEEDED macro)
|
||||
*/
|
||||
void GetElementOrParentByTagName(in DOMString aTagName, in nsIDOMNode aNode, out nsIDOMElement aReturn);
|
||||
nsIDOMElement getElementOrParentByTagName(in AString aTagName,
|
||||
in nsIDOMNode aNode);
|
||||
|
||||
/** Return an element only if it is the only node selected,
|
||||
* such as an image, horizontal rule, etc.
|
||||
* The exception is a link, which is more like a text attribute:
|
||||
* The Anchor tag is returned if the selection is within the textnode(s)
|
||||
* that are children of the "A" node.
|
||||
* This could be a collapsed selection, i.e., a caret within the link text.
|
||||
* This could be a collapsed selection, i.e., a caret
|
||||
* within the link text.
|
||||
*
|
||||
* @param aTagName The HTML tagname or and empty string
|
||||
* to get any element (but only if it is the only element selected)
|
||||
@@ -378,17 +400,18 @@ interface nsIHTMLEditor : nsISupports
|
||||
* (an "A" tag with the "href" attribute set)
|
||||
* Use "anchor" or "namedanchor" to get a named anchor node
|
||||
* (an "A" tag with the "name" attribute set)
|
||||
* Returns NS_EDITOR_ELEMENT_NOT_FOUND if an element is not found (passes NS_SUCCEEDED macro)
|
||||
* @return NS_EDITOR_ELEMENT_NOT_FOUND if an element is not found
|
||||
* (passes NS_SUCCEEDED macro)
|
||||
*/
|
||||
void GetSelectedElement(in DOMString aTagName, out nsIDOMElement aReturn);
|
||||
nsIDOMElement getSelectedElement(in AString aTagName);
|
||||
|
||||
/** Output the contents of the <HEAD> section as text/HTML format
|
||||
*/
|
||||
void GetHeadContentsAsHTML(out DOMString aOutputString);
|
||||
AString getHeadContentsAsHTML();
|
||||
|
||||
/** Replace all children of <HEAD> with string of HTML source
|
||||
*/
|
||||
void ReplaceHeadContentsWithHTML(in DOMString aSourceToInsert);
|
||||
void replaceHeadContentsWithHTML(in AString aSourceToInsert);
|
||||
|
||||
/** Return a new element with default attribute values
|
||||
*
|
||||
@@ -404,20 +427,21 @@ interface nsIHTMLEditor : nsISupports
|
||||
* (an "A" tag with the "href" attribute set)
|
||||
* Use "anchor" or "namedanchor" to get a named anchor node
|
||||
* (an "A" tag with the "name" attribute set)
|
||||
* @return The new element created.
|
||||
*/
|
||||
void CreateElementWithDefaults(in DOMString aTagName, out nsIDOMElement aReturn);
|
||||
nsIDOMElement createElementWithDefaults(in AString aTagName);
|
||||
|
||||
/** Insert an link element as the parent of the current selection
|
||||
*
|
||||
* @param aElement An "A" element with a non-empty "href" attribute
|
||||
*/
|
||||
void InsertLinkAroundSelection(in nsIDOMElement aAnchorElement);
|
||||
void insertLinkAroundSelection(in nsIDOMElement aAnchorElement);
|
||||
|
||||
/** Set the value of the "bgcolor" attribute on the document's <body> element
|
||||
*
|
||||
* @param aColor The HTML color string, such as "#ffccff" or "yellow"
|
||||
*/
|
||||
void SetBackgroundColor(in DOMString aColor);
|
||||
void setBackgroundColor(in AString aColor);
|
||||
|
||||
|
||||
/** Set an attribute on the document's <body> element
|
||||
@@ -428,11 +452,12 @@ interface nsIHTMLEditor : nsISupports
|
||||
* @param aAttr The attribute to be set
|
||||
* @param aValue The value of the attribute
|
||||
*/
|
||||
void SetBodyAttribute(in DOMString aAttr, in DOMString aValue);
|
||||
void setBodyAttribute(in AString aAttr, in AString aValue);
|
||||
|
||||
//XXX Used to suppress spurious drag/drop events to workaround bug 50703
|
||||
// Don't use this method! It will go away after first release!
|
||||
void IgnoreSpuriousDragEvent(in boolean aIgnoreSpuriousDragEvent);
|
||||
/** XXX Used to suppress spurious drag/drop events to workaround bug 50703
|
||||
* Don't use this method! It will go away after first release!
|
||||
*/
|
||||
void ignoreSpuriousDragEvent(in boolean aIgnoreSpuriousDragEvent);
|
||||
|
||||
/**
|
||||
* Find all the nodes in the document which contain references
|
||||
@@ -441,17 +466,15 @@ interface nsIHTMLEditor : nsISupports
|
||||
*
|
||||
* @return aNodeList the linked nodes found
|
||||
*/
|
||||
nsISupportsArray GetLinkedObjects();
|
||||
nsISupportsArray getLinkedObjects();
|
||||
|
||||
void SetCSSEnabled(in boolean aIsCSSPrefChecked);
|
||||
|
||||
/** IsCSSEnabled answers a boolean which is true is the HTMLEditor has been
|
||||
* instantiated with CSS knowledge and if the CSS pref is currently checked
|
||||
/** A boolean which is true is the HTMLEditor has been instantiated
|
||||
* with CSS knowledge and if the CSS pref is currently checked
|
||||
*
|
||||
* @param aIsCSSEnabled [OUT] true if CSS handled and enabled
|
||||
* @return true if CSS handled and enabled
|
||||
*/
|
||||
void IsCSSEnabled(out boolean aIsCSSEnabled);
|
||||
attribute boolean isCSSEnabled;
|
||||
|
||||
nsIDOMCSSStyleRule ParseStyleAttrIntoCSSRule(in wstring aString);
|
||||
nsIDOMCSSStyleRule parseStyleAttrIntoCSSRule(in AString aString);
|
||||
};
|
||||
|
||||
|
||||
@@ -39,15 +39,17 @@
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMNode;
|
||||
interface nsIDOMElement;
|
||||
interface nsIDOMRange;
|
||||
|
||||
[scriptable, uuid(4805e684-49b9-11d3-9ce4-ed60bd6cb5bc)]
|
||||
|
||||
interface nsITableEditor : nsISupports
|
||||
{
|
||||
enum {
|
||||
eNoSearch,
|
||||
ePreviousColumn,
|
||||
ePreviousRow
|
||||
};
|
||||
const short eNoSearch = 0;
|
||||
const short ePreviousColumn = 1;
|
||||
const short ePreviousRow = 2;
|
||||
|
||||
/* ------------ Table editing Methods -------------- */
|
||||
|
||||
@@ -61,9 +63,9 @@ interface nsITableEditor : nsISupports
|
||||
* @param aAfter If TRUE, insert after the current cell,
|
||||
* else insert before current cell
|
||||
*/
|
||||
void InsertTableCell(in long aNumber, in boolean aAfter);
|
||||
void InsertTableColumn(in long aNumber, in boolean aAfter);
|
||||
void InsertTableRow(in long aNumber, in boolean aAfter);
|
||||
void insertTableCell(in long aNumber, in boolean aAfter);
|
||||
void insertTableColumn(in long aNumber, in boolean aAfter);
|
||||
void insertTableRow(in long aNumber, in boolean aAfter);
|
||||
|
||||
/** Delete table methods
|
||||
* Delete starting at the selected cell or the
|
||||
@@ -75,13 +77,13 @@ interface nsITableEditor : nsISupports
|
||||
*
|
||||
* @param aNumber Number of items to insert/delete
|
||||
*/
|
||||
void DeleteTable();
|
||||
void deleteTable();
|
||||
|
||||
/** Delete just the cell contents
|
||||
* This is what should happen when Delete key is used
|
||||
* for selected cells, to minimize upsetting the table layout
|
||||
*/
|
||||
void DeleteTableCellContents();
|
||||
void deleteTableCellContents();
|
||||
|
||||
/** Delete cell elements as well as contents
|
||||
* @param aNumber Number of contiguous cells, rows, or columns
|
||||
@@ -92,15 +94,15 @@ interface nsITableEditor : nsISupports
|
||||
* user simply selects a cell in each, and they don't
|
||||
* have to be contiguous.
|
||||
*/
|
||||
void DeleteTableCell(in long aNumber);
|
||||
void DeleteTableColumn(in long aNumber);
|
||||
void DeleteTableRow(in long aNumber);
|
||||
void deleteTableCell(in long aNumber);
|
||||
void deleteTableColumn(in long aNumber);
|
||||
void deleteTableRow(in long aNumber);
|
||||
|
||||
/** Table Selection methods
|
||||
* Selecting a row or column actually
|
||||
* selects all cells (not TR in the case of rows)
|
||||
*/
|
||||
void SelectTableCell();
|
||||
void selectTableCell();
|
||||
|
||||
/** Select a rectangular block of cells:
|
||||
* all cells falling within the row/column index of aStartCell
|
||||
@@ -110,12 +112,13 @@ interface nsITableEditor : nsISupports
|
||||
* @param aStartCell starting cell in block
|
||||
* @param aEndCell ending cell in block
|
||||
*/
|
||||
void SelectBlockOfCells(in nsIDOMElement aStartCell, in nsIDOMElement aEndCell);
|
||||
void selectBlockOfCells(in nsIDOMElement aStartCell,
|
||||
in nsIDOMElement aEndCell);
|
||||
|
||||
void SelectTableRow();
|
||||
void SelectTableColumn();
|
||||
void SelectTable();
|
||||
void SelectAllTableCells();
|
||||
void selectTableRow();
|
||||
void selectTableColumn();
|
||||
void selectTable();
|
||||
void selectAllTableCells();
|
||||
|
||||
/** Create a new TD or TH element, the opposite type of the supplied aSourceCell
|
||||
* 1. Copy all attributes from aSourceCell to the new cell
|
||||
@@ -123,9 +126,9 @@ interface nsITableEditor : nsISupports
|
||||
* 3. Replace aSourceCell in the table with the new cell
|
||||
*
|
||||
* @param aSourceCell The cell to be replaced
|
||||
* @param aNewCell The new cell that replaces aSourceCell
|
||||
* @return The new cell that replaces aSourceCell
|
||||
*/
|
||||
void SwitchTableCellHeaderType(in nsIDOMElement aSourceCell, out nsIDOMElement aNewCell);
|
||||
nsIDOMElement switchTableCellHeaderType(in nsIDOMElement aSourceCell);
|
||||
|
||||
/** Merges contents of all selected cells
|
||||
* for selected cells that are adjacent,
|
||||
@@ -147,7 +150,7 @@ interface nsITableEditor : nsISupports
|
||||
* that cell and the one to the right
|
||||
* are merged
|
||||
*/
|
||||
void JoinTableCells(in boolean aMergeNonContiguousContents);
|
||||
void joinTableCells(in boolean aMergeNonContiguousContents);
|
||||
|
||||
/** Split a cell that has rowspan and/or colspan > 0
|
||||
* into cells such that all new cells have
|
||||
@@ -155,7 +158,7 @@ interface nsITableEditor : nsISupports
|
||||
* All of the contents are not touched --
|
||||
* they will appear to be in the upper-left cell
|
||||
*/
|
||||
void SplitTableCell();
|
||||
void splitTableCell();
|
||||
|
||||
/** Scan through all rows and add cells as needed so
|
||||
* all locations in the cellmap are occupied.
|
||||
@@ -167,20 +170,22 @@ interface nsITableEditor : nsISupports
|
||||
* thus it can be used to fixup all tables
|
||||
* in a page independant of the selection
|
||||
*/
|
||||
void NormalizeTable(in nsIDOMElement aTable);
|
||||
void normalizeTable(in nsIDOMElement aTable);
|
||||
|
||||
/** Get the row an column index from the layout's cellmap
|
||||
* If aTable is null, it will try to find enclosing table of selection ancho
|
||||
*
|
||||
*/
|
||||
void GetCellIndexes(in nsIDOMElement aCell, out long aRowIndex, out long aColIndex);
|
||||
void getCellIndexes(in nsIDOMElement aCell,
|
||||
out long aRowIndex, out long aColIndex);
|
||||
|
||||
/** Get the number of rows and columns in a table from the layout's cellmap
|
||||
* If aTable is null, it will try to find enclosing table of selection ancho
|
||||
* Note that all rows in table will not have this many because of
|
||||
* ROWSPAN effects or if table is not "rectangular" (has short rows)
|
||||
*/
|
||||
void GetTableSize(in nsIDOMElement aTable, out long aRowCount, out long aColCount);
|
||||
void getTableSize(in nsIDOMElement aTable,
|
||||
out long aRowCount, out long aColCount);
|
||||
|
||||
/** Get a cell element at cellmap grid coordinates
|
||||
* A cell that spans across multiple cellmap locations will
|
||||
@@ -189,12 +194,14 @@ interface nsITableEditor : nsISupports
|
||||
* @param aTable A table in the document
|
||||
* @param aRowIndex, aColIndex The 0-based cellmap indexes
|
||||
*
|
||||
* Returns NS_EDITOR_ELEMENT_NOT_FOUND if an element is not found (passes NS_SUCCEEDED macro)
|
||||
* Returns NS_EDITOR_ELEMENT_NOT_FOUND if an element is not found
|
||||
* (passes NS_SUCCEEDED macro)
|
||||
* You can scan for all cells in a row or column
|
||||
* by iterating through the appropriate indexes
|
||||
* until the returned aCell is null
|
||||
*/
|
||||
void GetCellAt(in nsIDOMElement aTable, in long aRowIndex, in long aColIndex, out nsIDOMElement aCell);
|
||||
nsIDOMElement getCellAt(in nsIDOMElement aTable,
|
||||
in long aRowIndex, in long aColIndex);
|
||||
|
||||
/** Get a cell at cellmap grid coordinates and associated data
|
||||
* A cell that spans across multiple cellmap locations will
|
||||
@@ -220,35 +227,34 @@ interface nsITableEditor : nsISupports
|
||||
*
|
||||
* Returns NS_EDITOR_ELEMENT_NOT_FOUND if a cell is not found (passes NS_SUCCEEDED macro)
|
||||
*/
|
||||
void GetCellDataAt(in nsIDOMElement aTable, in long aRowIndex, in long aColIndex, out nsIDOMElement aCell,
|
||||
out long aStartRowIndex, out long aStartColIndex,
|
||||
out long aRowSpan, out long aColSpan,
|
||||
out long aActualRowSpan, out long aActualColSpan,
|
||||
out boolean aIsSelected);
|
||||
void getCellDataAt(in nsIDOMElement aTable,
|
||||
in long aRowIndex, in long aColIndex,
|
||||
out nsIDOMElement aCell,
|
||||
out long aStartRowIndex, out long aStartColIndex,
|
||||
out long aRowSpan, out long aColSpan,
|
||||
out long aActualRowSpan, out long aActualColSpan,
|
||||
out boolean aIsSelected);
|
||||
|
||||
/** Get the first row element in a table
|
||||
*
|
||||
* @param aTableElement Any TABLE or child-of-table element in the document
|
||||
* @param aRowIndex The 0-based index of the row
|
||||
*
|
||||
* Returns:
|
||||
* @param aRow The row at the requested index
|
||||
* @return The row at the requested index
|
||||
* Returns null if there are no rows in table
|
||||
* Returns NS_EDITOR_ELEMENT_NOT_FOUND if an element is not found (passes NS_SUCCEEDED macro)
|
||||
* Returns (to C++) NS_EDITOR_ELEMENT_NOT_FOUND if an element is not found
|
||||
* (passes NS_SUCCEEDED macro)
|
||||
*/
|
||||
void GetFirstRow(in nsIDOMElement aTableElement, out nsIDOMElement aRow);
|
||||
nsIDOMNode getFirstRow(in nsIDOMElement aTableElement);
|
||||
|
||||
/** Get the next row element starting the search from aTableElement
|
||||
*
|
||||
* @param aTableElement Any TR or child-of-TR element in the document
|
||||
*
|
||||
* Returns:
|
||||
* @param aRow The row to start search from
|
||||
* @return The row to start search from
|
||||
* and the row returned from the search
|
||||
* Returns null if there isn't another row
|
||||
* Returns NS_EDITOR_ELEMENT_NOT_FOUND if an element is not found (passes NS_SUCCEEDED macro)
|
||||
* Returns (to C++) NS_EDITOR_ELEMENT_NOT_FOUND if an element is not found
|
||||
* (passes NS_SUCCEEDED macro)
|
||||
*/
|
||||
void GetNextRow(in nsIDOMElement aTableElement, out nsIDOMElement aRow);
|
||||
nsIDOMNode getNextRow(in nsIDOMNode aTableElement);
|
||||
|
||||
/** Preferred direction to search for neighboring cell
|
||||
* when trying to locate a cell to place caret in after
|
||||
@@ -273,64 +279,76 @@ interface nsITableEditor : nsISupports
|
||||
* and can use the nsSetSelectionAfterTableEdit stack-based
|
||||
* object to insure we reset the caret in a table-editing method.
|
||||
*/
|
||||
void SetSelectionAfterTableEdit(in nsIDOMElement aTable, in long aRow, in long aCol,
|
||||
in long aDirection, in boolean aSelected);
|
||||
void setSelectionAfterTableEdit(in nsIDOMElement aTable,
|
||||
in long aRow, in long aCol,
|
||||
in long aDirection, in boolean aSelected);
|
||||
|
||||
/** Examine the current selection and find
|
||||
* a selected TABLE, TD or TH, or TR element.
|
||||
* or return the parent TD or TH if selection is inside a table cell
|
||||
* Returns null if no table element is found.
|
||||
*
|
||||
* @param aTableElement The table element (table, row, or cell) returned
|
||||
* @param aTagName The tagname of returned element
|
||||
* Note that "td" will be returned if name is actually "th"
|
||||
* @param aSelectedCount How many table elements were selected
|
||||
* This tells us if we have multiple cells selected
|
||||
* (0 if element is a parent cell of selection)
|
||||
* @param aTableElement The table element (table, row, or cell) returned
|
||||
* @param aTagName The tagname of returned element
|
||||
* Note that "td" will be returned if name
|
||||
* is actually "th"
|
||||
* @return How many table elements were selected
|
||||
* This tells us if we have multiple cells selected
|
||||
* (0 if element is a parent cell of selection)
|
||||
*
|
||||
* Returns NS_EDITOR_ELEMENT_NOT_FOUND if an element is not found (passes NS_SUCCEEDED macro)
|
||||
* Returns NS_EDITOR_ELEMENT_NOT_FOUND if an element is not found
|
||||
* (passes NS_SUCCEEDED macro)
|
||||
*/
|
||||
void GetSelectedOrParentTableElement(out nsIDOMElement aTableElement, nsString& aTagName, out long aSelectedCount);
|
||||
long getSelectedOrParentTableElement(out nsIDOMElement aTableElement,
|
||||
out AString aTagName);
|
||||
|
||||
/** Generally used after GetSelectedOrParentTableElement
|
||||
* to test if selected cells are complete rows or columns
|
||||
*
|
||||
* @param aElement Any table or cell element or any element inside a table
|
||||
* @param aElement Any table or cell element or any element
|
||||
* inside a table
|
||||
* Used to get enclosing table.
|
||||
* If null, selection's anchorNode is used
|
||||
*
|
||||
* @param aSelectionType Returns:
|
||||
* 0 aCellElement was not a cell (returned result = NS_ERROR_FAILURE)
|
||||
* TABLESELECTION_CELL There are 1 or more cells selected
|
||||
* but complete rows or columns are not selected
|
||||
* TABLESELECTION_ROW All cells are in 1 or more rows
|
||||
* and in each row, all cells selected
|
||||
* Note: This is the value if all rows (thus all cells) are selected
|
||||
* TABLESELECTION_COLUMN All cells are in 1 or more columns
|
||||
* and in each column, all cells are selected
|
||||
* @return
|
||||
* 0 aCellElement was not a cell
|
||||
* (returned result = NS_ERROR_FAILURE)
|
||||
* TABLESELECTION_CELL There are 1 or more cells selected but
|
||||
* complete rows or columns are not selected
|
||||
* TABLESELECTION_ROW All cells are in 1 or more rows
|
||||
* and in each row, all cells selected
|
||||
* Note: This is the value if all rows
|
||||
* (thus all cells) are selected
|
||||
* TABLESELECTION_COLUMN All cells are in 1 or more columns
|
||||
* and in each column, all cells are selected
|
||||
*/
|
||||
void GetSelectedCellsType(nsIDOMElement *aElement, PRUint32 &aSelectionType);
|
||||
PRUint32 getSelectedCellsType(in nsIDOMElement aElement);
|
||||
|
||||
/** Get first selected element from first selection range.
|
||||
* Assumes cell-selection model where each cell
|
||||
* is in a separate range (selection parent node is table row)
|
||||
* @param aCell Selected cell or null if ranges don't contain cell selections
|
||||
* @param aRange Optional: if not null, return the selection range
|
||||
* @param aCell [OUT] Selected cell or null if ranges don't contain
|
||||
* cell selections
|
||||
* @param aRange [OUT] Optional: if not null, return the selection range
|
||||
* associated with the cell
|
||||
* Returns NS_EDITOR_ELEMENT_NOT_FOUND if an element is not found (passes NS_SUCCEEDED macro)
|
||||
* Returns NS_EDITOR_ELEMENT_NOT_FOUND if an element is not found
|
||||
* (passes NS_SUCCEEDED macro)
|
||||
*/
|
||||
void GetFirstSelectedCell(nsIDOMElement **aCell, nsIDOMRange **aRange);
|
||||
void getFirstSelectedCell(out nsIDOMElement aCell, out nsIDOMRange aRange);
|
||||
|
||||
/** Get first selected element from first selection range.
|
||||
* Assumes cell-selection model where each cell
|
||||
* is in a separate range (selection parent node is table row)
|
||||
* @param aCell Selected cell or null if ranges don't contain cell selections
|
||||
* @param aRowIndex Optional: if not null, return the row index of first cell
|
||||
* @param aColIndex Optional: if not null, return the column index of first cell
|
||||
* @param aCell Selected cell or null if ranges don't contain
|
||||
* cell selections
|
||||
* @param aRowIndex Optional: if not null, return row index of 1st cell
|
||||
* @param aColIndex Optional: if not null, return column index of 1st cell
|
||||
*
|
||||
* Returns NS_EDITOR_ELEMENT_NOT_FOUND if an element is not found (passes NS_SUCCEEDED macro)
|
||||
* Returns NS_EDITOR_ELEMENT_NOT_FOUND if an element is not found
|
||||
* (passes NS_SUCCEEDED macro)
|
||||
*/
|
||||
void GetFirstSelectedCellInTable(nsIDOMElement **aCell, PRInt32 *aRowIndex, PRInt32 *aColIndex);
|
||||
void getFirstSelectedCellInTable(out nsIDOMElement aCell,
|
||||
out long aRowIndex, out long aColIndex);
|
||||
|
||||
/** Get next selected cell element from first selection range.
|
||||
* Assumes cell-selection model where each cell
|
||||
@@ -341,6 +359,6 @@ interface nsITableEditor : nsISupports
|
||||
* @param aRange Optional: if not null, return the selection range
|
||||
* associated with the cell
|
||||
*/
|
||||
void GetNextSelectedCell(nsIDOMElement **aCell, nsIDOMRange **aRange);
|
||||
void getNextSelectedCell(out nsIDOMElement aCell, out nsIDOMRange aRange);
|
||||
};
|
||||
|
||||
|
||||
@@ -248,29 +248,37 @@ NS_IMETHODIMP nsHTMLEditor::LoadHTMLWithCharset(const nsAReadableString & aInput
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::InsertHTML(const nsAReadableString & aInString)
|
||||
NS_IMETHODIMP nsHTMLEditor::InsertHTML(const nsAString & aInString)
|
||||
{
|
||||
nsAutoString charset;
|
||||
return InsertHTMLWithCharset(aInString, charset);
|
||||
}
|
||||
|
||||
nsresult nsHTMLEditor::InsertHTMLWithContext(const nsAReadableString & aInputString, const nsAReadableString & aContextStr, const nsAReadableString & aInfoStr)
|
||||
nsresult
|
||||
nsHTMLEditor::InsertHTMLWithContext(const nsAString & aInputString,
|
||||
const nsAString & aContextStr,
|
||||
const nsAString & aInfoStr)
|
||||
{
|
||||
nsAutoString charset;
|
||||
return InsertHTMLWithCharsetAndContext(aInputString, charset, aContextStr, aInfoStr);
|
||||
return InsertHTMLWithCharsetAndContext(aInputString, charset,
|
||||
aContextStr, aInfoStr);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::InsertHTMLWithCharset(const nsAReadableString & aInputString, const nsAReadableString & aCharset)
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::InsertHTMLWithCharset(const nsAString & aInputString,
|
||||
const nsAString & aCharset)
|
||||
{
|
||||
return InsertHTMLWithCharsetAndContext(aInputString, aCharset, nsAutoString(), nsAutoString());
|
||||
return InsertHTMLWithCharsetAndContext(aInputString, aCharset,
|
||||
nsAutoString(), nsAutoString());
|
||||
}
|
||||
|
||||
|
||||
nsresult nsHTMLEditor::InsertHTMLWithCharsetAndContext(const nsAReadableString & aInputString,
|
||||
const nsAReadableString & aCharset,
|
||||
const nsAReadableString & aContextStr,
|
||||
const nsAReadableString & aInfoStr)
|
||||
nsresult
|
||||
nsHTMLEditor::InsertHTMLWithCharsetAndContext(const nsAString & aInputString,
|
||||
const nsAString & aCharset,
|
||||
const nsAString & aContextStr,
|
||||
const nsAString & aInfoStr)
|
||||
{
|
||||
if (!mRules) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
@@ -1361,7 +1369,7 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsQuotation(PRInt32 aSelectionType)
|
||||
return PasteAsCitedQuotation(citation, aSelectionType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::PasteAsCitedQuotation(const nsAReadableString & aCitation,
|
||||
NS_IMETHODIMP nsHTMLEditor::PasteAsCitedQuotation(const nsAString & aCitation,
|
||||
PRInt32 aSelectionType)
|
||||
{
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
@@ -1471,7 +1479,7 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsPlaintextQuotation(PRInt32 aSelectionType)
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::InsertAsQuotation(const nsAReadableString & aQuotedText,
|
||||
NS_IMETHODIMP nsHTMLEditor::InsertAsQuotation(const nsAString & aQuotedText,
|
||||
nsIDOMNode **aNodeInserted)
|
||||
{
|
||||
if (mFlags & eEditorPlaintextMask)
|
||||
@@ -1488,7 +1496,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertAsQuotation(const nsAReadableString & aQuotedT
|
||||
// in that here, quoted material is enclosed in a <pre> tag
|
||||
// in order to preserve the original line wrapping.
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::InsertAsPlaintextQuotation(const nsAReadableString & aQuotedText,
|
||||
nsHTMLEditor::InsertAsPlaintextQuotation(const nsAString & aQuotedText,
|
||||
nsIDOMNode **aNodeInserted)
|
||||
{
|
||||
nsresult rv;
|
||||
@@ -1582,10 +1590,10 @@ nsHTMLEditor::InsertAsPlaintextQuotation(const nsAReadableString & aQuotedText,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::InsertAsCitedQuotation(const nsAReadableString & aQuotedText,
|
||||
const nsAReadableString & aCitation,
|
||||
nsHTMLEditor::InsertAsCitedQuotation(const nsAString & aQuotedText,
|
||||
const nsAString & aCitation,
|
||||
PRBool aInsertHTML,
|
||||
const nsAReadableString & aCharset,
|
||||
const nsAString & aCharset,
|
||||
nsIDOMNode **aNodeInserted)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> newNode;
|
||||
|
||||
@@ -718,7 +718,7 @@ nsHTMLEditRules::GetAlignment(PRBool *aMixed, nsIHTMLEditor::EAlignment *aAlign)
|
||||
if (!nodeToExamine) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
PRBool useCSS;
|
||||
mHTMLEditor->IsCSSEnabled(&useCSS);
|
||||
mHTMLEditor->GetIsCSSEnabled(&useCSS);
|
||||
NS_NAMED_LITERAL_STRING(typeAttrName, "align");
|
||||
nsIAtom *dummyProperty = nsnull;
|
||||
if (useCSS && mHTMLEditor->mHTMLCSSUtils->IsCSSEditableProperty(nodeToExamine, dummyProperty, &typeAttrName))
|
||||
@@ -827,7 +827,7 @@ nsHTMLEditRules::GetIndentState(PRBool *aCanIndent, PRBool *aCanOutdent)
|
||||
PRInt32 i;
|
||||
arrayOfNodes->Count(&listCount);
|
||||
PRBool useCSS;
|
||||
mHTMLEditor->IsCSSEnabled(&useCSS);
|
||||
mHTMLEditor->GetIsCSSEnabled(&useCSS);
|
||||
for (i=(PRInt32)listCount-1; i>=0; i--)
|
||||
{
|
||||
nsCOMPtr<nsISupports> isupports = dont_AddRef(arrayOfNodes->ElementAt(i));
|
||||
@@ -3029,7 +3029,7 @@ nsHTMLEditRules::WillIndent(nsISelection *aSelection, PRBool *aCancel, PRBool *
|
||||
{
|
||||
PRBool useCSS;
|
||||
nsresult res;
|
||||
mHTMLEditor->IsCSSEnabled(&useCSS);
|
||||
mHTMLEditor->GetIsCSSEnabled(&useCSS);
|
||||
|
||||
if (useCSS) {
|
||||
res = WillCSSIndent(aSelection, aCancel, aHandled);
|
||||
@@ -3408,7 +3408,7 @@ nsHTMLEditRules::WillOutdent(nsISelection *aSelection, PRBool *aCancel, PRBool *
|
||||
nsresult res = NS_OK;
|
||||
nsCOMPtr<nsIDOMNode> rememberedLeftBQ, rememberedRightBQ;
|
||||
PRBool useCSS;
|
||||
mHTMLEditor->IsCSSEnabled(&useCSS);
|
||||
mHTMLEditor->GetIsCSSEnabled(&useCSS);
|
||||
|
||||
res = NormalizeSelection(aSelection);
|
||||
if (NS_FAILED(res)) return res;
|
||||
@@ -4008,7 +4008,7 @@ nsHTMLEditRules::WillAlign(nsISelection *aSelection,
|
||||
nsCOMPtr<nsIDOMNode> curParent;
|
||||
nsCOMPtr<nsIDOMNode> curDiv;
|
||||
PRBool useCSS;
|
||||
mHTMLEditor->IsCSSEnabled(&useCSS);
|
||||
mHTMLEditor->GetIsCSSEnabled(&useCSS);
|
||||
for (i=0; i<(PRInt32)listCount; i++)
|
||||
{
|
||||
// here's where we actually figure out what to do
|
||||
@@ -4145,7 +4145,7 @@ nsHTMLEditRules::AlignBlockContents(nsIDOMNode *aNode, const nsAReadableString *
|
||||
nsCOMPtr <nsIDOMNode> firstChild, lastChild, divNode;
|
||||
|
||||
PRBool useCSS;
|
||||
mHTMLEditor->IsCSSEnabled(&useCSS);
|
||||
mHTMLEditor->GetIsCSSEnabled(&useCSS);
|
||||
|
||||
res = mHTMLEditor->GetFirstEditableChild(aNode, address_of(firstChild));
|
||||
if (NS_FAILED(res)) return res;
|
||||
@@ -5012,7 +5012,7 @@ nsHTMLEditRules::GetNodesForOperation(nsISupportsArray *inArrayOfRanges,
|
||||
nsCOMPtr<nsISupports> isupports;
|
||||
|
||||
PRBool useCSS;
|
||||
mHTMLEditor->IsCSSEnabled(&useCSS);
|
||||
mHTMLEditor->GetIsCSSEnabled(&useCSS);
|
||||
|
||||
// bust up any inlines that cross our range endpoints,
|
||||
// but only if we are allowed to touch content.
|
||||
@@ -7713,7 +7713,7 @@ nsHTMLEditRules::RemoveAlignment(nsIDOMNode * aNode, nsAReadableString & aAlignT
|
||||
aNode->GetFirstChild(getter_AddRefs(child));
|
||||
}
|
||||
PRBool useCSS;
|
||||
mHTMLEditor->IsCSSEnabled(&useCSS);
|
||||
mHTMLEditor->GetIsCSSEnabled(&useCSS);
|
||||
|
||||
while (child)
|
||||
{
|
||||
@@ -7904,7 +7904,7 @@ nsHTMLEditRules::AlignBlock(nsIDOMElement * aElement, const nsAReadableString *
|
||||
if (NS_FAILED(res)) return res;
|
||||
NS_NAMED_LITERAL_STRING(attr, "align");
|
||||
PRBool useCSS;
|
||||
mHTMLEditor->IsCSSEnabled(&useCSS);
|
||||
mHTMLEditor->GetIsCSSEnabled(&useCSS);
|
||||
if (useCSS) {
|
||||
// let's use CSS alignment; we use margin-left and margin-right for tables
|
||||
// and text-align for other block-level elements
|
||||
|
||||
@@ -2123,7 +2123,7 @@ nsHTMLEditor::GetBackgroundColorState(PRBool *aMixed, nsAWritableString &aOutCol
|
||||
{
|
||||
nsresult res;
|
||||
PRBool useCSS;
|
||||
IsCSSEnabled(&useCSS);
|
||||
GetIsCSSEnabled(&useCSS);
|
||||
if (useCSS) {
|
||||
// if we are in CSS mode, we have to check if the containing block defines
|
||||
// a background color
|
||||
@@ -2141,7 +2141,7 @@ nsHTMLEditor::GetHighlightColorState(PRBool *aMixed, nsAWritableString &aOutColo
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
PRBool useCSS;
|
||||
IsCSSEnabled(&useCSS);
|
||||
GetIsCSSEnabled(&useCSS);
|
||||
*aMixed = PR_FALSE;
|
||||
aOutColor.Assign(NS_LITERAL_STRING("transparent"));
|
||||
if (useCSS) {
|
||||
@@ -2284,7 +2284,9 @@ nsHTMLEditor::GetHTMLBackgroundColorState(PRBool *aMixed, nsAWritableString &aOu
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
PRInt32 selectedCount;
|
||||
nsAutoString tagName;
|
||||
nsresult res = GetSelectedOrParentTableElement(*getter_AddRefs(element), tagName, selectedCount);
|
||||
nsresult res = GetSelectedOrParentTableElement(getter_AddRefs(element),
|
||||
tagName,
|
||||
&selectedCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
NS_NAMED_LITERAL_STRING(styleName, "bgcolor");
|
||||
@@ -3209,7 +3211,8 @@ nsHTMLEditor::SetHTMLBackgroundColor(const nsAReadableString& aColor)
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
PRInt32 selectedCount;
|
||||
nsAutoString tagName;
|
||||
nsresult res = GetSelectedOrParentTableElement(*getter_AddRefs(element), tagName, selectedCount);
|
||||
nsresult res = GetSelectedOrParentTableElement(getter_AddRefs(element),
|
||||
tagName, &selectedCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
PRBool setColor = (aColor.Length() > 0);
|
||||
@@ -5010,7 +5013,7 @@ nsHTMLEditor::SetAttributeOrEquivalent(nsIDOMElement * aElement,
|
||||
{
|
||||
PRBool useCSS;
|
||||
nsresult res = NS_OK;
|
||||
IsCSSEnabled(&useCSS);
|
||||
GetIsCSSEnabled(&useCSS);
|
||||
if (useCSS && mHTMLCSSUtils) {
|
||||
PRInt32 count;
|
||||
res = mHTMLCSSUtils->SetCSSEquivalentToHTMLStyle(aElement, nsnull, &aAttribute, &aValue, &count);
|
||||
@@ -5045,7 +5048,7 @@ nsHTMLEditor::SetAttributeOrEquivalent(nsIDOMElement * aElement,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::SetCSSEnabled(PRBool aIsCSSPrefChecked)
|
||||
nsHTMLEditor::SetIsCSSEnabled(PRBool aIsCSSPrefChecked)
|
||||
{
|
||||
nsresult err = NS_ERROR_NOT_INITIALIZED;
|
||||
if (mHTMLCSSUtils)
|
||||
@@ -5288,7 +5291,7 @@ nsHTMLEditor::SetBackgroundColor(const nsAReadableString& aColor)
|
||||
{
|
||||
nsresult res;
|
||||
PRBool useCSS;
|
||||
IsCSSEnabled(&useCSS);
|
||||
GetIsCSSEnabled(&useCSS);
|
||||
if (useCSS) {
|
||||
// if we are in CSS mode, we have to apply the background color to the
|
||||
// containing block (or the body if we have no block-level element in
|
||||
@@ -5315,7 +5318,7 @@ nsHTMLEditor::NodesSameType(nsIDOMNode *aNode1, nsIDOMNode *aNode2)
|
||||
}
|
||||
|
||||
PRBool useCSS;
|
||||
IsCSSEnabled(&useCSS);
|
||||
GetIsCSSEnabled(&useCSS);
|
||||
|
||||
nsCOMPtr<nsIAtom> atom1 = GetTag(aNode1);
|
||||
nsCOMPtr<nsIAtom> atom2 = GetTag(aNode2);
|
||||
@@ -5334,7 +5337,8 @@ nsHTMLEditor::NodesSameType(nsIDOMNode *aNode1, nsIDOMNode *aNode2)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::ParseStyleAttrIntoCSSRule(const PRUnichar *aString, nsIDOMCSSStyleRule **_retval)
|
||||
nsHTMLEditor::ParseStyleAttrIntoCSSRule(const nsAString& aString,
|
||||
nsIDOMCSSStyleRule **_retval)
|
||||
{
|
||||
nsCOMPtr<nsIDOMDocument> domdoc;
|
||||
nsEditor::GetDocument(getter_AddRefs(domdoc));
|
||||
@@ -5355,8 +5359,8 @@ nsHTMLEditor::ParseStyleAttrIntoCSSRule(const PRUnichar *aString, nsIDOMCSSStyle
|
||||
NS_ASSERTION(css, "can't get a css parser");
|
||||
if (!css) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsAutoString value(aString);
|
||||
css->ParseStyleAttribute(value, docURL, getter_AddRefs(mRule));
|
||||
//nsAutoString value(aString);
|
||||
css->ParseStyleAttribute(aString, docURL, getter_AddRefs(mRule));
|
||||
nsCOMPtr<nsIDOMCSSStyleRule> styleRule = do_QueryInterface(mRule);
|
||||
if (styleRule) {
|
||||
*_retval = styleRule;
|
||||
|
||||
@@ -122,7 +122,8 @@ public:
|
||||
NS_IMETHOD CopyLastEditableChildStyles(nsIDOMNode *aPreviousBlock, nsIDOMNode *aNewBlock,
|
||||
nsIDOMNode **aOutBrNode);
|
||||
|
||||
NS_IMETHOD ParseStyleAttrIntoCSSRule(const PRUnichar *aString, nsIDOMCSSStyleRule **_retval);
|
||||
NS_IMETHOD ParseStyleAttrIntoCSSRule(const nsAString& aString,
|
||||
nsIDOMCSSStyleRule **_retval);
|
||||
|
||||
NS_IMETHOD SetCSSInlineProperty(nsIAtom *aProperty,
|
||||
const nsAReadableString & aAttribute,
|
||||
@@ -194,8 +195,8 @@ public:
|
||||
|
||||
NS_IMETHOD GetLinkedObjects(nsISupportsArray** aNodeList);
|
||||
|
||||
NS_IMETHOD SetCSSEnabled(PRBool aIsCSSPrefChecked);
|
||||
NS_IMETHOD IsCSSEnabled(PRBool * aIsCSSEnabled);
|
||||
NS_IMETHOD SetIsCSSEnabled(PRBool aIsCSSPrefChecked);
|
||||
NS_IMETHOD GetIsCSSEnabled(PRBool *aIsCSSEnabled);
|
||||
|
||||
/* ------------ nsIEditorIMESupport overrides -------------- */
|
||||
|
||||
@@ -247,14 +248,18 @@ public:
|
||||
NS_IMETHOD JoinTableCells(PRBool aMergeNonContiguousContents);
|
||||
NS_IMETHOD SplitTableCell();
|
||||
NS_IMETHOD NormalizeTable(nsIDOMElement *aTable);
|
||||
NS_IMETHOD GetCellIndexes(nsIDOMElement *aCell, PRInt32& aRowIndex, PRInt32& aColIndex);
|
||||
NS_IMETHOD GetTableSize(nsIDOMElement *aTable, PRInt32& aRowCount, PRInt32& aColCount);
|
||||
NS_IMETHOD GetCellIndexes(nsIDOMElement *aCell,
|
||||
PRInt32* aRowIndex, PRInt32* aColIndex);
|
||||
NS_IMETHOD GetTableSize(nsIDOMElement *aTable,
|
||||
PRInt32* aRowCount, PRInt32* aColCount);
|
||||
NS_IMETHOD GetCellAt(nsIDOMElement* aTable, PRInt32 aRowIndex, PRInt32 aColIndex, nsIDOMElement **aCell);
|
||||
NS_IMETHOD GetCellDataAt(nsIDOMElement* aTable, PRInt32 aRowIndex, PRInt32 aColIndex, nsIDOMElement **aCell,
|
||||
PRInt32& aStartRowIndex, PRInt32& aStartColIndex,
|
||||
PRInt32& aRowSpan, PRInt32& aColSpan,
|
||||
PRInt32& aActualRowSpan, PRInt32& aActualColSpan,
|
||||
PRBool& aIsSelected);
|
||||
NS_IMETHOD GetCellDataAt(nsIDOMElement* aTable,
|
||||
PRInt32 aRowIndex, PRInt32 aColIndex,
|
||||
nsIDOMElement **aCell,
|
||||
PRInt32* aStartRowIndex, PRInt32* aStartColIndex,
|
||||
PRInt32* aRowSpan, PRInt32* aColSpan,
|
||||
PRInt32* aActualRowSpan, PRInt32* aActualColSpan,
|
||||
PRBool* aIsSelected);
|
||||
NS_IMETHOD GetFirstRow(nsIDOMElement* aTableElement, nsIDOMNode** aRowNode);
|
||||
NS_IMETHOD GetNextRow(nsIDOMNode* aCurrentRowNode, nsIDOMNode** aRowNode);
|
||||
NS_IMETHOD GetFirstCellInRow(nsIDOMNode* aRowNode, nsIDOMNode** aCellNode);
|
||||
@@ -263,8 +268,10 @@ public:
|
||||
|
||||
NS_IMETHOD SetSelectionAfterTableEdit(nsIDOMElement* aTable, PRInt32 aRow, PRInt32 aCol,
|
||||
PRInt32 aDirection, PRBool aSelected);
|
||||
NS_IMETHOD GetSelectedOrParentTableElement(nsIDOMElement* &aTableElement, nsString& aTagName, PRInt32 &aSelectedCount);
|
||||
NS_IMETHOD GetSelectedCellsType(nsIDOMElement *aElement, PRUint32 &aSelectionType);
|
||||
NS_IMETHOD GetSelectedOrParentTableElement(nsIDOMElement** aTableElement,
|
||||
nsAString& aTagName,
|
||||
PRInt32 *aSelectedCount);
|
||||
NS_IMETHOD GetSelectedCellsType(nsIDOMElement *aElement, PRUint32 *aSelectionType);
|
||||
|
||||
nsresult GetCellFromRange(nsIDOMRange *aRange, nsIDOMElement **aCell);
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ NS_IMETHODIMP nsHTMLEditor::SetCSSInlineProperty(nsIAtom *aProperty,
|
||||
nsresult res = NS_OK;
|
||||
PRBool useCSS;
|
||||
|
||||
IsCSSEnabled(&useCSS);
|
||||
GetIsCSSEnabled(&useCSS);
|
||||
if (useCSS) {
|
||||
res = SetInlineProperty(aProperty, aAttribute, aValue);
|
||||
}
|
||||
@@ -397,7 +397,7 @@ nsHTMLEditor::SetInlinePropertyOnNode( nsIDOMNode *aNode,
|
||||
ToLowerCase(tag);
|
||||
|
||||
PRBool useCSS;
|
||||
IsCSSEnabled(&useCSS);
|
||||
GetIsCSSEnabled(&useCSS);
|
||||
|
||||
if (useCSS) {
|
||||
// we are in CSS mode
|
||||
@@ -580,7 +580,7 @@ nsresult nsHTMLEditor::SplitStyleAbovePoint(nsCOMPtr<nsIDOMNode> *aNode,
|
||||
PRInt32 offset;
|
||||
|
||||
PRBool useCSS;
|
||||
IsCSSEnabled(&useCSS);
|
||||
GetIsCSSEnabled(&useCSS);
|
||||
|
||||
PRBool isSet;
|
||||
while (tmp && !IsBlockNode(tmp))
|
||||
@@ -677,7 +677,7 @@ nsresult nsHTMLEditor::RemoveStyleInside(nsIDOMNode *aNode,
|
||||
}
|
||||
else {
|
||||
PRBool useCSS;
|
||||
IsCSSEnabled(&useCSS);
|
||||
GetIsCSSEnabled(&useCSS);
|
||||
|
||||
if (!aChildrenOnly
|
||||
&& useCSS && mHTMLCSSUtils->IsCSSEditableProperty(aNode, aProperty, aAttribute)) {
|
||||
@@ -908,7 +908,7 @@ nsHTMLEditor::GetInlinePropertyBase(nsIAtom *aProperty,
|
||||
PRBool first=PR_TRUE;
|
||||
|
||||
PRBool useCSS;
|
||||
IsCSSEnabled(&useCSS);
|
||||
GetIsCSSEnabled(&useCSS);
|
||||
|
||||
nsCOMPtr<nsISelection>selection;
|
||||
result = GetSelection(getter_AddRefs(selection));
|
||||
@@ -1154,7 +1154,7 @@ nsresult nsHTMLEditor::RemoveInlinePropertyImpl(nsIAtom *aProperty, const nsARea
|
||||
selection->GetIsCollapsed(&isCollapsed);
|
||||
|
||||
PRBool useCSS;
|
||||
IsCSSEnabled(&useCSS);
|
||||
GetIsCSSEnabled(&useCSS);
|
||||
|
||||
if (isCollapsed)
|
||||
{
|
||||
@@ -1799,7 +1799,7 @@ nsHTMLEditor::GetFontColorState(PRBool *aMixed, nsAWritableString &aOutColor)
|
||||
// can handle CSS styles (for instance, Composer can, Messenger can't) and if
|
||||
// the CSS preference is checked
|
||||
nsresult
|
||||
nsHTMLEditor::IsCSSEnabled(PRBool *aIsCSSEnabled)
|
||||
nsHTMLEditor::GetIsCSSEnabled(PRBool *aIsCSSEnabled)
|
||||
{
|
||||
*aIsCSSEnabled = PR_FALSE;
|
||||
if (mCSSAware) {
|
||||
|
||||
@@ -226,9 +226,10 @@ nsHTMLEditor::InsertTableCell(PRInt32 aNumber, PRBool aAfter)
|
||||
// Get more data for current cell in row we are inserting at (we need COLSPAN)
|
||||
PRInt32 curStartRowIndex, curStartColIndex, rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
PRBool isSelected;
|
||||
res = GetCellDataAt(table, startRowIndex, startColIndex, getter_AddRefs(curCell),
|
||||
curStartRowIndex, curStartColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
res = GetCellDataAt(table, startRowIndex, startColIndex,
|
||||
getter_AddRefs(curCell),
|
||||
&curStartRowIndex, &curStartColIndex, &rowSpan, &colSpan,
|
||||
&actualRowSpan, &actualColSpan, &isSelected);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!curCell) return NS_ERROR_FAILURE;
|
||||
PRInt32 newCellIndex = aAfter ? (startColIndex+colSpan) : startColIndex;
|
||||
@@ -517,9 +518,11 @@ nsHTMLEditor::InsertTableColumn(PRInt32 aNumber, PRBool aAfter)
|
||||
// Get more data for current cell (we need ROWSPAN)
|
||||
PRInt32 curStartRowIndex, curStartColIndex, rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
PRBool isSelected;
|
||||
res = GetCellDataAt(table, startRowIndex, startColIndex, getter_AddRefs(curCell),
|
||||
curStartRowIndex, curStartColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
res = GetCellDataAt(table, startRowIndex, startColIndex,
|
||||
getter_AddRefs(curCell),
|
||||
&curStartRowIndex, &curStartColIndex,
|
||||
&rowSpan, &colSpan,
|
||||
&actualRowSpan, &actualColSpan, &isSelected);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!curCell) return NS_ERROR_FAILURE;
|
||||
|
||||
@@ -540,7 +543,7 @@ nsHTMLEditor::InsertTableColumn(PRInt32 aNumber, PRBool aAfter)
|
||||
}
|
||||
|
||||
PRInt32 rowCount, colCount, rowIndex;
|
||||
res = GetTableSize(table, rowCount, colCount);
|
||||
res = GetTableSize(table, &rowCount, &colCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
//We reset caret in destructor...
|
||||
@@ -565,9 +568,11 @@ nsHTMLEditor::InsertTableColumn(PRInt32 aNumber, PRBool aAfter)
|
||||
if (startColIndex < colCount)
|
||||
{
|
||||
// We are inserting before an existing column
|
||||
res = GetCellDataAt(table, rowIndex, startColIndex, getter_AddRefs(curCell),
|
||||
curStartRowIndex, curStartColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
res = GetCellDataAt(table, rowIndex, startColIndex,
|
||||
getter_AddRefs(curCell),
|
||||
&curStartRowIndex, &curStartColIndex,
|
||||
&rowSpan, &colSpan,
|
||||
&actualRowSpan, &actualColSpan, &isSelected);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// Don't fail entire process if we fail to find a cell
|
||||
@@ -649,14 +654,16 @@ nsHTMLEditor::InsertTableRow(PRInt32 aNumber, PRBool aAfter)
|
||||
// Get more data for current cell in row we are inserting at (we need COLSPAN)
|
||||
PRInt32 curStartRowIndex, curStartColIndex, rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
PRBool isSelected;
|
||||
res = GetCellDataAt(table, startRowIndex, startColIndex, getter_AddRefs(curCell),
|
||||
curStartRowIndex, curStartColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
res = GetCellDataAt(table, startRowIndex, startColIndex,
|
||||
getter_AddRefs(curCell),
|
||||
&curStartRowIndex, &curStartColIndex,
|
||||
&rowSpan, &colSpan,
|
||||
&actualRowSpan, &actualColSpan, &isSelected);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!curCell) return NS_ERROR_FAILURE;
|
||||
|
||||
PRInt32 rowCount, colCount;
|
||||
res = GetTableSize(table, rowCount, colCount);
|
||||
res = GetTableSize(table, &rowCount, &colCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
@@ -690,9 +697,12 @@ nsHTMLEditor::InsertTableRow(PRInt32 aNumber, PRBool aAfter)
|
||||
PRInt32 colIndex = 0;
|
||||
// This returns NS_TABLELAYOUT_CELL_NOT_FOUND when we run past end of row,
|
||||
// which passes the NS_SUCCEEDED macro
|
||||
while ( NS_OK == GetCellDataAt(table, startRowIndex, colIndex, getter_AddRefs(curCell),
|
||||
curStartRowIndex, curStartColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected) )
|
||||
while ( NS_OK == GetCellDataAt(table, startRowIndex, colIndex,
|
||||
getter_AddRefs(curCell),
|
||||
&curStartRowIndex, &curStartColIndex,
|
||||
&rowSpan, &colSpan,
|
||||
&actualRowSpan, &actualColSpan,
|
||||
&isSelected) )
|
||||
{
|
||||
if (curCell)
|
||||
{
|
||||
@@ -729,9 +739,12 @@ nsHTMLEditor::InsertTableRow(PRInt32 aNumber, PRBool aAfter)
|
||||
// ...but we must compensate for all cells with rowSpan = 0 in the last row
|
||||
PRInt32 lastRow = rowCount-1;
|
||||
PRInt32 tempColIndex = 0;
|
||||
while ( NS_OK == GetCellDataAt(table, lastRow, tempColIndex, getter_AddRefs(curCell),
|
||||
curStartRowIndex, curStartColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected) )
|
||||
while ( NS_OK == GetCellDataAt(table, lastRow, tempColIndex,
|
||||
getter_AddRefs(curCell),
|
||||
&curStartRowIndex, &curStartColIndex,
|
||||
&rowSpan, &colSpan,
|
||||
&actualRowSpan, &actualColSpan,
|
||||
&isSelected) )
|
||||
{
|
||||
if (rowSpan == 0)
|
||||
cellsInRow -= actualColSpan;
|
||||
@@ -884,11 +897,11 @@ nsHTMLEditor::DeleteTableCell(PRInt32 aNumber)
|
||||
cell = firstCell;
|
||||
|
||||
PRInt32 rowCount, colCount;
|
||||
res = GetTableSize(table, rowCount, colCount);
|
||||
res = GetTableSize(table, &rowCount, &colCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// Get indexes -- may be different than original cell
|
||||
res = GetCellIndexes(cell, startRowIndex, startColIndex);
|
||||
res = GetCellIndexes(cell, &startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// The setCaret object will call SetSelectionAfterTableEdit in it's destructor
|
||||
@@ -919,7 +932,7 @@ nsHTMLEditor::DeleteTableCell(PRInt32 aNumber)
|
||||
res = GetNextSelectedCell(getter_AddRefs(cell), nsnull);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!cell) break;
|
||||
res = GetCellIndexes(cell, nextRow, startColIndex);
|
||||
res = GetCellIndexes(cell, &nextRow, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
// Delete entire row
|
||||
@@ -954,7 +967,7 @@ nsHTMLEditor::DeleteTableCell(PRInt32 aNumber)
|
||||
res = GetNextSelectedCell(getter_AddRefs(cell), nsnull);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!cell) break;
|
||||
res = GetCellIndexes(cell, startRowIndex, nextCol);
|
||||
res = GetCellIndexes(cell, &startRowIndex, &nextCol);
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
// Delete entire Col
|
||||
@@ -984,7 +997,7 @@ nsHTMLEditor::DeleteTableCell(PRInt32 aNumber)
|
||||
cell = nextCell;
|
||||
if (cell)
|
||||
{
|
||||
res = GetCellIndexes(cell, startRowIndex, startColIndex);
|
||||
res = GetCellIndexes(cell, &startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
}
|
||||
@@ -1013,7 +1026,7 @@ nsHTMLEditor::DeleteTableCell(PRInt32 aNumber)
|
||||
// but first check if its the only row left
|
||||
// so we can delete the entire table
|
||||
PRInt32 rowCount, colCount;
|
||||
res = GetTableSize(table, rowCount, colCount);
|
||||
res = GetTableSize(table, &rowCount, &colCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
if (rowCount == 1)
|
||||
@@ -1074,7 +1087,7 @@ nsHTMLEditor::DeleteTableCellContents()
|
||||
if (firstCell)
|
||||
{
|
||||
cell = firstCell;
|
||||
res = GetCellIndexes(cell, startRowIndex, startColIndex);
|
||||
res = GetCellIndexes(cell, &startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
|
||||
@@ -1133,7 +1146,7 @@ nsHTMLEditor::DeleteTableColumn(PRInt32 aNumber)
|
||||
// Don't fail if no cell found
|
||||
if (!table || !cell) return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
|
||||
res = GetTableSize(table, rowCount, colCount);
|
||||
res = GetTableSize(table, &rowCount, &colCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// Shortcut the case of deleting all columns in table
|
||||
@@ -1160,7 +1173,7 @@ nsHTMLEditor::DeleteTableColumn(PRInt32 aNumber)
|
||||
if (firstCell && rangeCount > 1)
|
||||
{
|
||||
// Fetch indexes again - may be different for selected cells
|
||||
res = GetCellIndexes(firstCell, startRowIndex, startColIndex);
|
||||
res = GetCellIndexes(firstCell, &startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
//We control selection resetting after the insert...
|
||||
@@ -1175,7 +1188,7 @@ nsHTMLEditor::DeleteTableColumn(PRInt32 aNumber)
|
||||
{
|
||||
if (cell != firstCell)
|
||||
{
|
||||
res = GetCellIndexes(cell, startRowIndex, startColIndex);
|
||||
res = GetCellIndexes(cell, &startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
// Find the next cell in a different column
|
||||
@@ -1186,7 +1199,7 @@ nsHTMLEditor::DeleteTableColumn(PRInt32 aNumber)
|
||||
res = GetNextSelectedCell(getter_AddRefs(cell), getter_AddRefs(range));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!cell) break;
|
||||
res = GetCellIndexes(cell, startRowIndex, nextCol);
|
||||
res = GetCellIndexes(cell, &startRowIndex, &nextCol);
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
res = DeleteColumn(table, startColIndex);
|
||||
@@ -1215,8 +1228,8 @@ nsHTMLEditor::DeleteColumn(nsIDOMElement *aTable, PRInt32 aColIndex)
|
||||
|
||||
do {
|
||||
res = GetCellDataAt(aTable, rowIndex, aColIndex, getter_AddRefs(cell),
|
||||
startRowIndex, startColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
&startRowIndex, &startColIndex, &rowSpan, &colSpan,
|
||||
&actualRowSpan, &actualColSpan, &isSelected);
|
||||
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
@@ -1258,7 +1271,7 @@ nsHTMLEditor::DeleteColumn(nsIDOMElement *aTable, PRInt32 aColIndex)
|
||||
// so we can delete the entire table
|
||||
// (This should never happen but it's the safe thing to do)
|
||||
PRInt32 rowCount, colCount;
|
||||
res = GetTableSize(aTable, rowCount, colCount);
|
||||
res = GetTableSize(aTable, &rowCount, &colCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
if (rowCount == 1)
|
||||
@@ -1312,7 +1325,7 @@ nsHTMLEditor::DeleteTableRow(PRInt32 aNumber)
|
||||
// Don't fail if no cell found
|
||||
if (!cell) return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
|
||||
res = GetTableSize(table, rowCount, colCount);
|
||||
res = GetTableSize(table, &rowCount, &colCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// Shortcut the case of deleting all rows in table
|
||||
@@ -1335,7 +1348,7 @@ nsHTMLEditor::DeleteTableRow(PRInt32 aNumber)
|
||||
if (firstCell && rangeCount > 1)
|
||||
{
|
||||
// Fetch indexes again - may be different for selected cells
|
||||
res = GetCellIndexes(firstCell, startRowIndex, startColIndex);
|
||||
res = GetCellIndexes(firstCell, &startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
|
||||
@@ -1353,7 +1366,7 @@ nsHTMLEditor::DeleteTableRow(PRInt32 aNumber)
|
||||
{
|
||||
if (cell != firstCell)
|
||||
{
|
||||
res = GetCellIndexes(cell, startRowIndex, startColIndex);
|
||||
res = GetCellIndexes(cell, &startRowIndex, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
// Find the next cell in a different row
|
||||
@@ -1364,7 +1377,7 @@ nsHTMLEditor::DeleteTableRow(PRInt32 aNumber)
|
||||
res = GetNextSelectedCell(getter_AddRefs(cell), getter_AddRefs(range));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!cell) break;
|
||||
res = GetCellIndexes(cell, nextRow, startColIndex);
|
||||
res = GetCellIndexes(cell, &nextRow, &startColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
// Delete entire row
|
||||
@@ -1420,8 +1433,8 @@ nsHTMLEditor::DeleteRow(nsIDOMElement *aTable, PRInt32 aRowIndex)
|
||||
// cells in the next row to be deleted
|
||||
do {
|
||||
res = GetCellDataAt(aTable, aRowIndex, colIndex, getter_AddRefs(cell),
|
||||
startRowIndex, startColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
&startRowIndex, &startColIndex, &rowSpan, &colSpan,
|
||||
&actualRowSpan, &actualColSpan, &isSelected);
|
||||
|
||||
// We don't fail if we don't find a cell, so this must be real bad
|
||||
if(NS_FAILED(res)) return res;
|
||||
@@ -1568,10 +1581,10 @@ nsHTMLEditor::SelectBlockOfCells(nsIDOMElement *aStartCell, nsIDOMElement *aEndC
|
||||
PRInt32 startRowIndex, startColIndex, endRowIndex, endColIndex;
|
||||
|
||||
// Get starting and ending cells' location in the cellmap
|
||||
res = GetCellIndexes(aStartCell, startRowIndex, startColIndex);
|
||||
res = GetCellIndexes(aStartCell, &startRowIndex, &startColIndex);
|
||||
if(NS_FAILED(res)) return res;
|
||||
|
||||
res = GetCellIndexes(aEndCell, endRowIndex, endColIndex);
|
||||
res = GetCellIndexes(aEndCell, &endRowIndex, &endColIndex);
|
||||
if(NS_FAILED(res)) return res;
|
||||
|
||||
// Suppress nsISelectionListener notification
|
||||
@@ -1594,7 +1607,7 @@ nsHTMLEditor::SelectBlockOfCells(nsIDOMElement *aStartCell, nsIDOMElement *aEndC
|
||||
|
||||
while (cell)
|
||||
{
|
||||
res = GetCellIndexes(cell, currentRowIndex, currentColIndex);
|
||||
res = GetCellIndexes(cell, ¤tRowIndex, ¤tColIndex);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
if (currentRowIndex < maxRow || currentRowIndex > maxRow ||
|
||||
@@ -1615,8 +1628,9 @@ nsHTMLEditor::SelectBlockOfCells(nsIDOMElement *aStartCell, nsIDOMElement *aEndC
|
||||
for(PRInt32 col = minColumn; col <= maxColumn; col += PR_MAX(actualColSpan, 1))
|
||||
{
|
||||
res = GetCellDataAt(table, row, col, getter_AddRefs(cell),
|
||||
currentRowIndex, currentColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
¤tRowIndex, ¤tColIndex,
|
||||
&rowSpan, &colSpan,
|
||||
&actualRowSpan, &actualColSpan, &isSelected);
|
||||
if (NS_FAILED(res)) break;
|
||||
// Skip cells that already selected or are spanned from previous locations
|
||||
if (!isSelected && cell && row == currentRowIndex && col == currentColIndex)
|
||||
@@ -1651,7 +1665,7 @@ nsHTMLEditor::SelectAllTableCells()
|
||||
if(!table) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
PRInt32 rowCount, colCount;
|
||||
res = GetTableSize(table, rowCount, colCount);
|
||||
res = GetTableSize(table, &rowCount, &colCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
nsCOMPtr<nsISelection> selection;
|
||||
@@ -1676,8 +1690,9 @@ nsHTMLEditor::SelectAllTableCells()
|
||||
for(PRInt32 col = 0; col < colCount; col += PR_MAX(actualColSpan, 1))
|
||||
{
|
||||
res = GetCellDataAt(table, row, col, getter_AddRefs(cell),
|
||||
currentRowIndex, currentColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
¤tRowIndex, ¤tColIndex,
|
||||
&rowSpan, &colSpan,
|
||||
&actualRowSpan, &actualColSpan, &isSelected);
|
||||
if (NS_FAILED(res)) break;
|
||||
// Skip cells that are spanned from previous rows or columns
|
||||
if (cell && row == currentRowIndex && col == currentColIndex)
|
||||
@@ -1726,7 +1741,7 @@ nsHTMLEditor::SelectTableRow()
|
||||
if (!table) return NS_ERROR_FAILURE;
|
||||
|
||||
PRInt32 rowCount, colCount;
|
||||
res = GetTableSize(table, rowCount, colCount);
|
||||
res = GetTableSize(table, &rowCount, &colCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
//Note: At this point, we could get first and last cells in row,
|
||||
@@ -1748,8 +1763,8 @@ nsHTMLEditor::SelectTableRow()
|
||||
for(PRInt32 col = 0; col < colCount; col += PR_MAX(actualColSpan, 1))
|
||||
{
|
||||
res = GetCellDataAt(table, startRowIndex, col, getter_AddRefs(cell),
|
||||
currentRowIndex, currentColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
¤tRowIndex, ¤tColIndex, &rowSpan, &colSpan,
|
||||
&actualRowSpan, &actualColSpan, &isSelected);
|
||||
if (NS_FAILED(res)) break;
|
||||
// Skip cells that are spanned from previous rows or columns
|
||||
if (cell && currentRowIndex == startRowIndex && currentColIndex == col)
|
||||
@@ -1797,7 +1812,7 @@ nsHTMLEditor::SelectTableColumn()
|
||||
if (!table) return NS_ERROR_FAILURE;
|
||||
|
||||
PRInt32 rowCount, colCount;
|
||||
res = GetTableSize(table, rowCount, colCount);
|
||||
res = GetTableSize(table, &rowCount, &colCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// Suppress nsISelectionListener notification
|
||||
@@ -1815,8 +1830,8 @@ nsHTMLEditor::SelectTableColumn()
|
||||
for(PRInt32 row = 0; row < rowCount; row += PR_MAX(actualRowSpan, 1))
|
||||
{
|
||||
res = GetCellDataAt(table, row, startColIndex, getter_AddRefs(cell),
|
||||
currentRowIndex, currentColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
¤tRowIndex, ¤tColIndex, &rowSpan, &colSpan,
|
||||
&actualRowSpan, &actualColSpan, &isSelected);
|
||||
if (NS_FAILED(res)) break;
|
||||
// Skip cells that are spanned from previous rows or columns
|
||||
if (cell && currentRowIndex == row && currentColIndex == startColIndex)
|
||||
@@ -1927,8 +1942,9 @@ nsHTMLEditor::SplitCellIntoColumns(nsIDOMElement *aTable, PRInt32 aRowIndex, PRI
|
||||
PRInt32 startRowIndex, startColIndex, rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
PRBool isSelected;
|
||||
nsresult res = GetCellDataAt(aTable, aRowIndex, aColIndex, getter_AddRefs(cell),
|
||||
startRowIndex, startColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
&startRowIndex, &startColIndex,
|
||||
&rowSpan, &colSpan,
|
||||
&actualRowSpan, &actualColSpan, &isSelected);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!cell) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
@@ -1969,8 +1985,9 @@ nsHTMLEditor::SplitCellIntoRows(nsIDOMElement *aTable, PRInt32 aRowIndex, PRInt3
|
||||
PRInt32 startRowIndex, startColIndex, rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
PRBool isSelected;
|
||||
nsresult res = GetCellDataAt(aTable, aRowIndex, aColIndex, getter_AddRefs(cell),
|
||||
startRowIndex, startColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
&startRowIndex, &startColIndex,
|
||||
&rowSpan, &colSpan,
|
||||
&actualRowSpan, &actualColSpan, &isSelected);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!cell) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
@@ -1979,7 +1996,7 @@ nsHTMLEditor::SplitCellIntoRows(nsIDOMElement *aTable, PRInt32 aRowIndex, PRInt3
|
||||
return NS_OK;
|
||||
|
||||
PRInt32 rowCount, colCount;
|
||||
res = GetTableSize(aTable, rowCount, colCount);
|
||||
res = GetTableSize(aTable, &rowCount, &colCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> cell2;
|
||||
@@ -1997,8 +2014,8 @@ nsHTMLEditor::SplitCellIntoRows(nsIDOMElement *aTable, PRInt32 aRowIndex, PRInt3
|
||||
// Search for a cell to insert before
|
||||
res = GetCellDataAt(aTable, rowBelowIndex,
|
||||
colIndex, getter_AddRefs(cell2),
|
||||
startRowIndex2, startColIndex2, rowSpan2, colSpan2,
|
||||
actualRowSpan2, actualColSpan2, isSelected2);
|
||||
&startRowIndex2, &startColIndex2, &rowSpan2, &colSpan2,
|
||||
&actualRowSpan2, &actualColSpan2, &isSelected2);
|
||||
// If we fail here, it could be because row has bad rowspan values,
|
||||
// such as all cells having rowspan > 1 (Call FixRowSpan first!)
|
||||
if (NS_FAILED(res) || !cell) return NS_ERROR_FAILURE;
|
||||
@@ -2165,7 +2182,7 @@ nsHTMLEditor::JoinTableCells(PRBool aMergeNonContiguousContents)
|
||||
// and just merge contents if not contiguous
|
||||
|
||||
PRInt32 rowCount, colCount;
|
||||
res = GetTableSize(table, rowCount, colCount);
|
||||
res = GetTableSize(table, &rowCount, &colCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// Get spans for cell we will merge into
|
||||
@@ -2201,8 +2218,9 @@ nsHTMLEditor::JoinTableCells(PRBool aMergeNonContiguousContents)
|
||||
for (colIndex = firstColIndex; colIndex < colCount; colIndex += PR_MAX(actualColSpan2, 1))
|
||||
{
|
||||
res = GetCellDataAt(table, rowIndex, colIndex, getter_AddRefs(cell2),
|
||||
startRowIndex2, startColIndex2, rowSpan2, colSpan2,
|
||||
actualRowSpan2, actualColSpan2, isSelected2);
|
||||
&startRowIndex2, &startColIndex2,
|
||||
&rowSpan2, &colSpan2,
|
||||
&actualRowSpan2, &actualColSpan2, &isSelected2);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
if (isSelected2)
|
||||
@@ -2288,8 +2306,9 @@ nsHTMLEditor::JoinTableCells(PRBool aMergeNonContiguousContents)
|
||||
for (colIndex = 0; colIndex < colCount; colIndex += PR_MAX(actualColSpan2, 1))
|
||||
{
|
||||
res = GetCellDataAt(table, rowIndex, colIndex, getter_AddRefs(cell2),
|
||||
startRowIndex2, startColIndex2, rowSpan2, colSpan2,
|
||||
actualRowSpan2, actualColSpan2, isSelected2);
|
||||
&startRowIndex2, &startColIndex2,
|
||||
&rowSpan2, &colSpan2,
|
||||
&actualRowSpan2, &actualColSpan2, &isSelected2);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// If this is 0, we are past last cell in row, so exit the loop
|
||||
@@ -2398,15 +2417,15 @@ nsHTMLEditor::JoinTableCells(PRBool aMergeNonContiguousContents)
|
||||
{
|
||||
// Joining with cell to the right -- get rowspan and colspan data of target cell
|
||||
res = GetCellDataAt(table, startRowIndex, startColIndex, getter_AddRefs(targetCell),
|
||||
startRowIndex, startColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
&startRowIndex, &startColIndex, &rowSpan, &colSpan,
|
||||
&actualRowSpan, &actualColSpan, &isSelected);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!targetCell) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// Get data for cell to the right
|
||||
res = GetCellDataAt(table, startRowIndex, startColIndex+actualColSpan, getter_AddRefs(cell2),
|
||||
startRowIndex2, startColIndex2, rowSpan2, colSpan2,
|
||||
actualRowSpan2, actualColSpan2, isSelected2);
|
||||
&startRowIndex2, &startColIndex2, &rowSpan2, &colSpan2,
|
||||
&actualRowSpan2, &actualColSpan2, &isSelected2);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if(!cell2) return NS_OK; // Don't fail if there's no cell
|
||||
|
||||
@@ -2538,7 +2557,7 @@ nsHTMLEditor::FixBadRowSpan(nsIDOMElement *aTable, PRInt32 aRowIndex, PRInt32& a
|
||||
if (!aTable) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
PRInt32 rowCount, colCount;
|
||||
nsresult res = GetTableSize(aTable, rowCount, colCount);
|
||||
nsresult res = GetTableSize(aTable, &rowCount, &colCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
nsCOMPtr<nsIDOMElement>cell;
|
||||
@@ -2551,8 +2570,8 @@ nsHTMLEditor::FixBadRowSpan(nsIDOMElement *aTable, PRInt32 aRowIndex, PRInt32& a
|
||||
for( colIndex = 0; colIndex < colCount; colIndex += PR_MAX(actualColSpan, 1))
|
||||
{
|
||||
res = GetCellDataAt(aTable, aRowIndex, colIndex, getter_AddRefs(cell),
|
||||
startRowIndex, startColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
&startRowIndex, &startColIndex, &rowSpan, &colSpan,
|
||||
&actualRowSpan, &actualColSpan, &isSelected);
|
||||
// NOTE: This is a *real* failure.
|
||||
// GetCellDataAt passes if cell is missing from cellmap
|
||||
if(NS_FAILED(res)) return res;
|
||||
@@ -2573,8 +2592,8 @@ nsHTMLEditor::FixBadRowSpan(nsIDOMElement *aTable, PRInt32 aRowIndex, PRInt32& a
|
||||
for(colIndex = 0; colIndex < colCount; colIndex += PR_MAX(actualColSpan, 1))
|
||||
{
|
||||
res = GetCellDataAt(aTable, aRowIndex, colIndex, getter_AddRefs(cell),
|
||||
startRowIndex, startColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
&startRowIndex, &startColIndex, &rowSpan, &colSpan,
|
||||
&actualRowSpan, &actualColSpan, &isSelected);
|
||||
if(NS_FAILED(res)) return res;
|
||||
// Fixup rowspans only for cells starting in current row
|
||||
if(cell && rowSpan > 0 &&
|
||||
@@ -2587,7 +2606,7 @@ nsHTMLEditor::FixBadRowSpan(nsIDOMElement *aTable, PRInt32 aRowIndex, PRInt32& a
|
||||
NS_ASSERTION((actualColSpan > 0),"ActualColSpan = 0 in FixBadRowSpan");
|
||||
}
|
||||
}
|
||||
return GetTableSize(aTable, aNewRowCount, colCount);
|
||||
return GetTableSize(aTable, &aNewRowCount, &colCount);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@@ -2596,7 +2615,7 @@ nsHTMLEditor::FixBadColSpan(nsIDOMElement *aTable, PRInt32 aColIndex, PRInt32& a
|
||||
if (!aTable) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
PRInt32 rowCount, colCount;
|
||||
nsresult res = GetTableSize(aTable, rowCount, colCount);
|
||||
nsresult res = GetTableSize(aTable, &rowCount, &colCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
@@ -2609,8 +2628,8 @@ nsHTMLEditor::FixBadColSpan(nsIDOMElement *aTable, PRInt32 aColIndex, PRInt32& a
|
||||
for( rowIndex = 0; rowIndex < rowCount; rowIndex += PR_MAX(actualRowSpan, 1))
|
||||
{
|
||||
res = GetCellDataAt(aTable, rowIndex, aColIndex, getter_AddRefs(cell),
|
||||
startRowIndex, startColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
&startRowIndex, &startColIndex, &rowSpan, &colSpan,
|
||||
&actualRowSpan, &actualColSpan, &isSelected);
|
||||
// NOTE: This is a *real* failure.
|
||||
// GetCellDataAt passes if cell is missing from cellmap
|
||||
if(NS_FAILED(res)) return res;
|
||||
@@ -2631,8 +2650,8 @@ nsHTMLEditor::FixBadColSpan(nsIDOMElement *aTable, PRInt32 aColIndex, PRInt32& a
|
||||
for(rowIndex = 0; rowIndex < rowCount; rowIndex += PR_MAX(actualRowSpan, 1))
|
||||
{
|
||||
res = GetCellDataAt(aTable, rowIndex, aColIndex, getter_AddRefs(cell),
|
||||
startRowIndex, startColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
&startRowIndex, &startColIndex, &rowSpan, &colSpan,
|
||||
&actualRowSpan, &actualColSpan, &isSelected);
|
||||
if(NS_FAILED(res)) return res;
|
||||
// Fixup colspans only for cells starting in current column
|
||||
if(cell && colSpan > 0 &&
|
||||
@@ -2645,7 +2664,7 @@ nsHTMLEditor::FixBadColSpan(nsIDOMElement *aTable, PRInt32 aColIndex, PRInt32& a
|
||||
NS_ASSERTION((actualRowSpan > 0),"ActualRowSpan = 0 in FixBadColSpan");
|
||||
}
|
||||
}
|
||||
return GetTableSize(aTable, rowCount, aNewColCount);
|
||||
return GetTableSize(aTable, &rowCount, &aNewColCount);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@@ -2663,7 +2682,7 @@ nsHTMLEditor::NormalizeTable(nsIDOMElement *aTable)
|
||||
if (!table) return NS_OK;
|
||||
|
||||
PRInt32 rowCount, colCount, rowIndex, colIndex;
|
||||
res = GetTableSize(table, rowCount, colCount);
|
||||
res = GetTableSize(table, &rowCount, &colCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// Save current selection
|
||||
@@ -2698,8 +2717,8 @@ nsHTMLEditor::NormalizeTable(nsIDOMElement *aTable)
|
||||
for(colIndex = 0; colIndex < colCount; colIndex++)
|
||||
{
|
||||
res = GetCellDataAt(table, rowIndex, colIndex, getter_AddRefs(cell),
|
||||
startRowIndex, startColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
&startRowIndex, &startColIndex, &rowSpan, &colSpan,
|
||||
&actualRowSpan, &actualColSpan, &isSelected);
|
||||
// NOTE: This is a *real* failure.
|
||||
// GetCellDataAt passes if cell is missing from cellmap
|
||||
if(NS_FAILED(res)) return res;
|
||||
@@ -2738,11 +2757,14 @@ nsHTMLEditor::NormalizeTable(nsIDOMElement *aTable)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetCellIndexes(nsIDOMElement *aCell, PRInt32 &aRowIndex, PRInt32 &aColIndex)
|
||||
nsHTMLEditor::GetCellIndexes(nsIDOMElement *aCell,
|
||||
PRInt32 *aRowIndex, PRInt32 *aColIndex)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRowIndex);
|
||||
*aColIndex=0; // initialize out params
|
||||
NS_ENSURE_ARG_POINTER(aColIndex);
|
||||
*aRowIndex=0;
|
||||
nsresult res=NS_ERROR_NOT_INITIALIZED;
|
||||
aColIndex=0; // initialize out params
|
||||
aRowIndex=0;
|
||||
if (!aCell)
|
||||
{
|
||||
// Get the selected cell or the cell enclosing the selection anchor
|
||||
@@ -2763,7 +2785,7 @@ nsHTMLEditor::GetCellIndexes(nsIDOMElement *aCell, PRInt32 &aRowIndex, PRInt32 &
|
||||
res = layoutObject->QueryInterface(NS_GET_IID(nsITableCellLayout), (void**)(&cellLayoutObject));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!cellLayoutObject) return NS_ERROR_FAILURE;
|
||||
return cellLayoutObject->GetCellIndexes(aRowIndex, aColIndex);
|
||||
return cellLayoutObject->GetCellIndexes(*aRowIndex, *aColIndex);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@@ -2793,8 +2815,8 @@ PRBool nsHTMLEditor::GetNumberOfCellsInRow(nsIDOMElement* aTable, PRInt32 rowInd
|
||||
PRInt32 startRowIndex, startColIndex, rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
PRBool isSelected;
|
||||
res = GetCellDataAt(aTable, rowIndex, colIndex, getter_AddRefs(cell),
|
||||
startRowIndex, startColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
&startRowIndex, &startColIndex, &rowSpan, &colSpan,
|
||||
&actualRowSpan, &actualColSpan, &isSelected);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (cell)
|
||||
{
|
||||
@@ -2817,11 +2839,14 @@ PRBool nsHTMLEditor::GetNumberOfCellsInRow(nsIDOMElement* aTable, PRInt32 rowInd
|
||||
Use GetTableRowCount and GetTableColumnCount from JavaScript
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetTableSize(nsIDOMElement *aTable, PRInt32& aRowCount, PRInt32& aColCount)
|
||||
nsHTMLEditor::GetTableSize(nsIDOMElement *aTable,
|
||||
PRInt32* aRowCount, PRInt32* aColCount)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRowCount);
|
||||
NS_ENSURE_ARG_POINTER(aColCount);
|
||||
nsresult res = NS_ERROR_FAILURE;
|
||||
aRowCount = 0;
|
||||
aColCount = 0;
|
||||
*aRowCount = 0;
|
||||
*aColCount = 0;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
// Get the selected talbe or the table enclosing the selection anchor
|
||||
res = GetElementOrParentByTagName(NS_LITERAL_STRING("table"), aTable, getter_AddRefs(table));
|
||||
@@ -2835,24 +2860,32 @@ nsHTMLEditor::GetTableSize(nsIDOMElement *aTable, PRInt32& aRowCount, PRInt32& a
|
||||
if (!tableLayoutObject)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return tableLayoutObject->GetTableSize(aRowCount, aColCount);
|
||||
return tableLayoutObject->GetTableSize(*aRowCount, *aColCount);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetCellDataAt(nsIDOMElement* aTable, PRInt32 aRowIndex, PRInt32 aColIndex, nsIDOMElement **aCell,
|
||||
PRInt32& aStartRowIndex, PRInt32& aStartColIndex,
|
||||
PRInt32& aRowSpan, PRInt32& aColSpan,
|
||||
PRInt32& aActualRowSpan, PRInt32& aActualColSpan,
|
||||
PRBool& aIsSelected)
|
||||
nsHTMLEditor::GetCellDataAt(nsIDOMElement* aTable, PRInt32 aRowIndex,
|
||||
PRInt32 aColIndex, nsIDOMElement **aCell,
|
||||
PRInt32* aStartRowIndex, PRInt32* aStartColIndex,
|
||||
PRInt32* aRowSpan, PRInt32* aColSpan,
|
||||
PRInt32* aActualRowSpan, PRInt32* aActualColSpan,
|
||||
PRBool* aIsSelected)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aStartRowIndex);
|
||||
NS_ENSURE_ARG_POINTER(aStartColIndex);
|
||||
NS_ENSURE_ARG_POINTER(aRowSpan);
|
||||
NS_ENSURE_ARG_POINTER(aColSpan);
|
||||
NS_ENSURE_ARG_POINTER(aActualRowSpan);
|
||||
NS_ENSURE_ARG_POINTER(aActualColSpan);
|
||||
NS_ENSURE_ARG_POINTER(aIsSelected);
|
||||
nsresult res=NS_ERROR_FAILURE;
|
||||
aStartRowIndex = 0;
|
||||
aStartColIndex = 0;
|
||||
aRowSpan = 0;
|
||||
aColSpan = 0;
|
||||
aActualRowSpan = 0;
|
||||
aActualColSpan = 0;
|
||||
aIsSelected = PR_FALSE;
|
||||
*aStartRowIndex = 0;
|
||||
*aStartColIndex = 0;
|
||||
*aRowSpan = 0;
|
||||
*aColSpan = 0;
|
||||
*aActualRowSpan = 0;
|
||||
*aActualColSpan = 0;
|
||||
*aIsSelected = PR_FALSE;
|
||||
|
||||
if (!aCell) return NS_ERROR_NULL_POINTER;
|
||||
*aCell = nsnull;
|
||||
@@ -2878,11 +2911,12 @@ nsHTMLEditor::GetCellDataAt(nsIDOMElement* aTable, PRInt32 aRowIndex, PRInt32 aC
|
||||
// Note that this returns NS_TABLELAYOUT_CELL_NOT_FOUND when
|
||||
// the index(es) are out of bounds
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
res = tableLayoutObject->GetCellDataAt(aRowIndex, aColIndex, *getter_AddRefs(cell),
|
||||
aStartRowIndex, aStartColIndex,
|
||||
aRowSpan, aColSpan,
|
||||
aActualRowSpan, aActualColSpan,
|
||||
aIsSelected);
|
||||
res = tableLayoutObject->GetCellDataAt(aRowIndex, aColIndex,
|
||||
*getter_AddRefs(cell),
|
||||
*aStartRowIndex, *aStartColIndex,
|
||||
*aRowSpan, *aColSpan,
|
||||
*aActualRowSpan, *aActualColSpan,
|
||||
*aIsSelected);
|
||||
if (cell)
|
||||
{
|
||||
*aCell = cell.get();
|
||||
@@ -2900,8 +2934,8 @@ nsHTMLEditor::GetCellAt(nsIDOMElement* aTable, PRInt32 aRowIndex, PRInt32 aColIn
|
||||
PRInt32 startRowIndex, startColIndex, rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
PRBool isSelected;
|
||||
return GetCellDataAt(aTable, aRowIndex, aColIndex, aCell,
|
||||
startRowIndex, startColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
&startRowIndex, &startColIndex, &rowSpan, &colSpan,
|
||||
&actualRowSpan, &actualColSpan, &isSelected);
|
||||
}
|
||||
|
||||
// When all you want are the rowspan and colspan (not exposed in nsITableEditor)
|
||||
@@ -2913,8 +2947,8 @@ nsHTMLEditor::GetCellSpansAt(nsIDOMElement* aTable, PRInt32 aRowIndex, PRInt32 a
|
||||
PRInt32 startRowIndex, startColIndex, rowSpan, colSpan;
|
||||
PRBool isSelected;
|
||||
return GetCellDataAt(aTable, aRowIndex, aColIndex, getter_AddRefs(cell),
|
||||
startRowIndex, startColIndex, rowSpan, colSpan,
|
||||
aActualRowSpan, aActualColSpan, isSelected);
|
||||
&startRowIndex, &startColIndex, &rowSpan, &colSpan,
|
||||
&aActualRowSpan, &aActualColSpan, &isSelected);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@@ -2959,7 +2993,8 @@ nsHTMLEditor::GetCellContext(nsISelection **aSelection,
|
||||
nsCOMPtr<nsIDOMElement> cellOrTableElement;
|
||||
PRInt32 selectedCount;
|
||||
nsAutoString tagName;
|
||||
res = GetSelectedOrParentTableElement(*getter_AddRefs(cellOrTableElement), tagName, selectedCount);
|
||||
res = GetSelectedOrParentTableElement(getter_AddRefs(cellOrTableElement),
|
||||
tagName, &selectedCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (tagName == NS_LITERAL_STRING("table"))
|
||||
{
|
||||
@@ -3000,7 +3035,7 @@ nsHTMLEditor::GetCellContext(nsISelection **aSelection,
|
||||
{
|
||||
PRInt32 rowIndex, colIndex;
|
||||
// Get current cell location so we can put caret back there when done
|
||||
res = GetCellIndexes(cell, rowIndex, colIndex);
|
||||
res = GetCellIndexes(cell, &rowIndex, &colIndex);
|
||||
if(NS_FAILED(res)) return res;
|
||||
if (aRowIndex) *aRowIndex = rowIndex;
|
||||
if (aColIndex) *aColIndex = colIndex;
|
||||
@@ -3190,7 +3225,7 @@ nsHTMLEditor::GetFirstSelectedCellInTable(nsIDOMElement **aCell, PRInt32 *aRowIn
|
||||
if (aRowIndex || aColIndex)
|
||||
{
|
||||
PRInt32 startRowIndex, startColIndex;
|
||||
res = GetCellIndexes(cell, startRowIndex, startColIndex);
|
||||
res = GetCellIndexes(cell, &startRowIndex, &startColIndex);
|
||||
if(NS_FAILED(res)) return res;
|
||||
|
||||
if (aRowIndex)
|
||||
@@ -3297,11 +3332,15 @@ nsHTMLEditor::SetSelectionAfterTableEdit(nsIDOMElement* aTable, PRInt32 aRow, PR
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetSelectedOrParentTableElement(nsIDOMElement* &aTableElement, nsString& aTagName, PRInt32 &aSelectedCount)
|
||||
nsHTMLEditor::GetSelectedOrParentTableElement(nsIDOMElement** aTableElement,
|
||||
nsAString& aTagName,
|
||||
PRInt32 *aSelectedCount)
|
||||
{
|
||||
aTableElement = nsnull;
|
||||
NS_ENSURE_ARG_POINTER(aTableElement);
|
||||
NS_ENSURE_ARG_POINTER(aSelectedCount);
|
||||
*aTableElement = nsnull;
|
||||
aTagName.SetLength(0);
|
||||
aSelectedCount = 0;
|
||||
*aSelectedCount = 0;
|
||||
|
||||
nsCOMPtr<nsISelection> selection;
|
||||
nsresult res = GetSelection(getter_AddRefs(selection));
|
||||
@@ -3319,7 +3358,7 @@ nsHTMLEditor::GetSelectedOrParentTableElement(nsIDOMElement* &aTableElement, nsS
|
||||
{
|
||||
// Each cell is in its own selection range,
|
||||
// so count signals multiple-cell selection
|
||||
res = selection->GetRangeCount(&aSelectedCount);
|
||||
res = selection->GetRangeCount(aSelectedCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
aTagName = tdName;
|
||||
}
|
||||
@@ -3360,20 +3399,20 @@ nsHTMLEditor::GetSelectedOrParentTableElement(nsIDOMElement* &aTableElement, nsS
|
||||
aTagName = tdName;
|
||||
// Each cell is in its own selection range,
|
||||
// so count signals multiple-cell selection
|
||||
res = selection->GetRangeCount(&aSelectedCount);
|
||||
res = selection->GetRangeCount(aSelectedCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
else if(tag == tableName)
|
||||
{
|
||||
tableOrCellElement = do_QueryInterface(selectedNode);
|
||||
aTagName = tableName;
|
||||
aSelectedCount = 1;
|
||||
*aSelectedCount = 1;
|
||||
}
|
||||
else if(tag == trName)
|
||||
{
|
||||
tableOrCellElement = do_QueryInterface(selectedNode);
|
||||
aTagName = trName;
|
||||
aSelectedCount = 1;
|
||||
*aSelectedCount = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3388,8 +3427,8 @@ nsHTMLEditor::GetSelectedOrParentTableElement(nsIDOMElement* &aTableElement, nsS
|
||||
}
|
||||
if (tableOrCellElement)
|
||||
{
|
||||
aTableElement = tableOrCellElement.get();
|
||||
NS_ADDREF(aTableElement);
|
||||
*aTableElement = tableOrCellElement.get();
|
||||
NS_ADDREF(*aTableElement);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@@ -3409,9 +3448,10 @@ static PRBool IndexNotTested(nsVoidArray *aArray, PRInt32 aIndex)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetSelectedCellsType(nsIDOMElement *aElement, PRUint32 &aSelectionType)
|
||||
nsHTMLEditor::GetSelectedCellsType(nsIDOMElement *aElement, PRUint32 *aSelectionType)
|
||||
{
|
||||
aSelectionType = 0;
|
||||
NS_ENSURE_ARG_POINTER(aSelectionType);
|
||||
*aSelectionType = 0;
|
||||
|
||||
// Be sure we have a table element
|
||||
// (if aElement is null, this uses selection's anchor node)
|
||||
@@ -3421,7 +3461,7 @@ nsHTMLEditor::GetSelectedCellsType(nsIDOMElement *aElement, PRUint32 &aSelection
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
PRInt32 rowCount, colCount;
|
||||
res = GetTableSize(table, rowCount, colCount);
|
||||
res = GetTableSize(table, &rowCount, &colCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// Traverse all selected cells
|
||||
@@ -3431,7 +3471,7 @@ nsHTMLEditor::GetSelectedCellsType(nsIDOMElement *aElement, PRUint32 &aSelection
|
||||
if (res == NS_EDITOR_ELEMENT_NOT_FOUND) return NS_OK;
|
||||
|
||||
// We have at least one selected cell, so set return value
|
||||
aSelectionType = nsISelectionPrivate::TABLESELECTION_CELL;
|
||||
*aSelectionType = nsISelectionPrivate::TABLESELECTION_CELL;
|
||||
|
||||
// Store indexes of each row/col to avoid duplication of searches
|
||||
nsVoidArray indexArray;
|
||||
@@ -3442,7 +3482,7 @@ nsHTMLEditor::GetSelectedCellsType(nsIDOMElement *aElement, PRUint32 &aSelection
|
||||
{
|
||||
// Get the cell's location in the cellmap
|
||||
PRInt32 startRowIndex, startColIndex;
|
||||
res = GetCellIndexes(selectedCell, startRowIndex, startColIndex);
|
||||
res = GetCellIndexes(selectedCell, &startRowIndex, &startColIndex);
|
||||
if(NS_FAILED(res)) return res;
|
||||
|
||||
if (IndexNotTested(&indexArray, startColIndex))
|
||||
@@ -3457,7 +3497,7 @@ nsHTMLEditor::GetSelectedCellsType(nsIDOMElement *aElement, PRUint32 &aSelection
|
||||
|
||||
if (allCellsInRowAreSelected)
|
||||
{
|
||||
aSelectionType = nsISelectionPrivate::TABLESELECTION_ROW;
|
||||
*aSelectionType = nsISelectionPrivate::TABLESELECTION_ROW;
|
||||
return NS_OK;
|
||||
}
|
||||
// Test for columns
|
||||
@@ -3471,7 +3511,7 @@ nsHTMLEditor::GetSelectedCellsType(nsIDOMElement *aElement, PRUint32 &aSelection
|
||||
{
|
||||
// Get the cell's location in the cellmap
|
||||
PRInt32 startRowIndex, startColIndex;
|
||||
res = GetCellIndexes(selectedCell, startRowIndex, startColIndex);
|
||||
res = GetCellIndexes(selectedCell, &startRowIndex, &startColIndex);
|
||||
if(NS_FAILED(res)) return res;
|
||||
|
||||
if (IndexNotTested(&indexArray, startRowIndex))
|
||||
@@ -3484,7 +3524,7 @@ nsHTMLEditor::GetSelectedCellsType(nsIDOMElement *aElement, PRUint32 &aSelection
|
||||
res = GetNextSelectedCell(getter_AddRefs(selectedCell), nsnull);
|
||||
}
|
||||
if (allCellsInColAreSelected)
|
||||
aSelectionType = nsISelectionPrivate::TABLESELECTION_COLUMN;
|
||||
*aSelectionType = nsISelectionPrivate::TABLESELECTION_COLUMN;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -3501,8 +3541,9 @@ nsHTMLEditor::AllCellsInRowSelected(nsIDOMElement *aTable, PRInt32 aRowIndex, PR
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsresult res = GetCellDataAt(aTable, aRowIndex, col, getter_AddRefs(cell),
|
||||
curStartRowIndex, curStartColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
&curStartRowIndex, &curStartColIndex,
|
||||
&rowSpan, &colSpan,
|
||||
&actualRowSpan, &actualColSpan, &isSelected);
|
||||
|
||||
if (NS_FAILED(res)) return PR_FALSE;
|
||||
// If no cell, we may have a "ragged" right edge,
|
||||
@@ -3530,8 +3571,9 @@ nsHTMLEditor::AllCellsInColumnSelected(nsIDOMElement *aTable, PRInt32 aColIndex,
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsresult res = GetCellDataAt(aTable, row, aColIndex, getter_AddRefs(cell),
|
||||
curStartRowIndex, curStartColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
&curStartRowIndex, &curStartColIndex,
|
||||
&rowSpan, &colSpan,
|
||||
&actualRowSpan, &actualColSpan, &isSelected);
|
||||
|
||||
if (NS_FAILED(res)) return PR_FALSE;
|
||||
// If no cell, we must have a "ragged" right edge on the last column
|
||||
|
||||
@@ -804,6 +804,27 @@
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsITableEditor.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIEditorMailSupport.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIEditorStyleSheets.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIEditorObserver.idl</PATH>
|
||||
@@ -887,6 +908,21 @@
|
||||
<PATH>nsIEditorIMESupport.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsITableEditor.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIEditorMailSupport.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIEditorStyleSheets.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIEditorObserver.idl</PATH>
|
||||
@@ -1655,6 +1691,27 @@
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsITableEditor.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIEditorMailSupport.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIEditorStyleSheets.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIEditorObserver.idl</PATH>
|
||||
@@ -1738,6 +1795,21 @@
|
||||
<PATH>nsIEditorIMESupport.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsITableEditor.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIEditorMailSupport.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIEditorStyleSheets.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIEditorObserver.idl</PATH>
|
||||
@@ -1835,6 +1907,24 @@
|
||||
<PATH>nsIEditorIMESupport.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>editor.xpt</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsITableEditor.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>editor.xpt</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIEditorMailSupport.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>editor.xpt</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIEditorStyleSheets.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>editor.xpt</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
|
||||
@@ -22,6 +22,3 @@
|
||||
|
||||
nsEditorCID.h
|
||||
nsIEditorLogging.h
|
||||
nsIEditorMailSupport.h
|
||||
nsIEditorStyleSheets.h
|
||||
nsITableEditor.h
|
||||
|
||||
@@ -31,9 +31,6 @@ MODULE = editor
|
||||
EXPORTS = \
|
||||
nsEditorCID.h \
|
||||
nsIEditorLogging.h \
|
||||
nsIEditorMailSupport.h \
|
||||
nsIEditorStyleSheets.h \
|
||||
nsITableEditor.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
@@ -25,9 +25,6 @@ DEPTH=..\..
|
||||
EXPORTS = \
|
||||
nsEditorCID.h \
|
||||
nsIEditorLogging.h \
|
||||
nsIEditorMailSupport.h \
|
||||
nsIEditorStyleSheets.h \
|
||||
nsITableEditor.h \
|
||||
$(NULL)
|
||||
|
||||
MODULE = editor
|
||||
|
||||
@@ -695,7 +695,8 @@ var gPersistObj;
|
||||
// Don't forget to do these things after calling OutputFileWithPersistAPI:
|
||||
// window.editorShell.doAfterSave(doUpdateURLOnDocument, urlstring); // we need to update the url before notifying listeners
|
||||
// if (!aSaveCopy && success)
|
||||
// window.editorShell.editor.ResetModificationCount(); // this should cause notification to listeners that document has changed
|
||||
// window.editorShell.editor.resetModificationCount();
|
||||
// this should cause notification to listeners that document has changed
|
||||
|
||||
const webPersist = Components.interfaces.nsIWebBrowserPersist;
|
||||
function OutputFileWithPersistAPI(editorDoc, aDestinationLocation, aRelatedFilesParentDir, aMimeType)
|
||||
@@ -860,7 +861,8 @@ var gEditorOutputProgressListener =
|
||||
try {
|
||||
window.editorShell.doAfterSave(true, urlstring); // we need to update the url before notifying listeners
|
||||
var editor = window.editorShell.editor.QueryInterface(Components.interfaces.nsIEditor);
|
||||
editor.ResetModificationCount(); // this should cause notification to listeners that document has changed
|
||||
editor.resetModificationCount();
|
||||
// this should cause notification to listeners that doc has changed
|
||||
|
||||
// Set UI based on whether we're editing a remote or local url
|
||||
SetSaveAndPublishUI(urlstring);
|
||||
@@ -1260,7 +1262,8 @@ function SaveDocument(aSaveAs, aSaveCopy, aMimeType)
|
||||
try {
|
||||
window.editorShell.doAfterSave(doUpdateURL, urlstring); // we need to update the url before notifying listeners
|
||||
if (!aSaveCopy)
|
||||
window.editorShell.editor.ResetModificationCount(); // this should cause notification to listeners that document has changed
|
||||
window.editorShell.editor.resetModificationCount();
|
||||
// this should cause notification to listeners that document has changed
|
||||
|
||||
// Set UI based on whether we're editing a remote or local url
|
||||
SetSaveAndPublishUI(urlstring);
|
||||
@@ -1673,10 +1676,9 @@ var nsFindCommand =
|
||||
|
||||
if (newfind)
|
||||
{
|
||||
dump("Using new find dialog\n");
|
||||
try {
|
||||
window.openDialog("chrome://editor/content/EdReplace.xul", "_blank",
|
||||
"chrome,close,titlebar,modal", "");
|
||||
"chrome,dependent", "");
|
||||
}
|
||||
catch(ex) {
|
||||
dump("*** Exception: couldn't open Replace Dialog\n");
|
||||
@@ -1684,7 +1686,6 @@ var nsFindCommand =
|
||||
window._content.focus();
|
||||
}
|
||||
else {
|
||||
dump("Using old find\n");
|
||||
window.editorShell.Replace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,40 @@
|
||||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001-2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var gPublishHandler = null;
|
||||
|
||||
function EditorPublish(destinationDirectoryLocation, fileName, login, password)
|
||||
@@ -70,7 +107,7 @@ function output_current_editor_to_channel(aChannel)
|
||||
var formatType = 'text/' + editorShell.editorType;
|
||||
var flags = 256; // nsIDocumentEncoder::OutputEncodeEntities
|
||||
var charset = editorShell.GetDocumentCharacterSet();
|
||||
editorShell.editor.OutputToStream(aChannel, formatType, charset, flags);
|
||||
editorShell.editor.outputToStream(aChannel, formatType, charset, flags);
|
||||
// protocolChannel.uploadStream = contentsStream;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ function BuildCSSAttributeTable()
|
||||
// outside of the document's tree
|
||||
var styleAttr = gElement.getAttribute("style");
|
||||
var editor = editorShell.editor.QueryInterface(Components.interfaces.nsIHTMLEditor);
|
||||
var styleRule = editor.ParseStyleAttrIntoCSSRule(styleAttr);
|
||||
var styleRule = editor.parseStyleAttrIntoCSSRule(styleAttr);
|
||||
|
||||
if (styleRule == undefined)
|
||||
{
|
||||
|
||||
@@ -1179,8 +1179,8 @@ function InsertElementAroundSelection(element)
|
||||
while (anchor)
|
||||
{
|
||||
node = anchor.nextSibling;
|
||||
editor.DeleteNode(anchor);
|
||||
editor.InsertNode(anchor, element, element.childNodes.length);
|
||||
editor.deleteNode(anchor);
|
||||
editor.insertNode(anchor, element, element.childNodes.length);
|
||||
if (anchor == focus) break;
|
||||
anchor = node;
|
||||
}
|
||||
@@ -1207,8 +1207,8 @@ function RemoveElementKeepingChildren(element)
|
||||
offset++;
|
||||
while ((node = element.firstChild))
|
||||
{
|
||||
editor.DeleteNode(node);
|
||||
editor.InsertNode(node, parent, offset++);
|
||||
editor.deleteNode(node);
|
||||
editor.insertNode(node, parent, offset++);
|
||||
}
|
||||
}
|
||||
editorShell.DeleteElement(element);
|
||||
|
||||
@@ -174,8 +174,8 @@ function onAccept()
|
||||
if (newLegend)
|
||||
editorShell.InsertElement(legendElement, fieldsetElement, 0, true);
|
||||
else while (legendElement.firstChild)
|
||||
editor.DeleteNode(legendElement.firstChild);
|
||||
editor.InsertNode(editorShell.editorDocument.createTextNode(gDialog.legendText.value), legendElement, 0);
|
||||
editor.deleteNode(legendElement.firstChild);
|
||||
editor.insertNode(editorShell.editorDocument.createTextNode(gDialog.legendText.value), legendElement, 0);
|
||||
}
|
||||
else if (!newLegend)
|
||||
editorShell.DeleteElement(legendElement);
|
||||
|
||||
@@ -118,10 +118,10 @@ function onAccept()
|
||||
{
|
||||
var editor = editorShell.editor;
|
||||
while (labelElement.firstChild)
|
||||
editor.DeleteNode(labelElement.firstChild);
|
||||
editor.deleteNode(labelElement.firstChild);
|
||||
if (gDialog.labelText.value) {
|
||||
var textNode = editorShell.editorDocument.createTextNode(gDialog.labelText.value);
|
||||
editor.InsertNode(textNode, labelElement, 0);
|
||||
editor.insertNode(textNode, labelElement, 0);
|
||||
editorShell.SelectElement(labelElement);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,10 +163,10 @@ function onAccept()
|
||||
var initialText = gDialog.textareaValue.value;
|
||||
if (initialText != textareaElement.value) {
|
||||
while (textareaElement.hasChildNodes())
|
||||
editorShell.editor.DeleteNode(textareaElement.firstChild);
|
||||
editorShell.editor.deleteNode(textareaElement.firstChild);
|
||||
if (initialText) {
|
||||
var textNode = editorShell.editorDocument.createTextNode(initialText);
|
||||
editorShell.editor.InsertNode(textNode, textareaElement, 0);
|
||||
editorShell.editor.insertNode(textNode, textareaElement, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -151,9 +151,7 @@ function ReleaseGlobalVariables()
|
||||
|
||||
function disableEditableFields()
|
||||
{
|
||||
var flags = new Object;
|
||||
editorShell.editor.GetFlags(flags);
|
||||
editorShell.editor.SetFlags(flags.value | nsIPlaintextEditor.eEditorReadonlyMask);
|
||||
editorShell.editor.flags |= nsIPlaintextEditor.eEditorReadonlyMask;
|
||||
var disableElements = document.getElementsByAttribute("disableonsend", "true");
|
||||
for (i=0;i<disableElements.length;i++)
|
||||
{
|
||||
@@ -163,9 +161,7 @@ function disableEditableFields()
|
||||
|
||||
function enableEditableFields()
|
||||
{
|
||||
var flags = new Object;
|
||||
editorShell.editor.GetFlags(flags);
|
||||
editorShell.editor.SetFlags(flags.value ^ nsIPlaintextEditor.eEditorReadonlyMask);
|
||||
editorShell.editor.flags ^= nsIPlaintextEditor.eEditorReadonlyMask;
|
||||
var enableElements = document.getElementsByAttribute("disableonsend", "true");
|
||||
for (i=0;i<enableElements.length;i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user