XPFCapability Class Reference

This is the baseclass for the various nodes in the capability tree. More...

#include <xpfcaps.h>

Inheritance diagram for XPFCapability:

XPFCColour XPFCComplexClass XPFCFeather XPFCFill XPFCFillTrans XPFCLine XPFCLineTrans XPFCBevel XPFCBitmap XPFCBitmapEffect XPFCBlend XPFCClipView XPFCContour XPFCEllipse XPFCLayer XPFCMould XPFCPolygon XPFCRectangle XPFCShadow XPFCText List of all members.

Public Member Functions

 XPFCapability (XPFConvertType ConvertType=XPFCONVTYPE_UNKNOWN)
virtual ~XPFCapability ()
XPFCapabilityGetNext () const
XPFCapabilityGetChild () const
XPFConvertType GetConvertType () const
void SetNext (XPFCapability *pNext)
void SetChild (XPFCapability *pChild)
XPFConvertType GetConvertTypeForNode (Node *pNode)
XPFConvertType GetConvertTypeForAttrs (RenderRegion *pRegion)

Protected Member Functions

virtual BOOL DoesNodeMatch (Node *pNode)
virtual BOOL DoAttributesMatch (RenderRegion *pRegion)
virtual BOOL DoesColourMatch (DocColour *pColour)
BOOL AreAllChildrenText (Node *pRootNode, BOOL bPlain)
BOOL IsTextStoryPlain (Node *pNode)
 This determines if a text story only contains simple text. This is currently defined as flat fill, flat fill trans, constant line width, no dash patterns etc...

Protected Attributes

XPFCapabilitym_pNext
XPFCapabilitym_pChild
XPFConvertType m_ConvertType

Private Member Functions

 CC_DECLARE_MEMDUMP (XPFCapability)

Detailed Description

This is the baseclass for the various nodes in the capability tree.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/01/05

Definition at line 212 of file xpfcaps.h.


Constructor & Destructor Documentation

XPFCapability::XPFCapability XPFConvertType  ConvertType = XPFCONVTYPE_UNKNOWN  )  [inline]
 

Definition at line 218 of file xpfcaps.h.

00219     {
00220         m_pNext = NULL;
00221         m_pChild = NULL;
00222         m_ConvertType = ConvertType;
00223     }

virtual XPFCapability::~XPFCapability  )  [inline, virtual]
 

Definition at line 224 of file xpfcaps.h.

00225     {
00226         XPFCapability* pNext = NULL;
00227         XPFCapability* pCap = m_pChild;
00228         while (pCap)
00229         {
00230             pNext = pCap->GetNext();
00231             delete pCap;
00232             pCap = pNext;
00233         }
00234     }


Member Function Documentation

BOOL XPFCapability::AreAllChildrenText Node pRootNode,
BOOL  bPlain
[protected]
 

Definition at line 190 of file xpfcaps.cpp.

00191 {
00192     Node* pNode = pRootNode->FindFirstChild();
00193     while (pNode)
00194     {
00195         // Check this node
00196         if (pNode->IsAnObject())
00197         {
00198             // If it is a group then check its children
00199             if (pNode->IsAGroup() && !AreAllChildrenText(pNode, bPlain))
00200                 return(FALSE);
00201 
00202             // If it is not a text story then return false
00203             if (!IS_A(pNode, TextStory))
00204                 return(FALSE);
00205 
00206             if (bPlain && !IsTextStoryPlain(pNode))
00207                 return(FALSE);
00208         }
00209             
00210         // Move on to the next node
00211         pNode = pNode->FindNext();
00212     }
00213 
00214     return(TRUE);
00215 }

XPFCapability::CC_DECLARE_MEMDUMP XPFCapability   )  [private]
 

virtual BOOL XPFCapability::DoAttributesMatch RenderRegion pRegion  )  [inline, protected, virtual]
 

Reimplemented in XPFCFill, XPFCFillTrans, XPFCLine, XPFCLineTrans, and XPFCFeather.

Definition at line 250 of file xpfcaps.h.

00250 { return(FALSE); }

