CaretNode Class Reference

Some Notes about the Caret. More...

#include <nodetext.h>

Inheritance diagram for CaretNode:

VisibleTextNode BaseTextClass NodeRenderableInk NodeRenderableBounded NodeRenderable Node CCObject SimpleCCObject List of all members.

Public Member Functions

 CaretNode ()
 Simple CaretNode constructor, it is required so that SimpleCopy will work.
 CaretNode (Node *ContextNode, AttachNodeDirection Direction)
 The main CaretNode constructor.
virtual void SetSelected (BOOL Status)
 Overides the normal SetSelected call so we can ensure that the caret is not selected outside the TextTool.
virtual BOOL DiscardsAttributeChildren () const
 When attributes are applied to the caret, we cannot generate undo info as children of the CaretNode are thrown away in a non-undoable way.
BOOL DoApplyAttrsTo (UndoableOperation *pUndoOp, VisibleTextNode *pDstVTN, BOOL bDeleteDups=TRUE)
 Apply attrs on caret to given VTN (on same line) ensuring tree left optimal.
PathCreatePath (Matrix *pMatrix)
 Create a caret path.
void RenderObjectBlobs (RenderRegion *pRender)
 Renders the caret's path into the pRender render region.
BOOL RenderObjectBlobsCore (RenderRegion *pRender)
 Renders the caret's path into the pRender render region.
virtual BOOL ValidateBoundingRect (FormatRegion *pFormatRegion=NULL)
 recache the caret's renderable and blob bounding rects
virtual DocRect GetBoundingRect (BOOL DontUseAttrs=FALSE, BOOL HitTest=FALSE)
virtual DocRect GetBlobBoundingRect ()
 get the caret's blob bounds Note: Abuse of bounding box cache should really be for renderable bounds but the caret has none!
virtual BOOL ExportRender (RenderRegion *pRegion)
 This function is called when the render function passes through this node It outputs the Text Object start and end tokens.
virtual UINT32 GetNodeSize () const
 For finding the size of the CaretNode.
virtual void GetDebugDetails (StringBase *Str)
 For obtaining debug information about the Node. This fn can be deleted before we ship.
virtual String Describe (BOOL Plural, BOOL Verbose)
 For obtaining a desciption about the node to use in the status line.
virtual BOOL IsACaret () const
BOOL HasMoved ()
 reposition the caret after it has moved If possible to the right of the previous char as the caret takes its attributes from this char so the caret's position reflects it's baseline shift correctly
virtual BOOL WritePreChildrenWeb (BaseCamelotFilter *pFilter)
 Writes a caret node record to the new file format filter.
virtual BOOL WritePreChildrenNative (BaseCamelotFilter *pFIlter)
virtual BOOL CanWriteChildrenWeb (BaseCamelotFilter *pFilter)
 If the node does not mind the filter automatically writing out its child nodes, then return TRUE.
virtual BOOL CanWriteChildrenNative (BaseCamelotFilter *pFilter)

Protected Member Functions

virtual NodeSimpleCopy ()
 It is illegal to copy a CaretNode, therefore this function will generate an error if called. But blends, moulds etc. call this function so I (Peter) have implemented it Fix after the show.

Private Attributes

DocRect BlobBounds

Detailed Description

Some Notes about the Caret.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/2/95
There will be a single CaretNode stored in every TextObject.

The Caret's path will be rendered by the TextStory as an object blob, this is so that it only gets shown if the Text object is selected.

The appearance of the Caret will vary depending on what is going on around it. In particular its height will be dependent on the heights of its ajacent chars. Because of this it makes sense to delay generating the caret's path until it needs to be rendered.

Definition at line 423 of file nodetext.h.


Constructor & Destructor Documentation

CaretNode::CaretNode  ) 
 

Simple CaretNode 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 2534 of file nodetext.cpp.

02534                     : VisibleTextNode() // Call the base class
02535 {
02536 }

CaretNode::CaretNode Node ContextNode,
AttachNodeDirection  Direction
 

The main CaretNode constructor.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
07/02/95
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

Definition at line 2559 of file nodetext.cpp.

02560                                                       : VisibleTextNode(ContextNode, Direction)
02561 {
02562 }


Member Function Documentation

BOOL CaretNode::CanWriteChildrenNative BaseCamelotFilter pFilter  )  [virtual]
 

Reimplemented from Node.

Definition at line 3124 of file nodetext.cpp.

03125 {
03126     return FALSE;
03127 }

BOOL CaretNode::CanWriteChildrenWeb BaseCamelotFilter pFilter  )  [virtual]
 

If the node does not mind the filter automatically writing out its child nodes, then return TRUE.

> virtual BOOL Node::CanWriteChildrenWeb(BaseCamelotFilter* pFilter)

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/5/96
Parameters:
pFilter = ptr to filter to write to [INPUTS]
Returns:
TRUE if ok to automatically write out the children, FALSE otherwise
If, however, you wish to prevent this (e.g. because you want to save out your child nodes yourself, in some selective fashion), then return FALSE

See also:
WritePostChildrenWeb(), WritePreChildrenWeb()

Reimplemented from Node.

Definition at line 3119 of file nodetext.cpp.

03120 {
03121     return FALSE;
03122 }

Path * CaretNode::CreatePath Matrix pMatrix  ) 
 

Create a caret path.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/395
Parameters:
pMatrix - transform to be applied to the caret [INPUTS]
Returns:
pointer to new path (or NULL if fails)

Definition at line 2633 of file nodetext.cpp.

02634 {   
02635     ERROR2IF(pMatrix==NULL,NULL,"CaretNode::CreatePath() - pMatrix==NULL");
02636 
02637     TextLine* pTextLine=(TextLine*)FindParent();
02638     ERROR2IF(pTextLine==NULL,FALSE,"CaretNode::CreatePath() - pTextLine==NULL");
02639 
02640     // find italic status on caret
02641     NodeAttribute* pAttr;
02642     BOOL Italic=FALSE;
02643     if (FindAppliedAttribute(CC_RUNTIME_CLASS(AttrTxtItalic), &pAttr))
02644         Italic=((TxtItalicAttribute*)(pAttr->GetAttributeValue()))->ItalicOn;
02645 
02646     // find script offest
02647     FIXED16 ScriptOffset=0;
02648     if (FindAppliedAttribute(CC_RUNTIME_CLASS(AttrTxtScript), &pAttr))
02649         ScriptOffset=((TxtScriptAttribute*)(pAttr->GetAttributeValue()))->Offset;
02650 
02651     // find caret height
02652     MILLIPOINT LineSize  = pTextLine->GetLineSize();
02653     MILLIPOINT CaretSize = LineSize;
02654     if (FindAppliedAttribute(CC_RUNTIME_CLASS(AttrTxtFontSize), &pAttr))
02655         CaretSize=((TxtFontSizeAttribute*)(pAttr->GetAttributeValue()))->FontSize;
02656 
02657     // find baseline shift
02658 //  MILLIPOINT BaseLineShift=0;
02659 //  if (FindAppliedAttribute(CC_RUNTIME_CLASS(AttrTxtBaseLine), &pAttr))
02660 //      BaseLineShift=((TxtBaseLineAttribute*)(pAttr->GetAttributeValue()))->Value;
02661 
02662     // calc caret top and bottom points accounting for italic and baseline shift
02663     FIXED16             CaretRatio=(LineSize!=0) ? Div32By32(CaretSize,LineSize) : 1;
02664     DocCoord            CaretTop(0, XLONG(pTextLine->GetLineDescent()) * CaretRatio );
02665     DocCoord            CaretBot(0, XLONG(pTextLine->GetLineAscent()) * CaretRatio );
02666     if (Italic && ScriptOffset==0)
02667     {
02668         const double SlantRatio = tan(15.0*PI/180);
02669         CaretTop.x = (INT32) ((double)CaretTop.y * SlantRatio);
02670         CaretBot.x = (INT32) ((double)CaretBot.y * SlantRatio);
02671     }
02672 
02673     // get caret path
02674     Path* pCaretPath=new Path(); 
02675     BOOL ok=(pCaretPath!=NULL);
02676     if (ok) ok=pCaretPath->Initialise(2,12);
02677     if (ok) ok=pCaretPath->AddMoveTo(CaretTop);
02678     if (ok) ok=pCaretPath->AddLineTo(CaretBot);
02679 
02680     // apply transform to caret path
02681     DocCoord* pPathCoords=NULL;
02682     if (ok) pPathCoords=pCaretPath->GetCoordArray();                                 
02683     if (ok) ok=(pPathCoords!=NULL);
02684     if (ok) pMatrix->transform((Coord*)pPathCoords, pCaretPath->GetNumCoords());
02685 
02686     // if not OK, delete caret path and set return path pointer to NULL
02687     if (!ok)
02688     {
02689         delete pCaretPath;
02690         pCaretPath=NULL;
02691     }
02692 
02693     return pCaretPath;
02694 } 

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

For obtaining a desciption about the node to use in the status line.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/03/95
Parameters:
Plural - FALSE to describe a single caret [INPUTS] TRUE to describe many
Returns:
String describing what the node is

Reimplemented from Node.

Definition at line 2796 of file nodetext.cpp.

02797 {
02798     if (Plural)
02799         return(String(_R(IDS_CARETSDESCRIPTION)));  
02800     else
02801         return(String(_R(IDS_CARETDESCRIPTION))); 
02802 }

BOOL CaretNode::DiscardsAttributeChildren  )  const [virtual]
 

When attributes are applied to the caret, we cannot generate undo info as children of the CaretNode are thrown away in a non-undoable way.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/5/95
Returns:
TRUE
Notes: Phil, 24/09/2005 The usage of this function has changed subtly today. It used to prevent both attribute optimisation and undo recording on Caret nodes. As of today it just prevents undo recording - attribute optimisation goes ahead like normal on Caret nodes so that they behave more consistently.

Reimplemented from Node.

Definition at line 2985 of file nodetext.cpp.

02986 {
02987     return TRUE;
02988 }

BOOL CaretNode::DoApplyAttrsTo UndoableOperation pUndoOp,
VisibleTextNode pDstVTN,
BOOL  bDeleteDups = TRUE
 

Apply attrs on caret to given VTN (on same line) ensuring tree left optimal.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/7/96
Parameters:
pDstVTN - VisibleTextNode to apply caret attrs to [INPUTS]
Returns:
FALSE if fails

Definition at line 3001 of file nodetext.cpp.

03002 {
03003     ERROR2IF(pUndoOp==NULL,FALSE,"CaretNode::DoApplyAttrsTo() - pUndoOp==NULL");
03004     ERROR2IF(pDstVTN==NULL,FALSE,"CaretNode::DoApplyAttrsTo() - pDstVTN==NULL");
03005 
03006     TextLine* pCaretLine = this->FindParentLine();
03007     ERROR2IF(pCaretLine==NULL,FALSE,"CaretNode::DoApplyAttrsTo() - caret has no TextLine parent");
03008     TextLine* pDstVTNLine = pDstVTN->FindParentLine();
03009     ERROR2IF(pDstVTNLine==NULL,FALSE,"CaretNode::DoApplyAttrsTo() - dest VTN has no TextLine parent");
03010 if (bDeleteDups)
03011 {
03012     ERROR2IF(pDstVTNLine!=pCaretLine,FALSE,"CaretNode::DoApplyAttrsTo() - caret and pDstVTN not on same line");
03013 }
03014 
03015     // determine if attr types on caret are already localised
03016     AbstractTextChar* pATC = (AbstractTextChar*)(pCaretLine->FindFirstChild(CC_RUNTIME_CLASS(AbstractTextChar)));
03017     ERROR2IF(pATC==NULL,FALSE,"OpTextFormat::DoInsertCharHelper() - caret line has no AbstaractTextChars");
03018     BOOL CommonAttrsAffected = !pATC->HasAttrTypesOn(this);
03019 
03020     // if attr types on the caret are not localised, localise them
03021     AttrTypeSet CaretsAttrTypes;
03022     this->AddChildAttrTypesToSet(&CaretsAttrTypes);
03023     if (CommonAttrsAffected)
03024         if (!pUndoOp->DoLocaliseForAttrChange(pDstVTN,&CaretsAttrTypes,NULL))
03025             return FALSE;
03026 
03027 // BODGE WORDWRAP - causes dup attrs if applying defalut attr on caret to new char in line of non-default
03028 
03029     // now copy carets attrs to new char, deleting any duplicates
03030     NodeAttribute* pCaretAttr = (NodeAttribute*)(this->FindFirstChild(CC_RUNTIME_CLASS(NodeAttribute)));
03031     while (pCaretAttr!=NULL)
03032     {
03033         NodeAttribute* pDupAttr = pDstVTN->GetChildAttrOfType(pCaretAttr->GetAttributeType());
03034 
03035         // If we have found a duplicate and we are allowed to delete it, do so
03036         if (pDupAttr!=NULL && bDeleteDups)
03037         {
03038             pDupAttr->CascadeDelete();
03039             delete pDupAttr;
03040         }
03041 
03042         // If we didn't find a duplicate or we did and we deleted it then
03043         // copy the caret's attribute
03044         if (pDupAttr==NULL || bDeleteDups)
03045         {
03046             Node* pAttrCopy; 
03047             if (!pCaretAttr->NodeCopy(&pAttrCopy))
03048                 return FALSE;
03049             pAttrCopy->AttachNode(pDstVTN, LASTCHILD);
03050         }
03051 
03052         pCaretAttr = (NodeAttribute*)(pCaretAttr->FindNext(CC_RUNTIME_CLASS(NodeAttribute)));
03053     }
03054 
03055     // if attr types on caret were localised, factor them out
03056     if (CommonAttrsAffected)
03057         if (!pUndoOp->DoFactorOutAfterAttrChange(pDstVTN, &CaretsAttrTypes))
03058             return FALSE;
03059 
03060     return TRUE;
03061 }

BOOL CaretNode::ExportRender RenderRegion pRegion  )  [virtual]
 

This function is called when the render function passes through this node It outputs the Text Object start and end tokens.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/4/95
Parameters:
pRegion - points to the export render region [INPUTS]
Returns:
TRUE if rendered OK (FALSE=>use normal rendering)

Reimplemented from NodeRenderableInk.

Definition at line 2769 of file nodetext.cpp.

02770 {
02771 #if EXPORT_TEXT
02772 // BODGE TEXT - need to export caret in a comment!
02773     if (pRegion->IsKindOf(CC_RUNTIME_CLASS(EPSRenderRegion)))
02774     {
02775         /*EPSExportDC *pDC=*/(EPSExportDC*)pRegion->GetRenderDC();
02776 //      pDC->OutputToken("ctk");
02777 //      pDC->OutputNewLine();
02778         return TRUE;
02779     }
02780 #endif
02781     return FALSE;
02782 }

DocRect CaretNode::GetBlobBoundingRect  )  [virtual]
 

get the caret's blob bounds Note: Abuse of bounding box cache should really be for renderable bounds but the caret has none!

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/3/95
Returns:
the caret's bounds

Reimplemented from NodeRenderable.

Definition at line 2816 of file nodetext.cpp.

02817 {
02818     if (IsBoundingRectValid==FALSE)
02819         if (ValidateBoundingRect()==FALSE)
02820             InformError();
02821 
02822     return BlobBounds;
02823 }

DocRect CaretNode::GetBoundingRect BOOL  DontUseAttr = FALSE,
BOOL  HitTest = FALSE
[virtual]
 

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/3/95
Parameters:
DontUseAttr - not used [INPUTS] HitTest - not used
Returns:
the caret's renderable bounds

Reimplemented from NodeRenderableBounded.

Definition at line 2836 of file nodetext.cpp.

02837 {
02838     if (IsBoundingRectValid==FALSE)
02839         if (ValidateBoundingRect()==FALSE)
02840             InformError();
02841 
02842     return BoundingRectangle;
02843 }

void CaretNode::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.

Definition at line 2615 of file nodetext.cpp.

02616 {
02617 #if DEBUG_TREE
02618     VisibleTextNode::GetDebugDetails(Str);
02619 #endif
02620 }

UINT32 CaretNode::GetNodeSize  )  const [virtual]
 

For finding the size of the CaretNode.

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

Reimplemented from VisibleTextNode.

Definition at line 2599 of file nodetext.cpp.

02600 {
02601     return (sizeof(CaretNode)); 
02602 }

BOOL CaretNode::HasMoved  ) 
 

reposition the caret after it has moved If possible to the right of the previous char as the caret takes its attributes from this char so the caret's position reflects it's baseline shift correctly

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

Definition at line 2925 of file nodetext.cpp.

