Back to index

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

#include <nsComposerCommands.h>

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

List of all members.

Public Member Functions

 nsAbsolutePositioningCommand ()
NS_IMETHOD DoCommand (const char *aCommandName, nsISupports *aCommandRefCon)=0
boolean isCommandEnabled (in string aCommandName, in nsISupports aCommandContext)
 Returns true if the command is currently enabled.
void getCommandStateParams (in string aCommandName, in nsICommandParams aParams, in nsISupports aCommandContext)
void doCommand (in string aCommandName, in nsISupports aCommandContext)
 Execute the name command.
void doCommandParams (in string aCommandName, in nsICommandParams aParams, in nsISupports aCommandContext)

Protected Member Functions

NS_IMETHOD IsCommandEnabled (const char *aCommandName, nsISupports *aCommandRefCon, PRBool *_retval)
virtual nsresult GetCurrentState (nsIEditor *aEditor, const char *aTagName, nsICommandParams *aParams)
virtual nsresult ToggleState (nsIEditor *aEditor, const char *aTagName)

Protected Attributes

const char * mTagName

Detailed Description

Definition at line 273 of file nsComposerCommands.h.


Constructor & Destructor Documentation

Definition at line 1094 of file nsComposerCommands.cpp.


Member Function Documentation

NS_IMETHOD nsBaseComposerCommand::DoCommand ( const char *  aCommandName,
nsISupports *  aCommandRefCon 
) [pure virtual, inherited]
void nsIControllerCommand::doCommand ( in string  aCommandName,
in nsISupports  aCommandContext 
) [inherited]

Execute the name command.

Parameters:
aCommandNamethe name of the command to execute.
aCommandContexta cookie held by the nsIControllerCommandTable, allowing the command to get some context information. The contents of this cookie are implementation-defined.
void nsIControllerCommand::doCommandParams ( in string  aCommandName,
in nsICommandParams  aParams,
in nsISupports  aCommandContext 
) [inherited]
void nsIControllerCommand::getCommandStateParams ( in string  aCommandName,
in nsICommandParams  aParams,
in nsISupports  aCommandContext 
) [inherited]
nsresult nsAbsolutePositioningCommand::GetCurrentState ( nsIEditor aEditor,
const char *  aTagName,
nsICommandParams aParams 
) [protected, virtual]

Implements nsBaseStateUpdatingCommand.

Definition at line 1114 of file nsComposerCommands.cpp.

{
  NS_ASSERTION(aEditor, "Need an editor here");
  
  nsCOMPtr<nsIHTMLAbsPosEditor> htmlEditor = do_QueryInterface(aEditor);
  if (!htmlEditor) return NS_ERROR_FAILURE;

  PRBool isEnabled;
  htmlEditor->GetAbsolutePositioningEnabled(&isEnabled);
  if (!isEnabled) {
    aParams->SetBooleanValue(STATE_MIXED,PR_FALSE);
    aParams->SetCStringValue(STATE_ATTRIBUTE, "");
    return NS_OK;
  }

  nsCOMPtr<nsIDOMElement>  elt;
  nsresult rv = htmlEditor->GetAbsolutelyPositionedSelectionContainer(getter_AddRefs(elt));
  if (NS_FAILED(rv)) 
    return rv;

  nsAutoString outStateString;
  if (elt)
    outStateString.AssignLiteral("absolute");

  aParams->SetBooleanValue(STATE_MIXED,PR_FALSE);
  aParams->SetCStringValue(STATE_ATTRIBUTE, NS_ConvertUCS2toUTF8(outStateString).get());
  return NS_OK;
}

Here is the call graph for this function:

boolean nsIControllerCommand::isCommandEnabled ( in string  aCommandName,
in nsISupports  aCommandContext 
) [inherited]

Returns true if the command is currently enabled.

An nsIControllerCommand can implement more than one commands; say, a group of related commands (e.g. delete left/delete right). Because of this, the command name is passed to each method.

Parameters:
aCommandNamethe name of the command for which we want the enabled state.
aCommandContexta cookie held by the nsIControllerCommandTable, allowing the command to get some context information. The contents of this cookie are implementation-defined.
NS_IMETHODIMP nsAbsolutePositioningCommand::IsCommandEnabled ( const char *  aCommandName,
nsISupports *  aCommandRefCon,
PRBool _retval 
) [protected, virtual]

Implements nsBaseComposerCommand.

Definition at line 1100 of file nsComposerCommands.cpp.

{
  NS_ASSERTION(aCommandRefCon, "Need an editor here");
  
  nsCOMPtr<nsIHTMLAbsPosEditor> htmlEditor = do_QueryInterface(aCommandRefCon);
  if (!htmlEditor) return NS_ERROR_FAILURE;

  htmlEditor->GetAbsolutePositioningEnabled(_retval);
  return NS_OK;
}

Here is the call graph for this function:

nsresult nsAbsolutePositioningCommand::ToggleState ( nsIEditor aEditor,
const char *  aTagName 
) [protected, virtual]

Implements nsBaseStateUpdatingCommand.

Definition at line 1144 of file nsComposerCommands.cpp.

{
  NS_ASSERTION(aEditor, "Need an editor here");
  
  nsCOMPtr<nsIHTMLAbsPosEditor> htmlEditor = do_QueryInterface(aEditor);
  if (!htmlEditor) return NS_ERROR_FAILURE;

  nsCOMPtr<nsIDOMElement>  elt;
  nsresult rv = htmlEditor->GetAbsolutelyPositionedSelectionContainer(getter_AddRefs(elt));
  if (NS_FAILED(rv)) return rv;

  if (elt) {
    // we have to remove positioning on an element
    rv = htmlEditor->AbsolutePositionSelection(PR_FALSE);
  }
  else {
    rv = htmlEditor->AbsolutePositionSelection(PR_TRUE);
  }
  return rv;
}

Here is the call graph for this function:


Member Data Documentation

const char* nsBaseStateUpdatingCommand::mTagName [protected, inherited]

Definition at line 104 of file nsComposerCommands.h.


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