Back to index

lightning-sunbird  0.9+nobinonly
Functions
nsEditorMode.h File Reference
#include "nsError.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

nsresult NS_InitEditorMode (nsIDOMDocument *aDOMDocument, nsIPresShell *aPresShell)
nsresult NS_DoEditorTest (PRInt32 aCommandID)

Function Documentation

nsresult NS_DoEditorTest ( PRInt32  aCommandID)

Definition at line 121 of file nsEditorMode.cpp.

{
  nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(gEditor);
  nsCOMPtr<nsITableEditor> tableEditor = do_QueryInterface(gEditor);
  if (htmlEditor && tableEditor)
  {
    switch(aCommandID)
    {
      case VIEWER_EDIT_SET_BGCOLOR_RED:
        htmlEditor->SetBodyAttribute(NS_LITERAL_STRING("bgcolor"), NS_LITERAL_STRING("red"));
        break;
      case VIEWER_EDIT_SET_BGCOLOR_YELLOW:
        htmlEditor->SetBodyAttribute(NS_LITERAL_STRING("bgcolor"), NS_LITERAL_STRING("yellow"));
        break;
      case VIEWER_EDIT_INSERT_CELL:  
        tableEditor->InsertTableCell(1, PR_FALSE);
        break;    
      case VIEWER_EDIT_INSERT_COLUMN:
        tableEditor->InsertTableColumn(1, PR_FALSE);
        break;    
      case VIEWER_EDIT_INSERT_ROW:    
        tableEditor->InsertTableRow(1, PR_FALSE);
        break;    
      case VIEWER_EDIT_DELETE_TABLE:  
        tableEditor->DeleteTable();
        break;    
      case VIEWER_EDIT_DELETE_CELL:  
        tableEditor->DeleteTableCell(1);
        break;    
      case VIEWER_EDIT_DELETE_COLUMN:
        tableEditor->DeleteTableColumn(1);
        break;    
      case VIEWER_EDIT_DELETE_ROW:
        tableEditor->DeleteTableRow(1);
        break;    
      case VIEWER_EDIT_JOIN_CELL_RIGHT:
        tableEditor->JoinTableCells(PR_FALSE);
        break;    
      case VIEWER_DISPLAYTEXT:
      case VIEWER_DISPLAYHTML:
        PrintEditorOutput(gEditor, aCommandID);
        break;
     default:
        return NS_ERROR_NOT_IMPLEMENTED;    
    }
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult NS_InitEditorMode ( nsIDOMDocument aDOMDocument,
nsIPresShell aPresShell 
)

Definition at line 63 of file nsEditorMode.cpp.

{
  nsresult result = NS_OK;

  // This is a big leak if called > once, but its only temp test code, correct?
  if (gEditor)
    gEditor=nsnull;

  NS_ASSERTION(nsnull!=aDOMDocument, "null document");
  NS_ASSERTION(nsnull!=aPresShell, "null presentation shell");

  if ((nsnull==aDOMDocument) || (nsnull==aPresShell))
    return NS_ERROR_NULL_POINTER;

  result = CallCreateInstance(kHTMLEditorCID, &gEditor);
  if (NS_FAILED(result))
    return result;
  if (!gEditor) {
    return NS_ERROR_OUT_OF_MEMORY;
  }
  nsCOMPtr<nsISelectionController> selCon;
  selCon = do_QueryInterface(aPresShell);
  result = gEditor->Init(aDOMDocument, aPresShell, nsnull, selCon, 0);
  if (NS_SUCCEEDED(result))
    result = gEditor->PostCreate();
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function: