TextStory Class Reference

The root of the TextObject hierarchy. More...

#include <nodetxts.h>

Inheritance diagram for TextStory:

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

Public Member Functions

 TextStory ()
 Simple TextStory constructor, it is required so that SimpleCopy will work.
 ~TextStory ()
 The destructor currently just checks to see if the TextStory being deleted still has the input focus, and clears it if it has. One situation where this occurs is when deleting a document. This dosen't clear the selection.
 TextStory (Node *ContextNode, AttachNodeDirection Direction)
 The main TextStory constructor.
void Init ()
 Initialies the member variables of the TextStory.
String_256 GetStoryAsString ()
virtual BOOL IsSetCandidate () const
 Indicates that NodeRenderableInks are candidates for membership of Attribute gallery set.
virtual BOOL IsCompound () const
virtual NodeSimpleCopy ()
 This method returns a shallow copy of the node with all Node pointers NULL. The function is virtual, and must be defined for all derived classes of Node.
void CopyNodeContents (TextStory *NodeCopy)
 This method copies the node's contents to the node pointed to by NodeCopy.
virtual void PolyCopyNodeContents (NodeRenderable *pNodeCopy)
 Polymorphically copies the contents of this node to another.
INT32 BaseComplexCopy (CopyStage Stage, Range &RangeToCopy, Node **pOutput)
INT32 BaseComplexHide (UndoableOperation *pOp)
 This function handles the text story being hidden during operations such as OpDelete / OpCut / etc. The function is called indirectly via it child nodes. It should never be called directly. Its purpose is to cope with various parts of the text story being hidden. It is not possible to DoHideNodes() on a selection of the text stories children as this may leave the story in an invalid state. Hence all children ask their parent text story to sort out the problem. The function is usually called from a derived version of Node::ComplexHide().
virtual BOOL HidingNode ()
 Called when this TextStory is hidden - Clears the input focus from this TextStory if it currently has it, then calls the parent class.
virtual BOOL CanBecomeA (BecomeA *pBecomeA)
 This function is used by the convert to shapes operation. It determines if the node or any of its children can convert themselves into an InkClass object.
virtual BOOL DoBecomeA (BecomeA *pBecomeA)
 Transforms the object into another type of object.
virtual String Describe (BOOL Plural, BOOL Verbose)
 Gives a description of the TextStory node for the status line etc.
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 BOOL OnNodePopUp (Spread *pSpread, DocCoord PointerPos, ContextMenu *pMenu)
 Allows the TextStory to respond to pop up menu clicks on itself.
virtual DocRect GetBlobBoundingRect ()
virtual void RenderObjectBlobs (RenderRegion *pRender)
 Render the text story's object blobs.
virtual void RenderTinyBlobs (RenderRegion *pRender)
 Render the text story's tiny blobs.
DocCoord GetBlobPosAndSize (INT32 *pSize=NULL)
virtual BOOL AllowOp (ObjChangeParam *pParam, BOOL SetOpPermissionState=TRUE, BOOL DoPreTriggerEdit=TRUE)
 Allows the TextStory to abort the following operations under the following circumstances.
virtual BOOL AllowOp_AccountForCompound (ObjChangeParam *pParam, BOOL SetOpPermissionState=TRUE, BOOL DoPreTriggerEdit=TRUE)
 Req'd so that the curve bit of text-on-a-curve gets AllowOp messages, thus allowing feathered curve bits to update correctly.
virtual ChangeCode OnChildChange (ObjChangeParam *pParam)
 This function is called at the end of any operation which has affected a TextStory in order to (undoably) reformat the story and redraw affected bits.
BOOL MoveCaretLeftAChar ()
 This routine moves the caret to the left by one position.
BOOL MoveCaretRightAChar ()
 This routine moves the caret to the right by one position.
BOOL MoveCaretLeftAWord ()
 This routine moves the caret to the left by a word. If the caret is in a word it is moved to the start of that word, else the caret is positioned at the start of the previous word.
BOOL MoveCaretRightAWord ()
 This routine moves the caret to the right by a word. It caret is positioned to the left of the first character encountered after a space.
BOOL MoveCaretToStartOfLine ()
 This routine moves the caret to the start of the TextLine that it is on.
BOOL MoveCaretToEndOfLine ()
 Move caret to end of TextLine which it is on.
BOOL MoveCaretToCharacter (VisibleTextNode *pChar, AttachNodeDirection Dir)
 This routine moves the caret to the left or right of a specified char.
BOOL AttachCaretAttributes ()
 This function should be called after the caret has been moved to its new location. It deletes all its previous children, and copies the children of the character to the left of it. If there isn't anything to the left then the attributes to the right are used; if there isn't anything to the right then no attributes are attached so the defaults are used. This function broacasts an attribute changed message.
