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 #include "../../include/formfiller/FFL_FormFiller.h" | 7 #include "../../include/formfiller/FFL_FormFiller.h" |
8 #include "../../include/formfiller/FFL_IFormFiller.h" | 8 #include "../../include/formfiller/FFL_IFormFiller.h" |
9 #include "../../include/formfiller/FFL_CheckBox.h" | 9 #include "../../include/formfiller/FFL_CheckBox.h" |
10 #include "../../include/formfiller/FFL_ComboBox.h" | 10 #include "../../include/formfiller/FFL_ComboBox.h" |
11 #include "../../include/formfiller/FFL_ListBox.h" | 11 #include "../../include/formfiller/FFL_ListBox.h" |
12 #include "../../include/formfiller/FFL_PushButton.h" | 12 #include "../../include/formfiller/FFL_PushButton.h" |
13 #include "../../include/formfiller/FFL_RadioButton.h" | 13 #include "../../include/formfiller/FFL_RadioButton.h" |
14 #include "../../include/formfiller/FFL_TextField.h" | 14 #include "../../include/formfiller/FFL_TextField.h" |
15 | 15 |
16 #define FFL_MAXLISTBOXHEIGHT» » 140.0f | 16 #define FFL_MAXLISTBOXHEIGHT 140.0f |
17 | 17 |
18 // HHOOK CFFL_IFormFiller::m_hookSheet = NULL; | 18 // HHOOK CFFL_IFormFiller::m_hookSheet = NULL; |
19 // MSG CFFL_IFormFiller::g_Msg; | 19 // MSG CFFL_IFormFiller::g_Msg; |
20 | 20 |
21 /* ----------------------------- CFFL_IFormFiller -----------------------------
*/ | 21 /* ----------------------------- CFFL_IFormFiller ----------------------------- |
22 | 22 */ |
23 CFFL_IFormFiller::CFFL_IFormFiller(CPDFDoc_Environment* pApp) : | 23 |
24 m_pApp(pApp), | 24 CFFL_IFormFiller::CFFL_IFormFiller(CPDFDoc_Environment* pApp) |
25 m_bNotifying(FALSE) | 25 : m_pApp(pApp), m_bNotifying(FALSE) { |
26 { | 26 } |
27 } | 27 |
28 | 28 CFFL_IFormFiller::~CFFL_IFormFiller() { |
29 CFFL_IFormFiller::~CFFL_IFormFiller() | 29 FX_POSITION pos = m_Maps.GetStartPosition(); |
30 { | 30 while (pos) { |
31 FX_POSITION pos = m_Maps.GetStartPosition(); | 31 CPDFSDK_Annot* pAnnot = NULL; |
32 while (pos) | 32 CFFL_FormFiller* pFormFiller = NULL; |
33 { | 33 m_Maps.GetNextAssoc(pos, pAnnot, pFormFiller); |
34 CPDFSDK_Annot * pAnnot = NULL; | 34 delete pFormFiller; |
35 CFFL_FormFiller * pFormFiller = NULL; | 35 } |
36 m_Maps.GetNextAssoc(pos,pAnnot,pFormFiller); | 36 m_Maps.RemoveAll(); |
37 delete pFormFiller; | 37 } |
38 } | 38 |
39 m_Maps.RemoveAll(); | 39 FX_BOOL CFFL_IFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView, |
40 } | 40 CPDFSDK_Annot* pAnnot, |
41 | 41 CPDF_Point point) { |
42 FX_BOOL CFFL_IFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView,CPDFSDK_Anno
t* pAnnot, CPDF_Point point) | 42 CPDF_Rect rc = pAnnot->GetRect(); |
43 { | 43 if (rc.Contains(point.x, point.y)) |
44 CPDF_Rect rc = pAnnot->GetRect(); | 44 return TRUE; |
45 if(rc.Contains(point.x, point.y)) | 45 return FALSE; |
46 return TRUE; | 46 } |
47 return FALSE; | 47 |
48 } | 48 FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, |
49 | 49 CPDFSDK_Annot* pAnnot) { |
50 FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot
* pAnnot) | 50 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
51 { | 51 return pFormFiller->GetViewBBox(pPageView, pAnnot); |
52 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 52 } else { |
53 { | 53 ASSERT(pPageView != NULL); |
54 return pFormFiller->GetViewBBox(pPageView, pAnnot); | 54 ASSERT(pAnnot != NULL); |
55 } | 55 |
56 else | 56 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); |
57 { | 57 ASSERT(pPDFAnnot != NULL); |
58 ASSERT(pPageView != NULL); | 58 |
59 ASSERT(pAnnot != NULL); | 59 CPDF_Rect rcAnnot; |
60 | 60 pPDFAnnot->GetRect(rcAnnot); |
61 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); | 61 |
62 ASSERT(pPDFAnnot != NULL); | 62 // CRect rcWin; |
63 | 63 // pPageView->DocToWindow(rcAnnot, rcWin); |
64 CPDF_Rect rcAnnot; | 64 CPDF_Rect rcWin = CPWL_Utils::InflateRect(rcAnnot, 1); |
65 pPDFAnnot->GetRect(rcAnnot); | 65 // rcWin.InflateRect(1, 1); |
66 | 66 |
67 // CRect rcWin; | 67 return rcWin.GetOutterRect(); |
68 // pPageView->DocToWindow(rcAnnot, rcWin); | 68 } |
69 CPDF_Rect rcWin = CPWL_Utils::InflateRect(rcAnnot,1); | 69 } |
70 // rcWin.InflateRect(1, 1); | 70 |
71 | 71 void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, |
72 return rcWin.GetOutterRect(); | 72 /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, |
73 } | 73 CFX_RenderDevice* pDevice, |
74 } | 74 CPDF_Matrix* pUser2Device, |
75 | 75 /*const CRect& rcWindow,*/ FX_DWORD dwFlags) { |
76 void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, /*HDC hDC,*/ CPDFSDK_
Annot* pAnnot, | 76 ASSERT(pPageView != NULL); |
77 CFX_RenderDevice* pDevice, CPDF_
Matrix* pUser2Device, | 77 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
78 /*const CRect& rcWindow,*/ FX_DW
ORD dwFlags) | 78 |
79 { | 79 if (IsVisible(pWidget)) { |
80 ASSERT(pPageView != NULL); | 80 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
81 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 81 if (pFormFiller->IsValid()) { |
82 | 82 pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); |
83 if (IsVisible(pWidget)) | 83 |
84 { | 84 pAnnot->GetPDFPage(); |
85 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 85 |
86 { | 86 CPDFSDK_Document* pDocument = m_pApp->GetCurrentDoc(); |
87 if (pFormFiller->IsValid()) | 87 ASSERT(pDocument != NULL); |
88 { | 88 |
89 pFormFiller->OnDraw(pPageView, pAnnot, pDevice,
pUser2Device, dwFlags); | 89 if (pDocument->GetFocusAnnot() == pAnnot) { |
90 | 90 CPDF_Rect rcFocus = pFormFiller->GetFocusBox(pPageView); |
91 pAnnot->GetPDFPage(); | 91 if (!rcFocus.IsEmpty()) { |
92 | 92 CFX_PathData path; |
93 | 93 |
94 CPDFSDK_Document* pDocument = m_pApp->GetCurrent
Doc(); | 94 path.SetPointCount(5); |
95 ASSERT(pDocument != NULL); | 95 path.SetPoint(0, rcFocus.left, rcFocus.top, FXPT_MOVETO); |
96 | 96 path.SetPoint(1, rcFocus.left, rcFocus.bottom, FXPT_LINETO); |
97 if (pDocument->GetFocusAnnot() == pAnnot) | 97 path.SetPoint(2, rcFocus.right, rcFocus.bottom, FXPT_LINETO); |
98 { | 98 path.SetPoint(3, rcFocus.right, rcFocus.top, FXPT_LINETO); |
99 CPDF_Rect rcFocus = pFormFiller->GetFocu
sBox(pPageView); | 99 path.SetPoint(4, rcFocus.left, rcFocus.top, FXPT_LINETO); |
100 if (!rcFocus.IsEmpty()) | 100 |
101 { | 101 CFX_GraphStateData gsd; |
102 CFX_PathData path; | 102 gsd.SetDashCount(1); |
103 | 103 gsd.m_DashArray[0] = 1.0f; |
104 path.SetPointCount(5); | 104 gsd.m_DashPhase = 0; |
105 path.SetPoint(0, rcFocus.left,
rcFocus.top, FXPT_MOVETO); | 105 |
106 path.SetPoint(1, rcFocus.left,
rcFocus.bottom, FXPT_LINETO); | 106 gsd.m_LineWidth = 1.0f; |
107 path.SetPoint(2, rcFocus.right,
rcFocus.bottom, FXPT_LINETO); | 107 pDevice->DrawPath(&path, |
108 path.SetPoint(3, rcFocus.right,
rcFocus.top, FXPT_LINETO); | 108 pUser2Device, |
109 path.SetPoint(4, rcFocus.left,
rcFocus.top, FXPT_LINETO); | 109 &gsd, |
110 | 110 0, |
111 CFX_GraphStateData gsd; | 111 ArgbEncode(255, 0, 0, 0), |
112 gsd.SetDashCount(1);
| 112 FXFILL_ALTERNATE); |
113 gsd.m_DashArray[0] = 1.0f; | 113 |
114 gsd.m_DashPhase = 0; | 114 // ::DrawFocusRect(hDC, &rcFocus); |
115 | 115 } |
116 gsd.m_LineWidth = 1.0f; | 116 } |
117 pDevice->DrawPath(&path, pUser2D
evice, &gsd, 0, ArgbEncode(255,0,0,0), FXFILL_ALTERNATE); | 117 |
118 | 118 return; |
119 // ::DrawFocusRect(hDC, &rcFocus); | 119 } |
120 } | 120 } |
121 } | 121 |
122 | 122 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
123 return; | 123 pFormFiller->OnDrawDeactive( |
124 } | 124 pPageView, pAnnot, pDevice, pUser2Device, dwFlags); |
125 } | 125 else |
126 | 126 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); |
127 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 127 |
128 pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice,
pUser2Device, dwFlags); | 128 if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget)) { |
129 else | 129 pWidget->DrawShadow(pDevice, pPageView); |
130 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Anno
t::Normal, NULL); | 130 } |
131 | 131 } |
132 if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget)) | 132 } |
133 { | 133 |
134 pWidget->DrawShadow(pDevice, pPageView); | 134 void CFFL_IFormFiller::OnCreate(CPDFSDK_Annot* pAnnot) { |
135 } | 135 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
136 | 136 pFormFiller->OnCreate(pAnnot); |
137 } | 137 } |
138 } | 138 } |
139 | 139 |
140 void CFFL_IFormFiller::OnCreate(CPDFSDK_Annot* pAnnot) | 140 void CFFL_IFormFiller::OnLoad(CPDFSDK_Annot* pAnnot) { |
141 { | 141 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
142 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 142 pFormFiller->OnLoad(pAnnot); |
143 { | 143 } |
144 pFormFiller->OnCreate(pAnnot); | 144 } |
145 } | 145 |
146 } | 146 void CFFL_IFormFiller::OnDelete(CPDFSDK_Annot* pAnnot) { |
147 | 147 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
148 void CFFL_IFormFiller::OnLoad(CPDFSDK_Annot* pAnnot) | 148 pFormFiller->OnDelete(pAnnot); |
149 { | 149 } |
150 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 150 |
151 { | 151 UnRegisterFormFiller(pAnnot); |
152 pFormFiller->OnLoad(pAnnot); | 152 } |
153 } | 153 |
154 } | 154 void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, |
155 | 155 CPDFSDK_Annot* pAnnot, |
156 void CFFL_IFormFiller::OnDelete(CPDFSDK_Annot* pAnnot) | 156 FX_UINT nFlag) { |
157 { | 157 ASSERT(pAnnot != NULL); |
158 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 158 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
159 { | 159 |
160 pFormFiller->OnDelete(pAnnot); | 160 if (!m_bNotifying) { |
161 } | 161 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
162 | 162 if (pWidget->GetAAction(CPDF_AAction::CursorEnter)) { |
163 UnRegisterFormFiller(pAnnot); | 163 m_bNotifying = TRUE; |
164 } | 164 |
165 | 165 int nValueAge = pWidget->GetValueAge(); |
166 void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, CPDFSDK_Annot*
pAnnot, FX_UINT nFlag) | 166 |
167 { | 167 pWidget->ClearAppModified(); |
168 ASSERT(pAnnot != NULL); | 168 |
169 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 169 ASSERT(pPageView != NULL); |
170 | 170 |
171 if (!m_bNotifying) | 171 PDFSDK_FieldAction fa; |
172 { | 172 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
173 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 173 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
174 if (pWidget->GetAAction(CPDF_AAction::CursorEnter)) | 174 pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageView); |
175 { | 175 m_bNotifying = FALSE; |
176 m_bNotifying = TRUE; | 176 |
177 | 177 // if ( !IsValidAnnot(pPageView, pAnnot) ) return; |
178 int nValueAge = pWidget->GetValueAge(); | 178 |
179 | 179 if (pWidget->IsAppModified()) { |
180 pWidget->ClearAppModified(); | 180 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
181 | 181 pFormFiller->ResetPDFWindow(pPageView, |
182 ASSERT(pPageView != NULL); | 182 pWidget->GetValueAge() == nValueAge); |
183 | 183 } |
184 | 184 } |
185 | 185 } |
186 PDFSDK_FieldAction fa; | 186 } |
187 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 187 |
188 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 188 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) { |
189 pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageV
iew ); | 189 pFormFiller->OnMouseEnter(pPageView, pAnnot); |
190 m_bNotifying = FALSE; | 190 } |
191 | 191 } |
192 //if ( !IsValidAnnot(pPageView, pAnnot) ) return; | 192 |
193 | 193 void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, |
194 if (pWidget->IsAppModified()) | 194 CPDFSDK_Annot* pAnnot, |
195 { | 195 FX_UINT nFlag) { |
196 if (CFFL_FormFiller* pFormFiller = GetFormFiller
(pWidget, FALSE)) | 196 ASSERT(pAnnot != NULL); |
197 { | 197 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
198 pFormFiller->ResetPDFWindow(pPageView, p
Widget->GetValueAge() == nValueAge); | 198 |
199 } | 199 if (!m_bNotifying) { |
200 } | 200 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
201 } | 201 if (pWidget->GetAAction(CPDF_AAction::CursorExit)) { |
202 } | 202 m_bNotifying = TRUE; |
203 | 203 pWidget->GetAppearanceAge(); |
204 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) | 204 int nValueAge = pWidget->GetValueAge(); |
205 { | 205 pWidget->ClearAppModified(); |
206 pFormFiller->OnMouseEnter(pPageView, pAnnot); | 206 |
207 } | 207 ASSERT(pPageView != NULL); |
208 } | 208 |
209 | 209 PDFSDK_FieldAction fa; |
210 void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* p
Annot, FX_UINT nFlag) | 210 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
211 { | 211 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
212 ASSERT(pAnnot != NULL); | 212 |
213 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 213 pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageView); |
214 | 214 m_bNotifying = FALSE; |
215 if (!m_bNotifying) | 215 |
216 { | 216 // if (!IsValidAnnot(pPageView, pAnnot)) return; |
217 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 217 |
218 if (pWidget->GetAAction(CPDF_AAction::CursorExit)) | 218 if (pWidget->IsAppModified()) { |
219 { | 219 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
220 m_bNotifying = TRUE; | 220 pFormFiller->ResetPDFWindow(pPageView, |
221 pWidget->GetAppearanceAge(); | 221 nValueAge == pWidget->GetValueAge()); |
222 int nValueAge = pWidget->GetValueAge(); | 222 } |
223 pWidget->ClearAppModified(); | 223 } |
224 | 224 } |
225 ASSERT(pPageView != NULL); | 225 } |
226 | 226 |
227 | 227 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
228 | 228 pFormFiller->OnMouseExit(pPageView, pAnnot); |
229 PDFSDK_FieldAction fa; | 229 } |
230 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 230 } |
231 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 231 |
232 | 232 FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, |
233 pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageVi
ew); | 233 CPDFSDK_Annot* pAnnot, |
234 m_bNotifying = FALSE; | 234 FX_UINT nFlags, |
235 | 235 const CPDF_Point& point) { |
236 //if (!IsValidAnnot(pPageView, pAnnot)) return; | 236 ASSERT(pAnnot != NULL); |
237 | 237 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
238 if (pWidget->IsAppModified()) | 238 |
239 { | 239 if (!m_bNotifying) { |
240 if (CFFL_FormFiller* pFormFiller = GetFormFiller
(pWidget, FALSE)) | 240 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
241 { | 241 if (Annot_HitTest(pPageView, pAnnot, point) && |
242 pFormFiller->ResetPDFWindow(pPageView, n
ValueAge == pWidget->GetValueAge()); | 242 pWidget->GetAAction(CPDF_AAction::ButtonDown)) { |
243 } | 243 m_bNotifying = TRUE; |
244 } | 244 pWidget->GetAppearanceAge(); |
245 } | 245 int nValueAge = pWidget->GetValueAge(); |
246 } | 246 pWidget->ClearAppModified(); |
247 | 247 |
248 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 248 ASSERT(pPageView != NULL); |
249 { | 249 |
250 pFormFiller->OnMouseExit(pPageView, pAnnot); | 250 PDFSDK_FieldAction fa; |
251 } | 251 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlags); |
252 } | 252 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlags); |
253 | 253 pWidget->OnAAction(CPDF_AAction::ButtonDown, fa, pPageView); |
254 FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Ann
ot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 254 m_bNotifying = FALSE; |
255 { | 255 |
256 ASSERT(pAnnot != NULL); | 256 if (!IsValidAnnot(pPageView, pAnnot)) |
257 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 257 return TRUE; |
258 | 258 |
259 if (!m_bNotifying) | 259 if (pWidget->IsAppModified()) { |
260 { | 260 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
261 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 261 pFormFiller->ResetPDFWindow(pPageView, |
262 if (Annot_HitTest(pPageView, pAnnot, point) && pWidget->GetAActi
on(CPDF_AAction::ButtonDown)) | 262 nValueAge == pWidget->GetValueAge()); |
263 { | 263 } |
264 m_bNotifying = TRUE; | 264 } |
265 pWidget->GetAppearanceAge(); | 265 } |
266 int nValueAge = pWidget->GetValueAge(); | 266 } |
267 pWidget->ClearAppModified(); | 267 |
268 | 268 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
269 ASSERT(pPageView != NULL); | 269 return pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point); |
270 | 270 } |
271 | 271 |
272 | 272 return FALSE; |
273 PDFSDK_FieldAction fa; | 273 } |
274 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlags); | 274 |
275 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlags); | 275 FX_BOOL CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, |
276 pWidget->OnAAction(CPDF_AAction::ButtonDown, fa, pPageVi
ew); | 276 CPDFSDK_Annot* pAnnot, |
277 m_bNotifying = FALSE; | 277 FX_UINT nFlags, |
278 | 278 const CPDF_Point& point) { |
279 if (!IsValidAnnot(pPageView, pAnnot)) return TRUE; | 279 ASSERT(pAnnot != NULL); |
280 | 280 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
281 if (pWidget->IsAppModified()) | 281 |
282 { | 282 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
283 if (CFFL_FormFiller* pFormFiller = GetFormFiller
(pWidget, FALSE)) | 283 // CReader_Page* pPage = pAnnot->GetPage(); |
284 { | 284 // ASSERT(pPage != NULL); |
285 pFormFiller->ResetPDFWindow(pPageView, n
ValueAge == pWidget->GetValueAge()); | 285 CPDFSDK_Document* pDocument = m_pApp->GetCurrentDoc(); |
286 } | 286 ASSERT(pDocument != NULL); |
287 } | 287 |
288 } | 288 switch (pWidget->GetFieldType()) { |
289 } | 289 case FIELDTYPE_PUSHBUTTON: |
290 | 290 case FIELDTYPE_CHECKBOX: |
291 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 291 case FIELDTYPE_RADIOBUTTON: |
292 { | 292 if (GetViewBBox(pPageView, pAnnot).Contains((int)point.x, (int)point.y)) { |
293 return pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, poi
nt); | 293 pDocument->SetFocusAnnot(pAnnot); |
294 } | 294 } |
295 | 295 break; |
296 return FALSE; | 296 default: |
297 } | 297 pDocument->SetFocusAnnot(pAnnot); |
298 | 298 break; |
299 FX_BOOL CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot
* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 299 } |
300 { | 300 |
301 ASSERT(pAnnot != NULL); | 301 FX_BOOL bRet = FALSE; |
302 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 302 |
303 | 303 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
304 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 304 bRet = pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point); |
305 // CReader_Page* pPage = pAnnot->GetPage(); | 305 } |
306 // ASSERT(pPage != NULL); | 306 |
307 CPDFSDK_Document* pDocument = m_pApp->GetCurrentDoc(); | 307 if (pDocument->GetFocusAnnot() == pAnnot) { |
308 ASSERT(pDocument != NULL); | 308 FX_BOOL bExit = FALSE; |
309 | 309 FX_BOOL bReset = FALSE; |
310 switch (pWidget->GetFieldType()) | 310 OnButtonUp(pWidget, pPageView, bReset, bExit, nFlags); |
311 { | 311 if (bExit) |
312 case FIELDTYPE_PUSHBUTTON: | 312 return TRUE; |
313 case FIELDTYPE_CHECKBOX: | 313 } |
314 case FIELDTYPE_RADIOBUTTON: | 314 return bRet; |
315 if (GetViewBBox(pPageView, pAnnot).Contains((int)point.x, (int)p
oint.y)) | 315 } |
316 { | 316 |
317 pDocument->SetFocusAnnot(pAnnot); | 317 void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, |
318 } | 318 CPDFSDK_PageView* pPageView, |
319 break; | 319 FX_BOOL& bReset, |
320 default: | 320 FX_BOOL& bExit, |
321 pDocument->SetFocusAnnot(pAnnot); | 321 FX_UINT nFlag) { |
322 break; | 322 ASSERT(pWidget != NULL); |
323 } | 323 |
324 | 324 if (!m_bNotifying) { |
325 FX_BOOL bRet = FALSE; | 325 if (pWidget->GetAAction(CPDF_AAction::ButtonUp)) { |
326 | 326 m_bNotifying = TRUE; |
327 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 327 int nAge = pWidget->GetAppearanceAge(); |
328 { | 328 int nValueAge = pWidget->GetValueAge(); |
329 bRet = pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point
); | 329 |
330 } | 330 ASSERT(pPageView != NULL); |
331 | 331 // CReader_DocView* pDocView = |
332 if (pDocument->GetFocusAnnot() == pAnnot) | 332 // pPageView->GetDocView(); |
333 { | 333 // ASSERT(pDocView != NULL); |
334 FX_BOOL bExit = FALSE; | 334 |
335 FX_BOOL bReset = FALSE; | 335 PDFSDK_FieldAction fa; |
336 OnButtonUp(pWidget, pPageView, bReset, bExit,nFlags); | 336 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
337 if (bExit) return TRUE; | 337 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
338 } | 338 |
339 return bRet; | 339 pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView); |
340 } | 340 m_bNotifying = FALSE; |
341 | 341 |
342 void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPa
geView, FX_BOOL& bReset, FX_BOOL& bExit,FX_UINT nFlag) | 342 if (!IsValidAnnot(pPageView, pWidget)) { |
343 { | 343 bExit = TRUE; |
344 ASSERT(pWidget != NULL); | 344 return; |
345 | 345 } |
346 if (!m_bNotifying) | 346 |
347 { | 347 if (nAge != pWidget->GetAppearanceAge()) { |
348 if (pWidget->GetAAction(CPDF_AAction::ButtonUp)) | 348 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
349 { | 349 pFormFiller->ResetPDFWindow(pPageView, |
350 m_bNotifying = TRUE; | 350 nValueAge == pWidget->GetValueAge()); |
351 int nAge = pWidget->GetAppearanceAge(); | 351 } |
352 int nValueAge = pWidget->GetValueAge(); | 352 |
353 | 353 bReset = TRUE; |
354 ASSERT(pPageView != NULL); | 354 } |
355 // CReader_DocView* pDocView = pPageView->GetDocView(); | 355 } |
356 // ASSERT(pDocView != NULL); | 356 } |
357 | 357 } |
358 | 358 |
359 | 359 FX_BOOL CFFL_IFormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, |
360 PDFSDK_FieldAction fa; | 360 CPDFSDK_Annot* pAnnot, |
361 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 361 FX_UINT nFlags, |
362 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 362 const CPDF_Point& point) { |
363 | 363 ASSERT(pAnnot != NULL); |
364 pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView
); | 364 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
365 m_bNotifying = FALSE; | 365 |
366 | 366 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
367 if (!IsValidAnnot(pPageView, pWidget)) | 367 return pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); |
368 { | 368 } |
369 bExit = TRUE; | 369 |
370 return; | 370 return FALSE; |
371 } | 371 } |
372 | 372 |
373 if (nAge != pWidget->GetAppearanceAge()) | 373 FX_BOOL CFFL_IFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, |
374 { | 374 CPDFSDK_Annot* pAnnot, |
375 if (CFFL_FormFiller* pFormFiller = GetFormFiller
(pWidget, FALSE)) | 375 FX_UINT nFlags, |
376 { | 376 const CPDF_Point& point) { |
377 pFormFiller->ResetPDFWindow(pPageView, n
ValueAge == pWidget->GetValueAge()); | 377 ASSERT(pAnnot != NULL); |
378 } | 378 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
379 | 379 |
380 bReset = TRUE; | 380 // change cursor |
381 } | 381 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) { |
382 } | 382 return pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); |
383 } | 383 } |
384 } | 384 |
385 | 385 return FALSE; |
386 FX_BOOL CFFL_IFormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_A
nnot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 386 } |
387 { | 387 |
388 ASSERT(pAnnot != NULL); | 388 FX_BOOL CFFL_IFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, |
389 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 389 CPDFSDK_Annot* pAnnot, |
390 | 390 FX_UINT nFlags, |
391 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 391 short zDelta, |
392 { | 392 const CPDF_Point& point) { |
393 return pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, p
oint); | 393 ASSERT(pAnnot != NULL); |
394 } | 394 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
395 | 395 |
396 return FALSE; | 396 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
397 } | 397 return pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, point); |
398 | 398 } |
399 FX_BOOL CFFL_IFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot
* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 399 |
400 { | 400 return FALSE; |
401 ASSERT(pAnnot != NULL); | 401 } |
402 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 402 |
403 | 403 FX_BOOL CFFL_IFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, |
404 //change cursor | 404 CPDFSDK_Annot* pAnnot, |
405 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) | 405 FX_UINT nFlags, |
406 { | 406 const CPDF_Point& point) { |
407 return pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point
); | 407 ASSERT(pAnnot != NULL); |
408 } | 408 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
409 | 409 |
410 return FALSE; | 410 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
411 } | 411 return pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point); |
412 | 412 } |
413 FX_BOOL CFFL_IFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Anno
t* pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point) | 413 |
414 { | 414 return FALSE; |
415 ASSERT(pAnnot != NULL); | 415 } |
416 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 416 |
417 | 417 FX_BOOL CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, |
418 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 418 CPDFSDK_Annot* pAnnot, |
419 { | 419 FX_UINT nFlags, |
420 return pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDel
ta, point); | 420 const CPDF_Point& point) { |
421 } | 421 ASSERT(pAnnot != NULL); |
422 | 422 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
423 return FALSE; | 423 |
424 } | 424 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
425 | 425 return pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); |
426 FX_BOOL CFFL_IFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Ann
ot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 426 } |
427 { | 427 |
428 ASSERT(pAnnot != NULL); | 428 return FALSE; |
429 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 429 } |
430 | 430 |
431 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 431 FX_BOOL CFFL_IFormFiller::OnRButtonDblClk(CPDFSDK_PageView* pPageView, |
432 { | 432 CPDFSDK_Annot* pAnnot, |
433 return pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, poi
nt); | 433 FX_UINT nFlags, |
434 } | 434 const CPDF_Point& point) { |
435 | 435 ASSERT(pAnnot != NULL); |
436 return FALSE; | 436 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
437 } | 437 |
438 | 438 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
439 FX_BOOL CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot
* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 439 return pFormFiller->OnRButtonDblClk(pPageView, pAnnot, nFlags, point); |
440 { | 440 } |
441 ASSERT(pAnnot != NULL); | 441 |
442 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 442 return FALSE; |
443 | 443 } |
444 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 444 |
445 { | 445 FX_BOOL CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, |
446 return pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point
); | 446 FX_UINT nKeyCode, |
447 } | 447 FX_UINT nFlags) { |
448 | 448 ASSERT(pAnnot != NULL); |
449 return FALSE; | 449 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
450 } | 450 |
451 | 451 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
452 FX_BOOL CFFL_IFormFiller::OnRButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_A
nnot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 452 return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags); |
453 { | 453 } |
454 ASSERT(pAnnot != NULL); | 454 |
455 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 455 return FALSE; |
456 | 456 } |
457 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 457 |
458 { | 458 FX_BOOL CFFL_IFormFiller::OnChar(CPDFSDK_Annot* pAnnot, |
459 return pFormFiller->OnRButtonDblClk(pPageView, pAnnot, nFlags, p
oint); | 459 FX_UINT nChar, |
460 } | 460 FX_UINT nFlags) { |
461 | 461 ASSERT(pAnnot != NULL); |
462 return FALSE; | 462 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
463 } | 463 |
464 | 464 if (nChar == FWL_VKEY_Tab) |
465 FX_BOOL CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_
UINT nFlags) | 465 return TRUE; |
466 { | 466 |
467 ASSERT(pAnnot != NULL); | 467 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
468 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 468 return pFormFiller->OnChar(pAnnot, nChar, nFlags); |
469 | 469 } |
470 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 470 |
471 { | 471 return FALSE; |
472 return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags); | 472 } |
473 } | 473 |
474 | 474 void CFFL_IFormFiller::OnDeSelected(CPDFSDK_Annot* pAnnot) { |
475 return FALSE; | 475 ASSERT(pAnnot != NULL); |
476 } | 476 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
477 | 477 |
478 FX_BOOL CFFL_IFormFiller::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT n
Flags) | 478 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
479 { | 479 pFormFiller->OnDeSelected(pAnnot); |
480 ASSERT(pAnnot != NULL); | 480 } |
481 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 481 } |
482 | 482 |
483 if (nChar == FWL_VKEY_Tab) return TRUE; | 483 void CFFL_IFormFiller::OnSelected(CPDFSDK_Annot* pAnnot) { |
484 | 484 ASSERT(pAnnot != NULL); |
485 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 485 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
486 { | 486 |
487 return pFormFiller->OnChar(pAnnot, nChar, nFlags); | 487 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
488 } | 488 pFormFiller->OnSelected(pAnnot); |
489 | 489 } |
490 return FALSE; | 490 } |
491 } | 491 |
492 | 492 FX_BOOL CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { |
493 void CFFL_IFormFiller::OnDeSelected(CPDFSDK_Annot* pAnnot) | 493 if (!pAnnot) |
494 { | 494 return FALSE; |
495 ASSERT(pAnnot != NULL); | 495 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
496 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 496 |
497 | 497 if (!m_bNotifying) { |
498 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 498 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
499 { | 499 if (pWidget->GetAAction(CPDF_AAction::GetFocus)) { |
500 pFormFiller->OnDeSelected(pAnnot); | 500 m_bNotifying = TRUE; |
501 } | 501 pWidget->GetAppearanceAge(); |
502 } | 502 int nValueAge = pWidget->GetValueAge(); |
503 | 503 pWidget->ClearAppModified(); |
504 void CFFL_IFormFiller::OnSelected(CPDFSDK_Annot* pAnnot) | 504 |
505 { | 505 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); |
506 ASSERT(pAnnot != NULL); | 506 ASSERT(pPageView != NULL); |
507 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 507 |
508 | 508 PDFSDK_FieldAction fa; |
509 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 509 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
510 { | 510 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
511 pFormFiller->OnSelected(pAnnot); | 511 |
512 } | 512 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, TRUE); |
513 } | 513 if (!pFormFiller) |
514 | 514 return FALSE; |
515 FX_BOOL CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) | 515 pFormFiller->GetActionData(pPageView, CPDF_AAction::GetFocus, fa); |
516 { | 516 |
517 if(!pAnnot) return FALSE; | 517 pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView); |
518 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 518 m_bNotifying = FALSE; |
519 | 519 |
520 if (!m_bNotifying) | 520 // if (!IsValidAnnot(m_pApp, pDocument, pDocView, |
521 { | 521 //pPageView, pAnnot)) return FALSE; |
522 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 522 |
523 if (pWidget->GetAAction(CPDF_AAction::GetFocus)) | 523 if (pWidget->IsAppModified()) { |
524 { | 524 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
525 m_bNotifying = TRUE; | 525 pFormFiller->ResetPDFWindow(pPageView, |
526 pWidget->GetAppearanceAge(); | 526 nValueAge == pWidget->GetValueAge()); |
527 int nValueAge = pWidget->GetValueAge(); | 527 } |
528 pWidget->ClearAppModified(); | 528 } |
529 | 529 } |
530 | 530 } |
531 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); | 531 |
532 ASSERT(pPageView != NULL); | 532 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) { |
533 | 533 if (pFormFiller->OnSetFocus(pAnnot, nFlag)) { |
534 PDFSDK_FieldAction fa; | 534 return TRUE; |
535 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 535 } else |
536 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 536 return FALSE; |
537 | 537 } |
538 | 538 |
539 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, TR
UE); | 539 return TRUE; |
540 if(!pFormFiller) return FALSE; | 540 } |
541 pFormFiller->GetActionData(pPageView, CPDF_AAction::GetF
ocus, fa); | 541 |
542 | 542 FX_BOOL CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { |
543 pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView
); | 543 if (!pAnnot) |
544 m_bNotifying = FALSE; | 544 return FALSE; |
545 | 545 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
546 // if (!IsValidAnnot(m_pApp, pDocument, pDocView, pPageView
, pAnnot)) return FALSE; | 546 |
547 | 547 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
548 if (pWidget->IsAppModified()) | 548 if (pFormFiller->OnKillFocus(pAnnot, nFlag)) { |
549 { | 549 if (!m_bNotifying) { |
550 if (CFFL_FormFiller* pFormFiller = GetFormFiller
(pWidget, FALSE)) | 550 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
551 { | 551 if (pWidget->GetAAction(CPDF_AAction::LoseFocus)) { |
552 pFormFiller->ResetPDFWindow(pPageView, n
ValueAge == pWidget->GetValueAge()); | 552 m_bNotifying = TRUE; |
553 } | 553 pWidget->ClearAppModified(); |
554 } | 554 |
555 } | 555 CPDFSDK_PageView* pPageView = pWidget->GetPageView(); |
556 } | 556 ASSERT(pPageView != NULL); |
557 | 557 |
558 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) | 558 PDFSDK_FieldAction fa; |
559 { | 559 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
560 if (pFormFiller->OnSetFocus(pAnnot, nFlag)) | 560 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
561 { | 561 |
562 return TRUE; | 562 pFormFiller->GetActionData(pPageView, CPDF_AAction::LoseFocus, fa); |
563 } | 563 |
564 else | 564 pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView); |
565 return FALSE; | 565 m_bNotifying = FALSE; |
566 } | 566 } |
567 | 567 } |
568 return TRUE; | 568 } else |
569 } | 569 return FALSE; |
570 | 570 } |
571 FX_BOOL CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) | 571 |
572 { | 572 return TRUE; |
573 if(!pAnnot) return FALSE; | 573 } |
574 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 574 |
575 | 575 FX_BOOL CFFL_IFormFiller::IsVisible(CPDFSDK_Widget* pWidget) { |
576 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 576 return pWidget->IsVisible(); |
577 { | 577 } |
578 if (pFormFiller->OnKillFocus(pAnnot, nFlag)) | 578 |
579 { | 579 FX_BOOL CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) { |
580 if (!m_bNotifying) | 580 ASSERT(pWidget != NULL); |
581 { | 581 |
582 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnno
t; | 582 int nFieldFlags = pWidget->GetFieldFlags(); |
583 if (pWidget->GetAAction(CPDF_AAction::LoseFocus)
) | 583 |
584 { | 584 return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY; |
585 m_bNotifying = TRUE; | 585 } |
586 pWidget->ClearAppModified(); | 586 |
587 | 587 FX_BOOL CFFL_IFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) { |
588 CPDFSDK_PageView* pPageView = pWidget->G
etPageView(); | 588 ASSERT(pWidget != NULL); |
589 ASSERT(pPageView != NULL); | 589 |
590 | 590 if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) |
591 PDFSDK_FieldAction fa; | 591 return TRUE; |
592 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown
(nFlag); | 592 else { |
593 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(n
Flag); | 593 CPDF_Page* pPage = pWidget->GetPDFPage(); |
594 | 594 ASSERT(pPage != NULL); |
595 pFormFiller->GetActionData(pPageView, CP
DF_AAction::LoseFocus, fa); | 595 |
596 | 596 CPDF_Document* pDocument = pPage->m_pDocument; |
597 pWidget->OnAAction(CPDF_AAction::LoseFoc
us, fa, pPageView); | 597 ASSERT(pDocument != NULL); |
598 m_bNotifying = FALSE; | 598 |
599 | 599 FX_DWORD dwPermissions = pDocument->GetUserPermissions(); |
600 } | 600 return (dwPermissions & FPDFPERM_FILL_FORM) || |
601 } | 601 (dwPermissions & FPDFPERM_ANNOT_FORM) || |
602 } | 602 (dwPermissions & FPDFPERM_MODIFY); |
603 else | 603 } |
604 return FALSE; | 604 return TRUE; |
605 } | 605 } |
606 | 606 |
607 return TRUE; | 607 CFFL_FormFiller* CFFL_IFormFiller::GetFormFiller(CPDFSDK_Annot* pAnnot, |
608 } | 608 FX_BOOL bRegister) { |
609 | 609 // ASSERT(pAnnot != NULL); |
610 FX_BOOL CFFL_IFormFiller::IsVisible(CPDFSDK_Widget* pWidget) | 610 // ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
611 { | 611 |
612 return pWidget->IsVisible(); | 612 CFFL_FormFiller* pFormFiller = NULL; |
613 } | 613 m_Maps.Lookup(pAnnot, pFormFiller); |
614 | 614 |
615 FX_BOOL CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) | 615 if (pFormFiller) |
616 { | 616 return pFormFiller; |
617 ASSERT(pWidget != NULL); | 617 |
618 | 618 if (bRegister) { |
619 int nFieldFlags = pWidget->GetFieldFlags(); | 619 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
620 | 620 |
621 return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY; | 621 int nFieldType = pWidget->GetFieldType(); |
622 } | 622 switch (nFieldType) { |
623 | 623 case FIELDTYPE_PUSHBUTTON: |
624 FX_BOOL CFFL_IFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) | 624 pFormFiller = new CFFL_PushButton(m_pApp, pWidget); |
625 { | 625 break; |
626 ASSERT(pWidget != NULL); | 626 case FIELDTYPE_CHECKBOX: |
627 | 627 pFormFiller = new CFFL_CheckBox(m_pApp, pWidget); |
628 if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) | 628 break; |
629 return TRUE; | 629 case FIELDTYPE_RADIOBUTTON: |
630 else | 630 pFormFiller = new CFFL_RadioButton(m_pApp, pWidget); |
631 { | 631 break; |
632 CPDF_Page* pPage = pWidget->GetPDFPage(); | 632 case FIELDTYPE_TEXTFIELD: |
633 ASSERT(pPage != NULL); | 633 pFormFiller = new CFFL_TextField(m_pApp, pWidget); |
634 | 634 break; |
635 CPDF_Document* pDocument = pPage->m_pDocument; | 635 case FIELDTYPE_LISTBOX: |
636 ASSERT(pDocument != NULL); | 636 pFormFiller = new CFFL_ListBox(m_pApp, pWidget); |
637 | 637 break; |
638 FX_DWORD dwPermissions = pDocument->GetUserPermissions(); | 638 case FIELDTYPE_COMBOBOX: |
639 return (dwPermissions&FPDFPERM_FILL_FORM) || | 639 pFormFiller = new CFFL_ComboBox(m_pApp, pWidget); |
640 (dwPermissions&FPDFPERM_ANNOT_FORM) || | 640 break; |
641 (dwPermissions&FPDFPERM_MODIFY); | 641 case FIELDTYPE_UNKNOWN: |
642 } | 642 default: |
643 return TRUE; | 643 pFormFiller = NULL; |
644 } | 644 break; |
645 | 645 } |
646 CFFL_FormFiller* CFFL_IFormFiller::GetFormFiller(CPDFSDK_Annot* pAnnot, FX_BOOL
bRegister) | 646 |
647 { | 647 if (pFormFiller) { |
648 // ASSERT(pAnnot != NULL); | 648 m_Maps.SetAt(pAnnot, pFormFiller); |
649 // ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 649 } |
650 | 650 } |
651 CFFL_FormFiller * pFormFiller = NULL; | 651 |
652 m_Maps.Lookup(pAnnot, pFormFiller); | 652 return pFormFiller; |
653 | 653 } |
654 if (pFormFiller) | 654 |
655 return pFormFiller; | 655 void CFFL_IFormFiller::RemoveFormFiller(CPDFSDK_Annot* pAnnot) { |
656 | 656 if (pAnnot != NULL) { |
657 if (bRegister) | 657 UnRegisterFormFiller(pAnnot); |
658 { | 658 } |
659 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 659 } |
660 | 660 |
661 int nFieldType = pWidget->GetFieldType(); | 661 void CFFL_IFormFiller::UnRegisterFormFiller(CPDFSDK_Annot* pAnnot) { |
662 switch(nFieldType) | 662 CFFL_FormFiller* pFormFiller = NULL; |
663 { | 663 |
664 case FIELDTYPE_PUSHBUTTON: | 664 if (m_Maps.Lookup(pAnnot, pFormFiller)) { |
665 pFormFiller = new CFFL_PushButton(m_pApp, pWidget); | 665 if (pFormFiller) |
666 break; | 666 delete pFormFiller; |
667 case FIELDTYPE_CHECKBOX: | 667 m_Maps.RemoveKey(pAnnot); |
668 pFormFiller = new CFFL_CheckBox(m_pApp, pWidget); | 668 } |
669 break; | 669 } |
670 case FIELDTYPE_RADIOBUTTON: | 670 |
671 pFormFiller = new CFFL_RadioButton(m_pApp, pWidget); | 671 void CFFL_IFormFiller::SetFocusAnnotTab(CPDFSDK_Annot* pWidget, |
672 break; | 672 FX_BOOL bSameField, |
673 case FIELDTYPE_TEXTFIELD: | 673 FX_BOOL bNext) { |
674 pFormFiller = new CFFL_TextField(m_pApp, pWidget); | 674 } |
675 break; | 675 |
676 case FIELDTYPE_LISTBOX: | 676 void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData, |
677 pFormFiller = new CFFL_ListBox(m_pApp, pWidget); | 677 FX_FLOAT fPopupMin, |
678 break; | 678 FX_FLOAT fPopupMax, |
679 case FIELDTYPE_COMBOBOX: | 679 FX_INT32& nRet, |
680 pFormFiller = new CFFL_ComboBox(m_pApp, pWidget); | 680 FX_FLOAT& fPopupRet) { |
681 break; | 681 ASSERT(pPrivateData != NULL); |
682 case FIELDTYPE_UNKNOWN: | 682 |
683 default: | 683 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
684 pFormFiller = NULL; | 684 |
685 break; | 685 CPDF_Rect rcPageView(0, 0, 0, 0); |
686 } | 686 rcPageView.right = pData->pWidget->GetPDFPage()->GetPageWidth(); |
687 | 687 rcPageView.bottom = pData->pWidget->GetPDFPage()->GetPageHeight(); |
688 if (pFormFiller) | 688 rcPageView.Normalize(); |
689 { | 689 |
690 m_Maps.SetAt(pAnnot, pFormFiller); | 690 ASSERT(pData->pWidget != NULL); |
691 } | 691 CPDF_Rect rcAnnot = pData->pWidget->GetRect(); |
692 } | 692 |
693 | 693 FX_FLOAT fTop = 0.0f; |
694 return pFormFiller; | 694 FX_FLOAT fBottom = 0.0f; |
695 } | 695 |
696 | 696 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pData->pWidget; |
697 void CFFL_IFormFiller::RemoveFormFiller(CPDFSDK_Annot* pAnnot) | 697 switch (pWidget->GetRotate() / 90) { |
698 { | 698 default: |
699 if ( pAnnot != NULL ) | 699 case 0: |
700 { | 700 fTop = rcPageView.top - rcAnnot.top; |
701 UnRegisterFormFiller( pAnnot ); | 701 fBottom = rcAnnot.bottom - rcPageView.bottom; |
702 } | 702 break; |
703 } | 703 case 1: |
704 | 704 fTop = rcAnnot.left - rcPageView.left; |
705 void CFFL_IFormFiller::UnRegisterFormFiller(CPDFSDK_Annot* pAnnot) | 705 fBottom = rcPageView.right - rcAnnot.right; |
706 { | 706 break; |
707 CFFL_FormFiller * pFormFiller = NULL; | 707 case 2: |
708 | 708 fTop = rcAnnot.bottom - rcPageView.bottom; |
709 if (m_Maps.Lookup(pAnnot,pFormFiller)) | 709 fBottom = rcPageView.top - rcAnnot.top; |
710 { | 710 break; |
711 if (pFormFiller) | 711 case 3: |
712 delete pFormFiller; | 712 fTop = rcPageView.right - rcAnnot.right; |
713 m_Maps.RemoveKey(pAnnot); | 713 fBottom = rcAnnot.left - rcPageView.left; |
714 } | 714 break; |
715 } | 715 } |
716 | 716 |
717 void CFFL_IFormFiller::SetFocusAnnotTab(CPDFSDK_Annot* pWidget, FX_BOOL bSameFie
ld, FX_BOOL bNext) | 717 FX_FLOAT fFactHeight = 0; |
718 { | 718 FX_BOOL bBottom = TRUE; |
719 | 719 FX_FLOAT fMaxListBoxHeight = 0; |
720 } | 720 if (fPopupMax > FFL_MAXLISTBOXHEIGHT) { |
721 | 721 if (fPopupMin > FFL_MAXLISTBOXHEIGHT) { |
722 void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX
_FLOAT fPopupMax, FX_INT32 & nRet, FX_FLOAT & fPopupRet) | 722 fMaxListBoxHeight = fPopupMin; |
723 { | 723 } else { |
724 ASSERT(pPrivateData != NULL); | 724 fMaxListBoxHeight = FFL_MAXLISTBOXHEIGHT; |
725 | 725 } |
726 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; | 726 } else |
727 | 727 fMaxListBoxHeight = fPopupMax; |
728 | 728 |
729 | 729 if (fBottom > fMaxListBoxHeight) { |
730 | 730 fFactHeight = fMaxListBoxHeight; |
731 CPDF_Rect rcPageView(0,0,0,0); | 731 bBottom = TRUE; |
732 rcPageView.right = pData->pWidget->GetPDFPage()->GetPageWidth(); | 732 } else { |
733 rcPageView.bottom = pData->pWidget->GetPDFPage()->GetPageHeight(); | 733 if (fTop > fMaxListBoxHeight) { |
734 rcPageView.Normalize(); | 734 fFactHeight = fMaxListBoxHeight; |
735 | 735 bBottom = FALSE; |
736 | 736 } else { |
737 ASSERT(pData->pWidget != NULL); | 737 if (fTop > fBottom) { |
738 CPDF_Rect rcAnnot = pData->pWidget->GetRect(); | 738 fFactHeight = fTop; |
739 | 739 bBottom = FALSE; |
740 FX_FLOAT fTop = 0.0f; | 740 } else { |
741 FX_FLOAT fBottom = 0.0f; | 741 fFactHeight = fBottom; |
742 | 742 bBottom = TRUE; |
743 CPDFSDK_Widget * pWidget = (CPDFSDK_Widget*)pData->pWidget; | 743 } |
744 switch (pWidget->GetRotate() / 90) | 744 } |
745 { | 745 } |
746 default: | 746 |
747 case 0: | 747 nRet = bBottom ? 0 : 1; |
748 fTop = rcPageView.top - rcAnnot.top; | 748 fPopupRet = fFactHeight; |
749 fBottom = rcAnnot.bottom - rcPageView.bottom; | 749 } |
750 break; | 750 |
751 case 1: | 751 void CFFL_IFormFiller::OnSetWindowRect(void* pPrivateData, |
752 fTop = rcAnnot.left - rcPageView.left; | 752 const CPDF_Rect& rcWindow) { |
753 fBottom = rcPageView.right - rcAnnot.right; | 753 ASSERT(pPrivateData != NULL); |
754 break; | 754 |
755 case 2: | 755 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
756 fTop = rcAnnot.bottom - rcPageView.bottom; | 756 |
757 fBottom = rcPageView.top - rcAnnot.top; | 757 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, TRUE)) { |
758 break; | 758 CPDF_Rect rcOld = |
759 case 3: | 759 pFormFiller->PWLtoFFL(pFormFiller->GetWindowRect(pData->pPageView)); |
760 fTop = rcPageView.right - rcAnnot.right; | 760 CPDF_Rect rcNew = pFormFiller->PWLtoFFL(rcWindow); |
761 fBottom = rcAnnot.left - rcPageView.left; | 761 pFormFiller->SetWindowRect(pData->pPageView, rcWindow); |
762 break; | 762 |
763 } | 763 CPDF_Rect unRect = rcOld; |
764 | 764 unRect.Union(rcNew); |
765 FX_FLOAT fFactHeight = 0; | 765 // FX_RECT rcRect = unRect.GetOutterRect(); |
766 FX_BOOL bBottom = TRUE; | 766 unRect.left = (FX_FLOAT)(unRect.left - 0.5); |
767 FX_FLOAT fMaxListBoxHeight = 0; | 767 unRect.right = (FX_FLOAT)(unRect.right + 0.5); |
768 if (fPopupMax > FFL_MAXLISTBOXHEIGHT) | 768 unRect.top = (FX_FLOAT)(unRect.top + 0.5); |
769 { | 769 unRect.bottom = (FX_FLOAT)(unRect.bottom - 0.5); |
770 if (fPopupMin > FFL_MAXLISTBOXHEIGHT) | 770 m_pApp->FFI_Invalidate(pData->pWidget->GetPDFPage(), |
771 { | 771 unRect.left, |
772 fMaxListBoxHeight = fPopupMin; | 772 unRect.top, |
773 } | 773 unRect.right, |
774 else | 774 unRect.bottom); |
775 { | 775 } |
776 fMaxListBoxHeight = FFL_MAXLISTBOXHEIGHT; | 776 } |
777 } | 777 |
778 } | 778 void CFFL_IFormFiller::OnKeyStroke(FX_BOOL bEditOrList, |
779 else | 779 void* pPrivateData, |
780 fMaxListBoxHeight = fPopupMax; | 780 FX_INT32 nKeyCode, |
781 | 781 CFX_WideString& strChange, |
782 if (fBottom > fMaxListBoxHeight) | 782 const CFX_WideString& strChangeEx, |
783 { | 783 FX_BOOL bKeyDown, |
784 fFactHeight = fMaxListBoxHeight; | 784 FX_BOOL& bRC, |
785 bBottom = TRUE; | 785 FX_BOOL& bExit) { |
786 } | 786 ASSERT(pPrivateData != NULL); |
787 else | 787 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
788 { | 788 ASSERT(pData->pWidget != NULL); |
789 if (fTop > fMaxListBoxHeight) | 789 |
790 { | 790 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); |
791 fFactHeight = fMaxListBoxHeight; | 791 ASSERT(pFormFiller != NULL); |
792 bBottom = FALSE; | 792 |
793 } | 793 pFormFiller->OnKeyStroke(bKeyDown); |
794 else | 794 } |
795 { | 795 |
796 if (fTop > fBottom) | 796 void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, |
797 { | 797 CPDFSDK_PageView* pPageView, |
798 fFactHeight = fTop; | 798 FX_BOOL& bRC, |
799 bBottom = FALSE; | 799 FX_BOOL& bExit, |
800 } | 800 FX_DWORD nFlag) { |
801 else | 801 if (!m_bNotifying) { |
802 { | 802 ASSERT(pWidget != NULL); |
803 fFactHeight = fBottom; | 803 if (pWidget->GetAAction(CPDF_AAction::KeyStroke)) { |
804 bBottom = TRUE; | 804 m_bNotifying = TRUE; |
805 } | 805 pWidget->ClearAppModified(); |
806 } | 806 |
807 } | 807 ASSERT(pPageView != NULL); |
808 | 808 // CReader_DocView* pDocView = |
809 nRet = bBottom ? 0 : 1; | 809 // pPageView->GetDocView(); |
810 fPopupRet = fFactHeight; | 810 // ASSERT(pDocView != NULL); |
811 } | 811 |
812 | 812 PDFSDK_FieldAction fa; |
813 void CFFL_IFormFiller::OnSetWindowRect(void* pPrivateData, const CPDF_Rect & rcW
indow) | 813 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
814 { | 814 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
815 ASSERT(pPrivateData != NULL); | 815 fa.bWillCommit = TRUE; |
816 | 816 fa.nCommitKey = GetCommitKey(); |
817 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; | 817 fa.bKeyDown = GetKeyDown(); |
818 | 818 fa.bRC = TRUE; |
819 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, TRUE)) | 819 |
820 { | 820 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); |
821 | 821 ASSERT(pFormFiller != NULL); |
822 CPDF_Rect rcOld = pFormFiller->PWLtoFFL(pFormFiller->GetWindowRe
ct(pData->pPageView)); | 822 |
823 CPDF_Rect rcNew = pFormFiller->PWLtoFFL(rcWindow); | 823 pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyStroke, fa); |
824 pFormFiller->SetWindowRect(pData->pPageView, rcWindow); | 824 pFormFiller->SaveState(pPageView); |
825 | 825 |
826 CPDF_Rect unRect = rcOld; | 826 PDFSDK_FieldAction faOld = fa; |
827 unRect.Union(rcNew); | 827 pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageView); |
828 //FX_RECT rcRect = unRect.GetOutterRect(); | 828 |
829 unRect.left = (FX_FLOAT)(unRect.left - 0.5); | 829 bRC = fa.bRC; |
830 unRect.right = (FX_FLOAT)(unRect.right + 0.5); | 830 // bExit = !IsValidAnnot(m_pApp, pDocument, |
831 unRect.top = (FX_FLOAT)(unRect.top + 0.5); | 831 //pDocView, pPageView, pWidget); |
832 unRect.bottom = (FX_FLOAT)(unRect.bottom -0.5); | 832 |
833 m_pApp->FFI_Invalidate(pData->pWidget->GetPDFPage(), unRect.left
, unRect.top, unRect.right, unRect.bottom); | 833 m_bNotifying = FALSE; |
834 } | 834 } |
835 } | 835 } |
836 | 836 } |
837 void CFFL_IFormFiller::OnKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_I
NT32 nKeyCode, CFX_WideString& strChange, | 837 |
838 const CFX_Wid
eString& strChangeEx, FX_BOOL bKeyDown, | 838 void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, |
839 FX_BOOL & bRC
, FX_BOOL & bExit) | 839 CPDFSDK_PageView* pPageView, |
840 { | 840 FX_BOOL& bRC, |
841 ASSERT(pPrivateData != NULL); | 841 FX_BOOL& bExit, |
842 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; | 842 FX_DWORD nFlag) { |
843 ASSERT(pData->pWidget != NULL); | 843 if (!m_bNotifying) { |
844 | 844 ASSERT(pWidget != NULL); |
845 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); | 845 if (pWidget->GetAAction(CPDF_AAction::Validate)) { |
846 ASSERT(pFormFiller != NULL); | 846 m_bNotifying = TRUE; |
847 | 847 pWidget->ClearAppModified(); |
848 pFormFiller->OnKeyStroke(bKeyDown); | 848 |
849 } | 849 ASSERT(pPageView != NULL); |
850 | 850 // CReader_DocView* pDocView = |
851 void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, CPDFSDK_PageVi
ew* pPageView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag) | 851 // pPageView->GetDocView(); |
852 { | 852 // ASSERT(pDocView != NULL); |
853 if (!m_bNotifying) | 853 |
854 { | 854 PDFSDK_FieldAction fa; |
855 ASSERT(pWidget != NULL); | 855 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
856 if (pWidget->GetAAction(CPDF_AAction::KeyStroke)) | 856 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
857 { | 857 fa.bKeyDown = GetKeyDown(); |
858 m_bNotifying = TRUE; | 858 fa.bRC = TRUE; |
859 pWidget->ClearAppModified(); | 859 |
860 | 860 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); |
861 ASSERT(pPageView != NULL); | 861 ASSERT(pFormFiller != NULL); |
862 // CReader_DocView* pDocView = pPageView->GetDocView(); | 862 |
863 // ASSERT(pDocView != NULL); | 863 pFormFiller->GetActionData(pPageView, CPDF_AAction::Validate, fa); |
864 | 864 pFormFiller->SaveState(pPageView); |
865 | 865 |
866 | 866 PDFSDK_FieldAction faOld = fa; |
867 PDFSDK_FieldAction fa; | 867 pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView); |
868 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 868 |
869 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 869 bRC = fa.bRC; |
870 fa.bWillCommit = TRUE; | 870 // bExit = !IsValidAnnot(m_pApp, pDocument, |
871 fa.nCommitKey = GetCommitKey(); | 871 //pDocView, pPageView, pWidget); |
872 fa.bKeyDown = GetKeyDown(); | 872 |
873 fa.bRC = TRUE; | 873 m_bNotifying = FALSE; |
874 | 874 } |
875 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FA
LSE); | 875 } |
876 ASSERT(pFormFiller != NULL); | 876 } |
877 | 877 |
878 pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyS
troke, fa); | 878 void CFFL_IFormFiller::OnCalculate(CPDFSDK_Widget* pWidget, |
879 pFormFiller->SaveState(pPageView); | 879 CPDFSDK_PageView* pPageView, |
880 | 880 FX_BOOL& bExit, |
881 PDFSDK_FieldAction faOld = fa; | 881 FX_DWORD nFlag) { |
882 pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageVie
w); | 882 if (!m_bNotifying) { |
883 | 883 ASSERT(pWidget != NULL); |
884 bRC = fa.bRC; | 884 ASSERT(pPageView != NULL); |
885 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPage
View, pWidget); | 885 // CReader_DocView* pDocView = pPageView->GetDocView(); |
886 | 886 // ASSERT(pDocView != NULL); |
887 m_bNotifying = FALSE; | 887 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); |
888 } | 888 ASSERT(pDocument != NULL); |
889 } | 889 |
890 } | 890 CPDFSDK_InterForm* pInterForm = |
891 | 891 (CPDFSDK_InterForm*)pDocument->GetInterForm(); |
892 void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPa
geView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag) | 892 ASSERT(pInterForm != NULL); |
893 { | 893 |
894 if (!m_bNotifying) | 894 pInterForm->OnCalculate(pWidget->GetFormField()); |
895 { | 895 |
896 ASSERT(pWidget != NULL); | 896 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, |
897 if (pWidget->GetAAction(CPDF_AAction::Validate)) | 897 //pWidget); |
898 { | 898 |
899 m_bNotifying = TRUE; | 899 m_bNotifying = FALSE; |
900 pWidget->ClearAppModified(); | 900 } |
901 | 901 } |
902 ASSERT(pPageView != NULL); | 902 |
903 // CReader_DocView* pDocView = pPageView->GetDocView(); | 903 void CFFL_IFormFiller::OnFormat(CPDFSDK_Widget* pWidget, |
904 // ASSERT(pDocView != NULL); | 904 CPDFSDK_PageView* pPageView, |
905 | 905 FX_BOOL& bExit, |
906 | 906 FX_DWORD nFlag) { |
907 | 907 if (!m_bNotifying) { |
908 PDFSDK_FieldAction fa; | 908 ASSERT(pWidget != NULL); |
909 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 909 ASSERT(pPageView != NULL); |
910 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 910 // CReader_DocView* pDocView = pPageView->GetDocView(); |
911 fa.bKeyDown = GetKeyDown(); | 911 // ASSERT(pDocView != NULL); |
912 fa.bRC = TRUE; | 912 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); |
913 | 913 ASSERT(pDocument != NULL); |
914 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FA
LSE); | 914 |
915 ASSERT(pFormFiller != NULL); | 915 CPDFSDK_InterForm* pInterForm = |
916 | 916 (CPDFSDK_InterForm*)pDocument->GetInterForm(); |
917 pFormFiller->GetActionData(pPageView, CPDF_AAction::Vali
date, fa); | 917 ASSERT(pInterForm != NULL); |
918 pFormFiller->SaveState(pPageView); | 918 |
919 | 919 FX_BOOL bFormated = FALSE; |
920 PDFSDK_FieldAction faOld = fa; | 920 CFX_WideString sValue = pInterForm->OnFormat( |
921 pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView
); | 921 pWidget->GetFormField(), GetCommitKey(), bFormated); |
922 | 922 |
923 bRC = fa.bRC; | 923 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, |
924 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPage
View, pWidget); | 924 //pWidget); |
925 | 925 |
926 m_bNotifying = FALSE; | 926 if (bExit) |
927 } | 927 return; |
928 } | 928 |
929 } | 929 if (bFormated) { |
930 | 930 pInterForm->ResetFieldAppearance(pWidget->GetFormField(), sValue, TRUE); |
931 void CFFL_IFormFiller::OnCalculate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pP
ageView, FX_BOOL& bExit, FX_DWORD nFlag) | 931 pInterForm->UpdateField(pWidget->GetFormField()); |
932 { | 932 } |
933 if (!m_bNotifying) | 933 |
934 { | 934 m_bNotifying = FALSE; |
935 ASSERT(pWidget != NULL); | 935 } |
936 ASSERT(pPageView != NULL); | |
937 // CReader_DocView* pDocView = pPageView->GetDocView(); | |
938 // ASSERT(pDocView != NULL); | |
939 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); | |
940 ASSERT(pDocument != NULL); | |
941 | |
942 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->G
etInterForm(); | |
943 ASSERT(pInterForm != NULL); | |
944 | |
945 pInterForm->OnCalculate(pWidget->GetFormField()); | |
946 | |
947 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pW
idget); | |
948 | |
949 m_bNotifying = FALSE; | |
950 } | |
951 } | |
952 | |
953 void CFFL_IFormFiller::OnFormat(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPage
View, FX_BOOL& bExit, FX_DWORD nFlag) | |
954 { | |
955 if (!m_bNotifying) | |
956 { | |
957 ASSERT(pWidget != NULL); | |
958 ASSERT(pPageView != NULL); | |
959 // CReader_DocView* pDocView = pPageView->GetDocView(); | |
960 // ASSERT(pDocView != NULL); | |
961 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); | |
962 ASSERT(pDocument != NULL); | |
963 | |
964 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->G
etInterForm(); | |
965 ASSERT(pInterForm != NULL); | |
966 | |
967 FX_BOOL bFormated = FALSE; | |
968 CFX_WideString sValue = pInterForm->OnFormat(pWidget->GetFormFie
ld(), GetCommitKey(), bFormated); | |
969 | |
970 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pW
idget); | |
971 | |
972 if (bExit) return; | |
973 | |
974 if (bFormated) | |
975 { | |
976 pInterForm->ResetFieldAppearance(pWidget->GetFormField()
, sValue, TRUE); | |
977 pInterForm->UpdateField(pWidget->GetFormField()); | |
978 } | |
979 | |
980 m_bNotifying = FALSE; | |
981 } | |
982 } | 936 } |
983 | 937 |
984 // LRESULT CALLBACK CFFL_IFormFiller::FFL_WndProc( | 938 // LRESULT CALLBACK CFFL_IFormFiller::FFL_WndProc( |
985 // » » » » » » » » » int co
de, // hook code | 939 // » » » » » » » » » int co
de, // hook |
986 // » » » » » » » » » WPARAM
wParam, // virtual-key code | 940 // code |
987 // » » » » » » » » » LPARAM
lParam // keystroke-message information | 941 // » » » » » » » » » WPARAM
wParam, // virtual-key |
| 942 // code |
| 943 // » » » » » » » » » LPARAM
lParam // |
| 944 // keystroke-message information |
988 //
) | 945 //
) |
989 // { | 946 // { |
990 // if (code != HC_ACTION) | 947 // if (code != HC_ACTION) |
991 // { | 948 // { |
992 // return CallNextHookEx (m_hookSheet, code, wParam, lParam); | 949 // return CallNextHookEx (m_hookSheet, code, wParam, lParam); |
993 // } | 950 // } |
994 // | 951 // |
995 // » FXSYS_memcpy(&g_Msg, (void*)lParam, sizeof(MSG));» | 952 // » FXSYS_memcpy(&g_Msg, (void*)lParam, sizeof(MSG)); |
996 // | 953 // |
997 // return 0; | 954 // return 0; |
998 // } | 955 // } |
999 | 956 |
1000 // MSG CFFL_IFormFiller::GetLastMessage() | 957 // MSG CFFL_IFormFiller::GetLastMessage() |
1001 // { | 958 // { |
1002 // return g_Msg; | 959 // return g_Msg; |
1003 // } | 960 // } |
1004 | 961 |
1005 int CFFL_IFormFiller::GetCommitKey() | 962 int CFFL_IFormFiller::GetCommitKey() { |
1006 { | 963 //» MSG msg = CFFL_IFormFiller::GetLastMessage(); |
1007 //» MSG msg = CFFL_IFormFiller::GetLastMessage(); | |
1008 | 964 |
1009 » int nCommitKey = 0; | 965 int nCommitKey = 0; |
1010 // » switch (msg.message) | 966 // » switch (msg.message) |
1011 // » { | 967 // » { |
1012 // » case WM_LBUTTONDOWN: | 968 // » case WM_LBUTTONDOWN: |
1013 // » case WM_LBUTTONUP: | 969 // » case WM_LBUTTONUP: |
1014 // » » nCommitKey = 1; | 970 // » » nCommitKey = 1; |
1015 // » » break; | 971 // » » break; |
1016 // » case WM_KEYDOWN: | 972 // » case WM_KEYDOWN: |
1017 // » » switch (msg.wParam) | 973 // » » switch (msg.wParam) |
1018 // » » { | 974 // » » { |
1019 // » » case VK_RETURN: | 975 // » » case VK_RETURN: |
1020 // » » » nCommitKey = 2; | 976 // » » » nCommitKey = 2; |
1021 // » » » break; | 977 // » » » break; |
1022 // » » case VK_TAB: | 978 // » » case VK_TAB: |
1023 // » » » nCommitKey = 3; | 979 // » » » nCommitKey = 3; |
1024 // » » » break; | 980 // » » » break; |
1025 // » » } | 981 // » » } |
1026 // » » break; | 982 // » » break; |
1027 // » } | 983 // » } |
1028 | 984 |
1029 » return nCommitKey; | 985 return nCommitKey; |
1030 } | 986 } |
1031 | 987 |
1032 FX_BOOL CFFL_IFormFiller::GetKeyDown() | 988 FX_BOOL CFFL_IFormFiller::GetKeyDown() { |
1033 { | 989 return TRUE; |
1034 » return TRUE; | 990 // » MSG msg = CFFL_IFormFiller::GetLastMessage(); |
1035 // » MSG msg = CFFL_IFormFiller::GetLastMessage(); | 991 // |
1036 // | 992 // » return msg.message == WM_KEYDOWN || msg.message == WM_CHAR; |
1037 // » return msg.message == WM_KEYDOWN || msg.message == WM_CHAR; | |
1038 } | 993 } |
1039 | 994 |
1040 FX_BOOL»CFFL_IFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView, CPDFSDK_Anno
t* pAnnot) | 995 FX_BOOL CFFL_IFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView, |
1041 { | 996 CPDFSDK_Annot* pAnnot) { |
| 997 ASSERT(pPageView != NULL); |
| 998 ASSERT(pAnnot != NULL); |
1042 | 999 |
1043 » ASSERT(pPageView != NULL); | 1000 if (pPageView) |
1044 » ASSERT(pAnnot != NULL); | 1001 return pPageView->IsValidAnnot(pAnnot->GetPDFAnnot()); |
1045 | 1002 else |
1046 » if(pPageView) | 1003 return FALSE; |
1047 » » return pPageView->IsValidAnnot(pAnnot->GetPDFAnnot()); | |
1048 » else | |
1049 » » return FALSE; | |
1050 } | 1004 } |
1051 | 1005 |
1052 void CFFL_IFormFiller::BeforeUndo(CPDFSDK_Document* pDocument) | 1006 void CFFL_IFormFiller::BeforeUndo(CPDFSDK_Document* pDocument) { |
1053 { | |
1054 | |
1055 } | 1007 } |
1056 | 1008 |
1057 void CFFL_IFormFiller::BeforeRedo(CPDFSDK_Document* pDocument) | 1009 void CFFL_IFormFiller::BeforeRedo(CPDFSDK_Document* pDocument) { |
1058 { | 1010 BeforeUndo(pDocument); |
1059 » BeforeUndo(pDocument); | |
1060 } | 1011 } |
1061 | 1012 |
1062 void CFFL_IFormFiller::AfterUndo(CPDFSDK_Document* pDocument) | 1013 void CFFL_IFormFiller::AfterUndo(CPDFSDK_Document* pDocument) { |
1063 { | |
1064 } | 1014 } |
1065 | 1015 |
1066 void CFFL_IFormFiller::AfterRedo(CPDFSDK_Document* pDocument) | 1016 void CFFL_IFormFiller::AfterRedo(CPDFSDK_Document* pDocument) { |
1067 { | |
1068 } | 1017 } |
1069 | 1018 |
1070 FX_BOOL»CFFL_IFormFiller::CanCopy(CPDFSDK_Document* pDocument) | 1019 FX_BOOL CFFL_IFormFiller::CanCopy(CPDFSDK_Document* pDocument) { |
1071 { | 1020 return FALSE; |
1072 | |
1073 » return FALSE; | |
1074 } | 1021 } |
1075 | 1022 |
1076 FX_BOOL»CFFL_IFormFiller::CanCut(CPDFSDK_Document* pDocument) | 1023 FX_BOOL CFFL_IFormFiller::CanCut(CPDFSDK_Document* pDocument) { |
1077 { | 1024 return FALSE; |
1078 | |
1079 » return FALSE; | |
1080 } | 1025 } |
1081 | 1026 |
1082 FX_BOOL»CFFL_IFormFiller::CanPaste(CPDFSDK_Document* pDocument) | 1027 FX_BOOL CFFL_IFormFiller::CanPaste(CPDFSDK_Document* pDocument) { |
1083 { | 1028 return FALSE; |
1084 | |
1085 » return FALSE; | |
1086 } | 1029 } |
1087 | 1030 |
1088 void CFFL_IFormFiller::DoCopy(CPDFSDK_Document* pDocument) | 1031 void CFFL_IFormFiller::DoCopy(CPDFSDK_Document* pDocument) { |
1089 { | |
1090 } | 1032 } |
1091 | 1033 |
1092 void CFFL_IFormFiller::DoCut(CPDFSDK_Document* pDocument) | 1034 void CFFL_IFormFiller::DoCut(CPDFSDK_Document* pDocument) { |
1093 { | |
1094 } | 1035 } |
1095 | 1036 |
1096 void CFFL_IFormFiller::DoPaste(CPDFSDK_Document* pDocument) | 1037 void CFFL_IFormFiller::DoPaste(CPDFSDK_Document* pDocument) { |
1097 { | 1038 } |
| 1039 void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, |
| 1040 void* pPrivateData, |
| 1041 FX_INT32 nKeyCode, |
| 1042 CFX_WideString& strChange, |
| 1043 const CFX_WideString& strChangeEx, |
| 1044 int nSelStart, |
| 1045 int nSelEnd, |
| 1046 FX_BOOL bKeyDown, |
| 1047 FX_BOOL& bRC, |
| 1048 FX_BOOL& bExit, |
| 1049 FX_DWORD nFlag) { |
| 1050 ASSERT(pPrivateData != NULL); |
| 1051 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
| 1052 ASSERT(pData->pWidget != NULL); |
1098 | 1053 |
1099 } | 1054 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); |
1100 void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData
, FX_INT32 nKeyCode, | 1055 ASSERT(pFormFiller != NULL); |
1101 » » » » » » » » » »
» CFX_WideString & strChange, const CFX_WideString& strChangeEx, | |
1102 » » » » » » » » » »
» int nSelStart, int nSelEnd, | |
1103 » » » » » » » » » »
FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit, FX_DWORD nFlag) | |
1104 { | |
1105 » ASSERT(pPrivateData != NULL); | |
1106 » CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; | |
1107 » ASSERT(pData->pWidget != NULL); | |
1108 » | |
1109 » CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); | |
1110 » ASSERT(pFormFiller != NULL); | |
1111 » | |
1112 » if (!m_bNotifying) | |
1113 » { | |
1114 » » if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke)) | |
1115 » » { | |
1116 » » » m_bNotifying = TRUE; | |
1117 » » » int nAge = pData->pWidget->GetAppearanceAge(); | |
1118 » » » int nValueAge = pData->pWidget->GetValueAge(); | |
1119 | 1056 |
1120 » » » ASSERT(pData->pPageView != NULL); | 1057 if (!m_bNotifying) { |
1121 » » » CPDFSDK_Document* pDocument = pData->pPageView->GetSDKD
ocument(); | 1058 if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke)) { |
1122 » » » | 1059 m_bNotifying = TRUE; |
1123 » » » PDFSDK_FieldAction fa; | 1060 int nAge = pData->pWidget->GetAppearanceAge(); |
1124 » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 1061 int nValueAge = pData->pWidget->GetValueAge(); |
1125 » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | |
1126 » » » fa.sChange = strChange; | |
1127 » » » fa.sChangeEx = strChangeEx; | |
1128 » » » fa.bKeyDown = bKeyDown; | |
1129 » » » fa.bWillCommit = FALSE; | |
1130 » » » fa.bRC = TRUE; | |
1131 » » » fa.nSelStart = nSelStart; | |
1132 » » » fa.nSelEnd = nSelEnd; | |
1133 | 1062 |
| 1063 ASSERT(pData->pPageView != NULL); |
| 1064 CPDFSDK_Document* pDocument = pData->pPageView->GetSDKDocument(); |
1134 | 1065 |
1135 » » » pFormFiller->GetActionData(pData->pPageView, CPDF_AActio
n::KeyStroke, fa); | 1066 PDFSDK_FieldAction fa; |
1136 » » » pFormFiller->SaveState(pData->pPageView); | 1067 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
1137 » » » | 1068 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
1138 » » » if (pData->pWidget->OnAAction(CPDF_AAction::KeyStroke, f
a, pData->pPageView)) | 1069 fa.sChange = strChange; |
1139 » » » { | 1070 fa.sChangeEx = strChangeEx; |
1140 » » » » if (!IsValidAnnot(pData->pPageView, pData->pWidg
et)) | 1071 fa.bKeyDown = bKeyDown; |
1141 » » » » { | 1072 fa.bWillCommit = FALSE; |
1142 » » » » » bExit = TRUE; | 1073 fa.bRC = TRUE; |
1143 » » » » » m_bNotifying = FALSE; | 1074 fa.nSelStart = nSelStart; |
1144 » » » » » return; | 1075 fa.nSelEnd = nSelEnd; |
1145 » » » » } | 1076 |
1146 » » » » | 1077 pFormFiller->GetActionData(pData->pPageView, CPDF_AAction::KeyStroke, fa); |
1147 » » » » if (nAge != pData->pWidget->GetAppearanceAge()) | 1078 pFormFiller->SaveState(pData->pPageView); |
1148 » » » » { | 1079 |
1149 » » » » » CPWL_Wnd* pWnd = pFormFiller->ResetPDFWi
ndow(pData->pPageView, nValueAge == pData->pWidget->GetValueAge()); | 1080 if (pData->pWidget->OnAAction( |
1150 » » » » » pData = (CFFL_PrivateData*)pWnd->GetAtta
chedData(); | 1081 CPDF_AAction::KeyStroke, fa, pData->pPageView)) { |
1151 » » » » » bExit = TRUE; | 1082 if (!IsValidAnnot(pData->pPageView, pData->pWidget)) { |
1152 » » » » } | 1083 bExit = TRUE; |
1153 » » » » | 1084 m_bNotifying = FALSE; |
1154 » » » » if (fa.bRC) | 1085 return; |
1155 » » » » { | 1086 } |
1156 » » » » » pFormFiller->SetActionData(pData->pPageV
iew, CPDF_AAction::KeyStroke, fa); | 1087 |
1157 » » » » » bRC = FALSE; | 1088 if (nAge != pData->pWidget->GetAppearanceAge()) { |
1158 » » » » } | 1089 CPWL_Wnd* pWnd = pFormFiller->ResetPDFWindow( |
1159 » » » » else | 1090 pData->pPageView, nValueAge == pData->pWidget->GetValueAge()); |
1160 » » » » { | 1091 pData = (CFFL_PrivateData*)pWnd->GetAttachedData(); |
1161 » » » » » pFormFiller->RestoreState(pData->pPageVi
ew); | 1092 bExit = TRUE; |
1162 » » » » » bRC = FALSE; | 1093 } |
1163 » » » » } | 1094 |
1164 » » » » | 1095 if (fa.bRC) { |
1165 » » » » if (pDocument->GetFocusAnnot() != pData->pWidget
) | 1096 pFormFiller->SetActionData( |
1166 » » » » { | 1097 pData->pPageView, CPDF_AAction::KeyStroke, fa); |
1167 » » » » » pFormFiller->CommitData(pData->pPageView
,nFlag); | 1098 bRC = FALSE; |
1168 » » » » » bExit = TRUE; | 1099 } else { |
1169 » » » » } | 1100 pFormFiller->RestoreState(pData->pPageView); |
1170 » » » } | 1101 bRC = FALSE; |
1171 » » » else | 1102 } |
1172 » » » {» » » | 1103 |
1173 » » » » if (!IsValidAnnot(pData->pPageView, pData->pWidg
et)) | 1104 if (pDocument->GetFocusAnnot() != pData->pWidget) { |
1174 » » » » { | 1105 pFormFiller->CommitData(pData->pPageView, nFlag); |
1175 » » » » » bExit = TRUE; | 1106 bExit = TRUE; |
1176 » » » » » m_bNotifying = FALSE; | 1107 } |
1177 » » » » » return; | 1108 } else { |
1178 » » » » } | 1109 if (!IsValidAnnot(pData->pPageView, pData->pWidget)) { |
1179 » » » } | 1110 bExit = TRUE; |
1180 » » » | 1111 m_bNotifying = FALSE; |
1181 » » » m_bNotifying = FALSE; | 1112 return; |
1182 » » } | 1113 } |
1183 » } | 1114 } |
| 1115 |
| 1116 m_bNotifying = FALSE; |
| 1117 } |
| 1118 } |
1184 } | 1119 } |
1185 | 1120 |
1186 void» CFFL_IFormFiller::OnAfterKeyStroke(FX_BOOL bEditOrList, void* pPrivateDa
ta, FX_BOOL & bExit,FX_DWORD nFlag) | 1121 void CFFL_IFormFiller::OnAfterKeyStroke(FX_BOOL bEditOrList, |
1187 { | 1122 void* pPrivateData, |
1188 » ASSERT(pPrivateData != NULL); | 1123 FX_BOOL& bExit, |
1189 » CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; | 1124 FX_DWORD nFlag) { |
1190 » ASSERT(pData->pWidget != NULL); | 1125 ASSERT(pPrivateData != NULL); |
1191 » | 1126 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
1192 » CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); | 1127 ASSERT(pData->pWidget != NULL); |
1193 » ASSERT(pFormFiller != NULL); | 1128 |
1194 » | 1129 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); |
1195 » if (!bEditOrList) | 1130 ASSERT(pFormFiller != NULL); |
1196 » » pFormFiller->OnKeyStroke(bExit); | 1131 |
| 1132 if (!bEditOrList) |
| 1133 pFormFiller->OnKeyStroke(bExit); |
1197 } | 1134 } |
OLD | NEW |