From b437ecfbf4433d1ea645a00f076d63cfef892f76 Mon Sep 17 00:00:00 2001 From: "cmanske%netscape.com" Date: Thu, 15 Oct 1998 22:03:20 +0000 Subject: [PATCH] Implemented new function to check if in Preformt text git-svn-id: svn://10.0.0.236/trunk@12931 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/lib/layout/edtutil.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/mozilla/lib/layout/edtutil.cpp b/mozilla/lib/layout/edtutil.cpp index 8de76dd21c0..fc2437fde80 100644 --- a/mozilla/lib/layout/edtutil.cpp +++ b/mozilla/lib/layout/edtutil.cpp @@ -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) ) + 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 ) { - CEditContainerElement *pContainer; - CEditInsertPoint ip; - pEditBuffer->GetInsertPoint(ip); - if( ip.m_pElement ) - { - pContainer = ip.m_pElement->FindContainer(); - if( pContainer ) - return pContainer->GetType() != P_PREFORMAT; - } + CEditContainerElement *pContainer = ip.m_pElement->FindContainer(); + if( pContainer ) + return pContainer->GetType() == P_PREFORMAT; } return FALSE; }