OLD | NEW |
| (Empty) |
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 XFA_FXFA_INCLUDE_FXFA_WIDGET_H_ | |
8 #define XFA_FXFA_INCLUDE_FXFA_WIDGET_H_ | |
9 | |
10 #include "core/fxcrt/fx_coordinates.h" | |
11 #include "core/fxge/fx_dib.h" | |
12 #include "xfa/fxfa/parser/cxfa_box.h" | |
13 #include "xfa/fxfa/parser/cxfa_event.h" | |
14 #include "xfa/fxfa/parser/cxfa_image.h" | |
15 #include "xfa/fxfa/parser/cxfa_margin.h" | |
16 #include "xfa/fxfa/parser/cxfa_script.h" | |
17 #include "xfa/fxfa/parser/cxfa_value.h" | |
18 #include "xfa/fxfa/parser/cxfa_widgetdata.h" | |
19 | |
20 class CFGAS_GEFont; | |
21 class CXFA_EventParam; | |
22 class CXFA_FFApp; | |
23 class CXFA_FFDoc; | |
24 class CXFA_FFDocView; | |
25 class CXFA_FFWidget; | |
26 class CXFA_Node; | |
27 class CXFA_TextLayout; | |
28 class CXFA_WidgetLayoutData; | |
29 class IXFA_AppProvider; | |
30 | |
31 class CXFA_WidgetAcc : public CXFA_WidgetData { | |
32 public: | |
33 CXFA_WidgetAcc(CXFA_FFDocView* pDocView, CXFA_Node* pNode); | |
34 ~CXFA_WidgetAcc(); | |
35 | |
36 FX_BOOL GetName(CFX_WideString& wsName, int32_t iNameType = 0); | |
37 FX_BOOL ProcessValueChanged(); | |
38 void ResetData(); | |
39 | |
40 void SetImageEdit(const CFX_WideString& wsContentType, | |
41 const CFX_WideString& wsHref, | |
42 const CFX_WideString& wsData); | |
43 | |
44 CXFA_WidgetAcc* GetExclGroup(); | |
45 CXFA_FFDocView* GetDocView(); | |
46 CXFA_FFDoc* GetDoc(); | |
47 CXFA_FFApp* GetApp(); | |
48 IXFA_AppProvider* GetAppProvider(); | |
49 | |
50 int32_t ProcessEvent(int32_t iActivity, CXFA_EventParam* pEventParam); | |
51 int32_t ProcessEvent(CXFA_Event& event, CXFA_EventParam* pEventParam); | |
52 int32_t ProcessCalculate(); | |
53 int32_t ProcessValidate(int32_t iFlags = 0); | |
54 int32_t ExecuteScript(CXFA_Script script, | |
55 CXFA_EventParam* pEventParam, | |
56 CFXJSE_Value** pRetValue = nullptr); | |
57 | |
58 CXFA_FFWidget* GetNextWidget(CXFA_FFWidget* pWidget); | |
59 void StartWidgetLayout(FX_FLOAT& fCalcWidth, FX_FLOAT& fCalcHeight); | |
60 FX_BOOL FindSplitPos(int32_t iBlockIndex, FX_FLOAT& fCalcHeight); | |
61 FX_BOOL LoadCaption(); | |
62 void LoadText(); | |
63 FX_BOOL LoadImageImage(); | |
64 FX_BOOL LoadImageEditImage(); | |
65 void GetImageDpi(int32_t& iImageXDpi, int32_t& iImageYDpi); | |
66 void GetImageEditDpi(int32_t& iImageXDpi, int32_t& iImageYDpi); | |
67 CXFA_TextLayout* GetCaptionTextLayout(); | |
68 CXFA_TextLayout* GetTextLayout(); | |
69 CFX_DIBitmap* GetImageImage(); | |
70 CFX_DIBitmap* GetImageEditImage(); | |
71 void SetImageImage(CFX_DIBitmap* newImage); | |
72 void SetImageEditImage(CFX_DIBitmap* newImage); | |
73 void UpdateUIDisplay(CXFA_FFWidget* pExcept = nullptr); | |
74 | |
75 CXFA_Node* GetDatasets(); | |
76 CFGAS_GEFont* GetFDEFont(); | |
77 FX_FLOAT GetFontSize(); | |
78 FX_ARGB GetTextColor(); | |
79 FX_FLOAT GetLineHeight(); | |
80 CXFA_WidgetLayoutData* GetWidgetLayoutData(); | |
81 | |
82 protected: | |
83 void ProcessScriptTestValidate(CXFA_Validate validate, | |
84 int32_t iRet, | |
85 CFXJSE_Value* pRetValue, | |
86 FX_BOOL bVersionFlag); | |
87 int32_t ProcessFormatTestValidate(CXFA_Validate validate, | |
88 FX_BOOL bVersionFlag); | |
89 int32_t ProcessNullTestValidate(CXFA_Validate validate, | |
90 int32_t iFlags, | |
91 FX_BOOL bVersionFlag); | |
92 void GetValidateCaptionName(CFX_WideString& wsCaptionName, | |
93 FX_BOOL bVersionFlag); | |
94 void GetValidateMessage(IXFA_AppProvider* pAppProvider, | |
95 CFX_WideString& wsMessage, | |
96 FX_BOOL bError, | |
97 FX_BOOL bVersionFlag); | |
98 void CalcCaptionSize(CFX_SizeF& szCap); | |
99 FX_BOOL CalculateFieldAutoSize(CFX_SizeF& size); | |
100 FX_BOOL CalculateWidgetAutoSize(CFX_SizeF& size); | |
101 FX_BOOL CalculateTextEditAutoSize(CFX_SizeF& size); | |
102 FX_BOOL CalculateCheckButtonAutoSize(CFX_SizeF& size); | |
103 FX_BOOL CalculatePushButtonAutoSize(CFX_SizeF& size); | |
104 FX_BOOL CalculateImageEditAutoSize(CFX_SizeF& size); | |
105 FX_BOOL CalculateImageAutoSize(CFX_SizeF& size); | |
106 FX_BOOL CalculateTextAutoSize(CFX_SizeF& size); | |
107 FX_FLOAT CalculateWidgetAutoHeight(FX_FLOAT fHeightCalc); | |
108 FX_FLOAT CalculateWidgetAutoWidth(FX_FLOAT fWidthCalc); | |
109 FX_FLOAT GetWidthWithoutMargin(FX_FLOAT fWidthCalc); | |
110 FX_FLOAT GetHeightWithoutMargin(FX_FLOAT fHeightCalc); | |
111 void CalculateTextContentSize(CFX_SizeF& size); | |
112 void CalculateAccWidthAndHeight(XFA_Element eUIType, | |
113 FX_FLOAT& fWidth, | |
114 FX_FLOAT& fCalcHeight); | |
115 void InitLayoutData(); | |
116 void StartTextLayout(FX_FLOAT& fCalcWidth, FX_FLOAT& fCalcHeight); | |
117 | |
118 CXFA_FFDocView* m_pDocView; | |
119 std::unique_ptr<CXFA_WidgetLayoutData> m_pLayoutData; | |
120 uint32_t m_nRecursionDepth; | |
121 }; | |
122 | |
123 #endif // XFA_FXFA_INCLUDE_FXFA_WIDGET_H_ | |
OLD | NEW |