AbstractTextChar Class Reference

This is the base class for all VisibleTextNodes which have an associated Unicode character. More...

#include <nodetext.h>

Inheritance diagram for AbstractTextChar:

VisibleTextNode BaseTextClass NodeRenderableInk NodeRenderableBounded NodeRenderable Node CCObject SimpleCCObject EOLNode HorizontalTab KernCode TextChar List of all members.

Public Member Functions

 AbstractTextChar ()
 Simple AbstractTextChar constructor, it is required so that SimpleCopy will work.
 AbstractTextChar (Node *ContextNode, AttachNodeDirection Direction)
 The main TextChar constructor.
virtual String Describe (BOOL Plural, BOOL Verbose)
 Gives a description of all character nodes.
virtual UINT32 GetNodeSize () const
 For finding the size of the node.
virtual void GetDebugDetails (StringBase *Str)
 For obtaining debug information about the Node. This fn can be deleted before we ship.
virtual DocRect GetBoundingRect (BOOL DontUseAttrs=FALSE, BOOL HitTest=FALSE)
 Gets the bounds of the char if the cached bounds are invalid, they are recalculated.
virtual DocRect GetBlobBoundingRect ()
 Calculates the blob bounding box of the char based on its metrics Irrespective of their visibility.
virtual DocRect GetImagemapClickableRectangle ()
 Used to get the clickable area of this character for an imagemap.
void RenderObjectBlobs (RenderRegion *pRenderRegion)
 Renders the selection blobs.
void RenderTinyBlobs (RenderRegion *pRenderRegion)
 Renders the tiny blob, which is an outline selection box.
virtual BOOL ReCacheMetrics (FormatRegion *pFormatRegion)
 Recache metrics (and AttrdCharBound) in AbstractTextChars.
PathCreateMetricsRectPath ()
 creates a rectangular path the advance width of a char and the height of a line transformed to the correct point in the doc
BOOL GetMetricsRect (DocRect *pRect)
 return the metrics rect of a char
BOOL GetMetricsRectInStory (DocRect *pRect)
 return the metrics rect of a char relative to the TextStory Note: Not valid for text on a path!!
BOOL GetMetricsRectBounds (DocRect *pRect)
 return the bounds in the doc of the char's metrics rect
BOOL IsAnAbstractTextChar () const
virtual WCHAR GetUnicodeValue ()
MILLIPOINT GetVisibleAdvance ()
 get the visible advance with of the char ie advance width less last char tracking if at end of line
virtual MILLIPOINT GetCharWidth ()
virtual MILLIPOINT GetCharAdvance ()
virtual MILLIPOINT GetBaseLineShift ()
MILLIPOINT GetFontAscent ()
MILLIPOINT GetFontDescent ()
MILLIPOINT GetFontSize ()
void SetCharAdvance (MILLIPOINT Advance)
void SetCharWidth (MILLIPOINT Width)
void SetFontAscent (MILLIPOINT Ascent)
void SetFontDescent (MILLIPOINT Descent)
void SetFontSize (MILLIPOINT Size)
void SetBaseLineShift (MILLIPOINT Size)
void SetAttrdCharBounds (DocRect &rect)
DocRect GetAttrdCharBounds ()
virtual void PolyCopyNodeContents (NodeRenderable *pNodeCopy)
 Polymorphically copies the contents of this node to another.

Protected Member Functions

void Init ()
 common init function for constructors
void CopyNodeContents (AbstractTextChar *NodeCopy)
 This method copies the node's contents to the node pointed to by NodeCopy.
virtual NodeSimpleCopy ()
 Because this is an abstract class, the SimpleCopy method simply causes an ERROR3 to go off.
DocRect GetImagemapRectForAdjacentChars (BOOL fForwards)
 Called by GetImagemapClickableRectangle to get the clickable rectangle for this character and all the adjacent characters with the same WebAddress attribute.

Private Attributes

MILLIPOINT mCharWidth
MILLIPOINT mCharAdvance
MILLIPOINT mBaseLineShift
MILLIPOINT mFontAscent
MILLIPOINT mFontDescent
MILLIPOINT mFontSize
DocRect mAttrdCharBounds

