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/parser/xfa_script_nodehelper.h" | 7 #include "xfa/fxfa/parser/xfa_script_nodehelper.h" |
8 | 8 |
9 #include "core/fxcrt/include/fx_ext.h" | 9 #include "core/fxcrt/include/fx_ext.h" |
10 #include "xfa/fxfa/parser/xfa_doclayout.h" | 10 #include "xfa/fxfa/parser/xfa_doclayout.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 if (eLogicType == XFA_LOGIC_NoTransparent) { | 216 if (eLogicType == XFA_LOGIC_NoTransparent) { |
217 return pNode->GetNodeItem(XFA_NODEITEM_Parent); | 217 return pNode->GetNodeItem(XFA_NODEITEM_Parent); |
218 } | 218 } |
219 CXFA_Node* parent; | 219 CXFA_Node* parent; |
220 CXFA_Node* node = pNode; | 220 CXFA_Node* node = pNode; |
221 while (TRUE) { | 221 while (TRUE) { |
222 parent = XFA_ResolveNodes_GetParent(node); | 222 parent = XFA_ResolveNodes_GetParent(node); |
223 if (parent == NULL) { | 223 if (parent == NULL) { |
224 break; | 224 break; |
225 } | 225 } |
226 XFA_Element parentElement = parent->GetElementType(); | 226 XFA_Element parentType = parent->GetElementType(); |
227 if ((!parent->IsUnnamed() && parentElement != XFA_Element::SubformSet) || | 227 if ((!parent->IsUnnamed() && parentType != XFA_Element::SubformSet) || |
228 parentElement == XFA_Element::Variables) { | 228 parentType == XFA_Element::Variables) { |
229 break; | 229 break; |
230 } | 230 } |
231 node = parent; | 231 node = parent; |
232 } | 232 } |
233 return parent; | 233 return parent; |
234 } | 234 } |
235 | 235 |
236 int32_t CXFA_NodeHelper::XFA_GetIndex(CXFA_Node* pNode, | 236 int32_t CXFA_NodeHelper::XFA_GetIndex(CXFA_Node* pNode, |
237 XFA_LOGIC_TYPE eLogicType, | 237 XFA_LOGIC_TYPE eLogicType, |
238 FX_BOOL bIsProperty, | 238 FX_BOOL bIsProperty, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 ws = refNode->GetCData(XFA_ATTRIBUTE_Name); | 298 ws = refNode->GetCData(XFA_ATTRIBUTE_Name); |
299 ws.Replace(L".", L"\\."); | 299 ws.Replace(L".", L"\\."); |
300 wsName.Format(L"%s[%d]", ws.c_str(), | 300 wsName.Format(L"%s[%d]", ws.c_str(), |
301 XFA_GetIndex(refNode, eLogicType, bIsProperty, FALSE)); | 301 XFA_GetIndex(refNode, eLogicType, bIsProperty, FALSE)); |
302 } | 302 } |
303 | 303 |
304 FX_BOOL CXFA_NodeHelper::XFA_NodeIsTransparent(CXFA_Node* refNode) { | 304 FX_BOOL CXFA_NodeHelper::XFA_NodeIsTransparent(CXFA_Node* refNode) { |
305 if (refNode == NULL) { | 305 if (refNode == NULL) { |
306 return FALSE; | 306 return FALSE; |
307 } | 307 } |
308 XFA_Element eRefNode = refNode->GetElementType(); | 308 XFA_Element refNodeType = refNode->GetElementType(); |
309 if ((refNode->IsUnnamed() && refNode->IsContainerNode()) || | 309 if ((refNode->IsUnnamed() && refNode->IsContainerNode()) || |
310 eRefNode == XFA_Element::SubformSet || eRefNode == XFA_Element::Area || | 310 refNodeType == XFA_Element::SubformSet || |
311 eRefNode == XFA_Element::Proto) { | 311 refNodeType == XFA_Element::Area || refNodeType == XFA_Element::Proto) { |
312 return TRUE; | 312 return TRUE; |
313 } | 313 } |
314 return FALSE; | 314 return FALSE; |
315 } | 315 } |
316 | 316 |
317 FX_BOOL CXFA_NodeHelper::XFA_CreateNode_ForCondition( | 317 FX_BOOL CXFA_NodeHelper::XFA_CreateNode_ForCondition( |
318 CFX_WideString& wsCondition) { | 318 CFX_WideString& wsCondition) { |
319 int32_t iLen = wsCondition.GetLength(); | 319 int32_t iLen = wsCondition.GetLength(); |
320 CFX_WideString wsIndex(L"0"); | 320 CFX_WideString wsIndex(L"0"); |
321 FX_BOOL bAll = FALSE; | 321 FX_BOOL bAll = FALSE; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 } | 431 } |
432 | 432 |
433 FX_BOOL CXFA_NodeHelper::XFA_NodeIsProperty(CXFA_Node* refNode) { | 433 FX_BOOL CXFA_NodeHelper::XFA_NodeIsProperty(CXFA_Node* refNode) { |
434 CXFA_Node* parent = | 434 CXFA_Node* parent = |
435 XFA_ResolveNodes_GetParent(refNode, XFA_LOGIC_NoTransparent); | 435 XFA_ResolveNodes_GetParent(refNode, XFA_LOGIC_NoTransparent); |
436 return parent && refNode && | 436 return parent && refNode && |
437 XFA_GetPropertyOfElement(parent->GetElementType(), | 437 XFA_GetPropertyOfElement(parent->GetElementType(), |
438 refNode->GetElementType(), | 438 refNode->GetElementType(), |
439 XFA_XDPPACKET_UNKNOWN); | 439 XFA_XDPPACKET_UNKNOWN); |
440 } | 440 } |
OLD | NEW |