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

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

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

Powered by Google App Engine
This is Rietveld 408576698