Page Class Reference

Represents the actual bits of paper on which the document will be printed. More...

#include <page.h>

Inheritance diagram for Page:

NodeRenderablePaper NodeRenderableBounded NodeRenderable Node CCObject SimpleCCObject List of all members.

Public Member Functions

 Page ()
 This constructor creates a Page linked to no other nodes, with all status flags false, and NULL bounding and pasteboard rectangles.
 Page (Node *ContextNode, AttachNodeDirection Direction, const DocRect &NewPageRect, BOOL Locked=FALSE, BOOL Mangled=FALSE, BOOL Marked=FALSE, BOOL Selected=FALSE)
 This method initialises the page node and links it to ContextNode in the direction specified by Direction. The sizes of the pasteboard rectangles of all paper nodes above this page are recalculated, and the document extents changed.
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.
void Render (RenderRegion *pRender)
 Renders page items: White page rectangle, page divider, print margin, and grid.
const DocRectGetPageRect (void) const
 For obtaining the page rectangle.
BOOL SetPageRect (DocRect NewPageRect)
 For setting up a new page rectangle.
PageFindNextPage (void)
 To find the next sibling page.
PageFindRightPage (void)
 To find the page joined to the right of this page.
PageFindBottomPage (void)
 To find the page joined to the bottom of this page.
void CopyIntoSpread (Page *pContextPage, LinkDirection ld)
 To make a copy of the current page and attach it to ContextPage in the direction specified by ld.
virtual UINT32 GetNodeSize () const
 For finding the size of the node.
virtual void GetDebugDetails (StringBase *Str)
 For obtaining debug information about the Node.
virtual BOOL Snap (DocCoord *pDocCoord)
 Snaps to given coord to the nearest point on the page boundary.
virtual BOOL Snap (DocRect *pDocRect, const DocCoord &PrevCoord, const DocCoord &CurCoord)
 Snaps the given rect to the page, preserving its width and height.
virtual BOOL WritePreChildrenWeb (BaseCamelotFilter *pFilter)
 Writes the Page record to the filter (if it's required).
virtual BOOL WritePreChildrenNative (BaseCamelotFilter *pFilter)
virtual void PolyCopyNodeContents (NodeRenderable *pNodeCopy)
 Polymorphically copies the contents of this node to another.

Static Public Member Functions

static void SetPageColour (DocColour &NewColour)
 Sets the page colour to NewColour.
static DocColourGetPageColour (void)
 For finding the colour of a page.

Static Public Attributes

static DocColour PageColour

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

Protected Attributes

DocRect PageRect

Private Member Functions

INT32 SnapOrdinate (INT32 Lo, INT32 Hi, INT32 Src, INT32 SnapDist)
 This function will return either Lo, Hi, or Src depending on the following:.

Detailed Description

Represents the actual bits of paper on which the document will be printed.

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

Chapter

Spread

Layer

Definition at line 125 of file page.h.


Constructor & Destructor Documentation

Page::Page  ) 
 

This constructor creates a Page 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 145 of file page.cpp.

00145           : NodeRenderablePaper()
00146 {   
00147 }                    

Page::Page Node ContextNode,
AttachNodeDirection  Direction,
const DocRect NewPageRect,
BOOL  Locked = FALSE,
BOOL  Mangled = FALSE,
BOOL  Marked = FALSE,
BOOL  Selected = FALSE
 

This method initialises the page node and links it to ContextNode in the direction specified by Direction. The sizes of the pasteboard rectangles of all paper nodes above this page are recalculated, and the document extents changed.

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

PasteRect : Page's pasteboard rectangle PageWidth : The width of the page PageHeight: The height of the page

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 202 of file page.cpp.

00210  :NodeRenderablePaper(ContextNode, Direction, Locked, Mangled, 
00211                                     Marked, Selected)     
00212 {
00213     PageRect = NewPageRect;
00214 }                                                      


Member Function Documentation

void Page::CopyIntoSpread Page ContextPage,
LinkDirection  ld
 

To make a copy of the current page and attach it to ContextPage in the direction specified by ld.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/5/93
Parameters:
ContextPage,: Page to which the copied page is to be attached [INPUTS] ld: The direction in which the copied page is to be attached to the ContextPage
- [OUTPUTS]
Returns:
-
(********* This fn is not finished yet it will be quite complex)
Returns:
Errors: -
See also:
-

Definition at line 632 of file page.cpp.

00633 {                  
00634 }

void Page::CopyNodeContents Page 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 427 of file page.cpp.