virtual BOOL XPFCapability::DoesColourMatch DocColour pColour  )  [inline, protected, virtual]
 

Reimplemented in XPFCColour.

Definition at line 251 of file xpfcaps.h.

00251 { return(FALSE); }

virtual BOOL XPFCapability::DoesNodeMatch Node pNode  )  [inline, protected, virtual]
 

Reimplemented in XPFCComplexClass, XPFCLayer, XPFCShadow, XPFCBevel, XPFCBlend, XPFCMould, XPFCRectangle, XPFCEllipse, XPFCPolygon, XPFCBitmap, XPFCText, and XPFCFeather.

Definition at line 249 of file xpfcaps.h.

00249 { return(FALSE); }

XPFCapability* XPFCapability::GetChild void   )  const [inline]
 

Definition at line 237 of file xpfcaps.h.

00237 { return(m_pChild); }

XPFConvertType XPFCapability::GetConvertType  )  const [inline]
 

Definition at line 238 of file xpfcaps.h.

00238 { return(m_ConvertType); }

XPFConvertType XPFCapability::GetConvertTypeForAttrs RenderRegion pRegion  ) 
 

Definition at line 167 of file xpfcaps.cpp.

00168 {
00169     if (!DoAttributesMatch(pRegion))
00170         return(XPFCONVTYPE_UNKNOWN);
00171     
00172     XPFConvertType Type = m_ConvertType;
00173 
00174     // Scan through the children asking any that match this node 
00175     // to return the convert type
00176 
00177     XPFCapability* pCap = m_pChild;
00178     while (pCap)
00179     {
00180         XPFConvertType ThisType = pCap->GetConvertTypeForAttrs(pRegion);
00181         if (ThisType != XPFCONVTYPE_UNKNOWN)
00182             Type = ThisType;
00183         pCap = pCap->GetNext();
00184     }
00185 
00186     return(Type);
00187 }

XPFConvertType XPFCapability::GetConvertTypeForNode Node pNode  ) 
 

Definition at line 145 of file xpfcaps.cpp.

00146 {
00147     if (!DoesNodeMatch(pNode))
00148         return(XPFCONVTYPE_UNKNOWN);
00149     
00150     XPFConvertType Type = m_ConvertType;
00151 
00152     // Scan through the children asking any that match this node 
00153     // to return the convert type
00154 
00155     XPFCapability* pCap = m_pChild;
00156     while (pCap)
00157     {
00158         XPFConvertType ThisType = pCap->GetConvertTypeForNode(pNode);
00159         if (ThisType != XPFCONVTYPE_UNKNOWN)
00160             Type = ThisType;
00161         pCap = pCap->GetNext();
00162     }
00163 
00164     return(Type);
00165 }

XPFCapability* XPFCapability::GetNext void   )  const [inline]
 

Definition at line 236 of file xpfcaps.h.

00236 { return(m_pNext); }

BOOL XPFCapability::IsTextStoryPlain Node pNode  )  [protected]
 

This determines if a text story only contains simple text. This is currently defined as flat fill, flat fill trans, constant line width, no dash patterns etc...

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/08/2005
Returns:
TRUE if the node only contains "plain" text, FALSE if it doesn't

Definition at line 232 of file xpfcaps.cpp.

