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_interactiveformfiller.h" |
12 #include "fpdfsdk/include/cpdfsdk_environment.h" | 12 #include "fpdfsdk/include/cpdfsdk_environment.h" |
13 #include "fpdfsdk/include/cpdfsdk_widget.h" | 13 #include "fpdfsdk/include/cpdfsdk_widget.h" |
14 #include "fpdfsdk/include/fsdk_common.h" | 14 #include "fpdfsdk/include/fsdk_common.h" |
15 #include "fpdfsdk/pdfwindow/PWL_ListBox.h" | 15 #include "fpdfsdk/pdfwindow/PWL_ListBox.h" |
16 | 16 |
17 #define FFL_DEFAULTLISTBOXFONTSIZE 12.0f | 17 #define FFL_DEFAULTLISTBOXFONTSIZE 12.0f |
18 | 18 |
19 CFFL_ListBox::CFFL_ListBox(CPDFSDK_Environment* pApp, CPDFSDK_Annot* pWidget) | 19 CFFL_ListBox::CFFL_ListBox(CPDFSDK_Environment* pApp, CPDFSDK_Annot* pWidget) |
20 : CFFL_FormFiller(pApp, pWidget) {} | 20 : CFFL_FormFiller(pApp, pWidget) {} |
21 | 21 |
(...skipping 18 matching lines...) Expand all Loading... |
40 cp.pFontMap = m_pFontMap.get(); | 40 cp.pFontMap = m_pFontMap.get(); |
41 | 41 |
42 return cp; | 42 return cp; |
43 } | 43 } |
44 | 44 |
45 CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const PWL_CREATEPARAM& cp, | 45 CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const PWL_CREATEPARAM& cp, |
46 CPDFSDK_PageView* pPageView) { | 46 CPDFSDK_PageView* pPageView) { |
47 CPWL_ListBox* pWnd = new CPWL_ListBox(); | 47 CPWL_ListBox* pWnd = new CPWL_ListBox(); |
48 pWnd->AttachFFLData(this); | 48 pWnd->AttachFFLData(this); |
49 pWnd->Create(cp); | 49 pWnd->Create(cp); |
50 | 50 pWnd->SetFillerNotify(m_pEnv->GetInteractiveFormFiller()); |
51 CFFL_IFormFiller* pIFormFiller = m_pEnv->GetIFormFiller(); | |
52 pWnd->SetFillerNotify(pIFormFiller); | |
53 | 51 |
54 for (int32_t i = 0, sz = m_pWidget->CountOptions(); i < sz; i++) | 52 for (int32_t i = 0, sz = m_pWidget->CountOptions(); i < sz; i++) |
55 pWnd->AddString(m_pWidget->GetOptionLabel(i)); | 53 pWnd->AddString(m_pWidget->GetOptionLabel(i)); |
56 | 54 |
57 if (pWnd->HasFlag(PLBS_MULTIPLESEL)) { | 55 if (pWnd->HasFlag(PLBS_MULTIPLESEL)) { |
58 m_OriginSelections.clear(); | 56 m_OriginSelections.clear(); |
59 | 57 |
60 FX_BOOL bSetCaret = FALSE; | 58 FX_BOOL bSetCaret = FALSE; |
61 for (int32_t i = 0, sz = m_pWidget->CountOptions(); i < sz; i++) { | 59 for (int32_t i = 0, sz = m_pWidget->CountOptions(); i < sz; i++) { |
62 if (m_pWidget->IsOptionSelected(i)) { | 60 if (m_pWidget->IsOptionSelected(i)) { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 RestoreState(pPageView); | 196 RestoreState(pPageView); |
199 pRet = GetPDFWindow(pPageView, FALSE); | 197 pRet = GetPDFWindow(pPageView, FALSE); |
200 } else { | 198 } else { |
201 pRet = GetPDFWindow(pPageView, TRUE); | 199 pRet = GetPDFWindow(pPageView, TRUE); |
202 } | 200 } |
203 | 201 |
204 m_pWidget->UpdateField(); | 202 m_pWidget->UpdateField(); |
205 | 203 |
206 return pRet; | 204 return pRet; |
207 } | 205 } |
OLD | NEW |