#include <princomp.h>
Inheritance diagram for PrintComponentClass:
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. |
Definition at line 125 of file princomp.h.
|
Add a print component to the specified document.
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 }
|
|
Register the print document component with the main application.
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 }
|