7#ifndef CORE_FPDFDOC_CPVT_VARIABLETEXT_H_
8#define CORE_FPDFDOC_CPVT_VARIABLETEXT_H_
15#include "core/fpdfdoc/cpvt_floatrect.h"
16#include "core/fpdfdoc/cpvt_line.h"
17#include "core/fpdfdoc/cpvt_lineinfo.h"
18#include "core/fpdfdoc/cpvt_wordplace.h"
19#include "core/fpdfdoc/cpvt_wordrange.h"
20#include "core/fxcrt/fx_codepage_forward.h"
21#include "core/fxcrt/fx_coordinates.h"
22#include "core/fxcrt/unowned_ptr.h"
23#include "core/fxcrt/widestring.h"
41 void SetAt(int32_t nWordIndex);
55 virtual int GetCharWidth(int32_t nFontIndex, uint16_t word);
81 void SetLimitChar(int32_t nLimitChar) { m_nLimitChar = nLimitChar; }
84 void SetFontSize(
float fFontSize) { m_fFontSize = fFontSize; }
85 void SetCharArray(int32_t nCharArray) { m_nCharArray = nCharArray; }
89 bool IsValid()
const {
return m_bInitialized; }
93 void SetText(
const WideString& text);
117 const CFX_PointF& point)
const;
119 const CFX_PointF& point)
const;
137 CFX_PointF
InToOut(
const CFX_PointF& point)
const;
138 CFX_PointF
OutToIn(
const CFX_PointF& point)
const;
141 float GetFontAscent(int32_t nFontIndex,
float fFontSize)
const;
150 float fWordTail)
const;
160 int GetCharWidth(int32_t nFontIndex, uint16_t Word, uint16_t SubWord)
const;
161 int32_t GetWordFontIndex(uint16_t word,
170 float GetWordFontSize()
const;
182 float GetAutoFontSize();
183 bool IsBigger(
float fFontSize)
const;
184 CPVT_FloatRect RearrangeSections(
const CPVT_WordRange& PlaceRange);
186 bool m_bInitialized =
false;
187 bool m_bMultiLine =
false;
188 bool m_bLimitWidth =
false;
189 bool m_bAutoFontSize =
false;
190 uint16_t m_wSubWord = 0;
191 int32_t m_nLimitChar = 0;
192 int32_t m_nCharArray = 0;
193 int32_t m_nAlignment = 0;
194 float m_fLineLeading = 0.0f;
195 float m_fFontSize = 0.0f;
196 std::vector<std::unique_ptr<CPVT_Section>> m_SectionArray;
198 std::unique_ptr<Iterator> m_pVTIterator;
200 CPVT_FloatRect m_rcContent;
constexpr CFX_FloatRect(float l, float b, float r, float t)
void Inflate(float x, float y)
CFX_FloatRect & operator=(const CFX_FloatRect &that)=default
void Deflate(float x, float y)
static const char kDefaultAnsiFontName[]
CFX_Matrix & operator=(const CFX_Matrix &other)=default
CFX_Matrix(float a1, float b1, float c1, float d1, float e1, float f1)
static CFX_FloatRect BoundingRectFromQuadPoints(const CPDF_Dictionary *pAnnotDict)
CPDF_DefaultAppearance(const ByteString &csDA)
bool KeyExist(const ByteString &key) const
float GetFloatFor(const ByteString &key) const
WideString GetUnicodeTextFor(const ByteString &key) const
void SetRectFor(const ByteString &key, const CFX_FloatRect &rect)
RetainPtr< const CPDF_Array > GetArrayFor(const ByteString &key) const
CFX_FloatRect GetRectFor(const ByteString &key) const
static CPDF_DocPageData * FromDocument(const CPDF_Document *pDoc)
static constexpr uint32_t kInvalidCharCode
static bool GenerateAnnotAP(CPDF_Document *pDoc, CPDF_Dictionary *pAnnotDict, CPDF_Annot::Subtype subtype)
static void GenerateEmptyAP(CPDF_Document *pDoc, CPDF_Dictionary *pAnnotDict)
static void GenerateFormAP(CPDF_Document *pDoc, CPDF_Dictionary *pAnnotDict, FormType type)
ByteString GetPDFFontAlias(int32_t nFontIndex) override
RetainPtr< CPDF_Font > GetPDFFont(int32_t nFontIndex) override
int32_t CharCodeFromUnicode(int32_t nFontIndex, uint16_t word) override
CPVT_FontMap(CPDF_Document *pDoc, RetainPtr< CPDF_Dictionary > pResDict, RetainPtr< CPDF_Font > pDefFont, const ByteString &sDefFontAlias)
int32_t GetWordFontIndex(uint16_t word, FX_Charset charset, int32_t nFontIndex) override
FX_Charset CharSetFromUnicode(uint16_t word, FX_Charset nOldCharset) override
void SetAt(int32_t nWordIndex)
bool GetWord(CPVT_Word &word) const
bool GetLine(CPVT_Line &line) const
Iterator(CPVT_VariableText *pVT)
const CPVT_WordPlace & GetWordPlace() const
void SetAt(const CPVT_WordPlace &place)
virtual int32_t GetTypeDescent(int32_t nFontIndex)
virtual int GetCharWidth(int32_t nFontIndex, uint16_t word)
virtual int32_t GetWordFontIndex(uint16_t word, FX_Charset charset, int32_t nFontIndex)
Provider(IPVT_FontMap *pFontMap)
virtual int32_t GetTypeAscent(int32_t nFontIndex)
IPVT_FontMap * GetFontMap()
virtual int32_t GetDefaultFontIndex()
float GetPlateHeight() const
void SetPlateRect(const CFX_FloatRect &rect)
CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace &place) const
CPVT_WordPlace NextLineHeaderPlace(const CPVT_WordPlace &place) const
CPVT_WordPlace PrevLineHeaderPlace(const CPVT_WordPlace &place) const
CFX_PointF GetBTPoint() const
int32_t GetLimitChar() const
CPVT_WordPlace GetBeginWordPlace() const
CPVT_WordPlace GetEndWordPlace() const
CPVT_WordPlace InsertSection(const CPVT_WordPlace &place)
int32_t WordPlaceToWordIndex(const CPVT_WordPlace &place) const
CFX_PointF GetETPoint() const
CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace &place) const
float GetFontAscent(int32_t nFontIndex, float fFontSize) const
int32_t GetAlignment() const
uint16_t GetPasswordChar() const
float GetWordWidth(const CPVT_WordInfo &WordInfo) const
float GetWordWidth(int32_t nFontIndex, uint16_t Word, uint16_t SubWord, float fFontSize, float fWordTail) const
float GetWordDescent(const CPVT_WordInfo &WordInfo) const
void SetLimitChar(int32_t nLimitChar)
CFX_FloatRect GetContentRect() const
float GetFontDescent(int32_t nFontIndex, float fFontSize) const
CPVT_WordPlace InsertWord(const CPVT_WordPlace &place, uint16_t word, FX_Charset charset)
CFX_PointF OutToIn(const CFX_PointF &point) const
CPVT_VariableText(Provider *Provider)
CFX_PointF InToOut(const CFX_PointF &point) const
void SetText(const WideString &text)
int32_t GetCharArray() const
void SetProvider(Provider *pProvider)
float GetWordAscent(const CPVT_WordInfo &WordInfo, float fFontSize) const
CPVT_VariableText::Iterator * GetIterator()
const CFX_FloatRect & GetPlateRect() const
void SetCharArray(int32_t nCharArray)
float GetPlateWidth() const
CPVT_WordPlace WordIndexToWordPlace(int32_t index) const
CPVT_WordPlace DeleteWords(const CPVT_WordRange &PlaceRange)
CPVT_WordPlace GetUpWordPlace(const CPVT_WordPlace &place, const CFX_PointF &point) const
CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace &place) const
CPVT_WordPlace GetSectionBeginPlace(const CPVT_WordPlace &place) const
CPVT_WordPlace SearchWordPlace(const CFX_PointF &point) const
CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace &place) const
CFX_FloatRect InToOut(const CPVT_FloatRect &rect) const
CPVT_WordPlace DeleteWord(const CPVT_WordPlace &place)
bool IsAutoReturn() const
float GetWordDescent(const CPVT_WordInfo &WordInfo, float fFontSize) const
void UpdateWordPlace(CPVT_WordPlace &place) const
void SetAlignment(int32_t nFormat)
void SetMultiLine(bool bMultiLine)
void RearrangePart(const CPVT_WordRange &PlaceRange)
float GetFontSize() const
CPVT_WordPlace BackSpaceWord(const CPVT_WordPlace &place)
float GetWordAscent(const CPVT_WordInfo &WordInfo) const
void SetAutoFontSize(bool bAuto)
int32_t GetTotalWords() const
uint16_t GetSubWord() const
void SetFontSize(float fFontSize)
CPVT_WordPlace GetDownWordPlace(const CPVT_WordPlace &place, const CFX_PointF &point) const
CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace &place) const
int32_t GetDefaultFontIndex()
void SetAutoReturn(bool bAuto)
void SetPasswordChar(uint16_t wSubWord)
virtual ByteString GetPDFFontAlias(int32_t nFontIndex)=0
static ByteString Format(const char *pFormat,...)
ByteString & operator+=(const ByteString &str)
ByteString & operator=(ByteString &&that) noexcept
WideString & operator+=(const WideString &str)
WideString & operator+=(wchar_t ch)
#define FXSYS_IsFloatBigger(fa, fb)
#define FXSYS_IsFloatZero(f)
#define FXSYS_IsFloatSmaller(fa, fb)
CFX_Color CFXColorFromArray(const CPDF_Array &array)
CFX_Color CFXColorFromString(const ByteString &str)
const char kWinAnsiEncoding[]
CFX_Color & operator=(const CFX_Color &that)=default
constexpr CFX_Color(Type type=CFX_Color::Type::kTransparent, float color1=0.0f, float color2=0.0f, float color3=0.0f, float color4=0.0f)
int32_t LineCmp(const CPVT_WordPlace &wp) const