| 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_environment.h" | 9 #include "fpdfsdk/cpdfsdk_environment.h" |
| 10 #include "fpdfsdk/cpdfsdk_widget.h" | 10 #include "fpdfsdk/cpdfsdk_widget.h" |
| 11 #include "fpdfsdk/formfiller/cba_fontmap.h" | 11 #include "fpdfsdk/formfiller/cba_fontmap.h" |
| 12 #include "fpdfsdk/formfiller/cffl_formfiller.h" | 12 #include "fpdfsdk/formfiller/cffl_formfiller.h" |
| 13 #include "fpdfsdk/formfiller/cffl_interactiveformfiller.h" | 13 #include "fpdfsdk/formfiller/cffl_interactiveformfiller.h" |
| 14 #include "fpdfsdk/fsdk_common.h" | 14 #include "fpdfsdk/fsdk_common.h" |
| 15 #include "fpdfsdk/pdfwindow/PWL_ListBox.h" | 15 #include "fpdfsdk/pdfwindow/PWL_ListBox.h" |
| 16 #include "third_party/base/ptr_util.h" |
| 16 | 17 |
| 17 #define FFL_DEFAULTLISTBOXFONTSIZE 12.0f | 18 #define FFL_DEFAULTLISTBOXFONTSIZE 12.0f |
| 18 | 19 |
| 19 CFFL_ListBox::CFFL_ListBox(CPDFSDK_Environment* pApp, CPDFSDK_Annot* pWidget) | 20 CFFL_ListBox::CFFL_ListBox(CPDFSDK_Environment* pApp, CPDFSDK_Annot* pWidget) |
| 20 : CFFL_FormFiller(pApp, pWidget) {} | 21 : CFFL_FormFiller(pApp, pWidget) {} |
| 21 | 22 |
| 22 CFFL_ListBox::~CFFL_ListBox() {} | 23 CFFL_ListBox::~CFFL_ListBox() {} |
| 23 | 24 |
| 24 PWL_CREATEPARAM CFFL_ListBox::GetCreateParam() { | 25 PWL_CREATEPARAM CFFL_ListBox::GetCreateParam() { |
| 25 PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam(); | 26 PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam(); |
| 26 | 27 |
| 27 uint32_t dwFieldFlag = m_pWidget->GetFieldFlags(); | 28 uint32_t dwFieldFlag = m_pWidget->GetFieldFlags(); |
| 28 | 29 |
| 29 if (dwFieldFlag & FIELDFLAG_MULTISELECT) { | 30 if (dwFieldFlag & FIELDFLAG_MULTISELECT) { |
| 30 cp.dwFlags |= PLBS_MULTIPLESEL; | 31 cp.dwFlags |= PLBS_MULTIPLESEL; |
| 31 } | 32 } |
| 32 | 33 |
| 33 cp.dwFlags |= PWS_VSCROLL; | 34 cp.dwFlags |= PWS_VSCROLL; |
| 34 | 35 |
| 35 if (cp.dwFlags & PWS_AUTOFONTSIZE) | 36 if (cp.dwFlags & PWS_AUTOFONTSIZE) |
| 36 cp.fFontSize = FFL_DEFAULTLISTBOXFONTSIZE; | 37 cp.fFontSize = FFL_DEFAULTLISTBOXFONTSIZE; |
| 37 | 38 |
| 38 if (!m_pFontMap) { | 39 if (!m_pFontMap) { |
| 39 m_pFontMap = | 40 m_pFontMap = |
| 40 WrapUnique(new CBA_FontMap(m_pWidget, m_pEnv->GetSysHandler())); | 41 pdfium::MakeUnique<CBA_FontMap>(m_pWidget, m_pEnv->GetSysHandler()); |
| 41 } | 42 } |
| 42 cp.pFontMap = m_pFontMap.get(); | 43 cp.pFontMap = m_pFontMap.get(); |
| 43 | 44 |
| 44 return cp; | 45 return cp; |
| 45 } | 46 } |
| 46 | 47 |
| 47 CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const PWL_CREATEPARAM& cp, | 48 CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const PWL_CREATEPARAM& cp, |
| 48 CPDFSDK_PageView* pPageView) { | 49 CPDFSDK_PageView* pPageView) { |
| 49 CPWL_ListBox* pWnd = new CPWL_ListBox(); | 50 CPWL_ListBox* pWnd = new CPWL_ListBox(); |
| 50 pWnd->AttachFFLData(this); | 51 pWnd->AttachFFLData(this); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 RestoreState(pPageView); | 199 RestoreState(pPageView); |
| 199 pRet = GetPDFWindow(pPageView, FALSE); | 200 pRet = GetPDFWindow(pPageView, FALSE); |
| 200 } else { | 201 } else { |
| 201 pRet = GetPDFWindow(pPageView, TRUE); | 202 pRet = GetPDFWindow(pPageView, TRUE); |
| 202 } | 203 } |
| 203 | 204 |
| 204 m_pWidget->UpdateField(); | 205 m_pWidget->UpdateField(); |
| 205 | 206 |
| 206 return pRet; | 207 return pRet; |
| 207 } | 208 } |
| OLD | NEW |