00428 {
00429     ENSURE(NodeCopy != NULL,"Trying to copy a page's contents to a NULL node");  
00430     NodeRenderablePaper::CopyNodeContents(NodeCopy); 
00431     NodeCopy->PageRect = PageRect;
00432     NodeCopy->PageColour = PageColour;           
00433 }

String Page::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] Retuns: 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 243 of file page.cpp.

00244 {     
00245     if (Plural)
00246         return(String(_R(IDS_PAGE_DESCRP)));  
00247     else
00248         return(String(_R(IDS_PAGE_DESCRS))); 
00249 }; 

Page * Page::FindBottomPage void   ) 
 

To find the page joined to the bottom of this page.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/6/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
If this page has another page joined beneath it, then a pointer to the bottom page is returned, else NULL is returned.

Errors: -

See also:
Page::RightPage

Definition at line 592 of file page.cpp.

00593 {
00594     Page* SiblingPage = FindNextPage(); 
00595     while (SiblingPage != NULL)                       
00596     {         
00597         DocRect SiblingPageRect = SiblingPage->GetPageRect();   
00598         // For two pages joined together vertically the hi.y of the lower page must be 
00599         // equal to lo.y of the upper page, also the two pages will have identical x
00600         // coordinates (i.e. they have the same width and are in the same place horizontally).       
00601         // This condition could be optimised   
00602         if ( ((SiblingPageRect.HighCorner().y) == (PageRect.LowCorner().y)) &&
00603              ((SiblingPageRect.HighCorner().x) == (PageRect.HighCorner().x)) &&
00604              ((SiblingPageRect.LowCorner().x) == (PageRect.LowCorner().x))
00605            )                  
00606             return(SiblingPage); 
00607         SiblingPage = SiblingPage->FindNextPage();
00608     }   
00609     return (NULL); // No page was found to be joined beneath this page
00610 }  

Page * Page::FindNextPage void   ) 
 

To find the next sibling page.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/5/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The next sibling page of this node, or NULL if there are none.

Errors: -

See also:
-

Definition at line 522 of file page.cpp.

00523 {
00524     Node* CurrentNode = FindNext(); 
00525     while (CurrentNode != NULL)
00526     {
00527         if(CurrentNode->IsKindOf(CC_RUNTIME_CLASS(Page)))
00528             return ((Page*) CurrentNode);     
00529         CurrentNode = CurrentNode->FindNext(); 
00530     }
00531     return (NULL);                          // No page found
00532 }     

Page * Page::FindRightPage void   ) 
 

To find the page joined to the right of this page.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/6/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
If this page has another page joined to its right hand edge, then a pointer to the right page is returned, else NULL is returned.

Errors: -

See also:
Page::BottomPage

Definition at line 550 of file page.cpp.

00551 {  
00552     Page* SiblingPage = FindNextPage();      
00553      
00554     if (SiblingPage != NULL) 
00555     {   
00556         const DocRect& SiblingPageRect = SiblingPage->GetPageRect();  
00557             
00558         //For two pages joined together horizontally the hi.x of the left-hand page must 
00559         //be equal to the lo.x of the right hand page, also the two pages will have 
00560         //identical y coordinates (i.e. they have the same height and are in the same place
00561         //vertically. 
00562         
00563         // This can be optimised **
00564         if (((PageRect.HighCorner().x) == (SiblingPageRect.LowCorner().x)) &&
00565             ((PageRect.LowCorner().y ) == (SiblingPageRect.LowCorner().y)) &&
00566             ((PageRect.HighCorner().y) == (SiblingPageRect.HighCorner().y))
00567            )     
00568             return (SiblingPage); 
00569         else
00570             return (NULL);               
00571     }        
00572     return (NULL);
00573 }                  

void Page::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 703 of file page.cpp.

00704 {          
00705 #ifdef _DEBUG
00706     NodeRenderablePaper::GetDebugDetails(Str); 
00707     String_256 TempStr; 
00708     if (!PageRect.IsValid())
00709     { 
00710         TempStr = TEXT("\r\nPage Rectangle = *INVALID*\r\n"); 
00711     }
00712     else
00713     TempStr._MakeMsg(TEXT("\r\nPage Rectangle\r\n   Low(#1%ld, #2%ld)\r\n   High(#3%ld, #4%ld)\r\n"),    
00714                           PageRect.LowCorner().x,  
00715                           PageRect.LowCorner().y,
00716                           PageRect.HighCorner().x,  
00717                           PageRect.HighCorner().y); 
00718     (*Str)+=TempStr; 
00719 #endif
00720 }

