OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 | |
8 #include "../../include/formfiller/FFL_FormFiller.h" | 7 #include "../../include/formfiller/FFL_FormFiller.h" |
9 #include "../../include/formfiller/FFL_Notify.h" | 8 #include "../../include/formfiller/FFL_Notify.h" |
10 #include "../../include/formfiller/FFL_CBA_Fontmap.h" | 9 #include "../../include/formfiller/FFL_CBA_Fontmap.h" |
11 | 10 |
12 #define GetRed(rgb)» » » ((FX_BYTE)(rgb)) | 11 #define GetRed(rgb) ((FX_BYTE)(rgb)) |
13 #define GetGreen(rgb)» » ((FX_BYTE)(((FX_WORD)(rgb)) >> 8)) | 12 #define GetGreen(rgb) ((FX_BYTE)(((FX_WORD)(rgb)) >> 8)) |
14 #define GetBlue(rgb)» » ((FX_BYTE)((rgb)>>16)) | 13 #define GetBlue(rgb) ((FX_BYTE)((rgb) >> 16)) |
15 | 14 |
16 #define FFL_HINT_ELAPSE»» 800 | 15 #define FFL_HINT_ELAPSE 800 |
17 | 16 |
18 /* ------------------------- CFFL_FormFiller ------------------------- */ | 17 /* ------------------------- CFFL_FormFiller ------------------------- */ |
19 | 18 |
20 CFFL_FormFiller::CFFL_FormFiller(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnno
t) | 19 CFFL_FormFiller::CFFL_FormFiller(CPDFDoc_Environment* pApp, |
21 :m_pApp(pApp), | 20 CPDFSDK_Annot* pAnnot) |
22 m_pAnnot(pAnnot), | 21 : m_pApp(pApp), m_pAnnot(pAnnot), m_bValid(FALSE), m_ptOldPos(0, 0) { |
23 m_bValid(FALSE), | 22 m_pWidget = (CPDFSDK_Widget*)pAnnot; |
24 m_ptOldPos(0,0) | 23 } |
25 { | 24 |
26 m_pWidget = (CPDFSDK_Widget*) pAnnot; | 25 CFFL_FormFiller::~CFFL_FormFiller() { |
27 } | 26 FX_POSITION pos = m_Maps.GetStartPosition(); |
28 | 27 while (pos) { |
29 CFFL_FormFiller::~CFFL_FormFiller() | 28 CPDFSDK_PageView* pPageView = NULL; |
30 { | 29 CPWL_Wnd* pWnd = NULL; |
31 FX_POSITION pos = m_Maps.GetStartPosition(); | 30 m_Maps.GetNextAssoc(pos, pPageView, pWnd); |
32 while (pos) | 31 |
33 { | 32 if (pWnd) { |
34 CPDFSDK_PageView * pPageView = NULL; | 33 CFFL_PrivateData* pData = (CFFL_PrivateData*)pWnd->GetAttachedData(); |
35 CPWL_Wnd* pWnd = NULL; | 34 pWnd->Destroy(); |
36 m_Maps.GetNextAssoc(pos, pPageView, pWnd); | 35 delete pWnd; |
37 | 36 delete pData; |
38 if (pWnd) | 37 } |
39 { | 38 } |
40 CFFL_PrivateData* pData = (CFFL_PrivateData*)pWnd->GetAt
tachedData(); | 39 m_Maps.RemoveAll(); |
41 pWnd->Destroy(); | 40 } |
42 delete pWnd; | 41 |
43 delete pData; | 42 void CFFL_FormFiller::SetWindowRect(CPDFSDK_PageView* pPageView, |
44 } | 43 const CPDF_Rect& rcWindow) { |
45 } | 44 if (CPWL_Wnd* pWnd = this->GetPDFWindow(pPageView, FALSE)) { |
46 m_Maps.RemoveAll(); | 45 pWnd->Move(CPDF_Rect(rcWindow), TRUE, FALSE); |
47 | 46 } |
48 } | 47 } |
49 | 48 |
50 void CFFL_FormFiller::SetWindowRect(CPDFSDK_PageView* pPageView, const CPDF_Rect
& rcWindow) | 49 CPDF_Rect CFFL_FormFiller::GetWindowRect(CPDFSDK_PageView* pPageView) { |
51 { | 50 if (CPWL_Wnd* pWnd = this->GetPDFWindow(pPageView, FALSE)) { |
52 if (CPWL_Wnd* pWnd = this->GetPDFWindow(pPageView, FALSE)) | 51 return pWnd->GetWindowRect(); |
53 { | 52 } |
54 pWnd->Move(CPDF_Rect(rcWindow), TRUE, FALSE); | 53 |
55 } | 54 return CPDF_Rect(0, 0, 0, 0); |
56 } | 55 } |
57 | 56 |
58 CPDF_Rect CFFL_FormFiller::GetWindowRect(CPDFSDK_PageView* pPageView) | 57 FX_RECT CFFL_FormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, |
59 { | 58 CPDFSDK_Annot* pAnnot) { |
60 if (CPWL_Wnd* pWnd = this->GetPDFWindow(pPageView, FALSE)) | 59 ASSERT(pPageView != NULL); |
61 { | 60 ASSERT(pAnnot != NULL); |
62 return pWnd->GetWindowRect(); | 61 |
63 } | 62 CPDF_Rect rcAnnot = m_pWidget->GetRect(); |
64 | 63 |
65 return CPDF_Rect(0,0,0,0); | 64 if (CPWL_Wnd* pWnd = this->GetPDFWindow(pPageView, FALSE)) { |
66 } | 65 CPDF_Rect rcWindow = pWnd->GetWindowRect(); |
67 | 66 rcAnnot = PWLtoFFL(rcWindow); |
68 FX_RECT CFFL_FormFiller::GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot*
pAnnot) | 67 } |
69 { | 68 |
70 ASSERT(pPageView != NULL); | 69 CPDF_Rect rcWin = rcAnnot; |
71 ASSERT(pAnnot != NULL); | 70 // pPageView->DocToWindow(rcAnnot, rcWin); |
72 | 71 |
73 CPDF_Rect rcAnnot = m_pWidget->GetRect(); | 72 CPDF_Rect rcFocus = this->GetFocusBox(pPageView); |
74 | 73 if (!rcFocus.IsEmpty()) |
75 if (CPWL_Wnd* pWnd = this->GetPDFWindow(pPageView, FALSE)) | 74 rcWin.Union(rcFocus); |
76 { | 75 |
77 CPDF_Rect rcWindow = pWnd->GetWindowRect(); | 76 CPDF_Rect rect = CPWL_Utils::InflateRect(rcWin, 1); |
78 rcAnnot = PWLtoFFL(rcWindow); | 77 |
79 } | 78 return rect.GetOutterRect(); |
80 | 79 } |
81 CPDF_Rect rcWin = rcAnnot; | 80 |
82 // pPageView->DocToWindow(rcAnnot, rcWin); | 81 void CFFL_FormFiller::OnDraw(CPDFSDK_PageView* pPageView, |
83 | 82 /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, |
84 CPDF_Rect rcFocus = this->GetFocusBox(pPageView); | 83 CFX_RenderDevice* pDevice, |
85 if (!rcFocus.IsEmpty()) | 84 CPDF_Matrix* pUser2Device, |
86 rcWin.Union(rcFocus); | 85 /*const CRect& rcWindow,*/ FX_DWORD dwFlags) { |
87 | 86 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
88 CPDF_Rect rect = CPWL_Utils::InflateRect(rcWin,1); | 87 |
89 | 88 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { |
90 return rect.GetOutterRect(); | 89 CPDF_Matrix mt = this->GetCurMatrix(); |
91 } | 90 mt.Concat(*pUser2Device); |
92 | 91 pWnd->DrawAppearance(pDevice, &mt); |
93 void CFFL_FormFiller::OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_A
nnot* pAnnot, | 92 } else { |
94 CFX_RenderDevice* pDevice, CPDF_
Matrix* pUser2Device, | 93 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
95 /*const CRect& rcWindow,*/ FX_DW
ORD dwFlags) | 94 if (CFFL_IFormFiller::IsVisible(pWidget)) |
96 { | 95 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); |
97 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 96 } |
98 | 97 } |
99 if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) | 98 |
100 { | 99 void CFFL_FormFiller::OnDrawDeactive( |
101 CPDF_Matrix mt = this->GetCurMatrix(); | 100 CPDFSDK_PageView* pPageView, |
102 mt.Concat(*pUser2Device); | 101 /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, |
103 pWnd->DrawAppearance(pDevice,&mt); | 102 CFX_RenderDevice* pDevice, |
104 } | 103 CPDF_Matrix* pUser2Device, |
105 else | 104 /*const CRect& rcWindow,*/ FX_DWORD dwFlags) { |
106 { | 105 ASSERT(pAnnot != NULL); |
107 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 106 |
108 if (CFFL_IFormFiller::IsVisible(pWidget)) | 107 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
109 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Anno
t::Normal, NULL); | 108 |
110 } | 109 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); |
111 } | 110 } |
112 | 111 |
113 void CFFL_FormFiller::OnDrawDeactive(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ C
PDFSDK_Annot* pAnnot, | 112 void CFFL_FormFiller::OnCreate(CPDFSDK_Annot* pAnnot) { |
114 CFX_RenderDevice* pDevice, CPDF_
Matrix* pUser2Device, | 113 } |
115 /*const CRect& rcWindow,*/ FX_DW
ORD dwFlags) | 114 |
116 { | 115 void CFFL_FormFiller::OnLoad(CPDFSDK_Annot* pAnnot) { |
117 ASSERT(pAnnot != NULL); | 116 } |
118 | 117 |
119 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 118 void CFFL_FormFiller::OnDelete(CPDFSDK_Annot* pAnnot) { |
120 | 119 } |
121 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL)
; | 120 |
122 } | 121 void CFFL_FormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, |
123 | 122 CPDFSDK_Annot* pAnnot) { |
124 | 123 } |
125 void CFFL_FormFiller::OnCreate(CPDFSDK_Annot* pAnnot) | 124 |
126 { | 125 void CFFL_FormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, |
127 } | 126 CPDFSDK_Annot* pAnnot) { |
128 | 127 EndTimer(); |
129 void CFFL_FormFiller::OnLoad(CPDFSDK_Annot* pAnnot) | 128 ASSERT(m_pWidget != NULL); |
130 { | 129 } |
131 } | 130 |
132 | 131 FX_BOOL CFFL_FormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, |
133 void CFFL_FormFiller::OnDelete(CPDFSDK_Annot* pAnnot) | 132 CPDFSDK_Annot* pAnnot, |
134 { | 133 FX_UINT nFlags, |
135 } | 134 const CPDF_Point& point) { |
136 | 135 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE)) { |
137 void CFFL_FormFiller::OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* p
Annot) | 136 m_bValid = TRUE; |
138 { | 137 FX_RECT rect = this->GetViewBBox(pPageView, pAnnot); |
139 } | 138 this->InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); |
140 | 139 |
141 void CFFL_FormFiller::OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pA
nnot) | 140 if (!rect.Contains((int)point.x, (int)point.y)) |
142 { | 141 return FALSE; |
143 EndTimer(); | 142 |
144 ASSERT(m_pWidget != NULL); | 143 return pWnd->OnLButtonDown(WndtoPWL(pPageView, point), nFlags); |
145 } | 144 } |
146 | 145 |
147 FX_BOOL CFFL_FormFiller::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Anno
t* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 146 return FALSE; |
148 { | 147 } |
149 if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, TRUE)) | 148 |
150 { | 149 FX_BOOL CFFL_FormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, |
151 m_bValid = TRUE; | 150 CPDFSDK_Annot* pAnnot, |
152 FX_RECT rect = this->GetViewBBox(pPageView,pAnnot); | 151 FX_UINT nFlags, |
153 this->InvalidateRect(rect.left, rect.top, rect.right, rect.botto
m); | 152 const CPDF_Point& point) { |
154 | 153 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { |
155 if(!rect.Contains((int)point.x, (int)point.y)) | 154 FX_RECT rcFFL = this->GetViewBBox(pPageView, pAnnot); |
156 return FALSE; | 155 this->InvalidateRect(rcFFL.left, rcFFL.top, rcFFL.right, rcFFL.bottom); |
157 | 156 pWnd->OnLButtonUp(WndtoPWL(pPageView, point), nFlags); |
158 return pWnd->OnLButtonDown(WndtoPWL(pPageView, point),nFlags); | 157 return TRUE; |
159 } | 158 } |
160 | 159 |
161 return FALSE; | 160 return FALSE; |
162 } | 161 } |
163 | 162 |
164 FX_BOOL CFFL_FormFiller::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot*
pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 163 FX_BOOL CFFL_FormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, |
165 { | 164 CPDFSDK_Annot* pAnnot, |
166 if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) | 165 FX_UINT nFlags, |
167 { | 166 const CPDF_Point& point) { |
168 FX_RECT rcFFL = this->GetViewBBox(pPageView, pAnnot); | 167 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { |
169 this->InvalidateRect(rcFFL.left, rcFFL.top, rcFFL.right, rcFFL.b
ottom); | 168 pWnd->OnLButtonDblClk(WndtoPWL(pPageView, point), nFlags); |
170 pWnd->OnLButtonUp(WndtoPWL(pPageView, point),nFlags); | 169 return TRUE; |
171 return TRUE; | 170 } |
172 } | 171 |
173 | 172 return FALSE; |
174 return FALSE; | 173 } |
175 } | 174 |
176 | 175 FX_BOOL CFFL_FormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, |
177 FX_BOOL CFFL_FormFiller::OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_An
not* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 176 CPDFSDK_Annot* pAnnot, |
178 { | 177 FX_UINT nFlags, |
179 if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) | 178 const CPDF_Point& point) { |
180 { | 179 if ((m_ptOldPos.x != point.x) || (m_ptOldPos.y != point.y)) { |
181 pWnd->OnLButtonDblClk(WndtoPWL(pPageView, point),nFlags); | 180 m_ptOldPos = point; |
182 return TRUE; | 181 } |
183 } | 182 |
184 | 183 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { |
185 return FALSE; | 184 pWnd->OnMouseMove(WndtoPWL(pPageView, point), nFlags); |
186 } | 185 return TRUE; |
187 | 186 } |
188 FX_BOOL CFFL_FormFiller::OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot*
pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 187 |
189 { | 188 return FALSE; |
190 if ((m_ptOldPos.x != point.x) || (m_ptOldPos.y != point.y)) | 189 } |
191 { | 190 |
192 m_ptOldPos = point; | 191 FX_BOOL CFFL_FormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, |
193 } | 192 CPDFSDK_Annot* pAnnot, |
194 | 193 FX_UINT nFlags, |
195 if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) | 194 short zDelta, |
196 { | 195 const CPDF_Point& point) { |
197 pWnd->OnMouseMove(WndtoPWL(pPageView, point),nFlags); | 196 if (!IsValid()) |
198 return TRUE; | 197 return FALSE; |
199 } | 198 |
200 | 199 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE)) { |
201 return FALSE; | 200 return pWnd->OnMouseWheel(zDelta, WndtoPWL(pPageView, point), nFlags); |
202 } | 201 } |
203 | 202 |
204 FX_BOOL CFFL_FormFiller::OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot
* pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point) | 203 return FALSE; |
205 { | 204 } |
206 if (!IsValid()) return FALSE; | 205 |
207 | 206 FX_BOOL CFFL_FormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, |
208 if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, TRUE)) | 207 CPDFSDK_Annot* pAnnot, |
209 { | 208 FX_UINT nFlags, |
210 return pWnd->OnMouseWheel(zDelta, WndtoPWL(pPageView, point),nFl
ags); | 209 const CPDF_Point& point) { |
211 } | 210 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE)) { |
212 | 211 pWnd->OnRButtonDown(WndtoPWL(pPageView, point), nFlags); |
213 return FALSE; | 212 return TRUE; |
214 } | 213 } |
215 | 214 |
216 FX_BOOL CFFL_FormFiller::OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Anno
t* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 215 return FALSE; |
217 { | 216 } |
218 if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, TRUE)) | 217 |
219 { | 218 FX_BOOL CFFL_FormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, |
220 pWnd->OnRButtonDown(WndtoPWL(pPageView, point),nFlags); | 219 CPDFSDK_Annot* pAnnot, |
221 return TRUE; | 220 FX_UINT nFlags, |
222 } | 221 const CPDF_Point& point) { |
223 | 222 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { |
224 return FALSE; | 223 pWnd->OnRButtonUp(WndtoPWL(pPageView, point), nFlags); |
225 } | 224 return TRUE; |
226 | 225 } |
227 FX_BOOL CFFL_FormFiller::OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot*
pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 226 |
228 { | 227 return FALSE; |
229 if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) | 228 } |
230 { | 229 |
231 pWnd->OnRButtonUp(WndtoPWL(pPageView, point),nFlags); | 230 FX_BOOL CFFL_FormFiller::OnRButtonDblClk(CPDFSDK_PageView* pPageView, |
232 return TRUE; | 231 CPDFSDK_Annot* pAnnot, |
233 } | 232 FX_UINT nFlags, |
234 | 233 const CPDF_Point& point) { |
235 return FALSE; | 234 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { |
236 } | 235 pWnd->OnRButtonDblClk(WndtoPWL(pPageView, point), nFlags); |
237 | 236 return TRUE; |
238 FX_BOOL CFFL_FormFiller::OnRButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_An
not* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 237 } |
239 { | 238 |
240 if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) | 239 return FALSE; |
241 { | 240 } |
242 pWnd->OnRButtonDblClk(WndtoPWL(pPageView, point),nFlags); | 241 |
243 return TRUE; | 242 FX_BOOL CFFL_FormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, |
244 } | 243 FX_UINT nKeyCode, |
245 | 244 FX_UINT nFlags) { |
246 return FALSE; | 245 if (IsValid()) { |
247 } | 246 CPDFSDK_PageView* pPageView = this->GetCurPageView(); |
248 | 247 ASSERT(pPageView != NULL); |
249 FX_BOOL CFFL_FormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_U
INT nFlags) | 248 |
250 { | 249 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { |
251 if (IsValid()) | 250 return pWnd->OnKeyDown(nKeyCode, nFlags); |
252 { | 251 } |
253 CPDFSDK_PageView* pPageView = this->GetCurPageView(); | 252 } |
254 ASSERT(pPageView != NULL); | 253 |
255 | 254 return FALSE; |
256 if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) | 255 } |
257 { | 256 |
258 return pWnd->OnKeyDown(nKeyCode,nFlags); | 257 FX_BOOL CFFL_FormFiller::OnChar(CPDFSDK_Annot* pAnnot, |
259 } | 258 FX_UINT nChar, |
260 } | 259 FX_UINT nFlags) { |
261 | 260 if (IsValid()) { |
262 return FALSE; | 261 CPDFSDK_PageView* pPageView = this->GetCurPageView(); |
263 } | 262 ASSERT(pPageView != NULL); |
264 | 263 |
265 FX_BOOL CFFL_FormFiller::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nF
lags) | 264 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { |
266 { | 265 return pWnd->OnChar(nChar, nFlags); |
267 if (IsValid()) | 266 } |
268 { | 267 } |
269 CPDFSDK_PageView* pPageView = this->GetCurPageView(); | 268 |
270 ASSERT(pPageView != NULL); | 269 return FALSE; |
271 | 270 } |
272 if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) | 271 |
273 { | 272 void CFFL_FormFiller::OnDeSelected(CPDFSDK_Annot* pAnnot) { |
274 return pWnd->OnChar(nChar,nFlags); | 273 ASSERT(FALSE); |
275 } | 274 } |
276 } | 275 |
277 | 276 void CFFL_FormFiller::OnSelected(CPDFSDK_Annot* pAnnot) { |
278 return FALSE; | 277 ASSERT(FALSE); |
279 } | 278 } |
280 | 279 |
281 void CFFL_FormFiller::OnDeSelected(CPDFSDK_Annot* pAnnot) | 280 FX_BOOL CFFL_FormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { |
282 { | 281 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
283 ASSERT(FALSE); | 282 |
284 } | 283 CPDF_Page* pPage = pWidget->GetPDFPage(); |
285 | 284 CPDFSDK_Document* pDoc = m_pApp->GetCurrentDoc(); |
286 void CFFL_FormFiller::OnSelected(CPDFSDK_Annot* pAnnot) | 285 CPDFSDK_PageView* pPageView = pDoc->GetPageView(pPage); |
287 { | 286 ASSERT(pPageView != NULL); |
288 ASSERT(FALSE); | 287 |
289 } | 288 CPWL_Wnd* pWnd = NULL; |
290 | 289 if ((pWnd = GetPDFWindow(pPageView, TRUE))) { |
291 FX_BOOL CFFL_FormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) | 290 pWnd->SetFocus(); |
292 { | 291 } |
293 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 292 |
294 | 293 m_bValid = TRUE; |
295 CPDF_Page * pPage = pWidget->GetPDFPage(); | 294 |
296 CPDFSDK_Document * pDoc = m_pApp->GetCurrentDoc(); | 295 m_bValid = TRUE; |
297 CPDFSDK_PageView* pPageView = pDoc->GetPageView(pPage); | 296 FX_RECT rcRect = this->GetViewBBox(pPageView, pAnnot); |
298 ASSERT(pPageView != NULL); | 297 this->InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom); |
299 | 298 |
300 | 299 return TRUE; |
301 | 300 } |
302 CPWL_Wnd * pWnd = NULL; | 301 |
303 if ( (pWnd = GetPDFWindow(pPageView, TRUE))) | 302 FX_BOOL CFFL_FormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { |
304 { | 303 if (IsValid()) { |
305 pWnd->SetFocus(); | 304 CPDFSDK_PageView* pPageView = this->GetCurPageView(); |
306 } | 305 ASSERT(pPageView != NULL); |
307 | 306 |
308 m_bValid = TRUE; | 307 CommitData(pPageView, nFlag); |
309 | 308 |
310 | 309 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { |
311 | 310 pWnd->KillFocus(); |
312 | 311 } |
313 m_bValid = TRUE; | 312 |
314 FX_RECT rcRect = this->GetViewBBox(pPageView,pAnnot); | 313 switch (m_pWidget->GetFieldType()) { |
315 this->InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.botto
m); | 314 case FIELDTYPE_PUSHBUTTON: |
316 | 315 case FIELDTYPE_CHECKBOX: |
317 return TRUE; | 316 case FIELDTYPE_RADIOBUTTON: |
318 } | 317 EscapeFiller(pPageView, TRUE); |
319 | 318 break; |
320 FX_BOOL CFFL_FormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) | 319 default: |
321 { | 320 EscapeFiller(pPageView, FALSE); |
322 if (IsValid()) | 321 break; |
323 { | 322 } |
324 CPDFSDK_PageView* pPageView = this->GetCurPageView(); | 323 } |
325 ASSERT(pPageView != NULL); | 324 |
326 | 325 return TRUE; |
327 CommitData(pPageView, nFlag); | 326 } |
328 | 327 |
329 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) | 328 FX_BOOL CFFL_FormFiller::IsValid() const { |
330 { | 329 return m_bValid; |
331 pWnd->KillFocus(); | 330 } |
332 } | 331 |
333 | 332 PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() { |
334 switch (m_pWidget->GetFieldType()) | 333 ASSERT(m_pApp != NULL); |
335 { | 334 |
336 case FIELDTYPE_PUSHBUTTON: | 335 PWL_CREATEPARAM cp; |
337 case FIELDTYPE_CHECKBOX: | 336 |
338 case FIELDTYPE_RADIOBUTTON: | 337 cp.pParentWnd = NULL; |
339 EscapeFiller(pPageView, TRUE); | 338 cp.pProvider = this; |
340 break; | 339 cp.rcRectWnd = GetPDFWindowRect(); |
341 default: | 340 |
342 EscapeFiller(pPageView, FALSE); | 341 FX_DWORD dwCreateFlags = PWS_BORDER | PWS_BACKGROUND | PWS_VISIBLE; |
343 break; | 342 |
344 } | 343 ASSERT(m_pWidget != NULL); |
345 } | 344 |
346 | 345 FX_DWORD dwFieldFlag = m_pWidget->GetFieldFlags(); |
347 return TRUE; | 346 |
348 } | 347 if (dwFieldFlag & FIELDFLAG_READONLY) { |
349 | 348 dwCreateFlags |= PWS_READONLY; |
350 FX_BOOL CFFL_FormFiller::IsValid() const | 349 } |
351 { | 350 |
352 return m_bValid; | 351 FX_COLORREF color; |
353 } | 352 if (m_pWidget->GetFillColor(color)) { |
354 | 353 cp.sBackgroundColor = |
355 PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() | 354 CPWL_Color(GetRed(color), GetGreen(color), GetBlue(color)); |
356 { | 355 } |
357 ASSERT(m_pApp != NULL); | 356 |
358 | 357 if (m_pWidget->GetBorderColor(color)) { |
359 PWL_CREATEPARAM cp; | 358 cp.sBorderColor = |
360 | 359 CPWL_Color(GetRed(color), GetGreen(color), GetBlue(color)); |
361 cp.pParentWnd = NULL; | 360 } |
362 cp.pProvider = this; | 361 |
363 cp.rcRectWnd = GetPDFWindowRect(); | 362 cp.sTextColor = CPWL_Color(COLORTYPE_GRAY, 0); |
364 | 363 |
365 FX_DWORD dwCreateFlags = PWS_BORDER | PWS_BACKGROUND | PWS_VISIBLE; | 364 if (m_pWidget->GetTextColor(color)) { |
366 | 365 cp.sTextColor = CPWL_Color(GetRed(color), GetGreen(color), GetBlue(color)); |
367 ASSERT(m_pWidget != NULL); | 366 } |
368 | 367 |
369 | 368 cp.fFontSize = m_pWidget->GetFontSize(); |
370 FX_DWORD dwFieldFlag = m_pWidget->GetFieldFlags(); | 369 cp.dwBorderWidth = m_pWidget->GetBorderWidth(); |
371 | 370 |
372 if (dwFieldFlag & FIELDFLAG_READONLY) | 371 int nBorderStyle = m_pWidget->GetBorderStyle(); |
373 { | 372 |
374 dwCreateFlags |= PWS_READONLY; | 373 switch (nBorderStyle) { |
375 } | 374 case BBS_SOLID: |
376 | 375 cp.nBorderStyle = PBS_SOLID; |
377 FX_COLORREF color; | 376 break; |
378 if (m_pWidget->GetFillColor(color)) | 377 case BBS_DASH: |
379 { | 378 cp.nBorderStyle = PBS_DASH; |
380 cp.sBackgroundColor = CPWL_Color(GetRed(color), GetGreen(color),
GetBlue(color)); | 379 cp.sDash = CPWL_Dash(3, 3, 0); |
381 } | 380 break; |
382 | 381 case BBS_BEVELED: |
383 if (m_pWidget->GetBorderColor(color)) | 382 cp.nBorderStyle = PBS_BEVELED; |
384 { | 383 cp.dwBorderWidth *= 2; |
385 cp.sBorderColor = CPWL_Color(GetRed(color), GetGreen(color), Get
Blue(color)); | 384 break; |
386 } | 385 case BBS_INSET: |
387 | 386 cp.nBorderStyle = PBS_INSET; |
388 cp.sTextColor = CPWL_Color(COLORTYPE_GRAY,0); | 387 cp.dwBorderWidth *= 2; |
389 | 388 break; |
390 if (m_pWidget->GetTextColor(color)) | 389 case BBS_UNDERLINE: |
391 { | 390 cp.nBorderStyle = PBS_UNDERLINED; |
392 cp.sTextColor = CPWL_Color(GetRed(color), GetGreen(color), GetBl
ue(color)); | 391 break; |
393 } | 392 } |
394 | 393 |
395 cp.fFontSize = m_pWidget->GetFontSize(); | 394 if (cp.fFontSize <= 0) { |
396 cp.dwBorderWidth = m_pWidget->GetBorderWidth(); | 395 dwCreateFlags |= PWS_AUTOFONTSIZE; |
397 | 396 } |
398 int nBorderStyle = m_pWidget->GetBorderStyle(); | 397 |
399 | 398 cp.dwFlags = dwCreateFlags; |
400 switch (nBorderStyle) | 399 cp.pSystemHandler = m_pApp->GetSysHandler(); |
401 { | 400 return cp; |
402 case BBS_SOLID: | 401 } |
403 cp.nBorderStyle = PBS_SOLID; | 402 |
404 break; | 403 CPWL_Wnd* CFFL_FormFiller::GetPDFWindow(CPDFSDK_PageView* pPageView, |
405 case BBS_DASH: | 404 FX_BOOL bNew) { |
406 cp.nBorderStyle = PBS_DASH; | 405 ASSERT(pPageView != NULL); |
407 cp.sDash = CPWL_Dash(3,3,0); | 406 ASSERT(m_pWidget != NULL); |
408 break; | 407 |
409 case BBS_BEVELED: | 408 CPWL_Wnd* pWnd = NULL; |
410 cp.nBorderStyle = PBS_BEVELED; | 409 m_Maps.Lookup(pPageView, pWnd); |
411 cp.dwBorderWidth *= 2; | 410 |
412 break; | 411 if (bNew) { |
413 case BBS_INSET: | 412 if (pWnd) { |
414 cp.nBorderStyle = PBS_INSET; | 413 CFFL_PrivateData* pPrivateData = |
415 cp.dwBorderWidth *= 2; | 414 (CFFL_PrivateData*)pWnd->GetAttachedData(); |
416 break; | 415 ASSERT(pPrivateData != NULL); |
417 case BBS_UNDERLINE: | 416 |
418 cp.nBorderStyle = PBS_UNDERLINED; | 417 if (pPrivateData->nWidgetAge != m_pWidget->GetAppearanceAge()) { |
419 break; | 418 return this->ResetPDFWindow( |
420 } | 419 pPageView, m_pWidget->GetValueAge() == pPrivateData->nValueAge); |
421 | 420 } |
422 if (cp.fFontSize <= 0) | 421 } else { |
423 { | 422 PWL_CREATEPARAM cp = GetCreateParam(); |
424 dwCreateFlags |= PWS_AUTOFONTSIZE; | 423 cp.hAttachedWnd = (FX_HWND)m_pWidget; |
425 } | 424 |
426 | 425 CFFL_PrivateData* pPrivateData = new CFFL_PrivateData; |
427 cp.dwFlags = dwCreateFlags; | 426 pPrivateData->pWidget = m_pWidget; |
428 cp.pSystemHandler = m_pApp->GetSysHandler(); | 427 pPrivateData->pPageView = pPageView; |
429 return cp; | 428 pPrivateData->nWidgetAge = m_pWidget->GetAppearanceAge(); |
430 } | 429 pPrivateData->nValueAge = 0; |
431 | 430 |
432 CPWL_Wnd* CFFL_FormFiller::GetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bNe
w) | 431 cp.pAttachedData = pPrivateData; |
433 { | 432 |
434 ASSERT(pPageView != NULL); | 433 pWnd = NewPDFWindow(cp, pPageView); |
435 ASSERT(m_pWidget != NULL); | 434 |
436 | 435 if (pWnd) { |
437 CPWL_Wnd* pWnd = NULL; | 436 m_Maps.SetAt(pPageView, pWnd); |
438 m_Maps.Lookup(pPageView, pWnd); | 437 } |
439 | 438 } |
440 if (bNew) | 439 } |
441 { | 440 |
442 if (pWnd) | 441 return pWnd; |
443 { | 442 } |
444 CFFL_PrivateData* pPrivateData = (CFFL_PrivateData*)pWnd
->GetAttachedData(); | 443 |
445 ASSERT(pPrivateData != NULL); | 444 void CFFL_FormFiller::DestroyPDFWindow(CPDFSDK_PageView* pPageView) { |
446 | 445 CPWL_Wnd* pWnd = NULL; |
447 if (pPrivateData->nWidgetAge != m_pWidget->GetAppearance
Age()) | 446 m_Maps.Lookup(pPageView, pWnd); |
448 { | 447 |
449 return this->ResetPDFWindow(pPageView, m_pWidget
->GetValueAge() == pPrivateData->nValueAge); | 448 if (pWnd) { |
450 } | 449 CFFL_PrivateData* pData = (CFFL_PrivateData*)pWnd->GetAttachedData(); |
451 } | 450 pData->pPageView = NULL; |
452 else | 451 pWnd->Destroy(); |
453 { | 452 delete pWnd; |
454 PWL_CREATEPARAM cp = GetCreateParam(); | 453 delete pData; |
455 cp.hAttachedWnd = (FX_HWND)m_pWidget; | 454 } |
456 | 455 |
457 CFFL_PrivateData* pPrivateData = new CFFL_PrivateData; | 456 m_Maps.RemoveKey(pPageView); |
458 pPrivateData->pWidget = m_pWidget; | 457 } |
459 pPrivateData->pPageView = pPageView; | 458 |
460 pPrivateData->nWidgetAge = m_pWidget->GetAppearanceAge()
; | 459 CPDF_Matrix CFFL_FormFiller::GetWindowMatrix(void* pAttachedData) { |
461 pPrivateData->nValueAge = 0; | 460 if (CFFL_PrivateData* pPrivateData = (CFFL_PrivateData*)pAttachedData) { |
462 | 461 if (pPrivateData->pPageView) { |
463 cp.pAttachedData = pPrivateData; | 462 CPDF_Matrix mtPageView; |
464 | 463 pPrivateData->pPageView->GetCurrentMatrix(mtPageView); |
465 pWnd = NewPDFWindow(cp, pPageView); | 464 CPDF_Matrix mt = GetCurMatrix(); |
466 | 465 mt.Concat(mtPageView); |
467 if (pWnd) | 466 |
468 { | 467 return mt; |
469 m_Maps.SetAt(pPageView, pWnd); | 468 } |
470 } | 469 } |
471 } | 470 return CPDF_Matrix(1, 0, 0, 1, 0, 0); |
472 } | 471 } |
473 | 472 |
474 return pWnd; | 473 CPDF_Matrix CFFL_FormFiller::GetCurMatrix() { |
475 } | 474 CPDF_Matrix mt; |
476 | 475 |
477 void CFFL_FormFiller::DestroyPDFWindow(CPDFSDK_PageView* pPageView) | 476 ASSERT(m_pWidget != NULL); |
478 { | 477 |
479 CPWL_Wnd* pWnd = NULL; | 478 CPDF_Rect rcDA; |
480 m_Maps.Lookup(pPageView, pWnd); | 479 m_pWidget->GetPDFAnnot()->GetRect(rcDA); |
481 | 480 |
482 if (pWnd) | 481 switch (m_pWidget->GetRotate()) { |
483 { | 482 default: |
484 CFFL_PrivateData* pData = (CFFL_PrivateData*)pWnd->GetAttachedDa
ta(); | 483 case 0: |
485 pData->pPageView = NULL; | 484 mt = CPDF_Matrix(1, 0, 0, 1, 0, 0); |
486 pWnd->Destroy(); | 485 break; |
487 delete pWnd; | 486 case 90: |
488 delete pData; | 487 mt = CPDF_Matrix(0, 1, -1, 0, rcDA.right - rcDA.left, 0); |
489 } | 488 break; |
490 | 489 case 180: |
491 m_Maps.RemoveKey(pPageView); | 490 mt = CPDF_Matrix( |
492 } | 491 -1, 0, 0, -1, rcDA.right - rcDA.left, rcDA.top - rcDA.bottom); |
493 | 492 break; |
494 CPDF_Matrix CFFL_FormFiller::GetWindowMatrix(void* pAttachedData) | 493 case 270: |
495 { | 494 mt = CPDF_Matrix(0, -1, 1, 0, 0, rcDA.top - rcDA.bottom); |
496 if (CFFL_PrivateData* pPrivateData = (CFFL_PrivateData*)pAttachedData) | 495 break; |
497 { | 496 } |
498 if (pPrivateData->pPageView) | 497 mt.e += rcDA.left; |
499 { | 498 mt.f += rcDA.bottom; |
500 CPDF_Matrix mtPageView; | 499 |
501 pPrivateData->pPageView->GetCurrentMatrix(mtPageView); | 500 return mt; |
502 CPDF_Matrix mt = GetCurMatrix(); | 501 } |
503 mt.Concat(mtPageView); | 502 |
504 | 503 CFX_WideString CFFL_FormFiller::LoadPopupMenuString(int nIndex) { |
505 return mt; | 504 ASSERT(m_pApp != NULL); |
506 } | 505 |
507 } | 506 return L""; |
508 return CPDF_Matrix(1,0,0,1,0,0); | 507 } |
509 } | 508 |
510 | 509 CPDF_Rect CFFL_FormFiller::GetPDFWindowRect() const { |
511 CPDF_Matrix CFFL_FormFiller::GetCurMatrix() | 510 ASSERT(m_pWidget != NULL); |
512 { | 511 |
513 CPDF_Matrix mt; | 512 CPDF_Rect rectAnnot; |
514 | 513 m_pWidget->GetPDFAnnot()->GetRect(rectAnnot); |
515 ASSERT(m_pWidget != NULL); | 514 |
516 | 515 FX_FLOAT fWidth = rectAnnot.right - rectAnnot.left; |
517 CPDF_Rect rcDA ; | 516 FX_FLOAT fHeight = rectAnnot.top - rectAnnot.bottom; |
518 m_pWidget->GetPDFAnnot()->GetRect(rcDA); | 517 |
519 | 518 if ((m_pWidget->GetRotate() / 90) & 0x01) |
520 | 519 return CPDF_Rect(0, 0, fHeight, fWidth); |
521 switch (m_pWidget->GetRotate()) | 520 else |
522 { | 521 return CPDF_Rect(0, 0, fWidth, fHeight); |
523 default: | 522 } |
524 case 0: | 523 |
525 mt = CPDF_Matrix(1,0,0,1,0,0); | 524 CPDFSDK_PageView* CFFL_FormFiller::GetCurPageView() { |
526 break; | 525 CPDF_Page* pPage = m_pAnnot->GetPDFPage(); |
527 case 90: | 526 CPDFSDK_Document* pSDKDoc = m_pApp->GetCurrentDoc(); |
528 mt = CPDF_Matrix(0,1,-1,0,rcDA.right - rcDA.left,0); | 527 if (pSDKDoc) { |
529 break; | 528 return pSDKDoc->GetPageView(pPage); |
530 case 180: | 529 } |
531 mt = CPDF_Matrix(-1,0,0,-1,rcDA.right - rcDA.left,rcDA.top - rcD
A.bottom); | 530 return NULL; |
532 break; | 531 } |
533 case 270: | 532 |
534 mt = CPDF_Matrix(0,-1,1,0,0,rcDA.top - rcDA.bottom); | 533 CPDF_Rect CFFL_FormFiller::GetFocusBox(CPDFSDK_PageView* pPageView) { |
535 break; | 534 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { |
536 } | 535 CPDF_Rect rcFocus = FFLtoWnd(pPageView, PWLtoFFL(pWnd->GetFocusRect())); |
537 mt.e += rcDA.left; | 536 ASSERT(pPageView); |
538 mt.f += rcDA.bottom; | 537 CPDF_Rect rcPage = pPageView->GetPDFPage()->GetPageBBox(); |
539 | 538 if (rcPage.Contains(rcFocus)) |
540 return mt; | 539 return rcFocus; |
541 } | 540 else |
542 | 541 return CPDF_Rect(0, 0, 0, 0); |
543 CFX_WideString CFFL_FormFiller::LoadPopupMenuString(int nIndex) | 542 } |
544 { | 543 return CPDF_Rect(0, 0, 0, 0); |
545 ASSERT(m_pApp != NULL); | 544 } |
546 | 545 |
547 return L""; | 546 CPDF_Rect CFFL_FormFiller::FFLtoPWL(const CPDF_Rect& rect) { |
548 } | 547 CPDF_Matrix mt; |
549 | 548 mt.SetReverse(GetCurMatrix()); |
550 CPDF_Rect CFFL_FormFiller::GetPDFWindowRect() const | 549 |
551 { | 550 CPDF_Rect temp = rect; |
552 ASSERT(m_pWidget != NULL); | 551 mt.TransformRect(temp); |
553 | 552 |
554 CPDF_Rect rectAnnot; | 553 return temp; |
555 m_pWidget->GetPDFAnnot()->GetRect(rectAnnot); | 554 } |
556 | 555 |
557 FX_FLOAT fWidth = rectAnnot.right - rectAnnot.left; | 556 CPDF_Rect CFFL_FormFiller::PWLtoFFL(const CPDF_Rect& rect) { |
558 FX_FLOAT fHeight = rectAnnot.top - rectAnnot.bottom; | 557 CPDF_Matrix mt = GetCurMatrix(); |
559 | 558 |
560 | 559 CPDF_Rect temp = rect; |
561 if ((m_pWidget->GetRotate() / 90) & 0x01) | 560 mt.TransformRect(temp); |
562 return CPDF_Rect(0,0,fHeight,fWidth); | 561 |
563 else | 562 return temp; |
564 return CPDF_Rect(0,0,fWidth,fHeight); | 563 } |
565 } | 564 |
566 | 565 CPDF_Point CFFL_FormFiller::FFLtoPWL(const CPDF_Point& point) { |
567 CPDFSDK_PageView* CFFL_FormFiller::GetCurPageView() | 566 CPDF_Matrix mt; |
568 { | 567 mt.SetReverse(GetCurMatrix()); |
569 | 568 |
570 CPDF_Page* pPage = m_pAnnot->GetPDFPage(); | 569 CPDF_Point pt = point; |
571 CPDFSDK_Document* pSDKDoc = m_pApp->GetCurrentDoc(); | 570 mt.Transform(pt.x, pt.y); |
572 if(pSDKDoc) | 571 |
573 { | 572 return pt; |
574 return pSDKDoc->GetPageView(pPage); | 573 } |
575 } | 574 |
576 return NULL; | 575 CPDF_Point CFFL_FormFiller::PWLtoFFL(const CPDF_Point& point) { |
577 } | 576 CPDF_Matrix mt = GetCurMatrix(); |
578 | 577 |
579 CPDF_Rect CFFL_FormFiller::GetFocusBox(CPDFSDK_PageView* pPageView) | 578 CPDF_Point pt = point; |
580 { | 579 mt.Transform(pt.x, pt.y); |
581 if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) | 580 |
582 { | 581 return pt; |
583 CPDF_Rect rcFocus = FFLtoWnd(pPageView, PWLtoFFL(pWnd->GetFocus
Rect())); | 582 } |
584 ASSERT(pPageView); | 583 |
585 CPDF_Rect rcPage = pPageView->GetPDFPage()->GetPageBBox(); | 584 CPDF_Point CFFL_FormFiller::WndtoPWL(CPDFSDK_PageView* pPageView, |
586 if(rcPage.Contains(rcFocus)) | 585 const CPDF_Point& pt) { |
587 return rcFocus; | 586 // ASSERT(pPageView != NULL); |
588 else | 587 // |
589 return CPDF_Rect(0,0,0,0); | 588 // CPDF_Point point(0.0f, 0.0f); |
590 } | 589 // pPageView->WindowToDoc(pt.x, pt.y, point.x, point.y); |
591 return CPDF_Rect(0,0,0,0); | 590 // |
592 } | 591 return FFLtoPWL(pt); |
593 | 592 // return CPDF_Point(0, 0); |
594 CPDF_Rect CFFL_FormFiller::FFLtoPWL(const CPDF_Rect& rect) | 593 } |
595 { | 594 |
596 CPDF_Matrix mt; | 595 CPDF_Rect CFFL_FormFiller::FFLtoWnd(CPDFSDK_PageView* pPageView, |
597 mt.SetReverse(GetCurMatrix()); | 596 const CPDF_Rect& rect) { |
598 | 597 // FX_RECT rcRet(0,0,0,0); |
599 CPDF_Rect temp = rect; | 598 // |
600 mt.TransformRect(temp); | 599 // ASSERT(pPageView != NULL); |
601 | 600 // pPageView->DocToWindow(rect, rcRet); |
602 return temp; | 601 // |
603 } | 602 return rect; |
604 | 603 } |
605 CPDF_Rect CFFL_FormFiller::PWLtoFFL(const CPDF_Rect& rect) | 604 |
606 { | 605 void CFFL_FormFiller::FFL_FreeData(void* pData) { |
607 CPDF_Matrix mt = GetCurMatrix(); | 606 ASSERT(pData != NULL); |
608 | 607 |
609 CPDF_Rect temp = rect; | 608 delete (CFFL_PrivateData*)pData; |
610 mt.TransformRect(temp); | 609 } |
611 | 610 |
612 return temp; | 611 FX_BOOL CFFL_FormFiller::CommitData(CPDFSDK_PageView* pPageView, |
613 } | 612 FX_UINT nFlag) { |
614 | 613 if (IsDataChanged(pPageView)) { |
615 CPDF_Point CFFL_FormFiller::FFLtoPWL(const CPDF_Point& point) | 614 // CFFL_IFormFiller* pIFormFiller = CFFL_Module::GetFormFiller(m_pApp); |
616 { | 615 CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); // NULL; |
617 CPDF_Matrix mt; | 616 ASSERT(pIFormFiller != NULL); |
618 mt.SetReverse(GetCurMatrix()); | 617 |
619 | 618 FX_BOOL bRC = TRUE; |
620 CPDF_Point pt = point; | 619 FX_BOOL bExit = FALSE; |
621 mt.Transform(pt.x,pt.y); | 620 |
622 | 621 pIFormFiller->OnKeyStrokeCommit(m_pWidget, pPageView, bRC, bExit, nFlag); |
623 return pt; | 622 if (bExit) |
624 } | 623 return TRUE; |
625 | 624 if (!bRC) { |
626 CPDF_Point CFFL_FormFiller::PWLtoFFL(const CPDF_Point & point) | 625 this->ResetPDFWindow(pPageView, FALSE); |
627 { | 626 return TRUE; |
628 CPDF_Matrix mt = GetCurMatrix(); | 627 } |
629 | 628 |
630 CPDF_Point pt = point; | 629 pIFormFiller->OnValidate(m_pWidget, pPageView, bRC, bExit, nFlag); |
631 mt.Transform(pt.x,pt.y); | 630 if (bExit) |
632 | 631 return TRUE; |
633 return pt; | 632 if (!bRC) { |
634 } | 633 this->ResetPDFWindow(pPageView, FALSE); |
635 | 634 return TRUE; |
636 CPDF_Point CFFL_FormFiller::WndtoPWL(CPDFSDK_PageView* pPageView, const CPDF_Poi
nt& pt) | 635 } |
637 { | 636 |
638 // ASSERT(pPageView != NULL); | 637 SaveData(pPageView); |
639 // | 638 |
640 // CPDF_Point point(0.0f, 0.0f); | 639 pIFormFiller->OnCalculate(m_pWidget, pPageView, bExit, nFlag); |
641 // pPageView->WindowToDoc(pt.x, pt.y, point.x, point.y); | 640 if (bExit) |
642 // | 641 return TRUE; |
643 return FFLtoPWL(pt); | 642 |
644 // return CPDF_Point(0, 0); | 643 pIFormFiller->OnFormat(m_pWidget, pPageView, bExit, nFlag); |
645 } | 644 } |
646 | 645 |
647 CPDF_Rect CFFL_FormFiller::FFLtoWnd(CPDFSDK_PageView* pPageView, const CPDF_Rect
& rect) | 646 return TRUE; |
648 { | 647 } |
649 // FX_RECT rcRet(0,0,0,0); | 648 |
650 // | 649 FX_BOOL CFFL_FormFiller::IsDataChanged(CPDFSDK_PageView* pPageView) { |
651 // ASSERT(pPageView != NULL); | 650 return FALSE; |
652 // pPageView->DocToWindow(rect, rcRet); | 651 } |
653 // | 652 |
654 return rect; | 653 void CFFL_FormFiller::SaveData(CPDFSDK_PageView* pPageView) { |
655 | 654 } |
656 } | 655 |
657 | 656 void CFFL_FormFiller::GetKeyStrokeData(CPDFSDK_PageView* pPageView, |
658 void CFFL_FormFiller::FFL_FreeData(void* pData) | 657 FFL_KeyStrokeData& data) { |
659 { | 658 } |
660 ASSERT(pData != NULL); | 659 |
661 | 660 void CFFL_FormFiller::SetChangeMark() { |
662 delete (CFFL_PrivateData*)pData; | 661 m_pApp->FFI_OnChange(); |
663 } | 662 } |
664 | 663 |
665 FX_BOOL CFFL_FormFiller::CommitData(CPDFSDK_PageView* pPageView, FX_UINT nFlag) | 664 void CFFL_FormFiller::GetActionData(CPDFSDK_PageView* pPageView, |
666 { | 665 CPDF_AAction::AActionType type, |
667 if (IsDataChanged(pPageView)) | 666 PDFSDK_FieldAction& fa) { |
668 { | 667 fa.sValue = m_pWidget->GetValue(); |
669 //CFFL_IFormFiller* pIFormFiller = CFFL_Module::GetFormFiller(m_
pApp); | 668 } |
670 CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller();//NULL
; | 669 |
671 ASSERT(pIFormFiller != NULL); | 670 void CFFL_FormFiller::SetActionData(CPDFSDK_PageView* pPageView, |
672 | 671 CPDF_AAction::AActionType type, |
673 FX_BOOL bRC = TRUE; | 672 const PDFSDK_FieldAction& fa) { |
674 FX_BOOL bExit = FALSE; | 673 } |
675 | 674 |
676 pIFormFiller->OnKeyStrokeCommit(m_pWidget, pPageView, bRC, bExit
, nFlag); | 675 FX_BOOL CFFL_FormFiller::IsActionDataChanged(CPDF_AAction::AActionType type, |
677 if (bExit) return TRUE; | 676 const PDFSDK_FieldAction& faOld, |
678 if (!bRC) | 677 const PDFSDK_FieldAction& faNew) { |
679 { | 678 return FALSE; |
680 this->ResetPDFWindow(pPageView, FALSE); | 679 } |
681 return TRUE; | 680 |
682 } | 681 void CFFL_FormFiller::SaveState(CPDFSDK_PageView* pPageView) { |
683 | 682 } |
684 pIFormFiller->OnValidate(m_pWidget, pPageView, bRC, bExit, nFlag
); | 683 |
685 if (bExit) return TRUE; | 684 void CFFL_FormFiller::RestoreState(CPDFSDK_PageView* pPageView) { |
686 if (!bRC) | 685 } |
687 { | 686 |
688 this->ResetPDFWindow(pPageView, FALSE); | 687 CPWL_Wnd* CFFL_FormFiller::ResetPDFWindow(CPDFSDK_PageView* pPageView, |
689 return TRUE; | 688 FX_BOOL bRestoreValue) { |
690 } | 689 return GetPDFWindow(pPageView, FALSE); |
691 | 690 } |
692 SaveData(pPageView); | 691 |
693 | 692 void CFFL_FormFiller::TimerProc() { |
694 pIFormFiller->OnCalculate(m_pWidget, pPageView, bExit,nFlag); | 693 } |
695 if (bExit) return TRUE; | 694 |
696 | 695 IFX_SystemHandler* CFFL_FormFiller::GetSystemHandler() const { |
697 pIFormFiller->OnFormat(m_pWidget, pPageView, bExit,nFlag); | 696 return m_pApp->GetSysHandler(); |
698 } | 697 // return NULL; |
699 | 698 } |
700 return TRUE; | 699 |
701 } | 700 void CFFL_FormFiller::OnKeyStroke(FX_BOOL bKeyDown) { |
702 | 701 } |
703 FX_BOOL CFFL_FormFiller::IsDataChanged(CPDFSDK_PageView* pPageView) | 702 |
704 { | 703 void CFFL_FormFiller::EscapeFiller(CPDFSDK_PageView* pPageView, |
705 return FALSE; | 704 FX_BOOL bDestroyPDFWindow) { |
706 } | 705 m_bValid = FALSE; |
707 | 706 |
708 void CFFL_FormFiller::SaveData(CPDFSDK_PageView* pPageView) | 707 FX_RECT rcRect = this->GetViewBBox(pPageView, m_pWidget); |
709 { | 708 this->InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom); |
710 } | 709 |
711 | 710 if (bDestroyPDFWindow) |
712 void CFFL_FormFiller::GetKeyStrokeData(CPDFSDK_PageView* pPageView, FFL_KeyStrok
eData& data) | 711 DestroyPDFWindow(pPageView); |
713 { | 712 } |
714 } | 713 |
715 | 714 FX_BOOL CFFL_FormFiller::CanCopy(CPDFSDK_Document* pDocument) { |
716 void CFFL_FormFiller::SetChangeMark() | 715 return FALSE; |
717 { | 716 } |
718 m_pApp->FFI_OnChange(); | 717 |
719 } | 718 FX_BOOL CFFL_FormFiller::CanCut(CPDFSDK_Document* pDocument) { |
720 | 719 return FALSE; |
721 void CFFL_FormFiller::GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::A
ActionType type, | 720 } |
722 PDFSDK_FieldAction& fa) | 721 |
723 { | 722 FX_BOOL CFFL_FormFiller::CanPaste(CPDFSDK_Document* pDocument) { |
724 fa.sValue = m_pWidget->GetValue(); | 723 return FALSE; |
725 } | 724 } |
726 | 725 |
727 void CFFL_FormFiller::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::A
ActionType type, | 726 void CFFL_FormFiller::DoCopy(CPDFSDK_Document* pDocument) { |
728 const PD
FSDK_FieldAction& fa) | 727 } |
729 { | 728 |
730 } | 729 void CFFL_FormFiller::DoCut(CPDFSDK_Document* pDocument) { |
731 | 730 } |
732 FX_BOOL CFFL_FormFiller::IsActionDataChanged(CPDF_AAction::AActionType type, con
st PDFSDK_FieldAction& faOld, | 731 |
733 const PD
FSDK_FieldAction& faNew) | 732 void CFFL_FormFiller::DoPaste(CPDFSDK_Document* pDocument) { |
734 { | 733 } |
735 return FALSE; | 734 |
736 } | 735 void CFFL_FormFiller::InvalidateRect(double left, |
737 | 736 double top, |
738 void CFFL_FormFiller::SaveState(CPDFSDK_PageView* pPageView) | 737 double right, |
739 { | 738 double bottom) { |
740 } | 739 CPDF_Page* pPage = m_pWidget->GetPDFPage(); |
741 | 740 m_pApp->FFI_Invalidate(pPage, left, top, right, bottom); |
742 void CFFL_FormFiller::RestoreState(CPDFSDK_PageView* pPageView) | |
743 { | |
744 } | |
745 | |
746 CPWL_Wnd* CFFL_FormFiller::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL
bRestoreValue) | |
747 { | |
748 return GetPDFWindow(pPageView, FALSE); | |
749 } | |
750 | |
751 void CFFL_FormFiller::TimerProc() | |
752 { | |
753 | |
754 } | |
755 | |
756 IFX_SystemHandler* CFFL_FormFiller::GetSystemHandler() const | |
757 { | |
758 return m_pApp->GetSysHandler(); | |
759 // return NULL; | |
760 } | |
761 | |
762 void CFFL_FormFiller::OnKeyStroke(FX_BOOL bKeyDown) | |
763 { | |
764 } | |
765 | |
766 void CFFL_FormFiller::EscapeFiller(CPDFSDK_PageView* pPageView, FX_BOOL bDestroy
PDFWindow) | |
767 { | |
768 m_bValid = FALSE; | |
769 | |
770 FX_RECT rcRect = this->GetViewBBox(pPageView, m_pWidget); | |
771 this->InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.botto
m); | |
772 | |
773 if(bDestroyPDFWindow) | |
774 DestroyPDFWindow(pPageView); | |
775 } | |
776 | |
777 FX_BOOL CFFL_FormFiller::CanCopy(CPDFSDK_Document* pDocument) | |
778 { | |
779 return FALSE; | |
780 } | |
781 | |
782 FX_BOOL CFFL_FormFiller::CanCut(CPDFSDK_Document* pDocument) | |
783 { | |
784 return FALSE; | |
785 } | |
786 | |
787 FX_BOOL CFFL_FormFiller::CanPaste(CPDFSDK_Document* pDocument) | |
788 { | |
789 return FALSE; | |
790 } | |
791 | |
792 void CFFL_FormFiller::DoCopy(CPDFSDK_Document* pDocument) | |
793 { | |
794 } | |
795 | |
796 void CFFL_FormFiller::DoCut(CPDFSDK_Document* pDocument) | |
797 { | |
798 } | |
799 | |
800 void CFFL_FormFiller::DoPaste(CPDFSDK_Document* pDocument) | |
801 { | |
802 } | |
803 | |
804 void CFFL_FormFiller::InvalidateRect(double left, double top, double right, doub
le bottom) | |
805 { | |
806 CPDF_Page * pPage = m_pWidget->GetPDFPage(); | |
807 m_pApp->FFI_Invalidate(pPage, left, top, right, bottom); | |
808 } | 741 } |
809 | 742 |
810 /* ------------------------- CFFL_Button ------------------------- */ | 743 /* ------------------------- CFFL_Button ------------------------- */ |
811 | 744 |
812 CFFL_Button::CFFL_Button(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget) : | 745 CFFL_Button::CFFL_Button(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget) |
813 » CFFL_FormFiller(pApp, pWidget), | 746 : CFFL_FormFiller(pApp, pWidget), m_bMouseIn(FALSE), m_bMouseDown(FALSE) { |
814 » m_bMouseIn(FALSE), | 747 } |
815 » m_bMouseDown(FALSE) | 748 |
816 { | 749 CFFL_Button::~CFFL_Button() { |
817 } | 750 } |
818 | 751 |
819 CFFL_Button::~CFFL_Button() | 752 void CFFL_Button::OnMouseEnter(CPDFSDK_PageView* pPageView, |
820 { | 753 CPDFSDK_Annot* pAnnot) { |
821 } | 754 m_bMouseIn = TRUE; |
822 | 755 FX_RECT rect = this->GetViewBBox(pPageView, pAnnot); |
823 void CFFL_Button::OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnno
t) | 756 this->InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); |
824 { | 757 //» ::InvalidateRect(pPageView->GetPageViewWnd(), |
825 » m_bMouseIn = TRUE; | 758 //&this->GetViewBBox(pPageView, pAnnot), TRUE); |
826 » FX_RECT rect = this->GetViewBBox(pPageView,pAnnot); | 759 } |
827 » this->InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); | 760 |
828 //» ::InvalidateRect(pPageView->GetPageViewWnd(), &this->GetViewBBox(pPageVi
ew, pAnnot), TRUE); | 761 void CFFL_Button::OnMouseExit(CPDFSDK_PageView* pPageView, |
829 } | 762 CPDFSDK_Annot* pAnnot) { |
830 | 763 m_bMouseIn = FALSE; |
831 void CFFL_Button::OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot
) | 764 |
832 { | 765 FX_RECT rect = this->GetViewBBox(pPageView, pAnnot); |
833 » m_bMouseIn = FALSE; | 766 this->InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); |
834 | 767 //» ::InvalidateRect(pPageView->GetPageViewWnd(), |
835 » FX_RECT rect = this->GetViewBBox(pPageView,pAnnot); | 768 //&this->GetViewBBox(pPageView, pAnnot), TRUE); |
836 » this->InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); | 769 EndTimer(); |
837 //» ::InvalidateRect(pPageView->GetPageViewWnd(), &this->GetViewBBox(pPageVi
ew, pAnnot), TRUE); | 770 ASSERT(m_pWidget != NULL); |
838 » EndTimer(); | 771 //» m_pWidget->HideHint(); |
839 » ASSERT(m_pWidget != NULL); | 772 } |
840 //» m_pWidget->HideHint(); | 773 |
841 } | 774 FX_BOOL CFFL_Button::OnLButtonDown(CPDFSDK_PageView* pPageView, |
842 | 775 CPDFSDK_Annot* pAnnot, |
843 FX_BOOL CFFL_Button::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* p
Annot, FX_UINT nFlags, const CPDF_Point& point) | 776 FX_UINT nFlags, |
844 { | 777 const CPDF_Point& point) { |
845 » CPDF_Rect rcAnnot = pAnnot->GetRect(); | 778 CPDF_Rect rcAnnot = pAnnot->GetRect(); |
846 » if(!rcAnnot.Contains(point.x, point.y)) | 779 if (!rcAnnot.Contains(point.x, point.y)) |
847 » » return FALSE; | 780 return FALSE; |
848 | 781 |
849 » m_bMouseDown = TRUE; | 782 m_bMouseDown = TRUE; |
850 » m_bValid = TRUE; | 783 m_bValid = TRUE; |
851 » FX_RECT rect = this->GetViewBBox(pPageView, pAnnot); | 784 FX_RECT rect = this->GetViewBBox(pPageView, pAnnot); |
852 » this->InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); | 785 this->InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); |
853 //» ::InvalidateRect(pPageView->GetPageViewWnd(), &this->GetViewBBox(pPageVi
ew, pAnnot), TRUE); | 786 //» ::InvalidateRect(pPageView->GetPageViewWnd(), |
854 » return TRUE; | 787 //&this->GetViewBBox(pPageView, pAnnot), TRUE); |
855 } | 788 return TRUE; |
856 | 789 } |
857 FX_BOOL»CFFL_Button::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAn
not, FX_UINT nFlags, const CPDF_Point& point) | 790 |
858 { | 791 FX_BOOL CFFL_Button::OnLButtonUp(CPDFSDK_PageView* pPageView, |
859 » CPDF_Rect rcAnnot = pAnnot->GetRect(); | 792 CPDFSDK_Annot* pAnnot, |
860 » if(!rcAnnot.Contains(point.x, point.y)) | 793 FX_UINT nFlags, |
861 » » return FALSE; | 794 const CPDF_Point& point) { |
862 | 795 CPDF_Rect rcAnnot = pAnnot->GetRect(); |
863 » m_bMouseDown = FALSE; | 796 if (!rcAnnot.Contains(point.x, point.y)) |
864 » m_pWidget->GetPDFPage(); | 797 return FALSE; |
865 » | 798 |
866 | 799 m_bMouseDown = FALSE; |
867 » FX_RECT rect = this->GetViewBBox(pPageView, pAnnot); | 800 m_pWidget->GetPDFPage(); |
868 » this->InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); | 801 |
869 // » ::InvalidateRect(pPageView->GetPageViewWnd(), &this->GetViewBBox(pPageVi
ew, pAnnot), TRUE); | 802 FX_RECT rect = this->GetViewBBox(pPageView, pAnnot); |
870 » return TRUE; | 803 this->InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); |
871 } | 804 // » ::InvalidateRect(pPageView->GetPageViewWnd(), |
872 | 805 // &this->GetViewBBox(pPageView, pAnnot), TRUE); |
873 FX_BOOL»CFFL_Button::OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAn
not, FX_UINT nFlags, const CPDF_Point& point) | 806 return TRUE; |
874 { | 807 } |
875 » ASSERT(m_pApp != NULL); | 808 |
876 | 809 FX_BOOL CFFL_Button::OnMouseMove(CPDFSDK_PageView* pPageView, |
877 » return TRUE; | 810 CPDFSDK_Annot* pAnnot, |
878 } | 811 FX_UINT nFlags, |
879 | 812 const CPDF_Point& point) { |
880 void CFFL_Button::OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot
* pAnnot, | 813 ASSERT(m_pApp != NULL); |
881 » » » » » » » CFX_RenderDevice* pDevic
e, CPDF_Matrix* pUser2Device, | 814 |
882 » » » » » » » /*const CRect& rcWindow,
*/ FX_DWORD dwFlags) | 815 return TRUE; |
883 { | 816 } |
884 » ASSERT(pPageView != NULL); | 817 |
885 » ASSERT(pAnnot != NULL); | 818 void CFFL_Button::OnDraw(CPDFSDK_PageView* pPageView, |
886 | 819 /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, |
887 » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 820 CFX_RenderDevice* pDevice, |
888 | 821 CPDF_Matrix* pUser2Device, |
889 » CPDF_FormControl* pCtrl = pWidget->GetFormControl(); | 822 /*const CRect& rcWindow,*/ FX_DWORD dwFlags) { |
890 » ASSERT(pCtrl != NULL); | 823 ASSERT(pPageView != NULL); |
891 | 824 ASSERT(pAnnot != NULL); |
892 » CPDF_FormControl::HighlightingMode eHM = pCtrl->GetHighlightingMode(); | 825 |
893 | 826 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
894 » if (eHM == CPDF_FormControl::Push) | 827 |
895 » { | 828 CPDF_FormControl* pCtrl = pWidget->GetFormControl(); |
896 » » if (m_bMouseDown) | 829 ASSERT(pCtrl != NULL); |
897 » » { | 830 |
898 » » » if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Down)) | 831 CPDF_FormControl::HighlightingMode eHM = pCtrl->GetHighlightingMode(); |
899 » » » » pWidget->DrawAppearance(pDevice, pUser2Device, C
PDF_Annot::Down, NULL); | 832 |
900 » » » else | 833 if (eHM == CPDF_FormControl::Push) { |
901 » » » » pWidget->DrawAppearance(pDevice, pUser2Device, C
PDF_Annot::Normal, NULL); | 834 if (m_bMouseDown) { |
902 » » } | 835 if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Down)) |
903 » » else if (m_bMouseIn) | 836 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Down, NULL); |
904 » » { | 837 else |
905 » » » if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Rollove
r)) | 838 pWidget->DrawAppearance( |
906 » » » » pWidget->DrawAppearance(pDevice, pUser2Device, C
PDF_Annot::Rollover, NULL); | 839 pDevice, pUser2Device, CPDF_Annot::Normal, NULL); |
907 » » » else | 840 } else if (m_bMouseIn) { |
908 » » » » pWidget->DrawAppearance(pDevice, pUser2Device, C
PDF_Annot::Normal, NULL); | 841 if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Rollover)) |
909 » » } | 842 pWidget->DrawAppearance( |
910 » » else | 843 pDevice, pUser2Device, CPDF_Annot::Rollover, NULL); |
911 » » { | 844 else |
912 » » » pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Anno
t::Normal, NULL); | 845 pWidget->DrawAppearance( |
913 » » } | 846 pDevice, pUser2Device, CPDF_Annot::Normal, NULL); |
914 » } | 847 } else { |
915 » else | 848 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); |
916 » » pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Norma
l, NULL); | 849 } |
917 } | 850 } else |
918 | 851 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); |
919 | 852 } |
920 void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFS
DK_Annot* pAnnot, | 853 |
921 » » » » » » » » CFX_RenderDevic
e* pDevice, CPDF_Matrix* pUser2Device, | 854 void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView, |
922 » » » » » » » » /*const CRect&
rcWindow, */FX_DWORD dwFlags) | 855 /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, |
923 { | 856 CFX_RenderDevice* pDevice, |
924 » OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); | 857 CPDF_Matrix* pUser2Device, |
925 } | 858 /*const CRect& rcWindow, */ FX_DWORD dwFlags) { |
| 859 OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); |
| 860 } |
OLD | NEW |