Implemented new function to check if in Preformt text

This commit is contained in:
cmanske%netscape.com 1998-10-15 22:03:20 +00:00
parent 39691ea998
commit 94d9781c29

View File

@ -2435,21 +2435,23 @@ XP_Bool EDT_CanSetCharacterAttribute(MWContext * pMWContext)
if( !pMWContext || pMWContext->waitingMode || EDT_IsBlocked(pMWContext) ){
return FALSE;
}
GET_WRITABLE_EDIT_BUF_OR_RETURN(pMWContext, pEditBuffer) FALSE;
ED_ElementType type = EDT_GetCurrentElementType(pMWContext);
if( (type == ED_ELEMENT_TEXT || type == ED_ELEMENT_SELECTION ||
type >= ED_ELEMENT_TABLE) && !EDT_IsJavaScript(pMWContext) )
{
CEditContainerElement *pContainer;
return ( (type == ED_ELEMENT_TEXT || type == ED_ELEMENT_SELECTION ||
type >= ED_ELEMENT_TABLE) && !EDT_IsJavaScript(pMWContext) );
}
// TODO: Should probably go through all containers in a selection
XP_Bool EDT_IsPreformat(MWContext *pMWContext)
{
GET_EDIT_BUF_OR_RETURN(pMWContext, pEditBuffer) FALSE;
CEditInsertPoint ip;
pEditBuffer->GetInsertPoint(ip);
if( ip.m_pElement )
{
pContainer = ip.m_pElement->FindContainer();
CEditContainerElement *pContainer = ip.m_pElement->FindContainer();
if( pContainer )
return pContainer->GetType() != P_PREFORMAT;
}
return pContainer->GetType() == P_PREFORMAT;
}
return FALSE;
}