Node Class Reference

This abstract class describes the fundamental type of object which can be linked into a camelot tree. All other objects which are linked into the tree are derived from this class. More...

#include <node.h>

Inheritance diagram for Node:

CCObject SimpleCCObject EndDocument InsertionNode NodeBarProperty NodeHidden NodeRenderable NodeSetProperty NodeSetSentinel StartDocument List of all members.

Public Types

typedef BOOL(Node::* TypeFunc )() const

Public Member Functions

 Node ()
 This constructor creates a node linked to no other with all status flags FALSE. Also updates the Node counter of the current Document.
 Node (Node *ContextNode, AttachNodeDirection Direction, BOOL Locked=FALSE, BOOL Mangled=FALSE, BOOL Marked=FALSE, BOOL Selected=FALSE, BOOL Renderable=FALSE)
 This constructor initialises a node and links it to ContextNode in the direction specified by Direction. All necessary tree links are updated. For example if a node is inserted as a FirstChild of ContextNode, and Context node already has children, then the current first child of context node will become the next sibling of the new first child node.
virtual ~Node ()
 Destroys a Node object. The base class updates the node counter of the current document, and ensures that the SelRange doesn't have a cached pointer to 'this' as its 'Last Selected Node'.
virtual void Render (RenderRegion *pRender)
 For rendering a node.
void RenderTreeAtomic (RenderRegion *pRender)
 Renders the tree rooted at this node into the given RenderRegion.
virtual BOOL NeedsToRender (RenderRegion *pRender)
 Decide whether this node needs to be rendered, given the information provided by the parameters. This is a virtual function which defaults to returning FALSE - i.e. the node never needs to be rendered. This function should be overridden for any renderable nodes, so that they use the info provided to determine whether or not they need to be rendered.
virtual void PreExportRender (RenderRegion *pRender)
 Perform any rendering required when exporting to a file, and this node is being 'passed by' during the tree searching. For example, a group node being exported to EPS would output a "start group" token, and then its ExportRender function would output a "end group" token. By default, it does nothing. Nodes wishing to do special export processing should override this function (and ExportRender).
virtual BOOL ExportRender (RenderRegion *pRender)
 Perform special export rendering of an object, if it is different to the way the object would be rendered normally (e.g. graduated fill attributes, and so on). By default, the base class function returns FALSE, so by default all objects will be exported by calling the Render() function unless they override this function.
virtual BOOL NeedsToExport (RenderRegion *pRender, BOOL VisibleLayersOnly=FALSE, BOOL CheckSelected=FALSE)
 To indicate whether a given node needs to be rendered when exporting the document tree to a foreign file format. The base class always returns FALSE; if derived nodes wish to be exported they must override it and return TRUE.
virtual String Describe (BOOL Plural, BOOL Verbose=TRUE)
 To return a description of the Node object in either the singular or the plural. This method is called by the DescribeRange method.
virtual ChangeCode OnChildChange (ObjChangeParam *pParam)
 This function should be overridden in derived object classes. Composite objects can use this function to respond to one of their children undergoing a change. They should return CC_FAIL whenever they are unable to cope with the change.
virtual OpPermissionState GetOpPermission ()
 Use this to access the node's permission flags to find out if the current op is doable to this node.
virtual void SetOpPermission (OpPermissionState NewState, BOOL AndParents=FALSE)
 Use this to set the node's permission flags.
virtual BOOL AllowOp (ObjChangeParam *pParam, BOOL SetOpPermissionState=TRUE, BOOL DoPreTriggerEdit=TRUE)
 This is the way to ask a node if you can do an op to it.
virtual BOOL AllowOp_AccountForCompound (ObjChangeParam *pParam, BOOL SetOpPermissionState=TRUE, BOOL DoPreTriggerEdit=TRUE)
 if this is a compound node, ensures all child nodes have their AllowOp() called.
void CascadeDelete (void)
 This method removes the node from the tree and deletes all its child nodes (including hidden nodes).
virtual SubtreeRenderState RenderSubtree (RenderRegion *pRender, Node **ppNextNode=NULL, BOOL bClip=TRUE)
 Enables Nodes to be able to Do Pre Print time alterations or even take over the control of the current Printing of their children.
virtual void RenderAfterSubtree (RenderRegion *pRender)
virtual BOOL WritePreChildrenWeb (BaseCamelotFilter *pFilter)
 Writes out a record that represents the node.
virtual BOOL WritePreChildrenNative (BaseCamelotFilter *pFilter)
virtual BOOL WritePostChildrenWeb (BaseCamelotFilter *pFilter)
 Gives the node a change to write data to the filter after its children have been automatically written out.
virtual BOOL WritePostChildrenNative (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)
 Begin to write out you child records, in the web format.
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.
virtual BOOL ReadPostChildrenWeb (BaseCamelotFilter *pFilter)
 This function is called during the importing of the file.
virtual BOOL ReadPostChildrenNative (BaseCamelotFilter *pFilter)
virtual BOOL AreYouSafeToRender ()
 This function is used by the progressive rendering system & the new file format to determine whether the node is renderable or not.
BOOL CopyNode (Node *DestinationNode, AttachNodeDirection Direction)
 This method creates a 'deep' copy of the node and then attaches it to the destination node. The Direction input specifies how the node is to be attached to the Destination node. The following before and after diagram illustrates this method.
virtual BOOL NodeCopy (Node **ppNodeCopy)
 This method outputs a 'deep' copy of the node. It is the same as CopyNode except that the copy is not linked into the tree.
virtual BOOL CloneNode (Node **ppNoeCopy, BOOL bLightweight)
 This method outputs a 'deep' copy of the node. It is the same as CopyNode except that the copy is not linked into the tree. Override if yor class can interpret the lightweight flag.
BOOL CopyComplexRange (Range &RangeToCopy)
 Copy the series of nodes described by RangeToCopy and attach them to onto the last child position of this object.
BOOL CopyChildrenTo (Node *DestinationNode, CopyControlFlags CopyFlags=ccALL)
 This function copies the node's children to DestinationNode which should initially have no children.
void MoveNode (Node *DestinationNode, AttachNodeDirection Direction)
 This method moves a node from its existing position in the tree to a new node position specified by Destination. The Direction input specifies how the node is to be attached to the Destination node. The following before and after diagram illustrates this method.
void AttachNode (Node *ContextNode, AttachNodeDirection Direction, BOOL fCheckTransparent=TRUE, BOOL InvalidateChildren=TRUE)
 This method attaches the node to a context node in the direction specified by Direction. All necessary tree links are updated.
void InsertChainSimple (Node *ContextNode, AttachNodeDirection Direction)
 Inserts a chain of nodes at contextnode. A chain is an unconnected set of siblings. This function should be called from the first node (left most) in the chain. It doesn't do anything fancy - in fact, little more than changing a few pointers here and there.
virtual BOOL PostImport ()
 This function is called after a document is imported. Nodes should override this function to do any post-import processing.
virtual BOOL PostDuplicate (UndoableOperation *pOp)
 This function is called after this node has been created via a copy/duplicate type operation. Nodes should override this function to do any post-processing.
UINT32 GetTag () const
 For finding a nodes TAG, which is a unique identifier for each node stored within a document.
virtual UINT32 GetNodeSize () const
 For finding the size of a node, in concrete classes derived from Node.
virtual CopyType GetCopyType ()
 This function returns a type describing how this object is to be copied. The fuction is called from the low level copy operation CopyObjects. There are two options at present, these being SIMPLECOPY and COMPLEXCOPY. SIMPLECOPY indicates that the node can be copied by a call to its virtual function SimpleCopy() followed by a deep copy of all its children. COMPLEXCOPY however indicates that the node needs to do its own thing when copying and must be called via the ComplexCopy() virtual function. This virtual will likely return a tree of copied objects rather than just a copy of itself.
UINT32 GetSubtreeSize ()
 For finding the size of this subtree.
BOOL IsUnder (Node *pTestNode, BOOL bFirstCall=TRUE) const
 For finding out whether this node is under another node. Where "under" is defined as being before it in rendering order. To find the answer quickly without scanning the entire tree, we will find the common root node of both this and pNode and find out whether the child links from that node lead down to this node first or pTestNode first. (Because if my parent is under the test node then so am I) Do this recursively so that state is held on the stack, not in the tree Clever, huh? There is some strictly unneccessary work done in finding the common ancestor in this implementation but it's the best compromise that is both reasonably fast and completely stateless.
BOOL IsLocked () const
 For finding the status of the nodes locked flag.
BOOL IsMangled () const
 For finding the status of the nodes mangled flag.
BOOL IsMarked () const
 For finding the status of the nodes marked flag.
BOOL IsRenderable () const
 For finding the status of the nodes renderable flag.
BOOL IsParentOfSelected () const
 For finding the status of the nodes SelectedChildren flag Note: When this function returns TRUE it is not guaranteed that there will be selected children - there may be none!
BOOL IsSelected () const
 For finding the status of the nodes selected flag.
BOOL IsChildOfSelected ()
 For finding out whether this node has a selected parent. Note: If a group (node) of a number of objects is selected then only the group node itself has the selected flag set. Any children of this group, i.e. objects in the group would also be deemed selected but would not have the selected bit set. This routine is based on the routine View::IsPrintableNodeSelected and just searches up until it finds a layer. If by then it has found a selected flag then its parent must be selected and hence it is.
virtual BOOL ShouldBeRendered () const
 For determining quickly if the node is an object For finding the status of the node's Compound flag For finding the status of the node's Compound flag Allows you to see if this node is a NodeAttribute or is Hiding a NodeAttribute without having to use the expensive runtime checkingFor finding if a node is a paper node. For finding if a node is a layer node. For finding if a node is a spread node.For finding if a node is a chapter node.Determine if a node is *derived* from the NodeRenderable class. NB. This has nothing to do with the node's renderable flag! Work out if the node should be rendered - basically all nodes except NodeRenderable nodes should be rendered. However, some NodeRenderable derived classes should not actually be rendered - for example NodeMouldGroup hides the original un-moulded objects, which should definitely *not* be rendered. This is mainly used during printing where due to complications to do with banding and transparency, we cannot use NeedsToRender() to filter out such nodes, so we use this function instead. NB. This has nothing to do with the node's renderable flag!
virtual BOOL NeedsTransparency () const
 Can be overriden in derived classes to return TRUE, indicating that the user may be prompted concerning transparency mode when such a node is inserted in the tree.
virtual INT32 EstimateNodeComplexity (OpParam *details)
virtual BOOL IsAnObject () const
virtual BOOL IsAnAttribute () const
virtual BOOL IsKindOfTextAttribute () const
virtual BOOL IsPaper () const
virtual BOOL IsLayer () const
virtual BOOL IsSpread () const
virtual BOOL IsChapter () const
virtual BOOL IsNodeDocument () const
virtual BOOL IsNodeRenderableClass () const
virtual BOOL IsNodeHidden () const
virtual BOOL IsNodePath () const
virtual BOOL IsARegularShape () const
virtual BOOL IsOrHidesAnAttribute () const
virtual BOOL IsABitmap () const
virtual BOOL IsAFillAttr () const
virtual BOOL IsABitmapFill () const
virtual BOOL IsABitmapColourFill () const
virtual BOOL IsABitmapTranspFill () const
virtual BOOL IsAFeatherAttr () const
virtual BOOL IsAClipViewAttr () const
virtual BOOL IsBounded () const
virtual BOOL IsDragged () const
virtual BOOL IsController ()
virtual BOOL IsABlend ()
virtual BOOL IsCompound () const
virtual BOOL IsCompoundClass () const
virtual BOOL IsAVisibleTextNode () const
virtual BOOL IsAnAbstractTextChar () const
virtual BOOL IsATextChar () const
virtual BOOL IsABaseTextClass () const
virtual BOOL IsATypeface () const
virtual BOOL IsAnObjectName () const
virtual BOOL IsUserAttribute () const
virtual BOOL IsSetCandidate () const
virtual BOOL IsCacheCompound () const
virtual BOOL IsABevel () const
virtual BOOL IsABevelController () const
virtual BOOL IsAContour () const
virtual BOOL IsAContourController () const
virtual BOOL IsAShadow () const
virtual BOOL IsAShadowController () const
virtual BOOL IsABrush () const
virtual BOOL IsEffect () const
virtual BOOL IsBitmapEffect () const
virtual BOOL IsRenderedAsInk () const
BOOL IsBrushed () const
 Quicker way to test if this node is a bitmap. Virtual function for determining if the node is a Fill attribute Virtual function for determining if the node is a Fill attribute Virtual function for determining if the node is a Fill attribute Virtual function for determining if the node is a Fill attribute Quicker way to test if this node is an object-name attribute. Quicker way to test if this node is an AttrUser. Quicker way to test if this node is worth considering during Name gallery scans. Virtual function to determine whether this node is a NodeMould.Virtual function for determing whether this node is a brush attribute as above.
virtual NodePathIsAnEditablePath ()
 Determine if a node is *derived* from the NodeHidden class.Determine if a node is a NodeDocument object.Determine if a node is a NodePath object.Determine if a node is a QuickShape object.Determine if a node is a visible text node.Determine if a node is an AbstractTextChar node. Determine if a node is a (or is derived from) TextChar. Determine if a node is a (or is derived from) BaseTextClass. Determine if a node is a (or is derived from) AttrTxtFontTypeface. Finds the node to edit (if it exists). This node could actually be 'this' node one of its children which the node wants to be editable.
virtual BOOL IsANodeClipViewController () const
virtual BOOL IsANodeClipView () const
virtual BOOL IsAGroup () const
virtual BOOL IsAnInsertionNode () const
virtual BOOL IsANodeMould () const
virtual BOOL SupportsClipboardFormat (InternalClipboardFormat *Format) const
 Determine if a node supports a given internal data type. This is used by the clipboard when exporting to other applications in order to determine if certain data types can be supplied.
virtual BOOL DiscardsAttributeChildren () const
 This virtual was added because we need to know about nodes which can discard their child attributes, an example is the CaretNode. If an attribute gets applied to such a node then no undo info can be generated.
virtual NodeHasEditableChild (CCRuntimeClass *ChildClass, Node *pPrevNode)
 This function allows compound objects to provide editable children. It also allows tools to ask an object what other nodes form part of its editable surface if the node itself cannot be editable. This allows complex objects such as moulds and text objects, who have a single parent above many objects (some of which are editable), to provide a way for tools to get at them. A tool scanning the selection may be looking to edit certain objects. If a selected object it comes accross is not of the correct type, the tool can also ask it whether it contains any editable objects of type(ChildClass). If the node overrides this virtual function it can provide a strangly shapes editable surface. Note, do not confuse this with select inside, where objects have been explicitly selected by the user. In that case the parent would never be asked for editable children as it does not form part of the selection under a select inside action.
virtual KernelBitmapEnumerateBitmaps (UINT32 Count)
 Find out what bitmaps, if any, are used by this node.
virtual double GetEffectiveBitmapMinDPI (KernelBitmap *pBitmap)
virtual BOOL ReplaceBitmap (KernelBitmap *pOrigBitmap, KernelBitmap *pNewBitmap)
virtual TCHARGetDefaultOpToken ()
void SetLocked (BOOL Status)
 To set the node's locked status (TRUE/FALSE).
void SetMangled (BOOL Status)
 To set Nodes mangled status (TRUE/FALSE).
void SetMarker (BOOL Status)
 To set Nodes marked status (TRUE/FALSE).
virtual void SetSelected (BOOL Status)
 To set Nodes selected status (TRUE/FALSE) This routine also deals with "select-inside" by making sure all the SelectedChildren flags are set appropriately. Note: Selecting a node prevents it from being a parent of selected nodes This routine therefore clears the selection of any children! Note2: Calling this routine clears any selection from children of this node and marks it to no longer be the parent of selected children. This is done because selected nodes can't have sel children and because unselecting a node implies that you thought it was selected in which case it shouldn't have selected children.
void SetRender (BOOL Status, BOOL bAndChildren=FALSE)
 To set Nodes renderable status (TRUE/FALSE).
void SetParentOfSelected (BOOL Status)
 To set Nodes SelectedChildren status (TRUE/FALSE) This is used to implement select-inside.
BOOL HasSelectedChildren () const
 To find out whether a node has got selected children or children that themselves have selected children... Helper function for SetSelected Scope: Private.
void ClearSelection (BOOL AndChildren=FALSE)
 Clears all selection flags in this node. It now deselects all children if the AndChildren is TRUE (Defaults to FALSE).
BOOL ChildrenNeedTransparency ()
 Used when adding sub-trees to a document (e.g. file load, import). It scans the node's children to determine if any of them need transparency in order to be displayed correctly. NB. The node itself is not checked; only its children.
NodeFindNext (void) const
 For finding the next sibling of a node.
NodeFindPrevious (void) const
 For finding the previous sibling of a node.
NodeFindParent (void) const
 For finding the parent of a node.
NodeFindFirstChild (void) const
 For finding the first child of a node.
NodeFindLastChild (BOOL ExcludeInsertionNode=FALSE) const
 This function will return TRUE when called on NodeRenderableBounded nodes and those derived from it. This is the base class version that returns FALSE For finding a node's last child.
NodeFindParent (CCRuntimeClass *ParentClass) const
 This function follows the node's parent links until it finds a node of class ParentClass. If no such node is found then an ENSURE will occur.
NodeFindNext (CCRuntimeClass *Class) const
 This function follows the node's next links until it finds a node derived from Class. NULL is returned if no node is found.
NodeFindPrevious (CCRuntimeClass *Class) const
 This function follows the node's Previous links until it finds a node derived from Class. NULL is returned if no node is found.
NodeFindFirstChild (CCRuntimeClass *Class) const
 Find first child of specified type.
NodeFindLastChild (CCRuntimeClass *Class) const
 Find last child of specified type.
NodeRenderableInkFindNextInk () const
 Find the next ink node. Notes: Analogous to FindNext(CC_RUNTIME_CLASS(NodeRenderableInk)), just faster and neater.
NodeRenderableInkFindPreviousInk () const
 Find the previous ink node. Notes: Analogous to FindPrevious(CC_RUNTIME_CLASS(NodeRenderableInk)), just faster and neater.
NodeRenderableInkFindFirstChildInk () const
 Find the first child ink-node. Notes: Analogous to FindFirstChild(CC_RUNTIME_CLASS(NodeRenderableInk)), just faster and neater.
NodeRenderableInkFindLastChildInk () const
 Find the last child ink-node. Notes: Analogous to FindLastChild(CC_RUNTIME_CLASS(NodeRenderableInk)), just faster and neater.
BaseDocumentFindOwnerDoc () const
 Find out which document this node is in. This is used to maintain an accurate node count for each document.
BOOL IsFamily (CCRuntimeClass *ccrcType, Node *pAncestor) const
 Basically, we're looking for a child-parent-grandparent relationship. We're the child and our parent can also be the grandparent.
void SetParentDangerous (Node *NewParent)
 Sets the parent of the node to NewParent.
void SetNextDangerous (Node *NewNext)
void SetPreviousDangerous (Node *NewPrev)
void SetChildDangerous (Node *NewChild)
NodeFindNextNonHidden (void) const
 For finding the next sibling of a node (ignoring all NodeHidden nodes).
NodeFindPrevNonHidden (void) const
 For finding the previous sibling of a node (ignoring all NodeHidden nodes).
SpreadFindParentSpread ()
 Find the spread node to which this node is ultimately attached.
NodeDocFindNextDepthFirst (void)
 To find the next node in the depth first traversal of the current document tree.
NodeFindFirstDepthFirst ()
 To find the first node in a depth first traversal of this subtree.
NodeFindNextDepthFirst (Node *Subtree)
 To find the next node in the depth first traversal of the subtree.
NodeFindFirstPreorder ()
NodeFindNextPreorder (Node *pRoot=NULL, BOOL bSkipSubtree=FALSE)
ChapterFindNextChapter (void)
 To find the next chapter in the document tree.
NodeRenderablePaperFindNextForClippedPaperRender (void)
 To traverse the document tree to find the next paper renderable node which needs to be rendered, i.e. its pasteboard rectangle intersects with the current clipping rectangle.
NodeFindFirstForClippedInkRender (DocRect *pClipRect, RenderRegion *pRender, BOOL ExcludeLockedLayers=FALSE, Node *pStopNode=NULL)
 To traverse the document tree depth first to find the first NodeRenderableInk or NodeAttribute node which needs to be rendered, i.e. in the case of a NodeRenderableInk node its bounding rectangle intersects with the current clipping rectangle (and it's not on a hidden layer).
NodeFindNextForClippedInkRender (DocRect *pClipRect, RenderRegion *pRender, BOOL ExcludeLockedLayers=FALSE, Node *pStopNode=NULL)
 To traverse the document tree depth first to find the next NodeRenderableInk or NodeAttribute node which needs to be rendered, i.e. in the case of a NodeRenderableInk its bounding rectangle intersects with the current clipping rectangle.
NodeFindFirstForUnclippedInkRender (RenderRegion *pRender)
 To traverse the document tree depth first to find the first NodeRenderableInk or NodeAttribute node which needs to be rendered, regardless of the clip rectangle of the render region (and it's not on a hidden layer).
NodeFindNextForUnclippedInkRender (RenderRegion *pRender)
 To traverse the document tree depth first to find the next NodeRenderableInk or NodeAttribute node which needs to be rendered, ignoring the clipping rectangle of the clip region. (i.e. all renderable nodes except those on hidden layers).
ChapterFindEnclosingChapter (DocCoord *ChapterPos, XLONG *ChapterDepth)
 For finding the enclosing chapter of a node, the position of the start of the enclosing chapter, and the chapters depth.
NodeAttributeFindFirstGeometryLinkedAttr ()
NodeAttributeFindNextGeometryLinkedAttr ()
virtual void UnlinkNodeFromTree (BaseDocument *pOwnerDoc=NULL)
 Unlinks the node from the tree.
NodeFindParentOfSelected ()
 To find the node at the normal selection surface from one of its selected-inside children. Note that this routine can be used to test whether a node is "selected-inside" or not by testing whether the Node* returned is NULL or not. (NULL means not selected-inside.).
virtual NodeCompoundGetParentController () const
virtual BOOL CanBecomeA (BecomeA *pBecomeA)
 Interrogation routine to see if a node can be changed into a different node type.
virtual BOOL DoBecomeA (BecomeA *pBecomeA)
 Actually tries to change the node into a different node type.
ChangeCode WarnParentOfChange (ObjChangeParam *pParam, BOOL AllParents=TRUE)
 When an object changes, this function should be used to inform its parent(s) of the change. If AllParents is TRUE it will call every parent, passing the object change parameter to their OnChildChange() virtual function.
virtual BOOL AllowSelectInside () const
void IncHiddenCnt (void)
 Increments the count of the number of NodeHidden nodes which reffer to the node. This routine should only be called from the NodeHidden methods.
void DecHiddenCnt (void)
 Decrements the count of the number of NodeHidden nodes which reffer to the node. This routine should only be called from the NodeHidden methods.
UINT32 GetHiddenCnt (void)
 For finding out how many hidden nodes reffer to the node.
BOOL OptimiseAttributes ()
 This function should be called on a subtree.
virtual BOOL HidingNode ()
 Useful for debugging - actually, it only exists in the debug build.This virtual function is called whenever the node is hidden. It allows the node do things like 'optimise' itself to use less memory or send a message to let others know it's is being hidden etc.
virtual BOOL ShowingNode ()
 This virtual function is called whenever the node is re-shown after being Hidden. It allows the node to reconstruct itself if it was optimised or send a message to let others know it is back etc.
virtual INT32 ComplexHide (UndoableOperation *pOp, Node *pNextInRange)
 This function can be overridden by complex objects who wish to gain more control in what happens when they are hidden. For instance some nodes may not want to be hidden at all. If this function is not overridden, the normal action will be used, which is to use DoHideNode() on the node. It may be that some complex parents may wish to retain various sets of nodes within themselves and allow others to be hidden. To inherit this facility in your node, you simply need to override this virtual function and handle your own hiding of the node.
void MarkNodeAndChildren ()
 Mark this node and all its children.
void MarkChildren ()
 Mark all children of this node.
void ClearMarks ()
 Clear marks from this node and all its children.
void ClearChildMarks ()
 Clear marks from all the children of this node.
virtual BOOL IsDifferent (Node *pOther)
 Determine if 2 nodes are considered different.
virtual void CountChildNodes (UINT32 *pChildCount, UINT32 *pChildAttrCount)
 This scans the child sibling list of this node, counting the number of nodes it finds and the number of attributes.
virtual BOOL AreChildAttrsIdentical (Node *pOtherNode)
 This scans the child sibling list of this node, to see of it contains the same attributes as pOtherNode.
virtual BOOL HasThisChildAttr (NodeAttribute *pAttr)
 This scans the child sibling list of this node, to see if it contains an attribute that's exactly the same as the given one.
virtual BOOL CopyChildAttrs (Node *pDestNode)
 This scans the child sibling list of this node, and copies all the child attributes, applying the copy as a child to the destination node.
virtual BOOL IsNodeInSubtree (Node *pNode)
 Checks the parents of the given node, to see whether it lies within this node's subtree.
virtual BOOL RegenerateNode (UndoableOperation *pOp=NULL, BOOL bCacheRender=FALSE, BOOL bInformParents=TRUE)
virtual BOOL PromoteHitTestOnChildrenToMe () const
virtual BOOL ShouldITransformWithChildren () const
virtual BOOL NeedsParent (Node *pClassNode) const
virtual BOOL MarqueeSelectNode () const
virtual NodePublicCopy ()
 This method copies the node's contents to the node pointed to by NodeCopy.
void RemoveAttrTypeFromSubtree (CCRuntimeClass *AttrType, Node *pExceptThis=NULL)
 Searches the subtree and every attribute which has type AttrType is deleted.
void DeleteChildren (Node *FirstChild)
 Deletes the children and all the children's children etc. starting from FirstChild.
virtual BOOL SetParentLayerAsEdited ()
 Mark parent layer as edited. If an ink object as something done to it which changes its appearance then we need to mark the parent layer as edited. In this baseclass version do nothing.
NodeAttributeFindFirstAttr (TypeFunc pfnTest) const
virtual BOOL IsTypeExtendible () const
virtual DocRect ValidateExtend (const ExtendParams &ExtParams)
 Tests the reversibility of an Extend operation applied to this node.
virtual void Extend (const ExtendParams &ExtParams)
 Perform an Extend operation on this Node, and its children if appropriate. Default implementation just calls Extend() on its children.

Static Public Member Functions

static NodeDocFindFirstDepthFirst (BaseDocument *pDocToSearch)
 To find the first node in a depth first traversal of the document tree.
static ChapterFindFirstChapter (BaseDocument *pDocToSearch)
 To find the first chapter in the document tree.
static void StartHourglass ()
static void StopHourglass ()
static BOOL ShowHourglass ()

Protected Member Functions

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.
virtual INT32 ComplexCopy (CopyStage Stage, Range &RangeToCopy, Node **pOutput)
 This virtual function is useful for nodes needing to control how they are to be copied. It is overridden currently by text characters and line objects. These objects cannot exist outside the context of a text story. Hence when copying a character object, the parent line object and text story object must be copied along with it. To do this we must give an object the ability to copy whatever it needs to along with itself. In order to do that, the object needs to override this virtual function and the associated GetCopyType() function. ( Normally nodes which are not associated with a particular grouping will not need to override either of these functions. The copy mechanism defaults to using SimpleCopy(), whereby every node is copied as is ).
void CopyNodeContents (Node *nodeCopy)
 This method copies the node's contents to the node pointed to by NodeCopy.
NodeFindChildToRender (DocRect *const pClipRect, RenderRegion *const pRender, BOOL ExcludeLockedLayers, Node *pStopNode=NULL)
 Find the first child of this node that needs rendering. This follows the children (assuming they intersect with the clipping rectangle), and finds (via a depth first search) the first child that should be rendered according to our rules. The node should be either:.
NodeFindChildToRenderUnclipped (RenderRegion *const pRender)
 Find the first child of this node that needs rendering. This follows the children (assuming they intersect with the clipping rectangle), and finds (via a depth first search) the first child that should be rendered according to our rules. The node should be either:.
BOOL CopyChildren (Node *FirstChild, Node *NewParent, CopyControlFlags=ccALL)
 This private method makes a copy of all the subtree's children and attaches them to NewParent (the root of the new subtree). It is a helper method for CopyTree.
BOOL DeSelectSubtree ()
 To deselect all selected nodes below this node. This function also ensures that the SelectedChildren flags are cleared properly. It is self-recursive! Helper function for SetSelected Scope: Private.

Protected Attributes

UINT32 Tag
NodeFlags Flags
NodePrevious
NodeNext
NodeChild
NodeParent
UINT32 HiddenRefCnt

Static Protected Attributes

static MILLIPOINT PixelWidth
static MILLIPOINT PixelHeight

Private Member Functions

void AttachAsPreviousNode (Node *ContextNode)
 Links the node as a previous sibling of ContextNode.
void AttachAsNextNode (Node *ContextNode)
 Links the node as a next sibling of ContextNode.
void AttachAsFirstChildNode (Node *ContextNode)
 Links the node as a first child of ContextNode.
void AttachAsLastChildNode (Node *ContextNode)
 Links the node as a last child of ContextNode.
void SetTags (BaseDocument *pOwnerDoc)
 Sets the tag of this node and all its descendants to a legal value, according to which document it is in, if any.

Static Private Attributes

static BOOL HourglassOn = FALSE

Friends

class NodeHidden

Classes

struct  NodeFlags

Detailed Description

This abstract class describes the fundamental type of object which can be linked into a camelot tree. All other objects which are linked into the tree are derived from this class.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> Date: 19/4/93 Base Classes: CCObject
IMPORTANT: When producing derived classes of Node, the virtual functions SimpleCopy and ShowDebugTreeDetails() must be redefined.

See also:
CCObject

Definition at line 344 of file node.h.


Member Typedef Documentation

typedef BOOL(Node::* Node::TypeFunc)() const
 

Definition at line 845 of file node.h.


Constructor & Destructor Documentation

Node::Node  ) 
 

This constructor creates a node linked to no other with all status flags FALSE. Also updates the Node counter of the current Document.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/4/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
- (Constructor)

Errors: An assertion failure will occur if there is no current document Notes: This method relies on the current document having been set in the Document object.

Definition at line 161 of file node.cpp.

00162 {
00163     Previous=Next=Child=Parent=NULL; 
00164     // Set OpPermission stuff here too as SetOpPermission does a GetOpPermission which otherwise reads an undefined value
00165     Flags.Locked=Flags.Mangled=Flags.Marked=Flags.Selected=Flags.Renderable=Flags.OpPermission1=Flags.OpPermission2 = FALSE;   
00166     Flags.SelectedChildren = FALSE;
00167     SetOpPermission(PERMISSION_UNDEFINED);  
00168     HiddenRefCnt = 0; 
00169          
00170     // Has no TAG because it is not in a document yet.
00171     Tag = TAG_NOT_IN_DOC; 
00172 }

Node::Node Node ContextNode,
AttachNodeDirection  Direction,
BOOL  Locked = FALSE,
BOOL  Mangled = FALSE,
BOOL  Marked = FALSE,
BOOL  Selected = FALSE,
BOOL  Renderable = FALSE
 

This constructor initialises a node and links it to ContextNode in the direction specified by Direction. All necessary tree links are updated. For example if a node is inserted as a FirstChild of ContextNode, and Context node already has children, then the current first child of context node will become the next sibling of the new first child node.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/93
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

The remaining inputs specify the status of the node:

Locked: Is node locked ? Mangled: Is node mangled ? Marked: Is node marked ? Selected: Is node selected ? Renderable: Is node renderable ? Compound: Can node contain non attribute children (eg. a group)

Parameters:
- [OUTPUTS]
Returns:
-
Also updates the Node counter of the current document.

Returns:
Errors: An assertion failure will occur if the ContextNode is NULL

Definition at line 232 of file node.cpp.

00240 {                             
00241     // Defensive programming
00242     ENSURE(ContextNode != NULL,"Trying to attach a node to a NULL node");              
00243 
00244     // Initialize the flags
00245     Flags.Locked = Locked; 
00246     Flags.Mangled = Mangled; 
00247     Flags.Marked = Marked; 
00248     Flags.Selected = Selected; 
00249     Flags.SelectedChildren = FALSE;
00250     Flags.Renderable = Renderable;
00251     Flags.OpPermission1 = Flags.OpPermission2 = FALSE; // because SetOpPermission does a GetOpPermission
00252 
00253     // Has no TAG because it is not in a document yet.
00254     Tag = TAG_NOT_IN_DOC; 
00255 
00256     SetOpPermission(PERMISSION_UNDEFINED);  
00257     Child=NULL;                         // New node has no children
00258     AttachNode(ContextNode,Direction);  
00259              
00260     // Sanity check of unique TAG for object
00261     BaseDocument* pDoc = ContextNode->FindOwnerDoc();
00262     if (pDoc != NULL)
00263     {
00264         ERROR3IF(Tag==TAG_NOT_IN_DOC, "Tag should have a valid value");
00265         // Get a tag for this node and update the count of nodes in the document.
00266         if (Tag==TAG_NOT_IN_DOC)
00267             SetTags(pDoc);
00268     }
00269     else 
00270     {
00271         ERROR3IF(Tag!=TAG_NOT_IN_DOC, "Tag should be TAG_NOT_IN_DOC");
00272         Tag = TAG_NOT_IN_DOC; // Has no TAG
00273     }
00274 
00275     HiddenRefCnt = 0;
00276 
00277     if (Selected) 
00278     {
00279         // Inform the Selection SelRange that the selection has changed
00280         // Pass in 'this' to let it know that I am the most recently selected node
00281         SelRange *Selection = GetApplication()->FindSelection();
00282         if (Selection != NULL)
00283             Selection->Update(FALSE, this);
00284     }
00285 } 

Node::~Node  )  [virtual]
 