VisibleTextNodeGetPrevWordChar (VisibleTextNode *pStartChar)
VisibleTextNodeGetNextWordChar (VisibleTextNode *pStartChar)
VisibleTextNodeGetSelectionEnd (BOOL *pDirection=NULL)
 This function should be called to find what character nodes are selected. The return value is a pointer to the last selected node, at the other end of the selected characters from the anchor (which is the caret). NULL will be returned if there is no selection.
BOOL GetCharacterAtPoint (BOOL InBounds, DocCoord Point, VisibleTextNode **pHitChar, BOOL *ToLeft)
 Given a location works out the nearest character to that location.
CaretNodeGetCaret ()
 Returns a pointer to the caret node of this TextStory, NULL will be returned if there is no Caret.
NodePathGetTextPath () const
 This function should be used to get a pointer to the path the text is on. NULL is returned if there is no text path.
TextLineFindFirstLine () const
 This function should be used to obtain a pointer to the TextStory's first TextLine node.
TextLineFindLastLine () const
VisibleTextNodeFindFirstVTN () const
VisibleTextNodeFindLastVTN () const
virtual void Transform (TransformBase &transform)
 transform a text story and any children capable of being transformed
DocRect GetUTStoryBounds ()
 The bounding box of the story in it's untransformed space.
BOOL CreateUntransformedPath (TextStoryInfo *pPathInfo)
 Create a copy of the story's path removing the Story matrix transform Also, reverse path if text is reversed on the path Note: This should really be broken up into member functions of Path.
void MatrixFitToPath ()
 modify TextStory matrix appropriately when fitting text to a path
void MatrixRemoveFromPath ()
 modify TextStory matrix appropriately when removing text from a path
virtual BOOL FormatAndChildren (UndoableOperation *pUndoOp=NULL, BOOL UseNodeFlags=FALSE, BOOL WordWrap=TRUE)
 Reformat a text story.
BOOL UnWrapStory (UndoableOperation *pUndoOp)
 Join consecutive soft lines into single hard lines and append a final (virtual) EOL to the story if none.
BOOL DeleteSelectedText (UndoableOperation *pUndoOp)
 Delete all selected text objects in story, deleteing whole lines where possible.
BOOL DeleteSelectedTextLines (UndoableOperation *pUndoOp)
 Called by DeleteSelectedText to delete all selected TextLines (including TextLines will all children selected).
BOOL DeleteSelectedTextCharacters (UndoableOperation *pUndoOp)
 delete all (remaining) selected VTN in story, joining lines if EOL deleted and story not word wrapping
void PreExportRender (RenderRegion *pRegion)
 This function is called when the render function passes through this node It outputs the Text Object start and end tokens.
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.
BOOL PostImport ()
 This functions is called following the complete import of a document. It allows nodes to complete their post import initialisation once they are in complete tree. The TextStory and its children are formatted following loading.
BOOL PostDuplicate (UndoableOperation *pOp)
 This function is called following the (simple)copy of a text story. The TextStory and its children are re-formatted.
BOOL ImportFix_MoveScaleToAttrs ()
 Move the scale from the story's matrix down to its attributes (ie fix up docs which were created with partly developed by code!).
BOOL CorelStyleBaselineShift (BaseShiftEnum BaseShift)
BOOL OKToExport ()
 Determines wether or not this text story should be exported. If there are no characters in it then we don't want to save it as it will cause bother when loaded back.
virtual BOOL WritePreChildrenWeb (BaseCamelotFilter *pFilter)
 Writes out a records associated with this node.
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)
virtual BOOL WriteBeginChildRecordsWeb (BaseCamelotFilter *pFilter)
 Writes out child records associated with the text story.
virtual BOOL WriteBeginChildRecordsNative (BaseCamelotFilter *pFilter)
 Begin to write out you child records, in the native format.
virtual BOOL WriteEndChildRecordsWeb (BaseCamelotFilter *pFilter)
 Finished writing out you child records, in the web format.
virtual BOOL WriteEndChildRecordsNative (BaseCamelotFilter *pFilter)
 Finished writing out you child records, in the native format.
void ResetStringList ()
void AddImportedString (ImportedString *pImportedString)
 Adds the object to the list of imported strings.
BOOL EnsureStoryHasCaret ()
 Makes sure the story has a caret node.
void Validate (BOOL EnsureOpFlagsReset=TRUE)
 Perform various integrity checks on a text story in debug builds.
void CheckLeaf (Node *pLeafNode)
 Ensure no Linelevel attrs below line level.
void CheckSubtree (Node *pNode, AttrTypeSet *pParentAttrSet=NULL, BOOL *pDescendantSelected=NULL)
 Validate a subtree, checking for:
  • duplication of attribute on node or parent (except caret)
  • nodes with child objects must be flagged as compound
  • attributes are not flagged as selected or parent of selected
  • hidden nodes are not flagged as selected, parent of selected or compound
  • node is not both flagged as selected and parent of selected
  • node with selected descendant is flagged as parent of selected
  • node with no selected descendant is not flagged as parent of selected
  • no sibling attributes.

