Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

CP_Document_Doc Class Reference

CP_Document class to handle the data from the main window and reading / writing contents.

List of all members.

Public Member Functions

Constructor / Destructor
 CP_Document_Doc (CPLAT::CP_ScriptableObject *inContainer, CPLAT::FourCharCode inDocType)
 Constructor.
virtual ~CP_Document_Doc () throw ()
Document UI
virtual void HandleCreateDocumentUI (SInt32 inPostCreateFlags=CP_E_Doc_Create_DoNothing)
File
virtual void HandleOpen (const CPLAT::CP_FileSystemSpec &inFileSpec)
virtual void WritePersistantData (CPLAT::CP_File &inFile, CPLAT::CP_PersistantWriter *inWriter)

Static Public Member Functions

Creator
static CPLAT::CP_Document_Base * DocumentCreator (CPLAT::CP_ScriptableObject *inContainer, CPLAT::FourCharCode inDocumentClass)

Protected Member Functions

Persistance
void CreateWriter (CPLAT::CP_PersistantWriter **inReturnWriter, CPLAT::FourCharCode inOSType)
virtual void GetFileTypeInfo (const CPLAT::CP_FileSystemSpec &inFileSpec, CPLAT::FourCharCode *inOutCreator, CPLAT::FourCharCode *inOutType, CPLAT::CP_String *inOutFileExtension)
Printing
virtual void HandlePrintCommand (CPLAT::OSStatus &inOutStatus, CPLAT::CP_CommandNo &inCommandNo)

Protected Attributes

CPLAT::CP_TextView * fTextView

Private Types

typedef CPLAT::CP_Document<
CPLAT::CP_UndoPolicy_None,
CPLAT::CP_PrintPolicy_Print > 
inherited

Private Member Functions

Slots
void TextFieldChanged (CPLAT::CP_DataValueHolder &inValue, CPLAT::OSStatus &inOutStatus)
void HandleSizeMenuCommand (CPLAT::OSStatus &inOutStatus, CPLAT::CP_CommandNo &inCommandNo)
void HandleStyleMenuCommand (CPLAT::OSStatus &inOutStatus, CPLAT::CP_CommandNo &inCommandNo)


Member Typedef Documentation

typedef CPLAT::CP_Document<CPLAT::CP_UndoPolicy_None, CPLAT::CP_PrintPolicy_Print> CP_Document_Doc::inherited [private]
 


Constructor & Destructor Documentation

CP_Document_Doc::CP_Document_Doc CPLAT::CP_ScriptableObject *  inContainer,
CPLAT::FourCharCode  inDocType
 

Constructor.

Parameters:
inContainer The scriptable object that serves as a container for this document. In this case it will be the application object.
inDocType The documents default file type.
Exceptions:
none 

CP_Document_Doc::~CP_Document_Doc  )  throw () [virtual]
 

Destructor.

Exceptions:
none 


Member Function Documentation

CPLAT::CP_Document_Base * CP_Document_Doc::DocumentCreator CPLAT::CP_ScriptableObject *  inContainer,
CPLAT::FourCharCode  inDocumentClass
[static]
 

Called when some action has requested we create a new document object. This is usually called from the CP_DocumentFactoryManager when it needs to create a new document.

Parameters:
inContainer The scriptable object that serves as a container for this document. In this case it will be the application object.
inDocumentClass The documents default file type.
Exceptions:
none 
Returns:
void

void CP_Document_Doc::HandleCreateDocumentUI SInt32  inPostCreateFlags = CP_E_Doc_Create_DoNothing  )  [virtual]
 

Called when the document wants to create the main user interface for the document. In this demo we create a window, with a CP_TextView in it.

Parameters:
inPostCreateFlags Flags passed to this call to indicate what type of action has caused this to be called. The types of actions are:
  • CP_E_Doc_Create_DoNothing
  • CP_E_Doc_Create_CreateUI
  • CP_E_Doc_Create_CreateUIOnNew
  • CP_E_Doc_Create_CreateUIOnOpen
Exceptions:
none 
Returns:
void

void CP_Document_Doc::HandleOpen const CPLAT::CP_FileSystemSpec &  inFileSpec  )  [virtual]
 

Called when the user has requested we open a new document. In this demo we will create a CP_File object to read in the data, and then set the contents of the view to the data from the file. In this demo, no attempt is made to verify that we are dealing with text data.

Parameters:
inFileSpec The CP_FileSystemSpec of the file that is being opened.
Exceptions:
none 
Returns:
void

void CP_Document_Doc::WritePersistantData CPLAT::CP_File &  inFile,
CPLAT::CP_PersistantWriter *  inWriter
[virtual]
 

Called from the persistant writer we created above to actualy write out the documents data. In this demo we write out the contents of the text view to the passed in file. No formatting or any other special information is written, just the plain text.

Parameters:
inFile The CP_File object that we are writing to. The file has already been opened for writing into.
inWriter The CP_PersistantWriter object that is handling this operation.
Exceptions:
none 
Returns:
void

void CP_Document_Doc::CreateWriter CPLAT::CP_PersistantWriter **  inReturnWriter,
CPLAT::FourCharCode  inOSType
[protected]
 

Called when the document is being saved. This will create a return a CP_PersistantWriter object that is used to save the actual data.

Parameters:
inReturnWriter Location to return the newly created persistant writer object to.
inOSType The OSType to determine the type of writer to create. In this demo, we only create a single type of writer. In other cases, you may need to create different persistant writers for different document types.
Exceptions:
none 
Returns:
void

void CP_Document_Doc::GetFileTypeInfo const CPLAT::CP_FileSystemSpec &  inFileSpec,
CPLAT::FourCharCode inOutCreator,
CPLAT::FourCharCode inOutType,
CPLAT::CP_String *  inOutFileExtension
[protected, virtual]
 

Called when we need to get the file type information for our documents file. In this demo, we supply the creator as the applications creator code, and the files extensio as 'txt' for a text file.

Parameters:
inFileSpec Not used.
inOutCreator Location to return the creator code in.
inOutType Location to return the type code in.
inOutFileExtension Location to return the file extension for this file.
Exceptions:
none 
Returns:
void

void CP_Document_Doc::HandlePrintCommand CPLAT::OSStatus &  inOutStatus,
CPLAT::CP_CommandNo inCommandNo
[protected, virtual]
 

Called when the user wants to print the contents of this document. In this demo, we just ask the text view object to handle the OS native printing provided by the text view.

Parameters:
inOutStatus Not used.
inCommandNo Not used.
Exceptions:
none 
Returns:
void

void CP_Document_Doc::TextFieldChanged CPLAT::CP_DataValueHolder &  inValue,
CPLAT::OSStatus &  inOutStatus
[private]
 

Slot called when the contents of the text view have changed. We use this opportunity to mark the document as being dirty, and needing to be saved.

Parameters:
inValue Not used.
inOutStatus Not used.
Exceptions:
none 
Returns:
void

void CP_Document_Doc::HandleSizeMenuCommand CPLAT::OSStatus &  inOutStatus,
CPLAT::CP_CommandNo inCommandNo
[private]
 

Call when the user selects a size from the size menu

Returns:
inOutStatus Not used.

inCommandNo The command number associated with the selected item.

Exceptions:
none 
Returns:
void

void CP_Document_Doc::HandleStyleMenuCommand CPLAT::OSStatus &  inOutStatus,
CPLAT::CP_CommandNo inCommandNo
[private]
 

Call when the user selects a style from the size menu

Returns:
inOutStatus Not used.

inCommandNo The command number associated with the selected item.

Exceptions:
none 
Returns:
void


Member Data Documentation

CPLAT::CP_TextView* CP_Document_Doc::fTextView [protected]
 


The documentation for this class was generated from the following files:
Generated on Tue Sep 20 20:23:20 2005 for CPLAT_MacOS by  doxygen 1.4.0