PrintBaseTab Class Reference

Allows the user to set any options which are associated with general document printing. More...

#include <optsprin.h>

Inheritance diagram for PrintBaseTab:

OptionsTabs ListItem CCObject SimpleCCObject PrintGeneralTab PrintImagesetterTab PrintLayoutTab PrintSepsTab List of all members.

Public Member Functions

 PrintBaseTab ()
 PrintBaseTab constructor.
 ~PrintBaseTab ()
 PrintBaseTab destructor.
virtual BOOL InitSection ()
 Sets initial values for the print general section of the options dialog box.
virtual BOOL HandleMsg (DialogMsg *Msg)
 Handles any print options tabs messages that the derived class is not interested in handlign themselves. Should be called by the derived class for any events they don't handle.
virtual BOOL GreySection ()
 Called when the user has closed all documents.
virtual BOOL UngreySection ()
 Called when the user has selected a new document.
virtual BOOL UpdateSection (String_256 *DocumentName)
 Called when we have switched to a new document and need to update all the controls on this tab. Should only init the tab if the page is present.
virtual BOOL PageSizeHasChanged ()
 Allows a tab to update any page size items being displayed.
virtual BOOL IsDocumentOption ()
 Allows the document options dialog code to determine if this tab belongs to the group of document options.
virtual BOOL IsProgramOption ()
 Allows the program options dialog code to determine if this tab belongs to the group of program options.
virtual BOOL IsPrintingOption ()
 Allows the printing options dialog code to determine if this tab belongs to the group of printing options.
BOOL IsAllGreyed ()
void PrintSettingsChanged ()
 Called by AppPrefsDlg::Message() when it received a PrintMsg::SETTINGSCHANGED message.

Static Public Member Functions

static void DocumentSettingsUpdated (void)
 Copies the current document print control into our locl print control copy Called by the AppPrefs base dialogue when we soft-commit with the Apply button.

Protected Member Functions

void CopyLocalPrintControlFromDoc (void)
 Copies the current document print control into our locl print control copy (i.e. copies the current document configuration into our local copy, either initialising the values that the dialogue should be using, or effectively "cancelling" any user changes made in the dialogue. Note that you'll have to call updatesection to update the dialogue to use the new settings.
void CopyLocalPrintControlToDoc (void)
 Copies our local print control copy into the current document (i.e. commits the local dialogue values into the document).
virtual BOOL CommitSection ()
 Commits values from the print dialogue tabs to the document. Should be called by all derived classes.
PrintControlGetPrintControl ()
 Access function to the doc's print control object.
void EnableControl (CGadgetID Gadget, BOOL Enabled)
 This will enable the gadget given if Enabled is TRUE AND AllGreyed is FALSE, i.e. it is a central control-greying func that takes the AllGreyed state of the tab into account.
BOOL TalkToPage ()
 This calls pPrefsDlg->TalkToPage() with the ID returned from GetPageID().
virtual BOOL EnableControls ()=0
virtual BOOL ShowDetails ()=0

Static Protected Attributes

static PrintControl LocalPrintControl
static DocumentpLastPrintControlDocument = NULL

Private Member Functions

void UpdateDocName ()
 This displays the doc name returned from GetDocumentName() in the tab If it can't do it for some reason (i.e. NULL dlg ptr) it just returns.

Private Attributes

BOOL AllGreyed

Friends

class SepsDlg

Detailed Description

Allows the user to set any options which are associated with general document printing.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/3/95
See also:
OptionsTabs; AppPrefsDlg; DocPrefsDlg;

Definition at line 126 of file optsprin.h.


Constructor & Destructor Documentation

PrintBaseTab::PrintBaseTab  ) 
 

PrintBaseTab constructor.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/4/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 203 of file optsprin.cpp.

00204 {   
00205 }        

PrintBaseTab::~PrintBaseTab  ) 
 

PrintBaseTab destructor.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/4/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 225 of file optsprin.cpp.

00226 {   
00227     // Vape the cached print control info
00228     pLastPrintControlDocument = NULL;
00229 
00230     // Clear out the entire print control to sensible defaults. This includes wiping the
00231     // plate list, which ensures there are no IndexedColours left "in use" when we exit
00232     PrintControl BlankPC;
00233     LocalPrintControl = BlankPC;
00234 }        


Member Function Documentation

BOOL PrintBaseTab::CommitSection  )  [protected, virtual]
 

Commits values from the print dialogue tabs to the document. Should be called by all derived classes.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/9/96
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
True if values in dialog box ok, False otherwise.

Errors: -

See also:
-

Implements OptionsTabs.

Reimplemented in PrintGeneralTab, PrintLayoutTab, PrintSepsTab, and PrintImagesetterTab.

Definition at line 830 of file optsprin.cpp.

00831 {
00832     if (!IsAllGreyed() && pDocument != NULL)
00833         CopyLocalPrintControlToDoc();
00834 
00835     pLastPrintControlDocument = NULL;
00836 
00837     return(TRUE);
00838 }

void PrintBaseTab::CopyLocalPrintControlFromDoc void   )  [protected]
 

Copies the current document print control into our locl print control copy (i.e. copies the current document configuration into our local copy, either initialising the values that the dialogue should be using, or effectively "cancelling" any user changes made in the dialogue. Note that you'll have to call updatesection to update the dialogue to use the new settings.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/9/96
The print tabs all work *exclusively* on the copy, and then the base tab will update the real document print control from the local one as appropriate when the dialogue values are committed.

Notes: This caches the print control information for the options dialogue document. Subsequent calls don't bother doing anything, on the grounds that due to the random times at which our tabs are initialised, they can try to copy the doc information into the local control when doing so will overwrite changed but non-committed values for this document. (e.g. without this caching lock on it, clicking the "do separations" button doesn't auto-update the "output printers marks" option in the other tab until you've "seen" that tab!

Definition at line 536 of file optsprin.cpp.

00537 {
00538     // If cached for this document, don't copy it again, because this could lose settings
00539     // which have been changed in the dialogue but not yet committed.
00540     if (pLastPrintControlDocument == pDocument)
00541         return;
00542 
00543     PrintControl *PrintCtrl = GetPrintControl();
00544     if (PrintCtrl != NULL)
00545     {
00546         LocalPrintControl = *PrintCtrl;
00547         LocalPrintControl.SetUp(pDocument->GetSelectedSpread());
00548 
00549         pLastPrintControlDocument = pDocument;
00550     }
00551 }

void PrintBaseTab::CopyLocalPrintControlToDoc void   )  [protected]
 

Copies our local print control copy into the current document (i.e. commits the local dialogue values into the document).

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/9/96
The print tabs all work *exclusively* on the copy, and then the base tab will update the real document print control from the local one as appropriate when the dialogue values are committed.

Definition at line 604 of file optsprin.cpp.

00605 {
00606     PrintControl *PrintCtrl = GetPrintControl();
00607     if (PrintCtrl != NULL)
00608     {
00609         *PrintCtrl = LocalPrintControl;
00610         if (pDocument)                      // If we have just changed document settings
00611             pDocument->SetModified(TRUE);   // Then mark the document modified!!!
00612     }
00613 }

void PrintBaseTab::DocumentSettingsUpdated void   )  [static]
 

Copies the current document print control into our locl print control copy Called by the AppPrefs base dialogue when we soft-commit with the Apply button.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/9/96

Definition at line 566 of file optsprin.cpp.

00567 {
00568     Document *pDoc = Document::GetSelected();
00569     if (pDoc != NULL)
00570     {
00571         PrintComponent* pPrComp = (PrintComponent*)pDoc->GetDocComponent(CC_RUNTIME_CLASS(PrintComponent));
00572         if (pPrComp != NULL)    
00573         {
00574             PrintControl* pPrCtrl = pPrComp->GetPrintControl();
00575             if (pPrCtrl != NULL)
00576             {
00577                 LocalPrintControl = *pPrCtrl;
00578                 LocalPrintControl.SetUp(pDoc->GetSelectedSpread());
00579 
00580                 pLastPrintControlDocument = pDoc;
00581             }
00582         }
00583     }
00584 }

void PrintBaseTab::EnableControl CGadgetID  Gadget,
BOOL  Enabled
[protected]
 

This will enable the gadget given if Enabled is TRUE AND AllGreyed is FALSE, i.e. it is a central control-greying func that takes the AllGreyed state of the tab into account.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/3/95
Parameters:
Gadget = gadget ID [INPUTS] Enabled = TRUE to enable, FALSE to disable gadget
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 701 of file optsprin.cpp.

00702 {
00703 
00704 // Code to comment out non-functional aspects of the print dlg (18/4/95)
00705 /*
00706 if (Gadget != _R(IDC_GROUP_PRINTMETHOD) &&
00707     Gadget != _R(IDC_PRINTMETHOD_NORMAL) &&
00708     Gadget != _R(IDC_PRINTMETHOD_BITMAP) &&
00709     Gadget != _R(IDC_PRINTMETHOD_AABITMAP) &&
00710 
00711     Gadget != _R(IDC_GROUP_DPI) &&
00712     Gadget != _R(IDC_DPIAUTO) &&
00713     Gadget != _R(IDC_DPIMANUAL) &&
00714     Gadget != _R(IDC_DPIEDIT) &&
00715     Gadget != _R(IDC_DPIEDITTEXT))
00716 {
00717     Enabled = FALSE;
00718 }
00719 */
00720     if (pPrefsDlg != NULL)
00721         pPrefsDlg->EnableGadget(Gadget,Enabled && !AllGreyed);
00722 }

virtual BOOL PrintBaseTab::EnableControls  )  [protected, pure virtual]
 

Implemented in PrintGeneralTab, PrintLayoutTab, PrintSepsTab, and PrintImagesetterTab.

PrintControl * PrintBaseTab::GetPrintControl  )  [protected]
 

Access function to the doc's print control object.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/4/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Ptr to the associated doc's print control object or NULL if it fails
This has to find the doc's print component and ask it for the print control object
Returns:
Errors: -
See also:
-

Definition at line 489 of file optsprin.cpp.

00490 {
00491     // Return NULL if we don't have a document ptr
00492     if (pDocument == NULL)
00493         return NULL;
00494 
00495     // Find the doc's print component
00496     PrintComponent* pPrComp = (PrintComponent*)pDocument->GetDocComponent(CC_RUNTIME_CLASS(PrintComponent));
00497     ERROR2IF(pPrComp == NULL,NULL,"Can't find the associated doc's print component");
00498 
00499     // Find a ptr to the print component's print control object
00500     PrintControl* pPrCtrl = pPrComp->GetPrintControl();
00501     ERROR2IF(pPrCtrl == NULL,NULL,"The doc's print component gave me a NULL print control object");
00502 
00503     return pPrCtrl;
00504 }

BOOL PrintBaseTab::GreySection  )  [virtual]
 

Called when the user has closed all documents.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/4/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
PrintBaseTab::UngreySection;

Reimplemented from OptionsTabs.

Reimplemented in PrintSepsTab, and PrintImagesetterTab.

Definition at line 371 of file optsprin.cpp.

00372 {
00373     ERROR2IF(pPrefsDlg == NULL,FALSE,"PrintBaseTab::GreySection called with no dialog pointer");
00374 
00375     // Vape the cached print control info
00376     pLastPrintControlDocument = NULL;
00377 
00378     // Clear out the entire print control to sensible defaults. This includes wiping the
00379     // plate list, which ensures there are no IndexedColours left "in use" when we exit
00380     PrintControl BlankPC;
00381     LocalPrintControl = BlankPC;
00382 
00383     if (TalkToPage())
00384     {
00385         // Make sure the information field displaying the name of the current document
00386         // is correct.
00387         UpdateDocName();
00388 
00389         AllGreyed = TRUE;
00390         EnableControls();   // Call our central greying/ungreying function
00391     }
00392 
00393     return TRUE;
00394 } 

BOOL PrintBaseTab::HandleMsg DialogMsg Msg  )  [virtual]
 

Handles any print options tabs messages that the derived class is not interested in handlign themselves. Should be called by the derived class for any events they don't handle.

Author:
Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/9/96
Parameters:
Msg - The dialogue message to be handled [INPUTS]
Returns:
TRUE
Currently handles: DIM_CREATE - Calls InitSection() and then ShowDetails()

DIM_CANCEL - vapes the cached PrintControl info, so that cancel really does cancel!

Implements OptionsTabs.

Reimplemented in PrintGeneralTab, PrintLayoutTab, PrintSepsTab, and PrintImagesetterTab.

Definition at line 773 of file optsprin.cpp.

