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_INCLUDE_FXFA_XFA_FFWIDGETHANDLER_H_ |
| 8 #define XFA_INCLUDE_FXFA_XFA_FFWIDGETHANDLER_H_ |
| 9 |
| 10 #include <vector> |
| 11 |
| 12 #include "xfa/fxfa/parser/xfa_document.h" |
| 13 #include "xfa/include/fxfa/fxfa.h" |
| 14 |
| 15 class CXFA_FFDocView; |
| 16 |
| 17 class CXFA_FFWidgetHandler { |
| 18 public: |
| 19 CXFA_FFWidgetHandler(CXFA_FFDocView* pDocView); |
| 20 ~CXFA_FFWidgetHandler(); |
| 21 CXFA_FFWidget* CreateWidget(CXFA_FFWidget* hParent, |
| 22 XFA_WIDGETTYPE eType, |
| 23 CXFA_FFWidget* hBefore = NULL); |
| 24 CXFA_FFPageView* GetPageView(CXFA_FFWidget* hWidget); |
| 25 void GetRect(CXFA_FFWidget* hWidget, CFX_RectF& rt); |
| 26 uint32_t GetStatus(CXFA_FFWidget* hWidget); |
| 27 FX_BOOL GetBBox(CXFA_FFWidget* hWidget, |
| 28 CFX_RectF& rtBox, |
| 29 uint32_t dwStatus, |
| 30 FX_BOOL bDrawFocus = FALSE); |
| 31 CXFA_WidgetAcc* GetDataAcc(CXFA_FFWidget* hWidget); |
| 32 void GetName(CXFA_FFWidget* hWidget, |
| 33 CFX_WideString& wsName, |
| 34 int32_t iNameType = 0); |
| 35 FX_BOOL GetToolTip(CXFA_FFWidget* hWidget, CFX_WideString& wsToolTip); |
| 36 void SetPrivateData(CXFA_FFWidget* hWidget, |
| 37 void* module_id, |
| 38 void* pData, |
| 39 PD_CALLBACK_FREEDATA callback); |
| 40 void* GetPrivateData(CXFA_FFWidget* hWidget, void* module_id); |
| 41 FX_BOOL OnMouseEnter(CXFA_FFWidget* hWidget); |
| 42 FX_BOOL OnMouseExit(CXFA_FFWidget* hWidget); |
| 43 FX_BOOL OnLButtonDown(CXFA_FFWidget* hWidget, |
| 44 uint32_t dwFlags, |
| 45 FX_FLOAT fx, |
| 46 FX_FLOAT fy); |
| 47 FX_BOOL OnLButtonUp(CXFA_FFWidget* hWidget, |
| 48 uint32_t dwFlags, |
| 49 FX_FLOAT fx, |
| 50 FX_FLOAT fy); |
| 51 FX_BOOL OnLButtonDblClk(CXFA_FFWidget* hWidget, |
| 52 uint32_t dwFlags, |
| 53 FX_FLOAT fx, |
| 54 FX_FLOAT fy); |
| 55 FX_BOOL OnMouseMove(CXFA_FFWidget* hWidget, |
| 56 uint32_t dwFlags, |
| 57 FX_FLOAT fx, |
| 58 FX_FLOAT fy); |
| 59 FX_BOOL OnMouseWheel(CXFA_FFWidget* hWidget, |
| 60 uint32_t dwFlags, |
| 61 int16_t zDelta, |
| 62 FX_FLOAT fx, |
| 63 FX_FLOAT fy); |
| 64 FX_BOOL OnRButtonDown(CXFA_FFWidget* hWidget, |
| 65 uint32_t dwFlags, |
| 66 FX_FLOAT fx, |
| 67 FX_FLOAT fy); |
| 68 FX_BOOL OnRButtonUp(CXFA_FFWidget* hWidget, |
| 69 uint32_t dwFlags, |
| 70 FX_FLOAT fx, |
| 71 FX_FLOAT fy); |
| 72 FX_BOOL OnRButtonDblClk(CXFA_FFWidget* hWidget, |
| 73 uint32_t dwFlags, |
| 74 FX_FLOAT fx, |
| 75 FX_FLOAT fy); |
| 76 |
| 77 FX_BOOL OnKeyDown(CXFA_FFWidget* hWidget, |
| 78 uint32_t dwKeyCode, |
| 79 uint32_t dwFlags); |
| 80 FX_BOOL OnKeyUp(CXFA_FFWidget* hWidget, uint32_t dwKeyCode, uint32_t dwFlags); |
| 81 FX_BOOL OnChar(CXFA_FFWidget* hWidget, uint32_t dwChar, uint32_t dwFlags); |
| 82 uint32_t OnHitTest(CXFA_FFWidget* hWidget, FX_FLOAT fx, FX_FLOAT fy); |
| 83 FX_BOOL OnSetCursor(CXFA_FFWidget* hWidget, FX_FLOAT fx, FX_FLOAT fy); |
| 84 void RenderWidget(CXFA_FFWidget* hWidget, |
| 85 CFX_Graphics* pGS, |
| 86 CFX_Matrix* pMatrix = NULL, |
| 87 FX_BOOL bHighlight = FALSE); |
| 88 FX_BOOL HasEvent(CXFA_WidgetAcc* pWidgetAcc, XFA_EVENTTYPE eEventType); |
| 89 int32_t ProcessEvent(CXFA_WidgetAcc* pWidgetAcc, CXFA_EventParam* pParam); |
| 90 |
| 91 protected: |
| 92 CXFA_Node* CreateWidgetFormItem(XFA_WIDGETTYPE eType, |
| 93 CXFA_Node* pParent, |
| 94 CXFA_Node* pBefore) const; |
| 95 |
| 96 CXFA_Node* CreatePushButton(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 97 CXFA_Node* CreateCheckButton(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 98 CXFA_Node* CreateExclGroup(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 99 CXFA_Node* CreateRadioButton(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 100 CXFA_Node* CreateDatetimeEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 101 CXFA_Node* CreateDecimalField(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 102 CXFA_Node* CreateNumericField(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 103 CXFA_Node* CreateSignature(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 104 CXFA_Node* CreateTextEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 105 CXFA_Node* CreateDropdownList(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 106 CXFA_Node* CreateListBox(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 107 CXFA_Node* CreateImageField(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 108 CXFA_Node* CreatePasswordEdit(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 109 CXFA_Node* CreateField(XFA_ELEMENT eElement, |
| 110 CXFA_Node* pParent, |
| 111 CXFA_Node* pBefore) const; |
| 112 CXFA_Node* CreateArc(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 113 CXFA_Node* CreateRectangle(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 114 CXFA_Node* CreateImage(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 115 CXFA_Node* CreateLine(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 116 CXFA_Node* CreateText(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 117 CXFA_Node* CreateDraw(XFA_ELEMENT eElement, |
| 118 CXFA_Node* pParent, |
| 119 CXFA_Node* pBefore) const; |
| 120 |
| 121 CXFA_Node* CreateSubform(CXFA_Node* pParent, CXFA_Node* pBefore) const; |
| 122 CXFA_Node* CreateFormItem(XFA_ELEMENT eElement, |
| 123 CXFA_Node* pParent, |
| 124 CXFA_Node* pBefore) const; |
| 125 CXFA_Node* CreateCopyNode(XFA_ELEMENT eElement, |
| 126 CXFA_Node* pParent, |
| 127 CXFA_Node* pBefore = NULL) const; |
| 128 CXFA_Node* CreateTemplateNode(XFA_ELEMENT eElement, |
| 129 CXFA_Node* pParent, |
| 130 CXFA_Node* pBefore) const; |
| 131 CXFA_Node* CreateFontNode(CXFA_Node* pParent) const; |
| 132 CXFA_Node* CreateMarginNode(CXFA_Node* pParent, |
| 133 uint32_t dwFlags, |
| 134 FX_FLOAT fInsets[4]) const; |
| 135 CXFA_Node* CreateValueNode(XFA_ELEMENT eValue, CXFA_Node* pParent) const; |
| 136 CXFA_Document* GetObjFactory() const; |
| 137 CXFA_Document* GetXFADoc() const; |
| 138 |
| 139 CXFA_FFDocView* m_pDocView; |
| 140 }; |
| 141 |
| 142 class CXFA_FFMenuHandler { |
| 143 public: |
| 144 CXFA_FFMenuHandler(); |
| 145 ~CXFA_FFMenuHandler(); |
| 146 |
| 147 FX_BOOL CanCopy(CXFA_FFWidget* hWidget); |
| 148 FX_BOOL CanCut(CXFA_FFWidget* hWidget); |
| 149 FX_BOOL CanPaste(CXFA_FFWidget* hWidget); |
| 150 FX_BOOL CanSelectAll(CXFA_FFWidget* hWidget); |
| 151 FX_BOOL CanDelete(CXFA_FFWidget* hWidget); |
| 152 FX_BOOL CanDeSelect(CXFA_FFWidget* hWidget); |
| 153 FX_BOOL Copy(CXFA_FFWidget* hWidget, CFX_WideString& wsText); |
| 154 FX_BOOL Cut(CXFA_FFWidget* hWidget, CFX_WideString& wsText); |
| 155 FX_BOOL Paste(CXFA_FFWidget* hWidget, const CFX_WideString& wsText); |
| 156 FX_BOOL SelectAll(CXFA_FFWidget* hWidget); |
| 157 FX_BOOL Delete(CXFA_FFWidget* hWidget); |
| 158 FX_BOOL DeSelect(CXFA_FFWidget* hWidget); |
| 159 FX_BOOL CanUndo(CXFA_FFWidget* hWidget); |
| 160 FX_BOOL CanRedo(CXFA_FFWidget* hWidget); |
| 161 FX_BOOL Undo(CXFA_FFWidget* hWidget); |
| 162 FX_BOOL Redo(CXFA_FFWidget* hWidget); |
| 163 FX_BOOL GetSuggestWords(CXFA_FFWidget* hWidget, |
| 164 CFX_PointF pointf, |
| 165 std::vector<CFX_ByteString>& sSuggest); |
| 166 FX_BOOL ReplaceSpellCheckWord(CXFA_FFWidget* hWidget, |
| 167 CFX_PointF pointf, |
| 168 const CFX_ByteStringC& bsReplace); |
| 169 }; |
| 170 |
| 171 #endif // XFA_INCLUDE_FXFA_XFA_FFWIDGETHANDLER_H_ |
OLD | NEW |