Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions
nsITextServicesDocument Class Reference

The nsITextServicesDocument presents the document in as a bunch of flattened text blocks. More...

#include <nsITextServicesDocument.h>

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

List of all members.

Public Types

enum  TSDDisplayStyle { eDSNormal = 0, eDSUndlerline }
enum  TSDBlockSelectionStatus {
  eBlockNotFound = 0, eBlockOutside, eBlockInside, eBlockContains,
  eBlockPartial
}

Public Member Functions

NS_IMETHOD InitWithDocument (nsIDOMDocument *aDOMDocument, nsIPresShell *aPresShell)=0
 Initializes the text services document to use a particular DOM document.
NS_IMETHOD GetDocument (nsIDOMDocument **aDocument)=0
 Get the DOM document for the document in use.
NS_IMETHOD InitWithEditor (nsIEditor *aEditor)=0
 Initializes the text services document to use a particular editor.
NS_IMETHOD SetExtent (nsIDOMRange *aDOMRange)=0
 Sets the range/extent over which the text services document will iterate.
NS_IMETHOD GetExtent (nsIDOMRange **aDOMRange)=0
 Gets the range that the text services document is currently iterating over.
NS_IMETHOD ExpandRangeToWordBoundaries (nsIDOMRange *aRange)=0
 Expands the end points of the range so that it spans complete words.
NS_IMETHOD SetFilter (nsITextServicesFilter *aFilter)=0
 Sets the filter to be used while iterating over content.
NS_IMETHOD CanEdit (PRBool *aCanEdit)=0
 Returns true if the document can be modified with calls to DeleteSelection() and InsertText().
NS_IMETHOD GetCurrentTextBlock (nsString *aStr)=0
 Returns the text in the current text block.
NS_IMETHOD FirstBlock ()=0
 Tells the document to point to the first text block in the document.
NS_IMETHOD LastBlock ()=0
 Tells the document to point to the last text block in the document.
NS_IMETHOD FirstSelectedBlock (TSDBlockSelectionStatus *aSelectionStatus, PRInt32 *aSelectionOffset, PRInt32 *aSelectionLength)=0
 Tells the document to point to the first text block that contains the current selection or caret.
NS_IMETHOD LastSelectedBlock (TSDBlockSelectionStatus *aSelectionStatus, PRInt32 *aSelectionOffset, PRInt32 *aSelectionLength)=0
 Tells the document to point to the last text block that contains the current selection or caret.
NS_IMETHOD PrevBlock ()=0
 Tells the document to point to the text block before the current one.
NS_IMETHOD NextBlock ()=0
 Tells the document to point to the text block after the current one.
NS_IMETHOD IsDone (PRBool *aIsDone)=0
 IsDone() will always set aIsDone == PR_FALSE unless the document contains no text, PrevBlock() was called while the document was already pointing to the first text block in the document, or NextBlock() was called while the document was already pointing to the last text block in the document.
NS_IMETHOD SetSelection (PRInt32 aOffset, PRInt32 aLength)=0
 SetSelection() allows the caller to set the selection based on an offset into the string returned by GetCurrentTextBlock().
NS_IMETHOD ScrollSelectionIntoView ()=0
 Scrolls the document so that the current selection is visible.
NS_IMETHOD DeleteSelection ()=0
 Deletes the text selected by SetSelection().
NS_IMETHOD InsertText (const nsString *aText)=0
 Inserts the given text at the current cursor position.
NS_IMETHOD SetDisplayStyle (TSDDisplayStyle aStyle)=0
 Sets the display style for the text selected by SetSelection().
NS_IMETHOD GetDOMRangeFor (PRInt32 aOffset, PRInt32 aLength, nsIDOMRange **aRange)=0
 Returns the DOM range for a given offset and length.

Detailed Description

The nsITextServicesDocument presents the document in as a bunch of flattened text blocks.

Each text block can be retrieved as an nsString (array of characters).

Definition at line 65 of file nsITextServicesDocument.h.


Member Enumeration Documentation

Enumerator:
eBlockNotFound 
eBlockOutside 
eBlockInside 
eBlockContains 
eBlockPartial 

Definition at line 72 of file nsITextServicesDocument.h.

               { eBlockNotFound=0, // There is no text block (TB) in or before the selection (S).
                 eBlockOutside,    // No TB in S, but found one before/after S.
                 eBlockInside,     // S extends beyond the start and end of TB.
                 eBlockContains,   // TB contains entire S.
                 eBlockPartial     // S begins or ends in TB but extends outside of TB.
  } TSDBlockSelectionStatus;
Enumerator:
eDSNormal 
eDSUndlerline 

Definition at line 70 of file nsITextServicesDocument.h.


Member Function Documentation

NS_IMETHOD nsITextServicesDocument::CanEdit ( PRBool aCanEdit) [pure virtual]

Returns true if the document can be modified with calls to DeleteSelection() and InsertText().

Parameters:
aCanEditis true if the document can be modified, false if it can't.

Implemented in nsTextServicesDocument.

Deletes the text selected by SetSelection().

Calling DeleteSelection with nothing selected, or with a collapsed selection (cursor) does nothing and returns NS_OK.

Implemented in nsTextServicesDocument.

Expands the end points of the range so that it spans complete words.

This call does not change any internal state of the text services document.

Parameters:
aDOMRangethe range to be expanded/adjusted.

Implemented in nsTextServicesDocument.