Detailed Description

This is the base class for all VisibleTextNodes which have an associated Unicode character.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/12/94

Definition at line 214 of file nodetext.h.


Constructor & Destructor Documentation

AbstractTextChar::AbstractTextChar  ) 
 

Simple AbstractTextChar constructor, it is required so that SimpleCopy will work.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/12/94

Definition at line 1206 of file nodetext.cpp.

01206                                   : VisibleTextNode()   // Call the base class
01207 {
01208     Init();
01209 }

AbstractTextChar::AbstractTextChar Node ContextNode,
AttachNodeDirection  Direction
 

The main TextChar constructor.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/12/94
Parameters:
ContextNode,: Pointer to a node which this node is to be attached to. [INPUTS]
Direction:

Specifies the direction in which the node is to be attached to the ContextNode. The values this variable can take are as follows:

PREV : Attach node as a previous sibling of the context node NEXT : Attach node as a next sibling of the context node FIRSTCHILD: Attach node as the first child of the context node LASTCHILD : Attach node as a last child of the context node

ChCode: The UNICODE character to store in the TextChar node

Definition at line 1235 of file nodetext.cpp.

01235                                                                                   : 
01236     VisibleTextNode(ContextNode, Direction) // call the base class
01237 {
01238     Init();
01239 }


Member Function Documentation

void AbstractTextChar::CopyNodeContents AbstractTextChar NodeCopy  )  [protected]
 

This method copies the node's contents to the node pointed to by NodeCopy.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/4/93
Parameters:
A copy of this node [OUTPUTS]
Returns:
Errors: An assertion failure will occur if NodeCopy is NULL

Definition at line 1279 of file nodetext.cpp.

01280 {
01281     // Ask the base class to do its bit
01282     VisibleTextNode::CopyNodeContents( NodeCopy );
01283 
01284     // copy specifics
01285     NodeCopy->mCharWidth       = mCharWidth;
01286     NodeCopy->mCharAdvance     = mCharAdvance;
01287     NodeCopy->mFontAscent      = mFontAscent;
01288     NodeCopy->mFontDescent     = mFontDescent;
01289     NodeCopy->mFontSize        = mFontSize;
01290     NodeCopy->mBaseLineShift   = mBaseLineShift;
01291     NodeCopy->mAttrdCharBounds = mAttrdCharBounds;
01292 }

Path * AbstractTextChar::CreateMetricsRectPath  ) 
 

creates a rectangular path the advance width of a char and the height of a line transformed to the correct point in the doc

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/3/95
Returns:
pointer to path (or NULL if fails)

Definition at line 1701 of file nodetext.cpp.

01702 {
01703     DocRect rect(0,0,0,0);
01704     if (GetMetricsRect(&rect)==FALSE)
01705         return FALSE;
01706 
01707     // create the path
01708     Path* pBoundsPath=new Path(); 
01709     BOOL ok=(pBoundsPath!=NULL);
01710     if (ok) ok=pBoundsPath->Initialise(6,12);
01711     if (ok) ok=pBoundsPath->AddMoveTo(rect.lo);
01712     if (ok) ok=pBoundsPath->AddLineTo(DocCoord(rect.hi.x,rect.lo.y));   // bottom line
01713     if (ok) ok=pBoundsPath->AddLineTo(rect.hi);                     // right side
01714     if (ok) ok=pBoundsPath->AddLineTo(DocCoord(rect.lo.x,rect.hi.y));   // top line
01715     if (ok) ok=pBoundsPath->AddLineTo(rect.lo);                     // left side
01716     if (ok) ok=pBoundsPath->CloseSubPath();
01717     if (ok) pBoundsPath->IsFilled=TRUE;
01718 
01719     // transform path to correct point in doc
01720     Matrix matrix;
01721     if (ok) ok=GetStoryAndCharMatrix(&matrix);
01722     DocCoord* pPathCoords=NULL;
01723     if (ok) pPathCoords=pBoundsPath->GetCoordArray();                                
01724     if (ok) ok=(pPathCoords!=NULL);
01725     if (ok) matrix.transform((Coord*)pPathCoords, pBoundsPath->GetNumCoords());
01726 
01727     // if not OK, delete path and set return path pointer to NULL
01728     if (!ok)
01729     {
01730         delete pBoundsPath;
01731         pBoundsPath=NULL;
01732     }
01733 
01734     return pBoundsPath;
01735 }