TCHARGetNodeInfo (Node *pNode)
 return string with CC_RUNTIME_CLASS name of node and address
void ResetEOLs (BOOL Status)
 Scan through all end of line nodes in this text story and set the status of their virtual flag.
BOOL WillStoryWrapOnPath ()
 Calculates whether the formatter will wrap any line of text around the path It calculates this by checking the position of the last character (or VTN in each line). If this wraps it is assumed the whole line will wrap. Note text is assumed to only ever wrap on a path which is closed.
const MatrixGetpStoryMatrix () const
MatrixGetpStoryMatrix ()
Matrix GetStoryMatrix () const
void SetStoryMatrix (Matrix &matrix)
DocRect GetRedrawRect () const
void SetRedrawRect (DocRect rect)
void UpdateRedrawRect (DocRect rect)
MILLIPOINT GetStoryWidth () const
void SetStoryWidth (MILLIPOINT NewValue)
MILLIPOINT GetImportFormatWidth () const
BaseShiftEnum GetImportBaseShift () const
void SetImportFormatWidth (MILLIPOINT width)
void SetImportBaseShift (BaseShiftEnum shift)
BOOL IsTextOnPathReversed () const
BOOL IsTextOnPathTangential () const
BOOL IsPrintingAsShapes () const
BOOL IsWordWrapping () const
void ReverseTextOnPath ()
void ToggleTextOnPathTangentialness ()
void SetPrintingAsShapes (BOOL NewValues)
void SetWordWrapping (BOOL NewValues)
FIXED16 GetCharsScale () const
FIXED16 GetCharsAspect () const
ANGLE GetCharsRotation () const
ANGLE GetCharsShear () const
void SetCharsScale (FIXED16 scale)
void SetCharsAspect (FIXED16 aspect)
void SetCharsRotation (ANGLE rotation)
void SetCharsShear (ANGLE shear)
BOOL IsAutoKerning ()
void SetAutoKerning (BOOL NewValue)
MILLIPOINT GetLeftIndent () const
MILLIPOINT GetRightIndent () const
DocCoord GetLeftIndentPos () const
 Gets the position in the document of the left indent of this story.
DocCoord GetRightIndentPos () const
 Gets the position in the document of the right indent of this story. Remember that the right inrent is relative to the RHS of the path.
void SetLeftIndent (MILLIPOINT NewIndent)
void SetRightIndent (MILLIPOINT NewIndent)
virtual BOOL IsTypeExtendible () const
virtual DocRect ValidateExtend (const ExtendParams &ExtParams)
 Tests to see whether this text-story's extend-centre is positioned so as to make an extend operation irreversible. See also: Extender class.
virtual void Extend (const ExtendParams &ExtParams)
 Perform an Extend operation on this text-story. See also: Extender class.
DocCoord FindExtendCentre ()
 Find the extend-centre reference point. See also: Extender class.
Justification FindJustification ()
 Used in conjunction with Extend() and its sister functions to determine which way a text-story should extend. If you use this function for another purpose, read it and make sure it does what you think it should do first. Notes: Be aware that this function uses IsKindOf() to test this node's children within the tree. See also: Extender class.

Static Public Member Functions

static TextStoryCreateTextObject (DocCoord Anchor)
 Creates a Text object.
static TextStoryCreateTextObject (Matrix TheMatrix)
 Creates a Text object.
static TextStoryCreateFromChars (DocCoord Pos, char *pChars, WCHAR *pWChars, Document *pCreateDoc, LOGFONT *pLogFont=NULL, BOOL ControlCodes=FALSE, DocColour *pColour=NULL)
 Create a TextStory from an array of chars OR WCHARs and optionally account for control codes and a LogFont (ie size/aspect/bold/italic/typeface/rotation).
static TextStoryGetFocusStory ()
 This function should be used to get a pointer to the TextStory with the input focus. There can be only one such story with an active caret at any time, although there does not have to aways be one (in this case NULL is returned).
static void SetFocusStory (TextStory *pNewStory)
 This function should be used to set the pointer with the input focus. Setting the pointer to NULL clears the into focus.
static DocCoord GetPathBlobPos (MILLIPOINT IndentLength, NodePath *pPath)
 Gets the location of the of a point a certian distance along the path. This function is static so others, eg the drag op, can call it and it's scary math.

Protected Member Functions

BOOL Copy (Range &RangeToCopy, Node **pOutput)
 Make a copy of the text story and all children which lie inside RangeToCopy.
void SetStoryMarkers (Range &RangeToCopy)
 Scan through the text story setting the necessary copyme bits to make sure the text story is copied correctly. The range is used to determin what items are actually being copied. If characters are being copied, we need to copy a line and text story as well.
BOOL ExpandImportedStrings ()
 Expands any strings that were imported into a series of text characters.
BOOL IsGradientFilled ()
 Looks through the list of nodes under the text story node to see if there are any gradient fills on this object. See also: TextStory::PreExportRender.

Static Protected Member Functions

static BOOL DeleteChildAttribute (NodeRenderableInk *pParent, CCRuntimeClass *ReqdAttrib)
 Finds and deletes a child attribute of the given type.

Private Attributes

Matrix StoryMatrix
DocRect RedrawRect
CaretNodeCachedCaret
MILLIPOINT mLeftIndent
MILLIPOINT mRightIndent
MILLIPOINT StoryWidth
BOOL TextOnPathReversed: 1
BOOL TextOnPathTangential: 1
BOOL PrintAsShapes: 1
BOOL WordWrapping: 1
BOOL BeingCopied: 1
MILLIPOINT ImportFormatWidth
BaseShiftEnum ImportBaseShift
FIXED16 CharsScale
FIXED16 CharsAspect
ANGLE CharsRotation
ANGLE CharsShear
ImportedStringListpImportedStringList
bool AutoKern

Static Private Attributes

static TextStorypFocusStory = NULL

Detailed Description

The root of the TextObject hierarchy.

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

Definition at line 260 of file nodetxts.h.


Constructor & Destructor Documentation

TextStory::TextStory  ) 
 

Simple TextStory 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 1024 of file nodetxts.cpp.

01024                     : BaseTextClass()   // Call the base class
01025 {
01026     Init();
01027 }

TextStory::~TextStory  ) 
 

The destructor currently just checks to see if the TextStory being deleted still has the input focus, and clears it if it has. One situation where this occurs is when deleting a document. This dosen't clear the selection.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/2/95

Definition at line 1040 of file nodetxts.cpp.

01041 {
01042     if (GetFocusStory() == this)
01043         SetFocusStory(NULL);
01044 
01045     if (pImportedStringList != NULL)
01046     {
01047         pImportedStringList->DeleteAll();
01048         delete pImportedStringList;
01049         pImportedStringList = NULL;
01050     }
01051 }

TextStory::TextStory Node ContextNode,
AttachNodeDirection  Direction
 

The main TextStory 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

Definition at line 1074 of file nodetxts.cpp.

01075                                                    :BaseTextClass(ContextNode, Direction)
01076 {
01077     Init();
01078 }


Member Function Documentation

void TextStory::AddImportedString ImportedString pImportedString  ) 
 

Adds the object to the list of imported strings.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/8/96
Parameters:
pImportedString = ptr to the imported string object [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 4593 of file nodetxts.cpp.

04594 {
04595     if (pImportedStringList == NULL)
04596         pImportedStringList = new ImportedStringList;
04597 
04598     if (pImportedStringList != NULL)
04599         pImportedStringList->AddTail(pImportedString);
04600 }

BOOL TextStory::AllowOp ObjChangeParam pParam,
BOOL  SetOpPermissionState = TRUE,
BOOL  DoPreTriggerEdit = TRUE
[virtual]
 

Allows the TextStory to abort the following operations under the following circumstances.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>; Karim 19/01/2000
Date:
6/5/95
Parameters:
pParam - pointer to the change parameter object [INPUTS] SetOpPermissionState - TRUE to set the Nodes permission flags DoPreTriggerEdit - if TRUE then calls NameGallery::PreTriggerEdit. Must* be TRUE if the calling Op may make any nodes change their bounds, eg move, line width, cut. Use TRUE if unsure.
Returns:
TRUE if the operation can proceede, FALSE to stop it

Reimplemented from BaseTextClass.

Definition at line 1454 of file nodetxts.cpp.

01456 {
01457     ERROR2IF(pParam==NULL,FALSE,"TextStory::AllowOp() - pParam==NULL");
01458 
01459     // decide if we allow it ...
01460 
01461     // Karim 14/11/2000
01462     //  Added the !=OBJCHANGE_CALLEDBYCHILD clause.
01463     //  TextStories don't usually pass AllowOp down to their children.
01464     //  This is an exception - see TextStory::AllowOp_AccountForCompound for more info.
01465     BOOL allowed=TRUE;
01466     ObjChangeFlags Flags=pParam->GetChangeFlags();
01467     if (pParam->GetDirection() != OBJCHANGE_CALLEDBYCHILD)
01468         AllowOp_AccountForCompound(pParam, SetOpPermissionState, DoPreTriggerEdit);
01469 
01470     else
01471     {
01472         // we disallow changes to our text chars, but any child NodePath is fair game.
01473         if (pParam->GetCallingChild() == NULL || !pParam->GetCallingChild()->IsNodePath())
01474         {
01475             if (Flags.ReplaceNode || Flags.MultiReplaceNode)
01476             {
01477                 pParam->SetReasonForDenial(_R(IDE_TEXT_USEDBYSTORY));
01478                 allowed=FALSE;
01479             }
01480         }
01481     }
01482 
01483     // if we allow it, (and our parents weren't calling us) see if our parents do ...
01484     if (allowed && pParam->GetDirection()!=OBJCHANGE_CALLEDBYPARENT && Parent!=NULL)
01485     {
01486         // pass a temporary copy of the ObjChangeParam to our parent indicating call direction
01487         // and if all our children are deleted we know we don't delete ourselves so clear delete flag
01488         ObjChangeFlags NewFlags=pParam->GetChangeFlags();
01489         if (pParam->GetDirection()==OBJCHANGE_CALLEDBYCHILD)
01490             NewFlags.DeleteNode=FALSE;
01491         ObjChangeParam ObjParam(pParam->GetChangeType(), NewFlags, pParam->GetChangeObj(),
01492                                 pParam->GetOpPointer(),  OBJCHANGE_CALLEDBYCHILD);
01493         ObjParam.SetCallingChild(this);
01494         allowed=Parent->AllowOp(&ObjParam,SetOpPermissionState,DoPreTriggerEdit);
01495     }
01496 
01497     // if setting permisions ...
01498     if (SetOpPermissionState)
01499     {
01500         if (allowed)
01501         {
01502             if (Parent!=NULL)
01503                 Parent->SetOpPermission(PERMISSION_ALLOWED);
01504 
01505             // if post process required,
01506             // ensure our OnChildChange is called for post processing (by setting permission on ourself),
01507             // and do all pre-op processing we need to do for text
01508             if (pParam->GetDirection()!=OBJCHANGE_CALLEDBYPARENT || Flags.Attribute || Flags.TransformNode)
01509             {
01510                 SetOpPermission(PERMISSION_ALLOWED);
01511                 allowed=PreOpProcessing(pParam);
01512             }
01513         }
01514         else
01515             SetOpPermission(PERMISSION_DENIED,TRUE);
01516     }
01517 
01518     // if we're ok so far and were asked to do a PreTriggerEdit, then
01519     // determine whether the Op may change the bounds of some nodes.
01520     // If it may, then call NameGallery::PreTriggerEdit.
01521     if (allowed && DoPreTriggerEdit)
01522     {
01523         // if the Op is non-NULL then query its MayChangeNodeBounds() method.
01524         UndoableOperation* pChangeOp = pParam->GetOpPointer();
01525         if (pChangeOp != NULL && pChangeOp->MayChangeNodeBounds() && NameGallery::Instance())
01526         {
01527             allowed = NameGallery::Instance()->PreTriggerEdit(pChangeOp, pParam, this);
01528         }
01529     }
01530 
01531     // Ilan 8/5/00
01532     // Inform geom linked attrs of the change.
01533     if(allowed)
01534     {
01535         UndoableOperation* pChangeOp = pParam->GetOpPointer();
01536         BOOL InformGeomLinkedAttrs = SetOpPermissionState && pChangeOp && pChangeOp->MayChangeNodeBounds();
01537         if(InformGeomLinkedAttrs)
01538         {
01539             NodeAttribute* pNA = FindFirstGeometryLinkedAttr();
01540             while(pNA)
01541             {
01542                 pNA->LinkedNodeGeometryHasChanged(pChangeOp);
01543                 pNA = pNA->FindNextGeometryLinkedAttr();
01544             }
01545         }
01546     }
01547 
01548     // return result (directly, or indirectly via a child AllowOp()) to op
01549     return allowed;
01550 }

BOOL TextStory::AllowOp_AccountForCompound ObjChangeParam pParam,
BOOL  SetOpPermissionState = TRUE,
BOOL  DoPreTriggerEdit = TRUE
[virtual]
 

Req'd so that the curve bit of text-on-a-curve gets AllowOp messages, thus allowing feathered curve bits to update correctly.

This is a very much cut-down version of Node::AllowOp_AccountForCompound, tailored to the way TextStories behave - DON'T COPY IT!

See also: Node::AllowOp_AccountForCompound().

Reimplemented from Node.

Definition at line 1571 of file nodetxts.cpp.

01573 {
01574     // we only do the biz if an attr changes, or if we're transformin' or regeneratin'.
01575     ObjChangeFlags Flags = pParam->GetChangeFlags();
01576     if (Flags.Attribute || Flags.TransformNode || Flags.RegenerateNode)
01577     {
01578         ObjChangeDirection OldDirection = pParam->GetDirection();
01579         pParam->SetDirection(OBJCHANGE_CALLEDBYPARENT);
01580 
01581         for (Node*  pNode =  FindFirstChild();
01582                     pNode != NULL;
01583                     pNode =  pNode->FindNext())
01584         {
01585             if (pNode->IsNodePath())
01586                 pNode->AllowOp(pParam, SetOpPermissionState, DoPreTriggerEdit);
01587         }
01588 
01589         pParam->SetDirection(OldDirection);
01590     }
01591 
01592     return TRUE;
01593 }

BOOL TextStory::AttachCaretAttributes  ) 
 

