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

Side by Side Diff: fpdfsdk/src/fxedit/fxet_list.cpp

Issue 1566583002: Merge to XFA: Remove header files that only have includes. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Fix XFA Created 4 years, 11 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 | « fpdfsdk/src/fxedit/fxet_edit.cpp ('k') | fpdfsdk/src/fxedit/fxet_module.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/include/fxedit/fxet_edit.h" 7 #include "fpdfsdk/include/fxedit/fxet_edit.h"
8 #include "fpdfsdk/include/fxedit/fxet_list.h" 8 #include "fpdfsdk/include/fxedit/fxet_list.h"
9 #include "fpdfsdk/include/fxedit/fxet_stub.h"
10
11 /* ------------------------------- CFX_ListItem
12 * ---------------------------------- */
13 9
14 CFX_ListItem::CFX_ListItem() 10 CFX_ListItem::CFX_ListItem()
15 : m_pEdit(NULL), 11 : m_pEdit(NULL),
16 m_bSelected(FALSE), 12 m_bSelected(FALSE),
17 m_bCaret(FALSE), 13 m_bCaret(FALSE),
18 m_rcListItem(0.0f, 0.0f, 0.0f, 0.0f) { 14 m_rcListItem(0.0f, 0.0f, 0.0f, 0.0f) {
19 m_pEdit = IFX_Edit::NewEdit(); 15 m_pEdit = IFX_Edit::NewEdit();
20 m_pEdit->SetAlignmentV(1); 16 m_pEdit->SetAlignmentV(1);
21 m_pEdit->Initialize(); 17 m_pEdit->Initialize();
22 } 18 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 return word.Word; 89 return word.Word;
94 } 90 }
95 91
96 CFX_WideString CFX_ListItem::GetText() const { 92 CFX_WideString CFX_ListItem::GetText() const {
97 if (m_pEdit) 93 if (m_pEdit)
98 return m_pEdit->GetText(); 94 return m_pEdit->GetText();
99 95
100 return L""; 96 return L"";
101 } 97 }
102 98
103 /* ------------------------------------ CFX_List
104 * --------------------------------- */
105
106 CFX_List::CFX_List() 99 CFX_List::CFX_List()
107 : m_fFontSize(0.0f), m_pFontMap(NULL), m_bMultiple(FALSE) {} 100 : m_fFontSize(0.0f), m_pFontMap(NULL), m_bMultiple(FALSE) {}
108 101
109 CFX_List::~CFX_List() { 102 CFX_List::~CFX_List() {
110 Empty(); 103 Empty();
111 } 104 }
112 105
113 void CFX_List::Empty() { 106 void CFX_List::Empty() {
114 for (int32_t i = 0, sz = m_aListItems.GetSize(); i < sz; i++) 107 for (int32_t i = 0, sz = m_aListItems.GetSize(); i < sz; i++)
115 delete m_aListItems.GetAt(i); 108 delete m_aListItems.GetAt(i);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 } 294 }
302 295
303 CFX_WideString CFX_List::GetItemText(int32_t nIndex) const { 296 CFX_WideString CFX_List::GetItemText(int32_t nIndex) const {
304 if (CFX_ListItem* pListItem = m_aListItems.GetAt(nIndex)) { 297 if (CFX_ListItem* pListItem = m_aListItems.GetAt(nIndex)) {
305 return pListItem->GetText(); 298 return pListItem->GetText();
306 } 299 }
307 300
308 return L""; 301 return L"";
309 } 302 }
310 303
311 /* ------------------------------------ CPLST_Select
312 * ---------------------------------- */
313
314 CPLST_Select::CPLST_Select() {} 304 CPLST_Select::CPLST_Select() {}
315 305
316 CPLST_Select::~CPLST_Select() { 306 CPLST_Select::~CPLST_Select() {
317 for (int32_t i = 0, sz = m_aItems.GetSize(); i < sz; i++) 307 for (int32_t i = 0, sz = m_aItems.GetSize(); i < sz; i++)
318 delete m_aItems.GetAt(i); 308 delete m_aItems.GetAt(i);
319 309
320 m_aItems.RemoveAll(); 310 m_aItems.RemoveAll();
321 } 311 }
322 312
323 void CPLST_Select::Add(int32_t nItemIndex) { 313 void CPLST_Select::Add(int32_t nItemIndex) {
324 int32_t nIndex = Find(nItemIndex); 314 int32_t nIndex = Find(nItemIndex);
325 315
326 if (nIndex < 0) 316 if (nIndex < 0) {
327 m_aItems.Add(new CPLST_Select_Item(nItemIndex, 1)); 317 m_aItems.Add(new CPLST_Select_Item(nItemIndex, 1));
328 else { 318 } else {
329 if (CPLST_Select_Item* pItem = m_aItems.GetAt(nIndex)) { 319 if (CPLST_Select_Item* pItem = m_aItems.GetAt(nIndex)) {
330 pItem->nState = 1; 320 pItem->nState = 1;
331 } 321 }
332 } 322 }
333 } 323 }
334 324
335 void CPLST_Select::Add(int32_t nBeginIndex, int32_t nEndIndex) { 325 void CPLST_Select::Add(int32_t nBeginIndex, int32_t nEndIndex) {
336 if (nBeginIndex > nEndIndex) { 326 if (nBeginIndex > nEndIndex) {
337 int32_t nTemp = nEndIndex; 327 int32_t nTemp = nEndIndex;
338 nEndIndex = nBeginIndex; 328 nEndIndex = nBeginIndex;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 if (pItem->nState == -1) { 401 if (pItem->nState == -1) {
412 delete pItem; 402 delete pItem;
413 m_aItems.RemoveAt(i); 403 m_aItems.RemoveAt(i);
414 } else { 404 } else {
415 pItem->nState = 0; 405 pItem->nState = 0;
416 } 406 }
417 } 407 }
418 } 408 }
419 } 409 }
420 410
421 /* ------------------------------------ CFX_ListCtrl
422 * --------------------------------- */
423
424 CFX_ListCtrl::CFX_ListCtrl() 411 CFX_ListCtrl::CFX_ListCtrl()
425 : m_pNotify(NULL), 412 : m_pNotify(NULL),
426 m_bNotifyFlag(FALSE), 413 m_bNotifyFlag(FALSE),
427 m_ptScrollPos(0.0f, 0.0f), 414 m_ptScrollPos(0.0f, 0.0f),
428 m_nSelItem(-1), 415 m_nSelItem(-1),
429 m_nFootIndex(-1), 416 m_nFootIndex(-1),
430 m_bCtrlSel(FALSE), 417 m_bCtrlSel(FALSE),
431 m_nCaretIndex(-1) {} 418 m_nCaretIndex(-1) {}
432 419
433 CFX_ListCtrl::~CFX_ListCtrl() {} 420 CFX_ListCtrl::~CFX_ListCtrl() {}
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 int32_t nIndex = GetLastSelected(); 571 int32_t nIndex = GetLastSelected();
585 int32_t nFindIndex = FindNext(nIndex, nChar); 572 int32_t nFindIndex = FindNext(nIndex, nChar);
586 573
587 if (nFindIndex != nIndex) { 574 if (nFindIndex != nIndex) {
588 OnVK(nFindIndex, bShift, bCtrl); 575 OnVK(nFindIndex, bShift, bCtrl);
589 return TRUE; 576 return TRUE;
590 } 577 }
591 return FALSE; 578 return FALSE;
592 } 579 }
593 580
594 /* -------- inner methods ------- */
595
596 void CFX_ListCtrl::SetPlateRect(const CPDF_Rect& rect) { 581 void CFX_ListCtrl::SetPlateRect(const CPDF_Rect& rect) {
597 CFX_ListContainer::SetPlateRect(rect); 582 CFX_ListContainer::SetPlateRect(rect);
598 m_ptScrollPos.x = rect.left; 583 m_ptScrollPos.x = rect.left;
599 SetScrollPos(CPDF_Point(rect.left, rect.top)); 584 SetScrollPos(CPDF_Point(rect.left, rect.top));
600 ReArrange(0); 585 ReArrange(0);
601 InvalidateItem(-1); 586 InvalidateItem(-1);
602 } 587 }
603 588
604 CPDF_Rect CFX_ListCtrl::GetItemRect(int32_t nIndex) const { 589 CPDF_Rect CFX_ListCtrl::GetItemRect(int32_t nIndex) const {
605 return InToOut(CFX_List::GetItemRect(nIndex)); 590 return InToOut(CFX_List::GetItemRect(nIndex));
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 m_aSelItems.Done(); 688 m_aSelItems.Done();
704 } 689 }
705 690
706 void CFX_ListCtrl::Select(int32_t nItemIndex) { 691 void CFX_ListCtrl::Select(int32_t nItemIndex) {
707 if (!IsValid(nItemIndex)) 692 if (!IsValid(nItemIndex))
708 return; 693 return;
709 694
710 if (IsMultipleSel()) { 695 if (IsMultipleSel()) {
711 m_aSelItems.Add(nItemIndex); 696 m_aSelItems.Add(nItemIndex);
712 SelectItems(); 697 SelectItems();
713 } else 698 } else {
714 SetSingleSelect(nItemIndex); 699 SetSingleSelect(nItemIndex);
700 }
715 } 701 }
716 702
717 FX_BOOL CFX_ListCtrl::IsItemVisible(int32_t nItemIndex) const { 703 FX_BOOL CFX_ListCtrl::IsItemVisible(int32_t nItemIndex) const {
718 CPDF_Rect rcPlate = GetPlateRect(); 704 CPDF_Rect rcPlate = GetPlateRect();
719 CPDF_Rect rcItem = GetItemRect(nItemIndex); 705 CPDF_Rect rcItem = GetItemRect(nItemIndex);
720 706
721 return rcItem.bottom >= rcPlate.bottom && rcItem.top <= rcPlate.top; 707 return rcItem.bottom >= rcPlate.bottom && rcItem.top <= rcPlate.top;
722 } 708 }
723 709
724 void CFX_ListCtrl::ScrollToListItem(int32_t nItemIndex) { 710 void CFX_ListCtrl::ScrollToListItem(int32_t nItemIndex) {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 810
825 int32_t CFX_ListCtrl::GetItemIndex(const CPDF_Point& point) const { 811 int32_t CFX_ListCtrl::GetItemIndex(const CPDF_Point& point) const {
826 return CFX_List::GetItemIndex(OutToIn(point)); 812 return CFX_List::GetItemIndex(OutToIn(point));
827 } 813 }
828 814
829 CFX_WideString CFX_ListCtrl::GetText() const { 815 CFX_WideString CFX_ListCtrl::GetText() const {
830 if (IsMultipleSel()) 816 if (IsMultipleSel())
831 return GetItemText(m_nCaretIndex); 817 return GetItemText(m_nCaretIndex);
832 return GetItemText(m_nSelItem); 818 return GetItemText(m_nSelItem);
833 } 819 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fxedit/fxet_edit.cpp ('k') | fpdfsdk/src/fxedit/fxet_module.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698