Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Public Attributes | Private Attributes
nsTextInputSelectionImpl Class Reference
Inheritance diagram for nsTextInputSelectionImpl:
Inheritance graph
[legend]
Collaboration diagram for nsTextInputSelectionImpl:
Collaboration graph
[legend]

List of all members.

Public Types

enum  HINT { HINTLEFT = 0, HINTRIGHT = 1 }

Public Member Functions

NS_DECL_ISUPPORTS nsTextInputSelectionImpl (nsIFrameSelection *aSel, nsIPresShell *aShell, nsIContent *aLimiter)
 ~nsTextInputSelectionImpl ()
NS_IMETHOD SetDisplaySelection (PRInt16 toggle)
 Sets/Gets The display selection enum.
NS_IMETHOD GetDisplaySelection (PRInt16 *_retval)
NS_IMETHOD SetSelectionFlags (PRInt16 aInEnable)
NS_IMETHOD GetSelectionFlags (PRInt16 *aOutEnable)
NS_IMETHOD GetSelection (PRInt16 type, nsISelection **_retval)
 GetSelection no query interface for selection.
NS_IMETHOD ScrollSelectionIntoView (PRInt16 aType, PRInt16 aRegion, PRBool aIsSynchronous)
 ScrollSelectionIntoView scrolls a region of the selection, so that it is visible in the scrolled view.
NS_IMETHOD RepaintSelection (PRInt16 type)
NS_IMETHOD RepaintSelection (nsPresContext *aPresContext, SelectionType aSelectionType)
 RepaintSelection repaints the selected frames that are inside the selection specified by aSelectionType.
NS_IMETHOD SetCaretEnabled (PRBool enabled)
NS_IMETHOD SetCaretReadOnly (PRBool aReadOnly)
NS_IMETHOD GetCaretEnabled (PRBool *_retval)
NS_IMETHOD SetCaretVisibilityDuringSelection (PRBool aVisibility)
NS_IMETHOD CharacterMove (PRBool aForward, PRBool aExtend)
 CharacterMove will generally be called from the nsiselectioncontroller implementations.
NS_IMETHOD WordMove (PRBool aForward, PRBool aExtend)
 WordMove will generally be called from the nsiselectioncontroller implementations.
NS_IMETHOD LineMove (PRBool aForward, PRBool aExtend)
 LineMove will generally be called from the nsiselectioncontroller implementations.
NS_IMETHOD IntraLineMove (PRBool aForward, PRBool aExtend)
 IntraLineMove will generally be called from the nsiselectioncontroller implementations.
NS_IMETHOD PageMove (PRBool aForward, PRBool aExtend)
NS_IMETHOD CompleteScroll (PRBool aForward)
NS_IMETHOD CompleteMove (PRBool aForward, PRBool aExtend)
NS_IMETHOD ScrollPage (PRBool aForward)
NS_IMETHOD ScrollLine (PRBool aForward)
NS_IMETHOD ScrollHorizontal (PRBool aLeft)
NS_IMETHOD SelectAll (void)
 Select All will generally be called from the nsiselectioncontroller implementations.
NS_IMETHOD CheckVisibility (nsIDOMNode *node, PRInt16 startOffset, PRInt16 EndOffset, PRBool *_retval)
NS_IMETHOD Init (nsIPresShell *aShell, nsIContent *aLimiter)
 Init will initialize the frame selector with the necessary pres shell to be used by most of the methods.
NS_IMETHOD ShutDown ()
 ShutDown will be called when the owner of the frame selection is shutting down this should be the time to release all member variable interfaces.
NS_IMETHOD HandleTextEvent (nsGUIEvent *aGuiEvent)
 HandleKeyEvent will accept an event.
NS_IMETHOD HandleKeyEvent (nsPresContext *aPresContext, nsGUIEvent *aGuiEvent)
 HandleKeyEvent will accept an event and a PresContext.
NS_IMETHOD HandleClick (nsIContent *aNewFocus, PRUint32 aContentOffset, PRUint32 aContentEndOffset, PRBool aContinueSelection, PRBool aMultipleSelection, PRBool aHint)
 HandleClick will take the focus to the new frame at the new offset and will either extend the selection from the old anchor, or replace the old anchor.
NS_IMETHOD HandleDrag (nsPresContext *aPresContext, nsIFrame *aFrame, nsPoint &aPoint)
 HandleDrag extends the selection to contain the frame closest to aPoint.
NS_IMETHOD HandleTableSelection (nsIContent *aParentContent, PRInt32 aContentOffset, PRInt32 aTarget, nsMouseEvent *aMouseEvent)
 HandleTableSelection will set selection to a table, cell, etc depending on information contained in aFlags.
NS_IMETHOD StartAutoScrollTimer (nsPresContext *aPresContext, nsIView *aView, nsPoint &aPoint, PRUint32 aDelay)
 StartAutoScrollTimer is responsible for scrolling views so that aPoint is always visible, and for selecting any frame that contains aPoint.
NS_IMETHOD StopAutoScrollTimer ()
 StopAutoScrollTimer stops any active auto scroll timer.
NS_IMETHOD EnableFrameNotification (PRBool aEnable)
 EnableFrameNotification mutch like start batching, except all dirty calls are ignored.
NS_IMETHOD LookUpSelection (nsIContent *aContent, PRInt32 aContentOffset, PRInt32 aContentLength, SelectionDetails **aReturnDetails, PRBool aSlowCheck)
 Lookup Selection returns in frame coordinates the selection beginning and ending with the type of selection given.
NS_IMETHOD SetMouseDownState (PRBool aState)
 SetMouseDownState(PRBool); sets the mouse state to aState for resons of drag state.
NS_IMETHOD GetMouseDownState (PRBool *aState)
 GetMouseDownState(PRBool *); gets the mouse state to aState for resons of drag state.
