Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes
inDOMView Class Reference

#include <inDOMView.h>

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

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_INIDOMVIEW
NS_DECL_NSITREEVIEW 
inDOMView ()
virtual ~inDOMView ()
nsIDOMNode getNodeFromRowIndex (in long rowIndex)
long getRowIndexFromNode (in nsIDOMNode node)
void rebuild ()
void getRowProperties (in long index, in nsISupportsArray properties)
 An atomized list of properties for a given row.
void getCellProperties (in long row, in nsITreeColumn col, in nsISupportsArray properties)
 An atomized list of properties for a given cell.
void getColumnProperties (in nsITreeColumn col, in nsISupportsArray properties)
 Called to get properties to paint a column background.
boolean isContainer (in long index)
 Methods that can be used to test whether or not a twisty should be drawn, and if so, whether an open or closed twisty should be used.
boolean isContainerOpen (in long index)
boolean isContainerEmpty (in long index)
boolean isSeparator (in long index)
 isSeparator is used to determine if the row at index is a separator.
boolean isSorted ()
 Specifies if there is currently a sort on any column.
boolean canDrop (in long index, in long orientation)
 Methods used by the drag feedback code to determine if a drag is allowable at the current location.
void drop (in long row, in long orientation)
 Called when the user drops something on this view.
long getParentIndex (in long rowIndex)
 Methods used by the tree to draw thread lines in the tree.
boolean hasNextSibling (in long rowIndex, in long afterIndex)
 hasNextSibling is used to determine if the row at rowIndex has a nextSibling that occurs after the index specified by afterIndex.
long getLevel (in long index)
 The level is an integer value that represents the level of indentation.
AString getImageSrc (in long row, in nsITreeColumn col)
 The image path for a given cell.
long getProgressMode (in long row, in nsITreeColumn col)
AString getCellValue (in long row, in nsITreeColumn col)
 The value for a given cell.
AString getCellText (in long row, in nsITreeColumn col)
 The text for a given cell.
void setTree (in nsITreeBoxObject tree)
 Called during initialization to link the view to the front end box object.
void toggleOpenState (in long index)
 Called on the view when an item is opened or closed.
void cycleHeader (in nsITreeColumn col)
 Called on the view when a header is clicked.
void selectionChanged ()
 Should be called from a XUL onselect handler whenever the selection changes.
void cycleCell (in long row, in nsITreeColumn col)
 Called on the view when a cell in a non-selectable cycling column (e.g., unread/flag/etc.) is clicked.
boolean isEditable (in long row, in nsITreeColumn col)
 isEditable is called to ask the view if the cell contents are editable.
void setCellValue (in long row, in nsITreeColumn col, in AString value)
 setCellValue is called when the value of the cell has been set by the user.
void setCellText (in long row, in nsITreeColumn col, in AString value)
 setCellText is called when the contents of the cell have been edited by the user.
void performAction (in wstring action)
 A command API that can be used to invoke commands on the selection.
void performActionOnRow (in wstring action, in long row)
 A command API that can be used to invoke commands on a specific row.
void performActionOnCell (in wstring action, in long row, in nsITreeColumn col)
 A command API that can be used to invoke commands on a specific cell.
virtual void BeginUpdate (nsIDocument *aDocument, nsUpdateType aUpdateType)=0
 Notify that a content model update is beginning.
virtual void EndUpdate (nsIDocument *aDocument, nsUpdateType aUpdateType)=0
 Notify that a content model update is finished.
virtual void BeginLoad (nsIDocument *aDocument)=0
 Notify the observer that a document load is beginning.
virtual void EndLoad (nsIDocument *aDocument)=0
 Notify the observer that a document load has finished.
virtual void BeginReflow (nsIDocument *aDocument, nsIPresShell *aShell)=0
 Notify the observer that the document is being reflowed in the given presentation shell.
virtual void EndReflow (nsIDocument *aDocument, nsIPresShell *aShell)=0
 Notify the observer that the document is done being reflowed in the given presentation shell.
virtual void CharacterDataChanged (nsIDocument *aDocument, nsIContent *aContent, PRBool aAppend)=0
 Notification that the content model has changed.
virtual void ContentStatesChanged (nsIDocument *aDocument, nsIContent *aContent1, nsIContent *aContent2, PRInt32 aStateMask)=0
 Notification that the state of a content node has changed.
virtual void AttributeChanged (nsIDocument *aDocument, nsIContent *aContent, PRInt32 aNameSpaceID, nsIAtom *aAttribute, PRInt32 aModType)=0
 Notification that the content model has changed.
virtual void ContentAppended (nsIDocument *aDocument, nsIContent *aContainer, PRInt32 aNewIndexInContainer)=0
 Notifcation that the content model has had data appended to the given content object.
virtual void ContentInserted (nsIDocument *aDocument, nsIContent *aContainer, nsIContent *aChild, PRInt32 aIndexInContainer)=0
 Notification that content has been inserted.
virtual void ContentRemoved (nsIDocument *aDocument, nsIContent *aContainer, nsIContent *aChild, PRInt32 aIndexInContainer)=0
 Content has just been removed.
virtual void StyleSheetAdded (nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, PRBool aDocumentSheet)=0
 A StyleSheet has just been added to the document.
virtual void StyleSheetRemoved (nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, PRBool aDocumentSheet)=0
 A StyleSheet has just been removed from the document.
virtual void StyleSheetApplicableStateChanged (nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, PRBool aApplicable)=0
 A StyleSheet has just changed its applicable state.