00233 {
00234 //  TRACEUSER( "Gerry", _T("IsTextStoryPlain(%s)\n"), pNode->GetRuntimeClass()->m_lpszClassName);
00235 
00236     // If the node has children then we must loop through them testing each
00237     Node* pChild = pNode->FindFirstChild();
00238     while (pChild)
00239     {
00240         if (!IsTextStoryPlain(pChild))
00241             return(FALSE);
00242 
00243         pChild = pChild->FindNext();
00244     }
00245 
00246     if (pNode->IsAnAttribute())
00247     {
00248         NodeAttribute* pAttr = (NodeAttribute*)pNode;
00249 
00250         // These don't return a sensible value from GetAttributeIndex so 
00251         // we have to check the runtime class
00252         if (pAttr->GetAttributeType() == CC_RUNTIME_CLASS(AttrFillGeometry))
00253         {
00254             if (!pAttr->IsAFlatFill())
00255                 return(FALSE);
00256         }
00257         else if (pAttr->GetAttributeType() == CC_RUNTIME_CLASS(AttrTranspFillGeometry))
00258         {
00259             if (!pAttr->IsAFlatFill())
00260                 return(FALSE);
00261 
00262             TranspFillAttribute* pTrans = (TranspFillAttribute*)(pAttr->GetAttributeValue());
00263             // Get the type
00264             UINT32 Type = pTrans->GetTranspType();
00265             // If we are flat, mix and 0% trans
00266             if (Type != TT_Mix ||
00267                 *(pTrans->GetStartTransp()) != 0)
00268             {
00269                 return(FALSE);
00270             }
00271         }
00272         else
00273         {
00274             switch (pAttr->GetAttributeIndex())
00275             {
00276                 case ATTR_FILLGEOMETRY:
00277                 case ATTR_TRANSPFILLGEOMETRY:
00278                 {
00279                     TRACEUSER( "Gerry", _T("FillGeometry attribute not trapped\n"));
00280                 }
00281                 break;
00282 
00283                 case ATTR_DASHPATTERN:
00284                 {
00285                     DashPatternAttribute* pDash = (DashPatternAttribute*)(pAttr->GetAttributeValue());
00286                     DashPatternAttribute NoDash;
00287                     // If the attribute is different to the "no dash" then return FALSE
00288                     // then we do not match
00289                     if (NoDash.IsDifferent(pDash))
00290                         return(FALSE);
00291                 }
00292                 break;
00293 
00294                 case ATTR_STROKETYPE:
00295                 {
00296                     StrokeTypeAttrValue* pStroke = (StrokeTypeAttrValue*)(pAttr->GetAttributeValue());
00297                     StrokeTypeAttrValue DefStroke;
00298                     if (!((*pStroke) == DefStroke))
00299                         return(FALSE);
00300                 }
00301                 break;
00302 
00303                 case ATTR_VARWIDTH:
00304                 {
00305                     VariableWidthAttrValue* pVarWidth = (VariableWidthAttrValue*)(pAttr->GetAttributeValue());
00306                     VariableWidthAttrValue DefVarWidth;
00307                     if (!((*pVarWidth) == DefVarWidth))
00308                         return(FALSE);
00309                 }
00310                 break;
00311 
00312                 case ATTR_BRUSHTYPE:
00313                 {
00314                     BrushAttrValue* pBrush = (BrushAttrValue*)(pAttr->GetAttributeValue());
00315                     BrushAttrValue DefBrush;
00316                     if (DefBrush.IsDifferent(pBrush))
00317                         return(FALSE);
00318                 }
00319                 break;
00320                 
00321                 case ATTR_FEATHER:
00322                 {
00323                     FeatherAttrValue* pFeather = (FeatherAttrValue*)(pAttr->GetAttributeValue());
00324                     if (pFeather->GetFeatherSize() != 0)
00325                         return(FALSE);
00326                 }
00327                 break;
00328 
00329                 default:
00330                     break;
00331             }
00332         }
00333     }
00334 
00335     // We've got this far so there are no non-plain attributes and we can return TRUE
00336     return(TRUE);
00337 }

void XPFCapability::SetChild XPFCapability pChild  )  [inline]
 

Definition at line 241 of file xpfcaps.h.

00241 { m_pChild = pChild; }

void XPFCapability::SetNext XPFCapability pNext  )  [inline]
 

Definition at line 240 of file xpfcaps.h.

00240 { m_pNext = pNext; }


Member Data Documentation

XPFConvertType XPFCapability::m_ConvertType [protected]
 

Definition at line 259 of file xpfcaps.h.

XPFCapability* XPFCapability::m_pChild [protected]
 

Definition at line 258 of file xpfcaps.h.

XPFCapability* XPFCapability::m_pNext [protected]
 

Definition at line 257 of file xpfcaps.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:03:22 2007 for Camelot by  doxygen 1.4.4