LDocument is a PowerPlant class that is used for opening, saving, closing, reverting, and printing a document. LDocument is an abstract class which provides a framework for supporting standard document operations via AppleEvents.
Methods :
The methods in this class are:
Data Members:
The data members in this class are:
Operation:
You probably won't need to override all of these methods in a normal application, as many of them are complete.
Methods related to saving, reverting, and printing a document are empty, and need to be overrided.
Source files:
Ancestors:
Purpose:
The constructors create objects from the passed-in parameters.
Access:
Prototype:
LDocument();
LDocument( LCommander *inSuper );Parameters:
The parameter for these constructors is:
Purpose:
The destructor destroys the object.
Access:
Prototype:
virtual ~LDocument();
Purpose:
Ask the user to save a Document and give it a name.
Access:
Prototype:
virtual Boolean AskSaveAs(Parameters:
FSSpec &outFSSpec,
Boolean inRecordIt );
The parameters for this method are:
Return:
Returns false if the user cancels the operation, else it returns true.
Purpose:
Attempt to close a document. The Document might not close if it is modified and the user cancels the operation when asked whether to save the changes.
Access:
Prototype:
virtual void AttemptClose( Boolean inRecordIt );Parameters:
The parameter for this method is:
Return:
Purpose:
Try to close a Document when quitting the program.
Access:
Prototype:
virtual Boolean AttemptQuitSelf(Parameters:
SInt32 inSaveOption );
The parameter for this method is:
Return:
Return false if the user cancels when asked whether to save changes to a modified
Document.
Purpose:
Access:
Prototype:
virtual void Close();Parameters:
Return:
Purpose:
Close a document in response to a close AppleEvent.
Access:
Prototype:
virtual void DoAEClose(Parameters:
const AppleEvent &inCloseAE );
The parameter for this method is:
Return:
Purpose:
Save a Document in a particular file. This is equivalent to a "Save As" operation.
Subclasses should override this function to save the file, and
should set mIsSpecified to true.
Access:
Prototype:
virtual void DoAESave(Parameters:
FSSpec& inFileSpec,
OSType inFileType );
The parameters for this method are:
Return:
Purpose:
Access:
Prototype:
virtual void DoPrint();Parameters:
Return:
Purpose:
Revert a document to its last saved version.
Access:
Prototype:
virtual void DoRevert();Parameters:
Return:
Purpose:
Save a Document, which must already be specified. Subclasses should override this method to save a document to an existing file.
Access:
Prototype:
virtual void DoSave();Parameters:
Return:
Purpose:
Return the document that uses the specified FSSpec.
Access:
Prototype:
static LDocument* FindByFileSpec(Parameters:
const FSSpec &inFileSpec );
The parameters for this method are:
Return:
A pointer to the LDocument that corresponds to the file we're interesting in.
Purpose:
Return whether a command is enabled and/or marked in a Menu. This method is an override of FindCommandStatus() in LCommander.
Purpose:
Return the document with the specified name.
Access:
Prototype:
static LDocument* FindNamedDocument(Parameters:
ConstStringPtr inName );
The parameter for this method is:
Return:
A pointer to the LDocument we are interested in, or nil if not found.
Purpose:
This method returns an AppleEvent property.
Access:
Prototype:
virtual void GetAEProperty(Parameters:
DescType inProperty,
const AEDesc &inRequestedType,
AEDesc &outPropertyDesc ) const;
The parameters for this method are:
Return:
Purpose:
This method is a pure virtual method that must be implemented in your subclass. It returns the AppleEvent descriptor.
Access:
Prototype:
virtual StringPtr GetDescriptor(Parameters:
Str255 outDescriptor ) const = 0;
The parameter for this method is:
Return:
A StringPtr to the descriptor string.
Purpose:
Returns the value of the sDocumentList data member.
Access:
Prototype:
static TArray<LDocument*>& GetDocumentList();Parameters:
Return:
Returns the value of the sDocumentList.
Purpose:
This method handles an AppleEvent.
Access:
Prototype:
virtual void HandleAppleEvent(Parameters:
const AppleEvent &inAppleEvent,
AppleEvent &outAEReply,
AEDesc &outResult,
long inAENumber );
The parameters for this method are:
Return:
Purpose:
Return whether a document has been modified since it was last saved.
Access:
Prototype:
virtual Boolean IsModified();Parameters:
Return:
Purpose:
Make this Document the current one. You should override this method to do what makes sense for a particular kind of document. In most cases, this means selecting the main window for a document.
Access:
Prototype:
virtual void MakeCurrent();Parameters:
Return:
Purpose:
AppleEvent Object Model Support
Access:
Prototype:
virtual void MakeSelfSpecifier(Parameters:
AEDesc &inSuperSpecifier,
AEDesc &outSelfSpecifier ) const;
The parameters for this method are:
Return:
Purpose:
Access:
Prototype:
virtual Boolean ObeyCommand( CommandT inCommand,Parameters:
void *ioParam );
The parameters for this method are:
Return:
Return true if the command was handled, else return false.
Purpose:
Access:
Prototype:
virtual void SendAEClose(Parameters:
SInt32 inSaveOption,
FSSpec &inFileSpec,
Boolean inExecute );
The parameters for this method are:
Return:
Purpose:
Access:
Prototype:
virtual void SendAESaveAs(Parameters:
FSSpec &inFileSpec,
OSType inFileType,
Boolean inExecute );
The parameters for this method are:
Return:
Purpose:
Specify whether a document has been modified since it was last saved.
Access:
Prototype:
virtual void SetModified( Boolean inModified );Parameters:
The parameter for this method is:
|
Return:
Purpose:
Return whether the Document has a file that uses the specified
FSSpec.
Access:
Prototype:
virtual Boolean UsesFileSpec(Parameters:
const FSSpec& inFileSpec) const;
The parameter for this method is:
Return:
Return true if the document has a file with the FSSpec, else return false.
Purpose:
The static document list of pointers to LDocument objects.
Access:
Prototype:
static TArray<LDocument*> sDocumentList;
Purpose:
The handle to the print record.
Access:
Prototype:
THPrint mPrintRecordH;
Purpose:
Indicates whether a document is modified (dirty) or not.
Access:
Prototype:
Boolean mIsModified;
Purpose:
Indicates whether a document has the specified information to save without interacting with the user first.
Access:
Prototype:
Boolean mIsSpecified;