02926 {
02927 #if !defined(EXCLUDE_FROM_RALPH)
02928     AbstractTextChar* pPrevATC=(AbstractTextChar*)(this->FindPrevious(CC_RUNTIME_CLASS(AbstractTextChar)));
02929     BOOL AfterPrevChar = (pPrevATC!=NULL);
02930 
02931     // if positioning the caret after the previous char and its a kern code
02932     // and its on a path and a silly size, position the caret before the next char
02933     if (AfterPrevChar && IS_A(pPrevATC,KernCode))
02934     {
02935         TextStory* pTextStory = this->FindParentStory();
02936         ERROR2IF(pTextStory==NULL,FALSE,"CaretNode::HasMoved() - could not find caret's parent story!");
02937         if ( pTextStory->GetTextPath()!=NULL && ((KernCode*)pPrevATC)->GetValue().x>1000 )
02938             AfterPrevChar = FALSE;
02939     }
02940 
02941     // if positioning caret after last char, use prev char's info plus advance
02942     // else just use next char's info
02943     Matrix matrix;
02944     MILLIPOINT pos=0;
02945     if (AfterPrevChar)
02946     {
02947         const MILLIPOINT advance=pPrevATC->GetVisibleAdvance();
02948         matrix  = Matrix(advance,0);
02949         matrix *= pPrevATC->GetMatrix();
02950         pos     = pPrevATC->GetPosInLine()+advance;
02951     }
02952     else
02953     {
02954         AbstractTextChar* pNextATC=(AbstractTextChar*)(this->FindNext(CC_RUNTIME_CLASS(AbstractTextChar)));
02955         ERROR2IF(pNextATC==NULL,FALSE,"CaretNode::HasMoved() - no AbstractTextChar before or after caret!");
02956         matrix = pNextATC->GetMatrix();
02957         pos    = pNextATC->GetPosInLine();
02958     }
02959 
02960     SetMatrix(matrix);
02961     SetPosInLine(pos);
02962     InvalidateBoundingRect();
02963 #endif
02964     return TRUE;
02965 }

virtual BOOL CaretNode::IsACaret  )  const [inline, virtual]
 

Reimplemented from VisibleTextNode.

Definition at line 449 of file nodetext.h.

00449 {return TRUE;};

void CaretNode::RenderObjectBlobs RenderRegion pRenderRegion  )  [virtual]
 

Renders the caret's path into the pRender render region.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/2/95
Parameters:
pRender - The region to render into [INPUTS]
Returns:
FALSE if fails

Reimplemented from NodeRenderable.

Definition at line 2707 of file nodetext.cpp.

02708 {
02709     if (RenderObjectBlobsCore(pRenderRegion)==FALSE)
02710         InformError();
02711 }

BOOL CaretNode::RenderObjectBlobsCore RenderRegion pRenderRegion  ) 
 

Renders the caret's path into the pRender render region.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/2/95
Parameters:
pRender,: The region to render into [INPUTS]
Returns:
FALSE if fails

Definition at line 2724 of file nodetext.cpp.

02725 {
02726 #if !defined(EXCLUDE_FROM_RALPH)
02727     ERROR2IF(pRenderRegion==NULL,FALSE,"CaretNode::RenderObjectBlobsCore() - pRenderRegion==NULL");
02728 
02729     TextStory* pTextStory = this->FindParentStory();
02730     ERROR2IF(pTextStory==NULL,FALSE,"CaretNode::RenderObjectBlobsCore() - pTextStory==NULL");
02731 
02732     // get the caret path transformed to the correct place in the doc
02733     Matrix matrix;
02734     if (GetStoryAndCharMatrix(&matrix)==FALSE)
02735         return FALSE;
02736     Path* pCaretPath=CreatePath(&matrix);
02737     BOOL ok=(pCaretPath!=NULL);
02738 
02739     // draw the caret path in red (line width?)
02740     if (ok)
02741     {
02742         pRenderRegion->SaveContext();
02743         pRenderRegion->SetLineColour(RED);
02744         pRenderRegion->DrawPath(pCaretPath);
02745         pRenderRegion->RestoreContext();
02746     }
02747 
02748     // delete the caret path
02749     delete pCaretPath;
02750 
02751     return ok;
02752 #else
02753     return TRUE;
02754 #endif
02755 }

void CaretNode::SetSelected BOOL  Status  )  [virtual]
 

Overides the normal SetSelected call so we can ensure that the caret is not selected outside the TextTool.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/5/95
Parameters:
Status - TRUE to select the caret [INPUTS] FALSE to deselect it

Reimplemented from Node.

Definition at line 3075 of file nodetext.cpp.

03076 {
03077 #if !defined(EXCLUDE_FROM_RALPH)
03078     if (!TextTool::IsCurrentTool())
03079     {
03080         TextStory* pStory = this->FindParentStory();
03081         if (pStory != NULL)
03082             pStory->SetSelected(Status);
03083     }
03084     else
03085         BaseTextClass::SetSelected(Status);
03086 #endif
03087 }

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

It is illegal to copy a CaretNode, therefore this function will generate an error if called. But blends, moulds etc. call this function so I (Peter) have implemented it Fix after the show.

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

