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