Tells the document to point to the first text block in the document.

This method does not adjust the current cursor position or selection.

Implemented in nsTextServicesDocument.

NS_IMETHOD nsITextServicesDocument::FirstSelectedBlock ( TSDBlockSelectionStatus aSelectionStatus,
PRInt32 aSelectionOffset,
PRInt32 aSelectionLength 
) [pure virtual]

Tells the document to point to the first text block that contains the current selection or caret.

Parameters:
aSelectionStatuswill contain the text block selection status
aSelectionOffsetwill contain the offset into the string returned by GetCurrentTextBlock() where the selection begins.
aLengthwill contain the number of characters that are selected in the string.

Implemented in nsTextServicesDocument.

Returns the text in the current text block.

Parameters:
aStrwill contain the text.

Implemented in nsTextServicesDocument.

Here is the caller graph for this function:

Get the DOM document for the document in use.

Returns:
aDocument the dom document [OUT]

Implemented in nsTextServicesDocument.

NS_IMETHOD nsITextServicesDocument::GetDOMRangeFor ( PRInt32  aOffset,
PRInt32  aLength,
nsIDOMRange **  aRange 
) [pure virtual]

Returns the DOM range for a given offset and length.

Parameters:
aOffsetoffset into string returned by GetCurrentTextBlock().
aLengthnumber characters selected.
Returns:
aDOMRange the DOM range that represents the offset and length

Implemented in nsTextServicesDocument.

NS_IMETHOD nsITextServicesDocument::GetExtent ( nsIDOMRange **  aDOMRange) [pure virtual]

Gets the range that the text services document is currently iterating over.

If SetExtent() was never called, this method will return a range that spans the entire body of the document.

Parameters:
aDOMRangewill contain an AddRef'd pointer to the range.

Implemented in nsTextServicesDocument.

NS_IMETHOD nsITextServicesDocument::InitWithDocument ( nsIDOMDocument aDOMDocument,
nsIPresShell aPresShell 
) [pure virtual]

Initializes the text services document to use a particular DOM document.

Parameters:
aDOMDocumentis the document to use. It is AddRef'd by this method.
aPresShellis the presentation shell to use when setting the selection. It is AddRef'd by this method.

Implemented in nsTextServicesDocument.

Initializes the text services document to use a particular editor.

The text services document will use the DOM document and presentation shell used by the editor.

Parameters:
aEditoris the editor to use. The editor is AddRef'd by this method.

Implemented in nsTextServicesDocument.

Inserts the given text at the current cursor position.

If there is a selection, it will be deleted before the text is inserted.

Implemented in nsTextServicesDocument.

NS_IMETHOD nsITextServicesDocument::IsDone ( PRBool aIsDone) [pure virtual]

IsDone() will always set aIsDone == PR_FALSE unless the document contains no text, PrevBlock() was called while the document was already pointing to the first text block in the document, or NextBlock() was called while the document was already pointing to the last text block in the document.

Parameters:
aIsDonewill contain the result.

Implemented in nsTextServicesDocument.

Here is the caller graph for this function:

Tells the document to point to the last text block in the document.

This method does not adjust the current cursor position or selection.

Implemented in nsTextServicesDocument.

NS_IMETHOD nsITextServicesDocument::LastSelectedBlock ( TSDBlockSelectionStatus aSelectionStatus,
PRInt32 aSelectionOffset,
PRInt32 aSelectionLength 
) [pure virtual]

Tells the document to point to the last text block that contains the current selection or caret.

Parameters:
aSelectionStatuswill contain the text block selection status
aSelectionOffsetwill contain the offset into the string returned by GetCurrentTextBlock() where the selection begins.
aLengthwill contain the number of characters that are selected in the string.

Implemented in nsTextServicesDocument.

Tells the document to point to the text block after the current one.

This method will return NS_OK, even if there is no next block. Callers should call IsDone() to check if we have gone beyond the last text block in the document.

Implemented in nsTextServicesDocument.

Tells the document to point to the text block before the current one.

This method will return NS_OK, even if there is no previous block. Callers should call IsDone() to check if we have gone beyond the first text block in the document.

Implemented in nsTextServicesDocument.

Here is the caller graph for this function:

Scrolls the document so that the current selection is visible.

Implemented in nsTextServicesDocument.

Sets the display style for the text selected by SetSelection().

Parameters:
aStyleis the style to apply to the selected text.

Implemented in nsTextServicesDocument.

Sets the range/extent over which the text services document will iterate.

Note that InitWithDocument() or InitWithEditor() should have been called prior to calling this method. If this method is never called, the text services defaults to iterating over the entire document.

Parameters:
aDOMRangeis the range to use. aDOMRange must point to a valid range object.

Implemented in nsTextServicesDocument.

Sets the filter to be used while iterating over content.

Parameters:
aFilterfilter to be used while iterating over content.

Implemented in nsTextServicesDocument.

NS_IMETHOD nsITextServicesDocument::SetSelection ( PRInt32  aOffset,
PRInt32  aLength 
) [pure virtual]

SetSelection() allows the caller to set the selection based on an offset into the string returned by GetCurrentTextBlock().

A length of zero places the cursor at that offset. A positive non-zero length "n" selects n characters in the string.

Parameters:
aOffsetoffset into string returned by GetCurrentTextBlock().
aLengthnumber characters selected.

Implemented in nsTextServicesDocument.


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