Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

MFC Extension library : Enhanced print preview plug-in

, 24 May 2004 CPOL
MFC Extension library : Enhanced print preview plug-in
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#include "mappedbitmapbutton.h"
#include "afxpriv.h"
#include <..\src\afximpl.h>

// override MFC class
class CMultiPagePreviewView : public CPreviewView
	virtual		~CMultiPagePreviewView();
	// override
	// these variables are used in the page layout algorithm
	int					m_Across;				// number across the page, >= 1
	int					m_Down;			    	// number down the page, >= 1
	CPoint				m_PageOffset;			// amount to move the page from one position to the next
	// bitmapped buttons in toolbar
	CMappedBitmapButton m_print;
	CMappedBitmapButton m_printSetup;
	CMappedBitmapButton m_next;
	CMappedBitmapButton m_previous;
	CMappedBitmapButton m_zoomIn;
	CMappedBitmapButton m_zoomOut;
	CMappedBitmapButton m_pages;
    // plug in library support
    CPlugInMap**	    m_pMaps;
	int				    m_MapCount;
	bool			    m_bSuppressThisMessage;
	CPIState		    m_state;
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
	virtual BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult);
	//virtual void OnDraw(CDC* pDC);
	virtual void	PositionPage(UINT nPage);
	void			SetScaledSize(UINT nPage);
	void			DoZoom(UINT nPage, CPoint point);
	void			SetZoomState(UINT nNewState, UINT nPage, CPoint point);
	CSize			CalcPageDisplaySize();
	void			SetupScrollbar();
    int             GetPrintOrientation() const;
    bool            SetPrintOrientation(int mode) const;
	// note that is you change the maximum number of pages that can be displayed in preview mode
	// you have to increase the size of this array to make sure there is an entry available for every
	// possible page that can be shown at once.
	PAGE_INFO		m_pageInfoArray2[9]; // Embedded array for the default implementation - replaces MFC one of size 2!

#ifdef _DEBUG
	virtual void	AssertValid() const;
	virtual void	Dump(CDumpContext& dc) const;
	afx_msg int		OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void	OnNumPageChange();
	afx_msg void	OnZoomIn();
	afx_msg void	OnZoomOut();
	afx_msg void	OnUpdateNumPageChange(CCmdUI* pCmdUI);
	afx_msg void	OnUpdateZoomIn(CCmdUI* pCmdUI);
	afx_msg void	OnUpdateZoomOut(CCmdUI* pCmdUI);
	afx_msg void	OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg BOOL	OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
	afx_msg void	OnPreviewPages();
	afx_msg BOOL	OnToolTipNotify(UINT id, NMHDR *pNMHDR, LRESULT * pResult);
	afx_msg void	OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void	OnLandscape();
	afx_msg BOOL	OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
    afx_msg void    OnPrintSetup();

// the additional zoom level factors that we support when zoomed in
// the default MFC range is 0 (ZOOMED_OUT), 1 and 2
#define ZOOM_IN_150     3
#define ZOOM_IN_200     4
#define ZOOM_IN_400     5


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.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Roger Allen
Software Developer (Senior) Sirius Analytical Instruments
United Kingdom United Kingdom
A research and development programmer working for a pharmaceutical instrument company for the past 17 years.
I am one of those lucky people who enjoys his work and spends more time than he should either doing work or reseaching new stuff. I can also be found on playing DDO on the Cannith server (Send a tell to "Maetrim" who is my current main)
I am also a keep fit fanatic, doing cross country running and am seriously into [url][/url] Karate at this time of my life, training from 4-6 times a week and recently achieved my 1st Dan after 6 years.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150224.1 | Last Updated 25 May 2004
Article Copyright 2004 by Roger Allen
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid