NodeMould Class Reference

This class defines the structure of a mould node object. This object is the parent of a MouldGroup node and a Moulder node. Objects being moulded are placed inside MouldGroup and all resulting moulded objects are placed inside the Moulder node. More...

#include <nodemold.h>

Inheritance diagram for NodeMould:

NodeGroup NodeCompound NodeRenderableInk NodeRenderableBounded NodeRenderable Node CCObject SimpleCCObject List of all members.

Public Member Functions

 NodeMould ()
 NodeMould (Node *ContextNode, AttachNodeDirection Direction, BOOL Locked=FALSE, BOOL Mangled=FALSE, BOOL Marked=FALSE, BOOL Selected=FALSE)
 This method initialises the node and links it to ContextNode in the direction specified by Direction. All necessary tree links are updated.
 ~NodeMould ()
 This destructor calls the parent class destructor and then checks whether it is necessary to delete the mould geometry class. If so the shape geometry is deleted.
void InitialiseVars ()
 Common place to set up the classes private variables.
virtual void PreExportRender (RenderRegion *pRender)
 Called before this node or any of its children have been rendered to the export region. This outputs the "start mould" command. Supports ArtWorks EPS and Camelot EPS.
virtual BOOL ExportRender (RenderRegion *pRender)
 Called after this node and all of its children have been rendered to the export region. This outputs the "end mould" command. Supports ArtWorks EPS and Camelot EPS.
virtual BOOL PostImport ()
 This function is called after a document is imported. Nodes should override this function to do any post-import processing.
virtual void RenderObjectBlobs (RenderRegion *pRender)
 This renders all the blobs associated with this mould node This node doesn't do any rendering itself. All it does is ask the shape object to render itself.
virtual void RenderTinyBlobs (RenderRegion *pRender)
 Draws the paths Tiny blob into the render region supplied.
virtual DocRect GetBlobBoundingRect ()
 This calculates the bounding box of the mould and adds in the influence of the selection blobs. It does not consider if the blobs are visible or not, it just gives the bounding box that they would occupy if they were visible Note, the mould blob bounds are simply made up of the nodemouldpath bounds and thats yer lot.
virtual void Transform (TransformBase &Trans)
 Transforms the mould object and all its children.
virtual String Describe (BOOL Plural, BOOL Verbose)
 To return a description of the Mould object in either the singular or the plural. This method is called by the DescribeRange method.
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.
virtual UINT32 GetNodeSize () const
 For finding the size of the node.
virtual BOOL IsANodeMould () const
 Virtual function to determine whether this node is a NodeMould.
virtual BOOL OnClick (DocCoord, ClickType, ClickModifiers, Spread *)
 Allows the Node to respond to clicks by selecting its blobs or starting drags etc. Here we check for clicks over a moulds shape. If a blob has been clicked on we start a new drag operation to alter the shape of the mould.
BOOL OnMouseMove (DocCoord, Spread *, ClickModifiers, INT32 *, INT32 *)
 A very unusual function to find in a node. This must exist so that the mould tool can ask the mould object what cursor to show as the mouse moves around. The function is called for each selected mould object when the mould tool is current. The nub of the problem is that a mould object can basically be made up of virtually anything. We actually need to ask the mould shape handler inside the mould object what type of cursor it wants to show and what sort of resouced message it would like to display. This cannot be determined from outside the object.
virtual ChangeCode OnChildChange (ObjChangeParam *pParam)
 An object has or is currently being edited inside our mould so we need to perform actions related to this change. The parameter block passed to us will define what to do (if we recognise it). Otherwise we will simply perform the default action of remoulding ourselves on receiving a HasChanged reason.
virtual NodeHasEditableChild (CCRuntimeClass *ChildClass, Node *pPrevEditable)
 This function returns our edit node (the nodemouldpath) which forms part of the mould objects editable surface.
virtual BOOL OnNodePopUp (Spread *pSpread, DocCoord PointerPos, ContextMenu *pMenu)
 This provides descriptions for the mould records. Allows the Mould object to respond to pop up menu clicks on itself.
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. This converts all its children, and replaces itself in the tree with a NodeGroup.
virtual BOOL AllowSelectInside () const
void GetDebugDetails (StringBase *Str)
 Displays debugging info of the tree For obtaining debug information about the Node.
void PreExportCAMEPS (RenderRegion *pRegion)
BOOL PostExportCAMEPS (RenderRegion *pRegion)
void PreExportAWEPS (RenderRegion *pRegion)
BOOL PostExportAWEPS (RenderRegion *pRegion)
void ToggleDetachFlag ()
 Switch the logical value of the detached mould flag inside this mould object.
BOOL IsDetached () const
virtual BOOL WritePreChildrenWeb (BaseCamelotFilter *pFilter)
 Writes out a records associated with this node.
virtual BOOL WritePreChildrenNative (BaseCamelotFilter *pFilter)
virtual BOOL IsTypeExtendible () const
virtual DocRect ValidateExtend (const ExtendParams &ExtParams)
 NodeMould uses Node's base-class implementation, as we don't want to inherit NodeGroup's extend behaviour - see Node::ValidateExtend() for details. See also: Node::ValidateExtend().
virtual void Extend (const ExtendParams &ExtParams)
 NodeMould uses Node's base-class implementation, as we don't want to inherit NodeGroup's extend behaviour - see Node::Extend() for details. See also: Node::Extend().
virtual DocRect GetExtendTargetBounds (const ExtendParams &ExtParams)
 NodeMould uses NodeRenderableBounded's base-class implementation, as we don't want to inherit NodeGroup's extend behaviour - see base class for details. See also: NodeRenderableBounded::Extend().
virtual void PolyCopyNodeContents (NodeRenderable *pNodeCopy)
 Polymorphically copies the contents of this node to another.
MouldSpace DescribeGeometry ()
 Find out what type of geometry is defined for this mould object.
MouldGeometryGetGeometry () const
NodeMouldPathGetPathShape ()
 A useful function to find the first node mould shape object within a NodeMould object. As this is used quite a lot its been 'function'alised.
PathGetPath ()
 A useful function to find the actual path used for moulding As this is used quite a lot its been 'function' alised.
DocRect GetRenderBounds ()
 Return the bounding rect of the mould. This rectangle includes only those items in the mould which are visible and hence will be invalidated by the OS. Items such as the NodeMouldGroup (which are of course invisible) do not get involved in the renderbounds.
DocRect GetChildrensBounds ()
void DisableBlobs ()
void EnableBlobs ()
BOOL CreateGeometry (MouldSpace mSpace)
 Changes the mould space used by this mould to that described by mSpace. Currently the defined spaces are MOULDSPACE_ENVELOPE MOULDSPACE_PERSPECTIVE.
NodeMoulderCreateNewMoulder (UndoableOperation *)
 Creates a NodeMoulder object and returns a pointer to it.
NodeMouldPathCreateNewMouldShape (Path *pPath, DocRect *const pDestin, UndoableOperation *pOp)
 Creates a node mould path object using the path pointer given and the destination rectangle described. The objects pointer is returned.
NodeMouldGroupCreateNewMouldGroup (UndoableOperation *pOp)
 Creates a MouldGroup object and returns a pointer to it.
BOOL CreateAllMoulderObjects (UndoableOperation *pOp)
 Scan through the children of a mould object, getting all NodeMoulders to regenerate their moulded objects.
NodeMoulderAddNewMoulder (Node *, AttachNodeDirection, UndoableOperation *)
 Creates a NodeMoulder object and sticks it in the tree at the specified position.
NodeMouldPathAddNewMouldShape (Path *pPath, DocRect *const pDestin, UndoableOperation *pOp)
 Creates a node mould path object using the path pointer given and the destination rectangle described. The object is inserted as the first child of this node mould object and its pointer is returned.
NodeMouldGroupAddNewMouldGroup (UndoableOperation *pOp)
 Creates a MouldGroup object inside the MouldParent and moves all the objects specified by NodeList into the group. Only object which can become either a path or a nodebitmap are actually moved.
BOOL FillMouldGroup (NodeMouldGroup *, List *, UndoableOperation *)
 Moves all the objects specified by NodeList into the mould group. Only objects which can become either a path or a nodebitmap are actually moved.
NodeMoulderFindFirstMoulder (BOOL errorcheck=TRUE)
 A useful function to find the first node moulder object within a NodeMould object. As this is used quite a lot its been 'function'alised.
NodeMoulderFindNextMoulder (NodeMoulder *pNodeMoulder)
 A useful function to find the next node moulder object within a NodeMould object.
NodeMouldGroupFindMouldGroup (BOOL errorcheck=TRUE)
 A useful function to find the mould group node within a NodeMould object. As this is used quite a lot its been 'function'alised.
ChangeCode RemouldAll (UndoableOperation *pUndoOp)
 Creates a new set of moulded objects, now the mould shape has changed.
ChangeCode StartSaveContext (UndoableOperation *pUndoOp, INT32)
 Tries to save the current state of the mould shape on the undo. If you want to edit the mould in any way you should use this function to record various parts of the mould before going ahead and changing any data. The corresponding EndSaveContext should be called after you have altered any data.
