summaryrefslogtreecommitdiff
path: root/core/include
diff options
context:
space:
mode:
Diffstat (limited to 'core/include')
-rw-r--r--core/include/fpdfdoc/fpdf_vt.h186
1 files changed, 52 insertions, 134 deletions
diff --git a/core/include/fpdfdoc/fpdf_vt.h b/core/include/fpdfdoc/fpdf_vt.h
index 1e0d351fee..d8a904c632 100644
--- a/core/include/fpdfdoc/fpdf_vt.h
+++ b/core/include/fpdfdoc/fpdf_vt.h
@@ -10,8 +10,6 @@
#include "core/include/fxge/fx_dib.h"
class IPDF_VariableText;
-class IPDF_VariableText_Iterator;
-class IPDF_VariableText_Provider;
struct CPVT_Line;
struct CPVT_Section;
struct CPVT_Word;
@@ -39,57 +37,43 @@ struct CPVT_WordPlace {
FX_BOOL operator!=(const CPVT_WordPlace& wp) const { return !(*this == wp); }
inline int32_t WordCmp(const CPVT_WordPlace& wp) const {
- if (nSecIndex > wp.nSecIndex) {
+ if (nSecIndex > wp.nSecIndex)
return 1;
- }
- if (nSecIndex < wp.nSecIndex) {
+ if (nSecIndex < wp.nSecIndex)
return -1;
- }
- if (nLineIndex > wp.nLineIndex) {
+ if (nLineIndex > wp.nLineIndex)
return 1;
- }
- if (nLineIndex < wp.nLineIndex) {
+ if (nLineIndex < wp.nLineIndex)
return -1;
- }
- if (nWordIndex > wp.nWordIndex) {
+ if (nWordIndex > wp.nWordIndex)
return 1;
- }
- if (nWordIndex < wp.nWordIndex) {
+ if (nWordIndex < wp.nWordIndex)
return -1;
- }
return 0;
}
inline int32_t LineCmp(const CPVT_WordPlace& wp) const {
- if (nSecIndex > wp.nSecIndex) {
+ if (nSecIndex > wp.nSecIndex)
return 1;
- }
- if (nSecIndex < wp.nSecIndex) {
+ if (nSecIndex < wp.nSecIndex)
return -1;
- }
- if (nLineIndex > wp.nLineIndex) {
+ if (nLineIndex > wp.nLineIndex)
return 1;
- }
- if (nLineIndex < wp.nLineIndex) {
+ if (nLineIndex < wp.nLineIndex)
return -1;
- }
return 0;
}
inline int32_t SecCmp(const CPVT_WordPlace& wp) const {
- if (nSecIndex > wp.nSecIndex) {
+ if (nSecIndex > wp.nSecIndex)
return 1;
- }
- if (nSecIndex < wp.nSecIndex) {
+ if (nSecIndex < wp.nSecIndex)
return -1;
- }
return 0;
}
int32_t nSecIndex;
-
int32_t nLineIndex;
-
int32_t nWordIndex;
};
struct CPVT_WordRange {
@@ -135,7 +119,6 @@ struct CPVT_WordRange {
}
CPVT_WordPlace BeginPos;
-
CPVT_WordPlace EndPos;
};
struct CPVT_SecProps {
@@ -152,9 +135,7 @@ struct CPVT_SecProps {
nAlignment(other.nAlignment) {}
FX_FLOAT fLineLeading;
-
FX_FLOAT fLineIndent;
-
int32_t nAlignment;
};
struct CPVT_WordProps {
@@ -192,17 +173,11 @@ struct CPVT_WordProps {
nHorzScale(other.nHorzScale) {}
int32_t nFontIndex;
-
FX_FLOAT fFontSize;
-
FX_COLORREF dwWordColor;
-
int32_t nScriptType;
-
int32_t nWordStyle;
-
FX_FLOAT fCharSpace;
-
int32_t nHorzScale;
};
struct CPVT_Word {
@@ -217,23 +192,14 @@ struct CPVT_Word {
WordProps() {}
uint16_t Word;
-
int32_t nCharset;
-
CPVT_WordPlace WordPlace;
-
CFX_FloatPoint ptWord;
-
FX_FLOAT fAscent;
-
FX_FLOAT fDescent;
-
FX_FLOAT fWidth;
-
int32_t nFontIndex;
-
FX_FLOAT fFontSize;
-
CPVT_WordProps WordProps;
};
struct CPVT_Line {
@@ -241,104 +207,84 @@ struct CPVT_Line {
: ptLine(0, 0), fLineWidth(0.0f), fLineAscent(0.0f), fLineDescent(0.0f) {}
CPVT_WordPlace lineplace;
-
CPVT_WordPlace lineEnd;
-
CFX_FloatPoint ptLine;
-
FX_FLOAT fLineWidth;
-
FX_FLOAT fLineAscent;
-
FX_FLOAT fLineDescent;
};
struct CPVT_Section {
CPVT_WordPlace secplace;
-
CFX_FloatRect rcSection;
-
CPVT_SecProps SecProps;
-
CPVT_WordProps WordProps;
};
-class IPDF_VariableText_Iterator {
- public:
- virtual ~IPDF_VariableText_Iterator() {}
-
- virtual FX_BOOL NextWord() = 0;
-
- virtual FX_BOOL PrevWord() = 0;
-
- virtual FX_BOOL NextLine() = 0;
-
- virtual FX_BOOL PrevLine() = 0;
-
- virtual FX_BOOL NextSection() = 0;
-
- virtual FX_BOOL PrevSection() = 0;
-
- virtual FX_BOOL GetWord(CPVT_Word& word) const = 0;
-
- virtual FX_BOOL SetWord(const CPVT_Word& word) = 0;
-
- virtual FX_BOOL GetLine(CPVT_Line& line) const = 0;
-
- virtual FX_BOOL GetSection(CPVT_Section& section) const = 0;
-
- virtual FX_BOOL SetSection(const CPVT_Section& section) = 0;
-
- virtual void SetAt(int32_t nWordIndex) = 0;
-
- virtual void SetAt(const CPVT_WordPlace& place) = 0;
-
- virtual const CPVT_WordPlace& GetAt() const = 0;
-};
class IPDF_VariableText {
public:
- static IPDF_VariableText* NewVariableText();
+ class Provider {
+ public:
+ virtual ~Provider() {}
+
+ virtual int32_t GetCharWidth(int32_t nFontIndex,
+ uint16_t word,
+ int32_t nWordStyle) = 0;
+ virtual int32_t GetTypeAscent(int32_t nFontIndex) = 0;
+ virtual int32_t GetTypeDescent(int32_t nFontIndex) = 0;
+ virtual int32_t GetWordFontIndex(uint16_t word,
+ int32_t charset,
+ int32_t nFontIndex) = 0;
+ virtual int32_t GetDefaultFontIndex() = 0;
+ virtual FX_BOOL IsLatinWord(uint16_t word) = 0;
+ };
+
+ class Iterator {
+ public:
+ virtual ~Iterator() {}
+
+ virtual FX_BOOL NextWord() = 0;
+ virtual FX_BOOL PrevWord() = 0;
+ virtual FX_BOOL NextLine() = 0;
+ virtual FX_BOOL PrevLine() = 0;
+ virtual FX_BOOL NextSection() = 0;
+ virtual FX_BOOL PrevSection() = 0;
+ virtual FX_BOOL GetWord(CPVT_Word& word) const = 0;
+ virtual FX_BOOL SetWord(const CPVT_Word& word) = 0;
+ virtual FX_BOOL GetLine(CPVT_Line& line) const = 0;
+ virtual FX_BOOL GetSection(CPVT_Section& section) const = 0;
+ virtual FX_BOOL SetSection(const CPVT_Section& section) = 0;
+ virtual void SetAt(int32_t nWordIndex) = 0;
+ virtual void SetAt(const CPVT_WordPlace& place) = 0;
+ virtual const CPVT_WordPlace& GetAt() const = 0;
+ };
+ static IPDF_VariableText* NewVariableText();
static void DelVariableText(IPDF_VariableText* pVT);
- virtual IPDF_VariableText_Provider* SetProvider(
- IPDF_VariableText_Provider* pProvider) = 0;
+ virtual void Initialize() = 0;
- virtual IPDF_VariableText_Iterator* GetIterator() = 0;
+ virtual Provider* SetProvider(Provider* pProvider) = 0;
+ virtual Iterator* GetIterator() = 0;
virtual void SetPlateRect(const CFX_FloatRect& rect) = 0;
-
virtual void SetAlignment(int32_t nFormat = 0) = 0;
-
virtual void SetPasswordChar(uint16_t wSubWord = '*') = 0;
-
virtual void SetLimitChar(int32_t nLimitChar = 0) = 0;
-
virtual void SetCharArray(int32_t nCharArray = 0) = 0;
-
virtual void SetCharSpace(FX_FLOAT fCharSpace = 0.0f) = 0;
-
virtual void SetHorzScale(int32_t nHorzScale = 100) = 0;
-
virtual void SetMultiLine(FX_BOOL bMultiLine = TRUE) = 0;
-
virtual void SetAutoReturn(FX_BOOL bAuto = TRUE) = 0;
-
virtual void SetAutoFontSize(FX_BOOL bAuto = TRUE) = 0;
-
virtual void SetFontSize(FX_FLOAT fFontSize) = 0;
-
virtual void SetLineLeading(FX_FLOAT fLineLeading) = 0;
-
virtual void SetRichText(FX_BOOL bRichText) = 0;
- virtual void Initialize() = 0;
-
virtual FX_BOOL IsValid() const = 0;
-
virtual FX_BOOL IsRichText() const = 0;
+ virtual FX_BOOL IsMultiLine() const = 0;
virtual void RearrangeAll() = 0;
-
virtual void RearrangePart(const CPVT_WordRange& PlaceRange) = 0;
virtual void ResetAll() = 0;
@@ -347,18 +293,15 @@ class IPDF_VariableText {
int32_t charset = 1,
const CPVT_SecProps* pSecProps = NULL,
const CPVT_WordProps* pWordProps = NULL) = 0;
-
virtual CPVT_WordPlace InsertWord(
const CPVT_WordPlace& place,
uint16_t word,
int32_t charset = 1,
const CPVT_WordProps* pWordProps = NULL) = 0;
-
virtual CPVT_WordPlace InsertSection(
const CPVT_WordPlace& place,
const CPVT_SecProps* pSecProps = NULL,
const CPVT_WordProps* pWordProps = NULL) = 0;
-
virtual CPVT_WordPlace InsertText(
const CPVT_WordPlace& place,
const FX_WCHAR* text,
@@ -367,70 +310,45 @@ class IPDF_VariableText {
const CPVT_WordProps* pWordProps = NULL) = 0;
virtual CPVT_WordPlace DeleteWords(const CPVT_WordRange& PlaceRange) = 0;
-
virtual CPVT_WordPlace DeleteWord(const CPVT_WordPlace& place) = 0;
-
virtual CPVT_WordPlace BackSpaceWord(const CPVT_WordPlace& place) = 0;
virtual const CFX_FloatRect& GetPlateRect() const = 0;
-
virtual CFX_FloatRect GetContentRect() const = 0;
-
virtual int32_t GetTotalWords() const = 0;
-
virtual FX_FLOAT GetFontSize() const = 0;
-
virtual int32_t GetAlignment() const = 0;
-
virtual uint16_t GetPasswordChar() const = 0;
-
virtual int32_t GetCharArray() const = 0;
-
virtual int32_t GetLimitChar() const = 0;
-
- virtual FX_BOOL IsMultiLine() const = 0;
-
virtual int32_t GetHorzScale() const = 0;
-
virtual FX_FLOAT GetCharSpace() const = 0;
-
virtual CPVT_WordPlace GetBeginWordPlace() const = 0;
-
virtual CPVT_WordPlace GetEndWordPlace() const = 0;
-
virtual CPVT_WordPlace GetPrevWordPlace(
const CPVT_WordPlace& place) const = 0;
-
virtual CPVT_WordPlace GetNextWordPlace(
const CPVT_WordPlace& place) const = 0;
virtual CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const = 0;
-
virtual CPVT_WordPlace GetUpWordPlace(const CPVT_WordPlace& place,
const CFX_FloatPoint& point) const = 0;
-
virtual CPVT_WordPlace GetDownWordPlace(
const CPVT_WordPlace& place,
const CFX_FloatPoint& point) const = 0;
-
virtual CPVT_WordPlace GetLineBeginPlace(
const CPVT_WordPlace& place) const = 0;
-
virtual CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace& place) const = 0;
-
virtual CPVT_WordPlace GetSectionBeginPlace(
const CPVT_WordPlace& place) const = 0;
-
virtual CPVT_WordPlace GetSectionEndPlace(
const CPVT_WordPlace& place) const = 0;
virtual void UpdateWordPlace(CPVT_WordPlace& place) const = 0;
-
virtual CPVT_WordPlace AdjustLineHeader(const CPVT_WordPlace& place,
FX_BOOL bPrevOrNext) const = 0;
virtual int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const = 0;
-
virtual CPVT_WordPlace WordIndexToWordPlace(int32_t index) const = 0;
protected: