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

Side by Side Diff: xfa/fxfa/app/xfa_ffdocview.cpp

Issue 2083453003: Split the XFA_OBJECTTYPE enum into two parts. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix == nullptr Created 4 years, 6 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 | xfa/fxfa/app/xfa_fffield.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 "xfa/fxfa/include/xfa_ffdocview.h" 7 #include "xfa/fxfa/include/xfa_ffdocview.h"
8 8
9 #include "core/fxcrt/include/fx_ext.h" 9 #include "core/fxcrt/include/fx_ext.h"
10 #include "xfa/fxfa/app/xfa_ffbarcode.h" 10 #include "xfa/fxfa/app/xfa_ffbarcode.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 FX_BOOL CXFA_FFDocView::ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc) { 210 FX_BOOL CXFA_FFDocView::ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc) {
211 CXFA_Node* pNode = pWidgetAcc->GetNode(); 211 CXFA_Node* pNode = pWidgetAcc->GetNode();
212 XFA_ELEMENT eType = pNode->GetClassID(); 212 XFA_ELEMENT eType = pNode->GetClassID();
213 if (eType != XFA_ELEMENT_Field && eType != XFA_ELEMENT_ExclGroup) { 213 if (eType != XFA_ELEMENT_Field && eType != XFA_ELEMENT_ExclGroup) {
214 return FALSE; 214 return FALSE;
215 } 215 }
216 pWidgetAcc->ResetData(); 216 pWidgetAcc->ResetData();
217 pWidgetAcc->UpdateUIDisplay(); 217 pWidgetAcc->UpdateUIDisplay();
218 if (CXFA_Validate validate = pWidgetAcc->GetValidate()) { 218 if (CXFA_Validate validate = pWidgetAcc->GetValidate()) {
219 AddValidateWidget(pWidgetAcc); 219 AddValidateWidget(pWidgetAcc);
220 validate.GetNode()->SetFlag(XFA_NODEFLAG_NeedsInitApp, false); 220 validate.GetNode()->SetFlag(XFA_NodeFlag_NeedsInitApp, false);
221 } 221 }
222 return TRUE; 222 return TRUE;
223 } 223 }
224 void CXFA_FFDocView::ResetWidgetData(CXFA_WidgetAcc* pWidgetAcc) { 224 void CXFA_FFDocView::ResetWidgetData(CXFA_WidgetAcc* pWidgetAcc) {
225 m_bLayoutEvent = TRUE; 225 m_bLayoutEvent = TRUE;
226 FX_BOOL bChanged = FALSE; 226 FX_BOOL bChanged = FALSE;
227 CXFA_Node* pFormNode = NULL; 227 CXFA_Node* pFormNode = NULL;
228 if (pWidgetAcc) { 228 if (pWidgetAcc) {
229 bChanged = ResetSingleWidgetAccData(pWidgetAcc); 229 bChanged = ResetSingleWidgetAccData(pWidgetAcc);
230 pFormNode = pWidgetAcc->GetNode(); 230 pFormNode = pWidgetAcc->GetNode();
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 ->GetDocProvider() 410 ->GetDocProvider()
411 ->IsValidationsEnabled(pDocView->GetDoc())) { 411 ->IsValidationsEnabled(pDocView->GetDoc())) {
412 return pWidgetAcc->ProcessValidate(0x01); 412 return pWidgetAcc->ProcessValidate(0x01);
413 } 413 }
414 return XFA_EVENTERROR_Disabled; 414 return XFA_EVENTERROR_Disabled;
415 case XFA_EVENT_InitCalculate: { 415 case XFA_EVENT_InitCalculate: {
416 CXFA_Calculate calc = pWidgetAcc->GetCalculate(); 416 CXFA_Calculate calc = pWidgetAcc->GetCalculate();
417 if (!calc) { 417 if (!calc) {
418 return XFA_EVENTERROR_NotExist; 418 return XFA_EVENTERROR_NotExist;
419 } 419 }
420 if (pWidgetAcc->GetNode()->HasFlag(XFA_NODEFLAG_UserInteractive)) { 420 if (pWidgetAcc->GetNode()->IsUserInteractive())
421 return XFA_EVENTERROR_Disabled; 421 return XFA_EVENTERROR_Disabled;
422 } 422
423 CXFA_Script script = calc.GetScript(); 423 CXFA_Script script = calc.GetScript();
424 return pWidgetAcc->ExecuteScript(script, pParam); 424 return pWidgetAcc->ExecuteScript(script, pParam);
425 } 425 }
426 default: 426 default:
427 break; 427 break;
428 } 428 }
429 int32_t iRet = 429 int32_t iRet =
430 pWidgetAcc->ProcessEvent(gs_EventActivity[pParam->m_eType], pParam); 430 pWidgetAcc->ProcessEvent(gs_EventActivity[pParam->m_eType], pParam);
431 return iRet; 431 return iRet;
432 } 432 }
(...skipping 16 matching lines...) Expand all
449 return iRet; 449 return iRet;
450 } 450 }
451 CXFA_EventParam eParam; 451 CXFA_EventParam eParam;
452 eParam.m_eType = eEventType; 452 eParam.m_eType = eEventType;
453 eParam.m_pTarget = pWidgetAcc; 453 eParam.m_pTarget = pWidgetAcc;
454 eParam.m_bIsFormReady = bIsFormReady; 454 eParam.m_bIsFormReady = bIsFormReady;
455 return XFA_ProcessEvent(this, pWidgetAcc, &eParam); 455 return XFA_ProcessEvent(this, pWidgetAcc, &eParam);
456 } 456 }
457 if (bRecursive) { 457 if (bRecursive) {
458 for (CXFA_Node* pNode = pFormNode->GetNodeItem( 458 for (CXFA_Node* pNode = pFormNode->GetNodeItem(
459 XFA_NODEITEM_FirstChild, XFA_OBJECTTYPE_ContainerNode); 459 XFA_NODEITEM_FirstChild, XFA_ObjectType::ContainerNode);
460 pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling, 460 pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling,
461 XFA_OBJECTTYPE_ContainerNode)) { 461 XFA_ObjectType::ContainerNode)) {
462 elementType = pNode->GetClassID(); 462 elementType = pNode->GetClassID();
463 if (elementType != XFA_ELEMENT_Variables && 463 if (elementType != XFA_ELEMENT_Variables &&
464 elementType != XFA_ELEMENT_Draw) { 464 elementType != XFA_ELEMENT_Draw) {
465 iRet |= ExecEventActivityByDeepFirst(pNode, eEventType, bIsFormReady, 465 iRet |= ExecEventActivityByDeepFirst(pNode, eEventType, bIsFormReady,
466 bRecursive, pExclude); 466 bRecursive, pExclude);
467 } 467 }
468 } 468 }
469 } 469 }
470 CXFA_WidgetAcc* pWidgetAcc = (CXFA_WidgetAcc*)pFormNode->GetWidgetData(); 470 CXFA_WidgetAcc* pWidgetAcc = (CXFA_WidgetAcc*)pFormNode->GetWidgetData();
471 if (pWidgetAcc == NULL) { 471 if (pWidgetAcc == NULL) {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 if (pCurrentAcc != pWidgetAcc) { 627 if (pCurrentAcc != pWidgetAcc) {
628 m_CalculateAccs.Add(pWidgetAcc); 628 m_CalculateAccs.Add(pWidgetAcc);
629 } 629 }
630 } 630 }
631 void CXFA_FFDocView::AddCalculateNodeNotify(CXFA_Node* pNodeChange) { 631 void CXFA_FFDocView::AddCalculateNodeNotify(CXFA_Node* pNodeChange) {
632 CXFA_CalcData* pGlobalData = 632 CXFA_CalcData* pGlobalData =
633 (CXFA_CalcData*)pNodeChange->GetUserData(XFA_CalcData); 633 (CXFA_CalcData*)pNodeChange->GetUserData(XFA_CalcData);
634 int32_t iCount = pGlobalData ? pGlobalData->m_Globals.GetSize() : 0; 634 int32_t iCount = pGlobalData ? pGlobalData->m_Globals.GetSize() : 0;
635 for (int32_t i = 0; i < iCount; i++) { 635 for (int32_t i = 0; i < iCount; i++) {
636 CXFA_WidgetAcc* pResultAcc = pGlobalData->m_Globals[i]; 636 CXFA_WidgetAcc* pResultAcc = pGlobalData->m_Globals[i];
637 if (pResultAcc->GetNode()->HasFlag(XFA_NODEFLAG_HasRemoved)) { 637 if (pResultAcc->GetNode()->HasRemovedChildren())
638 continue; 638 continue;
639 } 639
640 int32_t iAccs = m_CalculateAccs.GetSize(); 640 int32_t iAccs = m_CalculateAccs.GetSize();
641 CXFA_WidgetAcc* pCurrentAcc = 641 CXFA_WidgetAcc* pCurrentAcc =
642 iAccs > 0 ? m_CalculateAccs[iAccs - 1] : nullptr; 642 iAccs > 0 ? m_CalculateAccs[iAccs - 1] : nullptr;
643 if (pCurrentAcc != pResultAcc) { 643 if (pCurrentAcc != pResultAcc) {
644 m_CalculateAccs.Add(pResultAcc); 644 m_CalculateAccs.Add(pResultAcc);
645 } 645 }
646 } 646 }
647 } 647 }
648 void CXFA_FFDocView::RunCalculateRecursive(int32_t& iIndex) { 648 void CXFA_FFDocView::RunCalculateRecursive(int32_t& iIndex) {
649 while (iIndex < m_CalculateAccs.GetSize()) { 649 while (iIndex < m_CalculateAccs.GetSize()) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 m_ValidateAccs.RemoveAll(); 696 m_ValidateAccs.RemoveAll();
697 return TRUE; 697 return TRUE;
698 } 698 }
699 FX_BOOL CXFA_FFDocView::RunValidate() { 699 FX_BOOL CXFA_FFDocView::RunValidate() {
700 if (!m_pDoc->GetDocProvider()->IsValidationsEnabled(m_pDoc)) { 700 if (!m_pDoc->GetDocProvider()->IsValidationsEnabled(m_pDoc)) {
701 return FALSE; 701 return FALSE;
702 } 702 }
703 int32_t iCounts = m_ValidateAccs.GetSize(); 703 int32_t iCounts = m_ValidateAccs.GetSize();
704 for (int32_t i = 0; i < iCounts; i++) { 704 for (int32_t i = 0; i < iCounts; i++) {
705 CXFA_WidgetAcc* pAcc = m_ValidateAccs[i]; 705 CXFA_WidgetAcc* pAcc = m_ValidateAccs[i];
706 if (pAcc->GetNode()->HasFlag(XFA_NODEFLAG_HasRemoved)) { 706 if (pAcc->GetNode()->HasRemovedChildren())
707 continue; 707 continue;
708 } 708
709 pAcc->ProcessValidate(); 709 pAcc->ProcessValidate();
710 } 710 }
711 m_ValidateAccs.RemoveAll(); 711 m_ValidateAccs.RemoveAll();
712 return TRUE; 712 return TRUE;
713 } 713 }
714 FX_BOOL CXFA_FFDocView::RunEventLayoutReady() { 714 FX_BOOL CXFA_FFDocView::RunEventLayoutReady() {
715 CXFA_Node* pRootItem = 715 CXFA_Node* pRootItem =
716 ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form)); 716 ToNode(m_pDoc->GetXFADoc()->GetXFAObject(XFA_HASHCODE_Form));
717 if (!pRootItem) { 717 if (!pRootItem) {
718 return FALSE; 718 return FALSE;
719 } 719 }
720 ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready); 720 ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready);
721 RunLayout(); 721 RunLayout();
722 return TRUE; 722 return TRUE;
723 } 723 }
724 void CXFA_FFDocView::RunBindItems() { 724 void CXFA_FFDocView::RunBindItems() {
725 for (int32_t i = 0; i < m_BindItems.GetSize(); i++) { 725 for (int32_t i = 0; i < m_BindItems.GetSize(); i++) {
726 if (m_BindItems[i]->HasFlag(XFA_NODEFLAG_HasRemoved)) 726 if (m_BindItems[i]->HasRemovedChildren())
727 continue; 727 continue;
728 728
729 CXFA_Node* pWidgetNode = m_BindItems[i]->GetNodeItem(XFA_NODEITEM_Parent); 729 CXFA_Node* pWidgetNode = m_BindItems[i]->GetNodeItem(XFA_NODEITEM_Parent);
730 CXFA_WidgetAcc* pAcc = 730 CXFA_WidgetAcc* pAcc =
731 static_cast<CXFA_WidgetAcc*>(pWidgetNode->GetWidgetData()); 731 static_cast<CXFA_WidgetAcc*>(pWidgetNode->GetWidgetData());
732 if (!pAcc) 732 if (!pAcc)
733 continue; 733 continue;
734 734
735 CXFA_BindItems binditems(m_BindItems[i]); 735 CXFA_BindItems binditems(m_BindItems[i]);
736 CXFA_ScriptContext* pScriptContext = 736 CXFA_ScriptContext* pScriptContext =
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 CXFA_WidgetAcc* CXFA_WidgetAccIterator::GetCurrentWidgetAcc() { 839 CXFA_WidgetAcc* CXFA_WidgetAccIterator::GetCurrentWidgetAcc() {
840 return NULL; 840 return NULL;
841 } 841 }
842 FX_BOOL CXFA_WidgetAccIterator::SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget) { 842 FX_BOOL CXFA_WidgetAccIterator::SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget) {
843 return FALSE; 843 return FALSE;
844 } 844 }
845 void CXFA_WidgetAccIterator::SkipTree() { 845 void CXFA_WidgetAccIterator::SkipTree() {
846 m_ContentIterator.SkipChildrenAndMoveToNext(); 846 m_ContentIterator.SkipChildrenAndMoveToNext();
847 m_pCurWidgetAcc = NULL; 847 m_pCurWidgetAcc = NULL;
848 } 848 }
OLDNEW
« no previous file with comments | « no previous file | xfa/fxfa/app/xfa_fffield.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698