OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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/cxfa_widgetdata.h" | 7 #include "xfa/fxfa/parser/cxfa_widgetdata.h" |
8 | 8 |
9 #include "core/fxcrt/include/fx_ext.h" | 9 #include "core/fxcrt/include/fx_ext.h" |
10 #include "xfa/fxbarcode/include/BC_Library.h" | 10 #include "xfa/fxbarcode/include/BC_Library.h" |
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 i++; | 921 i++; |
922 pListNode = pListNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 922 pListNode = pListNode->GetNodeItem(XFA_NODEITEM_NextSibling); |
923 } | 923 } |
924 InsertListTextItem(pNode, wsLabel.AsStringC(), nIndex); | 924 InsertListTextItem(pNode, wsLabel.AsStringC(), nIndex); |
925 InsertListTextItem(pSaveItems, wsNewValue.AsStringC(), nIndex); | 925 InsertListTextItem(pSaveItems, wsNewValue.AsStringC(), nIndex); |
926 } | 926 } |
927 if (!bNotify) | 927 if (!bNotify) |
928 return; | 928 return; |
929 | 929 |
930 m_pNode->GetDocument()->GetNotify()->OnWidgetDataEvent( | 930 m_pNode->GetDocument()->GetNotify()->OnWidgetDataEvent( |
931 this, XFA_WIDGETEVENT_ListItemAdded, (void*)(const FX_WCHAR*)wsLabel, | 931 this, XFA_WIDGETEVENT_ListItemAdded, (void*)wsLabel.c_str(), |
932 (void*)(const FX_WCHAR*)wsValue, (void*)(uintptr_t)nIndex); | 932 (void*)wsValue.c_str(), (void*)(uintptr_t)nIndex); |
933 } | 933 } |
934 | 934 |
935 void CXFA_WidgetData::GetItemLabel(const CFX_WideStringC& wsValue, | 935 void CXFA_WidgetData::GetItemLabel(const CFX_WideStringC& wsValue, |
936 CFX_WideString& wsLabel) { | 936 CFX_WideString& wsLabel) { |
937 int32_t iCount = 0; | 937 int32_t iCount = 0; |
938 CXFA_NodeArray listitems; | 938 CXFA_NodeArray listitems; |
939 CXFA_Node* pItems = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); | 939 CXFA_Node* pItems = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); |
940 for (; pItems; pItems = pItems->GetNodeItem(XFA_NODEITEM_NextSibling)) { | 940 for (; pItems; pItems = pItems->GetNodeItem(XFA_NODEITEM_NextSibling)) { |
941 if (pItems->GetClassID() != XFA_ELEMENT_Items) | 941 if (pItems->GetClassID() != XFA_ELEMENT_Items) |
942 continue; | 942 continue; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 break; | 1118 break; |
1119 } | 1119 } |
1120 } | 1120 } |
1121 return FALSE; | 1121 return FALSE; |
1122 } | 1122 } |
1123 | 1123 |
1124 FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_DataLength(int32_t& val) { | 1124 FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_DataLength(int32_t& val) { |
1125 CXFA_Node* pUIChild = GetUIChild(); | 1125 CXFA_Node* pUIChild = GetUIChild(); |
1126 CFX_WideString wsDataLength; | 1126 CFX_WideString wsDataLength; |
1127 if (pUIChild->TryCData(XFA_ATTRIBUTE_DataLength, wsDataLength)) { | 1127 if (pUIChild->TryCData(XFA_ATTRIBUTE_DataLength, wsDataLength)) { |
1128 val = FXSYS_wtoi(wsDataLength); | 1128 val = FXSYS_wtoi(wsDataLength.c_str()); |
1129 return TRUE; | 1129 return TRUE; |
1130 } | 1130 } |
1131 return FALSE; | 1131 return FALSE; |
1132 } | 1132 } |
1133 | 1133 |
1134 FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_StartChar(FX_CHAR& val) { | 1134 FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_StartChar(FX_CHAR& val) { |
1135 CXFA_Node* pUIChild = GetUIChild(); | 1135 CXFA_Node* pUIChild = GetUIChild(); |
1136 CFX_WideStringC wsStartEndChar; | 1136 CFX_WideStringC wsStartEndChar; |
1137 if (pUIChild->TryCData(XFA_ATTRIBUTE_StartChar, wsStartEndChar)) { | 1137 if (pUIChild->TryCData(XFA_ATTRIBUTE_StartChar, wsStartEndChar)) { |
1138 if (wsStartEndChar.GetLength()) { | 1138 if (wsStartEndChar.GetLength()) { |
(...skipping 13 matching lines...) Expand all Loading... |
1152 return TRUE; | 1152 return TRUE; |
1153 } | 1153 } |
1154 } | 1154 } |
1155 return FALSE; | 1155 return FALSE; |
1156 } | 1156 } |
1157 | 1157 |
1158 FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_ECLevel(int32_t& val) { | 1158 FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_ECLevel(int32_t& val) { |
1159 CXFA_Node* pUIChild = GetUIChild(); | 1159 CXFA_Node* pUIChild = GetUIChild(); |
1160 CFX_WideString wsECLevel; | 1160 CFX_WideString wsECLevel; |
1161 if (pUIChild->TryCData(XFA_ATTRIBUTE_ErrorCorrectionLevel, wsECLevel)) { | 1161 if (pUIChild->TryCData(XFA_ATTRIBUTE_ErrorCorrectionLevel, wsECLevel)) { |
1162 val = FXSYS_wtoi(wsECLevel); | 1162 val = FXSYS_wtoi(wsECLevel.c_str()); |
1163 return TRUE; | 1163 return TRUE; |
1164 } | 1164 } |
1165 return FALSE; | 1165 return FALSE; |
1166 } | 1166 } |
1167 | 1167 |
1168 FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_ModuleWidth(int32_t& val) { | 1168 FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_ModuleWidth(int32_t& val) { |
1169 CXFA_Node* pUIChild = GetUIChild(); | 1169 CXFA_Node* pUIChild = GetUIChild(); |
1170 CXFA_Measurement mModuleWidthHeight; | 1170 CXFA_Measurement mModuleWidthHeight; |
1171 if (pUIChild->TryMeasure(XFA_ATTRIBUTE_ModuleWidth, mModuleWidthHeight)) { | 1171 if (pUIChild->TryMeasure(XFA_ATTRIBUTE_ModuleWidth, mModuleWidthHeight)) { |
1172 val = (int32_t)mModuleWidthHeight.ToUnit(XFA_UNIT_Pt); | 1172 val = (int32_t)mModuleWidthHeight.ToUnit(XFA_UNIT_Pt); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1232 return FALSE; | 1232 return FALSE; |
1233 } | 1233 } |
1234 | 1234 |
1235 FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_WideNarrowRatio(FX_FLOAT& val) { | 1235 FX_BOOL CXFA_WidgetData::GetBarcodeAttribute_WideNarrowRatio(FX_FLOAT& val) { |
1236 CXFA_Node* pUIChild = GetUIChild(); | 1236 CXFA_Node* pUIChild = GetUIChild(); |
1237 CFX_WideString wsWideNarrowRatio; | 1237 CFX_WideString wsWideNarrowRatio; |
1238 if (pUIChild->TryCData(XFA_ATTRIBUTE_WideNarrowRatio, wsWideNarrowRatio)) { | 1238 if (pUIChild->TryCData(XFA_ATTRIBUTE_WideNarrowRatio, wsWideNarrowRatio)) { |
1239 FX_STRSIZE ptPos = wsWideNarrowRatio.Find(':'); | 1239 FX_STRSIZE ptPos = wsWideNarrowRatio.Find(':'); |
1240 FX_FLOAT fRatio = 0; | 1240 FX_FLOAT fRatio = 0; |
1241 if (ptPos >= 0) { | 1241 if (ptPos >= 0) { |
1242 fRatio = (FX_FLOAT)FXSYS_wtoi(wsWideNarrowRatio); | 1242 fRatio = (FX_FLOAT)FXSYS_wtoi(wsWideNarrowRatio.c_str()); |
1243 } else { | 1243 } else { |
1244 int32_t fA, fB; | 1244 int32_t fA, fB; |
1245 fA = FXSYS_wtoi(wsWideNarrowRatio.Left(ptPos)); | 1245 fA = FXSYS_wtoi(wsWideNarrowRatio.Left(ptPos).c_str()); |
1246 fB = FXSYS_wtoi(wsWideNarrowRatio.Mid(ptPos + 1)); | 1246 fB = FXSYS_wtoi(wsWideNarrowRatio.Mid(ptPos + 1).c_str()); |
1247 if (fB) | 1247 if (fB) |
1248 fRatio = (FX_FLOAT)fA / fB; | 1248 fRatio = (FX_FLOAT)fA / fB; |
1249 } | 1249 } |
1250 val = fRatio; | 1250 val = fRatio; |
1251 return TRUE; | 1251 return TRUE; |
1252 } | 1252 } |
1253 return FALSE; | 1253 return FALSE; |
1254 } | 1254 } |
1255 | 1255 |
1256 void CXFA_WidgetData::GetPasswordChar(CFX_WideString& wsPassWord) { | 1256 void CXFA_WidgetData::GetPasswordChar(CFX_WideString& wsPassWord) { |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1788 } | 1788 } |
1789 } | 1789 } |
1790 } else if (wc == L'.') { | 1790 } else if (wc == L'.') { |
1791 iTread_ = 0; | 1791 iTread_ = 0; |
1792 iLead = -1; | 1792 iLead = -1; |
1793 } | 1793 } |
1794 wsRet += wc; | 1794 wsRet += wc; |
1795 } | 1795 } |
1796 return wsRet; | 1796 return wsRet; |
1797 } | 1797 } |
OLD | NEW |