| 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 "core/fxcrt/include/fx_ext.h" | 7 #include "core/fxcrt/include/fx_ext.h" |
| 8 #include "xfa/fxbarcode/include/BC_Library.h" | 8 #include "xfa/fxbarcode/include/BC_Library.h" |
| 9 #include "xfa/fxfa/app/xfa_ffnotify.h" | 9 #include "xfa/fxfa/app/xfa_ffnotify.h" |
| 10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" | 10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" |
| 11 #include "xfa/fxfa/parser/xfa_docdata.h" | 11 #include "xfa/fxfa/parser/xfa_docdata.h" |
| 12 #include "xfa/fxfa/parser/xfa_doclayout.h" | 12 #include "xfa/fxfa/parser/xfa_doclayout.h" |
| 13 #include "xfa/fxfa/parser/xfa_document.h" | 13 #include "xfa/fxfa/parser/xfa_document.h" |
| 14 #include "xfa/fxfa/parser/xfa_localemgr.h" | 14 #include "xfa/fxfa/parser/xfa_localemgr.h" |
| 15 #include "xfa/fxfa/parser/xfa_localevalue.h" | 15 #include "xfa/fxfa/parser/xfa_localevalue.h" |
| 16 #include "xfa/fxfa/parser/xfa_object.h" | 16 #include "xfa/fxfa/parser/xfa_object.h" |
| 17 #include "xfa/fxfa/parser/xfa_parser.h" | 17 #include "xfa/fxfa/parser/xfa_parser.h" |
| 18 #include "xfa/fxfa/parser/xfa_script.h" | 18 #include "xfa/fxfa/parser/xfa_script.h" |
| 19 #include "xfa/fxfa/parser/xfa_utils.h" | 19 #include "xfa/fxfa/parser/xfa_utils.h" |
| 20 | 20 |
| 21 static FX_ARGB XFA_WStringToColor(const CFX_WideStringC& wsValue) { | 21 static FX_ARGB XFA_WStringToColor(const CFX_WideStringC& wsValue) { |
| 22 uint8_t r = 0, g = 0, b = 0; | 22 uint8_t r = 0, g = 0, b = 0; |
| 23 if (wsValue.GetLength() == 0) { | 23 if (wsValue.GetLength() == 0) { |
| 24 return 0xff000000; | 24 return 0xff000000; |
| 25 } | 25 } |
| 26 int cc = 0; | 26 int cc = 0; |
| 27 const FX_WCHAR* str = wsValue.GetPtr(); | 27 const FX_WCHAR* str = wsValue.raw_str(); |
| 28 int len = wsValue.GetLength(); | 28 int len = wsValue.GetLength(); |
| 29 while (XFA_IsSpace(str[cc]) && cc < len) { | 29 while (XFA_IsSpace(str[cc]) && cc < len) { |
| 30 cc++; | 30 cc++; |
| 31 } | 31 } |
| 32 if (cc >= len) { | 32 if (cc >= len) { |
| 33 return 0xff000000; | 33 return 0xff000000; |
| 34 } | 34 } |
| 35 while (cc < len) { | 35 while (cc < len) { |
| 36 if (str[cc] == ',' || !XFA_IsDigit(str[cc])) { | 36 if (str[cc] == ',' || !XFA_IsDigit(str[cc])) { |
| 37 break; | 37 break; |
| (...skipping 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1231 pSelectedMember = pNode; | 1231 pSelectedMember = pNode; |
| 1232 break; | 1232 break; |
| 1233 } | 1233 } |
| 1234 } | 1234 } |
| 1235 return pSelectedMember; | 1235 return pSelectedMember; |
| 1236 } | 1236 } |
| 1237 CXFA_Node* CXFA_WidgetData::SetSelectedMember(const CFX_WideStringC& wsName, | 1237 CXFA_Node* CXFA_WidgetData::SetSelectedMember(const CFX_WideStringC& wsName, |
| 1238 FX_BOOL bNotify) { | 1238 FX_BOOL bNotify) { |
| 1239 CXFA_Node* pSelectedMember = NULL; | 1239 CXFA_Node* pSelectedMember = NULL; |
| 1240 uint32_t nameHash = | 1240 uint32_t nameHash = |
| 1241 FX_HashCode_String_GetW(wsName.GetPtr(), wsName.GetLength()); | 1241 FX_HashCode_String_GetW(wsName.raw_str(), wsName.GetLength()); |
| 1242 for (CXFA_Node* pNode = ToNode(m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)); | 1242 for (CXFA_Node* pNode = ToNode(m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild)); |
| 1243 pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 1243 pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
| 1244 if (pNode->GetNameHash() == nameHash) { | 1244 if (pNode->GetNameHash() == nameHash) { |
| 1245 CXFA_WidgetData widgetData(pNode); | 1245 CXFA_WidgetData widgetData(pNode); |
| 1246 widgetData.SetCheckState(XFA_CHECKSTATE_On, bNotify); | 1246 widgetData.SetCheckState(XFA_CHECKSTATE_On, bNotify); |
| 1247 pSelectedMember = pNode; | 1247 pSelectedMember = pNode; |
| 1248 break; | 1248 break; |
| 1249 } | 1249 } |
| 1250 } | 1250 } |
| 1251 return pSelectedMember; | 1251 return pSelectedMember; |
| (...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2648 XFA_ATTRIBUTE attributeValue = XFA_ATTRIBUTE_Type, | 2648 XFA_ATTRIBUTE attributeValue = XFA_ATTRIBUTE_Type, |
| 2649 XFA_ATTRIBUTEENUM eDefaultValue = XFA_ATTRIBUTEENUM_Optional) { | 2649 XFA_ATTRIBUTEENUM eDefaultValue = XFA_ATTRIBUTEENUM_Optional) { |
| 2650 XFA_ATTRIBUTEENUM eType = eDefaultValue; | 2650 XFA_ATTRIBUTEENUM eType = eDefaultValue; |
| 2651 if (pNode) { | 2651 if (pNode) { |
| 2652 if (!pNode->TryEnum(attributeValue, eType, TRUE)) { | 2652 if (!pNode->TryEnum(attributeValue, eType, TRUE)) { |
| 2653 eType = eDefaultValue; | 2653 eType = eDefaultValue; |
| 2654 } | 2654 } |
| 2655 } | 2655 } |
| 2656 return eType; | 2656 return eType; |
| 2657 } | 2657 } |
| OLD | NEW |