NS_IMETHOD SetDelayCaretOverExistingSelection (PRBool aDelay)
 Allow applications to specify how we should place the caret when the user clicks over an existing selection.
NS_IMETHOD GetDelayCaretOverExistingSelection (PRBool *aDelay)
 Get the current delay caret setting.
NS_IMETHOD SetDelayedCaretData (nsMouseEvent *aMouseEvent)
 If we are delaying caret placement til MouseUp (see Set/GetDelayCaretOverExistingSelection()), this method can be used to store the data received during the MouseDown so that we can place the caret during the MouseUp event.
NS_IMETHOD GetDelayedCaretData (nsMouseEvent **aMouseEvent)
 Get the delayed MouseDown event data necessary to place the caret during MouseUp processing.
NS_IMETHOD GetLimiter (nsIContent **aLimiterContent)
 Get the content node that limits the selection When searching up a nodes for parents, as in a text edit field in an browser page, we must stop at this node else we reach into the parent page, which is very bad!
NS_IMETHOD GetTableCellSelection (PRBool *aState)
 if we are in table cell selection mode.
NS_IMETHOD GetFrameForNodeOffset (nsIContent *aNode, PRInt32 aOffset, HINT aHint, nsIFrame **aReturnFrame, PRInt32 *aReturnOffset)
 GetFrameForNodeOffset given a node and its child offset, return the nsIFrame and the offset into that frame.
NS_IMETHOD AdjustOffsetsFromStyle (nsIFrame *aFrame, PRBool *changeSelection, nsIContent **outContent, PRInt32 *outStartOffset, PRInt32 *outEndOffset)
 AdjustOffsetsFromStyle.
NS_IMETHOD GetHint (nsIFrameSelection::HINT *aHint)
NS_IMETHOD SetHint (nsIFrameSelection::HINT aHint)
NS_IMETHOD SetScrollableView (nsIScrollableView *aScrollableView)
NS_IMETHOD GetScrollableView (nsIScrollableView **aScrollableView)
NS_IMETHOD CommonPageMove (PRBool aForward, PRBool aExtend, nsIScrollableView *aScrollableView, nsIFrameSelection *aFrameSel)
 Scrolling then moving caret placement code in common to text areas and content areas should be located in the implementer This method will accept the following parameters and perform the scroll and caret movement.
NS_IMETHOD SetMouseDoubleDown (PRBool aDoubleDown)
 This will tell the frame selection that a double click has been pressed so it can track abort future drags if inside the same selection has the double click down happened.
NS_IMETHOD GetMouseDoubleDown (PRBool *aDoubleDown)
 This will return whether the double down flag was set.
NS_IMETHOD MaintainSelection ()
 MaintainSelection will track the current selection as being "sticky".
nsWeakPtrGetPresShell ()
void setDisplaySelection (in short toggle)
 SetDisplaySelection will set the display mode for the selection.
short getDisplaySelection ()
 GetDisplaySelection will get the display mode for the selection.
nsISelection getSelection (in short type)
 GetSelection will return the selection that the presentation shell may implement.
void scrollSelectionIntoView (in short type, in short region, in boolean isSynchronous)
 ScrollSelectionIntoView scrolls a region of the selection, so that it is visible in the scrolled view.
void repaintSelection (in short type)
 RepaintSelection repaints the selection specified by aType.
void setCaretEnabled (in boolean enabled)
 Set the caret as enabled or disabled.
void setCaretReadOnly (in boolean readOnly)
 Set the caret readonly or not.
boolean getCaretEnabled ()
 Gets the current state of the caret.
void setCaretVisibilityDuringSelection (in boolean visibility)
 Show the caret even in selections.
void characterMove (in boolean forward, in boolean extend)
 CharacterMove will move the selection one character forward/backward in the document.
void wordMove (in boolean forward, in boolean extend)
 WordMove will move the selection one word forward/backward in the document.
void lineMove (in boolean forward, in boolean extend)
 LineMove will move the selection one line forward/backward in the document.
void intraLineMove (in boolean forward, in boolean extend)
 IntraLineMove will move the selection to the front of the line or end of the line in the document.
void pageMove (in boolean forward, in boolean extend)
 PageMove will move the selection one page forward/backward in the document.
void completeScroll (in boolean forward)
 CompleteScroll will move page view to the top or bottom of the document.
void completeMove (in boolean forward, in boolean extend)
 CompleteMove will move page view to the top or bottom of the document this will also have the effect of collapsing the selection if the aExtend = PR_FALSE the "point" of selection that is extended is considered the "focus" point.
void scrollPage (in boolean forward)
 ScrollPage will scroll the page without affecting the selection.
void scrollLine (in boolean forward)
 ScrolLine will scroll line up or down dependent on the boolean.
void scrollHorizontal (in boolean left)
 ScrolHorizontal will scroll left or right dependent on the boolean.
void selectAll ()
 SelectAll will select the whole page.
boolean checkVisibility (in nsIDOMNode node, in short startOffset, in short endOffset)
 CheckVisibility will return true if textnode and offsets are actually rendered in the current precontext.
void setSelectionFlags (in short toggle)
short getSelectionFlags ()

Public Attributes

const short SELECTION_NONE = 0
const short SELECTION_NORMAL = 1
const short SELECTION_SPELLCHECK = 2
const short SELECTION_IME_RAWINPUT = 4
const short SELECTION_IME_SELECTEDRAWTEXT = 8
const short SELECTION_IME_CONVERTEDTEXT = 16
const short SELECTION_IME_SELECTEDCONVERTEDTEXT = 32
const short SELECTION_ACCESSIBILITY = 64
const short NUM_SELECTIONTYPES = 8
const short SELECTION_ANCHOR_REGION = 0
const short SELECTION_FOCUS_REGION = 1
const short NUM_SELECTION_REGIONS = 2
const short SELECTION_OFF = 0
const short SELECTION_HIDDEN = 1
const short SELECTION_ON = 2
const short SELECTION_DISABLED = 3
const short SELECTION_ATTENTION = 4
const short DISPLAY_TEXT = 1
const short DISPLAY_IMAGES = 2
const short DISPLAY_FRAMES = 4
const short DISPLAY_ALL = 7