String AbstractTextChar::Describe BOOL  Plural,
BOOL  Verbose
[virtual]
 

Gives a description of all character nodes.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/12/94
Parameters:
Plural,: Singular or plural description [INPUTS]
Returns:
A string describing the node

Reimplemented from Node.

Reimplemented in EOLNode.

Definition at line 1328 of file nodetext.cpp.

01329 {
01330     if (Plural)
01331         return(String(_R(IDS_DESCRIBE_TEXTCHARP)));  
01332     else
01333         return(String(_R(IDS_DESCRIBE_TEXTCHARS))); 
01334 }

DocRect AbstractTextChar::GetAttrdCharBounds  )  [inline]
 

Definition at line 259 of file nodetext.h.

00259 { return mAttrdCharBounds; }

virtual MILLIPOINT AbstractTextChar::GetBaseLineShift  )  [inline, virtual]
 

Reimplemented from VisibleTextNode.

Definition at line 245 of file nodetext.h.

00245 { return mBaseLineShift; }

DocRect AbstractTextChar::GetBlobBoundingRect  )  [virtual]
 

Calculates the blob bounding box of the char based on its metrics Irrespective of their visibility.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/4/95
Returns:
DocRect - Returns the bounding rect of the char and its blobs

Reimplemented from NodeRenderable.

Reimplemented in EOLNode.

Definition at line 1440 of file nodetext.cpp.

01441 {
01442     DocRect Bounds(0,0,0,0);
01443     if (GetMetricsRectBounds(&Bounds)==FALSE)
01444         return GetBoundingRect();
01445 
01446     IncludeChildrensBoundingRects(&Bounds);
01447     return Bounds;
01448 }

DocRect AbstractTextChar::GetBoundingRect BOOL  DontUseAttrs = FALSE,
BOOL  HitTest = FALSE
[virtual]
 

Gets the bounds of the char if the cached bounds are invalid, they are recalculated.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/3/94
Parameters:
DontUseAttrs - indicates that bounds of attributes applied to node should be ignored [INPUTS] Defaults to FALSE HitTest - TRUE if being called during HitTest
Returns:
The characters bounding rect

Reimplemented from NodeRenderableBounded.

Reimplemented in EOLNode.

Definition at line 1382 of file nodetext.cpp.

01383 {
01384     // if not hit testing, attrs should be included and cache is valid, return cached value
01385     if (HitTest==FALSE && DontUseAttrs==FALSE && IsBoundingRectValid)
01386         return BoundingRectangle;
01387 
01388     BOOL    ok=TRUE;
01389     DocRect TempBounds;
01390     if (HitTest)
01391         ok=GetMetricsRectBounds(&TempBounds);
01392     else
01393     {
01394         // get the matrix to transform the char to the correct point in the doc
01395         Matrix matrix;
01396         ok=GetStoryAndCharMatrix(&matrix);
01397 
01398         // get attr'd-char bounds from node, and transform them
01399         TempBounds=GetAttrdCharBounds();                                              
01400         if (ok) ok=matrix.TransformBounds(&TempBounds);
01401 
01402         // if including attrs, account for line width and recache bounds
01403         NodeAttribute* pAttr;
01404         if (ok && DontUseAttrs==FALSE && FindAppliedAttribute(CC_RUNTIME_CLASS(AttrLineWidth), &pAttr))
01405         {
01406             // get width of line and inflate bounds
01407             LineWidthAttribute* pLineWidthAttr=(LineWidthAttribute*)(pAttr->GetAttributeValue());
01408             TempBounds.Inflate( (MILLIPOINT)(pLineWidthAttr->LineWidth)/2 );
01409 
01410             // update value in cache and flag valid
01411             BoundingRectangle   = TempBounds;
01412             IsBoundingRectValid = TRUE;
01413         }
01414         // now we must also account for brush attributes
01415         NodeAttribute* pBrushAttr = NULL;
01416         if (ok && DontUseAttrs == FALSE && FindAppliedAttribute(CC_RUNTIME_CLASS(AttrBrushType), &pBrushAttr))
01417         {
01418             DocRect BrushRect = ((AttrBrushType*)pBrushAttr)->GetAttrBoundingRect(this);
01419             BoundingRectangle = BoundingRectangle.Union(BrushRect);
01420             IsBoundingRectValid = TRUE;
01421         }
01422     }
01423 
01424     // report any errors which occurred, and return the bounding box
01425     if (!ok) InformError();
01426     return TempBounds;
01427 }

