/** * @file XTPPreviewView.h * * @copyright * (c) 1998-2025 Codejock Software, All Rights Reserved. * * This source file is the property of Codejock Software and must not be * redistributed by any means without the explicit written permission of * Codejock Software. * * The use of this source code is governed by the terms and conditions specified * in the Toolkit Pro license agreement. Codejock Software grants you, as a * single software developer, the limited right to use this software on one * computer only. * * Contact Information: * support@codejock.com * http://www.codejock.com * */ /** @cond */ #if !defined(__XTPPREVIEWVIEW_H__) # define __XTPPREVIEWVIEW_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" ///////////////////////////////////////////////////////////////////////////// // CXTPPreviewView view # define XTP_ZOOM_WHOLEPAGE 0 /**< Fit the entire preview page on the screen.*/ # define XTP_ZOOM_PAGEWIDTH 1 /**< Fit the preview page to the width of the screen.*/ /** * @brief * CXTPPreviewView is a CPreviewView derived class that represents a * print preview window with a themed toolBar. */ class _XTP_EXT_CLASS CXTPPreviewView : public CPreviewView { /** @cond */ DECLARE_DYNCREATE(CXTPPreviewView) /** @endcond */ protected: /** * @brief * Constructs a CXTPPreviewView object. * @param nPageCount Number of pages to be displayed in print preview mode. * You must increase the page count to make sure there is * an entry available for each page that can be displayed. */ CXTPPreviewView(int nPageCount = 9); /** * @brief * Destroys a CXTPPreviewView object, handles cleanup and deallocation. */ virtual ~CXTPPreviewView(); public: /** * @brief * Sets the zoom state of the preview window. * @param nNewState Zoom state to use. Possible values (XTP_ZOOM_WHOLEPAGE, * XTP_ZOOM_PAGEWIDTH) or you can specify an integer that * represents a percentage to zoom the page. * @param nPage Page number to zoom. * @param point Point on page to zoom. */ void SetZoomState(UINT nNewState, UINT nPage, CPoint point); /** * @brief * Returns the current zoom state of the preview window. * @return * Current zoom state of the preview window. */ int GetZoomState() const; /** * @brief * Call this method to get a pointer to the toolbar of the preview window. * @return * Pointer to the toolbar of the preview window. */ CXTPToolBar* GetCommandBar(); /** @cond */ private: CXTPControl* FindToolbarButton(UINT nCommandID); virtual void PositionPage(UINT nPage); void SetScaledSize(UINT nPage); void DoZoom(UINT nPage, CPoint point); CSize CalcPageDisplaySize(); void SetupScrollbar(); void ZoomIn(UINT nPage, CPoint point); virtual void OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView); /** * @brief * Sets the number of pages to be viewed on the screen. * @param nAcross Number of pages horizontally. * @param nDown Number of pages vertically. */ void SetNumPreviewPages(int nAcross, int nDown); protected: # ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; # endif /** @endcond */ protected: /** @cond */ //{{AFX_VIRTUAL(CXTPPreviewView) public: void RecalLayout(); virtual BOOL PreCreateWindow(CREATESTRUCT& cs); //}}AFX_VIRTUAL //{{AFX_MSG(CXTPPreviewView) afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnWindowPosChanged(WINDOWPOS FAR* lpwndpos); afx_msg void OnPaint(); afx_msg BOOL OnEraseBkgnd(CDC*); 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 void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnGotoPageSetFocus(NMHDR* pNMHDR, LRESULT* pRes); afx_msg void OnGotoPageKillFocus(NMHDR* pNMHDR, LRESULT* pRes); afx_msg void OnUpdateGotoPage(CCmdUI* pCmdUI); afx_msg void OnZoomCombo(NMHDR* pNMHDR, LRESULT* pRes); afx_msg void OnOnePage(); afx_msg void OnTwoPage(NMHDR* pNMHDR, LRESULT* pRes); //}}AFX_MSG DECLARE_MESSAGE_MAP() /** @endcond */ protected: PAGE_INFO* m_pPageInfo2; /**< Embedded array for the default implementation - replaces MFC one of size 2! */ CXTPToolBar* m_pCommandBar; /**< Pointer to the "built-in" print preview toolbar. */ int m_cxPixelsPerInch; /**< Width of pixels in preview mode. */ int m_cyPixelsPerInch; /**< Height of pixels in preview mode. */ // 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 */ COLORREF m_clrBackColor; }; AFX_INLINE CXTPToolBar* CXTPPreviewView::GetCommandBar() { return m_pCommandBar; } /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif // !defined(__XTPPREVIEWVIEW_H__) /** @endcond */