|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
//<2F>ļ<EFBFBD>: CItem<65><6D><EFBFBD><EFBFBD>չ
|
|
|
|
|
|
//<2F><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>:
|
|
|
|
|
|
// <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD>ػ<EFBFBD><D8BB><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD>
|
|
|
|
|
|
//
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д: 2006-12-07
|
|
|
|
|
|
//
|
|
|
|
|
|
//
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
#include "StdAfx.h"
|
|
|
|
|
|
//#include "DrawApp.h"
|
|
|
|
|
|
#include ".\itemprint.h"
|
|
|
|
|
|
//#include "DrawDoc.h"
|
|
|
|
|
|
//#include "DrawView.h"
|
|
|
|
|
|
//#include "DrawMainFrame.h"
|
|
|
|
|
|
//#include "DrawChildFrame.h"
|
|
|
|
|
|
//#include ".\PublicParam.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace NDrawView
|
|
|
|
|
|
{
|
|
|
|
|
|
CItemPrint::CItemPrint(CSigmaDoc * ppDoc)
|
|
|
|
|
|
: CItemBase(ppDoc)
|
|
|
|
|
|
{
|
|
|
|
|
|
this->SetType(ITEM_PRINT);
|
|
|
|
|
|
m_pPreviewDC=NULL;
|
|
|
|
|
|
m_bPrinting=FALSE;
|
|
|
|
|
|
m_szPageNum.SetSize(1,1);
|
|
|
|
|
|
m_bRestorePreviewDC=FALSE;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CItemPrint::~CItemPrint(void)
|
|
|
|
|
|
{
|
|
|
|
|
|
ClearPreviewDC();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CItemPrint::ClearPreviewDC(void)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(m_pPreviewDC)delete m_pPreviewDC;
|
|
|
|
|
|
m_pPreviewDC=NULL;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CItemPrint::EnablePrinting(BOOL bEnable)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_bPrinting=bEnable;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CItemPrint::OnDraw(CXyDC* pDC)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CItemPrint::OnFilePrintPreviewUIUpdate(CCmdUI* pCmdUI)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CItemPrint::OnFilePrintPreview(void)
|
|
|
|
|
|
{
|
|
|
|
|
|
EnablePrinting(FALSE);
|
|
|
|
|
|
|
|
|
|
|
|
//m_bRestorePreviewDC=FALSE;
|
|
|
|
|
|
//if(m_pPreviewDC)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// if(::AfxMessageBox(IDS_STRING_RESTORE_PREVIEW_DC, MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON1)==IDYES)
|
|
|
|
|
|
// m_bRestorePreviewDC=TRUE;
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
//GetDrawDoc()->SetPreview(TRUE);
|
|
|
|
|
|
//m_bChildRulerBar=GetRulerBarState();
|
|
|
|
|
|
//CDrawMainFrame* pMainFrame = (CDrawMainFrame*)GetDrawDoc()->GetMainFrame();
|
|
|
|
|
|
//if(pMainFrame)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// pMainFrame->EnablePaneBar(FALSE);
|
|
|
|
|
|
// //pMainFrame->CommandBarState(true);
|
|
|
|
|
|
// //pMainFrame->ShowCommandBar(false);
|
|
|
|
|
|
//}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CItemPrint::OnEndPrintPreview(CDC* pDC, CPrintInfo* pInfo, POINT point, CPreviewView* pView)
|
|
|
|
|
|
{
|
|
|
|
|
|
// GetDrawDoc()->SetPreview(FALSE);
|
|
|
|
|
|
// SetRulerBarState(m_bChildRulerBar);
|
|
|
|
|
|
// CDrawMainFrame* pMainFrame = (CDrawMainFrame*)GetDrawDoc()->GetMainFrame();
|
|
|
|
|
|
// if(pMainFrame)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// pMainFrame->EnablePaneBar(TRUE);
|
|
|
|
|
|
//// pMainFrame->CommandBarState(false);
|
|
|
|
|
|
// }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL CItemPrint::OnPreparePrinting(CPrintInfo* pInfo)
|
|
|
|
|
|
{
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CRect CItemPrint::GetViewRect(CRect oldViewRect)
|
|
|
|
|
|
{
|
|
|
|
|
|
//CPrintPageSetup* pPageSetup = PARAM().GetPageSetup();
|
|
|
|
|
|
//if(pPageSetup->m_bMulline)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// int mn=pPageSetup->m_nMullineNum;
|
|
|
|
|
|
// switch(pPageSetup->m_nMullineIdea)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// case 0: //<2F><><EFBFBD>з<EFBFBD>ʽ
|
|
|
|
|
|
// oldViewRect.SetRect(0,0,oldViewRect.Width()*m_szPageNum.cx, oldViewRect.Height()*m_szPageNum.cy*mn);
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case 1: //<2F><><EFBFBD>з<EFBFBD>ʽ
|
|
|
|
|
|
// oldViewRect.SetRect(0,0,oldViewRect.Width()*m_szPageNum.cx*mn, oldViewRect.Height()*m_szPageNum.cy);
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
//else
|
|
|
|
|
|
// oldViewRect.SetRect(0,0,oldViewRect.Width()*m_szPageNum.cx,oldViewRect.Height()*m_szPageNum.cy);
|
|
|
|
|
|
return oldViewRect;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CItemPrint::OnDrawSetDC(CXyDC* pDC) //<2F><><EFBFBD>÷<EFBFBD>ҳ<EFBFBD><D2B3>ӡʱ<D3A1><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Χ
|
|
|
|
|
|
{
|
|
|
|
|
|
if(pDC==NULL) return;
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>Χ
|
|
|
|
|
|
CRect rtView=pDC->GetViewRect();
|
|
|
|
|
|
rtView=GetViewRect(rtView);
|
|
|
|
|
|
pDC->SetViewRect(rtView);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CItemPrint::SetSectionSize(long cx,long cy)
|
|
|
|
|
|
{
|
|
|
|
|
|
/*CDrawDoc* pDoc = GetDrawDoc();
|
|
|
|
|
|
COne *pOne;
|
|
|
|
|
|
CSection *od;
|
|
|
|
|
|
POSITION p = pDoc->GetDraw()->GetValueList()->GetHeadPosition();
|
|
|
|
|
|
while(p)
|
|
|
|
|
|
{
|
|
|
|
|
|
pOne=(COne *)(pDoc->GetDraw()->GetValueList()->GetNext(p));
|
|
|
|
|
|
if(pOne->GetType()!=DOUBLEFOX_SECTION)continue;
|
|
|
|
|
|
od=(CSection*)pOne->value;
|
|
|
|
|
|
od->SetViewSize(cx,cy);
|
|
|
|
|
|
}*/
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CItemPrint::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
|
|
|
|
|
|
{
|
|
|
|
|
|
//CPrintPageSetup* pPageSetup = PARAM().GetPageSetup();
|
|
|
|
|
|
//CDrawDoc* pDoc = GetDrawDoc();
|
|
|
|
|
|
|
|
|
|
|
|
////<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>߶<EFBFBD>,<2C><><EFBFBD><EFBFBD>
|
|
|
|
|
|
//CSize sz;
|
|
|
|
|
|
//sz.cx=pDC->GetDeviceCaps(HORZRES);//<2F><><EFBFBD>ô<EFBFBD>ӡҳ<D3A1>Ͽɴ<CFBF>ӡ<EFBFBD><D3A1><EFBFBD>Ŀ<EFBFBD><C4BF>ȣ<EFBFBD><C8A3><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD>
|
|
|
|
|
|
//sz.cy=pDC->GetDeviceCaps(VERTRES);//<2F><><EFBFBD>ô<EFBFBD>ӡҳ<D3A1>Ͽɴ<CFBF>ӡ<EFBFBD><D3A1><EFBFBD>ĸ߶ȣ<DFB6><C8A3><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD>
|
|
|
|
|
|
//SetSectionSize(sz.cx,sz.cy);
|
|
|
|
|
|
|
|
|
|
|
|
////<2F><><EFBFBD>ô<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>
|
|
|
|
|
|
//double xx,yy;
|
|
|
|
|
|
//pDoc->GetDC().GetScale(xx,yy);
|
|
|
|
|
|
//pDoc->SetDC(pDC);
|
|
|
|
|
|
//pDoc->GetDC().SetScale(xx,yy);
|
|
|
|
|
|
|
|
|
|
|
|
////<2F><><EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD>Ԥ<EFBFBD><D4A4>״̬ʱ<CCAC><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>ӡԤ<D3A1><D4A4>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD>ŷ<EFBFBD><C5B7><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><C2B5>øú<C3B8><C3BA><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
////Ϊ<><CEAA>ʹ<EFBFBD>˳<EFBFBD>Ԥ<EFBFBD><D4A4>״̬<D7B4><CCAC><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>֮ǰ<D6AE>ı<EFBFBD><C4B1><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD>Ҫ<EFBFBD>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4>״̬<D7B4><CCAC><EFBFBD>ô<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD>
|
|
|
|
|
|
//if(!pDoc->m_bSetPrinterInPreview)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// BOOL br=pDoc->IsPreview();
|
|
|
|
|
|
// pDoc->SetPreview(FALSE);
|
|
|
|
|
|
// pDoc->PushDC();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|
|
|
|
|
// pDoc->SetPreview(br);
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
//m_szPageNum.SetSize(1,1);
|
|
|
|
|
|
//CRect rtView=pDoc->GetDC().GetViewRect();
|
|
|
|
|
|
|
|
|
|
|
|
//if(pPageSetup->m_bExtendScreen) //ȫ<><C8AB><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
|
//{
|
|
|
|
|
|
// CRect rt=GetPrintArea(pDC); rt.OffsetRect(-rt.left,-rt.top);
|
|
|
|
|
|
// CRect8 rect(1e100,-1e100,-1e100,1e100);
|
|
|
|
|
|
// if(pDoc->GetDraw()->GetCount()>0) pDoc->GetDrawRange(rect);
|
|
|
|
|
|
// else *((CRect8*)&rect)=rt;
|
|
|
|
|
|
// if(pPageSetup->m_nScreenSel==0)pDoc->GetDC().Extend(rect,rt,EXTEND_MODE_CENTER); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
|
// else pDoc->GetDC().Extend(rect,rt,EXTEND_MODE_STRECH); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
|
//}
|
|
|
|
|
|
//else if(pPageSetup->m_bPartition) //<2F><>ҳ<EFBFBD><D2B3>ʾ
|
|
|
|
|
|
//{
|
|
|
|
|
|
// CSize sz=GetPartitionNum(pDC);
|
|
|
|
|
|
// pInfo->SetMinPage(1);
|
|
|
|
|
|
// pInfo->m_nNumPreviewPages = 1;
|
|
|
|
|
|
// switch(pPageSetup->m_nPartitionIdea)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// case 0://ȫ<><C8AB>
|
|
|
|
|
|
// pInfo->SetMaxPage(sz.cx*sz.cy);
|
|
|
|
|
|
// if(sz.cx*sz.cy>1) pInfo->m_nNumPreviewPages = 2;
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case 1://<2F><>ֱ
|
|
|
|
|
|
// pInfo->SetMaxPage(sz.cy);
|
|
|
|
|
|
// sz.cx=1;
|
|
|
|
|
|
// if(sz.cy>1) pInfo->m_nNumPreviewPages = 2;
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case 2://ˮƽ
|
|
|
|
|
|
// pInfo->SetMaxPage(sz.cx);
|
|
|
|
|
|
// sz.cy=1;
|
|
|
|
|
|
// if(sz.cx>1) pInfo->m_nNumPreviewPages = 2;
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// pInfo->m_nCurPage = 0;
|
|
|
|
|
|
// m_szPageNum=sz;
|
|
|
|
|
|
|
|
|
|
|
|
// //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>Χ
|
|
|
|
|
|
// rtView=GetViewRect(rtView);
|
|
|
|
|
|
// pDoc->GetDC().SetViewRect(rtView);
|
|
|
|
|
|
//}
|
|
|
|
|
|
//else if(pPageSetup->m_bCenterDocument && pDoc->GetDraw()->GetCount()>0) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|
|
|
|
|
//{
|
|
|
|
|
|
// //<2F><><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>Ĵ<EFBFBD>С
|
|
|
|
|
|
// CRect8 rect(1e100,-1e100,-1e100,1e100);
|
|
|
|
|
|
// pDoc->GetDrawRange(rect);
|
|
|
|
|
|
// //pDoc->GetDraw()->GetRange(rect);
|
|
|
|
|
|
// //rect.left=pDoc->GetDC().left;
|
|
|
|
|
|
// //rect.top=pDoc->GetDC().top;
|
|
|
|
|
|
|
|
|
|
|
|
// CRect rt=GetPrintArea(pDC);
|
|
|
|
|
|
// CRect mg=GetMarginRect();
|
|
|
|
|
|
// CPoint porg=pDC->GetViewportOrg();
|
|
|
|
|
|
// rt.OffsetRect(-mg.left,-mg.top);
|
|
|
|
|
|
// CRect8 rs=pDoc->GetDC().GetReal(rt);
|
|
|
|
|
|
|
|
|
|
|
|
// CPoint2D pt=rect.CenterPoint();
|
|
|
|
|
|
// CPoint2D ps=rs.CenterPoint();
|
|
|
|
|
|
// pDoc->GetDC().OffsetRect(pt.x0-ps.x0, pt.y0-ps.y0);
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
////<2F>ָ<EFBFBD><D6B8>ϴ<EFBFBD>Ԥ<EFBFBD><D4A4>ʱ<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>
|
|
|
|
|
|
//if(m_pPreviewDC!=NULL)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// if(m_bPrinting || m_bRestorePreviewDC)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// pDoc->SetDC(*m_pPreviewDC);
|
|
|
|
|
|
// pDoc->SetDC(pDC);
|
|
|
|
|
|
// pDoc->GetDC().SetViewRect(rtView);
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CItemPrint::OnPrint(CDC* pDC, CPrintInfo* pInfo)
|
|
|
|
|
|
{
|
|
|
|
|
|
//CPrintPageSetup* pPageSetup = PARAM().GetPageSetup();
|
|
|
|
|
|
|
|
|
|
|
|
////<2F><>ҳ<EFBFBD>߾<EFBFBD>
|
|
|
|
|
|
//if(GetDrawDoc()->IsPreview())
|
|
|
|
|
|
// DrawPageFrame(pDC, pInfo->m_rectDraw);
|
|
|
|
|
|
|
|
|
|
|
|
////<2F><><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3>
|
|
|
|
|
|
//CPoint pt=pDC->GetViewportOrg();
|
|
|
|
|
|
//pDC->SetViewportOrg(0,0);
|
|
|
|
|
|
//PrintPageNumber(pDC);
|
|
|
|
|
|
//pDC->SetViewportOrg(pt);
|
|
|
|
|
|
|
|
|
|
|
|
//if(!pPageSetup->m_bExtendScreen)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// //pDC->SelectClipRgn(NULL);
|
|
|
|
|
|
// MarginRect(pInfo->m_rectDraw);
|
|
|
|
|
|
// pDC->IntersectClipRect(&pInfo->m_rectDraw);
|
|
|
|
|
|
//}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CItemPrint::OnEndPrinting(CDC* pDC, CPrintInfo* pInfo)
|
|
|
|
|
|
{
|
|
|
|
|
|
//CDrawDoc* pDoc = GetDrawDoc();
|
|
|
|
|
|
//CDrawView* pView = GetDrawView();
|
|
|
|
|
|
|
|
|
|
|
|
////<2F>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>Χ
|
|
|
|
|
|
//CRect rect;
|
|
|
|
|
|
//pView->GetClientRect(&rect);
|
|
|
|
|
|
//SetSectionSize(rect.Width()+5,rect.Height()+5);
|
|
|
|
|
|
|
|
|
|
|
|
////<2F><><EFBFBD><EFBFBD>Ϊ<EFBFBD>˱<EFBFBD><CBB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡԤ<D3A1><D4A4>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ͬ
|
|
|
|
|
|
//CRect8 rt=*(CRect8*)&pDoc->GetDC();
|
|
|
|
|
|
//double sx,sy;
|
|
|
|
|
|
|
|
|
|
|
|
//BOOL bSetCurScale=::GetPreferences().OtherPrint.m_bSetScale;
|
|
|
|
|
|
//if(bSetCurScale)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// pDoc->GetDC().GetScale(sx, sy);
|
|
|
|
|
|
// if(m_pPreviewDC)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// delete m_pPreviewDC;
|
|
|
|
|
|
// m_pPreviewDC=NULL;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
//else
|
|
|
|
|
|
//{
|
|
|
|
|
|
// if(m_pPreviewDC==NULL)
|
|
|
|
|
|
// m_pPreviewDC=new CXyDC;
|
|
|
|
|
|
// *m_pPreviewDC=pDoc->GetDC();
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////
|
|
|
|
|
|
//BOOL br=pDoc->IsPreview();
|
|
|
|
|
|
//pDoc->SetPreview(FALSE);
|
|
|
|
|
|
//pDoc->PopDC();//<2F>ָ<EFBFBD><D6B8><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
|
|
|
|
|
|
//pDoc->SetPreview(br);
|
|
|
|
|
|
|
|
|
|
|
|
////<2F>ָ<EFBFBD><D6B8><EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD>
|
|
|
|
|
|
//double xx,yy;
|
|
|
|
|
|
//pDoc->GetDC().GetScale(xx,yy);
|
|
|
|
|
|
|
|
|
|
|
|
//CClientDC dc(pView);
|
|
|
|
|
|
//pDoc->SetDC(&dc);
|
|
|
|
|
|
//pDoc->GetDC().SetScale(xx,yy);
|
|
|
|
|
|
|
|
|
|
|
|
////<2F><><EFBFBD><EFBFBD>Ϊ<EFBFBD>˱<EFBFBD><CBB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӡԤ<D3A1><D4A4>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ͬ
|
|
|
|
|
|
//if(bSetCurScale)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// pDoc->GetDC()=rt;
|
|
|
|
|
|
// pDoc->GetDC().SetScale(sx,sy);
|
|
|
|
|
|
//}
|
|
|
|
|
|
//AfterEndPrinting(pDC, pInfo);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CItemPrint::AfterEndPrinting(CDC* pDC, CPrintInfo* pInfo)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CItemPrint::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(!pDC->IsPrinting()) return;
|
|
|
|
|
|
|
|
|
|
|
|
CRect rt = GetPrintArea(pDC);
|
|
|
|
|
|
CSize sz = m_szPageNum;
|
|
|
|
|
|
|
|
|
|
|
|
//CPrintPageSetup* pPageSetup = PARAM().GetPageSetup();
|
|
|
|
|
|
|
|
|
|
|
|
////TRACE("OnPrepareDC( %ld/(%ld,%ld) page )\n", pInfo->m_nCurPage, m_szPageNum.cx, m_szPageNum.cy);
|
|
|
|
|
|
//if(pInfo->m_nCurPage==1)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// pDC->SetViewportOrg(rt.left,rt.top);
|
|
|
|
|
|
//}
|
|
|
|
|
|
//else if(pInfo->m_nCurPage>1)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// CSize sw=GetSuperpositionWidth();//<2F><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
|
|
|
|
|
|
|
// int pagew=rt.Width();
|
|
|
|
|
|
// int pageh=rt.Height();
|
|
|
|
|
|
//
|
|
|
|
|
|
// if(pPageSetup->m_bMulline)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// int mn=pPageSetup->m_nMullineNum;
|
|
|
|
|
|
// if(pPageSetup->m_nMullineIdea==0) //<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// pageh=pageh*mn-sw.cy*(mn-1);
|
|
|
|
|
|
// else //<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// pagew=pagew*mn-sw.cx*(mn-1);
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// int x,y;
|
|
|
|
|
|
// switch(pPageSetup->m_nPartitionIdea)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// case 0://ȫ<><C8AB>
|
|
|
|
|
|
// {
|
|
|
|
|
|
// int row = pInfo->m_nCurPage / sz.cx + (pInfo->m_nCurPage % sz.cx > 0);
|
|
|
|
|
|
// int col = (pInfo->m_nCurPage - 1) % sz.cx + 1;
|
|
|
|
|
|
// //TRACE("OnPrepareDC( row=%d, col=%d)\n", row,col);
|
|
|
|
|
|
// x=-(pagew-sw.cx)*(col-1);
|
|
|
|
|
|
// y=-(pageh-sw.cy)*(row-1);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case 1://<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// x=-(pagew-sw.cx)*(pInfo->m_nCurPage-1);
|
|
|
|
|
|
// y=0;
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case 2://<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// x=0;
|
|
|
|
|
|
// y=-(pageh-sw.cy)*(pInfo->m_nCurPage-1);
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// x+=rt.left;
|
|
|
|
|
|
// y+=rt.top;
|
|
|
|
|
|
// pDC->SetViewportOrg(x,y);
|
|
|
|
|
|
//}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CSize CItemPrint::GetPartitionNum(CDC* pDC)
|
|
|
|
|
|
{
|
|
|
|
|
|
//CDrawDoc* pDoc = GetDrawDoc();
|
|
|
|
|
|
|
|
|
|
|
|
//if(pDoc->GetDraw()->GetCount()==0) return CSize(1,1);
|
|
|
|
|
|
|
|
|
|
|
|
//CRect rt = GetPrintArea(pDC);
|
|
|
|
|
|
//CPrintPageSetup* pPageSetup = PARAM().GetPageSetup();
|
|
|
|
|
|
|
|
|
|
|
|
////<2F><><EFBFBD><EFBFBD>һҳ<D2BB>ɴ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD>Ĵ<EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD>ȣ<EFBFBD><C8A3><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD>ף<EFBFBD>
|
|
|
|
|
|
//double sx=rt.Width ()*pDoc->GetDC().UnitX;
|
|
|
|
|
|
//double sy=rt.Height()*pDoc->GetDC().UnitY;
|
|
|
|
|
|
|
|
|
|
|
|
////<2F><><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD>ӡʱ<D3A1><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һҳֽ<D2B3>ɴ<EFBFBD>ӡ<EFBFBD>ij<EFBFBD><C4B3><EFBFBD>
|
|
|
|
|
|
//if(pPageSetup->m_bMulline)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// int mn=pPageSetup->m_nMullineNum;
|
|
|
|
|
|
// if(pPageSetup->m_nMullineIdea==0) //<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// sy=sy*mn-pPageSetup->m_nSuperpositionWidth*(mn-1);
|
|
|
|
|
|
// else //<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// sx=sx*mn-pPageSetup->m_nSuperpositionWidth*(mn-1);
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
////<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD>ĺ<EFBFBD><C4BA>׳<EFBFBD><D7B3><EFBFBD>
|
|
|
|
|
|
//CRect8 rect(1e100,-1e100,-1e100,1e100);
|
|
|
|
|
|
//pDoc->GetDrawRange(rect);
|
|
|
|
|
|
//double mx=pDoc->GetDC().GetScreenWidth8 (rect.Width ()) * pDoc->GetDC().UnitX;
|
|
|
|
|
|
//double my=pDoc->GetDC().GetScreenHeight8(rect.Height()) * pDoc->GetDC().UnitY;
|
|
|
|
|
|
//my=fabs(my);
|
|
|
|
|
|
|
|
|
|
|
|
CSize sz(0,0);
|
|
|
|
|
|
//if(mx<=ZERO) sz.cx=1;
|
|
|
|
|
|
//else while(mx > ZERO)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// sz.cx++;
|
|
|
|
|
|
// mx -= sx;
|
|
|
|
|
|
// if(mx <= ZERO) break;
|
|
|
|
|
|
// mx += pPageSetup->m_nSuperpositionWidth;
|
|
|
|
|
|
//}
|
|
|
|
|
|
//if(my<=ZERO) sz.cy=1;
|
|
|
|
|
|
//else while(my > ZERO)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// sz.cy++;
|
|
|
|
|
|
// my -= sy;
|
|
|
|
|
|
// if(my <= ZERO) break;
|
|
|
|
|
|
// my += pPageSetup->m_nSuperpositionWidth;
|
|
|
|
|
|
//}
|
|
|
|
|
|
return sz;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CItemPrint::PrintPageNumber(CDC *pDC)
|
|
|
|
|
|
{
|
|
|
|
|
|
//CPrintPageSetup* pPageSetup = PARAM().GetPageSetup();
|
|
|
|
|
|
|
|
|
|
|
|
//if(pPageSetup->m_nSideSel==0) return;
|
|
|
|
|
|
//if(pPageSetup->m_strLabel.IsEmpty()) return;
|
|
|
|
|
|
|
|
|
|
|
|
//CRect mg=GetMarginRect(0.5); //ת<><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>֮<EFBFBD><D6AE><EFBFBD><EFBFBD>ҳ<EFBFBD>߾<EFBFBD>
|
|
|
|
|
|
//int m_PageWidth=pDC->GetDeviceCaps(HORZRES);
|
|
|
|
|
|
//int m_PageHeight=pDC->GetDeviceCaps(VERTRES);
|
|
|
|
|
|
//
|
|
|
|
|
|
//int x = AfxGetPublicFunction()->FloatToLong(pPageSetup->m_nMarginX/GetDrawDoc()->GetDC().UnitX);
|
|
|
|
|
|
//int y = AfxGetPublicFunction()->FloatToLong(pPageSetup->m_nMarginY/GetDrawDoc()->GetDC().UnitY);
|
|
|
|
|
|
//CSize size=pDC->GetTextExtent(pPageSetup->m_strLabel);
|
|
|
|
|
|
|
|
|
|
|
|
//switch(pPageSetup->m_nSideSel)
|
|
|
|
|
|
//{
|
|
|
|
|
|
//case 1://ֽ<><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
// x+=mg.left;
|
|
|
|
|
|
// pPageSetup->m_lfPageNumberFont.lfEscapement=-900;//<2F><>ת-90<39><30>
|
|
|
|
|
|
// pPageSetup->m_lfPageNumberFont.lfOrientation=-900;//<2F><>ת-90<39><30>
|
|
|
|
|
|
// switch(pPageSetup->m_nAliginSel)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// case 0://<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// y=m_PageHeight-size.cx-y;
|
|
|
|
|
|
// y-=mg.bottom*2;
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case 1://<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// y=m_PageHeight/2-size.cx/2+y;
|
|
|
|
|
|
// y=y+mg.top-mg.bottom;
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case 2://<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// y+=mg.top*2;
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// x+=size.cy;
|
|
|
|
|
|
// break;
|
|
|
|
|
|
//case 3://ֽ<><D6BD><EFBFBD>ұ<EFBFBD>
|
|
|
|
|
|
// x+=mg.right;
|
|
|
|
|
|
// pPageSetup->m_lfPageNumberFont.lfEscapement=900;//<2F><>ת90<39><30>
|
|
|
|
|
|
// pPageSetup->m_lfPageNumberFont.lfOrientation=900;//<2F><>ת90<39><30>
|
|
|
|
|
|
// switch(pPageSetup->m_nAliginSel)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// case 0://<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// y+=size.cx;
|
|
|
|
|
|
// y+=mg.top*2;
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case 1://<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// y=m_PageHeight/2+size.cx/2+y;
|
|
|
|
|
|
// y=y+mg.top-mg.bottom;
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case 2://<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// y=m_PageHeight-y;
|
|
|
|
|
|
// y-=mg.bottom*2;
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// x=m_PageWidth-size.cy-x;
|
|
|
|
|
|
// break;
|
|
|
|
|
|
//case 2://ֽ<><D6BD><EFBFBD>ϱ<EFBFBD>
|
|
|
|
|
|
// y+=mg.top;
|
|
|
|
|
|
// pPageSetup->m_lfPageNumberFont.lfEscapement=0;
|
|
|
|
|
|
// pPageSetup->m_lfPageNumberFont.lfOrientation=0;
|
|
|
|
|
|
// switch(pPageSetup->m_nAliginSel)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// case 0://<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// x=m_PageWidth-size.cx-x;
|
|
|
|
|
|
// x-=mg.right*2;
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case 1://<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// x=m_PageWidth/2-size.cx/2+x;
|
|
|
|
|
|
// x=x-mg.right+mg.left;
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case 2://<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// x+=mg.left*2;
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// break;
|
|
|
|
|
|
//case 4://ֽ<><D6BD><EFBFBD>±<EFBFBD>
|
|
|
|
|
|
// y+=mg.bottom;
|
|
|
|
|
|
// pPageSetup->m_lfPageNumberFont.lfEscapement=0;
|
|
|
|
|
|
// pPageSetup->m_lfPageNumberFont.lfOrientation=0;
|
|
|
|
|
|
// switch(pPageSetup->m_nAliginSel)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// case 0://<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// x=m_PageWidth-size.cx-x;
|
|
|
|
|
|
// x-=mg.right*2;
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case 1://<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// x=(m_PageWidth)/2-size.cx/2+x;
|
|
|
|
|
|
// x=x-mg.right+mg.left;
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case 2://<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// x+=mg.left*2;
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// y=m_PageHeight-size.cy-y;
|
|
|
|
|
|
// break;
|
|
|
|
|
|
//}
|
|
|
|
|
|
//CFont ft;
|
|
|
|
|
|
//if(ft.CreateFontIndirect(&pPageSetup->m_lfPageNumberFont))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// CFont* pFont=pDC->SelectObject(&ft);
|
|
|
|
|
|
// pDC->TextOut(x,y,pPageSetup->m_strLabel);
|
|
|
|
|
|
// pDC->SelectObject(pFont);
|
|
|
|
|
|
//}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CItemPrint::SetRulerBarState(BOOL bView)
|
|
|
|
|
|
{
|
|
|
|
|
|
//CDrawChildFrame *cf=(CDrawChildFrame*)GetDrawView()->GetParentChildFrame();
|
|
|
|
|
|
//if(cf) cf->ShowRuler(bView);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL CItemPrint::GetRulerBarState(void)
|
|
|
|
|
|
{
|
|
|
|
|
|
BOOL vt=TRUE;
|
|
|
|
|
|
/*CDrawChildFrame *cf=(CDrawChildFrame*)GetDrawView()->GetParentChildFrame();
|
|
|
|
|
|
if(cf)
|
|
|
|
|
|
{
|
|
|
|
|
|
vt=cf->GetRulerState();
|
|
|
|
|
|
cf->ShowRuler(FALSE);
|
|
|
|
|
|
}*/
|
|
|
|
|
|
return vt;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CRect CItemPrint::GetPrintArea(CDC* pDC)
|
|
|
|
|
|
{
|
|
|
|
|
|
CRect rt(0, 0, pDC->GetDeviceCaps(HORZRES), pDC->GetDeviceCaps(VERTRES));
|
|
|
|
|
|
MarginRect(rt);
|
|
|
|
|
|
return rt;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CItemPrint::MarginRect(CRect& rt)
|
|
|
|
|
|
{
|
|
|
|
|
|
CRect mg = GetMarginRect();
|
|
|
|
|
|
rt.left +=mg.left;
|
|
|
|
|
|
rt.top +=mg.top;
|
|
|
|
|
|
rt.right -=mg.right;
|
|
|
|
|
|
rt.bottom -=mg.bottom;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CRect CItemPrint::GetMarginRect(double sc)//ת<><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>֮<EFBFBD><D6AE><EFBFBD><EFBFBD>ҳ<EFBFBD>߾<EFBFBD>
|
|
|
|
|
|
{
|
|
|
|
|
|
/*CPrintPageSetup* pPageSetup = PARAM().GetPageSetup();
|
|
|
|
|
|
CRect rt;
|
|
|
|
|
|
rt.left =AfxGetPublicFunction()->FloatToLong(pPageSetup->m_nMarginLeft /GetDrawDoc()->GetDC().UnitX * sc);
|
|
|
|
|
|
rt.top =AfxGetPublicFunction()->FloatToLong(pPageSetup->m_nMarginTop /GetDrawDoc()->GetDC().UnitY * sc);
|
|
|
|
|
|
rt.right =AfxGetPublicFunction()->FloatToLong(pPageSetup->m_nMarginRight /GetDrawDoc()->GetDC().UnitX * sc);
|
|
|
|
|
|
rt.bottom =AfxGetPublicFunction()->FloatToLong(pPageSetup->m_nMarginBottom/GetDrawDoc()->GetDC().UnitY * sc);*/
|
|
|
|
|
|
CRect rt;
|
|
|
|
|
|
return rt;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CSize CItemPrint::GetSuperpositionWidth(void)//<2F><><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
|
{
|
|
|
|
|
|
//CPrintPageSetup* pPageSetup = PARAM().GetPageSetup();
|
|
|
|
|
|
CSize sz;
|
|
|
|
|
|
//sz.cx = AfxGetPublicFunction()->FloatToLong(pPageSetup->m_nSuperpositionWidth / GetDrawDoc()->GetDC().UnitX);
|
|
|
|
|
|
//sz.cy = AfxGetPublicFunction()->FloatToLong(pPageSetup->m_nSuperpositionWidth / GetDrawDoc()->GetDC().UnitY);
|
|
|
|
|
|
return sz;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CItemPrint::DrawPageFrame(CDC* pDC, CRect rect)
|
|
|
|
|
|
{
|
|
|
|
|
|
//<2F><>ҳ<EFBFBD>߾<EFBFBD>
|
|
|
|
|
|
CRect ro=rect;
|
|
|
|
|
|
CRect rn=rect;
|
|
|
|
|
|
MarginRect(rn);
|
|
|
|
|
|
|
|
|
|
|
|
CPen pen(PS_SOLID, 1, RGB(199,199,199));
|
|
|
|
|
|
CBrush* pBrush=(CBrush*)pDC->SelectStockObject(NULL_BRUSH);
|
|
|
|
|
|
CPen* pOldPen=(CPen*)pDC->SelectObject(&pen);
|
|
|
|
|
|
pDC->Rectangle(ro);
|
|
|
|
|
|
|
|
|
|
|
|
CRect mg = GetMarginRect();
|
|
|
|
|
|
if(!(mg.left==0 && mg.right==0 && mg.bottom==0 && mg.top==0))
|
|
|
|
|
|
{
|
|
|
|
|
|
pDC->MoveTo(ro.left, rn.top);
|
|
|
|
|
|
pDC->LineTo(ro.right, rn.top);
|
|
|
|
|
|
|
|
|
|
|
|
pDC->MoveTo(ro.left, rn.bottom);
|
|
|
|
|
|
pDC->LineTo(ro.right, rn.bottom);
|
|
|
|
|
|
|
|
|
|
|
|
pDC->MoveTo(rn.left, ro.top);
|
|
|
|
|
|
pDC->LineTo(rn.left, ro.bottom);
|
|
|
|
|
|
|
|
|
|
|
|
pDC->MoveTo(rn.right, ro.top);
|
|
|
|
|
|
pDC->LineTo(rn.right, ro.bottom);
|
|
|
|
|
|
//pDC->Rectangle(pInfo->m_rectDraw);
|
|
|
|
|
|
}
|
|
|
|
|
|
pDC->SelectObject(pOldPen);
|
|
|
|
|
|
pDC->SelectObject(pBrush);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}//namespace
|