Private Attributes

nsCOMPtr< nsIFrameSelectionmFrameSelection
nsCOMPtr< nsIContentmLimiter
nsWeakPtr mPresShellWeak

Detailed Description

Definition at line 546 of file nsTextControlFrame.cpp.


Member Enumeration Documentation

enum nsIFrameSelection::HINT [inherited]
Enumerator:
HINTLEFT 
HINTRIGHT 

Definition at line 135 of file nsIFrameSelection.h.

{ HINTLEFT = 0, HINTRIGHT = 1};  //end of this line or beginning of next

Constructor & Destructor Documentation

Definition at line 647 of file nsTextControlFrame.cpp.

{
  if (aSel && aShell)
  {
    mFrameSelection = aSel;//we are the owner now!
    mLimiter = aLimiter;
    mFrameSelection->Init(aShell, mLimiter);
    mPresShellWeak = do_GetWeakReference(aShell);
#ifdef IBMBIDI
    mBidiKeyboard = do_GetService("@mozilla.org/widget/bidikeyboard;1");
#endif
  }
}

Here is the call graph for this function:

Definition at line 552 of file nsTextControlFrame.cpp.

{}

Member Function Documentation

NS_IMETHODIMP nsTextInputSelectionImpl::AdjustOffsetsFromStyle ( nsIFrame aFrame,
PRBool changeSelection,
nsIContent **  outContent,
PRInt32 outStartOffset,
PRInt32 outEndOffset 
) [virtual]

AdjustOffsetsFromStyle.

Called after detecting that a click or drag will select the frame, this function looks for user-select style on that frame or a parent frame, and adjust the content and offsets accordingly.

Parameters:
aFramethe frame that was clicked
outContentcontent node to be selected
outStartOffsetselection start offset
outEndOffsetselection end offset

Implements nsIFrameSelection.

Definition at line 1156 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->AdjustOffsetsFromStyle(aFrame, changeSelection, outContent, outStartOffset, outEndOffset);
}
void nsISelectionController::characterMove ( in boolean  forward,
in boolean  extend 
) [inherited]

CharacterMove will move the selection one character forward/backward in the document.

this will also have the effect of collapsing the selection if the aExtend = PR_FALSE the "point" of selection that is extended is considered the "focus" point. or the last point adjusted by the selection.

Parameters:
aForwardforward or backward if PR_FALSE
aExtendshould it collapse the selection of extend it?
NS_IMETHODIMP nsTextInputSelectionImpl::CharacterMove ( PRBool  aForward,
PRBool  aExtend 
) [virtual]

CharacterMove will generally be called from the nsiselectioncontroller implementations.

the effect being the selection will move one character left or right.

Parameters:
aForwardmove forward in document.
aExtendcontinue selection

Implements nsIFrameSelection.

Definition at line 831 of file nsTextControlFrame.cpp.

{
  if (mFrameSelection)
    return mFrameSelection->CharacterMove(aForward, aExtend);
  return NS_ERROR_NULL_POINTER;
}
boolean nsISelectionController::checkVisibility ( in nsIDOMNode  node,
in short  startOffset,
in short  endOffset 
) [inherited]

CheckVisibility will return true if textnode and offsets are actually rendered in the current precontext.

Parameters:
aNodetextNode to test
aStartOffsetoffset in dom to first char of textnode to test
aEndOffsetoffset in dom to last char of textnode to test
aReturnBoolboolean returned TRUE if visible FALSE if not
NS_IMETHODIMP nsTextInputSelectionImpl::CheckVisibility ( nsIDOMNode node,
PRInt16  startOffset,
PRInt16  EndOffset,
PRBool _retval 
)

Definition at line 1001 of file nsTextControlFrame.cpp.

{
  if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED;
  nsresult result;
  nsCOMPtr<nsISelectionController> shell = do_QueryReferent(mPresShellWeak, &result);
  if (shell)
  {
    return shell->CheckVisibility(node,startOffset,EndOffset, _retval);
  }
  return NS_ERROR_FAILURE;

}

Here is the call graph for this function:

NS_IMETHODIMP nsTextInputSelectionImpl::CommonPageMove ( PRBool  aForward,
PRBool  aExtend,
nsIScrollableView aScrollableView,
nsIFrameSelection aFrameSel 
) [virtual]

Scrolling then moving caret placement code in common to text areas and content areas should be located in the implementer This method will accept the following parameters and perform the scroll and caret movement.

It remains for the caller to call the final ScrollCaretIntoView if that called wants to be sure the caret is always visible.

Parameters:
aForwardif PR_TRUE, scroll forward if not scroll backward
aExtendif PR_TRUE, extend selection to the new point
aScrollableViewthe view that needs the scrolling
aFrameSelthe nsIFrameSelection of the caller.
Returns:
always NS_OK

Implements nsIFrameSelection.

Definition at line 1197 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->CommonPageMove(aForward, aExtend, aScrollableView, this);
}
void nsISelectionController::completeMove ( in boolean  forward,
in boolean  extend 
) [inherited]

CompleteMove will move page view to the top or bottom of the document this will also have the effect of collapsing the selection if the aExtend = PR_FALSE the "point" of selection that is extended is considered the "focus" point.

or the last point adjusted by the selection.

Parameters:
aForwardforward or backward if PR_FALSE
aExtendshould it collapse the selection of extend it?

