LAPTOP-T815PCOQ\25526
2024-11-15 f5c4a7f3bce165fe2c8c6d934f0f49a363a2ea60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
//LogCtrl.h
//LogCtrl.h
#ifndef __LOGCTRL_H
#define __LOGCTRL_H
#define __LOGCTRL_LIB_H
 
#ifndef __AFXTEMPL_H
#include <afxtempl.h>
#endif
 
//LOG CELL STATE
//MERGE
#define LCS_NORML        0x0000
#define LCS_MERGE        0x0001
#define LCS_UNUSE        0x0002
 
//LINE
#define LCS_TLINE        0x0001    //TOP LINE DRAW
#define LCS_BLINE        0x0002    //BOTTOM LINE DRAW
#define LCS_LLINE        0x0004    //LEFT LINE DRAW
#define LCS_RLINE        0x0008    //RIGHT LINE DRAW
#define LCS_RECT        LCS_TLINE|LCS_BLINE|LCS_LLINE|LCS_RLINE
 
//merge state
#define SetFlag(n)  DWORD(BYTE(n)<<16)
#define GetFlag(d)  int((d & 0x00FF0000)>>16)
 
#define SetDown(n)  DWORD(BYTE(n)<<8)
#define GetDown(d)  int((d & 0x0000FF00)>>8)
 
#define SetRight(n) DWORD(BYTE(n))
#define GetRight(d) int((d & 0x000000FF))
 
#define LOGCHECK(b) if(b){return;}
#define LOGCHECK0(b) if(b){return 0;}
#define LOGCHECK1(b) if(b){return -1;}
 
class CPrintDC;
class CLogCell;
class CLogPage;
class CLogCtrl;
 
typedef CArray<CLogCell,CLogCell&> CLogItem;
typedef CArray<CLogItem,CLogItem&> CLogItemArray;
typedef CArray<CLogPage,CLogPage&> CLogPageArray;
 
typedef struct tagLOGCELL
{
    BYTE        m_nLine; //»óÇÏÁ¿젶óÀΠ
    UINT        m_nState;//´Ù¸¥¼¿°ú º´ÇյƴÂÁö ..
    UINT        m_nFormat;//Á¤·Ä¸ðµå
    RECT        m_rect;  //¼¿ÀÇ ¿µ¿ª
    COLORREF    m_txtclr;//±ÛÀÚ»ö
    COLORREF    m_bkgclr;//¹è°æ»ö
    CString        m_strTxt;//±ÛÀÚ
    CFont*        m_pfont; //ÆùÆ®
    CBitmap*    m_pBitmap;//ºñÆ®¸Ê
}LOGCELL;
 
//Orientation=°¡·Î(1), ¼¼·Î(2)  bDialog=DoModal()
class CPrintDC
{
public:
    CPrintDC();
    virtual ~CPrintDC();
    CDC* GetPrintDC(int Orientation, BOOL bDialog=FALSE);
protected:
    CDC *m_pDC;
};
 
class CLogCell : public tagLOGCELL
{
public:
    CLogCell();
    CLogCell(LPCSTR lpstr,
            CRect    rect,
            int nFormat=DT_CENTER,
            COLORREF textColor=0x00000000,
            COLORREF backColor=0x00ffffff,
            CFont* pf=NULL);
 
    void operator=(const CLogCell& log);
    void InitCell();
    void Draw(CDC* pDC);
};
 
class CLogPage 
{
public:
    CLogPage();
    CLogPage(CPoint startPnt);
    virtual ~CLogPage();
    void RemoveAll();
    void operator=(CLogPage& page);
 
    //Çà,¿­ °¹¼ö¸¦ ¼³Á¤ÇÑ´Ù.
    void SetColCount(int nCount);
    void SetRowCount(int nCount);
    BOOL RemoveRow(int nRow);
 
    //ÀåÇ¥ Ãâ·ÂÀ§Ä¡
    void SetStartPoint(CPoint startPnt);
    CPoint GetStartPoint() const;
 
    //Çà,¿­ °¹¼ö¸¦ ¸®ÅÏÇÑ´Ù.
    int GetColCount() const;
    int GetRowCount() const;
 
    //Æø,³ôÀ̸¦ ¼³Á¤ÇÑ´Ù.
    BOOL SetColWidth(int nCol, int nWidth);
    BOOL SetRowHeight(int nRow, int nHeight);
 
    //ÆùÆ®¸¦ ¼³Á¤ÇÑ´Ù.
    BOOL SetCellFont(int nRow, int nCol, CFont* pf);
    BOOL SetCellFont(int nsRow, int nsCol, int neRow, int neCol, CFont* pf);
    CFont* GetCellFont(int nRow, int nCol);
 
    //¹è°æ»öÀ» ¼³Á¤ÇÑ´Ù.
    BOOL SetCellBkgColor(int nRow, int nCol, COLORREF color);
    COLORREF GetCellBkgColor(int nRow, int nCol);
 
    //±ÛÀÚ»öÀ» ¼³Á¤ÇÑ´Ù.
    BOOL SetCellTxtColor(int nRow, int nCol, COLORREF color);
    COLORREF GetCellTxtColor(int nRow, int nCol);
 
    //±ÛÀÚÀ§Ä¡ ¼³Á¤
    BOOL SetCellFormat(int nRow, int nCol, int nFormat);
    int GetCellFormat(int nRow, int nCol);
 
