Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Public Attributes
nsIHTMLEditor Interface Reference

import "nsIHTMLEditor.idl";

Inheritance diagram for nsIHTMLEditor:
Inheritance graph
[legend]
Collaboration diagram for nsIHTMLEditor:
Collaboration graph
[legend]

List of all members.

Public Types

typedef short EAlignment

Public Member Functions

void addDefaultProperty (in nsIAtom aProperty, in AString aAttribute, in AString aValue)
 AddDefaultProperty() registers a default style property with the editor.
void removeDefaultProperty (in nsIAtom aProperty, in AString aAttribute, in AString aValue)
 RemoveDefaultProperty() unregisters a default style property with the editor.
void removeAllDefaultProperties ()
 RemoveAllDefaultProperties() unregisters all default style properties with the editor.
void setCSSInlineProperty (in nsIAtom aProperty, in AString aAttribute, in AString aValue)
 SetInlineProperty() sets the aggregate properties on the current selection.
void setInlineProperty (in nsIAtom aProperty, in AString aAttribute, in AString aValue)
void getInlineProperty (in nsIAtom aProperty, in AString aAttribute, in AString aValue, out boolean aFirst, out boolean aAny, out boolean aAll)
 getInlineProperty() gets aggregate properties of the current selection.
AString getInlinePropertyWithAttrValue (in nsIAtom aProperty, in AString aAttribute, in AString aValue, out boolean aFirst, out boolean aAny, out boolean aAll)
void removeAllInlineProperties ()
 removeAllInlineProperties() deletes all the inline properties from all text in the current selection.
void removeInlineProperty (in nsIAtom aProperty, in AString aAttribute)
 removeInlineProperty() deletes the properties from all text in the current selection.
void increaseFontSize ()
 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.
void decreaseFontSize ()
 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.
boolean canDrag (in nsIDOMEvent aEvent)
 canDrag decides if a drag should be started (for example, based on the current selection and mousepoint).
void doDrag (in nsIDOMEvent aEvent)
 doDrag transfers the relevant data (as appropriate) to a transferable so it can later be dropped.
void insertFromDrop (in nsIDOMEvent aEvent)
 insertFromDrop looks for a dragsession and inserts the relevant data in response to a drop.
boolean nodeIsBlock (in nsIDOMNode node)
 Tests if a node is a BLOCK element according the the HTML 4.0 DTD.
void insertHTML (in AString aInputString)
 Insert some HTML source at the current location.
void pasteNoFormatting (in long aSelectionType)
 Paste the text in the OS clipboard at the cursor position, replacing the selected text (if any), but strip out any HTML styles and formatting.
void rebuildDocumentFromSource (in AString aSourceString)
 Rebuild the entire document from source HTML Needed to be able to edit HEAD and other outside-of-BODY content.
void insertHTMLWithContext (in AString aInputString, in AString aContextStr, in AString aInfoStr, in AString aFlavor, in nsIDOMDocument aSourceDoc, in nsIDOMNode aDestinationNode, in long aDestinationOffset, in boolean aDeleteSelection)
 Insert some HTML source, interpreting the string argument according to the given context.
void insertElementAtSelection (in nsIDOMElement aElement, in boolean aDeleteSelection)
 Insert an element, which may have child nodes, at the selection Used primarily to insert a new element for various insert element dialogs, but it enforces the HTML 4.0 DTD "CanContain" rules, so it should be useful for other elements.
void setDocumentTitle (in AString aTitle)
 Set the documents title.
void updateBaseURL ()
 Set the BaseURL for the document to the current URL but only if the page doesn't have a <base> tag This should be done after the document URL has changed, such as after saving a file This is used as base for relativizing link and image urls.
void selectElement (in nsIDOMElement aElement)
 Set the selection at the suppled element.
void setCaretAfterElement (in nsIDOMElement aElement)
 Create a collapsed selection just after aElement.
void setParagraphFormat (in AString aParagraphFormat)
 SetParagraphFormat Insert a block paragraph tag around selection.