00774 {
00775     ERROR2IF(Msg == NULL,FALSE,"PrintGeneralTab::Message null message received");
00776     ERROR2IF(pPrefsDlg == NULL,FALSE,"PrintGeneralTab::HandleMsg called with no dialog pointer");
00777 
00778     BOOL ok = TalkToPage(); // The print general tab identifier
00779     if (!ok)
00780         return TRUE;        // page not present
00781 
00782     switch(Msg->DlgMsg)
00783     {
00784         case DIM_CREATE:    // Initialise controls
00785             ok = InitSection();
00786             if (!ok)
00787                 InformError();
00788             else
00789                 ShowDetails();  // The base class InitSection() no longer does this by default
00790             break;
00791 
00792 
00793         case DIM_CANCEL:
00794         {
00795             // Vape the cached print control info
00796             pLastPrintControlDocument = NULL;
00797 
00798             // Clear out the entire print control to sensible defaults. This includes wiping the
00799             // plate list, which ensures there are no IndexedColours left "in use" when we exit
00800             PrintControl BlankPC;
00801             LocalPrintControl = BlankPC;
00802             break;
00803         }
00804 
00805         default:
00806             break;
00807     }
00808 
00809     return TRUE;
00810 }  

BOOL PrintBaseTab::InitSection  )  [virtual]
 

Sets initial values for the print general section of the options dialog box.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/4/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, else FALSE

Errors: -

See also:
AppPrefsDlg; OptionsTabs;

Implements OptionsTabs.

Reimplemented in PrintLayoutTab, PrintSepsTab, and PrintImagesetterTab.

Definition at line 631 of file optsprin.cpp.

00632 {
00633     ERROR2IF(pPrefsDlg == NULL,FALSE,"PrintBaseTab::InitSection called with no dialog pointer");
00634 
00635     if (pDocument == NULL)
00636         return GreySection();
00637 
00638     AllGreyed = FALSE;  // we are ungreyed by default
00639 
00640     // Make sure the information field displaying the name of the current document
00641     // is correct.
00642     UpdateDocName();
00643 
00644     // Copy the doc's print control data into our local copy
00645     CopyLocalPrintControlFromDoc();
00646 
00647     if (!TalkToPage())
00648         return TRUE;    // Just return if TalkToPage() fails
00649 
00650     // Display the print data in our tab
00651     //return ShowDetails(); // I've commented this out as it should be done in the actual tab's init function - Adrian 
00652     return TRUE;
00653 }

BOOL PrintBaseTab::IsAllGreyed  )  [inline]
 

Definition at line 150 of file optsprin.h.

00150 { return AllGreyed; }

BOOL PrintBaseTab::IsDocumentOption  )  [virtual]
 

Allows the document options dialog code to determine if this tab belongs to the group of document options.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/4/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Returns True if this tab is a document option.

Errors: -

See also:
IsProgramOption();

Implements OptionsTabs.

Definition at line 254 of file optsprin.cpp.

00255 {
00256     return FALSE;   // This tab is not a document option. Changed from True 3/3/97.
00257 }

BOOL PrintBaseTab::IsPrintingOption  )  [virtual]
 

Allows the printing options dialog code to determine if this tab belongs to the group of printing options.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/4/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Returns True if this tab is a printing option.

Errors: -

See also:
IsProgramOption();

Reimplemented from OptionsTabs.

Definition at line 300 of file optsprin.cpp.

00301 {
00302     return TRUE;    // This tab is a printing option 
00303 }

BOOL PrintBaseTab::IsProgramOption  )  [virtual]
 

Allows the program options dialog code to determine if this tab belongs to the group of program options.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/4/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Returns True if this tab is a program option.

Errors: -

See also:
IsProgramOption();

Implements OptionsTabs.

Definition at line 277 of file optsprin.cpp.

00278 {
00279     return FALSE;   // This tab is not a program option. Changed from True 3/3/97.
00280 }

BOOL PrintBaseTab::PageSizeHasChanged  )  [virtual]
 

Allows a tab to update any page size items being displayed.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/4/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
True if handled ok, False if not.

Errors: -

See also:
-

Reimplemented from OptionsTabs.

Definition at line 672 of file optsprin.cpp.

00673 {
00674     // Sent when the page size has been changed
00675     LocalPrintControl.SetUp(pDocument->GetSelectedSpread());
00676 
00677     if (!TalkToPage())
00678         return TRUE;    // Just return if TalkToPage() fails
00679 
00680     return ShowDetails();
00681 }

