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 "fpdfsdk/formfiller/cffl_listbox.h" | 7 #include "fpdfsdk/formfiller/cffl_listbox.h" |
8 | 8 |
9 #include "fpdfsdk/cpdfsdk_formfillenvironment.h" | 9 #include "fpdfsdk/cpdfsdk_formfillenvironment.h" |
10 #include "fpdfsdk/cpdfsdk_widget.h" | 10 #include "fpdfsdk/cpdfsdk_widget.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 if (dwFieldFlag & FIELDFLAG_MULTISELECT) { | 31 if (dwFieldFlag & FIELDFLAG_MULTISELECT) { |
32 cp.dwFlags |= PLBS_MULTIPLESEL; | 32 cp.dwFlags |= PLBS_MULTIPLESEL; |
33 } | 33 } |
34 | 34 |
35 cp.dwFlags |= PWS_VSCROLL; | 35 cp.dwFlags |= PWS_VSCROLL; |
36 | 36 |
37 if (cp.dwFlags & PWS_AUTOFONTSIZE) | 37 if (cp.dwFlags & PWS_AUTOFONTSIZE) |
38 cp.fFontSize = FFL_DEFAULTLISTBOXFONTSIZE; | 38 cp.fFontSize = FFL_DEFAULTLISTBOXFONTSIZE; |
39 | 39 |
40 if (!m_pFontMap) { | 40 if (!m_pFontMap) { |
41 m_pFontMap = | 41 m_pFontMap = pdfium::MakeUnique<CBA_FontMap>( |
42 pdfium::MakeUnique<CBA_FontMap>(m_pWidget, m_pEnv->GetSysHandler()); | 42 m_pWidget, m_pFormFillEnv->GetSysHandler()); |
43 } | 43 } |
44 cp.pFontMap = m_pFontMap.get(); | 44 cp.pFontMap = m_pFontMap.get(); |
45 | 45 |
46 return cp; | 46 return cp; |
47 } | 47 } |
48 | 48 |
49 CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const PWL_CREATEPARAM& cp, | 49 CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const PWL_CREATEPARAM& cp, |
50 CPDFSDK_PageView* pPageView) { | 50 CPDFSDK_PageView* pPageView) { |
51 CPWL_ListBox* pWnd = new CPWL_ListBox(); | 51 CPWL_ListBox* pWnd = new CPWL_ListBox(); |
52 pWnd->AttachFFLData(this); | 52 pWnd->AttachFFLData(this); |
53 pWnd->Create(cp); | 53 pWnd->Create(cp); |
54 pWnd->SetFillerNotify(m_pEnv->GetInteractiveFormFiller()); | 54 pWnd->SetFillerNotify(m_pFormFillEnv->GetInteractiveFormFiller()); |
55 | 55 |
56 for (int32_t i = 0, sz = m_pWidget->CountOptions(); i < sz; i++) | 56 for (int32_t i = 0, sz = m_pWidget->CountOptions(); i < sz; i++) |
57 pWnd->AddString(m_pWidget->GetOptionLabel(i)); | 57 pWnd->AddString(m_pWidget->GetOptionLabel(i)); |
58 | 58 |
59 if (pWnd->HasFlag(PLBS_MULTIPLESEL)) { | 59 if (pWnd->HasFlag(PLBS_MULTIPLESEL)) { |
60 m_OriginSelections.clear(); | 60 m_OriginSelections.clear(); |
61 | 61 |
62 FX_BOOL bSetCaret = FALSE; | 62 FX_BOOL bSetCaret = FALSE; |
63 for (int32_t i = 0, sz = m_pWidget->CountOptions(); i < sz; i++) { | 63 for (int32_t i = 0, sz = m_pWidget->CountOptions(); i < sz; i++) { |
64 if (m_pWidget->IsOptionSelected(i)) { | 64 if (m_pWidget->IsOptionSelected(i)) { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 RestoreState(pPageView); | 200 RestoreState(pPageView); |
201 pRet = GetPDFWindow(pPageView, FALSE); | 201 pRet = GetPDFWindow(pPageView, FALSE); |
202 } else { | 202 } else { |
203 pRet = GetPDFWindow(pPageView, TRUE); | 203 pRet = GetPDFWindow(pPageView, TRUE); |
204 } | 204 } |
205 | 205 |
206 m_pWidget->UpdateField(); | 206 m_pWidget->UpdateField(); |
207 | 207 |
208 return pRet; | 208 return pRet; |
209 } | 209 } |
OLD | NEW |