if (!nsCRT::strcmp(aCommandName, "cmd_setDocumentModified"))
nsCOMPtr<nsIPresContext> presContext; nsresult rv = GetPresContextFromEditor(editor, getter_AddRefs(presContext)); if (NS_FAILED(rv)) return rv; if (!presContext) return NS_ERROR_FAILURE;  PRInt32 animationMode; rv = aParams->GetLongValue("imageAnimation", &animationMode); if (NS_SUCCEEDED(rv))
nsSetDocumentStateCommand::DoCommandParams(const char *aCommandName,                                           nsICommandParams *aParams,                                           nsISupports *refCon){  nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);  if (!editor)     return NS_ERROR_INVALID_ARG;  if (!nsCRT::strcmp(aCommandName, "cmd_setDocumentModified"))  {    NS_ENSURE_ARG_POINTER(aParams);    PRBool modified;     nsresult rv = aParams->GetBooleanValue(STATE_ATTRIBUTE, &modified);    // Should we fail if this param wasn't set?    // I'm not sure we should be that strict    if (NS_FAILED(rv))      return rv;    if (modified)      return editor->IncrementModificationCount(1);    else       return editor->ResetModificationCount();  }  else if (!nsCRT::strcmp(aCommandName, "cmd_setDocumentReadOnly"))  {    NS_ENSURE_ARG_POINTER(aParams);    PRBool isReadOnly;     nsresult rvRO = aParams->GetBooleanValue(STATE_ATTRIBUTE, &isReadOnly);    if (NS_FAILED(rvRO))      return rvRO;    PRUint32 flags;    editor->GetFlags(&flags);    if (isReadOnly)      flags |= nsIPlaintextEditor::eEditorReadonlyMask;    else      flags &= ~(nsIPlaintextEditor::eEditorReadonlyMask);    return editor->SetFlags(flags);  }  else if (!nsCRT::strcmp(aCommandName, "cmd_setDocumentUseCSS"))  {    NS_ENSURE_ARG_POINTER(aParams);    nsCOMPtr<nsIHTMLEditor> htmleditor = do_QueryInterface(refCon);    if (!htmleditor)       return NS_ERROR_INVALID_ARG;    PRBool desireCSS;    nsresult rvCSS = aParams->GetBooleanValue(STATE_ATTRIBUTE, &desireCSS);    if (NS_FAILED(rvCSS))      return rvCSS;    return htmleditor->SetIsCSSEnabled(desireCSS);  }  return NS_ERROR_NOT_IMPLEMENTED;}