This function should be called after the caret has been moved to its new location. It deletes all its previous children, and copies the children of the character to the left of it. If there isn't anything to the left then the attributes to the right are used; if there isn't anything to the right then no attributes are attached so the defaults are used. This function broacasts an attribute changed message.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/03/95
Returns:
TRUE if the attributes were successfully applied to the caret FALSE if an error occured

Errors: Returns TRUE if it worked, FALSE if the copy failed

Definition at line 2399 of file nodetxts.cpp.

02400 {
02401     CaretNode* pCaret = GetCaret();
02402     BOOL Success = TRUE;
02403     BOOL TellPeople = FALSE;
02404     ERROR2IF(pCaret==NULL,FALSE,"Text story didn't have caret");
02405 
02406     // Identify where were are going to get the new attributes from
02407     VisibleTextNode* pAttributeSource = pCaret->FindPrevVTNInLine();
02408     if (pAttributeSource == NULL)
02409         pAttributeSource = pCaret->FindNextVTNInLine();
02410 
02411     // See if the attributes are the same as the current ones
02412 /*  if (pAttributeSource != NULL)
02413     {
02414         Node* pCaretChild = pCaret->FindFirstChild();
02415         Node* pSourceChild = pAttributeSource->FindFirstChild();
02416 
02417         if ( ( (pCaretChild == NULL) && (pSourceChild != NULL) ) ||
02418              ( (pCaretChild != NULL) && (pSourceChild == NULL) ) )
02419         {
02420             TellPeople = TRUE;
02421         }
02422 
02423         if ( (pCaretChild != NULL) && (pSourceChild != NULL) )
02424         {
02425             while ((pCaretChild != NULL) && (pSourceChild != NULL))
02426             {
02427                 if ( (pCaretChild->IsAnAttribute()) && (pSourceChild->IsAnAttribute()) )
02428                 {
02429                     if (! ( *((NodeAttribute*)pCaretChild) == *((NodeAttribute*)pSourceChild) ))
02430                         TellPeople = TRUE;
02431                 }
02432                 else
02433                     TellPeople = TRUE;
02434                 pCaretChild = pCaretChild->FindNext();
02435                 pSourceChild = pSourceChild->FindNext();
02436             }
02437         }
02438     }
02439     else */
02440         TellPeople = TRUE;
02441 
02442     if (pAttributeSource != NULL)
02443     {
02444         // Delete the children of the caret
02445         pCaret->DeleteChildren(pCaret->FindFirstChild());
02446 
02447         // Attempt to copy the attributes of the previous character across
02448         Node* pToCopy = pAttributeSource->FindFirstChild(CC_RUNTIME_CLASS(NodeAttribute));
02449         while (Success && (pToCopy != NULL))
02450         {
02451             Success = pToCopy->CopyNode(pCaret, LASTCHILD);
02452             pToCopy = pToCopy->FindNext(CC_RUNTIME_CLASS(NodeAttribute));
02453         }
02454     }
02455 
02456     // Update other people
02457     if (TellPeople)
02458         GetApplication()->FindSelection()->Update();
02459 
02460     return Success;
02461 }

INT32 TextStory::BaseComplexCopy CopyStage  Stage,
Range RangeToCopy,
Node **  pOutput
 

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/5/95
Parameters:
Stage - either COPYOBJECT [INPUTS] COPYFINISHED RangeToCopy - Describes the range which is currently being copied. pOutput - Depends on the Stage parameter if Stage= COPYOBJECT Then the node pointer pOutput points at NULL. It should be set on exit to point at the copied object or tree of objects COPYFINISHED Then the node pointer pOutput points at the resulting copy from COPYOBJECT as it has been inserted into the destination tree.
Returns:
-1 = The routine failed to make a copy. 0 = No copy has been made. +1 = pOutput points to the copy.

Definition at line 3646 of file nodetxts.cpp.

03647 {
03648     ERROR2IF(pOutput==NULL,FALSE,"TextStory::RootComplexCopy() called with NULL output pointer");
03649 
03650     switch (Stage)
03651     {
03652         case COPYOBJECT:
03653             if (!BeingCopied)
03654             {
03655                 BeingCopied = TRUE;
03656                 if (Copy(RangeToCopy, pOutput))
03657                     return 1;
03658                 else
03659                     return -1;
03660             }
03661             return 0;
03662             break;
03663 
03664         case COPYFINISHED:
03665             if (BeingCopied)
03666             {
03667                 BeingCopied = FALSE;
03668                 Node* pCopy = (*pOutput);
03669                 if (pCopy && (IS_A(pCopy,TextStory)))
03670                     ((TextStory*)pCopy)->FormatAndChildren(NULL,FALSE,FALSE);
03671             }
03672             return 0;
03673             break;
03674 
03675         default:
03676             return -1;
03677             break;
03678     }
03679 }

INT32 TextStory::BaseComplexHide UndoableOperation pOp  ) 
 

This function handles the text story being hidden during operations such as OpDelete / OpCut / etc. The function is called indirectly via it child nodes. It should never be called directly. Its purpose is to cope with various parts of the text story being hidden. It is not possible to DoHideNodes() on a selection of the text stories children as this may leave the story in an invalid state. Hence all children ask their parent text story to sort out the problem. The function is usually called from a derived version of Node::ComplexHide().

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/5/95
Parameters:
pOp - a pointer to an undoable operation [INPUTS]
Returns:
-1 = The routine failed to hide this node. 0 = Ignored, this object does not support complex hide operations +1 = The node and possibly various others have been hidden correctly.

Definition at line 3987 of file nodetxts.cpp.

03988 {
03989     ERROR2IF(pOp==NULL, -1, "Operation pointer is NULL in TextStory::BaseComplexHide()");
03990 
03991     if (!DeleteSelectedText(pOp))
03992         return -1;
03993 
03994 #if !defined(EXCLUDE_FROM_RALPH)
03995     // try to regain the caret on completion
03996     TextInfoBarOp::RegainCaretOnOpEnd();
03997 #endif
03998 
03999     return 1;
04000 }

BOOL TextStory::CanBecomeA BecomeA pBecomeA  )  [virtual]
 

This function is used by the convert to shapes operation. It determines if the node or any of its children can convert themselves into an InkClass object.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/02/94
Parameters:
InkClass,: The class of object to turn into [INPUTS] pNumObjects = ptr to place number of objects of type pClass that will be created (Note: can be NULL). pNumObects in undefined on entry
Returns:
TRUE if the node, or any of its children can transmogrify themselves to become an InkClass object
The number you put into pNumObjects (if it's not NULL) should exactly equal the total number of pClass objects you create. It should NOT contain any additional objects you may produce such as group objects for containing the pClass object, or attributes.

Also, the entry value of *pNumObjects cannot be assumed to be 0.

Reimplemented from Node.

Definition at line 1697 of file nodetxts.cpp.

01698 {
01699     // A TextStory can become a NodePath
01700     if (pBecomeA->BAPath())
01701     {
01702         if (pBecomeA->IsCounting())
01703         {
01704             // Sum the number of paths our immediate children will create
01705             Node* pNode = FindFirstDepthFirst();
01706             while (pNode!=NULL && pNode!=this)
01707             {
01708                 // Call child to update BecomeA count
01709                 pNode->CanBecomeA(pBecomeA);
01710 
01711                 // Text chars don't have their own CanBecomeA, so count them here.
01712                 if (IS_A(pNode, TextChar) && !((TextChar*)pNode)->IsAVisibleSpace())
01713                     pBecomeA->AddCount(1);
01714 
01715                 pNode = pNode->FindNextDepthFirst(this);
01716             }
01717         }
01718 
01719         return TRUE;
01720     }
01721 
01722     return FALSE;
01723 }

BOOL TextStory::CanWriteChildrenNative BaseCamelotFilter pFilter  )  [virtual]
 

Reimplemented from Node.

Definition at line 4518 of file nodetxts.cpp.

04519 {
04520 #ifdef DO_EXPORT
04521     return CXaraFileTxtStory::CanWriteChildrenNative(pFilter, this);
04522 #else
04523     return FALSE;
04524 #endif
04525 }

BOOL TextStory::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 4509 of file nodetxts.cpp.

04510 {
04511 #ifdef DO_EXPORT
04512     return CXaraFileTxtStory::CanWriteChildrenWeb(pFilter, this);
04513 #else
04514     return FALSE;
04515 #endif
04516 }

void TextStory::CheckLeaf Node pLeafNode  ) 
 

Ensure no Linelevel attrs below line level.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/6/96
Parameters:
pLeafNode - [INPUTS]

Definition at line 4863 of file nodetxts.cpp.