virtual void StyleRuleChanged (nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, nsIStyleRule *aOldStyleRule, nsIStyleRule *aNewStyleRule)=0
 A StyleRule has just been modified within a style sheet.
virtual void StyleRuleAdded (nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, nsIStyleRule *aStyleRule)=0
 A StyleRule has just been added to a style sheet.
virtual void StyleRuleRemoved (nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, nsIStyleRule *aStyleRule)=0
 A StyleRule has just been removed from a style sheet.
virtual void DocumentWillBeDestroyed (nsIDocument *aDocument)=0
 The document is in the process of being destroyed.

Static Public Member Functions

static
NS_DECL_NSIDOCUMENTOBSERVER
void 
InitAtoms ()

Public Attributes

attribute nsIDOMNode rootNode
attribute boolean showAnonymousContent
attribute boolean showSubDocuments
attribute boolean showWhitespaceNodes
attribute unsigned long whatToShow
readonly attribute long rowCount
 The total number of rows in the tree (including the offscreen rows).
attribute nsITreeSelection selection
 The selection for this view.
const short DROP_BEFORE = -1
const short DROP_ON = 0
const short DROP_AFTER = 1
const short PROGRESS_NORMAL = 1
 The progress mode for a given cell.
const short PROGRESS_UNDETERMINED = 2
const short PROGRESS_NONE = 3

Protected Member Functions

inDOMViewNodeGetNodeAt (PRInt32 aIndex)
PRInt32 GetRowCount ()
PRBool RowOutOfBounds (PRInt32 aRow, PRInt32 aCount)
inDOMViewNodeCreateNode (nsIDOMNode *aNode, inDOMViewNode *aParent)
void AppendNode (inDOMViewNode *aNode)
void InsertNode (inDOMViewNode *aNode, PRInt32 aIndex)
void RemoveNode (PRInt32 aIndex)
void ReplaceNode (inDOMViewNode *aNode, PRInt32 aIndex)
void InsertNodes (nsVoidArray &aNodes, PRInt32 aIndex)
void RemoveNodes (PRInt32 aIndex, PRInt32 aCount)
void RemoveAllNodes ()
void ExpandNode (PRInt32 aRow)
void CollapseNode (PRInt32 aRow)
nsresult RowToNode (PRInt32 aRow, inDOMViewNode **aNode)
nsresult NodeToRow (nsIDOMNode *aNode, PRInt32 *aRow)
void InsertLinkAfter (inDOMViewNode *aNode, inDOMViewNode *aInsertAfter)
void InsertLinkBefore (inDOMViewNode *aNode, inDOMViewNode *aInsertBefore)
void RemoveLink (inDOMViewNode *aNode)
void ReplaceLink (inDOMViewNode *aNewNode, inDOMViewNode *aOldNode)
nsresult GetChildNodesFor (nsIDOMNode *aNode, nsCOMArray< nsIDOMNode > &aResult)
nsresult AppendKidsToArray (nsIDOMNodeList *aKids, nsCOMArray< nsIDOMNode > &aArray)
nsresult AppendAttrsToArray (nsIDOMNamedNodeMap *aKids, nsCOMArray< nsIDOMNode > &aArray)
nsresult GetFirstDescendantOf (inDOMViewNode *aNode, PRInt32 aRow, PRInt32 *aResult)
nsresult GetLastDescendantOf (inDOMViewNode *aNode, PRInt32 aRow, PRInt32 *aResult)
nsresult GetRealPreviousSibling (nsIDOMNode *aNode, nsIDOMNode *aRealParent, nsIDOMNode **aSibling)

Protected Attributes

nsCOMPtr< nsITreeBoxObjectmTree
nsCOMPtr< nsITreeSelectionmSelection
nsCOMPtr< inIDOMUtilsmDOMUtils
PRPackedBool mShowAnonymous
PRPackedBool mShowSubDocuments
PRPackedBool mShowWhitespaceNodes
PRUint32 mWhatToShow
nsCOMPtr< nsIDOMNodemRootNode
nsCOMPtr< nsIDOMDocumentmRootDocument
nsVoidArray mNodes

Static Protected Attributes

static nsIAtomkAnonymousAtom = nsnull
static nsIAtomkElementNodeAtom = nsnull
static nsIAtomkAttributeNodeAtom = nsnull
static nsIAtomkTextNodeAtom = nsnull
static nsIAtomkCDataSectionNodeAtom = nsnull
static nsIAtomkEntityReferenceNodeAtom = nsnull
static nsIAtomkEntityNodeAtom = nsnull
static nsIAtomkProcessingInstructionNodeAtom = nsnull
static nsIAtomkCommentNodeAtom = nsnull
static nsIAtomkDocumentNodeAtom = nsnull
static nsIAtomkDocumentTypeNodeAtom = nsnull
static nsIAtomkDocumentFragmentNodeAtom = nsnull
static nsIAtomkNotationNodeAtom = nsnull
static const nsStaticAtom Atoms_info []

Detailed Description

Definition at line 55 of file inDOMView.h.


Constructor & Destructor Documentation

inDOMView::~inDOMView ( ) [virtual]

Definition at line 125 of file inDOMView.cpp.

{
  SetRootNode(nsnull);
}

Member Function Documentation

Definition at line 1237 of file inDOMView.cpp.

