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 #ifndef XFA_FXFA_XFA_FFWIDGET_H_ | 7 #ifndef XFA_FXFA_XFA_FFWIDGET_H_ |
8 #define XFA_FXFA_XFA_FFWIDGET_H_ | 8 #define XFA_FXFA_XFA_FFWIDGET_H_ |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 CFX_ArrayTemplate<CXFA_WidgetAcc*> m_Globals; | 40 CFX_ArrayTemplate<CXFA_WidgetAcc*> m_Globals; |
41 int32_t m_iRefCount; | 41 int32_t m_iRefCount; |
42 }; | 42 }; |
43 | 43 |
44 class CXFA_FFWidget : public CXFA_ContentLayoutItem { | 44 class CXFA_FFWidget : public CXFA_ContentLayoutItem { |
45 public: | 45 public: |
46 CXFA_FFWidget(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); | 46 CXFA_FFWidget(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); |
47 ~CXFA_FFWidget() override; | 47 ~CXFA_FFWidget() override; |
48 | 48 |
49 virtual FX_BOOL GetBBox(CFX_RectF& rtBox, | 49 virtual bool GetBBox(CFX_RectF& rtBox, |
50 uint32_t dwStatus, | 50 uint32_t dwStatus, |
51 FX_BOOL bDrawFocus = FALSE); | 51 bool bDrawFocus = false); |
52 virtual void RenderWidget(CFX_Graphics* pGS, | 52 virtual void RenderWidget(CFX_Graphics* pGS, |
53 CFX_Matrix* pMatrix, | 53 CFX_Matrix* pMatrix, |
54 uint32_t dwStatus); | 54 uint32_t dwStatus); |
55 virtual FX_BOOL IsLoaded(); | 55 virtual bool IsLoaded(); |
56 virtual FX_BOOL LoadWidget(); | 56 virtual bool LoadWidget(); |
57 virtual void UnloadWidget(); | 57 virtual void UnloadWidget(); |
58 virtual FX_BOOL PerformLayout(); | 58 virtual bool PerformLayout(); |
59 virtual FX_BOOL UpdateFWLData(); | 59 virtual bool UpdateFWLData(); |
60 virtual void UpdateWidgetProperty(); | 60 virtual void UpdateWidgetProperty(); |
61 virtual FX_BOOL OnMouseEnter(); | 61 virtual bool OnMouseEnter(); |
62 virtual FX_BOOL OnMouseExit(); | 62 virtual bool OnMouseExit(); |
63 virtual FX_BOOL OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); | 63 virtual bool OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); |
64 virtual FX_BOOL OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); | 64 virtual bool OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); |
65 virtual FX_BOOL OnLButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); | 65 virtual bool OnLButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); |
66 virtual FX_BOOL OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); | 66 virtual bool OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); |
67 virtual FX_BOOL OnMouseWheel(uint32_t dwFlags, | 67 virtual bool OnMouseWheel(uint32_t dwFlags, |
68 int16_t zDelta, | 68 int16_t zDelta, |
69 FX_FLOAT fx, | 69 FX_FLOAT fx, |
70 FX_FLOAT fy); | 70 FX_FLOAT fy); |
71 virtual FX_BOOL OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); | 71 virtual bool OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); |
72 virtual FX_BOOL OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); | 72 virtual bool OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); |
73 virtual FX_BOOL OnRButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); | 73 virtual bool OnRButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); |
74 | 74 |
75 virtual FX_BOOL OnSetFocus(CXFA_FFWidget* pOldWidget); | 75 virtual bool OnSetFocus(CXFA_FFWidget* pOldWidget); |
76 virtual FX_BOOL OnKillFocus(CXFA_FFWidget* pNewWidget); | 76 virtual bool OnKillFocus(CXFA_FFWidget* pNewWidget); |
77 virtual FX_BOOL OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags); | 77 virtual bool OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags); |
78 virtual FX_BOOL OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags); | 78 virtual bool OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags); |
79 virtual FX_BOOL OnChar(uint32_t dwChar, uint32_t dwFlags); | 79 virtual bool OnChar(uint32_t dwChar, uint32_t dwFlags); |
80 virtual FWL_WidgetHit OnHitTest(FX_FLOAT fx, FX_FLOAT fy); | 80 virtual FWL_WidgetHit OnHitTest(FX_FLOAT fx, FX_FLOAT fy); |
81 virtual FX_BOOL OnSetCursor(FX_FLOAT fx, FX_FLOAT fy); | 81 virtual bool OnSetCursor(FX_FLOAT fx, FX_FLOAT fy); |
82 virtual FX_BOOL CanUndo(); | 82 virtual bool CanUndo(); |
83 virtual FX_BOOL CanRedo(); | 83 virtual bool CanRedo(); |
84 virtual FX_BOOL Undo(); | 84 virtual bool Undo(); |
85 virtual FX_BOOL Redo(); | 85 virtual bool Redo(); |
86 virtual FX_BOOL CanCopy(); | 86 virtual bool CanCopy(); |
87 virtual FX_BOOL CanCut(); | 87 virtual bool CanCut(); |
88 virtual FX_BOOL CanPaste(); | 88 virtual bool CanPaste(); |
89 virtual FX_BOOL CanSelectAll(); | 89 virtual bool CanSelectAll(); |
90 virtual FX_BOOL CanDelete(); | 90 virtual bool CanDelete(); |
91 virtual FX_BOOL CanDeSelect(); | 91 virtual bool CanDeSelect(); |
92 virtual FX_BOOL Copy(CFX_WideString& wsCopy); | 92 virtual bool Copy(CFX_WideString& wsCopy); |
93 virtual FX_BOOL Cut(CFX_WideString& wsCut); | 93 virtual bool Cut(CFX_WideString& wsCut); |
94 virtual FX_BOOL Paste(const CFX_WideString& wsPaste); | 94 virtual bool Paste(const CFX_WideString& wsPaste); |
95 virtual FX_BOOL SelectAll(); | 95 virtual bool SelectAll(); |
96 virtual FX_BOOL Delete(); | 96 virtual bool Delete(); |
97 virtual FX_BOOL DeSelect(); | 97 virtual bool DeSelect(); |
98 virtual FX_BOOL GetSuggestWords(CFX_PointF pointf, | 98 virtual bool GetSuggestWords(CFX_PointF pointf, |
99 std::vector<CFX_ByteString>& sSuggest); | 99 std::vector<CFX_ByteString>& sSuggest); |
100 virtual FX_BOOL ReplaceSpellCheckWord(CFX_PointF pointf, | 100 virtual bool ReplaceSpellCheckWord(CFX_PointF pointf, |
101 const CFX_ByteStringC& bsReplace); | 101 const CFX_ByteStringC& bsReplace); |
102 | 102 |
103 CXFA_FFPageView* GetPageView(); | 103 CXFA_FFPageView* GetPageView(); |
104 void SetPageView(CXFA_FFPageView* pPageView); | 104 void SetPageView(CXFA_FFPageView* pPageView); |
105 void GetWidgetRect(CFX_RectF& rtWidget); | 105 void GetWidgetRect(CFX_RectF& rtWidget); |
106 CFX_RectF ReCacheWidgetRect(); | 106 CFX_RectF ReCacheWidgetRect(); |
107 uint32_t GetStatus(); | 107 uint32_t GetStatus(); |
108 void ModifyStatus(uint32_t dwAdded, uint32_t dwRemoved); | 108 void ModifyStatus(uint32_t dwAdded, uint32_t dwRemoved); |
109 | 109 |
110 CXFA_WidgetAcc* GetDataAcc(); | 110 CXFA_WidgetAcc* GetDataAcc(); |
111 FX_BOOL GetToolTip(CFX_WideString& wsToolTip); | 111 bool GetToolTip(CFX_WideString& wsToolTip); |
112 | 112 |
113 CXFA_FFDocView* GetDocView(); | 113 CXFA_FFDocView* GetDocView(); |
114 void SetDocView(CXFA_FFDocView* pDocView); | 114 void SetDocView(CXFA_FFDocView* pDocView); |
115 CXFA_FFDoc* GetDoc(); | 115 CXFA_FFDoc* GetDoc(); |
116 CXFA_FFApp* GetApp(); | 116 CXFA_FFApp* GetApp(); |
117 IXFA_AppProvider* GetAppProvider(); | 117 IXFA_AppProvider* GetAppProvider(); |
118 void InvalidateWidget(const CFX_RectF* pRect = nullptr); | 118 void InvalidateWidget(const CFX_RectF* pRect = nullptr); |
119 void AddInvalidateRect(const CFX_RectF* pRect = nullptr); | 119 void AddInvalidateRect(const CFX_RectF* pRect = nullptr); |
120 FX_BOOL GetCaptionText(CFX_WideString& wsCap); | 120 bool GetCaptionText(CFX_WideString& wsCap); |
121 bool IsFocused(); | 121 bool IsFocused(); |
122 void Rotate2Normal(FX_FLOAT& fx, FX_FLOAT& fy); | 122 void Rotate2Normal(FX_FLOAT& fx, FX_FLOAT& fy); |
123 void GetRotateMatrix(CFX_Matrix& mt); | 123 void GetRotateMatrix(CFX_Matrix& mt); |
124 FX_BOOL IsLayoutRectEmpty(); | 124 bool IsLayoutRectEmpty(); |
125 CXFA_FFWidget* GetParent(); | 125 CXFA_FFWidget* GetParent(); |
126 FX_BOOL IsAncestorOf(CXFA_FFWidget* pWidget); | 126 bool IsAncestorOf(CXFA_FFWidget* pWidget); |
127 const IFWL_App* GetFWLApp(); | 127 const IFWL_App* GetFWLApp(); |
128 | 128 |
129 protected: | 129 protected: |
130 virtual FX_BOOL PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy); | 130 virtual bool PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy); |
131 | 131 |
132 void DrawBorder(CFX_Graphics* pGS, | 132 void DrawBorder(CFX_Graphics* pGS, |
133 CXFA_Box box, | 133 CXFA_Box box, |
134 const CFX_RectF& rtBorder, | 134 const CFX_RectF& rtBorder, |
135 CFX_Matrix* pMatrix, | 135 CFX_Matrix* pMatrix, |
136 uint32_t dwFlags = 0); | 136 uint32_t dwFlags = 0); |
137 void GetMinMaxWidth(FX_FLOAT fMinWidth, FX_FLOAT fMaxWidth); | 137 void GetMinMaxWidth(FX_FLOAT fMinWidth, FX_FLOAT fMaxWidth); |
138 void GetMinMaxHeight(FX_FLOAT fMinHeight, FX_FLOAT fMaxHeight); | 138 void GetMinMaxHeight(FX_FLOAT fMinHeight, FX_FLOAT fMaxHeight); |
139 void GetRectWithoutRotate(CFX_RectF& rtWidget); | 139 void GetRectWithoutRotate(CFX_RectF& rtWidget); |
140 bool IsMatchVisibleStatus(uint32_t dwStatus); | 140 bool IsMatchVisibleStatus(uint32_t dwStatus); |
141 void EventKillFocus(); | 141 void EventKillFocus(); |
142 FX_BOOL IsButtonDown(); | 142 bool IsButtonDown(); |
143 void SetButtonDown(FX_BOOL bSet); | 143 void SetButtonDown(bool bSet); |
144 | 144 |
145 CXFA_FFDocView* m_pDocView; | 145 CXFA_FFDocView* m_pDocView; |
146 CXFA_FFPageView* m_pPageView; | 146 CXFA_FFPageView* m_pPageView; |
147 CXFA_WidgetAcc* m_pDataAcc; | 147 CXFA_WidgetAcc* m_pDataAcc; |
148 CFX_RectF m_rtWidget; | 148 CFX_RectF m_rtWidget; |
149 }; | 149 }; |
150 | 150 |
151 int32_t XFA_StrokeTypeSetLineDash(CFX_Graphics* pGraphics, | 151 int32_t XFA_StrokeTypeSetLineDash(CFX_Graphics* pGraphics, |
152 int32_t iStrokeType, | 152 int32_t iStrokeType, |
153 int32_t iCapType); | 153 int32_t iCapType); |
154 CFX_GraphStateData::LineCap XFA_LineCapToFXGE(int32_t iLineCap); | 154 CFX_GraphStateData::LineCap XFA_LineCapToFXGE(int32_t iLineCap); |
155 void XFA_DrawImage(CFX_Graphics* pGS, | 155 void XFA_DrawImage(CFX_Graphics* pGS, |
156 const CFX_RectF& rtImage, | 156 const CFX_RectF& rtImage, |
157 CFX_Matrix* pMatrix, | 157 CFX_Matrix* pMatrix, |
158 CFX_DIBitmap* pDIBitmap, | 158 CFX_DIBitmap* pDIBitmap, |
159 int32_t iAspect, | 159 int32_t iAspect, |
160 int32_t iImageXDpi, | 160 int32_t iImageXDpi, |
161 int32_t iImageYDpi, | 161 int32_t iImageYDpi, |
162 int32_t iHorzAlign = XFA_ATTRIBUTEENUM_Left, | 162 int32_t iHorzAlign = XFA_ATTRIBUTEENUM_Left, |
163 int32_t iVertAlign = XFA_ATTRIBUTEENUM_Top); | 163 int32_t iVertAlign = XFA_ATTRIBUTEENUM_Top); |
164 CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc, | 164 CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc, |
165 CXFA_Image* pImage, | 165 CXFA_Image* pImage, |
166 FX_BOOL& bNameImage, | 166 bool& bNameImage, |
167 int32_t& iImageXDpi, | 167 int32_t& iImageXDpi, |
168 int32_t& iImageYDpi); | 168 int32_t& iImageYDpi); |
169 CFX_DIBitmap* XFA_LoadImageFromBuffer(IFX_SeekableReadStream* pImageFileRead, | 169 CFX_DIBitmap* XFA_LoadImageFromBuffer(IFX_SeekableReadStream* pImageFileRead, |
170 FXCODEC_IMAGE_TYPE type, | 170 FXCODEC_IMAGE_TYPE type, |
171 int32_t& iImageXDpi, | 171 int32_t& iImageXDpi, |
172 int32_t& iImageYDpi); | 172 int32_t& iImageYDpi); |
173 FXCODEC_IMAGE_TYPE XFA_GetImageType(const CFX_WideString& wsType); | 173 FXCODEC_IMAGE_TYPE XFA_GetImageType(const CFX_WideString& wsType); |
174 FX_CHAR* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len); | 174 FX_CHAR* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len); |
175 void XFA_RectWidthoutMargin(CFX_RectF& rt, | 175 void XFA_RectWidthoutMargin(CFX_RectF& rt, |
176 const CXFA_Margin& mg, | 176 const CXFA_Margin& mg, |
177 FX_BOOL bUI = FALSE); | 177 bool bUI = false); |
178 CXFA_FFWidget* XFA_GetWidgetFromLayoutItem(CXFA_LayoutItem* pLayoutItem); | 178 CXFA_FFWidget* XFA_GetWidgetFromLayoutItem(CXFA_LayoutItem* pLayoutItem); |
179 FX_BOOL XFA_IsCreateWidget(XFA_Element iType); | 179 bool XFA_IsCreateWidget(XFA_Element iType); |
180 #define XFA_DRAWBOX_ForceRound 1 | 180 #define XFA_DRAWBOX_ForceRound 1 |
181 #define XFA_DRAWBOX_Lowered3D 2 | 181 #define XFA_DRAWBOX_Lowered3D 2 |
182 void XFA_DrawBox(CXFA_Box box, | 182 void XFA_DrawBox(CXFA_Box box, |
183 CFX_Graphics* pGS, | 183 CFX_Graphics* pGS, |
184 const CFX_RectF& rtWidget, | 184 const CFX_RectF& rtWidget, |
185 CFX_Matrix* pMatrix, | 185 CFX_Matrix* pMatrix, |
186 uint32_t dwFlags = 0); | 186 uint32_t dwFlags = 0); |
187 | 187 |
188 #endif // XFA_FXFA_XFA_FFWIDGET_H_ | 188 #endif // XFA_FXFA_XFA_FFWIDGET_H_ |
OLD | NEW |