1 // Copyright 2014 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #ifndef _FXFA_FORMFILLER_FIELD_IMP_H 8 #define _FXFA_FORMFILLER_FIELD_IMP_H 9 #define XFA_MINUI_HEIGHT 4.32f 10 #define XFA_DEFAULTUI_HEIGHT 2.0f 11 class CXFA_TextLayout; 12 class CXFA_FFField : public CXFA_FFWidget, public IFWL_WidgetDelegate { 13 public: 14 CXFA_FFField(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); 15 virtual ~CXFA_FFField(); 16 17 virtual FX_BOOL GetBBox(CFX_RectF& rtBox, 18 FX_DWORD dwStatus, 19 FX_BOOL bDrawFocus = FALSE); 20 virtual void RenderWidget(CFX_Graphics* pGS, 21 CFX_Matrix* pMatrix = NULL, 22 FX_DWORD dwStatus = 0, 23 int32_t iRotate = 0); 24 virtual FX_BOOL IsLoaded(); 25 virtual FX_BOOL LoadWidget(); 26 virtual void UnloadWidget(); 27 virtual FX_BOOL PerformLayout(); 28 virtual void UpdateFWL(); 29 FX_DWORD UpdateUIProperty(); 30 virtual FX_BOOL OnMouseEnter(); 31 virtual FX_BOOL OnMouseExit(); 32 virtual FX_BOOL OnLButtonDown(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy); 33 virtual FX_BOOL OnLButtonUp(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy); 34 virtual FX_BOOL OnLButtonDblClk(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy); 35 virtual FX_BOOL OnMouseMove(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy); 36 virtual FX_BOOL OnMouseWheel(FX_DWORD dwFlags, 37 int16_t zDelta, 38 FX_FLOAT fx, 39 FX_FLOAT fy); 40 virtual FX_BOOL OnRButtonDown(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy); 41 virtual FX_BOOL OnRButtonUp(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy); 42 virtual FX_BOOL OnRButtonDblClk(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy); 43 44 virtual FX_BOOL OnSetFocus(CXFA_FFWidget* pOldWidget); 45 virtual FX_BOOL OnKillFocus(CXFA_FFWidget* pNewWidget); 46 virtual FX_BOOL OnKeyDown(FX_DWORD dwKeyCode, FX_DWORD dwFlags); 47 virtual FX_BOOL OnKeyUp(FX_DWORD dwKeyCode, FX_DWORD dwFlags); 48 virtual FX_BOOL OnChar(FX_DWORD dwChar, FX_DWORD dwFlags); 49 virtual FX_DWORD OnHitTest(FX_FLOAT fx, FX_FLOAT fy); 50 virtual FX_BOOL OnSetCursor(FX_FLOAT fx, FX_FLOAT fy); 51 52 protected: 53 virtual FX_BOOL PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy); 54 virtual void SetFWLRect(); 55 void SetFWLThemeProvider(); GetNormalWidget()56 CFWL_Widget* GetNormalWidget() { return m_pNormalWidget; } 57 void FWLToClient(FX_FLOAT& fx, FX_FLOAT& fy); 58 void LayoutCaption(); 59 void RenderCaption(CFX_Graphics* pGS, CFX_Matrix* pMatrix = NULL); 60 61 int32_t CalculateOverride(); 62 int32_t CalculateWidgetAcc(CXFA_WidgetAcc* pAcc); 63 FX_BOOL ProcessCommittedData(); 64 virtual FX_BOOL CommitData(); 65 virtual FX_BOOL IsDataChanged(); 66 void DrawHighlight(CFX_Graphics* pGS, 67 CFX_Matrix* pMatrix, 68 FX_DWORD dwStatus, 69 FX_BOOL bEllipse = FALSE); 70 void DrawFocus(CFX_Graphics* pGS, CFX_Matrix* pMatrix); 71 void TranslateFWLMessage(CFWL_Message* pMessage); 72 void CapPlacement(); 73 void CapTopBottomPlacement(CXFA_Caption caption, 74 const CFX_RectF& rtWidget, 75 int32_t iCapPlacement); 76 void CapLeftRightPlacement(CXFA_Caption caption, 77 const CFX_RectF& rtWidget, 78 int32_t iCapPlacement); 79 void SetEditScrollOffset(); 80 81 public: 82 virtual int32_t OnProcessMessage(CFWL_Message* pMessage); 83 virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent); 84 virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, 85 const CFX_Matrix* pMatrix = NULL); 86 87 protected: 88 CFWL_Widget* m_pNormalWidget; 89 CFX_RectF m_rtUI; 90 CFX_RectF m_rtCaption; 91 }; 92 #endif 93