Definition at line 909 of file nsTextControlFrame.cpp.

{
  // grab the parent / root DIV for this text widget
  nsresult result;
  nsCOMPtr<nsIContent> parentDIV;
  result = GetLimiter(getter_AddRefs(parentDIV));
  if (NS_FAILED(result))
    return result;
  if (!parentDIV)
    return NS_ERROR_UNEXPECTED;

  // make the caret be either at the very beginning (0) or the very end
  PRInt32 offset = 0;
  HINT hint = HINTLEFT;
  if (aForward)
  {
    offset = parentDIV->GetChildCount();

    // Prevent the caret from being placed after the last
    // BR node in the content tree!

    if (offset > 0)
    {
      nsIContent *child = parentDIV->GetChildAt(offset - 1);

      if (child->Tag() == nsHTMLAtoms::br)
      {
        --offset;
        hint = HINTRIGHT; // for Bug 106855
      }
    }
  }

  result = mFrameSelection->HandleClick(parentDIV, offset, offset, aExtend, PR_FALSE, hint);

  // if we got this far, attempt to scroll no matter what the above result is
  return CompleteScroll(aForward);
}

Here is the call graph for this function:

CompleteScroll will move page view to the top or bottom of the document.

Parameters:
aForwardforward or backward if PR_FALSE

Definition at line 895 of file nsTextControlFrame.cpp.

{
  nsIScrollableView *scrollableView;
  nsresult result;
  result = GetScrollableView(&scrollableView);
  if (NS_FAILED(result))
    return result;
  if (!scrollableView)
    return NS_ERROR_NOT_INITIALIZED;

  return scrollableView->ScrollByWhole(!aForward); //TRUE = top, aForward TRUE=bottom
}

Here is the call graph for this function:

EnableFrameNotification mutch like start batching, except all dirty calls are ignored.

no notifications will go out until enableNotifications with a PR_TRUE is called

Implements nsIFrameSelection.

Definition at line 1085 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->EnableFrameNotification(aEnable);
}

Gets the current state of the caret.

Parameters:
aEnabled[OUT] set to the current caret state, as set by SetCaretEnabled
Returns:
if aOutEnabled==null, returns NS_ERROR_INVALID_ARG else NS_OK

Definition at line 787 of file nsTextControlFrame.cpp.

{
  if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED;
  nsresult result;
  nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShellWeak, &result);
  if (shell)
  {
    nsCOMPtr<nsICaret> caret;
    if (NS_SUCCEEDED(result = shell->GetCaret(getter_AddRefs(caret))))
    {
      nsCOMPtr<nsISelection> domSel;
      if (NS_SUCCEEDED(result = mFrameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(domSel))))
      {
        return caret->GetCaretVisible(_retval);
      }
    }

  }
  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Get the current delay caret setting.

If aDelay contains a return value of PR_TRUE, the caret is placed on MouseUp when clicking over an existing selection. If PR_FALSE, the selection is cleared and caret is placed immediately in all cases.

Parameters:
aDelaywill contain the return value.

Implements nsIFrameSelection.

Definition at line 1119 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->GetDelayCaretOverExistingSelection(aDelay);
}

Get the delayed MouseDown event data necessary to place the caret during MouseUp processing.

will contain a pointer to the event received by the selection during MouseDown processing. It can be NULL if the data is no longer valid.

Implements nsIFrameSelection.

Definition at line 1131 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->GetDelayedCaretData(aMouseEvent);
}

GetDisplaySelection will get the display mode for the selection.

OFF,ON,DISABLED

Implements nsIFrameSelection.

Definition at line 670 of file nsTextControlFrame.cpp.

{
  if (mFrameSelection)
    return mFrameSelection->GetDisplaySelection(aToggle);
  return NS_ERROR_NULL_POINTER;
}
NS_IMETHODIMP nsTextInputSelectionImpl::GetFrameForNodeOffset ( nsIContent aNode,
PRInt32  aOffset,
HINT  aHint,
nsIFrame **  aReturnFrame,
PRInt32 aReturnOffset 
) [virtual]

GetFrameForNodeOffset given a node and its child offset, return the nsIFrame and the offset into that frame.

Parameters:
aNodeinput parameter for the node to look at
aOffsetoffset into above node.
aReturnFramewill contain the return frame. MUST NOT BE NULL or will return error
aReturnOffsetwill contain offset into frame.

Implements nsIFrameSelection.

Definition at line 1150 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->GetFrameForNodeOffset(aNode, aOffset, aHint,aReturnFrame,aReturnOffset);
}

Implements nsIFrameSelection.

Definition at line 1162 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->GetHint(aHint);
}

Get the content node that limits the selection When searching up a nodes for parents, as in a text edit field in an browser page, we must stop at this node else we reach into the parent page, which is very bad!

Implements nsIFrameSelection.

Definition at line 1137 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->GetLimiter(aLimiterContent);
}

This will return whether the double down flag was set.

is the return boolean value

Implements nsIFrameSelection.

Definition at line 1187 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->GetMouseDoubleDown(aDoubleDown);
}

GetMouseDownState(PRBool *); gets the mouse state to aState for resons of drag state.

Parameters:
aStatewill hold the state of mousedown

Implements nsIFrameSelection.

Definition at line 1107 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->GetMouseDownState(aState);
}

Definition at line 631 of file nsTextControlFrame.cpp.

{return mPresShellWeak;}

Here is the caller graph for this function:

Implements nsIFrameSelection.

Definition at line 1177 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->GetScrollableView(aScrollableView);
}

GetSelection will return the selection that the presentation shell may implement.

Parameters:
aTypewill hold the type of selection //SelectionType
_returnwill hold the return value
NS_IMETHODIMP nsTextInputSelectionImpl::GetSelection ( PRInt16  aSelectionType,
nsISelection **  aSelection 
) [virtual]

