GetCommandState for document commands to return their boolean values; r=glazman, sr=sfraser, bug=208544

This commit is contained in:
brade%netscape.com 2003-06-06 19:28:25 +00:00
Родитель c525b45af0
Коммит 00fc2c47cb
1 изменённых файлов: 21 добавлений и 0 удалений

Просмотреть файл

@ -328,6 +328,27 @@ nsSetDocumentStateCommand::GetCommandStateParams(const char *aCommandName,
return aParams->SetBooleanValue(STATE_ATTRIBUTE, modified);
}
else if (!nsCRT::strcmp(aCommandName, "cmd_setDocumentReadOnly"))
{
NS_ENSURE_ARG_POINTER(aParams);
PRUint32 flags;
editor->GetFlags(&flags);
PRBool isReadOnly = flags & nsIPlaintextEditor::eEditorReadonlyMask;
return aParams->SetBooleanValue(STATE_ATTRIBUTE, isReadOnly);
}
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 isCSS;
htmleditor->GetIsCSSEnabled(&isCSS);
return aParams->SetBooleanValue(STATE_ATTRIBUTE, isCSS);
}
return NS_ERROR_NOT_IMPLEMENTED;
}