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

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

Issue 1407583004: Changes to master to more closely match XFA. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 2 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 | « no previous file | fpdfsdk/src/fpdf_transformpage.cpp » ('j') | fpdfsdk/src/fpdf_transformpage.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../include/formfiller/FFL_FormFiller.h" 7 #include "../../include/formfiller/FFL_FormFiller.h"
8 #include "../../include/formfiller/FFL_IFormFiller.h" 8 #include "../../include/formfiller/FFL_IFormFiller.h"
9 #include "../../include/formfiller/FFL_CheckBox.h" 9 #include "../../include/formfiller/FFL_CheckBox.h"
10 #include "../../include/formfiller/FFL_ComboBox.h" 10 #include "../../include/formfiller/FFL_ComboBox.h"
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 502
503 FX_BOOL CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) { 503 FX_BOOL CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) {
504 ASSERT(pWidget != NULL); 504 ASSERT(pWidget != NULL);
505 505
506 int nFieldFlags = pWidget->GetFieldFlags(); 506 int nFieldFlags = pWidget->GetFieldFlags();
507 507
508 return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY; 508 return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY;
509 } 509 }
510 510
511 FX_BOOL CFFL_IFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) { 511 FX_BOOL CFFL_IFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) {
512 ASSERT(pWidget != NULL);
513
514 if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) 512 if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON)
515 return TRUE; 513 return TRUE;
516 else {
517 CPDF_Page* pPage = pWidget->GetPDFPage();
518 ASSERT(pPage != NULL);
519 514
520 CPDF_Document* pDocument = pPage->m_pDocument; 515 CPDF_Page* pPage = pWidget->GetPDFPage();
521 ASSERT(pDocument != NULL); 516 CPDF_Document* pDocument = pPage->m_pDocument;
522 517 FX_DWORD dwPermissions = pDocument->GetUserPermissions();
523 FX_DWORD dwPermissions = pDocument->GetUserPermissions(); 518 return (dwPermissions & FPDFPERM_FILL_FORM) ||
524 return (dwPermissions & FPDFPERM_FILL_FORM) || 519 (dwPermissions & FPDFPERM_ANNOT_FORM) ||
525 (dwPermissions & FPDFPERM_ANNOT_FORM) || 520 (dwPermissions & FPDFPERM_MODIFY);
526 (dwPermissions & FPDFPERM_MODIFY);
527 }
528 return TRUE;
Lei Zhang 2015/10/13 22:04:38 uhhh
529 } 521 }
530 522
531 CFFL_FormFiller* CFFL_IFormFiller::GetFormFiller(CPDFSDK_Annot* pAnnot, 523 CFFL_FormFiller* CFFL_IFormFiller::GetFormFiller(CPDFSDK_Annot* pAnnot,
532 FX_BOOL bRegister) { 524 FX_BOOL bRegister) {
533 auto it = m_Maps.find(pAnnot); 525 auto it = m_Maps.find(pAnnot);
534 if (it != m_Maps.end()) 526 if (it != m_Maps.end())
535 return it->second; 527 return it->second;
536 528
537 if (!bRegister) 529 if (!bRegister)
538 return nullptr; 530 return nullptr;
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 TRUE); 787 TRUE);
796 pInterForm->UpdateField(pWidget->GetFormField()); 788 pInterForm->UpdateField(pWidget->GetFormField());
797 } 789 }
798 790
799 m_bNotifying = FALSE; 791 m_bNotifying = FALSE;
800 } 792 }
801 } 793 }
802 794
803 FX_BOOL CFFL_IFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView, 795 FX_BOOL CFFL_IFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView,
804 CPDFSDK_Annot* pAnnot) { 796 CPDFSDK_Annot* pAnnot) {
805 ASSERT(pPageView != NULL);
806 ASSERT(pAnnot != NULL);
807
808 if (pPageView) 797 if (pPageView)
809 return pPageView->IsValidAnnot(pAnnot->GetPDFAnnot()); 798 return pPageView->IsValidAnnot(pAnnot->GetPDFAnnot());
810 else 799
811 return FALSE; 800 return FALSE;
812 } 801 }
813 802
814 void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, 803 void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList,
815 void* pPrivateData, 804 void* pPrivateData,
816 int32_t nKeyCode, 805 int32_t nKeyCode,
817 CFX_WideString& strChange, 806 CFX_WideString& strChange,
818 const CFX_WideString& strChangeEx, 807 const CFX_WideString& strChangeEx,
819 int nSelStart, 808 int nSelStart,
820 int nSelEnd, 809 int nSelEnd,
821 FX_BOOL bKeyDown, 810 FX_BOOL bKeyDown,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 FX_BOOL& bExit, 887 FX_BOOL& bExit,
899 FX_DWORD nFlag) { 888 FX_DWORD nFlag) {
900 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; 889 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData;
901 ASSERT(pData->pWidget); 890 ASSERT(pData->pWidget);
902 891
903 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); 892 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE);
904 893
905 if (!bEditOrList) 894 if (!bEditOrList)
906 pFormFiller->OnKeyStroke(bExit, nFlag); 895 pFormFiller->OnKeyStroke(bExit, nFlag);
907 } 896 }
OLDNEW
« no previous file with comments | « no previous file | fpdfsdk/src/fpdf_transformpage.cpp » ('j') | fpdfsdk/src/fpdf_transformpage.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698