PageSizesList 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 PageSizesList:

List CCObject SimpleCCObject List of all members.

Public Member Functions

 PageSizesList ()
 Constructor.
 ~PageSizesList ()
 Destructor.
BOOL InitPageSizes ()
 Scans all PageSize to find out which PageSize are available for use, and instantiates one of each, and holds them in a list.
BOOL DeinitPageSizes ()
 Destroy all the PageSize objects.
PageSizeGetFirstPageSize ()
 Iterating through the list of PageSize known to Camelot. This function returns the first PageSize.
PageSizeGetNextPageSize (PageSize *)
 Iterating through the list of PageSize known to Camelot. This function returns the next PageSize.
BOOL DeclarePageSize (PageId NewId, String_32 *Name, double Width, double Height, UnitType Units, PageSize **pPageSize)
 A function to declare a new page size to the system.
BOOL DeclarePageSize (PageId NewId, ResourceID r, double Width, double Height, UnitType Units, PageSize **pPageSize)
String_32GetTextualDescription (PageId ThisId)
 Return the name for the page size specified.
PageId GetPageIdFromSize (INT32 Width, INT32 Height)
 Returns the name for the page size specified or CUSTOM if not found.
BOOL GetSizeFromPageId (PageId ThisId, INT32 *Width, INT32 *Height)
 Returns the width and height the page size specified.

Private Member Functions

 CC_DECLARE_DYNAMIC (PageSizesList)
BOOL ReadPageSizes ()
 Reads the page size definitions from somewhere (either file or bound-in resource file).
BOOL ReadPageSizesFromDisk ()
 Reads the page size definitions from disk (i.e. writable media).
BOOL ReadPageSizesFromRes ()
 Reads the hot key definitions from the bound in resource.
BOOL ReadPageSizesFromFile (CCLexFile &file)
 Reads the page size definitions from the given file.
BOOL ReadPageSizesList (CCLexFile &file)
 Read one page size definition from the given file.
BOOL ReadPageSizeDef (CCLexFile &file, String_32 *pPageName, double *pWidth, double *pHeight, UnitType *pUnits)
 Generates a key press object and op token from the given file.

Private Attributes

INT32 MaxPageId
UINT32 ErrorId

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 168 of file pagesize.h.


Constructor & Destructor Documentation

PageSizesList::PageSizesList  ) 
 

Constructor.

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

Definition at line 321 of file pagesize.cpp.

00322 {
00323     // Set up useful defaults
00324 
00325     // This is the next page id which will be used when the next page is added
00326     MaxPageId = (INT32)LASTPAGE;
00327 }

PageSizesList::~PageSizesList  ) 
 

Destructor.

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

Definition at line 342 of file pagesize.cpp.

00343 {
00344     // Remove all page sizes from the list
00345     ListItem* pItem;
00346 
00347     while ((pItem = this->RemoveHead()) != NULL)
00348         delete pItem;
00349 }


Member Function Documentation

PageSizesList::CC_DECLARE_DYNAMIC PageSizesList   )  [private]
 

BOOL PageSizesList::DeclarePageSize PageId  NewId,
ResourceID  r,
double  Width,
double  Height,
UnitType  Units,
PageSize **  pPageSize
[inline]
 

Definition at line 186 of file pagesize.h.

00188                         { String_32 Name(r); return DeclarePageSize(NewId, &Name, Width, Height, Units, pPageSize); }

BOOL PageSizesList::DeclarePageSize PageId  NewId,
String_32 Name,
double  Width,
double  Height,
UnitType  Units,
PageSize **  ppPageSize
 

A function to declare a new page size to the system.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
NewId unique pageid. [INPUTS] Name textual desciption of page size Width width of page in mm. Height height of page in mm. ppPageSize pointer to a page size pointer to be updated
Returns:
True if page size declared, False if something went wrong.
See also:
PageSize

Definition at line 454 of file pagesize.cpp.

00456 {
00457     // First check to see if somebody has actually declared the pointer to be non null.
00458     PageSize *pPageSize = new PageSize;
00459     if (pPageSize == NULL) return FALSE;
00460 
00461     if (!pPageSize->Init(NewId, Name, Width, Height, Units))
00462     {
00463         /* Error occured - report it and stop trying to initialise the options tab. */
00464         delete pPageSize;       // remove the declared page size
00465         pPageSize = NULL;       // remove the item from the system
00466         InformError();          // tell the user about the problem
00467         return TRUE;
00468     }
00469 
00470     // Add this new item at the end of the list
00471     this->AddTail(pPageSize);
00472 
00473     *ppPageSize = pPageSize;    // update the new end pointer 
00474     
00475     // All ok
00476     return TRUE;
00477 }

BOOL PageSizesList::DeinitPageSizes  ) 
 

Destroy all the PageSize objects.

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

Definition at line 427 of file pagesize.cpp.

00428 {
00429     // Get rid of our PageSize list
00430     this->DeleteAll();
00431 
00432     // All ok
00433     return TRUE;
00434 }

PageSize * PageSizesList::GetFirstPageSize  ) 
 

Iterating through the list of PageSize known to Camelot. This function returns the first PageSize.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Returns:
Pointer to the first page size NULL if none.
See also:
PageSizesList::GetNext() Scope: Static

Definition at line 493 of file pagesize.cpp.

00494 {
00495     return (PageSize *) this->GetHead();
00496 }

PageSize * PageSizesList::GetNextPageSize PageSize pPageSize  ) 
 

Iterating through the list of PageSize known to Camelot. This function returns the next PageSize.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
pPageSize - pointer to the PageSize to be used to get the following [INPUTS] PageSize.
Returns:
Pointer to the next PageSize, or NULL if none.
See also:
PageSizesList::GetFirst

Definition at line 513 of file pagesize.cpp.

00514 {
00515     return (PageSize *) this->GetNext(pPageSize);
00516 }

PageId PageSizesList::GetPageIdFromSize INT32  Width,
INT32  Height
 

Returns the name for the page size specified or CUSTOM if not found.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
Height height of page in millipoints. [INPUTS] Width width of page in millipoints.
Returns:
PageId the Id for the specified page.
See also:
PageSize::GetSizeFromPageId()

Definition at line 562 of file pagesize.cpp.

00563 {
00564     PageSize* pPageSize = (PageSize*) this->GetHead();
00565 
00566     while (pPageSize != NULL)
00567     {
00568         // Must give a little leeway either side as otherwise rounding errors may
00569         // raise their ugly heads and mean that 841891 != 841892 and hence miss the page size
00570         INT32 bodge = (INT32)(0.5 * MM_MP_VAL); // extra leeway on comparison required
00571         INT32 FoundWidth = pPageSize->GetPageWidth();
00572         INT32 FoundHeight = pPageSize->GetPageHeight(); 
00573         if ( (FoundWidth >= (Width - bodge)) && (FoundWidth <= (Width + bodge)) &&
00574              (FoundHeight  >= (Height - bodge)) && (FoundHeight  <= (Height + bodge)) )
00575             return pPageSize->GetPageId();
00576 
00577         pPageSize = (PageSize*) this->GetNext(pPageSize);
00578     }
00579 
00580     return CUSTOM;
00581 }

BOOL PageSizesList::GetSizeFromPageId PageId  ThisId,
INT32 *  Width,
INT32 *  Height
 

Returns the width and height the page size specified.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
PageId - id of the page that we are searching for [INPUTS]
Returns:
Width the width for the specified page in millipoints. Height the height for the specified page in millipoints.
See also:
PageSize::GetPageIdFromSize()

Definition at line 597 of file pagesize.cpp.

00598 {
00599     // Set up default values in case of early exit
00600     *Width = 0;
00601     *Height = 0;
00602 
00603     PageSize* pPageSize = (PageSize*) this->GetHead();
00604 
00605     while (pPageSize != NULL)
00606     {
00607         if (pPageSize->GetPageId() == ThisId)
00608         {
00609             *Width = pPageSize->GetPageWidth();         // return found page width
00610             *Height = pPageSize->GetPageHeight();       // return found page height
00611             return TRUE;
00612         }
00613         pPageSize = (PageSize*) this->GetNext(pPageSize);
00614     }
00615 
00616     // Did not find the specified page 
00617     return FALSE;
00618 }