GetSelection no query interface for selection.

must use this method now.

Parameters:
aSelectionTypeenum value defined in nsISelection for the seleciton you want.

Implements nsIFrameSelection.

Definition at line 691 of file nsTextControlFrame.cpp.

{
  if (mFrameSelection)
    return mFrameSelection->GetSelection(type, _retval);
  return NS_ERROR_NULL_POINTER;
}

Here is the caller graph for this function:

Definition at line 684 of file nsTextControlFrame.cpp.

{
  *aOutEnable = nsISelectionDisplay::DISPLAY_TEXT;
  return NS_OK; 
}

if we are in table cell selection mode.

aka ctrl click in table cell

Implements nsIFrameSelection.

Definition at line 1143 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->GetTableCellSelection(aState);
}
NS_IMETHODIMP nsTextInputSelectionImpl::HandleClick ( nsIContent aNewFocus,
PRUint32  aContentOffset,
PRUint32  aContentEndOffset,
PRBool  aContinueSelection,
PRBool  aMultipleSelection,
PRBool  aHint 
) [virtual]

HandleClick will take the focus to the new frame at the new offset and will either extend the selection from the old anchor, or replace the old anchor.

the old anchor and focus position may also be used to deselect things

Parameters:
aNewfocusis the content that wants the focus
aContentOffsetis the content offset of the parent aNewFocus
aContentOffsetEndis the content offset of the parent aNewFocus and is specified different when you need to select to and include both start and end points
aContinueSelectionis the flag that tells the selection to keep the old anchor point or not.
aMultipleSelectionwill tell the frame selector to replace /or not the old selection. cannot coexist with aContinueSelection
aHintwill tell the selection which direction geometrically to actually show the caret on. 1 = end of this line 0 = beggining of this line

Implements nsIFrameSelection.

Definition at line 1046 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->HandleClick(aNewFocus, aContentOffset, aContentEndOffset , 
                     aContinueSelection, aMultipleSelection, aHint);
}
NS_IMETHODIMP nsTextInputSelectionImpl::HandleDrag ( nsPresContext aPresContext,
nsIFrame aFrame,
nsPoint aPoint 
) [virtual]

HandleDrag extends the selection to contain the frame closest to aPoint.

Parameters:
aPresContextis the context to use when figuring out what frame contains the point.
aFrameis the parent of all frames to use when searching for the closest frame to the point.
aPointis relative to aFrame's parent view.

Implements nsIFrameSelection.

Definition at line 1055 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->HandleDrag(aPresContext, aFrame, aPoint);
}
NS_IMETHODIMP nsTextInputSelectionImpl::HandleKeyEvent ( nsPresContext aPresContext,
nsGUIEvent aGuiEvent 
) [virtual]

HandleKeyEvent will accept an event and a PresContext.

DOES NOT ADDREF

Parameters:
aGuiEventis the event that should be dealt with by aFocusFrame
aFrameis the frame that MAY handle the event

Implements nsIFrameSelection.

Definition at line 1039 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->HandleKeyEvent(aPresContext, aGuiEvent);
}
NS_IMETHODIMP nsTextInputSelectionImpl::HandleTableSelection ( nsIContent aParentContent,
PRInt32  aContentOffset,
PRInt32  aTarget,
nsMouseEvent aMouseEvent 
) [virtual]

HandleTableSelection will set selection to a table, cell, etc depending on information contained in aFlags.

Parameters:
aParentContentis the paretent of either a table or cell that user clicked or dragged the mouse in
aContentOffsetis the offset of the table or cell
aTargetindicates what to select (defined in nsISelectionPrivate.idl/nsISelectionPrivate.h): TABLESELECTION_CELL We should select a cell (content points to the cell) TABLESELECTION_ROW We should select a row (content points to any cell in row) TABLESELECTION_COLUMN We should select a row (content points to any cell in column) TABLESELECTION_TABLE We should select a table (content points to the table) TABLESELECTION_ALLCELLS We should select all cells (content points to any cell in table)
aMouseEventpassed in so we we can get where event occured and what keys are pressed

Implements nsIFrameSelection.

Definition at line 1062 of file nsTextControlFrame.cpp.

{
  // We should never have a table inside a text control frame!
  NS_ASSERTION(PR_TRUE, "Calling HandleTableSelection inside nsTextControlFrame!");
  return NS_OK;
}

HandleKeyEvent will accept an event.

DOES NOT ADDREF

Parameters:
aGuiEventis the event that should be dealt with by aFocusFrame
aFrameis the frame that MAY handle the event

Implements nsIFrameSelection.

Definition at line 1032 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->HandleTextEvent(aGuiEvent);
}
NS_IMETHODIMP nsTextInputSelectionImpl::Init ( nsIPresShell aShell,
nsIContent aLimiter 
) [virtual]

Init will initialize the frame selector with the necessary pres shell to be used by most of the methods.

Parameters:
aShellis the parameter to be used for most of the other calls for callbacks ect
aLimiterlimits the selection to nodes with aLimiter parents

Implements nsIFrameSelection.

Definition at line 1018 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->Init(aShell, aLimiter);
}

Here is the caller graph for this function:

void nsISelectionController::intraLineMove ( in boolean  forward,
in boolean  extend 
) [inherited]

IntraLineMove will move the selection to the front of the line or end of the line in the document.

this will also have the effect of collapsing the selection if the aExtend = PR_FALSE the "point" of selection that is extended is considered the "focus" point. or the last point adjusted by the selection.

Parameters:
aForwardforward or backward if PR_FALSE
aExtendshould it collapse the selection of extend it?
NS_IMETHODIMP nsTextInputSelectionImpl::IntraLineMove ( PRBool  aForward,
PRBool  aExtend 
) [virtual]

