diff options
Diffstat (limited to 'fpdfsdk/include/formfiller')
-rw-r--r-- | fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h | 51 | ||||
-rw-r--r-- | fpdfsdk/include/formfiller/FFL_CheckBox.h | 27 | ||||
-rw-r--r-- | fpdfsdk/include/formfiller/FFL_ComboBox.h | 69 | ||||
-rw-r--r-- | fpdfsdk/include/formfiller/FFL_FormFiller.h | 178 | ||||
-rw-r--r-- | fpdfsdk/include/formfiller/FFL_IFormFiller.h | 144 | ||||
-rw-r--r-- | fpdfsdk/include/formfiller/FFL_ListBox.h | 44 | ||||
-rw-r--r-- | fpdfsdk/include/formfiller/FFL_Notify.h | 54 | ||||
-rw-r--r-- | fpdfsdk/include/formfiller/FFL_PushButton.h | 25 | ||||
-rw-r--r-- | fpdfsdk/include/formfiller/FFL_RadioButton.h | 25 | ||||
-rw-r--r-- | fpdfsdk/include/formfiller/FFL_TextField.h | 89 | ||||
-rw-r--r-- | fpdfsdk/include/formfiller/FFL_Utils.h | 20 | ||||
-rw-r--r-- | fpdfsdk/include/formfiller/FormFiller.h | 30 |
12 files changed, 756 insertions, 0 deletions
diff --git a/fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h b/fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h new file mode 100644 index 0000000000..7624596788 --- /dev/null +++ b/fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h @@ -0,0 +1,51 @@ +// 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
+
+#ifndef _RAO_FONTMAP_H_
+#define _RAO_FONTMAP_H_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+class CPDFSDK_Annot;
+
+class CBA_FontMap : public CPWL_FontMap
+{
+public:
+ CBA_FontMap(CPDFSDK_Annot* pAnnot, IFX_SystemHandler* pSystemHandler);
+ CBA_FontMap(CPDF_Document* pDocument, CPDF_Dictionary* pAnnotDict, IFX_SystemHandler* pSystemHandler);
+
+ virtual ~CBA_FontMap();
+
+ virtual void Initial(FX_LPCSTR fontname = NULL);
+
+public:
+ void SetDefaultFont(CPDF_Font * pFont, const CFX_ByteString & sFontName);
+
+ void Reset();
+ void SetAPType(const CFX_ByteString& sAPType);
+
+protected:
+ virtual CPDF_Font* FindFontSameCharset(CFX_ByteString& sFontAlias, FX_INT32 nCharset);
+ virtual void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias);
+ virtual CPDF_Document* GetDocument();
+private:
+ CPDF_Font* FindResFontSameCharset(CPDF_Dictionary* pResDict, CFX_ByteString& sFontAlias,
+ FX_INT32 nCharset);
+ CPDF_Font* GetAnnotDefaultFont(CFX_ByteString &csNameTag);
+ void AddFontToAnnotDict(CPDF_Font* pFont, const CFX_ByteString& sAlias);
+
+private:
+ CPDF_Document* m_pDocument;
+ CPDF_Dictionary* m_pAnnotDict;
+ CPDF_Font* m_pDefaultFont;
+ CFX_ByteString m_sDefaultFontName;
+
+ CFX_ByteString m_sAPType;
+};
+
+#endif // _RAO_FONTMAP_H_
diff --git a/fpdfsdk/include/formfiller/FFL_CheckBox.h b/fpdfsdk/include/formfiller/FFL_CheckBox.h new file mode 100644 index 0000000000..f8ee370519 --- /dev/null +++ b/fpdfsdk/include/formfiller/FFL_CheckBox.h @@ -0,0 +1,27 @@ +// 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
+
+#ifndef _FFL_CHECKBOX_H_
+#define _FFL_CHECKBOX_H_
+
+class CFFL_CheckBox : public CFFL_Button
+{
+public:
+ CFFL_CheckBox(CPDFDoc_Environment* pApp, CPDFSDK_Widget* pWidget);
+ virtual ~CFFL_CheckBox();
+
+ virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);
+
+ virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags);
+ virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
+ virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+
+ virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView);
+ virtual void SaveData(CPDFSDK_PageView* pPageView);
+};
+
+#endif //_FFL_CHECKBOX_H_
+
diff --git a/fpdfsdk/include/formfiller/FFL_ComboBox.h b/fpdfsdk/include/formfiller/FFL_ComboBox.h new file mode 100644 index 0000000000..f116acffd9 --- /dev/null +++ b/fpdfsdk/include/formfiller/FFL_ComboBox.h @@ -0,0 +1,69 @@ +// 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
+
+#ifndef _FFL_COMBOBOX_H_
+ #define _FFL_COMBOBOX_H_
+
+struct FFL_ComboBoxState
+{
+ int nIndex;
+ int nStart;
+ int nEnd;
+ CFX_WideString sValue;
+};
+class CBA_FontMap;
+
+class CFFL_ComboBox : public CFFL_FormFiller, public IPWL_FocusHandler, public IPWL_Edit_Notify
+{
+public:
+ CFFL_ComboBox(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget);
+ virtual ~CFFL_ComboBox();
+
+ virtual PWL_CREATEPARAM GetCreateParam();
+ virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);
+
+
+ virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
+
+ virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView);
+ virtual void SaveData(CPDFSDK_PageView* pPageView);
+
+ virtual void GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, PDFSDK_FieldAction& fa);
+ virtual void SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type, const PDFSDK_FieldAction& fa);
+ virtual FX_BOOL IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld, const PDFSDK_FieldAction& faNew);
+ virtual void SaveState(CPDFSDK_PageView* pPageView);
+ virtual void RestoreState(CPDFSDK_PageView* pPageView);
+
+ virtual CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue);
+ virtual void OnKeyStroke(FX_BOOL bKeyDown, FX_UINT nFlag);
+
+public:
+ virtual void OnSetFocus(CPWL_Wnd* pWnd);
+ virtual void OnKillFocus(CPWL_Wnd* pWnd);
+
+public:
+ virtual void OnAddUndo(CPWL_Edit* pEdit);
+
+public:
+ virtual FX_BOOL CanCopy(CPDFSDK_Document* pDocument);
+ virtual FX_BOOL CanCut(CPDFSDK_Document* pDocument);
+ virtual FX_BOOL CanPaste(CPDFSDK_Document* pDocument);
+
+ virtual void DoCopy(CPDFSDK_Document* pDocument);
+ virtual void DoCut(CPDFSDK_Document* pDocument);
+ virtual void DoPaste(CPDFSDK_Document* pDocument);
+
+private:
+ CFX_WideString GetSelectExportText();
+
+private:
+ CBA_FontMap* m_pFontMap;
+ FFL_ComboBoxState m_State;
+ //CFFL_IM_BOX m_IMBox;
+};
+
+#endif //_FFL_COMBOBOX_H_
+
diff --git a/fpdfsdk/include/formfiller/FFL_FormFiller.h b/fpdfsdk/include/formfiller/FFL_FormFiller.h new file mode 100644 index 0000000000..eb81675fa4 --- /dev/null +++ b/fpdfsdk/include/formfiller/FFL_FormFiller.h @@ -0,0 +1,178 @@ +// 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
+
+#ifndef _FFL_FORMFILLER_H_
+#define _FFL_FORMFILLER_H_
+
+#include "FFL_IFormFiller.h"
+#include "FFL_CBA_Fontmap.h"
+
+class CPDFSDK_Annot;
+class CFFL_FormFiller;
+class CFFL_Notify;
+class CPDFDoc_Environment;
+class CPDFSDK_PageView;
+class CPDFSDK_Document;
+class CPDFSDK_Widget;
+
+
+#define CFFL_PageView2PDFWindow CFX_MapPtrTemplate<CPDFSDK_PageView*, CPWL_Wnd*>
+
+struct FFL_KeyStrokeData
+{
+ CFX_WideString swValue;
+ FX_BOOL bFull;
+ int nSelStart;
+ int nSelEnd;
+};
+
+
+
+class CFFL_FormFiller : /*public IBA_AnnotFiller,*/ public IPWL_Provider, public CPWL_TimerHandler
+{
+public:
+ CFFL_FormFiller(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot);
+ virtual ~CFFL_FormFiller();
+
+ virtual FX_RECT GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
+ virtual void OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
+ /*const CRect& rcWindow, */FX_DWORD dwFlags);
+ virtual void OnDrawDeactive(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
+ /*const CRect& rcWindow, */FX_DWORD dwFlags);
+
+ virtual void OnCreate(CPDFSDK_Annot* pAnnot);
+ virtual void OnLoad(CPDFSDK_Annot* pAnnot);
+ virtual void OnDelete(CPDFSDK_Annot* pAnnot);
+
+ virtual void OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
+ virtual void OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
+
+ virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+ virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+ virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+ virtual FX_BOOL OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+ virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point);
+ virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+ virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+ virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+
+ virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags);
+ virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
+
+ virtual void OnDeSelected(CPDFSDK_Annot* pAnnot);
+ virtual void OnSelected(CPDFSDK_Annot* pAnnot);
+
+ virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
+ virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
+
+ virtual FX_BOOL CanCopy(CPDFSDK_Document* pDocument);
+ virtual FX_BOOL CanCut(CPDFSDK_Document* pDocument);
+ virtual FX_BOOL CanPaste(CPDFSDK_Document* pDocument);
+
+ virtual void DoCopy(CPDFSDK_Document* pDocument);
+ virtual void DoCut(CPDFSDK_Document* pDocument);
+ virtual void DoPaste(CPDFSDK_Document* pDocument);
+
+public: //CPWL_TimerHandler
+ virtual void TimerProc();
+ virtual IFX_SystemHandler* GetSystemHandler() const;
+
+public:
+ virtual CPDF_Matrix GetWindowMatrix(void* pAttachedData);
+ virtual CFX_WideString LoadPopupMenuString(int nIndex);
+
+ virtual void GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
+ PDFSDK_FieldAction& fa);
+ virtual void SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
+ const PDFSDK_FieldAction& fa);
+ virtual FX_BOOL IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld,
+ const PDFSDK_FieldAction& faNew);
+
+ virtual void SaveState(CPDFSDK_PageView* pPageView);
+ virtual void RestoreState(CPDFSDK_PageView* pPageView);
+
+ virtual CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue);
+
+ virtual void OnKeyStroke(FX_BOOL bKeyDown);
+
+ CPDF_Matrix GetCurMatrix();
+
+ CPDF_Rect FFLtoPWL(const CPDF_Rect& rect);
+ CPDF_Rect PWLtoFFL(const CPDF_Rect& rect);
+ CPDF_Point FFLtoPWL(const CPDF_Point& point);
+ CPDF_Point PWLtoFFL(const CPDF_Point& point);
+
+ CPDF_Point WndtoPWL(CPDFSDK_PageView* pPageView, const CPDF_Point& pt);
+ CPDF_Rect FFLtoWnd(CPDFSDK_PageView* pPageView, const CPDF_Rect& rect);
+
+ void SetWindowRect(CPDFSDK_PageView* pPageView, const CPDF_Rect& rcWindow);
+ CPDF_Rect GetWindowRect(CPDFSDK_PageView* pPageView);
+
+ static void FFL_FreeData(void* pData);
+
+ FX_BOOL CommitData(CPDFSDK_PageView* pPageView, FX_UINT nFlag);
+ virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView);
+ virtual void SaveData(CPDFSDK_PageView* pPageView);
+
+ virtual void GetKeyStrokeData(CPDFSDK_PageView* pPageView, FFL_KeyStrokeData& data);
+
+public:
+ CPWL_Wnd* GetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bNew);
+ void DestroyPDFWindow(CPDFSDK_PageView* pPageView);
+ void EscapeFiller(CPDFSDK_PageView* pPageView, FX_BOOL bDestroyPDFWindow);
+
+ virtual PWL_CREATEPARAM GetCreateParam();
+ virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView) = 0;
+ virtual CPDF_Rect GetFocusBox(CPDFSDK_PageView* pPageView);
+
+public:
+ FX_BOOL IsValid() const;
+ CPDF_Rect GetPDFWindowRect() const;
+
+ CPDFSDK_PageView* GetCurPageView();
+ void SetChangeMark();
+
+ virtual void InvalidateRect(double left, double top, double right, double bottom);
+ CPDFDoc_Environment* GetApp(){return m_pApp;}
+ CPDFSDK_Annot* GetSDKAnnot() {return m_pAnnot;}
+protected:
+ CPDFDoc_Environment* m_pApp;
+ CPDFSDK_Widget* m_pWidget;
+ CPDFSDK_Annot* m_pAnnot;
+
+ FX_BOOL m_bValid;
+ CFFL_PageView2PDFWindow m_Maps;
+ CPDF_Point m_ptOldPos;
+};
+
+class CFFL_Button : public CFFL_FormFiller
+{
+public:
+ CFFL_Button(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget);
+ virtual ~CFFL_Button();
+
+ virtual void OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
+ virtual void OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
+ virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+ virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+ virtual FX_BOOL OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+ virtual void OnDraw(CPDFSDK_PageView *pPageView/*, HDC hDC*/, CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
+ /*const CRect& rcWindow,*/ FX_DWORD dwFlags);
+
+ virtual void OnDrawDeactive(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
+ /*const CRect& rcWindow, */FX_DWORD dwFlags);
+protected:
+ FX_BOOL m_bMouseIn;
+ FX_BOOL m_bMouseDown;
+};
+
+//#define CFFL_IM_BOX CFX_ArrayTemplate<CBA_EditInput*>
+
+#endif
diff --git a/fpdfsdk/include/formfiller/FFL_IFormFiller.h b/fpdfsdk/include/formfiller/FFL_IFormFiller.h new file mode 100644 index 0000000000..79b4b8e6d7 --- /dev/null +++ b/fpdfsdk/include/formfiller/FFL_IFormFiller.h @@ -0,0 +1,144 @@ +// 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
+
+#ifndef _FFL_IFORMFILLER_H_
+#define _FFL_IFORMFILLER_H_
+
+#include "FormFiller.h"
+class CFFL_FormFiller;
+class CFFL_PrivateData;
+
+#define CFFL_Widget2Filler CFX_MapPtrTemplate<CPDFSDK_Annot*, CFFL_FormFiller*>
+
+// #define IsALTpressed() (GetKeyState(VK_MENU) < 0)
+// #define IsCTRLpressed() (GetKeyState(VK_CONTROL) < 0)
+// #define IsSHIFTpressed() (GetKeyState(VK_SHIFT)&0x8000)
+// #define IsINSERTpressed() (GetKeyState(VK_INSERT) & 0x01)
+// #define VK_SHIFT 0x10
+// #define VK_CONTROL 0x11
+// #define VK_MENU 0x12
+// #define VK_RETURN 0x0D
+// #define VK_SPACE 0x20
+// #define VK_ESCAPE 0x1B
+
+
+
+class CFFL_IFormFiller :/* public IBA_AnnotFiller, */public IPWL_Filler_Notify//,
+// public IUndo_EventHandler, public IClipboard_Handler
+{
+public:
+ CFFL_IFormFiller(CPDFDoc_Environment* pApp);
+ virtual ~CFFL_IFormFiller();
+
+ virtual FX_BOOL Annot_HitTest(CPDFSDK_PageView* pPageView,CPDFSDK_Annot* pAnnot, CPDF_Point point);
+ virtual FX_RECT GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot);
+ virtual void OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
+ /*const CRect& rcWindow,*/ FX_DWORD dwFlags);
+
+
+ virtual void OnCreate(CPDFSDK_Annot* pAnnot);
+ virtual void OnLoad(CPDFSDK_Annot* pAnnot);
+ virtual void OnDelete(CPDFSDK_Annot* pAnnot);
+
+ virtual void OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
+ virtual void OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
+
+ virtual FX_BOOL OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+ virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+ virtual FX_BOOL OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+ virtual FX_BOOL OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+ virtual FX_BOOL OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point);
+ virtual FX_BOOL OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+ virtual FX_BOOL OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+ virtual FX_BOOL OnRButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+
+ virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags);
+ virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
+
+ virtual void OnDeSelected(CPDFSDK_Annot* pAnnot);
+ virtual void OnSelected(CPDFSDK_Annot* pAnnot);
+
+ virtual FX_BOOL OnSetFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag);
+ virtual FX_BOOL OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag);
+
+public:
+ virtual void QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX_FLOAT fPopupMax, FX_INT32 & nRet, FX_FLOAT & fPopupRet);
+ virtual void OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_INT32 nKeyCode,
+ CFX_WideString & strChange, const CFX_WideString& strChangeEx,
+ int nSelStart, int nSelEnd,
+ FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit, FX_DWORD nFlag);
+ virtual void OnAfterKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_BOOL & bExit, FX_DWORD nFlag) ;
+
+ virtual void OnSetWindowRect(void* pPrivateData, const CPDF_Rect & rcWindow);
+ virtual void OnKeyStroke(FX_BOOL bEditOrList, void* pPrivateData, FX_INT32 nKeyCode, CFX_WideString & strChange,
+ const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit);
+
+public:
+ virtual void BeforeUndo(CPDFSDK_Document* pDocument);
+ virtual void BeforeRedo(CPDFSDK_Document* pDocument);
+ virtual void AfterUndo(CPDFSDK_Document* pDocument);
+ virtual void AfterRedo(CPDFSDK_Document* pDocument);
+
+public:
+ virtual FX_BOOL CanCopy(CPDFSDK_Document* pDocument);
+ virtual FX_BOOL CanCut(CPDFSDK_Document* pDocument);
+ virtual FX_BOOL CanPaste(CPDFSDK_Document* pDocument);
+
+ virtual void DoCopy(CPDFSDK_Document* pDocument);
+ virtual void DoCut(CPDFSDK_Document* pDocument);
+ virtual void DoPaste(CPDFSDK_Document* pDocument);
+
+public:
+ CFFL_FormFiller* GetFormFiller(CPDFSDK_Annot* pAnnot, FX_BOOL bRegister);
+ void RemoveFormFiller(CPDFSDK_Annot* pAnnot);
+
+ static FX_BOOL IsVisible(CPDFSDK_Widget* pWidget);
+ static FX_BOOL IsReadOnly(CPDFSDK_Widget* pWidget);
+ static FX_BOOL IsFillingAllowed(CPDFSDK_Widget* pWidget);
+ static FX_BOOL IsValidAnnot(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot);
+
+ void OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag);
+ void OnValidate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag);
+
+ void OnCalculate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bExit, FX_DWORD nFlag);
+ void OnFormat(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bExit, FX_DWORD nFlag);
+ void OnButtonUp(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageView, FX_BOOL& bReset, FX_BOOL& bExit,FX_UINT nFlag);
+// static LRESULT CALLBACK FFL_WndProc(
+// int code, // hook code
+// WPARAM wParam, // virtual-key code
+// LPARAM lParam // keystroke-message information
+// );
+// static MSG GetLastMessage();
+ static int GetCommitKey();
+ static FX_BOOL GetKeyDown();
+
+
+public:
+// static MSG g_Msg;
+// static HHOOK m_hookSheet;
+
+private:
+ void UnRegisterFormFiller(CPDFSDK_Annot* pAnnot);
+ void SetFocusAnnotTab(CPDFSDK_Annot* pWidget, FX_BOOL bSameField, FX_BOOL bNext);
+
+private:
+ CPDFDoc_Environment* m_pApp;
+ CFFL_Widget2Filler m_Maps;
+ FX_BOOL m_bNotifying;
+};
+
+class CFFL_PrivateData
+{
+public:
+ CPDFSDK_Widget* pWidget;
+ CPDFSDK_PageView* pPageView;
+ int nWidgetAge;
+ int nValueAge;
+};
+
+#endif //_FFL_IFORMFILLER_H_
+
diff --git a/fpdfsdk/include/formfiller/FFL_ListBox.h b/fpdfsdk/include/formfiller/FFL_ListBox.h new file mode 100644 index 0000000000..899c44da2d --- /dev/null +++ b/fpdfsdk/include/formfiller/FFL_ListBox.h @@ -0,0 +1,44 @@ +// 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
+
+#ifndef _FFL_LISTBOX_H_
+#define _FFL_LISTBOX_H_
+
+class CBA_FontMap;
+class CFFL_ListBox : public CFFL_FormFiller
+{
+public:
+ CFFL_ListBox(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget);
+ virtual ~CFFL_ListBox();
+
+ virtual PWL_CREATEPARAM GetCreateParam();
+ virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);
+
+ virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
+
+ virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView);
+ virtual void SaveData(CPDFSDK_PageView* pPageView);
+
+ virtual void GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
+ PDFSDK_FieldAction& fa);
+ virtual void SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
+ const PDFSDK_FieldAction& fa);
+
+ virtual void SaveState(CPDFSDK_PageView* pPageView);
+ virtual void RestoreState(CPDFSDK_PageView* pPageView);
+
+ virtual CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue);
+ virtual void OnKeyStroke(FX_BOOL bKeyDown, FX_DWORD nFlag);
+
+private:
+ CBA_FontMap* m_pFontMap;
+ CFX_MapPtrTemplate<int, void*> m_OriginSelections;
+ CFX_ArrayTemplate<int> m_State;
+};
+
+
+#endif //_FFL_LISTBOX_H_
+
diff --git a/fpdfsdk/include/formfiller/FFL_Notify.h b/fpdfsdk/include/formfiller/FFL_Notify.h new file mode 100644 index 0000000000..8a0b7a3fa3 --- /dev/null +++ b/fpdfsdk/include/formfiller/FFL_Notify.h @@ -0,0 +1,54 @@ +// 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
+
+#if !defined(_FFL_NOTIFY_H_)
+#define _FFL_NOTIFY_H_
+
+class CFFL_FormFiller;
+
+class CFFL_Notify
+{
+public:
+ CFFL_Notify(CFFL_FormFiller * pFormFiller);
+ virtual ~CFFL_Notify();
+
+public:
+ FX_BOOL OnSetFocus(FX_BOOL & bExit);
+ FX_BOOL OnMouseEnter(FX_BOOL & bExit);
+ FX_BOOL OnMouseDown(FX_BOOL & bExit);
+ FX_BOOL OnMouseUp(FX_BOOL & bExit);
+ FX_BOOL OnMouseExit(FX_BOOL & bExit);
+ FX_BOOL OnKillFocus(FX_BOOL & bExit);
+
+ FX_BOOL OnCalculate();
+ FX_BOOL OnFormat(int iCommitKey);
+ FX_BOOL OnValidate(CPDF_FormField* pFormField, CFX_WideString& strValue, CFX_WideString & strChange,
+ const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL bModifier,
+ FX_BOOL bShift, FX_BOOL & bRC);
+ FX_BOOL OnKeyStroke(CPDF_FormField* pFormField, int nCommitKey, CFX_WideString& strValue, CFX_WideString& strChange,
+ const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL bModifier,
+ FX_BOOL bShift, FX_BOOL bWillCommit, FX_BOOL bFieldFull,
+ int& nSelStart, int& nSelEnd, FX_BOOL& bRC);
+
+ void BeforeNotify();
+ void AfterNotify();
+ FX_BOOL IsNotifying() const {return m_nNotifyFlag > 0;}
+
+private:
+// CReader_InterForm * GetReaderInterForm();
+ FX_BOOL DoAAction(CPDF_AAction::AActionType eAAT, FX_BOOL & bExit);
+ FX_BOOL FindAAction(CPDF_AAction::AActionType eAAT,CPDF_Action & action);
+ FX_BOOL FindAAction(CPDF_AAction aaction,CPDF_AAction::AActionType eAAT,CPDF_Action & action);
+ FX_BOOL ExecuteActionTree(CPDF_AAction::AActionType eAAT, CPDF_Action & action, FX_BOOL& bExit);
+ FX_BOOL ExecuteAction(CPDF_AAction::AActionType eAAT,CPDF_Action & action,FX_BOOL& bExit);
+
+ CFFL_FormFiller * m_pFormFiller;
+ FX_BOOL m_bDoActioning;
+ FX_INT32 m_nNotifyFlag;
+};
+
+#endif
+
diff --git a/fpdfsdk/include/formfiller/FFL_PushButton.h b/fpdfsdk/include/formfiller/FFL_PushButton.h new file mode 100644 index 0000000000..4dcff145ae --- /dev/null +++ b/fpdfsdk/include/formfiller/FFL_PushButton.h @@ -0,0 +1,25 @@ +// 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
+
+#ifndef _FFL_PUSHBUTTON_H_
+#define _FFL_PUSHBUTTON_H_
+
+class CFFL_PushButton : public CFFL_Button
+{
+public:
+ CFFL_PushButton(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot);
+ virtual ~CFFL_PushButton();
+
+ virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);
+
+ virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
+ virtual void OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot,
+ CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,
+ FX_DWORD dwFlags);
+};
+
+#endif //_FFL_PUSHBUTTON_H_
+
diff --git a/fpdfsdk/include/formfiller/FFL_RadioButton.h b/fpdfsdk/include/formfiller/FFL_RadioButton.h new file mode 100644 index 0000000000..bab8584db9 --- /dev/null +++ b/fpdfsdk/include/formfiller/FFL_RadioButton.h @@ -0,0 +1,25 @@ +// 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
+
+#ifndef _FFL_RADIOBUTTON_H_
+#define _FFL_RADIOBUTTON_H_
+
+class CFFL_RadioButton : public CFFL_Button
+{
+public:
+ CFFL_RadioButton(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot);
+ virtual ~CFFL_RadioButton();
+
+ virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);
+ virtual FX_BOOL OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UINT nFlags);
+ virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
+ virtual FX_BOOL OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point);
+ virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView);
+ virtual void SaveData(CPDFSDK_PageView* pPageView);
+};
+
+#endif //_FFL_RADIOBUTTON_H_
+
diff --git a/fpdfsdk/include/formfiller/FFL_TextField.h b/fpdfsdk/include/formfiller/FFL_TextField.h new file mode 100644 index 0000000000..2b6f069af2 --- /dev/null +++ b/fpdfsdk/include/formfiller/FFL_TextField.h @@ -0,0 +1,89 @@ +// 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
+
+#if !defined(AFX_FFL_EDIT_H__8E0C9456_CBA2_4EFB_9F31_53C6D8C1A8AC__INCLUDED_)
+#define AFX_FFL_EDIT_H__8E0C9456_CBA2_4EFB_9F31_53C6D8C1A8AC__INCLUDED_
+
+#include "FFL_FormFiller.h"
+
+#define BF_ALIGN_LEFT 0
+#define BF_ALIGN_MIDDLE 1
+#define BF_ALIGN_RIGHT 2
+
+class CBA_FontMap;
+
+class CFFL_EditUndoItem //: public IUndoItem
+{
+public:
+ CFFL_EditUndoItem(CPWL_Edit* pEdit);
+ virtual ~CFFL_EditUndoItem();
+
+ virtual void Undo();
+ virtual void Redo();
+ virtual CFX_WideString GetDescr();
+ virtual void Release();
+
+private:
+ CPWL_Edit* m_pEdit;
+};
+
+struct FFL_TextFieldState
+{
+ int nStart;
+ int nEnd;
+ CFX_WideString sValue;
+};
+
+class CFFL_TextField : public CFFL_FormFiller, public IPWL_FocusHandler, public IPWL_Edit_Notify
+{
+public:
+ CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot);
+ virtual ~CFFL_TextField();
+
+ virtual PWL_CREATEPARAM GetCreateParam();
+ virtual CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView* pPageView);
+
+
+ virtual FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlags);
+
+ virtual FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView);
+ virtual void SaveData(CPDFSDK_PageView* pPageView);
+
+ virtual void GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
+ PDFSDK_FieldAction& fa);
+ virtual void SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AActionType type,
+ const PDFSDK_FieldAction& fa);
+ virtual FX_BOOL IsActionDataChanged(CPDF_AAction::AActionType type, const PDFSDK_FieldAction& faOld,
+ const PDFSDK_FieldAction& faNew);
+ virtual void SaveState(CPDFSDK_PageView* pPageView);
+ virtual void RestoreState(CPDFSDK_PageView* pPageView);
+
+ virtual CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue);
+
+public:
+ virtual void OnSetFocus(CPWL_Wnd* pWnd);
+ virtual void OnKillFocus(CPWL_Wnd* pWnd);
+
+public:
+ virtual void OnAddUndo(CPWL_Edit* pEdit);
+
+public:
+ virtual FX_BOOL CanCopy(CPDFSDK_Document* pDocument);
+ virtual FX_BOOL CanCut(CPDFSDK_Document* pDocument);
+ virtual FX_BOOL CanPaste(CPDFSDK_Document* pDocument);
+
+ virtual void DoCopy(CPDFSDK_Document* pDocument);
+ virtual void DoCut(CPDFSDK_Document* pDocument);
+ virtual void DoPaste(CPDFSDK_Document* pDocument);
+
+private:
+ CBA_FontMap* m_pFontMap;
+// CBA_SpellCheck* m_pSpellCheck;
+ FFL_TextFieldState m_State;
+// CFFL_IM_BOX m_IMBox;
+};
+
+#endif // !defined(AFX_FFL_EDIT_H__8E0C9456_CBA2_4EFB_9F31_53C6D8C1A8AC__INCLUDED_)
diff --git a/fpdfsdk/include/formfiller/FFL_Utils.h b/fpdfsdk/include/formfiller/FFL_Utils.h new file mode 100644 index 0000000000..07f2bee761 --- /dev/null +++ b/fpdfsdk/include/formfiller/FFL_Utils.h @@ -0,0 +1,20 @@ +// 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
+
+#define FFL_BASE_USERUNIT 1.0f / 72.0f
+
+template<class T> T FFL_MIN (const T & i, const T & j) { return ((i < j) ? i : j); }
+template<class T> T FFL_MAX (const T & i, const T & j) { return ((i > j) ? i : j); }
+
+class CFFL_Utils
+{
+public:
+ static CPDF_Rect MaxRect(const CPDF_Rect & rect1,const CPDF_Rect & rect2);
+ static CPDF_Rect InflateRect(const CPDF_Rect & crRect, const FX_FLOAT & fSize);
+ static CPDF_Rect DeflateRect(const CPDF_Rect & crRect, const FX_FLOAT & fSize);
+ static FX_BOOL TraceObject(CPDF_Object* pObj);
+};
+
diff --git a/fpdfsdk/include/formfiller/FormFiller.h b/fpdfsdk/include/formfiller/FormFiller.h new file mode 100644 index 0000000000..e7a22a0101 --- /dev/null +++ b/fpdfsdk/include/formfiller/FormFiller.h @@ -0,0 +1,30 @@ +// 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
+
+#ifndef _FORMFILLER_H_
+#define _FORMFILLER_H_
+
+
+
+#ifndef _INC_PDFAPI
+ #define _INC_PDFAPI
+
+ #include "../../../core/include/fpdfapi/fpdf_module.h"
+ #include "../../../core/include/fpdfdoc/fpdf_doc.h"
+ #include "../../../core/include/fpdfdoc/fpdf_vt.h"
+ #include "../../../core/include/fxcrt/fx_xml.h"
+
+#endif
+
+#include "../fsdk_mgr.h"
+
+#include "../fxedit/fx_edit.h"
+#include "../pdfwindow/IPDFWindow.h"
+
+
+
+#endif //_FORMFILLER_H_
+
|