String_32 * PageSizesList::GetTextualDescription PageId  ThisId  ) 
 

Return the name for the page size specified.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
PageId - id of the page that we are searching for [INPUTS]
Returns:
Textual name for the specified page.
See also:
PageSize::GetFirst

Definition at line 531 of file pagesize.cpp.

00532 {
00533     PageSize* pPageSize = (PageSize*) this->GetHead();
00534 
00535     while (pPageSize != NULL)
00536     {
00537         if (pPageSize->GetPageId() == ThisId)
00538             return pPageSize->GetPageName();
00539 
00540         pPageSize = (PageSize*) this->GetNext(pPageSize);
00541     }
00542 
00543     ERROR3("PageSizesList::GetTextualDescription Specified page id not found");
00544     return NULL;
00545 }

BOOL PageSizesList::InitPageSizes  ) 
 

Scans all PageSize to find out which PageSize are available for use, and instantiates one of each, and holds them in a list.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Returns:
TRUE if initialised ok, FALSE if not.

Errors: Out of memory (if a PageSize fails to initialise for other reasons then an error is reported, but Camelot will still start up ok, i.e. TRUE is returned).

See also:
PageSize

Definition at line 367 of file pagesize.cpp.

00368 {
00369     // Reset our store for error message identifiers to the 'no error' state.
00370     ErrorId = 0;
00371     
00372     // First, try and read hot keys from resource file
00373     BOOL Ok = ReadPageSizes();
00374 
00375     // Failed to read in the pages from the resource, tell the user this and what we think
00376     // the problem is, then use the bound in pages.
00377     if (!Ok)
00378     {
00379         // For now if we fail, error 3 to tell the user and then use the bound in version. 
00380         if (ErrorId == 0)
00381             ErrorId = _R(IDW_PAGES_UNKNOWNERROR);
00382     
00383         String_256 ErrorReason;
00384         ErrorReason.MakeMsg(ErrorId);
00385         
00386         // Combine the above error with the main error message
00387         String_256 ErrorMsg;
00388         ErrorMsg.MakeMsg(_R(IDW_PAGES_FAILEDREADING), (TCHAR*) ErrorReason);
00389         Error::SetError(_R(IDW_PAGES_FAILEDREADING), (TCHAR *) ErrorMsg, 0);
00390         InformError();                                                          \
00391         TRACEUSER( "Neville", _T("PageSizesList::InitPageSizes failed to read in list from resource, using bound in one"));
00392 
00393         // Vape any that may have been created
00394         this->DeleteAll();
00395         
00396         // Create, initialise and install the built in PageSize list
00397         PageSize *pPageSize;
00398 
00399         // First size is implied to be custom i.e. if unknown size.
00400         DeclarePageSize(A0, _R(IDS_K_PAGESIZE_A0), 840.0, 1188.0, MILLIMETRES, &pPageSize);
00401         DeclarePageSize(A1, _R(IDS_K_PAGESIZE_A1), 594.0, 840.0, MILLIMETRES, &pPageSize);
00402         DeclarePageSize(A2, _R(IDS_K_PAGESIZE_A2), 420.0, 594.0, MILLIMETRES, &pPageSize);
00403         DeclarePageSize(A3, _R(IDS_K_PAGESIZE_A3), 297.0, 420.0, MILLIMETRES, &pPageSize);
00404         DeclarePageSize(A4, _R(IDS_K_PAGESIZE_A4), 210.0, 297.0, MILLIMETRES, &pPageSize);
00405         DeclarePageSize(A5, _R(IDS_K_PAGESIZE_A5), 148.5, 210.0, MILLIMETRES, &pPageSize);
00406         DeclarePageSize(A6, _R(IDS_K_PAGESIZE_A6), 105.0, 148.5, MILLIMETRES, &pPageSize);
00407         DeclarePageSize(USLEGAL, _R(IDS_K_PAGESIZE_USLEGAL), 8.5, 14, INCHES, &pPageSize);
00408         DeclarePageSize(USLETTER,_R(IDS_K_PAGESIZE_USLETTER), 8.5, 11, INCHES, &pPageSize);
00409         DeclarePageSize(FANFOLD, _R(IDS_K_PAGESIZE_FANFOLD), 8.25, 12, INCHES, &pPageSize);
00410     }
00411     
00412     // All ok
00413     return TRUE;
00414 }

BOOL PageSizesList::ReadPageSizeDef CCLexFile file,
String_32 pPageName,
double *  pWidth,
double *  pHeight,
UnitType pUnits
[private]
 

Generates a key press object and op token from the given file.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/11/95
Parameters:
file = file that contains the key definitions [INPUTS] ppKeyPress = Place to put the ptr to a key press object pOpToken = ptr to string to place the op token string ppTextDesc = ptr to a ptr to a String_32 object that describes the key def (e.g. "Ctrl+X") pCheckUnicode = Flag to determine how the hot key is compared with key press objects
*ppKeyPress = a ptr to a key press object OR NULL [OUTPUTS] pOpToken = op token of op associated with the key press object OR empty string ppTextDesc = ptr to a String_32 describing the key combination. If this is NULL, then the key combo has no text description pCheckUnicode = TRUE if Unicode checking should be done, FALSE otherwise
Returns:
TRUE if OK FALSE otherwise (syntax error, not enough memory, etc)
See also:
HotKey::ReadKeyDef

Definition at line 850 of file pagesize.cpp.

00855 {
00856     // Check the parameters
00857     ERROR2IF(pPageName == NULL, FALSE,"PageSizesList::ReadPageSizeDef pPageName is NULL");
00858     ERROR2IF(pWidth == NULL,    FALSE,"PageSizesList::ReadPageSizeDef pWidth is NULL");
00859     ERROR2IF(pHeight == NULL,   FALSE,"PageSizesList::ReadPageSizeDef pHeight is NULL");
00860     ERROR2IF(pUnits == NULL,    FALSE,"PageSizesList::ReadPageSizeDef pUnits is NULL");
00861 
00862     // Fill in some useful default values
00863     *pPageName              = _T("");
00864     *pWidth                 = 0.0;
00865     *pHeight                = 0.0;
00866     *pUnits                 = MILLIMETRES;  // default to reading in measurements in millimetres
00867     
00868     PsTokenIndex Token;
00869     const TCHAR* TokenBuf   = file.GetTokenBuf();
00870 
00871     // This set of parameters will combine to form a key press object that represents
00872     // the hot key combination
00873 //  String_32* pTextDesc    = NULL;
00874 
00875     // This is FALSE until we have read the text that describes the page size
00876     BOOL TextDescRead       = FALSE;
00877     // This is FALSE until we have read the first number in, which should be the width
00878     BOOL ReadWidth          = FALSE;
00879 
00880     // We haven't finsihed, but we're OK at the mo
00881     BOOL finished           = FALSE;
00882     BOOL ok                 = TRUE;
00883 
00884     while (ok && !finished)
00885     {
00886         // Get the next token
00887         ok = file.GetSimpleToken();
00888 
00889         if (ok)
00890         {
00891             // Find out the type of the token
00892             LexTokenType TokenType = file.GetTokenType();
00893 
00894             switch (TokenType)
00895             {
00896                 case TOKEN_STRING:
00897                     {
00898                         // Read that text into the name of the page as this is the only 
00899                         // string that is expected
00900                         // Make sure the desccription is not too long and there is one
00901                         INT32 length = camStrlen(TokenBuf); 
00902                         ok = ((length <= pPageName->MaxLength()) && (length > 0) );
00903 
00904                         if (ok)
00905                         {
00906                             // Only take as much as we can take
00907                             //TokenBuf.Left(pPageName, pPageName->MaxLength());                 
00908                             *pPageName = TokenBuf;
00909                             
00910                             // We have read the text desc string
00911                             TextDescRead = TRUE;
00912                         }
00913                         else
00914                         {
00915                             TRACEUSER( "Neville", _T("PageSizesList::ReadPageSizeDef blank or too long a page size name!"));
00916                             ErrorId = _R(IDW_PAGES_BADPAGENAME);
00917                         }
00918                         
00919                     }
00920                     break;
00921 
00922                 case TOKEN_NORMAL:
00923                     {
00924                         Token = FindToken(TokenBuf);
00925                         switch (Token)
00926                         {
00927                             // if we find either of the units then this is the last item
00928                             // so this page size is all read in
00929                             case TOKEN_MILLIMETRES:
00930                                 *pUnits = MILLIMETRES;
00931                                 finished = TRUE;
00932                                 break;
00933                             case TOKEN_INCHES:
00934                                 *pUnits = INCHES;
00935                                 finished = TRUE;
00936                                 break;
00937 
00938                             case PsTOKEN_NONE:
00939                                 {
00940                                     double Number;
00941                                     // Could use this but the routine requires a valid doc!
00942                                     //String_256 Value;
00943                                     //Value = TokenBuf;
00944                                     //ok = Convert::StringToDouble( &Value, &Number);
00945                                     // Could use this but is not unicode compliant!
00946                                     //Number = atof((char *)TokenBuf);
00947                                     ok = (camSscanf(TokenBuf,_T("%lg"),&Number) == 1);
00948                                     if (ok)
00949                                     {
00950                                         if (!ReadWidth)
00951                                         {
00952                                             ReadWidth = TRUE;
00953                                             *pWidth = Number;
00954                                         }
00955                                         else
00956                                         {
00957                                             //ok = (camSscanf(TokenBuf,"%lg",pHeight) == 1);
00958                                             *pHeight = Number;
00959                                         }
00960                                     }
00961                                     else
00962                                     {
00963                                         ErrorId = _R(IDW_PAGES_BADPAGESIZE);
00964                                         TRACEUSER( "Neville", _T("PageSize: Expected a size (width/height) but got : '%s'\n"),TokenBuf);
00965                                     }
00966                                 }
00967                                 break;
00968 
00969                             default:
00970                                 // Flag a bad token so that we stop parsing this line
00971                                 ok = FALSE;
00972                                 TRACEUSER( "Neville", _T("PageSize: Didn't expect to get this token ('%s') in the middle of a hot key def\n"),TokenBuf);
00973                                 ErrorId = _R(IDW_PAGES_BADTOKEN);
00974                                 break;
00975                         }
00976                     }
00977                     break;
00978 
00979                 default:
00980                     // bad token so stop parsing this line
00981                     TRACEUSER( "Neville", _T("PageSize: Unexpected token - %s\n"),TokenBuf);
00982                     ok = FALSE;
00983                     ErrorId = _R(IDW_PAGES_UNEXPECTEDTOKEN);
00984                     break;
00985             }
00986         }
00987     }
00988 
00989     return (ok);
00990 }