virtual MILLIPOINT AbstractTextChar::GetCharAdvance  )  [inline, virtual]
 

Reimplemented from VisibleTextNode.

Definition at line 244 of file nodetext.h.

00244 { return mCharAdvance; }

virtual MILLIPOINT AbstractTextChar::GetCharWidth  )  [inline, virtual]
 

Reimplemented from VisibleTextNode.

Definition at line 243 of file nodetext.h.

00243 { return mCharWidth; }

void AbstractTextChar::GetDebugDetails StringBase Str  )  [virtual]
 

For obtaining debug information about the Node. This fn can be deleted before we ship.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/2/95
Parameters:
Str,: String giving debug info about the node [OUTPUTS]

Reimplemented from VisibleTextNode.

Reimplemented in TextChar, KernCode, and EOLNode.

Definition at line 1363 of file nodetext.cpp.

01364 {
01365     VisibleTextNode::GetDebugDetails(Str);
01366 }

MILLIPOINT AbstractTextChar::GetFontAscent  )  [inline]
 

Definition at line 247 of file nodetext.h.

00247 { return mFontAscent; }

MILLIPOINT AbstractTextChar::GetFontDescent  )  [inline]
 

Definition at line 248 of file nodetext.h.

00248 { return mFontDescent; }

MILLIPOINT AbstractTextChar::GetFontSize  )  [inline]
 

Definition at line 249 of file nodetext.h.

00249 { return mFontSize; }

DocRect AbstractTextChar::GetImagemapClickableRectangle  )  [virtual]
 

Used to get the clickable area of this character for an imagemap.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/3/97
Parameters:
- [INPUTS]
Returns:
The bounding rectangle of this character and all adjacent characters in the same line with the same Web Address attribute
The clickable area of this character is defined as the bounding rectangle of all adjacent characters with the same Web Address attribute. This is so that sequences of characters with the same Web Address attribute present a single clickable area, rather than a lot of separate areas.

The way it does this is by calling our helper function GetImagemapRectForAdjacentChars twice: once to get the clickable rectangle of the characters before this, once to get the clickable rectangle of the characters after this.

Reimplemented from NodeRenderableBounded.

Definition at line 1472 of file nodetext.cpp.

01473 {
01474     DocRect rectPrevious=GetImagemapRectForAdjacentChars(FALSE);
01475     DocRect rectNext=GetImagemapRectForAdjacentChars(TRUE);
01476 
01477     rectPrevious=rectPrevious.Union(rectNext);
01478 
01479     return rectPrevious;
01480 }

DocRect AbstractTextChar::GetImagemapRectForAdjacentChars BOOL  fForwards  )  [protected]
 

Called by GetImagemapClickableRectangle to get the clickable rectangle for this character and all the adjacent characters with the same WebAddress attribute.

Author:
Graham_Walmsley (Xara Group Ltd) <camelotdev@xara.com>
Date:
27/3/97
Parameters:
fForwards TRUE for the characters after this one [INPUTS] FALSE for the character before this one
Returns:
The bounding rectangle of this character and all characters (before/after) this one in this line with the same Web Address attribute.
See also:
AbstractTextChar::GetImagemapClickableRectangle()