{
  PRUint32 l = 0;
  aKids->GetLength(&l);
  nsCOMPtr<nsIDOMNode> kid;
  for (PRUint32 i = 0; i < l; ++i) {
    aKids->Item(i, getter_AddRefs(kid));
    aArray.AppendObject(kid);
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult inDOMView::AppendKidsToArray ( nsIDOMNodeList aKids,
nsCOMArray< nsIDOMNode > &  aArray 
) [protected]

Definition at line 1189 of file inDOMView.cpp.

{
  PRUint32 l = 0;
  aKids->GetLength(&l);
  nsCOMPtr<nsIDOMNode> kid;
  PRUint16 nodeType = 0;

  // Try and get DOM Utils in case we don't have one yet.
  if (mShowWhitespaceNodes && !mDOMUtils) {
    mDOMUtils = do_CreateInstance("@mozilla.org/inspector/dom-utils;1");
  }

  for (PRUint32 i = 0; i < l; ++i) {
    aKids->Item(i, getter_AddRefs(kid));
    kid->GetNodeType(&nodeType);

    NS_ASSERTION(nodeType && nodeType <= nsIDOMNode::NOTATION_NODE,
                 "Unknown node type. "
                 "Were new types added to the spec?");
    // As of DOM Level 2 Core and Traversal, each NodeFilter constant
    // is defined as the lower nth bit in the NodeFilter bitmask,
    // where n is the numeric constant of the nodeType it represents.
    // If this invariant ever changes, we will need to update the
    // following line.
    PRUint32 filterForNodeType = 1 << (nodeType - 1);

    if (mWhatToShow & filterForNodeType) {
      if ((nodeType == nsIDOMNode::TEXT_NODE ||
           nodeType == nsIDOMNode::COMMENT_NODE) &&
          !mShowWhitespaceNodes && mDOMUtils) {
        nsCOMPtr<nsIDOMCharacterData> data = do_QueryInterface(kid);
        NS_ASSERTION(data, "Does not implement nsIDOMCharacterData!");
        PRBool ignore;
        mDOMUtils->IsIgnorableWhitespace(data, &ignore);
        if (ignore) {
          continue;
        }
      }

      aArray.AppendObject(kid);
    }
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void inDOMView::AppendNode ( inDOMViewNode aNode) [protected]

Definition at line 909 of file inDOMView.cpp.

{
  mNodes.AppendElement(aNode);
}

Here is the caller graph for this function:

virtual void nsIDocumentObserver::AttributeChanged ( nsIDocument aDocument,
nsIContent aContent,
PRInt32  aNameSpaceID,
nsIAtom aAttribute,
PRInt32  aModType 
) [pure virtual, inherited]

Notification that the content model has changed.

This method is called automatically by content objects when an attribute's value has changed (therefore there is normally no need to invoke this method directly). The notification is passed to any IDocumentObservers document observers.

Parameters:
aDocumentThe document being observed
aContentthe piece of content whose attribute changed
aAttributethe atom name of the attribute
aModTypeWhether or not the attribute was added, changed, or removed. The constants are defined in nsIDOMMutationEvent.h.

Implemented in PresShell, nsContentList, nsXULContentBuilder, nsXULTemplateBuilder, nsImageMap, nsTreeContentView, and nsXMLPrettyPrinter.

virtual void nsIDocumentObserver::BeginLoad ( nsIDocument aDocument) [pure virtual, inherited]

Notify the observer that a document load is beginning.

Implemented in PresShell.

virtual void nsIDocumentObserver::BeginReflow ( nsIDocument aDocument,
nsIPresShell aShell 
) [pure virtual, inherited]

Notify the observer that the document is being reflowed in the given presentation shell.

virtual void nsIDocumentObserver::BeginUpdate ( nsIDocument aDocument,
nsUpdateType  aUpdateType 
) [pure virtual, inherited]

Notify that a content model update is beginning.

This call can be nested.

Implemented in nsFragmentObserver, PresShell, HTMLContentSink, and nsXMLPrettyPrinter.

boolean nsITreeView::canDrop ( in long  index,
in long  orientation 
) [inherited]

Methods used by the drag feedback code to determine if a drag is allowable at the current location.

To get the behavior where drops are only allowed on items, such as the mailNews folder pane, always return false when the orientation is not DROP_ON.

virtual void nsIDocumentObserver::CharacterDataChanged ( nsIDocument aDocument,
nsIContent aContent,
PRBool  aAppend 
) [pure virtual, inherited]

Notification that the content model has changed.

This method is called automatically by content objects when their state is changed (therefore there is normally no need to invoke this method directly). The notification is passed to any IDocumentObservers. The notification is passed on to all of the document observers.

This notification is not sent when a piece of content is added/removed from the document (the other notifications are used for that).

Parameters:
aDocumentThe document being observed
aContentthe piece of content that changed
aAppendWhether the change was an append

Implemented in PresShell.

void inDOMView::CollapseNode ( PRInt32  aRow) [protected]

Definition at line 1010 of file inDOMView.cpp.

{
  inDOMViewNode* node = nsnull;
  RowToNode(aRow, &node);

  PRInt32 row = 0;
  GetLastDescendantOf(node, aRow, &row);

  RemoveNodes(aRow+1, row-aRow);

  node->isOpen = PR_FALSE;
}

Here is the call graph for this function:

virtual void nsIDocumentObserver::ContentAppended ( nsIDocument aDocument,
nsIContent aContainer,
PRInt32  aNewIndexInContainer 
) [pure virtual, inherited]

Notifcation that the content model has had data appended to the given content object.

This method is called automatically by the content container objects when a new content object is appended to the container (therefore there is normally no need to invoke this method directly). The notification is passed on to all of the document observers.

Parameters:
aDocumentThe document being observed
aContainerthe container that had a new child appended
aNewIndexInContainerthe index in the container of the first new child

Implemented in PresShell, nsContentList, nsBindingManager, nsImageMap, nsTreeContentView, and nsXMLPrettyPrinter.

virtual void nsIDocumentObserver::ContentInserted ( nsIDocument aDocument,
nsIContent aContainer,
nsIContent aChild,
PRInt32  aIndexInContainer 
) [pure virtual, inherited]

Notification that content has been inserted.

This method is called automatically by the content container objects when a new content object is inserted in the container (therefore there is normally no need to invoke this method directly). The notification is passed on to all of the document observers.

Parameters:
aDocumentThe document being observed
aContainerthe container that now contains aChild
aChildthe child that was inserted
aIndexInContainerthe index of the child in the container

Implemented in PresShell, nsContentList, nsBindingManager, nsImageMap, nsTreeContentView, and nsXMLPrettyPrinter.

virtual void nsIDocumentObserver::ContentRemoved ( nsIDocument aDocument,
nsIContent aContainer,
nsIContent aChild,
PRInt32  aIndexInContainer 
) [pure virtual, inherited]

Content has just been removed.

This method is called automatically by content container objects when a content object has just been removed from the container (therefore there is normally no need to invoke this method directly). The notification is passed on to all of the document observers.

Parameters:
aDocumentThe document being observed
aContainerthe container that had a child removed
aChildthe child that was just removed
aIndexInContainerthe index of the child in the container before it was removed

Implemented in PresShell, nsContentList, nsBindingManager, nsImageMap, nsTreeContentView, and nsXMLPrettyPrinter.

virtual void nsIDocumentObserver::ContentStatesChanged ( nsIDocument aDocument,
nsIContent aContent1,
nsIContent aContent2,
PRInt32  aStateMask 
) [pure virtual, inherited]

Notification that the state of a content node has changed.

(ie: gained or lost focus, became active or hovered over) This method is called automatically by content objects when their state is changed (therefore there is normally no need to invoke this method directly). The notification is passed to any IDocumentObservers. The notification is passed on to all of the document observers.

This notification is not sent when a piece of content is added/removed from the document or the content itself changed (the other notifications are used for that).

The optional second content node is to allow optimization of the case where state moves from one node to another (as is likely for :focus and :hover)

Either content node may be nsnull, but not both

Parameters:
aDocumentThe document being observed
aContent1the piece of content that changed
aContent2optional second piece of content that changed

Implemented in PresShell, and nsTreeContentView.

inDOMViewNode * inDOMView::CreateNode ( nsIDOMNode aNode,
inDOMViewNode aParent 
) [protected]

Definition at line 890 of file inDOMView.cpp.

{
  inDOMViewNode* viewNode = new inDOMViewNode(aNode);
  viewNode->level = aParent ? aParent->level+1 : 0;
  viewNode->parent = aParent;

  nsCOMArray<nsIDOMNode> grandKids;
  GetChildNodesFor(aNode, grandKids);
  viewNode->isContainer = (grandKids.Count() > 0);
  return viewNode;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsITreeView::cycleCell ( in long  row,
in nsITreeColumn  col 
) [inherited]

Called on the view when a cell in a non-selectable cycling column (e.g., unread/flag/etc.) is clicked.

Called on the view when a header is clicked.

virtual void nsIDocumentObserver::DocumentWillBeDestroyed ( nsIDocument aDocument) [pure virtual, inherited]

The document is in the process of being destroyed.

This method is called automatically during document destruction.

Parameters:
aDocumentThe document being observed

Implemented in nsFragmentObserver, nsDOMStyleSheetList, nsContentList, nsBindingManager, nsXULContentBuilder, nsXULTreeBuilder, nsXULTemplateBuilder, nsTreeContentView, and nsXMLPrettyPrinter.

void nsITreeView::drop ( in long  row,
in long  orientation 
) [inherited]

Called when the user drops something on this view.

The |orientation| param specifies before/on/after the given |row|.

virtual void nsIDocumentObserver::EndLoad ( nsIDocument aDocument) [pure virtual, inherited]

Notify the observer that a document load has finished.

Note that the associated reflow of the document will be done before EndLoad is invoked, not after.

Implemented in PresShell.

virtual void nsIDocumentObserver::EndReflow ( nsIDocument aDocument,
nsIPresShell aShell 
) [pure virtual, inherited]

Notify the observer that the document is done being reflowed in the given presentation shell.

virtual void nsIDocumentObserver::EndUpdate ( nsIDocument aDocument,
nsUpdateType  aUpdateType 
) [pure virtual, inherited]

Notify that a content model update is finished.

This call can be nested.

Implemented in PresShell, HTMLContentSink, and nsXMLPrettyPrinter.

void inDOMView::ExpandNode ( PRInt32  aRow) [protected]

Definition at line 978 of file inDOMView.cpp.

{
  inDOMViewNode* node = nsnull;
  RowToNode(aRow, &node);

  nsCOMArray<nsIDOMNode> kids;
  GetChildNodesFor(node ? node->node : mRootNode,
                   kids);
  PRInt32 kidCount = kids.Count();

  nsVoidArray list(kidCount);

  inDOMViewNode* newNode = nsnull;
  inDOMViewNode* prevNode = nsnull;

  for (PRInt32 i = 0; i < kidCount; ++i) {
    newNode = CreateNode(kids[i], node);
    list.ReplaceElementAt(newNode, i);

    if (prevNode)
      prevNode->next = newNode;
    newNode->previous = prevNode;
    prevNode = newNode;
  }

  InsertNodes(list, aRow+1);

  if (node)
    node->isOpen = PR_TRUE;
}

Here is the call graph for this function:

void nsITreeView::getCellProperties ( in long  row,
in nsITreeColumn  col,
in nsISupportsArray  properties 
) [inherited]

An atomized list of properties for a given cell.

Each property, x, that the view gives back will cause the pseudoclass :moz-tree-cell-x to be matched on the ::moz-tree-cell pseudoelement.

AString nsITreeView::getCellText ( in long  row,
in nsITreeColumn  col 
) [inherited]

The text for a given cell.

If a column consists only of an image, then the empty string is returned.

AString nsITreeView::getCellValue ( in long  row,
in nsITreeColumn  col 
) [inherited]

The value for a given cell.

This method is only called for columns of type other than |text|.

nsresult inDOMView::GetChildNodesFor ( nsIDOMNode aNode,
nsCOMArray< nsIDOMNode > &  aResult 
) [protected]

Definition at line 1128 of file inDOMView.cpp.

{
  // Need to do this test to prevent unfortunate NYI assertion
  // on nsXULAttribute::GetChildNodes
  nsCOMPtr<nsIDOMAttr> attr = do_QueryInterface(aNode);
  if (!attr) {
    // attribute nodes
    if (mWhatToShow & nsIDOMNodeFilter::SHOW_ATTRIBUTE) {
      nsCOMPtr<nsIDOMNamedNodeMap> attrs;
      aNode->GetAttributes(getter_AddRefs(attrs));
      if (attrs) {
        AppendAttrsToArray(attrs, aResult);
      }
    }

    if (mWhatToShow & nsIDOMNodeFilter::SHOW_ELEMENT) {
      // try to get the anonymous content
      nsCOMPtr<nsIDOMNodeList> kids;
      if (mShowAnonymous) {
        nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
        if (content) {
          nsCOMPtr<nsIBindingManager> bindingManager = inLayoutUtils::GetBindingManagerFor(aNode);
          if (bindingManager) {
            bindingManager->GetAnonymousNodesFor(content, getter_AddRefs(kids));
            if (!kids) {
              bindingManager->GetContentListFor(content, getter_AddRefs(kids));
            }
          }
        }
      }

      if (!kids) {
        aNode->GetChildNodes(getter_AddRefs(kids));
      }
      if (kids) {
        AppendKidsToArray(kids, aResult);
      }
    }

    if (mShowSubDocuments) {
      nsCOMPtr<nsIDOMNode> domdoc =
        do_QueryInterface(inLayoutUtils::GetSubDocumentFor(aNode));
      if (domdoc) {
        aResult.AppendObject(domdoc);
      }
    }
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Called to get properties to paint a column background.

For shading the sort column, etc.

nsresult inDOMView::GetFirstDescendantOf ( inDOMViewNode aNode,
PRInt32  aRow,
PRInt32 aResult 
) [protected]

Definition at line 1095 of file inDOMView.cpp.

{
  // get the first node that is a descendant of the previous sibling
  PRInt32 row = 0;
  inDOMViewNode* node;
  for (row = aRow+1; row < GetRowCount(); ++row) {
    node = GetNodeAt(row);
    if (node->parent == aNode) {
      *aResult = row;
      return NS_OK;
    }
    if (node->level <= aNode->level)
      break;
  }
  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

AString nsITreeView::getImageSrc ( in long  row,
in nsITreeColumn  col 
) [inherited]

The image path for a given cell.

For defining an icon for a cell. If the empty string is returned, the :moz-tree-image pseudoelement will be used.

nsresult inDOMView::GetLastDescendantOf ( inDOMViewNode aNode,
PRInt32  aRow,
PRInt32 aResult 
) [protected]

Definition at line 1113 of file inDOMView.cpp.

{
  // get the last node that is a descendant of the previous sibling
  PRInt32 row = 0;
  for (row = aRow+1; row < GetRowCount(); ++row) {
    if (GetNodeAt(row)->level <= aNode->level)
      break;
  }
  *aResult = row-1;
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

long nsITreeView::getLevel ( in long  index) [inherited]

The level is an integer value that represents the level of indentation.

It is multiplied by the width specified in the :moz-tree-indentation pseudoelement to compute the exact indendation.

inDOMViewNode * inDOMView::GetNodeAt ( PRInt32  aIndex) [protected]

Definition at line 878 of file inDOMView.cpp.

{
  return (inDOMViewNode*)mNodes.ElementAt(aRow);
}

Here is the caller graph for this function:

long nsITreeView::getParentIndex ( in long  rowIndex) [inherited]

Methods used by the tree to draw thread lines in the tree.

getParentIndex is used to obtain the index of a parent row. If there is no parent row, getParentIndex returns -1.

long nsITreeView::getProgressMode ( in long  row,
in nsITreeColumn  col 
) [inherited]
nsresult inDOMView::GetRealPreviousSibling ( nsIDOMNode aNode,
nsIDOMNode aRealParent,
nsIDOMNode **  aSibling 
) [protected]

Definition at line 1180 of file inDOMView.cpp.

{
  // XXXjrh: This won't work for some cases during some situations where XBL insertion points
  // are involved.  Fix me!
  aNode->GetPreviousSibling(aSibling);
  return NS_OK;
}

Definition at line 309 of file inDOMView.cpp.

{
  *aRowCount = GetRowCount();
  return NS_OK;
}

Here is the caller graph for this function:

void nsITreeView::getRowProperties ( in long  index,
in nsISupportsArray  properties 
) [inherited]

An atomized list of properties for a given row.

Each property, x, that the view gives back will cause the pseudoclass :moz-tree-row-x to be matched on the pseudoelement ::moz-tree-row.

boolean nsITreeView::hasNextSibling ( in long  rowIndex,
in long  afterIndex 
) [inherited]

hasNextSibling is used to determine if the row at rowIndex has a nextSibling that occurs after the index specified by afterIndex.

Code that is forced to march down the view looking at levels can optimize the march by starting at afterIndex+1.

void inDOMView::InitAtoms ( ) [static]

Definition at line 147 of file inDOMView.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void inDOMView::InsertLinkAfter ( inDOMViewNode aNode,
inDOMViewNode aInsertAfter 
) [protected]

Definition at line 1053 of file inDOMView.cpp.

{
  if (aInsertAfter->next)
    aInsertAfter->next->previous = aNode;
  aNode->next = aInsertAfter->next;
  aInsertAfter->next = aNode;
  aNode->previous = aInsertAfter;
}
void inDOMView::InsertLinkBefore ( inDOMViewNode aNode,
inDOMViewNode aInsertBefore 
) [protected]

Definition at line 1063 of file inDOMView.cpp.

{
  if (aInsertBefore->previous)
    aInsertBefore->previous->next = aNode;
  aNode->previous = aInsertBefore->previous;
  aInsertBefore->previous = aNode;
  aNode->next = aInsertBefore;
}
void inDOMView::InsertNode ( inDOMViewNode aNode,
PRInt32  aIndex 
) [protected]

Definition at line 915 of file inDOMView.cpp.

{
  if (RowOutOfBounds(aRow, 1))
    AppendNode(aNode);
  else
    mNodes.InsertElementAt(aNode, aRow);
}

Here is the call graph for this function:

void inDOMView::InsertNodes ( nsVoidArray aNodes,
PRInt32  aIndex 
) [protected]

Definition at line 944 of file inDOMView.cpp.

{
  if (aRow < 0 || aRow > GetRowCount())
    return;

  mNodes.InsertElementsAt(aNodes, aRow);
}

Here is the call graph for this function:

Here is the caller graph for this function:

boolean nsITreeView::isContainer ( in long  index) [inherited]

Methods that can be used to test whether or not a twisty should be drawn, and if so, whether an open or closed twisty should be used.

Here is the caller graph for this function:

boolean nsITreeView::isContainerEmpty ( in long  index) [inherited]
boolean nsITreeView::isContainerOpen ( in long  index) [inherited]
boolean nsITreeView::isEditable ( in long  row,
in nsITreeColumn  col 
) [inherited]

isEditable is called to ask the view if the cell contents are editable.

A value of true will result in the tree popping up a text field when the user tries to inline edit the cell.

boolean nsITreeView::isSeparator ( in long  index) [inherited]

isSeparator is used to determine if the row at index is a separator.

A value of true will result in the tree drawing a horizontal separator. The tree uses the ::moz-tree-separator pseudoclass to draw the separator.

boolean nsITreeView::isSorted ( ) [inherited]

Specifies if there is currently a sort on any column.

Used mostly by dragdrop to affect drop feedback.

nsresult inDOMView::NodeToRow ( nsIDOMNode aNode,
PRInt32 aRow 
) [protected]

Definition at line 1036 of file inDOMView.cpp.

{
  PRInt32 rowCount = GetRowCount();
  for (PRInt32 i = 0; i < rowCount; ++i) {
    if (GetNodeAt(i)->node == aNode) {
      *aRow = i;
      return NS_OK;
    }
  }

  *aRow = -1;
  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

void nsITreeView::performAction ( in wstring  action) [inherited]

A command API that can be used to invoke commands on the selection.

The tree will automatically invoke this method when certain keys are pressed. For example, when the DEL key is pressed, performAction will be called with the "delete" string.

void nsITreeView::performActionOnCell ( in wstring  action,
in long  row,
in nsITreeColumn  col 
) [inherited]

A command API that can be used to invoke commands on a specific cell.

void nsITreeView::performActionOnRow ( in wstring  action,
in long  row 
) [inherited]

A command API that can be used to invoke commands on a specific row.

void inIDOMView::rebuild ( ) [inherited]

Definition at line 967 of file inDOMView.cpp.

{
  PRInt32 rowCount = GetRowCount();
  for (PRInt32 i = 0; i < rowCount; ++i) {
    delete GetNodeAt(i);
  }

  mNodes.Clear();
}

Here is the call graph for this function:

void inDOMView::RemoveLink ( inDOMViewNode aNode) [protected]

Definition at line 1073 of file inDOMView.cpp.

{
  if (aNode->previous)
    aNode->previous->next = aNode->next;
  if (aNode->next)
    aNode->next->previous = aNode->previous;
}
void inDOMView::RemoveNode ( PRInt32  aIndex) [protected]

Definition at line 924 of file inDOMView.cpp.

{
  if (RowOutOfBounds(aRow, 1))
    return;

  delete GetNodeAt(aRow);
  mNodes.RemoveElementAt(aRow);
}

Here is the call graph for this function:

void inDOMView::RemoveNodes ( PRInt32  aIndex,
PRInt32  aCount 
) [protected]

Definition at line 953 of file inDOMView.cpp.

{
  if (aRow < 0)
    return;

  PRInt32 rowCount = GetRowCount();
  for (PRInt32 i = aRow; i < aRow+aCount && i < rowCount; ++i) {
    delete GetNodeAt(i);
  }

  mNodes.RemoveElementsAt(aRow, aCount);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void inDOMView::ReplaceLink ( inDOMViewNode aNewNode,
inDOMViewNode aOldNode 
) [protected]

Definition at line 1082 of file inDOMView.cpp.

{
  if (aOldNode->previous)
    aOldNode->previous->next = aNewNode;
  if (aOldNode->next)
    aOldNode->next->previous = aNewNode;
  aNewNode->next = aOldNode->next;
  aNewNode->previous = aOldNode->previous;
}
void inDOMView::ReplaceNode ( inDOMViewNode aNode,
PRInt32  aIndex 
) [protected]

Definition at line 934 of file inDOMView.cpp.

{
  if (RowOutOfBounds(aRow, 1))
    return;

  delete GetNodeAt(aRow);
  mNodes.ReplaceElementAt(aNode, aRow);
}

Here is the call graph for this function:

PRBool inDOMView::RowOutOfBounds ( PRInt32  aRow,
PRInt32  aCount 
) [protected]

Definition at line 903 of file inDOMView.cpp.

{
  return aRow < 0 || aRow >= GetRowCount() || aCount+aRow > GetRowCount();
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult inDOMView::RowToNode ( PRInt32  aRow,
inDOMViewNode **  aNode 
) [protected]

Definition at line 1026 of file inDOMView.cpp.

{
  if (aRow < 0 || aRow >= GetRowCount())
    return NS_ERROR_FAILURE;

  *aNode = GetNodeAt(aRow);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Should be called from a XUL onselect handler whenever the selection changes.

void nsITreeView::setCellText ( in long  row,
in nsITreeColumn  col,
in AString  value 
) [inherited]

setCellText is called when the contents of the cell have been edited by the user.

void nsITreeView::setCellValue ( in long  row,
in nsITreeColumn  col,
in AString  value 
) [inherited]

setCellValue is called when the value of the cell has been set by the user.

This method is only called for columns of type other than |text|.

Called during initialization to link the view to the front end box object.

virtual void nsIDocumentObserver::StyleRuleAdded ( nsIDocument aDocument,
nsIStyleSheet aStyleSheet,
nsIStyleRule aStyleRule 
) [pure virtual, inherited]

A StyleRule has just been added to a style sheet.

This method is called automatically when the rule gets added to the sheet. The style sheet passes this notification to the document. The notification is passed on to all of the document observers.

Parameters:
aDocumentThe document being observed
aStyleSheetthe StyleSheet that has been modified
aStyleRulethe rule that was added

Implemented in PresShell.

virtual void nsIDocumentObserver::StyleRuleChanged ( nsIDocument aDocument,
nsIStyleSheet aStyleSheet,
nsIStyleRule aOldStyleRule,
nsIStyleRule aNewStyleRule 
) [pure virtual, inherited]

A StyleRule has just been modified within a style sheet.

This method is called automatically when the rule gets modified. The style sheet passes this notification to the document. The notification is passed on to all of the document observers.

Since nsIStyleRule objects are immutable, there is a new object replacing the old one. However, the use of this method (rather than StyleRuleAdded and StyleRuleRemoved) implies that the new rule matches the same elements and has the same priority (weight, origin, specificity) as the old one. (However, if it is a CSS style rule, there may be a change in whether it has an important rule.)

Parameters:
aDocumentThe document being observed
aStyleSheetthe StyleSheet that contians the rule
aOldStyleRuleThe rule being removed. This rule may not be fully valid anymore -- however, it can still be used for pointer comparison and |QueryInterface|.
aNewStyleRuleThe rule being added.

Implemented in PresShell.

virtual void nsIDocumentObserver::StyleRuleRemoved ( nsIDocument aDocument,
nsIStyleSheet aStyleSheet,
nsIStyleRule aStyleRule 
) [pure virtual, inherited]

A StyleRule has just been removed from a style sheet.

This method is called automatically when the rule gets removed from the sheet. The style sheet passes this notification to the document. The notification is passed on to all of the document observers.

Parameters:
aDocumentThe document being observed
aStyleSheetthe StyleSheet that has been modified
aStyleRulethe rule that was removed

Implemented in PresShell.

virtual void nsIDocumentObserver::StyleSheetAdded ( nsIDocument aDocument,
nsIStyleSheet aStyleSheet,
PRBool  aDocumentSheet 
) [pure virtual, inherited]

A StyleSheet has just been added to the document.

This method is called automatically when a StyleSheet gets added to the document, even if the stylesheet is not applicable. The notification is passed on to all of the document observers.

Parameters:
aDocumentThe document being observed
aStyleSheetthe StyleSheet that has been added
aDocumentSheetTrue if sheet is in document's style sheet list, false if sheet is not (i.e., UA or user sheet)

Implemented in PresShell, and nsDOMStyleSheetList.

virtual void nsIDocumentObserver::StyleSheetApplicableStateChanged ( nsIDocument aDocument,
nsIStyleSheet aStyleSheet,
PRBool  aApplicable 
) [pure virtual, inherited]

A StyleSheet has just changed its applicable state.

This method is called automatically when the applicable state of a StyleSheet gets changed. The style sheet passes this notification to the document. The notification is passed on to all of the document observers.

Parameters:
aDocumentThe document being observed
aStyleSheetthe StyleSheet that has changed state
aApplicablePR_TRUE if the sheet is applicable, PR_FALSE if it is not applicable

Implemented in PresShell.

virtual void nsIDocumentObserver::StyleSheetRemoved ( nsIDocument aDocument,
nsIStyleSheet aStyleSheet,
PRBool  aDocumentSheet 
) [pure virtual, inherited]

A StyleSheet has just been removed from the document.

This method is called automatically when a StyleSheet gets removed from the document, even if the stylesheet is not applicable. The notification is passed on to all of the document observers.

Parameters:
aDocumentThe document being observed
aStyleSheetthe StyleSheet that has been removed
aDocumentSheetTrue if sheet is in document's style sheet list, false if sheet is not (i.e., UA or user sheet)

Implemented in PresShell, and nsDOMStyleSheetList.

void nsITreeView::toggleOpenState ( in long  index) [inherited]

Called on the view when an item is opened or closed.


Member Data Documentation

Initial value:
 {
  {"anonymous", &inDOMView::kAnonymousAtom},
  {"ELEMENT_NODE", &inDOMView::kElementNodeAtom},
  {"ATTRIBUTE_NODE", &inDOMView::kAttributeNodeAtom},
  {"TEXT_NODE", &inDOMView::kTextNodeAtom},
  {"CDATA_SECTION_NODE", &inDOMView::kCDataSectionNodeAtom},
  {"ENTITY_REFERENCE_NODE", &inDOMView::kEntityReferenceNodeAtom},
  {"ENTITY_NODE", &inDOMView::kEntityNodeAtom},
  {"PROCESSING_INSTRUCTION_NODE", &inDOMView::kProcessingInstructionNodeAtom},
  {"COMMENT_NODE", &inDOMView::kCommentNodeAtom},
  {"DOCUMENT_NODE", &inDOMView::kDocumentNodeAtom},
  {"DOCUMENT_TYPE_NODE", &inDOMView::kDocumentTypeNodeAtom},
  {"DOCUMENT_FRAGMENT_NODE", &inDOMView::kDocumentFragmentNodeAtom},
  {"NOTATION_NODE", &inDOMView::kNotationNodeAtom}
}

Definition at line 87 of file inDOMView.h.

const short nsITreeView::DROP_AFTER = 1 [inherited]

Definition at line 103 of file nsITreeView.idl.

const short nsITreeView::DROP_BEFORE = -1 [inherited]

Definition at line 101 of file nsITreeView.idl.

const short nsITreeView::DROP_ON = 0 [inherited]

Definition at line 102 of file nsITreeView.idl.

nsIAtom * inDOMView::kAnonymousAtom = nsnull [static, protected]

Definition at line 73 of file inDOMView.h.

nsIAtom * inDOMView::kAttributeNodeAtom = nsnull [static, protected]

Definition at line 75 of file inDOMView.h.

Definition at line 77 of file inDOMView.h.

nsIAtom * inDOMView::kCommentNodeAtom = nsnull [static, protected]

Definition at line 81 of file inDOMView.h.

Definition at line 84 of file inDOMView.h.

nsIAtom * inDOMView::kDocumentNodeAtom = nsnull [static, protected]

Definition at line 82 of file inDOMView.h.

Definition at line 83 of file inDOMView.h.

nsIAtom * inDOMView::kElementNodeAtom = nsnull [static, protected]

Definition at line 74 of file inDOMView.h.

nsIAtom * inDOMView::kEntityNodeAtom = nsnull [static, protected]

Definition at line 79 of file inDOMView.h.

Definition at line 78 of file inDOMView.h.

nsIAtom * inDOMView::kNotationNodeAtom = nsnull [static, protected]

Definition at line 85 of file inDOMView.h.

Definition at line 80 of file inDOMView.h.

nsIAtom * inDOMView::kTextNodeAtom = nsnull [static, protected]

Definition at line 76 of file inDOMView.h.

Definition at line 91 of file inDOMView.h.

Definition at line 101 of file inDOMView.h.

Definition at line 99 of file inDOMView.h.

Definition at line 98 of file inDOMView.h.

Definition at line 90 of file inDOMView.h.

Definition at line 93 of file inDOMView.h.

Definition at line 94 of file inDOMView.h.

Definition at line 95 of file inDOMView.h.

Definition at line 89 of file inDOMView.h.

Definition at line 96 of file inDOMView.h.

const short nsITreeView::PROGRESS_NONE = 3 [inherited]

Definition at line 153 of file nsITreeView.idl.

const short nsITreeView::PROGRESS_NORMAL = 1 [inherited]

The progress mode for a given cell.

This method is only called for columns of type |progressmeter|.

Definition at line 151 of file nsITreeView.idl.

Definition at line 152 of file nsITreeView.idl.

Definition at line 45 of file inIDOMView.idl.

readonly attribute long nsITreeView::rowCount [inherited]

The total number of rows in the tree (including the offscreen rows).

Definition at line 53 of file nsITreeView.idl.

The selection for this view.

Definition at line 58 of file nsITreeView.idl.

Definition at line 47 of file inIDOMView.idl.

Definition at line 48 of file inIDOMView.idl.

Definition at line 49 of file inIDOMView.idl.

attribute unsigned long inIDOMView::whatToShow [inherited]

Definition at line 50 of file inIDOMView.idl.


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