summaryrefslogtreecommitdiff
path: root/fpdfsdk/include/fxedit
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/include/fxedit')
-rw-r--r--fpdfsdk/include/fxedit/fx_edit.h471
-rw-r--r--fpdfsdk/include/fxedit/fxet_edit.h823
-rw-r--r--fpdfsdk/include/fxedit/fxet_list.h363
-rw-r--r--fpdfsdk/include/fxedit/fxet_stub.h26
4 files changed, 1683 insertions, 0 deletions
diff --git a/fpdfsdk/include/fxedit/fx_edit.h b/fpdfsdk/include/fxedit/fx_edit.h
new file mode 100644
index 0000000000..2b73e61bc4
--- /dev/null
+++ b/fpdfsdk/include/fxedit/fx_edit.h
@@ -0,0 +1,471 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef _FX_EDIT_H_
+#define _FX_EDIT_H_
+
+#define PVTWORD_STYLE_NORMAL 0x0000L
+#define PVTWORD_STYLE_HIGHLIGHT 0x0001L
+#define PVTWORD_STYLE_UNDERLINE 0x0002L
+#define PVTWORD_STYLE_CROSSOUT 0x0004L
+#define PVTWORD_STYLE_SQUIGGLY 0x0008L
+#define PVTWORD_STYLE_DUALCROSSOUT 0x0010L
+#define PVTWORD_STYLE_BOLD 0x0020L
+#define PVTWORD_STYLE_ITALIC 0x0040L
+
+#define FX_EDIT_ISLATINWORD(u) (u == 0x2D || (u <= 0x005A && u >= 0x0041) || (u <= 0x007A && u >= 0x0061) || (u <= 0x02AF && u >= 0x00C0))
+
+#ifdef FX_READER_DLL
+ #ifdef FXET_EXPORT
+ #define FXET_CLASS __declspec(dllexport)
+ #else
+ #define FXET_CLASS
+ #endif
+#else
+ #define FXET_CLASS
+#endif
+
+#ifndef DEFAULT_CHARSET
+#define DEFAULT_CHARSET 1
+#endif
+
+class IFX_Edit_FontMap;
+class IFX_Edit_Notify;
+class IFX_Edit_Iterator;
+class IFX_Edit_UndoItem;
+class IFX_Edit;
+class IFX_List_Notify;
+class IFX_List;
+class IFX_SystemHandler;
+
+class IFX_Edit_FontMap
+{
+public:
+ //map a fontindex to pdf font.
+ virtual CPDF_Font * GetPDFFont(FX_INT32 nFontIndex) = 0;
+ //get the alias of a pdf font.
+ virtual CFX_ByteString GetPDFFontAlias(FX_INT32 nFontIndex) = 0;
+ //get the index of a font that can show a word.
+ virtual FX_INT32 GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex) = 0;
+ //get the charcode of word from unicode
+ virtual FX_INT32 CharCodeFromUnicode(FX_INT32 nFontIndex, FX_WORD word) = 0;
+ //get the charset of unicode
+ virtual FX_INT32 CharSetFromUnicode(FX_WORD word, FX_INT32 nOldCharset) = 0;
+};
+
+class IFX_Edit_Notify
+{
+ //this class is implemented by user
+public:
+ //set the horizontal scrollbar information.
+ virtual void IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax,
+ FX_FLOAT fContentMin, FX_FLOAT fContentMax,
+ FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;
+ //set the vertical scrollbar information.
+ virtual void IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax,
+ FX_FLOAT fContentMin, FX_FLOAT fContentMax,
+ FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;
+ //set the position of horizontal scrollbar.
+ virtual void IOnSetScrollPosX(FX_FLOAT fx) = 0;
+ //set the position of vertical scrollbar.
+ virtual void IOnSetScrollPosY(FX_FLOAT fy) = 0;
+ //set the caret information.
+ virtual void IOnSetCaret(FX_BOOL bVisible,const CPDF_Point & ptHead,const CPDF_Point & ptFoot, const CPVT_WordPlace& place) = 0;
+ //if the caret position is changed ,send the information of current postion to user.
+ virtual void IOnCaretChange(const CPVT_SecProps & secProps, const CPVT_WordProps & wordProps) = 0;
+ //if the text area is changed, send the information to user.
+ virtual void IOnContentChange(const CPDF_Rect& rcContent) = 0;
+ //Invalidate the rectangle relative to the bounding box of edit.
+ virtual void IOnInvalidateRect(CPDF_Rect * pRect) = 0;
+};
+
+class IFX_Edit_OprNotify
+{
+ //this class is implemented by user
+public:
+ //OprType: 0
+ virtual void OnInsertWord(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
+ //OprType: 1
+ virtual void OnInsertReturn(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
+ //OprType: 2
+ virtual void OnBackSpace(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
+ //OprType: 3
+ virtual void OnDelete(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
+ //OprType: 4
+ virtual void OnClear(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
+ //OprType: 5
+ virtual void OnInsertText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
+ //OprType: 6
+ virtual void OnSetText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
+ //
+ virtual void OnAddUndo(IFX_Edit_UndoItem* pUndoItem) = 0;
+};
+
+class IFX_Edit_Iterator
+{
+public:
+ virtual ~IFX_Edit_Iterator() {}
+public:
+ //move the current position to the next word.
+ virtual FX_BOOL NextWord() = 0;
+ //move the current position to the next line.
+ virtual FX_BOOL NextLine() = 0;
+ //move the current position to the next section.
+ virtual FX_BOOL NextSection() = 0;
+
+ //move the current position to the previous word.
+ virtual FX_BOOL PrevWord() = 0;
+ //move the current position to the previous line.
+ virtual FX_BOOL PrevLine() = 0;
+ //move the current position to the previous section.
+ virtual FX_BOOL PrevSection() = 0;
+
+ //get the information of the current word.
+ virtual FX_BOOL GetWord(CPVT_Word & word) const = 0;
+ //get the information of the current line.
+ virtual FX_BOOL GetLine(CPVT_Line & line) const = 0;
+ //get the information of the current section.
+ virtual FX_BOOL GetSection(CPVT_Section & section) const = 0;
+ //set the current position.
+ virtual void SetAt(FX_INT32 nWordIndex) = 0;
+ //set the current position.
+ virtual void SetAt(const CPVT_WordPlace & place) = 0;
+ //get the current position.
+ virtual const CPVT_WordPlace & GetAt() const = 0;
+
+ //get the edit which this iterator belongs to
+ virtual IFX_Edit* GetEdit() const = 0;
+};
+
+class IFX_Edit_UndoItem
+{
+public:
+ virtual void Undo() = 0;
+ virtual void Redo() = 0;
+ virtual CFX_WideString GetUndoTitle() = 0;
+ virtual void Release() = 0;
+};
+
+class FXET_CLASS IFX_Edit
+{
+public:
+ static IFX_Edit* NewEdit();
+ static void DelEdit(IFX_Edit* pEdit);
+
+public:
+ //set a IFX_Edit_FontMap pointer implemented by user.
+ virtual void SetFontMap(IFX_Edit_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;
+ //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;
+
+ //initialize the edit.
+ virtual void Initialize() = 0;
+
+ //set the bounding box of the text area.
+ virtual void SetPlateRect(const CPDF_Rect & rect, FX_BOOL bPaint = TRUE) = 0;
+ //set the scroll origin
+ virtual void SetScrollPos(const CPDF_Point & point) = 0;
+
+ //set the horizontal text alignment in text box, nFormat (0:left 1:middle 2:right).
+ virtual void SetAlignmentH(FX_INT32 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(FX_INT32 nFormat = 0, FX_BOOL bPaint = TRUE) = 0;
+ //if the text is shown in secret , set a character for substitute.
+ virtual void SetPasswordChar(FX_WORD wSubWord = '*', FX_BOOL bPaint = TRUE) = 0;
+ //set the maximal count of words of the text.
+ virtual void SetLimitChar(FX_INT32 nLimitChar = 0, FX_BOOL bPaint = TRUE) = 0;
+ //if set the count of charArray , then all words is shown in equal space.
+ virtual void SetCharArray(FX_INT32 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(FX_INT32 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(FX_INT32 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(FX_INT32 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(FX_INT32 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(FX_INT32 nAlignment) = 0;
+
+ //set the selected range of text.
+ //if nStartChar == 0 and nEndChar == -1, select all the text.
+ virtual void SetSel(FX_INT32 nStartChar,FX_INT32 nEndChar) = 0;
+ //get the selected range of text.
+ virtual void GetSel(FX_INT32 & nStartChar, FX_INT32 & 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 FX_INT32 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 CPDF_Point GetScrollPos() const = 0;
+ //get the bounding box of the text area.
+ virtual CPDF_Rect GetPlateRect() const = 0;
+ //get the fact area of the text.
+ virtual CPDF_Rect 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;
+
+ //send the mousedown message to edit for response.
+ //if Shift key is hold, bShift is TRUE, is Ctrl key is hold, bCtrl is TRUE.
+ virtual void OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+ //send the mousemove message to edit when mouse down is TRUE.
+ virtual void OnMouseMove(const CPDF_Point & 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;
+
+ //put text into edit.
+ virtual void SetText(FX_LPCWSTR text,FX_INT32 charset = DEFAULT_CHARSET,
+ const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL) = 0;
+ //insert a word into the edit.
+ virtual FX_BOOL InsertWord(FX_WORD word, FX_INT32 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(FX_LPCWSTR text, FX_INT32 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(FX_INT32 nPos) = 0;
+
+ //arrange all words over again
+ virtual void Paint() = 0;
+
+ //allow to refresh screen?
+ virtual void EnableRefresh(FX_BOOL bRefresh) = 0;
+
+ virtual void RefreshWordRange(const CPVT_WordRange& wr) = 0;
+
+ //allow undo/redo?
+ virtual void EnableUndo(FX_BOOL bUndo) = 0;
+
+ //allow notify?
+ virtual void EnableNotify(FX_BOOL bNotify) = 0;
+
+ //allow opr notify?
+ virtual void EnableOprNotify(FX_BOOL bNotify) = 0;
+
+ //map word place to word index.
+ virtual FX_INT32 WordPlaceToWordIndex(const CPVT_WordPlace & place) const = 0;
+ //map word index to word place.
+ virtual CPVT_WordPlace WordIndexToWordPlace(FX_INT32 index) const = 0;
+
+ //get the beginning position of a line
+ virtual CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace & place) const = 0;
+
+ //get the ending position of a line
+ virtual CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace & place) const = 0;
+
+ //get the beginning position of a section
+ virtual CPVT_WordPlace GetSectionBeginPlace(const CPVT_WordPlace & place) const = 0;
+
+ //get the ending position of a section
+ virtual CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace & place) const = 0;
+
+ //search a wordplace form point
+ virtual CPVT_WordPlace SearchWordPlace(const CPDF_Point& point) const = 0;
+
+ //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 FX_WORD GetPasswordChar() const = 0;
+ //get the count of charArray
+ virtual FX_INT32 GetCharArray() const = 0;
+ //get the horizontal scale of all characters
+ virtual FX_INT32 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 FX_INT32 GetTotalWords() const = 0;
+
+ virtual void AddUndoItem(IFX_Edit_UndoItem* pUndoItem) = 0;
+
+public:
+ static CFX_ByteString GetEditAppearanceStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset,
+ const CPVT_WordRange* pRange = NULL,
+ FX_BOOL bContinuous = TRUE, FX_WORD SubWord = 0);
+ static CFX_ByteString GetSelectAppearanceStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, const CPVT_WordRange* pRange = NULL);
+ static void DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, FX_COLORREF crTextFill, FX_COLORREF crTextStroke,
+ const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, IFX_SystemHandler* pSystemHandler, void* pFFLData);
+ static void DrawUnderline(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, FX_COLORREF color,
+ const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange);
+ static void DrawRichEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit,
+ const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange);
+ static void GeneratePageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit,
+ const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, FX_COLORREF crText, CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray);
+ static void GenerateRichPageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit,
+ const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray);
+ static void GenerateUnderlineObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit,
+ const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, FX_COLORREF color);
+};
+
+class IFX_List_Notify
+{
+ //this class is implemented by user
+public:
+ //set the horizontal scrollbar information.
+ virtual void IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax,
+ FX_FLOAT fContentMin, FX_FLOAT fContentMax,
+ FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;
+ //set the vertical scrollbar information.
+ virtual void IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax,
+ FX_FLOAT fContentMin, FX_FLOAT fContentMax,
+ FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;
+ //set the position of horizontal scrollbar.
+ virtual void IOnSetScrollPosX(FX_FLOAT fx) = 0;
+ //set the position of vertical scrollbar.
+ virtual void IOnSetScrollPosY(FX_FLOAT fy) = 0;
+ //Invalidate the rectangle relative to the bounding box of edit.
+ virtual void IOnInvalidateRect(CPDF_Rect * pRect) = 0;
+};
+
+class FXET_CLASS IFX_List
+{
+public:
+ static IFX_List* NewList();
+ static void DelList(IFX_List* pList);
+
+public:
+ virtual void SetFontMap(IFX_Edit_FontMap * pFontMap) = 0;
+ virtual void SetNotify(IFX_List_Notify * pNotify) = 0;
+
+ virtual void SetPlateRect(const CPDF_Rect & rect) = 0;
+ virtual void SetFontSize(FX_FLOAT fFontSize) = 0;
+
+ virtual CPDF_Rect GetPlateRect() const = 0;
+ virtual CPDF_Rect GetContentRect() const = 0;
+
+ virtual FX_FLOAT GetFontSize() const = 0;
+ virtual IFX_Edit* GetItemEdit(FX_INT32 nIndex) const = 0;
+ virtual FX_INT32 GetCount() const = 0;
+ virtual FX_BOOL IsItemSelected(FX_INT32 nIndex) const = 0;
+ virtual FX_FLOAT GetFirstHeight() const = 0;
+
+ virtual void SetMultipleSel(FX_BOOL bMultiple) = 0;
+ virtual FX_BOOL IsMultipleSel() const = 0;
+ virtual FX_BOOL IsValid(FX_INT32 nItemIndex) const = 0;
+ virtual FX_INT32 FindNext(FX_INT32 nIndex,FX_WCHAR nChar) const = 0;
+
+ virtual void SetScrollPos(const CPDF_Point & point) = 0;
+ virtual void ScrollToListItem(FX_INT32 nItemIndex) = 0;
+ virtual CPDF_Rect GetItemRect(FX_INT32 nIndex) const = 0;
+ virtual FX_INT32 GetCaret() const = 0;
+ virtual FX_INT32 GetSelect() const = 0;
+ virtual FX_INT32 GetTopItem() const = 0;
+ virtual FX_INT32 GetItemIndex(const CPDF_Point & point) const = 0;
+ virtual FX_INT32 GetFirstSelected() const = 0;
+
+ virtual void AddString(FX_LPCWSTR string) = 0;
+ virtual void SetTopItem(FX_INT32 nIndex) = 0;
+ virtual void Select(FX_INT32 nItemIndex) = 0;
+ virtual void SetCaret(FX_INT32 nItemIndex) = 0;
+ virtual void Empty() = 0;
+ virtual void Cancel() = 0;
+ virtual CFX_WideString GetText() const = 0;
+
+
+ virtual void OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+ virtual void OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+ virtual void OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+ virtual void OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+ virtual void OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+ virtual void OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+ virtual void OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+ virtual void OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+ virtual void OnVK(FX_INT32 nItemIndex,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+ virtual FX_BOOL OnChar(FX_WORD nChar,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
+};
+
+#endif
+
diff --git a/fpdfsdk/include/fxedit/fxet_edit.h b/fpdfsdk/include/fxedit/fxet_edit.h
new file mode 100644
index 0000000000..72b780956d
--- /dev/null
+++ b/fpdfsdk/include/fxedit/fxet_edit.h
@@ -0,0 +1,823 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef _FXET_EDIT_H_
+#define _FXET_EDIT_H_
+
+#include "fx_edit.h"
+
+class CFX_Edit_Page;
+struct CFX_Edit_LineRect;
+class CFX_Edit_LineRectArray;
+class CFX_Edit_RectArray;
+class CFX_Edit_Refresh;
+class CFX_Edit_Select;
+class CFX_Edit;
+class CFX_Edit_Iterator;
+class CFX_Edit_Refresh;
+class CFX_Edit_UndoItem;
+class CFX_Edit_Undo;
+class CFX_Edit_Provider;
+
+#define FX_EDIT_IsFloatZero(f) (f < 0.0001 && f > -0.0001)
+#define FX_EDIT_IsFloatEqual(fa,fb) FX_EDIT_IsFloatZero(fa - fb)
+#define FX_EDIT_IsFloatBigger(fa,fb) (fa > fb && !FX_EDIT_IsFloatEqual(fa,fb))
+#define FX_EDIT_IsFloatSmaller(fa,fb) (fa < fb && !FX_EDIT_IsFloatEqual(fa,fb))
+
+template<class T> T FX_EDIT_MIN (const T & i, const T & j) { return ((i < j) ? i : j); }
+template<class T> T FX_EDIT_MAX (const T & i, const T & j) { return ((i > j) ? i : j); }
+
+#define FX_EDIT_PI 3.14159265358979f
+#define FX_EDIT_ITALIC_ANGEL 10 * FX_EDIT_PI / 180.0f
+
+
+/* ------------------------- CFX_Edit_Refresh ---------------------------- */
+
+enum REFRESH_PLAN_E
+{
+ RP_ANALYSE,
+ RP_NOANALYSE,
+ RP_OPTIONAL
+};
+
+enum EDIT_PROPS_E
+{
+ EP_LINELEADING,
+ EP_LINEINDENT,
+ EP_ALIGNMENT,
+ EP_FONTINDEX,
+ EP_FONTSIZE,
+ EP_WORDCOLOR,
+ EP_SCRIPTTYPE,
+ EP_UNDERLINE,
+ EP_CROSSOUT,
+ EP_CHARSPACE,
+ EP_HORZSCALE,
+ EP_BOLD,
+ EP_ITALIC
+};
+
+struct CFX_Edit_LineRect
+{
+ CFX_Edit_LineRect(const CPVT_WordRange & wrLine,const CPDF_Rect & rcLine) :
+ m_wrLine(wrLine), m_rcLine(rcLine)
+ {
+ }
+
+ FX_BOOL operator != (const CFX_Edit_LineRect & linerect) const
+ {
+ return FXSYS_memcmp(this, &linerect, sizeof(CFX_Edit_LineRect)) != 0;
+ }
+
+ FX_BOOL IsSameHeight(const CFX_Edit_LineRect & linerect) const
+ {
+ return FX_EDIT_IsFloatZero((m_rcLine.top - m_rcLine.bottom) - (linerect.m_rcLine.top -linerect.m_rcLine.bottom));
+ }
+
+ FX_BOOL IsSameTop(const CFX_Edit_LineRect & linerect) const
+ {
+ return FX_EDIT_IsFloatZero(m_rcLine.top - linerect.m_rcLine.top);
+ }
+
+ FX_BOOL IsSameLeft(const CFX_Edit_LineRect & linerect) const
+ {
+ return FX_EDIT_IsFloatZero(m_rcLine.left - linerect.m_rcLine.left);
+ }
+
+ FX_BOOL IsSameRight(const CFX_Edit_LineRect & linerect) const
+ {
+ return FX_EDIT_IsFloatZero(m_rcLine.right - linerect.m_rcLine.right);
+ }
+
+ CPVT_WordRange m_wrLine;
+ CPDF_Rect m_rcLine;
+};
+
+class CFX_Edit_LineRectArray
+{
+public:
+ CFX_Edit_LineRectArray()
+ {
+ }
+
+ virtual ~CFX_Edit_LineRectArray()
+ {
+ Empty();
+ }
+
+ void Empty()
+ {
+ for (FX_INT32 i = 0, sz = m_LineRects.GetSize(); i < sz; i++)
+ delete m_LineRects.GetAt(i);
+
+ m_LineRects.RemoveAll();
+ }
+
+ void RemoveAll()
+ {
+ m_LineRects.RemoveAll();
+ }
+
+ void operator = (CFX_Edit_LineRectArray & rects)
+ {
+ Empty();
+ for (FX_INT32 i = 0, sz = rects.GetSize(); i < sz; i++)
+ m_LineRects.Add(rects.GetAt(i));
+
+ rects.RemoveAll();
+ }
+
+ void Add(const CPVT_WordRange & wrLine,const CPDF_Rect & rcLine)
+ {
+ if (CFX_Edit_LineRect * pRect = new CFX_Edit_LineRect(wrLine,rcLine))
+ m_LineRects.Add(pRect);
+ }
+
+ FX_INT32 GetSize() const
+ {
+ return m_LineRects.GetSize();
+ }
+
+ CFX_Edit_LineRect * GetAt(FX_INT32 nIndex) const
+ {
+ if (nIndex < 0 || nIndex >= m_LineRects.GetSize())
+ return NULL;
+
+ return m_LineRects.GetAt(nIndex);
+ }
+
+ CFX_ArrayTemplate<CFX_Edit_LineRect*> m_LineRects;
+};
+
+class CFX_Edit_RectArray
+{
+public:
+ CFX_Edit_RectArray()
+ {
+ }
+
+ virtual ~CFX_Edit_RectArray()
+ {
+ this->Empty();
+ }
+
+ void Empty()
+ {
+ for (FX_INT32 i = 0, sz = m_Rects.GetSize(); i < sz; i++)
+ delete m_Rects.GetAt(i);
+
+ this->m_Rects.RemoveAll();
+ }
+
+ void Add(const CPDF_Rect & rect)
+ {
+ //check for overlaped area
+ for (FX_INT32 i = 0, sz = m_Rects.GetSize(); i < sz; i++)
+ if (CPDF_Rect * pRect = m_Rects.GetAt(i))
+ if (pRect->Contains(rect))return;
+
+ if (CPDF_Rect * pNewRect = new CPDF_Rect(rect))
+ m_Rects.Add(pNewRect);
+ }
+
+ FX_INT32 GetSize() const
+ {
+ return m_Rects.GetSize();
+ }
+
+ CPDF_Rect * GetAt(FX_INT32 nIndex) const
+ {
+ if (nIndex < 0 || nIndex >= m_Rects.GetSize())
+ return NULL;
+
+ return m_Rects.GetAt(nIndex);
+ }
+
+ CFX_ArrayTemplate<CPDF_Rect*> m_Rects;
+};
+
+class CFX_Edit_Refresh
+{
+public:
+ CFX_Edit_Refresh();
+ virtual ~CFX_Edit_Refresh();
+
+ void BeginRefresh();
+ void Push(const CPVT_WordRange & linerange,const CPDF_Rect & rect);
+ void NoAnalyse();
+ void Analyse(FX_INT32 nAlignment);
+ void AddRefresh(const CPDF_Rect & rect);
+ const CFX_Edit_RectArray * GetRefreshRects() const;
+ void EndRefresh();
+
+private:
+ CFX_Edit_LineRectArray m_NewLineRects;
+ CFX_Edit_LineRectArray m_OldLineRects;
+ CFX_Edit_RectArray m_RefreshRects;
+};
+
+
+/* ------------------------- CFX_Edit_Select ---------------------------- */
+
+class CFX_Edit_Select
+{
+public:
+ CFX_Edit_Select()
+ {
+ }
+
+ CFX_Edit_Select(const CPVT_WordPlace & begin,const CPVT_WordPlace & end)
+ {
+ Set(begin,end);
+ }
+
+ CFX_Edit_Select(const CPVT_WordRange & range)
+ {
+ Set(range.BeginPos,range.EndPos);
+ }
+
+ CPVT_WordRange ConvertToWordRange() const
+ {
+ return CPVT_WordRange(this->BeginPos,this->EndPos);
+ }
+
+ void Default()
+ {
+ BeginPos.Default();
+ EndPos.Default();
+ }
+
+ void Set(const CPVT_WordPlace & begin,const CPVT_WordPlace & end)
+ {
+ this->BeginPos = begin;
+ this->EndPos = end;
+ }
+
+ void SetBeginPos(const CPVT_WordPlace & begin)
+ {
+ this->BeginPos = begin;
+ }
+
+ void SetEndPos(const CPVT_WordPlace & end)
+ {
+ this->EndPos = end;
+ }
+
+ FX_BOOL IsExist() const
+ {
+ return this->BeginPos != this->EndPos;
+ }
+
+ FX_BOOL operator != (const CPVT_WordRange & wr) const
+ {
+ return wr.BeginPos != this->BeginPos || wr.EndPos != this->EndPos;
+ }
+
+ CPVT_WordPlace BeginPos,EndPos;
+};
+
+/* ------------------------- CFX_Edit_Undo ---------------------------- */
+
+class CFX_Edit_Undo
+{
+public:
+ CFX_Edit_Undo(FX_INT32 nBufsize = 10000);
+ virtual ~CFX_Edit_Undo();
+
+ void Undo();
+ void Redo();
+
+ void AddItem(IFX_Edit_UndoItem* pItem);
+
+ FX_BOOL CanUndo() const;
+ FX_BOOL CanRedo() const;
+ FX_BOOL IsModified() const;
+ FX_BOOL IsWorking() const;
+
+ void Reset();
+
+ IFX_Edit_UndoItem* GetItem(FX_INT32 nIndex);
+ FX_INT32 GetItemCount(){return m_UndoItemStack.GetSize();}
+ FX_INT32 GetCurUndoPos(){return m_nCurUndoPos;}
+
+private:
+ void SetBufSize(FX_INT32 nSize){m_nBufSize = nSize;}
+ FX_INT32 GetBufSize(){return m_nBufSize;}
+
+ void RemoveHeads();
+ void RemoveTails();
+
+private:
+ CFX_ArrayTemplate<IFX_Edit_UndoItem*> m_UndoItemStack;
+
+ FX_INT32 m_nCurUndoPos;
+ FX_INT32 m_nBufSize;
+ FX_BOOL m_bModified;
+ FX_BOOL m_bVirgin;
+ FX_BOOL m_bWorking;
+};
+
+class CFX_Edit_UndoItem : public IFX_Edit_UndoItem
+{
+public:
+ CFX_Edit_UndoItem() : m_bFirst(TRUE), m_bLast(TRUE) {}
+ virtual ~CFX_Edit_UndoItem(){}
+
+ virtual CFX_WideString GetUndoTitle() {return L"";}
+ virtual void Release(){delete this;}
+
+public:
+ void SetFirst(FX_BOOL bFirst){m_bFirst = bFirst;}
+ FX_BOOL IsFirst(){return m_bFirst;}
+ void SetLast(FX_BOOL bLast){m_bLast = bLast;}
+ FX_BOOL IsLast(){return m_bLast;}
+
+private:
+ FX_BOOL m_bFirst;
+ FX_BOOL m_bLast;
+};
+
+class CFX_Edit_GroupUndoItem : public IFX_Edit_UndoItem
+{
+public:
+ CFX_Edit_GroupUndoItem(const CFX_WideString& sTitle);
+ virtual ~CFX_Edit_GroupUndoItem();
+
+ void AddUndoItem(CFX_Edit_UndoItem* pUndoItem);
+ void UpdateItems();
+
+public:
+ virtual void Undo();
+ virtual void Redo();
+ virtual CFX_WideString GetUndoTitle();
+ virtual void Release();
+
+private:
+ CFX_WideString m_sTitle;
+ CFX_ArrayTemplate<CFX_Edit_UndoItem*> m_Items;
+};
+
+/* ------------------------- CFX_Edit_UndoItem derived classes ---------------------------- */
+
+class CFXEU_InsertWord : public CFX_Edit_UndoItem
+{
+public:
+ CFXEU_InsertWord(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,
+ FX_WORD word, FX_INT32 charset, const CPVT_WordProps * pWordProps);
+ virtual ~CFXEU_InsertWord();
+
+ void Redo();
+ void Undo();
+
+private:
+ CFX_Edit* m_pEdit;
+
+ CPVT_WordPlace m_wpOld;
+ CPVT_WordPlace m_wpNew;
+ FX_WORD m_Word;
+ FX_INT32 m_nCharset;
+ CPVT_WordProps m_WordProps;
+};
+
+class CFXEU_InsertReturn : public CFX_Edit_UndoItem
+{
+public:
+ CFXEU_InsertReturn(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,
+ const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps);
+ virtual ~CFXEU_InsertReturn();
+
+ void Redo();
+ void Undo();
+
+private:
+ CFX_Edit * m_pEdit;
+
+ CPVT_WordPlace m_wpOld;
+ CPVT_WordPlace m_wpNew;
+ CPVT_SecProps m_SecProps;
+ CPVT_WordProps m_WordProps;
+};
+
+class CFXEU_Backspace : public CFX_Edit_UndoItem
+{
+public:
+ CFXEU_Backspace(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,
+ FX_WORD word, FX_INT32 charset,
+ const CPVT_SecProps & SecProps, const CPVT_WordProps & WordProps);
+ virtual ~CFXEU_Backspace();
+
+ void Redo();
+ void Undo();
+
+private:
+ CFX_Edit * m_pEdit;
+
+ CPVT_WordPlace m_wpOld;
+ CPVT_WordPlace m_wpNew;
+ FX_WORD m_Word;
+ FX_INT32 m_nCharset;
+ CPVT_SecProps m_SecProps;
+ CPVT_WordProps m_WordProps;
+};
+
+class CFXEU_Delete : public CFX_Edit_UndoItem
+{
+public:
+ CFXEU_Delete(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,
+ FX_WORD word, FX_INT32 charset,
+ const CPVT_SecProps & SecProps, const CPVT_WordProps & WordProps, FX_BOOL bSecEnd);
+ virtual ~CFXEU_Delete();
+
+ void Redo();
+ void Undo();
+
+private:
+ CFX_Edit * m_pEdit;
+
+ CPVT_WordPlace m_wpOld;
+ CPVT_WordPlace m_wpNew;
+ FX_WORD m_Word;
+ FX_INT32 m_nCharset;
+ CPVT_SecProps m_SecProps;
+ CPVT_WordProps m_WordProps;
+ FX_BOOL m_bSecEnd;
+};
+
+class CFXEU_Clear : public CFX_Edit_UndoItem
+{
+public:
+ CFXEU_Clear(CFX_Edit * pEdit, const CPVT_WordRange & wrSel, const CFX_WideString & swText);
+ virtual ~CFXEU_Clear();
+
+ void Redo();
+ void Undo();
+
+private:
+ CFX_Edit* m_pEdit;
+
+ CPVT_WordRange m_wrSel;
+ CFX_WideString m_swText;
+};
+
+class CFXEU_ClearRich : public CFX_Edit_UndoItem
+{
+public:
+ CFXEU_ClearRich(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,
+ const CPVT_WordRange & wrSel,
+ FX_WORD word, FX_INT32 charset,
+ const CPVT_SecProps & SecProps, const CPVT_WordProps & WordProps);
+ virtual ~CFXEU_ClearRich();
+
+ void Redo();
+ void Undo();
+
+private:
+ CFX_Edit * m_pEdit;
+
+ CPVT_WordPlace m_wpOld;
+ CPVT_WordPlace m_wpNew;
+ CPVT_WordRange m_wrSel;
+ FX_WORD m_Word;
+ FX_INT32 m_nCharset;
+ CPVT_SecProps m_SecProps;
+ CPVT_WordProps m_WordProps;
+};
+
+class CFXEU_InsertText : public CFX_Edit_UndoItem
+{
+public:
+ CFXEU_InsertText(CFX_Edit * pEdit, const CPVT_WordPlace & wpOldPlace, const CPVT_WordPlace & wpNewPlace,
+ const CFX_WideString & swText, FX_INT32 charset,
+ const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps);
+ virtual ~CFXEU_InsertText();
+
+ void Redo();
+ void Undo();
+
+private:
+ CFX_Edit * m_pEdit;
+
+ CPVT_WordPlace m_wpOld;
+ CPVT_WordPlace m_wpNew;
+ CFX_WideString m_swText;
+ FX_INT32 m_nCharset;
+ CPVT_SecProps m_SecProps;
+ CPVT_WordProps m_WordProps;
+};
+
+class CFXEU_SetSecProps : public CFX_Edit_UndoItem
+{
+public:
+ CFXEU_SetSecProps(CFX_Edit * pEdit, const CPVT_WordPlace & place, EDIT_PROPS_E ep,
+ const CPVT_SecProps & oldsecprops, const CPVT_WordProps & oldwordprops,
+ const CPVT_SecProps & newsecprops, const CPVT_WordProps & newwordprops, const CPVT_WordRange & range);
+ virtual ~CFXEU_SetSecProps();
+
+ void Redo();
+ void Undo();
+
+private:
+ CFX_Edit * m_pEdit;
+ CPVT_WordPlace m_wpPlace;
+ CPVT_WordRange m_wrPlace;
+ EDIT_PROPS_E m_eProps;
+
+ CPVT_SecProps m_OldSecProps;
+ CPVT_SecProps m_NewSecProps;
+ CPVT_WordProps m_OldWordProps;
+ CPVT_WordProps m_NewWordProps;
+};
+
+class CFXEU_SetWordProps : public CFX_Edit_UndoItem
+{
+public:
+ CFXEU_SetWordProps(CFX_Edit * pEdit, const CPVT_WordPlace & place, EDIT_PROPS_E ep,
+ const CPVT_WordProps & oldprops, const CPVT_WordProps & newprops, const CPVT_WordRange & range);
+ virtual ~CFXEU_SetWordProps();
+
+ void Redo();
+ void Undo();
+
+private:
+ CFX_Edit * m_pEdit;
+ CPVT_WordPlace m_wpPlace;
+ CPVT_WordRange m_wrPlace;
+ EDIT_PROPS_E m_eProps;
+
+ CPVT_WordProps m_OldWordProps;
+ CPVT_WordProps m_NewWordProps;
+};
+
+/* ------------------------- CFX_Edit ---------------------------- */
+
+class CFX_Edit : public IFX_Edit
+{
+ friend class CFX_Edit_Iterator;
+ friend class CFXEU_InsertWord;
+ friend class CFXEU_InsertReturn;
+ friend class CFXEU_Backspace;
+ friend class CFXEU_Delete;
+ friend class CFXEU_Clear;
+ friend class CFXEU_ClearRich;
+ friend class CFXEU_SetSecProps;
+ friend class CFXEU_SetWordProps;
+ friend class CFXEU_InsertText;
+
+public:
+ CFX_Edit(IPDF_VariableText * pVT);
+ virtual ~CFX_Edit();
+
+ void SetFontMap(IFX_Edit_FontMap * pFontMap);
+ void SetVTProvider(IPDF_VariableText_Provider* pProvider);
+ void SetNotify(IFX_Edit_Notify * pNotify);
+ void SetOprNotify(IFX_Edit_OprNotify* pOprNotify);
+ IFX_Edit_Iterator* GetIterator();
+ IPDF_VariableText * GetVariableText();
+ IFX_Edit_FontMap* GetFontMap();
+
+ void Initialize();
+ void SetPlateRect(const CPDF_Rect & rect, FX_BOOL bPaint = TRUE);
+ void SetScrollPos(const CPDF_Point & point);
+
+ void SetAlignmentH(FX_INT32 nFormat = 0, FX_BOOL bPaint = TRUE);
+ void SetAlignmentV(FX_INT32 nFormat = 0, FX_BOOL bPaint = TRUE);
+ void SetPasswordChar(FX_WORD wSubWord = '*', FX_BOOL bPaint = TRUE);
+ void SetLimitChar(FX_INT32 nLimitChar = 0, FX_BOOL bPaint = TRUE);
+ void SetCharArray(FX_INT32 nCharArray = 0, FX_BOOL bPaint = TRUE);
+ void SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE);
+ void SetHorzScale(FX_INT32 nHorzScale = 100, FX_BOOL bPaint = TRUE);
+ void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE);
+ void SetMultiLine(FX_BOOL bMultiLine = TRUE, FX_BOOL bPaint = TRUE);
+ void SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE);
+ void SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE);
+ void SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE);
+ void SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE);
+ void SetTextOverflow(FX_BOOL bAllowed = FALSE, FX_BOOL bPaint = TRUE);
+
+ FX_BOOL IsRichText() const;
+ void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE);
+ FX_BOOL SetRichFontSize(FX_FLOAT fFontSize);
+ FX_BOOL SetRichFontIndex(FX_INT32 nFontIndex);
+ FX_BOOL SetRichTextColor(FX_COLORREF dwColor);
+ FX_BOOL SetRichTextScript(FX_INT32 nScriptType);
+ FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE);
+ FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE);
+ FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE);
+ FX_BOOL SetRichTextCrossout(FX_BOOL bCrossout = TRUE);
+ FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace);
+ FX_BOOL SetRichTextHorzScale(FX_INT32 nHorzScale = 100);
+ FX_BOOL SetRichTextLineLeading(FX_FLOAT fLineLeading);
+ FX_BOOL SetRichTextLineIndent(FX_FLOAT fLineIndent);
+ FX_BOOL SetRichTextAlignment(FX_INT32 nAlignment);
+
+ void OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl);
+ void OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl);
+ void OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl);
+ void OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl);
+ void OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl);
+ void OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl);
+ void OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl);
+ void OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl);
+
+ void SetText(FX_LPCWSTR text,FX_INT32 charset = DEFAULT_CHARSET,
+ const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL);
+ FX_BOOL InsertWord(FX_WORD word, FX_INT32 charset = DEFAULT_CHARSET, const CPVT_WordProps * pWordProps = NULL);
+ FX_BOOL InsertReturn(const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL);
+ FX_BOOL Backspace();
+ FX_BOOL Delete();
+ FX_BOOL Clear();
+ FX_BOOL Empty();
+ FX_BOOL InsertText(FX_LPCWSTR text, FX_INT32 charset = DEFAULT_CHARSET,
+ const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL);
+ FX_BOOL Redo();
+ FX_BOOL Undo();
+ CPVT_WordPlace DoInsertText(const CPVT_WordPlace& place, FX_LPCWSTR text, FX_INT32 charset,
+ const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps);
+ FX_INT32 GetCharSetFromUnicode(FX_WORD word, FX_INT32 nOldCharset);
+
+ FX_INT32 WordPlaceToWordIndex(const CPVT_WordPlace & place) const;
+ CPVT_WordPlace WordIndexToWordPlace(FX_INT32 index) const;
+
+ CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace & place) const;
+ CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace & place) const;
+ CPVT_WordPlace GetSectionBeginPlace(const CPVT_WordPlace & place) const;
+ CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace & place) const;
+ CPVT_WordPlace SearchWordPlace(const CPDF_Point& point) const;
+
+ FX_INT32 GetCaret() const;
+ CPVT_WordPlace GetCaretWordPlace() const;
+ CFX_WideString GetSelText() const;
+ CFX_WideString GetText() const;
+ FX_FLOAT GetFontSize() const;
+ FX_WORD GetPasswordChar() const;
+ CPDF_Point GetScrollPos() const;
+ FX_INT32 GetCharArray() const;
+ CPDF_Rect GetPlateRect() const;
+ CPDF_Rect GetContentRect() const;
+ CFX_WideString GetRangeText(const CPVT_WordRange & range) const;
+ FX_INT32 GetHorzScale() const;
+ FX_FLOAT GetCharSpace() const;
+ FX_INT32 GetTotalWords() const;
+ FX_INT32 GetTotalLines() const;
+
+ void SetSel(FX_INT32 nStartChar,FX_INT32 nEndChar);
+ void GetSel(FX_INT32 & nStartChar, FX_INT32 & nEndChar) const;
+
+private:
+ void SelectAll();
+ void SelectNone();
+ void SetSel(const CPVT_WordPlace & begin,const CPVT_WordPlace & end);
+ FX_BOOL IsSelected() const;
+
+ void RearrangeAll();
+ void RearrangePart(const CPVT_WordRange & range);
+ void Paint();
+ void ScrollToCaret();
+ void SetScrollInfo();
+ void SetScrollPosX(FX_FLOAT fx);
+ void SetScrollPosY(FX_FLOAT fy);
+ void SetScrollLimit();
+ void SetContentChanged();
+ void EnableNotify(FX_BOOL bNotify);
+
+ void SetText(FX_LPCWSTR text,FX_INT32 charset,
+ const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps,FX_BOOL bAddUndo, FX_BOOL bPaint);
+ FX_BOOL InsertWord(FX_WORD word, FX_INT32 charset, const CPVT_WordProps * pWordProps,FX_BOOL bAddUndo, FX_BOOL bPaint);
+ FX_BOOL InsertReturn(const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps,FX_BOOL bAddUndo, FX_BOOL bPaint);
+ FX_BOOL Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint);
+ FX_BOOL Delete(FX_BOOL bAddUndo, FX_BOOL bPaint);
+ FX_BOOL Clear(FX_BOOL bAddUndo, FX_BOOL bPaint);
+ FX_BOOL InsertText(FX_LPCWSTR text, FX_INT32 charset,
+ const CPVT_SecProps * pSecProps,const CPVT_WordProps * pWordProps,FX_BOOL bAddUndo, FX_BOOL bPaint);
+ FX_BOOL SetRichTextProps(EDIT_PROPS_E eProps,
+ const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps);
+ FX_BOOL SetSecProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place,
+ const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps, const CPVT_WordRange & wr, FX_BOOL bAddUndo);
+ FX_BOOL SetWordProps(EDIT_PROPS_E eProps, const CPVT_WordPlace & place,
+ const CPVT_WordProps * pWordProps, const CPVT_WordRange & wr, FX_BOOL bAddUndo);
+ void PaintSetProps(EDIT_PROPS_E eProps, const CPVT_WordRange & wr);
+ void PaintInsertText(const CPVT_WordPlace & wpOld, const CPVT_WordPlace & wpNew);
+
+ inline CPDF_Point VTToEdit(const CPDF_Point & point) const;
+ inline CPDF_Point EditToVT(const CPDF_Point & point) const;
+ inline CPDF_Rect VTToEdit(const CPDF_Rect & rect) const;
+ inline CPDF_Rect EditToVT(const CPDF_Rect & rect) const;
+
+ void EnableRefresh(FX_BOOL bRefresh);
+ void Refresh(REFRESH_PLAN_E ePlan,const CPVT_WordRange * pRange1 = NULL,const CPVT_WordRange * pRange2 = NULL);
+ void RefreshPushLineRects(const CPVT_WordRange & wr);
+ void RefreshPushRandomRects(const CPVT_WordRange & wr);
+ void RefreshWordRange(const CPVT_WordRange& wr);
+
+ void SetCaret(FX_INT32 nPos);
+ void SetCaret(const CPVT_WordPlace & place);
+ void SetCaretInfo();
+ void SetCaretOrigin();
+ void SetCaretChange();
+
+ CPVT_WordRange GetWholeWordRange() const;
+ CPVT_WordRange GetVisibleWordRange() const;
+ CPVT_WordRange GetLatinWordsRange(const CPVT_WordPlace & place) const;
+ CPVT_WordRange CombineWordRange(const CPVT_WordRange & wr1, const CPVT_WordRange & wr2);
+ CPVT_WordRange GetSelectWordRange() const;
+
+ void EnableUndo(FX_BOOL bUndo);
+ void EnableOprNotify(FX_BOOL bNotify);
+
+ FX_BOOL IsTextFull() const;
+ FX_BOOL IsTextOverflow() const;
+ FX_BOOL CanUndo() const;
+ FX_BOOL CanRedo() const;
+ FX_BOOL IsModified() const;
+
+ void BeginGroupUndo(const CFX_WideString& sTitle);
+ void EndGroupUndo();
+ void AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem);
+ void AddUndoItem(IFX_Edit_UndoItem* pUndoItem);
+
+ void SetPageInfo(const CPVT_WordPlace& place);
+ CPVT_WordPlace SearchPageEndPlace(const CPVT_WordPlace& wpPageBegin, const CPDF_Point& point) const;
+ FX_FLOAT GetLineTop(const CPVT_WordPlace& place) const;
+ FX_FLOAT GetLineBottom(const CPVT_WordPlace& place) const;
+
+private:
+ IPDF_VariableText* m_pVT;
+ IFX_Edit_Notify* m_pNotify;
+ IFX_Edit_OprNotify* m_pOprNotify;
+ CFX_Edit_Provider* m_pVTProvide;
+
+ CPVT_WordPlace m_wpCaret;
+ CPVT_WordPlace m_wpOldCaret;
+ CFX_Edit_Select m_SelState;
+
+ CPDF_Point m_ptScrollPos;
+ CPDF_Point m_ptRefreshScrollPos;
+ FX_BOOL m_bEnableScroll;
+ IFX_Edit_Iterator * m_pIterator;
+ CFX_Edit_Refresh m_Refresh;
+ CPDF_Point m_ptCaret;
+ CFX_Edit_Undo m_Undo;
+ FX_INT32 m_nAlignment;
+ FX_BOOL m_bNotifyFlag;
+ FX_BOOL m_bTextFullFlag;
+ FX_BOOL m_bEnableOverflow;
+ FX_BOOL m_bEnableRefresh;
+ CPDF_Rect m_rcOldContent;
+ FX_BOOL m_bEnableUndo;
+ FX_BOOL m_bNotify;
+ FX_BOOL m_bOprNotify;
+ CFX_Edit_GroupUndoItem* m_pGroupUndoItem;
+};
+
+/* ------------------------- CFX_Edit_Iterator ---------------------------- */
+
+class CFX_Edit_Iterator : public IFX_Edit_Iterator
+{
+public:
+ CFX_Edit_Iterator(CFX_Edit * pEdit,IPDF_VariableText_Iterator * pVTIterator);
+ virtual ~CFX_Edit_Iterator();
+
+ FX_BOOL NextWord();
+ FX_BOOL NextLine();
+ FX_BOOL NextSection();
+ FX_BOOL PrevWord();
+ FX_BOOL PrevLine();
+ FX_BOOL PrevSection();
+
+ FX_BOOL GetWord(CPVT_Word & word) const;
+ FX_BOOL GetLine(CPVT_Line & line) const;
+ FX_BOOL GetSection(CPVT_Section & section) const;
+ void SetAt(FX_INT32 nWordIndex);
+ void SetAt(const CPVT_WordPlace & place);
+ const CPVT_WordPlace & GetAt() const;
+ IFX_Edit* GetEdit() const;
+
+private:
+ CFX_Edit * m_pEdit;
+ IPDF_VariableText_Iterator* m_pVTIterator;
+};
+
+class CFX_Edit_Provider : public IPDF_VariableText_Provider
+{
+public:
+ CFX_Edit_Provider(IFX_Edit_FontMap* pFontMap);
+ virtual ~CFX_Edit_Provider();
+
+ IFX_Edit_FontMap* GetFontMap();
+
+ FX_INT32 GetCharWidth(FX_INT32 nFontIndex, FX_WORD word, FX_INT32 nWordStyle);
+ FX_INT32 GetTypeAscent(FX_INT32 nFontIndex);
+ FX_INT32 GetTypeDescent(FX_INT32 nFontIndex);
+ FX_INT32 GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex);
+ FX_INT32 GetDefaultFontIndex();
+ FX_BOOL IsLatinWord(FX_WORD word);
+
+private:
+ IFX_Edit_FontMap* m_pFontMap;
+};
+
+#endif //_FXET_EDIT_H_
+
diff --git a/fpdfsdk/include/fxedit/fxet_list.h b/fpdfsdk/include/fxedit/fxet_list.h
new file mode 100644
index 0000000000..d77be86be4
--- /dev/null
+++ b/fpdfsdk/include/fxedit/fxet_list.h
@@ -0,0 +1,363 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef _FXET_LIST_H_
+#define _FXET_LIST_H_
+
+#include "fx_edit.h"
+
+class IFX_Edit;
+
+class CLST_Size
+{
+public:
+ CLST_Size() : x(0.0f), y(0.0f)
+ {
+ }
+
+ CLST_Size(FX_FLOAT x,FX_FLOAT y)
+ {
+ this->x = x;
+ this->y = y;
+ }
+
+ void Default()
+ {
+ x = 0.0f;
+ y = 0.0f;
+ }
+
+ FX_BOOL operator != (const CLST_Size & size) const
+ {
+ return FXSYS_memcmp(this, &size, sizeof(CLST_Size)) != 0;
+ }
+
+ FX_FLOAT x,y;
+};
+
+class CLST_Rect : public CPDF_Rect
+{
+public:
+ CLST_Rect()
+ {
+ left = top = right = bottom = 0.0f;
+ }
+
+ CLST_Rect(FX_FLOAT left,FX_FLOAT top,
+ FX_FLOAT right,FX_FLOAT bottom)
+ {
+ this->left = left;
+ this->top = top;
+ this->right = right;
+ this->bottom = bottom;
+ }
+
+ CLST_Rect(const CPDF_Rect & rect)
+ {
+ this->left = rect.left;
+ this->top = rect.top;
+ this->right = rect.right;
+ this->bottom = rect.bottom;
+ }
+
+ void Default()
+ {
+ left = top = right = bottom = 0.0f;
+ }
+
+ const CLST_Rect operator = (const CPDF_Rect & rect)
+ {
+ this->left = rect.left;
+ this->top = rect.top;
+ this->right = rect.right;
+ this->bottom = rect.bottom;
+
+ return *this;
+ }
+
+ FX_BOOL operator == (const CLST_Rect & rect) const
+ {
+ return FXSYS_memcmp(this, &rect, sizeof(CLST_Rect)) == 0;
+ }
+
+ FX_BOOL operator != (const CLST_Rect & rect) const
+ {
+ return FXSYS_memcmp(this, &rect, sizeof(CLST_Rect)) != 0;
+ }
+
+ FX_FLOAT Width() const
+ {
+ return this->right - this->left;
+ }
+
+ FX_FLOAT Height() const
+ {
+ if (this->top > this->bottom)
+ return this->top - this->bottom;
+ else
+ return this->bottom - this->top;
+ }
+
+ CPDF_Point LeftTop() const
+ {
+ return CPDF_Point(left,top);
+ }
+
+ CPDF_Point RightBottom() const
+ {
+ return CPDF_Point(right,bottom);
+ }
+
+ const CLST_Rect operator += (const CPDF_Point & point)
+ {
+ this->left += point.x;
+ this->right += point.x;
+ this->top += point.y;
+ this->bottom += point.y;
+
+ return *this;
+ }
+
+ const CLST_Rect operator -= (const CPDF_Point & point)
+ {
+ this->left -= point.x;
+ this->right -= point.x;
+ this->top -= point.y;
+ this->bottom -= point.y;
+
+ return *this;
+ }
+
+ CLST_Rect operator + (const CPDF_Point & point) const
+ {
+ return CLST_Rect(left + point.x,
+ top + point.y,
+ right + point.x,
+ bottom + point.y);
+ }
+
+ CLST_Rect operator - (const CPDF_Point & point) const
+ {
+ return CLST_Rect(left - point.x,
+ top - point.y,
+ right - point.x,
+ bottom - point.y);
+ }
+};
+
+class CFX_ListItem
+{
+public:
+ CFX_ListItem();
+ virtual ~CFX_ListItem();
+
+ void SetFontMap(IFX_Edit_FontMap * pFontMap);
+ IFX_Edit_Iterator* GetIterator() const;
+ IFX_Edit* GetEdit() const;
+
+public:
+ void SetRect(const CLST_Rect & rect);
+ void SetSelect(FX_BOOL bSelected);
+ void SetCaret(FX_BOOL bCaret);
+ void SetText(FX_LPCWSTR text);
+ void SetFontSize(FX_FLOAT fFontSize);
+ CFX_WideString GetText() const;
+
+ CLST_Rect GetRect() const;
+ FX_BOOL IsSelected() const;
+ FX_BOOL IsCaret() const;
+ FX_FLOAT GetItemHeight() const;
+ FX_WORD GetFirstChar() const;
+
+private:
+ IFX_Edit* m_pEdit;
+ FX_BOOL m_bSelected; //是否选中
+ FX_BOOL m_bCaret; //是否为焦点,多选时用
+ CLST_Rect m_rcListItem; //内部坐标
+};
+
+class CFX_ListContainer
+{
+public:
+ CFX_ListContainer() : m_rcPlate(0.0f,0.0f,0.0f,0.0f), m_rcContent(0.0f,0.0f,0.0f,0.0f){}
+ virtual ~CFX_ListContainer(){}
+ virtual void SetPlateRect(const CPDF_Rect & rect){m_rcPlate = rect;}
+ CPDF_Rect GetPlateRect() const{return m_rcPlate;}
+ void SetContentRect(const CLST_Rect & rect){m_rcContent = rect;}
+ CLST_Rect GetContentRect() const{return m_rcContent;}
+ CPDF_Point GetBTPoint() const{return CPDF_Point(m_rcPlate.left,m_rcPlate.top);}
+ CPDF_Point GetETPoint() const{return CPDF_Point(m_rcPlate.right,m_rcPlate.bottom);}
+public:
+ CPDF_Point InnerToOuter(const CPDF_Point & point) const{return CPDF_Point(point.x + GetBTPoint().x,GetBTPoint().y - point.y);}
+ CPDF_Point OuterToInner(const CPDF_Point & point) const{return CPDF_Point(point.x - GetBTPoint().x,GetBTPoint().y - point.y);}
+ CPDF_Rect InnerToOuter(const CLST_Rect & rect) const{CPDF_Point ptLeftTop = InnerToOuter(CPDF_Point(rect.left,rect.top));
+ CPDF_Point ptRightBottom = InnerToOuter(CPDF_Point(rect.right,rect.bottom));
+ return CPDF_Rect(ptLeftTop.x,ptRightBottom.y,ptRightBottom.x,ptLeftTop.y);}
+ CLST_Rect OuterToInner(const CPDF_Rect & rect) const{CPDF_Point ptLeftTop = OuterToInner(CPDF_Point(rect.left,rect.top));
+ CPDF_Point ptRightBottom = OuterToInner(CPDF_Point(rect.right,rect.bottom));
+ return CLST_Rect(ptLeftTop.x,ptLeftTop.y,ptRightBottom.x,ptRightBottom.y);}
+private:
+ CPDF_Rect m_rcPlate;
+ CLST_Rect m_rcContent; //positive forever!
+};
+
+template<class TYPE> class CLST_ArrayTemplate : public CFX_ArrayTemplate<TYPE>
+{
+public:
+ FX_BOOL IsEmpty() { return CFX_ArrayTemplate<TYPE>::GetSize() <= 0; }
+ TYPE GetAt(FX_INT32 nIndex) const { if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) return CFX_ArrayTemplate<TYPE>::GetAt(nIndex); return NULL;}
+ void RemoveAt(FX_INT32 nIndex){if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) CFX_ArrayTemplate<TYPE>::RemoveAt(nIndex);}
+};
+
+class CFX_List : protected CFX_ListContainer , public IFX_List
+{
+public:
+ CFX_List();
+ virtual ~CFX_List();
+
+public:
+ virtual void SetFontMap(IFX_Edit_FontMap * pFontMap);
+ virtual void SetFontSize(FX_FLOAT fFontSize);
+
+ virtual CPDF_Rect GetPlateRect() const;
+ virtual CPDF_Rect GetContentRect() const;
+
+ virtual FX_FLOAT GetFontSize() const;
+ virtual IFX_Edit* GetItemEdit(FX_INT32 nIndex) const;
+ virtual FX_INT32 GetCount() const;
+ virtual FX_BOOL IsItemSelected(FX_INT32 nIndex) const;
+ virtual FX_FLOAT GetFirstHeight() const;
+
+ virtual void SetMultipleSel(FX_BOOL bMultiple);
+ virtual FX_BOOL IsMultipleSel() const;
+ virtual FX_BOOL IsValid(FX_INT32 nItemIndex) const;
+ virtual FX_INT32 FindNext(FX_INT32 nIndex,FX_WCHAR nChar) const;
+
+protected:
+ virtual void Empty();
+
+ void AddItem(FX_LPCWSTR str);
+ virtual void ReArrange(FX_INT32 nItemIndex);
+
+ virtual CPDF_Rect GetItemRect(FX_INT32 nIndex) const;
+ CFX_WideString GetItemText(FX_INT32 nIndex) const;
+
+ void SetItemSelect(FX_INT32 nItemIndex, FX_BOOL bSelected);
+ void SetItemCaret(FX_INT32 nItemIndex, FX_BOOL bCaret);
+
+ virtual FX_INT32 GetItemIndex(const CPDF_Point & point) const;
+ FX_INT32 GetFirstSelected() const;
+ FX_INT32 GetLastSelected() const;
+ FX_WCHAR Toupper(FX_WCHAR c) const;
+
+private:
+ CLST_ArrayTemplate<CFX_ListItem*> m_aListItems;
+ FX_FLOAT m_fFontSize;
+ IFX_Edit_FontMap* m_pFontMap;
+ FX_BOOL m_bMultiple;
+};
+
+struct CPLST_Select_Item
+{
+ CPLST_Select_Item(FX_INT32 nItemIndex,FX_INT32 nState)
+ {
+ this->nItemIndex = nItemIndex;
+ this->nState = nState;
+ }
+
+ FX_INT32 nItemIndex;
+ FX_INT32 nState; //0:normal select -1:to deselect 1: to select
+};
+
+class CPLST_Select
+{
+public:
+ CPLST_Select();
+ virtual ~CPLST_Select();
+
+public:
+ void Add(FX_INT32 nItemIndex);
+ void Add(FX_INT32 nBeginIndex, FX_INT32 nEndIndex);
+ void Sub(FX_INT32 nItemIndex);
+ void Sub(FX_INT32 nBeginIndex, FX_INT32 nEndIndex);
+ FX_BOOL IsExist(FX_INT32 nItemIndex) const;
+ FX_INT32 Find(FX_INT32 nItemIndex) const;
+ FX_INT32 GetCount() const;
+ FX_INT32 GetItemIndex(FX_INT32 nIndex) const;
+ FX_INT32 GetState(FX_INT32 nIndex) const;
+ void Done();
+ void DeselectAll();
+
+private:
+ CFX_ArrayTemplate<CPLST_Select_Item*> m_aItems;
+};
+
+class CFX_ListCtrl : public CFX_List
+{
+public:
+ CFX_ListCtrl();
+ virtual ~CFX_ListCtrl();
+
+public:
+ void SetNotify(IFX_List_Notify * pNotify);
+
+ void OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl);
+ void OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl);
+ void OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl);
+ void OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl);
+ void OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl);
+ void OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl);
+ void OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl);
+ void OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl);
+ void OnVK(FX_INT32 nItemIndex,FX_BOOL bShift,FX_BOOL bCtrl);
+ FX_BOOL OnChar(FX_WORD nChar,FX_BOOL bShift,FX_BOOL bCtrl);
+
+ virtual CPDF_Point InToOut(const CPDF_Point & point) const;
+ virtual CPDF_Point OutToIn(const CPDF_Point & point) const;
+ virtual CPDF_Rect InToOut(const CPDF_Rect & rect) const;
+ virtual CPDF_Rect OutToIn(const CPDF_Rect & rect) const;
+
+ virtual void SetPlateRect(const CPDF_Rect & rect);
+ void SetScrollPos(const CPDF_Point & point);
+ void ScrollToListItem(FX_INT32 nItemIndex);
+ virtual CPDF_Rect GetItemRect(FX_INT32 nIndex) const;
+ FX_INT32 GetCaret() const {return m_nCaretIndex;}
+ FX_INT32 GetSelect() const {return m_nSelItem;}
+ FX_INT32 GetTopItem() const;
+ virtual CPDF_Rect GetContentRect() const;
+ virtual FX_INT32 GetItemIndex(const CPDF_Point & point) const;
+
+ void AddString(FX_LPCWSTR string);
+ void SetTopItem(FX_INT32 nIndex);
+ void Select(FX_INT32 nItemIndex);
+ virtual void SetCaret(FX_INT32 nItemIndex);
+ virtual void Empty();
+ virtual void Cancel();
+ CFX_WideString GetText() const;
+
+private:
+ void SetMultipleSelect(FX_INT32 nItemIndex, FX_BOOL bSelected);
+ void SetSingleSelect(FX_INT32 nItemIndex);
+ void InvalidateItem(FX_INT32 nItemIndex);
+ void SelectItems();
+ FX_BOOL IsItemVisible(FX_INT32 nItemIndex) const;
+ void SetScrollInfo();
+ void SetScrollPosY(FX_FLOAT fy);
+ virtual void ReArrange(FX_INT32 nItemIndex);
+
+private:
+ IFX_List_Notify* m_pNotify;
+ FX_BOOL m_bNotifyFlag;
+ CPDF_Point m_ptScrollPos;
+ CPLST_Select m_aSelItems; //for multiple
+ FX_INT32 m_nSelItem; //for single
+ FX_INT32 m_nFootIndex; //for multiple
+ FX_BOOL m_bCtrlSel; //for multiple
+ FX_INT32 m_nCaretIndex; //for multiple
+};
+
+#endif
+
diff --git a/fpdfsdk/include/fxedit/fxet_stub.h b/fpdfsdk/include/fxedit/fxet_stub.h
new file mode 100644
index 0000000000..aa50cd59a0
--- /dev/null
+++ b/fpdfsdk/include/fxedit/fxet_stub.h
@@ -0,0 +1,26 @@
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef _FXET_STUB_H_
+#define _FXET_STUB_H_
+
+#include "../../../core/include/fpdfapi/fpdf_module.h"
+#include "../../../core/include/fpdfapi/fpdf_render.h"
+#include "../../../core/include/fpdfapi/fpdf_pageobj.h"
+#include "../../../core/include/fpdfdoc/fpdf_vt.h"
+#include "../fx_systemhandler.h"
+#ifdef FX_READER_DLL
+ #ifdef _DEBUG
+ #pragma comment(lib, "X:/pdf/fxcore/Lib/dbg_w32_vc6/fxcoredll[dbg,w32,vc6].lib")
+ #pragma comment(lib, "X:/pdf/fxcore/Lib/dbg_w32_vc6/fpdfdocdll[dbg,w32,vc6].lib")
+ #else
+ #pragma comment(lib, "X:/pdf/fxcore/Lib/rel_w32_vc6/fxcoredll[rel,w32,vc6].lib")
+ #pragma comment(lib, "X:/pdf/fxcore/Lib/rel_w32_vc6/fpdfdocdll[rel,w32,vc6].lib")
+ #endif
+#endif
+
+#endif
+