Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Side by Side Diff: xfa/fee/ifde_txtedtengine.h

Issue 1927973003: Remove IFDE_TxtEdt interfaces where possible. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_FEE_IFDE_TXTEDTENGINE_H_ 7 #ifndef XFA_FEE_IFDE_TXTEDTENGINE_H_
8 #define XFA_FEE_IFDE_TXTEDTENGINE_H_ 8 #define XFA_FEE_IFDE_TXTEDTENGINE_H_
9 9
10 #include "core/fxge/include/fx_dib.h" 10 #include "core/fxge/include/fx_dib.h"
11 #include "xfa/fgas/font/fgas_font.h" 11 #include "xfa/fgas/font/fgas_font.h"
12 12
13 class CFDE_TxtEdtEngine;
14 class CFWL_EditImp;
13 class IFDE_TxtEdtPage; 15 class IFDE_TxtEdtPage;
14 class IFDE_TxtEdtEngine;
15 class IFDE_TxtEdtEventSink;
16 class IFDE_TxtEdtParag;
17 16
18 typedef struct FDE_HTXTEDTFIND_ { void* pData; } * FDE_HTXTEDTFIND; 17 typedef struct FDE_HTXTEDTFIND_ { void* pData; } * FDE_HTXTEDTFIND;
19 18
20 #define FDE_TEXTEDITMODE_MultiLines (1L << 0) 19 #define FDE_TEXTEDITMODE_MultiLines (1L << 0)
21 #define FDE_TEXTEDITMODE_AutoLineWrap (1L << 1) 20 #define FDE_TEXTEDITMODE_AutoLineWrap (1L << 1)
22 #define FDE_TEXTEDITMODE_ReadOnly (1L << 2) 21 #define FDE_TEXTEDITMODE_ReadOnly (1L << 2)
23 #define FDE_TEXTEDITMODE_LimitArea_Vert (1L << 3) 22 #define FDE_TEXTEDITMODE_LimitArea_Vert (1L << 3)
24 #define FDE_TEXTEDITMODE_LimitArea_Horz (1L << 4) 23 #define FDE_TEXTEDITMODE_LimitArea_Horz (1L << 4)
25 #define FDE_TEXTEDITMODE_NoRedoUndo (1L << 5) 24 #define FDE_TEXTEDITMODE_NoRedoUndo (1L << 5)
26 #define FDE_TEXTEDITMODE_FIELD_TAB (1L << 6) 25 #define FDE_TEXTEDITMODE_FIELD_TAB (1L << 6)
(...skipping 28 matching lines...) Expand all
55 MC_WordForward, 54 MC_WordForward,
56 MC_LineStart, 55 MC_LineStart,
57 MC_LineEnd, 56 MC_LineEnd,
58 MC_ParagStart, 57 MC_ParagStart,
59 MC_ParagEnd, 58 MC_ParagEnd,
60 MC_PageUp, 59 MC_PageUp,
61 MC_PageDown, 60 MC_PageDown,
62 MC_Home, 61 MC_Home,
63 MC_End, 62 MC_End,
64 }; 63 };
64
65 enum FDE_TXTEDT_MODIFY_RET { 65 enum FDE_TXTEDT_MODIFY_RET {
66 FDE_TXTEDT_MODIFY_RET_F_Tab = -6, 66 FDE_TXTEDT_MODIFY_RET_F_Tab = -6,
67 FDE_TXTEDT_MODIFY_RET_F_Locked = -5, 67 FDE_TXTEDT_MODIFY_RET_F_Locked = -5,
68 FDE_TXTEDT_MODIFY_RET_F_Invalidate = -4, 68 FDE_TXTEDT_MODIFY_RET_F_Invalidate = -4,
69 FDE_TXTEDT_MODIFY_RET_F_Boundary = -3, 69 FDE_TXTEDT_MODIFY_RET_F_Boundary = -3,
70 FDE_TXTEDT_MODIFY_RET_F_Full = -2, 70 FDE_TXTEDT_MODIFY_RET_F_Full = -2,
71 FDE_TXTEDT_MODIFY_RET_F_Normal = -1, 71 FDE_TXTEDT_MODIFY_RET_F_Normal = -1,
72 FDE_TXTEDT_MODIFY_RET_S_Normal = 0, 72 FDE_TXTEDT_MODIFY_RET_S_Normal = 0,
73 FDE_TXTEDT_MODIFY_RET_S_Full = 1, 73 FDE_TXTEDT_MODIFY_RET_S_Full = 1,
74 FDE_TXTEDT_MODIFY_RET_S_Part = 2, 74 FDE_TXTEDT_MODIFY_RET_S_Part = 2,
75 FDE_TXTEDT_MODIFY_RET_S_Empty = 3, 75 FDE_TXTEDT_MODIFY_RET_S_Empty = 3,
76 FDE_TXTEDT_MODIFY_RET_T_Tab = 4, 76 FDE_TXTEDT_MODIFY_RET_T_Tab = 4,
77 }; 77 };
78
78 enum FDE_TXTEDIT_LINEEND { 79 enum FDE_TXTEDIT_LINEEND {
79 FDE_TXTEDIT_LINEEND_Auto, 80 FDE_TXTEDIT_LINEEND_Auto,
80 FDE_TXTEDIT_LINEEND_CRLF, 81 FDE_TXTEDIT_LINEEND_CRLF,
81 FDE_TXTEDIT_LINEEND_CR, 82 FDE_TXTEDIT_LINEEND_CR,
82 FDE_TXTEDIT_LINEEND_LF, 83 FDE_TXTEDIT_LINEEND_LF,
83 }; 84 };
84 struct _FDE_TXTEDTPARAMS { 85
85 _FDE_TXTEDTPARAMS() 86 struct FDE_TXTEDTPARAMS {
87 FDE_TXTEDTPARAMS()
86 : fPlateWidth(0), 88 : fPlateWidth(0),
87 fPlateHeight(0), 89 fPlateHeight(0),
88 nLineCount(0), 90 nLineCount(0),
89 dwLayoutStyles(0), 91 dwLayoutStyles(0),
90 dwAlignment(0), 92 dwAlignment(0),
91 dwMode(0), 93 dwMode(0),
92 pFont(NULL), 94 pFont(NULL),
Tom Sepez 2016/04/28 16:51:09 nit: nullptr (also below)
dsinclair 2016/04/28 17:35:56 Done.
93 fFontSize(10.0f), 95 fFontSize(10.0f),
94 dwFontColor(0xff000000), 96 dwFontColor(0xff000000),
95 fLineSpace(10.0f), 97 fLineSpace(10.0f),
96 fTabWidth(36), 98 fTabWidth(36),
97 bTabEquidistant(FALSE), 99 bTabEquidistant(FALSE),
98 wDefChar(0xFEFF), 100 wDefChar(0xFEFF),
99 wLineBreakChar('\n'), 101 wLineBreakChar('\n'),
100 nCharRotation(0), 102 nCharRotation(0),
101 nLineEnd(0), 103 nLineEnd(0),
102 nHorzScale(100), 104 nHorzScale(100),
103 fCharSpace(0), 105 fCharSpace(0),
104 pEventSink(NULL) {} 106 pEventSink(NULL) {}
107
105 FX_FLOAT fPlateWidth; 108 FX_FLOAT fPlateWidth;
106 FX_FLOAT fPlateHeight; 109 FX_FLOAT fPlateHeight;
107 int32_t nLineCount; 110 int32_t nLineCount;
108 uint32_t dwLayoutStyles; 111 uint32_t dwLayoutStyles;
109 uint32_t dwAlignment; 112 uint32_t dwAlignment;
110 uint32_t dwMode; 113 uint32_t dwMode;
111 IFX_Font* pFont; 114 IFX_Font* pFont;
112 FX_FLOAT fFontSize; 115 FX_FLOAT fFontSize;
113 FX_ARGB dwFontColor; 116 FX_ARGB dwFontColor;
114 FX_FLOAT fLineSpace; 117 FX_FLOAT fLineSpace;
115 FX_FLOAT fTabWidth; 118 FX_FLOAT fTabWidth;
116 FX_BOOL bTabEquidistant; 119 FX_BOOL bTabEquidistant;
117 FX_WCHAR wDefChar; 120 FX_WCHAR wDefChar;
118 FX_WCHAR wLineBreakChar; 121 FX_WCHAR wLineBreakChar;
119 int32_t nCharRotation; 122 int32_t nCharRotation;
120 int32_t nLineEnd; 123 int32_t nLineEnd;
121 int32_t nHorzScale; 124 int32_t nHorzScale;
122 FX_FLOAT fCharSpace; 125 FX_FLOAT fCharSpace;
123 IFDE_TxtEdtEventSink* pEventSink; 126 CFWL_EditImp* pEventSink;
124 }; 127 };
125 typedef _FDE_TXTEDTPARAMS FDE_TXTEDTPARAMS; 128
126 typedef _FDE_TXTEDTPARAMS* FDE_LPTXTEDTPARAMS;
127 enum FDE_TXTEDT_TEXTCHANGE_TYPE { 129 enum FDE_TXTEDT_TEXTCHANGE_TYPE {
128 FDE_TXTEDT_TEXTCHANGE_TYPE_Insert = 0, 130 FDE_TXTEDT_TEXTCHANGE_TYPE_Insert = 0,
129 FDE_TXTEDT_TEXTCHANGE_TYPE_Delete, 131 FDE_TXTEDT_TEXTCHANGE_TYPE_Delete,
130 FDE_TXTEDT_TEXTCHANGE_TYPE_Replace, 132 FDE_TXTEDT_TEXTCHANGE_TYPE_Replace,
131 }; 133 };
132 struct _FDE_TXTEDT_TEXTCHANGE_INFO { 134
135 struct FDE_TXTEDT_TEXTCHANGE_INFO {
133 int32_t nChangeType; 136 int32_t nChangeType;
134 CFX_WideString wsInsert; 137 CFX_WideString wsInsert;
135 CFX_WideString wsDelete; 138 CFX_WideString wsDelete;
136 CFX_WideString wsPrevText; 139 CFX_WideString wsPrevText;
137 }; 140 };
138 typedef _FDE_TXTEDT_TEXTCHANGE_INFO FDE_TXTEDT_TEXTCHANGE_INFO; 141
139 typedef _FDE_TXTEDT_TEXTCHANGE_INFO* FDE_LPTXTEDT_TEXTCHANGE_INFO;
140 class IFDE_TxtEdtEventSink {
141 public:
142 virtual ~IFDE_TxtEdtEventSink() {}
143 virtual void On_CaretChanged(IFDE_TxtEdtEngine* pEdit,
144 int32_t nPage,
145 FX_BOOL bVisible = TRUE) = 0;
146 virtual void On_TextChanged(IFDE_TxtEdtEngine* pEdit,
147 FDE_TXTEDT_TEXTCHANGE_INFO& ChangeInfo) = 0;
148 virtual void On_PageCountChanged(IFDE_TxtEdtEngine* pEdit) = 0;
149 virtual void On_SelChanged(IFDE_TxtEdtEngine* pEdit) = 0;
150 virtual FX_BOOL On_PageLoad(IFDE_TxtEdtEngine* pEdit,
151 int32_t nPageIndex,
152 int32_t nPurpose) = 0;
153 virtual FX_BOOL On_PageUnload(IFDE_TxtEdtEngine* pEdit,
154 int32_t nPageIndex,
155 int32_t nPurpose) = 0;
156 virtual FX_BOOL On_PageChange(IFDE_TxtEdtEngine* pEdit,
157 int32_t nPageIndex) = 0;
158 virtual void On_AddDoRecord(IFDE_TxtEdtEngine* pEdit,
159 const CFX_ByteStringC& bsDoRecord) = 0;
160 virtual FX_BOOL On_ValidateField(IFDE_TxtEdtEngine* pEdit,
161 int32_t nBlockIndex,
162 int32_t nFieldIndex,
163 const CFX_WideString& wsFieldText,
164 int32_t nCharIndex) = 0;
165 virtual FX_BOOL On_ValidateBlock(IFDE_TxtEdtEngine* pEdit,
166 int32_t nBlockIndex) = 0;
167 virtual FX_BOOL On_GetBlockFormatText(IFDE_TxtEdtEngine* pEdit,
168 int32_t nBlockIndex,
169 CFX_WideString& wsBlockText) = 0;
170 virtual FX_BOOL On_Validate(IFDE_TxtEdtEngine* pEdit,
171 CFX_WideString& wsText) = 0;
172 };
173 class IFX_CharIter { 142 class IFX_CharIter {
174 public: 143 public:
175 virtual ~IFX_CharIter() {} 144 virtual ~IFX_CharIter() {}
176 virtual void Release() = 0; 145 virtual void Release() = 0;
177 virtual FX_BOOL Next(FX_BOOL bPrev = FALSE) = 0; 146 virtual FX_BOOL Next(FX_BOOL bPrev = FALSE) = 0;
178 virtual FX_WCHAR GetChar() = 0; 147 virtual FX_WCHAR GetChar() = 0;
179 virtual void SetAt(int32_t nIndex) = 0; 148 virtual void SetAt(int32_t nIndex) = 0;
180 virtual int32_t GetAt() const = 0; 149 virtual int32_t GetAt() const = 0;
181 virtual FX_BOOL IsEOF(FX_BOOL bTail = TRUE) const = 0; 150 virtual FX_BOOL IsEOF(FX_BOOL bTail = TRUE) const = 0;
182 virtual IFX_CharIter* Clone() = 0; 151 virtual IFX_CharIter* Clone() = 0;
183 }; 152 };
184 class IFDE_TxtEdtEngine {
185 public:
186 static IFDE_TxtEdtEngine* Create();
187
188 virtual ~IFDE_TxtEdtEngine() {}
189 virtual void Release() = 0;
190 virtual void SetEditParams(const FDE_TXTEDTPARAMS& params) = 0;
191 virtual const FDE_TXTEDTPARAMS* GetEditParams() const = 0;
192
193 virtual int32_t CountPages() const = 0;
194 virtual IFDE_TxtEdtPage* GetPage(int32_t nIndex) = 0;
195 virtual FX_BOOL SetBufChunkSize(int32_t nChunkSize) = 0;
196 virtual void SetTextByStream(IFX_Stream* pStream) = 0;
197 virtual void SetText(const CFX_WideString& wsText) = 0;
198 virtual int32_t GetTextLength() const = 0;
199 virtual void GetText(CFX_WideString& wsText,
200 int32_t nStart,
201 int32_t nCount = -1) = 0;
202 virtual void ClearText() = 0;
203
204 virtual int32_t GetCaretRect(CFX_RectF& rtCaret) const = 0;
205 virtual int32_t GetCaretPos() const = 0;
206 virtual int32_t SetCaretPos(int32_t nIndex, FX_BOOL bBefore = TRUE) = 0;
207 virtual int32_t MoveCaretPos(FDE_TXTEDTMOVECARET eMoveCaret,
208 FX_BOOL bShift = FALSE,
209 FX_BOOL bCtrl = FALSE) = 0;
210
211 virtual void Lock() = 0;
212 virtual void Unlock() = 0;
213 virtual FX_BOOL IsLocked() const = 0;
214
215 virtual int32_t Insert(int32_t nStart,
216 const FX_WCHAR* lpText,
217 int32_t nLength) = 0;
218 virtual int32_t Delete(int32_t nStart, FX_BOOL bBackspace = FALSE) = 0;
219 virtual int32_t DeleteRange(int32_t nStart, int32_t nCount = -1) = 0;
220 virtual int32_t Replace(int32_t nStart,
221 int32_t nLength,
222 const CFX_WideString& wsReplace) = 0;
223 virtual void SetLimit(int32_t nLimit) = 0;
224 virtual void SetAliasChar(FX_WCHAR wAlias) = 0;
225 virtual void AddSelRange(int32_t nStart, int32_t nCount = -1) = 0;
226 virtual int32_t CountSelRanges() = 0;
227 virtual int32_t GetSelRange(int32_t nIndex, int32_t& nStart) = 0;
228 virtual void ClearSelection() = 0;
229
230 virtual FX_BOOL Redo(const CFX_ByteStringC& bsRedo) = 0;
231 virtual FX_BOOL Undo(const CFX_ByteStringC& bsUndo) = 0;
232
233 virtual int32_t StartLayout() = 0;
234 virtual int32_t DoLayout(IFX_Pause* pPause) = 0;
235 virtual void EndLayout() = 0;
236
237 virtual FX_BOOL Optimize(IFX_Pause* pPause = NULL) = 0;
238 virtual int32_t CountParags() const = 0;
239 virtual IFDE_TxtEdtParag* GetParag(int32_t nParagIndex) const = 0;
240 virtual IFX_CharIter* CreateCharIter() = 0;
241 };
242 class IFDE_TxtEdtParag {
243 public:
244 virtual ~IFDE_TxtEdtParag() {}
245 virtual int32_t GetTextLength() const = 0;
246 virtual int32_t GetStartIndex() const = 0;
247 virtual int32_t CountLines() const = 0;
248 virtual void GetLineRange(int32_t nLineIndex,
249 int32_t& nStart,
250 int32_t& nCount) const = 0;
251 };
252 153
253 #endif // XFA_FEE_IFDE_TXTEDTENGINE_H_ 154 #endif // XFA_FEE_IFDE_TXTEDTENGINE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698