| 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 ------------------------------
- */ |
| 11 | 11 |
| 12 CFFL_TextField::CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot)
: | 12 CFFL_TextField::CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot)
: |
| 13 » CFFL_FormFiller(pApp, pAnnot), | 13 CFFL_FormFiller(pApp, pAnnot), |
| 14 » m_pFontMap(NULL)//, | 14 m_pFontMap(NULL)//, |
| 15 » //m_pSpellCheck(NULL) | 15 //m_pSpellCheck(NULL) |
| 16 { | 16 { |
| 17 » m_State.nStart = m_State.nEnd = 0; | 17 m_State.nStart = m_State.nEnd = 0; |
| 18 } | 18 } |
| 19 | 19 |
| 20 CFFL_TextField::~CFFL_TextField() | 20 CFFL_TextField::~CFFL_TextField() |
| 21 { | 21 { |
| 22 delete m_pFontMap; | 22 delete m_pFontMap; |
| 23 } | 23 } |
| 24 | 24 |
| 25 PWL_CREATEPARAM CFFL_TextField::GetCreateParam() | 25 PWL_CREATEPARAM CFFL_TextField::GetCreateParam() |
| 26 { | 26 { |
| 27 » PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam(); | 27 PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam(); |
| 28 | 28 |
| 29 » ASSERT(m_pWidget != NULL); | 29 ASSERT(m_pWidget != NULL); |
| 30 » int nFlags = m_pWidget->GetFieldFlags(); | 30 int nFlags = m_pWidget->GetFieldFlags(); |
| 31 | 31 |
| 32 | 32 |
| 33 » if (nFlags & FIELDFLAG_PASSWORD) | 33 if (nFlags & FIELDFLAG_PASSWORD) |
| 34 » { | 34 { |
| 35 » » cp.dwFlags |= PES_PASSWORD; | 35 cp.dwFlags |= PES_PASSWORD; |
| 36 » } | 36 } |
| 37 | 37 |
| 38 » if (!(nFlags & FIELDFLAG_DONOTSPELLCHECK)) | 38 if (!(nFlags & FIELDFLAG_DONOTSPELLCHECK)) |
| 39 » { | 39 { |
| 40 » } | 40 } |
| 41 | 41 |
| 42 » if (nFlags & FIELDFLAG_MULTILINE) | 42 if (nFlags & FIELDFLAG_MULTILINE) |
| 43 » { | 43 { |
| 44 » » cp.dwFlags |= PES_MULTILINE | PES_AUTORETURN | PES_TOP; | 44 cp.dwFlags |= PES_MULTILINE | PES_AUTORETURN | PES_TOP; |
| 45 | 45 |
| 46 » » if (!(nFlags & FIELDFLAG_DONOTSCROLL)) | 46 if (!(nFlags & FIELDFLAG_DONOTSCROLL)) |
| 47 » » { | 47 { |
| 48 » » » cp.dwFlags |= PWS_VSCROLL | PES_AUTOSCROLL; | 48 cp.dwFlags |= PWS_VSCROLL | PES_AUTOSCROLL; |
| 49 » » } | 49 } |
| 50 » } | 50 } |
| 51 » else | 51 else |
| 52 » { | 52 { |
| 53 » » cp.dwFlags |= PES_CENTER; | 53 cp.dwFlags |= PES_CENTER; |
| 54 | 54 |
| 55 » » if (!(nFlags & FIELDFLAG_DONOTSCROLL)) | 55 if (!(nFlags & FIELDFLAG_DONOTSCROLL)) |
| 56 » » { | 56 { |
| 57 » » » cp.dwFlags |= PES_AUTOSCROLL; | 57 cp.dwFlags |= PES_AUTOSCROLL; |
| 58 » » } | 58 } |
| 59 » } | 59 } |
| 60 | 60 |
| 61 » if (nFlags & FIELDFLAG_COMB) | 61 if (nFlags & FIELDFLAG_COMB) |
| 62 » { | 62 { |
| 63 » » cp.dwFlags |= PES_CHARARRAY; | 63 cp.dwFlags |= PES_CHARARRAY; |
| 64 » } | 64 } |
| 65 | 65 |
| 66 » if (nFlags & FIELDFLAG_RICHTEXT) | 66 if (nFlags & FIELDFLAG_RICHTEXT) |
| 67 » { | 67 { |
| 68 » » cp.dwFlags |= PES_RICH; | 68 cp.dwFlags |= PES_RICH; |
| 69 » } | 69 } |
| 70 | 70 |
| 71 » cp.dwFlags |= PES_UNDO; | 71 cp.dwFlags |= PES_UNDO; |
| 72 | 72 |
| 73 » switch (m_pWidget->GetAlignment()) | 73 switch (m_pWidget->GetAlignment()) |
| 74 » { | 74 { |
| 75 » default: | 75 default: |
| 76 » case BF_ALIGN_LEFT: | 76 case BF_ALIGN_LEFT: |
| 77 » » cp.dwFlags |= PES_LEFT; | 77 cp.dwFlags |= PES_LEFT; |
| 78 » » break; | 78 break; |
| 79 » case BF_ALIGN_MIDDLE: | 79 case BF_ALIGN_MIDDLE: |
| 80 » » cp.dwFlags |= PES_MIDDLE; | 80 cp.dwFlags |= PES_MIDDLE; |
| 81 » » break; | 81 break; |
| 82 » case BF_ALIGN_RIGHT: | 82 case BF_ALIGN_RIGHT: |
| 83 » » cp.dwFlags |= PES_RIGHT; | 83 cp.dwFlags |= PES_RIGHT; |
| 84 » » break; | 84 break; |
| 85 » } | 85 } |
| 86 | 86 |
| 87 » if (!m_pFontMap) | 87 if (!m_pFontMap) |
| 88 » { | 88 { |
| 89 » » m_pFontMap = new CBA_FontMap(m_pWidget, m_pApp->GetSysHandler())
; | 89 m_pFontMap = new CBA_FontMap(m_pWidget, m_pApp->GetSysHandler()); |
| 90 » » m_pFontMap->Initial(); | 90 m_pFontMap->Initial(); |
| 91 » } | 91 } |
| 92 » cp.pFontMap = m_pFontMap; | 92 cp.pFontMap = m_pFontMap; |
| 93 » cp.pFocusHandler = this; | 93 cp.pFocusHandler = this; |
| 94 | 94 |
| 95 » return cp; | 95 return cp; |
| 96 } | 96 } |
| 97 | 97 |
| 98 CPWL_Wnd* CFFL_TextField::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageVi
ew* pPageView) | 98 CPWL_Wnd* CFFL_TextField::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageVi
ew* pPageView) |
| 99 { | 99 { |
| 100 » CPWL_Edit * pWnd = new CPWL_Edit(); | 100 CPWL_Edit * pWnd = new CPWL_Edit(); |
| 101 » » pWnd->AttachFFLData(this); | 101 pWnd->AttachFFLData(this); |
| 102 » pWnd->Create(cp); | 102 pWnd->Create(cp); |
| 103 | 103 |
| 104 | 104 |
| 105 | 105 |
| 106 » ASSERT(m_pApp != NULL); | 106 ASSERT(m_pApp != NULL); |
| 107 » CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); | 107 CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); |
| 108 » pWnd->SetFillerNotify(pIFormFiller); | 108 pWnd->SetFillerNotify(pIFormFiller); |
| 109 | 109 |
| 110 » ASSERT(m_pWidget != NULL); | 110 ASSERT(m_pWidget != NULL); |
| 111 » int32_t nMaxLen = m_pWidget->GetMaxLen(); | 111 int32_t nMaxLen = m_pWidget->GetMaxLen(); |
| 112 » CFX_WideString swValue = m_pWidget->GetValue(); | 112 CFX_WideString swValue = m_pWidget->GetValue(); |
| 113 | 113 |
| 114 » if (nMaxLen > 0) | 114 if (nMaxLen > 0) |
| 115 » { | 115 { |
| 116 » » if (pWnd->HasFlag(PES_CHARARRAY)) | 116 if (pWnd->HasFlag(PES_CHARARRAY)) |
| 117 » » { | 117 { |
| 118 » » » pWnd->SetCharArray(nMaxLen); | 118 pWnd->SetCharArray(nMaxLen); |
| 119 » » » pWnd->SetAlignFormatV(PEAV_CENTER); | 119 pWnd->SetAlignFormatV(PEAV_CENTER); |
| 120 » » } | 120 } |
| 121 » » else | 121 else |
| 122 » » { | 122 { |
| 123 » » » pWnd->SetLimitChar(nMaxLen); | 123 pWnd->SetLimitChar(nMaxLen); |
| 124 » » } | 124 } |
| 125 » } | 125 } |
| 126 | 126 |
| 127 » pWnd->SetText(swValue.c_str()); | 127 pWnd->SetText(swValue.c_str()); |
| 128 » return pWnd; | 128 return pWnd; |
| 129 } | 129 } |
| 130 | 130 |
| 131 | 131 |
| 132 FX_BOOL»CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFl
ags) | 132 FX_BOOL CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFl
ags) |
| 133 { | 133 { |
| 134 switch (nChar) | 134 switch (nChar) |
| 135 { | 135 { |
| 136 case FWL_VKEY_Return: | 136 case FWL_VKEY_Return: |
| 137 if (!(m_pWidget->GetFieldFlags() & FIELDFLAG_MULTILINE)) | 137 if (!(m_pWidget->GetFieldFlags() & FIELDFLAG_MULTILINE)) |
| 138 { | 138 { |
| 139 CPDFSDK_PageView* pPageView = GetCurPageView(); | 139 CPDFSDK_PageView* pPageView = GetCurPageView(); |
| 140 ASSERT(pPageView != NULL); | 140 ASSERT(pPageView != NULL); |
| 141 m_bValid = !m_bValid; | 141 m_bValid = !m_bValid; |
| 142 CPDF_Rect rcAnnot = pAnnot->GetRect(); | 142 CPDF_Rect rcAnnot = pAnnot->GetRect(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 166 CPDFSDK_PageView* pPageView = GetCurPageView(); | 166 CPDFSDK_PageView* pPageView = GetCurPageView(); |
| 167 ASSERT(pPageView != NULL); | 167 ASSERT(pPageView != NULL); |
| 168 EscapeFiller(pPageView,TRUE); | 168 EscapeFiller(pPageView,TRUE); |
| 169 return TRUE; | 169 return TRUE; |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 | 172 |
| 173 return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); | 173 return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags); |
| 174 } | 174 } |
| 175 | 175 |
| 176 FX_BOOL»CFFL_TextField::IsDataChanged(CPDFSDK_PageView* pPageView) | 176 FX_BOOL CFFL_TextField::IsDataChanged(CPDFSDK_PageView* pPageView) |
| 177 { | 177 { |
| 178 » ASSERT(m_pWidget != NULL); | 178 ASSERT(m_pWidget != NULL); |
| 179 | 179 |
| 180 » if (CPWL_Edit * pEdit = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) | 180 if (CPWL_Edit * pEdit = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) |
| 181 » » return pEdit->GetText() != m_pWidget->GetValue(); | 181 return pEdit->GetText() != m_pWidget->GetValue(); |
| 182 | 182 |
| 183 » return FALSE; | 183 return FALSE; |
| 184 } | 184 } |
| 185 | 185 |
| 186 void CFFL_TextField::SaveData(CPDFSDK_PageView* pPageView) | 186 void CFFL_TextField::SaveData(CPDFSDK_PageView* pPageView) |
| 187 { | 187 { |
| 188 » ASSERT(m_pWidget != NULL); | 188 ASSERT(m_pWidget != NULL); |
| 189 | 189 |
| 190 » if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) | 190 if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) |
| 191 » { | 191 { |
| 192 » » CFX_WideString sOldValue = m_pWidget->GetValue(); | 192 CFX_WideString sOldValue = m_pWidget->GetValue(); |
| 193 » » CFX_WideString sNewValue = pWnd->GetText(); | 193 CFX_WideString sNewValue = pWnd->GetText(); |
| 194 | 194 |
| 195 » » m_pWidget->SetValue(sNewValue, FALSE); | 195 m_pWidget->SetValue(sNewValue, FALSE); |
| 196 » » m_pWidget->ResetFieldAppearance(TRUE); | 196 m_pWidget->ResetFieldAppearance(TRUE); |
| 197 » » m_pWidget->UpdateField(); | 197 m_pWidget->UpdateField(); |
| 198 » » SetChangeMark(); | 198 SetChangeMark(); |
| 199 » } | 199 } |
| 200 } | 200 } |
| 201 | 201 |
| 202 void CFFL_TextField::GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AA
ctionType type, | 202 void CFFL_TextField::GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AA
ctionType type, |
| 203 » » » » » » » » » PDFSDK_F
ieldAction& fa) | 203 PDFSDK_FieldAction& fa) |
| 204 { | 204 { |
| 205 » switch (type) | 205 switch (type) |
| 206 » { | 206 { |
| 207 » case CPDF_AAction::KeyStroke: | 207 case CPDF_AAction::KeyStroke: |
| 208 » » if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)
) | 208 if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) |
| 209 » » { | 209 { |
| 210 » » » fa.bFieldFull = pWnd->IsTextFull(); | 210 fa.bFieldFull = pWnd->IsTextFull(); |
| 211 | 211 |
| 212 » » » fa.sValue = pWnd->GetText(); | 212 fa.sValue = pWnd->GetText(); |
| 213 | 213 |
| 214 » » » if (fa.bFieldFull) | 214 if (fa.bFieldFull) |
| 215 » » » { | 215 { |
| 216 » » » » fa.sChange = L""; | 216 fa.sChange = L""; |
| 217 » » » » fa.sChangeEx = L""; | 217 fa.sChangeEx = L""; |
| 218 » » » } | 218 } |
| 219 » » } | 219 } |
| 220 » » break; | 220 break; |
| 221 » case CPDF_AAction::Validate: | 221 case CPDF_AAction::Validate: |
| 222 » » if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)
) | 222 if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) |
| 223 » » { | 223 { |
| 224 » » » fa.sValue = pWnd->GetText(); | 224 fa.sValue = pWnd->GetText(); |
| 225 » » } | 225 } |
| 226 » » break; | 226 break; |
| 227 » case CPDF_AAction::LoseFocus: | 227 case CPDF_AAction::LoseFocus: |
| 228 » case CPDF_AAction::GetFocus: | 228 case CPDF_AAction::GetFocus: |
| 229 » » ASSERT(m_pWidget != NULL); | 229 ASSERT(m_pWidget != NULL); |
| 230 » » fa.sValue = m_pWidget->GetValue(); | 230 fa.sValue = m_pWidget->GetValue(); |
| 231 » » break; | 231 break; |
| 232 » default: | 232 default: |
| 233 » » break; | 233 break; |
| 234 » } | 234 } |
| 235 } | 235 } |
| 236 | 236 |
| 237 void CFFL_TextField::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AA
ctionType type, | 237 void CFFL_TextField::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AA
ctionType type, |
| 238 » » » » » » » » » const PD
FSDK_FieldAction& fa) | 238 const PDFSDK_FieldAction& fa) |
| 239 { | 239 { |
| 240 » switch (type) | 240 switch (type) |
| 241 » { | 241 { |
| 242 » case CPDF_AAction::KeyStroke: | 242 case CPDF_AAction::KeyStroke: |
| 243 » » if (CPWL_Edit * pEdit = (CPWL_Edit*)GetPDFWindow(pPageView, FALS
E)) | 243 if (CPWL_Edit * pEdit = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) |
| 244 » » { | 244 { |
| 245 » » » pEdit->SetFocus(); | 245 pEdit->SetFocus(); |
| 246 » » » pEdit->SetSel(fa.nSelStart, fa.nSelEnd); | 246 pEdit->SetSel(fa.nSelStart, fa.nSelEnd); |
| 247 » » » pEdit->ReplaceSel(fa.sChange.c_str()); | 247 pEdit->ReplaceSel(fa.sChange.c_str()); |
| 248 » » } | 248 } |
| 249 » » break; | 249 break; |
| 250 » default: | 250 default: |
| 251 » » break; | 251 break; |
| 252 » } | 252 } |
| 253 } | 253 } |
| 254 | 254 |
| 255 | 255 |
| 256 FX_BOOL»CFFL_TextField::IsActionDataChanged(CPDF_AAction::AActionType type, cons
t PDFSDK_FieldAction& faOld, | 256 FX_BOOL CFFL_TextField::IsActionDataChanged(CPDF_AAction::AActionType type, cons
t PDFSDK_FieldAction& faOld, |
| 257 » » » » » » » » » const PD
FSDK_FieldAction& faNew) | 257 const PDFSDK_FieldAction& faNew) |
| 258 { | 258 { |
| 259 » switch (type) | 259 switch (type) |
| 260 » { | 260 { |
| 261 » case CPDF_AAction::KeyStroke: | 261 case CPDF_AAction::KeyStroke: |
| 262 » » return (!faOld.bFieldFull && faOld.nSelEnd != faNew.nSelEnd) ||
faOld.nSelStart != faNew.nSelStart || | 262 return (!faOld.bFieldFull && faOld.nSelEnd != faNew.nSelEnd) || faOld.nS
elStart != faNew.nSelStart || |
| 263 » » » faOld.sChange != faNew.sChange; | 263 faOld.sChange != faNew.sChange; |
| 264 » default: | 264 default: |
| 265 » » break; | 265 break; |
| 266 » } | 266 } |
| 267 | 267 |
| 268 » return FALSE; | 268 return FALSE; |
| 269 } | 269 } |
| 270 | 270 |
| 271 void CFFL_TextField::SaveState(CPDFSDK_PageView* pPageView) | 271 void CFFL_TextField::SaveState(CPDFSDK_PageView* pPageView) |
| 272 { | 272 { |
| 273 » ASSERT(pPageView != NULL); | 273 ASSERT(pPageView != NULL); |
| 274 | 274 |
| 275 » if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) | 275 if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) |
| 276 » { | 276 { |
| 277 » » pWnd->GetSel(m_State.nStart, m_State.nEnd); | 277 pWnd->GetSel(m_State.nStart, m_State.nEnd); |
| 278 » » m_State.sValue = pWnd->GetText(); | 278 m_State.sValue = pWnd->GetText(); |
| 279 » } | 279 } |
| 280 } | 280 } |
| 281 | 281 |
| 282 void CFFL_TextField::RestoreState(CPDFSDK_PageView* pPageView) | 282 void CFFL_TextField::RestoreState(CPDFSDK_PageView* pPageView) |
| 283 { | 283 { |
| 284 » ASSERT(pPageView != NULL); | 284 ASSERT(pPageView != NULL); |
| 285 | 285 |
| 286 » if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, TRUE)) | 286 if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, TRUE)) |
| 287 » { | 287 { |
| 288 » » pWnd->SetText(m_State.sValue.c_str()); | 288 pWnd->SetText(m_State.sValue.c_str()); |
| 289 » » pWnd->SetSel(m_State.nStart, m_State.nEnd); | 289 pWnd->SetSel(m_State.nStart, m_State.nEnd); |
| 290 » } | 290 } |
| 291 } | 291 } |
| 292 | 292 |
| 293 CPWL_Wnd* CFFL_TextField::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bR
estoreValue) | 293 CPWL_Wnd* CFFL_TextField::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bR
estoreValue) |
| 294 { | 294 { |
| 295 » if (bRestoreValue) | 295 if (bRestoreValue) |
| 296 » » SaveState(pPageView); | 296 SaveState(pPageView); |
| 297 | 297 |
| 298 » DestroyPDFWindow(pPageView); | 298 DestroyPDFWindow(pPageView); |
| 299 | 299 |
| 300 » CPWL_Wnd* pRet = NULL; | 300 CPWL_Wnd* pRet = NULL; |
| 301 | 301 |
| 302 » if (bRestoreValue) | 302 if (bRestoreValue) |
| 303 » { | 303 { |
| 304 » » RestoreState(pPageView); | 304 RestoreState(pPageView); |
| 305 » » pRet = GetPDFWindow(pPageView, FALSE); | 305 pRet = GetPDFWindow(pPageView, FALSE); |
| 306 » } | 306 } |
| 307 » else | 307 else |
| 308 » » pRet = GetPDFWindow(pPageView, TRUE); | 308 pRet = GetPDFWindow(pPageView, TRUE); |
| 309 | 309 |
| 310 » m_pWidget->UpdateField(); | 310 m_pWidget->UpdateField(); |
| 311 | 311 |
| 312 » return pRet; | 312 return pRet; |
| 313 } | 313 } |
| 314 | 314 |
| 315 FX_BOOL CFFL_TextField::IsFieldFull(CPDFSDK_PageView* pPageView) | 315 FX_BOOL CFFL_TextField::IsFieldFull(CPDFSDK_PageView* pPageView) |
| 316 { | 316 { |
| 317 if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) | 317 if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) |
| 318 { | 318 { |
| 319 return pWnd->IsTextFull(); | 319 return pWnd->IsTextFull(); |
| 320 } | 320 } |
| 321 | 321 |
| 322 return FALSE; | 322 return FALSE; |
| 323 } | 323 } |
| 324 | 324 |
| 325 void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd) | 325 void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd) |
| 326 { | 326 { |
| 327 » ASSERT(m_pApp != NULL); | 327 ASSERT(m_pApp != NULL); |
| 328 | 328 |
| 329 » ASSERT(pWnd != NULL); | 329 ASSERT(pWnd != NULL); |
| 330 | 330 |
| 331 » if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT) | 331 if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT) |
| 332 » { | 332 { |
| 333 » » CPWL_Edit* pEdit = (CPWL_Edit*)pWnd; | 333 CPWL_Edit* pEdit = (CPWL_Edit*)pWnd; |
| 334 » » pEdit->SetCharSet(134); | 334 pEdit->SetCharSet(134); |
| 335 » » pEdit->SetCodePage(936); | 335 pEdit->SetCodePage(936); |
| 336 | 336 |
| 337 » » pEdit->SetReadyToInput(); | 337 pEdit->SetReadyToInput(); |
| 338 » » CFX_WideString wsText = pEdit->GetText(); | 338 CFX_WideString wsText = pEdit->GetText(); |
| 339 » » int nCharacters = wsText.GetLength(); | 339 int nCharacters = wsText.GetLength(); |
| 340 » » CFX_ByteString bsUTFText = wsText.UTF16LE_Encode(); | 340 CFX_ByteString bsUTFText = wsText.UTF16LE_Encode(); |
| 341 » » unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str(); | 341 unsigned short* pBuffer = (unsigned short*)bsUTFText.c_str(); |
| 342 » » m_pApp->FFI_OnSetFieldInputFocus(m_pWidget->GetFormField(), pBuf
fer, nCharacters, TRUE); | 342 m_pApp->FFI_OnSetFieldInputFocus(m_pWidget->GetFormField(), pBuffer, nCh
aracters, TRUE); |
| 343 | 343 |
| 344 » » pEdit->SetEditNotify(this); | 344 pEdit->SetEditNotify(this); |
| 345 » » //pUndo->BeginEdit(pDocument); | 345 //pUndo->BeginEdit(pDocument); |
| 346 » } | 346 } |
| 347 } | 347 } |
| 348 | 348 |
| 349 void CFFL_TextField::OnKillFocus(CPWL_Wnd* pWnd) | 349 void CFFL_TextField::OnKillFocus(CPWL_Wnd* pWnd) |
| 350 { | 350 { |
| 351 | 351 |
| 352 } | 352 } |
| 353 | 353 |
| 354 FX_BOOL»CFFL_TextField::CanCopy(CPDFSDK_Document* pDocument) | 354 FX_BOOL CFFL_TextField::CanCopy(CPDFSDK_Document* pDocument) |
| 355 { | 355 { |
| 356 » return FALSE; | 356 return FALSE; |
| 357 } | 357 } |
| 358 | 358 |
| 359 FX_BOOL CFFL_TextField::CanCut(CPDFSDK_Document* pDocument) | 359 FX_BOOL CFFL_TextField::CanCut(CPDFSDK_Document* pDocument) |
| 360 { | 360 { |
| 361 » return FALSE; | 361 return FALSE; |
| 362 } | 362 } |
| 363 | 363 |
| 364 FX_BOOL»CFFL_TextField::CanPaste(CPDFSDK_Document* pDocument) | 364 FX_BOOL CFFL_TextField::CanPaste(CPDFSDK_Document* pDocument) |
| 365 { | 365 { |
| 366 » return FALSE; | 366 return FALSE; |
| 367 } | 367 } |
| 368 | 368 |
| 369 void CFFL_TextField::DoCopy(CPDFSDK_Document* pDocument) | 369 void CFFL_TextField::DoCopy(CPDFSDK_Document* pDocument) |
| 370 { | 370 { |
| 371 | 371 |
| 372 } | 372 } |
| 373 | 373 |
| 374 void CFFL_TextField::DoCut(CPDFSDK_Document* pDocument) | 374 void CFFL_TextField::DoCut(CPDFSDK_Document* pDocument) |
| 375 { | 375 { |
| 376 } | 376 } |
| 377 | 377 |
| 378 void CFFL_TextField::DoPaste(CPDFSDK_Document* pDocument) | 378 void CFFL_TextField::DoPaste(CPDFSDK_Document* pDocument) |
| 379 { | 379 { |
| 380 | 380 |
| 381 } | 381 } |
| 382 | 382 |
| 383 void CFFL_TextField::OnAddUndo(CPWL_Edit* pEdit) | 383 void CFFL_TextField::OnAddUndo(CPWL_Edit* pEdit) |
| 384 { | 384 { |
| 385 } | 385 } |
| 386 | 386 |
| OLD | NEW |