Chromium Code Reviews| 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/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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 484 if (pWidgetAcc == NULL) { | 484 if (pWidgetAcc == NULL) { |
| 485 return iRet; | 485 return iRet; |
| 486 } | 486 } |
| 487 CXFA_EventParam eParam; | 487 CXFA_EventParam eParam; |
| 488 eParam.m_eType = eEventType; | 488 eParam.m_eType = eEventType; |
| 489 eParam.m_pTarget = pWidgetAcc; | 489 eParam.m_pTarget = pWidgetAcc; |
| 490 eParam.m_bIsFormReady = bIsFormReady; | 490 eParam.m_bIsFormReady = bIsFormReady; |
| 491 iRet |= XFA_ProcessEvent(this, pWidgetAcc, &eParam); | 491 iRet |= XFA_ProcessEvent(this, pWidgetAcc, &eParam); |
| 492 return iRet; | 492 return iRet; |
| 493 } | 493 } |
| 494 CXFA_FFWidget* CXFA_FFDocView::GetWidgetByName(const CFX_WideStringC& wsName, | 494 |
| 495 CXFA_FFWidget* CXFA_FFDocView::GetWidgetByName(const CFX_WideString& wsName, | |
| 495 CXFA_FFWidget* pRefWidget) { | 496 CXFA_FFWidget* pRefWidget) { |
| 496 CXFA_WidgetAcc* pRefAcc = pRefWidget ? pRefWidget->GetDataAcc() : NULL; | 497 CXFA_WidgetAcc* pRefAcc = pRefWidget ? pRefWidget->GetDataAcc() : nullptr; |
| 497 if (CXFA_WidgetAcc* pAcc = GetWidgetAccByName(wsName, pRefAcc)) { | 498 if (CXFA_WidgetAcc* pAcc = GetWidgetAccByName(wsName, pRefAcc)) |
|
Lei Zhang
2016/04/14 22:15:10
CXFA_WidgetAcc* pAcc = GetWidgetAccByName(wsName,
Tom Sepez
2016/04/14 22:19:57
Much better. done.
| |
| 498 return pAcc->GetNextWidget(NULL); | 499 return pAcc->GetNextWidget(nullptr); |
| 499 } | 500 |
| 500 return NULL; | 501 return nullptr; |
| 501 } | 502 } |
| 503 | |
| 502 CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName( | 504 CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName( |
| 503 const CFX_WideStringC& wsName, | 505 const CFX_WideString& wsName, |
| 504 CXFA_WidgetAcc* pRefWidgetAcc) { | 506 CXFA_WidgetAcc* pRefWidgetAcc) { |
| 505 CFX_WideString wsExpression; | 507 CFX_WideString wsExpression; |
| 506 uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | | 508 uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | |
| 507 XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; | 509 XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; |
| 508 CXFA_ScriptContext* pScriptContext = m_pDoc->GetXFADoc()->GetScriptContext(); | 510 CXFA_ScriptContext* pScriptContext = m_pDoc->GetXFADoc()->GetScriptContext(); |
| 509 if (!pScriptContext) { | 511 if (!pScriptContext) { |
| 510 return NULL; | 512 return nullptr; |
| 511 } | 513 } |
| 512 CXFA_Node* refNode = NULL; | 514 CXFA_Node* refNode = nullptr; |
| 513 if (pRefWidgetAcc) { | 515 if (pRefWidgetAcc) { |
| 514 refNode = pRefWidgetAcc->GetNode(); | 516 refNode = pRefWidgetAcc->GetNode(); |
| 515 wsExpression = wsName; | 517 wsExpression = wsName; |
| 516 } else { | 518 } else { |
| 517 wsExpression = L"$form." + wsName; | 519 wsExpression = L"$form." + wsName; |
| 518 } | 520 } |
| 519 XFA_RESOLVENODE_RS resoveNodeRS; | 521 XFA_RESOLVENODE_RS resoveNodeRS; |
| 520 int32_t iRet = pScriptContext->ResolveObjects( | 522 int32_t iRet = pScriptContext->ResolveObjects( |
| 521 refNode, wsExpression.AsStringC(), resoveNodeRS, dwStyle); | 523 refNode, wsExpression.AsStringC(), resoveNodeRS, dwStyle); |
| 522 if (iRet < 1) { | 524 if (iRet < 1) { |
| 523 return NULL; | 525 return nullptr; |
| 524 } | 526 } |
| 525 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { | 527 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { |
| 526 CXFA_Node* pNode = resoveNodeRS.nodes[0]->AsNode(); | 528 CXFA_Node* pNode = resoveNodeRS.nodes[0]->AsNode(); |
| 527 if (pNode) { | 529 if (pNode) { |
| 528 return (CXFA_WidgetAcc*)pNode->GetWidgetData(); | 530 return (CXFA_WidgetAcc*)pNode->GetWidgetData(); |
| 529 } | 531 } |
| 530 } | 532 } |
| 531 return NULL; | 533 return nullptr; |
| 532 } | 534 } |
| 533 | 535 |
| 534 void CXFA_FFDocView::OnPageEvent(CXFA_ContainerLayoutItem* pSender, | 536 void CXFA_FFDocView::OnPageEvent(CXFA_ContainerLayoutItem* pSender, |
| 535 XFA_PAGEEVENT eEvent, | 537 XFA_PAGEEVENT eEvent, |
| 536 int32_t iPageIndex) { | 538 int32_t iPageIndex) { |
| 537 CXFA_FFPageView* pFFPageView = static_cast<CXFA_FFPageView*>(pSender); | 539 CXFA_FFPageView* pFFPageView = static_cast<CXFA_FFPageView*>(pSender); |
| 538 if (eEvent == XFA_PAGEEVENT_PageRemoved) { | 540 if (eEvent == XFA_PAGEEVENT_PageRemoved) { |
| 539 m_pDoc->GetDocProvider()->PageViewEvent(pFFPageView, | 541 m_pDoc->GetDocProvider()->PageViewEvent(pFFPageView, |
| 540 XFA_PAGEVIEWEVENT_PostRemoved); | 542 XFA_PAGEVIEWEVENT_PostRemoved); |
| 541 return; | 543 return; |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 918 CXFA_WidgetAcc* CXFA_WidgetAccIterator::GetCurrentWidgetAcc() { | 920 CXFA_WidgetAcc* CXFA_WidgetAccIterator::GetCurrentWidgetAcc() { |
| 919 return NULL; | 921 return NULL; |
| 920 } | 922 } |
| 921 FX_BOOL CXFA_WidgetAccIterator::SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget) { | 923 FX_BOOL CXFA_WidgetAccIterator::SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget) { |
| 922 return FALSE; | 924 return FALSE; |
| 923 } | 925 } |
| 924 void CXFA_WidgetAccIterator::SkipTree() { | 926 void CXFA_WidgetAccIterator::SkipTree() { |
| 925 m_ContentIterator.SkipChildrenAndMoveToNext(); | 927 m_ContentIterator.SkipChildrenAndMoveToNext(); |
| 926 m_pCurWidgetAcc = NULL; | 928 m_pCurWidgetAcc = NULL; |
| 927 } | 929 } |
| OLD | NEW |