XPFCText Class Reference

This is the class for Text capabilities. More...

#include <xpfcaps.h>

Inheritance diagram for XPFCText:

XPFCComplexClass XPFCapability List of all members.

Public Member Functions

 XPFCText (XPFConvertType ConvertType, XPFBOOL bOnPath, XPFBOOL bComplex, XPFBOOL bPlain, XPFBOOL bAutoKern, XPFBOOL bJustified)
virtual ~XPFCText ()

Protected Member Functions

virtual BOOL DoesNodeMatch (Node *pNode)
BOOL IsNodeJustified (Node *pNode)
 This determines if a text story uses non-left justification.

Protected Attributes

XPFBOOL m_bOnPath
XPFBOOL m_bComplex
XPFBOOL m_bPlain
XPFBOOL m_bAutoKern
XPFBOOL m_bJustified

Private Member Functions

 CC_DECLARE_MEMDUMP (XPFCText)

Detailed Description

This is the class for Text capabilities.

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

Definition at line 684 of file xpfcaps.h.


Constructor & Destructor Documentation

XPFCText::XPFCText XPFConvertType  ConvertType,
XPFBOOL  bOnPath,
XPFBOOL  bComplex,
XPFBOOL  bPlain,
XPFBOOL  bAutoKern,
XPFBOOL  bJustified
[inline]
 

Definition at line 690 of file xpfcaps.h.

00691         : XPFCComplexClass(CC_RUNTIME_CLASS(TextStory), ConvertType)
00692     {
00693         m_bOnPath = bOnPath;
00694         m_bComplex = bComplex;
00695         m_bPlain = bPlain;
00696         m_bAutoKern = bAutoKern;
00697         m_bJustified = bJustified;
00698     }

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

Definition at line 699 of file xpfcaps.h.

00700     {
00701     }


Member Function Documentation

XPFCText::CC_DECLARE_MEMDUMP XPFCText   )  [private]
 

BOOL XPFCText::DoesNodeMatch Node pNode  )  [protected, virtual]
 

Reimplemented from XPFCComplexClass.

Definition at line 638 of file xpfcaps.cpp.

00639 {
00640     // If we aren't the correct type of node then return
00641     if (!XPFCComplexClass::DoesNodeMatch(pNode))
00642         return(FALSE);
00643 
00644     TextStory* pStory = (TextStory*)pNode;
00645 
00646     // Now test the property attributes
00647     if (m_bOnPath != XPFB_UNKNOWN)
00648     {
00649         // Check if the text is on a path
00650         BOOL bOnPath = (pStory->GetTextPath() != NULL);
00651         if (bOnPath != m_bOnPath)
00652             return(FALSE);
00653     }
00654     
00655     if (m_bComplex != XPFB_UNKNOWN)
00656     {
00657         // Check the story matrix for any rotation or shear
00658         Matrix mStory = pStory->GetStoryMatrix();
00659         ANGLE Rot = 0;
00660         ANGLE Shear = 0;
00661         mStory.Decompose(NULL, NULL, &Rot, &Shear, NULL, NULL);
00662         BOOL bComplex = !(Rot == 0 && Shear == 0);
00663         if (bComplex != m_bComplex)
00664             return(FALSE);
00665     }
00666 
00667     if (m_bPlain != XPFB_UNKNOWN)
00668     {
00669         // Scan story for non-plain attributes
00670         BOOL bPlain = IsTextStoryPlain(pStory);
00671         TRACEUSER( "Gerry", _T("IsTextStoryPlain returned %s\n"), bPlain ? _T("true") : _T("false"));
00672         if (bPlain != m_bPlain)
00673             return(FALSE);
00674     }
00675 
00676     if (m_bAutoKern != XPFB_UNKNOWN)
00677     {
00678         // Check if the story is auto-kerned
00679         if (pStory->IsAutoKerning() != m_bAutoKern)
00680             return(FALSE);
00681     }
00682     
00683     if (m_bJustified != XPFB_UNKNOWN)
00684     {
00685         // Check if the story uses non-left justification
00686         BOOL bJustified = IsNodeJustified(pNode);
00687         if (bJustified != m_bJustified)
00688             return(FALSE);
00689     }
00690     
00691     return(TRUE);
00692 }

BOOL XPFCText::IsNodeJustified Node pRootNode  )  [protected]
 

This determines if a text story uses non-left justification.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/09/2005
Returns:
TRUE if the node contains non-"left justified" text, FALSE if it only uses left justify

Definition at line 708 of file xpfcaps.cpp.

00709 {
00710 //  TRACEUSER( "Gerry", _T("IsNodeJustified(%s)\n"), pRootNode->GetRuntimeClass()->m_lpszClassName);
00711 
00712     // If this isn't a renderable ink node then get out
00713     if (!pRootNode->IS_KIND_OF(NodeRenderableInk))
00714         return(FALSE);
00715 
00716     NodeRenderableInk* pInkNode = (NodeRenderableInk*)pRootNode;
00717 
00718     // We scan through the tree looking for any AttrTxtJustification nodes
00719     Node* pNode = pRootNode->FindFirstDepthFirst();
00720     while (pNode)
00721     {
00722         // Check this node
00723         if (pNode->IsAnAttribute() && pNode->IS_KIND_OF(AttrTxtJustification))
00724         {
00725             AttrTxtJustification* pAttr = (AttrTxtJustification*)pNode;
00726             if (pAttr->Value.justification != JLEFT)
00727                 return(TRUE);
00728         }
00729 
00730         // Move on to the next node
00731         pNode = pNode->FindNextDepthFirst(pRootNode);
00732     }
00733 
00734     // No justification in the story so test the applied justification ignoring children
00735     AttrTxtJustification* pAttr = (AttrTxtJustification*)(pInkNode->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrTxtJustification), TRUE));
00736     if (pAttr && pAttr->Value.justification != JLEFT)
00737         return(TRUE);
00738 
00739     // We've got this far so there are no non-left attributes and we can return FALSE
00740     return(FALSE);
00741 }


Member Data Documentation

XPFBOOL XPFCText::m_bAutoKern [protected]
 

Definition at line 711 of file xpfcaps.h.

XPFBOOL XPFCText::m_bComplex [protected]
 

Definition at line 709 of file xpfcaps.h.

XPFBOOL XPFCText::m_bJustified [protected]
 

Definition at line 712 of file xpfcaps.h.

XPFBOOL XPFCText::m_bOnPath [protected]
 

Definition at line 708 of file xpfcaps.h.

XPFBOOL XPFCText::m_bPlain [protected]
 

Definition at line 710 of file xpfcaps.h.


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