Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(724)

Side by Side Diff: fpdfsdk/src/formfiller/FFL_IFormFiller.cpp

Issue 1252613002: FX_BOOL considered harmful. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Manual edits. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/src/formfiller/FFL_FormFiller.cpp ('k') | fpdfsdk/src/formfiller/FFL_ListBox.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 CFFL_IFormFiller::CFFL_IFormFiller(CPDFDoc_Environment* pApp) :
24 m_pApp(pApp), 24 m_pApp(pApp),
25 » m_bNotifying(FALSE) 25 » m_bNotifying(false)
26 { 26 {
27 } 27 }
28 28
29 CFFL_IFormFiller::~CFFL_IFormFiller() 29 CFFL_IFormFiller::~CFFL_IFormFiller()
30 { 30 {
31 for (auto& it : m_Maps) 31 for (auto& it : m_Maps)
32 delete it.second; 32 delete it.second;
33 m_Maps.clear(); 33 m_Maps.clear();
34 } 34 }
35 35
36 FX_BOOL»CFFL_IFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView,CPDFSDK_Anno t* pAnnot, CPDF_Point point) 36 bool» CFFL_IFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView,CPDFSDK_Anno t* pAnnot, CPDF_Point point)
37 { 37 {
38 CPDF_Rect rc = pAnnot->GetRect(); 38 CPDF_Rect rc = pAnnot->GetRect();
39 if(rc.Contains(point.x, point.y)) 39 if(rc.Contains(point.x, point.y))
40 » » return TRUE; 40 » » return true;
41 » return FALSE; 41 » return false;
42 } 42 }
43 43
44 FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot * pAnnot) 44 FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot * pAnnot)
45 { 45 {
46 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 46 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false))
47 { 47 {
48 return pFormFiller->GetViewBBox(pPageView, pAnnot); 48 return pFormFiller->GetViewBBox(pPageView, pAnnot);
49 } 49 }
50 else 50 else
51 { 51 {
52 ASSERT(pPageView != NULL); 52 ASSERT(pPageView != NULL);
53 ASSERT(pAnnot != NULL); 53 ASSERT(pAnnot != NULL);
54 54
55 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); 55 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
56 ASSERT(pPDFAnnot != NULL); 56 ASSERT(pPDFAnnot != NULL);
(...skipping 12 matching lines...) Expand all
69 69
70 void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, /*HDC hDC,*/ CPDFSDK_ Annot* pAnnot, 70 void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, /*HDC hDC,*/ CPDFSDK_ Annot* pAnnot,
71 CFX_RenderDevice* pDevice, CPDF_ Matrix* pUser2Device, 71 CFX_RenderDevice* pDevice, CPDF_ Matrix* pUser2Device,
72 /*const CRect& rcWindow,*/ FX_DW ORD dwFlags) 72 /*const CRect& rcWindow,*/ FX_DW ORD dwFlags)
73 { 73 {
74 ASSERT(pPageView != NULL); 74 ASSERT(pPageView != NULL);
75 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 75 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
76 76
77 if (IsVisible(pWidget)) 77 if (IsVisible(pWidget))
78 { 78 {
79 » » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 79 » » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false))
80 { 80 {
81 if (pFormFiller->IsValid()) 81 if (pFormFiller->IsValid())
82 { 82 {
83 pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); 83 pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags);
84 pAnnot->GetPDFPage(); 84 pAnnot->GetPDFPage();
85 85
86 CPDFSDK_Document* pDocument = m_pApp->GetSDKDocu ment(); 86 CPDFSDK_Document* pDocument = m_pApp->GetSDKDocu ment();
87 if (pDocument->GetFocusAnnot() == pAnnot) 87 if (pDocument->GetFocusAnnot() == pAnnot)
88 { 88 {
89 CPDF_Rect rcFocus = pFormFiller->GetFocu sBox(pPageView); 89 CPDF_Rect rcFocus = pFormFiller->GetFocu sBox(pPageView);
(...skipping 12 matching lines...) Expand all
102 gsd.m_DashArray[0] = 1.0f; 102 gsd.m_DashArray[0] = 1.0f;
103 gsd.m_DashPhase = 0; 103 gsd.m_DashPhase = 0;
104 gsd.m_LineWidth = 1.0f; 104 gsd.m_LineWidth = 1.0f;
105 pDevice->DrawPath(&path, pUser2D evice, &gsd, 0, ArgbEncode(255,0,0,0), FXFILL_ALTERNATE); 105 pDevice->DrawPath(&path, pUser2D evice, &gsd, 0, ArgbEncode(255,0,0,0), FXFILL_ALTERNATE);
106 } 106 }
107 } 107 }
108 return; 108 return;
109 } 109 }
110 } 110 }
111 111
112 » » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 112 » » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false))
113 pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); 113 pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, pUser2Device, dwFlags);
114 else 114 else
115 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Anno t::Normal, NULL); 115 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Anno t::Normal, NULL);
116 116
117 if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget)) 117 if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget))
118 pWidget->DrawShadow(pDevice, pPageView); 118 pWidget->DrawShadow(pDevice, pPageView);
119 } 119 }
120 } 120 }
121 121
122 void CFFL_IFormFiller::OnCreate(CPDFSDK_Annot* pAnnot) 122 void CFFL_IFormFiller::OnCreate(CPDFSDK_Annot* pAnnot)
123 { 123 {
124 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 124 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false))
125 { 125 {
126 pFormFiller->OnCreate(pAnnot); 126 pFormFiller->OnCreate(pAnnot);
127 } 127 }
128 } 128 }
129 129
130 void CFFL_IFormFiller::OnLoad(CPDFSDK_Annot* pAnnot) 130 void CFFL_IFormFiller::OnLoad(CPDFSDK_Annot* pAnnot)
131 { 131 {
132 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 132 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false))
133 { 133 {
134 pFormFiller->OnLoad(pAnnot); 134 pFormFiller->OnLoad(pAnnot);
135 } 135 }
136 } 136 }
137 137
138 void CFFL_IFormFiller::OnDelete(CPDFSDK_Annot* pAnnot) 138 void CFFL_IFormFiller::OnDelete(CPDFSDK_Annot* pAnnot)
139 { 139 {
140 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 140 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false))
141 { 141 {
142 pFormFiller->OnDelete(pAnnot); 142 pFormFiller->OnDelete(pAnnot);
143 } 143 }
144 144
145 UnRegisterFormFiller(pAnnot); 145 UnRegisterFormFiller(pAnnot);
146 } 146 }
147 147
148 void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlag) 148 void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlag)
149 { 149 {
150 ASSERT(pAnnot != NULL); 150 ASSERT(pAnnot != NULL);
151 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 151 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
152 152
153 if (!m_bNotifying) 153 if (!m_bNotifying)
154 { 154 {
155 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 155 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
156 if (pWidget->GetAAction(CPDF_AAction::CursorEnter)) 156 if (pWidget->GetAAction(CPDF_AAction::CursorEnter))
157 { 157 {
158 » » » m_bNotifying = TRUE; 158 » » » m_bNotifying = true;
159 159
160 int nValueAge = pWidget->GetValueAge(); 160 int nValueAge = pWidget->GetValueAge();
161 161
162 pWidget->ClearAppModified(); 162 pWidget->ClearAppModified();
163 163
164 ASSERT(pPageView != NULL); 164 ASSERT(pPageView != NULL);
165 165
166 166
167 167
168 PDFSDK_FieldAction fa; 168 PDFSDK_FieldAction fa;
169 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); 169 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
170 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); 170 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
171 pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageV iew ); 171 pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageV iew );
172 » » » m_bNotifying = FALSE; 172 » » » m_bNotifying = false;
173 173
174 //if ( !IsValidAnnot(pPageView, pAnnot) ) return; 174 //if ( !IsValidAnnot(pPageView, pAnnot) ) return;
175 175
176 if (pWidget->IsAppModified()) 176 if (pWidget->IsAppModified())
177 { 177 {
178 » » » » if (CFFL_FormFiller* pFormFiller = GetFormFiller (pWidget, FALSE)) 178 » » » » if (CFFL_FormFiller* pFormFiller = GetFormFiller (pWidget, false))
179 { 179 {
180 pFormFiller->ResetPDFWindow(pPageView, p Widget->GetValueAge() == nValueAge); 180 pFormFiller->ResetPDFWindow(pPageView, p Widget->GetValueAge() == nValueAge);
181 } 181 }
182 } 182 }
183 } 183 }
184 } 184 }
185 185
186 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) 186 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, true))
187 { 187 {
188 pFormFiller->OnMouseEnter(pPageView, pAnnot); 188 pFormFiller->OnMouseEnter(pPageView, pAnnot);
189 } 189 }
190 } 190 }
191 191
192 void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* p Annot, FX_UINT nFlag) 192 void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* p Annot, FX_UINT nFlag)
193 { 193 {
194 ASSERT(pAnnot != NULL); 194 ASSERT(pAnnot != NULL);
195 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 195 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
196 196
197 if (!m_bNotifying) 197 if (!m_bNotifying)
198 { 198 {
199 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 199 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
200 if (pWidget->GetAAction(CPDF_AAction::CursorExit)) 200 if (pWidget->GetAAction(CPDF_AAction::CursorExit))
201 { 201 {
202 » » » m_bNotifying = TRUE; 202 » » » m_bNotifying = true;
203 pWidget->GetAppearanceAge(); 203 pWidget->GetAppearanceAge();
204 int nValueAge = pWidget->GetValueAge(); 204 int nValueAge = pWidget->GetValueAge();
205 pWidget->ClearAppModified(); 205 pWidget->ClearAppModified();
206 206
207 ASSERT(pPageView != NULL); 207 ASSERT(pPageView != NULL);
208 208
209 209
210 210
211 PDFSDK_FieldAction fa; 211 PDFSDK_FieldAction fa;
212 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); 212 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
213 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); 213 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
214 214
215 pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageVi ew); 215 pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageVi ew);
216 » » » m_bNotifying = FALSE; 216 » » » m_bNotifying = false;
217 217
218 //if (!IsValidAnnot(pPageView, pAnnot)) return; 218 //if (!IsValidAnnot(pPageView, pAnnot)) return;
219 219
220 if (pWidget->IsAppModified()) 220 if (pWidget->IsAppModified())
221 { 221 {
222 » » » » if (CFFL_FormFiller* pFormFiller = GetFormFiller (pWidget, FALSE)) 222 » » » » if (CFFL_FormFiller* pFormFiller = GetFormFiller (pWidget, false))
223 { 223 {
224 pFormFiller->ResetPDFWindow(pPageView, n ValueAge == pWidget->GetValueAge()); 224 pFormFiller->ResetPDFWindow(pPageView, n ValueAge == pWidget->GetValueAge());
225 } 225 }
226 } 226 }
227 } 227 }
228 } 228 }
229 229
230 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 230 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false))
231 { 231 {
232 pFormFiller->OnMouseExit(pPageView, pAnnot); 232 pFormFiller->OnMouseExit(pPageView, pAnnot);
233 } 233 }
234 } 234 }
235 235
236 FX_BOOL»CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Ann ot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) 236 bool» CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Ann ot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
237 { 237 {
238 ASSERT(pAnnot != NULL); 238 ASSERT(pAnnot != NULL);
239 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 239 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
240 240
241 if (!m_bNotifying) 241 if (!m_bNotifying)
242 { 242 {
243 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 243 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
244 if (Annot_HitTest(pPageView, pAnnot, point) && pWidget->GetAActi on(CPDF_AAction::ButtonDown)) 244 if (Annot_HitTest(pPageView, pAnnot, point) && pWidget->GetAActi on(CPDF_AAction::ButtonDown))
245 { 245 {
246 » » » m_bNotifying = TRUE; 246 » » » m_bNotifying = true;
247 pWidget->GetAppearanceAge(); 247 pWidget->GetAppearanceAge();
248 int nValueAge = pWidget->GetValueAge(); 248 int nValueAge = pWidget->GetValueAge();
249 pWidget->ClearAppModified(); 249 pWidget->ClearAppModified();
250 250
251 ASSERT(pPageView != NULL); 251 ASSERT(pPageView != NULL);
252 252
253 253
254 254
255 PDFSDK_FieldAction fa; 255 PDFSDK_FieldAction fa;
256 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlags); 256 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlags);
257 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlags); 257 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlags);
258 pWidget->OnAAction(CPDF_AAction::ButtonDown, fa, pPageVi ew); 258 pWidget->OnAAction(CPDF_AAction::ButtonDown, fa, pPageVi ew);
259 » » » m_bNotifying = FALSE; 259 » » » m_bNotifying = false;
260 260
261 » » » if (!IsValidAnnot(pPageView, pAnnot)) return TRUE; 261 » » » if (!IsValidAnnot(pPageView, pAnnot)) return true;
262 262
263 if (pWidget->IsAppModified()) 263 if (pWidget->IsAppModified())
264 { 264 {
265 » » » » if (CFFL_FormFiller* pFormFiller = GetFormFiller (pWidget, FALSE)) 265 » » » » if (CFFL_FormFiller* pFormFiller = GetFormFiller (pWidget, false))
266 { 266 {
267 pFormFiller->ResetPDFWindow(pPageView, n ValueAge == pWidget->GetValueAge()); 267 pFormFiller->ResetPDFWindow(pPageView, n ValueAge == pWidget->GetValueAge());
268 } 268 }
269 } 269 }
270 } 270 }
271 } 271 }
272 272
273 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 273 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false))
274 { 274 {
275 return pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, poi nt); 275 return pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, poi nt);
276 } 276 }
277 277
278 » return FALSE; 278 » return false;
279 } 279 }
280 280
281 FX_BOOL»CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot * pAnnot, FX_UINT nFlags, const CPDF_Point& point) 281 bool» CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot * pAnnot, FX_UINT nFlags, const CPDF_Point& point)
282 { 282 {
283 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 283 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
284 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 284 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
285 CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument(); 285 CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument();
286 286
287 switch (pWidget->GetFieldType()) 287 switch (pWidget->GetFieldType())
288 { 288 {
289 case FIELDTYPE_PUSHBUTTON: 289 case FIELDTYPE_PUSHBUTTON:
290 case FIELDTYPE_CHECKBOX: 290 case FIELDTYPE_CHECKBOX:
291 case FIELDTYPE_RADIOBUTTON: 291 case FIELDTYPE_RADIOBUTTON:
292 if (GetViewBBox(pPageView, pAnnot).Contains((int)point.x, (int)p oint.y)) 292 if (GetViewBBox(pPageView, pAnnot).Contains((int)point.x, (int)p oint.y))
293 pDocument->SetFocusAnnot(pAnnot); 293 pDocument->SetFocusAnnot(pAnnot);
294 break; 294 break;
295 default: 295 default:
296 pDocument->SetFocusAnnot(pAnnot); 296 pDocument->SetFocusAnnot(pAnnot);
297 break; 297 break;
298 } 298 }
299 299
300 » FX_BOOL bRet = FALSE; 300 » bool bRet = false;
301 301
302 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 302 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false))
303 { 303 {
304 bRet = pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point ); 304 bRet = pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point );
305 } 305 }
306 306
307 if (pDocument->GetFocusAnnot() == pAnnot) 307 if (pDocument->GetFocusAnnot() == pAnnot)
308 { 308 {
309 » » FX_BOOL bExit = FALSE; 309 » » bool bExit = false;
310 » » FX_BOOL bReset = FALSE; 310 » » bool bReset = false;
311 OnButtonUp(pWidget, pPageView, bReset, bExit,nFlags); 311 OnButtonUp(pWidget, pPageView, bReset, bExit,nFlags);
312 » » if (bExit) return TRUE; 312 » » if (bExit) return true;
313 } 313 }
314 return bRet; 314 return bRet;
315 } 315 }
316 316
317 void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPa geView, FX_BOOL& bReset, FX_BOOL& bExit,FX_UINT nFlag) 317 void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPa geView, bool& bReset, bool& bExit,FX_UINT nFlag)
318 { 318 {
319 ASSERT(pWidget != NULL); 319 ASSERT(pWidget != NULL);
320 320
321 if (!m_bNotifying) 321 if (!m_bNotifying)
322 { 322 {
323 if (pWidget->GetAAction(CPDF_AAction::ButtonUp)) 323 if (pWidget->GetAAction(CPDF_AAction::ButtonUp))
324 { 324 {
325 » » » m_bNotifying = TRUE; 325 » » » m_bNotifying = true;
326 int nAge = pWidget->GetAppearanceAge(); 326 int nAge = pWidget->GetAppearanceAge();
327 int nValueAge = pWidget->GetValueAge(); 327 int nValueAge = pWidget->GetValueAge();
328 328
329 ASSERT(pPageView != NULL); 329 ASSERT(pPageView != NULL);
330 // CReader_DocView* pDocView = pPageView->GetDocView(); 330 // CReader_DocView* pDocView = pPageView->GetDocView();
331 // ASSERT(pDocView != NULL); 331 // ASSERT(pDocView != NULL);
332 332
333 333
334 334
335 PDFSDK_FieldAction fa; 335 PDFSDK_FieldAction fa;
336 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); 336 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
337 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); 337 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
338 338
339 pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView ); 339 pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView );
340 » » » m_bNotifying = FALSE; 340 » » » m_bNotifying = false;
341 341
342 if (!IsValidAnnot(pPageView, pWidget)) 342 if (!IsValidAnnot(pPageView, pWidget))
343 { 343 {
344 » » » » bExit = TRUE; 344 » » » » bExit = true;
345 return; 345 return;
346 } 346 }
347 347
348 if (nAge != pWidget->GetAppearanceAge()) 348 if (nAge != pWidget->GetAppearanceAge())
349 { 349 {
350 » » » » if (CFFL_FormFiller* pFormFiller = GetFormFiller (pWidget, FALSE)) 350 » » » » if (CFFL_FormFiller* pFormFiller = GetFormFiller (pWidget, false))
351 { 351 {
352 pFormFiller->ResetPDFWindow(pPageView, n ValueAge == pWidget->GetValueAge()); 352 pFormFiller->ResetPDFWindow(pPageView, n ValueAge == pWidget->GetValueAge());
353 } 353 }
354 354
355 » » » » bReset = TRUE; 355 » » » » bReset = true;
356 } 356 }
357 } 357 }
358 } 358 }
359 } 359 }
360 360
361 FX_BOOL»CFFL_IFormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_A nnot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) 361 bool» CFFL_IFormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_A nnot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
362 { 362 {
363 ASSERT(pAnnot != NULL); 363 ASSERT(pAnnot != NULL);
364 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 364 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
365 365
366 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 366 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false))
367 { 367 {
368 return pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, p oint); 368 return pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, p oint);
369 } 369 }
370 370
371 » return FALSE; 371 » return false;
372 } 372 }
373 373
374 FX_BOOL»CFFL_IFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot * pAnnot, FX_UINT nFlags, const CPDF_Point& point) 374 bool» CFFL_IFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot * pAnnot, FX_UINT nFlags, const CPDF_Point& point)
375 { 375 {
376 ASSERT(pAnnot != NULL); 376 ASSERT(pAnnot != NULL);
377 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 377 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
378 378
379 //change cursor 379 //change cursor
380 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) 380 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, true))
381 { 381 {
382 return pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point ); 382 return pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point );
383 } 383 }
384 384
385 » return FALSE; 385 » return false;
386 } 386 }
387 387
388 FX_BOOL»CFFL_IFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Anno t* pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point) 388 bool» CFFL_IFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Anno t* pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point)
389 { 389 {
390 ASSERT(pAnnot != NULL); 390 ASSERT(pAnnot != NULL);
391 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 391 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
392 392
393 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 393 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false))
394 { 394 {
395 return pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDel ta, point); 395 return pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDel ta, point);
396 } 396 }
397 397
398 » return FALSE; 398 » return false;
399 } 399 }
400 400
401 FX_BOOL»CFFL_IFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Ann ot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) 401 bool» CFFL_IFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Ann ot* pAnnot, FX_UINT nFlags, const CPDF_Point& point)
402 { 402 {
403 ASSERT(pAnnot != NULL); 403 ASSERT(pAnnot != NULL);
404 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 404 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
405 405
406 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 406 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false))
407 { 407 {
408 return pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, poi nt); 408 return pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, poi nt);
409 } 409 }
410 410
411 » return FALSE; 411 » return false;
412 } 412 }
413 413
414 FX_BOOL»CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot * pAnnot, FX_UINT nFlags, const CPDF_Point& point) 414 bool» CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot * pAnnot, FX_UINT nFlags, const CPDF_Point& point)
415 { 415 {
416 ASSERT(pAnnot != NULL); 416 ASSERT(pAnnot != NULL);
417 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 417 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
418 418
419 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 419 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false))
420 { 420 {
421 return pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point ); 421 return pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point );
422 } 422 }
423 423
424 » return FALSE; 424 » return false;
425 } 425 }
426 426
427 FX_BOOL»CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_ UINT nFlags) 427 bool» CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_ UINT nFlags)
428 { 428 {
429 ASSERT(pAnnot != NULL); 429 ASSERT(pAnnot != NULL);
430 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 430 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
431 431
432 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 432 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false))
433 { 433 {
434 return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags); 434 return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags);
435 } 435 }
436 436
437 » return FALSE; 437 » return false;
438 } 438 }
439 439
440 FX_BOOL»CFFL_IFormFiller::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT n Flags) 440 bool» CFFL_IFormFiller::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT n Flags)
441 { 441 {
442 ASSERT(pAnnot != NULL); 442 ASSERT(pAnnot != NULL);
443 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 443 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
444 444
445 » if (nChar == FWL_VKEY_Tab) return TRUE; 445 » if (nChar == FWL_VKEY_Tab) return true;
446 446
447 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 447 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false))
448 { 448 {
449 return pFormFiller->OnChar(pAnnot, nChar, nFlags); 449 return pFormFiller->OnChar(pAnnot, nChar, nFlags);
450 } 450 }
451 451
452 » return FALSE; 452 » return false;
453 } 453 }
454 454
455 FX_BOOL CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) 455 bool CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag)
456 { 456 {
457 » if(!pAnnot) return FALSE; 457 » if(!pAnnot) return false;
458 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 458 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
459 459
460 if (!m_bNotifying) 460 if (!m_bNotifying)
461 { 461 {
462 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 462 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
463 if (pWidget->GetAAction(CPDF_AAction::GetFocus)) 463 if (pWidget->GetAAction(CPDF_AAction::GetFocus))
464 { 464 {
465 » » » m_bNotifying = TRUE; 465 » » » m_bNotifying = true;
466 pWidget->GetAppearanceAge(); 466 pWidget->GetAppearanceAge();
467 int nValueAge = pWidget->GetValueAge(); 467 int nValueAge = pWidget->GetValueAge();
468 pWidget->ClearAppModified(); 468 pWidget->ClearAppModified();
469 469
470 470
471 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); 471 CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
472 ASSERT(pPageView != NULL); 472 ASSERT(pPageView != NULL);
473 473
474 PDFSDK_FieldAction fa; 474 PDFSDK_FieldAction fa;
475 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); 475 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
476 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); 476 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
477 477
478 478
479 » » » CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, TR UE); 479 » » » CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, tr ue);
480 » » » if(!pFormFiller) return FALSE; 480 » » » if(!pFormFiller) return false;
481 pFormFiller->GetActionData(pPageView, CPDF_AAction::GetF ocus, fa); 481 pFormFiller->GetActionData(pPageView, CPDF_AAction::GetF ocus, fa);
482 482
483 pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView ); 483 pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView );
484 » » » m_bNotifying = FALSE; 484 » » » m_bNotifying = false;
485 485
486 //» » » if (!IsValidAnnot(m_pApp, pDocument, pDocView, pPageView , pAnnot)) return FALSE; 486 //» » » if (!IsValidAnnot(m_pApp, pDocument, pDocView, pPageView , pAnnot)) return false;
487 487
488 if (pWidget->IsAppModified()) 488 if (pWidget->IsAppModified())
489 { 489 {
490 » » » » if (CFFL_FormFiller* pFormFiller = GetFormFiller (pWidget, FALSE)) 490 » » » » if (CFFL_FormFiller* pFormFiller = GetFormFiller (pWidget, false))
491 { 491 {
492 pFormFiller->ResetPDFWindow(pPageView, n ValueAge == pWidget->GetValueAge()); 492 pFormFiller->ResetPDFWindow(pPageView, n ValueAge == pWidget->GetValueAge());
493 } 493 }
494 } 494 }
495 } 495 }
496 } 496 }
497 497
498 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) 498 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, true))
499 { 499 {
500 if (pFormFiller->OnSetFocus(pAnnot, nFlag)) 500 if (pFormFiller->OnSetFocus(pAnnot, nFlag))
501 { 501 {
502 » » » return TRUE; 502 » » » return true;
503 } 503 }
504 else 504 else
505 » » » return FALSE; 505 » » » return false;
506 } 506 }
507 507
508 » return TRUE; 508 » return true;
509 } 509 }
510 510
511 FX_BOOL»CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) 511 bool» CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag)
512 { 512 {
513 » if(!pAnnot) return FALSE; 513 » if(!pAnnot) return false;
514 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); 514 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
515 515
516 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) 516 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false))
517 { 517 {
518 if (pFormFiller->OnKillFocus(pAnnot, nFlag)) 518 if (pFormFiller->OnKillFocus(pAnnot, nFlag))
519 { 519 {
520 if (!m_bNotifying) 520 if (!m_bNotifying)
521 { 521 {
522 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnno t; 522 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnno t;
523 if (pWidget->GetAAction(CPDF_AAction::LoseFocus) ) 523 if (pWidget->GetAAction(CPDF_AAction::LoseFocus) )
524 { 524 {
525 » » » » » m_bNotifying = TRUE; 525 » » » » » m_bNotifying = true;
526 pWidget->ClearAppModified(); 526 pWidget->ClearAppModified();
527 527
528 CPDFSDK_PageView* pPageView = pWidget->G etPageView(); 528 CPDFSDK_PageView* pPageView = pWidget->G etPageView();
529 ASSERT(pPageView != NULL); 529 ASSERT(pPageView != NULL);
530 530
531 PDFSDK_FieldAction fa; 531 PDFSDK_FieldAction fa;
532 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown (nFlag); 532 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown (nFlag);
533 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(n Flag); 533 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(n Flag);
534 534
535 pFormFiller->GetActionData(pPageView, CP DF_AAction::LoseFocus, fa); 535 pFormFiller->GetActionData(pPageView, CP DF_AAction::LoseFocus, fa);
536 536
537 pWidget->OnAAction(CPDF_AAction::LoseFoc us, fa, pPageView); 537 pWidget->OnAAction(CPDF_AAction::LoseFoc us, fa, pPageView);
538 » » » » » m_bNotifying = FALSE; 538 » » » » » m_bNotifying = false;
539 539
540 } 540 }
541 } 541 }
542 } 542 }
543 else 543 else
544 » » » return FALSE; 544 » » » return false;
545 } 545 }
546 546
547 » return TRUE; 547 » return true;
548 } 548 }
549 549
550 FX_BOOL»CFFL_IFormFiller::IsVisible(CPDFSDK_Widget* pWidget) 550 bool» CFFL_IFormFiller::IsVisible(CPDFSDK_Widget* pWidget)
551 { 551 {
552 return pWidget->IsVisible(); 552 return pWidget->IsVisible();
553 } 553 }
554 554
555 FX_BOOL»CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) 555 bool» CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget)
556 { 556 {
557 ASSERT(pWidget != NULL); 557 ASSERT(pWidget != NULL);
558 558
559 int nFieldFlags = pWidget->GetFieldFlags(); 559 int nFieldFlags = pWidget->GetFieldFlags();
560 560
561 return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY; 561 return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY;
562 } 562 }
563 563
564 FX_BOOL»CFFL_IFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) 564 bool» CFFL_IFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget)
565 { 565 {
566 ASSERT(pWidget != NULL); 566 ASSERT(pWidget != NULL);
567 567
568 if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) 568 if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON)
569 » » return TRUE; 569 » » return true;
570 else 570 else
571 { 571 {
572 CPDF_Page* pPage = pWidget->GetPDFPage(); 572 CPDF_Page* pPage = pWidget->GetPDFPage();
573 ASSERT(pPage != NULL); 573 ASSERT(pPage != NULL);
574 574
575 CPDF_Document* pDocument = pPage->m_pDocument; 575 CPDF_Document* pDocument = pPage->m_pDocument;
576 ASSERT(pDocument != NULL); 576 ASSERT(pDocument != NULL);
577 577
578 FX_DWORD dwPermissions = pDocument->GetUserPermissions(); 578 FX_DWORD dwPermissions = pDocument->GetUserPermissions();
579 return (dwPermissions&FPDFPERM_FILL_FORM) || 579 return (dwPermissions&FPDFPERM_FILL_FORM) ||
580 (dwPermissions&FPDFPERM_ANNOT_FORM) || 580 (dwPermissions&FPDFPERM_ANNOT_FORM) ||
581 (dwPermissions&FPDFPERM_MODIFY); 581 (dwPermissions&FPDFPERM_MODIFY);
582 } 582 }
583 » return TRUE; 583 » return true;
584 } 584 }
585 585
586 CFFL_FormFiller* CFFL_IFormFiller::GetFormFiller(CPDFSDK_Annot* pAnnot, FX_BOOL bRegister) 586 CFFL_FormFiller* CFFL_IFormFiller::GetFormFiller(CPDFSDK_Annot* pAnnot, bool bRe gister)
587 { 587 {
588 auto it = m_Maps.find(pAnnot); 588 auto it = m_Maps.find(pAnnot);
589 if (it != m_Maps.end()) 589 if (it != m_Maps.end())
590 return it->second; 590 return it->second;
591 591
592 if (!bRegister) 592 if (!bRegister)
593 return nullptr; 593 return nullptr;
594 594
595 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 595 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
596 int nFieldType = pWidget->GetFieldType(); 596 int nFieldType = pWidget->GetFieldType();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 fTop = rcAnnot.bottom - rcPageView.bottom; 682 fTop = rcAnnot.bottom - rcPageView.bottom;
683 fBottom = rcPageView.top - rcAnnot.top; 683 fBottom = rcPageView.top - rcAnnot.top;
684 break; 684 break;
685 case 3: 685 case 3:
686 fTop = rcPageView.right - rcAnnot.right; 686 fTop = rcPageView.right - rcAnnot.right;
687 fBottom = rcAnnot.left - rcPageView.left; 687 fBottom = rcAnnot.left - rcPageView.left;
688 break; 688 break;
689 } 689 }
690 690
691 FX_FLOAT fFactHeight = 0; 691 FX_FLOAT fFactHeight = 0;
692 » FX_BOOL bBottom = TRUE; 692 » bool bBottom = true;
693 FX_FLOAT fMaxListBoxHeight = 0; 693 FX_FLOAT fMaxListBoxHeight = 0;
694 if (fPopupMax > FFL_MAXLISTBOXHEIGHT) 694 if (fPopupMax > FFL_MAXLISTBOXHEIGHT)
695 { 695 {
696 if (fPopupMin > FFL_MAXLISTBOXHEIGHT) 696 if (fPopupMin > FFL_MAXLISTBOXHEIGHT)
697 { 697 {
698 fMaxListBoxHeight = fPopupMin; 698 fMaxListBoxHeight = fPopupMin;
699 } 699 }
700 else 700 else
701 { 701 {
702 fMaxListBoxHeight = FFL_MAXLISTBOXHEIGHT; 702 fMaxListBoxHeight = FFL_MAXLISTBOXHEIGHT;
703 } 703 }
704 } 704 }
705 else 705 else
706 fMaxListBoxHeight = fPopupMax; 706 fMaxListBoxHeight = fPopupMax;
707 707
708 if (fBottom > fMaxListBoxHeight) 708 if (fBottom > fMaxListBoxHeight)
709 { 709 {
710 fFactHeight = fMaxListBoxHeight; 710 fFactHeight = fMaxListBoxHeight;
711 » » bBottom = TRUE; 711 » » bBottom = true;
712 } 712 }
713 else 713 else
714 { 714 {
715 if (fTop > fMaxListBoxHeight) 715 if (fTop > fMaxListBoxHeight)
716 { 716 {
717 fFactHeight = fMaxListBoxHeight; 717 fFactHeight = fMaxListBoxHeight;
718 » » » bBottom = FALSE; 718 » » » bBottom = false;
719 } 719 }
720 else 720 else
721 { 721 {
722 if (fTop > fBottom) 722 if (fTop > fBottom)
723 { 723 {
724 fFactHeight = fTop; 724 fFactHeight = fTop;
725 » » » » bBottom = FALSE; 725 » » » » bBottom = false;
726 } 726 }
727 else 727 else
728 { 728 {
729 fFactHeight = fBottom; 729 fFactHeight = fBottom;
730 » » » » bBottom = TRUE; 730 » » » » bBottom = true;
731 } 731 }
732 } 732 }
733 } 733 }
734 734
735 nRet = bBottom ? 0 : 1; 735 nRet = bBottom ? 0 : 1;
736 fPopupRet = fFactHeight; 736 fPopupRet = fFactHeight;
737 } 737 }
738 738
739 void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, CPDFSDK_PageVi ew* pPageView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag) 739 void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, CPDFSDK_PageVi ew* pPageView, bool& bRC, bool& bExit, FX_DWORD nFlag)
740 { 740 {
741 if (!m_bNotifying) 741 if (!m_bNotifying)
742 { 742 {
743 ASSERT(pWidget != NULL); 743 ASSERT(pWidget != NULL);
744 if (pWidget->GetAAction(CPDF_AAction::KeyStroke)) 744 if (pWidget->GetAAction(CPDF_AAction::KeyStroke))
745 { 745 {
746 » » » m_bNotifying = TRUE; 746 » » » m_bNotifying = true;
747 pWidget->ClearAppModified(); 747 pWidget->ClearAppModified();
748 748
749 ASSERT(pPageView != NULL); 749 ASSERT(pPageView != NULL);
750 750
751 PDFSDK_FieldAction fa; 751 PDFSDK_FieldAction fa;
752 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); 752 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
753 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); 753 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
754 » » » fa.bWillCommit = TRUE; 754 » » » fa.bWillCommit = true;
755 » » » fa.bKeyDown = TRUE; 755 » » » fa.bKeyDown = true;
756 » » » fa.bRC = TRUE; 756 » » » fa.bRC = true;
757 757
758 » » » CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FA LSE); 758 » » » CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, fa lse);
759 ASSERT(pFormFiller != NULL); 759 ASSERT(pFormFiller != NULL);
760 760
761 pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyS troke, fa); 761 pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyS troke, fa);
762 pFormFiller->SaveState(pPageView); 762 pFormFiller->SaveState(pPageView);
763 763
764 PDFSDK_FieldAction faOld = fa; 764 PDFSDK_FieldAction faOld = fa;
765 pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageVie w); 765 pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageVie w);
766 766
767 bRC = fa.bRC; 767 bRC = fa.bRC;
768 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPage View, pWidget); 768 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPage View, pWidget);
769 769
770 » » » m_bNotifying = FALSE; 770 » » » m_bNotifying = false;
771 } 771 }
772 } 772 }
773 } 773 }
774 774
775 void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPa geView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag) 775 void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPa geView, bool& bRC, bool& bExit, FX_DWORD nFlag)
776 { 776 {
777 if (!m_bNotifying) 777 if (!m_bNotifying)
778 { 778 {
779 ASSERT(pWidget != NULL); 779 ASSERT(pWidget != NULL);
780 if (pWidget->GetAAction(CPDF_AAction::Validate)) 780 if (pWidget->GetAAction(CPDF_AAction::Validate))
781 { 781 {
782 » » » m_bNotifying = TRUE; 782 » » » m_bNotifying = true;
783 pWidget->ClearAppModified(); 783 pWidget->ClearAppModified();
784 784
785 ASSERT(pPageView != NULL); 785 ASSERT(pPageView != NULL);
786 // CReader_DocView* pDocView = pPageView->GetDocView(); 786 // CReader_DocView* pDocView = pPageView->GetDocView();
787 // ASSERT(pDocView != NULL); 787 // ASSERT(pDocView != NULL);
788 788
789 789
790 790
791 PDFSDK_FieldAction fa; 791 PDFSDK_FieldAction fa;
792 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); 792 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
793 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); 793 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
794 » » » fa.bKeyDown = TRUE; 794 » » » fa.bKeyDown = true;
795 » » » fa.bRC = TRUE; 795 » » » fa.bRC = true;
796 796
797 » » » CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FA LSE); 797 » » » CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, fa lse);
798 ASSERT(pFormFiller != NULL); 798 ASSERT(pFormFiller != NULL);
799 799
800 pFormFiller->GetActionData(pPageView, CPDF_AAction::Vali date, fa); 800 pFormFiller->GetActionData(pPageView, CPDF_AAction::Vali date, fa);
801 pFormFiller->SaveState(pPageView); 801 pFormFiller->SaveState(pPageView);
802 802
803 PDFSDK_FieldAction faOld = fa; 803 PDFSDK_FieldAction faOld = fa;
804 pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView ); 804 pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView );
805 805
806 bRC = fa.bRC; 806 bRC = fa.bRC;
807 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPage View, pWidget); 807 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPage View, pWidget);
808 808
809 » » » m_bNotifying = FALSE; 809 » » » m_bNotifying = false;
810 } 810 }
811 } 811 }
812 } 812 }
813 813
814 void CFFL_IFormFiller::OnCalculate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pP ageView, FX_BOOL& bExit, FX_DWORD nFlag) 814 void CFFL_IFormFiller::OnCalculate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pP ageView, bool& bExit, FX_DWORD nFlag)
815 { 815 {
816 if (!m_bNotifying) 816 if (!m_bNotifying)
817 { 817 {
818 ASSERT(pWidget != NULL); 818 ASSERT(pWidget != NULL);
819 ASSERT(pPageView != NULL); 819 ASSERT(pPageView != NULL);
820 // CReader_DocView* pDocView = pPageView->GetDocView(); 820 // CReader_DocView* pDocView = pPageView->GetDocView();
821 // ASSERT(pDocView != NULL); 821 // ASSERT(pDocView != NULL);
822 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); 822 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument();
823 ASSERT(pDocument != NULL); 823 ASSERT(pDocument != NULL);
824 824
825 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->G etInterForm(); 825 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->G etInterForm();
826 ASSERT(pInterForm != NULL); 826 ASSERT(pInterForm != NULL);
827 827
828 pInterForm->OnCalculate(pWidget->GetFormField()); 828 pInterForm->OnCalculate(pWidget->GetFormField());
829 829
830 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pW idget); 830 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pW idget);
831 831
832 » » m_bNotifying = FALSE; 832 » » m_bNotifying = false;
833 } 833 }
834 } 834 }
835 835
836 void CFFL_IFormFiller::OnFormat(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPage View, FX_BOOL& bExit, FX_DWORD nFlag) 836 void CFFL_IFormFiller::OnFormat(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPage View, bool& bExit, FX_DWORD nFlag)
837 { 837 {
838 if (!m_bNotifying) 838 if (!m_bNotifying)
839 { 839 {
840 ASSERT(pWidget != NULL); 840 ASSERT(pWidget != NULL);
841 ASSERT(pPageView != NULL); 841 ASSERT(pPageView != NULL);
842 // CReader_DocView* pDocView = pPageView->GetDocView(); 842 // CReader_DocView* pDocView = pPageView->GetDocView();
843 // ASSERT(pDocView != NULL); 843 // ASSERT(pDocView != NULL);
844 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); 844 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument();
845 ASSERT(pDocument != NULL); 845 ASSERT(pDocument != NULL);
846 846
847 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->G etInterForm(); 847 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->G etInterForm();
848 ASSERT(pInterForm != NULL); 848 ASSERT(pInterForm != NULL);
849 849
850 » » FX_BOOL bFormated = FALSE; 850 » » bool bFormated = false;
851 CFX_WideString sValue = pInterForm->OnFormat(pWidget->GetFormFie ld(), bFormated); 851 CFX_WideString sValue = pInterForm->OnFormat(pWidget->GetFormFie ld(), bFormated);
852 852
853 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pW idget); 853 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pW idget);
854 854
855 if (bExit) return; 855 if (bExit) return;
856 856
857 if (bFormated) 857 if (bFormated)
858 { 858 {
859 » » » pInterForm->ResetFieldAppearance(pWidget->GetFormField() , sValue.c_str(), TRUE); 859 » » » pInterForm->ResetFieldAppearance(pWidget->GetFormField() , sValue.c_str(), true);
860 pInterForm->UpdateField(pWidget->GetFormField()); 860 pInterForm->UpdateField(pWidget->GetFormField());
861 } 861 }
862 862
863 » » m_bNotifying = FALSE; 863 » » m_bNotifying = false;
864 } 864 }
865 } 865 }
866 866
867 FX_BOOL»CFFL_IFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView, CPDFSDK_Anno t* pAnnot) 867 bool» CFFL_IFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView, CPDFSDK_Anno t* pAnnot)
868 { 868 {
869 869
870 ASSERT(pPageView != NULL); 870 ASSERT(pPageView != NULL);
871 ASSERT(pAnnot != NULL); 871 ASSERT(pAnnot != NULL);
872 872
873 if(pPageView) 873 if(pPageView)
874 return pPageView->IsValidAnnot(pAnnot->GetPDFAnnot()); 874 return pPageView->IsValidAnnot(pAnnot->GetPDFAnnot());
875 else 875 else
876 » » return FALSE; 876 » » return false;
877 } 877 }
878 878
879 void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData , int32_t nKeyCode, 879 void CFFL_IFormFiller::OnBeforeKeyStroke(bool bEditOrList, void* pPrivateData, i nt32_t nKeyCode,
880 CFX_WideString & strChange, const CFX_WideString& strChangeEx, 880 CFX_WideString & strChange, const CFX_WideString& strChangeEx,
881 int nSelStart, int nSelEnd, 881 int nSelStart, int nSelEnd,
882 » » » » » » » » » » FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit, FX_DWORD nFlag) 882 » » » » » » » » » » bool bKeyDown, bool & bRC, bool & bExit, FX_DWORD nFlag)
883 { 883 {
884 ASSERT(pPrivateData != NULL); 884 ASSERT(pPrivateData != NULL);
885 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; 885 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
886 ASSERT(pData->pWidget != NULL); 886 ASSERT(pData->pWidget != NULL);
887 887
888 » CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); 888 » CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, false);
889 ASSERT(pFormFiller != NULL); 889 ASSERT(pFormFiller != NULL);
890 890
891 if (!m_bNotifying) 891 if (!m_bNotifying)
892 { 892 {
893 if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke)) 893 if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke))
894 { 894 {
895 » » » m_bNotifying = TRUE; 895 » » » m_bNotifying = true;
896 int nAge = pData->pWidget->GetAppearanceAge(); 896 int nAge = pData->pWidget->GetAppearanceAge();
897 int nValueAge = pData->pWidget->GetValueAge(); 897 int nValueAge = pData->pWidget->GetValueAge();
898 898
899 ASSERT(pData->pPageView != NULL); 899 ASSERT(pData->pPageView != NULL);
900 CPDFSDK_Document* pDocument = pData->pPageView->GetSDKD ocument(); 900 CPDFSDK_Document* pDocument = pData->pPageView->GetSDKD ocument();
901 901
902 PDFSDK_FieldAction fa; 902 PDFSDK_FieldAction fa;
903 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); 903 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag);
904 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); 904 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag);
905 fa.sChange = strChange; 905 fa.sChange = strChange;
906 fa.sChangeEx = strChangeEx; 906 fa.sChangeEx = strChangeEx;
907 fa.bKeyDown = bKeyDown; 907 fa.bKeyDown = bKeyDown;
908 » » » fa.bWillCommit = FALSE; 908 » » » fa.bWillCommit = false;
909 » » » fa.bRC = TRUE; 909 » » » fa.bRC = true;
910 fa.nSelStart = nSelStart; 910 fa.nSelStart = nSelStart;
911 fa.nSelEnd = nSelEnd; 911 fa.nSelEnd = nSelEnd;
912 912
913 913
914 pFormFiller->GetActionData(pData->pPageView, CPDF_AActio n::KeyStroke, fa); 914 pFormFiller->GetActionData(pData->pPageView, CPDF_AActio n::KeyStroke, fa);
915 pFormFiller->SaveState(pData->pPageView); 915 pFormFiller->SaveState(pData->pPageView);
916 916
917 if (pData->pWidget->OnAAction(CPDF_AAction::KeyStroke, f a, pData->pPageView)) 917 if (pData->pWidget->OnAAction(CPDF_AAction::KeyStroke, f a, pData->pPageView))
918 { 918 {
919 if (!IsValidAnnot(pData->pPageView, pData->pWidg et)) 919 if (!IsValidAnnot(pData->pPageView, pData->pWidg et))
920 { 920 {
921 » » » » » bExit = TRUE; 921 » » » » » bExit = true;
922 » » » » » m_bNotifying = FALSE; 922 » » » » » m_bNotifying = false;
923 return; 923 return;
924 } 924 }
925 925
926 if (nAge != pData->pWidget->GetAppearanceAge()) 926 if (nAge != pData->pWidget->GetAppearanceAge())
927 { 927 {
928 CPWL_Wnd* pWnd = pFormFiller->ResetPDFWi ndow(pData->pPageView, nValueAge == pData->pWidget->GetValueAge()); 928 CPWL_Wnd* pWnd = pFormFiller->ResetPDFWi ndow(pData->pPageView, nValueAge == pData->pWidget->GetValueAge());
929 pData = (CFFL_PrivateData*)pWnd->GetAtta chedData(); 929 pData = (CFFL_PrivateData*)pWnd->GetAtta chedData();
930 » » » » » bExit = TRUE; 930 » » » » » bExit = true;
931 } 931 }
932 932
933 if (fa.bRC) 933 if (fa.bRC)
934 { 934 {
935 pFormFiller->SetActionData(pData->pPageV iew, CPDF_AAction::KeyStroke, fa); 935 pFormFiller->SetActionData(pData->pPageV iew, CPDF_AAction::KeyStroke, fa);
936 » » » » » bRC = FALSE; 936 » » » » » bRC = false;
937 } 937 }
938 else 938 else
939 { 939 {
940 pFormFiller->RestoreState(pData->pPageVi ew); 940 pFormFiller->RestoreState(pData->pPageVi ew);
941 » » » » » bRC = FALSE; 941 » » » » » bRC = false;
942 } 942 }
943 943
944 if (pDocument->GetFocusAnnot() != pData->pWidget ) 944 if (pDocument->GetFocusAnnot() != pData->pWidget )
945 { 945 {
946 pFormFiller->CommitData(pData->pPageView ,nFlag); 946 pFormFiller->CommitData(pData->pPageView ,nFlag);
947 » » » » » bExit = TRUE; 947 » » » » » bExit = true;
948 } 948 }
949 } 949 }
950 else 950 else
951 { 951 {
952 if (!IsValidAnnot(pData->pPageView, pData->pWidg et)) 952 if (!IsValidAnnot(pData->pPageView, pData->pWidg et))
953 { 953 {
954 » » » » » bExit = TRUE; 954 » » » » » bExit = true;
955 » » » » » m_bNotifying = FALSE; 955 » » » » » m_bNotifying = false;
956 return; 956 return;
957 } 957 }
958 } 958 }
959 959
960 » » » m_bNotifying = FALSE; 960 » » » m_bNotifying = false;
961 } 961 }
962 } 962 }
963 } 963 }
964 964
965 void» CFFL_IFormFiller::OnAfterKeyStroke(FX_BOOL bEditOrList, void* pPrivateDa ta, FX_BOOL & bExit,FX_DWORD nFlag) 965 void» CFFL_IFormFiller::OnAfterKeyStroke(bool bEditOrList, void* pPrivateData, bool & bExit,FX_DWORD nFlag)
966 { 966 {
967 ASSERT(pPrivateData != NULL); 967 ASSERT(pPrivateData != NULL);
968 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; 968 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
969 ASSERT(pData->pWidget != NULL); 969 ASSERT(pData->pWidget != NULL);
970 970
971 » CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); 971 » CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, false);
972 ASSERT(pFormFiller != NULL); 972 ASSERT(pFormFiller != NULL);
973 973
974 if (!bEditOrList) 974 if (!bEditOrList)
975 pFormFiller->OnKeyStroke(bExit); 975 pFormFiller->OnKeyStroke(bExit);
976 } 976 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/formfiller/FFL_FormFiller.cpp ('k') | fpdfsdk/src/formfiller/FFL_ListBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698