| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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 CORE_FPDFDOC_INCLUDE_CPDF_VARIABLETEXT_H_ | 7 #ifndef CORE_FPDFDOC_INCLUDE_CPDF_VARIABLETEXT_H_ |
| 8 #define CORE_FPDFDOC_INCLUDE_CPDF_VARIABLETEXT_H_ | 8 #define CORE_FPDFDOC_INCLUDE_CPDF_VARIABLETEXT_H_ |
| 9 | 9 |
| 10 #include "core/fpdfdoc/cpvt_floatrect.h" | 10 #include "core/fpdfdoc/cpvt_floatrect.h" |
| 11 #include "core/fpdfdoc/cpvt_lineinfo.h" | 11 #include "core/fpdfdoc/cpvt_lineinfo.h" |
| 12 #include "core/fpdfdoc/include/cpvt_line.h" | 12 #include "core/fpdfdoc/include/cpvt_line.h" |
| 13 #include "core/fpdfdoc/include/cpvt_wordplace.h" | 13 #include "core/fpdfdoc/include/cpvt_wordplace.h" |
| 14 #include "core/fpdfdoc/include/cpvt_wordrange.h" | 14 #include "core/fpdfdoc/include/cpvt_wordrange.h" |
| 15 #include "core/fpdfdoc/pdf_vt.h" | 15 #include "core/fpdfdoc/pdf_vt.h" |
| 16 #include "core/fxcrt/include/fx_coordinates.h" | 16 #include "core/fxcrt/include/fx_coordinates.h" |
| 17 #include "core/fxcrt/include/fx_string.h" | 17 #include "core/fxcrt/include/fx_string.h" |
| 18 #include "core/fxcrt/include/fx_system.h" | 18 #include "core/fxcrt/include/fx_system.h" |
| 19 | 19 |
| 20 class CSection; | 20 class CSection; |
| 21 class IPVT_FontMap; | 21 class IPVT_FontMap; |
| 22 | 22 |
| 23 struct CPVT_SecProps; | 23 struct CPVT_SecProps; |
| 24 struct CPVT_Section; | 24 struct CPVT_Section; |
| 25 struct CPVT_SectionInfo; | 25 struct CPVT_SectionInfo; |
| 26 struct CPVT_Word; | 26 struct CPVT_Word; |
| 27 struct CPVT_WordInfo; |
| 27 struct CPVT_WordProps; | 28 struct CPVT_WordProps; |
| 28 struct CPVT_WordInfo; | |
| 29 | 29 |
| 30 #define VARIABLETEXT_HALF 0.5f | 30 #define VARIABLETEXT_HALF 0.5f |
| 31 | 31 |
| 32 class CPDF_VariableText : private CPDF_EditContainer { | 32 class CPDF_VariableText : private CPDF_EditContainer { |
| 33 public: | 33 public: |
| 34 enum class ScriptType { Normal, Super, Sub }; | 34 enum class ScriptType { Normal, Super, Sub }; |
| 35 | 35 |
| 36 class Iterator { | 36 class Iterator { |
| 37 public: | 37 public: |
| 38 explicit Iterator(CPDF_VariableText* pVT); | 38 explicit Iterator(CPDF_VariableText* pVT); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 53 void SetAt(const CPVT_WordPlace& place); | 53 void SetAt(const CPVT_WordPlace& place); |
| 54 const CPVT_WordPlace& GetAt() const { return m_CurPos; } | 54 const CPVT_WordPlace& GetAt() const { return m_CurPos; } |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 CPVT_WordPlace m_CurPos; | 57 CPVT_WordPlace m_CurPos; |
| 58 CPDF_VariableText* const m_pVT; | 58 CPDF_VariableText* const m_pVT; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 class Provider { | 61 class Provider { |
| 62 public: | 62 public: |
| 63 Provider(IPVT_FontMap* pFontMap); | 63 explicit Provider(IPVT_FontMap* pFontMap); |
| 64 virtual ~Provider(); | 64 virtual ~Provider(); |
| 65 | 65 |
| 66 virtual int32_t GetCharWidth(int32_t nFontIndex, | 66 virtual int32_t GetCharWidth(int32_t nFontIndex, |
| 67 uint16_t word, | 67 uint16_t word, |
| 68 int32_t nWordStyle); | 68 int32_t nWordStyle); |
| 69 virtual int32_t GetTypeAscent(int32_t nFontIndex); | 69 virtual int32_t GetTypeAscent(int32_t nFontIndex); |
| 70 virtual int32_t GetTypeDescent(int32_t nFontIndex); | 70 virtual int32_t GetTypeDescent(int32_t nFontIndex); |
| 71 virtual int32_t GetWordFontIndex(uint16_t word, | 71 virtual int32_t GetWordFontIndex(uint16_t word, |
| 72 int32_t charset, | 72 int32_t charset, |
| 73 int32_t nFontIndex); | 73 int32_t nFontIndex); |
| 74 virtual FX_BOOL IsLatinWord(uint16_t word); | 74 virtual FX_BOOL IsLatinWord(uint16_t word); |
| 75 virtual int32_t GetDefaultFontIndex(); | 75 virtual int32_t GetDefaultFontIndex(); |
| 76 | 76 |
| 77 private: | 77 private: |
| 78 IPVT_FontMap* m_pFontMap; | 78 IPVT_FontMap* m_pFontMap; |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 CPDF_VariableText(); | 81 CPDF_VariableText(); |
| 82 virtual ~CPDF_VariableText(); | 82 ~CPDF_VariableText() override; |
| 83 | 83 |
| 84 CPDF_VariableText::Provider* SetProvider( | 84 void SetProvider(CPDF_VariableText::Provider* pProvider); |
| 85 CPDF_VariableText::Provider* pProvider); | |
| 86 CPDF_VariableText::Iterator* GetIterator(); | 85 CPDF_VariableText::Iterator* GetIterator(); |
| 87 | 86 |
| 88 // CPDF_EditContainer. | 87 // CPDF_EditContainer. |
| 89 void SetPlateRect(const CFX_FloatRect& rect) override { | 88 void SetPlateRect(const CFX_FloatRect& rect) override { |
| 90 CPDF_EditContainer::SetPlateRect(rect); | 89 CPDF_EditContainer::SetPlateRect(rect); |
| 91 } | 90 } |
| 92 CFX_FloatRect GetContentRect() const override; | 91 CFX_FloatRect GetContentRect() const override; |
| 93 const CFX_FloatRect& GetPlateRect() const override { | 92 const CFX_FloatRect& GetPlateRect() const override { |
| 94 return CPDF_EditContainer::GetPlateRect(); | 93 return CPDF_EditContainer::GetPlateRect(); |
| 95 } | 94 } |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 int32_t m_nHorzScale; | 243 int32_t m_nHorzScale; |
| 245 uint16_t m_wSubWord; | 244 uint16_t m_wSubWord; |
| 246 FX_FLOAT m_fFontSize; | 245 FX_FLOAT m_fFontSize; |
| 247 FX_BOOL m_bInitial; | 246 FX_BOOL m_bInitial; |
| 248 FX_BOOL m_bRichText; | 247 FX_BOOL m_bRichText; |
| 249 CPDF_VariableText::Provider* m_pVTProvider; | 248 CPDF_VariableText::Provider* m_pVTProvider; |
| 250 CPDF_VariableText::Iterator* m_pVTIterator; | 249 CPDF_VariableText::Iterator* m_pVTIterator; |
| 251 }; | 250 }; |
| 252 | 251 |
| 253 #endif // CORE_FPDFDOC_INCLUDE_CPDF_VARIABLETEXT_H_ | 252 #endif // CORE_FPDFDOC_INCLUDE_CPDF_VARIABLETEXT_H_ |
| OLD | NEW |