PageSize Class Reference

Encapsulates all the page size information and functionality in one class. The class knows what size an A4 page is and what its textual name is. More...

#include <pagesize.h>

Inheritance diagram for PageSize:

ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 PageSize ()
 Constructor.
virtual BOOL Init (PageId NewId, String_32 *Name, double PageWidth, double PageHeight, UnitType Units)
 Initialiser.
PageId GetPageId ()
 Returns page id.
String_32GetPageName ()
 Way of finding the name for this page.
INT32 GetPageWidth ()
 Way of of finding out the current page width.
INT32 GetPageHeight ()
 Way of of finding out the current page height.

Protected Attributes

PageId Id
String_32 PageName
INT32 PageWidth
INT32 PageHeight
double PageWidthInMM
double PageHeightInMM

Private Member Functions

 CC_DECLARE_DYNAMIC (PageSize)

Detailed Description

Encapsulates all the page size information and functionality in one class. The class knows what size an A4 page is and what its textual name is.

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

Definition at line 132 of file pagesize.h.


Constructor & Destructor Documentation

PageSize::PageSize  ) 
 

Constructor.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Returns:
Errors:
See also:
AppPrefsDlg;

Definition at line 177 of file pagesize.cpp.

00178 {
00179     // Do nothing
00180 }


Member Function Documentation

PageSize::CC_DECLARE_DYNAMIC PageSize   )  [private]
 

INT32 PageSize::GetPageHeight  ) 
 

Way of of finding out the current page height.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Returns:
Height of this page in millipoints.
See also:
PageSize; AppPrefsDlg;

Definition at line 298 of file pagesize.cpp.

00299 {
00300     return PageHeight;
00301 }

PageId PageSize::GetPageId  ) 
 

Returns page id.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Returns:
The id for this page
See also:
PageSize; AppPrefsDlg;

Definition at line 249 of file pagesize.cpp.

00250 {
00251     return Id;
00252 }

String_32 * PageSize::GetPageName  ) 
 

Way of finding the name for this page.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Returns:
pointer to the name of this page
See also:
PageSize; AppPrefsDlg;

Definition at line 265 of file pagesize.cpp.

00266 {
00267     return &PageName;
00268 }

INT32 PageSize::GetPageWidth  ) 
 

Way of of finding out the current page width.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Returns:
Width of this page in millipoints.
See also:
PageSize; AppPrefsDlg;

Definition at line 282 of file pagesize.cpp.

00283 {
00284     return PageWidth;
00285 }

BOOL PageSize::Init PageId  NewId,
String_32 Name,
double  Width,
double  Height,
UnitType  Units
[virtual]
 

Initialiser.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
NewId unique page id for this page size [INPUTS] Name textual name for this page (for menus etc.) Width width in the specified units e.g. millimetres Height height in the specified units Units the specified units
Returns:
Errors:
See also:
PageSize; AppPrefsDlg;

Definition at line 200 of file pagesize.cpp.

00202 {
00203     // Guard against floating point exceptions by checking the input values
00204     // 0.1" or 0.1mm should be a good enough minimim
00205     ERROR2IF(Width < 0.1 || Width > (double)INT32_MAX, FALSE, "PageSize::Init bad width");
00206     ERROR2IF(Height < 0.1 || Height > (double)INT32_MAX, FALSE, "PageSize::Init bad width");
00207 
00208     Id = NewId;                 // Copy the page id across
00209     PageName = *Name;           // Copy the page name across 
00210     PageWidthInMM = Width;      // Copy the width across
00211     PageHeightInMM = Height;    // Copy the height across
00212     
00213     // Now work out the equivalent millipoint values
00214     // Cannot use the ConvertToNewUnits functions as these require a current doc
00215     // and we have not got one yet! Do it the hard way but use the conversion values
00216     // specified in units.h
00217     switch (Units)
00218     {
00219         case MILLIMETRES:
00220             PageWidth = (INT32)(Width * MM_MP_VAL);
00221             PageHeight = (INT32)(Height * MM_MP_VAL);
00222             break;
00223         case INCHES:
00224             PageWidth = (INT32)(Width * IN_MP_VAL);
00225             PageHeight = (INT32)(Height * IN_MP_VAL);
00226             break;
00227         default:
00228             ERROR2(FALSE,"Bad units used in PageSize::Init");
00229             break;
00230     }
00231     //PageWidth = ConvertToNewUnits(Width, MILLIMETRES, MILLIPOINTS);
00232     //PageHeight = ConvertToNewUnits(Height, MILLIMETRES, MILLIPOINTS);
00233     
00234     return TRUE;
00235 }


Member Data Documentation

PageId PageSize::Id [protected]
 

Definition at line 149 of file pagesize.h.

INT32 PageSize::PageHeight [protected]
 

Definition at line 152 of file pagesize.h.

double PageSize::PageHeightInMM [protected]
 

Definition at line 154 of file pagesize.h.

String_32 PageSize::PageName [protected]
 

Definition at line 150 of file pagesize.h.

INT32 PageSize::PageWidth [protected]
 

Definition at line 151 of file pagesize.h.

double PageSize::PageWidthInMM [protected]
 

Definition at line 153 of file pagesize.h.


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