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

Side by Side Diff: fpdfsdk/include/fxedit/fxet_edit.h

Issue 1265503005: clang-format all pdfium code. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: sigh Created 5 years, 4 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 FPDFSDK_INCLUDE_FXEDIT_FXET_EDIT_H_ 7 #ifndef FPDFSDK_INCLUDE_FXEDIT_FXET_EDIT_H_
8 #define FPDFSDK_INCLUDE_FXEDIT_FXET_EDIT_H_ 8 #define FPDFSDK_INCLUDE_FXEDIT_FXET_EDIT_H_
9 9
10 #include "../../../core/include/fpdfdoc/fpdf_vt.h" 10 #include "../../../core/include/fpdfdoc/fpdf_vt.h"
11 #include "fx_edit.h" 11 #include "fx_edit.h"
12 12
13 class CFX_Edit_Page; 13 class CFX_Edit_Page;
14 struct CFX_Edit_LineRect; 14 struct CFX_Edit_LineRect;
15 class CFX_Edit_LineRectArray; 15 class CFX_Edit_LineRectArray;
16 class CFX_Edit_RectArray; 16 class CFX_Edit_RectArray;
17 class CFX_Edit_Refresh; 17 class CFX_Edit_Refresh;
18 class CFX_Edit_Select; 18 class CFX_Edit_Select;
19 class CFX_Edit; 19 class CFX_Edit;
20 class CFX_Edit_Iterator; 20 class CFX_Edit_Iterator;
21 class CFX_Edit_Refresh; 21 class CFX_Edit_Refresh;
22 class CFX_Edit_UndoItem; 22 class CFX_Edit_UndoItem;
23 class CFX_Edit_Undo; 23 class CFX_Edit_Undo;
24 class CFX_Edit_Provider; 24 class CFX_Edit_Provider;
25 25
26 #define FX_EDIT_IsFloatZero(f)» » » » » » (f < 0.0 001 && f > -0.0001) 26 #define FX_EDIT_IsFloatZero(f) (f < 0.0001 && f > -0.0001)
27 #define FX_EDIT_IsFloatEqual(fa,fb)» » » » » FX_EDIT_ IsFloatZero(fa - fb) 27 #define FX_EDIT_IsFloatEqual(fa, fb) FX_EDIT_IsFloatZero(fa - fb)
28 #define FX_EDIT_IsFloatBigger(fa,fb)» » » » (fa > fb && !FX_ EDIT_IsFloatEqual(fa,fb)) 28 #define FX_EDIT_IsFloatBigger(fa, fb) (fa > fb && !FX_EDIT_IsFloatEqual(fa, fb))
29 #define FX_EDIT_IsFloatSmaller(fa,fb)» » » » (fa < fb && !FX_ EDIT_IsFloatEqual(fa,fb)) 29 #define FX_EDIT_IsFloatSmaller(fa, fb) \
30 30 (fa < fb && !FX_EDIT_IsFloatEqual(fa, fb))
31 template<class T> T FX_EDIT_MIN (const T & i, const T & j) { return ((i < j) ? i : j); } 31
32 template<class T> T FX_EDIT_MAX (const T & i, const T & j) { return ((i > j) ? i : j); } 32 template <class T>
33 33 T FX_EDIT_MIN(const T& i, const T& j) {
34 #define»FX_EDIT_PI» » » » » » » » » 3.14159265358979f 34 return ((i < j) ? i : j);
35 #define FX_EDIT_ITALIC_ANGEL» » » » » » 10 * FX_ EDIT_PI / 180.0f 35 }
36 36 template <class T>
37 T FX_EDIT_MAX(const T& i, const T& j) {
38 return ((i > j) ? i : j);
39 }
40
41 #define FX_EDIT_PI 3.14159265358979f
42 #define FX_EDIT_ITALIC_ANGEL 10 * FX_EDIT_PI / 180.0f
37 43
38 /* ------------------------- CFX_Edit_Refresh ---------------------------- */ 44 /* ------------------------- CFX_Edit_Refresh ---------------------------- */
39 45
40 enum REFRESH_PLAN_E 46 enum REFRESH_PLAN_E { RP_ANALYSE, RP_NOANALYSE, RP_OPTIONAL };
41 { 47
42 » RP_ANALYSE, 48 enum EDIT_PROPS_E {
43 » RP_NOANALYSE, 49 EP_LINELEADING,
44 » RP_OPTIONAL 50 EP_LINEINDENT,
45 }; 51 EP_ALIGNMENT,
46 52 EP_FONTINDEX,
47 enum EDIT_PROPS_E 53 EP_FONTSIZE,
48 { 54 EP_WORDCOLOR,
49 » EP_LINELEADING, 55 EP_SCRIPTTYPE,
50 » EP_LINEINDENT, 56 EP_UNDERLINE,
51 » EP_ALIGNMENT, 57 EP_CROSSOUT,
52 » EP_FONTINDEX, 58 EP_CHARSPACE,
53 » EP_FONTSIZE, 59 EP_HORZSCALE,
54 » EP_WORDCOLOR, 60 EP_BOLD,
55 » EP_SCRIPTTYPE, 61 EP_ITALIC
56 » EP_UNDERLINE, 62 };
57 » EP_CROSSOUT, 63
58 » EP_CHARSPACE, 64 struct CFX_Edit_LineRect {
59 » EP_HORZSCALE, 65 CFX_Edit_LineRect(const CPVT_WordRange& wrLine, const CPDF_Rect& rcLine)
60 » EP_BOLD, 66 : m_wrLine(wrLine), m_rcLine(rcLine) {}
61 » EP_ITALIC 67
62 }; 68 FX_BOOL operator!=(const CFX_Edit_LineRect& linerect) const {
63 69 return FXSYS_memcmp(this, &linerect, sizeof(CFX_Edit_LineRect)) != 0;
64 struct CFX_Edit_LineRect 70 }
65 { 71
66 » CFX_Edit_LineRect(const CPVT_WordRange & wrLine,const CPDF_Rect & rcLine ) : 72 FX_BOOL IsSameHeight(const CFX_Edit_LineRect& linerect) const {
67 » » m_wrLine(wrLine), m_rcLine(rcLine) 73 return FX_EDIT_IsFloatZero(
68 » { 74 (m_rcLine.top - m_rcLine.bottom) -
69 » } 75 (linerect.m_rcLine.top - linerect.m_rcLine.bottom));
70 76 }
71 » FX_BOOL operator != (const CFX_Edit_LineRect & linerect) const 77
72 » { 78 FX_BOOL IsSameTop(const CFX_Edit_LineRect& linerect) const {
73 » » return FXSYS_memcmp(this, &linerect, sizeof(CFX_Edit_LineRect)) != 0; 79 return FX_EDIT_IsFloatZero(m_rcLine.top - linerect.m_rcLine.top);
74 » } 80 }
75 81
76 » FX_BOOL IsSameHeight(const CFX_Edit_LineRect & linerect) const 82 FX_BOOL IsSameLeft(const CFX_Edit_LineRect& linerect) const {
77 » { 83 return FX_EDIT_IsFloatZero(m_rcLine.left - linerect.m_rcLine.left);
78 » » return FX_EDIT_IsFloatZero((m_rcLine.top - m_rcLine.bottom) - (l inerect.m_rcLine.top -linerect.m_rcLine.bottom)); 84 }
79 » } 85
80 86 FX_BOOL IsSameRight(const CFX_Edit_LineRect& linerect) const {
81 » FX_BOOL IsSameTop(const CFX_Edit_LineRect & linerect) const 87 return FX_EDIT_IsFloatZero(m_rcLine.right - linerect.m_rcLine.right);
82 » { 88 }
83 » » return FX_EDIT_IsFloatZero(m_rcLine.top - linerect.m_rcLine.top) ; 89
84 » } 90 CPVT_WordRange m_wrLine;
85 91 CPDF_Rect m_rcLine;
86 » FX_BOOL IsSameLeft(const CFX_Edit_LineRect & linerect) const 92 };
87 » { 93
88 » » return FX_EDIT_IsFloatZero(m_rcLine.left - linerect.m_rcLine.lef t); 94 class CFX_Edit_LineRectArray {
89 » } 95 public:
90 96 CFX_Edit_LineRectArray() {}
91 » FX_BOOL IsSameRight(const CFX_Edit_LineRect & linerect) const 97
92 » { 98 virtual ~CFX_Edit_LineRectArray() { Empty(); }
93 » » return FX_EDIT_IsFloatZero(m_rcLine.right - linerect.m_rcLine.ri ght); 99
94 » } 100 void Empty() {
95 101 for (int32_t i = 0, sz = m_LineRects.GetSize(); i < sz; i++)
96 » CPVT_WordRange» » » » » » » m_wrLine ; 102 delete m_LineRects.GetAt(i);
97 » CPDF_Rect» » » » » » » » m_rcLine; 103
98 }; 104 m_LineRects.RemoveAll();
99 105 }
100 class CFX_Edit_LineRectArray 106
101 { 107 void RemoveAll() { m_LineRects.RemoveAll(); }
102 public: 108
103 » CFX_Edit_LineRectArray() 109 void operator=(CFX_Edit_LineRectArray& rects) {
104 » { 110 Empty();
105 » } 111 for (int32_t i = 0, sz = rects.GetSize(); i < sz; i++)
106 112 m_LineRects.Add(rects.GetAt(i));
107 » virtual ~CFX_Edit_LineRectArray() 113
108 » { 114 rects.RemoveAll();
109 » » Empty(); 115 }
110 » } 116
111 117 void Add(const CPVT_WordRange& wrLine, const CPDF_Rect& rcLine) {
112 » void Empty() 118 if (CFX_Edit_LineRect* pRect = new CFX_Edit_LineRect(wrLine, rcLine))
113 » { 119 m_LineRects.Add(pRect);
114 » » for (int32_t i = 0, sz = m_LineRects.GetSize(); i < sz; i++) 120 }
115 » » » delete m_LineRects.GetAt(i); 121
116 122 int32_t GetSize() const { return m_LineRects.GetSize(); }
117 » » m_LineRects.RemoveAll(); 123
118 » } 124 CFX_Edit_LineRect* GetAt(int32_t nIndex) const {
119 125 if (nIndex < 0 || nIndex >= m_LineRects.GetSize())
120 » void RemoveAll() 126 return NULL;
121 » { 127
122 » » m_LineRects.RemoveAll(); 128 return m_LineRects.GetAt(nIndex);
123 » } 129 }
124 130
125 » void operator = (CFX_Edit_LineRectArray & rects) 131 CFX_ArrayTemplate<CFX_Edit_LineRect*> m_LineRects;
126 » { 132 };
127 » » Empty(); 133
128 » » for (int32_t i = 0, sz = rects.GetSize(); i < sz; i++) 134 class CFX_Edit_RectArray {
129 » » » m_LineRects.Add(rects.GetAt(i)); 135 public:
130 136 CFX_Edit_RectArray() {}
131 » » rects.RemoveAll(); 137
132 » } 138 virtual ~CFX_Edit_RectArray() { Empty(); }
133 139
134 » void Add(const CPVT_WordRange & wrLine,const CPDF_Rect & rcLine) 140 void Empty() {
135 » { 141 for (int32_t i = 0, sz = m_Rects.GetSize(); i < sz; i++)
136 » » if (CFX_Edit_LineRect * pRect = new CFX_Edit_LineRect(wrLine,rcL ine)) 142 delete m_Rects.GetAt(i);
137 » » » m_LineRects.Add(pRect); 143
138 » } 144 m_Rects.RemoveAll();
139 145 }
140 » int32_t GetSize() const 146
141 » { 147 void Add(const CPDF_Rect& rect) {
142 » » return m_LineRects.GetSize(); 148 // check for overlaped area
143 » } 149 for (int32_t i = 0, sz = m_Rects.GetSize(); i < sz; i++)
144 150 if (CPDF_Rect* pRect = m_Rects.GetAt(i))
145 » CFX_Edit_LineRect * GetAt(int32_t nIndex) const 151 if (pRect->Contains(rect))
146 » { 152 return;
147 » » if (nIndex < 0 || nIndex >= m_LineRects.GetSize()) 153
148 » » » return NULL; 154 if (CPDF_Rect* pNewRect = new CPDF_Rect(rect))
149 155 m_Rects.Add(pNewRect);
150 » » return m_LineRects.GetAt(nIndex); 156 }
151 » } 157
152 158 int32_t GetSize() const { return m_Rects.GetSize(); }
153 » CFX_ArrayTemplate<CFX_Edit_LineRect*>» » m_LineRects; 159
154 }; 160 CPDF_Rect* GetAt(int32_t nIndex) const {
155 161 if (nIndex < 0 || nIndex >= m_Rects.GetSize())
156 class CFX_Edit_RectArray 162 return NULL;
157 { 163
158 public: 164 return m_Rects.GetAt(nIndex);
159 » CFX_Edit_RectArray() 165 }
160 » { 166
161 » } 167 CFX_ArrayTemplate<CPDF_Rect*> m_Rects;
162 168 };
163 » virtual ~CFX_Edit_RectArray() 169
164 » { 170 class CFX_Edit_Refresh {
165 » » Empty(); 171 public:
166 » } 172 CFX_Edit_Refresh();
167 173 virtual ~CFX_Edit_Refresh();
168 » void Empty() 174
169 » { 175 void BeginRefresh();
170 » » for (int32_t i = 0, sz = m_Rects.GetSize(); i < sz; i++) 176 void Push(const CPVT_WordRange& linerange, const CPDF_Rect& rect);
171 » » » delete m_Rects.GetAt(i); 177 void NoAnalyse();
172 178 void Analyse(int32_t nAlignment);
173 » » m_Rects.RemoveAll(); 179 void AddRefresh(const CPDF_Rect& rect);
174 » } 180 const CFX_Edit_RectArray* GetRefreshRects() const;
175 181 void EndRefresh();
176 » void Add(const CPDF_Rect & rect) 182
177 » { 183 private:
178 » » //check for overlaped area 184 CFX_Edit_LineRectArray m_NewLineRects;
179 » » for (int32_t i = 0, sz = m_Rects.GetSize(); i < sz; i++) 185 CFX_Edit_LineRectArray m_OldLineRects;
180 » » » if (CPDF_Rect * pRect = m_Rects.GetAt(i)) 186 CFX_Edit_RectArray m_RefreshRects;
181 » » » » if (pRect->Contains(rect))return; 187 };
182
183 » » if (CPDF_Rect * pNewRect = new CPDF_Rect(rect))
184 » » » m_Rects.Add(pNewRect);
185 » }
186
187 » int32_t GetSize() const
188 » {
189 » » return m_Rects.GetSize();
190 » }
191
192 » CPDF_Rect * GetAt(int32_t nIndex) const
193 » {
194 » » if (nIndex < 0 || nIndex >= m_Rects.GetSize())
195 » » » return NULL;
196
197 » » return m_Rects.GetAt(nIndex);
198 » }
199
200 » CFX_ArrayTemplate<CPDF_Rect*>» » » m_Rects;
201 };
202
203 class CFX_Edit_Refresh
204 {
205 public:
206 » CFX_Edit_Refresh();
207 » virtual ~CFX_Edit_Refresh();
208
209 » void» » » » » » » » » BeginRefresh();
210 » void» » » » » » » » » Push(const CPVT_WordRange & linerange,const CPDF_Rect & rect);
211 » void» » » » » » » » » NoAnalyse();
212 » void» » » » » » » » » Analyse(int32_t nAlignment);
213 » void» » » » » » » » » AddRefresh(const CPDF_Rect & rect);
214 » const CFX_Edit_RectArray *» » » » GetRefreshRects( ) const;
215 » void» » » » » » » » » EndRefresh();
216
217 private:
218 » CFX_Edit_LineRectArray» » » » » m_NewLineRects;
219 » CFX_Edit_LineRectArray» » » » » m_OldLineRects;
220 » CFX_Edit_RectArray» » » » » » m_Refres hRects;
221 };
222
223 188
224 /* ------------------------- CFX_Edit_Select ---------------------------- */ 189 /* ------------------------- CFX_Edit_Select ---------------------------- */
225 190
226 class CFX_Edit_Select 191 class CFX_Edit_Select {
227 { 192 public:
228 public: 193 CFX_Edit_Select() {}
229 » CFX_Edit_Select() 194
230 » { 195 CFX_Edit_Select(const CPVT_WordPlace& begin, const CPVT_WordPlace& end) {
231 » } 196 Set(begin, end);
232 197 }
233 » CFX_Edit_Select(const CPVT_WordPlace & begin,const CPVT_WordPlace & end) 198
234 » { 199 CFX_Edit_Select(const CPVT_WordRange& range) {
235 » » Set(begin,end); 200 Set(range.BeginPos, range.EndPos);
236 » } 201 }
237 202
238 » CFX_Edit_Select(const CPVT_WordRange & range) 203 CPVT_WordRange ConvertToWordRange() const {
239 » { 204 return CPVT_WordRange(BeginPos, EndPos);
240 » » Set(range.BeginPos,range.EndPos); 205 }
241 » } 206
242 207 void Default() {
243 » CPVT_WordRange ConvertToWordRange() const 208 BeginPos.Default();
244 » { 209 EndPos.Default();
245 » » return CPVT_WordRange(BeginPos, EndPos); 210 }
246 » } 211
247 212 void Set(const CPVT_WordPlace& begin, const CPVT_WordPlace& end) {
248 » void Default() 213 BeginPos = begin;
249 » { 214 EndPos = end;
250 » » BeginPos.Default(); 215 }
251 » » EndPos.Default(); 216
252 » } 217 void SetBeginPos(const CPVT_WordPlace& begin) { BeginPos = begin; }
253 218
254 » void Set(const CPVT_WordPlace & begin,const CPVT_WordPlace & end) 219 void SetEndPos(const CPVT_WordPlace& end) { EndPos = end; }
255 » { 220
256 » » BeginPos = begin; 221 FX_BOOL IsExist() const { return BeginPos != EndPos; }
257 » » EndPos = end; 222
258 » } 223 FX_BOOL operator!=(const CPVT_WordRange& wr) const {
259 224 return wr.BeginPos != BeginPos || wr.EndPos != EndPos;
260 » void SetBeginPos(const CPVT_WordPlace & begin) 225 }
261 » { 226
262 » » BeginPos = begin; 227 CPVT_WordPlace BeginPos, EndPos;
263 » }
264
265 » void SetEndPos(const CPVT_WordPlace & end)
266 » {
267 » » EndPos = end;
268 » }
269
270 » FX_BOOL IsExist() const
271 » {
272 » » return BeginPos != EndPos;
273 » }
274
275 » FX_BOOL operator != (const CPVT_WordRange & wr) const
276 » {
277 » » return wr.BeginPos != BeginPos || wr.EndPos != EndPos;
278 » }
279
280 » CPVT_WordPlace BeginPos,EndPos;
281 }; 228 };
282 229
283 /* ------------------------- CFX_Edit_Undo ---------------------------- */ 230 /* ------------------------- CFX_Edit_Undo ---------------------------- */
284 231
285 class CFX_Edit_Undo 232 class CFX_Edit_Undo {
286 { 233 public:
287 public: 234 CFX_Edit_Undo(int32_t nBufsize = 10000);
288 CFX_Edit_Undo(int32_t nBufsize = 10000); 235 virtual ~CFX_Edit_Undo();
289 virtual ~CFX_Edit_Undo(); 236
290 237 void Undo();
291 void Undo(); 238 void Redo();
292 void Redo(); 239
293 240 void AddItem(IFX_Edit_UndoItem* pItem);
294 void AddItem(IFX_Edit_UndoItem* pItem); 241
295 242 FX_BOOL CanUndo() const;
296 FX_BOOL CanUndo() const; 243 FX_BOOL CanRedo() const;
297 FX_BOOL CanRedo() const; 244 FX_BOOL IsModified() const;
298 FX_BOOL IsModified() const; 245 FX_BOOL IsWorking() const;
299 FX_BOOL IsWorking() const; 246
300 247 void Reset();
301 void Reset(); 248
302 249 IFX_Edit_UndoItem* GetItem(int32_t nIndex);
303 IFX_Edit_UndoItem* GetItem( int32_t nIndex); 250 int32_t GetItemCount() { return m_UndoItemStack.GetSize(); }
304 int32_t GetItemC ount(){return m_UndoItemStack.GetSize();} 251 int32_t GetCurUndoPos() { return m_nCurUndoPos; }
305 int32_t GetCurUn doPos(){return m_nCurUndoPos;} 252
306 253 private:
307 private: 254 void SetBufSize(int32_t nSize) { m_nBufSize = nSize; }
308 void SetBufSize(int32_t nSize){m_nBufSize = nSize;} 255 int32_t GetBufSize() { return m_nBufSize; }
309 int32_t GetBufSi ze(){return m_nBufSize;} 256
310 257 void RemoveHeads();
311 void RemoveHeads(); 258 void RemoveTails();
312 void RemoveTails(); 259
313 260 private:
314 private: 261 CFX_ArrayTemplate<IFX_Edit_UndoItem*> m_UndoItemStack;
315 CFX_ArrayTemplate<IFX_Edit_UndoItem*> m_UndoItemStack; 262
316 263 int32_t m_nCurUndoPos;
317 int32_t m_nCurUn doPos; 264 int32_t m_nBufSize;
318 int32_t m_nBufSi ze; 265 FX_BOOL m_bModified;
319 FX_BOOL m_bModified; 266 FX_BOOL m_bVirgin;
320 FX_BOOL m_bVirgin; 267 FX_BOOL m_bWorking;
321 FX_BOOL m_bWorking; 268 };
322 }; 269
323 270 class CFX_Edit_UndoItem : public IFX_Edit_UndoItem {
324 class CFX_Edit_UndoItem : public IFX_Edit_UndoItem 271 public:
325 { 272 CFX_Edit_UndoItem() : m_bFirst(TRUE), m_bLast(TRUE) {}
326 public: 273
327 CFX_Edit_UndoItem() : m_bFirst(TRUE), m_bLast(TRUE) {} 274 CFX_WideString GetUndoTitle() override { return L""; }
328 275
329 CFX_WideString GetUndoTitle() override { return L""; } 276 void SetFirst(FX_BOOL bFirst) { m_bFirst = bFirst; }
330 277 FX_BOOL IsFirst() { return m_bFirst; }
331 void SetFirst(FX_BOOL bFirst){m_bFirst = bFirst;} 278 void SetLast(FX_BOOL bLast) { m_bLast = bLast; }
332 FX_BOOL IsFirst(){return m_bFirst;} 279 FX_BOOL IsLast() { return m_bLast; }
333 void SetLast(FX_BOOL bLast){m_bLast = bLast;} 280
334 FX_BOOL IsLast(){return m_bLast;} 281 private:
335 282 FX_BOOL m_bFirst;
336 private: 283 FX_BOOL m_bLast;
337 FX_BOOL m_bFirst; 284 };
338 FX_BOOL m_bLast; 285
339 }; 286 class CFX_Edit_GroupUndoItem : public IFX_Edit_UndoItem {
340 287 public:
341 class CFX_Edit_GroupUndoItem : public IFX_Edit_UndoItem 288 CFX_Edit_GroupUndoItem(const CFX_WideString& sTitle);
342 { 289 ~CFX_Edit_GroupUndoItem() override;
343 public: 290
344 CFX_Edit_GroupUndoItem(const CFX_WideString& sTitle); 291 void Undo() override;
345 ~CFX_Edit_GroupUndoItem() override; 292 void Redo() override;
346 293 CFX_WideString GetUndoTitle() override;
347 void Undo() override; 294
348 void Redo() override; 295 void AddUndoItem(CFX_Edit_UndoItem* pUndoItem);
349 CFX_WideString GetUndoTitle() override; 296 void UpdateItems();
350 297
351 void AddUndoItem(CFX_Edit_UndoItem* pUndoItem); 298 private:
352 void UpdateItems(); 299 CFX_WideString m_sTitle;
353 300 CFX_ArrayTemplate<CFX_Edit_UndoItem*> m_Items;
354 private: 301 };
355 CFX_WideString m_sTitle ; 302
356 CFX_ArrayTemplate<CFX_Edit_UndoItem*> m_Items; 303 /* ------------------------- CFX_Edit_UndoItem derived classes
357 }; 304 * ---------------------------- */
358 305
359 /* ------------------------- CFX_Edit_UndoItem derived classes ----------------- ----------- */ 306 class CFXEU_InsertWord : public CFX_Edit_UndoItem {
360 307 public:
361 class CFXEU_InsertWord : public CFX_Edit_UndoItem 308 CFXEU_InsertWord(CFX_Edit* pEdit,
362 { 309 const CPVT_WordPlace& wpOldPlace,
363 public: 310 const CPVT_WordPlace& wpNewPlace,
364 CFXEU_InsertWord(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, co nst CPVT_WordPlace & wpNewPlace, 311 FX_WORD word,
365 FX_WORD word, int32_t charset, const CPVT_WordProps * pWordProps ); 312 int32_t charset,
366 virtual ~CFXEU_InsertWord(); 313 const CPVT_WordProps* pWordProps);
367 314 virtual ~CFXEU_InsertWord();
368 void Redo(); 315
369 void Undo(); 316 void Redo();
370 317 void Undo();
371 private: 318
372 CFX_Edit* m_pEdit; 319 private:
373 320 CFX_Edit* m_pEdit;
374 CPVT_WordPlace m_wpOld; 321
375 CPVT_WordPlace m_wpNew; 322 CPVT_WordPlace m_wpOld;
376 FX_WORD m_Word; 323 CPVT_WordPlace m_wpNew;
377 int32_t m_nCharset; 324 FX_WORD m_Word;
378 CPVT_WordProps m_WordProps; 325 int32_t m_nCharset;
379 }; 326 CPVT_WordProps m_WordProps;
380 327 };
381 class CFXEU_InsertReturn : public CFX_Edit_UndoItem 328
382 { 329 class CFXEU_InsertReturn : public CFX_Edit_UndoItem {
383 public: 330 public:
384 CFXEU_InsertReturn(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace, 331 CFXEU_InsertReturn(CFX_Edit* pEdit,
385 const CPVT_SecProps * p SecProps, const CPVT_WordProps * pWordProps); 332 const CPVT_WordPlace& wpOldPlace,
386 virtual ~CFXEU_InsertReturn(); 333 const CPVT_WordPlace& wpNewPlace,
387 334 const CPVT_SecProps* pSecProps,
388 void Redo(); 335 const CPVT_WordProps* pWordProps);
389 void Undo(); 336 virtual ~CFXEU_InsertReturn();
390 337
391 private: 338 void Redo();
392 CFX_Edit * m_pEdit; 339 void Undo();
393 340
394 CPVT_WordPlace m_wpOld; 341 private:
395 CPVT_WordPlace m_wpNew; 342 CFX_Edit* m_pEdit;
396 CPVT_SecProps m_SecProps; 343
397 CPVT_WordProps m_WordProps; 344 CPVT_WordPlace m_wpOld;
398 }; 345 CPVT_WordPlace m_wpNew;
399 346 CPVT_SecProps m_SecProps;
400 class CFXEU_Backspace : public CFX_Edit_UndoItem 347 CPVT_WordProps m_WordProps;
401 { 348 };
402 public: 349
403 CFXEU_Backspace(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, con st CPVT_WordPlace & wpNewPlace, 350 class CFXEU_Backspace : public CFX_Edit_UndoItem {
404 FX_WORD word, int32_t charset, 351 public:
405 const CPVT_SecProps & SecProps, const CPVT_WordProps & WordProps); 352 CFXEU_Backspace(CFX_Edit* pEdit,
406 virtual ~CFXEU_Backspace(); 353 const CPVT_WordPlace& wpOldPlace,
407 354 const CPVT_WordPlace& wpNewPlace,
408 void Redo(); 355 FX_WORD word,
409 void Undo(); 356 int32_t charset,
410 357 const CPVT_SecProps& SecProps,
411 private: 358 const CPVT_WordProps& WordProps);
412 CFX_Edit * m_pEdit; 359 virtual ~CFXEU_Backspace();
413 360
414 CPVT_WordPlace m_wpOld; 361 void Redo();
415 CPVT_WordPlace m_wpNew; 362 void Undo();
416 FX_WORD m_Word; 363
417 int32_t m_nCharset; 364 private:
418 CPVT_SecProps m_SecProps; 365 CFX_Edit* m_pEdit;
419 CPVT_WordProps m_WordProps; 366
420 }; 367 CPVT_WordPlace m_wpOld;
421 368 CPVT_WordPlace m_wpNew;
422 class CFXEU_Delete : public CFX_Edit_UndoItem 369 FX_WORD m_Word;
423 { 370 int32_t m_nCharset;
424 public: 371 CPVT_SecProps m_SecProps;
425 CFXEU_Delete(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace, 372 CPVT_WordProps m_WordProps;
426 FX_WORD word, int32_t charset, 373 };
427 const CPVT_SecProps & SecProps, const CPVT_WordProps & WordProps, FX_BOOL bSecEnd); 374
428 virtual ~CFXEU_Delete(); 375 class CFXEU_Delete : public CFX_Edit_UndoItem {
429 376 public:
430 void Redo(); 377 CFXEU_Delete(CFX_Edit* pEdit,
431 void Undo(); 378 const CPVT_WordPlace& wpOldPlace,
432 379 const CPVT_WordPlace& wpNewPlace,
433 private: 380 FX_WORD word,
434 CFX_Edit * m_pEdit; 381 int32_t charset,
435 382 const CPVT_SecProps& SecProps,
436 CPVT_WordPlace m_wpOld; 383 const CPVT_WordProps& WordProps,
437 CPVT_WordPlace m_wpNew; 384 FX_BOOL bSecEnd);
438 FX_WORD m_Word; 385 virtual ~CFXEU_Delete();
439 int32_t m_nCharset; 386
440 CPVT_SecProps m_SecProps; 387 void Redo();
441 CPVT_WordProps m_WordProps; 388 void Undo();
442 FX_BOOL m_bSecEnd; 389
443 }; 390 private:
444 391 CFX_Edit* m_pEdit;
445 class CFXEU_Clear : public CFX_Edit_UndoItem 392
446 { 393 CPVT_WordPlace m_wpOld;
447 public: 394 CPVT_WordPlace m_wpNew;
448 CFXEU_Clear(CFX_Edit * pEdit, const CPVT_WordRange & wrSel, const CFX_Wi deString & swText); 395 FX_WORD m_Word;
449 virtual ~CFXEU_Clear(); 396 int32_t m_nCharset;
450 397 CPVT_SecProps m_SecProps;
451 void Redo(); 398 CPVT_WordProps m_WordProps;
452 void Undo(); 399 FX_BOOL m_bSecEnd;
453 400 };
454 private: 401
455 CFX_Edit* m_pEdit; 402 class CFXEU_Clear : public CFX_Edit_UndoItem {
456 403 public:
457 CPVT_WordRange m_wrSel; 404 CFXEU_Clear(CFX_Edit* pEdit,
458 CFX_WideString m_swText; 405 const CPVT_WordRange& wrSel,
459 }; 406 const CFX_WideString& swText);
460 407 virtual ~CFXEU_Clear();
461 class CFXEU_ClearRich : public CFX_Edit_UndoItem 408
462 { 409 void Redo();
463 public: 410 void Undo();
464 CFXEU_ClearRich(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, con st CPVT_WordPlace & wpNewPlace, 411
465 const CPVT_WordRange & wrSel, 412 private:
466 FX_WORD word, int32_t charset, 413 CFX_Edit* m_pEdit;
467 const CPVT_SecProps & SecProps, const CPVT_WordProps & WordProps); 414
468 virtual ~CFXEU_ClearRich(); 415 CPVT_WordRange m_wrSel;
469 416 CFX_WideString m_swText;
470 void Redo(); 417 };
471 void Undo(); 418
472 419 class CFXEU_ClearRich : public CFX_Edit_UndoItem {
473 private: 420 public:
474 CFX_Edit * m_pEdit; 421 CFXEU_ClearRich(CFX_Edit* pEdit,
475 422 const CPVT_WordPlace& wpOldPlace,
476 CPVT_WordPlace m_wpOld; 423 const CPVT_WordPlace& wpNewPlace,
477 CPVT_WordPlace m_wpNew; 424 const CPVT_WordRange& wrSel,
478 CPVT_WordRange m_wrSel; 425 FX_WORD word,
479 FX_WORD m_Word; 426 int32_t charset,
480 int32_t m_nCharset; 427 const CPVT_SecProps& SecProps,
481 CPVT_SecProps m_SecProps; 428 const CPVT_WordProps& WordProps);
482 CPVT_WordProps m_WordProps; 429 virtual ~CFXEU_ClearRich();
483 }; 430
484 431 void Redo();
485 class CFXEU_InsertText : public CFX_Edit_UndoItem 432 void Undo();
486 { 433
487 public: 434 private:
488 CFXEU_InsertText(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, co nst CPVT_WordPlace & wpNewPlace, 435 CFX_Edit* m_pEdit;
489 const CFX_WideString & swText , int32_t charset, 436
490 const CPVT_SecProps * pSecPro ps, const CPVT_WordProps * pWordProps); 437 CPVT_WordPlace m_wpOld;
491 virtual ~CFXEU_InsertText(); 438 CPVT_WordPlace m_wpNew;
492 439 CPVT_WordRange m_wrSel;
493 void Redo(); 440 FX_WORD m_Word;
494 void Undo(); 441 int32_t m_nCharset;
495 442 CPVT_SecProps m_SecProps;
496 private: 443 CPVT_WordProps m_WordProps;
497 CFX_Edit * m_pEdit; 444 };
498 445
499 CPVT_WordPlace m_wpOld; 446 class CFXEU_InsertText : public CFX_Edit_UndoItem {
500 CPVT_WordPlace m_wpNew; 447 public:
501 CFX_WideString m_swText; 448 CFXEU_InsertText(CFX_Edit* pEdit,
502 int32_t m_nCharset; 449 const CPVT_WordPlace& wpOldPlace,
503 CPVT_SecProps m_SecProps; 450 const CPVT_WordPlace& wpNewPlace,
504 CPVT_WordProps m_WordProps; 451 const CFX_WideString& swText,
505 }; 452 int32_t charset,
506 453 const CPVT_SecProps* pSecProps,
507 class CFXEU_SetSecProps : public CFX_Edit_UndoItem 454 const CPVT_WordProps* pWordProps);
508 { 455 virtual ~CFXEU_InsertText();
509 public: 456
510 CFXEU_SetSecProps(CFX_Edit * pEdit, const CPVT_WordPlace & place, EDIT_P ROPS_E ep, 457 void Redo();
511 const CPVT_SecProps & oldsecprops, const CPVT_WordProps & oldwor dprops, 458 void Undo();
512 const CPVT_SecProps & newsecprops, const CPVT_WordProps & newwor dprops, const CPVT_WordRange & range); 459
513 virtual ~CFXEU_SetSecProps(); 460 private:
514 461 CFX_Edit* m_pEdit;
515 void Redo(); 462
516 void Undo(); 463 CPVT_WordPlace m_wpOld;
517 464 CPVT_WordPlace m_wpNew;
518 private: 465 CFX_WideString m_swText;
519 CFX_Edit * m_pEdit; 466 int32_t m_nCharset;
520 CPVT_WordPlace m_wpPlace; 467 CPVT_SecProps m_SecProps;
521 CPVT_WordRange m_wrPlace; 468 CPVT_WordProps m_WordProps;
522 EDIT_PROPS_E m_eProps; 469 };
523 470
524 CPVT_SecProps m_OldSecProps; 471 class CFXEU_SetSecProps : public CFX_Edit_UndoItem {
525 CPVT_SecProps m_NewSecProps; 472 public:
526 CPVT_WordProps m_OldWordProps; 473 CFXEU_SetSecProps(CFX_Edit* pEdit,
527 CPVT_WordProps m_NewWordProps; 474 const CPVT_WordPlace& place,
528 }; 475 EDIT_PROPS_E ep,
529 476 const CPVT_SecProps& oldsecprops,
530 class CFXEU_SetWordProps : public CFX_Edit_UndoItem 477 const CPVT_WordProps& oldwordprops,
531 { 478 const CPVT_SecProps& newsecprops,
532 public: 479 const CPVT_WordProps& newwordprops,
533 CFXEU_SetWordProps(CFX_Edit * pEdit, const CPVT_WordPlace & place, EDIT_ PROPS_E ep, 480 const CPVT_WordRange& range);
534 const CPVT_WordProps & oldprops, const CPVT_WordProps & newprops , const CPVT_WordRange & range); 481 virtual ~CFXEU_SetSecProps();
535 virtual ~CFXEU_SetWordProps(); 482
536 483 void Redo();
537 void Redo(); 484 void Undo();
538 void Undo(); 485
539 486 private:
540 private: 487 CFX_Edit* m_pEdit;
541 CFX_Edit * m_pEdit; 488 CPVT_WordPlace m_wpPlace;
542 CPVT_WordPlace m_wpPlace; 489 CPVT_WordRange m_wrPlace;
543 CPVT_WordRange m_wrPlace; 490 EDIT_PROPS_E m_eProps;
544 EDIT_PROPS_E m_eProps; 491
545 492 CPVT_SecProps m_OldSecProps;
546 CPVT_WordProps m_OldWordProps; 493 CPVT_SecProps m_NewSecProps;
547 CPVT_WordProps m_NewWordProps; 494 CPVT_WordProps m_OldWordProps;
495 CPVT_WordProps m_NewWordProps;
496 };
497
498 class CFXEU_SetWordProps : public CFX_Edit_UndoItem {
499 public:
500 CFXEU_SetWordProps(CFX_Edit* pEdit,
501 const CPVT_WordPlace& place,
502 EDIT_PROPS_E ep,
503 const CPVT_WordProps& oldprops,
504 const CPVT_WordProps& newprops,
505 const CPVT_WordRange& range);
506 virtual ~CFXEU_SetWordProps();
507
508 void Redo();
509 void Undo();
510
511 private:
512 CFX_Edit* m_pEdit;
513 CPVT_WordPlace m_wpPlace;
514 CPVT_WordRange m_wrPlace;
515 EDIT_PROPS_E m_eProps;
516
517 CPVT_WordProps m_OldWordProps;
518 CPVT_WordProps m_NewWordProps;
548 }; 519 };
549 520
550 /* ------------------------- CFX_Edit ---------------------------- */ 521 /* ------------------------- CFX_Edit ---------------------------- */
551 522
552 class CFX_Edit : public IFX_Edit 523 class CFX_Edit : public IFX_Edit {
553 { 524 friend class CFX_Edit_Iterator;
554 friend class CFX_Edit_Iterator; 525 friend class CFXEU_InsertWord;
555 friend class CFXEU_InsertWord; 526 friend class CFXEU_InsertReturn;
556 friend class CFXEU_InsertReturn; 527 friend class CFXEU_Backspace;
557 friend class CFXEU_Backspace; 528 friend class CFXEU_Delete;
558 friend class CFXEU_Delete; 529 friend class CFXEU_Clear;
559 friend class CFXEU_Clear; 530 friend class CFXEU_ClearRich;
560 friend class CFXEU_ClearRich; 531 friend class CFXEU_SetSecProps;
561 friend class CFXEU_SetSecProps; 532 friend class CFXEU_SetWordProps;
562 friend class CFXEU_SetWordProps; 533 friend class CFXEU_InsertText;
563 friend class CFXEU_InsertText; 534
564 535 public:
565 public: 536 CFX_Edit(IPDF_VariableText* pVT);
566 CFX_Edit(IPDF_VariableText * pVT); 537 virtual ~CFX_Edit();
567 virtual ~CFX_Edit(); 538
568 539 void SetFontMap(IFX_Edit_FontMap* pFontMap);
569 void SetFontMap(IFX_Edit_FontMap * pFontMap); 540 void SetVTProvider(IPDF_VariableText_Provider* pProvider);
570 void SetVTProvider(IPDF_VariableText_Provider* pProvider); 541 void SetNotify(IFX_Edit_Notify* pNotify);
571 void SetNotify(IFX_Edit_Notify * pNotify); 542 void SetOprNotify(IFX_Edit_OprNotify* pOprNotify);
572 void SetOprNotify(IFX_Edit_OprNotify* pOprNotify); 543 IFX_Edit_Iterator* GetIterator();
573 IFX_Edit_Iterator* GetItera tor(); 544 IPDF_VariableText* GetVariableText();
574 IPDF_VariableText * GetVaria bleText(); 545 IFX_Edit_FontMap* GetFontMap();
575 IFX_Edit_FontMap* GetFontM ap(); 546
576 547 void Initialize();
577 void Initialize(); 548 void SetPlateRect(const CPDF_Rect& rect, FX_BOOL bPaint = TRUE);
578 void SetPlateRect(const CPDF_Rect & rect, FX_BOOL bPaint = TRUE); 549 void SetScrollPos(const CPDF_Point& point);
579 void SetScrollPos(const CPDF_Point & point); 550
580 551 void SetAlignmentH(int32_t nFormat = 0, FX_BOOL bPaint = TRUE);
581 void SetAlignmentH(int32_t nFormat = 0, FX_BOOL bPaint = TRUE); 552 void SetAlignmentV(int32_t nFormat = 0, FX_BOOL bPaint = TRUE);
582 void SetAlignmentV(int32_t nFormat = 0, FX_BOOL bPaint = TRUE); 553 void SetPasswordChar(FX_WORD wSubWord = '*', FX_BOOL bPaint = TRUE);
583 void SetPasswordChar(FX_WORD wSubWord = '*', FX_BOOL bPaint = TRUE); 554 void SetLimitChar(int32_t nLimitChar = 0, FX_BOOL bPaint = TRUE);
584 void SetLimitChar(int32_t nLimitChar = 0, FX_BOOL bPaint = TRUE); 555 void SetCharArray(int32_t nCharArray = 0, FX_BOOL bPaint = TRUE);
585 void SetCharArray(int32_t nCharArray = 0, FX_BOOL bPaint = TRUE); 556 void SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE);
586 void SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE); 557 void SetHorzScale(int32_t nHorzScale = 100, FX_BOOL bPaint = TRUE);
587 void SetHorzScale(int32_t nHorzScale = 100, FX_BOOL bPaint = TRUE); 558 void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE);
588 void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE); 559 void SetMultiLine(FX_BOOL bMultiLine = TRUE, FX_BOOL bPaint = TRUE);
589 void SetMultiLine(FX_BOOL bMultiLine = TRUE, FX_BOOL bPaint = TRUE); 560 void SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE);
590 void SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE); 561 void SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE);
591 void SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE); 562 void SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE);
592 void SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE); 563 void SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE);
593 void SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE); 564 void SetTextOverflow(FX_BOOL bAllowed = FALSE, FX_BOOL bPaint = TRUE);
594 void SetTextOverflow(FX_BOOL bAllowed = FALSE, FX_BOOL bPaint = TRUE); 565
595 566 FX_BOOL IsRichText() const;
596 FX_BOOL IsRichText() const; 567 void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE);
597 void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE); 568 FX_BOOL SetRichFontSize(FX_FLOAT fFontSize);
598 FX_BOOL SetRichFontSize(FX_FLOAT fFontSize); 569 FX_BOOL SetRichFontIndex(int32_t nFontIndex);
599 FX_BOOL SetRichFontIndex(int32_t nFontIndex); 570 FX_BOOL SetRichTextColor(FX_COLORREF dwColor);
600 FX_BOOL SetRichTextColor(FX_COLORREF dwColor); 571 FX_BOOL SetRichTextScript(int32_t nScriptType);
601 FX_BOOL SetRichTextScript(int32_t nScriptType); 572 FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE);
602 FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE); 573 FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE);
603 FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE); 574 FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE);
604 FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE); 575 FX_BOOL SetRichTextCrossout(FX_BOOL bCrossout = TRUE);
605 FX_BOOL SetRichTextCrossout(FX_BOOL bCrossout = TRUE); 576 FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace);
606 FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace); 577 FX_BOOL SetRichTextHorzScale(int32_t nHorzScale = 100);
607 FX_BOOL SetRichTextHorzScale(int32_t nHorzScale = 100); 578 FX_BOOL SetRichTextLineLeading(FX_FLOAT fLineLeading);
608 FX_BOOL SetRichTextLineLeading(FX_FLOAT fLineLeading); 579 FX_BOOL SetRichTextLineIndent(FX_FLOAT fLineIndent);
609 FX_BOOL SetRichTextLineIndent(FX_FLOAT fLineIndent); 580 FX_BOOL SetRichTextAlignment(int32_t nAlignment);
610 FX_BOOL SetRichTextAlignment(int32_t nAlignment); 581
611 582 void OnMouseDown(const CPDF_Point& point, FX_BOOL bShift, FX_BOOL bCtrl);
612 void OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl); 583 void OnMouseMove(const CPDF_Point& point, FX_BOOL bShift, FX_BOOL bCtrl);
613 void OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl); 584 void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl);
614 void OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl); 585 void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl);
615 void OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl); 586 void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl);
616 void OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl); 587 void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl);
617 void OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl); 588 void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl);
618 void OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl); 589 void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl);
619 void OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl); 590
620 591 void SetText(const FX_WCHAR* text,
621 void SetText(const FX_WCHAR* text,int32_t charset = DEFAULT_CHARSET, 592 int32_t charset = DEFAULT_CHARSET,
622 const CPVT_SecProps * pSecProps = NULL,const CPVT_WordPr ops * pWordProps = NULL); 593 const CPVT_SecProps* pSecProps = NULL,
623 FX_BOOL InsertWord(FX_WORD word, int32_t charset = DEFAULT_CHARSET, const CPVT_WordProps * pWordProps = NULL); 594 const CPVT_WordProps* pWordProps = NULL);
624 FX_BOOL InsertReturn(const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWord Props = NULL); 595 FX_BOOL InsertWord(FX_WORD word,
625 FX_BOOL Backspace(); 596 int32_t charset = DEFAULT_CHARSET,
626 FX_BOOL Delete(); 597 const CPVT_WordProps* pWordProps = NULL);
627 FX_BOOL Clear(); 598 FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps = NULL,
628 FX_BOOL Empty(); 599 const CPVT_WordProps* pWordProps = NULL);
629 FX_BOOL InsertText(const FX_WCHAR* text, int32_t charset = DEFAULT_CHARSET, 600 FX_BOOL Backspace();
630 const CPVT_SecProps * pSecProps = NULL,const CPVT_WordPr ops * pWordProps = NULL); 601 FX_BOOL Delete();
631 FX_BOOL Redo(); 602 FX_BOOL Clear();
632 FX_BOOL Undo(); 603 FX_BOOL Empty();
633 CPVT_WordPlace DoInsert Text(const CPVT_WordPlace& place, const FX_WCHAR* text, int32_t charset, 604 FX_BOOL InsertText(const FX_WCHAR* text,
634 const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordPro ps); 605 int32_t charset = DEFAULT_CHARSET,
635 int32_t GetCharS etFromUnicode(FX_WORD word, int32_t nOldCharset); 606 const CPVT_SecProps* pSecProps = NULL,
636 607 const CPVT_WordProps* pWordProps = NULL);
637 int32_t WordPlac eToWordIndex(const CPVT_WordPlace & place) const; 608 FX_BOOL Redo();
638 CPVT_WordPlace WordInde xToWordPlace(int32_t index) const; 609 FX_BOOL Undo();
639 610 CPVT_WordPlace DoInsertText(const CPVT_WordPlace& place,
640 CPVT_WordPlace GetLineB eginPlace(const CPVT_WordPlace & place) const; 611 const FX_WCHAR* text,
641 CPVT_WordPlace GetLineE ndPlace(const CPVT_WordPlace & place) const; 612 int32_t charset,
642 CPVT_WordPlace GetSecti onBeginPlace(const CPVT_WordPlace & place) const; 613 const CPVT_SecProps* pSecProps,
643 CPVT_WordPlace GetSecti onEndPlace(const CPVT_WordPlace & place) const; 614 const CPVT_WordProps* pWordProps);
644 CPVT_WordPlace SearchWo rdPlace(const CPDF_Point& point) const; 615 int32_t GetCharSetFromUnicode(FX_WORD word, int32_t nOldCharset);
645 616
646 int32_t GetCaret () const; 617 int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const;
647 CPVT_WordPlace GetCaret WordPlace() const; 618 CPVT_WordPlace WordIndexToWordPlace(int32_t index) const;
648 CFX_WideString GetSelTe xt() const; 619
649 CFX_WideString GetText( ) const; 620 CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace& place) const;
650 FX_FLOAT GetFontSize() const; 621 CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace& place) const;
651 FX_WORD GetPasswordChar() const; 622 CPVT_WordPlace GetSectionBeginPlace(const CPVT_WordPlace& place) const;
652 CPDF_Point GetScrollPos() const; 623 CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace& place) const;
653 int32_t GetCharA rray() const; 624 CPVT_WordPlace SearchWordPlace(const CPDF_Point& point) const;
654 CPDF_Rect GetPlateRect() const; 625
655 CPDF_Rect GetContentRect() const; 626 int32_t GetCaret() const;
656 CFX_WideString GetRange Text(const CPVT_WordRange & range) const; 627 CPVT_WordPlace GetCaretWordPlace() const;
657 int32_t GetHorzS cale() const; 628 CFX_WideString GetSelText() const;
658 FX_FLOAT GetCharSpace() const; 629 CFX_WideString GetText() const;
659 int32_t GetTotal Words() const; 630 FX_FLOAT GetFontSize() const;
660 int32_t GetTotal Lines() const; 631 FX_WORD GetPasswordChar() const;
661 632 CPDF_Point GetScrollPos() const;
662 void SetSel(int32_t nStartChar,int32_t nEndChar); 633 int32_t GetCharArray() const;
663 void GetSel(int32_t & nStartChar, int32_t & nEndChar) const; 634 CPDF_Rect GetPlateRect() const;
664 635 CPDF_Rect GetContentRect() const;
665 private: 636 CFX_WideString GetRangeText(const CPVT_WordRange& range) const;
666 void SelectAll(); 637 int32_t GetHorzScale() const;
667 void SelectNone(); 638 FX_FLOAT GetCharSpace() const;
668 void SetSel(const CPVT_WordPlace & begin,const CPVT_WordPlace & end); 639 int32_t GetTotalWords() const;
669 FX_BOOL IsSelected() const; 640 int32_t GetTotalLines() const;
670 641
671 void RearrangeAll(); 642 void SetSel(int32_t nStartChar, int32_t nEndChar);
672 void RearrangePart(const CPVT_WordRange & range); 643 void GetSel(int32_t& nStartChar, int32_t& nEndChar) const;
673 void Paint(); 644
674 void ScrollToCaret(); 645 private:
675 void SetScrollInfo(); 646 void SelectAll();
676 void SetScrollPosX(FX_FLOAT fx); 647 void SelectNone();
677 void SetScrollPosY(FX_FLOAT fy); 648 void SetSel(const CPVT_WordPlace& begin, const CPVT_WordPlace& end);
678 void SetScrollLimit(); 649 FX_BOOL IsSelected() const;
679 void SetContentChanged(); 650
680 void EnableNotify(FX_BOOL bNotify); 651 void RearrangeAll();
681 652 void RearrangePart(const CPVT_WordRange& range);
682 void SetText(const FX_WCHAR* text,int32_t charset, 653 void Paint();
683 const CPVT_SecProps * pSecProps,const CPVT_WordProps * p WordProps,FX_BOOL bAddUndo, FX_BOOL bPaint); 654 void ScrollToCaret();
684 FX_BOOL InsertWord(FX_WORD word, int32_t charset, const CPVT_WordProps * pWordProps,FX_B OOL bAddUndo, FX_BOOL bPaint); 655 void SetScrollInfo();
685 FX_BOOL InsertReturn(const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps,F X_BOOL bAddUndo, FX_BOOL bPaint); 656 void SetScrollPosX(FX_FLOAT fx);
686 FX_BOOL Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint); 657 void SetScrollPosY(FX_FLOAT fy);
687 FX_BOOL Delete(FX_BOOL bAddUndo, FX_BOOL bPaint); 658 void SetScrollLimit();
688 FX_BOOL Clear(FX_BOOL bAddUndo, FX_BOOL bPaint); 659 void SetContentChanged();
689 FX_BOOL InsertText(const FX_WCHAR* text, int32_t charset, 660 void EnableNotify(FX_BOOL bNotify);
690 const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProp s,FX_BOOL bAddUndo, FX_BOOL bPaint); 661
691 FX_BOOL SetRichTextProps(EDIT_PROPS_E eProps, 662 void SetText(const FX_WCHAR* text,
692 const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordPro ps); 663 int32_t charset,
693 FX_BOOL SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, 664 const CPVT_SecProps* pSecProps,
694 const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordPro ps, const CPVT_WordRange & wr, FX_BOOL bAddUndo); 665 const CPVT_WordProps* pWordProps,
695 FX_BOOL SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place, 666 FX_BOOL bAddUndo,
696 const CPVT_WordProps * pWordProps, const CPVT_WordRange & wr, FX _BOOL bAddUndo); 667 FX_BOOL bPaint);
697 void PaintSetProps(EDIT_PROPS_E eProps, const CPVT_WordRange & wr); 668 FX_BOOL InsertWord(FX_WORD word,
698 void PaintInsertText(const CPVT_WordPlace & wpOld, const CPVT_WordPlace & wpNew); 669 int32_t charset,
699 670 const CPVT_WordProps* pWordProps,
700 inline CPDF_Point VTToEdit (const CPDF_Point & point) const; 671 FX_BOOL bAddUndo,
701 inline CPDF_Point EditToVT (const CPDF_Point & point) const; 672 FX_BOOL bPaint);
702 inline CPDF_Rect VTToEdit (const CPDF_Rect & rect) const; 673 FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps,
703 inline CPDF_Rect EditToVT (const CPDF_Rect & rect) const; 674 const CPVT_WordProps* pWordProps,
704 675 FX_BOOL bAddUndo,
705 void EnableRefresh(FX_BOOL bRefresh); 676 FX_BOOL bPaint);
706 void Refresh(REFRESH_PLAN_E ePlan,const CPVT_WordRange * pRange1 = NULL,const CPVT_Wo rdRange * pRange2 = NULL); 677 FX_BOOL Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint);
707 void RefreshPushLineRects(const CPVT_WordRange & wr); 678 FX_BOOL Delete(FX_BOOL bAddUndo, FX_BOOL bPaint);
708 void RefreshPushRandomRects(const CPVT_WordRange & wr); 679 FX_BOOL Clear(FX_BOOL bAddUndo, FX_BOOL bPaint);
709 void RefreshWordRange(const CPVT_WordRange& wr); 680 FX_BOOL InsertText(const FX_WCHAR* text,
710 681 int32_t charset,
711 void SetCaret(int32_t nPos); 682 const CPVT_SecProps* pSecProps,
712 void SetCaret(const CPVT_WordPlace & place); 683 const CPVT_WordProps* pWordProps,
713 void SetCaretInfo(); 684 FX_BOOL bAddUndo,
714 void SetCaretOrigin(); 685 FX_BOOL bPaint);
715 void SetCaretChange(); 686 FX_BOOL SetRichTextProps(EDIT_PROPS_E eProps,
716 687 const CPVT_SecProps* pSecProps,
717 CPVT_WordRange GetWhole WordRange() const; 688 const CPVT_WordProps* pWordProps);
718 CPVT_WordRange GetVisib leWordRange() const; 689 FX_BOOL SetSecProps(EDIT_PROPS_E eProps,
719 CPVT_WordRange GetLatin WordsRange(const CPVT_WordPlace & place) const; 690 const CPVT_WordPlace& place,
720 CPVT_WordRange CombineW ordRange(const CPVT_WordRange & wr1, const CPVT_WordRange & wr2); 691 const CPVT_SecProps* pSecProps,
721 CPVT_WordRange GetSelec tWordRange() const; 692 const CPVT_WordProps* pWordProps,
722 693 const CPVT_WordRange& wr,
723 void EnableUndo(FX_BOOL bUndo); 694 FX_BOOL bAddUndo);
724 void EnableOprNotify(FX_BOOL bNotify); 695 FX_BOOL SetWordProps(EDIT_PROPS_E eProps,
725 696 const CPVT_WordPlace& place,
726 FX_BOOL IsTextFull() const; 697 const CPVT_WordProps* pWordProps,
727 FX_BOOL IsTextOverflow() const; 698 const CPVT_WordRange& wr,
728 FX_BOOL CanUndo() const; 699 FX_BOOL bAddUndo);
729 FX_BOOL CanRedo() const; 700 void PaintSetProps(EDIT_PROPS_E eProps, const CPVT_WordRange& wr);
730 FX_BOOL IsModified() const; 701 void PaintInsertText(const CPVT_WordPlace& wpOld,
731 702 const CPVT_WordPlace& wpNew);
732 void BeginGroupUndo(const CFX_WideString& sTitle); 703
733 void EndGroupUndo(); 704 inline CPDF_Point VTToEdit(const CPDF_Point& point) const;
734 void AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem); 705 inline CPDF_Point EditToVT(const CPDF_Point& point) const;
735 void AddUndoItem(IFX_Edit_UndoItem* pUndoItem); 706 inline CPDF_Rect VTToEdit(const CPDF_Rect& rect) const;
736 707 inline CPDF_Rect EditToVT(const CPDF_Rect& rect) const;
737 void SetPageInfo(const CPVT_WordPlace& place); 708
738 CPVT_WordPlace SearchPa geEndPlace(const CPVT_WordPlace& wpPageBegin, const CPDF_Point& point) const; 709 void EnableRefresh(FX_BOOL bRefresh);
739 FX_FLOAT GetLineTop(const CPVT_WordPlace& place) const; 710 void Refresh(REFRESH_PLAN_E ePlan,
740 FX_FLOAT GetLineBottom(const CPVT_WordPlace& place) const; 711 const CPVT_WordRange* pRange1 = NULL,
741 712 const CPVT_WordRange* pRange2 = NULL);
742 private: 713 void RefreshPushLineRects(const CPVT_WordRange& wr);
743 IPDF_VariableText* m_pVT; 714 void RefreshPushRandomRects(const CPVT_WordRange& wr);
744 IFX_Edit_Notify* m_pNotif y; 715 void RefreshWordRange(const CPVT_WordRange& wr);
745 IFX_Edit_OprNotify* m_pOprNo tify; 716
746 CFX_Edit_Provider* m_pVTPro vide; 717 void SetCaret(int32_t nPos);
747 718 void SetCaret(const CPVT_WordPlace& place);
748 CPVT_WordPlace m_wpCare t; 719 void SetCaretInfo();
749 CPVT_WordPlace m_wpOldC aret; 720 void SetCaretOrigin();
750 CFX_Edit_Select m_SelSta te; 721 void SetCaretChange();
751 722
752 CPDF_Point m_ptScrollPos; 723 CPVT_WordRange GetWholeWordRange() const;
753 CPDF_Point m_ptRefreshScrollPos; 724 CPVT_WordRange GetVisibleWordRange() const;
754 FX_BOOL m_bEnableScroll; 725 CPVT_WordRange GetLatinWordsRange(const CPVT_WordPlace& place) const;
755 IFX_Edit_Iterator * m_pItera tor; 726 CPVT_WordRange CombineWordRange(const CPVT_WordRange& wr1,
756 CFX_Edit_Refresh m_Refres h; 727 const CPVT_WordRange& wr2);
757 CPDF_Point m_ptCaret; 728 CPVT_WordRange GetSelectWordRange() const;
758 CFX_Edit_Undo m_Undo; 729
759 int32_t m_nAlign ment; 730 void EnableUndo(FX_BOOL bUndo);
760 FX_BOOL m_bNotifyFlag; 731 void EnableOprNotify(FX_BOOL bNotify);
761 FX_BOOL m_bEnableOverflow; 732
762 FX_BOOL m_bEnableRefresh; 733 FX_BOOL IsTextFull() const;
763 CPDF_Rect m_rcOldContent; 734 FX_BOOL IsTextOverflow() const;
764 FX_BOOL m_bEnableUndo; 735 FX_BOOL CanUndo() const;
765 FX_BOOL m_bNotify; 736 FX_BOOL CanRedo() const;
766 FX_BOOL m_bOprNotify; 737 FX_BOOL IsModified() const;
767 CFX_Edit_GroupUndoItem* m_pGroupUndoItem ; 738
739 void BeginGroupUndo(const CFX_WideString& sTitle);
740 void EndGroupUndo();
741 void AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem);
742 void AddUndoItem(IFX_Edit_UndoItem* pUndoItem);
743
744 void SetPageInfo(const CPVT_WordPlace& place);
745 CPVT_WordPlace SearchPageEndPlace(const CPVT_WordPlace& wpPageBegin,
746 const CPDF_Point& point) const;
747 FX_FLOAT GetLineTop(const CPVT_WordPlace& place) const;
748 FX_FLOAT GetLineBottom(const CPVT_WordPlace& place) const;
749
750 private:
751 IPDF_VariableText* m_pVT;
752 IFX_Edit_Notify* m_pNotify;
753 IFX_Edit_OprNotify* m_pOprNotify;
754 CFX_Edit_Provider* m_pVTProvide;
755
756 CPVT_WordPlace m_wpCaret;
757 CPVT_WordPlace m_wpOldCaret;
758 CFX_Edit_Select m_SelState;
759
760 CPDF_Point m_ptScrollPos;
761 CPDF_Point m_ptRefreshScrollPos;
762 FX_BOOL m_bEnableScroll;
763 IFX_Edit_Iterator* m_pIterator;
764 CFX_Edit_Refresh m_Refresh;
765 CPDF_Point m_ptCaret;
766 CFX_Edit_Undo m_Undo;
767 int32_t m_nAlignment;
768 FX_BOOL m_bNotifyFlag;
769 FX_BOOL m_bEnableOverflow;
770 FX_BOOL m_bEnableRefresh;
771 CPDF_Rect m_rcOldContent;
772 FX_BOOL m_bEnableUndo;
773 FX_BOOL m_bNotify;
774 FX_BOOL m_bOprNotify;
775 CFX_Edit_GroupUndoItem* m_pGroupUndoItem;
768 }; 776 };
769 777
770 /* ------------------------- CFX_Edit_Iterator ---------------------------- */ 778 /* ------------------------- CFX_Edit_Iterator ---------------------------- */
771 779
772 class CFX_Edit_Iterator : public IFX_Edit_Iterator 780 class CFX_Edit_Iterator : public IFX_Edit_Iterator {
773 { 781 public:
774 public: 782 CFX_Edit_Iterator(CFX_Edit* pEdit, IPDF_VariableText_Iterator* pVTIterator);
775 » CFX_Edit_Iterator(CFX_Edit * pEdit,IPDF_VariableText_Iterator * pVTItera tor); 783 virtual ~CFX_Edit_Iterator();
776 » virtual ~CFX_Edit_Iterator(); 784
777 785 FX_BOOL NextWord();
778 » FX_BOOL»» » » » » » » » NextWord(); 786 FX_BOOL NextLine();
779 » FX_BOOL»» » » » » » » » NextLine(); 787 FX_BOOL NextSection();
780 » FX_BOOL»» » » » » » » » NextSection(); 788 FX_BOOL PrevWord();
781 » FX_BOOL»» » » » » » » » PrevWord(); 789 FX_BOOL PrevLine();
782 » FX_BOOL»» » » » » » » » PrevLine(); 790 FX_BOOL PrevSection();
783 » FX_BOOL»» » » » » » » » PrevSection(); 791
784 792 FX_BOOL GetWord(CPVT_Word& word) const;
785 » FX_BOOL»» » » » » » » » GetWord(CPVT_Word & word) const; 793 FX_BOOL GetLine(CPVT_Line& line) const;
786 » FX_BOOL»» » » » » » » » GetLine(CPVT_Line & line) const; 794 FX_BOOL GetSection(CPVT_Section& section) const;
787 » FX_BOOL»» » » » » » » » GetSection(CPVT_Section & section) const; 795 void SetAt(int32_t nWordIndex);
788 » void» » » » » » » » » SetAt(int32_t nWordIndex); 796 void SetAt(const CPVT_WordPlace& place);
789 » void» » » » » » » » » SetAt(const CPVT_WordPlace & place); 797 const CPVT_WordPlace& GetAt() const;
790 » const CPVT_WordPlace &» » » » » GetAt() const; 798 IFX_Edit* GetEdit() const;
791 » IFX_Edit*» » » » » » » » GetEdit() const; 799
792 800 private:
793 private: 801 CFX_Edit* m_pEdit;
794 » CFX_Edit *» » » » » » » » m_pEdit; 802 IPDF_VariableText_Iterator* m_pVTIterator;
795 » IPDF_VariableText_Iterator*» » » » m_pVTIterator; 803 };
796 }; 804
797 805 class CFX_Edit_Provider : public IPDF_VariableText_Provider {
798 class CFX_Edit_Provider : public IPDF_VariableText_Provider 806 public:
799 { 807 CFX_Edit_Provider(IFX_Edit_FontMap* pFontMap);
800 public: 808 virtual ~CFX_Edit_Provider();
801 » CFX_Edit_Provider(IFX_Edit_FontMap* pFontMap); 809
802 » virtual ~CFX_Edit_Provider(); 810 IFX_Edit_FontMap* GetFontMap();
803 811
804 » IFX_Edit_FontMap*» » » GetFontMap(); 812 int32_t GetCharWidth(int32_t nFontIndex, FX_WORD word, int32_t nWordStyle);
805 813 int32_t GetTypeAscent(int32_t nFontIndex);
806 » int32_t»» » » » GetCharWidth(int32_t nFontIndex, FX_WORD word, int32_t nWordStyle); 814 int32_t GetTypeDescent(int32_t nFontIndex);
807 » int32_t»» » » » GetTypeAscent(int32_t nFontIndex ); 815 int32_t GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex);
808 » int32_t»» » » » GetTypeDescent(int32_t nFontInde x); 816 int32_t GetDefaultFontIndex();
809 » int32_t»» » » » GetWordFontIndex(FX_WORD word, i nt32_t charset, int32_t nFontIndex); 817 FX_BOOL IsLatinWord(FX_WORD word);
810 » int32_t»» » » » GetDefaultFontIndex(); 818
811 » FX_BOOL»» » » » » IsLatinWord(FX_WORD word ); 819 private:
812 820 IFX_Edit_FontMap* m_pFontMap;
813 private:
814 » IFX_Edit_FontMap*» » » m_pFontMap;
815 }; 821 };
816 822
817 #endif // FPDFSDK_INCLUDE_FXEDIT_FXET_EDIT_H_ 823 #endif // FPDFSDK_INCLUDE_FXEDIT_FXET_EDIT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698