NodeRenderablePaper Class Reference

This abstract class describes a renderable paper node. A property of paper nodes is that they need to be rendered before their children. More...

#include <npaper.h>

Inheritance diagram for NodeRenderablePaper:

NodeRenderableBounded NodeRenderable Node CCObject SimpleCCObject Chapter Layer NodeDocument NodeGrid Page Spread NodeGridIso NodeGridRect List of all members.

Public Member Functions

 NodeRenderablePaper ()
 This constructor creates a NodeRenderablePaper linked to no other with all status flags false and uninitialised bounding and pasteboard rectangles.
 NodeRenderablePaper (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.
virtual SubtreeRenderState RenderSubtree (RenderRegion *pRender, Node **ppNextNode=NULL, BOOL bClip=TRUE)
 Indicate that we don't want to render paper objects in the ink loop.
virtual BOOL NeedsToExport (RenderRegion *pRender, BOOL VisibleLayersOnly=FALSE, BOOL CheckSelected=FALSE)
 Indicate that we don't want to export this class of nodes.
BOOL IsPaper () const
 Indicate that we ARE paper! (Overrides virtual func in Node.).
virtual DocRect GetPasteboardRect (BOOL Pixelise=TRUE, View *pView=NULL) const
 For obtaining the objects pasteboard rectangle.
virtual void GetDebugDetails (StringBase *Str)
 For obtaining debug information about the Node.
virtual void PolyCopyNodeContents (NodeRenderable *pNodeCopy)
 Polymorphically copies the contents of this node to another.

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.
void CopyNodeContents (NodeRenderablePaper *NodeCopy)
 This method copies the node's contents to the node pointed to by NodeCopy.
virtual void ChangePasteboardRect (const DocRect &PasteRect)
 To change the pasteboard rectangle of this node, and then if necessary recursively change the pasteboard rectangles of all its parents.
virtual void SetInitialPasteboardRect (const DocRect &PasteRect)
 To set the initial pasteboard rectangle of this node, and then change the pasteboard rectangles of all its parents.

Protected Attributes

DocRect PasteboardRect

Detailed Description

This abstract class describes a renderable paper node. A property of paper nodes is that they need to be rendered before their children.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> Date: 19/5/93 Base Classes: NodeRenderable, Node, CCObject
See the Node class for an important note about producing derived classes of Node.

See also:
NodeRenderable

Definition at line 125 of file npaper.h.


Constructor & Destructor Documentation

NodeRenderablePaper::NodeRenderablePaper  ) 
 

This constructor creates a NodeRenderablePaper linked to no other with all status flags false and uninitialised bounding and pasteboard rectangles.

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

Errors:

Definition at line 133 of file npaper.cpp.

00133                                         : NodeRenderableBounded()
00134 {
00135 } 

NodeRenderablePaper::NodeRenderablePaper 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:
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 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 183 of file npaper.cpp.

00189                :NodeRenderableBounded(ContextNode, Direction, Locked, Mangled, Marked, 
00190                 Selected) 
00191 { 
00192 } 


Member Function Documentation

void NodeRenderablePaper::ChangePasteboardRect const DocRect PasteRect  )  [protected, virtual]
 

To change the pasteboard rectangle of this node, and then if necessary recursively change the pasteboard rectangles of all its parents.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/4/93
Parameters:
PasteRect,: Rectangle representing the outer limits of the pasteboard [INPUTS]
- [OUTPUTS]
Returns:
-
The method also changes the document extents in the NodeDocument node at the root of the tree.

Returns:
Errors: An assertion failure will occur if the parent of a paper object is not a paper object or the root of the tree is not a NodeDocument
Scope: protected

See also:
NodeRenderablePaper::SetInitialPasteboardRect

Definition at line 368 of file npaper.cpp.

00369 {   
00370     // Check if the pasteboard rectangle should be changed
00371     if (PasteboardRect != PasteRect)
00372     {
00373         PasteboardRect = PasteRect;  // Set the pasteboard rectangle     
00374                            
00375         // If the node has a parent then we will need to change its    
00376         // Pasteboard rectangle
00377         if (Parent != NULL)   
00378         {
00379             // CombinedSiblingPasteboardRectangle will be the smallest rectangle which 
00380             // surrounds all sibling pasteboard rectangles.  
00381             DocRect CombinedSiblingPasteboardRectangle; 
00382         
00383             // Take the union of this nodes Pasteboard rectangle with all its siblings 
00384             // pasteboard rectangles. 
00385             Node* CurrentNode = this->FindParent()->FindFirstChild(); 
00386             while (CurrentNode != NULL)
00387             {       
00388                 if (CurrentNode->IsKindOf(CC_RUNTIME_CLASS(NodeRenderablePaper)))   
00389                 {
00390                     CombinedSiblingPasteboardRectangle = CombinedSiblingPasteboardRectangle.Union(
00391                         ( ((NodeRenderablePaper*)CurrentNode)->GetPasteboardRect(FALSE)) ); 
00392                 }           
00393                 CurrentNode = CurrentNode->FindNext();      
00394             }       
00395                                       
00396             // The parent of a paper object should always be a paper object
00397             ENSURE(Parent->IsKindOf(CC_RUNTIME_CLASS(NodeRenderablePaper)), 
00398                    "The parent of a paper object was not a paper object"); 
00399             
00400             // Call the routine recursively to set the parents pasteboard rectangle  
00401             ((NodeRenderablePaper*)Parent)->ChangePasteboardRect(
00402                 CombinedSiblingPasteboardRectangle);  
00403         }       
00404         else
00405         {
00406             // The root of the tree should be a NodeDocument
00407             ENSURE(this->IsKindOf(CC_RUNTIME_CLASS(NodeDocument)),
00408                    "When trying to set the document extents no\nNodeDocument node was found at the root of the tree");
00409             // Set the document extents
00410             ((NodeDocument*)this)->SetExtents(); 
00411         }
00412     }   
00413 }         