AString getParagraphState (out boolean aMixed)
 getParagraphState returns what block tag paragraph format is in the selection.
AString getFontFaceState (out boolean aMixed)
 getFontFaceState returns what font face is in the selection.
AString getFontColorState (out boolean aMixed)
 getFontColorState returns what font face is in the selection.
AString getBackgroundColorState (out boolean aMixed)
 getFontColorState returns what font face is in the selection.
AString getHighlightColorState (out boolean aMixed)
 getHighlightColorState returns what the highlight color of the selection.
void getListState (out boolean aMixed, out boolean aOL, out boolean aUL, out boolean aDL)
 getListState returns what list type is in the selection.
void getListItemState (out boolean aMixed, out boolean aLI, out boolean aDT, out boolean aDD)
 getListItemState returns what list item type is in the selection.
void getAlignment (out boolean aMixed, out short aAlign)
 getAlignment returns what alignment is in the selection.
void getIndentState (out boolean aCanIndent, out boolean aCanOutdent)
 Document me!
void makeOrChangeList (in AString aListType, in boolean entireList, in AString aBulletType)
 Document me!
void removeList (in AString aListType)
 Document me!
void indent (in AString aIndent)
 Document me!
void align (in AString aAlign)
 Document me!
nsIDOMElement getElementOrParentByTagName (in AString aTagName, in nsIDOMNode aNode)
 Return the input node or a parent matching the given aTagName, starting the search at the supplied node.
nsIDOMElement getSelectedElement (in AString aTagName)
 Return an element only if it is the only node selected, such as an image, horizontal rule, etc.
AString getHeadContentsAsHTML ()
 Output the contents of the <HEAD> section as text/HTML format.
void replaceHeadContentsWithHTML (in AString aSourceToInsert)
 Replace all children of <HEAD> with string of HTML source.
nsIDOMElement createElementWithDefaults (in AString aTagName)
 Return a new element with default attribute values.
void insertLinkAroundSelection (in nsIDOMElement aAnchorElement)
 Insert an link element as the parent of the current selection.
void setBackgroundColor (in AString aColor)
 Set the value of the "bgcolor" attribute on the document's <body> element.