UINT32 Page::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 737 of file page.cpp.

00738 {     
00739     return (sizeof(Page)); 
00740 }         

DocColour & Page::GetPageColour void   )  [static]
 

For finding the colour of a page.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/7/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The colour of a camelot page

Errors: -

See also:
-

Definition at line 682 of file page.cpp.

00683 {
00684     return (PageColour);     
00685 }  

const DocRect & Page::GetPageRect void   )  const
 

For obtaining the page rectangle.

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

Errors:

Definition at line 476 of file page.cpp.

00477 {
00478     return (PageRect); 
00479 }                              

void Page::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 448 of file page.cpp.

00449 {
00450     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
00451     ENSURE(IS_A(pNodeCopy, Page), "PolyCopyNodeContents given wrong dest node type");
00452 
00453     if (IS_A(pNodeCopy, Page))
00454         CopyNodeContents((Page*)pNodeCopy);
00455 }

void Page::Render RenderRegion pRender  )  [virtual]
 

Renders page items: White page rectangle, page divider, print margin, and grid.

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

Errors: -

See also:
-

Reimplemented from Node.

Definition at line 269 of file page.cpp.

00270 {      
00271     // If we should blow up, then blow up - don't worry, this is a very quick inline check
00272     OpException::BlowUpOnCrashMe();
00273 
00274     // Sanity check
00275     ERROR3IF(pRender == NULL,"Page::Render null render region!");
00276     if (pRender == NULL)
00277         return;
00278 
00279     // If we have the new page background layer present then we needn't bother redrawing the
00280     // page as we might get a flash of white as we redraw
00281     Node * pCurrent = FindParent();
00282     if (pCurrent->GetRuntimeClass() == CC_RUNTIME_CLASS(Spread))
00283     {
00284         // We have found the spread
00285         Spread * pSpread = (Spread *)pCurrent;
00286         // Is there a page background layer on the spread?
00287         Layer* pLayer = pSpread->FindFirstPageBackgroundLayer();
00288         // Yes, the layer is present but is it visible and does the quality level 
00289         // dictate that we should show it?
00290         if (
00291             pLayer && pLayer->IsVisible() &&
00292             (pRender->RRQuality.GetFillQuality() >= Quality::NoFill)
00293             )
00294             return;
00295     }
00296 
00297 // This conditional replaces the correct code (directly below in the IF clause) in favour
00298 // of a bodged version that renders the single pixel page outline using filled rectangles
00299 // (the code in the ELSE clause). This is required because although GDI and GDraw fills
00300 // can be made to match up, their outlines can't (at the time of writing).
00301 //
00302 // By the way, Gavin says, it's faster to plot four upright rects than to stroke a path
00303 // to become the outline of the page!!!
00304 //
00305 #if 0
00306     // Set up attributes for drawing page rectangle
00307     pRender->SetLineWidth(0);                   // Means single-pixel lines
00308     pRender->SetLineColour(DocColour(BLACK)); 
00309     pRender->SetFillColour(PageColour);   
00310 
00311     // Draw a rectangle covering the page 
00312     pRender->DrawRect(&PageRect);
00313 
00314 #else
00315     // Draw a rectangle covering the page 
00316     // Set up attributes for drawing page rectangle
00317     pRender->SetLineWidth(0);                   // Means single-pixel lines
00318     pRender->SetLineColour(COLOUR_TRANS); 
00319 
00320 // randomly change page colour to see which bit is redrawing
00321 #if 0
00322     static COLORREF pc = 0x00000000;
00323     switch (pc)
00324     {
00325         case 0x007FFFFF: pc = 0x00FF7FFF; break;
00326         case 0x00FF7FFF: pc = 0x00FFFF7F; break;
00327         case 0x00FFFF7F: pc = 0x007FFFFF; break;
00328         default: pc = 0x007FFFFF;
00329     }
00330     pRender->SetFillColour(DocColour((pc>>16)&0xFF,(pc>>8)&0xFF,pc&0xFF));
00331 #else
00332     pRender->SetFillColour(PageColour);
00333 #endif
00334     pRender->DrawRect(&PageRect);
00335 
00336 
00337 #ifndef NO_PAGE
00338     // This is the default non-Ralph behaviour
00339 
00340     pRender->SetFillColour(COLOUR_BLACK);
00341     pRender->DrawPixelRect(&PageRect);
00342 #else
00343     // Ralph Docs only render paper in some modes
00344     
00345     //find the parent NodeDocument 
00346     Node* pCurrentNode = FindParent(); 
00347     while(pCurrentNode != NULL)   
00348     {
00349         if (pCurrentNode->IsNodeDocument())
00350             break;   
00351         pCurrentNode = pCurrentNode->FindParent(); 
00352     }
00353     BaseDocument * pDoc =NULL;
00354     // get a Document *
00355     if(pCurrentNode)
00356         pDoc = ((NodeDocument*)(pCurrentNode))->GetParentDoc(); 
00357     // should we render paper ?
00358     if(((Document*)pDoc)->RalphDontShowPaper()==FALSE)
00359     {
00360         pRender->SetFillColour(COLOUR_BLACK);
00361         pRender->DrawPixelRect(&PageRect);
00362     }
00363 #endif // NO_PAGE
00364 
00365 #endif // simple redraw or redraw lines and page as filled rects
00366     
00367     //Draw print margin
00368     //if Document::PrintSpreads     *****
00369     //DocColour Red(0.87,0,0)
00370     // DocColour Transparent(TRANS);  
00371     
00372     //obtain the printer margin from the PrintView
00373     // pCurrentRenderRegion->DrawRect(&PrintMarginRect)
00374     
00375     // The rendering of the grid will have to wait until the grid exists.
00376 }  

void Page::SetPageColour DocColour NewColour  )  [static]
 

Sets the page colour to NewColour.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/7/93
Parameters:
NewColour,: The new page colour [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
Page::GetPageColour

Definition at line 662 of file page.cpp.

00663 {
00664     PageColour = NewColour;
00665 }   

BOOL Page::SetPageRect DocRect  NewPageRect  ) 
 

For setting up a new page rectangle.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/12/93
Parameters:
The pages rectangle [INPUTS]
- [OUTPUTS]
Returns:
-

Errors:

Definition at line 498 of file page.cpp.

00499 {
00500     PageRect = NewPageRect;
00501 
00502     return TRUE; 
00503 }                              

Node * Page::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 398 of file page.cpp.

00399 {
00400     Page* NodeCopy; 
00401     NodeCopy = new Page();   
00402     ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 
00403     CopyNodeContents(NodeCopy);   
00404     return (NodeCopy);
00405 }          

BOOL Page::Snap DocRect pDocRect,
const DocCoord PrevCoord,
const DocCoord CurCoord
[virtual]
 

Snaps the given rect to the page, preserving its width and height.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/95
Parameters:
pDocCoord - the rectangle to snap [INPUTS] StartDrag - Start coord of drag EndDrag - End coord of drag
[OUTPUTS] 
Returns:
TRUE - the DocRect been snapped. FALSE - the DocRect has not been processed.
It will snap the side of the rect that corresponds to the direction the mouse is moving, e.g. if the mouse is moving left, the left hand side of the rect is snapped.

To force the bottom left hand corner of the rect to be snapped, supply PrevCoord=(0,0) and CurCoord(-1,-1).

ALWAYS RETURNS FALSE currently.

Scope: public

Reimplemented from NodeRenderableBounded.

Definition at line 853 of file page.cpp.

00854 {
00855 #if !defined(EXCLUDE_FROM_RALPH)
00856     ERROR3IF(pDocRect == NULL,"pDocRect == NULL");
00857     if (pDocRect == NULL) return FALSE;
00858 
00859     DocCoord OrigCoord;
00860 
00861     if (PrevCoord.x < CurCoord.x)
00862         OrigCoord.x = pDocRect->hi.x;
00863     else
00864         OrigCoord.x = pDocRect->lo.x;
00865         
00866     if (PrevCoord.y < CurCoord.y)
00867         OrigCoord.y = pDocRect->hi.y;
00868     else
00869         OrigCoord.y = pDocRect->lo.y;
00870 
00871     DocCoord SnapCoord = OrigCoord;
00872 
00873     if (Snap(&SnapCoord))
00874     {
00875         INT32 DeltaX = SnapCoord.x - OrigCoord.x;
00876         INT32 DeltaY = SnapCoord.y - OrigCoord.y;
00877 
00878         pDocRect->Translate(DeltaX,DeltaY);
00879 
00880         return TRUE;
00881     }
00882     else
00883 #endif
00884         return FALSE;
00885 }

BOOL Page::Snap DocCoord pDocCoord  )  [virtual]
 

Snaps to given coord to the nearest point on the page boundary.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/95
Parameters:
pDocCoord = a coord in Spread coords [INPUTS]
[OUTPUTS] 
Returns:
TRUE - the DocCoord has been snapped . FALSE - the DocCoord has not been processed.

