/*
* This file is part of the EMFexplorer projet.
* Copyright (C) 2004 Smith Charles.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*
* Extension: for commercial use, apply the Equity Public License, which
* adds to the normal terms of the GLPL a condition of donation to the author.
* If you are interested in support for this source code,
* contact Smith Charles <smith.charles@free.fr> for more information.
*/
#ifndef _SCEMFDOCPAGE_H_
#define _SCEMFDOCPAGE_H_
class SCEMFDoc;
class SCAlphaBand;
class SCEMFDocPage
{
// Construction/Destruction
public:
SCEMFDocPage(SCEMFDoc* pParent);
~SCEMFDocPage();
// Accessors
// Getters
UINT SCGetFileType() const { return m_uiType; }
HENHMETAFILE SCGetEMF() const { return m_hEMF; }
BOOL SCGetDirty() const { return m_bDirty; }
CString SCGetCreditURL() const { return m_strCreditURL; }
CString SCGetCredit() const { return m_strCredit; }
CString SCGetComment() const { return m_strComment; }
CString SCGetFilePath() const { return m_strPath; }
BOOL SCGetInflate() const { return m_bInflate; }
void SCGetElemsRect(CRect& rcElems) const { rcElems = m_rectSize; }
void SCGetInflateRect(CRect& rectInflate) const { rectInflate = m_rectInflate; }
void SCGetPageBlackBox(CRect& rcElems) const;
// Setters
void SCSetCreditURL(LPCTSTR lpszURL) { ASSERT(lpszURL); m_strCreditURL = lpszURL; }
void SCSetCredit(LPCTSTR lpszCredit) { ASSERT(lpszCredit); m_strCredit = lpszCredit; }
void SCSetComment(LPCTSTR lpszComment) { ASSERT(lpszComment); m_strComment = lpszComment; }
// Operation
void SCReset();
void SCCopyFrom(const SCEMFDocPage& rDocPage);
HENHMETAFILE SCDetachEMF();
void SCSetFilePath(LPCTSTR lpszPath, BOOL bKeepImage=TRUE);
void SCAttachEMF(HENHMETAFILE hEMF, LPCTSTR lpszPath, UINT uiType);
HENHMETAFILE SCGetPageEMF();
HENHMETAFILE SCUnlockEMF();
void SCInflateElemsRect(int iLeft, int iTop, int iRight, int iBottom)
{
m_bInflate = TRUE;
// don't cumulate inflates
m_rectSize.InflateRect(iLeft - m_rectInflate.left, iTop - m_rectInflate.top,
iRight - m_rectInflate.right, iBottom - m_rectInflate.bottom);
m_rectInflate.SetRect(iLeft, iTop, iRight, iBottom);
}
void SCRecomputeElemsRect();
void SCGetBasicElemsRect(CRect& rcElems) const
{
rcElems = m_rectSize;
rcElems.InflateRect(-m_rectInflate.left, -m_rectInflate.top,
-m_rectInflate.right, -m_rectInflate.bottom);
}
// Implementation
void SCComputePageInfo(BOOL bReverseVideo, CRect& rectMargins);
void SCUpdatePageInfoColors(BOOL bReverseVideo);
void SCDisplayPageComments(HDC hDC, float fScale,
int xDest, int yDest, int iWdt, int iHgt);
void SCDisplayPageComments(HDC hDC, float fScale,
int xDest, int yDest, int iWdt, int iHgt, HDC hAttribDC);
void SCDisplayPageComments(void* pGraphics, float fScale,
int xDest, int yDest, int iWdt, int iHgt);
protected:
private:
SCEMFDoc* m_pParentDoc; // parent doc
UINT m_uiType; // file type of page
HENHMETAFILE m_hEMF; // EMF of page
BOOL m_bDirty; // image is new or was altered
CRect m_rectSize; // page dimensions
CString m_strPath; // path to page
CString m_strCreditURL; // this is informative (not for download)
CString m_strCredit; // credit
CString m_strComment; // any text
BOOL m_bInflate; // page-specific inflate on/off
CRect m_rectInflate; // the specific inflate
SCAlphaBand* m_pPgComment; // Page's comment
SCAlphaBand* m_pPgCredit; // Page's credit
friend class SCEMFDoc;
private:
// Control proliferation
/*No default =*/void operator=(const SCEMFDocPage &rCopy);
/*No default copy*/SCEMFDocPage(const SCEMFDocPage &rCopy);
};
typedef SCEMFDocPage *PSCEMFDocPage;
#endif //_SCEMFDOCPAGE_H_
// ------------------------------------------------------------