| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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->GetElementType(); | 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 | |
| 96 if (eType == XFA_Element::ContentArea) | 95 if (eType == XFA_Element::ContentArea) |
| 97 return new CXFA_ContainerLayoutItem(pNode); | 96 return new CXFA_ContainerLayoutItem(pNode); |
| 98 | 97 |
| 99 CXFA_WidgetAcc* pAcc = static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData()); | 98 CXFA_WidgetAcc* pAcc = static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData()); |
| 100 if (!pAcc) | 99 if (!pAcc) |
| 101 return new CXFA_ContentLayoutItem(pNode); | 100 return new CXFA_ContentLayoutItem(pNode); |
| 102 | 101 |
| 103 CXFA_FFWidget* pWidget; | 102 CXFA_FFWidget* pWidget; |
| 104 switch (pAcc->GetUIType()) { | 103 switch (pAcc->GetUIType()) { |
| 105 case XFA_Element::Barcode: | 104 case XFA_Element::Barcode: |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 CXFA_WidgetAcc* pAcc = | 312 CXFA_WidgetAcc* pAcc = |
| 314 pNode ? static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData()) : nullptr; | 313 pNode ? static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData()) : nullptr; |
| 315 pDocView->SetFocusWidgetAcc(pAcc); | 314 pDocView->SetFocusWidgetAcc(pAcc); |
| 316 } | 315 } |
| 317 | 316 |
| 318 void CXFA_FFNotify::OnNodeReady(CXFA_Node* pNode) { | 317 void CXFA_FFNotify::OnNodeReady(CXFA_Node* pNode) { |
| 319 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); | 318 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); |
| 320 if (!pDocView) | 319 if (!pDocView) |
| 321 return; | 320 return; |
| 322 | 321 |
| 323 XFA_Element iType = pNode->GetElementType(); | 322 XFA_Element eType = pNode->GetElementType(); |
| 324 if (XFA_IsCreateWidget(iType)) { | 323 if (XFA_IsCreateWidget(eType)) { |
| 325 CXFA_WidgetAcc* pAcc = new CXFA_WidgetAcc(pDocView, pNode); | 324 CXFA_WidgetAcc* pAcc = new CXFA_WidgetAcc(pDocView, pNode); |
| 326 pNode->SetObject(XFA_ATTRIBUTE_WidgetData, pAcc, &gs_XFADeleteWidgetAcc); | 325 pNode->SetObject(XFA_ATTRIBUTE_WidgetData, pAcc, &gs_XFADeleteWidgetAcc); |
| 327 return; | 326 return; |
| 328 } | 327 } |
| 329 switch (iType) { | 328 switch (eType) { |
| 330 case XFA_Element::BindItems: | 329 case XFA_Element::BindItems: |
| 331 pDocView->m_BindItems.Add(pNode); | 330 pDocView->m_BindItems.Add(pNode); |
| 332 break; | 331 break; |
| 333 case XFA_Element::Validate: { | 332 case XFA_Element::Validate: { |
| 334 pNode->SetFlag(XFA_NodeFlag_NeedsInitApp, false); | 333 pNode->SetFlag(XFA_NodeFlag_NeedsInitApp, false); |
| 335 } break; | 334 } break; |
| 336 default: | 335 default: |
| 337 break; | 336 break; |
| 338 } | 337 } |
| 339 } | 338 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); | 373 CXFA_FFDocView* pDocView = m_pDoc->GetDocView(); |
| 375 if (!pDocView) | 374 if (!pDocView) |
| 376 return; | 375 return; |
| 377 | 376 |
| 378 if (!(pSender->GetPacketID() & XFA_XDPPACKET_Form)) { | 377 if (!(pSender->GetPacketID() & XFA_XDPPACKET_Form)) { |
| 379 if (eAttr == XFA_ATTRIBUTE_Value) | 378 if (eAttr == XFA_ATTRIBUTE_Value) |
| 380 pDocView->AddCalculateNodeNotify(pSender); | 379 pDocView->AddCalculateNodeNotify(pSender); |
| 381 return; | 380 return; |
| 382 } | 381 } |
| 383 | 382 |
| 384 XFA_Element ePType = pParentNode->GetElementType(); | 383 XFA_Element eType = pParentNode->GetElementType(); |
| 385 FX_BOOL bIsContainerNode = pParentNode->IsContainerNode(); | 384 FX_BOOL bIsContainerNode = pParentNode->IsContainerNode(); |
| 386 CXFA_WidgetAcc* pWidgetAcc = | 385 CXFA_WidgetAcc* pWidgetAcc = |
| 387 static_cast<CXFA_WidgetAcc*>(pWidgetNode->GetWidgetData()); | 386 static_cast<CXFA_WidgetAcc*>(pWidgetNode->GetWidgetData()); |
| 388 if (!pWidgetAcc) | 387 if (!pWidgetAcc) |
| 389 return; | 388 return; |
| 390 | 389 |
| 391 bool bUpdateProperty = false; | 390 bool bUpdateProperty = false; |
| 392 pDocView->SetChangeMark(); | 391 pDocView->SetChangeMark(); |
| 393 switch (ePType) { | 392 switch (eType) { |
| 394 case XFA_Element::Caption: { | 393 case XFA_Element::Caption: { |
| 395 CXFA_TextLayout* pCapOut = pWidgetAcc->GetCaptionTextLayout(); | 394 CXFA_TextLayout* pCapOut = pWidgetAcc->GetCaptionTextLayout(); |
| 396 if (!pCapOut) | 395 if (!pCapOut) |
| 397 return; | 396 return; |
| 398 | 397 |
| 399 pCapOut->Unload(); | 398 pCapOut->Unload(); |
| 400 } break; | 399 } break; |
| 401 case XFA_Element::Ui: | 400 case XFA_Element::Ui: |
| 402 case XFA_Element::Para: | 401 case XFA_Element::Para: |
| 403 bUpdateProperty = true; | 402 bUpdateProperty = true; |
| 404 break; | 403 break; |
| 405 default: | 404 default: |
| 406 break; | 405 break; |
| 407 } | 406 } |
| 408 if (bIsContainerNode && eAttr == XFA_ATTRIBUTE_Access) | 407 if (bIsContainerNode && eAttr == XFA_ATTRIBUTE_Access) |
| 409 bUpdateProperty = true; | 408 bUpdateProperty = true; |
| 410 | 409 |
| 411 if (eAttr == XFA_ATTRIBUTE_Value) { | 410 if (eAttr == XFA_ATTRIBUTE_Value) { |
| 412 pDocView->AddCalculateNodeNotify(pSender); | 411 pDocView->AddCalculateNodeNotify(pSender); |
| 413 if (ePType == XFA_Element::Value || bIsContainerNode) { | 412 if (eType == XFA_Element::Value || bIsContainerNode) { |
| 414 if (bIsContainerNode) { | 413 if (bIsContainerNode) { |
| 415 pWidgetAcc->UpdateUIDisplay(); | 414 pWidgetAcc->UpdateUIDisplay(); |
| 416 pDocView->AddCalculateWidgetAcc(pWidgetAcc); | 415 pDocView->AddCalculateWidgetAcc(pWidgetAcc); |
| 417 pDocView->AddValidateWidget(pWidgetAcc); | 416 pDocView->AddValidateWidget(pWidgetAcc); |
| 418 } else if (pWidgetNode->GetNodeItem(XFA_NODEITEM_Parent) | 417 } else if (pWidgetNode->GetNodeItem(XFA_NODEITEM_Parent) |
| 419 ->GetElementType() == XFA_Element::ExclGroup) { | 418 ->GetElementType() == XFA_Element::ExclGroup) { |
| 420 pWidgetAcc->UpdateUIDisplay(); | 419 pWidgetAcc->UpdateUIDisplay(); |
| 421 } | 420 } |
| 422 return; | 421 return; |
| 423 } | 422 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 return; | 505 return; |
| 507 | 506 |
| 508 CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pSender); | 507 CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pSender); |
| 509 if (!pWidget) | 508 if (!pWidget) |
| 510 return; | 509 return; |
| 511 | 510 |
| 512 pDocView->DeleteLayoutItem(pWidget); | 511 pDocView->DeleteLayoutItem(pWidget); |
| 513 m_pDoc->GetDocProvider()->WidgetPreRemove(pWidget, pWidget->GetDataAcc()); | 512 m_pDoc->GetDocProvider()->WidgetPreRemove(pWidget, pWidget->GetDataAcc()); |
| 514 pWidget->AddInvalidateRect(nullptr); | 513 pWidget->AddInvalidateRect(nullptr); |
| 515 } | 514 } |
| OLD | NEW |