OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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 "fpdfsdk/cpdfsdk_widget.h" | 7 #include "fpdfsdk/cpdfsdk_widget.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 break; | 132 break; |
133 case PDFSDK_XFA_PostOpen: | 133 case PDFSDK_XFA_PostOpen: |
134 eEventType = XFA_EVENT_PostOpen; | 134 eEventType = XFA_EVENT_PostOpen; |
135 break; | 135 break; |
136 } | 136 } |
137 | 137 |
138 return eEventType; | 138 return eEventType; |
139 } | 139 } |
140 | 140 |
141 static XFA_EVENTTYPE GetXFAEventType(CPDF_AAction::AActionType eAAT, | 141 static XFA_EVENTTYPE GetXFAEventType(CPDF_AAction::AActionType eAAT, |
142 FX_BOOL bWillCommit) { | 142 bool bWillCommit) { |
143 XFA_EVENTTYPE eEventType = XFA_EVENT_Unknown; | 143 XFA_EVENTTYPE eEventType = XFA_EVENT_Unknown; |
144 | 144 |
145 switch (eAAT) { | 145 switch (eAAT) { |
146 case CPDF_AAction::CursorEnter: | 146 case CPDF_AAction::CursorEnter: |
147 eEventType = XFA_EVENT_MouseEnter; | 147 eEventType = XFA_EVENT_MouseEnter; |
148 break; | 148 break; |
149 case CPDF_AAction::CursorExit: | 149 case CPDF_AAction::CursorExit: |
150 eEventType = XFA_EVENT_MouseExit; | 150 eEventType = XFA_EVENT_MouseExit; |
151 break; | 151 break; |
152 case CPDF_AAction::ButtonDown: | 152 case CPDF_AAction::ButtonDown: |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 case CPDF_AAction::SaveDocument: | 184 case CPDF_AAction::SaveDocument: |
185 case CPDF_AAction::DocumentSaved: | 185 case CPDF_AAction::DocumentSaved: |
186 case CPDF_AAction::PrintDocument: | 186 case CPDF_AAction::PrintDocument: |
187 case CPDF_AAction::DocumentPrinted: | 187 case CPDF_AAction::DocumentPrinted: |
188 break; | 188 break; |
189 } | 189 } |
190 | 190 |
191 return eEventType; | 191 return eEventType; |
192 } | 192 } |
193 | 193 |
194 FX_BOOL CPDFSDK_Widget::HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT) { | 194 bool CPDFSDK_Widget::HasXFAAAction(PDFSDK_XFAAActionType eXFAAAT) { |
195 CXFA_FFWidget* hWidget = GetMixXFAWidget(); | 195 CXFA_FFWidget* hWidget = GetMixXFAWidget(); |
196 if (!hWidget) | 196 if (!hWidget) |
197 return FALSE; | 197 return false; |
198 | 198 |
199 CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler(); | 199 CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler(); |
200 if (!pXFAWidgetHandler) | 200 if (!pXFAWidgetHandler) |
201 return FALSE; | 201 return false; |
202 | 202 |
203 XFA_EVENTTYPE eEventType = GetXFAEventType(eXFAAAT); | 203 XFA_EVENTTYPE eEventType = GetXFAEventType(eXFAAAT); |
204 | 204 |
205 CXFA_WidgetAcc* pAcc; | 205 CXFA_WidgetAcc* pAcc; |
206 if ((eEventType == XFA_EVENT_Click || eEventType == XFA_EVENT_Change) && | 206 if ((eEventType == XFA_EVENT_Click || eEventType == XFA_EVENT_Change) && |
207 GetFieldType() == FIELDTYPE_RADIOBUTTON) { | 207 GetFieldType() == FIELDTYPE_RADIOBUTTON) { |
208 if (CXFA_FFWidget* hGroupWidget = GetGroupMixXFAWidget()) { | 208 if (CXFA_FFWidget* hGroupWidget = GetGroupMixXFAWidget()) { |
209 pAcc = hGroupWidget->GetDataAcc(); | 209 pAcc = hGroupWidget->GetDataAcc(); |
210 if (pXFAWidgetHandler->HasEvent(pAcc, eEventType)) | 210 if (pXFAWidgetHandler->HasEvent(pAcc, eEventType)) |
211 return TRUE; | 211 return true; |
212 } | 212 } |
213 } | 213 } |
214 | 214 |
215 pAcc = hWidget->GetDataAcc(); | 215 pAcc = hWidget->GetDataAcc(); |
216 return pXFAWidgetHandler->HasEvent(pAcc, eEventType); | 216 return pXFAWidgetHandler->HasEvent(pAcc, eEventType); |
217 } | 217 } |
218 | 218 |
219 FX_BOOL CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, | 219 bool CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT, |
220 PDFSDK_FieldAction& data, | 220 PDFSDK_FieldAction& data, |
221 CPDFSDK_PageView* pPageView) { | 221 CPDFSDK_PageView* pPageView) { |
222 CPDFXFA_Context* pContext = m_pPageView->GetFormFillEnv()->GetXFAContext(); | 222 CPDFXFA_Context* pContext = m_pPageView->GetFormFillEnv()->GetXFAContext(); |
223 | 223 |
224 CXFA_FFWidget* hWidget = GetMixXFAWidget(); | 224 CXFA_FFWidget* hWidget = GetMixXFAWidget(); |
225 if (!hWidget) | 225 if (!hWidget) |
226 return FALSE; | 226 return false; |
227 | 227 |
228 XFA_EVENTTYPE eEventType = GetXFAEventType(eXFAAAT); | 228 XFA_EVENTTYPE eEventType = GetXFAEventType(eXFAAAT); |
229 if (eEventType == XFA_EVENT_Unknown) | 229 if (eEventType == XFA_EVENT_Unknown) |
230 return FALSE; | 230 return false; |
231 | 231 |
232 CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler(); | 232 CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler(); |
233 if (!pXFAWidgetHandler) | 233 if (!pXFAWidgetHandler) |
234 return FALSE; | 234 return false; |
235 | 235 |
236 CXFA_EventParam param; | 236 CXFA_EventParam param; |
237 param.m_eType = eEventType; | 237 param.m_eType = eEventType; |
238 param.m_wsChange = data.sChange; | 238 param.m_wsChange = data.sChange; |
239 param.m_iCommitKey = data.nCommitKey; | 239 param.m_iCommitKey = data.nCommitKey; |
240 param.m_bShift = data.bShift; | 240 param.m_bShift = data.bShift; |
241 param.m_iSelStart = data.nSelStart; | 241 param.m_iSelStart = data.nSelStart; |
242 param.m_iSelEnd = data.nSelEnd; | 242 param.m_iSelEnd = data.nSelEnd; |
243 param.m_wsFullText = data.sValue; | 243 param.m_wsFullText = data.sValue; |
244 param.m_bKeyDown = data.bKeyDown; | 244 param.m_bKeyDown = data.bKeyDown; |
245 param.m_bModifier = data.bModifier; | 245 param.m_bModifier = data.bModifier; |
246 param.m_wsNewText = data.sValue; | 246 param.m_wsNewText = data.sValue; |
247 if (data.nSelEnd > data.nSelStart) | 247 if (data.nSelEnd > data.nSelStart) |
248 param.m_wsNewText.Delete(data.nSelStart, data.nSelEnd - data.nSelStart); | 248 param.m_wsNewText.Delete(data.nSelStart, data.nSelEnd - data.nSelStart); |
249 | 249 |
250 for (int i = 0; i < data.sChange.GetLength(); i++) | 250 for (int i = 0; i < data.sChange.GetLength(); i++) |
251 param.m_wsNewText.Insert(data.nSelStart, data.sChange[i]); | 251 param.m_wsNewText.Insert(data.nSelStart, data.sChange[i]); |
252 param.m_wsPrevText = data.sValue; | 252 param.m_wsPrevText = data.sValue; |
253 | 253 |
254 if ((eEventType == XFA_EVENT_Click || eEventType == XFA_EVENT_Change) && | 254 if ((eEventType == XFA_EVENT_Click || eEventType == XFA_EVENT_Change) && |
255 GetFieldType() == FIELDTYPE_RADIOBUTTON) { | 255 GetFieldType() == FIELDTYPE_RADIOBUTTON) { |
256 if (CXFA_FFWidget* hGroupWidget = GetGroupMixXFAWidget()) { | 256 if (CXFA_FFWidget* hGroupWidget = GetGroupMixXFAWidget()) { |
257 CXFA_WidgetAcc* pAcc = hGroupWidget->GetDataAcc(); | 257 CXFA_WidgetAcc* pAcc = hGroupWidget->GetDataAcc(); |
258 param.m_pTarget = pAcc; | 258 param.m_pTarget = pAcc; |
259 if (pXFAWidgetHandler->ProcessEvent(pAcc, ¶m) != | 259 if (pXFAWidgetHandler->ProcessEvent(pAcc, ¶m) != |
260 XFA_EVENTERROR_Success) { | 260 XFA_EVENTERROR_Success) { |
261 return FALSE; | 261 return false; |
262 } | 262 } |
263 } | 263 } |
264 } | 264 } |
265 CXFA_WidgetAcc* pAcc = hWidget->GetDataAcc(); | 265 CXFA_WidgetAcc* pAcc = hWidget->GetDataAcc(); |
266 param.m_pTarget = pAcc; | 266 param.m_pTarget = pAcc; |
267 int32_t nRet = pXFAWidgetHandler->ProcessEvent(pAcc, ¶m); | 267 int32_t nRet = pXFAWidgetHandler->ProcessEvent(pAcc, ¶m); |
268 | 268 |
269 if (CXFA_FFDocView* pDocView = pContext->GetXFADocView()) | 269 if (CXFA_FFDocView* pDocView = pContext->GetXFADocView()) |
270 pDocView->UpdateDocView(); | 270 pDocView->UpdateDocView(); |
271 | 271 |
272 return nRet == XFA_EVENTERROR_Success; | 272 return nRet == XFA_EVENTERROR_Success; |
273 } | 273 } |
274 | 274 |
275 void CPDFSDK_Widget::Synchronize(FX_BOOL bSynchronizeElse) { | 275 void CPDFSDK_Widget::Synchronize(bool bSynchronizeElse) { |
276 CXFA_FFWidget* hWidget = GetMixXFAWidget(); | 276 CXFA_FFWidget* hWidget = GetMixXFAWidget(); |
277 if (!hWidget) | 277 if (!hWidget) |
278 return; | 278 return; |
279 | 279 |
280 CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc(); | 280 CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc(); |
281 if (!pWidgetAcc) | 281 if (!pWidgetAcc) |
282 return; | 282 return; |
283 | 283 |
284 CPDF_FormField* pFormField = GetFormField(); | 284 CPDF_FormField* pFormField = GetFormField(); |
285 switch (GetFieldType()) { | 285 switch (GetFieldType()) { |
286 case FIELDTYPE_CHECKBOX: | 286 case FIELDTYPE_CHECKBOX: |
287 case FIELDTYPE_RADIOBUTTON: { | 287 case FIELDTYPE_RADIOBUTTON: { |
288 CPDF_FormControl* pFormCtrl = GetFormControl(); | 288 CPDF_FormControl* pFormCtrl = GetFormControl(); |
289 XFA_CHECKSTATE eCheckState = | 289 XFA_CHECKSTATE eCheckState = |
290 pFormCtrl->IsChecked() ? XFA_CHECKSTATE_On : XFA_CHECKSTATE_Off; | 290 pFormCtrl->IsChecked() ? XFA_CHECKSTATE_On : XFA_CHECKSTATE_Off; |
291 pWidgetAcc->SetCheckState(eCheckState, true); | 291 pWidgetAcc->SetCheckState(eCheckState, true); |
292 break; | 292 break; |
293 } | 293 } |
294 case FIELDTYPE_TEXTFIELD: | 294 case FIELDTYPE_TEXTFIELD: |
295 pWidgetAcc->SetValue(pFormField->GetValue(), XFA_VALUEPICTURE_Edit); | 295 pWidgetAcc->SetValue(pFormField->GetValue(), XFA_VALUEPICTURE_Edit); |
296 break; | 296 break; |
297 case FIELDTYPE_LISTBOX: { | 297 case FIELDTYPE_LISTBOX: { |
298 pWidgetAcc->ClearAllSelections(); | 298 pWidgetAcc->ClearAllSelections(); |
299 | 299 |
300 for (int i = 0, sz = pFormField->CountSelectedItems(); i < sz; i++) { | 300 for (int i = 0, sz = pFormField->CountSelectedItems(); i < sz; i++) { |
301 int nIndex = pFormField->GetSelectedIndex(i); | 301 int nIndex = pFormField->GetSelectedIndex(i); |
302 if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems()) | 302 if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems()) |
303 pWidgetAcc->SetItemState(nIndex, TRUE, false, FALSE, TRUE); | 303 pWidgetAcc->SetItemState(nIndex, true, false, false, true); |
304 } | 304 } |
305 break; | 305 break; |
306 } | 306 } |
307 case FIELDTYPE_COMBOBOX: { | 307 case FIELDTYPE_COMBOBOX: { |
308 pWidgetAcc->ClearAllSelections(); | 308 pWidgetAcc->ClearAllSelections(); |
309 | 309 |
310 for (int i = 0, sz = pFormField->CountSelectedItems(); i < sz; i++) { | 310 for (int i = 0, sz = pFormField->CountSelectedItems(); i < sz; i++) { |
311 int nIndex = pFormField->GetSelectedIndex(i); | 311 int nIndex = pFormField->GetSelectedIndex(i); |
312 if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems()) | 312 if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems()) |
313 pWidgetAcc->SetItemState(nIndex, TRUE, false, FALSE, TRUE); | 313 pWidgetAcc->SetItemState(nIndex, true, false, false, true); |
314 } | 314 } |
315 pWidgetAcc->SetValue(pFormField->GetValue(), XFA_VALUEPICTURE_Edit); | 315 pWidgetAcc->SetValue(pFormField->GetValue(), XFA_VALUEPICTURE_Edit); |
316 break; | 316 break; |
317 } | 317 } |
318 } | 318 } |
319 | 319 |
320 if (bSynchronizeElse) | 320 if (bSynchronizeElse) |
321 pWidgetAcc->ProcessValueChanged(); | 321 pWidgetAcc->ProcessValueChanged(); |
322 } | 322 } |
323 | 323 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 pFormField->CheckControl( | 370 pFormField->CheckControl( |
371 pFormField->GetControlIndex(pFormControl), | 371 pFormField->GetControlIndex(pFormControl), |
372 pWidgetAcc->GetCheckState() == XFA_CHECKSTATE_On, true); | 372 pWidgetAcc->GetCheckState() == XFA_CHECKSTATE_On, true); |
373 } | 373 } |
374 break; | 374 break; |
375 } | 375 } |
376 case FIELDTYPE_TEXTFIELD: { | 376 case FIELDTYPE_TEXTFIELD: { |
377 if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { | 377 if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { |
378 CFX_WideString sValue; | 378 CFX_WideString sValue; |
379 pWidgetAcc->GetValue(sValue, XFA_VALUEPICTURE_Display); | 379 pWidgetAcc->GetValue(sValue, XFA_VALUEPICTURE_Display); |
380 pFormField->SetValue(sValue, TRUE); | 380 pFormField->SetValue(sValue, true); |
381 } | 381 } |
382 break; | 382 break; |
383 } | 383 } |
384 case FIELDTYPE_LISTBOX: { | 384 case FIELDTYPE_LISTBOX: { |
385 pFormField->ClearSelection(FALSE); | 385 pFormField->ClearSelection(false); |
386 | 386 |
387 if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { | 387 if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { |
388 for (int i = 0, sz = pWidgetAcc->CountSelectedItems(); i < sz; i++) { | 388 for (int i = 0, sz = pWidgetAcc->CountSelectedItems(); i < sz; i++) { |
389 int nIndex = pWidgetAcc->GetSelectedItem(i); | 389 int nIndex = pWidgetAcc->GetSelectedItem(i); |
390 | 390 |
391 if (nIndex > -1 && nIndex < pFormField->CountOptions()) { | 391 if (nIndex > -1 && nIndex < pFormField->CountOptions()) { |
392 pFormField->SetItemSelection(nIndex, TRUE, TRUE); | 392 pFormField->SetItemSelection(nIndex, true, true); |
393 } | 393 } |
394 } | 394 } |
395 } | 395 } |
396 break; | 396 break; |
397 } | 397 } |
398 case FIELDTYPE_COMBOBOX: { | 398 case FIELDTYPE_COMBOBOX: { |
399 pFormField->ClearSelection(FALSE); | 399 pFormField->ClearSelection(false); |
400 | 400 |
401 if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { | 401 if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { |
402 for (int i = 0, sz = pWidgetAcc->CountSelectedItems(); i < sz; i++) { | 402 for (int i = 0, sz = pWidgetAcc->CountSelectedItems(); i < sz; i++) { |
403 int nIndex = pWidgetAcc->GetSelectedItem(i); | 403 int nIndex = pWidgetAcc->GetSelectedItem(i); |
404 | 404 |
405 if (nIndex > -1 && nIndex < pFormField->CountOptions()) { | 405 if (nIndex > -1 && nIndex < pFormField->CountOptions()) { |
406 pFormField->SetItemSelection(nIndex, TRUE, TRUE); | 406 pFormField->SetItemSelection(nIndex, true, true); |
407 } | 407 } |
408 } | 408 } |
409 | 409 |
410 CFX_WideString sValue; | 410 CFX_WideString sValue; |
411 pWidgetAcc->GetValue(sValue, XFA_VALUEPICTURE_Display); | 411 pWidgetAcc->GetValue(sValue, XFA_VALUEPICTURE_Display); |
412 pFormField->SetValue(sValue, TRUE); | 412 pFormField->SetValue(sValue, true); |
413 } | 413 } |
414 break; | 414 break; |
415 } | 415 } |
416 } | 416 } |
417 } | 417 } |
418 | 418 |
419 void CPDFSDK_Widget::SynchronizeXFAItems(CXFA_FFDocView* pXFADocView, | 419 void CPDFSDK_Widget::SynchronizeXFAItems(CXFA_FFDocView* pXFADocView, |
420 CXFA_FFWidget* hWidget, | 420 CXFA_FFWidget* hWidget, |
421 CPDF_FormField* pFormField, | 421 CPDF_FormField* pFormField, |
422 CPDF_FormControl* pFormControl) { | 422 CPDF_FormControl* pFormControl) { |
423 ASSERT(hWidget); | 423 ASSERT(hWidget); |
424 | 424 |
425 switch (pFormField->GetFieldType()) { | 425 switch (pFormField->GetFieldType()) { |
426 case FIELDTYPE_LISTBOX: { | 426 case FIELDTYPE_LISTBOX: { |
427 pFormField->ClearSelection(FALSE); | 427 pFormField->ClearSelection(false); |
428 pFormField->ClearOptions(TRUE); | 428 pFormField->ClearOptions(true); |
429 | 429 |
430 if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { | 430 if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { |
431 for (int i = 0, sz = pWidgetAcc->CountChoiceListItems(); i < sz; i++) { | 431 for (int i = 0, sz = pWidgetAcc->CountChoiceListItems(); i < sz; i++) { |
432 CFX_WideString swText; | 432 CFX_WideString swText; |
433 pWidgetAcc->GetChoiceListItem(swText, i); | 433 pWidgetAcc->GetChoiceListItem(swText, i); |
434 | 434 |
435 pFormField->InsertOption(swText, i, TRUE); | 435 pFormField->InsertOption(swText, i, true); |
436 } | 436 } |
437 } | 437 } |
438 break; | 438 break; |
439 } | 439 } |
440 case FIELDTYPE_COMBOBOX: { | 440 case FIELDTYPE_COMBOBOX: { |
441 pFormField->ClearSelection(FALSE); | 441 pFormField->ClearSelection(false); |
442 pFormField->ClearOptions(FALSE); | 442 pFormField->ClearOptions(false); |
443 | 443 |
444 if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { | 444 if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { |
445 for (int i = 0, sz = pWidgetAcc->CountChoiceListItems(); i < sz; i++) { | 445 for (int i = 0, sz = pWidgetAcc->CountChoiceListItems(); i < sz; i++) { |
446 CFX_WideString swText; | 446 CFX_WideString swText; |
447 pWidgetAcc->GetChoiceListItem(swText, i); | 447 pWidgetAcc->GetChoiceListItem(swText, i); |
448 | 448 |
449 pFormField->InsertOption(swText, i, FALSE); | 449 pFormField->InsertOption(swText, i, false); |
450 } | 450 } |
451 } | 451 } |
452 | 452 |
453 pFormField->SetValue(L"", TRUE); | 453 pFormField->SetValue(L"", true); |
454 break; | 454 break; |
455 } | 455 } |
456 } | 456 } |
457 } | 457 } |
458 #endif // PDF_ENABLE_XFA | 458 #endif // PDF_ENABLE_XFA |
459 | 459 |
460 FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid( | 460 bool CPDFSDK_Widget::IsWidgetAppearanceValid(CPDF_Annot::AppearanceMode mode) { |
461 CPDF_Annot::AppearanceMode mode) { | |
462 CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDictFor("AP"); | 461 CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDictFor("AP"); |
463 if (!pAP) | 462 if (!pAP) |
464 return FALSE; | 463 return false; |
465 | 464 |
466 // Choose the right sub-ap | 465 // Choose the right sub-ap |
467 const FX_CHAR* ap_entry = "N"; | 466 const FX_CHAR* ap_entry = "N"; |
468 if (mode == CPDF_Annot::Down) | 467 if (mode == CPDF_Annot::Down) |
469 ap_entry = "D"; | 468 ap_entry = "D"; |
470 else if (mode == CPDF_Annot::Rollover) | 469 else if (mode == CPDF_Annot::Rollover) |
471 ap_entry = "R"; | 470 ap_entry = "R"; |
472 if (!pAP->KeyExist(ap_entry)) | 471 if (!pAP->KeyExist(ap_entry)) |
473 ap_entry = "N"; | 472 ap_entry = "N"; |
474 | 473 |
475 // Get the AP stream or subdirectory | 474 // Get the AP stream or subdirectory |
476 CPDF_Object* psub = pAP->GetDirectObjectFor(ap_entry); | 475 CPDF_Object* psub = pAP->GetDirectObjectFor(ap_entry); |
477 if (!psub) | 476 if (!psub) |
478 return FALSE; | 477 return false; |
479 | 478 |
480 int nFieldType = GetFieldType(); | 479 int nFieldType = GetFieldType(); |
481 switch (nFieldType) { | 480 switch (nFieldType) { |
482 case FIELDTYPE_PUSHBUTTON: | 481 case FIELDTYPE_PUSHBUTTON: |
483 case FIELDTYPE_COMBOBOX: | 482 case FIELDTYPE_COMBOBOX: |
484 case FIELDTYPE_LISTBOX: | 483 case FIELDTYPE_LISTBOX: |
485 case FIELDTYPE_TEXTFIELD: | 484 case FIELDTYPE_TEXTFIELD: |
486 case FIELDTYPE_SIGNATURE: | 485 case FIELDTYPE_SIGNATURE: |
487 return psub->IsStream(); | 486 return psub->IsStream(); |
488 case FIELDTYPE_CHECKBOX: | 487 case FIELDTYPE_CHECKBOX: |
489 case FIELDTYPE_RADIOBUTTON: | 488 case FIELDTYPE_RADIOBUTTON: |
490 if (CPDF_Dictionary* pSubDict = psub->AsDictionary()) { | 489 if (CPDF_Dictionary* pSubDict = psub->AsDictionary()) { |
491 return !!pSubDict->GetStreamFor(GetAppState()); | 490 return !!pSubDict->GetStreamFor(GetAppState()); |
492 } | 491 } |
493 return FALSE; | 492 return false; |
494 } | 493 } |
495 return TRUE; | 494 return true; |
496 } | 495 } |
497 | 496 |
498 int CPDFSDK_Widget::GetFieldType() const { | 497 int CPDFSDK_Widget::GetFieldType() const { |
499 CPDF_FormField* pField = GetFormField(); | 498 CPDF_FormField* pField = GetFormField(); |
500 return pField ? pField->GetFieldType() : FIELDTYPE_UNKNOWN; | 499 return pField ? pField->GetFieldType() : FIELDTYPE_UNKNOWN; |
501 } | 500 } |
502 | 501 |
503 FX_BOOL CPDFSDK_Widget::IsAppearanceValid() { | 502 bool CPDFSDK_Widget::IsAppearanceValid() { |
504 #ifdef PDF_ENABLE_XFA | 503 #ifdef PDF_ENABLE_XFA |
505 CPDFXFA_Context* pContext = m_pPageView->GetFormFillEnv()->GetXFAContext(); | 504 CPDFXFA_Context* pContext = m_pPageView->GetFormFillEnv()->GetXFAContext(); |
506 int nDocType = pContext->GetDocType(); | 505 int nDocType = pContext->GetDocType(); |
507 if (nDocType != DOCTYPE_PDF && nDocType != DOCTYPE_STATIC_XFA) | 506 if (nDocType != DOCTYPE_PDF && nDocType != DOCTYPE_STATIC_XFA) |
508 return TRUE; | 507 return true; |
509 #endif // PDF_ENABLE_XFA | 508 #endif // PDF_ENABLE_XFA |
510 return CPDFSDK_BAAnnot::IsAppearanceValid(); | 509 return CPDFSDK_BAAnnot::IsAppearanceValid(); |
511 } | 510 } |
512 | 511 |
513 int CPDFSDK_Widget::GetLayoutOrder() const { | 512 int CPDFSDK_Widget::GetLayoutOrder() const { |
514 return 2; | 513 return 2; |
515 } | 514 } |
516 | 515 |
517 int CPDFSDK_Widget::GetFieldFlags() const { | 516 int CPDFSDK_Widget::GetFieldFlags() const { |
518 CPDF_InterForm* pPDFInterForm = m_pInterForm->GetInterForm(); | 517 CPDF_InterForm* pPDFInterForm = m_pInterForm->GetInterForm(); |
(...skipping 29 matching lines...) Expand all Loading... |
548 return pCtrl->GetRotation() % 360; | 547 return pCtrl->GetRotation() % 360; |
549 } | 548 } |
550 | 549 |
551 #ifdef PDF_ENABLE_XFA | 550 #ifdef PDF_ENABLE_XFA |
552 CFX_WideString CPDFSDK_Widget::GetName() const { | 551 CFX_WideString CPDFSDK_Widget::GetName() const { |
553 CPDF_FormField* pFormField = GetFormField(); | 552 CPDF_FormField* pFormField = GetFormField(); |
554 return pFormField->GetFullName(); | 553 return pFormField->GetFullName(); |
555 } | 554 } |
556 #endif // PDF_ENABLE_XFA | 555 #endif // PDF_ENABLE_XFA |
557 | 556 |
558 FX_BOOL CPDFSDK_Widget::GetFillColor(FX_COLORREF& color) const { | 557 bool CPDFSDK_Widget::GetFillColor(FX_COLORREF& color) const { |
559 CPDF_FormControl* pFormCtrl = GetFormControl(); | 558 CPDF_FormControl* pFormCtrl = GetFormControl(); |
560 int iColorType = 0; | 559 int iColorType = 0; |
561 color = ARGBToColorRef(pFormCtrl->GetBackgroundColor(iColorType)); | 560 color = ARGBToColorRef(pFormCtrl->GetBackgroundColor(iColorType)); |
562 return iColorType != COLORTYPE_TRANSPARENT; | 561 return iColorType != COLORTYPE_TRANSPARENT; |
563 } | 562 } |
564 | 563 |
565 FX_BOOL CPDFSDK_Widget::GetBorderColor(FX_COLORREF& color) const { | 564 bool CPDFSDK_Widget::GetBorderColor(FX_COLORREF& color) const { |
566 CPDF_FormControl* pFormCtrl = GetFormControl(); | 565 CPDF_FormControl* pFormCtrl = GetFormControl(); |
567 int iColorType = 0; | 566 int iColorType = 0; |
568 color = ARGBToColorRef(pFormCtrl->GetBorderColor(iColorType)); | 567 color = ARGBToColorRef(pFormCtrl->GetBorderColor(iColorType)); |
569 return iColorType != COLORTYPE_TRANSPARENT; | 568 return iColorType != COLORTYPE_TRANSPARENT; |
570 } | 569 } |
571 | 570 |
572 FX_BOOL CPDFSDK_Widget::GetTextColor(FX_COLORREF& color) const { | 571 bool CPDFSDK_Widget::GetTextColor(FX_COLORREF& color) const { |
573 CPDF_FormControl* pFormCtrl = GetFormControl(); | 572 CPDF_FormControl* pFormCtrl = GetFormControl(); |
574 CPDF_DefaultAppearance da = pFormCtrl->GetDefaultAppearance(); | 573 CPDF_DefaultAppearance da = pFormCtrl->GetDefaultAppearance(); |
575 if (!da.HasColor()) | 574 if (!da.HasColor()) |
576 return FALSE; | 575 return false; |
577 | 576 |
578 FX_ARGB argb; | 577 FX_ARGB argb; |
579 int iColorType = COLORTYPE_TRANSPARENT; | 578 int iColorType = COLORTYPE_TRANSPARENT; |
580 da.GetColor(argb, iColorType); | 579 da.GetColor(argb, iColorType); |
581 color = ARGBToColorRef(argb); | 580 color = ARGBToColorRef(argb); |
582 return iColorType != COLORTYPE_TRANSPARENT; | 581 return iColorType != COLORTYPE_TRANSPARENT; |
583 } | 582 } |
584 | 583 |
585 FX_FLOAT CPDFSDK_Widget::GetFontSize() const { | 584 FX_FLOAT CPDFSDK_Widget::GetFontSize() const { |
586 CPDF_FormControl* pFormCtrl = GetFormControl(); | 585 CPDF_FormControl* pFormCtrl = GetFormControl(); |
(...skipping 12 matching lines...) Expand all Loading... |
599 if (nIndex < pWidgetAcc->CountSelectedItems()) | 598 if (nIndex < pWidgetAcc->CountSelectedItems()) |
600 return pWidgetAcc->GetSelectedItem(nIndex); | 599 return pWidgetAcc->GetSelectedItem(nIndex); |
601 } | 600 } |
602 } | 601 } |
603 #endif // PDF_ENABLE_XFA | 602 #endif // PDF_ENABLE_XFA |
604 CPDF_FormField* pFormField = GetFormField(); | 603 CPDF_FormField* pFormField = GetFormField(); |
605 return pFormField->GetSelectedIndex(nIndex); | 604 return pFormField->GetSelectedIndex(nIndex); |
606 } | 605 } |
607 | 606 |
608 #ifdef PDF_ENABLE_XFA | 607 #ifdef PDF_ENABLE_XFA |
609 CFX_WideString CPDFSDK_Widget::GetValue(FX_BOOL bDisplay) const { | 608 CFX_WideString CPDFSDK_Widget::GetValue(bool bDisplay) const { |
610 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { | 609 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { |
611 if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { | 610 if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { |
612 CFX_WideString sValue; | 611 CFX_WideString sValue; |
613 pWidgetAcc->GetValue( | 612 pWidgetAcc->GetValue( |
614 sValue, bDisplay ? XFA_VALUEPICTURE_Display : XFA_VALUEPICTURE_Edit); | 613 sValue, bDisplay ? XFA_VALUEPICTURE_Display : XFA_VALUEPICTURE_Edit); |
615 return sValue; | 614 return sValue; |
616 } | 615 } |
617 } | 616 } |
618 #else | 617 #else |
619 CFX_WideString CPDFSDK_Widget::GetValue() const { | 618 CFX_WideString CPDFSDK_Widget::GetValue() const { |
(...skipping 10 matching lines...) Expand all Loading... |
630 CFX_WideString CPDFSDK_Widget::GetOptionLabel(int nIndex) const { | 629 CFX_WideString CPDFSDK_Widget::GetOptionLabel(int nIndex) const { |
631 CPDF_FormField* pFormField = GetFormField(); | 630 CPDF_FormField* pFormField = GetFormField(); |
632 return pFormField->GetOptionLabel(nIndex); | 631 return pFormField->GetOptionLabel(nIndex); |
633 } | 632 } |
634 | 633 |
635 int CPDFSDK_Widget::CountOptions() const { | 634 int CPDFSDK_Widget::CountOptions() const { |
636 CPDF_FormField* pFormField = GetFormField(); | 635 CPDF_FormField* pFormField = GetFormField(); |
637 return pFormField->CountOptions(); | 636 return pFormField->CountOptions(); |
638 } | 637 } |
639 | 638 |
640 FX_BOOL CPDFSDK_Widget::IsOptionSelected(int nIndex) const { | 639 bool CPDFSDK_Widget::IsOptionSelected(int nIndex) const { |
641 #ifdef PDF_ENABLE_XFA | 640 #ifdef PDF_ENABLE_XFA |
642 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { | 641 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { |
643 if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { | 642 if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { |
644 if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems()) | 643 if (nIndex > -1 && nIndex < pWidgetAcc->CountChoiceListItems()) |
645 return pWidgetAcc->GetItemState(nIndex); | 644 return pWidgetAcc->GetItemState(nIndex); |
646 | 645 |
647 return FALSE; | 646 return false; |
648 } | 647 } |
649 } | 648 } |
650 #endif // PDF_ENABLE_XFA | 649 #endif // PDF_ENABLE_XFA |
651 CPDF_FormField* pFormField = GetFormField(); | 650 CPDF_FormField* pFormField = GetFormField(); |
652 return pFormField->IsItemSelected(nIndex); | 651 return pFormField->IsItemSelected(nIndex); |
653 } | 652 } |
654 | 653 |
655 int CPDFSDK_Widget::GetTopVisibleIndex() const { | 654 int CPDFSDK_Widget::GetTopVisibleIndex() const { |
656 CPDF_FormField* pFormField = GetFormField(); | 655 CPDF_FormField* pFormField = GetFormField(); |
657 return pFormField->GetTopVisibleIndex(); | 656 return pFormField->GetTopVisibleIndex(); |
(...skipping 20 matching lines...) Expand all Loading... |
678 return pFormField->GetMaxLen(); | 677 return pFormField->GetMaxLen(); |
679 } | 678 } |
680 | 679 |
681 void CPDFSDK_Widget::SetCheck(bool bChecked, bool bNotify) { | 680 void CPDFSDK_Widget::SetCheck(bool bChecked, bool bNotify) { |
682 CPDF_FormControl* pFormCtrl = GetFormControl(); | 681 CPDF_FormControl* pFormCtrl = GetFormControl(); |
683 CPDF_FormField* pFormField = pFormCtrl->GetField(); | 682 CPDF_FormField* pFormField = pFormCtrl->GetField(); |
684 pFormField->CheckControl(pFormField->GetControlIndex(pFormCtrl), bChecked, | 683 pFormField->CheckControl(pFormField->GetControlIndex(pFormCtrl), bChecked, |
685 bNotify); | 684 bNotify); |
686 #ifdef PDF_ENABLE_XFA | 685 #ifdef PDF_ENABLE_XFA |
687 if (!IsWidgetAppearanceValid(CPDF_Annot::Normal)) | 686 if (!IsWidgetAppearanceValid(CPDF_Annot::Normal)) |
688 ResetAppearance(TRUE); | 687 ResetAppearance(true); |
689 if (!bNotify) | 688 if (!bNotify) |
690 Synchronize(TRUE); | 689 Synchronize(true); |
691 #endif // PDF_ENABLE_XFA | 690 #endif // PDF_ENABLE_XFA |
692 } | 691 } |
693 | 692 |
694 void CPDFSDK_Widget::SetValue(const CFX_WideString& sValue, FX_BOOL bNotify) { | 693 void CPDFSDK_Widget::SetValue(const CFX_WideString& sValue, bool bNotify) { |
695 CPDF_FormField* pFormField = GetFormField(); | 694 CPDF_FormField* pFormField = GetFormField(); |
696 pFormField->SetValue(sValue, bNotify); | 695 pFormField->SetValue(sValue, bNotify); |
697 #ifdef PDF_ENABLE_XFA | 696 #ifdef PDF_ENABLE_XFA |
698 if (!bNotify) | 697 if (!bNotify) |
699 Synchronize(TRUE); | 698 Synchronize(true); |
700 #endif // PDF_ENABLE_XFA | 699 #endif // PDF_ENABLE_XFA |
701 } | 700 } |
702 | 701 |
703 void CPDFSDK_Widget::SetDefaultValue(const CFX_WideString& sValue) {} | 702 void CPDFSDK_Widget::SetDefaultValue(const CFX_WideString& sValue) {} |
704 void CPDFSDK_Widget::SetOptionSelection(int index, | 703 void CPDFSDK_Widget::SetOptionSelection(int index, |
705 FX_BOOL bSelected, | 704 bool bSelected, |
706 FX_BOOL bNotify) { | 705 bool bNotify) { |
707 CPDF_FormField* pFormField = GetFormField(); | 706 CPDF_FormField* pFormField = GetFormField(); |
708 pFormField->SetItemSelection(index, bSelected, bNotify); | 707 pFormField->SetItemSelection(index, bSelected, bNotify); |
709 #ifdef PDF_ENABLE_XFA | 708 #ifdef PDF_ENABLE_XFA |
710 if (!bNotify) | 709 if (!bNotify) |
711 Synchronize(TRUE); | 710 Synchronize(true); |
712 #endif // PDF_ENABLE_XFA | 711 #endif // PDF_ENABLE_XFA |
713 } | 712 } |
714 | 713 |
715 void CPDFSDK_Widget::ClearSelection(FX_BOOL bNotify) { | 714 void CPDFSDK_Widget::ClearSelection(bool bNotify) { |
716 CPDF_FormField* pFormField = GetFormField(); | 715 CPDF_FormField* pFormField = GetFormField(); |
717 pFormField->ClearSelection(bNotify); | 716 pFormField->ClearSelection(bNotify); |
718 #ifdef PDF_ENABLE_XFA | 717 #ifdef PDF_ENABLE_XFA |
719 if (!bNotify) | 718 if (!bNotify) |
720 Synchronize(TRUE); | 719 Synchronize(true); |
721 #endif // PDF_ENABLE_XFA | 720 #endif // PDF_ENABLE_XFA |
722 } | 721 } |
723 | 722 |
724 void CPDFSDK_Widget::SetTopVisibleIndex(int index) {} | 723 void CPDFSDK_Widget::SetTopVisibleIndex(int index) {} |
725 | 724 |
726 void CPDFSDK_Widget::SetAppModified() { | 725 void CPDFSDK_Widget::SetAppModified() { |
727 m_bAppModified = TRUE; | 726 m_bAppModified = true; |
728 } | 727 } |
729 | 728 |
730 void CPDFSDK_Widget::ClearAppModified() { | 729 void CPDFSDK_Widget::ClearAppModified() { |
731 m_bAppModified = FALSE; | 730 m_bAppModified = false; |
732 } | 731 } |
733 | 732 |
734 FX_BOOL CPDFSDK_Widget::IsAppModified() const { | 733 bool CPDFSDK_Widget::IsAppModified() const { |
735 return m_bAppModified; | 734 return m_bAppModified; |
736 } | 735 } |
737 | 736 |
738 #ifdef PDF_ENABLE_XFA | 737 #ifdef PDF_ENABLE_XFA |
739 void CPDFSDK_Widget::ResetAppearance(FX_BOOL bValueChanged) { | 738 void CPDFSDK_Widget::ResetAppearance(bool bValueChanged) { |
740 switch (GetFieldType()) { | 739 switch (GetFieldType()) { |
741 case FIELDTYPE_TEXTFIELD: | 740 case FIELDTYPE_TEXTFIELD: |
742 case FIELDTYPE_COMBOBOX: { | 741 case FIELDTYPE_COMBOBOX: { |
743 FX_BOOL bFormatted = FALSE; | 742 bool bFormatted = false; |
744 CFX_WideString sValue = OnFormat(bFormatted); | 743 CFX_WideString sValue = OnFormat(bFormatted); |
745 ResetAppearance(bFormatted ? &sValue : nullptr, TRUE); | 744 ResetAppearance(bFormatted ? &sValue : nullptr, true); |
746 break; | 745 break; |
747 } | 746 } |
748 default: | 747 default: |
749 ResetAppearance(nullptr, FALSE); | 748 ResetAppearance(nullptr, false); |
750 break; | 749 break; |
751 } | 750 } |
752 } | 751 } |
753 #endif // PDF_ENABLE_XFA | 752 #endif // PDF_ENABLE_XFA |
754 | 753 |
755 void CPDFSDK_Widget::ResetAppearance(const CFX_WideString* sValue, | 754 void CPDFSDK_Widget::ResetAppearance(const CFX_WideString* sValue, |
756 FX_BOOL bValueChanged) { | 755 bool bValueChanged) { |
757 SetAppModified(); | 756 SetAppModified(); |
758 | 757 |
759 m_nAppAge++; | 758 m_nAppAge++; |
760 if (m_nAppAge > 999999) | 759 if (m_nAppAge > 999999) |
761 m_nAppAge = 0; | 760 m_nAppAge = 0; |
762 if (bValueChanged) | 761 if (bValueChanged) |
763 m_nValueAge++; | 762 m_nValueAge++; |
764 | 763 |
765 int nFieldType = GetFieldType(); | 764 int nFieldType = GetFieldType(); |
766 | 765 |
(...skipping 14 matching lines...) Expand all Loading... |
781 ResetAppearance_ListBox(); | 780 ResetAppearance_ListBox(); |
782 break; | 781 break; |
783 case FIELDTYPE_TEXTFIELD: | 782 case FIELDTYPE_TEXTFIELD: |
784 ResetAppearance_TextField(sValue); | 783 ResetAppearance_TextField(sValue); |
785 break; | 784 break; |
786 } | 785 } |
787 | 786 |
788 m_pAnnot->ClearCachedAP(); | 787 m_pAnnot->ClearCachedAP(); |
789 } | 788 } |
790 | 789 |
791 CFX_WideString CPDFSDK_Widget::OnFormat(FX_BOOL& bFormatted) { | 790 CFX_WideString CPDFSDK_Widget::OnFormat(bool& bFormatted) { |
792 CPDF_FormField* pFormField = GetFormField(); | 791 CPDF_FormField* pFormField = GetFormField(); |
793 ASSERT(pFormField); | 792 ASSERT(pFormField); |
794 return m_pInterForm->OnFormat(pFormField, bFormatted); | 793 return m_pInterForm->OnFormat(pFormField, bFormatted); |
795 } | 794 } |
796 | 795 |
797 void CPDFSDK_Widget::ResetFieldAppearance(FX_BOOL bValueChanged) { | 796 void CPDFSDK_Widget::ResetFieldAppearance(bool bValueChanged) { |
798 CPDF_FormField* pFormField = GetFormField(); | 797 CPDF_FormField* pFormField = GetFormField(); |
799 ASSERT(pFormField); | 798 ASSERT(pFormField); |
800 m_pInterForm->ResetFieldAppearance(pFormField, nullptr, bValueChanged); | 799 m_pInterForm->ResetFieldAppearance(pFormField, nullptr, bValueChanged); |
801 } | 800 } |
802 | 801 |
803 void CPDFSDK_Widget::DrawAppearance(CFX_RenderDevice* pDevice, | 802 void CPDFSDK_Widget::DrawAppearance(CFX_RenderDevice* pDevice, |
804 const CFX_Matrix* pUser2Device, | 803 const CFX_Matrix* pUser2Device, |
805 CPDF_Annot::AppearanceMode mode, | 804 CPDF_Annot::AppearanceMode mode, |
806 const CPDF_RenderOptions* pOptions) { | 805 const CPDF_RenderOptions* pOptions) { |
807 int nFieldType = GetFieldType(); | 806 int nFieldType = GetFieldType(); |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1353 CPDF_FormControl* pControl = GetFormControl(); | 1352 CPDF_FormControl* pControl = GetFormControl(); |
1354 CPDF_FormField* pField = pControl->GetField(); | 1353 CPDF_FormField* pField = pControl->GetField(); |
1355 CFX_ByteTextBuf sBody, sLines; | 1354 CFX_ByteTextBuf sBody, sLines; |
1356 | 1355 |
1357 CFX_FloatRect rcClient = GetClientRect(); | 1356 CFX_FloatRect rcClient = GetClientRect(); |
1358 CFX_FloatRect rcButton = rcClient; | 1357 CFX_FloatRect rcButton = rcClient; |
1359 rcButton.left = rcButton.right - 13; | 1358 rcButton.left = rcButton.right - 13; |
1360 rcButton.Normalize(); | 1359 rcButton.Normalize(); |
1361 | 1360 |
1362 std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit); | 1361 std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit); |
1363 pEdit->EnableRefresh(FALSE); | 1362 pEdit->EnableRefresh(false); |
1364 | 1363 |
1365 CBA_FontMap font_map(this, m_pInterForm->GetFormFillEnv()->GetSysHandler()); | 1364 CBA_FontMap font_map(this, m_pInterForm->GetFormFillEnv()->GetSysHandler()); |
1366 pEdit->SetFontMap(&font_map); | 1365 pEdit->SetFontMap(&font_map); |
1367 | 1366 |
1368 CFX_FloatRect rcEdit = rcClient; | 1367 CFX_FloatRect rcEdit = rcClient; |
1369 rcEdit.right = rcButton.left; | 1368 rcEdit.right = rcButton.left; |
1370 rcEdit.Normalize(); | 1369 rcEdit.Normalize(); |
1371 | 1370 |
1372 pEdit->SetPlateRect(rcEdit); | 1371 pEdit->SetPlateRect(rcEdit); |
1373 pEdit->SetAlignmentV(1, TRUE); | 1372 pEdit->SetAlignmentV(1, true); |
1374 | 1373 |
1375 FX_FLOAT fFontSize = GetFontSize(); | 1374 FX_FLOAT fFontSize = GetFontSize(); |
1376 if (IsFloatZero(fFontSize)) | 1375 if (IsFloatZero(fFontSize)) |
1377 pEdit->SetAutoFontSize(TRUE, TRUE); | 1376 pEdit->SetAutoFontSize(true, true); |
1378 else | 1377 else |
1379 pEdit->SetFontSize(fFontSize); | 1378 pEdit->SetFontSize(fFontSize); |
1380 | 1379 |
1381 pEdit->Initialize(); | 1380 pEdit->Initialize(); |
1382 | 1381 |
1383 if (sValue) { | 1382 if (sValue) { |
1384 pEdit->SetText(*sValue); | 1383 pEdit->SetText(*sValue); |
1385 } else { | 1384 } else { |
1386 int32_t nCurSel = pField->GetSelectedIndex(0); | 1385 int32_t nCurSel = pField->GetSelectedIndex(0); |
1387 if (nCurSel < 0) | 1386 if (nCurSel < 0) |
(...skipping 29 matching lines...) Expand all Loading... |
1417 WriteAppearance("N", GetRotatedRect(), GetMatrix(), sAP); | 1416 WriteAppearance("N", GetRotatedRect(), GetMatrix(), sAP); |
1418 } | 1417 } |
1419 | 1418 |
1420 void CPDFSDK_Widget::ResetAppearance_ListBox() { | 1419 void CPDFSDK_Widget::ResetAppearance_ListBox() { |
1421 CPDF_FormControl* pControl = GetFormControl(); | 1420 CPDF_FormControl* pControl = GetFormControl(); |
1422 CPDF_FormField* pField = pControl->GetField(); | 1421 CPDF_FormField* pField = pControl->GetField(); |
1423 CFX_FloatRect rcClient = GetClientRect(); | 1422 CFX_FloatRect rcClient = GetClientRect(); |
1424 CFX_ByteTextBuf sBody, sLines; | 1423 CFX_ByteTextBuf sBody, sLines; |
1425 | 1424 |
1426 std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit); | 1425 std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit); |
1427 pEdit->EnableRefresh(FALSE); | 1426 pEdit->EnableRefresh(false); |
1428 | 1427 |
1429 CBA_FontMap font_map(this, m_pInterForm->GetFormFillEnv()->GetSysHandler()); | 1428 CBA_FontMap font_map(this, m_pInterForm->GetFormFillEnv()->GetSysHandler()); |
1430 pEdit->SetFontMap(&font_map); | 1429 pEdit->SetFontMap(&font_map); |
1431 | 1430 |
1432 pEdit->SetPlateRect(CFX_FloatRect(rcClient.left, 0.0f, rcClient.right, 0.0f)); | 1431 pEdit->SetPlateRect(CFX_FloatRect(rcClient.left, 0.0f, rcClient.right, 0.0f)); |
1433 | 1432 |
1434 FX_FLOAT fFontSize = GetFontSize(); | 1433 FX_FLOAT fFontSize = GetFontSize(); |
1435 | 1434 |
1436 pEdit->SetFontSize(IsFloatZero(fFontSize) ? 12.0f : fFontSize); | 1435 pEdit->SetFontSize(IsFloatZero(fFontSize) ? 12.0f : fFontSize); |
1437 | 1436 |
(...skipping 20 matching lines...) Expand all Loading... |
1458 CFX_FloatRect rcContent = pEdit->GetContentRect(); | 1457 CFX_FloatRect rcContent = pEdit->GetContentRect(); |
1459 FX_FLOAT fItemHeight = rcContent.Height(); | 1458 FX_FLOAT fItemHeight = rcContent.Height(); |
1460 | 1459 |
1461 if (bSelected) { | 1460 if (bSelected) { |
1462 CFX_FloatRect rcItem = | 1461 CFX_FloatRect rcItem = |
1463 CFX_FloatRect(rcClient.left, fy - fItemHeight, rcClient.right, fy); | 1462 CFX_FloatRect(rcClient.left, fy - fItemHeight, rcClient.right, fy); |
1464 sList << "q\n" | 1463 sList << "q\n" |
1465 << CPWL_Utils::GetColorAppStream( | 1464 << CPWL_Utils::GetColorAppStream( |
1466 CPWL_Color(COLORTYPE_RGB, 0, 51.0f / 255.0f, | 1465 CPWL_Color(COLORTYPE_RGB, 0, 51.0f / 255.0f, |
1467 113.0f / 255.0f), | 1466 113.0f / 255.0f), |
1468 TRUE) | 1467 true) |
1469 << rcItem.left << " " << rcItem.bottom << " " << rcItem.Width() | 1468 << rcItem.left << " " << rcItem.bottom << " " << rcItem.Width() |
1470 << " " << rcItem.Height() << " re f\n" | 1469 << " " << rcItem.Height() << " re f\n" |
1471 << "Q\n"; | 1470 << "Q\n"; |
1472 | 1471 |
1473 sList << "BT\n" | 1472 sList << "BT\n" |
1474 << CPWL_Utils::GetColorAppStream(CPWL_Color(COLORTYPE_GRAY, 1), | 1473 << CPWL_Utils::GetColorAppStream(CPWL_Color(COLORTYPE_GRAY, 1), |
1475 TRUE) | 1474 true) |
1476 << CPWL_Utils::GetEditAppStream(pEdit.get(), | 1475 << CPWL_Utils::GetEditAppStream(pEdit.get(), |
1477 CFX_FloatPoint(0.0f, fy)) | 1476 CFX_FloatPoint(0.0f, fy)) |
1478 << "ET\n"; | 1477 << "ET\n"; |
1479 } else { | 1478 } else { |
1480 CPWL_Color crText = GetTextPWLColor(); | 1479 CPWL_Color crText = GetTextPWLColor(); |
1481 sList << "BT\n" | 1480 sList << "BT\n" |
1482 << CPWL_Utils::GetColorAppStream(crText, TRUE) | 1481 << CPWL_Utils::GetColorAppStream(crText, true) |
1483 << CPWL_Utils::GetEditAppStream(pEdit.get(), | 1482 << CPWL_Utils::GetEditAppStream(pEdit.get(), |
1484 CFX_FloatPoint(0.0f, fy)) | 1483 CFX_FloatPoint(0.0f, fy)) |
1485 << "ET\n"; | 1484 << "ET\n"; |
1486 } | 1485 } |
1487 | 1486 |
1488 fy -= fItemHeight; | 1487 fy -= fItemHeight; |
1489 } | 1488 } |
1490 | 1489 |
1491 if (sList.GetSize() > 0) { | 1490 if (sList.GetSize() > 0) { |
1492 sBody << "/Tx BMC\n" | 1491 sBody << "/Tx BMC\n" |
1493 << "q\n" | 1492 << "q\n" |
1494 << rcClient.left << " " << rcClient.bottom << " " << rcClient.Width() | 1493 << rcClient.left << " " << rcClient.bottom << " " << rcClient.Width() |
1495 << " " << rcClient.Height() << " re\nW\nn\n"; | 1494 << " " << rcClient.Height() << " re\nW\nn\n"; |
1496 sBody << sList << "Q\nEMC\n"; | 1495 sBody << sList << "Q\nEMC\n"; |
1497 } | 1496 } |
1498 | 1497 |
1499 CFX_ByteString sAP = GetBackgroundAppStream() + GetBorderAppStream() + | 1498 CFX_ByteString sAP = GetBackgroundAppStream() + GetBorderAppStream() + |
1500 sLines.AsStringC() + sBody.AsStringC(); | 1499 sLines.AsStringC() + sBody.AsStringC(); |
1501 | 1500 |
1502 WriteAppearance("N", GetRotatedRect(), GetMatrix(), sAP); | 1501 WriteAppearance("N", GetRotatedRect(), GetMatrix(), sAP); |
1503 } | 1502 } |
1504 | 1503 |
1505 void CPDFSDK_Widget::ResetAppearance_TextField(const CFX_WideString* sValue) { | 1504 void CPDFSDK_Widget::ResetAppearance_TextField(const CFX_WideString* sValue) { |
1506 CPDF_FormControl* pControl = GetFormControl(); | 1505 CPDF_FormControl* pControl = GetFormControl(); |
1507 CPDF_FormField* pField = pControl->GetField(); | 1506 CPDF_FormField* pField = pControl->GetField(); |
1508 CFX_ByteTextBuf sBody, sLines; | 1507 CFX_ByteTextBuf sBody, sLines; |
1509 | 1508 |
1510 std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit); | 1509 std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit); |
1511 pEdit->EnableRefresh(FALSE); | 1510 pEdit->EnableRefresh(false); |
1512 | 1511 |
1513 CBA_FontMap font_map(this, m_pInterForm->GetFormFillEnv()->GetSysHandler()); | 1512 CBA_FontMap font_map(this, m_pInterForm->GetFormFillEnv()->GetSysHandler()); |
1514 pEdit->SetFontMap(&font_map); | 1513 pEdit->SetFontMap(&font_map); |
1515 | 1514 |
1516 CFX_FloatRect rcClient = GetClientRect(); | 1515 CFX_FloatRect rcClient = GetClientRect(); |
1517 pEdit->SetPlateRect(rcClient); | 1516 pEdit->SetPlateRect(rcClient); |
1518 pEdit->SetAlignmentH(pControl->GetControlAlignment(), TRUE); | 1517 pEdit->SetAlignmentH(pControl->GetControlAlignment(), true); |
1519 | 1518 |
1520 uint32_t dwFieldFlags = pField->GetFieldFlags(); | 1519 uint32_t dwFieldFlags = pField->GetFieldFlags(); |
1521 FX_BOOL bMultiLine = (dwFieldFlags >> 12) & 1; | 1520 bool bMultiLine = (dwFieldFlags >> 12) & 1; |
1522 | 1521 |
1523 if (bMultiLine) { | 1522 if (bMultiLine) { |
1524 pEdit->SetMultiLine(TRUE, TRUE); | 1523 pEdit->SetMultiLine(true, true); |
1525 pEdit->SetAutoReturn(TRUE, TRUE); | 1524 pEdit->SetAutoReturn(true, true); |
1526 } else { | 1525 } else { |
1527 pEdit->SetAlignmentV(1, TRUE); | 1526 pEdit->SetAlignmentV(1, true); |
1528 } | 1527 } |
1529 | 1528 |
1530 uint16_t subWord = 0; | 1529 uint16_t subWord = 0; |
1531 if ((dwFieldFlags >> 13) & 1) { | 1530 if ((dwFieldFlags >> 13) & 1) { |
1532 subWord = '*'; | 1531 subWord = '*'; |
1533 pEdit->SetPasswordChar(subWord, TRUE); | 1532 pEdit->SetPasswordChar(subWord, true); |
1534 } | 1533 } |
1535 | 1534 |
1536 int nMaxLen = pField->GetMaxLen(); | 1535 int nMaxLen = pField->GetMaxLen(); |
1537 FX_BOOL bCharArray = (dwFieldFlags >> 24) & 1; | 1536 bool bCharArray = (dwFieldFlags >> 24) & 1; |
1538 FX_FLOAT fFontSize = GetFontSize(); | 1537 FX_FLOAT fFontSize = GetFontSize(); |
1539 | 1538 |
1540 #ifdef PDF_ENABLE_XFA | 1539 #ifdef PDF_ENABLE_XFA |
1541 CFX_WideString sValueTmp; | 1540 CFX_WideString sValueTmp; |
1542 if (!sValue && GetMixXFAWidget()) { | 1541 if (!sValue && GetMixXFAWidget()) { |
1543 sValueTmp = GetValue(TRUE); | 1542 sValueTmp = GetValue(true); |
1544 sValue = &sValueTmp; | 1543 sValue = &sValueTmp; |
1545 } | 1544 } |
1546 #endif // PDF_ENABLE_XFA | 1545 #endif // PDF_ENABLE_XFA |
1547 | 1546 |
1548 if (nMaxLen > 0) { | 1547 if (nMaxLen > 0) { |
1549 if (bCharArray) { | 1548 if (bCharArray) { |
1550 pEdit->SetCharArray(nMaxLen); | 1549 pEdit->SetCharArray(nMaxLen); |
1551 | 1550 |
1552 if (IsFloatZero(fFontSize)) { | 1551 if (IsFloatZero(fFontSize)) { |
1553 fFontSize = CPWL_Edit::GetCharArrayAutoFontSize(font_map.GetPDFFont(0), | 1552 fFontSize = CPWL_Edit::GetCharArrayAutoFontSize(font_map.GetPDFFont(0), |
1554 rcClient, nMaxLen); | 1553 rcClient, nMaxLen); |
1555 } | 1554 } |
1556 } else { | 1555 } else { |
1557 if (sValue) | 1556 if (sValue) |
1558 nMaxLen = sValue->GetLength(); | 1557 nMaxLen = sValue->GetLength(); |
1559 pEdit->SetLimitChar(nMaxLen); | 1558 pEdit->SetLimitChar(nMaxLen); |
1560 } | 1559 } |
1561 } | 1560 } |
1562 | 1561 |
1563 if (IsFloatZero(fFontSize)) | 1562 if (IsFloatZero(fFontSize)) |
1564 pEdit->SetAutoFontSize(TRUE, TRUE); | 1563 pEdit->SetAutoFontSize(true, true); |
1565 else | 1564 else |
1566 pEdit->SetFontSize(fFontSize); | 1565 pEdit->SetFontSize(fFontSize); |
1567 | 1566 |
1568 pEdit->Initialize(); | 1567 pEdit->Initialize(); |
1569 pEdit->SetText(sValue ? *sValue : pField->GetValue()); | 1568 pEdit->SetText(sValue ? *sValue : pField->GetValue()); |
1570 | 1569 |
1571 CFX_FloatRect rcContent = pEdit->GetContentRect(); | 1570 CFX_FloatRect rcContent = pEdit->GetContentRect(); |
1572 CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream( | 1571 CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream( |
1573 pEdit.get(), CFX_FloatPoint(), nullptr, !bCharArray, subWord); | 1572 pEdit.get(), CFX_FloatPoint(), nullptr, !bCharArray, subWord); |
1574 | 1573 |
1575 if (sEdit.GetLength() > 0) { | 1574 if (sEdit.GetLength() > 0) { |
1576 sBody << "/Tx BMC\n" | 1575 sBody << "/Tx BMC\n" |
1577 << "q\n"; | 1576 << "q\n"; |
1578 if (rcContent.Width() > rcClient.Width() || | 1577 if (rcContent.Width() > rcClient.Width() || |
1579 rcContent.Height() > rcClient.Height()) { | 1578 rcContent.Height() > rcClient.Height()) { |
1580 sBody << rcClient.left << " " << rcClient.bottom << " " | 1579 sBody << rcClient.left << " " << rcClient.bottom << " " |
1581 << rcClient.Width() << " " << rcClient.Height() << " re\nW\nn\n"; | 1580 << rcClient.Width() << " " << rcClient.Height() << " re\nW\nn\n"; |
1582 } | 1581 } |
1583 CPWL_Color crText = GetTextPWLColor(); | 1582 CPWL_Color crText = GetTextPWLColor(); |
1584 sBody << "BT\n" | 1583 sBody << "BT\n" |
1585 << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n" | 1584 << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n" |
1586 << "Q\nEMC\n"; | 1585 << "Q\nEMC\n"; |
1587 } | 1586 } |
1588 | 1587 |
1589 if (bCharArray) { | 1588 if (bCharArray) { |
1590 switch (GetBorderStyle()) { | 1589 switch (GetBorderStyle()) { |
1591 case BorderStyle::SOLID: { | 1590 case BorderStyle::SOLID: { |
1592 CFX_ByteString sColor = | 1591 CFX_ByteString sColor = |
1593 CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), FALSE); | 1592 CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), false); |
1594 if (sColor.GetLength() > 0) { | 1593 if (sColor.GetLength() > 0) { |
1595 sLines << "q\n" | 1594 sLines << "q\n" |
1596 << GetBorderWidth() << " w\n" | 1595 << GetBorderWidth() << " w\n" |
1597 << CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), FALSE) | 1596 << CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), false) |
1598 << " 2 J 0 j\n"; | 1597 << " 2 J 0 j\n"; |
1599 | 1598 |
1600 for (int32_t i = 1; i < nMaxLen; ++i) { | 1599 for (int32_t i = 1; i < nMaxLen; ++i) { |
1601 sLines << rcClient.left + | 1600 sLines << rcClient.left + |
1602 ((rcClient.right - rcClient.left) / nMaxLen) * i | 1601 ((rcClient.right - rcClient.left) / nMaxLen) * i |
1603 << " " << rcClient.bottom << " m\n" | 1602 << " " << rcClient.bottom << " m\n" |
1604 << rcClient.left + | 1603 << rcClient.left + |
1605 ((rcClient.right - rcClient.left) / nMaxLen) * i | 1604 ((rcClient.right - rcClient.left) / nMaxLen) * i |
1606 << " " << rcClient.top << " l S\n"; | 1605 << " " << rcClient.top << " l S\n"; |
1607 } | 1606 } |
1608 | 1607 |
1609 sLines << "Q\n"; | 1608 sLines << "Q\n"; |
1610 } | 1609 } |
1611 break; | 1610 break; |
1612 } | 1611 } |
1613 case BorderStyle::DASH: { | 1612 case BorderStyle::DASH: { |
1614 CFX_ByteString sColor = | 1613 CFX_ByteString sColor = |
1615 CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), FALSE); | 1614 CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), false); |
1616 if (sColor.GetLength() > 0) { | 1615 if (sColor.GetLength() > 0) { |
1617 CPWL_Dash dsBorder = CPWL_Dash(3, 3, 0); | 1616 CPWL_Dash dsBorder = CPWL_Dash(3, 3, 0); |
1618 | 1617 |
1619 sLines << "q\n" | 1618 sLines << "q\n" |
1620 << GetBorderWidth() << " w\n" | 1619 << GetBorderWidth() << " w\n" |
1621 << CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), FALSE) | 1620 << CPWL_Utils::GetColorAppStream(GetBorderPWLColor(), false) |
1622 << "[" << dsBorder.nDash << " " << dsBorder.nGap << "] " | 1621 << "[" << dsBorder.nDash << " " << dsBorder.nGap << "] " |
1623 << dsBorder.nPhase << " d\n"; | 1622 << dsBorder.nPhase << " d\n"; |
1624 | 1623 |
1625 for (int32_t i = 1; i < nMaxLen; ++i) { | 1624 for (int32_t i = 1; i < nMaxLen; ++i) { |
1626 sLines << rcClient.left + | 1625 sLines << rcClient.left + |
1627 ((rcClient.right - rcClient.left) / nMaxLen) * i | 1626 ((rcClient.right - rcClient.left) / nMaxLen) * i |
1628 << " " << rcClient.bottom << " m\n" | 1627 << " " << rcClient.bottom << " m\n" |
1629 << rcClient.left + | 1628 << rcClient.left + |
1630 ((rcClient.right - rcClient.left) / nMaxLen) * i | 1629 ((rcClient.right - rcClient.left) / nMaxLen) * i |
1631 << " " << rcClient.top << " l S\n"; | 1630 << " " << rcClient.top << " l S\n"; |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1813 CPDF_Dictionary* pXObject = new CPDF_Dictionary(pDoc->GetByteStringPool()); | 1812 CPDF_Dictionary* pXObject = new CPDF_Dictionary(pDoc->GetByteStringPool()); |
1814 pXObject->SetReferenceFor(sImageAlias, pDoc, pImage->GetObjNum()); | 1813 pXObject->SetReferenceFor(sImageAlias, pDoc, pImage->GetObjNum()); |
1815 pStreamResList->SetFor("XObject", pXObject); | 1814 pStreamResList->SetFor("XObject", pXObject); |
1816 } | 1815 } |
1817 | 1816 |
1818 void CPDFSDK_Widget::RemoveAppearance(const CFX_ByteString& sAPType) { | 1817 void CPDFSDK_Widget::RemoveAppearance(const CFX_ByteString& sAPType) { |
1819 if (CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDictFor("AP")) | 1818 if (CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDictFor("AP")) |
1820 pAPDict->RemoveFor(sAPType); | 1819 pAPDict->RemoveFor(sAPType); |
1821 } | 1820 } |
1822 | 1821 |
1823 FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type, | 1822 bool CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type, |
1824 PDFSDK_FieldAction& data, | 1823 PDFSDK_FieldAction& data, |
1825 CPDFSDK_PageView* pPageView) { | 1824 CPDFSDK_PageView* pPageView) { |
1826 CPDFSDK_FormFillEnvironment* pFormFillEnv = pPageView->GetFormFillEnv(); | 1825 CPDFSDK_FormFillEnvironment* pFormFillEnv = pPageView->GetFormFillEnv(); |
1827 | 1826 |
1828 #ifdef PDF_ENABLE_XFA | 1827 #ifdef PDF_ENABLE_XFA |
1829 CPDFXFA_Context* pContext = pFormFillEnv->GetXFAContext(); | 1828 CPDFXFA_Context* pContext = pFormFillEnv->GetXFAContext(); |
1830 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { | 1829 if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { |
1831 XFA_EVENTTYPE eEventType = GetXFAEventType(type, data.bWillCommit); | 1830 XFA_EVENTTYPE eEventType = GetXFAEventType(type, data.bWillCommit); |
1832 | 1831 |
1833 if (eEventType != XFA_EVENT_Unknown) { | 1832 if (eEventType != XFA_EVENT_Unknown) { |
1834 if (CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) { | 1833 if (CXFA_FFWidgetHandler* pXFAWidgetHandler = GetXFAWidgetHandler()) { |
1835 CXFA_EventParam param; | 1834 CXFA_EventParam param; |
(...skipping 15 matching lines...) Expand all Loading... |
1851 param.m_wsPrevText = data.sValue; | 1850 param.m_wsPrevText = data.sValue; |
1852 | 1851 |
1853 CXFA_WidgetAcc* pAcc = hWidget->GetDataAcc(); | 1852 CXFA_WidgetAcc* pAcc = hWidget->GetDataAcc(); |
1854 param.m_pTarget = pAcc; | 1853 param.m_pTarget = pAcc; |
1855 int32_t nRet = pXFAWidgetHandler->ProcessEvent(pAcc, ¶m); | 1854 int32_t nRet = pXFAWidgetHandler->ProcessEvent(pAcc, ¶m); |
1856 | 1855 |
1857 if (CXFA_FFDocView* pDocView = pContext->GetXFADocView()) | 1856 if (CXFA_FFDocView* pDocView = pContext->GetXFADocView()) |
1858 pDocView->UpdateDocView(); | 1857 pDocView->UpdateDocView(); |
1859 | 1858 |
1860 if (nRet == XFA_EVENTERROR_Success) | 1859 if (nRet == XFA_EVENTERROR_Success) |
1861 return TRUE; | 1860 return true; |
1862 } | 1861 } |
1863 } | 1862 } |
1864 } | 1863 } |
1865 #endif // PDF_ENABLE_XFA | 1864 #endif // PDF_ENABLE_XFA |
1866 | 1865 |
1867 CPDF_Action action = GetAAction(type); | 1866 CPDF_Action action = GetAAction(type); |
1868 if (action.GetDict() && action.GetType() != CPDF_Action::Unknown) { | 1867 if (action.GetDict() && action.GetType() != CPDF_Action::Unknown) { |
1869 CPDFSDK_ActionHandler* pActionHandler = pFormFillEnv->GetActionHander(); | 1868 CPDFSDK_ActionHandler* pActionHandler = pFormFillEnv->GetActionHander(); |
1870 return pActionHandler->DoAction_Field(action, type, pFormFillEnv, | 1869 return pActionHandler->DoAction_Field(action, type, pFormFillEnv, |
1871 GetFormField(), data); | 1870 GetFormField(), data); |
1872 } | 1871 } |
1873 return FALSE; | 1872 return false; |
1874 } | 1873 } |
1875 | 1874 |
1876 CPDF_Action CPDFSDK_Widget::GetAAction(CPDF_AAction::AActionType eAAT) { | 1875 CPDF_Action CPDFSDK_Widget::GetAAction(CPDF_AAction::AActionType eAAT) { |
1877 switch (eAAT) { | 1876 switch (eAAT) { |
1878 case CPDF_AAction::CursorEnter: | 1877 case CPDF_AAction::CursorEnter: |
1879 case CPDF_AAction::CursorExit: | 1878 case CPDF_AAction::CursorExit: |
1880 case CPDF_AAction::ButtonDown: | 1879 case CPDF_AAction::ButtonDown: |
1881 case CPDF_AAction::ButtonUp: | 1880 case CPDF_AAction::ButtonUp: |
1882 case CPDF_AAction::GetFocus: | 1881 case CPDF_AAction::GetFocus: |
1883 case CPDF_AAction::LoseFocus: | 1882 case CPDF_AAction::LoseFocus: |
(...skipping 25 matching lines...) Expand all Loading... |
1909 } | 1908 } |
1910 | 1909 |
1911 int32_t CPDFSDK_Widget::GetAppearanceAge() const { | 1910 int32_t CPDFSDK_Widget::GetAppearanceAge() const { |
1912 return m_nAppAge; | 1911 return m_nAppAge; |
1913 } | 1912 } |
1914 | 1913 |
1915 int32_t CPDFSDK_Widget::GetValueAge() const { | 1914 int32_t CPDFSDK_Widget::GetValueAge() const { |
1916 return m_nValueAge; | 1915 return m_nValueAge; |
1917 } | 1916 } |
1918 | 1917 |
1919 FX_BOOL CPDFSDK_Widget::HitTest(FX_FLOAT pageX, FX_FLOAT pageY) { | 1918 bool CPDFSDK_Widget::HitTest(FX_FLOAT pageX, FX_FLOAT pageY) { |
1920 CPDF_Annot* pAnnot = GetPDFAnnot(); | 1919 CPDF_Annot* pAnnot = GetPDFAnnot(); |
1921 CFX_FloatRect annotRect = pAnnot->GetRect(); | 1920 CFX_FloatRect annotRect = pAnnot->GetRect(); |
1922 if (!annotRect.Contains(pageX, pageY)) | 1921 if (!annotRect.Contains(pageX, pageY)) |
1923 return FALSE; | 1922 return false; |
1924 | 1923 |
1925 if (!IsVisible()) | 1924 if (!IsVisible()) |
1926 return FALSE; | 1925 return false; |
1927 | 1926 |
1928 if ((GetFieldFlags() & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) | 1927 if ((GetFieldFlags() & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) |
1929 return FALSE; | 1928 return false; |
1930 | 1929 |
1931 return TRUE; | 1930 return true; |
1932 } | 1931 } |
OLD | NEW |