| 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_ffdocview.h" | 7 #include "xfa/fxfa/app/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_ffapp.h" | 10 #include "xfa/fxfa/app/xfa_ffapp.h" |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 CXFA_WidgetAcc* pRefAcc = pRefWidget ? pRefWidget->GetDataAcc() : NULL; | 498 CXFA_WidgetAcc* pRefAcc = pRefWidget ? pRefWidget->GetDataAcc() : NULL; |
| 499 if (CXFA_WidgetAcc* pAcc = GetWidgetAccByName(wsName, pRefAcc)) { | 499 if (CXFA_WidgetAcc* pAcc = GetWidgetAccByName(wsName, pRefAcc)) { |
| 500 return pAcc->GetNextWidget(NULL); | 500 return pAcc->GetNextWidget(NULL); |
| 501 } | 501 } |
| 502 return NULL; | 502 return NULL; |
| 503 } | 503 } |
| 504 CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName( | 504 CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName( |
| 505 const CFX_WideStringC& wsName, | 505 const CFX_WideStringC& wsName, |
| 506 CXFA_WidgetAcc* pRefWidgetAcc) { | 506 CXFA_WidgetAcc* pRefWidgetAcc) { |
| 507 CFX_WideString wsExpression; | 507 CFX_WideString wsExpression; |
| 508 FX_DWORD dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | | 508 uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | |
| 509 XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; | 509 XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent; |
| 510 IXFA_ScriptContext* pScriptContext = m_pDoc->GetXFADoc()->GetScriptContext(); | 510 IXFA_ScriptContext* pScriptContext = m_pDoc->GetXFADoc()->GetScriptContext(); |
| 511 if (!pScriptContext) { | 511 if (!pScriptContext) { |
| 512 return NULL; | 512 return NULL; |
| 513 } | 513 } |
| 514 CXFA_Node* refNode = NULL; | 514 CXFA_Node* refNode = NULL; |
| 515 if (pRefWidgetAcc) { | 515 if (pRefWidgetAcc) { |
| 516 refNode = pRefWidgetAcc->GetNode(); | 516 refNode = pRefWidgetAcc->GetNode(); |
| 517 wsExpression = wsName; | 517 wsExpression = wsName; |
| 518 } else { | 518 } else { |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 ->GetNodeItem(XFA_NODEITEM_Parent); | 767 ->GetNodeItem(XFA_NODEITEM_Parent); |
| 768 CXFA_WidgetAcc* pAcc = (CXFA_WidgetAcc*)pWidgetNode->GetWidgetData(); | 768 CXFA_WidgetAcc* pAcc = (CXFA_WidgetAcc*)pWidgetNode->GetWidgetData(); |
| 769 if (!pAcc) { | 769 if (!pAcc) { |
| 770 continue; | 770 continue; |
| 771 } | 771 } |
| 772 CXFA_BindItems binditems(reinterpret_cast<CXFA_Node*>(m_bindItems[i])); | 772 CXFA_BindItems binditems(reinterpret_cast<CXFA_Node*>(m_bindItems[i])); |
| 773 IXFA_ScriptContext* pScriptContext = | 773 IXFA_ScriptContext* pScriptContext = |
| 774 pWidgetNode->GetDocument()->GetScriptContext(); | 774 pWidgetNode->GetDocument()->GetScriptContext(); |
| 775 CFX_WideStringC wsRef; | 775 CFX_WideStringC wsRef; |
| 776 binditems.GetRef(wsRef); | 776 binditems.GetRef(wsRef); |
| 777 FX_DWORD dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | | 777 uint32_t dwStyle = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Properties | |
| 778 XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent | | 778 XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_Parent | |
| 779 XFA_RESOLVENODE_ALL; | 779 XFA_RESOLVENODE_ALL; |
| 780 XFA_RESOLVENODE_RS rs; | 780 XFA_RESOLVENODE_RS rs; |
| 781 pScriptContext->ResolveObjects(pWidgetNode, wsRef, rs, dwStyle); | 781 pScriptContext->ResolveObjects(pWidgetNode, wsRef, rs, dwStyle); |
| 782 int32_t iCount = rs.nodes.GetSize(); | 782 int32_t iCount = rs.nodes.GetSize(); |
| 783 pAcc->DeleteItem(-1); | 783 pAcc->DeleteItem(-1); |
| 784 if (rs.dwFlags != XFA_RESOVENODE_RSTYPE_Nodes || iCount < 1) { | 784 if (rs.dwFlags != XFA_RESOVENODE_RSTYPE_Nodes || iCount < 1) { |
| 785 continue; | 785 continue; |
| 786 } | 786 } |
| 787 CFX_WideStringC wsValueRef, wsLabelRef; | 787 CFX_WideStringC wsValueRef, wsLabelRef; |
| 788 binditems.GetValueRef(wsValueRef); | 788 binditems.GetValueRef(wsValueRef); |
| 789 binditems.GetLabelRef(wsLabelRef); | 789 binditems.GetLabelRef(wsLabelRef); |
| 790 const bool bUseValue = wsLabelRef.IsEmpty() || wsLabelRef == wsValueRef; | 790 const bool bUseValue = wsLabelRef.IsEmpty() || wsLabelRef == wsValueRef; |
| 791 const bool bLabelUseContent = | 791 const bool bLabelUseContent = |
| 792 wsLabelRef.IsEmpty() || wsLabelRef == FX_WSTRC(L"$"); | 792 wsLabelRef.IsEmpty() || wsLabelRef == FX_WSTRC(L"$"); |
| 793 const bool bValueUseContent = | 793 const bool bValueUseContent = |
| 794 wsValueRef.IsEmpty() || wsValueRef == FX_WSTRC(L"$"); | 794 wsValueRef.IsEmpty() || wsValueRef == FX_WSTRC(L"$"); |
| 795 CFX_WideString wsValue, wsLabel; | 795 CFX_WideString wsValue, wsLabel; |
| 796 FX_DWORD uValueHash = FX_HashCode_String_GetW(CFX_WideString(wsValueRef), | 796 uint32_t uValueHash = FX_HashCode_String_GetW(CFX_WideString(wsValueRef), |
| 797 wsValueRef.GetLength()); | 797 wsValueRef.GetLength()); |
| 798 for (int32_t i = 0; i < iCount; i++) { | 798 for (int32_t i = 0; i < iCount; i++) { |
| 799 CXFA_Object* refObj = rs.nodes[i]; | 799 CXFA_Object* refObj = rs.nodes[i]; |
| 800 if (!refObj->IsNode()) { | 800 if (!refObj->IsNode()) { |
| 801 continue; | 801 continue; |
| 802 } | 802 } |
| 803 CXFA_Node* refNode = refObj->AsNode(); | 803 CXFA_Node* refNode = refObj->AsNode(); |
| 804 if (bValueUseContent) { | 804 if (bValueUseContent) { |
| 805 wsValue = refNode->GetContent(); | 805 wsValue = refNode->GetContent(); |
| 806 } else { | 806 } else { |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 CXFA_WidgetAcc* CXFA_WidgetAccIterator::GetCurrentWidgetAcc() { | 927 CXFA_WidgetAcc* CXFA_WidgetAccIterator::GetCurrentWidgetAcc() { |
| 928 return NULL; | 928 return NULL; |
| 929 } | 929 } |
| 930 FX_BOOL CXFA_WidgetAccIterator::SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget) { | 930 FX_BOOL CXFA_WidgetAccIterator::SetCurrentWidgetAcc(CXFA_WidgetAcc* hWidget) { |
| 931 return FALSE; | 931 return FALSE; |
| 932 } | 932 } |
| 933 void CXFA_WidgetAccIterator::SkipTree() { | 933 void CXFA_WidgetAccIterator::SkipTree() { |
| 934 m_ContentIterator.SkipChildrenAndMoveToNext(); | 934 m_ContentIterator.SkipChildrenAndMoveToNext(); |
| 935 m_pCurWidgetAcc = NULL; | 935 m_pCurWidgetAcc = NULL; |
| 936 } | 936 } |
| OLD | NEW |