04864 {
04865 #ifdef VALIDATE
04866     if (pLeafNode==NULL)
04867     {
04868         ERROR3("TextStory::CheckLeaf() - pNode==NULL");
04869         return;
04870     }
04871 
04872     Node* pNodeOnLeaf = pLeafNode->FindFirstChild();
04873     while (pNodeOnLeaf!=NULL)
04874     {
04875         if (pNodeOnLeaf->IsAnAttribute())
04876         {
04877             if ( ((NodeAttribute*)pNodeOnLeaf)->IsALineLevelAttrib() )
04878             {
04879                 if (IS_A(pLeafNode,CaretNode))
04880                     TRACE( _T("TextStory::CheckLeaf() - Line level attr applied to caret!\n"));
04881                 else
04882                     ERROR3("TextStory::CheckLeaf() - Line level attr applied below line level");
04883             }
04884         }
04885         pNodeOnLeaf = pNodeOnLeaf->FindNext();
04886     }
04887 #endif
04888 }

void TextStory::CheckSubtree Node pNode,
AttrTypeSet pParentAttrSet = NULL,
BOOL *  pDescendantSelected = NULL
 

Validate a subtree, checking for:

  • duplication of attribute on node or parent (except caret)
  • nodes with child objects must be flagged as compound
  • attributes are not flagged as selected or parent of selected
  • hidden nodes are not flagged as selected, parent of selected or compound
  • node is not both flagged as selected and parent of selected
  • node with selected descendant is flagged as parent of selected
  • node with no selected descendant is not flagged as parent of selected
  • no sibling attributes.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/6/96
Parameters:
pNode - [INPUTS] pParentAttrSet -
pDescendantSelected - [OUTPUTS]

Definition at line 4914 of file nodetxts.cpp.

04915 {
04916 #ifdef VALIDATE
04917     if (pNode==NULL)
04918     {
04919         ERROR3("CheckSubtree() - pNode==NULL");
04920         return;
04921     }
04922 
04923 PORTNOTE("text","Removed AfxCheckMemory")
04924 #ifndef EXCLUDE_FROM_XARALX
04925     ERROR3IF(!AfxCheckMemory(),"CheckSubtree() - memory corrupt!");
04926 #endif
04927 
04928     // get ptr to doc (if not an isolated subtree) as children are default attrs
04929     NodeDocument* pDoc = NULL;
04930     if (IS_A(pNode,NodeDocument))
04931         pDoc = (NodeDocument*)pNode;
04932     else
04933         pDoc = (NodeDocument*)(pNode->FindParent(CC_RUNTIME_CLASS(NodeDocument)));
04934 
04935     // flag attr set not yet coied - only do so if we have to as it is SLOOOW
04936     AttrTypeSet* pAttrSet = NULL;
04937 
04938     BOOL ChildSelected    = FALSE;
04939     BOOL ChildParentOfSel = FALSE;
04940     BOOL ChildObjectFound = FALSE;
04941     Node* pChildNode = pNode->FindFirstChild();
04942     while (pChildNode)
04943     {
04944         TRACEIF( pChildNode->IsSelected() && pChildNode->IsParentOfSelected(), 
04945             ( _T("CheckSubtree() - node (%s) both selected and parent of selected\n"), GetNodeInfo(pChildNode) ) );
04946         ChildSelected    |= pChildNode->IsSelected();
04947         ChildParentOfSel |= pChildNode->IsParentOfSelected();
04948         if (pChildNode->IsAnAttribute())
04949         {
04950             // if not already done, if no Attr set passed in, create one else copy the given one
04951             if (pAttrSet==NULL)
04952             {
04953                 if (pParentAttrSet==NULL)
04954                     pAttrSet = new AttrTypeSet;
04955                 else
04956                     pAttrSet = pParentAttrSet->CopySet();
04957             }
04958 
04959             TRACEIF( ChildObjectFound,      ( _T("CheckSubtree() - attribute (%s) found after child object\n"), GetNodeInfo(pChildNode) ) );
04960             NodeAttribute* pAttr = (NodeAttribute*)pChildNode;
04961             TRACEIF(pAttr->IsSelected(),    ( _T("CheckSubtree() - attribute (%s) selected\n"), GetNodeInfo(pAttr) ) );
04962             TRACEIF(pAttr->IsParentOfSelected(),( _T("CheckSubtree() - attribute (%s) parent of selected\n"), GetNodeInfo(pAttr) ) );
04963             if (!IS_A(pNode,CaretNode))
04964             {
04965                 // if attrbute already in set it is a duplicate of one on a parent (exc defaults)
04966                 CCRuntimeClass* pAttrType = pAttr->GetAttributeType();
04967                 TRACEIF( pAttrSet->InSet(pAttrType), ( _T("CheckSubtree() - attribute (%s) duplicate of one on self (%s) or parent\n"),
04968                     GetNodeInfo(pAttr),GetNodeInfo(pNode)));
04969 
04970                 // if not an isolated subtree and not default attr, check for duplicated default attrs
04971                 if (pDoc!=NULL && pNode!=pDoc)
04972                 {
04973                     NodeAttribute* pDefaultAttr = (NodeAttribute*)(pDoc->FindFirstChild(pAttrType));
04974                     TRACEIF( pDefaultAttr==