Back to index

lightning-sunbird  0.9+nobinonly
Functions
nsEditorEventListeners.cpp File Reference
#include "nsEditorEventListeners.h"
#include "nsEditor.h"
#include "nsIDOMEvent.h"
#include "nsIDOMNSEvent.h"
#include "nsIDOMDocument.h"
#include "nsIDocument.h"
#include "nsIPresShell.h"
#include "nsISelection.h"
#include "nsISelectionController.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMMouseEvent.h"
#include "nsIDOMNSUIEvent.h"
#include "nsIPrivateTextEvent.h"
#include "nsIPrivateCompositionEvent.h"
#include "nsIEditorMailSupport.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsILookAndFeel.h"
#include "nsPresContext.h"
#include "nsIServiceManager.h"
#include "nsIClipboard.h"
#include "nsIDragService.h"
#include "nsIDragSession.h"
#include "nsIContent.h"
#include "nsISupportsPrimitives.h"
#include "nsIDOMNSRange.h"
#include "nsEditorUtils.h"
#include "nsIDOMEventTarget.h"
#include "nsIEventStateManager.h"

Go to the source code of this file.

Functions

nsresult NS_NewEditorKeyListener (nsIDOMEventListener **aInstancePtrResult, nsIEditor *aEditor)
 factory for the editor key listener
nsresult NS_NewEditorMouseListener (nsIDOMEventListener **aInstancePtrResult, nsIEditor *aEditor)
 factory for the editor mouse listener
nsresult NS_NewEditorTextListener (nsIDOMEventListener **aInstancePtrResult, nsIEditor *aEditor)
 factory for the editor text listener
nsresult NS_NewEditorDragListener (nsIDOMEventListener **aInstancePtrResult, nsIPresShell *aPresShell, nsIEditor *aEditor)
 factory for the editor drag listener
nsresult NS_NewEditorCompositionListener (nsIDOMEventListener **aInstancePtrResult, nsIEditor *aEditor)
 factory for the editor composition listener
nsresult NS_NewEditorFocusListener (nsIDOMEventListener **aInstancePtrResult, nsIEditor *aEditor)
 factory for the editor composition listener
static PRBool IsTargetFocused (nsIDOMEventTarget *aTarget)

Function Documentation

static PRBool IsTargetFocused ( nsIDOMEventTarget aTarget) [static]

Definition at line 970 of file nsEditorEventListeners.cpp.

{
  // The event target could be either a content node or a document.
  nsCOMPtr<nsIDocument> doc;
  nsCOMPtr<nsIContent> content = do_QueryInterface(aTarget);
  if (content)
    doc = content->GetDocument();
  else
    doc = do_QueryInterface(aTarget);

  if (!doc)
    return PR_FALSE;

  nsIPresShell *shell = doc->GetShellAt(0);
  if (!shell)
    return PR_FALSE;

  nsPresContext *presContext = shell->GetPresContext();
  if (!presContext)
    return PR_FALSE;

  nsCOMPtr<nsIContent> focusedContent;
  presContext->EventStateManager()->
    GetFocusedContent(getter_AddRefs(focusedContent));

  // focusedContent will be null in the case where the document has focus,
  // and so will content.

  return (focusedContent == content);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult NS_NewEditorCompositionListener ( nsIDOMEventListener **  aInstancePtrResult,
nsIEditor aEditor 
)

factory for the editor composition listener

Definition at line 924 of file nsEditorEventListeners.cpp.

{
   nsTextEditorCompositionListener*   it = new nsTextEditorCompositionListener();
   if (nsnull==it) {
      return NS_ERROR_OUT_OF_MEMORY;
   }
   it->SetEditor(aEditor);
  return it->QueryInterface(NS_GET_IID(nsIDOMEventListener), (void **) aInstancePtrResult);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult NS_NewEditorDragListener ( nsIDOMEventListener **  aInstancePtrResult,
nsIPresShell aPresShell,
nsIEditor aEditor 
)

factory for the editor drag listener

Definition at line 909 of file nsEditorEventListeners.cpp.

{
  nsTextEditorDragListener* it = new nsTextEditorDragListener();
  if (nsnull == it) {
    return NS_ERROR_OUT_OF_MEMORY;
  }

  it->SetEditor(aEditor);
  it->SetPresShell(aPresShell);

  return it->QueryInterface(NS_GET_IID(nsIDOMEventListener), (void **) aInstancePtrResult);   
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult NS_NewEditorFocusListener ( nsIDOMEventListener **  aInstancePtrResult,
nsIEditor aEditor 
)

factory for the editor composition listener

Definition at line 935 of file nsEditorEventListeners.cpp.

{
  nsTextEditorFocusListener* it = new nsTextEditorFocusListener();
  if (nsnull == it) {
    return NS_ERROR_OUT_OF_MEMORY;
  }
  it->SetEditor(aEditor);
  return it->QueryInterface(NS_GET_IID(nsIDOMEventListener), (void **) aInstancePtrResult);
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult NS_NewEditorKeyListener ( nsIDOMEventListener **  aInstancePtrResult,
nsIEditor aEditor 
)

factory for the editor key listener

Definition at line 863 of file nsEditorEventListeners.cpp.

{
  nsTextEditorKeyListener* it = new nsTextEditorKeyListener();
  if (nsnull == it) {
    return NS_ERROR_OUT_OF_MEMORY;
  }

  it->SetEditor(aEditor);

  return it->QueryInterface(NS_GET_IID(nsIDOMEventListener), (void **) aInstancePtrResult);   
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult NS_NewEditorMouseListener ( nsIDOMEventListener **  aInstancePtrResult,
nsIEditor aEditor 
)

factory for the editor mouse listener

Definition at line 879 of file nsEditorEventListeners.cpp.

{
  nsTextEditorMouseListener* it = new nsTextEditorMouseListener();
  if (nsnull == it) {
    return NS_ERROR_OUT_OF_MEMORY;
  }

  it->SetEditor(aEditor);

  return it->QueryInterface(NS_GET_IID(nsIDOMEventListener), (void **) aInstancePtrResult);   
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult NS_NewEditorTextListener ( nsIDOMEventListener **  aInstancePtrResult,
nsIEditor aEditor 
)

factory for the editor text listener

Definition at line 894 of file nsEditorEventListeners.cpp.

{
   nsTextEditorTextListener*   it = new nsTextEditorTextListener();
   if (nsnull==it) {
      return NS_ERROR_OUT_OF_MEMORY;
   }

   it->SetEditor(aEditor);

   return it->QueryInterface(NS_GET_IID(nsIDOMEventListener), (void **) aInstancePtrResult);
}

Here is the call graph for this function:

Here is the caller graph for this function: