// SAPrint.h — StandAlone Print class header file

// Class used to print simple documents when Document/View architecture not available.

#ifndef SAPrint_H
#define SAPrint_H

class SAPrint {

public:

    enum { DEFAULT_MAX_LINE = 80, PIXELS_PER_INCH = 72 };

// public interface

SAPrint(const CString& sDocName = "Report", const CString& sFaceName = "",
const UINT nLinesTotal = 0, const UINT nMaxLineSize = DEFAULT_MAX_LINE);
virtual ~SAPrint();
virtual BOOL StartPage(void); // used to indicate start of page
virtual BOOL PrintLine(const CString& sLine); // print line of text
virtual BOOL EndPage(void); // used to indicate end of page
virtual void DeleteDoc(void); // delete document without printing
virtual UINT GetLinesPerPg(void) const;
virtual UINT GetPageNo(void) const; // page # of last printed line
virtual UINT GetPageNoNext(void) const; // page # of next line to be printed
virtual UINT GetLineNo(void) const; // line # of last printed line
virtual UINT GetLineNoNext(void) const; // line # of next line to be printed
virtual UINT GetMaxPageNo(void) const; // get max page # (0 means no maximum)
virtual CString GetFaceName(void) const; // get face name of current font
virtual UINT SetMaxPageNo(UINT nMaxPage); // set maximum page # (0 means no max)
virtual BOOL SetFaceName(const CString& sFaceName);// set face name of font

#ifdef _DEBUG

virtual BOOL Test(const CString& sTitle, const UINT nLinesTotal); // test only

#endif

protected:

// state of each object
BOOL m_bConstructed; // TRUE if completed construction
BOOL m_bDelDoc; // TRUE if deleting document without printing it
BOOL m_bPageStarted; // TRUE if page started
BOOL m_bDocStarted; // TRUE if document started
// structures that will be needed at some stage
CDC *m_pDC;
CFont *m_pFont;
CString m_sDocName;
CString m_sFaceName;
int m_iPrintJobNo;
UINT m_nLinesTotal;
UINT m_nMaxPageNo;
UINT m_nMaxLineSize;
UINT m_nLinesPerPage;
UINT m_nPageNo;
UINT m_nLineNo;
// unless otherwise specified, all units are in printer pixels
UINT m_cy; // distance down the page
UINT m_cxOffset; // left margin offset
UINT m_cxWidth; // width of line from left margin
UINT m_nVMax; // Maximum height of page
UINT m_nHMax; // Maximum width of page
int m_iHeight; // height of each line, based on font

private:

void CleanUp(BOOL bEndDoc);
// do not allow assignment or copying of instances of SAPrint
SAPrint(const SAPrint&);
operator=(const SAPrint&);

};

#endif