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

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

Issue 2146503002: Remove RichText support from fpdfsdk/fxedit. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 5 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
« no previous file with comments | « fpdfsdk/fxedit/include/fx_edit.h ('k') | fpdfsdk/javascript/Field.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef FPDFSDK_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>
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 void Redo() override; 324 void Redo() override;
325 void Undo() override; 325 void Undo() override;
326 326
327 private: 327 private:
328 CFX_Edit* m_pEdit; 328 CFX_Edit* m_pEdit;
329 329
330 CPVT_WordRange m_wrSel; 330 CPVT_WordRange m_wrSel;
331 CFX_WideString m_swText; 331 CFX_WideString m_swText;
332 }; 332 };
333 333
334 class CFXEU_ClearRich : public CFX_Edit_UndoItem {
335 public:
336 CFXEU_ClearRich(CFX_Edit* pEdit,
337 const CPVT_WordPlace& wpOldPlace,
338 const CPVT_WordPlace& wpNewPlace,
339 const CPVT_WordRange& wrSel,
340 uint16_t word,
341 int32_t charset,
342 const CPVT_SecProps& SecProps,
343 const CPVT_WordProps& WordProps);
344 ~CFXEU_ClearRich() override;
345
346 // CFX_Edit_UndoItem
347 void Redo() override;
348 void Undo() override;
349
350 private:
351 CFX_Edit* m_pEdit;
352
353 CPVT_WordPlace m_wpOld;
354 CPVT_WordPlace m_wpNew;
355 CPVT_WordRange m_wrSel;
356 uint16_t m_Word;
357 int32_t m_nCharset;
358 CPVT_SecProps m_SecProps;
359 CPVT_WordProps m_WordProps;
360 };
361
362 class CFXEU_InsertText : public CFX_Edit_UndoItem { 334 class CFXEU_InsertText : public CFX_Edit_UndoItem {
363 public: 335 public:
364 CFXEU_InsertText(CFX_Edit* pEdit, 336 CFXEU_InsertText(CFX_Edit* pEdit,
365 const CPVT_WordPlace& wpOldPlace, 337 const CPVT_WordPlace& wpOldPlace,
366 const CPVT_WordPlace& wpNewPlace, 338 const CPVT_WordPlace& wpNewPlace,
367 const CFX_WideString& swText, 339 const CFX_WideString& swText,
368 int32_t charset, 340 int32_t charset,
369 const CPVT_SecProps* pSecProps, 341 const CPVT_SecProps* pSecProps,
370 const CPVT_WordProps* pWordProps); 342 const CPVT_WordProps* pWordProps);
371 ~CFXEU_InsertText() override; 343 ~CFXEU_InsertText() override;
372 344
373 // CFX_Edit_UndoItem 345 // CFX_Edit_UndoItem
374 void Redo() override; 346 void Redo() override;
375 void Undo() override; 347 void Undo() override;
376 348
377 private: 349 private:
378 CFX_Edit* m_pEdit; 350 CFX_Edit* m_pEdit;
379 351
380 CPVT_WordPlace m_wpOld; 352 CPVT_WordPlace m_wpOld;
381 CPVT_WordPlace m_wpNew; 353 CPVT_WordPlace m_wpNew;
382 CFX_WideString m_swText; 354 CFX_WideString m_swText;
383 int32_t m_nCharset; 355 int32_t m_nCharset;
384 CPVT_SecProps m_SecProps; 356 CPVT_SecProps m_SecProps;
385 CPVT_WordProps m_WordProps; 357 CPVT_WordProps m_WordProps;
386 }; 358 };
387 359
388 class CFXEU_SetSecProps : public CFX_Edit_UndoItem {
389 public:
390 CFXEU_SetSecProps(CFX_Edit* pEdit,
391 const CPVT_WordPlace& place,
392 EDIT_PROPS_E ep,
393 const CPVT_SecProps& oldsecprops,
394 const CPVT_WordProps& oldwordprops,
395 const CPVT_SecProps& newsecprops,
396 const CPVT_WordProps& newwordprops,
397 const CPVT_WordRange& range);
398 ~CFXEU_SetSecProps() override;
399
400 // CFX_Edit_UndoItem
401 void Redo() override;
402 void Undo() override;
403
404 private:
405 CFX_Edit* m_pEdit;
406 CPVT_WordPlace m_wpPlace;
407 CPVT_WordRange m_wrPlace;
408 EDIT_PROPS_E m_eProps;
409
410 CPVT_SecProps m_OldSecProps;
411 CPVT_SecProps m_NewSecProps;
412 CPVT_WordProps m_OldWordProps;
413 CPVT_WordProps m_NewWordProps;
414 };
415
416 class CFXEU_SetWordProps : public CFX_Edit_UndoItem {
417 public:
418 CFXEU_SetWordProps(CFX_Edit* pEdit,
419 const CPVT_WordPlace& place,
420 EDIT_PROPS_E ep,
421 const CPVT_WordProps& oldprops,
422 const CPVT_WordProps& newprops,
423 const CPVT_WordRange& range);
424 ~CFXEU_SetWordProps() override;
425
426 // CFX_Edit_UndoItem
427 void Redo() override;
428 void Undo() override;
429
430 private:
431 CFX_Edit* m_pEdit;
432 CPVT_WordPlace m_wpPlace;
433 CPVT_WordRange m_wrPlace;
434 EDIT_PROPS_E m_eProps;
435
436 CPVT_WordProps m_OldWordProps;
437 CPVT_WordProps m_NewWordProps;
438 };
439
440 class CFX_Edit : public IFX_Edit { 360 class CFX_Edit : public IFX_Edit {
441 friend class CFX_Edit_Iterator; 361 friend class CFX_Edit_Iterator;
442 friend class CFXEU_InsertWord; 362 friend class CFXEU_InsertWord;
443 friend class CFXEU_InsertReturn; 363 friend class CFXEU_InsertReturn;
444 friend class CFXEU_Backspace; 364 friend class CFXEU_Backspace;
445 friend class CFXEU_Delete; 365 friend class CFXEU_Delete;
446 friend class CFXEU_Clear; 366 friend class CFXEU_Clear;
447 friend class CFXEU_ClearRich;
448 friend class CFXEU_SetSecProps;
449 friend class CFXEU_SetWordProps;
450 friend class CFXEU_InsertText; 367 friend class CFXEU_InsertText;
451 368
452 public: 369 public:
453 explicit CFX_Edit(CPDF_VariableText* pVT); 370 explicit CFX_Edit(CPDF_VariableText* pVT);
454 ~CFX_Edit() override; 371 ~CFX_Edit() override;
455 372
456 // IFX_Edit 373 // IFX_Edit
457 void SetFontMap(IPVT_FontMap* pFontMap) override; 374 void SetFontMap(IPVT_FontMap* pFontMap) override;
458 void SetNotify(IFX_Edit_Notify* pNotify) override; 375 void SetNotify(IFX_Edit_Notify* pNotify) override;
459 void SetOprNotify(IFX_Edit_OprNotify* pOprNotify) override; 376 void SetOprNotify(IFX_Edit_OprNotify* pOprNotify) override;
(...skipping 11 matching lines...) Expand all
471 void SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE) override; 388 void SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE) override;
472 void SetHorzScale(int32_t nHorzScale = 100, FX_BOOL bPaint = TRUE) override; 389 void SetHorzScale(int32_t nHorzScale = 100, FX_BOOL bPaint = TRUE) override;
473 void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE) override; 390 void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE) override;
474 void SetMultiLine(FX_BOOL bMultiLine = TRUE, FX_BOOL bPaint = TRUE) override; 391 void SetMultiLine(FX_BOOL bMultiLine = TRUE, FX_BOOL bPaint = TRUE) override;
475 void SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) override; 392 void SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) override;
476 void SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) override; 393 void SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) override;
477 void SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) override; 394 void SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) override;
478 void SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE) override; 395 void SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE) override;
479 void SetTextOverflow(FX_BOOL bAllowed = FALSE, 396 void SetTextOverflow(FX_BOOL bAllowed = FALSE,
480 FX_BOOL bPaint = TRUE) override; 397 FX_BOOL bPaint = TRUE) override;
481 FX_BOOL IsRichText() const override;
482 void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE) override;
483 FX_BOOL SetRichFontSize(FX_FLOAT fFontSize) override;
484 FX_BOOL SetRichFontIndex(int32_t nFontIndex) override;
485 FX_BOOL SetRichTextColor(FX_COLORREF dwColor) override;
486 FX_BOOL SetRichTextScript(CPDF_VariableText::ScriptType nScriptType) override;
487 FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE) override;
488 FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE) override;
489 FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE) override;
490 FX_BOOL SetRichTextCrossout(FX_BOOL bCrossout = TRUE) override;
491 FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace) override;
492 FX_BOOL SetRichTextHorzScale(int32_t nHorzScale = 100) override;
493 FX_BOOL SetRichTextLineLeading(FX_FLOAT fLineLeading) override;
494 FX_BOOL SetRichTextLineIndent(FX_FLOAT fLineIndent) override;
495 FX_BOOL SetRichTextAlignment(int32_t nAlignment) override;
496 void OnMouseDown(const CFX_FloatPoint& point, 398 void OnMouseDown(const CFX_FloatPoint& point,
497 FX_BOOL bShift, 399 FX_BOOL bShift,
498 FX_BOOL bCtrl) override; 400 FX_BOOL bCtrl) override;
499 void OnMouseMove(const CFX_FloatPoint& point, 401 void OnMouseMove(const CFX_FloatPoint& point,
500 FX_BOOL bShift, 402 FX_BOOL bShift,
501 FX_BOOL bCtrl) override; 403 FX_BOOL bCtrl) override;
502 void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) override; 404 void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) override;
503 void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl) override; 405 void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl) override;
504 void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl) override; 406 void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl) override;
505 void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) override; 407 void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) override;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 CFX_WideString GetRangeText(const CPVT_WordRange& range) const override; 446 CFX_WideString GetRangeText(const CPVT_WordRange& range) const override;
545 int32_t GetHorzScale() const override; 447 int32_t GetHorzScale() const override;
546 FX_FLOAT GetCharSpace() const override; 448 FX_FLOAT GetCharSpace() const override;
547 int32_t GetTotalWords() const override; 449 int32_t GetTotalWords() const override;
548 void SetSel(int32_t nStartChar, int32_t nEndChar) override; 450 void SetSel(int32_t nStartChar, int32_t nEndChar) override;
549 void GetSel(int32_t& nStartChar, int32_t& nEndChar) const override; 451 void GetSel(int32_t& nStartChar, int32_t& nEndChar) const override;
550 void SelectAll() override; 452 void SelectAll() override;
551 void SelectNone() override; 453 void SelectNone() override;
552 FX_BOOL IsSelected() const override; 454 FX_BOOL IsSelected() const override;
553 void Paint() override; 455 void Paint() override;
554 void EnableNotify(FX_BOOL bNotify) override;
555 void EnableRefresh(FX_BOOL bRefresh) override; 456 void EnableRefresh(FX_BOOL bRefresh) override;
556 void RefreshWordRange(const CPVT_WordRange& wr) override; 457 void RefreshWordRange(const CPVT_WordRange& wr) override;
557 void SetCaret(int32_t nPos) override; 458 void SetCaret(int32_t nPos) override;
558 CPVT_WordRange GetWholeWordRange() const override; 459 CPVT_WordRange GetWholeWordRange() const override;
559 CPVT_WordRange GetSelectWordRange() const override; 460 CPVT_WordRange GetSelectWordRange() const override;
560 void EnableUndo(FX_BOOL bUndo) override; 461 void EnableUndo(FX_BOOL bUndo) override;
561 void EnableOprNotify(FX_BOOL bNotify) override; 462 void EnableOprNotify(FX_BOOL bNotify) override;
562 FX_BOOL IsTextFull() const override; 463 FX_BOOL IsTextFull() const override;
563 FX_BOOL IsTextOverflow() const; 464 FX_BOOL IsTextOverflow() const;
564 FX_BOOL CanUndo() const override; 465 FX_BOOL CanUndo() const override;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 FX_BOOL bPaint); 508 FX_BOOL bPaint);
608 FX_BOOL Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint); 509 FX_BOOL Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint);
609 FX_BOOL Delete(FX_BOOL bAddUndo, FX_BOOL bPaint); 510 FX_BOOL Delete(FX_BOOL bAddUndo, FX_BOOL bPaint);
610 FX_BOOL Clear(FX_BOOL bAddUndo, FX_BOOL bPaint); 511 FX_BOOL Clear(FX_BOOL bAddUndo, FX_BOOL bPaint);
611 FX_BOOL InsertText(const FX_WCHAR* text, 512 FX_BOOL InsertText(const FX_WCHAR* text,
612 int32_t charset, 513 int32_t charset,
613 const CPVT_SecProps* pSecProps, 514 const CPVT_SecProps* pSecProps,
614 const CPVT_WordProps* pWordProps, 515 const CPVT_WordProps* pWordProps,
615 FX_BOOL bAddUndo, 516 FX_BOOL bAddUndo,
616 FX_BOOL bPaint); 517 FX_BOOL bPaint);
617 FX_BOOL SetRichTextProps(EDIT_PROPS_E eProps,
618 const CPVT_SecProps* pSecProps,
619 const CPVT_WordProps* pWordProps);
620 FX_BOOL SetSecProps(EDIT_PROPS_E eProps,
621 const CPVT_WordPlace& place,
622 const CPVT_SecProps* pSecProps,
623 const CPVT_WordProps* pWordProps,
624 const CPVT_WordRange& wr,
625 FX_BOOL bAddUndo);
626 FX_BOOL SetWordProps(EDIT_PROPS_E eProps,
627 const CPVT_WordPlace& place,
628 const CPVT_WordProps* pWordProps,
629 const CPVT_WordRange& wr,
630 FX_BOOL bAddUndo);
631 void PaintSetProps(EDIT_PROPS_E eProps, const CPVT_WordRange& wr);
632 void PaintInsertText(const CPVT_WordPlace& wpOld, 518 void PaintInsertText(const CPVT_WordPlace& wpOld,
633 const CPVT_WordPlace& wpNew); 519 const CPVT_WordPlace& wpNew);
634 520
635 inline CFX_FloatPoint VTToEdit(const CFX_FloatPoint& point) const; 521 inline CFX_FloatPoint VTToEdit(const CFX_FloatPoint& point) const;
636 inline CFX_FloatPoint EditToVT(const CFX_FloatPoint& point) const; 522 inline CFX_FloatPoint EditToVT(const CFX_FloatPoint& point) const;
637 inline CFX_FloatRect VTToEdit(const CFX_FloatRect& rect) const; 523 inline CFX_FloatRect VTToEdit(const CFX_FloatRect& rect) const;
638 inline CFX_FloatRect EditToVT(const CFX_FloatRect& rect) const; 524 inline CFX_FloatRect EditToVT(const CFX_FloatRect& rect) const;
639 525
640 void Refresh(REFRESH_PLAN_E ePlan, 526 void Refresh(REFRESH_PLAN_E ePlan,
641 const CPVT_WordRange* pRange1 = nullptr, 527 const CPVT_WordRange* pRange1 = nullptr,
642 const CPVT_WordRange* pRange2 = nullptr); 528 const CPVT_WordRange* pRange2 = nullptr);
643 void RefreshPushLineRects(const CPVT_WordRange& wr); 529 void RefreshPushLineRects(const CPVT_WordRange& wr);
644 void RefreshPushRandomRects(const CPVT_WordRange& wr); 530 void RefreshPushRandomRects(const CPVT_WordRange& wr);
645 531
646 void SetCaret(const CPVT_WordPlace& place); 532 void SetCaret(const CPVT_WordPlace& place);
647 void SetCaretInfo(); 533 void SetCaretInfo();
648 void SetCaretOrigin(); 534 void SetCaretOrigin();
649 void SetCaretChange();
650 535
651 CPVT_WordRange GetLatinWordsRange(const CPVT_WordPlace& place) const; 536 CPVT_WordRange GetLatinWordsRange(const CPVT_WordPlace& place) const;
652 CPVT_WordRange CombineWordRange(const CPVT_WordRange& wr1, 537 CPVT_WordRange CombineWordRange(const CPVT_WordRange& wr1,
653 const CPVT_WordRange& wr2); 538 const CPVT_WordRange& wr2);
654 539
655 void BeginGroupUndo(const CFX_WideString& sTitle); 540 void BeginGroupUndo(const CFX_WideString& sTitle);
656 void EndGroupUndo(); 541 void EndGroupUndo();
657 void AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem); 542 void AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem);
658 543
659 void SetPageInfo(const CPVT_WordPlace& place); 544 void SetPageInfo(const CPVT_WordPlace& place);
(...skipping 18 matching lines...) Expand all
678 std::unique_ptr<IFX_Edit_Iterator> m_pIterator; 563 std::unique_ptr<IFX_Edit_Iterator> m_pIterator;
679 CFX_Edit_Refresh m_Refresh; 564 CFX_Edit_Refresh m_Refresh;
680 CFX_FloatPoint m_ptCaret; 565 CFX_FloatPoint m_ptCaret;
681 CFX_Edit_Undo m_Undo; 566 CFX_Edit_Undo m_Undo;
682 int32_t m_nAlignment; 567 int32_t m_nAlignment;
683 FX_BOOL m_bNotifyFlag; 568 FX_BOOL m_bNotifyFlag;
684 FX_BOOL m_bEnableOverflow; 569 FX_BOOL m_bEnableOverflow;
685 FX_BOOL m_bEnableRefresh; 570 FX_BOOL m_bEnableRefresh;
686 CFX_FloatRect m_rcOldContent; 571 CFX_FloatRect m_rcOldContent;
687 FX_BOOL m_bEnableUndo; 572 FX_BOOL m_bEnableUndo;
688 FX_BOOL m_bNotify;
689 FX_BOOL m_bOprNotify; 573 FX_BOOL m_bOprNotify;
690 CFX_Edit_GroupUndoItem* m_pGroupUndoItem; 574 CFX_Edit_GroupUndoItem* m_pGroupUndoItem;
691 }; 575 };
692 576
693 class CFX_Edit_Iterator : public IFX_Edit_Iterator { 577 class CFX_Edit_Iterator : public IFX_Edit_Iterator {
694 public: 578 public:
695 CFX_Edit_Iterator(CFX_Edit* pEdit, CPDF_VariableText::Iterator* pVTIterator); 579 CFX_Edit_Iterator(CFX_Edit* pEdit, CPDF_VariableText::Iterator* pVTIterator);
696 ~CFX_Edit_Iterator() override; 580 ~CFX_Edit_Iterator() override;
697 581
698 // IFX_Edit_Iterator 582 // IFX_Edit_Iterator
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 int32_t charset, 616 int32_t charset,
733 int32_t nFontIndex) override; 617 int32_t nFontIndex) override;
734 int32_t GetDefaultFontIndex() override; 618 int32_t GetDefaultFontIndex() override;
735 FX_BOOL IsLatinWord(uint16_t word) override; 619 FX_BOOL IsLatinWord(uint16_t word) override;
736 620
737 private: 621 private:
738 IPVT_FontMap* m_pFontMap; 622 IPVT_FontMap* m_pFontMap;
739 }; 623 };
740 624
741 #endif // FPDFSDK_FXEDIT_INCLUDE_FXET_EDIT_H_ 625 #endif // FPDFSDK_FXEDIT_INCLUDE_FXET_EDIT_H_
OLDNEW
« no previous file with comments | « fpdfsdk/fxedit/include/fx_edit.h ('k') | fpdfsdk/javascript/Field.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698