void PrintBaseTab::PrintSettingsChanged  ) 
 

Called by AppPrefsDlg::Message() when it received a PrintMsg::SETTINGSCHANGED message.

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

Errors: -

See also:
-

Definition at line 739 of file optsprin.cpp.

00740 {
00741     if (IsAllGreyed())
00742         return;
00743 
00744     // Set up the print again so that it takes the new settings on board
00745     LocalPrintControl.SetUp(pDocument->GetSelectedSpread());
00746 
00747     if (TalkToPage())
00748         ShowDetails();
00749 }

virtual BOOL PrintBaseTab::ShowDetails  )  [protected, pure virtual]
 

Implemented in PrintGeneralTab, PrintLayoutTab, PrintSepsTab, and PrintImagesetterTab.

BOOL PrintBaseTab::TalkToPage  )  [protected]
 

This calls pPrefsDlg->TalkToPage() with the ID returned from GetPageID().

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/4/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, FALSE otherwise

Errors: -

See also:
-

Definition at line 322 of file optsprin.cpp.

00323 {
00324     if (pPrefsDlg != NULL)
00325         return (pPrefsDlg->TalkToPage(GetPageID()));
00326 
00327     return FALSE;
00328 }

BOOL PrintBaseTab::UngreySection  )  [virtual]
 

Called when the user has selected a new document.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/4/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
PrintBaseTab::UngreySection;

Reimplemented from OptionsTabs.

Reimplemented in PrintSepsTab, and PrintImagesetterTab.

Definition at line 413 of file optsprin.cpp.

00414 {
00415     ERROR2IF(pPrefsDlg == NULL,FALSE,"PrintBaseTab::UngreySection called with no dialog pointer");
00416 
00417     // Vape the cached print control info
00418     pLastPrintControlDocument = NULL;
00419  
00420     // Clear out the entire print control to sensible defaults. This includes wiping the
00421     // plate list, which ensures there are no IndexedColours left "in use" when we exit
00422     PrintControl BlankPC;
00423     LocalPrintControl = BlankPC;
00424 
00425     if (TalkToPage())
00426     {
00427         // Make sure the information field displaying the name of the current document
00428         // is correct.
00429         UpdateDocName();
00430 
00431         AllGreyed = FALSE;
00432 
00433         ShowDetails();      // Make sure all details have been updated to show the new document
00434         EnableControls();   // Call our central greying/ungreying function
00435     }
00436 
00437     return TRUE;
00438 }

void PrintBaseTab::UpdateDocName  )  [private]
 

This displays the doc name returned from GetDocumentName() in the tab If it can't do it for some reason (i.e. NULL dlg ptr) it just returns.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/4/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 348 of file optsprin.cpp.

00349 {
00350     if (pPrefsDlg != NULL && TalkToPage())
00351         pPrefsDlg->SetStringGadgetValue(_R(IDC_PRINT_DOCNAME),*GetDocumentName());
00352 }

BOOL PrintBaseTab::UpdateSection String_256 DocumentName  )  [virtual]
 

Called when we have switched to a new document and need to update all the controls on this tab. Should only init the tab if the page is present.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/4/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
PrintBaseTab::GreySection; PrintBaseTab::UngreySection; PrintBaseTab::InitSection;

Reimplemented from OptionsTabs.

Reimplemented in PrintSepsTab, and PrintImagesetterTab.

Definition at line 458 of file optsprin.cpp.

00459 {
00460     ERROR2IF(pPrefsDlg == NULL,FALSE,"PrintBaseTab::UpdateSection called with no dialog pointer");
00461 
00462     if (!TalkToPage())
00463         return TRUE;    // Just return if TalkToPage() fails
00464 
00465     // Call the normal init section code
00466     return InitSection();
00467 }


Friends And Related Function Documentation

friend class SepsDlg [friend]
 

Definition at line 185 of file optsprin.h.


Member Data Documentation

BOOL PrintBaseTab::AllGreyed [private]
 

Definition at line 183 of file optsprin.h.

PrintControl PrintBaseTab::LocalPrintControl [static, protected]
 

Definition at line 178 of file optsprin.h.

Document * PrintBaseTab::pLastPrintControlDocument = NULL [static, protected]
 

Definition at line 179 of file optsprin.h.


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