IntraLineMove will generally be called from the nsiselectioncontroller implementations.

the effect being the selection will move to beginning or end of line

Parameters:
aForwardmove forward in document.
aExtendcontinue selection

Implements nsIFrameSelection.

Definition at line 863 of file nsTextControlFrame.cpp.

{
  if (mFrameSelection)
    return mFrameSelection->IntraLineMove(aForward, aExtend);
  return NS_ERROR_NULL_POINTER;
}
void nsISelectionController::lineMove ( in boolean  forward,
in boolean  extend 
) [inherited]

LineMove will move the selection one line forward/backward in the document.

this will also have the effect of collapsing the selection if the aExtend = PR_FALSE the "point" of selection that is extended is considered the "focus" point. or the last point adjusted by the selection.

Parameters:
aForwardforward or backward if PR_FALSE
aExtendshould it collapse the selection of extend it?
NS_IMETHODIMP nsTextInputSelectionImpl::LineMove ( PRBool  aForward,
PRBool  aExtend 
) [virtual]

LineMove will generally be called from the nsiselectioncontroller implementations.

the effect being the selection will move one line up or down.

Parameters:
aForwardmove forward in document.
aExtendcontinue selection

Implements nsIFrameSelection.

Definition at line 849 of file nsTextControlFrame.cpp.

{
  if (mFrameSelection)
  {
    nsresult result = mFrameSelection->LineMove(aForward, aExtend);
    if (NS_FAILED(result))
      result = CompleteMove(aForward,aExtend);
    return result;
  }
  return NS_ERROR_NULL_POINTER;
}
NS_IMETHODIMP nsTextInputSelectionImpl::LookUpSelection ( nsIContent aContent,
PRInt32  aContentOffset,
PRInt32  aContentLength,
SelectionDetails **  aReturnDetails,
PRBool  aSlowCheck 
) [virtual]

Lookup Selection returns in frame coordinates the selection beginning and ending with the type of selection given.

Parameters:
aContentis the content asking
aContentOffsetis the starting content boundary
aContentLengthis the length of the content piece asking
aReturnDetailslinkedlist of return values for the selection.
aSlowCheckwill check using slow method with no shortcuts

Implements nsIFrameSelection.

Definition at line 1092 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->LookUpSelection(aContent, aContentOffset, aContentLength, aReturnDetails, aSlowCheck);
}

MaintainSelection will track the current selection as being "sticky".

Dragging or extending selection will never allow for a subset (or the whole) of the maintained selection to become unselected. Primary use: double click selecting then dragging on second click

Implements nsIFrameSelection.

Definition at line 1192 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->MaintainSelection();
}
void nsISelectionController::pageMove ( in boolean  forward,
in boolean  extend 
) [inherited]

PageMove will move the selection one page forward/backward in the document.

this will also have the effect of collapsing the selection if the aExtend = PR_FALSE the "point" of selection that is extended is considered the "focus" point. or the last point adjusted by the selection.

Parameters:
aForwardforward or backward if PR_FALSE
aExtendshould it collapse the selection of extend it?

Definition at line 872 of file nsTextControlFrame.cpp.

{
  // expected behavior for PageMove is to scroll AND move the caret
  // and to remain relative position of the caret in view. see Bug 4302.

  if (mPresShellWeak)
  {
    nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(mPresShellWeak);
    if (!presShell)
      return NS_ERROR_NULL_POINTER;

    //get the scroll view
    nsIScrollableView *scrollableView;
    nsresult result = GetScrollableView(&scrollableView);
    if (NS_FAILED(result))
      return result;

    CommonPageMove(aForward, aExtend, scrollableView, this);
  }
  return ScrollSelectionIntoView(nsISelectionController::SELECTION_NORMAL, nsISelectionController::SELECTION_FOCUS_REGION, PR_TRUE);
}

Here is the call graph for this function:

void nsISelectionController::repaintSelection ( in short  type) [inherited]

RepaintSelection repaints the selection specified by aType.

Parameters:
aTypespecifies the selection to repaint.

Definition at line 726 of file nsTextControlFrame.cpp.

