| 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 <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "core/fpdfdoc/cpvt_arraytemplate.h" |
| 12 #include "core/fpdfdoc/cpvt_floatrect.h" | 13 #include "core/fpdfdoc/cpvt_floatrect.h" |
| 13 #include "core/fpdfdoc/cpvt_lineinfo.h" | 14 #include "core/fpdfdoc/cpvt_lineinfo.h" |
| 14 #include "core/fpdfdoc/include/cpvt_line.h" | 15 #include "core/fpdfdoc/include/cpvt_line.h" |
| 15 #include "core/fpdfdoc/include/cpvt_wordplace.h" | 16 #include "core/fpdfdoc/include/cpvt_wordplace.h" |
| 16 #include "core/fpdfdoc/include/cpvt_wordrange.h" | 17 #include "core/fpdfdoc/include/cpvt_wordrange.h" |
| 17 #include "core/fpdfdoc/pdf_vt.h" | |
| 18 #include "core/fxcrt/include/fx_coordinates.h" | 18 #include "core/fxcrt/include/fx_coordinates.h" |
| 19 #include "core/fxcrt/include/fx_string.h" | 19 #include "core/fxcrt/include/fx_string.h" |
| 20 #include "core/fxcrt/include/fx_system.h" | 20 #include "core/fxcrt/include/fx_system.h" |
| 21 #include "core/fxge/include/fx_font.h" | 21 #include "core/fxge/include/fx_font.h" |
| 22 | 22 |
| 23 class CSection; | 23 class CSection; |
| 24 class IPVT_FontMap; | 24 class IPVT_FontMap; |
| 25 | 25 |
| 26 struct CPVT_SecProps; | 26 struct CPVT_SecProps; |
| 27 struct CPVT_Section; | 27 struct CPVT_Section; |
| 28 struct CPVT_SectionInfo; | 28 struct CPVT_SectionInfo; |
| 29 struct CPVT_Word; | 29 struct CPVT_Word; |
| 30 struct CPVT_WordInfo; | 30 struct CPVT_WordInfo; |
| 31 struct CPVT_WordProps; | 31 struct CPVT_WordProps; |
| 32 | 32 |
| 33 #define VARIABLETEXT_HALF 0.5f | 33 #define VARIABLETEXT_HALF 0.5f |
| 34 | 34 |
| 35 class CPDF_VariableText : private CPDF_EditContainer { | 35 class CPDF_VariableText { |
| 36 public: | 36 public: |
| 37 enum class ScriptType { Normal, Super, Sub }; | 37 enum class ScriptType { Normal, Super, Sub }; |
| 38 | 38 |
| 39 class Iterator { | 39 class Iterator { |
| 40 public: | 40 public: |
| 41 explicit Iterator(CPDF_VariableText* pVT); | 41 explicit Iterator(CPDF_VariableText* pVT); |
| 42 ~Iterator(); | 42 ~Iterator(); |
| 43 | 43 |
| 44 FX_BOOL NextWord(); | 44 FX_BOOL NextWord(); |
| 45 FX_BOOL PrevWord(); | 45 FX_BOOL PrevWord(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 75 int32_t charset, | 75 int32_t charset, |
| 76 int32_t nFontIndex); | 76 int32_t nFontIndex); |
| 77 virtual FX_BOOL IsLatinWord(uint16_t word); | 77 virtual FX_BOOL IsLatinWord(uint16_t word); |
| 78 virtual int32_t GetDefaultFontIndex(); | 78 virtual int32_t GetDefaultFontIndex(); |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 IPVT_FontMap* const m_pFontMap; | 81 IPVT_FontMap* const m_pFontMap; |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 CPDF_VariableText(); | 84 CPDF_VariableText(); |
| 85 ~CPDF_VariableText() override; | 85 ~CPDF_VariableText(); |
| 86 | 86 |
| 87 void SetProvider(CPDF_VariableText::Provider* pProvider); | 87 void SetProvider(CPDF_VariableText::Provider* pProvider); |
| 88 CPDF_VariableText::Iterator* GetIterator(); | 88 CPDF_VariableText::Iterator* GetIterator(); |
| 89 | 89 |
| 90 // CPDF_EditContainer. | 90 void SetContentRect(const CPVT_FloatRect& rect); |
| 91 void SetPlateRect(const CFX_FloatRect& rect) override; | 91 CFX_FloatRect GetContentRect() const; |
| 92 CFX_FloatRect GetContentRect() const override; | 92 void SetPlateRect(const CFX_FloatRect& rect); |
| 93 const CFX_FloatRect& GetPlateRect() const override; | 93 const CFX_FloatRect& GetPlateRect() const; |
| 94 | 94 |
| 95 void SetAlignment(int32_t nFormat) { m_nAlignment = nFormat; } | 95 void SetAlignment(int32_t nFormat) { m_nAlignment = nFormat; } |
| 96 void SetPasswordChar(uint16_t wSubWord) { m_wSubWord = wSubWord; } | 96 void SetPasswordChar(uint16_t wSubWord) { m_wSubWord = wSubWord; } |
| 97 void SetLimitChar(int32_t nLimitChar) { m_nLimitChar = nLimitChar; } | 97 void SetLimitChar(int32_t nLimitChar) { m_nLimitChar = nLimitChar; } |
| 98 void SetCharSpace(FX_FLOAT fCharSpace) { m_fCharSpace = fCharSpace; } | 98 void SetCharSpace(FX_FLOAT fCharSpace) { m_fCharSpace = fCharSpace; } |
| 99 void SetMultiLine(FX_BOOL bMultiLine) { m_bMultiLine = bMultiLine; } | 99 void SetMultiLine(FX_BOOL bMultiLine) { m_bMultiLine = bMultiLine; } |
| 100 void SetAutoReturn(FX_BOOL bAuto) { m_bLimitWidth = bAuto; } | 100 void SetAutoReturn(FX_BOOL bAuto) { m_bLimitWidth = bAuto; } |
| 101 void SetFontSize(FX_FLOAT fFontSize) { m_fFontSize = fFontSize; } | 101 void SetFontSize(FX_FLOAT fFontSize) { m_fFontSize = fFontSize; } |
| 102 void SetCharArray(int32_t nCharArray) { m_nCharArray = nCharArray; } | 102 void SetCharArray(int32_t nCharArray) { m_nCharArray = nCharArray; } |
| 103 void SetAutoFontSize(FX_BOOL bAuto) { m_bAutoFontSize = bAuto; } | 103 void SetAutoFontSize(FX_BOOL bAuto) { m_bAutoFontSize = bAuto; } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 CPVT_WordPlace GetSectionBeginPlace(const CPVT_WordPlace& place) const; | 144 CPVT_WordPlace GetSectionBeginPlace(const CPVT_WordPlace& place) const; |
| 145 CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace& place) const; | 145 CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace& place) const; |
| 146 void UpdateWordPlace(CPVT_WordPlace& place) const; | 146 void UpdateWordPlace(CPVT_WordPlace& place) const; |
| 147 CPVT_WordPlace AdjustLineHeader(const CPVT_WordPlace& place, | 147 CPVT_WordPlace AdjustLineHeader(const CPVT_WordPlace& place, |
| 148 FX_BOOL bPrevOrNext) const; | 148 FX_BOOL bPrevOrNext) const; |
| 149 int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const; | 149 int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const; |
| 150 CPVT_WordPlace WordIndexToWordPlace(int32_t index) const; | 150 CPVT_WordPlace WordIndexToWordPlace(int32_t index) const; |
| 151 | 151 |
| 152 uint16_t GetSubWord() const { return m_wSubWord; } | 152 uint16_t GetSubWord() const { return m_wSubWord; } |
| 153 | 153 |
| 154 FX_FLOAT GetPlateWidth() const { return m_rcPlate.right - m_rcPlate.left; } |
| 155 FX_FLOAT GetPlateHeight() const { return m_rcPlate.top - m_rcPlate.bottom; } |
| 156 CFX_SizeF GetPlateSize() const; |
| 157 CFX_FloatPoint GetBTPoint() const; |
| 158 CFX_FloatPoint GetETPoint() const; |
| 159 |
| 160 CFX_FloatPoint InToOut(const CFX_FloatPoint& point) const; |
| 161 CFX_FloatPoint OutToIn(const CFX_FloatPoint& point) const; |
| 162 CFX_FloatRect InToOut(const CPVT_FloatRect& rect) const; |
| 163 CPVT_FloatRect OutToIn(const CFX_FloatRect& rect) const; |
| 164 |
| 154 private: | 165 private: |
| 155 friend class CTypeset; | 166 friend class CTypeset; |
| 156 friend class CSection; | 167 friend class CSection; |
| 157 | 168 |
| 158 int32_t GetCharWidth(int32_t nFontIndex, | 169 int32_t GetCharWidth(int32_t nFontIndex, |
| 159 uint16_t Word, | 170 uint16_t Word, |
| 160 uint16_t SubWord, | 171 uint16_t SubWord, |
| 161 int32_t nWordStyle); | 172 int32_t nWordStyle); |
| 162 int32_t GetTypeAscent(int32_t nFontIndex); | 173 int32_t GetTypeAscent(int32_t nFontIndex); |
| 163 int32_t GetTypeDescent(int32_t nFontIndex); | 174 int32_t GetTypeDescent(int32_t nFontIndex); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 FX_BOOL m_bAutoFontSize; | 237 FX_BOOL m_bAutoFontSize; |
| 227 int32_t m_nAlignment; | 238 int32_t m_nAlignment; |
| 228 FX_FLOAT m_fLineLeading; | 239 FX_FLOAT m_fLineLeading; |
| 229 FX_FLOAT m_fCharSpace; | 240 FX_FLOAT m_fCharSpace; |
| 230 int32_t m_nHorzScale; | 241 int32_t m_nHorzScale; |
| 231 uint16_t m_wSubWord; | 242 uint16_t m_wSubWord; |
| 232 FX_FLOAT m_fFontSize; | 243 FX_FLOAT m_fFontSize; |
| 233 FX_BOOL m_bInitial; | 244 FX_BOOL m_bInitial; |
| 234 CPDF_VariableText::Provider* m_pVTProvider; | 245 CPDF_VariableText::Provider* m_pVTProvider; |
| 235 std::unique_ptr<CPDF_VariableText::Iterator> m_pVTIterator; | 246 std::unique_ptr<CPDF_VariableText::Iterator> m_pVTIterator; |
| 247 CFX_FloatRect m_rcPlate; |
| 248 CPVT_FloatRect m_rcContent; |
| 236 }; | 249 }; |
| 237 | 250 |
| 238 #endif // CORE_FPDFDOC_INCLUDE_CPDF_VARIABLETEXT_H_ | 251 #endif // CORE_FPDFDOC_INCLUDE_CPDF_VARIABLETEXT_H_ |
| OLD | NEW |