| 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_FWL_BASEWIDGET_FWL_EDIT_H_ | |
| 8 #define XFA_INCLUDE_FWL_BASEWIDGET_FWL_EDIT_H_ | |
| 9 | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "xfa/include/fwl/lightwidget/widget.h" | |
| 13 | |
| 14 class CFWL_WidgetImpProperties; | |
| 15 class IFWL_Edit; | |
| 16 | |
| 17 #define FWL_CLASS_Edit L"FWL_EDIT" | |
| 18 #define FWL_CLASSHASH_Edit 2893987822 | |
| 19 #define FWL_STYLEEXT_EDT_ReadOnly (1L << 0) | |
| 20 #define FWL_STYLEEXT_EDT_MultiLine (1L << 1) | |
| 21 #define FWL_STYLEEXT_EDT_WantReturn (1L << 2) | |
| 22 #define FWL_STYLEEXT_EDT_NoHideSel (1L << 3) | |
| 23 #define FWL_STYLEEXT_EDT_AutoHScroll (1L << 4) | |
| 24 #define FWL_STYLEEXT_EDT_AutoVScroll (1L << 5) | |
| 25 #define FWL_STYLEEXT_EDT_NoRedoUndo (1L << 6) | |
| 26 #define FWL_STYLEEXT_EDT_Validate (1L << 7) | |
| 27 #define FWL_STYLEEXT_EDT_Password (1L << 8) | |
| 28 #define FWL_STYLEEXT_EDT_Number (1L << 9) | |
| 29 #define FWL_STYLEEXT_EDT_HSelfAdaption (1L << 10) | |
| 30 #define FWL_STYLEEXT_EDT_VSelfAdaption (1L << 11) | |
| 31 #define FWL_STYLEEXT_EDT_VerticalLayout (1L << 12) | |
| 32 #define FWL_STYLEEXT_EDT_VerticalChars (1L << 13) | |
| 33 #define FWL_STYLEEXT_EDT_ReverseLine (1L << 14) | |
| 34 #define FWL_STYLEEXT_EDT_ArabicShapes (1L << 15) | |
| 35 #define FWL_STYLEEXT_EDT_ExpandTab (1L << 16) | |
| 36 #define FWL_STYLEEXT_EDT_CombText (1L << 17) | |
| 37 #define FWL_STYLEEXT_EDT_HNear (0L << 18) | |
| 38 #define FWL_STYLEEXT_EDT_HCenter (1L << 18) | |
| 39 #define FWL_STYLEEXT_EDT_HFar (2L << 18) | |
| 40 #define FWL_STYLEEXT_EDT_VNear (0L << 20) | |
| 41 #define FWL_STYLEEXT_EDT_VCenter (1L << 20) | |
| 42 #define FWL_STYLEEXT_EDT_VFar (2L << 20) | |
| 43 #define FWL_STYLEEXT_EDT_Justified (1L << 22) | |
| 44 #define FWL_STYLEEXT_EDT_Distributed (2L << 22) | |
| 45 #define FWL_STYLEEXT_EDT_HAlignMask (3L << 18) | |
| 46 #define FWL_STYLEEXT_EDT_VAlignMask (3L << 20) | |
| 47 #define FWL_STYLEEXT_EDT_HAlignModeMask (3L << 22) | |
| 48 #define FWL_STYLEEXT_EDT_InnerCaret (1L << 24) | |
| 49 #define FWL_STYLEEXT_EDT_ShowScrollbarFocus (1L << 25) | |
| 50 #define FWL_STYLEEXT_EDT_OuterScrollbar (1L << 26) | |
| 51 #define FWL_STYLEEXT_EDT_LastLineHeight (1L << 27) | |
| 52 #define FWL_STATE_EDT_Editing (1 << FWL_WGTSTATE_MAX) | |
| 53 #define FWL_PART_EDT_Border 1 | |
| 54 #define FWL_PART_EDT_Edge 2 | |
| 55 #define FWL_PART_EDT_Background 3 | |
| 56 #define FWL_PART_EDT_CombTextLine 4 | |
| 57 #define FWL_PARTDATA_EDT_Background 0 | |
| 58 #define FWL_PARTDATA_EDT_StaticBackground 1 | |
| 59 #define FWL_PARTSTATE_EDT_Normal (0L << 0) | |
| 60 #define FWL_PARTSTATE_EDT_ReadOnly (1L << 0) | |
| 61 #define FWL_PARTSTATE_EDT_Disable (2L << 0) | |
| 62 enum FWL_EDT_TEXTCHANGED { | |
| 63 FWL_EDT_TEXTCHANGED_Insert = 0, | |
| 64 FWL_EDT_TEXTCHANGED_Delete, | |
| 65 FWL_EDT_TEXTCHANGED_Replace, | |
| 66 }; | |
| 67 | |
| 68 #define FWL_EVT_EDT_TextChanged L"FWL_EVENT_EDT_TextChanged" | |
| 69 #define FWL_EVTHASH_EDT_TextChanged 1064022132 | |
| 70 #define FWL_EVT_EDT_PreSelfAdaption L"FWL_EVENT_PreSelfAdaption" | |
| 71 #define FWL_EVTHASH_EDT_PreSelfAdaption 1001979178 | |
| 72 #define FWL_EVT_EDT_Validate L"FWL_EVTHASH_EDT_Validate" | |
| 73 #define FWL_EVTHASH_EDT_Validate 3373308608 | |
| 74 #define FWL_EVT_EDT_CheckWord L"FWL_EVTHASH_EDT_CheckWord" | |
| 75 #define FWL_EVTHASH_EDT_CheckWord 2897181520 | |
| 76 #define FWL_EVT_EDT_GetSuggestWords L"FWL_EVTHASH_EDT_GetSuggestWords" | |
| 77 #define FWL_EVTHASH_EDT_GetSuggestWords 315782791 | |
| 78 #define FWL_EVT_EDT_TextFull L"FWL_EVTHASH_EDT_TextFull" | |
| 79 #define FWL_EVTHASH_EDT_TextFull 2158580174 | |
| 80 | |
| 81 BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtTextChanged, FWL_EVTHASH_EDT_TextChanged) | |
| 82 int32_t nChangeType; | |
| 83 CFX_WideString wsInsert; | |
| 84 CFX_WideString wsDelete; | |
| 85 CFX_WideString wsPrevText; | |
| 86 END_FWL_EVENT_DEF | |
| 87 BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtTextFull, FWL_EVTHASH_EDT_TextFull) | |
| 88 END_FWL_EVENT_DEF | |
| 89 BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtPreSelfAdaption, FWL_EVTHASH_EDT_PreSelfAdaption) | |
| 90 FX_BOOL bHSelfAdaption; | |
| 91 FX_BOOL bVSelfAdaption; | |
| 92 CFX_RectF rtAfterChange; | |
| 93 END_FWL_EVENT_DEF | |
| 94 BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtValidate, FWL_EVTHASH_EDT_Validate) | |
| 95 IFWL_Widget* pDstWidget; | |
| 96 CFX_WideString wsInsert; | |
| 97 FX_BOOL bValidate; | |
| 98 END_FWL_EVENT_DEF | |
| 99 BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtCheckWord, FWL_EVTHASH_EDT_CheckWord) | |
| 100 CFX_ByteString bsWord; | |
| 101 FX_BOOL bCheckWord; | |
| 102 END_FWL_EVENT_DEF | |
| 103 BEGIN_FWL_EVENT_DEF(CFWL_EvtEdtGetSuggestWords, FWL_EVTHASH_EDT_GetSuggestWords) | |
| 104 FX_BOOL bSuggestWords; | |
| 105 CFX_ByteString bsWord; | |
| 106 std::vector<CFX_ByteString> bsArraySuggestWords; | |
| 107 END_FWL_EVENT_DEF | |
| 108 class IFWL_EditDP : public IFWL_DataProvider {}; | |
| 109 #define FWL_EDT_FIND_FLAGS_Prev (0L << 0) | |
| 110 #define FWL_EDT_FIND_FLAGS_Next (1L << 0) | |
| 111 #define FWL_EDT_FIND_FLAGS_WholeWord (1L << 1) | |
| 112 #define FWL_EDT_FIND_FLAGS_NoCase (1L << 2) | |
| 113 typedef struct FWL_HEDTFIND_ { void* pData; } * FWL_HEDTFIND; | |
| 114 | |
| 115 class IFWL_Edit : public IFWL_Widget { | |
| 116 public: | |
| 117 static IFWL_Edit* Create(const CFWL_WidgetImpProperties& properties, | |
| 118 IFWL_Widget* pOuter); | |
| 119 static IFWL_Edit* CreateComboEdit(const CFWL_WidgetImpProperties& properties, | |
| 120 IFWL_Widget* pOuter); | |
| 121 | |
| 122 FWL_ERR SetText(const CFX_WideString& wsText); | |
| 123 int32_t GetTextLength() const; | |
| 124 FWL_ERR GetText(CFX_WideString& wsText, | |
| 125 int32_t nStart = 0, | |
| 126 int32_t nCount = -1) const; | |
| 127 FWL_ERR ClearText(); | |
| 128 int32_t GetCaretPos() const; | |
| 129 int32_t SetCaretPos(int32_t nIndex, FX_BOOL bBefore = TRUE); | |
| 130 FWL_ERR AddSelRange(int32_t nStart, int32_t nCount = -1); | |
| 131 int32_t CountSelRanges(); | |
| 132 int32_t GetSelRange(int32_t nIndex, int32_t& nStart); | |
| 133 FWL_ERR ClearSelections(); | |
| 134 int32_t GetLimit(); | |
| 135 FWL_ERR SetLimit(int32_t nLimit); | |
| 136 FWL_ERR SetAliasChar(FX_WCHAR wAlias); | |
| 137 FWL_ERR SetFormatString(const CFX_WideString& wsFormat); | |
| 138 FWL_ERR Insert(int32_t nStart, const FX_WCHAR* lpText, int32_t nLen); | |
| 139 FWL_ERR DeleteSelections(); | |
| 140 FWL_ERR DeleteRange(int32_t nStart, int32_t nCount = -1); | |
| 141 FWL_ERR ReplaceSelections(const CFX_WideStringC& wsReplace); | |
| 142 FWL_ERR Replace(int32_t nStart, | |
| 143 int32_t nLen, | |
| 144 const CFX_WideStringC& wsReplace); | |
| 145 FWL_ERR DoClipboard(int32_t iCmd); | |
| 146 FX_BOOL Copy(CFX_WideString& wsCopy); | |
| 147 FX_BOOL Cut(CFX_WideString& wsCut); | |
| 148 FX_BOOL Paste(const CFX_WideString& wsPaste); | |
| 149 FX_BOOL Delete(); | |
| 150 FX_BOOL Redo(const CFX_ByteStringC& bsRecord); | |
| 151 FX_BOOL Undo(const CFX_ByteStringC& bsRecord); | |
| 152 FX_BOOL Undo(); | |
| 153 FX_BOOL Redo(); | |
| 154 FX_BOOL CanUndo(); | |
| 155 FX_BOOL CanRedo(); | |
| 156 FWL_ERR SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant); | |
| 157 FWL_ERR SetOuter(IFWL_Widget* pOuter); | |
| 158 FWL_ERR SetNumberRange(int32_t iMin, int32_t iMax); | |
| 159 FWL_ERR SetBackColor(FX_DWORD dwColor); | |
| 160 FWL_ERR SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize); | |
| 161 void SetScrollOffset(FX_FLOAT fScrollOffset); | |
| 162 FX_BOOL GetSuggestWords(CFX_PointF pointf, | |
| 163 std::vector<CFX_ByteString>& sSuggest); | |
| 164 FX_BOOL ReplaceSpellCheckWord(CFX_PointF pointf, | |
| 165 const CFX_ByteStringC& bsReplace); | |
| 166 | |
| 167 protected: | |
| 168 IFWL_Edit(); | |
| 169 }; | |
| 170 | |
| 171 #endif // XFA_INCLUDE_FWL_BASEWIDGET_FWL_EDIT_H_ | |
| OLD | NEW |