{
  if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED;
  nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(mPresShellWeak);
  if (presShell)
  {
    nsPresContext *context = presShell->GetPresContext();
    if (context)
    {
      return mFrameSelection->RepaintSelection(context, type);
    }
  }
  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

NS_IMETHODIMP nsTextInputSelectionImpl::RepaintSelection ( nsPresContext aPresContext,
SelectionType  aSelectionType 
) [virtual]

RepaintSelection repaints the selected frames that are inside the selection specified by aSelectionType.

Parameters:
aSelectionTypeenum value defined in nsISelection for the seleciton you want.

Implements nsIFrameSelection.

Definition at line 742 of file nsTextControlFrame.cpp.

{
  return RepaintSelection(aSelectionType);
}

ScrolHorizontal will scroll left or right dependent on the boolean.

Parameters:
aLeftif true will scroll left. if not will scroll right.

Definition at line 978 of file nsTextControlFrame.cpp.

{
  nsIScrollableView *scrollableView;
  nsresult result;
  result = GetScrollableView(&scrollableView);
  if (NS_FAILED(result))
    return result;
  if (!scrollableView)
    return NS_ERROR_NOT_INITIALIZED;

  // will we have bug #7354 because we aren't forcing an update here?
  return scrollableView->ScrollByLines(aLeft ? -1 : 1, 0);
}

Here is the call graph for this function:

ScrolLine will scroll line up or down dependent on the boolean.

Parameters:
aForwardscroll forward or backwards in selection

Definition at line 963 of file nsTextControlFrame.cpp.

{
  nsIScrollableView *scrollableView;
  nsresult result;
  result = GetScrollableView(&scrollableView);
  if (NS_FAILED(result))
    return result;
  if (!scrollableView)
    return NS_ERROR_NOT_INITIALIZED;

  // will we have bug #7354 because we aren't forcing an update here?
  return scrollableView->ScrollByLines(0, aForward ? 1 : -1);
}

Here is the call graph for this function:

ScrollPage will scroll the page without affecting the selection.

Parameters:
aForwardscroll forward or backwards in selection

Definition at line 949 of file nsTextControlFrame.cpp.

{
  nsIScrollableView *scrollableView;
  nsresult result;
  result = GetScrollableView(&scrollableView);
  if (NS_FAILED(result))
    return result;
  if (!scrollableView)
    return NS_ERROR_NOT_INITIALIZED;

  return scrollableView->ScrollByPages(0, aForward ? 1 : -1);
}

Here is the call graph for this function:

void nsISelectionController::scrollSelectionIntoView ( in short  type,
in short  region,
in boolean  isSynchronous 
) [inherited]

ScrollSelectionIntoView scrolls a region of the selection, so that it is visible in the scrolled view.

Parameters:
aTypethe selection to scroll into view. //SelectionType
aRegionthe region inside the selection to scroll into view. //SelectionRegion
aIsSynchronouswhen true, scrolls the selection into view before returning. If false, posts a request which is processed at some point after the method returns.
NS_IMETHODIMP nsTextInputSelectionImpl::ScrollSelectionIntoView ( PRInt16  aSelectionType,
PRInt16  aRegion,
PRBool  aIsSynchronous 
) [virtual]

ScrollSelectionIntoView scrolls a region of the selection, so that it is visible in the scrolled view.

Parameters:
aTypethe selection to scroll into view.
aRegionthe region inside the selection to scroll into view.
aIsSynchronouswhen PR_TRUE, scrolls the selection into view at some point after the method returns.request which is processed

Implements nsIFrameSelection.

Definition at line 699 of file nsTextControlFrame.cpp.

{
  if (mFrameSelection) {
    nsresult rv = mFrameSelection->ScrollSelectionIntoView(aType, aRegion, aIsSynchronous);

    nsIScrollableView* scrollableView = nsnull;
    GetScrollableView(&scrollableView);
    if (!scrollableView) {
      return rv;
    }
    nsIView* view = nsnull;
    scrollableView->GetScrolledView(view);
    if (!view) {
      return rv;
    }
    const nsRect portRect = scrollableView->View()->GetBounds();
    const nsRect viewRect = view->GetBounds();
    if (viewRect.XMost() < portRect.width) {
      return scrollableView->ScrollTo(PR_MAX(viewRect.width - portRect.width, 0), viewRect.y, 0);
    }

    return rv;
  }
  return NS_ERROR_NULL_POINTER;
}

Here is the call graph for this function:

SelectAll will select the whole page.

Select All will generally be called from the nsiselectioncontroller implementations.

it will select the whole doc

Implements nsIFrameSelection.

Definition at line 993 of file nsTextControlFrame.cpp.

{
  if (mFrameSelection)
    return mFrameSelection->SelectAll();
  return NS_ERROR_NULL_POINTER;
}

Set the caret as enabled or disabled.

An enabled caret will draw or blink when made visible. A disabled caret will never show up. Can be called any time.

Parameters:
aEnablePR_TRUE to enable caret. PR_FALSE to disable.
Returns:
always NS_OK

Definition at line 748 of file nsTextControlFrame.cpp.

{
  if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED;

  nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShellWeak);
  if (!shell) return NS_ERROR_FAILURE;

  // tell the pres shell to enable the caret, rather than settings its visibility directly.
  // this way the presShell's idea of caret visibility is maintained.
  nsCOMPtr<nsISelectionController> selCon = do_QueryInterface(shell);
  if (!selCon) return NS_ERROR_NO_INTERFACE;
  selCon->SetCaretEnabled(enabled);

  return NS_OK;
}

Here is the call graph for this function:

Set the caret readonly or not.

An readonly caret will draw but not blink when made visible.

Parameters:
aReadOnlyPR_TRUE to enable caret. PR_FALSE to disable.
Returns:
always NS_OK

Definition at line 765 of file nsTextControlFrame.cpp.

{
  if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED;
  nsresult result;
  nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShellWeak, &result);
  if (shell)
  {
    nsCOMPtr<nsICaret> caret;
    if (NS_SUCCEEDED(result = shell->GetCaret(getter_AddRefs(caret))))
    {
      nsCOMPtr<nsISelection> domSel;
      if (NS_SUCCEEDED(result = mFrameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(domSel))))
      {
        return caret->SetCaretReadOnly(aReadOnly);
      }
    }

  }
  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Show the caret even in selections.

By default the caret is hidden unless the selection is collapsed. Use this function to show the caret even in selections.

Parameters:
aVisibilityPR_TRUE to show the caret in selections. PR_FALSE to hide.
Returns:
always NS_OK

Definition at line 809 of file nsTextControlFrame.cpp.

{
  if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED;
  nsresult result;
  nsCOMPtr<nsIPresShell> shell = do_QueryReferent(mPresShellWeak, &result);
  if (shell)
  {
    nsCOMPtr<nsICaret> caret;
    if (NS_SUCCEEDED(result = shell->GetCaret(getter_AddRefs(caret))))
    {
      nsCOMPtr<nsISelection> domSel;
      if (NS_SUCCEEDED(result = mFrameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(domSel))))
      {
        return caret->SetVisibilityDuringSelection(aVisibility);
      }
    }

  }
  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Allow applications to specify how we should place the caret when the user clicks over an existing selection.

A aDelay value of PR_TRUE means delay clearing the selection and placing the caret until MouseUp, when the user clicks over an existing selection. This is especially usefull when applications want to support Drag & Drop of the current selection. A value of PR_FALSE means place the caret immediately. If the application never calls this method, the nsIFrameSelection implementation assumes the default value is PR_TRUE.