ChangeCode EndSaveContext (UndoableOperation *pUndoOp, INT32)
 Tries to save the current state of the mould shape on the undo.
BOOL CreateAttrSetFromChildren (AttrTypeSet &AttSet)
 Builds a set of AttrTypeSet set of attributes from the children of a node.
BOOL SetGeometry (MouldGeometry *)
 Not to be used.
INT32 CountMoulders ()
 Count the number of moulder objects which have been created within this mould. This does not include hidden moulder objects of course.
virtual BOOL IsValidEffectAttr (NodeAttribute *pAttr) const
 Get width of pixels for use in capturing this group as a tight group bitmapDetermine whether this type of attribute can be an effect attribute On this node at this time.Determine whether this attribute instance can be an effect attribute On this node at this time.
virtual BOOL GroupCanTransformCached (TransformBase &Trans) const

Static Public Member Functions

static void RemovePerspectiveFills (Node *pParentNode, UndoableOperation *pUndoOp)
 This function scans the children of a given parent for perspectivised bitmap fills. It replaces these attributes with standard bitmap fill atts in order to avoid perspective bitmap fills from escaping during a make shapes.

Private Member Functions

 CC_DECLARE_DYNAMIC (NodeMould)
void RedrawMould ()
 Forces a redraw over the mould object.
void CopyNodeContents (NodeMould *pCopyOfNode)
 Copies the data from this node to pCopyOfNode by first calling the base class to get it to copy its stuff, and then copying its own stuff Scope: protected.
ChangeCode HandleMouldShapeChange (ObjChangePathEdit *pParam)
 The user is about to edit, in the action of editing, or has edited, our mould shape. We as a parent need to sort out whether they are allowed to continue. If so we need to perform various actions dependent on what stage the change is in. AboutToEdit: we need to decide whether there is a good reason to prevent the edit from taking place Editing: we need to eor our edit blobs on when necessary HasEdited: we need to perform a remould of all children.
void IncludeChildrensBoundingRects (DocRect &BoundingRect)
 The childrens Blob bounding rects are added to the BoundingRect.
BOOL OverMouldEndPoint (DocCoord coord, Spread *pSpread)
 This routine checks for the mouse being over end points of our mould path.
ChangeCode RecordChangeCodes (UndoableOperation *pOp)
 Record the CRC codes held within the mould object.
ChangeCode ConvertCode (ActionCode Act)
 Convert a action code to a change code.

Private Attributes

String_32 MouldName
MouldGeometrypMouldGeometry
BOOL DetachedGeometry
INT32 OnCC_CRC
INT32 OnCC_Width
INT32 OnCC_Height
BOOL RenderBlobs

Friends

class RecordChangeCodesAction

Detailed Description

This class defines the structure of a mould node object. This object is the parent of a MouldGroup node and a Moulder node. Objects being moulded are placed inside MouldGroup and all resulting moulded objects are placed inside the Moulder node.

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

Definition at line 161 of file nodemold.h.


Constructor & Destructor Documentation

NodeMould::NodeMould  ) 
 

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

This method initialises the node and links it to ContextNode in the direction specified by Direction. All necessary tree links are updated.

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

Specifies the direction in which this 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 ?

Parameters:
- [OUTPUTS]
Returns:
-

Errors: An assertion error will occur if ContextNode is NULL

Definition at line 229 of file nodemold.cpp.

00235                 :NodeGroup(ContextNode, Direction, Locked, Mangled, Marked, 
00236                 Selected) 
00237 { 
00238     NodeMould::InitialiseVars();
00239 } 

NodeMould::~NodeMould  ) 
 

This destructor calls the parent class destructor and then checks whether it is necessary to delete the mould geometry class. If so the shape geometry is deleted.

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

Definition at line 253 of file nodemold.cpp.

00254 {
00255     if (pMouldGeometry != NULL)
00256     {
00257         delete pMouldGeometry;
00258         pMouldGeometry = NULL;
00259     }
00260 }


Member Function Documentation

NodeMoulder * NodeMould::AddNewMoulder Node pContextNode,
AttachNodeDirection  Direction,
UndoableOperation pOp
 

Creates a NodeMoulder object and sticks it in the tree at the specified position.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/12/94
Parameters:
pContextNode = The node to which NewNode is to be attached [INPUTS] Direction = The direction the new node should be attached to the context node. pOp = A pointer to an active operation (can be null)
Returns:
a pointer to the moulder object (not in the tree). NULL if failed to create this moulder.
See also:
-

Definition at line 1616 of file nodemold.cpp.

01619 {
01620     BOOL ok;
01621 
01622     // create a new moulder object
01623     NodeMoulder* pMoulder = CreateNewMoulder(pOp);
01624     if (pMoulder==NULL)
01625         return NULL;
01626 
01627     if (pOp!=NULL)
01628     {
01629         // now insert it in the tree in an undoable way
01630         CALL_WITH_FAIL(pOp->DoInsertNewNode(pMoulder, pContextNode, Direction, FALSE, FALSE, FALSE, FALSE), pOp, ok);   
01631     }
01632     else
01633     {
01634         // all right then, insert it in a none undoable way
01635         pMoulder->AttachNode(pContextNode, Direction); 
01636         pMoulder->SetSelected(FALSE); 
01637         ok = TRUE;
01638     }
01639 
01640     // if failed get rid of what we have
01641     if (!ok)
01642     {
01643         delete pMoulder;
01644         return NULL;
01645     }
01646 
01647     return pMoulder;
01648 }

NodeMouldGroup * NodeMould::AddNewMouldGroup UndoableOperation pOp  ) 
 

Creates a MouldGroup object inside the MouldParent and moves all the objects specified by NodeList into the group. Only object which can become either a path or a nodebitmap are actually moved.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/12/94
Parameters:
pOp = A pointer to an active operation (can be null) [INPUTS]
Returns:
a pointer to the created mould group (inserted into the tree) NULL if unable to create the node
See also:
-

Definition at line 1836 of file nodemold.cpp.

01837 {
01838     BOOL ok;
01839 
01840     // Create a mould group object
01841     NodeMouldGroup* pMouldGroup = CreateNewMouldGroup(pOp);
01842     if (pMouldGroup==NULL)
01843         return NULL;
01844 
01845     if (pOp!=NULL)
01846     {
01847         // Now stick the mould group inside the mould parent, but dont alter the selection
01848         CALL_WITH_FAIL(pOp->DoInsertNewNode(pMouldGroup, this, LASTCHILD, FALSE, FALSE, FALSE, FALSE), pOp, ok);    
01849     }
01850     else
01851     {
01852         // all right then, insert it in a none undoable way
01853         pMouldGroup->AttachNode(this, LASTCHILD); 
01854         pMouldGroup->SetSelected(FALSE); 
01855         ok = TRUE;
01856     }
01857 
01858     // if failed get rid of what we have
01859     if (!ok)
01860     {
01861         delete pMouldGroup;
01862         return NULL;
01863     }
01864 
01865     return pMouldGroup;
01866 }

NodeMouldPath * NodeMould::AddNewMouldShape Path pShape,
DocRect *const   pDestin,
UndoableOperation pOp
 

Creates a node mould path object using the path pointer given and the destination rectangle described. The object is inserted as the first child of this node mould object and its pointer is returned.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/12/94
Parameters:
pPath = pointer to a path to use as a shape [INPUTS] pDestin = a rectangular area to place the shape over. If this is NULL the path is used as is. pOp = A pointer to an active operation (can be null)
Returns:
a pointer to the created node mould path (inserted into the tree) NULL if unable to create the node
See also:
-

Definition at line 1749 of file nodemold.cpp.

01752 {
01753     ERROR2IF(pShape==NULL, NULL, "NodeMould::AddNewMouldShape() called with a null path");
01754 
01755     NodeMouldPath* pNodeMPath = CreateNewMouldShape(pShape, pDestin, pOp);
01756     if (pNodeMPath==NULL)
01757         return NULL;
01758 
01759     NodeMouldGroup* pGroup = FindMouldGroup(FALSE);
01760     NodeMoulder* pMoulder = FindFirstMoulder(FALSE);
01761 
01762     Node* pContext = this;
01763     AttachNodeDirection Dir = LASTCHILD;
01764 
01765     if (pMoulder!=NULL)
01766     {
01767         pContext = pMoulder;
01768         Dir = PREV;
01769     }
01770 
01771     if (pGroup!=NULL)
01772     {
01773         pContext = pGroup;
01774         Dir = PREV;
01775     }
01776 
01777     BOOL ok = TRUE;
01778 
01779     if (pOp!=NULL)
01780         ok = pOp->DoInsertNewNode(pNodeMPath, pContext, Dir, FALSE, FALSE, FALSE, FALSE);
01781     else
01782     {
01783         pNodeMPath->AttachNode(pContext, Dir); 
01784         pNodeMPath->SetSelected(FALSE); 
01785     }
01786     
01787     if (!ok)
01788     {
01789         delete pNodeMPath;
01790         return NULL;
01791     }
01792 
01793     return pNodeMPath;
01794 }

virtual BOOL NodeMould::AllowSelectInside  )  const [inline, virtual]
 

Reimplemented from Node.

Definition at line 211 of file nodemold.h.

00211 { return FALSE; }

BOOL NodeMould::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:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/12/94
Parameters:
InkClass,: The class of object [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 NodeCompound.

Definition at line 809 of file nodemold.cpp.

00810 {
00811     // The NodeMoulder can become a NodePath
00812     if (pBecomeA->BAPath())
00813     {
00814         if (pBecomeA->IsCounting())
00815         {
00816             // We need to count how many paths it will create
00817             // We do this by adding the values received by each child NodeMoulder
00818             NodeMoulder* pNodeMoulder = FindFirstMoulder();
00819             while (pNodeMoulder != NULL)
00820             {
00821                 pNodeMoulder->CanBecomeA(pBecomeA);             // Increments count
00822 
00823                 pNodeMoulder = FindNextMoulder(pNodeMoulder);
00824             }
00825         }
00826 
00827         return TRUE;
00828     }
00829 
00830     return FALSE;
00831 }

NodeMould::CC_DECLARE_DYNAMIC NodeMould   )  [private]
 

ChangeCode NodeMould::ConvertCode ActionCode  Act  )  [private]
 

Convert a action code to a change code.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/01/95
Parameters:
Action code [INPUTS]
Returns:
Change code

Definition at line 2254 of file nodemold.cpp.

02255 {
02256     switch (Act)
02257     {
02258         case AC_FAIL:       return CC_FAIL;
02259         case AC_NORECORD:   return CC_NORECORD;
02260         case AC_OK:         return CC_OK;
02261     }
02262     return CC_OK;
02263 }

void NodeMould::CopyNodeContents NodeMould pCopyOfNode  )  [private]
 

Copies the data from this node to pCopyOfNode by first calling the base class to get it to copy its stuff, and then copying its own stuff Scope: protected.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/12/94
Parameters:
pCopyOfNode - The node to copy data to [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
NodeGroup::CopyNodeContents

Definition at line 472 of file nodemold.cpp.

00473 {
00474     ERROR3IF(pCopyOfNode==NULL,"NodeMould::CopyNodeContents() was asked to copy into a NULL pointer");
00475     NodeGroup::CopyNodeContents(pCopyOfNode);
00476 
00477     // Make sure we copy all our personal data here
00478     pCopyOfNode->DetachedGeometry = DetachedGeometry;
00479 
00480     // Need to copy the shape and adjust our pointer.
00481     MouldGeometry* pNewGeom = (MouldGeometry*) pMouldGeometry->MakeCopy();
00482 
00483     // if the shape is NULL ie we couldn't build it what do we do?
00484     if (pNewGeom)
00485         pCopyOfNode->pMouldGeometry = pNewGeom;
00486 
00487 }

INT32 NodeMould::CountMoulders  ) 
 

Count the number of moulder objects which have been created within this mould. This does not include hidden moulder objects of course.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/03/95
Parameters:
[INPUTS] 
Returns:
The number of moulder objects within this mould

Definition at line 1452 of file nodemold.cpp.

01453 {
01454     INT32 Count=0;
01455     Node* pNode = FindFirstChild();
01456     ERROR2IF(pNode == NULL,0, "No children found in MouldObject during NodeMould::CountMoulders()");
01457     while (pNode!=NULL)
01458     {
01459         // check for the right class
01460         if (pNode->GetRuntimeClass() == CC_RUNTIME_CLASS(NodeMoulder))
01461             Count+=1;
01462 
01463         pNode=pNode->FindNext();
01464     }
01465     return Count;
01466 }

BOOL NodeMould::CreateAllMoulderObjects UndoableOperation pOp  ) 
 

Scan through the children of a mould object, getting all NodeMoulders to regenerate their moulded objects.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/12/94
Parameters:
pOp = pointer to an operation (can be null) [INPUTS]
Returns:
TRUE if all moulder objects have rebuilt themselves FALSE if one failed.

Definition at line 1529 of file nodemold.cpp.

01530 {
01531     // Scan inside the mould object for the first moulder
01532     NodeMoulder* pMoulder = FindFirstMoulder();
01533     if (!pMoulder)
01534         // there's no moulder object inside this mould so we still can't do anything.
01535         return FALSE;
01536 
01537     // first find the mould group 
01538     NodeMouldGroup* pMouldGroup = FindMouldGroup();
01539     if (!pMouldGroup) 
01540         // there's no mould group inside this mould so we still can't do anything.
01541         return FALSE;
01542 
01543     while (pMoulder)
01544     {
01545         // create moulds for this moulder
01546         if (!pMoulder->CreateMouldedObjects(pMouldGroup, pMouldGeometry, pOp))
01547             return FALSE;
01548         // skip to the next moulder object
01549         pMoulder = (NodeMoulder*) pMoulder->FindNext(CC_RUNTIME_CLASS(NodeMoulder));
01550     }
01551     return TRUE;
01552 }

BOOL NodeMould::CreateAttrSetFromChildren AttrTypeSet AttSet  ) 
 

Builds a set of AttrTypeSet set of attributes from the children of a node.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/06/95
Parameters:
- [INPUTS]
AttSet = a set of attributes which are children of the compound node [OUTPUTS]
Returns:
TRUE - if the set was built correctly FALSE - if not

Definition at line 1094 of file nodemold.cpp.

01095 {
01096     Node* qNode = FindFirstChild();
01097     while (qNode && qNode->IsAnAttribute())
01098     {
01099         if (!AttSet.AddToSet(((NodeAttribute*)qNode)->GetAttributeType()))
01100             return FALSE;
01101         qNode=qNode->FindNext();
01102     }
01103     return TRUE;
01104 }

BOOL NodeMould::CreateGeometry MouldSpace  mSpace  ) 
 

Changes the mould space used by this mould to that described by mSpace. Currently the defined spaces are MOULDSPACE_ENVELOPE MOULDSPACE_PERSPECTIVE.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/12/94
Parameters:
mSpace = the type of mould to create. Currently use Envelope or Perspective [INPUTS] enum values. It can also be NULL if you wish to use the shape as is.
Returns:
TRUE if the geometry has been created successfully. FALSE then unable to create the geometry object (out of memory)

Definition at line 322 of file nodemold.cpp.

00323 {
00324     // now build the new vector space polymorphically
00325     MouldGeometry* pNewGeom=NULL;
00326 
00327     switch (mSpace)
00328     {
00329         case MOULDSPACE_ENVELOPE:
00330         {
00331             MouldEnvelope* mNewSpace = new MouldEnvelope;
00332             if (!mNewSpace)
00333                 return FALSE;
00334             if (!mNewSpace->Initialise())
00335             {
00336                 delete mNewSpace;
00337                 return FALSE;
00338             }
00339             pNewGeom = mNewSpace;
00340             break;
00341         }
00342 
00343         case MOULDSPACE_ENVELOPE2X2:
00344         {
00345             MouldEnvelope2x2* mNewSpace = new MouldEnvelope2x2;
00346             if (!mNewSpace)
00347                 return FALSE;
00348             if (!mNewSpace->Initialise())
00349             {
00350                 delete mNewSpace;
00351                 return FALSE;
00352             }
00353             pNewGeom = mNewSpace;
00354             break;
00355         }
00356 
00357         case MOULDSPACE_PERSPECTIVE:
00358         {
00359             MouldPerspective* mNewSpace = new MouldPerspective;
00360             if (!mNewSpace)
00361                 return FALSE;
00362             pNewGeom = mNewSpace;
00363             break;
00364         }
00365         default: break;
00366     }
00367 
00368     if (!pNewGeom)
00369         return FALSE;
00370 
00371     // Assign the class geometry pointer the new shape
00372     // Note, we do not record the mouldspace in our class because
00373     // we dont really need to. The shape is an abstract class with
00374     // concrete geometries derived from it and hence we can call a shape
00375     // function and the run time binder will call the correct class func.
00376 
00377     pMouldGeometry = pNewGeom;
00378     return TRUE;
00379 }

NodeMoulder * NodeMould::CreateNewMoulder UndoableOperation pOp  ) 
 

Creates a NodeMoulder object and returns a pointer to it.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/12/94
Parameters:
pOp = A pointer to an active operation (can be null) [INPUTS]
Returns:
a pointer to the moulder object (not in the tree). NULL if failed to create this moulder.
See also:
-

Definition at line 1570 of file nodemold.cpp.

01571 {
01572     BOOL ok;
01573 
01574     // first find the mould group 
01575     NodeMouldGroup* pMouldGroup = FindMouldGroup();
01576     if (!pMouldGroup) return NULL;
01577 
01578     // Now create a moulder object
01579     NodeMoulder* pMoulder;
01580     ALLOC_WITH_FAIL( pMoulder, new NodeMoulder, pOp);
01581     if (!pMoulder) return NULL;
01582 
01583     // get the moulder to initialise itself
01584     CALL_WITH_FAIL(pMoulder->Initialise(pMouldGroup), pOp, ok);
01585     if (!ok)
01586     {
01587         delete pMoulder;
01588         return NULL;
01589     }
01590 
01591     // its built so lets return it
01592     return pMoulder;
01593 }

NodeMouldGroup * NodeMould::CreateNewMouldGroup UndoableOperation pOp  ) 
 

Creates a MouldGroup object and returns a pointer to it.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/12/94
Parameters:
pOp = A pointer to an active operation (can be null) [INPUTS]
Returns:
a pointer to the created mould group (not in the tree) NULL if unable to create the node
See also:
-

Definition at line 1811 of file nodemold.cpp.

01812 {
01813     // Create a mould group object
01814     NodeMouldGroup* pMouldGroup;
01815     ALLOC_WITH_FAIL( pMouldGroup, new NodeMouldGroup, pOp);
01816     return pMouldGroup;
01817 }

NodeMouldPath * NodeMould::CreateNewMouldShape Path pShape,
DocRect *const   pDestin,
UndoableOperation pOp
 

Creates a node mould path object using the path pointer given and the destination rectangle described. The objects pointer is returned.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
19/12/94
Parameters:
pPath = pointer to a path to use as a shape [INPUTS] pDestin = a rectangular area to place the shape over. If this is NULL the path is used as is. pOp = A pointer to an active operation (can be null)
Returns:
a pointer to the created node mould path (not in the tree) NULL if unable to create the node
See also:
-

Definition at line 1673 of file nodemold.cpp.

01676 {
01677     ERROR2IF(pShape==NULL, NULL, "NodeMould::CreateNewMouldShape() called with a null path");
01678 
01679     // Note, we do not record the mouldspace in our class because
01680     // we dont really need to. The shape is an abstract class with
01681     // concrete geometries derived from it and hence we can call a shape
01682     // function and the run time binder will call the correct class func.
01683 
01684     BOOL ok;
01685 
01686     // build the new vector space polymorphically
01687     NodeMouldPath* pNodeMPath;
01688     ALLOC_WITH_FAIL( pNodeMPath, new NodeMouldPath, pOp);
01689     if (!pNodeMPath)
01690         return NULL;
01691 
01692     Path* pPath = (&(pNodeMPath->InkPath));
01693 
01694     CALL_WITH_FAIL(pPath->Initialise(pShape->GetNumCoords(), 12), pOp, ok);
01695     if (!ok)
01696     {
01697         delete pNodeMPath;
01698         return NULL;
01699     }
01700 
01701     CALL_WITH_FAIL(pPath->CopyPathDataFrom(pShape), pOp, ok);
01702     if (!ok)
01703     {
01704         delete pNodeMPath;
01705         return NULL;
01706     }
01707 
01708     // make sure our path has no fill bit
01709     pPath->IsFilled=FALSE;
01710 
01711     if (pDestin)
01712     {
01713         // we have been given a destination rectangle to map the path shape onto,
01714         // so first we need the source bbox
01715         DocRect Source = pPath->GetBoundingRect();
01716 
01717         // Build a transform matrix and apply it to this mould
01718         Matrix Mat(Source,*pDestin);
01719         Trans2DMatrix Trans(Mat);
01720         Trans.Transform( (DocCoord*)pPath->GetCoordArray(), pPath->GetNumCoords() );
01721     }
01722 
01723     return pNodeMPath;
01724 }

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

To return a description of the Mould object in either the singular or the plural. This method is called by the DescribeRange method.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/12/94
Parameters:
Plural,: Flag indicating if the string description should be plural or [INPUTS] singular.
- [OUTPUTS] Retuns: Description of the mould node
The description will always begin with a lower case letter.

Reimplemented from NodeGroup.

Definition at line 418 of file nodemold.cpp.

00419 {     
00420     if (Plural)
00421         return(String(_R(IDS_MOULD_DESCRP)));  
00422     else
00423         return(String(_R(IDS_MOULD_DESCRS))); 
00424 }; 

MouldSpace NodeMould::DescribeGeometry  ) 
 

Find out what type of geometry is defined for this mould object.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/12/94
Parameters:
[INPUTS] 
Returns:
The current mould space defined for this mould object. ie what type of mould geometry it uses, eg envelope, perspective etc.

Definition at line 1303 of file nodemold.cpp.

01304 {
01305     if (pMouldGeometry)
01306         return pMouldGeometry->Describe();
01307 
01308     return MOULDSPACE_UNDEFINED;
01309 }

void NodeMould::DisableBlobs  )  [inline]
 

Definition at line 259 of file nodemold.h.

00259 { RenderBlobs=FALSE;    }

BOOL NodeMould::DoBecomeA BecomeA pBecomeA  )  [virtual]
 

Transforms the object into another type of object. This converts all its children, and replaces itself in the tree with a NodeGroup.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/12/94
Parameters:
pBecomeA = ptr to a class that contains all the info needed to become a new [INPUTS] type of node.
- [OUTPUTS]
Returns:
TRUE if the object has been transformed, FALSE if we run out of memory

Errors: -

See also:
Node::CanBecomeA

Reimplemented from NodeCompound.

Definition at line 853 of file nodemold.cpp.

00854 {
00855     BOOL ok;
00856 
00857     switch (pBecomeA->GetReason())
00858     {
00859         case BECOMEA_REPLACE:
00860         {
00861 //          ERROR2IF(pBecomeA->GetUndoOp() == NULL,FALSE,"Trying to replace a NodeMould, but pUndoOp == NULL");
00862             UndoableOperation* pUndoOp = pBecomeA->GetUndoOp();
00863 
00864             // If replacing the mould with shapes, hide the mould, create a group, and move all the children
00865             // so they become children of the new group node
00866 
00867             NodeMoulder* pMoulder = FindFirstMoulder();
00868             if (pMoulder!=NULL)
00869             {
00870                 BOOL IsSelected = this->IsSelected();
00871                 SetSelected(FALSE);
00872 
00873                 // Localise only the current children so undo factors out only these
00874                 AttrTypeSet AttrTypes;
00875                 if (!CreateAttrSetFromChildren(AttrTypes))
00876                     return FALSE;
00877 
00878                 // localise common child attributes before moving objects!
00879                 if (pUndoOp)
00880                 {
00881                     if (!pUndoOp->DoLocaliseCommonAttributes(this, FALSE, FALSE, &AttrTypes))
00882                         return FALSE;
00883 
00884                     if (!pUndoOp->DoLocaliseCommonAttributes(pMoulder))
00885                         return FALSE;
00886                 }
00887                 else
00888                 {
00889                     if (!LocaliseCommonAttributes(FALSE, FALSE, &AttrTypes))
00890                         return FALSE;
00891 
00892                     if (!pMoulder->LocaliseCommonAttributes())
00893                         return FALSE;
00894                 }
00895 
00896                 // Pass on this message to our child ink nodes first
00897                 Node* pNode = pMoulder->FindFirstChild();
00898                 while (pNode != NULL)
00899                 {
00900                     Node* pThisNode = pNode;
00901                     pNode = pNode->FindNext();
00902                     pThisNode->DoBecomeA(pBecomeA);
00903                 }
00904 
00905                 // Allocate a new NodeGroup node
00906                 NodeGroup* pNodeGroup;
00907                 ALLOC_WITH_FAIL(pNodeGroup, (new NodeGroup), pUndoOp); 
00908                 if (pNodeGroup == NULL)
00909                     return FALSE;
00910 
00911                 // Insert the NodeGroup next to the NodeMould 
00912                 if (pUndoOp)
00913                 {
00914                     if (!pUndoOp->DoInsertNewNode(pNodeGroup,this,NEXT,FALSE,FALSE,FALSE,FALSE))
00915                         return FALSE;
00916 
00917                     // if we were selected the lets select our group
00918                     if (IsSelected)
00919                     {
00920                         // Select the group
00921                         if (!pUndoOp->DoSelectNode(pNodeGroup,FALSE))
00922                             return FALSE;
00923                     }
00924                 }
00925                 else
00926                 {
00927                     pNodeGroup->AttachNode(this,NEXT);
00928                 }
00929 
00930                 // Now move each node in turn.
00931                 pNode = pMoulder->FindLastChild();
00932                 while (pNode != NULL)
00933                 {                                                          
00934                     // Find the next node to move before we shift up the children
00935                     Node* pPrevNode = pNode->FindPrevious(); 
00936                     if (pNode->IsAnObject())
00937                     {
00938                         if (pUndoOp)
00939                         {
00940                             CALL_WITH_FAIL(pUndoOp->DoMoveNode(pNode, pNodeGroup, FIRSTCHILD), pUndoOp, ok);
00941                             if (!ok)
00942                                 return FALSE;
00943                         }
00944                         else
00945                         {
00946                             pNode->MoveNode(pNodeGroup, FIRSTCHILD);
00947                         }
00948                     }
00949                     pNode = pPrevNode;  
00950                 }
00951 
00952                 // Karim 15/05/2000 - this new loop copies non-optimising attrs applied to
00953                 // the NodeMould object, into the new group. Note that although CopyNode()
00954                 // is NOT undoable, things should be fine as the insertion of the group *was*.
00955                 pNode = FindLastChild();
00956                 while (pNode != NULL)
00957                 {
00958                     Node* pPrevNode = pNode->FindPrevious();
00959                     if (    pNode->IsAnAttribute() &&
00960                             !((NodeAttribute*)pNode)->ShouldBeOptimized() )
00961                     {
00962                         CALL_WITH_FAI