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

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

Issue 1891673003: Pass CFX_WideString to CXFA_FFDocView::GetWidgetByName. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Nits Created 4 years, 8 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 | « fpdfsdk/fsdk_baseform.cpp ('k') | xfa/fxfa/app/xfa_ffpageview.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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 CXFA_WidgetAcc* pAcc = GetWidgetAccByName(wsName, pRefAcc);
498 return pAcc->GetNextWidget(NULL); 499 return pAcc ? pAcc->GetNextWidget(nullptr) : nullptr;
499 }
500 return NULL;
501 } 500 }
501
502 CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName( 502 CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName(
503 const CFX_WideStringC& wsName, 503 const CFX_WideString& wsName,
504 CXFA_WidgetAcc* pRefWidgetAcc) { 504 CXFA_WidgetAcc* pRefWidgetAcc) {
505 CFX_WideString wsExpression; 505 CFX_WideString wsExpression;
506 uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | 506 uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties |
507 XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; 507 XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent;
508 CXFA_ScriptContext* pScriptContext = m_pDoc->GetXFADoc()->GetScriptContext(); 508 CXFA_ScriptContext* pScriptContext = m_pDoc->GetXFADoc()->GetScriptContext();
509 if (!pScriptContext) { 509 if (!pScriptContext) {
510 return NULL; 510 return nullptr;
511 } 511 }
512 CXFA_Node* refNode = NULL; 512 CXFA_Node* refNode = nullptr;
513 if (pRefWidgetAcc) { 513 if (pRefWidgetAcc) {
514 refNode = pRefWidgetAcc->GetNode(); 514 refNode = pRefWidgetAcc->GetNode();
515 wsExpression = wsName; 515 wsExpression = wsName;
516 } else { 516 } else {
517 wsExpression = L"$form." + wsName; 517 wsExpression = L"$form." + wsName;
518 } 518 }
519 XFA_RESOLVENODE_RS resoveNodeRS; 519 XFA_RESOLVENODE_RS resoveNodeRS;
520 int32_t iRet = pScriptContext->ResolveObjects( 520 int32_t iRet = pScriptContext->ResolveObjects(
521 refNode, wsExpression.AsStringC(), resoveNodeRS, dwStyle); 521 refNode, wsExpression.AsStringC(), resoveNodeRS, dwStyle);
522 if (iRet < 1) { 522 if (iRet < 1) {
523 return NULL; 523 return nullptr;
524 } 524 }
525 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) { 525 if (resoveNodeRS.dwFlags == XFA_RESOVENODE_RSTYPE_Nodes) {
526 CXFA_Node* pNode = resoveNodeRS.nodes[0]->AsNode(); 526 CXFA_Node* pNode = resoveNodeRS.nodes[0]->AsNode();
527 if (pNode) { 527 if (pNode) {
528 return (CXFA_WidgetAcc*)pNode->GetWidgetData(); 528 return (CXFA_WidgetAcc*)pNode->GetWidgetData();
529 } 529 }
530 } 530 }
531 return NULL; 531 return nullptr;
532 } 532 }
533 533
534 void CXFA_FFDocView::OnPageEvent(CXFA_ContainerLayoutItem* pSender, 534 void CXFA_FFDocView::OnPageEvent(CXFA_ContainerLayoutItem* pSender,
535 XFA_PAGEEVENT eEvent, 535 XFA_PAGEEVENT eEvent,
536 int32_t iPageIndex) { 536 int32_t iPageIndex) {
537 CXFA_FFPageView* pFFPageView = static_cast<CXFA_FFPageView*>(pSender); 537 CXFA_FFPageView* pFFPageView = static_cast<CXFA_FFPageView*>(pSender);
538 if (eEvent == XFA_PAGEEVENT_PageRemoved) { 538 if (eEvent == XFA_PAGEEVENT_PageRemoved) {
539 m_pDoc->GetDocProvider()->PageViewEvent(pFFPageView, 539 m_pDoc->GetDocProvider()->PageViewEvent(pFFPageView,
540 XFA_PAGEVIEWEVENT_PostRemoved); 540 XFA_PAGEVIEWEVENT_PostRemoved);
541 return; 541 return;
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 CXFA_WidgetAcc* CXFA_WidgetAccIterator::GetCurrentWidgetAcc() { 918 CXFA_WidgetAcc* CXFA_WidgetAccIterator::GetCurrentWidgetAcc() {
919 return NULL; 919 return NULL;
920 } 920 }
921 FX_BOOL CXFA_WidgetAccIterator::SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget) { 921 FX_BOOL CXFA_WidgetAccIterator::SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget) {
922 return FALSE; 922 return FALSE;
923 } 923 }
924 void CXFA_WidgetAccIterator::SkipTree() { 924 void CXFA_WidgetAccIterator::SkipTree() {
925 m_ContentIterator.SkipChildrenAndMoveToNext(); 925 m_ContentIterator.SkipChildrenAndMoveToNext();
926 m_pCurWidgetAcc = NULL; 926 m_pCurWidgetAcc = NULL;
927 } 927 }
OLDNEW
« no previous file with comments | « fpdfsdk/fsdk_baseform.cpp ('k') | xfa/fxfa/app/xfa_ffpageview.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698