OLD | NEW |
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_FXEDIT_FXET_EDIT_H_ | 7 #ifndef FPDFSDK_FXEDIT_FXET_EDIT_H_ |
8 #define FPDFSDK_FXEDIT_FXET_EDIT_H_ | 8 #define FPDFSDK_FXEDIT_FXET_EDIT_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 CFX_Edit_Select(); | 89 CFX_Edit_Select(); |
90 CFX_Edit_Select(const CPVT_WordPlace& begin, const CPVT_WordPlace& end); | 90 CFX_Edit_Select(const CPVT_WordPlace& begin, const CPVT_WordPlace& end); |
91 explicit CFX_Edit_Select(const CPVT_WordRange& range); | 91 explicit CFX_Edit_Select(const CPVT_WordRange& range); |
92 | 92 |
93 void Default(); | 93 void Default(); |
94 void Set(const CPVT_WordPlace& begin, const CPVT_WordPlace& end); | 94 void Set(const CPVT_WordPlace& begin, const CPVT_WordPlace& end); |
95 void SetBeginPos(const CPVT_WordPlace& begin); | 95 void SetBeginPos(const CPVT_WordPlace& begin); |
96 void SetEndPos(const CPVT_WordPlace& end); | 96 void SetEndPos(const CPVT_WordPlace& end); |
97 | 97 |
98 CPVT_WordRange ConvertToWordRange() const; | 98 CPVT_WordRange ConvertToWordRange() const; |
99 FX_BOOL IsExist() const; | 99 bool IsExist() const; |
100 | 100 |
101 CPVT_WordPlace BeginPos, EndPos; | 101 CPVT_WordPlace BeginPos, EndPos; |
102 }; | 102 }; |
103 | 103 |
104 class CFX_Edit_Undo { | 104 class CFX_Edit_Undo { |
105 public: | 105 public: |
106 explicit CFX_Edit_Undo(int32_t nBufsize); | 106 explicit CFX_Edit_Undo(int32_t nBufsize); |
107 virtual ~CFX_Edit_Undo(); | 107 virtual ~CFX_Edit_Undo(); |
108 | 108 |
109 void Undo(); | 109 void Undo(); |
110 void Redo(); | 110 void Redo(); |
111 | 111 |
112 void AddItem(IFX_Edit_UndoItem* pItem); | 112 void AddItem(IFX_Edit_UndoItem* pItem); |
113 | 113 |
114 FX_BOOL CanUndo() const; | 114 bool CanUndo() const; |
115 FX_BOOL CanRedo() const; | 115 bool CanRedo() const; |
116 FX_BOOL IsModified() const; | 116 bool IsModified() const; |
117 | 117 |
118 void Reset(); | 118 void Reset(); |
119 | 119 |
120 private: | 120 private: |
121 void RemoveHeads(); | 121 void RemoveHeads(); |
122 void RemoveTails(); | 122 void RemoveTails(); |
123 | 123 |
124 private: | 124 private: |
125 CFX_ArrayTemplate<IFX_Edit_UndoItem*> m_UndoItemStack; | 125 CFX_ArrayTemplate<IFX_Edit_UndoItem*> m_UndoItemStack; |
126 | 126 |
127 int32_t m_nCurUndoPos; | 127 int32_t m_nCurUndoPos; |
128 int32_t m_nBufSize; | 128 int32_t m_nBufSize; |
129 FX_BOOL m_bModified; | 129 bool m_bModified; |
130 FX_BOOL m_bVirgin; | 130 bool m_bVirgin; |
131 FX_BOOL m_bWorking; | 131 bool m_bWorking; |
132 }; | 132 }; |
133 | 133 |
134 class IFX_Edit_UndoItem { | 134 class IFX_Edit_UndoItem { |
135 public: | 135 public: |
136 virtual ~IFX_Edit_UndoItem() {} | 136 virtual ~IFX_Edit_UndoItem() {} |
137 | 137 |
138 virtual void Undo() = 0; | 138 virtual void Undo() = 0; |
139 virtual void Redo() = 0; | 139 virtual void Redo() = 0; |
140 virtual CFX_WideString GetUndoTitle() = 0; | 140 virtual CFX_WideString GetUndoTitle() = 0; |
141 }; | 141 }; |
142 | 142 |
143 class CFX_Edit_UndoItem : public IFX_Edit_UndoItem { | 143 class CFX_Edit_UndoItem : public IFX_Edit_UndoItem { |
144 public: | 144 public: |
145 CFX_Edit_UndoItem(); | 145 CFX_Edit_UndoItem(); |
146 ~CFX_Edit_UndoItem() override; | 146 ~CFX_Edit_UndoItem() override; |
147 | 147 |
148 CFX_WideString GetUndoTitle() override; | 148 CFX_WideString GetUndoTitle() override; |
149 | 149 |
150 void SetFirst(FX_BOOL bFirst); | 150 void SetFirst(bool bFirst); |
151 void SetLast(FX_BOOL bLast); | 151 void SetLast(bool bLast); |
152 FX_BOOL IsLast(); | 152 bool IsLast(); |
153 | 153 |
154 private: | 154 private: |
155 FX_BOOL m_bFirst; | 155 bool m_bFirst; |
156 FX_BOOL m_bLast; | 156 bool m_bLast; |
157 }; | 157 }; |
158 | 158 |
159 class CFX_Edit_GroupUndoItem : public IFX_Edit_UndoItem { | 159 class CFX_Edit_GroupUndoItem : public IFX_Edit_UndoItem { |
160 public: | 160 public: |
161 explicit CFX_Edit_GroupUndoItem(const CFX_WideString& sTitle); | 161 explicit CFX_Edit_GroupUndoItem(const CFX_WideString& sTitle); |
162 ~CFX_Edit_GroupUndoItem() override; | 162 ~CFX_Edit_GroupUndoItem() override; |
163 | 163 |
164 // IFX_Edit_UndoItem | 164 // IFX_Edit_UndoItem |
165 void Undo() override; | 165 void Undo() override; |
166 void Redo() override; | 166 void Redo() override; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 248 |
249 class CFXEU_Delete : public CFX_Edit_UndoItem { | 249 class CFXEU_Delete : public CFX_Edit_UndoItem { |
250 public: | 250 public: |
251 CFXEU_Delete(CFX_Edit* pEdit, | 251 CFXEU_Delete(CFX_Edit* pEdit, |
252 const CPVT_WordPlace& wpOldPlace, | 252 const CPVT_WordPlace& wpOldPlace, |
253 const CPVT_WordPlace& wpNewPlace, | 253 const CPVT_WordPlace& wpNewPlace, |
254 uint16_t word, | 254 uint16_t word, |
255 int32_t charset, | 255 int32_t charset, |
256 const CPVT_SecProps& SecProps, | 256 const CPVT_SecProps& SecProps, |
257 const CPVT_WordProps& WordProps, | 257 const CPVT_WordProps& WordProps, |
258 FX_BOOL bSecEnd); | 258 bool bSecEnd); |
259 ~CFXEU_Delete() override; | 259 ~CFXEU_Delete() override; |
260 | 260 |
261 // CFX_Edit_UndoItem | 261 // CFX_Edit_UndoItem |
262 void Redo() override; | 262 void Redo() override; |
263 void Undo() override; | 263 void Undo() override; |
264 | 264 |
265 private: | 265 private: |
266 CFX_Edit* m_pEdit; | 266 CFX_Edit* m_pEdit; |
267 | 267 |
268 CPVT_WordPlace m_wpOld; | 268 CPVT_WordPlace m_wpOld; |
269 CPVT_WordPlace m_wpNew; | 269 CPVT_WordPlace m_wpNew; |
270 uint16_t m_Word; | 270 uint16_t m_Word; |
271 int32_t m_nCharset; | 271 int32_t m_nCharset; |
272 CPVT_SecProps m_SecProps; | 272 CPVT_SecProps m_SecProps; |
273 CPVT_WordProps m_WordProps; | 273 CPVT_WordProps m_WordProps; |
274 FX_BOOL m_bSecEnd; | 274 bool m_bSecEnd; |
275 }; | 275 }; |
276 | 276 |
277 class CFXEU_Clear : public CFX_Edit_UndoItem { | 277 class CFXEU_Clear : public CFX_Edit_UndoItem { |
278 public: | 278 public: |
279 CFXEU_Clear(CFX_Edit* pEdit, | 279 CFXEU_Clear(CFX_Edit* pEdit, |
280 const CPVT_WordRange& wrSel, | 280 const CPVT_WordRange& wrSel, |
281 const CFX_WideString& swText); | 281 const CFX_WideString& swText); |
282 ~CFXEU_Clear() override; | 282 ~CFXEU_Clear() override; |
283 | 283 |
284 // CFX_Edit_UndoItem | 284 // CFX_Edit_UndoItem |
(...skipping 27 matching lines...) Expand all Loading... |
312 CPVT_WordPlace m_wpNew; | 312 CPVT_WordPlace m_wpNew; |
313 CFX_WideString m_swText; | 313 CFX_WideString m_swText; |
314 int32_t m_nCharset; | 314 int32_t m_nCharset; |
315 }; | 315 }; |
316 | 316 |
317 class CFX_Edit { | 317 class CFX_Edit { |
318 public: | 318 public: |
319 static CFX_ByteString GetEditAppearanceStream(CFX_Edit* pEdit, | 319 static CFX_ByteString GetEditAppearanceStream(CFX_Edit* pEdit, |
320 const CFX_FloatPoint& ptOffset, | 320 const CFX_FloatPoint& ptOffset, |
321 const CPVT_WordRange* pRange, | 321 const CPVT_WordRange* pRange, |
322 FX_BOOL bContinuous, | 322 bool bContinuous, |
323 uint16_t SubWord); | 323 uint16_t SubWord); |
324 static CFX_ByteString GetSelectAppearanceStream( | 324 static CFX_ByteString GetSelectAppearanceStream( |
325 CFX_Edit* pEdit, | 325 CFX_Edit* pEdit, |
326 const CFX_FloatPoint& ptOffset, | 326 const CFX_FloatPoint& ptOffset, |
327 const CPVT_WordRange* pRange); | 327 const CPVT_WordRange* pRange); |
328 static void DrawEdit(CFX_RenderDevice* pDevice, | 328 static void DrawEdit(CFX_RenderDevice* pDevice, |
329 CFX_Matrix* pUser2Device, | 329 CFX_Matrix* pUser2Device, |
330 CFX_Edit* pEdit, | 330 CFX_Edit* pEdit, |
331 FX_COLORREF crTextFill, | 331 FX_COLORREF crTextFill, |
332 FX_COLORREF crTextStroke, | 332 FX_COLORREF crTextStroke, |
(...skipping 20 matching lines...) Expand all Loading... |
353 // Returns an iterator for the contents. Should not be released. | 353 // Returns an iterator for the contents. Should not be released. |
354 CFX_Edit_Iterator* GetIterator(); | 354 CFX_Edit_Iterator* GetIterator(); |
355 IPVT_FontMap* GetFontMap(); | 355 IPVT_FontMap* GetFontMap(); |
356 void Initialize(); | 356 void Initialize(); |
357 | 357 |
358 // Set the bounding box of the text area. | 358 // Set the bounding box of the text area. |
359 void SetPlateRect(const CFX_FloatRect& rect); | 359 void SetPlateRect(const CFX_FloatRect& rect); |
360 void SetScrollPos(const CFX_FloatPoint& point); | 360 void SetScrollPos(const CFX_FloatPoint& point); |
361 | 361 |
362 // Set the horizontal text alignment. (nFormat [0:left, 1:middle, 2:right]) | 362 // Set the horizontal text alignment. (nFormat [0:left, 1:middle, 2:right]) |
363 void SetAlignmentH(int32_t nFormat, FX_BOOL bPaint); | 363 void SetAlignmentH(int32_t nFormat, bool bPaint); |
364 // Set the vertical text alignment. (nFormat [0:left, 1:middle, 2:right]) | 364 // Set the vertical text alignment. (nFormat [0:left, 1:middle, 2:right]) |
365 void SetAlignmentV(int32_t nFormat, FX_BOOL bPaint); | 365 void SetAlignmentV(int32_t nFormat, bool bPaint); |
366 | 366 |
367 // Set the substitution character for hidden text. | 367 // Set the substitution character for hidden text. |
368 void SetPasswordChar(uint16_t wSubWord, FX_BOOL bPaint); | 368 void SetPasswordChar(uint16_t wSubWord, bool bPaint); |
369 | 369 |
370 // Set the maximum number of words in the text. | 370 // Set the maximum number of words in the text. |
371 void SetLimitChar(int32_t nLimitChar); | 371 void SetLimitChar(int32_t nLimitChar); |
372 void SetCharArray(int32_t nCharArray); | 372 void SetCharArray(int32_t nCharArray); |
373 void SetCharSpace(FX_FLOAT fCharSpace); | 373 void SetCharSpace(FX_FLOAT fCharSpace); |
374 void SetMultiLine(FX_BOOL bMultiLine, FX_BOOL bPaint); | 374 void SetMultiLine(bool bMultiLine, bool bPaint); |
375 void SetAutoReturn(FX_BOOL bAuto, FX_BOOL bPaint); | 375 void SetAutoReturn(bool bAuto, bool bPaint); |
376 void SetAutoFontSize(FX_BOOL bAuto, FX_BOOL bPaint); | 376 void SetAutoFontSize(bool bAuto, bool bPaint); |
377 void SetAutoScroll(FX_BOOL bAuto, FX_BOOL bPaint); | 377 void SetAutoScroll(bool bAuto, bool bPaint); |
378 void SetFontSize(FX_FLOAT fFontSize); | 378 void SetFontSize(FX_FLOAT fFontSize); |
379 void SetTextOverflow(FX_BOOL bAllowed, FX_BOOL bPaint); | 379 void SetTextOverflow(bool bAllowed, bool bPaint); |
380 void OnMouseDown(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl); | 380 void OnMouseDown(const CFX_FloatPoint& point, bool bShift, bool bCtrl); |
381 void OnMouseMove(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl); | 381 void OnMouseMove(const CFX_FloatPoint& point, bool bShift, bool bCtrl); |
382 void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl); | 382 void OnVK_UP(bool bShift, bool bCtrl); |
383 void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl); | 383 void OnVK_DOWN(bool bShift, bool bCtrl); |
384 void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl); | 384 void OnVK_LEFT(bool bShift, bool bCtrl); |
385 void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl); | 385 void OnVK_RIGHT(bool bShift, bool bCtrl); |
386 void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl); | 386 void OnVK_HOME(bool bShift, bool bCtrl); |
387 void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl); | 387 void OnVK_END(bool bShift, bool bCtrl); |
388 void SetText(const CFX_WideString& sText); | 388 void SetText(const CFX_WideString& sText); |
389 FX_BOOL InsertWord(uint16_t word, int32_t charset); | 389 bool InsertWord(uint16_t word, int32_t charset); |
390 FX_BOOL InsertReturn(); | 390 bool InsertReturn(); |
391 FX_BOOL Backspace(); | 391 bool Backspace(); |
392 FX_BOOL Delete(); | 392 bool Delete(); |
393 FX_BOOL Clear(); | 393 bool Clear(); |
394 FX_BOOL InsertText(const CFX_WideString& sText, int32_t charset); | 394 bool InsertText(const CFX_WideString& sText, int32_t charset); |
395 FX_BOOL Redo(); | 395 bool Redo(); |
396 FX_BOOL Undo(); | 396 bool Undo(); |
397 int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const; | 397 int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const; |
398 CPVT_WordPlace WordIndexToWordPlace(int32_t index) const; | 398 CPVT_WordPlace WordIndexToWordPlace(int32_t index) const; |
399 CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const; | 399 CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const; |
400 int32_t GetCaret() const; | 400 int32_t GetCaret() const; |
401 CPVT_WordPlace GetCaretWordPlace() const; | 401 CPVT_WordPlace GetCaretWordPlace() const; |
402 CFX_WideString GetSelText() const; | 402 CFX_WideString GetSelText() const; |
403 CFX_WideString GetText() const; | 403 CFX_WideString GetText() const; |
404 FX_FLOAT GetFontSize() const; | 404 FX_FLOAT GetFontSize() const; |
405 uint16_t GetPasswordChar() const; | 405 uint16_t GetPasswordChar() const; |
406 CFX_FloatPoint GetScrollPos() const; | 406 CFX_FloatPoint GetScrollPos() const; |
407 int32_t GetCharArray() const; | 407 int32_t GetCharArray() const; |
408 CFX_FloatRect GetContentRect() const; | 408 CFX_FloatRect GetContentRect() const; |
409 CFX_WideString GetRangeText(const CPVT_WordRange& range) const; | 409 CFX_WideString GetRangeText(const CPVT_WordRange& range) const; |
410 int32_t GetHorzScale() const; | 410 int32_t GetHorzScale() const; |
411 FX_FLOAT GetCharSpace() const; | 411 FX_FLOAT GetCharSpace() const; |
412 int32_t GetTotalWords() const; | 412 int32_t GetTotalWords() const; |
413 void SetSel(int32_t nStartChar, int32_t nEndChar); | 413 void SetSel(int32_t nStartChar, int32_t nEndChar); |
414 void GetSel(int32_t& nStartChar, int32_t& nEndChar) const; | 414 void GetSel(int32_t& nStartChar, int32_t& nEndChar) const; |
415 void SelectAll(); | 415 void SelectAll(); |
416 void SelectNone(); | 416 void SelectNone(); |
417 FX_BOOL IsSelected() const; | 417 bool IsSelected() const; |
418 void Paint(); | 418 void Paint(); |
419 void EnableRefresh(FX_BOOL bRefresh); | 419 void EnableRefresh(bool bRefresh); |
420 void RefreshWordRange(const CPVT_WordRange& wr); | 420 void RefreshWordRange(const CPVT_WordRange& wr); |
421 void SetCaret(int32_t nPos); | 421 void SetCaret(int32_t nPos); |
422 CPVT_WordRange GetWholeWordRange() const; | 422 CPVT_WordRange GetWholeWordRange() const; |
423 CPVT_WordRange GetSelectWordRange() const; | 423 CPVT_WordRange GetSelectWordRange() const; |
424 void EnableUndo(FX_BOOL bUndo); | 424 void EnableUndo(bool bUndo); |
425 void EnableOprNotify(FX_BOOL bNotify); | 425 void EnableOprNotify(bool bNotify); |
426 FX_BOOL IsTextFull() const; | 426 bool IsTextFull() const; |
427 FX_BOOL IsTextOverflow() const; | 427 bool IsTextOverflow() const; |
428 FX_BOOL CanUndo() const; | 428 bool CanUndo() const; |
429 FX_BOOL CanRedo() const; | 429 bool CanRedo() const; |
430 CPVT_WordRange GetVisibleWordRange() const; | 430 CPVT_WordRange GetVisibleWordRange() const; |
431 | 431 |
432 FX_BOOL Empty(); | 432 bool Empty(); |
433 | 433 |
434 CPVT_WordPlace DoInsertText(const CPVT_WordPlace& place, | 434 CPVT_WordPlace DoInsertText(const CPVT_WordPlace& place, |
435 const CFX_WideString& sText, | 435 const CFX_WideString& sText, |
436 int32_t charset); | 436 int32_t charset); |
437 int32_t GetCharSetFromUnicode(uint16_t word, int32_t nOldCharset); | 437 int32_t GetCharSetFromUnicode(uint16_t word, int32_t nOldCharset); |
438 | 438 |
439 int32_t GetTotalLines() const; | 439 int32_t GetTotalLines() const; |
440 | 440 |
441 private: | 441 private: |
442 friend class CFX_Edit_Iterator; | 442 friend class CFX_Edit_Iterator; |
443 friend class CFXEU_InsertWord; | 443 friend class CFXEU_InsertWord; |
444 friend class CFXEU_InsertReturn; | 444 friend class CFXEU_InsertReturn; |
445 friend class CFXEU_Backspace; | 445 friend class CFXEU_Backspace; |
446 friend class CFXEU_Delete; | 446 friend class CFXEU_Delete; |
447 friend class CFXEU_Clear; | 447 friend class CFXEU_Clear; |
448 friend class CFXEU_InsertText; | 448 friend class CFXEU_InsertText; |
449 | 449 |
450 void SetSel(const CPVT_WordPlace& begin, const CPVT_WordPlace& end); | 450 void SetSel(const CPVT_WordPlace& begin, const CPVT_WordPlace& end); |
451 | 451 |
452 void RearrangeAll(); | 452 void RearrangeAll(); |
453 void RearrangePart(const CPVT_WordRange& range); | 453 void RearrangePart(const CPVT_WordRange& range); |
454 void ScrollToCaret(); | 454 void ScrollToCaret(); |
455 void SetScrollInfo(); | 455 void SetScrollInfo(); |
456 void SetScrollPosX(FX_FLOAT fx); | 456 void SetScrollPosX(FX_FLOAT fx); |
457 void SetScrollPosY(FX_FLOAT fy); | 457 void SetScrollPosY(FX_FLOAT fy); |
458 void SetScrollLimit(); | 458 void SetScrollLimit(); |
459 void SetContentChanged(); | 459 void SetContentChanged(); |
460 | 460 |
461 FX_BOOL InsertWord(uint16_t word, | 461 bool InsertWord(uint16_t word, |
462 int32_t charset, | 462 int32_t charset, |
463 const CPVT_WordProps* pWordProps, | 463 const CPVT_WordProps* pWordProps, |
464 FX_BOOL bAddUndo, | 464 bool bAddUndo, |
465 FX_BOOL bPaint); | 465 bool bPaint); |
466 FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps, | 466 bool InsertReturn(const CPVT_SecProps* pSecProps, |
467 const CPVT_WordProps* pWordProps, | 467 const CPVT_WordProps* pWordProps, |
468 FX_BOOL bAddUndo, | 468 bool bAddUndo, |
469 FX_BOOL bPaint); | 469 bool bPaint); |
470 FX_BOOL Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint); | 470 bool Backspace(bool bAddUndo, bool bPaint); |
471 FX_BOOL Delete(FX_BOOL bAddUndo, FX_BOOL bPaint); | 471 bool Delete(bool bAddUndo, bool bPaint); |
472 FX_BOOL Clear(FX_BOOL bAddUndo, FX_BOOL bPaint); | 472 bool Clear(bool bAddUndo, bool bPaint); |
473 FX_BOOL InsertText(const CFX_WideString& sText, | 473 bool InsertText(const CFX_WideString& sText, |
474 int32_t charset, | 474 int32_t charset, |
475 FX_BOOL bAddUndo, | 475 bool bAddUndo, |
476 FX_BOOL bPaint); | 476 bool bPaint); |
477 void PaintInsertText(const CPVT_WordPlace& wpOld, | 477 void PaintInsertText(const CPVT_WordPlace& wpOld, |
478 const CPVT_WordPlace& wpNew); | 478 const CPVT_WordPlace& wpNew); |
479 | 479 |
480 inline CFX_FloatPoint VTToEdit(const CFX_FloatPoint& point) const; | 480 inline CFX_FloatPoint VTToEdit(const CFX_FloatPoint& point) const; |
481 inline CFX_FloatPoint EditToVT(const CFX_FloatPoint& point) const; | 481 inline CFX_FloatPoint EditToVT(const CFX_FloatPoint& point) const; |
482 inline CFX_FloatRect VTToEdit(const CFX_FloatRect& rect) const; | 482 inline CFX_FloatRect VTToEdit(const CFX_FloatRect& rect) const; |
483 | 483 |
484 void Refresh(); | 484 void Refresh(); |
485 void RefreshPushLineRects(const CPVT_WordRange& wr); | 485 void RefreshPushLineRects(const CPVT_WordRange& wr); |
486 | 486 |
487 void SetCaret(const CPVT_WordPlace& place); | 487 void SetCaret(const CPVT_WordPlace& place); |
488 void SetCaretInfo(); | 488 void SetCaretInfo(); |
489 void SetCaretOrigin(); | 489 void SetCaretOrigin(); |
490 | 490 |
491 void AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem); | 491 void AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem); |
492 | 492 |
493 private: | 493 private: |
494 std::unique_ptr<CPDF_VariableText> m_pVT; | 494 std::unique_ptr<CPDF_VariableText> m_pVT; |
495 CPWL_EditCtrl* m_pNotify; | 495 CPWL_EditCtrl* m_pNotify; |
496 CPWL_Edit* m_pOprNotify; | 496 CPWL_Edit* m_pOprNotify; |
497 std::unique_ptr<CFX_Edit_Provider> m_pVTProvider; | 497 std::unique_ptr<CFX_Edit_Provider> m_pVTProvider; |
498 | 498 |
499 CPVT_WordPlace m_wpCaret; | 499 CPVT_WordPlace m_wpCaret; |
500 CPVT_WordPlace m_wpOldCaret; | 500 CPVT_WordPlace m_wpOldCaret; |
501 CFX_Edit_Select m_SelState; | 501 CFX_Edit_Select m_SelState; |
502 | 502 |
503 CFX_FloatPoint m_ptScrollPos; | 503 CFX_FloatPoint m_ptScrollPos; |
504 CFX_FloatPoint m_ptRefreshScrollPos; | 504 CFX_FloatPoint m_ptRefreshScrollPos; |
505 FX_BOOL m_bEnableScroll; | 505 bool m_bEnableScroll; |
506 std::unique_ptr<CFX_Edit_Iterator> m_pIterator; | 506 std::unique_ptr<CFX_Edit_Iterator> m_pIterator; |
507 CFX_Edit_Refresh m_Refresh; | 507 CFX_Edit_Refresh m_Refresh; |
508 CFX_FloatPoint m_ptCaret; | 508 CFX_FloatPoint m_ptCaret; |
509 CFX_Edit_Undo m_Undo; | 509 CFX_Edit_Undo m_Undo; |
510 int32_t m_nAlignment; | 510 int32_t m_nAlignment; |
511 FX_BOOL m_bNotifyFlag; | 511 bool m_bNotifyFlag; |
512 FX_BOOL m_bEnableOverflow; | 512 bool m_bEnableOverflow; |
513 FX_BOOL m_bEnableRefresh; | 513 bool m_bEnableRefresh; |
514 CFX_FloatRect m_rcOldContent; | 514 CFX_FloatRect m_rcOldContent; |
515 FX_BOOL m_bEnableUndo; | 515 bool m_bEnableUndo; |
516 FX_BOOL m_bOprNotify; | 516 bool m_bOprNotify; |
517 CFX_Edit_GroupUndoItem* m_pGroupUndoItem; | 517 CFX_Edit_GroupUndoItem* m_pGroupUndoItem; |
518 }; | 518 }; |
519 | 519 |
520 class CFX_Edit_Iterator { | 520 class CFX_Edit_Iterator { |
521 public: | 521 public: |
522 CFX_Edit_Iterator(CFX_Edit* pEdit, CPDF_VariableText::Iterator* pVTIterator); | 522 CFX_Edit_Iterator(CFX_Edit* pEdit, CPDF_VariableText::Iterator* pVTIterator); |
523 ~CFX_Edit_Iterator(); | 523 ~CFX_Edit_Iterator(); |
524 | 524 |
525 FX_BOOL NextWord(); | 525 bool NextWord(); |
526 FX_BOOL PrevWord(); | 526 bool PrevWord(); |
527 FX_BOOL GetWord(CPVT_Word& word) const; | 527 bool GetWord(CPVT_Word& word) const; |
528 FX_BOOL GetLine(CPVT_Line& line) const; | 528 bool GetLine(CPVT_Line& line) const; |
529 FX_BOOL GetSection(CPVT_Section& section) const; | 529 bool GetSection(CPVT_Section& section) const; |
530 void SetAt(int32_t nWordIndex); | 530 void SetAt(int32_t nWordIndex); |
531 void SetAt(const CPVT_WordPlace& place); | 531 void SetAt(const CPVT_WordPlace& place); |
532 const CPVT_WordPlace& GetAt() const; | 532 const CPVT_WordPlace& GetAt() const; |
533 | 533 |
534 private: | 534 private: |
535 CFX_Edit* m_pEdit; | 535 CFX_Edit* m_pEdit; |
536 CPDF_VariableText::Iterator* m_pVTIterator; | 536 CPDF_VariableText::Iterator* m_pVTIterator; |
537 }; | 537 }; |
538 | 538 |
539 class CFX_Edit_Provider : public CPDF_VariableText::Provider { | 539 class CFX_Edit_Provider : public CPDF_VariableText::Provider { |
540 public: | 540 public: |
541 explicit CFX_Edit_Provider(IPVT_FontMap* pFontMap); | 541 explicit CFX_Edit_Provider(IPVT_FontMap* pFontMap); |
542 ~CFX_Edit_Provider() override; | 542 ~CFX_Edit_Provider() override; |
543 | 543 |
544 IPVT_FontMap* GetFontMap(); | 544 IPVT_FontMap* GetFontMap(); |
545 | 545 |
546 // CPDF_VariableText::Provider: | 546 // CPDF_VariableText::Provider: |
547 int32_t GetCharWidth(int32_t nFontIndex, uint16_t word) override; | 547 int32_t GetCharWidth(int32_t nFontIndex, uint16_t word) override; |
548 int32_t GetTypeAscent(int32_t nFontIndex) override; | 548 int32_t GetTypeAscent(int32_t nFontIndex) override; |
549 int32_t GetTypeDescent(int32_t nFontIndex) override; | 549 int32_t GetTypeDescent(int32_t nFontIndex) override; |
550 int32_t GetWordFontIndex(uint16_t word, | 550 int32_t GetWordFontIndex(uint16_t word, |
551 int32_t charset, | 551 int32_t charset, |
552 int32_t nFontIndex) override; | 552 int32_t nFontIndex) override; |
553 int32_t GetDefaultFontIndex() override; | 553 int32_t GetDefaultFontIndex() override; |
554 FX_BOOL IsLatinWord(uint16_t word) override; | 554 bool IsLatinWord(uint16_t word) override; |
555 | 555 |
556 private: | 556 private: |
557 IPVT_FontMap* m_pFontMap; | 557 IPVT_FontMap* m_pFontMap; |
558 }; | 558 }; |
559 | 559 |
560 #endif // FPDFSDK_FXEDIT_FXET_EDIT_H_ | 560 #endif // FPDFSDK_FXEDIT_FXET_EDIT_H_ |
OLD | NEW |