Definition at line 1501 of file nodetext.cpp.

01502 {
01503     //First set up a pointer to the node we're currently looking at.
01504     //It will start at this text character
01505     //and scan either forwards or backwards
01506     AbstractTextChar* patcLookNode=this;
01507 
01508     //This flag tells us whether we are pointing at a character with
01509     //the same Web Address attribute as this one
01510     BOOL fSameAttribute=TRUE;
01511 
01512     //And this is the DocRect we will return
01513     DocRect rectToReturn=GetBoundingRect(FALSE, TRUE);
01514 
01515     //And let's find the Web Address attribute applied to this character
01516     AttrWebAddress* pwaThisAttribute=NULL;
01517 
01518     FindAppliedAttribute(CC_RUNTIME_CLASS(AttrWebAddress), (NodeAttribute**) &pwaThisAttribute);
01519     
01520     //While the node we're looking at exists, and has the same
01521     //Web Address attribute applied to it as this one
01522     while (patcLookNode && fSameAttribute)
01523     {
01524         //Then get the bounding box of that node
01525         DocRect rectLookNode=patcLookNode->GetBoundingRect(FALSE,TRUE);
01526 
01527         //Expand our rectangle to return to include that bounding box
01528         rectToReturn=rectToReturn.Union(rectLookNode);
01529 
01530         //Then move the pointer either forwards or backwards
01531         if (fForwards)
01532             patcLookNode=patcLookNode->FindNextAbstractTextCharInLine();
01533         else
01534             patcLookNode=patcLookNode->FindPrevAbstractTextCharInLine();
01535 
01536         //Now, if we are still looking at a node
01537         if (patcLookNode)
01538         {
01539             //Then find the attribute applied to that node
01540             AttrWebAddress* pwaLookAttribute=NULL;
01541 
01542             patcLookNode->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrWebAddress), (NodeAttribute**) &pwaLookAttribute);
01543             ERROR2IF(pwaLookAttribute==NULL, DocRect(0,0,0,0), "AbstractTextChar::GetImagemapRectForAdjacentChars got no applied attribute!");
01544         
01545             //And test whether it's the same as the attribute applied to this node
01546             fSameAttribute=(*pwaLookAttribute==*pwaThisAttribute);
01547         }
01548     }
01549 
01550     //Then return the rectangle we've created
01551     return rectToReturn;
01552 }

BOOL AbstractTextChar::GetMetricsRect DocRect pRect  ) 
 

return the metrics rect of a char

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/4/95 Outputs pRect -
Returns:
FALSE if fails

Definition at line 1616 of file nodetext.cpp.

01617 {
01618     ERROR2IF(pRect==NULL,FALSE,"AbstractTextChar::GetMetricsRect() - pRect==NULL");
01619 
01620     TextLine* pTextLine=(TextLine*)FindParent();
01621     ERROR2IF(pTextLine==NULL,FALSE,"AbstractTextChar::GetMetricsRect - pTextLine==NULL");
01622 
01623     // get a rect (relative to the TextStory) from the bottom left to top right of the char
01624     pRect->lo.y = pTextLine->GetLineDescent();
01625     pRect->hi.y = pTextLine->GetLineAscent();
01626     pRect->lo.x = 0;
01627     pRect->hi.x = 0;
01628     MILLIPOINT advance=GetVisibleAdvance();
01629     if (advance>=0)
01630         pRect->hi.x = advance;
01631     else
01632         pRect->lo.x = advance;
01633 
01634     return TRUE;
01635 }

BOOL AbstractTextChar::GetMetricsRectBounds DocRect pRect  ) 
 

return the bounds in the doc of the char's metrics rect

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/4/95 Outputs pRect -
Returns:
FALSE if fails

Definition at line 1673 of file nodetext.cpp.