Destroys a Node object. The base class updates the node counter of the current document, and ensures that the SelRange doesn't have a cached pointer to 'this' as its 'Last Selected Node'.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/11/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
Document::DecCurrentNodeCount

Definition at line 307 of file node.cpp.

00308 {
00309     ERROR3IF(Child != NULL,"Deleting a node that has a ptr to child nodes");
00310 
00311     // Ensure that the Selection SelRange doesn't still keep a cached pointer to me
00312     SelRange *Selection = GetApplication()->FindSelection();
00313     if (Selection != NULL)
00314         Selection->ClearLastSelectedNodeIfItIs(this);
00315 
00316 }


Member Function Documentation

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

This is the way to ask a node if you can do an op to it.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com> 19/01/2000
Date:
3/02/95
Parameters:
pParam = describes the way an op wants to change the node [INPUTS] SetOpPermissionState = if TRUE the Op permission state of this node will be set according to the outcome of the call 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.
- [OUTPUTS]
Returns:
TRUE means the node and all its parents are happy with this op, FALSE means don't do it
The ObjChangeParam class contains flags that describe how it will change the node

For example, the op could change the node's appearence (e.g. attr application, editing a path), replace the node with another node (e.g. because it uses hidden nodes to hide the original and put another node in its place, or "make shapes"), delete the node (e.g. the delete and cut ops), etc.

This function gives the node a chance to say NO. It also gives the parents a chance to say no too. E.g. a blend node will allow itself to be deleted, but it will NOT allow a child of itself to be deleted).

This call should only be made on selected, or parents of selected, nodes. It makes a decision as a straight node if it is selected. It makes a decision as a parent if it has selected children.

E.g. NodeBlend::AllowOp(...op delete...) if the node is selected, then it will return TRUE (parents permitting), i.e. I can be deleted if the node is a parent of selected it will return FALSE (i.e. can't delete children of blends).

So when the node is selected, you are asking the node if you can do the op to it. When the node is a parent of a selected node, you are asking if you can do the op to one of its children.

If the 'SetOpPermissionState' param is TRUE, the following indented lines applies: The node's op permission state is set according to the result of this function.

If TRUE is returned, then the node's op permission state will be left unchanged. AND the parent's op permission state will be set to PERMISSION_ALLOWED

if FALSE is returned, then the node's op permission state will be PERMISSION_DENIED, AND all it's parents (up to the layer) will be set to PERMISSION_DENIED

Also, all parents of this node are called via their AllowOp() func with the same state as this node. This means that after this call, you can guarantee that all of its parents will have either a PERMISSION_DENIED or PERMISSION_ALLOWED state.

Note: Even if this node tries to set all it's parents to have a PERMISSION_DENIED state, if any of its parents have previously been set to PERMISSION_ALLOWED they will remain in that state (see SetOpPermission()). Why? Well, it is possible for a parent node to have one child with a PERMISSION_DENIED and another child with a PERMISSION_ALLOWED. It this state the parent MUST be in state PERMISSION_ALLOWED, because at least one of its children will allow the op to happen to it.

So, after this call: The op permission state for this node will be either left unchanged (and therefore remain PERMISSION_UNDEFINED), or PERMISSION_DENIED.

The parent's op permission state will be either PERMISSION_ALLOWED, or PERMISSION_DENIED.

This is so UndoableOperation::UpdateChangedNodes() will only call OnChildChange() on parent nodes, because it only calls that func for nodes that have an op permission state of PERMISSION_ALLOWED.

See also:
GetOpPermission(),SetOpPermission();

Reimplemented in Layer, NodeContourController, NodeBlendPath, NodeClipViewController, NodeSetSentinel, NodeBevel, NodeBlend, NodeContour, NodeMoulder, NodePath, BaseTextClass, and TextStory.

Definition at line 5147 of file node.cpp.

05148 {
05149     ERROR2IF(pParam==NULL,FALSE,"Node::AllowOp() - pParam==NULL");
05150 
05151     // if not called by a child AllowOp(), ensure AllowOp() called for all nodes in compound nodes,
05152     if (pParam->GetDirection()!=OBJCHANGE_CALLEDBYCHILD)
05153     {
05154         BOOL AnyAllowed=AllowOp_AccountForCompound( pParam,
05155                                                     SetOpPermissionState,
05156                                                     DoPreTriggerEdit );
05157         // check for geometry linked attributes
05158         // NB this handles the passing of AllowOp messages to GeomLinkedAttrs on CALLEDBYPARENT
05159         // and CALLEDBYOP.
05160         // NB2 compounds which don't implement their own AllowOps will call
05161         // AccountForCompound from here so ensure that nodes don't inform
05162         // geom linked attrs of the change twice
05163         if(!IS_KIND_OF(NodeGroup))
05164         {
05165             UndoableOperation* pChangeOp = pParam->GetOpPointer();
05166             BOOL InformGeomLinkedAttrs = SetOpPermissionState && pChangeOp && pChangeOp->MayChangeNodeBounds();
05167             if(InformGeomLinkedAttrs)
05168             {
05169                 NodeAttribute* pNA = FindFirstGeometryLinkedAttr();
05170                 while(pNA)
05171                 {
05172                     pNA->LinkedNodeGeometryHasChanged(pChangeOp);
05173                     pNA = pNA->FindNextGeometryLinkedAttr();
05174                 }
05175             }
05176         }
05177 
05178         // if called by a parent, just pass this result back
05179         if (pParam->GetDirection()==OBJCHANGE_CALLEDBYPARENT)
05180             return AnyAllowed;
05181     }
05182     else
05183     {
05184         // clean out the calling-child ptr, so it doesn't get passed around unintentionally.
05185         pParam->SetCallingChild(NULL);
05186     }
05187 
05188 
05189     // at this point we must have been called directly by the op or via a child AllowOp()
05190 
05191     // decide if we allow it ... err we do!
05192     BOOL allowed = TRUE;
05193 
05194     // if we allowed it, see if our parents do ...
05195     if (Parent != NULL)
05196     {
05197         ObjChangeDirection OldDirection = pParam->GetDirection();
05198         pParam->