home *** CD-ROM | disk | FTP | other *** search
- /*
- File: Document.h
-
- Contains: An abstract base class for a document.
- (NOTE: It isn’t finished yet!)
-
- Written by: Dave Falkenburg
-
- Copyright: © 1994-95 by Dave Falkenburg, all rights reserved.
-
- Change History (most recent first):
-
- <1> 1/24/95 DRF First checked in.
- */
-
- #ifndef _DOCUMENTWINDOW_
- #define _DOCUMENTWINDOW_
-
- #include <GXPrinting.h>
-
- #include "File.h"
- #include "Window.h"
-
- class TDocumentWindow : public TWindow
- {
- protected:
- // TDocument cannot be directly instantiated, you must override it
- TDocumentWindow(FSSpecPtr theContainer = NULL);
-
- public:
- virtual ~TDocumentWindow();
-
- // ---------------- METHODS WHICH MUST BE OVERRIDDEN ---------------
-
- // Document specific methods which must be overridden.
-
-
- virtual void DrawCurrentPage(void);
-
- virtual OSErr WriteDocumentDataFork(void) = 0;
- virtual OSErr WriteDocumentResourceFork(void) = 0;
-
- // ---------------- METHODS WHICH MAY BE OVERRIDDEN ----------------
-
- virtual void Activate(Boolean activating);
-
-
- // Menu command handler: You override this method to handle any
- // content-specific commands. Call through this inherited method
- // for handling default things like closing, saving, and printing.
-
- virtual Boolean DoCommand(CommandID theCommand);
-
- // Some default actions we can perform on the document
-
- virtual Boolean CanClose(Boolean quitting);
- virtual Boolean Close(void);
- virtual Boolean DeleteAfterClose(void);
-
- virtual OSErr Save(void); /* = 0 */
- virtual OSErr SaveAs(void); /* = 0 */
- virtual OSErr Revert(void); /* = 0 */
-
- virtual void PageSetup(Boolean useCustomPageSetup);
- virtual OSErr Print(Boolean usePrintJobDialog);
-
- virtual OSErr QDPrintLoop(void);
- virtual OSErr GXPrintLoop(void);
-
-
-
- protected:
-
- TFile* fBackingFile;
- TFile* fTemporaryFile;
-
- gxJob fPrintJob;
- THPrint fPrintRecord;
- TDynamicArray* fPageFormats; // stored type is a gxFormat
-
- Boolean fDirty;
- Boolean fHasBeenSaved;
- Boolean fHasNewEditions;
- Boolean fCanPrint;
-
- Str255 fDocumentName;
- Str255 fDocumentKind;
-
- long fNumOfPages;
- long fCurrentPage;
-
-
- public:
- static Boolean CloseAllDocuments(Boolean quitting);
-
- private:
- static TDynamicArray fgActiveDocuments;
- };
-
-
- typedef struct GXPrintData
- {
- gxRectangle pageArea; // the Page rectangle
- gxViewPort printViewPort; // the ViewPort we're printing with
- } GXPrintData, *GXPrintDataPtr;
-
-
-
- #endif
-