01674 {
01675     ERROR2IF(pRect==NULL,FALSE,"AbstractTextChar::GetMetricsRectInStory() - pRect==NULL");
01676 
01677     Matrix matrix;
01678     if (GetStoryAndCharMatrix(&matrix)==FALSE)
01679         return FALSE;
01680 
01681     if (GetMetricsRect(pRect)==FALSE)
01682         return FALSE;
01683 
01684     if (matrix.TransformBounds(pRect)==FALSE)
01685         return FALSE;
01686 
01687     return TRUE;
01688 }

BOOL AbstractTextChar::GetMetricsRectInStory DocRect pRect  ) 
 

return the metrics rect of a char relative to the TextStory Note: Not valid for text on a path!!

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/4/95 Outputs pRect -
Returns:
FALSE if fails

Definition at line 1649 of file nodetext.cpp.

01650 {
01651     ERROR2IF(pRect==NULL,FALSE,"AbstractTextChar::GetMetricsRectInStory() - pRect==NULL");
01652 
01653     if (GetMetricsRect(pRect)==FALSE)
01654         return FALSE;
01655 
01656     // make it relative to the story!
01657     GetpMatrix()->transform((Coord*)&(pRect->lo),2);
01658 
01659     return TRUE;
01660 }

UINT32 AbstractTextChar::GetNodeSize  )  const [virtual]
 

For finding the size of the node.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/12/94
Returns:
The size of the node in bytes

Reimplemented from VisibleTextNode.

Reimplemented in TextChar, KernCode, HorizontalTab, and EOLNode.

Definition at line 1346 of file nodetext.cpp.

01347 {
01348     ERROR3("Trying to find the size of an AbstractTextChar ?"); 
01349     return (sizeof(AbstractTextChar)); 
01350 }

virtual WCHAR AbstractTextChar::GetUnicodeValue  )  [inline, virtual]
 

Reimplemented in TextChar.

Definition at line 240 of file nodetext.h.

00240 { return FONTEMCHAR; }

MILLIPOINT AbstractTextChar::GetVisibleAdvance  ) 
 

get the visible advance with of the char ie advance width less last char tracking if at end of line

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/4/95
Returns:
pointer to path (or NULL if fails)

Definition at line 1821 of file nodetext.cpp.

01822 {
01823     if (IS_A(this,TextChar) && FindNext(CC_RUNTIME_CLASS(AbstractTextChar))==NULL)
01824          return GetCharWidth();
01825 
01826     return GetCharAdvance();
01827 }

void AbstractTextChar::Init void   )  [protected]
 

common init function for constructors

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/2/96

Reimplemented from VisibleTextNode.

Definition at line 1186 of file nodetext.cpp.

01187 {
01188     mCharWidth       = 0;
01189     mCharAdvance     = 0;
01190     mFontAscent      = 0;
01191     mFontDescent     = 0;
01192     mFontSize        = 0;
01193     mBaseLineShift   = 0;
01194     mAttrdCharBounds = DocRect(0,0,0,0);
01195 }

BOOL AbstractTextChar::IsAnAbstractTextChar  )  const [inline, virtual]
 

Reimplemented from Node.

Definition at line 239 of file nodetext.h.

00239 { return TRUE; }

void AbstractTextChar::PolyCopyNodeContents NodeRenderable pNodeCopy  )  [virtual]
 

Polymorphically copies the contents of this node to another.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/12/2003
Parameters:
- [OUTPUTS]
Returns:
Errors: An assertion failure will occur if NodeCopy is NULL Scope: protected

Reimplemented from BaseTextClass.

Reimplemented in TextChar, KernCode, HorizontalTab, and EOLNode.

Definition at line 1307 of file nodetext.cpp.

01308 {
01309     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
01310     ENSURE(IS_A(pNodeCopy, AbstractTextChar), "PolyCopyNodeContents given wrong dest node type");
01311 
01312     if (IS_A(pNodeCopy, AbstractTextChar))
01313         CopyNodeContents((AbstractTextChar*)pNodeCopy);
01314 }

BOOL AbstractTextChar::ReCacheMetrics FormatRegion pFormatRegion  )  [virtual]
 

