Chromium Code Reviews| Index: core/fpdfdoc/include/cpdf_variabletext.h |
| diff --git a/core/fpdfdoc/include/cpdf_variabletext.h b/core/fpdfdoc/include/cpdf_variabletext.h |
| index c898b18ad8385d1a5ad28273a395663fb4b6c420..e806b5728976962c8cdbab5d03fead581110068c 100644 |
| --- a/core/fpdfdoc/include/cpdf_variabletext.h |
| +++ b/core/fpdfdoc/include/cpdf_variabletext.h |
| @@ -9,12 +9,12 @@ |
| #include <memory> |
| +#include "core/fpdfdoc/cpvt_arraytemplate.h" |
| #include "core/fpdfdoc/cpvt_floatrect.h" |
| #include "core/fpdfdoc/cpvt_lineinfo.h" |
| #include "core/fpdfdoc/include/cpvt_line.h" |
| #include "core/fpdfdoc/include/cpvt_wordplace.h" |
| #include "core/fpdfdoc/include/cpvt_wordrange.h" |
| -#include "core/fpdfdoc/pdf_vt.h" |
| #include "core/fxcrt/include/fx_coordinates.h" |
| #include "core/fxcrt/include/fx_string.h" |
| #include "core/fxcrt/include/fx_system.h" |
| @@ -32,7 +32,7 @@ struct CPVT_WordProps; |
| #define VARIABLETEXT_HALF 0.5f |
| -class CPDF_VariableText : private CPDF_EditContainer { |
| +class CPDF_VariableText { |
| public: |
| enum class ScriptType { Normal, Super, Sub }; |
| @@ -82,15 +82,15 @@ class CPDF_VariableText : private CPDF_EditContainer { |
| }; |
| CPDF_VariableText(); |
| - ~CPDF_VariableText() override; |
| + ~CPDF_VariableText(); |
| void SetProvider(CPDF_VariableText::Provider* pProvider); |
| CPDF_VariableText::Iterator* GetIterator(); |
| - // CPDF_EditContainer. |
| - void SetPlateRect(const CFX_FloatRect& rect) override; |
| - CFX_FloatRect GetContentRect() const override; |
| - const CFX_FloatRect& GetPlateRect() const override; |
| + void SetContentRect(const CPVT_FloatRect& rect); |
| + CFX_FloatRect GetContentRect() const; |
| + void SetPlateRect(const CFX_FloatRect& rect); |
| + const CFX_FloatRect& GetPlateRect() const; |
| void SetAlignment(int32_t nFormat) { m_nAlignment = nFormat; } |
| void SetPasswordChar(uint16_t wSubWord) { m_wSubWord = wSubWord; } |
| @@ -151,6 +151,38 @@ class CPDF_VariableText : private CPDF_EditContainer { |
| uint16_t GetSubWord() const { return m_wSubWord; } |
| + FX_FLOAT GetPlateWidth() const { return m_rcPlate.right - m_rcPlate.left; } |
| + FX_FLOAT GetPlateHeight() const { return m_rcPlate.top - m_rcPlate.bottom; } |
| + CFX_SizeF GetPlateSize() const { |
| + return CFX_SizeF(GetPlateWidth(), GetPlateHeight()); |
| + } |
| + CFX_FloatPoint GetBTPoint() const { |
| + return CFX_FloatPoint(m_rcPlate.left, m_rcPlate.top); |
| + } |
| + CFX_FloatPoint GetETPoint() const { |
| + return CFX_FloatPoint(m_rcPlate.right, m_rcPlate.bottom); |
| + } |
| + CFX_FloatPoint InToOut(const CFX_FloatPoint& point) const { |
| + return CFX_FloatPoint(point.x + GetBTPoint().x, GetBTPoint().y - point.y); |
| + } |
| + CFX_FloatPoint OutToIn(const CFX_FloatPoint& point) const { |
| + return CFX_FloatPoint(point.x - GetBTPoint().x, GetBTPoint().y - point.y); |
| + } |
| + CFX_FloatRect InToOut(const CPVT_FloatRect& rect) const { |
| + CFX_FloatPoint ptLeftTop = InToOut(CFX_FloatPoint(rect.left, rect.top)); |
|
Lei Zhang
2016/07/28 21:50:03
Feels like these should be moved out of the header
dsinclair
2016/08/02 17:55:47
Done.
|
| + CFX_FloatPoint ptRightBottom = |
| + InToOut(CFX_FloatPoint(rect.right, rect.bottom)); |
| + return CFX_FloatRect(ptLeftTop.x, ptRightBottom.y, ptRightBottom.x, |
| + ptLeftTop.y); |
| + } |
| + CPVT_FloatRect OutToIn(const CFX_FloatRect& rect) const { |
| + CFX_FloatPoint ptLeftTop = OutToIn(CFX_FloatPoint(rect.left, rect.top)); |
| + CFX_FloatPoint ptRightBottom = |
| + OutToIn(CFX_FloatPoint(rect.right, rect.bottom)); |
| + return CPVT_FloatRect(ptLeftTop.x, ptLeftTop.y, ptRightBottom.x, |
| + ptRightBottom.y); |
| + } |
| + |
| private: |
| friend class CTypeset; |
| friend class CSection; |
| @@ -233,6 +265,8 @@ class CPDF_VariableText : private CPDF_EditContainer { |
| FX_BOOL m_bInitial; |
| CPDF_VariableText::Provider* m_pVTProvider; |
| std::unique_ptr<CPDF_VariableText::Iterator> m_pVTIterator; |
| + CFX_FloatRect m_rcPlate; |
| + CPVT_FloatRect m_rcContent; |
| }; |
| #endif // CORE_FPDFDOC_INCLUDE_CPDF_VARIABLETEXT_H_ |