PrintComponentClass Class Reference

Provide a class that will add print components to new documents. More...

#include <princomp.h>

Inheritance diagram for PrintComponentClass:

DocComponentClass ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

BOOL AddComponent (BaseDocument *)
 Add a print component to the specified document.

Static Public Member Functions

static BOOL Init ()
 Register the print document component with the main application.

Detailed Description

Provide a class that will add print components to new documents.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/3/95
See also:
DocComponentClass

Definition at line 125 of file princomp.h.


Member Function Documentation

BOOL PrintComponentClass::AddComponent BaseDocument pDocument  )  [virtual]
 

Add a print component to the specified document.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/3/95
Parameters:
pDocument - the document to add the print to. [INPUTS]
Returns:
TRUE if the print was added ok; FALSE if not.

Errors: Out of memory

See also:
PrintComponentClass

Implements DocComponentClass.

Definition at line 177 of file princomp.cpp.

00178 {
00179     // Check to see if this document already has a print component; if so, leave it alone.
00180     if (pDocument->GetDocComponent(CC_RUNTIME_CLASS(PrintComponent)) != NULL)
00181         return TRUE;
00182 
00183     // No print component- try to create a new one for this document.
00184 
00185     // Firstly, create a new PrintControl object for the print component
00186     PrintControl *pPrCtrl = new PrintControl();
00187     if(pPrCtrl == NULL)
00188         return FALSE;
00189 
00190     // Ok - create the print component using this print control object.
00191     PrintComponent *pComponent = new PrintComponent(pPrCtrl);
00192     if (pComponent == NULL)
00193     {
00194         // Out of memory...
00195         delete pPrCtrl;
00196         return FALSE;
00197     }
00198 
00199     // All ok - add the component to the document.
00200     pDocument->AddDocComponent(pComponent);
00201 
00202     return TRUE;
00203 }

BOOL PrintComponentClass::Init void   )  [static]
 

Register the print document component with the main application.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/3/95
Returns:
TRUE if all went well; FALSE if not.

Errors: Out of memory.

See also:
DocComponent

Reimplemented from SimpleCCObject.

Definition at line 144 of file princomp.cpp.

00145 {
00146     // Instantiate a component class to register with the application.
00147     PrintComponentClass *pClass = new PrintComponentClass;
00148     if (pClass == NULL)
00149         return FALSE;
00150 
00151     // Register it
00152     GetApplication()->RegisterDocComponent(pClass);
00153 
00154     if (Camelot.DeclareSection(_T("Printing"),1))
00155         Camelot.DeclarePref(_T("Printing"), _T("AppPrintMethod"),   (INT32*)(&PrintControl::AppPrintMethod));
00156 
00157     // All ok
00158     return TRUE;
00159 }


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