summaryrefslogtreecommitdiff
path: root/fpdfsdk/include
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/include')
-rw-r--r--fpdfsdk/include/fsdk_define.h1
-rw-r--r--fpdfsdk/include/fxedit/fx_edit.h115
-rw-r--r--fpdfsdk/include/fxedit/fxet_edit.h31
-rw-r--r--fpdfsdk/include/fxedit/fxet_list.h6
4 files changed, 103 insertions, 50 deletions
diff --git a/fpdfsdk/include/fsdk_define.h b/fpdfsdk/include/fsdk_define.h
index 706880ab72..9d81737f62 100644
--- a/fpdfsdk/include/fsdk_define.h
+++ b/fpdfsdk/include/fsdk_define.h
@@ -9,7 +9,6 @@
#include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h"
#include "core/include/fpdfdoc/fpdf_doc.h"
-#include "core/include/fpdfdoc/fpdf_vt.h"
#include "core/include/fxge/fx_ge.h"
#include "core/include/fxge/fx_ge_win32.h"
#include "public/fpdfview.h"
diff --git a/fpdfsdk/include/fxedit/fx_edit.h b/fpdfsdk/include/fxedit/fx_edit.h
index 2adf97b882..532e96d97f 100644
--- a/fpdfsdk/include/fxedit/fx_edit.h
+++ b/fpdfsdk/include/fxedit/fx_edit.h
@@ -7,18 +7,18 @@
#ifndef FPDFSDK_INCLUDE_FXEDIT_FX_EDIT_H_
#define FPDFSDK_INCLUDE_FXEDIT_FX_EDIT_H_
+#include "core/fpdfdoc/include/cpdf_variabletext.h"
#include "core/fxcrt/include/fx_basic.h"
-#include "core/include/fpdfdoc/fpdf_vt.h"
#include "core/include/fxge/fx_dib.h"
-class CFX_RenderDevice;
class CPDF_Font;
-class CFX_Matrix;
class CPDF_PageObjectHolder;
-class CFX_FloatPoint;
class CPDF_TextObject;
+class CFX_FloatPoint;
+class CFX_Matrix;
+class CFX_RenderDevice;
class IFX_Edit;
-class IFX_Edit_FontMap;
+class IPVT_FontMap;
class IFX_Edit_Iterator;
class IFX_Edit_Notify;
class IFX_Edit_UndoItem;
@@ -51,23 +51,6 @@ struct CPVT_WordRange;
#define DEFAULT_CHARSET 1
#endif
-class IFX_Edit_FontMap {
- public:
- virtual ~IFX_Edit_FontMap() {}
- // map a fontindex to pdf font.
- virtual CPDF_Font* GetPDFFont(int32_t nFontIndex) = 0;
- // get the alias of a pdf font.
- virtual CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) = 0;
- // get the index of a font that can show a word.
- virtual int32_t GetWordFontIndex(uint16_t word,
- int32_t charset,
- int32_t nFontIndex) = 0;
- // get the charcode of word from unicode
- virtual int32_t CharCodeFromUnicode(int32_t nFontIndex, uint16_t word) = 0;
- // get the charset of unicode
- virtual int32_t CharSetFromUnicode(uint16_t word, int32_t nOldCharset) = 0;
-};
-
class IFX_Edit_Notify {
public:
virtual ~IFX_Edit_Notify() {}
@@ -183,21 +166,26 @@ class IFX_Edit {
static IFX_Edit* NewEdit();
static void DelEdit(IFX_Edit* pEdit);
- // set a IFX_Edit_FontMap pointer implemented by user.
- virtual void SetFontMap(IFX_Edit_FontMap* pFontMap) = 0;
+ // set a IPVT_FontMap pointer implemented by user.
+ virtual void SetFontMap(IPVT_FontMap* pFontMap) = 0;
+
// if user don't like to use FontMap, implement VTProvider and set it
// directly.
- virtual void SetVTProvider(IPDF_VariableText::Provider* pProvider) = 0;
+ virtual void SetVTProvider(CPDF_VariableText::Provider* pProvider) = 0;
+
// set a IFX_Edit_Notify pointer implemented by user.
virtual void SetNotify(IFX_Edit_Notify* pNotify) = 0;
virtual void SetOprNotify(IFX_Edit_OprNotify* pOprNotify) = 0;
+
// get a pointer allocated by CPDF_Edit, by this pointer, user can iterate the
// contents of edit, but don't need to release.
virtual IFX_Edit_Iterator* GetIterator() = 0;
+
// get a VT pointer relative to this edit.
- virtual IPDF_VariableText* GetVariableText() = 0;
- // get the IFX_Edit_FontMap pointer set by user.
- virtual IFX_Edit_FontMap* GetFontMap() = 0;
+ virtual CPDF_VariableText* GetVariableText() = 0;
+
+ // get the IPVT_FontMap pointer set by user.
+ virtual IPVT_FontMap* GetFontMap() = 0;
// initialize the edit.
virtual void Initialize() = 0;
@@ -205,106 +193,148 @@ class IFX_Edit {
// set the bounding box of the text area.
virtual void SetPlateRect(const CFX_FloatRect& rect,
FX_BOOL bPaint = TRUE) = 0;
+
// set the scroll origin
virtual void SetScrollPos(const CFX_FloatPoint& point) = 0;
// set the horizontal text alignment in text box, nFormat (0:left 1:middle
// 2:right).
virtual void SetAlignmentH(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) = 0;
+
// set the vertical text alignment in text box, nFormat (0:top 1:center
// 2:bottom).
virtual void SetAlignmentV(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) = 0;
+
// if the text is shown in secret , set a character for substitute.
virtual void SetPasswordChar(uint16_t wSubWord = '*',
FX_BOOL bPaint = TRUE) = 0;
+
// set the maximal count of words of the text.
virtual void SetLimitChar(int32_t nLimitChar = 0, FX_BOOL bPaint = TRUE) = 0;
+
// if set the count of charArray , then all words is shown in equal space.
virtual void SetCharArray(int32_t nCharArray = 0, FX_BOOL bPaint = TRUE) = 0;
+
// set the space of two characters.
virtual void SetCharSpace(FX_FLOAT fCharSpace = 0.0f,
FX_BOOL bPaint = TRUE) = 0;
+
// set the horizontal scale of all characters.
virtual void SetHorzScale(int32_t nHorzScale = 100,
FX_BOOL bPaint = TRUE) = 0;
+
// set the leading of all lines
virtual void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE) = 0;
+
// if set, CRLF is allowed.
virtual void SetMultiLine(FX_BOOL bMultiLine = TRUE,
FX_BOOL bPaint = TRUE) = 0;
+
// if set, all words auto fit the width of the bounding box.
virtual void SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0;
+
// if set, a font size is calculated to full fit the bounding box.
virtual void SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0;
+
// is set, the text is allowed to scroll.
virtual void SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0;
+
// set the font size of all words.
virtual void SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE) = 0;
+
// the text is allowed to auto-scroll, allow the text overflow?
virtual void SetTextOverflow(FX_BOOL bAllowed = FALSE,
FX_BOOL bPaint = TRUE) = 0;
// query if the edit is richedit.
virtual FX_BOOL IsRichText() const = 0;
+
// set the edit is richedit.
virtual void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE) = 0;
+
// set the fontsize of selected text.
virtual FX_BOOL SetRichFontSize(FX_FLOAT fFontSize) = 0;
+
// set the fontindex of selected text, user can change the font of selected
// text.
virtual FX_BOOL SetRichFontIndex(int32_t nFontIndex) = 0;
+
// set the textcolor of selected text.
virtual FX_BOOL SetRichTextColor(FX_COLORREF dwColor) = 0;
+
// set the text script type of selected text. (0:normal 1:superscript
// 2:subscript)
- virtual FX_BOOL SetRichTextScript(int32_t nScriptType) = 0;
+ virtual FX_BOOL SetRichTextScript(
+ CPDF_VariableText::ScriptType nScriptType) = 0;
+
// set the bold font style of selected text.
virtual FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE) = 0;
+
// set the italic font style of selected text.
virtual FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE) = 0;
+
// set the underline style of selected text.
virtual FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE) = 0;
+
// set the crossout style of selected text.
virtual FX_BOOL SetRichTextCrossout(FX_BOOL bCrossout = TRUE) = 0;
+
// set the charspace of selected text, in user coordinate.
virtual FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace) = 0;
+
// set the horizontal scale of selected text, default value is 100.
virtual FX_BOOL SetRichTextHorzScale(int32_t nHorzScale = 100) = 0;
+
// set the leading of selected section, in user coordinate.
virtual FX_BOOL SetRichTextLineLeading(FX_FLOAT fLineLeading) = 0;
+
// set the indent of selected section, in user coordinate.
virtual FX_BOOL SetRichTextLineIndent(FX_FLOAT fLineIndent) = 0;
+
// set the alignment of selected section, nAlignment(0:left 1:middle 2:right)
virtual FX_BOOL SetRichTextAlignment(int32_t nAlignment) = 0;
// set the selected range of text.
// if nStartChar == 0 and nEndChar == -1, select all the text.
virtual void SetSel(int32_t nStartChar, int32_t nEndChar) = 0;
+
// get the selected range of text.
virtual void GetSel(int32_t& nStartChar, int32_t& nEndChar) const = 0;
+
// select all the text.
virtual void SelectAll() = 0;
+
// set text is not selected.
virtual void SelectNone() = 0;
+
// get the caret position.
virtual int32_t GetCaret() const = 0;
virtual CPVT_WordPlace GetCaretWordPlace() const = 0;
+
// get the string of selected text.
virtual CFX_WideString GetSelText() const = 0;
+
// get the text conent
virtual CFX_WideString GetText() const = 0;
+
// query if any text is selected.
virtual FX_BOOL IsSelected() const = 0;
+
// get the scroll origin
virtual CFX_FloatPoint GetScrollPos() const = 0;
+
// get the bounding box of the text area.
virtual CFX_FloatRect GetPlateRect() const = 0;
+
// get the fact area of the text.
virtual CFX_FloatRect GetContentRect() const = 0;
+
// get the visible word range
virtual CPVT_WordRange GetVisibleWordRange() const = 0;
+
// get the whole word range
virtual CPVT_WordRange GetWholeWordRange() const = 0;
+
// get the word range of select text
virtual CPVT_WordRange GetSelectWordRange() const = 0;
@@ -313,20 +343,27 @@ class IFX_Edit {
virtual void OnMouseDown(const CFX_FloatPoint& point,
FX_BOOL bShift,
FX_BOOL bCtrl) = 0;
+
// send the mousemove message to edit when mouse down is TRUE.
virtual void OnMouseMove(const CFX_FloatPoint& point,
FX_BOOL bShift,
FX_BOOL bCtrl) = 0;
+
// send the UP key message to edit.
virtual void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) = 0;
+
// send the DOWN key message to edit.
virtual void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl) = 0;
+
// send the LEFT key message to edit.
virtual void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl) = 0;
+
// send the RIGHT key message to edit.
virtual void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) = 0;
+
// send the HOME key message to edit.
virtual void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) = 0;
+
// send the END key message to edit.
virtual void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) = 0;
@@ -335,29 +372,37 @@ class IFX_Edit {
int32_t charset = DEFAULT_CHARSET,
const CPVT_SecProps* pSecProps = NULL,
const CPVT_WordProps* pWordProps = NULL) = 0;
+
// insert a word into the edit.
virtual FX_BOOL InsertWord(uint16_t word,
int32_t charset = DEFAULT_CHARSET,
const CPVT_WordProps* pWordProps = NULL) = 0;
+
// insert a return into the edit.
virtual FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps = NULL,
const CPVT_WordProps* pWordProps = NULL) = 0;
+
// insert text into the edit.
virtual FX_BOOL InsertText(const FX_WCHAR* text,
int32_t charset = DEFAULT_CHARSET,
const CPVT_SecProps* pSecProps = NULL,
const CPVT_WordProps* pWordProps = NULL) = 0;
+
// do backspace operation.
virtual FX_BOOL Backspace() = 0;
+
// do delete operation.
virtual FX_BOOL Delete() = 0;
+
// delete the selected text.
virtual FX_BOOL Clear() = 0;
// do Redo operation.
virtual FX_BOOL Redo() = 0;
+
// do Undo operation.
virtual FX_BOOL Undo() = 0;
+
// move caret
virtual void SetCaret(int32_t nPos) = 0;
@@ -403,22 +448,30 @@ class IFX_Edit {
// get the font size of non_rich text or default font size of richtext.
virtual FX_FLOAT GetFontSize() const = 0;
+
// get the mask character.
virtual uint16_t GetPasswordChar() const = 0;
+
// get the count of charArray
virtual int32_t GetCharArray() const = 0;
+
// get the horizontal scale of all characters
virtual int32_t GetHorzScale() const = 0;
+
// get the space of two characters
virtual FX_FLOAT GetCharSpace() const = 0;
+
// get the latin words of specified range
virtual CFX_WideString GetRangeText(const CPVT_WordRange& range) const = 0;
+
// is the text full in bounding box
virtual FX_BOOL IsTextFull() const = 0;
virtual FX_BOOL CanUndo() const = 0;
virtual FX_BOOL CanRedo() const = 0;
+
// if the content is changed after settext?
virtual FX_BOOL IsModified() const = 0;
+
// get the total words in edit
virtual int32_t GetTotalWords() const = 0;
@@ -512,7 +565,7 @@ class IFX_List {
static IFX_List* NewList();
static void DelList(IFX_List* pList);
- virtual void SetFontMap(IFX_Edit_FontMap* pFontMap) = 0;
+ virtual void SetFontMap(IPVT_FontMap* pFontMap) = 0;
virtual void SetNotify(IFX_List_Notify* pNotify) = 0;
virtual void SetPlateRect(const CFX_FloatRect& rect) = 0;
@@ -568,7 +621,7 @@ class IFX_List {
virtual ~IFX_List() {}
};
-CFX_ByteString GetPDFWordString(IFX_Edit_FontMap* pFontMap,
+CFX_ByteString GetPDFWordString(IPVT_FontMap* pFontMap,
int32_t nFontIndex,
uint16_t Word,
uint16_t SubWord);
diff --git a/fpdfsdk/include/fxedit/fxet_edit.h b/fpdfsdk/include/fxedit/fxet_edit.h
index a9df992bf2..fb6c917582 100644
--- a/fpdfsdk/include/fxedit/fxet_edit.h
+++ b/fpdfsdk/include/fxedit/fxet_edit.h
@@ -7,7 +7,8 @@
#ifndef FPDFSDK_INCLUDE_FXEDIT_FXET_EDIT_H_
#define FPDFSDK_INCLUDE_FXEDIT_FXET_EDIT_H_
-#include "core/include/fpdfdoc/fpdf_vt.h"
+#include "core/fpdfdoc/include/cpvt_secprops.h"
+#include "core/fpdfdoc/include/cpvt_wordprops.h"
#include "fpdfsdk/include/fxedit/fx_edit.h"
class CFX_Edit;
@@ -510,17 +511,17 @@ class CFX_Edit : public IFX_Edit {
friend class CFXEU_InsertText;
public:
- explicit CFX_Edit(IPDF_VariableText* pVT);
+ explicit CFX_Edit(CPDF_VariableText* pVT);
~CFX_Edit() override;
// IFX_Edit
- void SetFontMap(IFX_Edit_FontMap* pFontMap) override;
- void SetVTProvider(IPDF_VariableText::Provider* pProvider) override;
+ void SetFontMap(IPVT_FontMap* pFontMap) override;
+ void SetVTProvider(CPDF_VariableText::Provider* pProvider) override;
void SetNotify(IFX_Edit_Notify* pNotify) override;
void SetOprNotify(IFX_Edit_OprNotify* pOprNotify) override;
IFX_Edit_Iterator* GetIterator() override;
- IPDF_VariableText* GetVariableText() override;
- IFX_Edit_FontMap* GetFontMap() override;
+ CPDF_VariableText* GetVariableText() override;
+ IPVT_FontMap* GetFontMap() override;
void Initialize() override;
void SetPlateRect(const CFX_FloatRect& rect, FX_BOOL bPaint = TRUE) override;
void SetScrollPos(const CFX_FloatPoint& point) override;
@@ -544,7 +545,7 @@ class CFX_Edit : public IFX_Edit {
FX_BOOL SetRichFontSize(FX_FLOAT fFontSize) override;
FX_BOOL SetRichFontIndex(int32_t nFontIndex) override;
FX_BOOL SetRichTextColor(FX_COLORREF dwColor) override;
- FX_BOOL SetRichTextScript(int32_t nScriptType) override;
+ FX_BOOL SetRichTextScript(CPDF_VariableText::ScriptType nScriptType) override;
FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE) override;
FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE) override;
FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE) override;
@@ -725,7 +726,7 @@ class CFX_Edit : public IFX_Edit {
FX_FLOAT GetLineBottom(const CPVT_WordPlace& place) const;
private:
- IPDF_VariableText* m_pVT;
+ CPDF_VariableText* m_pVT;
IFX_Edit_Notify* m_pNotify;
IFX_Edit_OprNotify* m_pOprNotify;
CFX_Edit_Provider* m_pVTProvide;
@@ -754,7 +755,7 @@ class CFX_Edit : public IFX_Edit {
class CFX_Edit_Iterator : public IFX_Edit_Iterator {
public:
- CFX_Edit_Iterator(CFX_Edit* pEdit, IPDF_VariableText::Iterator* pVTIterator);
+ CFX_Edit_Iterator(CFX_Edit* pEdit, CPDF_VariableText::Iterator* pVTIterator);
~CFX_Edit_Iterator() override;
// IFX_Edit_Iterator
@@ -774,17 +775,17 @@ class CFX_Edit_Iterator : public IFX_Edit_Iterator {
private:
CFX_Edit* m_pEdit;
- IPDF_VariableText::Iterator* m_pVTIterator;
+ CPDF_VariableText::Iterator* m_pVTIterator;
};
-class CFX_Edit_Provider : public IPDF_VariableText::Provider {
+class CFX_Edit_Provider : public CPDF_VariableText::Provider {
public:
- explicit CFX_Edit_Provider(IFX_Edit_FontMap* pFontMap);
+ explicit CFX_Edit_Provider(IPVT_FontMap* pFontMap);
~CFX_Edit_Provider() override;
- IFX_Edit_FontMap* GetFontMap();
+ IPVT_FontMap* GetFontMap();
- // IPDF_VariableText::Provider:
+ // CPDF_VariableText::Provider:
int32_t GetCharWidth(int32_t nFontIndex,
uint16_t word,
int32_t nWordStyle) override;
@@ -797,7 +798,7 @@ class CFX_Edit_Provider : public IPDF_VariableText::Provider {
FX_BOOL IsLatinWord(uint16_t word) override;
private:
- IFX_Edit_FontMap* m_pFontMap;
+ IPVT_FontMap* m_pFontMap;
};
#endif // FPDFSDK_INCLUDE_FXEDIT_FXET_EDIT_H_
diff --git a/fpdfsdk/include/fxedit/fxet_list.h b/fpdfsdk/include/fxedit/fxet_list.h
index d86e6ffeee..0018f13b46 100644
--- a/fpdfsdk/include/fxedit/fxet_list.h
+++ b/fpdfsdk/include/fxedit/fxet_list.h
@@ -118,7 +118,7 @@ class CFX_ListItem {
CFX_ListItem();
virtual ~CFX_ListItem();
- void SetFontMap(IFX_Edit_FontMap* pFontMap);
+ void SetFontMap(IPVT_FontMap* pFontMap);
IFX_Edit_Iterator* GetIterator() const;
IFX_Edit* GetEdit() const;
@@ -210,7 +210,7 @@ class CFX_List : protected CFX_ListContainer, public IFX_List {
~CFX_List() override;
// IFX_List:
- void SetFontMap(IFX_Edit_FontMap* pFontMap) override;
+ void SetFontMap(IPVT_FontMap* pFontMap) override;
void SetFontSize(FX_FLOAT fFontSize) override;
CFX_FloatRect GetPlateRect() const override;
CFX_FloatRect GetContentRect() const override;
@@ -240,7 +240,7 @@ class CFX_List : protected CFX_ListContainer, public IFX_List {
private:
CLST_ArrayTemplate<CFX_ListItem*> m_aListItems;
FX_FLOAT m_fFontSize;
- IFX_Edit_FontMap* m_pFontMap;
+ IPVT_FontMap* m_pFontMap;
FX_BOOL m_bMultiple;
};