Recache metrics (and AttrdCharBound) in AbstractTextChars.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/2/96
Parameters:
pFormatRegion - [INPUTS]
Returns:
FALSE if fails

Reimplemented from BaseTextClass.

Definition at line 1747 of file nodetext.cpp.

01748 {
01749 #ifndef DISABLE_TEXT_RENDERING
01750     // get metrics for this char with current attribute stack
01751     CharMetrics metrics;
01752     if (pFormatRegion->GetCharMetrics(&metrics,GetUnicodeValue())==FALSE)
01753         return FALSE;
01754 
01755     // set font ascent, descent and size
01756     SetFontAscent( metrics.FontAscent);
01757     SetFontDescent(metrics.FontDescent);
01758     SetFontSize(pFormatRegion->GetFontSize());
01759     SetBaseLineShift(pFormatRegion->GetBaseLineShift());
01760 
01761     // set char width and advance width inc tracking ...
01762     if (IS_A(this,KernCode))
01763     {
01764         INT32       KernInEmBy1000 = ((KernCode*)this)->GetValue().x;
01765         MILLIPOINT KernInMP       = MulDiv(KernInEmBy1000, metrics.FontEmWidth, 1000);
01766         SetCharWidth(KernInMP);
01767         SetCharAdvance(GetCharWidth());
01768     }
01769     else if (IS_A(this,HorizontalTab))
01770     {
01771         /* tab widths are not dependent on attributes, so do not do anything */
01772     }
01773     else if (this->IsAnEOLNode())
01774     {
01775         SetCharWidth(0);
01776         SetCharAdvance(0);
01777     }
01778     else
01779     {
01780         SetCharWidth(metrics.CharWidth);
01781         MILLIPOINT TrackingInMP       = 0;
01782         MILLIPOINT TrackingInEmBy1000 = pFormatRegion->GetTracking();
01783         if (TrackingInEmBy1000 !=0 )
01784             TrackingInMP = MulDiv(TrackingInEmBy1000, metrics.FontEmWidth, 1000);
01785 
01786         TextStory *story = FindParentStory();
01787         if (story)
01788         {
01789             if (story->IsAutoKerning())
01790                 SetCharAdvance(GetCharWidth()+TrackingInMP+GetAutoKernSize(pFormatRegion));
01791             else
01792                 SetCharAdvance(GetCharWidth()+TrackingInMP);
01793         }
01794         else
01795             ERROR3("Can't find base story");
01796     }
01797 
01798     // set AttrdCharBounds (if zero size (or kern code), set to sensible size for hit test)
01799     DocRect AttrdCharBounds(0,0,0,0);
01800     if (!IS_A(this,KernCode) && !IS_A(this,HorizontalTab))
01801         if (pFormatRegion->GetAttrdCharBounds(&AttrdCharBounds,GetUnicodeValue())==FALSE)
01802             return FALSE;
01803     if (AttrdCharBounds.IsEmpty())
01804         AttrdCharBounds.hi = DocCoord(GetCharAdvance(),pFormatRegion->GetFontSize()/3);
01805     SetAttrdCharBounds(AttrdCharBounds);
01806 #endif
01807     return TRUE;
01808 }

void AbstractTextChar::RenderObjectBlobs RenderRegion pRenderRegion  )  [virtual]
 

Renders the selection blobs.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/4/95
Parameters:
pRenderRegion - region to render the blobs into [INPUTS]

Reimplemented from NodeRenderable.

Reimplemented in EOLNode.

Definition at line 1564 of file nodetext.cpp.

01565 {
01566 #if !defined(EXCLUDE_FROM_RALPH)
01567     Path* pPath=CreateMetricsRectPath();
01568     if (pPath!=NULL && pRenderRegion!=NULL)
01569     {
01570         DocColour Trans(COLOUR_TRANS);
01571         pRenderRegion->SetLineWidth(0);
01572         pRenderRegion->SetLineColour(Trans);
01573         pRenderRegion->SetFillColour(COLOUR_UNSELECTEDBLOB);
01574         pRenderRegion->DrawPath(pPath);
01575         delete pPath;
01576     }
01577 #endif
01578 }