void NodeRenderablePaper::CopyNodeContents NodeRenderablePaper NodeCopy  )  [protected]
 

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

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/4/93
Parameters:
- [INPUTS]
A copy of this node [OUTPUTS]
Returns:
-

Errors: An assertion failure will occur if NodeCopy is NULL

Scope: protected

Definition at line 311 of file npaper.cpp.

00312 {                         
00313     ENSURE(NodeCopy != NULL,"Trying to copy a node's contents into a NULL node");  
00314     NodeRenderableBounded::CopyNodeContents(NodeCopy); 
00315     NodeCopy->PasteboardRect = PasteboardRect;         
00316 }       

void NodeRenderablePaper::GetDebugDetails StringBase Str  )  [virtual]
 

For obtaining debug information about the Node.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/9/93
Parameters:
- [INPUTS]
Str,: String giving debug info about the node [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from NodeRenderableBounded.

Reimplemented in Chapter, NodeGrid, NodeGridRect, NodeGridIso, Layer, NodeDocument, Page, and Spread.

Definition at line 541 of file npaper.cpp.

00542 {
00543 #ifdef _DEBUG
00544     NodeRenderableBounded::GetDebugDetails(Str);  
00545     
00546     String_256 TempStr; 
00547     if (!PasteboardRect.IsValid())
00548     { 
00549         TempStr = TEXT("\r\nPasteboard Rectangle = *INVALID*\r\n"); 
00550     }
00551     else 
00552         TempStr._MakeMsg(TEXT("\r\nPasteboard Rectangle\r\n   Low(#1%ld, #2%ld)\r\n   High(#3%ld, #4%ld)\r\n"),    
00553                     PasteboardRect.LowCorner().x,  
00554                     PasteboardRect.LowCorner().y,
00555                     PasteboardRect.HighCorner().x,  
00556                     PasteboardRect.HighCorner().y);      
00557                     
00558     (*Str)+=TempStr; 
00559 #endif
00560 }    

DocRect NodeRenderablePaper::GetPasteboardRect BOOL  Pixelise = TRUE,
View pView = NULL
const [virtual]
 

For obtaining the objects pasteboard rectangle.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/5/93
Parameters:
Pixelise - whether or not to pixelise the pasteboard rectangle before [INPUTS] returning it. pView - the view to pixelise to (not used if Pixelise is FALSE).
The objects pasteboard rectangle [OUTPUTS]
Returns:
-

Errors:

Reimplemented in Layer.

Definition at line 497 of file npaper.cpp.

00498 {
00499     DocRect temp = PasteboardRect;
00500 
00501     if (Pixelise)
00502     {
00503         // "Pixelise" the position of the spread.
00504         // Effectively, this ensures that the spread will be aligned to a whole pixel boundary
00505         // and allows both GDraw and GDI to consistently plot the same pixels when rendering
00506         // the same primitive
00507         if (pView != NULL)
00508         {
00509             temp.lo.Pixelise(pView);
00510             temp.hi.Pixelise(pView);
00511         }
00512         else
00513         {
00514             temp.lo.Pixelise();
00515             temp.hi.Pixelise();
00516         }
00517     }
00518 
00519     return (temp); 
00520 
00521 //  return (PasteboardRect); 
00522 }       

BOOL NodeRenderablePaper::IsPaper  )  const [virtual]
 

Indicate that we ARE paper! (Overrides virtual func in Node.).

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/11/94
Returns:
TRUE => we are a paper node.
See also:
Node::IsPaper

Reimplemented from Node.

Definition at line 231 of file npaper.cpp.

00232 {
00233     return TRUE;
00234 }

BOOL NodeRenderablePaper::NeedsToExport RenderRegion pRender,
BOOL  VisibleLayersOnly = FALSE,
BOOL  CheckSelected = FALSE
[virtual]
 

Indicate that we don't want to export this class of nodes.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/03/94
Parameters:
pRender - A pointer to the current export region (null if none) [INPUTS] VisibleLayersOnly - TRUE => remove nodes which are on invisible layers
  • FALSE => export everything CheckSelected - TRUE => we check if object selected and only export selected bjects
  • FALSE => we don't bother checking for selection or not
    Returns:
    FALSE => we never want to export NodeRenderablePaper objects.
    See also:
    NodeRenderablePaper::NeedsToRender

