Chapter Class Reference

Chapters group together pages which are automatically created from the same master page. More...

#include <chapter.h>

Inheritance diagram for Chapter:

NodeRenderablePaper NodeRenderableBounded NodeRenderable Node CCObject SimpleCCObject List of all members.

Public Member Functions

 Chapter ()
 This constructor creates a Chapter linked to no other nodes, with all status flags false, and NULL bounding and pasteboard rectangles.
 Chapter (Node *ContextNode, AttachNodeDirection Direction, MILLIPOINT FldLineXCoord=1000, 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 neccesary tree links are updated.
String Describe (BOOL Plural, BOOL Verbose)
 To return a description of the Node object in either the singular or the plural. This method is called by the DescribeRange method.
virtual BOOL IsChapter () const
 For finding if a node is a chapter node.
ChapterFindPreviousChapter (void)
 For finding the previous sibling chapter.
SpreadFindFirstSpread ()
 Returns the first spread which is an immediate child of the chapter.
XLONG GetChapterDepth ()
 Find the depth of a chapter in logical coords. i.e. how far from the top of the document the top of the chapter's pasteboard is.
void Render (RenderRegion *pRender)
void SetFoldLineXCoord (MILLIPOINT value, BOOL DisplayFoldLine=TRUE)
 For setting the X coordinate of the chapters fold line, and enabling/disabling the display of the fold line (for single page spreads the fold line is disabled).
MILLIPOINT GetFoldLineXCoord () const
 For finding the X coordinate of the chapters fold line.
BOOL ShouldShowFoldLine (void) const
 To determine if the chapter fold line is intended to be displayed.
virtual UINT32 GetNodeSize () const
 For finding the size of the node.
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.
virtual BOOL WritePreChildrenWeb (BaseCamelotFilter *pFilter)
 Web files don't write out a chapter records.
virtual BOOL WritePreChildrenNative (BaseCamelotFilter *pFilter)
 Writes out a chapter record.
virtual BOOL WriteBeginChildRecordsWeb (BaseCamelotFilter *pFilter)
 Begins the child record sequence for chapter 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)
 Ends the child record sequence for chapter in the web format.
virtual BOOL WriteEndChildRecordsNative (BaseCamelotFilter *pFilter)
 Finished writing out you child records, in the native format.

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 (Chapter *NodeCopy)
 This method copies the node's contents to the node pointed to by NodeCopy.

Protected Attributes

MILLIPOINT FoldLineXCoord
BOOL ShowFoldLine

Detailed Description

Chapters group together pages which are automatically created from the same master page.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/4/93
See also:
NodeRenderablePaper

Spread

Page

Layer

Definition at line 127 of file chapter.h.


Constructor & Destructor Documentation

Chapter::Chapter  ) 
 

This constructor creates a Chapter linked to no other nodes, with all status flags false, and NULL 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 136 of file chapter.cpp.

00136                 : NodeRenderablePaper()
00137 {   
00138     FoldLineXCoord = 0;
00139     ShowFoldLine = FALSE;
00140 }

Chapter::Chapter Node ContextNode,
AttachNodeDirection  Direction,
MILLIPOINT  FldLineXCoord = 1000,
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 neccesary 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

FldLineXCoord: X Coordinate of the main fold line for the spreads in the chapter

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 192 of file chapter.cpp.

00199                     : NodeRenderablePaper(ContextNode, Direction, Locked, Mangled, 
00200                                     Marked, Selected)
00201 {
00202     FoldLineXCoord = FldLineXCoord;    
00203     ShowFoldLine = TRUE;
00204 }   


Member Function Documentation

void Chapter::CopyNodeContents Chapter 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 454 of file chapter.cpp.

00455 {                         
00456     ENSURE(NodeCopy != NULL,"Trying to copy node contents to\na node pointed to by a NULL pointer"); 
00457     NodeRenderablePaper::CopyNodeContents(NodeCopy); 
00458     NodeCopy->FoldLineXCoord = FoldLineXCoord; 
00459 }              

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

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

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/6/93
Parameters:
Plural,: Flag indicating if the string description should be plural or [INPUTS] singular.
- [OUTPUTS]
Returns:
Description of the object
The description will always begin with a lower case letter.

Returns:
Errors: A resource exception will be thrown if a problem occurs when loading the string resource.
See also:
-

Reimplemented from Node.

Definition at line 234 of file chapter.cpp.

00235 {     
00236     if (Plural)
00237         return(String(_R(IDS_CHAPTER_DESCRP)));  
00238     else
00239         return(String(_R(IDS_CHAPTER_DESCRS))); 
00240 }; 

Spread * Chapter::FindFirstSpread  ) 
 

Returns the first spread which is an immediate child of the chapter.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/8/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Returns the first spread in the chapter (or NULL if there are no spreads)

Errors: -

See also:
-

Definition at line 299 of file chapter.cpp.

00300 {
00301     Node* pNode = FindFirstChild();
00302     while(pNode != 0 && !pNode->IsSpread())
00303         pNode = pNode->FindNext();
00304 
00305     return (Spread*) pNode;
00306 }

Chapter * Chapter::FindPreviousChapter void   ) 
 

For finding the previous sibling chapter.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/5/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The previous sibling chapter or NULL if there are no more chapters

Errors: -

See also:
-

Definition at line 258 of file chapter.cpp.

00259 { 
00260     Node* CurrentNode = FindPrevious(); 
00261     while (CurrentNode != 0)
00262     {
00263         if (CurrentNode->IsChapter())
00264             return (Chapter*) CurrentNode;    
00265         CurrentNode = CurrentNode->FindPrevious(); 
00266     }
00267     return 0; // No chapter found      
00268 }                                              

XLONG Chapter::GetChapterDepth  ) 
 

Find the depth of a chapter in logical coords. i.e. how far from the top of the document the top of the chapter's pasteboard is.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/12/93
Returns:
Depth of the Chapter

Definition at line 475 of file chapter.cpp.

00476 {
00477     XLONG Depth = 0;
00478 
00479     // Loop through document tree calculating the logical coordinate offset for the
00480     // current chapter  
00481 
00482 //  Chapter *pChapter = Node::FindFirstChapter(FindOwnerDoc());
00483     Node* pNode = FindParent();
00484     ERROR2IF(!(pNode->IsNodeDocument()), 0, "Parent of Chapter is not NodeDocument");
00485     Chapter *pChapter = (Chapter*)pNode->FindFirstChild(CC_RUNTIME_CLASS(Chapter));
00486 
00487     ENSURE(pChapter != NULL, "Couldn't find first chapter in Chapter::GetChapterDepth");
00488     
00489     while ((pChapter != NULL) && (pChapter != this))
00490     {       
00491                                                         
00492         ENSURE(pChapter->IsKindOf(CC_RUNTIME_CLASS(Chapter)), 
00493                 "Chapter's sibling is not a Chapter");
00494 
00495         const DocRect ChapRect = pChapter->GetPasteboardRect();
00496             
00497         // Accumulate logical offset
00498         Depth += ChapRect.Height();                     
00499             
00500         pChapter = (Chapter *) pChapter->FindNext();
00501     }
00502 
00503     return Depth;
00504 }

void Chapter::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 NodeRenderablePaper.

Definition at line 534 of file chapter.cpp.

00535 {          
00536     NodeRenderablePaper::GetDebugDetails(Str); 
00537     String_256 TempStr; 
00538     TempStr._MakeMsg(TEXT("\r\nFoldLine X Coord = #1%ld\r\n"), 
00539                      FoldLineXCoord); 
00540     (*Str)+=TempStr;      
00541 }

MILLIPOINT Chapter::GetFoldLineXCoord  )  const
 

For finding the X coordinate of the chapters fold line.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/5/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The value of the X coordinate of the chapters fold line

Errors: -

See also:
-

Definition at line 376 of file chapter.cpp.

00377 {
00378     return (FoldLineXCoord);
00379 }

UINT32 Chapter::GetNodeSize  )  const [virtual]
 

For finding the size of the node.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The size of the node in bytes
See also:
Node::GetSubtreeSize

Reimplemented from Node.

Definition at line 558 of file chapter.cpp.

00559 {     
00560     return (sizeof(Chapter)); 
00561 }  

BOOL Chapter::IsChapter  )  const [virtual]
 

For finding if a node is a chapter node.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/04/95
Returns:
TRUE

Reimplemented from Node.

Definition at line 575 of file chapter.cpp.

00576 { 
00577     return TRUE;
00578 }

void Chapter::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 NodeRenderablePaper.

Definition at line 425 of file chapter.cpp.

00426 {
00427     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
00428     ENSURE(IS_A(pNodeCopy, Chapter), "PolyCopyNodeContents given wrong dest node type");
00429 
00430     if (IS_A(pNodeCopy, Chapter))
00431         CopyNodeContents((Chapter*)pNodeCopy);
00432 }

void Chapter::Render RenderRegion pRender  )  [virtual]
 

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/5/93

Reimplemented from Node.

Definition at line 280 of file chapter.cpp.

00281 {
00282 }   

void Chapter::SetFoldLineXCoord MILLIPOINT  value,
BOOL  DisplayFoldLine = TRUE
 

For setting the X coordinate of the chapters fold line, and enabling/disabling the display of the fold line (for single page spreads the fold line is disabled).

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/5/93
Parameters:
value,: New value for the X coordinate of the chapters fold line [INPUTS] DisplayFoldLine - TRUE if the fold line should be displayed FALSE to disable display of the fold line altogether
Notes: The fold line is rendered in spread.cpp

After setting this value, you'll need to redraw the document appropriately

See also:
Chapter::ShouldShowFoldLine; Chapter::GetFoldLineXCoord

Definition at line 330 of file chapter.cpp.

00331 {
00332     FoldLineXCoord = value;
00333     ShowFoldLine = DisplayFoldLine;
00334 }

BOOL Chapter::ShouldShowFoldLine void   )  const
 

To determine if the chapter fold line is intended to be displayed.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/3/95
Returns:
TRUE if the chapter fold line should be displayed FALSE if the chapter fold line should not be displayed
See also:
Chapter::SetFoldLineXCoord

Definition at line 354 of file chapter.cpp.

00355 {
00356     return(ShowFoldLine);
00357 }

Node * Chapter::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.

Scope: protected

Reimplemented from NodeRenderablePaper.

Definition at line 404 of file chapter.cpp.

00405 {
00406     Chapter* NodeCopy; 
00407     NodeCopy = new Chapter();       
00408     ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 
00409     CopyNodeContents(NodeCopy);   
00410     return (NodeCopy);
00411 }    

BOOL Chapter::WriteBeginChildRecordsNative BaseCamelotFilter pFilter  )  [virtual]
 

Begin to write out you child records, in the native format.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/8/96
Parameters:
pFilter = ptr to filter to write to [INPUTS]
Returns:
TRUE if ok, FALSE otherwise
The base class will write out a TAG_DOWN record, but only if it has a child ptr

See also:
WritePostChildrenWeb(), WritePreChildrenWeb()

Reimplemented from Node.

Definition at line 684 of file chapter.cpp.

00685 {
00686     return Node::WriteBeginChildRecordsNative(pFilter);
00687 }

BOOL Chapter::WriteBeginChildRecordsWeb BaseCamelotFilter pFilter  )  [virtual]
 

Begins the child record sequence for chapter in the web format.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/8/96
Parameters:
pFilter = ptr to the filter to write to [INPUTS]
- [OUTPUTS]
Returns:
TRUE ok, FALSE otherwise
Web export doesn't write out chapter records, so this overrides the default behaviour in Node by ensuring the Down record does not get written

See also:
WritePreChildrenNative()

Reimplemented from Node.

Definition at line 654 of file chapter.cpp.

00655 {
00656     return TRUE;
00657 }

BOOL Chapter::WriteEndChildRecordsNative BaseCamelotFilter pFilter  )  [virtual]
 

Finished writing out you child records, in the native format.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/8/96
Parameters:
pFilter = ptr to filter to write to [INPUTS]
Returns:
TRUE if ok, FALSE otherwise
The base class will write out a TAG_UP record, but only if it has a child ptr

See also:
WritePostChildrenWeb(), WritePreChildrenWeb()

Reimplemented from Node.

Definition at line 689 of file chapter.cpp.

00690 {
00691     return Node::WriteEndChildRecordsNative(pFilter);
00692 }

BOOL Chapter::WriteEndChildRecordsWeb BaseCamelotFilter pFilter  )  [virtual]
 

Ends the child record sequence for chapter in the web format.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/8/96
Parameters:
pFilter = ptr to the filter to write to [INPUTS]
- [OUTPUTS]
Returns:
TRUE ok, FALSE otherwise
Web export doesn't write out chapter records, so this overrides the default behaviour in Node by ensuring the Up record does not get written

See also:
WritePreChildrenNative()

Reimplemented from Node.

Definition at line 677 of file chapter.cpp.

00678 {
00679     return TRUE;
00680 }

BOOL Chapter::WritePreChildrenNative BaseCamelotFilter pFilter  )  [virtual]
 

Writes out a chapter record.

> virtual BOOL Chapter::WritePreChildrenWeb(BaseCamelotFilter* pFilter)

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/7/96
Parameters:
pFilter = ptr to filter to write to [INPUTS]
Returns:
TRUE if the node has written out a record to the filter FALSE otherwise
See also:
CanWriteChildrenWeb(), WritePostChildrenWeb()

Reimplemented from Node.

Definition at line 617 of file chapter.cpp.

00618 {
00619 #ifdef DO_EXPORT
00620     BOOL RecordWritten = FALSE;
00621 
00622     // Always write out the spread record in native files
00623     CXaraFileRecord Rec(TAG_CHAPTER,TAG_CHAPTER_SIZE);
00624     if (pFilter->Write(&Rec) != 0)
00625         RecordWritten = TRUE;
00626     else
00627         pFilter->GotError(_R(IDE_FILE_WRITE_ERROR));
00628 
00629     return RecordWritten;
00630 #else
00631     return FALSE;
00632 #endif
00633 }

BOOL Chapter::WritePreChildrenWeb BaseCamelotFilter pFilter  )  [virtual]
 

Web files don't write out a chapter records.

> virtual BOOL Chapter::WritePreChildrenWeb(BaseCamelotFilter* pFilter)

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/7/96
Parameters:
pFilter = ptr to filter to write to [INPUTS]
Returns:
TRUE if the node has written out a record to the filter FALSE otherwise
This code assumes the document will only contain one chapter

See also:
CanWriteChildrenWeb(), WritePostChildrenWeb()

Reimplemented from Node.

Definition at line 597 of file chapter.cpp.

00598 {
00599     return FALSE;
00600 }


Member Data Documentation

MILLIPOINT Chapter::FoldLineXCoord [protected]
 

Definition at line 185 of file chapter.h.

BOOL Chapter::ShowFoldLine [protected]
 

Definition at line 186 of file chapter.h.


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