void setBodyAttribute (in AString aAttr, in AString aValue)
 Set an attribute on the document's <body> element such as text, link, background colors.
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!
nsISupportsArray getLinkedObjects ()
 Find all the nodes in the document which contain references to outside URIs (e.g.
void addInsertionListener (in nsIContentFilter inFilter)
 Add listener for insertion override.
void removeInsertionListener (in nsIContentFilter inFilter)
 Remove listener for insertion override.
nsIDOMElement createAnonymousElement (in AString aTag, in nsIDOMNode aParentNode, in AString aAnonClass, in boolean aIsCreatedHidden)
 Returns an anonymous nsDOMElement of type aTag, child of aParentNode.
nsIDOMElement getSelectionContainer ()
 returns the deepest container of the selection
void checkSelectionStateForAnonymousButtons (in nsISelection aSelection)
 Checks if the anonymous nodes created by the HTML editor have to be refreshed or hidden depending on a possible new state of the selection.
boolean isAnonymousElement (in nsIDOMElement aElement)

Public Attributes

const short eLeft = 0
const short eCenter = 1
const short eRight = 2
const short eJustify = 3
attribute boolean isCSSEnabled
 A boolean which is true is the HTMLEditor has been instantiated with CSS knowledge and if the CSS pref is currently checked.
attribute boolean returnInParagraphCreatesNewParagraph
 A boolean indicating if a return key pressed in a paragraph creates another paragraph or just inserts a
at the caret.

Detailed Description

Definition at line 56 of file nsIHTMLEditor.idl.


Member Typedef Documentation

Definition at line 59 of file nsIHTMLEditor.idl.


Member Function Documentation

void nsIHTMLEditor::addDefaultProperty ( in nsIAtom  aProperty,
in AString  aAttribute,
in AString  aValue 
)

AddDefaultProperty() registers a default style property with the editor.

Parameters:
aPropertythe property to set by default
aAttributethe attribute of the property, if applicable. May be null. Example: aProperty="font", aAttribute="color"
aValueif aAttribute is not null, the value of the attribute. Example: aProperty="font", aAttribute="color", aValue="0x00FFFF"

Add listener for insertion override.

Parameters:
inFilterfunction which callers want called during insertion
void nsIHTMLEditor::align ( in AString  aAlign)

Document me!

canDrag decides if a drag should be started (for example, based on the current selection and mousepoint).

Checks if the anonymous nodes created by the HTML editor have to be refreshed or hidden depending on a possible new state of the selection.

Parameters:
aSelection[IN] a selection
nsIDOMElement nsIHTMLEditor::createAnonymousElement ( in AString  aTag,
in nsIDOMNode  aParentNode,
in AString  aAnonClass,
in boolean  aIsCreatedHidden 
)

Returns an anonymous nsDOMElement of type aTag, child of aParentNode.

If aIsCreatedHidden is true, the class "hidden" is added to the created element. If aAnonClass is not the empty string, it becomes the value of the attribute "_moz_anonclass"

Returns:
a DOM Element
Parameters:
aTag[IN] a string representing the desired type of the element to create
aParentNode[IN] the parent node of the created anonymous element
aAnonClass[IN] contents of the _moz_anonclass attribute
aIsCreatedHidden[IN] a boolean specifying if the class "hidden" is to be added to the created anonymous element

Return a new element with default attribute values.

This does not rely on the selection, and is not sensitive to context.

Used primarily to supply new element for various insert element dialogs (Image, Link, NamedAnchor, Table, and HorizontalRule are the only returned elements as of 7/25/99)

Parameters:
aTagNameThe HTML tagname Special input values for Links and Named anchors: Use "href" to get a link node (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:
The new element created.

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.

doDrag transfers the relevant data (as appropriate) to a transferable so it can later be dropped.

void nsIHTMLEditor::getAlignment ( out boolean  aMixed,
out short  aAlign 
)

getAlignment returns what alignment is in the selection.

Parameters:
aMixedTrue if there is more than one type of list item, or if there is some list and non-list
aAlignenum value for first encountered alignment (left/center/right)

getFontColorState returns what font face is in the selection.

Parameters:
aMixedTrue if there is more than one font color
Returns:
Color string. "" is returned for none.

Return the input node or a parent matching the given aTagName, starting the search at the supplied node.

An example of use is for testing if a node is in a table cell given a selection anchor node.

Parameters:
aTagNameThe HTML tagname Special input values: Use "href" to get a link node (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) Use "list" to get an OL, UL, or DL list node Use "td" to get either a TD or TH cell node
aNodeThe 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)

getFontColorState returns what font face is in the selection.

Parameters:
aMixedTrue if there is more than one font color
Returns:
Color string. "" is returned for none.

getFontFaceState returns what font face is in the selection.

Parameters:
aMixedTrue if there is more than one font face
Returns:
Name of face. Note: "tt" is returned for tt tag. "" is returned for none.

Output the contents of the <HEAD> section as text/HTML format.

getHighlightColorState returns what the highlight color of the selection.

Parameters:
aMixedTrue if there is more than one font color
Returns:
Color string. "" is returned for none.
void nsIHTMLEditor::getIndentState ( out boolean  aCanIndent,
out boolean  aCanOutdent 
)

Document me!

void nsIHTMLEditor::getInlineProperty ( in nsIAtom  aProperty,
in AString  aAttribute,
in AString  aValue,
out boolean  aFirst,
out boolean  aAny,
out boolean  aAll 
)

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.

Parameters:
aPropertythe property to get on the selection
aAttributethe attribute of the property, if applicable. May be null. Example: aProperty="font", aAttribute="color"
aValueif aAttribute is not null, the value of the attribute. May be null. Example: aProperty="font", aAttribute="color", aValue="0x00FFFF"
aFirst[OUT] PR_TRUE if the first text node in the selection has the property
aAny[OUT] PR_TRUE if any of the text nodes in the selection have the property
aAll[OUT] PR_TRUE if all of the text nodes in the selection have the property
AString nsIHTMLEditor::getInlinePropertyWithAttrValue ( in nsIAtom  aProperty,
in AString  aAttribute,
in AString  aValue,
out boolean  aFirst,
out boolean  aAny,
out boolean  aAll 
)

Find all the nodes in the document which contain references to outside URIs (e.g.

a href, img src, script src, etc.) The objects in the array will be type nsIURIRefObject.

Returns:
aNodeList the linked nodes found

getListItemState returns what list item type is in the selection.

Parameters:
aMixedTrue if there is more than one type of list item, or if there is some list and non-list
aLItrue if "li" list items are selected.
aDTtrue if "dt" list items are selected.
aDDtrue if "dd" list items are selected.

getListState returns what list type is in the selection.

Parameters:
aMixedTrue if there is more than one type of list, or if there is some list and non-list
aOLThe company that employs me. No, really, it's true if an "ol" list is selected.
aULtrue if an "ul" list is selected.
aDLtrue if a "dl" list is selected.

getParagraphState returns what block tag paragraph format is in the selection.

Parameters:
aMixedTrue if there is more than one format
Returns:
Name of block tag. "" is returned for none.

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.

Parameters:
aTagNameThe HTML tagname or and empty string to get any element (but only if it is the only element selected) Special input values for Links and Named anchors: Use "href" to get a link node (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)

returns the deepest container of the selection

Returns:
a DOM Element
void nsIHTMLEditor::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!

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.

void nsIHTMLEditor::indent ( in AString  aIndent)

Document me!

Insert an element, which may have child nodes, at the selection Used primarily to insert a new element for various insert element dialogs, but it enforces the HTML 4.0 DTD "CanContain" rules, so it should be useful for other elements.

Parameters:
aElementThe element to insert
aDeleteSelectionDelete the selection before inserting If aDeleteSelection is PR_FALSE, then the element is inserted after the end of the selection for all element except Named Anchors, which insert before the selection

insertFromDrop looks for a dragsession and inserts the relevant data in response to a drop.

void nsIHTMLEditor::insertHTML ( in AString  aInputString)

Insert some HTML source at the current location.

Parameters:
aInputStringthe string to be inserted
void nsIHTMLEditor::insertHTMLWithContext ( in AString  aInputString,
in AString  aContextStr,
in AString  aInfoStr,
in AString  aFlavor,
in nsIDOMDocument  aSourceDoc,
in nsIDOMNode  aDestinationNode,
in long  aDestinationOffset,
in boolean  aDeleteSelection 
)

Insert some HTML source, interpreting the string argument according to the given context.

Parameters:
aInputStringthe string to be inserted
aContextStrContext of insertion
aInfoStrRelated info to aInputString
aFlavorTransferable flavor, can be ""
aSourceDocdocument where input was dragged from (may be null)
aDestinationNodelocation for insertion (such as when dropped)
aDestinationOffsetused with aDestNode to determine insert location
aDeleteSelectionused with aDestNode during drag&drop
aCollapseSelectionused with aDestNode during drag&drop

Insert an link element as the parent of the current selection.

Parameters:
aElementAn "A" element with a non-empty "href" attribute
void nsIHTMLEditor::makeOrChangeList ( in AString  aListType,
in boolean  entireList,
in AString  aBulletType 
)

Document me!

Tests if a node is a BLOCK element according the the HTML 4.0 DTD.

This does NOT consider CSS effect on display type

Parameters:
aNodethe node to test

Paste the text in the OS clipboard at the cursor position, replacing the selected text (if any), but strip out any HTML styles and formatting.

void nsIHTMLEditor::rebuildDocumentFromSource ( in AString  aSourceString)

Rebuild the entire document from source HTML Needed to be able to edit HEAD and other outside-of-BODY content.

Parameters:
aSourceStringHTML source string of the entire new document

RemoveAllDefaultProperties() unregisters all default style properties with the editor.

removeAllInlineProperties() deletes all the inline properties from all text in the current selection.

void nsIHTMLEditor::removeDefaultProperty ( in nsIAtom  aProperty,
in AString  aAttribute,
in AString  aValue 
)

RemoveDefaultProperty() unregisters a default style property with the editor.

Parameters:
aPropertythe property to remove from defaults
aAttributethe attribute of the property, if applicable. May be null. Example: aProperty="font", aAttribute="color"
aValueif aAttribute is not null, the value of the attribute. Example: aProperty="font", aAttribute="color", aValue="0x00FFFF"
void nsIHTMLEditor::removeInlineProperty ( in nsIAtom  aProperty,
in AString  aAttribute 
)

removeInlineProperty() deletes the properties from all text in the current selection.

If aProperty is not set on the selection, nothing is done.

Parameters:
aPropertythe property to remove 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
aAttributethe 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.

Remove listener for insertion override.

Parameters:
inFilterfunction which callers do not want called during insertion
void nsIHTMLEditor::removeList ( in AString  aListType)

Document me!

void nsIHTMLEditor::replaceHeadContentsWithHTML ( in AString  aSourceToInsert)

Replace all children of <HEAD> with string of HTML source.

Set the selection at the suppled element.

Parameters:
aElementAn element in the document

Set the value of the "bgcolor" attribute on the document's <body> element.

Parameters:
aColorThe HTML color string, such as "#ffccff" or "yellow"
void nsIHTMLEditor::setBodyAttribute ( in AString  aAttr,
in AString  aValue 
)

Set an attribute on the document's <body> element such as text, link, background colors.

8/31/00 THIS ISN'T BEING USED? SHOULD WE DROP IT?

Parameters:
aAttrThe attribute to be set
aValueThe value of the attribute

Create a collapsed selection just after aElement.

XXX could we parameterize SelectElement(before/select/after>?

The selection is set to parent-of-aElement with an offset 1 greater than aElement's offset but it enforces the HTML 4.0 DTD "CanContain" rules, so it should be useful for other elements.

Parameters:
aElementAn element in the document
void nsIHTMLEditor::setCSSInlineProperty ( in nsIAtom  aProperty,
in AString  aAttribute,
in AString  aValue 
)

SetInlineProperty() sets the aggregate properties on the current selection.

Parameters:
aPropertythe property to set on the selection
aAttributethe attribute of the property, if applicable. May be null. Example: aProperty="font", aAttribute="color"
aValueif aAttribute is not null, the value of the attribute. May be null. Example: aProperty="font", aAttribute="color", aValue="0x00FFFF"

Set the documents title.

void nsIHTMLEditor::setInlineProperty ( in nsIAtom  aProperty,
in AString  aAttribute,
in AString  aValue 
)
void nsIHTMLEditor::setParagraphFormat ( in AString  aParagraphFormat)

SetParagraphFormat Insert a block paragraph tag around selection.

Parameters:
aParagraphFormat"p", "h1" to "h6", "address", "pre", or "blockquote"

Set the BaseURL for the document to the current URL but only if the page doesn't have a <base> tag This should be done after the document URL has changed, such as after saving a file This is used as base for relativizing link and image urls.


Member Data Documentation

Definition at line 64 of file nsIHTMLEditor.idl.

Definition at line 66 of file nsIHTMLEditor.idl.

Definition at line 63 of file nsIHTMLEditor.idl.

Definition at line 65 of file nsIHTMLEditor.idl.

A boolean which is true is the HTMLEditor has been instantiated with CSS knowledge and if the CSS pref is currently checked.

Returns:
true if CSS handled and enabled

Definition at line 557 of file nsIHTMLEditor.idl.

A boolean indicating if a return key pressed in a paragraph creates another paragraph or just inserts a
at the caret.

Returns:
true if CR in a paragraph creates a new paragraph

Definition at line 610 of file nsIHTMLEditor.idl.


The documentation for this interface was generated from the following file: