| 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; | 16 class CPDF_PageObjectHolder; |
| 17 class CPDF_TextObject; | 17 class CPDF_TextObject; |
| 18 class CPWL_Edit; | 18 class CPWL_Edit; |
| 19 class CPWL_EditCtrl; | 19 class CPWL_EditCtrl; |
| 20 class CFX_Edit; | 20 class CFX_Edit; |
| 21 class CFX_Edit_Iterator; | 21 class CFX_Edit_Iterator; |
| 22 class CFX_Edit_Provider; | 22 class CFX_Edit_Provider; |
| 23 class CFX_RenderDevice; | 23 class CFX_RenderDevice; |
| 24 class CFX_SystemHandler; | 24 class CFX_SystemHandler; |
| 25 class IFX_Edit_UndoItem; | 25 class IFX_Edit_UndoItem; |
| 26 | 26 |
| 27 #define FX_EDIT_IsFloatZero(f) (f < 0.0001 && f > -0.0001) | |
| 28 #define FX_EDIT_IsFloatEqual(fa, fb) FX_EDIT_IsFloatZero(fa - fb) | |
| 29 #define FX_EDIT_IsFloatBigger(fa, fb) (fa > fb && !FX_EDIT_IsFloatEqual(fa, fb)) | |
| 30 #define FX_EDIT_IsFloatSmaller(fa, fb) \ | |
| 31 (fa < fb && !FX_EDIT_IsFloatEqual(fa, fb)) | |
| 32 | |
| 33 enum EDIT_PROPS_E { | 27 enum EDIT_PROPS_E { |
| 34 EP_LINELEADING, | 28 EP_LINELEADING, |
| 35 EP_LINEINDENT, | 29 EP_LINEINDENT, |
| 36 EP_ALIGNMENT, | 30 EP_ALIGNMENT, |
| 37 EP_FONTINDEX, | 31 EP_FONTINDEX, |
| 38 EP_FONTSIZE, | 32 EP_FONTSIZE, |
| 39 EP_WORDCOLOR, | 33 EP_WORDCOLOR, |
| 40 EP_SCRIPTTYPE, | 34 EP_SCRIPTTYPE, |
| 41 EP_UNDERLINE, | 35 EP_UNDERLINE, |
| 42 EP_CROSSOUT, | 36 EP_CROSSOUT, |
| 43 EP_CHARSPACE, | 37 EP_CHARSPACE, |
| 44 EP_HORZSCALE, | 38 EP_HORZSCALE, |
| 45 EP_BOLD, | 39 EP_BOLD, |
| 46 EP_ITALIC | 40 EP_ITALIC |
| 47 }; | 41 }; |
| 48 | 42 |
| 49 struct CFX_Edit_LineRect { | 43 struct CFX_Edit_LineRect { |
| 50 CFX_Edit_LineRect(const CPVT_WordRange& wrLine, const CFX_FloatRect& rcLine) | 44 CFX_Edit_LineRect(const CPVT_WordRange& wrLine, const CFX_FloatRect& rcLine) |
| 51 : m_wrLine(wrLine), m_rcLine(rcLine) {} | 45 : m_wrLine(wrLine), m_rcLine(rcLine) {} |
| 52 | 46 |
| 53 FX_BOOL operator!=(const CFX_Edit_LineRect& linerect) const { | 47 FX_BOOL operator!=(const CFX_Edit_LineRect& linerect) const { |
| 54 return FXSYS_memcmp(this, &linerect, sizeof(CFX_Edit_LineRect)) != 0; | 48 return FXSYS_memcmp(this, &linerect, sizeof(CFX_Edit_LineRect)) != 0; |
| 55 } | 49 } |
| 56 | 50 |
| 57 FX_BOOL IsSameHeight(const CFX_Edit_LineRect& linerect) const { | 51 FX_BOOL IsSameHeight(const CFX_Edit_LineRect& linerect) const { |
| 58 return FX_EDIT_IsFloatZero( | 52 return IsFloatZero((m_rcLine.top - m_rcLine.bottom) - |
| 59 (m_rcLine.top - m_rcLine.bottom) - | 53 (linerect.m_rcLine.top - linerect.m_rcLine.bottom)); |
| 60 (linerect.m_rcLine.top - linerect.m_rcLine.bottom)); | |
| 61 } | 54 } |
| 62 | 55 |
| 63 FX_BOOL IsSameTop(const CFX_Edit_LineRect& linerect) const { | 56 FX_BOOL IsSameTop(const CFX_Edit_LineRect& linerect) const { |
| 64 return FX_EDIT_IsFloatZero(m_rcLine.top - linerect.m_rcLine.top); | 57 return IsFloatZero(m_rcLine.top - linerect.m_rcLine.top); |
| 65 } | 58 } |
| 66 | 59 |
| 67 FX_BOOL IsSameLeft(const CFX_Edit_LineRect& linerect) const { | 60 FX_BOOL IsSameLeft(const CFX_Edit_LineRect& linerect) const { |
| 68 return FX_EDIT_IsFloatZero(m_rcLine.left - linerect.m_rcLine.left); | 61 return IsFloatZero(m_rcLine.left - linerect.m_rcLine.left); |
| 69 } | 62 } |
| 70 | 63 |
| 71 FX_BOOL IsSameRight(const CFX_Edit_LineRect& linerect) const { | 64 FX_BOOL IsSameRight(const CFX_Edit_LineRect& linerect) const { |
| 72 return FX_EDIT_IsFloatZero(m_rcLine.right - linerect.m_rcLine.right); | 65 return IsFloatZero(m_rcLine.right - linerect.m_rcLine.right); |
| 73 } | 66 } |
| 74 | 67 |
| 75 CPVT_WordRange m_wrLine; | 68 CPVT_WordRange m_wrLine; |
| 76 CFX_FloatRect m_rcLine; | 69 CFX_FloatRect m_rcLine; |
| 77 }; | 70 }; |
| 78 | 71 |
| 79 class CFX_Edit_LineRectArray { | 72 class CFX_Edit_LineRectArray { |
| 80 public: | 73 public: |
| 81 CFX_Edit_LineRectArray(); | 74 CFX_Edit_LineRectArray(); |
| 82 virtual ~CFX_Edit_LineRectArray(); | 75 virtual ~CFX_Edit_LineRectArray(); |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 int32_t charset, | 665 int32_t charset, |
| 673 int32_t nFontIndex) override; | 666 int32_t nFontIndex) override; |
| 674 int32_t GetDefaultFontIndex() override; | 667 int32_t GetDefaultFontIndex() override; |
| 675 FX_BOOL IsLatinWord(uint16_t word) override; | 668 FX_BOOL IsLatinWord(uint16_t word) override; |
| 676 | 669 |
| 677 private: | 670 private: |
| 678 IPVT_FontMap* m_pFontMap; | 671 IPVT_FontMap* m_pFontMap; |
| 679 }; | 672 }; |
| 680 | 673 |
| 681 #endif // FPDFSDK_FXEDIT_INCLUDE_FXET_EDIT_H_ | 674 #endif // FPDFSDK_FXEDIT_INCLUDE_FXET_EDIT_H_ |
| OLD | NEW |