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/fx_ext.h" | 9 #include "core/fxcrt/fx_ext.h" |
10 #include "third_party/base/stl_util.h" | 10 #include "third_party/base/stl_util.h" |
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 std::vector<CFX_WideString> wsSaveTextArray; | 867 std::vector<CFX_WideString> wsSaveTextArray; |
868 GetChoiceListItems(wsSaveTextArray, true); | 868 GetChoiceListItems(wsSaveTextArray, true); |
869 int32_t iSaves = pdfium::CollectionSize<int32_t>(wsSaveTextArray); | 869 int32_t iSaves = pdfium::CollectionSize<int32_t>(wsSaveTextArray); |
870 for (int32_t j = 0; j < iSaves; j++) { | 870 for (int32_t j = 0; j < iSaves; j++) { |
871 if (wsValueArray[nIndex] == wsSaveTextArray[j]) | 871 if (wsValueArray[nIndex] == wsSaveTextArray[j]) |
872 return j; | 872 return j; |
873 } | 873 } |
874 return -1; | 874 return -1; |
875 } | 875 } |
876 | 876 |
877 void CXFA_WidgetData::GetSelectedItems(CFX_Int32Array& iSelArray) { | 877 void CXFA_WidgetData::GetSelectedItems(CFX_ArrayTemplate<int32_t>& iSelArray) { |
878 std::vector<CFX_WideString> wsValueArray; | 878 std::vector<CFX_WideString> wsValueArray; |
879 GetSelectedItemsValue(wsValueArray); | 879 GetSelectedItemsValue(wsValueArray); |
880 int32_t iValues = pdfium::CollectionSize<int32_t>(wsValueArray); | 880 int32_t iValues = pdfium::CollectionSize<int32_t>(wsValueArray); |
881 if (iValues < 1) | 881 if (iValues < 1) |
882 return; | 882 return; |
883 | 883 |
884 std::vector<CFX_WideString> wsSaveTextArray; | 884 std::vector<CFX_WideString> wsSaveTextArray; |
885 GetChoiceListItems(wsSaveTextArray, true); | 885 GetChoiceListItems(wsSaveTextArray, true); |
886 int32_t iSaves = pdfium::CollectionSize<int32_t>(wsSaveTextArray); | 886 int32_t iSaves = pdfium::CollectionSize<int32_t>(wsSaveTextArray); |
887 for (int32_t i = 0; i < iValues; i++) { | 887 for (int32_t i = 0; i < iValues; i++) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 if (iSel < 0) { | 966 if (iSel < 0) { |
967 CFX_WideString wsValue = GetRawValue(); | 967 CFX_WideString wsValue = GetRawValue(); |
968 if (!wsValue.IsEmpty()) { | 968 if (!wsValue.IsEmpty()) { |
969 wsValue += L"\n"; | 969 wsValue += L"\n"; |
970 } | 970 } |
971 wsValue += wsSaveTextArray[nIndex]; | 971 wsValue += wsSaveTextArray[nIndex]; |
972 m_pNode->SetContent(wsValue, wsValue, bNotify, bScriptModify, | 972 m_pNode->SetContent(wsValue, wsValue, bNotify, bScriptModify, |
973 bSyncData); | 973 bSyncData); |
974 } | 974 } |
975 } else if (iSel >= 0) { | 975 } else if (iSel >= 0) { |
976 CFX_Int32Array iSelArray; | 976 CFX_ArrayTemplate<int32_t> iSelArray; |
977 GetSelectedItems(iSelArray); | 977 GetSelectedItems(iSelArray); |
978 for (int32_t i = 0; i < iSelArray.GetSize(); i++) { | 978 for (int32_t i = 0; i < iSelArray.GetSize(); i++) { |
979 if (iSelArray[i] == nIndex) { | 979 if (iSelArray[i] == nIndex) { |
980 iSelArray.RemoveAt(i); | 980 iSelArray.RemoveAt(i); |
981 break; | 981 break; |
982 } | 982 } |
983 } | 983 } |
984 SetSelectedItems(iSelArray, bNotify, bScriptModify, bSyncData); | 984 SetSelectedItems(iSelArray, bNotify, bScriptModify, bSyncData); |
985 } | 985 } |
986 } else { | 986 } else { |
987 if (bSelected) { | 987 if (bSelected) { |
988 if (iSel < 0) { | 988 if (iSel < 0) { |
989 CFX_WideString wsSaveText = wsSaveTextArray[nIndex]; | 989 CFX_WideString wsSaveText = wsSaveTextArray[nIndex]; |
990 CFX_WideString wsFormatText(wsSaveText); | 990 CFX_WideString wsFormatText(wsSaveText); |
991 GetFormatDataValue(wsSaveText, wsFormatText); | 991 GetFormatDataValue(wsSaveText, wsFormatText); |
992 m_pNode->SetContent(wsSaveText, wsFormatText, bNotify, bScriptModify, | 992 m_pNode->SetContent(wsSaveText, wsFormatText, bNotify, bScriptModify, |
993 bSyncData); | 993 bSyncData); |
994 } | 994 } |
995 } else if (iSel >= 0) { | 995 } else if (iSel >= 0) { |
996 m_pNode->SetContent(CFX_WideString(), CFX_WideString(), bNotify, | 996 m_pNode->SetContent(CFX_WideString(), CFX_WideString(), bNotify, |
997 bScriptModify, bSyncData); | 997 bScriptModify, bSyncData); |
998 } | 998 } |
999 } | 999 } |
1000 } | 1000 } |
1001 | 1001 |
1002 void CXFA_WidgetData::SetSelectedItems(CFX_Int32Array& iSelArray, | 1002 void CXFA_WidgetData::SetSelectedItems(CFX_ArrayTemplate<int32_t>& iSelArray, |
1003 bool bNotify, | 1003 bool bNotify, |
1004 bool bScriptModify, | 1004 bool bScriptModify, |
1005 bool bSyncData) { | 1005 bool bSyncData) { |
1006 CFX_WideString wsValue; | 1006 CFX_WideString wsValue; |
1007 int32_t iSize = iSelArray.GetSize(); | 1007 int32_t iSize = iSelArray.GetSize(); |
1008 if (iSize >= 1) { | 1008 if (iSize >= 1) { |
1009 std::vector<CFX_WideString> wsSaveTextArray; | 1009 std::vector<CFX_WideString> wsSaveTextArray; |
1010 GetChoiceListItems(wsSaveTextArray, true); | 1010 GetChoiceListItems(wsSaveTextArray, true); |
1011 CFX_WideString wsItemValue; | 1011 CFX_WideString wsItemValue; |
1012 for (int32_t i = 0; i < iSize; i++) { | 1012 for (int32_t i = 0; i < iSize; i++) { |
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1941 } | 1941 } |
1942 } | 1942 } |
1943 } else if (wc == L'.') { | 1943 } else if (wc == L'.') { |
1944 iTread_ = 0; | 1944 iTread_ = 0; |
1945 iLead = -1; | 1945 iLead = -1; |
1946 } | 1946 } |
1947 wsRet += wc; | 1947 wsRet += wc; |
1948 } | 1948 } |
1949 return wsRet; | 1949 return wsRet; |
1950 } | 1950 } |
OLD | NEW |