Back to index

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

#include <nsDocShellEditorData.h>

Collaboration diagram for nsDocShellEditorData:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsDocShellEditorData (nsIDocShell *inOwningDocShell)
 ~nsDocShellEditorData ()
nsresult MakeEditable (PRBool inWaitForUriLoad)
PRBool GetEditable ()
nsresult CreateEditor ()
nsresult GetEditingSession (nsIEditingSession **outEditingSession)
nsresult GetEditor (nsIEditor **outEditor)
nsresult SetEditor (nsIEditor *inEditor)
void TearDownEditor ()

Protected Member Functions

nsresult EnsureEditingSession ()

Protected Attributes

nsIDocShellmDocShell
nsCOMPtr< nsIEditingSessionmEditingSession
PRBool mMakeEditable
nsCOMPtr< nsIEditormEditor

Detailed Description

Definition at line 61 of file nsDocShellEditorData.h.


Constructor & Destructor Documentation

Definition at line 56 of file nsDocShellEditorData.cpp.

: mDocShell(inOwningDocShell)
, mMakeEditable(PR_FALSE)
{
  NS_ASSERTION(mDocShell, "Where is my docShell?");
}

Definition at line 69 of file nsDocShellEditorData.cpp.

Here is the call graph for this function:


Member Function Documentation

Definition at line 135 of file nsDocShellEditorData.cpp.

{
  nsCOMPtr<nsIEditingSession>   editingSession;    
  nsresult rv = GetEditingSession(getter_AddRefs(editingSession));
  if (NS_FAILED(rv)) return rv;
  
  nsCOMPtr<nsIDOMWindow>    domWindow = do_GetInterface(mDocShell);
  rv = editingSession->SetupEditorOnWindow(domWindow);
  if (NS_FAILED(rv)) return rv;
  
  return NS_OK;
}

Here is the call graph for this function:

Definition at line 215 of file nsDocShellEditorData.cpp.

{
  NS_ASSERTION(mDocShell, "Should have docShell here");
  
  nsresult rv = NS_OK;
  
  if (!mEditingSession)
  {
    mEditingSession =
      do_CreateInstance("@mozilla.org/editor/editingsession;1", &rv);
  }

  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 124 of file nsDocShellEditorData.cpp.

{
  return mMakeEditable || (mEditor != nsnull);
}

Definition at line 155 of file nsDocShellEditorData.cpp.

{
  nsresult rv = EnsureEditingSession();
  NS_ENSURE_SUCCESS(rv, rv);

  NS_ADDREF(*outEditingSession = mEditingSession);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 172 of file nsDocShellEditorData.cpp.

{
  NS_ENSURE_ARG_POINTER(outEditor);
  NS_IF_ADDREF(*outEditor = mEditor);
  return NS_OK;
}

Definition at line 98 of file nsDocShellEditorData.cpp.

{
  if (mMakeEditable)
    return NS_OK;
  
  // if we are already editable, and are getting turned off,
  // nuke the editor.
  if (mEditor)
  {
    NS_WARNING("Destroying existing editor on frame");
    
    mEditor->PreDestroy();
    mEditor = nsnull;
  }
  
  mMakeEditable = PR_TRUE;
  return NS_OK;
}

Definition at line 186 of file nsDocShellEditorData.cpp.

{
  // destroy any editor that we have. Checks for equality are
  // necessary to ensure that assigment into the nsCOMPtr does
  // not temporarily reduce the refCount of the editor to zero
  if (mEditor.get() != inEditor)
  {
    if (mEditor)
    {
      mEditor->PreDestroy();
      mEditor = nsnull;
    }
      
    mEditor = inEditor;    // owning addref
  }   
  
  return NS_OK;
}

Here is the call graph for this function:

Definition at line 75 of file nsDocShellEditorData.cpp.

{
  if (mEditingSession)
  {
    nsCOMPtr<nsIDOMWindow> domWindow = do_GetInterface(mDocShell);
    // This will eventually call nsDocShellEditorData::SetEditor(nsnull)
    //   which will call mEditorPreDestroy() and delete the editor
    mEditingSession->TearDownEditorOnWindow(domWindow);
  }
  else if (mEditor) // Should never have this w/o nsEditingSession!
  {
    mEditor->PreDestroy();
    mEditor = nsnull;     // explicit clear to make destruction order predictable
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 96 of file nsDocShellEditorData.h.

Definition at line 98 of file nsDocShellEditorData.h.

Definition at line 101 of file nsDocShellEditorData.h.

Definition at line 100 of file nsDocShellEditorData.h.


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