Parameters:
aDelayPR_TRUE if we should delay caret placement.

Implements nsIFrameSelection.

Definition at line 1113 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->SetDelayCaretOverExistingSelection(aDelay);
}

If we are delaying caret placement til MouseUp (see Set/GetDelayCaretOverExistingSelection()), this method can be used to store the data received during the MouseDown so that we can place the caret during the MouseUp event.

the event received by the selection MouseDown handling method. A NULL value can be use to tell this method that any data is storing is no longer valid.

Implements nsIFrameSelection.

Definition at line 1125 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->SetDelayedCaretData(aMouseEvent);
}
void nsISelectionController::setDisplaySelection ( in short  toggle) [inherited]

SetDisplaySelection will set the display mode for the selection.

OFF,ON,DISABLED

Sets/Gets The display selection enum.

Implements nsIFrameSelection.

Definition at line 662 of file nsTextControlFrame.cpp.

{
  if (mFrameSelection)
    return mFrameSelection->SetDisplaySelection(aToggle);
  return NS_ERROR_NULL_POINTER;
}

Implements nsIFrameSelection.

Definition at line 1167 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->SetHint(aHint);
}

This will tell the frame selection that a double click has been pressed so it can track abort future drags if inside the same selection has the double click down happened.

Implements nsIFrameSelection.

Definition at line 1182 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->SetMouseDoubleDown(aDoubleDown);
}

SetMouseDownState(PRBool); sets the mouse state to aState for resons of drag state.

Parameters:
aStateis the new state of mousedown

Implements nsIFrameSelection.

Definition at line 1100 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->SetMouseDownState(aState);
}

Implements nsIFrameSelection.

Definition at line 1172 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->SetScrollableView(aScrollableView);
}

Here is the caller graph for this function:

void nsISelectionDisplay::setSelectionFlags ( in short  toggle) [inherited]

Definition at line 678 of file nsTextControlFrame.cpp.

{
  return NS_OK;//stub this out. not used in input
}

ShutDown will be called when the owner of the frame selection is shutting down this should be the time to release all member variable interfaces.

all methods called after ShutDown should return NS_ERROR_FAILURE

Implements nsIFrameSelection.

Definition at line 1025 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->ShutDown();
}
NS_IMETHODIMP nsTextInputSelectionImpl::StartAutoScrollTimer ( nsPresContext aPresContext,
nsIView aFrame,
nsPoint aPoint,
PRUint32  aDelay 
) [virtual]

StartAutoScrollTimer is responsible for scrolling views so that aPoint is always visible, and for selecting any frame that contains aPoint.

The timer will also reset itself to fire again if we have not scrolled to the end of the document.

Parameters:
aPresContextis the context to use when figuring out what frame contains the point.
aViewis view to use when searching for the closest frame to the point, which is the view that is capturing the mouse
aPointis relative to the view.
aDelayis the timer's interval.

Implements nsIFrameSelection.

Definition at line 1071 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->StartAutoScrollTimer(aPresContext, aView, aPoint, aDelay);
}

StopAutoScrollTimer stops any active auto scroll timer.

Implements nsIFrameSelection.

Definition at line 1078 of file nsTextControlFrame.cpp.

{
  return mFrameSelection->StopAutoScrollTimer();
}
void nsISelectionController::wordMove ( in boolean  forward,
in boolean  extend 
) [inherited]

WordMove will move the selection one word forward/backward in the document.

this will also have the effect of collapsing the selection if the aExtend = PR_FALSE the "point" of selection that is extended is considered the "focus" point. or the last point adjusted by the selection.

Parameters:
aForwardforward or backward if PR_FALSE
aExtendshould it collapse the selection of extend it?
NS_IMETHODIMP nsTextInputSelectionImpl::WordMove ( PRBool  aForward,
PRBool  aExtend 
) [virtual]

WordMove will generally be called from the nsiselectioncontroller implementations.

the effect being the selection will move one word left or right.

Parameters:
aForwardmove forward in document.
aExtendcontinue selection

Implements nsIFrameSelection.

Definition at line 840 of file nsTextControlFrame.cpp.

{
  if (mFrameSelection)
    return mFrameSelection->WordMove(aForward, aExtend);
  return NS_ERROR_NULL_POINTER;
}

Member Data Documentation

const short nsISelectionDisplay::DISPLAY_ALL = 7 [inherited]

Definition at line 47 of file nsISelectionDisplay.idl.

Definition at line 46 of file nsISelectionDisplay.idl.

Definition at line 45 of file nsISelectionDisplay.idl.

Definition at line 44 of file nsISelectionDisplay.idl.

Definition at line 633 of file nsTextControlFrame.cpp.

Definition at line 634 of file nsTextControlFrame.cpp.

Definition at line 635 of file nsTextControlFrame.cpp.

Definition at line 69 of file nsISelectionController.idl.

Definition at line 65 of file nsISelectionController.idl.

Definition at line 64 of file nsISelectionController.idl.

Definition at line 67 of file nsISelectionController.idl.

Definition at line 75 of file nsISelectionController.idl.

Definition at line 74 of file nsISelectionController.idl.

Definition at line 68 of file nsISelectionController.idl.

Definition at line 72 of file nsISelectionController.idl.

Definition at line 62 of file nsISelectionController.idl.

Definition at line 60 of file nsISelectionController.idl.

Definition at line 63 of file nsISelectionController.idl.

Definition at line 61 of file nsISelectionController.idl.

Definition at line 57 of file nsISelectionController.idl.

Definition at line 58 of file nsISelectionController.idl.

Definition at line 71 of file nsISelectionController.idl.

Definition at line 73 of file nsISelectionController.idl.

Definition at line 59 of file nsISelectionController.idl.


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