Errors: Scope: public

Reimplemented from NodeRenderableBounded.

Definition at line 802 of file page.cpp.

00803 {
00804     ERROR3IF(pDocCoord == NULL,"pDocCoord == NULL");
00805     if (pDocCoord == NULL) return FALSE;
00806 
00807     MILLIPOINT SnapDist = CSnap::GetSnapDist();
00808 
00809     DocRect BigRect   = PageRect;
00810     DocRect SmallRect = PageRect;
00811 
00812     BigRect.Inflate(SnapDist);
00813     SmallRect.Inflate(-SnapDist);
00814 
00815     if (BigRect.ContainsCoord(*pDocCoord) && !SmallRect.ContainsCoord(*pDocCoord))
00816     {
00817         pDocCoord->x = SnapOrdinate(PageRect.lo.x,PageRect.hi.x,pDocCoord->x,SnapDist);
00818         pDocCoord->y = SnapOrdinate(PageRect.lo.y,PageRect.hi.y,pDocCoord->y,SnapDist);
00819 
00820         return TRUE;
00821     }
00822     return FALSE;
00823 }

INT32 Page::SnapOrdinate INT32  Lo,
INT32  Hi,
INT32  Src,
INT32  SnapDist
[private]
 

This function will return either Lo, Hi, or Src depending on the following:.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/95
Parameters:
Lo = low ordinate [INPUTS] Hi = high ordinate Src = Source ordinate SnapDist = snap distance threshold
[OUTPUTS] 
Returns:
The snapped version of Src.
if Src is closest to Lo, and the distance is <= SnapDist, Hi is returned if Src is closest to Hi, and the distance is <= SnapDist, Hi is returned

Otherwise Src is returned back.

Returns:
Errors: Scope: public

Definition at line 766 of file page.cpp.

00767 {
00768     INT32 DistLo = abs(Lo-Src);
00769     INT32 DistHi = abs(Hi-Src);
00770 
00771     if (DistLo < DistHi)
00772     {
00773         if (DistLo <= SnapDist)
00774             Src = Lo;
00775     }
00776     else
00777     {
00778         if (DistHi <= SnapDist)
00779             Src = Hi;
00780     }
00781 
00782     return Src;
00783 }

BOOL Page::WritePreChildrenNative BaseCamelotFilter pFilter  )  [virtual]
 

Reimplemented from Node.

Definition at line 913 of file page.cpp.

00914 {
00915 #if 0 //NEW_NATIVE_FILTER   // New native filters, only available to those who need them at present
00916     ERROR2IF(pFilter == NULL,FALSE,"Page - NULL filter param");
00917 
00918     // Only write out in the native file format
00919     // Just write out the position of this page as other information such as
00920     // show bleed is spread related and written in the spread information record
00921     BOOL RecordWritten = TRUE;
00922     BOOL ok = TRUE;
00923 
00924     CXaraFileRecord Rec(TAG_PAGE,TAG_PAGE_SIZE);
00925 
00926     ok = Rec.Init();
00927 
00928     if (ok) ok = Rec.WriteCoord(PageRect.lo);   // write out low corner details
00929     if (ok) ok = Rec.WriteCoord(PageRect.hi);   // write out high corner details
00930 
00931     // Finally, write the record out to file
00932     // In the process get the record number that this was written out as
00933     INT32 RecordNumber = 0L;
00934     if (ok) RecordNumber = pFilter->Write(&Rec);
00935     
00936     // If we have had a problem at any of the stages then return that to the caller
00937     if (!ok || RecordNumber <= 0)
00938         RecordWritten = FALSE;
00939 
00940     return RecordWritten;
00941 #else
00942     return TRUE;
00943 #endif //NEW_NATIVE_FILTER
00944 }

BOOL Page::WritePreChildrenWeb BaseCamelotFilter pFilter  )  [virtual]
 

Writes the Page record to the filter (if it's required).

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/7/96
Parameters:
pFilter = ptr to the filter [INPUTS]
Returns:
TRUE if record is written, FALSE if not
See also:
Node::WritePreChildrenWeb(BaseCamelotFilter* pFilter)

Reimplemented from Node.

Definition at line 904 of file page.cpp.

00905 {
00906     // This is not required in the web format
00907     return TRUE;
00908 }


Member Data Documentation

DocColour Page::PageColour [static]
 

Definition at line 174 of file page.h.

DocRect Page::PageRect [protected]
 

Definition at line 179 of file page.h.


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