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 "../../include/formfiller/FFL_TextField.h" | 7 #include "../../include/formfiller/FFL_TextField.h" |
8 #include "../../include/formfiller/FFL_CBA_Fontmap.h" | 8 #include "../../include/formfiller/FFL_CBA_Fontmap.h" |
9 | 9 |
10 /* ------------------------------- CFFL_TextField ------------------------------
- */ | 10 /* ------------------------------- CFFL_TextField ------------------------------
- */ |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 if (pWnd->HasFlag(PES_CHARARRAY)) | 122 if (pWnd->HasFlag(PES_CHARARRAY)) |
123 { | 123 { |
124 pWnd->SetCharArray(nMaxLen); | 124 pWnd->SetCharArray(nMaxLen); |
125 pWnd->SetAlignFormatV(PEAV_CENTER); | 125 pWnd->SetAlignFormatV(PEAV_CENTER); |
126 } | 126 } |
127 else | 127 else |
128 { | 128 { |
129 pWnd->SetLimitChar(nMaxLen); | 129 pWnd->SetLimitChar(nMaxLen); |
130 } | 130 } |
131 } | 131 } |
132 » | 132 |
133 » pWnd->SetText(swValue); | 133 » pWnd->SetText(swValue.c_str()); |
134 » | |
135 return pWnd; | 134 return pWnd; |
136 } | 135 } |
137 | 136 |
138 | 137 |
139 FX_BOOL CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFl
ags) | 138 FX_BOOL CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFl
ags) |
140 { | 139 { |
141 switch (nChar) | 140 switch (nChar) |
142 { | 141 { |
143 case FWL_VKEY_Return: | 142 case FWL_VKEY_Return: |
144 if (!(m_pWidget->GetFieldFlags() & FIELDFLAG_MULTILINE)) | 143 if (!(m_pWidget->GetFieldFlags() & FIELDFLAG_MULTILINE)) |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 void CFFL_TextField::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AA
ctionType type, | 243 void CFFL_TextField::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AA
ctionType type, |
245 const PD
FSDK_FieldAction& fa) | 244 const PD
FSDK_FieldAction& fa) |
246 { | 245 { |
247 switch (type) | 246 switch (type) |
248 { | 247 { |
249 case CPDF_AAction::KeyStroke: | 248 case CPDF_AAction::KeyStroke: |
250 if (CPWL_Edit * pEdit = (CPWL_Edit*)GetPDFWindow(pPageView, FALS
E)) | 249 if (CPWL_Edit * pEdit = (CPWL_Edit*)GetPDFWindow(pPageView, FALS
E)) |
251 { | 250 { |
252 pEdit->SetFocus(); | 251 pEdit->SetFocus(); |
253 pEdit->SetSel(fa.nSelStart, fa.nSelEnd); | 252 pEdit->SetSel(fa.nSelStart, fa.nSelEnd); |
254 » » » pEdit->ReplaceSel(fa.sChange); | 253 » » » pEdit->ReplaceSel(fa.sChange.c_str()); |
255 } | 254 } |
256 break; | 255 break; |
257 default: | 256 default: |
258 break; | 257 break; |
259 } | 258 } |
260 } | 259 } |
261 | 260 |
262 | 261 |
263 FX_BOOL CFFL_TextField::IsActionDataChanged(CPDF_AAction::AActionType type, cons
t PDFSDK_FieldAction& faOld, | 262 FX_BOOL CFFL_TextField::IsActionDataChanged(CPDF_AAction::AActionType type, cons
t PDFSDK_FieldAction& faOld, |
264 const PD
FSDK_FieldAction& faNew) | 263 const PD
FSDK_FieldAction& faNew) |
(...skipping 20 matching lines...) Expand all Loading... |
285 m_State.sValue = pWnd->GetText(); | 284 m_State.sValue = pWnd->GetText(); |
286 } | 285 } |
287 } | 286 } |
288 | 287 |
289 void CFFL_TextField::RestoreState(CPDFSDK_PageView* pPageView) | 288 void CFFL_TextField::RestoreState(CPDFSDK_PageView* pPageView) |
290 { | 289 { |
291 ASSERT(pPageView != NULL); | 290 ASSERT(pPageView != NULL); |
292 | 291 |
293 if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, TRUE)) | 292 if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, TRUE)) |
294 { | 293 { |
295 » » pWnd->SetText(m_State.sValue); | 294 » » pWnd->SetText(m_State.sValue.c_str()); |
296 pWnd->SetSel(m_State.nStart, m_State.nEnd); | 295 pWnd->SetSel(m_State.nStart, m_State.nEnd); |
297 } | 296 } |
298 } | 297 } |
299 | 298 |
300 CPWL_Wnd* CFFL_TextField::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bR
estoreValue) | 299 CPWL_Wnd* CFFL_TextField::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bR
estoreValue) |
301 { | 300 { |
302 if (bRestoreValue) | 301 if (bRestoreValue) |
303 SaveState(pPageView); | 302 SaveState(pPageView); |
304 | 303 |
305 DestroyPDFWindow(pPageView); | 304 DestroyPDFWindow(pPageView); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 | 383 |
385 void CFFL_TextField::DoPaste(CPDFSDK_Document* pDocument) | 384 void CFFL_TextField::DoPaste(CPDFSDK_Document* pDocument) |
386 { | 385 { |
387 | 386 |
388 } | 387 } |
389 | 388 |
390 void CFFL_TextField::OnAddUndo(CPWL_Edit* pEdit) | 389 void CFFL_TextField::OnAddUndo(CPWL_Edit* pEdit) |
391 { | 390 { |
392 } | 391 } |
393 | 392 |
OLD | NEW |