void AbstractTextChar::RenderTinyBlobs RenderRegion pRenderRegion  )  [virtual]
 

Renders the tiny blob, which is an outline selection box.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/4/95
Parameters:
pRenderRegion - region to render the blobs into [INPUTS]

Reimplemented from NodeRenderable.

Reimplemented in EOLNode.

Definition at line 1590 of file nodetext.cpp.

01591 {
01592 #if !defined(EXCLUDE_FROM_RALPH)
01593     Path* pPath=CreateMetricsRectPath();
01594     if (pPath!=NULL && pRenderRegion!=NULL)
01595     {
01596         DocColour Trans(COLOUR_TRANS);
01597         pRenderRegion->SetLineColour(COLOUR_UNSELECTEDBLOB);
01598         pRenderRegion->SetFillColour(Trans);
01599         pRenderRegion->DrawPath(pPath);
01600         delete pPath;
01601     }
01602 #endif
01603 }

void AbstractTextChar::SetAttrdCharBounds DocRect rect  )  [inline]
 

Definition at line 258 of file nodetext.h.

00258 { mAttrdCharBounds = rect; }

void AbstractTextChar::SetBaseLineShift MILLIPOINT  Size  )  [inline]
 

Definition at line 256 of file nodetext.h.

00256 { mBaseLineShift = Size; }

void AbstractTextChar::SetCharAdvance MILLIPOINT  Advance  )  [inline]
 

Definition at line 251 of file nodetext.h.

00251 { mCharAdvance   = Advance; }

void AbstractTextChar::SetCharWidth MILLIPOINT  Width  )  [inline]
 

Definition at line 252 of file nodetext.h.

00252 { mCharWidth     = Width; }

void AbstractTextChar::SetFontAscent MILLIPOINT  Ascent  )  [inline]
 

Definition at line 253 of file nodetext.h.

00253 { mFontAscent    = Ascent; }

void AbstractTextChar::SetFontDescent MILLIPOINT  Descent  )  [inline]
 

Definition at line 254 of file nodetext.h.

00254 { mFontDescent   = Descent; }

void AbstractTextChar::SetFontSize MILLIPOINT  Size  )  [inline]
 

Definition at line 255 of file nodetext.h.

00255 { mFontSize      = Size; }

Node * AbstractTextChar::SimpleCopy void   )  [protected, virtual]
 

Because this is an abstract class, the SimpleCopy method simply causes an ERROR3 to go off.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/12/94
Returns:

Reimplemented from VisibleTextNode.

Reimplemented in TextChar, KernCode, HorizontalTab, and EOLNode.

Definition at line 1252 of file nodetext.cpp.

01253 {
01254     ERROR3("Calling abstract classes SimpleCopy");
01255 
01256     // Well I suppose we should do the copy if the call gets into the retail 
01257     AbstractTextChar* NodeCopy = new AbstractTextChar();
01258 
01259     ERROR1IF(NodeCopy==NULL, NULL, _R(IDE_NOMORE_MEMORY)); 
01260 
01261     if (NodeCopy)
01262         CopyNodeContents(NodeCopy);
01263     
01264     return NodeCopy;
01265 }


Member Data Documentation

DocRect AbstractTextChar::mAttrdCharBounds [private]
 

Definition at line 277 of file nodetext.h.

MILLIPOINT AbstractTextChar::mBaseLineShift [private]
 

Definition at line 273 of file nodetext.h.

MILLIPOINT AbstractTextChar::mCharAdvance [private]
 

Definition at line 272 of file nodetext.h.

MILLIPOINT AbstractTextChar::mCharWidth [private]
 

Definition at line 271 of file nodetext.h.

MILLIPOINT AbstractTextChar::mFontAscent [private]
 

Definition at line 274 of file nodetext.h.

MILLIPOINT AbstractTextChar::mFontDescent [private]
 

Definition at line 275 of file nodetext.h.

MILLIPOINT AbstractTextChar::mFontSize [private]
 

Definition at line 276 of file nodetext.h.


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