BOOL PageSizesList::ReadPageSizes  )  [private]
 

Reads the page size definitions from somewhere (either file or bound-in resource file).

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/11/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if OK, FALSE otherwise
See also:
HotKey::ReadHotKeys;

Definition at line 643 of file pagesize.cpp.

00644 {
00645     BOOL ok = PageSizesList::ReadPageSizesFromDisk();
00646 
00647     if (!ok) ok = PageSizesList::ReadPageSizesFromRes();
00648 
00649     return (ok);
00650 }

BOOL PageSizesList::ReadPageSizesFromDisk  )  [private]
 

Reads the page size definitions from disk (i.e. writable media).

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/11/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if OK, FALSE otherwise
See also:
HotKey::ReadHotKeysFromDisk;

Definition at line 666 of file pagesize.cpp.

00667 {   
00668     // Not yet implemented
00669 
00670     return FALSE;
00671 }

BOOL PageSizesList::ReadPageSizesFromFile CCLexFile file  )  [private]
 

Reads the page size definitions from the given file.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/11/95
Parameters:
file = file that contains the page size definitions [INPUTS]
- [OUTPUTS]
Returns:
TRUE if OK, FALSE otherwise
See also:
HotKey::ReadHotKeysFromFile;

Definition at line 718 of file pagesize.cpp.

