| OLD | NEW |
| 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/app/xfa_ffnotify.h" | 7 #include "xfa/fxfa/app/xfa_ffnotify.h" |
| 8 | 8 |
| 9 #include "fxjse/include/cfxjse_value.h" | 9 #include "fxjse/include/cfxjse_value.h" |
| 10 #include "xfa/fxfa/app/xfa_ffbarcode.h" | 10 #include "xfa/fxfa/app/xfa_ffbarcode.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 } else { | 82 } else { |
| 83 static_cast<CXFA_FFComboBox*>(pWidget)->DeleteItem(iIndex); | 83 static_cast<CXFA_FFComboBox*>(pWidget)->DeleteItem(iIndex); |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 | 88 |
| 89 CXFA_LayoutItem* CXFA_FFNotify::OnCreateLayoutItem(CXFA_Node* pNode) { | 89 CXFA_LayoutItem* CXFA_FFNotify::OnCreateLayoutItem(CXFA_Node* pNode) { |
| 90 CXFA_LayoutProcessor* pLayout = m_pDoc->GetXFADoc()->GetDocLayout(); | 90 CXFA_LayoutProcessor* pLayout = m_pDoc->GetXFADoc()->GetDocLayout(); |
| 91 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pLayout); | 91 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pLayout); |
| 92 XFA_Element eType = pNode->GetClassID(); | 92 XFA_Element eType = pNode->GetElementType(); |
| 93 if (eType == XFA_Element::PageArea) | 93 if (eType == XFA_Element::PageArea) |
| 94 return new CXFA_FFPageView(pDocView, pNode); | 94 return new CXFA_FFPageView(pDocView, pNode); |
| 95 | 95 |
| 96 if (eType == XFA_Element::ContentArea) | 96 if (eType == XFA_Element::ContentArea) |
| 97 return new CXFA_ContainerLayoutItem(pNode); | 97 return new CXFA_ContainerLayoutItem(pNode); |
| 98 | 98 |
| 99 CXFA_WidgetAcc* pAcc = static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData()); | 99 CXFA_WidgetAcc* pAcc = static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData()); |
| 100 if (!pAcc) | 100 if (!pAcc) |
| 101 return new CXFA_ContentLayoutItem(pNode); | 101 return new CXFA_ContentLayoutItem(pNode); |
| 102 | 102 |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 CXFA_WidgetAcc* pAcc = | 313 CXFA_WidgetAcc* pAcc = |
| 314 pNode ? static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData()) : nullptr; | 314 pNode ? static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData()) : nullptr; |
| 315 pDocView->SetFocusWidgetAcc(pAcc); | 315 pDocView->SetFocusWidgetAcc(pAcc); |
| 316 } | 316 } |
| 317 | 317 |
| 318 void CXFA_FFNotify::OnNodeReady(CXFA_Node* pNode) { | 318 void CXFA_FFNotify::OnNodeReady(CXFA_Node* pNode) { |
| 319 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); | 319 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); |
| 320 if (!pDocView) | 320 if (!pDocView) |
| 321 return; | 321 return; |
| 322 | 322 |
| 323 XFA_Element iType = pNode->GetClassID(); | 323 XFA_Element iType = pNode->GetElementType(); |
| 324 if (XFA_IsCreateWidget(iType)) { | 324 if (XFA_IsCreateWidget(iType)) { |
| 325 CXFA_WidgetAcc* pAcc = new CXFA_WidgetAcc(pDocView, pNode); | 325 CXFA_WidgetAcc* pAcc = new CXFA_WidgetAcc(pDocView, pNode); |
| 326 pNode->SetObject(XFA_ATTRIBUTE_WidgetData, pAcc, &gs_XFADeleteWidgetAcc); | 326 pNode->SetObject(XFA_ATTRIBUTE_WidgetData, pAcc, &gs_XFADeleteWidgetAcc); |
| 327 return; | 327 return; |
| 328 } | 328 } |
| 329 switch (iType) { | 329 switch (iType) { |
| 330 case XFA_Element::BindItems: | 330 case XFA_Element::BindItems: |
| 331 pDocView->m_BindItems.Add(pNode); | 331 pDocView->m_BindItems.Add(pNode); |
| 332 break; | 332 break; |
| 333 case XFA_Element::Validate: { | 333 case XFA_Element::Validate: { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); | 374 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); |
| 375 if (!pDocView) | 375 if (!pDocView) |
| 376 return; | 376 return; |
| 377 | 377 |
| 378 if (!(pSender->GetPacketID() & XFA_XDPPACKET_Form)) { | 378 if (!(pSender->GetPacketID() & XFA_XDPPACKET_Form)) { |
| 379 if (eAttr == XFA_ATTRIBUTE_Value) | 379 if (eAttr == XFA_ATTRIBUTE_Value) |
| 380 pDocView->AddCalculateNodeNotify(pSender); | 380 pDocView->AddCalculateNodeNotify(pSender); |
| 381 return; | 381 return; |
| 382 } | 382 } |
| 383 | 383 |
| 384 XFA_Element ePType = pParentNode->GetClassID(); | 384 XFA_Element ePType = pParentNode->GetElementType(); |
| 385 FX_BOOL bIsContainerNode = pParentNode->IsContainerNode(); | 385 FX_BOOL bIsContainerNode = pParentNode->IsContainerNode(); |
| 386 CXFA_WidgetAcc* pWidgetAcc = | 386 CXFA_WidgetAcc* pWidgetAcc = |
| 387 static_cast<CXFA_WidgetAcc*>(pWidgetNode->GetWidgetData()); | 387 static_cast<CXFA_WidgetAcc*>(pWidgetNode->GetWidgetData()); |
| 388 if (!pWidgetAcc) | 388 if (!pWidgetAcc) |
| 389 return; | 389 return; |
| 390 | 390 |
| 391 bool bUpdateProperty = false; | 391 bool bUpdateProperty = false; |
| 392 pDocView->SetChangeMark(); | 392 pDocView->SetChangeMark(); |
| 393 switch (ePType) { | 393 switch (ePType) { |
| 394 case XFA_Element::Caption: { | 394 case XFA_Element::Caption: { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 408 if (bIsContainerNode && eAttr == XFA_ATTRIBUTE_Access) | 408 if (bIsContainerNode && eAttr == XFA_ATTRIBUTE_Access) |
| 409 bUpdateProperty = true; | 409 bUpdateProperty = true; |
| 410 | 410 |
| 411 if (eAttr == XFA_ATTRIBUTE_Value) { | 411 if (eAttr == XFA_ATTRIBUTE_Value) { |
| 412 pDocView->AddCalculateNodeNotify(pSender); | 412 pDocView->AddCalculateNodeNotify(pSender); |
| 413 if (ePType == XFA_Element::Value || bIsContainerNode) { | 413 if (ePType == XFA_Element::Value || bIsContainerNode) { |
| 414 if (bIsContainerNode) { | 414 if (bIsContainerNode) { |
| 415 pWidgetAcc->UpdateUIDisplay(); | 415 pWidgetAcc->UpdateUIDisplay(); |
| 416 pDocView->AddCalculateWidgetAcc(pWidgetAcc); | 416 pDocView->AddCalculateWidgetAcc(pWidgetAcc); |
| 417 pDocView->AddValidateWidget(pWidgetAcc); | 417 pDocView->AddValidateWidget(pWidgetAcc); |
| 418 } else if (pWidgetNode->GetNodeItem(XFA_NODEITEM_Parent)->GetClassID() == | 418 } else if (pWidgetNode->GetNodeItem(XFA_NODEITEM_Parent) |
| 419 XFA_Element::ExclGroup) { | 419 ->GetElementType() == XFA_Element::ExclGroup) { |
| 420 pWidgetAcc->UpdateUIDisplay(); | 420 pWidgetAcc->UpdateUIDisplay(); |
| 421 } | 421 } |
| 422 return; | 422 return; |
| 423 } | 423 } |
| 424 } | 424 } |
| 425 CXFA_FFWidget* pWidget = nullptr; | 425 CXFA_FFWidget* pWidget = nullptr; |
| 426 while ((pWidget = pWidgetAcc->GetNextWidget(pWidget)) != nullptr) { | 426 while ((pWidget = pWidgetAcc->GetNextWidget(pWidget)) != nullptr) { |
| 427 if (!pWidget->IsLoaded()) | 427 if (!pWidget->IsLoaded()) |
| 428 continue; | 428 continue; |
| 429 | 429 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 return; | 506 return; |
| 507 | 507 |
| 508 CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pSender); | 508 CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pSender); |
| 509 if (!pWidget) | 509 if (!pWidget) |
| 510 return; | 510 return; |
| 511 | 511 |
| 512 pDocView->DeleteLayoutItem(pWidget); | 512 pDocView->DeleteLayoutItem(pWidget); |
| 513 m_pDoc->GetDocProvider()->WidgetPreRemove(pWidget, pWidget->GetDataAcc()); | 513 m_pDoc->GetDocProvider()->WidgetPreRemove(pWidget, pWidget->GetDataAcc()); |
| 514 pWidget->AddInvalidateRect(nullptr); | 514 pWidget->AddInvalidateRect(nullptr); |
| 515 } | 515 } |
| OLD | NEW |