Reimplemented from NodeRenderable.

Reimplemented in Layer, and Spread.

Definition at line 257 of file npaper.cpp.

00258 {
00259     return FALSE;
00260 }

void NodeRenderablePaper::PolyCopyNodeContents NodeRenderable pNodeCopy  )  [virtual]
 

Polymorphically copies the contents of this node to another.

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

Reimplemented from NodeRenderableBounded.

Reimplemented in Chapter, NodeGrid, NodeGridRect, NodeGridIso, Layer, NodeDocument, Page, and Spread.

Definition at line 331 of file npaper.cpp.

00332 {
00333     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
00334     ENSURE(IS_A(pNodeCopy, NodeRenderablePaper), "PolyCopyNodeContents given wrong dest node type");
00335 
00336     if (IS_A(pNodeCopy, NodeRenderablePaper))
00337         CopyNodeContents((NodeRenderablePaper*)pNodeCopy);
00338 }

SubtreeRenderState NodeRenderablePaper::RenderSubtree RenderRegion pRender,
Node **  ppNextNode = NULL,
BOOL  bClip = TRUE
[virtual]
 

Indicate that we don't want to render paper objects in the ink loop.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/05/94
Parameters:
pRender - the render region in question (NULL if none) [INPUTS]
Returns:
FALSE => we never want to render paper objects while rendering ink objects.
See also:
NodeRenderablePaper::NeedsToExport

Reimplemented from NodeRenderableBounded.

Reimplemented in NodeGrid, Layer, and Spread.

Definition at line 208 of file npaper.cpp.

00209 {
00210     if (pRender && pRender->RenderPaperAsInk())
00211         return SUBTREE_ROOTANDCHILDREN;
00212 
00213     return SUBTREE_NORENDER;
00214 }

void NodeRenderablePaper::SetInitialPasteboardRect const DocRect PasteRect  )  [protected, virtual]
 

To set the initial pasteboard rectangle of this node, and then change the pasteboard rectangles of all its parents.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/4/93
Parameters:
PasteRect,: Rectangle representing the outer limits of the pasteboard [INPUTS]
- [OUTPUTS]
Returns:
-
The method also changes the document extents in the NodeDocument node at the root of the tree.

Returns:
Errors: An assertion failure will occur if the parent of a paper object is not a paper object or the root of the tree is not a NodeDocument.
Scope: protected

See also:
NodeRenderablePaper::ChangePasteboardRectangle

Reimplemented in Spread.

Definition at line 442 of file npaper.cpp.

00443 {    
00444     // Check if the pasteboard rectangle should be changed
00445     if (PasteboardRect != PasteRect)
00446     {
00447         PasteboardRect = PasteRect;  // Set the pasteboard rectangle     
00448                            
00449         // If the node has a parent then we will need to change its    
00450         // Pasteboard rectangle
00451         if (Parent != NULL)   
00452         {
00453             // The parent of a paper object should always be a paper object
00454             ENSURE(Parent->IsKindOf(CC_RUNTIME_CLASS(NodeRenderablePaper)),
00455                    "The parent of a paper object was not a paper object!");   
00456               
00457             // Union the parents pasteboard rectangle with this nodes pasteboard
00458             // rectangle to obtain the parents new pasteboard rectangle.   
00459             DocRect NewParentPasteboardRectangle = 
00460                 ((NodeRenderablePaper*)Parent)->GetPasteboardRect(FALSE); 
00461             NewParentPasteboardRectangle = NewParentPasteboardRectangle.Union(PasteRect);     
00462                 
00463             // Call the routine recursively to set the parent's pasteboard rectangle     
00464             ((NodeRenderablePaper*)Parent)->SetInitialPasteboardRect
00465                 (NewParentPasteboardRectangle);   
00466         }   
00467         else
00468         {
00469             // The root of the tree should be a NodeDocument
00470             ENSURE(this->IsKindOf(CC_RUNTIME_CLASS(NodeDocument)), 
00471                    "The root of the document tree was not a NodeDocument node");    
00472             // Set the document extents
00473             ((NodeDocument*)this)->SetExtents(); 
00474         }
00475     }   
00476 }                          

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

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.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/4/93
Parameters:
[INPUTS] 
[OUTPUTS] 
Returns:
A copy of the node or NULL if memory runs out

Errors: If memory runs out when trying to copy, then ERROR is called with an out of memory error and the function returns NULL.

Reimplemented from NodeRenderableBounded.

Reimplemented in Chapter, NodeGrid, NodeGridRect, NodeGridIso, Layer, NodeDocument, Page, and Spread.

Definition at line 282 of file npaper.cpp.

00283 {
00284     NodeRenderablePaper* NodeCopy; 
00285     NodeCopy = new NodeRenderablePaper();
00286     ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 
00287     CopyNodeContents(NodeCopy);   
00288     return (NodeCopy);
00289 }               


Member Data Documentation

DocRect NodeRenderablePaper::PasteboardRect [protected]
 

Definition at line 157 of file npaper.h.


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