00719 {
00720     BOOL finished = FALSE;
00721     BOOL ok;;   
00722 
00723     // Initialise lexing routines, and aspects of the lexer
00724     ok = file.InitLexer();
00725     file.SetDelimiters("\r\n");         // Set token delimiting characters
00726     file.SetCommentMarker(';');         // Set comment marker char
00727     file.SetWhitespace(" \t");          // Set whitespace chars
00728     file.SetStringDelimiters("\"\"");   // Set string delimiters
00729 
00730     PsTokenIndex Token;
00731     const TCHAR* TokenBuf = file.GetTokenBuf(); // Token buffer remains constant until lexer deinitialisation
00732     
00733     while (ok && !finished)
00734     {
00735         // Grab a token
00736         ok = file.GetSimpleToken();
00737 
00738         if (ok)
00739         {
00740             // Look the token up in our table
00741             Token = FindToken(TokenBuf);
00742 
00743             switch (Token)
00744             {
00745                 case TOKEN_PAGESIZE:
00746                     // Correst line start found so read in the page size info from that line
00747                     ok = PageSizesList::ReadPageSizesList(file);
00748                     break;
00749 
00750                 case TOKEN_PAGESIZEEND:
00751                     // End of table marker found so our job is over
00752                     finished = TRUE;
00753                     break;
00754 
00755                 default:
00756                     TRACEUSER("Neville", _T("PageSizesList: Unexpected token - %s\n"),TokenBuf);
00757                     ErrorId = _R(IDW_PAGES_UNEXPECTEDMAINTOKEN);
00758                     ok = FALSE;
00759                     break;
00760             }
00761         }
00762         else
00763             ErrorId = _R(IDW_PAGES_FAILEDTOGETTOKEN);
00764     }
00765 
00766     if (!ok)
00767     {
00768         TRACEUSER( "Neville", _T("\nPageSizesList: Offending line - %s\n"),file.GetLineBuf());
00769         //ERROR3("Error reading page sizes.  See TRACE output for details");
00770     }
00771 
00772     // We are now finished with the lexer
00773     file.DeinitLexer();
00774 
00775     return (ok);
00776 }

BOOL PageSizesList::ReadPageSizesFromRes  )  [private]
 

Reads the hot key definitions from the bound in resource.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/11/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if OK, FALSE otherwise
See also:
HotKey::ReadHotKeysFromRes;

Definition at line 687 of file pagesize.cpp.

00688 {
00689     // Resource File
00690     CCResTextFile file;             
00691 
00692     // Open resource
00693     BOOL ok = file.open(_R(IDH_DEFAULT_PAGESIZES), _R(IDT_CAM_PAGESIZES_RES));
00694 
00695     if (ok)
00696     {
00697         ok = PageSizesList::ReadPageSizesFromFile(file);
00698         file.close();
00699     }
00700 
00701     return (ok);
00702 }

BOOL PageSizesList::ReadPageSizesList CCLexFile file  )  [private]
 

Read one page size definition from the given file.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/11/95
Parameters:
file = file that contains the page size definitions [INPUTS]
- [OUTPUTS]
Returns:
TRUE if OK, FALSE otherwise
See also:
-

Definition at line 792 of file pagesize.cpp.

00793 {
00794     PageSize*   pPageSize   = NULL;
00795     String_32   PageName;
00796     double      Width       = 0.0;
00797     double      Height      = 0.0; 
00798     UnitType    Units       = NOTYPE;
00799 
00800     BOOL ok = PageSizesList::ReadPageSizeDef(file, &PageName, &Width, &Height, &Units);
00801 
00802     if (ok)
00803     {
00804         // First size is implied to be custom i.e. if unknown size.
00805         DeclarePageSize((PageId)MaxPageId, &PageName, Width, Height, Units, &pPageSize);
00806 
00807         // Now increment are next new page id
00808         MaxPageId++;
00809 
00810         if (!ok)
00811         {
00812             ErrorId = _R(IDW_PAGES_FAILEDTOADDPAGE);
00813             TRACEUSER( "Neville", _T("PageSizesList: Unable to add page size to the system\n"));
00814         }
00815     }
00816 
00817     return (ok);
00818 }


Member Data Documentation

UINT32 PageSizesList::ErrorId [private]
 

Definition at line 215 of file pagesize.h.

INT32 PageSizesList::MaxPageId [private]
 

Definition at line 212 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