Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(708)

Side by Side Diff: fpdfsdk/formfiller/cffl_listbox.cpp

Issue 1906133002: Remove unused CFX_IntArray. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Looks to be unused Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | fpdfsdk/fsdk_baseannot.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "fpdfsdk/formfiller/cffl_listbox.h" 7 #include "fpdfsdk/formfiller/cffl_listbox.h"
8 8
9 #include "fpdfsdk/formfiller/cba_fontmap.h" 9 #include "fpdfsdk/formfiller/cba_fontmap.h"
10 #include "fpdfsdk/formfiller/cffl_formfiller.h" 10 #include "fpdfsdk/formfiller/cffl_formfiller.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 ++nSelCount; 104 ++nSelCount;
105 } 105 }
106 } 106 }
107 107
108 return nSelCount != m_OriginSelections.size(); 108 return nSelCount != m_OriginSelections.size();
109 } 109 }
110 return pListBox->GetCurSel() != m_pWidget->GetSelectedIndex(0); 110 return pListBox->GetCurSel() != m_pWidget->GetSelectedIndex(0);
111 } 111 }
112 112
113 void CFFL_ListBox::SaveData(CPDFSDK_PageView* pPageView) { 113 void CFFL_ListBox::SaveData(CPDFSDK_PageView* pPageView) {
114 ASSERT(m_pWidget); 114 CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE);
dsinclair 2016/04/21 20:28:05 nit: static_cast
115 if (!pListBox)
116 return;
115 117
116 if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE)) { 118 int32_t nNewTopIndex = pListBox->GetTopVisibleIndex();
117 CFX_IntArray aOldSelect, aNewSelect; 119 m_pWidget->ClearSelection(FALSE);
118 120 if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) {
119 { 121 for (int32_t i = 0, sz = pListBox->GetCount(); i < sz; i++) {
120 for (int i = 0, sz = m_pWidget->CountOptions(); i < sz; i++) { 122 if (pListBox->IsItemSelected(i))
121 if (m_pWidget->IsOptionSelected(i)) { 123 m_pWidget->SetOptionSelection(i, TRUE, FALSE);
122 aOldSelect.Add(i);
123 }
124 }
125 } 124 }
126 125 } else {
127 int32_t nNewTopIndex = pListBox->GetTopVisibleIndex(); 126 m_pWidget->SetOptionSelection(pListBox->GetCurSel(), TRUE, FALSE);
128
129 m_pWidget->ClearSelection(FALSE);
130
131 if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) {
132 for (int32_t i = 0, sz = pListBox->GetCount(); i < sz; i++) {
133 if (pListBox->IsItemSelected(i)) {
134 m_pWidget->SetOptionSelection(i, TRUE, FALSE);
135 aNewSelect.Add(i);
136 }
137 }
138 } else {
139 m_pWidget->SetOptionSelection(pListBox->GetCurSel(), TRUE, FALSE);
140 aNewSelect.Add(pListBox->GetCurSel());
141 }
142
143 m_pWidget->SetTopVisibleIndex(nNewTopIndex);
144 m_pWidget->ResetFieldAppearance(TRUE);
145 m_pWidget->UpdateField();
146 SetChangeMark();
147 } 127 }
128 m_pWidget->SetTopVisibleIndex(nNewTopIndex);
129 m_pWidget->ResetFieldAppearance(TRUE);
130 m_pWidget->UpdateField();
131 SetChangeMark();
148 } 132 }
149 133
150 void CFFL_ListBox::GetActionData(CPDFSDK_PageView* pPageView, 134 void CFFL_ListBox::GetActionData(CPDFSDK_PageView* pPageView,
151 CPDF_AAction::AActionType type, 135 CPDF_AAction::AActionType type,
152 PDFSDK_FieldAction& fa) { 136 PDFSDK_FieldAction& fa) {
153 switch (type) { 137 switch (type) {
154 case CPDF_AAction::Validate: 138 case CPDF_AAction::Validate:
155 if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) { 139 if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) {
156 fa.sValue = L""; 140 fa.sValue = L"";
157 } else { 141 } else {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 RestoreState(pPageView); 198 RestoreState(pPageView);
215 pRet = GetPDFWindow(pPageView, FALSE); 199 pRet = GetPDFWindow(pPageView, FALSE);
216 } else { 200 } else {
217 pRet = GetPDFWindow(pPageView, TRUE); 201 pRet = GetPDFWindow(pPageView, TRUE);
218 } 202 }
219 203
220 m_pWidget->UpdateField(); 204 m_pWidget->UpdateField();
221 205
222 return pRet; 206 return pRet;
223 } 207 }
OLDNEW
« no previous file with comments | « no previous file | fpdfsdk/fsdk_baseannot.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698