You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mitlib.pub/MITLIB/GuiDLL/LPrint.h

71 lines
3.4 KiB
C++

// Start =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// General information section.
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// $Author:yongkiang$ User who last changed the file
// $Date:1/2/2013 12:16:33 PM$ Date and time of last check in
// $Revision:1.0$ Visual SourceSafe version number
// $Workfile:: LPrint.h $ Filename
// End =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// ListCtrlPrint.h: interface for the CListCtrlPrint class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_LISTCTRLPRINT_H__E1B3DDE2_9D53_11D1_8BAC_0000B43382FE__INCLUDED_)
#define AFX_LISTCTRLPRINT_H__E1B3DDE2_9D53_11D1_8BAC_0000B43382FE__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "PrintJob.h"
#ifdef BUILD_GUIDLL
#define DLLCLASS __declspec(dllexport)
#else
#define DLLCLASS __declspec(dllimport)
#endif
class DLLCLASS CListCtrlPrint : public CPrinterJob
{
public:
void Print(CListCtrl *List, CString csReportType = "NULL", CString csPackageName = "NULL", bool bUseDefaultPrint = false, bool* bPrinted = NULL);
CListCtrlPrint();
virtual ~CListCtrlPrint();
CRect rcMarginMM; // contain the margins in millimeters
CFont ftPrint, ftHead, ftFoot; // fonts used for printing
CSize szFtPrint, szFtHead, szFtFoot; // sizes of fonts (in device unit)
int *pDx, *pFormat; // datas about column size and format (center, right ..)
char ** pColTitle; // columns titles
int iItemXPage, iNumCol, iTotItem; // number of item in page, of columns and of tot number of items in list control
CListCtrl * pList; // pointer of the list ctrl
CString csPageHead; // text of header
CString csPageFooter; // text of footer
CString csPage; // format of page number / tot pages (ex. page %d of %d)
CString csFtHead, csFtFoot, csFtPrint; // fonts type names
int iFtHead, iFtFoot, iFtPrint; // fonts sizes
CSize szFoot; // internal use
// this subtracts the margins from the page size
void SubtractMargin(CDC * pDC, CRect &rc);
// virtual overridden from base class; same meaning of CView's one
void OnBeginPrinting(CDC * pDC, CPrintInfo * pInfo);
void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
bool OnPreparePrinting(CPrintInfo* pInfo, bool bUseDefaultPrint = false, bool bPrintPreview = false);
void OnPrint(CDC* pDC, CPrintInfo* pInfo);
// function self explicative; the items will be printed in the OnPrint function
// if bCalc is true, the function is called to compute the space for items and so
// no printing is needed, but only to return the size used and to subtract from the
// rcpage the space used
CSize PrintListFoot(CDC * pDC, CRect & rcPage, bool bCalc);
CSize PrintListHead(CDC * pDC, CRect & rcPage, bool bCalc);
CSize PrintPageFoot(CDC * pDC, CRect & rcPage, bool bCalc);
CSize PrintPageHead(CDC * pDC, CRect & rcPage, const int nPage, const int iMaxPage, bool bCalc);
};
#endif // !defined(AFX_LISTCTRLPRINT_H__E1B3DDE2_9D53_11D1_8BAC_0000B43382FE__INCLUDED_)