Click here to Skip to main content
15,896,522 members
Articles / Web Development / HTML

Printing Framework

Rate me:
Please Sign up or sign in to vote.
3.77/5 (10 votes)
22 Nov 20032 min read 65.1K   3.3K   28  
Simple framework for text and graphic Printing/Previewing
// TextData.cpp: implementation of the CTextData class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "TextData.h"
#include "DataPrint.h"

namespace printer {

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif


//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CTextData::CTextData(LPCTSTR lpszLib, LPCTSTR lpszVal)
	: m_itemLib(lpszLib), m_itemVal(lpszVal)
{
}
 
CTextData::~CTextData()
{

}


//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

int
CTextData::GetNbLignes()
{
	return max( m_itemLib.GetNbLignes(), m_itemVal.GetNbLignes() );
}	

void
CTextData::Initialize(CDC* pDC, SDataPrint* pData)
{
	pDC -> SelectObject (&pData->fontNormal);
  m_itemLib.Initialize(pDC, pData->cxLIBELLE);
	pDC -> SelectObject (&pData->fontBold);
	m_itemVal.Initialize(pDC, pData->cxVALUE);
}	



void
CTextData::Output(int nSubElt, int nLine, CDC* pDC, SDataPrint* pData)
{
	pDC -> SelectObject (&pData->fontNormal);
	
	//  Afficher le libelle
	if (nSubElt<m_itemLib.GetNbLignes()) {
//		pDC->SetTextJustification(0,4);
		SDataPrint::LineOutput(pDC, pData->nLibelle, nLine, 	m_itemLib.GetSubLigne(nSubElt));
	}

	// Initialiser le contexte
	pDC -> SelectObject ( &pData->fontBold );

	// Afficher la valeur
	if (nSubElt<m_itemVal.GetNbLignes()) {
		SDataPrint::LineOutput(pDC, pData->nValue, nLine,m_itemVal.GetSubLigne(nSubElt));
	}

	// Restaurer le contexte
	pDC -> SelectObject (&pData->fontNormal );
}
	
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions