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_utils.h" | 7 #include "xfa/fxfa/parser/xfa_utils.h" |
8 | 8 |
9 #include "core/fxcrt/fx_ext.h" | 9 #include "core/fxcrt/fx_ext.h" |
10 #include "xfa/fde/xml/fde_xml_imp.h" | 10 #include "xfa/fde/xml/fde_xml_imp.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 break; | 197 break; |
198 } | 198 } |
199 for (CFDE_XMLNode* pChildXML = | 199 for (CFDE_XMLNode* pChildXML = |
200 pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); | 200 pXMLNode->GetNodeItem(CFDE_XMLNode::FirstChild); |
201 pChildXML; | 201 pChildXML; |
202 pChildXML = pChildXML->GetNodeItem(CFDE_XMLNode::NextSibling)) { | 202 pChildXML = pChildXML->GetNodeItem(CFDE_XMLNode::NextSibling)) { |
203 XFA_GetPlainTextFromRichText(pChildXML, wsPlainText); | 203 XFA_GetPlainTextFromRichText(pChildXML, wsPlainText); |
204 } | 204 } |
205 } | 205 } |
206 | 206 |
207 FX_BOOL XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode) { | 207 bool XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode) { |
208 FX_BOOL bRet = FALSE; | 208 bool bRet = false; |
209 if (!pFieldNode) | 209 if (!pFieldNode) |
210 return bRet; | 210 return bRet; |
211 | 211 |
212 CXFA_Node* pUIChild = pFieldNode->GetChild(0, XFA_Element::Ui); | 212 CXFA_Node* pUIChild = pFieldNode->GetChild(0, XFA_Element::Ui); |
213 if (pUIChild) { | 213 if (pUIChild) { |
214 CXFA_Node* pFirstChild = pUIChild->GetNodeItem(XFA_NODEITEM_FirstChild); | 214 CXFA_Node* pFirstChild = pUIChild->GetNodeItem(XFA_NODEITEM_FirstChild); |
215 if (pFirstChild && | 215 if (pFirstChild && |
216 pFirstChild->GetElementType() == XFA_Element::ChoiceList) { | 216 pFirstChild->GetElementType() == XFA_Element::ChoiceList) { |
217 bRet = pFirstChild->GetEnum(XFA_ATTRIBUTE_Open) == | 217 bRet = pFirstChild->GetEnum(XFA_ATTRIBUTE_Open) == |
218 XFA_ATTRIBUTEENUM_MultiSelect; | 218 XFA_ATTRIBUTEENUM_MultiSelect; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 XFA_ATTRIBUTE eAttribute, | 388 XFA_ATTRIBUTE eAttribute, |
389 uint32_t dwPacket) { | 389 uint32_t dwPacket) { |
390 void* pValue; | 390 void* pValue; |
391 if (XFA_GetAttributeDefaultValue(pValue, eElement, eAttribute, | 391 if (XFA_GetAttributeDefaultValue(pValue, eElement, eAttribute, |
392 XFA_ATTRIBUTETYPE_Measure, dwPacket)) { | 392 XFA_ATTRIBUTETYPE_Measure, dwPacket)) { |
393 return *(CXFA_Measurement*)pValue; | 393 return *(CXFA_Measurement*)pValue; |
394 } | 394 } |
395 return CXFA_Measurement(); | 395 return CXFA_Measurement(); |
396 } | 396 } |
397 | 397 |
398 FX_BOOL XFA_GetAttributeDefaultValue(void*& pValue, | 398 bool XFA_GetAttributeDefaultValue(void*& pValue, |
399 XFA_Element eElement, | 399 XFA_Element eElement, |
400 XFA_ATTRIBUTE eAttribute, | 400 XFA_ATTRIBUTE eAttribute, |
401 XFA_ATTRIBUTETYPE eType, | 401 XFA_ATTRIBUTETYPE eType, |
402 uint32_t dwPacket) { | 402 uint32_t dwPacket) { |
403 const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttribute); | 403 const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttribute); |
404 if (!pInfo) | 404 if (!pInfo) |
405 return FALSE; | 405 return false; |
406 if (dwPacket && (dwPacket & pInfo->dwPackets) == 0) | 406 if (dwPacket && (dwPacket & pInfo->dwPackets) == 0) |
407 return FALSE; | 407 return false; |
408 if (pInfo->eType == eType) { | 408 if (pInfo->eType == eType) { |
409 pValue = pInfo->pDefValue; | 409 pValue = pInfo->pDefValue; |
410 return TRUE; | 410 return true; |
411 } | 411 } |
412 if (pInfo->eType == XFA_ATTRIBUTETYPE_NOTSURE) { | 412 if (pInfo->eType == XFA_ATTRIBUTETYPE_NOTSURE) { |
413 const XFA_NOTSUREATTRIBUTE* pAttr = | 413 const XFA_NOTSUREATTRIBUTE* pAttr = |
414 XFA_GetNotsureAttribute(eElement, eAttribute, eType); | 414 XFA_GetNotsureAttribute(eElement, eAttribute, eType); |
415 if (pAttr) { | 415 if (pAttr) { |
416 pValue = pAttr->pValue; | 416 pValue = pAttr->pValue; |
417 return TRUE; | 417 return true; |
418 } | 418 } |
419 } | 419 } |
420 return FALSE; | 420 return false; |
421 } | 421 } |
422 | 422 |
423 const XFA_ATTRIBUTEINFO* XFA_GetAttributeByName(const CFX_WideStringC& wsName) { | 423 const XFA_ATTRIBUTEINFO* XFA_GetAttributeByName(const CFX_WideStringC& wsName) { |
424 if (wsName.IsEmpty()) | 424 if (wsName.IsEmpty()) |
425 return nullptr; | 425 return nullptr; |
426 | 426 |
427 uint32_t uHash = FX_HashCode_GetW(wsName, false); | 427 uint32_t uHash = FX_HashCode_GetW(wsName, false); |
428 int32_t iStart = 0; | 428 int32_t iStart = 0; |
429 int32_t iEnd = g_iXFAAttributeCount - 1; | 429 int32_t iEnd = g_iXFAAttributeCount - 1; |
430 do { | 430 do { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 uint32_t dwFind = (g_XFAPacketData + iMid)->eName; | 477 uint32_t dwFind = (g_XFAPacketData + iMid)->eName; |
478 if (dwPacket == dwFind) | 478 if (dwPacket == dwFind) |
479 return g_XFAPacketData + iMid; | 479 return g_XFAPacketData + iMid; |
480 if (dwPacket < dwFind) | 480 if (dwPacket < dwFind) |
481 iEnd = iMid - 1; | 481 iEnd = iMid - 1; |
482 else | 482 else |
483 iStart = iMid + 1; | 483 iStart = iMid + 1; |
484 } while (iStart <= iEnd); | 484 } while (iStart <= iEnd); |
485 return nullptr; | 485 return nullptr; |
486 } | 486 } |
OLD | NEW |