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_INCLUDE_FXET_EDIT_H_ | 7 #ifndef FPDFSDK_FXEDIT_INCLUDE_FXET_EDIT_H_ |
8 #define FPDFSDK_FXEDIT_INCLUDE_FXET_EDIT_H_ | 8 #define FPDFSDK_FXEDIT_INCLUDE_FXET_EDIT_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "core/fpdfdoc/include/cpvt_secprops.h" | 12 #include "core/fpdfdoc/include/cpvt_secprops.h" |
13 #include "core/fpdfdoc/include/cpvt_wordprops.h" | 13 #include "core/fpdfdoc/include/cpvt_wordprops.h" |
14 #include "fpdfsdk/fxedit/include/fx_edit.h" | 14 #include "fpdfsdk/fxedit/include/fx_edit.h" |
15 | 15 |
| 16 class CPDF_PageObjectHolder; |
| 17 class CPDF_TextObject; |
| 18 class CPWL_Edit; |
| 19 class CPWL_EditCtrl; |
16 class CFX_Edit; | 20 class CFX_Edit; |
17 class CFX_Edit_Iterator; | 21 class CFX_Edit_Iterator; |
18 class CFX_Edit_Provider; | 22 class CFX_Edit_Provider; |
| 23 class CFX_RenderDevice; |
| 24 class CFX_SystemHandler; |
| 25 class IFX_Edit_UndoItem; |
19 | 26 |
20 #define FX_EDIT_IsFloatZero(f) (f < 0.0001 && f > -0.0001) | 27 #define FX_EDIT_IsFloatZero(f) (f < 0.0001 && f > -0.0001) |
21 #define FX_EDIT_IsFloatEqual(fa, fb) FX_EDIT_IsFloatZero(fa - fb) | 28 #define FX_EDIT_IsFloatEqual(fa, fb) FX_EDIT_IsFloatZero(fa - fb) |
22 #define FX_EDIT_IsFloatBigger(fa, fb) (fa > fb && !FX_EDIT_IsFloatEqual(fa, fb)) | 29 #define FX_EDIT_IsFloatBigger(fa, fb) (fa > fb && !FX_EDIT_IsFloatEqual(fa, fb)) |
23 #define FX_EDIT_IsFloatSmaller(fa, fb) \ | 30 #define FX_EDIT_IsFloatSmaller(fa, fb) \ |
24 (fa < fb && !FX_EDIT_IsFloatEqual(fa, fb)) | 31 (fa < fb && !FX_EDIT_IsFloatEqual(fa, fb)) |
25 | 32 |
26 enum REFRESH_PLAN_E { RP_ANALYSE, RP_NOANALYSE, RP_OPTIONAL }; | 33 enum REFRESH_PLAN_E { RP_ANALYSE, RP_NOANALYSE, RP_OPTIONAL }; |
27 | 34 |
28 enum EDIT_PROPS_E { | 35 enum EDIT_PROPS_E { |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 private: | 178 private: |
172 CFX_ArrayTemplate<IFX_Edit_UndoItem*> m_UndoItemStack; | 179 CFX_ArrayTemplate<IFX_Edit_UndoItem*> m_UndoItemStack; |
173 | 180 |
174 int32_t m_nCurUndoPos; | 181 int32_t m_nCurUndoPos; |
175 int32_t m_nBufSize; | 182 int32_t m_nBufSize; |
176 FX_BOOL m_bModified; | 183 FX_BOOL m_bModified; |
177 FX_BOOL m_bVirgin; | 184 FX_BOOL m_bVirgin; |
178 FX_BOOL m_bWorking; | 185 FX_BOOL m_bWorking; |
179 }; | 186 }; |
180 | 187 |
| 188 class IFX_Edit_UndoItem { |
| 189 public: |
| 190 virtual ~IFX_Edit_UndoItem() {} |
| 191 |
| 192 virtual void Undo() = 0; |
| 193 virtual void Redo() = 0; |
| 194 virtual CFX_WideString GetUndoTitle() = 0; |
| 195 }; |
| 196 |
181 class CFX_Edit_UndoItem : public IFX_Edit_UndoItem { | 197 class CFX_Edit_UndoItem : public IFX_Edit_UndoItem { |
182 public: | 198 public: |
183 CFX_Edit_UndoItem(); | 199 CFX_Edit_UndoItem(); |
184 ~CFX_Edit_UndoItem() override; | 200 ~CFX_Edit_UndoItem() override; |
185 | 201 |
186 CFX_WideString GetUndoTitle() override; | 202 CFX_WideString GetUndoTitle() override; |
187 | 203 |
188 void SetFirst(FX_BOOL bFirst); | 204 void SetFirst(FX_BOOL bFirst); |
189 FX_BOOL IsFirst(); | 205 FX_BOOL IsFirst(); |
190 void SetLast(FX_BOOL bLast); | 206 void SetLast(FX_BOOL bLast); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 CFX_Edit* m_pEdit; | 366 CFX_Edit* m_pEdit; |
351 | 367 |
352 CPVT_WordPlace m_wpOld; | 368 CPVT_WordPlace m_wpOld; |
353 CPVT_WordPlace m_wpNew; | 369 CPVT_WordPlace m_wpNew; |
354 CFX_WideString m_swText; | 370 CFX_WideString m_swText; |
355 int32_t m_nCharset; | 371 int32_t m_nCharset; |
356 CPVT_SecProps m_SecProps; | 372 CPVT_SecProps m_SecProps; |
357 CPVT_WordProps m_WordProps; | 373 CPVT_WordProps m_WordProps; |
358 }; | 374 }; |
359 | 375 |
360 class CFX_Edit : public IFX_Edit { | 376 class CFX_Edit { |
361 friend class CFX_Edit_Iterator; | 377 public: |
362 friend class CFXEU_InsertWord; | 378 static CFX_ByteString GetEditAppearanceStream( |
363 friend class CFXEU_InsertReturn; | 379 CFX_Edit* pEdit, |
364 friend class CFXEU_Backspace; | 380 const CFX_FloatPoint& ptOffset, |
365 friend class CFXEU_Delete; | 381 const CPVT_WordRange* pRange = nullptr, |
366 friend class CFXEU_Clear; | 382 FX_BOOL bContinuous = TRUE, |
367 friend class CFXEU_InsertText; | 383 uint16_t SubWord = 0); |
| 384 static CFX_ByteString GetSelectAppearanceStream( |
| 385 CFX_Edit* pEdit, |
| 386 const CFX_FloatPoint& ptOffset, |
| 387 const CPVT_WordRange* pRange = nullptr); |
| 388 static void DrawEdit(CFX_RenderDevice* pDevice, |
| 389 CFX_Matrix* pUser2Device, |
| 390 CFX_Edit* pEdit, |
| 391 FX_COLORREF crTextFill, |
| 392 FX_COLORREF crTextStroke, |
| 393 const CFX_FloatRect& rcClip, |
| 394 const CFX_FloatPoint& ptOffset, |
| 395 const CPVT_WordRange* pRange, |
| 396 CFX_SystemHandler* pSystemHandler, |
| 397 void* pFFLData); |
| 398 static void DrawUnderline(CFX_RenderDevice* pDevice, |
| 399 CFX_Matrix* pUser2Device, |
| 400 CFX_Edit* pEdit, |
| 401 FX_COLORREF color, |
| 402 const CFX_FloatRect& rcClip, |
| 403 const CFX_FloatPoint& ptOffset, |
| 404 const CPVT_WordRange* pRange); |
| 405 static void DrawRichEdit(CFX_RenderDevice* pDevice, |
| 406 CFX_Matrix* pUser2Device, |
| 407 CFX_Edit* pEdit, |
| 408 const CFX_FloatRect& rcClip, |
| 409 const CFX_FloatPoint& ptOffset, |
| 410 const CPVT_WordRange* pRange); |
| 411 static void GeneratePageObjects( |
| 412 CPDF_PageObjectHolder* pObjectHolder, |
| 413 CFX_Edit* pEdit, |
| 414 const CFX_FloatPoint& ptOffset, |
| 415 const CPVT_WordRange* pRange, |
| 416 FX_COLORREF crText, |
| 417 CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray); |
| 418 static void GenerateRichPageObjects( |
| 419 CPDF_PageObjectHolder* pObjectHolder, |
| 420 CFX_Edit* pEdit, |
| 421 const CFX_FloatPoint& ptOffset, |
| 422 const CPVT_WordRange* pRange, |
| 423 CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray); |
| 424 static void GenerateUnderlineObjects(CPDF_PageObjectHolder* pObjectHolder, |
| 425 CFX_Edit* pEdit, |
| 426 const CFX_FloatPoint& ptOffset, |
| 427 const CPVT_WordRange* pRange, |
| 428 FX_COLORREF color); |
368 | 429 |
369 public: | 430 CFX_Edit(); |
370 explicit CFX_Edit(CPDF_VariableText* pVT); | 431 ~CFX_Edit(); |
371 ~CFX_Edit() override; | |
372 | 432 |
373 // IFX_Edit | 433 void SetFontMap(IPVT_FontMap* pFontMap); |
374 void SetFontMap(IPVT_FontMap* pFontMap) override; | 434 void SetNotify(CPWL_EditCtrl* pNotify); |
375 void SetNotify(IFX_Edit_Notify* pNotify) override; | 435 void SetOprNotify(CPWL_Edit* pOprNotify); |
376 void SetOprNotify(IFX_Edit_OprNotify* pOprNotify) override; | 436 |
377 IFX_Edit_Iterator* GetIterator() override; | 437 // Returns an iterator for the contents. Should not be released. |
378 CPDF_VariableText* GetVariableText() override; | 438 CFX_Edit_Iterator* GetIterator(); |
379 IPVT_FontMap* GetFontMap() override; | 439 CPDF_VariableText* GetVariableText(); |
380 void Initialize() override; | 440 IPVT_FontMap* GetFontMap(); |
381 void SetPlateRect(const CFX_FloatRect& rect, FX_BOOL bPaint = TRUE) override; | 441 void Initialize(); |
382 void SetScrollPos(const CFX_FloatPoint& point) override; | 442 |
383 void SetAlignmentH(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) override; | 443 // Set the bounding box of the text area. |
384 void SetAlignmentV(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) override; | 444 void SetPlateRect(const CFX_FloatRect& rect, FX_BOOL bPaint = TRUE); |
385 void SetPasswordChar(uint16_t wSubWord = '*', FX_BOOL bPaint = TRUE) override; | 445 void SetScrollPos(const CFX_FloatPoint& point); |
386 void SetLimitChar(int32_t nLimitChar = 0, FX_BOOL bPaint = TRUE) override; | 446 |
387 void SetCharArray(int32_t nCharArray = 0, FX_BOOL bPaint = TRUE) override; | 447 // Set the horizontal text alignment. (nFormat [0:left, 1:middle, 2:right]) |
388 void SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE) override; | 448 void SetAlignmentH(int32_t nFormat = 0, FX_BOOL bPaint = TRUE); |
389 void SetHorzScale(int32_t nHorzScale = 100, FX_BOOL bPaint = TRUE) override; | 449 // Set the vertical text alignment. (nFormat [0:left, 1:middle, 2:right]) |
390 void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE) override; | 450 void SetAlignmentV(int32_t nFormat = 0, FX_BOOL bPaint = TRUE); |
391 void SetMultiLine(FX_BOOL bMultiLine = TRUE, FX_BOOL bPaint = TRUE) override; | 451 |
392 void SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) override; | 452 // Set the substitution character for hidden text. |
393 void SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) override; | 453 void SetPasswordChar(uint16_t wSubWord = '*', FX_BOOL bPaint = TRUE); |
394 void SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) override; | 454 |
395 void SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE) override; | 455 // Set the maximum number of words in the text. |
396 void SetTextOverflow(FX_BOOL bAllowed = FALSE, | 456 void SetLimitChar(int32_t nLimitChar = 0, FX_BOOL bPaint = TRUE); |
397 FX_BOOL bPaint = TRUE) override; | 457 void SetCharArray(int32_t nCharArray = 0, FX_BOOL bPaint = TRUE); |
398 void OnMouseDown(const CFX_FloatPoint& point, | 458 void SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE); |
399 FX_BOOL bShift, | 459 void SetHorzScale(int32_t nHorzScale = 100, FX_BOOL bPaint = TRUE); |
400 FX_BOOL bCtrl) override; | 460 void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE); |
401 void OnMouseMove(const CFX_FloatPoint& point, | 461 void SetMultiLine(FX_BOOL bMultiLine = TRUE, FX_BOOL bPaint = TRUE); |
402 FX_BOOL bShift, | 462 void SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE); |
403 FX_BOOL bCtrl) override; | 463 void SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE); |
404 void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) override; | 464 void SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE); |
405 void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl) override; | 465 void SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE); |
406 void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl) override; | 466 void SetTextOverflow(FX_BOOL bAllowed = FALSE, FX_BOOL bPaint = TRUE); |
407 void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) override; | 467 FX_BOOL IsRichText() const; |
408 void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) override; | 468 void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE); |
409 void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) override; | 469 FX_BOOL SetRichFontSize(FX_FLOAT fFontSize); |
| 470 FX_BOOL SetRichFontIndex(int32_t nFontIndex); |
| 471 FX_BOOL SetRichTextColor(FX_COLORREF dwColor); |
| 472 FX_BOOL SetRichTextScript(CPDF_VariableText::ScriptType nScriptType); |
| 473 FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE); |
| 474 FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE); |
| 475 FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE); |
| 476 FX_BOOL SetRichTextCrossout(FX_BOOL bCrossout = TRUE); |
| 477 FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace); |
| 478 FX_BOOL SetRichTextHorzScale(int32_t nHorzScale = 100); |
| 479 FX_BOOL SetRichTextLineLeading(FX_FLOAT fLineLeading); |
| 480 FX_BOOL SetRichTextLineIndent(FX_FLOAT fLineIndent); |
| 481 FX_BOOL SetRichTextAlignment(int32_t nAlignment); |
| 482 void OnMouseDown(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl); |
| 483 void OnMouseMove(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl); |
| 484 void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl); |
| 485 void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl); |
| 486 void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl); |
| 487 void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl); |
| 488 void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl); |
| 489 void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl); |
410 void SetText(const FX_WCHAR* text, | 490 void SetText(const FX_WCHAR* text, |
411 int32_t charset = DEFAULT_CHARSET, | 491 int32_t charset = DEFAULT_CHARSET, |
412 const CPVT_SecProps* pSecProps = nullptr, | 492 const CPVT_SecProps* pSecProps = nullptr, |
413 const CPVT_WordProps* pWordProps = nullptr) override; | 493 const CPVT_WordProps* pWordProps = nullptr); |
414 FX_BOOL InsertWord(uint16_t word, | 494 FX_BOOL InsertWord(uint16_t word, |
415 int32_t charset = DEFAULT_CHARSET, | 495 int32_t charset = DEFAULT_CHARSET, |
416 const CPVT_WordProps* pWordProps = nullptr) override; | 496 const CPVT_WordProps* pWordProps = nullptr); |
417 FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps = nullptr, | 497 FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps = nullptr, |
418 const CPVT_WordProps* pWordProps = nullptr) override; | 498 const CPVT_WordProps* pWordProps = nullptr); |
419 FX_BOOL Backspace() override; | 499 FX_BOOL Backspace(); |
420 FX_BOOL Delete() override; | 500 FX_BOOL Delete(); |
421 FX_BOOL Clear() override; | 501 FX_BOOL Clear(); |
422 FX_BOOL InsertText(const FX_WCHAR* text, | 502 FX_BOOL InsertText(const FX_WCHAR* text, |
423 int32_t charset = DEFAULT_CHARSET, | 503 int32_t charset = DEFAULT_CHARSET, |
424 const CPVT_SecProps* pSecProps = nullptr, | 504 const CPVT_SecProps* pSecProps = nullptr, |
425 const CPVT_WordProps* pWordProps = nullptr) override; | 505 const CPVT_WordProps* pWordProps = nullptr); |
426 FX_BOOL Redo() override; | 506 FX_BOOL Redo(); |
427 FX_BOOL Undo() override; | 507 FX_BOOL Undo(); |
428 int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const override; | 508 int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const; |
429 CPVT_WordPlace WordIndexToWordPlace(int32_t index) const override; | 509 CPVT_WordPlace WordIndexToWordPlace(int32_t index) const; |
430 CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace& place) const override; | 510 CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace& place) const; |
431 CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace& place) const override; | 511 CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace& place) const; |
432 CPVT_WordPlace GetSectionBeginPlace( | 512 CPVT_WordPlace GetSectionBeginPlace(const CPVT_WordPlace& place) const; |
433 const CPVT_WordPlace& place) const override; | 513 CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace& place) const; |
434 CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace& place) const override; | 514 CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const; |
435 CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const override; | 515 int32_t GetCaret() const; |
436 int32_t GetCaret() const override; | 516 CPVT_WordPlace GetCaretWordPlace() const; |
437 CPVT_WordPlace GetCaretWordPlace() const override; | 517 CFX_WideString GetSelText() const; |
438 CFX_WideString GetSelText() const override; | 518 CFX_WideString GetText() const; |
439 CFX_WideString GetText() const override; | 519 FX_FLOAT GetFontSize() const; |
440 FX_FLOAT GetFontSize() const override; | 520 uint16_t GetPasswordChar() const; |
441 uint16_t GetPasswordChar() const override; | 521 CFX_FloatPoint GetScrollPos() const; |
442 CFX_FloatPoint GetScrollPos() const override; | 522 int32_t GetCharArray() const; |
443 int32_t GetCharArray() const override; | 523 CFX_FloatRect GetPlateRect() const; |
444 CFX_FloatRect GetPlateRect() const override; | 524 CFX_FloatRect GetContentRect() const; |
445 CFX_FloatRect GetContentRect() const override; | 525 CFX_WideString GetRangeText(const CPVT_WordRange& range) const; |
446 CFX_WideString GetRangeText(const CPVT_WordRange& range) const override; | 526 int32_t GetHorzScale() const; |
447 int32_t GetHorzScale() const override; | 527 FX_FLOAT GetCharSpace() const; |
448 FX_FLOAT GetCharSpace() const override; | 528 int32_t GetTotalWords() const; |
449 int32_t GetTotalWords() const override; | 529 void SetSel(int32_t nStartChar, int32_t nEndChar); |
450 void SetSel(int32_t nStartChar, int32_t nEndChar) override; | 530 void GetSel(int32_t& nStartChar, int32_t& nEndChar) const; |
451 void GetSel(int32_t& nStartChar, int32_t& nEndChar) const override; | 531 void SelectAll(); |
452 void SelectAll() override; | 532 void SelectNone(); |
453 void SelectNone() override; | 533 FX_BOOL IsSelected() const; |
454 FX_BOOL IsSelected() const override; | 534 void Paint(); |
455 void Paint() override; | 535 void EnableNotify(FX_BOOL bNotify); |
456 void EnableRefresh(FX_BOOL bRefresh) override; | 536 void EnableRefresh(FX_BOOL bRefresh); |
457 void RefreshWordRange(const CPVT_WordRange& wr) override; | 537 void RefreshWordRange(const CPVT_WordRange& wr); |
458 void SetCaret(int32_t nPos) override; | 538 void SetCaret(int32_t nPos); |
459 CPVT_WordRange GetWholeWordRange() const override; | 539 CPVT_WordRange GetWholeWordRange() const; |
460 CPVT_WordRange GetSelectWordRange() const override; | 540 CPVT_WordRange GetSelectWordRange() const; |
461 void EnableUndo(FX_BOOL bUndo) override; | 541 void EnableUndo(FX_BOOL bUndo); |
462 void EnableOprNotify(FX_BOOL bNotify) override; | 542 void EnableOprNotify(FX_BOOL bNotify); |
463 FX_BOOL IsTextFull() const override; | 543 FX_BOOL IsTextFull() const; |
464 FX_BOOL IsTextOverflow() const; | 544 FX_BOOL IsTextOverflow() const; |
465 FX_BOOL CanUndo() const override; | 545 FX_BOOL CanUndo() const; |
466 FX_BOOL CanRedo() const override; | 546 FX_BOOL CanRedo() const; |
467 FX_BOOL IsModified() const override; | 547 FX_BOOL IsModified() const; |
468 CPVT_WordRange GetVisibleWordRange() const override; | 548 CPVT_WordRange GetVisibleWordRange() const; |
469 void AddUndoItem(IFX_Edit_UndoItem* pUndoItem) override; | 549 void AddUndoItem(IFX_Edit_UndoItem* pUndoItem); |
470 | 550 |
471 FX_BOOL Empty(); | 551 FX_BOOL Empty(); |
472 | 552 |
473 CPVT_WordPlace DoInsertText(const CPVT_WordPlace& place, | 553 CPVT_WordPlace DoInsertText(const CPVT_WordPlace& place, |
474 const FX_WCHAR* text, | 554 const FX_WCHAR* text, |
475 int32_t charset, | 555 int32_t charset, |
476 const CPVT_SecProps* pSecProps, | 556 const CPVT_SecProps* pSecProps, |
477 const CPVT_WordProps* pWordProps); | 557 const CPVT_WordProps* pWordProps); |
478 int32_t GetCharSetFromUnicode(uint16_t word, int32_t nOldCharset); | 558 int32_t GetCharSetFromUnicode(uint16_t word, int32_t nOldCharset); |
479 | 559 |
480 int32_t GetTotalLines() const; | 560 int32_t GetTotalLines() const; |
481 | 561 |
482 private: | 562 private: |
| 563 friend class CFX_Edit_Iterator; |
| 564 friend class CFXEU_InsertWord; |
| 565 friend class CFXEU_InsertReturn; |
| 566 friend class CFXEU_Backspace; |
| 567 friend class CFXEU_Delete; |
| 568 friend class CFXEU_Clear; |
| 569 friend class CFXEU_ClearRich; |
| 570 friend class CFXEU_InsertText; |
| 571 |
483 void SetSel(const CPVT_WordPlace& begin, const CPVT_WordPlace& end); | 572 void SetSel(const CPVT_WordPlace& begin, const CPVT_WordPlace& end); |
484 | 573 |
485 void RearrangeAll(); | 574 void RearrangeAll(); |
486 void RearrangePart(const CPVT_WordRange& range); | 575 void RearrangePart(const CPVT_WordRange& range); |
487 void ScrollToCaret(); | 576 void ScrollToCaret(); |
488 void SetScrollInfo(); | 577 void SetScrollInfo(); |
489 void SetScrollPosX(FX_FLOAT fx); | 578 void SetScrollPosX(FX_FLOAT fx); |
490 void SetScrollPosY(FX_FLOAT fy); | 579 void SetScrollPosY(FX_FLOAT fy); |
491 void SetScrollLimit(); | 580 void SetScrollLimit(); |
492 void SetContentChanged(); | 581 void SetContentChanged(); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 void EndGroupUndo(); | 630 void EndGroupUndo(); |
542 void AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem); | 631 void AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem); |
543 | 632 |
544 void SetPageInfo(const CPVT_WordPlace& place); | 633 void SetPageInfo(const CPVT_WordPlace& place); |
545 CPVT_WordPlace SearchPageEndPlace(const CPVT_WordPlace& wpPageBegin, | 634 CPVT_WordPlace SearchPageEndPlace(const CPVT_WordPlace& wpPageBegin, |
546 const CFX_FloatPoint& point) const; | 635 const CFX_FloatPoint& point) const; |
547 FX_FLOAT GetLineTop(const CPVT_WordPlace& place) const; | 636 FX_FLOAT GetLineTop(const CPVT_WordPlace& place) const; |
548 FX_FLOAT GetLineBottom(const CPVT_WordPlace& place) const; | 637 FX_FLOAT GetLineBottom(const CPVT_WordPlace& place) const; |
549 | 638 |
550 private: | 639 private: |
551 CPDF_VariableText* m_pVT; | 640 std::unique_ptr<CPDF_VariableText> m_pVT; |
552 IFX_Edit_Notify* m_pNotify; | 641 CPWL_EditCtrl* m_pNotify; |
553 IFX_Edit_OprNotify* m_pOprNotify; | 642 CPWL_Edit* m_pOprNotify; |
554 std::unique_ptr<CFX_Edit_Provider> m_pVTProvider; | 643 std::unique_ptr<CFX_Edit_Provider> m_pVTProvider; |
555 | 644 |
556 CPVT_WordPlace m_wpCaret; | 645 CPVT_WordPlace m_wpCaret; |
557 CPVT_WordPlace m_wpOldCaret; | 646 CPVT_WordPlace m_wpOldCaret; |
558 CFX_Edit_Select m_SelState; | 647 CFX_Edit_Select m_SelState; |
559 | 648 |
560 CFX_FloatPoint m_ptScrollPos; | 649 CFX_FloatPoint m_ptScrollPos; |
561 CFX_FloatPoint m_ptRefreshScrollPos; | 650 CFX_FloatPoint m_ptRefreshScrollPos; |
562 FX_BOOL m_bEnableScroll; | 651 FX_BOOL m_bEnableScroll; |
563 std::unique_ptr<IFX_Edit_Iterator> m_pIterator; | 652 std::unique_ptr<CFX_Edit_Iterator> m_pIterator; |
564 CFX_Edit_Refresh m_Refresh; | 653 CFX_Edit_Refresh m_Refresh; |
565 CFX_FloatPoint m_ptCaret; | 654 CFX_FloatPoint m_ptCaret; |
566 CFX_Edit_Undo m_Undo; | 655 CFX_Edit_Undo m_Undo; |
567 int32_t m_nAlignment; | 656 int32_t m_nAlignment; |
568 FX_BOOL m_bNotifyFlag; | 657 FX_BOOL m_bNotifyFlag; |
569 FX_BOOL m_bEnableOverflow; | 658 FX_BOOL m_bEnableOverflow; |
570 FX_BOOL m_bEnableRefresh; | 659 FX_BOOL m_bEnableRefresh; |
571 CFX_FloatRect m_rcOldContent; | 660 CFX_FloatRect m_rcOldContent; |
572 FX_BOOL m_bEnableUndo; | 661 FX_BOOL m_bEnableUndo; |
573 FX_BOOL m_bOprNotify; | 662 FX_BOOL m_bOprNotify; |
574 CFX_Edit_GroupUndoItem* m_pGroupUndoItem; | 663 CFX_Edit_GroupUndoItem* m_pGroupUndoItem; |
575 }; | 664 }; |
576 | 665 |
577 class CFX_Edit_Iterator : public IFX_Edit_Iterator { | 666 class CFX_Edit_Iterator { |
578 public: | 667 public: |
579 CFX_Edit_Iterator(CFX_Edit* pEdit, CPDF_VariableText::Iterator* pVTIterator); | 668 CFX_Edit_Iterator(CFX_Edit* pEdit, CPDF_VariableText::Iterator* pVTIterator); |
580 ~CFX_Edit_Iterator() override; | 669 ~CFX_Edit_Iterator(); |
581 | 670 |
582 // IFX_Edit_Iterator | 671 FX_BOOL NextWord(); |
583 FX_BOOL NextWord() override; | 672 FX_BOOL NextLine(); |
584 FX_BOOL NextLine() override; | 673 FX_BOOL NextSection(); |
585 FX_BOOL NextSection() override; | 674 FX_BOOL PrevWord(); |
586 FX_BOOL PrevWord() override; | 675 FX_BOOL PrevLine(); |
587 FX_BOOL PrevLine() override; | 676 FX_BOOL PrevSection(); |
588 FX_BOOL PrevSection() override; | 677 FX_BOOL GetWord(CPVT_Word& word) const; |
589 FX_BOOL GetWord(CPVT_Word& word) const override; | 678 FX_BOOL GetLine(CPVT_Line& line) const; |
590 FX_BOOL GetLine(CPVT_Line& line) const override; | 679 FX_BOOL GetSection(CPVT_Section& section) const; |
591 FX_BOOL GetSection(CPVT_Section& section) const override; | 680 void SetAt(int32_t nWordIndex); |
592 void SetAt(int32_t nWordIndex) override; | 681 void SetAt(const CPVT_WordPlace& place); |
593 void SetAt(const CPVT_WordPlace& place) override; | 682 const CPVT_WordPlace& GetAt() const; |
594 const CPVT_WordPlace& GetAt() const override; | 683 CFX_Edit* GetEdit() const; |
595 IFX_Edit* GetEdit() const override; | |
596 | 684 |
597 private: | 685 private: |
598 CFX_Edit* m_pEdit; | 686 CFX_Edit* m_pEdit; |
599 CPDF_VariableText::Iterator* m_pVTIterator; | 687 CPDF_VariableText::Iterator* m_pVTIterator; |
600 }; | 688 }; |
601 | 689 |
602 class CFX_Edit_Provider : public CPDF_VariableText::Provider { | 690 class CFX_Edit_Provider : public CPDF_VariableText::Provider { |
603 public: | 691 public: |
604 explicit CFX_Edit_Provider(IPVT_FontMap* pFontMap); | 692 explicit CFX_Edit_Provider(IPVT_FontMap* pFontMap); |
605 ~CFX_Edit_Provider() override; | 693 ~CFX_Edit_Provider() override; |
(...skipping 10 matching lines...) Expand all Loading... |
616 int32_t charset, | 704 int32_t charset, |
617 int32_t nFontIndex) override; | 705 int32_t nFontIndex) override; |
618 int32_t GetDefaultFontIndex() override; | 706 int32_t GetDefaultFontIndex() override; |
619 FX_BOOL IsLatinWord(uint16_t word) override; | 707 FX_BOOL IsLatinWord(uint16_t word) override; |
620 | 708 |
621 private: | 709 private: |
622 IPVT_FontMap* m_pFontMap; | 710 IPVT_FontMap* m_pFontMap; |
623 }; | 711 }; |
624 | 712 |
625 #endif // FPDFSDK_FXEDIT_INCLUDE_FXET_EDIT_H_ | 713 #endif // FPDFSDK_FXEDIT_INCLUDE_FXET_EDIT_H_ |
OLD | NEW |