| 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_textfield.h" | 7 #include "fpdfsdk/formfiller/cffl_textfield.h" |
| 8 | 8 |
| 9 #include "fpdfsdk/formfiller/cba_fontmap.h" | 9 #include "fpdfsdk/formfiller/cba_fontmap.h" |
| 10 #include "fpdfsdk/include/fsdk_common.h" | 10 #include "fpdfsdk/include/fsdk_common.h" |
| 11 #include "fpdfsdk/include/fsdk_mgr.h" | 11 #include "fpdfsdk/include/fsdk_mgr.h" |
| 12 | 12 |
| 13 CFFL_TextField::CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot) | 13 CFFL_TextField::CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot) |
| 14 : CFFL_FormFiller(pApp, pAnnot), m_pFontMap(NULL) { | 14 : CFFL_FormFiller(pApp, pAnnot), m_pFontMap(nullptr) { |
| 15 m_State.nStart = m_State.nEnd = 0; | 15 m_State.nStart = m_State.nEnd = 0; |
| 16 } | 16 } |
| 17 | 17 |
| 18 CFFL_TextField::~CFFL_TextField() { | 18 CFFL_TextField::~CFFL_TextField() { |
| 19 for (const auto& it : m_Maps) | 19 for (const auto& it : m_Maps) |
| 20 it.second->InvalidateFocusHandler(this); | 20 it.second->InvalidateFocusHandler(this); |
| 21 delete m_pFontMap; | 21 delete m_pFontMap; |
| 22 } | 22 } |
| 23 | 23 |
| 24 PWL_CREATEPARAM CFFL_TextField::GetCreateParam() { | 24 PWL_CREATEPARAM CFFL_TextField::GetCreateParam() { |
| 25 PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam(); | 25 PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam(); |
| 26 | 26 |
| 27 int nFlags = m_pWidget->GetFieldFlags(); | 27 int nFlags = m_pWidget->GetFieldFlags(); |
| 28 | 28 |
| 29 if (nFlags & FIELDFLAG_PASSWORD) { | 29 if (nFlags & FIELDFLAG_PASSWORD) { |
| 30 cp.dwFlags |= PES_PASSWORD; | 30 cp.dwFlags |= PES_PASSWORD; |
| 31 } | 31 } |
| 32 | 32 |
| 33 if (!(nFlags & FIELDFLAG_DONOTSPELLCHECK)) { | |
| 34 } | |
| 35 | |
| 36 if (nFlags & FIELDFLAG_MULTILINE) { | 33 if (nFlags & FIELDFLAG_MULTILINE) { |
| 37 cp.dwFlags |= PES_MULTILINE | PES_AUTORETURN | PES_TOP; | 34 cp.dwFlags |= PES_MULTILINE | PES_AUTORETURN | PES_TOP; |
| 38 | 35 |
| 39 if (!(nFlags & FIELDFLAG_DONOTSCROLL)) { | 36 if (!(nFlags & FIELDFLAG_DONOTSCROLL)) { |
| 40 cp.dwFlags |= PWS_VSCROLL | PES_AUTOSCROLL; | 37 cp.dwFlags |= PWS_VSCROLL | PES_AUTOSCROLL; |
| 41 } | 38 } |
| 42 } else { | 39 } else { |
| 43 cp.dwFlags |= PES_CENTER; | 40 cp.dwFlags |= PES_CENTER; |
| 44 | 41 |
| 45 if (!(nFlags & FIELDFLAG_DONOTSCROLL)) { | 42 if (!(nFlags & FIELDFLAG_DONOTSCROLL)) { |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 } | 234 } |
| 238 } | 235 } |
| 239 | 236 |
| 240 CPWL_Wnd* CFFL_TextField::ResetPDFWindow(CPDFSDK_PageView* pPageView, | 237 CPWL_Wnd* CFFL_TextField::ResetPDFWindow(CPDFSDK_PageView* pPageView, |
| 241 FX_BOOL bRestoreValue) { | 238 FX_BOOL bRestoreValue) { |
| 242 if (bRestoreValue) | 239 if (bRestoreValue) |
| 243 SaveState(pPageView); | 240 SaveState(pPageView); |
| 244 | 241 |
| 245 DestroyPDFWindow(pPageView); | 242 DestroyPDFWindow(pPageView); |
| 246 | 243 |
| 247 CPWL_Wnd* pRet = NULL; | 244 CPWL_Wnd* pRet = nullptr; |
| 248 | 245 |
| 249 if (bRestoreValue) { | 246 if (bRestoreValue) { |
| 250 RestoreState(pPageView); | 247 RestoreState(pPageView); |
| 251 pRet = GetPDFWindow(pPageView, FALSE); | 248 pRet = GetPDFWindow(pPageView, FALSE); |
| 252 } else { | 249 } else { |
| 253 pRet = GetPDFWindow(pPageView, TRUE); | 250 pRet = GetPDFWindow(pPageView, TRUE); |
| 254 } | 251 } |
| 255 | 252 |
| 256 m_pWidget->UpdateField(); | 253 m_pWidget->UpdateField(); |
| 257 | 254 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 283 m_pApp->FFI_OnSetFieldInputFocus(m_pWidget->GetFormField(), pBuffer, | 280 m_pApp->FFI_OnSetFieldInputFocus(m_pWidget->GetFormField(), pBuffer, |
| 284 nCharacters, TRUE); | 281 nCharacters, TRUE); |
| 285 | 282 |
| 286 pEdit->SetEditNotify(this); | 283 pEdit->SetEditNotify(this); |
| 287 } | 284 } |
| 288 } | 285 } |
| 289 | 286 |
| 290 void CFFL_TextField::OnKillFocus(CPWL_Wnd* pWnd) {} | 287 void CFFL_TextField::OnKillFocus(CPWL_Wnd* pWnd) {} |
| 291 | 288 |
| 292 void CFFL_TextField::OnAddUndo(CPWL_Edit* pEdit) {} | 289 void CFFL_TextField::OnAddUndo(CPWL_Edit* pEdit) {} |
| OLD | NEW |