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

Side by Side Diff: xfa/src/fxfa/src/parser/xfa_objectacc_imp.cpp

Issue 1668003003: Call CXFA_Object::ToNode() rather than C-style casting. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 4 years, 10 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
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/src/foxitlib.h" 7 #include "xfa/src/foxitlib.h"
8 #include "xfa/src/fxfa/src/common/xfa_utils.h" 8 #include "xfa/src/fxfa/src/common/xfa_utils.h"
9 #include "xfa/src/fxfa/src/common/xfa_object.h" 9 #include "xfa/src/fxfa/src/common/xfa_object.h"
10 #include "xfa/src/fxfa/src/common/xfa_document.h" 10 #include "xfa/src/fxfa/src/common/xfa_document.h"
(...skipping 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after
1914 if (i == eCheckState) { 1914 if (i == eCheckState) {
1915 pText->TryContent(wsContent); 1915 pText->TryContent(wsContent);
1916 break; 1916 break;
1917 } 1917 }
1918 pText = pText->GetNodeItem(XFA_NODEITEM_NextSibling); 1918 pText = pText->GetNodeItem(XFA_NODEITEM_NextSibling);
1919 } 1919 }
1920 SyncValue(wsContent, bNotify); 1920 SyncValue(wsContent, bNotify);
1921 } 1921 }
1922 } 1922 }
1923 CXFA_Node* CXFA_WidgetData::GetExclGroupNode() { 1923 CXFA_Node* CXFA_WidgetData::GetExclGroupNode() {
1924 CXFA_Node* pExcl = (CXFA_Node*)m_pNode->GetNodeItem(XFA_NODEITEM_Parent); 1924 CXFA_Node* pExcl = ToNode(m_pNode->GetNodeItem(XFA_NODEITEM_Parent));
1925 if (!pExcl || pExcl->GetClassID() != XFA_ELEMENT_ExclGroup) { 1925 if (!pExcl || pExcl->GetClassID() != XFA_ELEMENT_ExclGroup) {
1926 return NULL; 1926 return NULL;
1927 } 1927 }
1928 return pExcl; 1928 return pExcl;
1929 } 1929 }
1930 CXFA_Node* CXFA_WidgetData::GetSelectedMember() { 1930 CXFA_Node* CXFA_WidgetData::GetSelectedMember() {
1931 CXFA_Node* pSelectedMember = NULL; 1931 CXFA_Node* pSelectedMember = NULL;
1932 CFX_WideString wsState = GetRawValue(); 1932 CFX_WideString wsState = GetRawValue();
1933 if (wsState.IsEmpty()) { 1933 if (wsState.IsEmpty()) {
1934 return pSelectedMember; 1934 return pSelectedMember;
1935 } 1935 }
1936 for (CXFA_Node* pNode = 1936 for (CXFA_Node* pNode = ToNode(m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild));
1937 (CXFA_Node*)m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); 1937 pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
1938 pNode != NULL; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
1939 CXFA_WidgetData widgetData(pNode); 1938 CXFA_WidgetData widgetData(pNode);
1940 if (widgetData.GetCheckState() == XFA_CHECKSTATE_On) { 1939 if (widgetData.GetCheckState() == XFA_CHECKSTATE_On) {
1941 pSelectedMember = pNode; 1940 pSelectedMember = pNode;
1942 break; 1941 break;
1943 } 1942 }
1944 } 1943 }
1945 return pSelectedMember; 1944 return pSelectedMember;
1946 } 1945 }
1947 CXFA_Node* CXFA_WidgetData::SetSelectedMember(const CFX_WideStringC& wsName, 1946 CXFA_Node* CXFA_WidgetData::SetSelectedMember(const CFX_WideStringC& wsName,
1948 FX_BOOL bNotify) { 1947 FX_BOOL bNotify) {
1949 CXFA_Node* pSelectedMember = NULL; 1948 CXFA_Node* pSelectedMember = NULL;
1950 FX_DWORD nameHash = 1949 FX_DWORD nameHash =
1951 FX_HashCode_String_GetW(wsName.GetPtr(), wsName.GetLength()); 1950 FX_HashCode_String_GetW(wsName.GetPtr(), wsName.GetLength());
1952 for (CXFA_Node* pNode = 1951 for (CXFA_Node* pNode = ToNode(m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild));
1953 (CXFA_Node*)m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); 1952 pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
1954 pNode != NULL; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
1955 if (pNode->GetNameHash() == nameHash) { 1953 if (pNode->GetNameHash() == nameHash) {
1956 CXFA_WidgetData widgetData(pNode); 1954 CXFA_WidgetData widgetData(pNode);
1957 widgetData.SetCheckState(XFA_CHECKSTATE_On, bNotify); 1955 widgetData.SetCheckState(XFA_CHECKSTATE_On, bNotify);
1958 pSelectedMember = pNode; 1956 pSelectedMember = pNode;
1959 break; 1957 break;
1960 } 1958 }
1961 } 1959 }
1962 return pSelectedMember; 1960 return pSelectedMember;
1963 } 1961 }
1964 void CXFA_WidgetData::SetSelectedMemberByValue(const CFX_WideStringC& wsValue, 1962 void CXFA_WidgetData::SetSelectedMemberByValue(const CFX_WideStringC& wsValue,
(...skipping 1835 matching lines...) Expand 10 before | Expand all | Expand 10 after
3800 return FX_WSTRC(L""); 3798 return FX_WSTRC(L"");
3801 } 3799 }
3802 CXFA_Node* pRefNode = m_pNode->GetChild(nIndex, XFA_ELEMENT_Ref); 3800 CXFA_Node* pRefNode = m_pNode->GetChild(nIndex, XFA_ELEMENT_Ref);
3803 if (!pRefNode) { 3801 if (!pRefNode) {
3804 return FX_WSTRC(L""); 3802 return FX_WSTRC(L"");
3805 } 3803 }
3806 CFX_WideString wsContent; 3804 CFX_WideString wsContent;
3807 pRefNode->TryContent(wsContent); 3805 pRefNode->TryContent(wsContent);
3808 return wsContent; 3806 return wsContent;
3809 } 3807 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698