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

Side by Side Diff: fpdfsdk/src/fsdk_baseform.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/fsdk_baseannot.cpp ('k') | fpdfsdk/src/fsdk_mgr.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 "../../third_party/base/nonstd_unique_ptr.h" 7 #include "../../third_party/base/nonstd_unique_ptr.h"
8 #include "../include/fsdk_define.h" 8 #include "../include/fsdk_define.h"
9 #include "../include/fsdk_mgr.h" 9 #include "../include/fsdk_mgr.h"
10 #include "../include/fsdk_baseannot.h" 10 #include "../include/fsdk_baseannot.h"
(...skipping 19 matching lines...) Expand all
30 m_nValueAge(0) 30 m_nValueAge(0)
31 { 31 {
32 ASSERT(m_pInterForm != NULL); 32 ASSERT(m_pInterForm != NULL);
33 } 33 }
34 34
35 CPDFSDK_Widget::~CPDFSDK_Widget() 35 CPDFSDK_Widget::~CPDFSDK_Widget()
36 { 36 {
37 37
38 } 38 }
39 39
40 FX_BOOL»» CPDFSDK_Widget::IsWidgetAppearanceValid(CPDF_Annot::AppearanceMo de mode) 40 bool» » CPDFSDK_Widget::IsWidgetAppearanceValid(CPDF_Annot::AppearanceMo de mode)
41 { 41 {
42 CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP"); 42 CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP");
43 » if (pAP == NULL) return FALSE; 43 » if (pAP == NULL) return false;
44 44
45 // Choose the right sub-ap 45 // Choose the right sub-ap
46 const FX_CHAR* ap_entry = "N"; 46 const FX_CHAR* ap_entry = "N";
47 if (mode == CPDF_Annot::Down) 47 if (mode == CPDF_Annot::Down)
48 ap_entry = "D"; 48 ap_entry = "D";
49 else if (mode == CPDF_Annot::Rollover) 49 else if (mode == CPDF_Annot::Rollover)
50 ap_entry = "R"; 50 ap_entry = "R";
51 if (!pAP->KeyExist(ap_entry)) 51 if (!pAP->KeyExist(ap_entry))
52 ap_entry = "N"; 52 ap_entry = "N";
53 53
54 // Get the AP stream or subdirectory 54 // Get the AP stream or subdirectory
55 CPDF_Object* psub = pAP->GetElementValue(ap_entry); 55 CPDF_Object* psub = pAP->GetElementValue(ap_entry);
56 » if (psub == NULL) return FALSE; 56 » if (psub == NULL) return false;
57 57
58 int nFieldType = GetFieldType(); 58 int nFieldType = GetFieldType();
59 switch (nFieldType) 59 switch (nFieldType)
60 { 60 {
61 case FIELDTYPE_PUSHBUTTON: 61 case FIELDTYPE_PUSHBUTTON:
62 case FIELDTYPE_COMBOBOX: 62 case FIELDTYPE_COMBOBOX:
63 case FIELDTYPE_LISTBOX: 63 case FIELDTYPE_LISTBOX:
64 case FIELDTYPE_TEXTFIELD: 64 case FIELDTYPE_TEXTFIELD:
65 case FIELDTYPE_SIGNATURE: 65 case FIELDTYPE_SIGNATURE:
66 return psub->GetType() == PDFOBJ_STREAM; 66 return psub->GetType() == PDFOBJ_STREAM;
67 case FIELDTYPE_CHECKBOX: 67 case FIELDTYPE_CHECKBOX:
68 case FIELDTYPE_RADIOBUTTON: 68 case FIELDTYPE_RADIOBUTTON:
69 if (psub->GetType() == PDFOBJ_DICTIONARY) 69 if (psub->GetType() == PDFOBJ_DICTIONARY)
70 { 70 {
71 CPDF_Dictionary* pSubDict = (CPDF_Dictionary*)psub; 71 CPDF_Dictionary* pSubDict = (CPDF_Dictionary*)psub;
72 72
73 return pSubDict->GetStream(GetAppState()) != NULL; 73 return pSubDict->GetStream(GetAppState()) != NULL;
74 } 74 }
75 else 75 else
76 » » » return FALSE; 76 » » » return false;
77 break; 77 break;
78 } 78 }
79 79
80 » return TRUE; 80 » return true;
81 } 81 }
82 82
83 int CPDFSDK_Widget::GetFieldType() const 83 int CPDFSDK_Widget::GetFieldType() const
84 { 84 {
85 CPDF_FormField* pField = GetFormField(); 85 CPDF_FormField* pField = GetFormField();
86 ASSERT(pField != NULL); 86 ASSERT(pField != NULL);
87 87
88 return pField->GetFieldType(); 88 return pField->GetFieldType();
89 } 89 }
90 90
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 } 138 }
139 139
140 int CPDFSDK_Widget::GetRotate() const 140 int CPDFSDK_Widget::GetRotate() const
141 { 141 {
142 CPDF_FormControl* pCtrl = GetFormControl(); 142 CPDF_FormControl* pCtrl = GetFormControl();
143 ASSERT(pCtrl != NULL); 143 ASSERT(pCtrl != NULL);
144 144
145 return pCtrl->GetRotation() % 360; 145 return pCtrl->GetRotation() % 360;
146 } 146 }
147 147
148 FX_BOOL»CPDFSDK_Widget::GetFillColor(FX_COLORREF& color) const 148 bool» CPDFSDK_Widget::GetFillColor(FX_COLORREF& color) const
149 { 149 {
150 CPDF_FormControl* pFormCtrl = GetFormControl(); 150 CPDF_FormControl* pFormCtrl = GetFormControl();
151 ASSERT(pFormCtrl != NULL); 151 ASSERT(pFormCtrl != NULL);
152 152
153 int iColorType = 0; 153 int iColorType = 0;
154 color = FX_ARGBTOCOLORREF(pFormCtrl->GetBackgroundColor(iColorType)); 154 color = FX_ARGBTOCOLORREF(pFormCtrl->GetBackgroundColor(iColorType));
155 155
156 return iColorType != COLORTYPE_TRANSPARENT; 156 return iColorType != COLORTYPE_TRANSPARENT;
157 } 157 }
158 158
159 FX_BOOL»CPDFSDK_Widget::GetBorderColor(FX_COLORREF& color) const 159 bool» CPDFSDK_Widget::GetBorderColor(FX_COLORREF& color) const
160 { 160 {
161 CPDF_FormControl* pFormCtrl = GetFormControl(); 161 CPDF_FormControl* pFormCtrl = GetFormControl();
162 ASSERT(pFormCtrl != NULL); 162 ASSERT(pFormCtrl != NULL);
163 163
164 int iColorType = 0; 164 int iColorType = 0;
165 color = FX_ARGBTOCOLORREF(pFormCtrl->GetBorderColor(iColorType)); 165 color = FX_ARGBTOCOLORREF(pFormCtrl->GetBorderColor(iColorType));
166 166
167 return iColorType != COLORTYPE_TRANSPARENT; 167 return iColorType != COLORTYPE_TRANSPARENT;
168 } 168 }
169 169
170 FX_BOOL»CPDFSDK_Widget::GetTextColor(FX_COLORREF& color) const 170 bool» CPDFSDK_Widget::GetTextColor(FX_COLORREF& color) const
171 { 171 {
172 CPDF_FormControl* pFormCtrl = GetFormControl(); 172 CPDF_FormControl* pFormCtrl = GetFormControl();
173 ASSERT(pFormCtrl != NULL); 173 ASSERT(pFormCtrl != NULL);
174 174
175 CPDF_DefaultAppearance da = pFormCtrl->GetDefaultAppearance(); 175 CPDF_DefaultAppearance da = pFormCtrl->GetDefaultAppearance();
176 if (da.HasColor()) 176 if (da.HasColor())
177 { 177 {
178 FX_ARGB argb; 178 FX_ARGB argb;
179 int iColorType = COLORTYPE_TRANSPARENT; 179 int iColorType = COLORTYPE_TRANSPARENT;
180 da.GetColor(argb, iColorType); 180 da.GetColor(argb, iColorType);
181 color = FX_ARGBTOCOLORREF(argb); 181 color = FX_ARGBTOCOLORREF(argb);
182 182
183 return iColorType != COLORTYPE_TRANSPARENT; 183 return iColorType != COLORTYPE_TRANSPARENT;
184 } 184 }
185 185
186 » return FALSE; 186 » return false;
187 } 187 }
188 188
189 FX_FLOAT CPDFSDK_Widget::GetFontSize() const 189 FX_FLOAT CPDFSDK_Widget::GetFontSize() const
190 { 190 {
191 CPDF_FormControl* pFormCtrl = GetFormControl(); 191 CPDF_FormControl* pFormCtrl = GetFormControl();
192 ASSERT(pFormCtrl != NULL); 192 ASSERT(pFormCtrl != NULL);
193 193
194 CPDF_DefaultAppearance pDa = pFormCtrl->GetDefaultAppearance(); 194 CPDF_DefaultAppearance pDa = pFormCtrl->GetDefaultAppearance();
195 CFX_ByteString csFont = ""; 195 CFX_ByteString csFont = "";
196 FX_FLOAT fFontSize = 0.0f; 196 FX_FLOAT fFontSize = 0.0f;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 } 232 }
233 233
234 int CPDFSDK_Widget::CountOptions() const 234 int CPDFSDK_Widget::CountOptions() const
235 { 235 {
236 CPDF_FormField* pFormField = GetFormField(); 236 CPDF_FormField* pFormField = GetFormField();
237 ASSERT(pFormField != NULL); 237 ASSERT(pFormField != NULL);
238 238
239 return pFormField->CountOptions(); 239 return pFormField->CountOptions();
240 } 240 }
241 241
242 FX_BOOL»CPDFSDK_Widget::IsOptionSelected(int nIndex) const 242 bool» CPDFSDK_Widget::IsOptionSelected(int nIndex) const
243 { 243 {
244 CPDF_FormField* pFormField = GetFormField(); 244 CPDF_FormField* pFormField = GetFormField();
245 ASSERT(pFormField != NULL); 245 ASSERT(pFormField != NULL);
246 246
247 return pFormField->IsItemSelected(nIndex); 247 return pFormField->IsItemSelected(nIndex);
248 } 248 }
249 249
250 int CPDFSDK_Widget::GetTopVisibleIndex() const 250 int CPDFSDK_Widget::GetTopVisibleIndex() const
251 { 251 {
252 CPDF_FormField* pFormField = GetFormField(); 252 CPDF_FormField* pFormField = GetFormField();
253 ASSERT(pFormField != NULL); 253 ASSERT(pFormField != NULL);
254 254
255 return pFormField->GetTopVisibleIndex(); 255 return pFormField->GetTopVisibleIndex();
256 } 256 }
257 257
258 FX_BOOL»CPDFSDK_Widget::IsChecked() const 258 bool» CPDFSDK_Widget::IsChecked() const
259 { 259 {
260 CPDF_FormControl* pFormCtrl = GetFormControl(); 260 CPDF_FormControl* pFormCtrl = GetFormControl();
261 ASSERT(pFormCtrl != NULL); 261 ASSERT(pFormCtrl != NULL);
262 262
263 return pFormCtrl->IsChecked(); 263 return pFormCtrl->IsChecked();
264 } 264 }
265 265
266 int CPDFSDK_Widget::GetAlignment() const 266 int CPDFSDK_Widget::GetAlignment() const
267 { 267 {
268 CPDF_FormControl* pFormCtrl = GetFormControl(); 268 CPDF_FormControl* pFormCtrl = GetFormControl();
269 ASSERT(pFormCtrl != NULL); 269 ASSERT(pFormCtrl != NULL);
270 270
271 return pFormCtrl->GetControlAlignment(); 271 return pFormCtrl->GetControlAlignment();
272 } 272 }
273 273
274 int CPDFSDK_Widget::GetMaxLen() const 274 int CPDFSDK_Widget::GetMaxLen() const
275 { 275 {
276 CPDF_FormField* pFormField = GetFormField(); 276 CPDF_FormField* pFormField = GetFormField();
277 ASSERT(pFormField != NULL); 277 ASSERT(pFormField != NULL);
278 278
279 return pFormField->GetMaxLen(); 279 return pFormField->GetMaxLen();
280 } 280 }
281 281
282 void CPDFSDK_Widget::SetCheck(FX_BOOL bChecked, FX_BOOL bNotify) 282 void CPDFSDK_Widget::SetCheck(bool bChecked, bool bNotify)
283 { 283 {
284 CPDF_FormControl* pFormCtrl = GetFormControl(); 284 CPDF_FormControl* pFormCtrl = GetFormControl();
285 ASSERT(pFormCtrl != NULL); 285 ASSERT(pFormCtrl != NULL);
286 286
287 CPDF_FormField* pFormField = pFormCtrl->GetField(); 287 CPDF_FormField* pFormField = pFormCtrl->GetField();
288 ASSERT(pFormField != NULL); 288 ASSERT(pFormField != NULL);
289 289
290 pFormField->CheckControl(pFormField->GetControlIndex(pFormCtrl), bChecke d, bNotify); 290 pFormField->CheckControl(pFormField->GetControlIndex(pFormCtrl), bChecke d, bNotify);
291 } 291 }
292 292
293 void CPDFSDK_Widget::SetValue(const CFX_WideString& sValue, FX_BOOL bNotify) 293 void CPDFSDK_Widget::SetValue(const CFX_WideString& sValue, bool bNotify)
294 { 294 {
295 CPDF_FormField* pFormField = GetFormField(); 295 CPDF_FormField* pFormField = GetFormField();
296 ASSERT(pFormField != NULL); 296 ASSERT(pFormField != NULL);
297 297
298 pFormField->SetValue(sValue, bNotify); 298 pFormField->SetValue(sValue, bNotify);
299 } 299 }
300 300
301 void CPDFSDK_Widget::SetDefaultValue(const CFX_WideString& sValue) 301 void CPDFSDK_Widget::SetDefaultValue(const CFX_WideString& sValue)
302 { 302 {
303 } 303 }
304 void CPDFSDK_Widget::SetOptionSelection(int index, FX_BOOL bSelected, FX_BOOL bN otify) 304 void CPDFSDK_Widget::SetOptionSelection(int index, bool bSelected, bool bNotify)
305 { 305 {
306 CPDF_FormField* pFormField = GetFormField(); 306 CPDF_FormField* pFormField = GetFormField();
307 ASSERT(pFormField != NULL); 307 ASSERT(pFormField != NULL);
308 308
309 pFormField->SetItemSelection(index, bSelected, bNotify); 309 pFormField->SetItemSelection(index, bSelected, bNotify);
310 } 310 }
311 311
312 void CPDFSDK_Widget::ClearSelection(FX_BOOL bNotify) 312 void CPDFSDK_Widget::ClearSelection(bool bNotify)
313 { 313 {
314 CPDF_FormField* pFormField = GetFormField(); 314 CPDF_FormField* pFormField = GetFormField();
315 ASSERT(pFormField != NULL); 315 ASSERT(pFormField != NULL);
316 316
317 pFormField->ClearSelection(bNotify); 317 pFormField->ClearSelection(bNotify);
318 } 318 }
319 319
320 void CPDFSDK_Widget::SetTopVisibleIndex(int index) 320 void CPDFSDK_Widget::SetTopVisibleIndex(int index)
321 { 321 {
322 } 322 }
323 323
324 void CPDFSDK_Widget::SetAppModified() 324 void CPDFSDK_Widget::SetAppModified()
325 { 325 {
326 » m_bAppModified = TRUE; 326 » m_bAppModified = true;
327 } 327 }
328 328
329 void CPDFSDK_Widget::ClearAppModified() 329 void CPDFSDK_Widget::ClearAppModified()
330 { 330 {
331 » m_bAppModified = FALSE; 331 » m_bAppModified = false;
332 } 332 }
333 333
334 FX_BOOL CPDFSDK_Widget::IsAppModified() const 334 bool CPDFSDK_Widget::IsAppModified() const
335 { 335 {
336 return m_bAppModified; 336 return m_bAppModified;
337 } 337 }
338 338
339 void CPDFSDK_Widget::ResetAppearance(const FX_WCHAR* sValue, FX_BOOL bValueChang ed) 339 void CPDFSDK_Widget::ResetAppearance(const FX_WCHAR* sValue, bool bValueChanged)
340 { 340 {
341 SetAppModified(); 341 SetAppModified();
342 342
343 m_nAppAge++; 343 m_nAppAge++;
344 if (m_nAppAge > 999999) 344 if (m_nAppAge > 999999)
345 m_nAppAge = 0; 345 m_nAppAge = 0;
346 if (bValueChanged) 346 if (bValueChanged)
347 m_nValueAge++; 347 m_nValueAge++;
348 348
349 int nFieldType = GetFieldType(); 349 int nFieldType = GetFieldType();
(...skipping 17 matching lines...) Expand all
367 break; 367 break;
368 case FIELDTYPE_TEXTFIELD: 368 case FIELDTYPE_TEXTFIELD:
369 ResetAppearance_TextField(sValue); 369 ResetAppearance_TextField(sValue);
370 break; 370 break;
371 } 371 }
372 372
373 ASSERT(m_pAnnot != NULL); 373 ASSERT(m_pAnnot != NULL);
374 m_pAnnot->ClearCachedAP(); 374 m_pAnnot->ClearCachedAP();
375 } 375 }
376 376
377 CFX_WideString CPDFSDK_Widget::OnFormat(FX_BOOL& bFormated) 377 CFX_WideString CPDFSDK_Widget::OnFormat(bool& bFormated)
378 { 378 {
379 CPDF_FormField* pFormField = GetFormField(); 379 CPDF_FormField* pFormField = GetFormField();
380 ASSERT(pFormField != NULL); 380 ASSERT(pFormField != NULL);
381 return m_pInterForm->OnFormat(pFormField, bFormated); 381 return m_pInterForm->OnFormat(pFormField, bFormated);
382 } 382 }
383 383
384 void CPDFSDK_Widget::ResetFieldAppearance(FX_BOOL bValueChanged) 384 void CPDFSDK_Widget::ResetFieldAppearance(bool bValueChanged)
385 { 385 {
386 CPDF_FormField* pFormField = GetFormField(); 386 CPDF_FormField* pFormField = GetFormField();
387 ASSERT(pFormField != NULL); 387 ASSERT(pFormField != NULL);
388 388
389 ASSERT(m_pInterForm != NULL); 389 ASSERT(m_pInterForm != NULL);
390 390
391 m_pInterForm->ResetFieldAppearance(pFormField, NULL, bValueChanged); 391 m_pInterForm->ResetFieldAppearance(pFormField, NULL, bValueChanged);
392 } 392 }
393 393
394 void CPDFSDK_Widget::DrawAppearance(CFX_RenderDevice* pDevice, const CPDF_Mat rix* pUser2Device, 394 void CPDFSDK_Widget::DrawAppearance(CFX_RenderDevice* pDevice, const CPDF_Mat rix* pUser2Device,
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 1014
1015 CFX_ByteTextBuf sBody, sLines; 1015 CFX_ByteTextBuf sBody, sLines;
1016 1016
1017 CPDF_Rect rcClient = GetClientRect(); 1017 CPDF_Rect rcClient = GetClientRect();
1018 CPDF_Rect rcButton = rcClient; 1018 CPDF_Rect rcButton = rcClient;
1019 rcButton.left = rcButton.right - 13; 1019 rcButton.left = rcButton.right - 13;
1020 rcButton.Normalize(); 1020 rcButton.Normalize();
1021 1021
1022 if (IFX_Edit * pEdit = IFX_Edit::NewEdit()) 1022 if (IFX_Edit * pEdit = IFX_Edit::NewEdit())
1023 { 1023 {
1024 » » pEdit->EnableRefresh(FALSE); 1024 » » pEdit->EnableRefresh(false);
1025 1025
1026 CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); 1026 CPDFSDK_Document* pDoc = m_pInterForm->GetDocument();
1027 ASSERT(pDoc != NULL); 1027 ASSERT(pDoc != NULL);
1028 CPDFDoc_Environment* pEnv = pDoc->GetEnv(); 1028 CPDFDoc_Environment* pEnv = pDoc->GetEnv();
1029 CBA_FontMap FontMap(this,pEnv->GetSysHandler()); 1029 CBA_FontMap FontMap(this,pEnv->GetSysHandler());
1030 FontMap.Initial(); 1030 FontMap.Initial();
1031 pEdit->SetFontMap(&FontMap); 1031 pEdit->SetFontMap(&FontMap);
1032 1032
1033 CPDF_Rect rcEdit = rcClient; 1033 CPDF_Rect rcEdit = rcClient;
1034 rcEdit.right = rcButton.left; 1034 rcEdit.right = rcButton.left;
1035 rcEdit.Normalize(); 1035 rcEdit.Normalize();
1036 1036
1037 pEdit->SetPlateRect(rcEdit); 1037 pEdit->SetPlateRect(rcEdit);
1038 pEdit->SetAlignmentV(1); 1038 pEdit->SetAlignmentV(1);
1039 1039
1040 FX_FLOAT fFontSize = GetFontSize(); 1040 FX_FLOAT fFontSize = GetFontSize();
1041 if (IsFloatZero(fFontSize)) 1041 if (IsFloatZero(fFontSize))
1042 » » » pEdit->SetAutoFontSize(TRUE); 1042 » » » pEdit->SetAutoFontSize(true);
1043 else 1043 else
1044 pEdit->SetFontSize(fFontSize); 1044 pEdit->SetFontSize(fFontSize);
1045 1045
1046 pEdit->Initialize(); 1046 pEdit->Initialize();
1047 1047
1048 if (sValue) 1048 if (sValue)
1049 pEdit->SetText(sValue); 1049 pEdit->SetText(sValue);
1050 else 1050 else
1051 { 1051 {
1052 int32_t nCurSel = pField->GetSelectedIndex(0); 1052 int32_t nCurSel = pField->GetSelectedIndex(0);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 ASSERT(pControl != NULL); 1090 ASSERT(pControl != NULL);
1091 CPDF_FormField* pField = pControl->GetField(); 1091 CPDF_FormField* pField = pControl->GetField();
1092 ASSERT(pField != NULL); 1092 ASSERT(pField != NULL);
1093 1093
1094 CPDF_Rect rcClient = GetClientRect(); 1094 CPDF_Rect rcClient = GetClientRect();
1095 1095
1096 CFX_ByteTextBuf sBody, sLines; 1096 CFX_ByteTextBuf sBody, sLines;
1097 1097
1098 if (IFX_Edit * pEdit = IFX_Edit::NewEdit()) 1098 if (IFX_Edit * pEdit = IFX_Edit::NewEdit())
1099 { 1099 {
1100 » » pEdit->EnableRefresh(FALSE); 1100 » » pEdit->EnableRefresh(false);
1101 1101
1102 CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); 1102 CPDFSDK_Document* pDoc = m_pInterForm->GetDocument();
1103 ASSERT(pDoc != NULL); 1103 ASSERT(pDoc != NULL);
1104 CPDFDoc_Environment* pEnv = pDoc->GetEnv(); 1104 CPDFDoc_Environment* pEnv = pDoc->GetEnv();
1105 1105
1106 CBA_FontMap FontMap(this,pEnv->GetSysHandler()); 1106 CBA_FontMap FontMap(this,pEnv->GetSysHandler());
1107 FontMap.Initial(); 1107 FontMap.Initial();
1108 pEdit->SetFontMap(&FontMap); 1108 pEdit->SetFontMap(&FontMap);
1109 1109
1110 pEdit->SetPlateRect(CPDF_Rect(rcClient.left,0.0f,rcClient.right, 0.0f)); 1110 pEdit->SetPlateRect(CPDF_Rect(rcClient.left,0.0f,rcClient.right, 0.0f));
1111 1111
1112 FX_FLOAT fFontSize = GetFontSize(); 1112 FX_FLOAT fFontSize = GetFontSize();
1113 1113
1114 if (IsFloatZero(fFontSize)) 1114 if (IsFloatZero(fFontSize))
1115 pEdit->SetFontSize(12.0f); 1115 pEdit->SetFontSize(12.0f);
1116 else 1116 else
1117 pEdit->SetFontSize(fFontSize); 1117 pEdit->SetFontSize(fFontSize);
1118 1118
1119 pEdit->Initialize(); 1119 pEdit->Initialize();
1120 1120
1121 CFX_ByteTextBuf sList; 1121 CFX_ByteTextBuf sList;
1122 FX_FLOAT fy = rcClient.top; 1122 FX_FLOAT fy = rcClient.top;
1123 1123
1124 int32_t nTop = pField->GetTopVisibleIndex(); 1124 int32_t nTop = pField->GetTopVisibleIndex();
1125 int32_t nCount = pField->CountOptions(); 1125 int32_t nCount = pField->CountOptions();
1126 int32_t nSelCount = pField->CountSelectedItems(); 1126 int32_t nSelCount = pField->CountSelectedItems();
1127 1127
1128 for (int32_t i=nTop; i<nCount; i++) 1128 for (int32_t i=nTop; i<nCount; i++)
1129 { 1129 {
1130 » » » FX_BOOL bSelected = FALSE; 1130 » » » bool bSelected = false;
1131 for (int32_t j=0; j<nSelCount; j++) 1131 for (int32_t j=0; j<nSelCount; j++)
1132 { 1132 {
1133 if (pField->GetSelectedIndex(j) == i) 1133 if (pField->GetSelectedIndex(j) == i)
1134 { 1134 {
1135 » » » » » bSelected = TRUE; 1135 » » » » » bSelected = true;
1136 break; 1136 break;
1137 } 1137 }
1138 } 1138 }
1139 1139
1140 pEdit->SetText(pField->GetOptionLabel(i).c_str()); 1140 pEdit->SetText(pField->GetOptionLabel(i).c_str());
1141 1141
1142 CPDF_Rect rcContent = pEdit->GetContentRect(); 1142 CPDF_Rect rcContent = pEdit->GetContentRect();
1143 FX_FLOAT fItemHeight = rcContent.Height(); 1143 FX_FLOAT fItemHeight = rcContent.Height();
1144 1144
1145 if (bSelected) 1145 if (bSelected)
1146 { 1146 {
1147 CPDF_Rect rcItem = CPDF_Rect(rcClient.left,fy-fI temHeight,rcClient.right,fy); 1147 CPDF_Rect rcItem = CPDF_Rect(rcClient.left,fy-fI temHeight,rcClient.right,fy);
1148 » » » » sList << "q\n" << CPWL_Utils::GetColorAppStream( CPWL_Color(COLORTYPE_RGB,0,51.0f/255.0f,113.0f/255.0f),TRUE) 1148 » » » » sList << "q\n" << CPWL_Utils::GetColorAppStream( CPWL_Color(COLORTYPE_RGB,0,51.0f/255.0f,113.0f/255.0f),true)
1149 << rcItem.left << " " << rcItem.bottom < < " " << rcItem.Width() << " " << rcItem.Height() << " re f\n" << "Q\n"; 1149 << rcItem.left << " " << rcItem.bottom < < " " << rcItem.Width() << " " << rcItem.Height() << " re f\n" << "Q\n";
1150 1150
1151 » » » » sList << "BT\n" << CPWL_Utils::GetColorAppStream (CPWL_Color(COLORTYPE_GRAY,1),TRUE) << 1151 » » » » sList << "BT\n" << CPWL_Utils::GetColorAppStream (CPWL_Color(COLORTYPE_GRAY,1),true) <<
1152 CPWL_Utils::GetEditAppStream(pEdit,CPDF_ Point(0.0f,fy)) << "ET\n"; 1152 CPWL_Utils::GetEditAppStream(pEdit,CPDF_ Point(0.0f,fy)) << "ET\n";
1153 } 1153 }
1154 else 1154 else
1155 { 1155 {
1156 CPWL_Color crText = GetTextPWLColor(); 1156 CPWL_Color crText = GetTextPWLColor();
1157 » » » » sList << "BT\n" << CPWL_Utils::GetColorAppStream (crText,TRUE) << 1157 » » » » sList << "BT\n" << CPWL_Utils::GetColorAppStream (crText,true) <<
1158 CPWL_Utils::GetEditAppStream(pEdit,CPDF_Point(0. 0f,fy)) << "ET\n"; 1158 CPWL_Utils::GetEditAppStream(pEdit,CPDF_Point(0. 0f,fy)) << "ET\n";
1159 } 1159 }
1160 1160
1161 fy -= fItemHeight; 1161 fy -= fItemHeight;
1162 } 1162 }
1163 1163
1164 if (sList.GetSize() > 0) 1164 if (sList.GetSize() > 0)
1165 { 1165 {
1166 sBody << "/Tx BMC\n" << "q\n" << rcClient.left << " " << rcClient.bottom << " " 1166 sBody << "/Tx BMC\n" << "q\n" << rcClient.left << " " << rcClient.bottom << " "
1167 << rcClient.Width() << " " << rcClient.H eight() << " re\nW\nn\n"; 1167 << rcClient.Width() << " " << rcClient.H eight() << " re\nW\nn\n";
(...skipping 12 matching lines...) Expand all
1180 { 1180 {
1181 CPDF_FormControl* pControl = GetFormControl(); 1181 CPDF_FormControl* pControl = GetFormControl();
1182 ASSERT(pControl != NULL); 1182 ASSERT(pControl != NULL);
1183 CPDF_FormField* pField = pControl->GetField(); 1183 CPDF_FormField* pField = pControl->GetField();
1184 ASSERT(pField != NULL); 1184 ASSERT(pField != NULL);
1185 1185
1186 CFX_ByteTextBuf sBody, sLines; 1186 CFX_ByteTextBuf sBody, sLines;
1187 1187
1188 if (IFX_Edit * pEdit = IFX_Edit::NewEdit()) 1188 if (IFX_Edit * pEdit = IFX_Edit::NewEdit())
1189 { 1189 {
1190 » » pEdit->EnableRefresh(FALSE); 1190 » » pEdit->EnableRefresh(false);
1191 1191
1192 CPDFSDK_Document* pDoc = m_pInterForm->GetDocument(); 1192 CPDFSDK_Document* pDoc = m_pInterForm->GetDocument();
1193 ASSERT(pDoc != NULL); 1193 ASSERT(pDoc != NULL);
1194 CPDFDoc_Environment* pEnv = pDoc->GetEnv(); 1194 CPDFDoc_Environment* pEnv = pDoc->GetEnv();
1195 1195
1196 CBA_FontMap FontMap(this,pEnv->GetSysHandler());//, ISystemHandl e::GetSystemHandler(m_pBaseForm->GetEnv())); 1196 CBA_FontMap FontMap(this,pEnv->GetSysHandler());//, ISystemHandl e::GetSystemHandler(m_pBaseForm->GetEnv()));
1197 FontMap.Initial(); 1197 FontMap.Initial();
1198 pEdit->SetFontMap(&FontMap); 1198 pEdit->SetFontMap(&FontMap);
1199 1199
1200 CPDF_Rect rcClient = GetClientRect(); 1200 CPDF_Rect rcClient = GetClientRect();
1201 pEdit->SetPlateRect(rcClient); 1201 pEdit->SetPlateRect(rcClient);
1202 pEdit->SetAlignmentH(pControl->GetControlAlignment()); 1202 pEdit->SetAlignmentH(pControl->GetControlAlignment());
1203 1203
1204 FX_DWORD dwFieldFlags = pField->GetFieldFlags(); 1204 FX_DWORD dwFieldFlags = pField->GetFieldFlags();
1205 » » FX_BOOL bMultiLine = (dwFieldFlags >> 12) & 1; 1205 » » bool bMultiLine = (dwFieldFlags >> 12) & 1;
1206 1206
1207 if (bMultiLine) 1207 if (bMultiLine)
1208 { 1208 {
1209 » » » pEdit->SetMultiLine(TRUE); 1209 » » » pEdit->SetMultiLine(true);
1210 » » » pEdit->SetAutoReturn(TRUE); 1210 » » » pEdit->SetAutoReturn(true);
1211 } 1211 }
1212 else 1212 else
1213 { 1213 {
1214 pEdit->SetAlignmentV(1); 1214 pEdit->SetAlignmentV(1);
1215 } 1215 }
1216 1216
1217 FX_WORD subWord = 0; 1217 FX_WORD subWord = 0;
1218 if ((dwFieldFlags >> 13) & 1) 1218 if ((dwFieldFlags >> 13) & 1)
1219 { 1219 {
1220 subWord = '*'; 1220 subWord = '*';
1221 pEdit->SetPasswordChar(subWord); 1221 pEdit->SetPasswordChar(subWord);
1222 } 1222 }
1223 1223
1224 int nMaxLen = pField->GetMaxLen(); 1224 int nMaxLen = pField->GetMaxLen();
1225 » » FX_BOOL bCharArray = (dwFieldFlags >> 24) & 1; 1225 » » bool bCharArray = (dwFieldFlags >> 24) & 1;
1226 FX_FLOAT fFontSize = GetFontSize(); 1226 FX_FLOAT fFontSize = GetFontSize();
1227 1227
1228 if (nMaxLen > 0) 1228 if (nMaxLen > 0)
1229 { 1229 {
1230 if (bCharArray) 1230 if (bCharArray)
1231 { 1231 {
1232 pEdit->SetCharArray(nMaxLen); 1232 pEdit->SetCharArray(nMaxLen);
1233 1233
1234 if (IsFloatZero(fFontSize)) 1234 if (IsFloatZero(fFontSize))
1235 { 1235 {
1236 fFontSize = CPWL_Edit::GetCharArrayAutoF ontSize(FontMap.GetPDFFont(0),rcClient,nMaxLen); 1236 fFontSize = CPWL_Edit::GetCharArrayAutoF ontSize(FontMap.GetPDFFont(0),rcClient,nMaxLen);
1237 } 1237 }
1238 } 1238 }
1239 else 1239 else
1240 { 1240 {
1241 if (sValue) 1241 if (sValue)
1242 nMaxLen = wcslen((const wchar_t*)sValue) ; 1242 nMaxLen = wcslen((const wchar_t*)sValue) ;
1243 pEdit->SetLimitChar(nMaxLen); 1243 pEdit->SetLimitChar(nMaxLen);
1244 } 1244 }
1245 } 1245 }
1246 1246
1247 if (IsFloatZero(fFontSize)) 1247 if (IsFloatZero(fFontSize))
1248 » » » pEdit->SetAutoFontSize(TRUE); 1248 » » » pEdit->SetAutoFontSize(true);
1249 else 1249 else
1250 pEdit->SetFontSize(fFontSize); 1250 pEdit->SetFontSize(fFontSize);
1251 1251
1252 pEdit->Initialize(); 1252 pEdit->Initialize();
1253 1253
1254 if (sValue) 1254 if (sValue)
1255 pEdit->SetText(sValue); 1255 pEdit->SetText(sValue);
1256 else 1256 else
1257 pEdit->SetText(pField->GetValue().c_str()); 1257 pEdit->SetText(pField->GetValue().c_str());
1258 1258
(...skipping 14 matching lines...) Expand all
1273 CPWL_Color crText = GetTextPWLColor(); 1273 CPWL_Color crText = GetTextPWLColor();
1274 sBody << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n" << "Q\nEMC\n"; 1274 sBody << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n" << "Q\nEMC\n";
1275 } 1275 }
1276 1276
1277 if (bCharArray) 1277 if (bCharArray)
1278 { 1278 {
1279 switch (GetBorderStyle()) 1279 switch (GetBorderStyle())
1280 { 1280 {
1281 case BBS_SOLID: 1281 case BBS_SOLID:
1282 { 1282 {
1283 » » » » » CFX_ByteString sColor = CPWL_Utils::GetC olorAppStream(GetBorderPWLColor(),FALSE); 1283 » » » » » CFX_ByteString sColor = CPWL_Utils::GetC olorAppStream(GetBorderPWLColor(),false);
1284 if (sColor.GetLength() > 0) 1284 if (sColor.GetLength() > 0)
1285 { 1285 {
1286 sLines << "q\n" << GetBorderWidt h() << " w\n" 1286 sLines << "q\n" << GetBorderWidt h() << " w\n"
1287 » » » » » » » << CPWL_Utils::GetColorA ppStream(GetBorderPWLColor(),FALSE) << " 2 J 0 j\n"; 1287 » » » » » » » << CPWL_Utils::GetColorA ppStream(GetBorderPWLColor(),false) << " 2 J 0 j\n";
1288 1288
1289 for (int32_t i=1;i<nMaxLen;i++) 1289 for (int32_t i=1;i<nMaxLen;i++)
1290 { 1290 {
1291 sLines << rcClient.left + ((rcClient.right - rcClient.left)/nMaxLen)*i << " " 1291 sLines << rcClient.left + ((rcClient.right - rcClient.left)/nMaxLen)*i << " "
1292 << rcClient.bott om << " m\n" 1292 << rcClient.bott om << " m\n"
1293 << rcClient.left + ((rcClient.right - rcClient.left)/nMaxLen)*i << " " 1293 << rcClient.left + ((rcClient.right - rcClient.left)/nMaxLen)*i << " "
1294 << rcClient.top << " l S\n"; 1294 << rcClient.top << " l S\n";
1295 } 1295 }
1296 1296
1297 sLines << "Q\n"; 1297 sLines << "Q\n";
1298 } 1298 }
1299 } 1299 }
1300 break; 1300 break;
1301 case BBS_DASH: 1301 case BBS_DASH:
1302 { 1302 {
1303 » » » » » CFX_ByteString sColor = CPWL_Utils::GetC olorAppStream(GetBorderPWLColor(),FALSE); 1303 » » » » » CFX_ByteString sColor = CPWL_Utils::GetC olorAppStream(GetBorderPWLColor(),false);
1304 if (sColor.GetLength() > 0) 1304 if (sColor.GetLength() > 0)
1305 { 1305 {
1306 CPWL_Dash dsBorder = CPWL_Dash(3 , 3, 0); 1306 CPWL_Dash dsBorder = CPWL_Dash(3 , 3, 0);
1307 1307
1308 sLines << "q\n" << GetBorderWidt h() << " w\n" 1308 sLines << "q\n" << GetBorderWidt h() << " w\n"
1309 » » » » » » » << CPWL_Utils::GetColorA ppStream(GetBorderPWLColor(),FALSE) 1309 » » » » » » » << CPWL_Utils::GetColorA ppStream(GetBorderPWLColor(),false)
1310 << "[" << dsBorder.nDash << " " 1310 << "[" << dsBorder.nDash << " "
1311 << dsBorder.nGap << "] " 1311 << dsBorder.nGap << "] "
1312 << dsBorder.nPhase << " d\n"; 1312 << dsBorder.nPhase << " d\n";
1313 1313
1314 for (int32_t i=1;i<nMaxLen;i++) 1314 for (int32_t i=1;i<nMaxLen;i++)
1315 { 1315 {
1316 sLines << rcClient.left + ((rcClient.right - rcClient.left)/nMaxLen)*i << " " 1316 sLines << rcClient.left + ((rcClient.right - rcClient.left)/nMaxLen)*i << " "
1317 << rcClient.bott om << " m\n" 1317 << rcClient.bott om << " m\n"
1318 << rcClient.left + ((rcClient.right - rcClient.left)/nMaxLen)*i << " " 1318 << rcClient.left + ((rcClient.right - rcClient.left)/nMaxLen)*i << " "
1319 << rcClient.top << " l S\n"; 1319 << rcClient.top << " l S\n";
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1548 } 1548 }
1549 1549
1550 void CPDFSDK_Widget::RemoveAppearance(const CFX_ByteString& sAPType) 1550 void CPDFSDK_Widget::RemoveAppearance(const CFX_ByteString& sAPType)
1551 { 1551 {
1552 if (CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDict("AP")) 1552 if (CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDict("AP"))
1553 { 1553 {
1554 pAPDict->RemoveAt(sAPType); 1554 pAPDict->RemoveAt(sAPType);
1555 } 1555 }
1556 } 1556 }
1557 1557
1558 FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type, PDFSDK_FieldAc tion& data, CPDFSDK_PageView* pPageView) 1558 bool CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type, PDFSDK_FieldActio n& data, CPDFSDK_PageView* pPageView)
1559 { 1559 {
1560 CPDF_Action action = GetAAction(type); 1560 CPDF_Action action = GetAAction(type);
1561 1561
1562 if (action && action.GetType() != CPDF_Action::Unknown) 1562 if (action && action.GetType() != CPDF_Action::Unknown)
1563 { 1563 {
1564 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); 1564 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument();
1565 ASSERT(pDocument != NULL); 1565 ASSERT(pDocument != NULL);
1566 1566
1567 CPDFDoc_Environment* pEnv = pDocument->GetEnv(); 1567 CPDFDoc_Environment* pEnv = pDocument->GetEnv();
1568 ASSERT(pEnv != NULL); 1568 ASSERT(pEnv != NULL);
1569 1569
1570 CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); /*(CPDFSDK_ActionHandler*)pApp->GetActionHandler();*/ 1570 CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander(); /*(CPDFSDK_ActionHandler*)pApp->GetActionHandler();*/
1571 ASSERT(pActionHandler != NULL); 1571 ASSERT(pActionHandler != NULL);
1572 1572
1573 return pActionHandler->DoAction_Field(action, type, pDocument, G etFormField(), data); 1573 return pActionHandler->DoAction_Field(action, type, pDocument, G etFormField(), data);
1574 } 1574 }
1575 1575
1576 » return FALSE; 1576 » return false;
1577 } 1577 }
1578 1578
1579 CPDF_Action CPDFSDK_Widget::GetAAction(CPDF_AAction::AActionType eAAT) 1579 CPDF_Action CPDFSDK_Widget::GetAAction(CPDF_AAction::AActionType eAAT)
1580 { 1580 {
1581 switch (eAAT) 1581 switch (eAAT)
1582 { 1582 {
1583 case CPDF_AAction::CursorEnter: 1583 case CPDF_AAction::CursorEnter:
1584 case CPDF_AAction::CursorExit: 1584 case CPDF_AAction::CursorExit:
1585 case CPDF_AAction::ButtonDown: 1585 case CPDF_AAction::ButtonDown:
1586 case CPDF_AAction::ButtonUp: 1586 case CPDF_AAction::ButtonUp:
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 { 1623 {
1624 return m_nAppAge; 1624 return m_nAppAge;
1625 } 1625 }
1626 1626
1627 int32_t CPDFSDK_Widget::GetValueAge() const 1627 int32_t CPDFSDK_Widget::GetValueAge() const
1628 { 1628 {
1629 return m_nValueAge; 1629 return m_nValueAge;
1630 } 1630 }
1631 1631
1632 1632
1633 FX_BOOL»CPDFSDK_Widget::HitTest(FX_FLOAT pageX, FX_FLOAT pageY) 1633 bool» CPDFSDK_Widget::HitTest(FX_FLOAT pageX, FX_FLOAT pageY)
1634 { 1634 {
1635 CPDF_Annot* pAnnot = GetPDFAnnot(); 1635 CPDF_Annot* pAnnot = GetPDFAnnot();
1636 CFX_FloatRect annotRect; 1636 CFX_FloatRect annotRect;
1637 pAnnot->GetRect(annotRect); 1637 pAnnot->GetRect(annotRect);
1638 if(annotRect.Contains(pageX, pageY)) 1638 if(annotRect.Contains(pageX, pageY))
1639 { 1639 {
1640 » » if (!IsVisible()) return FALSE; 1640 » » if (!IsVisible()) return false;
1641 1641
1642 int nFieldFlags = GetFieldFlags(); 1642 int nFieldFlags = GetFieldFlags();
1643 if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) 1643 if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY)
1644 » » » return FALSE; 1644 » » » return false;
1645 1645
1646 » » return TRUE; 1646 » » return true;
1647 } 1647 }
1648 » return FALSE; 1648 » return false;
1649 } 1649 }
1650 1650
1651 CPDFSDK_InterForm::CPDFSDK_InterForm(CPDFSDK_Document* pDocument) 1651 CPDFSDK_InterForm::CPDFSDK_InterForm(CPDFSDK_Document* pDocument)
1652 :m_pDocument(pDocument), 1652 :m_pDocument(pDocument),
1653 m_pInterForm(NULL), 1653 m_pInterForm(NULL),
1654 » m_bCalculate(TRUE), 1654 » m_bCalculate(true),
1655 » m_bBusy(FALSE) 1655 » m_bBusy(false)
1656 { 1656 {
1657 ASSERT(m_pDocument != NULL); 1657 ASSERT(m_pDocument != NULL);
1658 » m_pInterForm = new CPDF_InterForm(m_pDocument->GetDocument(), FALSE); 1658 » m_pInterForm = new CPDF_InterForm(m_pDocument->GetDocument(), false);
1659 ASSERT(m_pInterForm != NULL); 1659 ASSERT(m_pInterForm != NULL);
1660 m_pInterForm->SetFormNotify(this); 1660 m_pInterForm->SetFormNotify(this);
1661 1661
1662 for(int i=0; i<6; i++) 1662 for(int i=0; i<6; i++)
1663 » » m_bNeedHightlight[i] = FALSE; 1663 » » m_bNeedHightlight[i] = false;
1664 m_iHighlightAlpha = 0; 1664 m_iHighlightAlpha = 0;
1665 } 1665 }
1666 1666
1667 CPDFSDK_InterForm::~CPDFSDK_InterForm() 1667 CPDFSDK_InterForm::~CPDFSDK_InterForm()
1668 { 1668 {
1669 delete m_pInterForm; 1669 delete m_pInterForm;
1670 m_pInterForm = nullptr; 1670 m_pInterForm = nullptr;
1671 m_Map.clear(); 1671 m_Map.clear();
1672 } 1672 }
1673 1673
1674 FX_BOOL CPDFSDK_InterForm::HighlightWidgets() 1674 bool CPDFSDK_InterForm::HighlightWidgets()
1675 { 1675 {
1676 » return FALSE; 1676 » return false;
1677 } 1677 }
1678 1678
1679 CPDFSDK_Widget* CPDFSDK_InterForm::GetSibling(CPDFSDK_Widget* pWidget, FX_BOOL b Next) const 1679 CPDFSDK_Widget* CPDFSDK_InterForm::GetSibling(CPDFSDK_Widget* pWidget, bool bNex t) const
1680 { 1680 {
1681 nonstd::unique_ptr<CBA_AnnotIterator> pIterator( 1681 nonstd::unique_ptr<CBA_AnnotIterator> pIterator(
1682 new CBA_AnnotIterator(pWidget->GetPageView(), "Widget", "")); 1682 new CBA_AnnotIterator(pWidget->GetPageView(), "Widget", ""));
1683 1683
1684 if (bNext) { 1684 if (bNext) {
1685 return (CPDFSDK_Widget*)pIterator->GetNextAnnot(pWidget); 1685 return (CPDFSDK_Widget*)pIterator->GetNextAnnot(pWidget);
1686 } 1686 }
1687 return (CPDFSDK_Widget*)pIterator->GetPrevAnnot(pWidget); 1687 return (CPDFSDK_Widget*)pIterator->GetPrevAnnot(pWidget);
1688 } 1688 }
1689 1689
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1781 void CPDFSDK_InterForm::AddMap(CPDF_FormControl* pControl, CPDFSDK_Widget* pWidg et) 1781 void CPDFSDK_InterForm::AddMap(CPDF_FormControl* pControl, CPDFSDK_Widget* pWidg et)
1782 { 1782 {
1783 m_Map[pControl] = pWidget; 1783 m_Map[pControl] = pWidget;
1784 } 1784 }
1785 1785
1786 void CPDFSDK_InterForm::RemoveMap(CPDF_FormControl* pControl) 1786 void CPDFSDK_InterForm::RemoveMap(CPDF_FormControl* pControl)
1787 { 1787 {
1788 m_Map.erase(pControl); 1788 m_Map.erase(pControl);
1789 } 1789 }
1790 1790
1791 void CPDFSDK_InterForm::EnableCalculate(FX_BOOL bEnabled) 1791 void CPDFSDK_InterForm::EnableCalculate(bool bEnabled)
1792 { 1792 {
1793 m_bCalculate = bEnabled; 1793 m_bCalculate = bEnabled;
1794 } 1794 }
1795 1795
1796 FX_BOOL CPDFSDK_InterForm::IsCalculateEnabled() const 1796 bool CPDFSDK_InterForm::IsCalculateEnabled() const
1797 { 1797 {
1798 return m_bCalculate; 1798 return m_bCalculate;
1799 } 1799 }
1800 1800
1801 #ifdef _WIN32 1801 #ifdef _WIN32
1802 CPDF_Stream* CPDFSDK_InterForm::LoadImageFromFile(const CFX_WideString& sFile) 1802 CPDF_Stream* CPDFSDK_InterForm::LoadImageFromFile(const CFX_WideString& sFile)
1803 { 1803 {
1804 ASSERT(m_pDocument != NULL); 1804 ASSERT(m_pDocument != NULL);
1805 CPDF_Document* pDocument = m_pDocument->GetDocument(); 1805 CPDF_Document* pDocument = m_pDocument->GetDocument();
1806 ASSERT(pDocument != NULL); 1806 ASSERT(pDocument != NULL);
1807 1807
1808 CPDF_Stream* pRetStream = NULL; 1808 CPDF_Stream* pRetStream = NULL;
1809 1809
1810 if (CFX_DIBitmap* pBmp = CFX_WindowsDIB::LoadFromFile(sFile.c_str())) 1810 if (CFX_DIBitmap* pBmp = CFX_WindowsDIB::LoadFromFile(sFile.c_str()))
1811 { 1811 {
1812 int nWidth = pBmp->GetWidth(); 1812 int nWidth = pBmp->GetWidth();
1813 int nHeight = pBmp->GetHeight(); 1813 int nHeight = pBmp->GetHeight();
1814 1814
1815 CPDF_Image Image(pDocument); 1815 CPDF_Image Image(pDocument);
1816 » » Image.SetImage(pBmp, FALSE); 1816 » » Image.SetImage(pBmp, false);
1817 CPDF_Stream* pImageStream = Image.GetStream(); 1817 CPDF_Stream* pImageStream = Image.GetStream();
1818 if (pImageStream) 1818 if (pImageStream)
1819 { 1819 {
1820 if (pImageStream->GetObjNum() == 0) 1820 if (pImageStream->GetObjNum() == 0)
1821 pDocument->AddIndirectObject(pImageStream); 1821 pDocument->AddIndirectObject(pImageStream);
1822 1822
1823 CPDF_Dictionary* pStreamDict = new CPDF_Dictionary(); 1823 CPDF_Dictionary* pStreamDict = new CPDF_Dictionary();
1824 pStreamDict->SetAtName("Subtype", "Form"); 1824 pStreamDict->SetAtName("Subtype", "Form");
1825 pStreamDict->SetAtName("Name", "IMG"); 1825 pStreamDict->SetAtName("Name", "IMG");
1826 CPDF_Array* pMatrix = new CPDF_Array(); 1826 CPDF_Array* pMatrix = new CPDF_Array();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1866 void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) 1866 void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField)
1867 { 1867 {
1868 ASSERT(m_pDocument != NULL); 1868 ASSERT(m_pDocument != NULL);
1869 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); 1869 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv();
1870 ASSERT(pEnv); 1870 ASSERT(pEnv);
1871 if(!pEnv->IsJSInitiated()) 1871 if(!pEnv->IsJSInitiated())
1872 return; 1872 return;
1873 1873
1874 if (m_bBusy) return; 1874 if (m_bBusy) return;
1875 1875
1876 » m_bBusy = TRUE; 1876 » m_bBusy = true;
1877 1877
1878 if (IsCalculateEnabled()) 1878 if (IsCalculateEnabled())
1879 { 1879 {
1880 IFXJS_Runtime* pRuntime = m_pDocument->GetJsRuntime(); 1880 IFXJS_Runtime* pRuntime = m_pDocument->GetJsRuntime();
1881 ASSERT(pRuntime != NULL); 1881 ASSERT(pRuntime != NULL);
1882 1882
1883 pRuntime->SetReaderDocument(m_pDocument); 1883 pRuntime->SetReaderDocument(m_pDocument);
1884 1884
1885 int nSize = m_pInterForm->CountFieldsInCalculationOrder(); 1885 int nSize = m_pInterForm->CountFieldsInCalculationOrder();
1886 for (int i=0; i<nSize; i++) 1886 for (int i=0; i<nSize; i++)
(...skipping 11 matching lines...) Expand all
1898 if (action) 1898 if (action)
1899 { 1899 {
1900 CFX_WideString csJS = ac tion.GetJavaScript(); 1900 CFX_WideString csJS = ac tion.GetJavaScript();
1901 if (!csJS.IsEmpty()) 1901 if (!csJS.IsEmpty())
1902 { 1902 {
1903 IFXJS_Context* p Context = pRuntime->NewContext(); 1903 IFXJS_Context* p Context = pRuntime->NewContext();
1904 ASSERT(pContext != NULL); 1904 ASSERT(pContext != NULL);
1905 1905
1906 CFX_WideString s OldValue = pField->GetValue(); 1906 CFX_WideString s OldValue = pField->GetValue();
1907 CFX_WideString s Value = sOldValue; 1907 CFX_WideString s Value = sOldValue;
1908 » » » » » » » » FX_BOOL bRC = TR UE; 1908 » » » » » » » » bool bRC = true;
1909 pContext->OnFiel d_Calculate(pFormField, pField, sValue, bRC); 1909 pContext->OnFiel d_Calculate(pFormField, pField, sValue, bRC);
1910 1910
1911 CFX_WideString s Info; 1911 CFX_WideString s Info;
1912 » » » » » » » » FX_BOOL bRet = p Context->RunScript(csJS, sInfo); 1912 » » » » » » » » bool bRet = pCon text->RunScript(csJS, sInfo);
1913 pRuntime->Releas eContext(pContext); 1913 pRuntime->Releas eContext(pContext);
1914 1914
1915 if (bRet) 1915 if (bRet)
1916 { 1916 {
1917 if (bRC) 1917 if (bRC)
1918 { 1918 {
1919 if (sValue.Compare(sOldValue) != 0) 1919 if (sValue.Compare(sOldValue) != 0)
1920 » » » » » » » » » » » pField->SetValue(sValue, TRUE); 1920 » » » » » » » » » » » pField->SetValue(sValue, true);
1921 } 1921 }
1922 } 1922 }
1923 } 1923 }
1924 } 1924 }
1925 } 1925 }
1926 } 1926 }
1927 } 1927 }
1928 } 1928 }
1929 1929
1930 1930
1931 } 1931 }
1932 1932
1933 » m_bBusy = FALSE; 1933 » m_bBusy = false;
1934 } 1934 }
1935 1935
1936 CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, FX_BOOL& bFormated) 1936 CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, bool& bFo rmated)
1937 { 1937 {
1938 ASSERT(m_pDocument != NULL); 1938 ASSERT(m_pDocument != NULL);
1939 ASSERT(pFormField != NULL); 1939 ASSERT(pFormField != NULL);
1940 1940
1941 CFX_WideString sValue = pFormField->GetValue(); 1941 CFX_WideString sValue = pFormField->GetValue();
1942 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); 1942 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv();
1943 ASSERT(pEnv); 1943 ASSERT(pEnv);
1944 if(!pEnv->IsJSInitiated()) 1944 if(!pEnv->IsJSInitiated())
1945 { 1945 {
1946 » » bFormated = FALSE; 1946 » » bFormated = false;
1947 return sValue; 1947 return sValue;
1948 } 1948 }
1949 1949
1950 IFXJS_Runtime* pRuntime = m_pDocument->GetJsRuntime(); 1950 IFXJS_Runtime* pRuntime = m_pDocument->GetJsRuntime();
1951 ASSERT(pRuntime != NULL); 1951 ASSERT(pRuntime != NULL);
1952 1952
1953 pRuntime->SetReaderDocument(m_pDocument); 1953 pRuntime->SetReaderDocument(m_pDocument);
1954 1954
1955 if (pFormField->GetFieldType() == FIELDTYPE_COMBOBOX) 1955 if (pFormField->GetFieldType() == FIELDTYPE_COMBOBOX)
1956 { 1956 {
1957 if (pFormField->CountSelectedItems() > 0) 1957 if (pFormField->CountSelectedItems() > 0)
1958 { 1958 {
1959 int index = pFormField->GetSelectedIndex(0); 1959 int index = pFormField->GetSelectedIndex(0);
1960 if (index >= 0) 1960 if (index >= 0)
1961 sValue = pFormField->GetOptionLabel(index); 1961 sValue = pFormField->GetOptionLabel(index);
1962 } 1962 }
1963 } 1963 }
1964 1964
1965 » bFormated = FALSE; 1965 » bFormated = false;
1966 1966
1967 CPDF_AAction aAction = pFormField->GetAdditionalAction(); 1967 CPDF_AAction aAction = pFormField->GetAdditionalAction();
1968 if (aAction != NULL && aAction.ActionExist(CPDF_AAction::Format)) 1968 if (aAction != NULL && aAction.ActionExist(CPDF_AAction::Format))
1969 { 1969 {
1970 CPDF_Action action = aAction.GetAction(CPDF_AAction::Format); 1970 CPDF_Action action = aAction.GetAction(CPDF_AAction::Format);
1971 if (action) 1971 if (action)
1972 { 1972 {
1973 CFX_WideString script = action.GetJavaScript(); 1973 CFX_WideString script = action.GetJavaScript();
1974 if (!script.IsEmpty()) 1974 if (!script.IsEmpty())
1975 { 1975 {
1976 CFX_WideString Value = sValue; 1976 CFX_WideString Value = sValue;
1977 1977
1978 IFXJS_Context* pContext = pRuntime->NewContext() ; 1978 IFXJS_Context* pContext = pRuntime->NewContext() ;
1979 ASSERT(pContext != NULL); 1979 ASSERT(pContext != NULL);
1980 1980
1981 » » » » pContext->OnField_Format(pFormField, Value, TRUE ); 1981 » » » » pContext->OnField_Format(pFormField, Value, true );
1982 1982
1983 CFX_WideString sInfo; 1983 CFX_WideString sInfo;
1984 » » » » FX_BOOL bRet = pContext->RunScript(script, sInfo ); 1984 » » » » bool bRet = pContext->RunScript(script, sInfo);
1985 pRuntime->ReleaseContext(pContext); 1985 pRuntime->ReleaseContext(pContext);
1986 1986
1987 if (bRet) 1987 if (bRet)
1988 { 1988 {
1989 sValue = Value; 1989 sValue = Value;
1990 » » » » » bFormated = TRUE; 1990 » » » » » bFormated = true;
1991 } 1991 }
1992 } 1992 }
1993 } 1993 }
1994 } 1994 }
1995 1995
1996 return sValue; 1996 return sValue;
1997 } 1997 }
1998 1998
1999 void CPDFSDK_InterForm::ResetFieldAppearance(CPDF_FormField* pFormField, const F X_WCHAR* sValue, FX_BOOL bValueChanged) 1999 void CPDFSDK_InterForm::ResetFieldAppearance(CPDF_FormField* pFormField, const F X_WCHAR* sValue, bool bValueChanged)
2000 { 2000 {
2001 ASSERT(pFormField != NULL); 2001 ASSERT(pFormField != NULL);
2002 2002
2003 for (int i=0,sz=pFormField->CountControls(); i<sz; i++) 2003 for (int i=0,sz=pFormField->CountControls(); i<sz; i++)
2004 { 2004 {
2005 CPDF_FormControl* pFormCtrl = pFormField->GetControl(i); 2005 CPDF_FormControl* pFormCtrl = pFormField->GetControl(i);
2006 ASSERT(pFormCtrl != NULL); 2006 ASSERT(pFormCtrl != NULL);
2007 2007
2008 ASSERT(m_pInterForm != NULL); 2008 ASSERT(m_pInterForm != NULL);
2009 if(CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl)) 2009 if(CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl))
2010 pWidget->ResetAppearance(sValue, bValueChanged); 2010 pWidget->ResetAppearance(sValue, bValueChanged);
2011 } 2011 }
2012 } 2012 }
2013 2013
2014 void CPDFSDK_InterForm::UpdateField(CPDF_FormField* pFormField) 2014 void CPDFSDK_InterForm::UpdateField(CPDF_FormField* pFormField)
2015 { 2015 {
2016 ASSERT(pFormField != NULL); 2016 ASSERT(pFormField != NULL);
2017 2017
2018 for (int i=0,sz=pFormField->CountControls(); i<sz; i++) 2018 for (int i=0,sz=pFormField->CountControls(); i<sz; i++)
2019 { 2019 {
2020 CPDF_FormControl* pFormCtrl = pFormField->GetControl(i); 2020 CPDF_FormControl* pFormCtrl = pFormField->GetControl(i);
2021 ASSERT(pFormCtrl != NULL); 2021 ASSERT(pFormCtrl != NULL);
2022 2022
2023 if(CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl)) 2023 if(CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl))
2024 { 2024 {
2025 CPDFDoc_Environment * pEnv = m_pDocument->GetEnv(); 2025 CPDFDoc_Environment * pEnv = m_pDocument->GetEnv();
2026 CFFL_IFormFiller* pIFormFiller = pEnv->GetIFormFiller(); 2026 CFFL_IFormFiller* pIFormFiller = pEnv->GetIFormFiller();
2027 2027
2028 CPDF_Page * pPage = pWidget->GetPDFPage(); 2028 CPDF_Page * pPage = pWidget->GetPDFPage();
2029 » » » CPDFSDK_PageView * pPageView = m_pDocument->GetPageView( pPage,FALSE); 2029 » » » CPDFSDK_PageView * pPageView = m_pDocument->GetPageView( pPage,false);
2030 2030
2031 FX_RECT rcBBox = pIFormFiller->GetViewBBox(pPageView, pW idget); 2031 FX_RECT rcBBox = pIFormFiller->GetViewBBox(pPageView, pW idget);
2032 2032
2033 pEnv->FFI_Invalidate(pPage,rcBBox.left, rcBBox.top, rcBB ox.right, rcBBox.bottom); 2033 pEnv->FFI_Invalidate(pPage,rcBBox.left, rcBBox.top, rcBB ox.right, rcBBox.bottom);
2034 } 2034 }
2035 } 2035 }
2036 } 2036 }
2037 2037
2038 void CPDFSDK_InterForm::OnKeyStrokeCommit(CPDF_FormField* pFormField, CFX_WideSt ring& csValue, FX_BOOL& bRC) 2038 void CPDFSDK_InterForm::OnKeyStrokeCommit(CPDF_FormField* pFormField, CFX_WideSt ring& csValue, bool& bRC)
2039 { 2039 {
2040 ASSERT(pFormField != NULL); 2040 ASSERT(pFormField != NULL);
2041 2041
2042 CPDF_AAction aAction = pFormField->GetAdditionalAction(); 2042 CPDF_AAction aAction = pFormField->GetAdditionalAction();
2043 if (aAction != NULL && aAction.ActionExist(CPDF_AAction::KeyStroke)) 2043 if (aAction != NULL && aAction.ActionExist(CPDF_AAction::KeyStroke))
2044 { 2044 {
2045 CPDF_Action action = aAction.GetAction(CPDF_AAction::KeyStroke); 2045 CPDF_Action action = aAction.GetAction(CPDF_AAction::KeyStroke);
2046 if (action) 2046 if (action)
2047 { 2047 {
2048 ASSERT(m_pDocument != NULL); 2048 ASSERT(m_pDocument != NULL);
2049 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); 2049 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv();
2050 ASSERT(pEnv != NULL); 2050 ASSERT(pEnv != NULL);
2051 2051
2052 CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionH ander(); 2052 CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionH ander();
2053 ASSERT(pActionHandler != NULL); 2053 ASSERT(pActionHandler != NULL);
2054 2054
2055 PDFSDK_FieldAction fa; 2055 PDFSDK_FieldAction fa;
2056 fa.bModifier = pEnv->FFI_IsCTRLKeyDown(0); 2056 fa.bModifier = pEnv->FFI_IsCTRLKeyDown(0);
2057 fa.bShift = pEnv->FFI_IsSHIFTKeyDown(0); 2057 fa.bShift = pEnv->FFI_IsSHIFTKeyDown(0);
2058 fa.sValue = csValue; 2058 fa.sValue = csValue;
2059 2059
2060 pActionHandler->DoAction_FieldJavaScript(action, CPDF_AA ction::KeyStroke, 2060 pActionHandler->DoAction_FieldJavaScript(action, CPDF_AA ction::KeyStroke,
2061 m_pDocument, pFormField, fa); 2061 m_pDocument, pFormField, fa);
2062 bRC = fa.bRC; 2062 bRC = fa.bRC;
2063 } 2063 }
2064 } 2064 }
2065 } 2065 }
2066 2066
2067 void CPDFSDK_InterForm::OnValidate(CPDF_FormField* pFormField, CFX_WideString& c sValue, FX_BOOL& bRC) 2067 void CPDFSDK_InterForm::OnValidate(CPDF_FormField* pFormField, CFX_WideString& c sValue, bool& bRC)
2068 { 2068 {
2069 ASSERT(pFormField != NULL); 2069 ASSERT(pFormField != NULL);
2070 2070
2071 CPDF_AAction aAction = pFormField->GetAdditionalAction(); 2071 CPDF_AAction aAction = pFormField->GetAdditionalAction();
2072 if (aAction != NULL && aAction.ActionExist(CPDF_AAction::Validate)) 2072 if (aAction != NULL && aAction.ActionExist(CPDF_AAction::Validate))
2073 { 2073 {
2074 CPDF_Action action = aAction.GetAction(CPDF_AAction::Validate); 2074 CPDF_Action action = aAction.GetAction(CPDF_AAction::Validate);
2075 if (action) 2075 if (action)
2076 { 2076 {
2077 ASSERT(m_pDocument != NULL); 2077 ASSERT(m_pDocument != NULL);
(...skipping 10 matching lines...) Expand all
2088 2088
2089 pActionHandler->DoAction_FieldJavaScript(action, CPDF_AA ction::Validate, m_pDocument, pFormField, fa); 2089 pActionHandler->DoAction_FieldJavaScript(action, CPDF_AA ction::Validate, m_pDocument, pFormField, fa);
2090 bRC = fa.bRC; 2090 bRC = fa.bRC;
2091 2091
2092 } 2092 }
2093 } 2093 }
2094 } 2094 }
2095 2095
2096 /* ----------------------------- action ----------------------------- */ 2096 /* ----------------------------- action ----------------------------- */
2097 2097
2098 FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) 2098 bool CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action)
2099 { 2099 {
2100 ASSERT(action); 2100 ASSERT(action);
2101 2101
2102 CPDF_ActionFields af = action.GetWidgets(); 2102 CPDF_ActionFields af = action.GetWidgets();
2103 CFX_PtrArray fieldObjects; 2103 CFX_PtrArray fieldObjects;
2104 af.GetAllFields(fieldObjects); 2104 af.GetAllFields(fieldObjects);
2105 CFX_PtrArray widgetArray; 2105 CFX_PtrArray widgetArray;
2106 CFX_PtrArray fields; 2106 CFX_PtrArray fields;
2107 GetFieldFromObjects(fieldObjects, fields); 2107 GetFieldFromObjects(fieldObjects, fields);
2108 2108
2109 » FX_BOOL bHide = action.GetHideStatus(); 2109 » bool bHide = action.GetHideStatus();
2110 2110
2111 » FX_BOOL bChanged = FALSE; 2111 » bool bChanged = false;
2112 2112
2113 for (int i=0, sz=fields.GetSize(); i<sz; i++) 2113 for (int i=0, sz=fields.GetSize(); i<sz; i++)
2114 { 2114 {
2115 CPDF_FormField* pField = (CPDF_FormField*)fields[i]; 2115 CPDF_FormField* pField = (CPDF_FormField*)fields[i];
2116 ASSERT(pField != NULL); 2116 ASSERT(pField != NULL);
2117 2117
2118 2118
2119 for (int j=0,jsz=pField->CountControls(); j<jsz; j++) 2119 for (int j=0,jsz=pField->CountControls(); j<jsz; j++)
2120 { 2120 {
2121 CPDF_FormControl* pControl = pField->GetControl(j); 2121 CPDF_FormControl* pControl = pField->GetControl(j);
(...skipping 14 matching lines...) Expand all
2136 nFlags &= (~ANNOTFLAG_HIDDEN); 2136 nFlags &= (~ANNOTFLAG_HIDDEN);
2137 nFlags &= (~ANNOTFLAG_NOVIEW); 2137 nFlags &= (~ANNOTFLAG_NOVIEW);
2138 } 2138 }
2139 pWidget->SetFlags(nFlags); 2139 pWidget->SetFlags(nFlags);
2140 2140
2141 CPDFSDK_PageView* pPageView = pWidget->GetPageVi ew(); 2141 CPDFSDK_PageView* pPageView = pWidget->GetPageVi ew();
2142 ASSERT(pPageView != NULL); 2142 ASSERT(pPageView != NULL);
2143 2143
2144 pPageView->UpdateView(pWidget); 2144 pPageView->UpdateView(pWidget);
2145 2145
2146 » » » » bChanged = TRUE; 2146 » » » » bChanged = true;
2147 } 2147 }
2148 } 2148 }
2149 } 2149 }
2150 2150
2151 return bChanged; 2151 return bChanged;
2152 } 2152 }
2153 2153
2154 FX_BOOL CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) 2154 bool CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action)
2155 { 2155 {
2156 ASSERT(action); 2156 ASSERT(action);
2157 ASSERT(m_pInterForm != NULL); 2157 ASSERT(m_pInterForm != NULL);
2158 2158
2159 CFX_WideString sDestination = action.GetFilePath(); 2159 CFX_WideString sDestination = action.GetFilePath();
2160 » if (sDestination.IsEmpty()) return FALSE; 2160 » if (sDestination.IsEmpty()) return false;
2161 2161
2162 CPDF_Dictionary* pActionDict = action.GetDict(); 2162 CPDF_Dictionary* pActionDict = action.GetDict();
2163 if (pActionDict->KeyExist("Fields")) 2163 if (pActionDict->KeyExist("Fields"))
2164 { 2164 {
2165 CPDF_ActionFields af = action.GetWidgets(); 2165 CPDF_ActionFields af = action.GetWidgets();
2166 FX_DWORD dwFlags = action.GetFlags(); 2166 FX_DWORD dwFlags = action.GetFlags();
2167 2167
2168 CFX_PtrArray fieldObjects; 2168 CFX_PtrArray fieldObjects;
2169 af.GetAllFields(fieldObjects); 2169 af.GetAllFields(fieldObjects);
2170 CFX_PtrArray fields; 2170 CFX_PtrArray fields;
2171 GetFieldFromObjects(fieldObjects, fields); 2171 GetFieldFromObjects(fieldObjects, fields);
2172 2172
2173 if (fields.GetSize() != 0) 2173 if (fields.GetSize() != 0)
2174 { 2174 {
2175 » » » FX_BOOL bIncludeOrExclude = !(dwFlags & 0x01); 2175 » » » bool bIncludeOrExclude = !(dwFlags & 0x01);
2176 if (m_pInterForm->CheckRequiredFields(&fields, bIncludeO rExclude)) 2176 if (m_pInterForm->CheckRequiredFields(&fields, bIncludeO rExclude))
2177 { 2177 {
2178 » » » » return FALSE; 2178 » » » » return false;
2179 } 2179 }
2180 » » » return SubmitFields(sDestination, fields, bIncludeOrExcl ude, FALSE); 2180 » » » return SubmitFields(sDestination, fields, bIncludeOrExcl ude, false);
2181 } 2181 }
2182 else 2182 else
2183 { 2183 {
2184 if ( m_pInterForm->CheckRequiredFields()) 2184 if ( m_pInterForm->CheckRequiredFields())
2185 { 2185 {
2186 » » » » return FALSE; 2186 » » » » return false;
2187 } 2187 }
2188 2188
2189 » » » return SubmitForm(sDestination, FALSE); 2189 » » » return SubmitForm(sDestination, false);
2190 } 2190 }
2191 } 2191 }
2192 else 2192 else
2193 { 2193 {
2194 if ( m_pInterForm->CheckRequiredFields()) 2194 if ( m_pInterForm->CheckRequiredFields())
2195 { 2195 {
2196 » » » return FALSE; 2196 » » » return false;
2197 } 2197 }
2198 2198
2199 » » return SubmitForm(sDestination, FALSE); 2199 » » return SubmitForm(sDestination, false);
2200 } 2200 }
2201 } 2201 }
2202 2202
2203 FX_BOOL CPDFSDK_InterForm::SubmitFields(const CFX_WideString& csDestination, con st CFX_PtrArray& fields, 2203 bool CPDFSDK_InterForm::SubmitFields(const CFX_WideString& csDestination, const CFX_PtrArray& fields,
2204 » » » » » » » » » FX_BOOL bIncludeOrExclude, FX_BOOL bUrlEncoded) 2204 » » » » » » » » » bool bIn cludeOrExclude, bool bUrlEncoded)
2205 { 2205 {
2206 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); 2206 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv();
2207 ASSERT(pEnv != NULL); 2207 ASSERT(pEnv != NULL);
2208 2208
2209 CFX_ByteTextBuf textBuf; 2209 CFX_ByteTextBuf textBuf;
2210 ExportFieldsToFDFTextBuf(fields, bIncludeOrExclude, textBuf); 2210 ExportFieldsToFDFTextBuf(fields, bIncludeOrExclude, textBuf);
2211 2211
2212 uint8_t* pBuffer = textBuf.GetBuffer(); 2212 uint8_t* pBuffer = textBuf.GetBuffer();
2213 FX_STRSIZE nBufSize = textBuf.GetLength(); 2213 FX_STRSIZE nBufSize = textBuf.GetLength();
2214 2214
2215 if (bUrlEncoded) 2215 if (bUrlEncoded)
2216 { 2216 {
2217 if(!FDFToURLEncodedData(pBuffer, nBufSize)) 2217 if(!FDFToURLEncodedData(pBuffer, nBufSize))
2218 » » » return FALSE; 2218 » » » return false;
2219 } 2219 }
2220 2220
2221 pEnv->JS_docSubmitForm(pBuffer, nBufSize, csDestination.c_str()); 2221 pEnv->JS_docSubmitForm(pBuffer, nBufSize, csDestination.c_str());
2222 2222
2223 » return TRUE; 2223 » return true;
2224 } 2224 }
2225 2225
2226 void CPDFSDK_InterForm::DoFDFBuffer(CFX_ByteString sBuffer) 2226 void CPDFSDK_InterForm::DoFDFBuffer(CFX_ByteString sBuffer)
2227 { 2227 {
2228 ASSERT(m_pDocument != NULL); 2228 ASSERT(m_pDocument != NULL);
2229 2229
2230 if (CFDF_Document *pFDFDocument = CFDF_Document::ParseMemory((const unsi gned char *)sBuffer.GetBuffer(sBuffer.GetLength()), sBuffer.GetLength())) 2230 if (CFDF_Document *pFDFDocument = CFDF_Document::ParseMemory((const unsi gned char *)sBuffer.GetBuffer(sBuffer.GetLength()), sBuffer.GetLength()))
2231 { 2231 {
2232 CPDF_Dictionary* pRootDic = pFDFDocument->GetRoot(); 2232 CPDF_Dictionary* pRootDic = pFDFDocument->GetRoot();
2233 if(pRootDic) 2233 if(pRootDic)
(...skipping 18 matching lines...) Expand all
2252 2252
2253 } 2253 }
2254 } 2254 }
2255 } 2255 }
2256 delete pFDFDocument; 2256 delete pFDFDocument;
2257 } 2257 }
2258 2258
2259 sBuffer.ReleaseBuffer(); 2259 sBuffer.ReleaseBuffer();
2260 } 2260 }
2261 2261
2262 FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(CFX_WideString csFDFFile, CFX_Wid eString csTxtFile) 2262 bool CPDFSDK_InterForm::FDFToURLEncodedData(CFX_WideString csFDFFile, CFX_WideSt ring csTxtFile)
2263 { 2263 {
2264 » return TRUE; 2264 » return true;
2265 } 2265 }
2266 2266
2267 FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf, FX_STRSIZE& nBufS ize) 2267 bool CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf, FX_STRSIZE& nBufSize )
2268 { 2268 {
2269 CFDF_Document* pFDF = CFDF_Document::ParseMemory(pBuf, nBufSize); 2269 CFDF_Document* pFDF = CFDF_Document::ParseMemory(pBuf, nBufSize);
2270 if (pFDF) 2270 if (pFDF)
2271 { 2271 {
2272 CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDict("FDF"); 2272 CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDict("FDF");
2273 » » if (pMainDict == NULL) return FALSE; 2273 » » if (pMainDict == NULL) return false;
2274 2274
2275 // Get fields 2275 // Get fields
2276 CPDF_Array* pFields = pMainDict->GetArray("Fields"); 2276 CPDF_Array* pFields = pMainDict->GetArray("Fields");
2277 » » if (pFields == NULL) return FALSE; 2277 » » if (pFields == NULL) return false;
2278 2278
2279 CFX_ByteTextBuf fdfEncodedData; 2279 CFX_ByteTextBuf fdfEncodedData;
2280 2280
2281 for (FX_DWORD i = 0; i < pFields->GetCount(); i ++) 2281 for (FX_DWORD i = 0; i < pFields->GetCount(); i ++)
2282 { 2282 {
2283 CPDF_Dictionary* pField = pFields->GetDict(i); 2283 CPDF_Dictionary* pField = pFields->GetDict(i);
2284 if (pField == NULL) continue; 2284 if (pField == NULL) continue;
2285 CFX_WideString name; 2285 CFX_WideString name;
2286 name = pField->GetUnicodeText("T"); 2286 name = pField->GetUnicodeText("T");
2287 CFX_ByteString name_b = CFX_ByteString::FromUnicode(name ); 2287 CFX_ByteString name_b = CFX_ByteString::FromUnicode(name );
2288 CFX_ByteString csBValue = pField->GetString("V"); 2288 CFX_ByteString csBValue = pField->GetString("V");
2289 CFX_WideString csWValue = PDF_DecodeText(csBValue); 2289 CFX_WideString csWValue = PDF_DecodeText(csBValue);
2290 CFX_ByteString csValue_b = CFX_ByteString::FromUnicode(c sWValue); 2290 CFX_ByteString csValue_b = CFX_ByteString::FromUnicode(c sWValue);
2291 2291
2292 fdfEncodedData = fdfEncodedData<<name_b.GetBuffer(name_b .GetLength()); 2292 fdfEncodedData = fdfEncodedData<<name_b.GetBuffer(name_b .GetLength());
2293 name_b.ReleaseBuffer(); 2293 name_b.ReleaseBuffer();
2294 fdfEncodedData = fdfEncodedData<<"="; 2294 fdfEncodedData = fdfEncodedData<<"=";
2295 fdfEncodedData = fdfEncodedData<<csValue_b.GetBuffer(csV alue_b.GetLength()); 2295 fdfEncodedData = fdfEncodedData<<csValue_b.GetBuffer(csV alue_b.GetLength());
2296 csValue_b.ReleaseBuffer(); 2296 csValue_b.ReleaseBuffer();
2297 if(i != pFields->GetCount()-1) 2297 if(i != pFields->GetCount()-1)
2298 fdfEncodedData = fdfEncodedData<<"&"; 2298 fdfEncodedData = fdfEncodedData<<"&";
2299 } 2299 }
2300 2300
2301 nBufSize = fdfEncodedData.GetLength(); 2301 nBufSize = fdfEncodedData.GetLength();
2302 pBuf = FX_Alloc(uint8_t, nBufSize); 2302 pBuf = FX_Alloc(uint8_t, nBufSize);
2303 FXSYS_memcpy(pBuf, fdfEncodedData.GetBuffer(), nBufSize); 2303 FXSYS_memcpy(pBuf, fdfEncodedData.GetBuffer(), nBufSize);
2304 } 2304 }
2305 » return TRUE; 2305 » return true;
2306 } 2306 }
2307 2307
2308 FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf(const CFX_PtrArray& fields,F X_BOOL bIncludeOrExclude, CFX_ByteTextBuf& textBuf) 2308 bool CPDFSDK_InterForm::ExportFieldsToFDFTextBuf(const CFX_PtrArray& fields,bool bIncludeOrExclude, CFX_ByteTextBuf& textBuf)
2309 { 2309 {
2310 ASSERT(m_pDocument != NULL); 2310 ASSERT(m_pDocument != NULL);
2311 ASSERT(m_pInterForm != NULL); 2311 ASSERT(m_pInterForm != NULL);
2312 2312
2313 CFDF_Document* pFDF = m_pInterForm->ExportToFDF(m_pDocument->GetPath(),( CFX_PtrArray&)fields, bIncludeOrExclude); 2313 CFDF_Document* pFDF = m_pInterForm->ExportToFDF(m_pDocument->GetPath(),( CFX_PtrArray&)fields, bIncludeOrExclude);
2314 » if (!pFDF) return FALSE; 2314 » if (!pFDF) return false;
2315 » FX_BOOL bRet = pFDF->WriteBuf(textBuf); // = FALSE;// 2315 » bool bRet = pFDF->WriteBuf(textBuf); // = false;//
2316 delete pFDF; 2316 delete pFDF;
2317 2317
2318 return bRet; 2318 return bRet;
2319 } 2319 }
2320 2320
2321 CFX_WideString CPDFSDK_InterForm::GetTemporaryFileName(const CFX_WideString& sFi leExt) 2321 CFX_WideString CPDFSDK_InterForm::GetTemporaryFileName(const CFX_WideString& sFi leExt)
2322 { 2322 {
2323 CFX_WideString sFileName; 2323 CFX_WideString sFileName;
2324 return L""; 2324 return L"";
2325 } 2325 }
2326 2326
2327 FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, FX_BOO L bUrlEncoded) 2327 bool CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, bool bUrl Encoded)
2328 { 2328 {
2329 » if (sDestination.IsEmpty()) return FALSE; 2329 » if (sDestination.IsEmpty()) return false;
2330 2330
2331 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); 2331 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv();
2332 ASSERT(pEnv != NULL); 2332 ASSERT(pEnv != NULL);
2333 2333
2334 » if(NULL == m_pDocument) return FALSE; 2334 » if(NULL == m_pDocument) return false;
2335 CFX_WideString wsPDFFilePath = m_pDocument->GetPath(); 2335 CFX_WideString wsPDFFilePath = m_pDocument->GetPath();
2336 2336
2337 » if(NULL == m_pInterForm) return FALSE; 2337 » if(NULL == m_pInterForm) return false;
2338 CFDF_Document* pFDFDoc = m_pInterForm->ExportToFDF(wsPDFFilePath); 2338 CFDF_Document* pFDFDoc = m_pInterForm->ExportToFDF(wsPDFFilePath);
2339 » if (NULL == pFDFDoc) return FALSE; 2339 » if (NULL == pFDFDoc) return false;
2340 2340
2341 CFX_ByteTextBuf FdfBuffer; 2341 CFX_ByteTextBuf FdfBuffer;
2342 » FX_BOOL bRet = pFDFDoc->WriteBuf(FdfBuffer); 2342 » bool bRet = pFDFDoc->WriteBuf(FdfBuffer);
2343 delete pFDFDoc; 2343 delete pFDFDoc;
2344 » if (!bRet) return FALSE; 2344 » if (!bRet) return false;
2345 2345
2346 uint8_t* pBuffer = FdfBuffer.GetBuffer(); 2346 uint8_t* pBuffer = FdfBuffer.GetBuffer();
2347 FX_STRSIZE nBufSize = FdfBuffer.GetLength(); 2347 FX_STRSIZE nBufSize = FdfBuffer.GetLength();
2348 2348
2349 if (bUrlEncoded) 2349 if (bUrlEncoded)
2350 { 2350 {
2351 if(!FDFToURLEncodedData(pBuffer, nBufSize)) 2351 if(!FDFToURLEncodedData(pBuffer, nBufSize))
2352 » » » return FALSE; 2352 » » » return false;
2353 } 2353 }
2354 2354
2355 pEnv->JS_docSubmitForm(pBuffer, nBufSize, sDestination.c_str()); 2355 pEnv->JS_docSubmitForm(pBuffer, nBufSize, sDestination.c_str());
2356 2356
2357 if (bUrlEncoded && pBuffer) 2357 if (bUrlEncoded && pBuffer)
2358 { 2358 {
2359 FX_Free(pBuffer); 2359 FX_Free(pBuffer);
2360 pBuffer = NULL; 2360 pBuffer = NULL;
2361 } 2361 }
2362 2362
2363 » return TRUE; 2363 » return true;
2364 } 2364 }
2365 2365
2366 FX_BOOL CPDFSDK_InterForm::ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf) 2366 bool CPDFSDK_InterForm::ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf)
2367 { 2367 {
2368 2368
2369 ASSERT(m_pInterForm != NULL); 2369 ASSERT(m_pInterForm != NULL);
2370 ASSERT(m_pDocument != NULL); 2370 ASSERT(m_pDocument != NULL);
2371 2371
2372 CFDF_Document* pFDF = m_pInterForm->ExportToFDF(m_pDocument->GetPath()); 2372 CFDF_Document* pFDF = m_pInterForm->ExportToFDF(m_pDocument->GetPath());
2373 » if (!pFDF) return FALSE; 2373 » if (!pFDF) return false;
2374 2374
2375 » FX_BOOL bRet = pFDF->WriteBuf(textBuf); 2375 » bool bRet = pFDF->WriteBuf(textBuf);
2376 delete pFDF; 2376 delete pFDF;
2377 2377
2378 return bRet; 2378 return bRet;
2379 } 2379 }
2380 2380
2381 2381
2382 FX_BOOL CPDFSDK_InterForm::DoAction_ResetForm(const CPDF_Action& action) 2382 bool CPDFSDK_InterForm::DoAction_ResetForm(const CPDF_Action& action)
2383 { 2383 {
2384 ASSERT(action); 2384 ASSERT(action);
2385 2385
2386 CPDF_Dictionary* pActionDict = action.GetDict(); 2386 CPDF_Dictionary* pActionDict = action.GetDict();
2387 if (pActionDict->KeyExist("Fields")) 2387 if (pActionDict->KeyExist("Fields"))
2388 { 2388 {
2389 CPDF_ActionFields af = action.GetWidgets(); 2389 CPDF_ActionFields af = action.GetWidgets();
2390 FX_DWORD dwFlags = action.GetFlags(); 2390 FX_DWORD dwFlags = action.GetFlags();
2391 2391
2392 CFX_PtrArray fieldObjects; 2392 CFX_PtrArray fieldObjects;
2393 af.GetAllFields(fieldObjects); 2393 af.GetAllFields(fieldObjects);
2394 CFX_PtrArray fields; 2394 CFX_PtrArray fields;
2395 GetFieldFromObjects(fieldObjects, fields); 2395 GetFieldFromObjects(fieldObjects, fields);
2396 » » return m_pInterForm->ResetForm(fields, !(dwFlags & 0x01), TRUE); 2396 » » return m_pInterForm->ResetForm(fields, !(dwFlags & 0x01), true);
2397 } 2397 }
2398 2398
2399 » return m_pInterForm->ResetForm(TRUE); 2399 » return m_pInterForm->ResetForm(true);
2400 } 2400 }
2401 2401
2402 FX_BOOL CPDFSDK_InterForm::DoAction_ImportData(const CPDF_Action& action) 2402 bool CPDFSDK_InterForm::DoAction_ImportData(const CPDF_Action& action)
2403 { 2403 {
2404 » return FALSE; 2404 » return false;
2405 } 2405 }
2406 2406
2407 void CPDFSDK_InterForm::GetFieldFromObjects(const CFX_PtrArray& objects, CFX_Ptr Array& fields) 2407 void CPDFSDK_InterForm::GetFieldFromObjects(const CFX_PtrArray& objects, CFX_Ptr Array& fields)
2408 { 2408 {
2409 ASSERT(m_pInterForm != NULL); 2409 ASSERT(m_pInterForm != NULL);
2410 2410
2411 int iCount = objects.GetSize(); 2411 int iCount = objects.GetSize();
2412 for (int i = 0; i < iCount; i ++) 2412 for (int i = 0; i < iCount; i ++)
2413 { 2413 {
2414 CPDF_Object* pObject = (CPDF_Object*)objects[i]; 2414 CPDF_Object* pObject = (CPDF_Object*)objects[i];
(...skipping 19 matching lines...) Expand all
2434 2434
2435 int CPDFSDK_InterForm::BeforeValueChange(const CPDF_FormField* pField, CFX_W ideString& csValue) 2435 int CPDFSDK_InterForm::BeforeValueChange(const CPDF_FormField* pField, CFX_W ideString& csValue)
2436 { 2436 {
2437 ASSERT(pField != NULL); 2437 ASSERT(pField != NULL);
2438 2438
2439 CPDF_FormField* pFormField = (CPDF_FormField*)pField; 2439 CPDF_FormField* pFormField = (CPDF_FormField*)pField;
2440 2440
2441 int nType = pFormField->GetFieldType(); 2441 int nType = pFormField->GetFieldType();
2442 if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD) 2442 if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD)
2443 { 2443 {
2444 » » FX_BOOL bRC = TRUE; 2444 » » bool bRC = true;
2445 OnKeyStrokeCommit(pFormField, csValue, bRC); 2445 OnKeyStrokeCommit(pFormField, csValue, bRC);
2446 if (bRC) 2446 if (bRC)
2447 { 2447 {
2448 OnValidate(pFormField, csValue, bRC); 2448 OnValidate(pFormField, csValue, bRC);
2449 if (bRC) 2449 if (bRC)
2450 return 1; 2450 return 1;
2451 else 2451 else
2452 return -1; 2452 return -1;
2453 } 2453 }
2454 else 2454 else
2455 return -1; 2455 return -1;
2456 } 2456 }
2457 else 2457 else
2458 return 0; 2458 return 0;
2459 } 2459 }
2460 2460
2461 int CPDFSDK_InterForm::AfterValueChange(const CPDF_FormField* pField) 2461 int CPDFSDK_InterForm::AfterValueChange(const CPDF_FormField* pField)
2462 { 2462 {
2463 ASSERT(pField != NULL); 2463 ASSERT(pField != NULL);
2464 2464
2465 CPDF_FormField* pFormField = (CPDF_FormField*)pField; 2465 CPDF_FormField* pFormField = (CPDF_FormField*)pField;
2466 int nType = pFormField->GetFieldType(); 2466 int nType = pFormField->GetFieldType();
2467 2467
2468 if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD) 2468 if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD)
2469 { 2469 {
2470 OnCalculate(pFormField); 2470 OnCalculate(pFormField);
2471 » » FX_BOOL bFormated = FALSE; 2471 » » bool bFormated = false;
2472 CFX_WideString sValue = OnFormat(pFormField, bFormated); 2472 CFX_WideString sValue = OnFormat(pFormField, bFormated);
2473 if (bFormated) 2473 if (bFormated)
2474 » » » ResetFieldAppearance(pFormField, sValue.c_str(), TRUE); 2474 » » » ResetFieldAppearance(pFormField, sValue.c_str(), true);
2475 else 2475 else
2476 » » » ResetFieldAppearance(pFormField, NULL, TRUE); 2476 » » » ResetFieldAppearance(pFormField, NULL, true);
2477 UpdateField(pFormField); 2477 UpdateField(pFormField);
2478 } 2478 }
2479 2479
2480 return 0; 2480 return 0;
2481 } 2481 }
2482 2482
2483 int CPDFSDK_InterForm::BeforeSelectionChange(const CPDF_FormField* pField, C FX_WideString& csValue) 2483 int CPDFSDK_InterForm::BeforeSelectionChange(const CPDF_FormField* pField, C FX_WideString& csValue)
2484 { 2484 {
2485 ASSERT(pField != NULL); 2485 ASSERT(pField != NULL);
2486 2486
2487 CPDF_FormField* pFormField = (CPDF_FormField*)pField; 2487 CPDF_FormField* pFormField = (CPDF_FormField*)pField;
2488 2488
2489 int nType = pFormField->GetFieldType(); 2489 int nType = pFormField->GetFieldType();
2490 if (nType == FIELDTYPE_LISTBOX) 2490 if (nType == FIELDTYPE_LISTBOX)
2491 { 2491 {
2492 » » FX_BOOL bRC = TRUE; 2492 » » bool bRC = true;
2493 OnKeyStrokeCommit(pFormField, csValue, bRC); 2493 OnKeyStrokeCommit(pFormField, csValue, bRC);
2494 if (bRC) 2494 if (bRC)
2495 { 2495 {
2496 OnValidate(pFormField, csValue, bRC); 2496 OnValidate(pFormField, csValue, bRC);
2497 if (bRC) 2497 if (bRC)
2498 return 1; 2498 return 1;
2499 else 2499 else
2500 return -1; 2500 return -1;
2501 } 2501 }
2502 else 2502 else
2503 return -1; 2503 return -1;
2504 } 2504 }
2505 else 2505 else
2506 return 0; 2506 return 0;
2507 } 2507 }
2508 2508
2509 int CPDFSDK_InterForm::AfterSelectionChange(const CPDF_FormField* pField) 2509 int CPDFSDK_InterForm::AfterSelectionChange(const CPDF_FormField* pField)
2510 { 2510 {
2511 ASSERT(pField != NULL); 2511 ASSERT(pField != NULL);
2512 2512
2513 CPDF_FormField* pFormField = (CPDF_FormField*)pField; 2513 CPDF_FormField* pFormField = (CPDF_FormField*)pField;
2514 int nType = pFormField->GetFieldType(); 2514 int nType = pFormField->GetFieldType();
2515 2515
2516 if (nType == FIELDTYPE_LISTBOX) 2516 if (nType == FIELDTYPE_LISTBOX)
2517 { 2517 {
2518 OnCalculate(pFormField); 2518 OnCalculate(pFormField);
2519 » » ResetFieldAppearance(pFormField, NULL, TRUE); 2519 » » ResetFieldAppearance(pFormField, NULL, true);
2520 UpdateField(pFormField); 2520 UpdateField(pFormField);
2521 } 2521 }
2522 2522
2523 return 0; 2523 return 0;
2524 } 2524 }
2525 2525
2526 int CPDFSDK_InterForm::AfterCheckedStatusChange(const CPDF_FormField* pField , const CFX_ByteArray& statusArray) 2526 int CPDFSDK_InterForm::AfterCheckedStatusChange(const CPDF_FormField* pField , const CFX_ByteArray& statusArray)
2527 { 2527 {
2528 ASSERT(pField != NULL); 2528 ASSERT(pField != NULL);
2529 2529
(...skipping 24 matching lines...) Expand all
2554 { 2554 {
2555 return 0; 2555 return 0;
2556 } 2556 }
2557 2557
2558 int CPDFSDK_InterForm::AfterFormImportData(const CPDF_InterForm* pForm) 2558 int CPDFSDK_InterForm::AfterFormImportData(const CPDF_InterForm* pForm)
2559 { 2559 {
2560 OnCalculate(nullptr); 2560 OnCalculate(nullptr);
2561 return 0; 2561 return 0;
2562 } 2562 }
2563 2563
2564 FX_BOOL CPDFSDK_InterForm::IsNeedHighLight(int nFieldType) 2564 bool CPDFSDK_InterForm::IsNeedHighLight(int nFieldType)
2565 { 2565 {
2566 if(nFieldType <1 || nFieldType > 6) 2566 if(nFieldType <1 || nFieldType > 6)
2567 » » return FALSE; 2567 » » return false;
2568 return m_bNeedHightlight[nFieldType-1]; 2568 return m_bNeedHightlight[nFieldType-1];
2569 } 2569 }
2570 2570
2571 void CPDFSDK_InterForm::RemoveAllHighLight() 2571 void CPDFSDK_InterForm::RemoveAllHighLight()
2572 { 2572 {
2573 » memset((void*)m_bNeedHightlight, 0, 6*sizeof(FX_BOOL)); 2573 » memset((void*)m_bNeedHightlight, 0, 6*sizeof(bool));
2574 } 2574 }
2575 void CPDFSDK_InterForm::SetHighlightColor(FX_COLORREF clr, int nFieldType) 2575 void CPDFSDK_InterForm::SetHighlightColor(FX_COLORREF clr, int nFieldType)
2576 { 2576 {
2577 if(nFieldType <0 || nFieldType > 6) return; 2577 if(nFieldType <0 || nFieldType > 6) return;
2578 switch(nFieldType) 2578 switch(nFieldType)
2579 { 2579 {
2580 case 0: 2580 case 0:
2581 { 2581 {
2582 for(int i=0; i<6; i++) 2582 for(int i=0; i<6; i++)
2583 { 2583 {
2584 m_aHighlightColor[i] = clr; 2584 m_aHighlightColor[i] = clr;
2585 » » » » m_bNeedHightlight[i] = TRUE; 2585 » » » » m_bNeedHightlight[i] = true;
2586 } 2586 }
2587 break; 2587 break;
2588 } 2588 }
2589 default: 2589 default:
2590 { 2590 {
2591 m_aHighlightColor[nFieldType-1] = clr; 2591 m_aHighlightColor[nFieldType-1] = clr;
2592 » » » m_bNeedHightlight[nFieldType-1] = TRUE; 2592 » » » m_bNeedHightlight[nFieldType-1] = true;
2593 break; 2593 break;
2594 } 2594 }
2595 } 2595 }
2596 2596
2597 } 2597 }
2598 2598
2599 FX_COLORREF CPDFSDK_InterForm::GetHighlightColor(int nFieldType) 2599 FX_COLORREF CPDFSDK_InterForm::GetHighlightColor(int nFieldType)
2600 { 2600 {
2601 if(nFieldType <0 || nFieldType >6) return FXSYS_RGB(255,255,255); 2601 if(nFieldType <0 || nFieldType >6) return FXSYS_RGB(255,255,255);
2602 if(nFieldType == 0) 2602 if(nFieldType == 0)
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
2842 ASSERT(pAnnot != NULL); 2842 ASSERT(pAnnot != NULL);
2843 2843
2844 if (pAnnot->GetType() == m_sType 2844 if (pAnnot->GetType() == m_sType
2845 && pAnnot->GetSubType() == m_sSu bType) 2845 && pAnnot->GetSubType() == m_sSu bType)
2846 sa.Add(pAnnot); 2846 sa.Add(pAnnot);
2847 } 2847 }
2848 } 2848 }
2849 2849
2850 if (sa.GetSize() > 0) 2850 if (sa.GetSize() > 0)
2851 { 2851 {
2852 » » » » sa.Sort(CBA_AnnotIterator::CompareByTop, FALSE); 2852 » » » » sa.Sort(CBA_AnnotIterator::CompareByTop, false);
2853 } 2853 }
2854 2854
2855 while (sa.GetSize() > 0) 2855 while (sa.GetSize() > 0)
2856 { 2856 {
2857 int nLeftTopIndex = -1; 2857 int nLeftTopIndex = -1;
2858 2858
2859 { 2859 {
2860 FX_FLOAT fLeft = -1.0f; 2860 FX_FLOAT fLeft = -1.0f;
2861 2861
2862 for (int i=sa.GetSize()-1; i>=0; i--) 2862 for (int i=sa.GetSize()-1; i>=0; i--)
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
2935 2935
2936 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); 2936 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
2937 ASSERT(pPDFAnnot != NULL); 2937 ASSERT(pPDFAnnot != NULL);
2938 2938
2939 CPDF_Rect rcAnnot; 2939 CPDF_Rect rcAnnot;
2940 pPDFAnnot->GetRect(rcAnnot); 2940 pPDFAnnot->GetRect(rcAnnot);
2941 2941
2942 return rcAnnot; 2942 return rcAnnot;
2943 } 2943 }
2944 2944
OLDNEW
« no previous file with comments | « fpdfsdk/src/fsdk_baseannot.cpp ('k') | fpdfsdk/src/fsdk_mgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698