Remove a few unused variables, functions, and member variables.
[pdfium.git] / fpdfsdk / src / formfiller / FFL_TextField.cpp
index 7644d4b..45c7162 100644 (file)
-// Copyright 2014 PDFium Authors. All rights reserved.\r
-// Use of this source code is governed by a BSD-style license that can be\r
-// found in the LICENSE file.\r
\r
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
-\r
-//#include "../include/FormFiller.h"\r
-//#include "../include/FFL_FormFiller.h"\r
-#include "../../include/formfiller/FFL_TextField.h"\r
-#include "../../include/formfiller/FFL_CBA_Fontmap.h"\r
-//#include "../include/FFL_Notify.h"\r
-\r
-CFFL_EditUndoItem::CFFL_EditUndoItem(CPWL_Edit* pEdit) : m_pEdit(pEdit)\r
-{\r
-}\r
-\r
-CFFL_EditUndoItem::~CFFL_EditUndoItem()\r
-{\r
-}\r
-\r
-void CFFL_EditUndoItem::Undo()\r
-{\r
-}\r
-\r
-void CFFL_EditUndoItem::Redo()\r
-{\r
-}\r
-\r
-CFX_WideString CFFL_EditUndoItem::GetDescr()\r
-{\r
-       return L"Input";\r
-}\r
-\r
-void CFFL_EditUndoItem::Release()\r
-{\r
-       delete this;\r
-}\r
-\r
-/* ------------------------------- CFFL_TextField ------------------------------- */\r
-\r
-CFFL_TextField::CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot) :\r
-       CFFL_FormFiller(pApp, pAnnot),\r
-       m_pFontMap(NULL)//,\r
-       //m_pSpellCheck(NULL)\r
-{\r
-       m_State.nStart = m_State.nEnd = 0;\r
-}\r
-\r
-CFFL_TextField::~CFFL_TextField()\r
-{\r
-       if (m_pFontMap)\r
-       {\r
-               delete m_pFontMap;\r
-               m_pFontMap = NULL;\r
-       }\r
-\r
-}\r
-\r
-PWL_CREATEPARAM CFFL_TextField::GetCreateParam()\r
-{\r
-       PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam();\r
-\r
-       ASSERT(m_pWidget != NULL);\r
-       int nFlags = m_pWidget->GetFieldFlags();\r
-\r
-\r
-       if (nFlags & FIELDFLAG_PASSWORD)\r
-       {               \r
-               cp.dwFlags |= PES_PASSWORD;\r
-       }\r
-\r
-       if (!(nFlags & FIELDFLAG_DONOTSPELLCHECK))\r
-       {               \r
-       }\r
-\r
-       if (nFlags & FIELDFLAG_MULTILINE)\r
-       {               \r
-               cp.dwFlags |= PES_MULTILINE | PES_AUTORETURN | PES_TOP;\r
-\r
-               if (!(nFlags & FIELDFLAG_DONOTSCROLL))\r
-               {\r
-                       cp.dwFlags |= PWS_VSCROLL | PES_AUTOSCROLL;\r
-               }\r
-       }\r
-       else\r
-       {\r
-               cp.dwFlags |= PES_CENTER;\r
-\r
-               if (!(nFlags & FIELDFLAG_DONOTSCROLL))\r
-               {\r
-                       cp.dwFlags |= PES_AUTOSCROLL;\r
-               }\r
-       }\r
-\r
-       if (nFlags & FIELDFLAG_COMB)\r
-       {               \r
-               cp.dwFlags |= PES_CHARARRAY;\r
-       }\r
-\r
-       if (nFlags & FIELDFLAG_RICHTEXT)\r
-       {               \r
-               cp.dwFlags |= PES_RICH;\r
-       }\r
-\r
-       cp.dwFlags |= PES_UNDO;\r
-       \r
-       switch (m_pWidget->GetAlignment())\r
-       {\r
-       default:\r
-       case BF_ALIGN_LEFT:\r
-               cp.dwFlags |= PES_LEFT;\r
-               break;\r
-       case BF_ALIGN_MIDDLE:\r
-               cp.dwFlags |= PES_MIDDLE;\r
-               break;\r
-       case BF_ALIGN_RIGHT:\r
-               cp.dwFlags |= PES_RIGHT;\r
-               break;\r
-       }\r
-\r
-       if (!m_pFontMap)\r
-       {\r
-               ASSERT(this->m_pApp != NULL);\r
-               m_pFontMap = new CBA_FontMap(m_pWidget, /*ISystemHandle::GetSystemHandler(m_pApp)*/m_pApp->GetSysHandler());\r
-               m_pFontMap->Initial();\r
-       }\r
-       cp.pFontMap = m_pFontMap;\r
-       cp.pFocusHandler = this;\r
-\r
-       return cp;\r
-}\r
-\r
-CPWL_Wnd* CFFL_TextField::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView)\r
-{\r
-       CPWL_Edit * pWnd = new CPWL_Edit();\r
-               pWnd->AttachFFLData(this);\r
-       pWnd->Create(cp);\r
-\r
-\r
-\r
-       ASSERT(m_pApp != NULL);\r
-       CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller();\r
-       pWnd->SetFillerNotify(pIFormFiller);\r
-\r
-       ASSERT(m_pWidget != NULL);\r
-       FX_INT32 nMaxLen = m_pWidget->GetMaxLen();\r
-       CFX_WideString swValue = m_pWidget->GetValue();\r
-       \r
-       if (nMaxLen > 0)\r
-       {\r
-               if (pWnd->HasFlag(PES_CHARARRAY))\r
-               {\r
-                       pWnd->SetCharArray(nMaxLen);\r
-                       pWnd->SetAlignFormatV(PEAV_CENTER);\r
-               }\r
-               else\r
-               {\r
-                       pWnd->SetLimitChar(nMaxLen);\r
-               }\r
-       }\r
-       \r
-       pWnd->SetText(swValue);\r
-       \r
-       return pWnd;\r
-}\r
-\r
-\r
-FX_BOOL        CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags)\r
-{\r
-       switch (nChar)\r
-       {\r
-       case FWL_VKEY_Return:\r
-               if (!(m_pWidget->GetFieldFlags() & FIELDFLAG_MULTILINE))\r
-               {\r
-                       CPDFSDK_PageView* pPageView = this->GetCurPageView();\r
-                       ASSERT(pPageView != NULL);\r
-                       m_bValid = !m_bValid;\r
-                       CPDF_Rect rcAnnot = pAnnot->GetRect();\r
-                       m_pApp->FFI_Invalidate(pAnnot->GetPDFPage(), rcAnnot.left, rcAnnot.top, rcAnnot.right, rcAnnot.bottom);\r
\r
-                       if (m_bValid)\r
-                       {\r
-                               if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE))\r
-                                       pWnd->SetFocus();\r
-                       }\r
-                       else\r
-                       {\r
-                               if (CommitData(pPageView, nFlags))\r
-                               {\r
-                                       DestroyPDFWindow(pPageView);\r
-                                       return TRUE;\r
-                               }\r
-                               else\r
-                               {\r
-                                       return FALSE;\r
-                               }\r
-                       }\r
-               }\r
-               break;\r
-       case FWL_VKEY_Escape:\r
-               {\r
-                       CPDFSDK_PageView* pPageView = this->GetCurPageView();\r
-                       ASSERT(pPageView != NULL);\r
-                       EscapeFiller(pPageView,TRUE);\r
-                       return TRUE;\r
-               }\r
-       }\r
-\r
-       return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags);\r
-}\r
-\r
-FX_BOOL        CFFL_TextField::IsDataChanged(CPDFSDK_PageView* pPageView)\r
-{\r
-       ASSERT(m_pWidget != NULL);\r
-\r
-       if (CPWL_Edit * pEdit = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE))\r
-               return pEdit->GetText() != m_pWidget->GetValue();\r
-\r
-       return FALSE;\r
-}\r
-\r
-void CFFL_TextField::SaveData(CPDFSDK_PageView* pPageView)\r
-{\r
-       ASSERT(m_pWidget != NULL);\r
-\r
-       if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE))\r
-       {\r
-               CFX_WideString sOldValue = m_pWidget->GetValue();\r
-               CFX_WideString sNewValue = pWnd->GetText();\r
-\r
-               m_pWidget->SetValue(sNewValue, FALSE);  \r
-               m_pWidget->ResetFieldAppearance(TRUE);\r
-               m_pWidget->UpdateField();\r
-               SetChangeMark();\r
-       }\r
-}\r
-\r
-void CFFL_TextField::GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,\r
-                                                                       PDFSDK_FieldAction& fa)\r
-{\r
-       switch (type)\r
-       {\r
-       case CPDF_AAction::KeyStroke:\r
-               if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE))\r
-               {\r
-                       fa.bFieldFull = pWnd->IsTextFull();     \r
-\r
-                       fa.sValue = pWnd->GetText();\r
-                       \r
-                       if (fa.bFieldFull)\r
-                       {\r
-                               fa.sChange = L"";\r
-                               fa.sChangeEx = L"";\r
-                       }\r
-               }\r
-               break;\r
-       case CPDF_AAction::Validate:\r
-               if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE))\r
-               {\r
-                       fa.sValue = pWnd->GetText();\r
-               }\r
-               break;\r
-       case CPDF_AAction::LoseFocus:\r
-       case CPDF_AAction::GetFocus:\r
-               ASSERT(m_pWidget != NULL);\r
-               fa.sValue = m_pWidget->GetValue();\r
-               break;\r
-       default:\r
-               break;\r
-       }\r
-}\r
-\r
-void CFFL_TextField::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, \r
-                                                                       const PDFSDK_FieldAction& fa)\r
-{\r
-       switch (type)\r
-       {\r
-       case CPDF_AAction::KeyStroke:\r
-               if (CPWL_Edit * pEdit = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE))\r
-               {\r
-                       pEdit->SetFocus();\r
-                       pEdit->SetSel(fa.nSelStart, fa.nSelEnd);\r
-                       pEdit->ReplaceSel(fa.sChange);\r
-               }\r
-               break;\r
-       default:\r
-               break;\r
-       }\r
-}\r
-\r
-\r
-FX_BOOL        CFFL_TextField::IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld, \r
-                                                                       const PDFSDK_FieldAction& faNew)\r
-{\r
-       switch (type)\r
-       {\r
-       case CPDF_AAction::KeyStroke:\r
-               return (!faOld.bFieldFull && faOld.nSelEnd != faNew.nSelEnd) || faOld.nSelStart != faNew.nSelStart ||\r
-                       faOld.sChange != faNew.sChange;\r
-       default:\r
-               break;\r
-       }\r
-\r
-       return FALSE;\r
-}\r
-\r
-void CFFL_TextField::SaveState(CPDFSDK_PageView* pPageView)\r
-{\r
-       ASSERT(pPageView != NULL);\r
-\r
-       if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE))\r
-       {\r
-               pWnd->GetSel(m_State.nStart, m_State.nEnd);\r
-               m_State.sValue = pWnd->GetText();\r
-       }\r
-}\r
-\r
-void CFFL_TextField::RestoreState(CPDFSDK_PageView* pPageView)\r
-{\r
-       ASSERT(pPageView != NULL);\r
-\r
-       if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, TRUE))\r
-       {\r
-               pWnd->SetText(m_State.sValue);\r
-               pWnd->SetSel(m_State.nStart, m_State.nEnd);\r
-       }\r
-}\r
-\r
-CPWL_Wnd* CFFL_TextField::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue)\r
-{\r
-       if (bRestoreValue)\r
-               SaveState(pPageView);\r
-\r
-       DestroyPDFWindow(pPageView);\r
-\r
-       CPWL_Wnd* pRet = NULL;\r
-\r
-       if (bRestoreValue)\r
-       {\r
-               RestoreState(pPageView);\r
-               pRet = this->GetPDFWindow(pPageView, FALSE);\r
-       }\r
-       else\r
-               pRet = this->GetPDFWindow(pPageView, TRUE);\r
-\r
-       m_pWidget->UpdateField();\r
-       \r
-       return pRet;\r
-}\r
-\r
-void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd)\r
-{\r
-       ASSERT(m_pApp != NULL);\r
-       \r
-       ASSERT(pWnd != NULL);\r
\r
-       if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT)\r
-       {\r
-               CPWL_Edit* pEdit = (CPWL_Edit*)pWnd;\r
-               pEdit->SetCharSet(134);\r
-               pEdit->SetCodePage(936);\r
\r
-               pEdit->SetReadyToInput();\r
-               CFX_WideString wsText = pEdit->GetText();\r
-               int nCharacters = wsText.GetLength();\r
-               CFX_ByteString bsUTFText = wsText.UTF16LE_Encode();\r
-               unsigned short* pBuffer = (unsigned short*)(FX_LPCSTR)bsUTFText;\r
-               m_pApp->FFI_OnSetFieldInputFocus(m_pWidget->GetFormField(), pBuffer, nCharacters, TRUE);\r
\r
-               pEdit->SetEditNotify(this);\r
-               //pUndo->BeginEdit(pDocument);\r
-       }\r
-}\r
-\r
-void CFFL_TextField::OnKillFocus(CPWL_Wnd* pWnd)\r
-{\r
-\r
-}\r
-\r
-FX_BOOL        CFFL_TextField::CanCopy(CPDFSDK_Document* pDocument)\r
-{\r
-       return FALSE;\r
-}\r
-\r
-FX_BOOL CFFL_TextField::CanCut(CPDFSDK_Document* pDocument)\r
-{\r
-       return FALSE;\r
-}\r
-\r
-FX_BOOL        CFFL_TextField::CanPaste(CPDFSDK_Document* pDocument)\r
-{\r
-       return FALSE;\r
-}\r
-\r
-void CFFL_TextField::DoCopy(CPDFSDK_Document* pDocument)\r
-{\r
-\r
-}\r
-\r
-void CFFL_TextField::DoCut(CPDFSDK_Document* pDocument)\r
-{\r
-}\r
-\r
-void CFFL_TextField::DoPaste(CPDFSDK_Document* pDocument)\r
-{\r
-\r
-}\r
-\r
-void CFFL_TextField::OnAddUndo(CPWL_Edit* pEdit)\r
-{\r
-}\r
-\r
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+//#include "../include/FormFiller.h"
+//#include "../include/FFL_FormFiller.h"
+#include "../../include/formfiller/FFL_TextField.h"
+#include "../../include/formfiller/FFL_CBA_Fontmap.h"
+//#include "../include/FFL_Notify.h"
+
+CFFL_EditUndoItem::CFFL_EditUndoItem(CPWL_Edit* pEdit)
+{
+}
+
+CFFL_EditUndoItem::~CFFL_EditUndoItem()
+{
+}
+
+void CFFL_EditUndoItem::Undo()
+{
+}
+
+void CFFL_EditUndoItem::Redo()
+{
+}
+
+CFX_WideString CFFL_EditUndoItem::GetDescr()
+{
+       return L"Input";
+}
+
+void CFFL_EditUndoItem::Release()
+{
+       delete this;
+}
+
+/* ------------------------------- CFFL_TextField ------------------------------- */
+
+CFFL_TextField::CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot) :
+       CFFL_FormFiller(pApp, pAnnot),
+       m_pFontMap(NULL)//,
+       //m_pSpellCheck(NULL)
+{
+       m_State.nStart = m_State.nEnd = 0;
+}
+
+CFFL_TextField::~CFFL_TextField()
+{
+       if (m_pFontMap)
+       {
+               delete m_pFontMap;
+               m_pFontMap = NULL;
+       }
+
+}
+
+PWL_CREATEPARAM CFFL_TextField::GetCreateParam()
+{
+       PWL_CREATEPARAM cp = CFFL_FormFiller::GetCreateParam();
+
+       ASSERT(m_pWidget != NULL);
+       int nFlags = m_pWidget->GetFieldFlags();
+
+
+       if (nFlags & FIELDFLAG_PASSWORD)
+       {               
+               cp.dwFlags |= PES_PASSWORD;
+       }
+
+       if (!(nFlags & FIELDFLAG_DONOTSPELLCHECK))
+       {               
+       }
+
+       if (nFlags & FIELDFLAG_MULTILINE)
+       {               
+               cp.dwFlags |= PES_MULTILINE | PES_AUTORETURN | PES_TOP;
+
+               if (!(nFlags & FIELDFLAG_DONOTSCROLL))
+               {
+                       cp.dwFlags |= PWS_VSCROLL | PES_AUTOSCROLL;
+               }
+       }
+       else
+       {
+               cp.dwFlags |= PES_CENTER;
+
+               if (!(nFlags & FIELDFLAG_DONOTSCROLL))
+               {
+                       cp.dwFlags |= PES_AUTOSCROLL;
+               }
+       }
+
+       if (nFlags & FIELDFLAG_COMB)
+       {               
+               cp.dwFlags |= PES_CHARARRAY;
+       }
+
+       if (nFlags & FIELDFLAG_RICHTEXT)
+       {               
+               cp.dwFlags |= PES_RICH;
+       }
+
+       cp.dwFlags |= PES_UNDO;
+       
+       switch (m_pWidget->GetAlignment())
+       {
+       default:
+       case BF_ALIGN_LEFT:
+               cp.dwFlags |= PES_LEFT;
+               break;
+       case BF_ALIGN_MIDDLE:
+               cp.dwFlags |= PES_MIDDLE;
+               break;
+       case BF_ALIGN_RIGHT:
+               cp.dwFlags |= PES_RIGHT;
+               break;
+       }
+
+       if (!m_pFontMap)
+       {
+               ASSERT(this->m_pApp != NULL);
+               m_pFontMap = new CBA_FontMap(m_pWidget, /*ISystemHandle::GetSystemHandler(m_pApp)*/m_pApp->GetSysHandler());
+               m_pFontMap->Initial();
+       }
+       cp.pFontMap = m_pFontMap;
+       cp.pFocusHandler = this;
+
+       return cp;
+}
+
+CPWL_Wnd* CFFL_TextField::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView)
+{
+       CPWL_Edit * pWnd = new CPWL_Edit();
+               pWnd->AttachFFLData(this);
+       pWnd->Create(cp);
+
+
+
+       ASSERT(m_pApp != NULL);
+       CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller();
+       pWnd->SetFillerNotify(pIFormFiller);
+
+       ASSERT(m_pWidget != NULL);
+       FX_INT32 nMaxLen = m_pWidget->GetMaxLen();
+       CFX_WideString swValue = m_pWidget->GetValue();
+       
+       if (nMaxLen > 0)
+       {
+               if (pWnd->HasFlag(PES_CHARARRAY))
+               {
+                       pWnd->SetCharArray(nMaxLen);
+                       pWnd->SetAlignFormatV(PEAV_CENTER);
+               }
+               else
+               {
+                       pWnd->SetLimitChar(nMaxLen);
+               }
+       }
+       
+       pWnd->SetText(swValue);
+       
+       return pWnd;
+}
+
+
+FX_BOOL        CFFL_TextField::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags)
+{
+       switch (nChar)
+       {
+       case FWL_VKEY_Return:
+               if (!(m_pWidget->GetFieldFlags() & FIELDFLAG_MULTILINE))
+               {
+                       CPDFSDK_PageView* pPageView = this->GetCurPageView();
+                       ASSERT(pPageView != NULL);
+                       m_bValid = !m_bValid;
+                       CPDF_Rect rcAnnot = pAnnot->GetRect();
+                       m_pApp->FFI_Invalidate(pAnnot->GetPDFPage(), rcAnnot.left, rcAnnot.top, rcAnnot.right, rcAnnot.bottom);
+                       if (m_bValid)
+                       {
+                               if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE))
+                                       pWnd->SetFocus();
+                       }
+                       else
+                       {
+                               if (CommitData(pPageView, nFlags))
+                               {
+                                       DestroyPDFWindow(pPageView);
+                                       return TRUE;
+                               }
+                               else
+                               {
+                                       return FALSE;
+                               }
+                       }
+               }
+               break;
+       case FWL_VKEY_Escape:
+               {
+                       CPDFSDK_PageView* pPageView = this->GetCurPageView();
+                       ASSERT(pPageView != NULL);
+                       EscapeFiller(pPageView,TRUE);
+                       return TRUE;
+               }
+       }
+
+       return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags);
+}
+
+FX_BOOL        CFFL_TextField::IsDataChanged(CPDFSDK_PageView* pPageView)
+{
+       ASSERT(m_pWidget != NULL);
+
+       if (CPWL_Edit * pEdit = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE))
+               return pEdit->GetText() != m_pWidget->GetValue();
+
+       return FALSE;
+}
+
+void CFFL_TextField::SaveData(CPDFSDK_PageView* pPageView)
+{
+       ASSERT(m_pWidget != NULL);
+
+       if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE))
+       {
+               CFX_WideString sOldValue = m_pWidget->GetValue();
+               CFX_WideString sNewValue = pWnd->GetText();
+
+               m_pWidget->SetValue(sNewValue, FALSE);  
+               m_pWidget->ResetFieldAppearance(TRUE);
+               m_pWidget->UpdateField();
+               SetChangeMark();
+       }
+}
+
+void CFFL_TextField::GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
+                                                                       PDFSDK_FieldAction& fa)
+{
+       switch (type)
+       {
+       case CPDF_AAction::KeyStroke:
+               if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE))
+               {
+                       fa.bFieldFull = pWnd->IsTextFull();     
+
+                       fa.sValue = pWnd->GetText();
+                       
+                       if (fa.bFieldFull)
+                       {
+                               fa.sChange = L"";
+                               fa.sChangeEx = L"";
+                       }
+               }
+               break;
+       case CPDF_AAction::Validate:
+               if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE))
+               {
+                       fa.sValue = pWnd->GetText();
+               }
+               break;
+       case CPDF_AAction::LoseFocus:
+       case CPDF_AAction::GetFocus:
+               ASSERT(m_pWidget != NULL);
+               fa.sValue = m_pWidget->GetValue();
+               break;
+       default:
+               break;
+       }
+}
+
+void CFFL_TextField::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, 
+                                                                       const PDFSDK_FieldAction& fa)
+{
+       switch (type)
+       {
+       case CPDF_AAction::KeyStroke:
+               if (CPWL_Edit * pEdit = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE))
+               {
+                       pEdit->SetFocus();
+                       pEdit->SetSel(fa.nSelStart, fa.nSelEnd);
+                       pEdit->ReplaceSel(fa.sChange);
+               }
+               break;
+       default:
+               break;
+       }
+}
+
+
+FX_BOOL        CFFL_TextField::IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld, 
+                                                                       const PDFSDK_FieldAction& faNew)
+{
+       switch (type)
+       {
+       case CPDF_AAction::KeyStroke:
+               return (!faOld.bFieldFull && faOld.nSelEnd != faNew.nSelEnd) || faOld.nSelStart != faNew.nSelStart ||
+                       faOld.sChange != faNew.sChange;
+       default:
+               break;
+       }
+
+       return FALSE;
+}
+
+void CFFL_TextField::SaveState(CPDFSDK_PageView* pPageView)
+{
+       ASSERT(pPageView != NULL);
+
+       if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE))
+       {
+               pWnd->GetSel(m_State.nStart, m_State.nEnd);
+               m_State.sValue = pWnd->GetText();
+       }
+}
+
+void CFFL_TextField::RestoreState(CPDFSDK_PageView* pPageView)
+{
+       ASSERT(pPageView != NULL);
+
+       if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, TRUE))
+       {
+               pWnd->SetText(m_State.sValue);
+               pWnd->SetSel(m_State.nStart, m_State.nEnd);
+       }
+}
+
+CPWL_Wnd* CFFL_TextField::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue)
+{
+       if (bRestoreValue)
+               SaveState(pPageView);
+
+       DestroyPDFWindow(pPageView);
+
+       CPWL_Wnd* pRet = NULL;
+
+       if (bRestoreValue)
+       {
+               RestoreState(pPageView);
+               pRet = this->GetPDFWindow(pPageView, FALSE);
+       }
+       else
+               pRet = this->GetPDFWindow(pPageView, TRUE);
+
+       m_pWidget->UpdateField();
+       
+       return pRet;
+}
+
+void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd)
+{
+       ASSERT(m_pApp != NULL);
+       
+       ASSERT(pWnd != NULL);
+       if (pWnd->GetClassName() == PWL_CLASSNAME_EDIT)
+       {
+               CPWL_Edit* pEdit = (CPWL_Edit*)pWnd;
+               pEdit->SetCharSet(134);
+               pEdit->SetCodePage(936);
+               pEdit->SetReadyToInput();
+               CFX_WideString wsText = pEdit->GetText();
+               int nCharacters = wsText.GetLength();
+               CFX_ByteString bsUTFText = wsText.UTF16LE_Encode();
+               unsigned short* pBuffer = (unsigned short*)(FX_LPCSTR)bsUTFText;
+               m_pApp->FFI_OnSetFieldInputFocus(m_pWidget->GetFormField(), pBuffer, nCharacters, TRUE);
+               pEdit->SetEditNotify(this);
+               //pUndo->BeginEdit(pDocument);
+       }
+}
+
+void CFFL_TextField::OnKillFocus(CPWL_Wnd* pWnd)
+{
+
+}
+
+FX_BOOL        CFFL_TextField::CanCopy(CPDFSDK_Document* pDocument)
+{
+       return FALSE;
+}
+
+FX_BOOL CFFL_TextField::CanCut(CPDFSDK_Document* pDocument)
+{
+       return FALSE;
+}
+
+FX_BOOL        CFFL_TextField::CanPaste(CPDFSDK_Document* pDocument)
+{
+       return FALSE;
+}
+
+void CFFL_TextField::DoCopy(CPDFSDK_Document* pDocument)
+{
+
+}
+
+void CFFL_TextField::DoCut(CPDFSDK_Document* pDocument)
+{
+}
+
+void CFFL_TextField::DoPaste(CPDFSDK_Document* pDocument)
+{
+
+}
+
+void CFFL_TextField::OnAddUndo(CPWL_Edit* pEdit)
+{
+}
+