Reimplemented from VisibleTextNode.

Definition at line 2576 of file nodetext.cpp.

02577 {
02578     // Make a new CaretNode and then copy things into it
02579     CaretNode* NodeCopy = new CaretNode();
02580 
02581     ERROR1IF(NodeCopy == NULL, NULL, _R(IDE_NOMORE_MEMORY)); 
02582 
02583     if (NodeCopy != NULL)
02584         CopyNodeContents(NodeCopy);
02585     
02586     return NodeCopy;
02587 }

BOOL CaretNode::ValidateBoundingRect FormatRegion pFormatRegion = NULL  )  [virtual]
 

recache the caret's renderable and blob bounding rects

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/3/95
Parameters:
pFormatRegion - not used [INPUTS]
Returns:
FALSE if fails

Reimplemented from VisibleTextNode.

Definition at line 2856 of file nodetext.cpp.

02857 {
02858 #if !defined(EXCLUDE_FROM_RALPH)
02859     BOOL ok=TRUE;
02860 
02861     // get the overall matrix to apply to the caret
02862     Matrix matrix;
02863     if (GetStoryAndCharMatrix(&matrix)==FALSE)
02864         return FALSE;
02865 
02866     // get a zero size rect at the correct position in the doc
02867     // for the renderable bounds of the caret (uses by ScrollToShow)
02868     DocCoord temp(0,0);
02869     matrix.transform((Coord*)&temp,1);
02870     DocRect RendRect(temp,temp);
02871 
02872     // get the bounds of the caret path for the blob bounds
02873     Path* pCaretPath=CreatePath(&matrix);
02874     DocRect BlobRect(0,0,0,0);
02875     ok=(pCaretPath!=NULL);
02876     if (ok)
02877     {
02878         DocCoord* pCoords=pCaretPath->GetCoordArray();
02879         PathVerb* pVerbs=pCaretPath->GetVerbArray();
02880         ok=(pVerbs!=NULL && pCoords!=NULL);
02881         if (ok)
02882         {
02883             GDrawContext *GD = GRenderRegion::GetStaticDrawContext();
02884 
02885             if (GD != NULL)
02886             {
02887                 ok=!(GD->CalcStrokeBBox((POINT*)pCoords, pVerbs, pCaretPath->GetNumCoords(),
02888                                      (LPRECT)(&BlobRect), 0, 2, CAPS_ROUND, JOIN_ROUND, NULL));
02889             }
02890 
02891             if (!ok) ERROR2RAW("CaretNode::ValidateBoundingRect() - GDraw_CalcStrokeBBox() failed");
02892         }
02893         delete pCaretPath;
02894     }
02895 
02896     // Inflate the blob bounds, so that the Caret is at least a pixel wide
02897     if (View::GetCurrent() != NULL)
02898     {
02899         INT32 PixWidth = (View::GetCurrent()->GetScaledPixelWidth()).MakeLong();
02900         BlobRect.Inflate(PixWidth/2);
02901     }
02902 
02903     // update the cached values
02904     BoundingRectangle   = RendRect;
02905     BlobBounds          = BlobRect;
02906     IsBoundingRectValid = TRUE;
02907     return ok;
02908 #else
02909     return TRUE;
02910 #endif
02911 }

BOOL CaretNode::WritePreChildrenNative BaseCamelotFilter pFIlter  )  [virtual]
 

Reimplemented from Node.

Definition at line 3110 of file nodetext.cpp.

03111 {
03112 //#ifdef DO_EXPORT
03113 //  return CXaraFileTxtCaret::WritePreChildrenNative(pFilter, this);
03114 //#else
03115     return FALSE;
03116 //#endif
03117 }

BOOL CaretNode::WritePreChildrenWeb BaseCamelotFilter pFilter  )  [virtual]
 

Writes a caret node record to the new file format filter.

Author:
Andy_Hayward (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/07/96
Parameters:
pFilter - new file format filter to write record to [INPUTS]
Returns:
TRUE if successful, FALSE otherwise

Reimplemented from Node.

Definition at line 3101 of file nodetext.cpp.

03102 {
03103 //#ifdef DO_EXPORT
03104 //  return CXaraFileTxtCaret::WritePreChildrenWeb(pFilter, this);
03105 //#else
03106     return FALSE;
03107 //#endif
03108 }


Member Data Documentation

DocRect CaretNode::BlobBounds [private]
 

Definition at line 462 of file nodetext.h.


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