    //RectÀ» ¼³Á¤ÇÑ´Ù.
    BOOL SetCellRect(int nRow, int nCol, CRect rect);
    BOOL GetCellRect(int nRow, int nCol, CRect& rect);
 
    //BITMAPÀ» ¼³Á¤ÇÑ´Ù.
    BOOL SetCellBmp(int nRow, int nCol, CBitmap* pBmp);
    CBitmap* GetCellBmp(int nRow, int nCol);
 
    //»ç°¢Çü ±×¸±¶§ ¾î´À À§Ä¡¸¦ ±×¸± °ÍÀΰ¡ ¼³Á¤ÇÑ´Ù. 
    BOOL SetCellLine(int nRow, int nCol, int nState=LCS_RECT/*LCS_RECT*/);
    int GetCellLine(int nRow, int nCol);
 
    //¼¿¿¡ ±ÛÀÚÀ» ÀÔ·ÂÇÑ´Ù.
    BOOL SetItemText(int nRow, int nCol, LPCTSTR lpstr, int nFormat=DT_CENTER|DT_VCENTER|DT_SINGLELINE);
    CString GetItemText(int nRow, int nCol);
 
    BOOL SetCell(int nRow, int nCol, CLogCell lc);
    CLogCell* GetCell(int nRow, int nCol);
 
    //¼¿À» º´ÇÕÇÑ´Ù.
    BOOL CellMerge(int nsCol, int nsRow, int neCol ,int neRow );
 
    //Ãâ·ÂÇÑ´Ù.(nPageNO´Â ÆäÀÌÁö ¹øÈ£À̸ç 0ÀÏ °æ¿ì Ãâ·ÂµÇÁö ¾Ê´Â´Ù.)
    void Draw(CDC* pDC, int nPageNO=0);
 
    //SetPageRect(,)ÇÔ¼ö¸¦ »ç¿ë½Ã 
    //Draw(CDC* pDC, int nPageNO=0);ÇÔ¼ö¸¦ È£ÃâÇϱ⠹ٷÎÀü¿¡ »ç¿ëÇØ¾ßÇÔ
    //¿ëµµ: 
    //   <<page>>                                 <<device>>
    //  0                               100      0                               1000  
    //  ¦£¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¤        ¦£¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¤
    //  ¦¢  (10,10)              (90,10)¦¢        ¦¢ (100,100)           (900,100)¦¢
    //  ¦¢  ¦£¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¤  ¦¢        ¦¢  ¦£¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¤  ¦¢
    //  ¦¢  ¦¢                      ¦¢  ¦¢        ¦¢  ¦¢                      ¦¢  ¦¢
    //  ¦¢  ¦¢                      ¦¢ ¦¬¦¬¦¬¦¬¦¬¦¬¦¬>¦¢                      ¦¢  ¦¢
    //  ¦¢  ¦¢                      ¦¢  ¦¢        ¦¢  ¦¢                      ¦¢  ¦¢
    //  ¦¢  ¦¢                      ¦¢  ¦¢        ¦¢  ¦¢                      ¦¢  ¦¢
    //  ¦¢  ¦¦¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¥  ¦¢        ¦¢  ¦¦¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¥  ¦¢
    //  ¦¢  (10,40)              (90,40)¦¢        ¦¢ (100,400)           (900,400)¦¢
    //  ¦¢                              ¦¢        ¦¢                              ¦¢
    //  ¦¢                              ¦¢        ¦¢                              ¦¢
    //  ¦¢                              ¦¢        ¦¢                              ¦¢
    //  ¦¢                              ¦¢        ¦¢                              ¦¢
    //  ¦¢                              ¦¢        ¦¢                              ¦¢
    //  ¦¢                              ¦¢        ¦¢                              ¦¢
    //  ¦¢                              ¦¢        ¦¢                              ¦¢
    //  ¦¢                              ¦¢        ¦¢                              ¦¢
    //  ¦¢                              ¦¢        ¦¢                              ¦¢
    //  ¦¢                              ¦¢        ¦¢                              ¦¢
    //  ¦¢                              ¦¢        ¦¢                              ¦¢
    //  ¦¦¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¥        ¦¦¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¥
    //  200                            100,200    2000                            1000,2000 
    //  
    //   CRect page(0,0,100,200);
    //   CRect device(0,0,1000,2000);
    //   ¿©¹éÀ» Á¶±Ý ÁÖ·Á¸é: CRect device(100,100,900,1900);
    //   SetPageRect(pDC, page, device);
    BOOL SetPageRect(CDC* pDC, CRect page, CRect device);
protected:
    bool m_IsViewPort;
    int m_RowCnt;
    int m_ColCnt;
    CPoint          m_startPnt;
    CLogItemArray m_liAry;
};
 
//ÀåÇ¥ Àüü¸¦ °ü¸®ÇÑ´Ù.
//ÀåÇ¥¸¦ Ãâ·ÂÇϱâ À§ÇØ ²À ÇÊ¿äÇÏÁø ¾Ê´Ù.
//CLogPage¸¦ »ç¿ëÇØµµ ¹«¹æÇÏ´Ù.
class CLogCtrl
{
public:
    CLogCtrl();
    virtual ~CLogCtrl();
    int  GetLogPageCount();
    void AddLogPage(CLogPage& lp);
    CLogPage* GetLogPage(int nPage);
    void DelLogPage(int nPage);
    void Draw(CDC* pDC, DOCINFO* pDocInfo);
protected:
    CLogPageArray m_log;
};
 
#endif