1e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Copyright 2014 PDFium Authors. All rights reserved.
2e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Use of this source code is governed by a BSD-style license that can be
3e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// found in the LICENSE file.
4e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
5e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
7e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#ifndef FPDFSDK_INCLUDE_FXEDIT_FX_EDIT_H_
8e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#define FPDFSDK_INCLUDE_FXEDIT_FX_EDIT_H_
9e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
10e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#include "../../../core/include/fxcrt/fx_basic.h"
11e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#include "../../../core/include/fxge/fx_dib.h"
12e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
13e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass CFX_RenderDevice;
14e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass CPDF_Font;
15e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass CPDF_Matrix;
16e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass CPDF_PageObjects;
17e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass CPDF_Point;
18e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass CPDF_Rect;
19e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass CPDF_TextObject;
20e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass IFX_Edit;
21e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass IFX_Edit_FontMap;
22e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass IFX_Edit_Iterator;
23e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass IFX_Edit_Notify;
24e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass IFX_Edit_UndoItem;
25e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass IFX_List;
26e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass IFX_List_Notify;
27e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass IFX_SystemHandler;
28e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass IPDF_VariableText;
29e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass IPDF_VariableText_Provider;
30e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovstruct CPVT_Line;
31e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovstruct CPVT_SecProps;
32e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovstruct CPVT_Section;
33e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovstruct CPVT_Word;
34e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovstruct CPVT_WordPlace;
35e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovstruct CPVT_WordProps;
36e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovstruct CPVT_WordRange;
37e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
38e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#define PVTWORD_STYLE_NORMAL				0x0000L
39e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#define PVTWORD_STYLE_HIGHLIGHT				0x0001L
40e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#define PVTWORD_STYLE_UNDERLINE				0x0002L
41e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#define PVTWORD_STYLE_CROSSOUT				0x0004L
42e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#define PVTWORD_STYLE_SQUIGGLY				0x0008L
43e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#define PVTWORD_STYLE_DUALCROSSOUT			0x0010L
44e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#define PVTWORD_STYLE_BOLD					0x0020L
45e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#define PVTWORD_STYLE_ITALIC				0x0040L
46e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
47e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#define FX_EDIT_ISLATINWORD(u)	(u == 0x2D || (u <= 0x005A && u >= 0x0041) || (u <= 0x007A && u >= 0x0061) || (u <= 0x02AF && u >= 0x00C0))
48e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
49e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#ifdef FX_READER_DLL
50e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	#ifdef FXET_EXPORT
51e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov		#define FXET_CLASS __declspec(dllexport)
52e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	#else
53e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov		#define FXET_CLASS
54e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	#endif
55e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#else
56e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	#define FXET_CLASS
57e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#endif
58e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
59e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#ifndef DEFAULT_CHARSET
60e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#define DEFAULT_CHARSET         1
61e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#endif
62e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
63e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass IFX_Edit_FontMap
64e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov{
65e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovpublic:
66e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov        virtual ~IFX_Edit_FontMap() { }
67e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//map a fontindex to pdf font.
68e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual CPDF_Font *						GetPDFFont(FX_INT32 nFontIndex) = 0;
69e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the alias of a pdf font.
70e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual CFX_ByteString					GetPDFFontAlias(FX_INT32 nFontIndex) = 0;
71e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the index of a font that can show a word.
72e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_INT32						GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex) = 0;
73e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the charcode of word from unicode
74e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_INT32						CharCodeFromUnicode(FX_INT32 nFontIndex, FX_WORD word) = 0;
75e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the charset of unicode
76e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_INT32						CharSetFromUnicode(FX_WORD word, FX_INT32 nOldCharset) = 0;
77e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov};
78e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
79e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass IFX_Edit_Notify
80e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov{
81e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovpublic:
82e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov        virtual ~IFX_Edit_Notify() { }
83e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the horizontal scrollbar information.
84e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax,
85e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov												FX_FLOAT fContentMin, FX_FLOAT fContentMax,
86e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov												FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;
87e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the vertical scrollbar information.
88e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax,
89e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov												FX_FLOAT fContentMin, FX_FLOAT fContentMax,
90e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov												FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;
91e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the position of horizontal scrollbar.
92e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							IOnSetScrollPosX(FX_FLOAT fx) = 0;
93e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the position of vertical scrollbar.
94e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							IOnSetScrollPosY(FX_FLOAT fy) = 0;
95e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the caret information.
96e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							IOnSetCaret(FX_BOOL bVisible,const CPDF_Point & ptHead,const CPDF_Point & ptFoot, const CPVT_WordPlace& place) = 0;
97e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//if the caret position is changed ,send the information of current postion to user.
98e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							IOnCaretChange(const CPVT_SecProps & secProps, const CPVT_WordProps & wordProps) = 0;
99e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//if the text area is changed, send the information to user.
100e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							IOnContentChange(const CPDF_Rect& rcContent) = 0;
101e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//Invalidate the rectangle relative to the bounding box of edit.
102e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							IOnInvalidateRect(CPDF_Rect * pRect) = 0;
103e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov};
104e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
105e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass IFX_Edit_OprNotify
106e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov{
107e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovpublic:
108e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov        virtual ~IFX_Edit_OprNotify() { }
109e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
110e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//OprType: 0
111e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							OnInsertWord(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
112e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//OprType: 1
113e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							OnInsertReturn(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
114e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//OprType: 2
115e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							OnBackSpace(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
116e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//OprType: 3
117e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							OnDelete(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
118e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//OprType: 4
119e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							OnClear(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
120e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//OprType: 5
121e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							OnInsertText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
122e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//OprType: 6
123e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							OnSetText(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0;
124e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//
125e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							OnAddUndo(IFX_Edit_UndoItem* pUndoItem) = 0;
126e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov};
127e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
128e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass IFX_Edit_Iterator
129e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov{
130e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovpublic:
131e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual ~IFX_Edit_Iterator()  {}
132e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovpublic:
133e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//move the current position to the next word.
134e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							NextWord() = 0;
135e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//move the current position to the next line.
136e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							NextLine() = 0;
137e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//move the current position to the next section.
138e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							NextSection() = 0;
139e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
140e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//move the current position to the previous word.
141e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							PrevWord() = 0;
142e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//move the current position to the previous line.
143e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							PrevLine() = 0;
144e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//move the current position to the previous section.
145e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							PrevSection() = 0;
146e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
147e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the information of the current word.
148e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							GetWord(CPVT_Word & word) const = 0;
149e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the information of the current line.
150e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							GetLine(CPVT_Line & line) const = 0;
151e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the information of the current section.
152e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							GetSection(CPVT_Section & section) const = 0;
153e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the current position.
154e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetAt(FX_INT32 nWordIndex) = 0;
155e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the current position.
156e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetAt(const CPVT_WordPlace & place) = 0;
157e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the current position.
158e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual const CPVT_WordPlace &			GetAt() const = 0;
159e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
160e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the edit which this iterator belongs to
161e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual IFX_Edit*						GetEdit() const = 0;
162e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov};
163e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
164e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass IFX_Edit_UndoItem
165e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov{
166e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovpublic:
167e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual ~IFX_Edit_UndoItem() { }
168e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
169e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							Undo() = 0;
170e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							Redo() = 0;
171e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual CFX_WideString					GetUndoTitle() = 0;
172e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov};
173e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
174e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass FXET_CLASS IFX_Edit
175e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov{
176e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovpublic:
177e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	static IFX_Edit*						NewEdit();
178e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	static	void							DelEdit(IFX_Edit* pEdit);
179e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
180e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov        //set a IFX_Edit_FontMap pointer implemented by user.
181e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetFontMap(IFX_Edit_FontMap* pFontMap) = 0;
182e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//if user don't like to use FontMap, implement VTProvider and set it directly.
183e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetVTProvider(IPDF_VariableText_Provider* pProvider) = 0;
184e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set a IFX_Edit_Notify pointer implemented by user.
185e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetNotify(IFX_Edit_Notify * pNotify) = 0;
186e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetOprNotify(IFX_Edit_OprNotify* pOprNotify) = 0;
187e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get a pointer allocated by CPDF_Edit, by this pointer, user can iterate the contents of edit, but don't need to release.
188e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual IFX_Edit_Iterator*				GetIterator() = 0;
189e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get a VT pointer relative to this edit.
190e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual IPDF_VariableText*				GetVariableText() = 0;
191e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the IFX_Edit_FontMap pointer set by user.
192e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual IFX_Edit_FontMap*				GetFontMap() = 0;
193e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
194e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//initialize the edit.
195e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							Initialize() = 0;
196e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
197e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the bounding box of the text area.
198e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetPlateRect(const CPDF_Rect & rect, FX_BOOL bPaint = TRUE) = 0;
199e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the scroll origin
200e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetScrollPos(const CPDF_Point & point) = 0;
201e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
202e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the horizontal text alignment in text box, nFormat (0:left 1:middle 2:right).
203e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetAlignmentH(FX_INT32 nFormat = 0, FX_BOOL bPaint = TRUE) = 0;
204e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the vertical text alignment in text box, nFormat (0:top 1:center 2:bottom).
205e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetAlignmentV(FX_INT32 nFormat = 0, FX_BOOL bPaint = TRUE) = 0;
206e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//if the text is shown in secret , set a character for substitute.
207e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetPasswordChar(FX_WORD wSubWord = '*', FX_BOOL bPaint = TRUE) = 0;
208e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the maximal count of words of the text.
209e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetLimitChar(FX_INT32 nLimitChar = 0, FX_BOOL bPaint = TRUE) = 0;
210e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//if set the count of charArray , then all words is shown in equal space.
211e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetCharArray(FX_INT32 nCharArray = 0, FX_BOOL bPaint = TRUE) = 0;
212e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the space of two characters.
213e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE) = 0;
214e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the horizontal scale of all characters.
215e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetHorzScale(FX_INT32 nHorzScale = 100, FX_BOOL bPaint = TRUE) = 0;
216e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the leading of all lines
217e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE) = 0;
218e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//if set, CRLF is allowed.
219e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetMultiLine(FX_BOOL bMultiLine = TRUE, FX_BOOL bPaint = TRUE) = 0;
220e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//if set, all words auto fit the width of the bounding box.
221e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0;
222e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//if set, a font size is calculated to full fit the bounding box.
223e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0;
224e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//is set, the text is allowed to scroll.
225e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0;
226e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the font size of all words.
227e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE) = 0;
228e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//the text is allowed to auto-scroll, allow the text overflow?
229e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetTextOverflow(FX_BOOL bAllowed = FALSE, FX_BOOL bPaint = TRUE) = 0;
230e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
231e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//query if the edit is richedit.
232e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							IsRichText() const = 0;
233e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the edit is richedit.
234e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE) = 0;
235e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the fontsize of selected text.
236e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							SetRichFontSize(FX_FLOAT fFontSize) = 0;
237e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the fontindex of selected text, user can change the font of selected text.
238e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							SetRichFontIndex(FX_INT32 nFontIndex) = 0;
239e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the textcolor of selected text.
240e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							SetRichTextColor(FX_COLORREF dwColor) = 0;
241e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the text script type of selected text. (0:normal 1:superscript 2:subscript)
242e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							SetRichTextScript(FX_INT32 nScriptType) = 0;
243e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the bold font style of selected text.
244e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							SetRichTextBold(FX_BOOL bBold = TRUE) = 0;
245e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the italic font style of selected text.
246e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							SetRichTextItalic(FX_BOOL bItalic = TRUE) = 0;
247e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the underline style of selected text.
248e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							SetRichTextUnderline(FX_BOOL bUnderline = TRUE) = 0;
249e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the crossout style of selected text.
250e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							SetRichTextCrossout(FX_BOOL bCrossout = TRUE) = 0;
251e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the charspace of selected text, in user coordinate.
252e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual	FX_BOOL							SetRichTextCharSpace(FX_FLOAT fCharSpace) = 0;
253e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the horizontal scale of selected text, default value is 100.
254e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							SetRichTextHorzScale(FX_INT32 nHorzScale = 100) = 0;
255e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the leading of selected section, in user coordinate.
256e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							SetRichTextLineLeading(FX_FLOAT fLineLeading) = 0;
257e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the indent of selected section, in user coordinate.
258e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							SetRichTextLineIndent(FX_FLOAT fLineIndent) = 0;
259e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the alignment of selected section, nAlignment(0:left 1:middle 2:right)
260e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							SetRichTextAlignment(FX_INT32 nAlignment) = 0;
261e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
262e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the selected range of text.
263e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//if nStartChar == 0 and nEndChar == -1, select all the text.
264e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetSel(FX_INT32 nStartChar,FX_INT32 nEndChar) = 0;
265e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the selected range of text.
266e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							GetSel(FX_INT32 & nStartChar, FX_INT32 & nEndChar) const = 0;
267e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//select all the text.
268e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual	void							SelectAll() = 0;
269e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set text is not selected.
270e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SelectNone() = 0;
271e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the caret position.
272e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_INT32						GetCaret() const = 0;
273e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual CPVT_WordPlace					GetCaretWordPlace() const = 0;
274e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the string of selected text.
275e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual CFX_WideString					GetSelText() const = 0;
276e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the text conent
277e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual CFX_WideString					GetText() const = 0;
278e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//query if any text is selected.
279e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							IsSelected() const = 0;
280e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the scroll origin
281e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual CPDF_Point						GetScrollPos() const = 0;
282e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the bounding box of the text area.
283e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual CPDF_Rect						GetPlateRect() const = 0;
284e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the fact area of the text.
285e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual CPDF_Rect						GetContentRect() const = 0;
286e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the visible word range
287e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual CPVT_WordRange					GetVisibleWordRange() const = 0;
288e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the whole word range
289e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual CPVT_WordRange					GetWholeWordRange() const = 0;
290e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the word range of select text
291e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual CPVT_WordRange					GetSelectWordRange() const = 0;
292e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
293e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//send the mousedown message to edit for response.
294e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//if Shift key is hold, bShift is TRUE, is Ctrl key is hold, bCtrl is TRUE.
295e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
296e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//send the mousemove message to edit when mouse down is TRUE.
297e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
298e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//send the UP key message to edit.
299e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
300e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//send the DOWN key message to edit.
301e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
302e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//send the LEFT key message to edit.
303e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
304e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//send the RIGHT key message to edit.
305e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
306e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//send the HOME key message to edit.
307e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
308e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//send the END key message to edit.
309e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
310e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
311e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//put text into edit.
312e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetText(FX_LPCWSTR text,FX_INT32 charset = DEFAULT_CHARSET,
313e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov													const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL) = 0;
314e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//insert a word into the edit.
315e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							InsertWord(FX_WORD word, FX_INT32 charset = DEFAULT_CHARSET, const CPVT_WordProps * pWordProps = NULL) = 0;
316e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//insert a return into the edit.
317e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							InsertReturn(const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL) = 0;
318e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//insert text into the edit.
319e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							InsertText(FX_LPCWSTR text, FX_INT32 charset = DEFAULT_CHARSET,
320e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov													const CPVT_SecProps * pSecProps = NULL,const CPVT_WordProps * pWordProps = NULL) = 0;
321e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//do backspace operation.
322e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							Backspace() = 0;
323e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//do delete operation.
324e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							Delete() = 0;
325e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//delete the selected text.
326e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							Clear() = 0;
327e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
328e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//do Redo operation.
329e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							Redo() = 0;
330e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//do Undo operation.
331e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							Undo() = 0;
332e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//move caret
333e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetCaret(FX_INT32 nPos) = 0;
334e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
335e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//arrange all words over again
336e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							Paint() = 0;
337e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
338e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//allow to refresh screen?
339e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							EnableRefresh(FX_BOOL bRefresh) = 0;
340e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
341e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							RefreshWordRange(const CPVT_WordRange& wr) = 0;
342e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
343e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//allow undo/redo?
344e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							EnableUndo(FX_BOOL bUndo) = 0;
345e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
346e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//allow notify?
347e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							EnableNotify(FX_BOOL bNotify) = 0;
348e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
349e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//allow opr notify?
350e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							EnableOprNotify(FX_BOOL bNotify) = 0;
351e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
352e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//map word place to word index.
353e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_INT32						WordPlaceToWordIndex(const CPVT_WordPlace & place) const = 0;
354e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//map word index to word place.
355e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual CPVT_WordPlace					WordIndexToWordPlace(FX_INT32 index) const = 0;
356e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
357e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the beginning position of a line
358e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual CPVT_WordPlace					GetLineBeginPlace(const CPVT_WordPlace & place) const = 0;
359e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
360e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the ending position of a line
361e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual CPVT_WordPlace					GetLineEndPlace(const CPVT_WordPlace & place) const = 0;
362e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
363e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the beginning position of a section
364e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual CPVT_WordPlace					GetSectionBeginPlace(const CPVT_WordPlace & place) const = 0;
365e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
366e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the ending position of a section
367e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual CPVT_WordPlace					GetSectionEndPlace(const CPVT_WordPlace & place) const = 0;
368e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
369e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//search a wordplace form point
370e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual CPVT_WordPlace					SearchWordPlace(const CPDF_Point& point) const = 0;
371e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
372e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the font size of non_rich text or default font size of richtext.
373e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_FLOAT						GetFontSize() const = 0;
374e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the mask character.
375e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_WORD							GetPasswordChar() const = 0;
376e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the count of charArray
377e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_INT32						GetCharArray() const = 0;
378e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the horizontal scale of all characters
379e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_INT32						GetHorzScale() const = 0;
380e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the space of two characters
381e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_FLOAT						GetCharSpace() const = 0;
382e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the latin words of specified range
383e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual CFX_WideString					GetRangeText(const CPVT_WordRange & range) const = 0;
384e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//is the text full in bounding box
385e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							IsTextFull() const = 0;
386e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							CanUndo() const = 0;
387e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							CanRedo() const = 0;
388e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//if the content is changed after settext?
389e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							IsModified() const = 0;
390e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//get the total words in edit
391e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_INT32						GetTotalWords() const = 0;
392e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
393e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							AddUndoItem(IFX_Edit_UndoItem* pUndoItem) = 0;
394e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
395e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	static CFX_ByteString					GetEditAppearanceStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset,
396e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov													const CPVT_WordRange* pRange = NULL,
397e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov													FX_BOOL bContinuous = TRUE, FX_WORD SubWord = 0);
398e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	static CFX_ByteString					GetSelectAppearanceStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, const CPVT_WordRange* pRange = NULL);
399e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	static void								DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, FX_COLORREF crTextFill, FX_COLORREF crTextStroke,
400e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov													const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, IFX_SystemHandler* pSystemHandler, void* pFFLData);
401e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	static void								DrawUnderline(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit, FX_COLORREF color,
402e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov													const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange);
403e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	static void								DrawRichEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit,
404e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov													const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, const CPVT_WordRange* pRange);
405e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	static void								GeneratePageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit,
406e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov													const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, FX_COLORREF crText, CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray);
407e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	static void								GenerateRichPageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit,
408e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov													const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray);
409e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	static void								GenerateUnderlineObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit,
410e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov													const CPDF_Point& ptOffset, const CPVT_WordRange* pRange, FX_COLORREF color);
411e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
412e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovprotected:
413e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov    ~IFX_Edit() { }
414e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov};
415e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
416e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass IFX_List_Notify
417e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov{
418e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovpublic:
419e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov        virtual ~IFX_List_Notify() { }
420e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the horizontal scrollbar information.
421e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							IOnSetScrollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax,
422e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov												FX_FLOAT fContentMin, FX_FLOAT fContentMax,
423e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov												FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;
424e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the vertical scrollbar information.
425e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							IOnSetScrollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax,
426e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov												FX_FLOAT fContentMin, FX_FLOAT fContentMax,
427e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov												FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0;
428e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the position of horizontal scrollbar.
429e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							IOnSetScrollPosX(FX_FLOAT fx) = 0;
430e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//set the position of vertical scrollbar.
431e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							IOnSetScrollPosY(FX_FLOAT fy) = 0;
432e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	//Invalidate the rectangle relative to the bounding box of edit.
433e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							IOnInvalidateRect(CPDF_Rect * pRect) = 0;
434e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov};
435e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
436e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovclass FXET_CLASS IFX_List
437e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov{
438e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovpublic:
439e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	static IFX_List*						NewList();
440e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	static void								DelList(IFX_List* pList);
441e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
442e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetFontMap(IFX_Edit_FontMap * pFontMap) = 0;
443e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetNotify(IFX_List_Notify * pNotify) = 0;
444e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
445e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetPlateRect(const CPDF_Rect & rect) = 0;
446e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetFontSize(FX_FLOAT fFontSize) = 0;
447e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
448e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual CPDF_Rect						GetPlateRect() const = 0;
449e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual CPDF_Rect						GetContentRect() const = 0;
450e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
451e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_FLOAT						GetFontSize() const = 0;
452e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual IFX_Edit*						GetItemEdit(FX_INT32 nIndex) const = 0;
453e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_INT32						GetCount() const = 0;
454e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							IsItemSelected(FX_INT32 nIndex) const = 0;
455e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_FLOAT						GetFirstHeight() const = 0;
456e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
457e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetMultipleSel(FX_BOOL bMultiple) = 0;
458e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							IsMultipleSel() const = 0;
459e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							IsValid(FX_INT32 nItemIndex) const = 0;
460e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_INT32						FindNext(FX_INT32 nIndex,FX_WCHAR nChar) const = 0;
461e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
462e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetScrollPos(const CPDF_Point & point) = 0;
463e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							ScrollToListItem(FX_INT32 nItemIndex) = 0;
464e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual CPDF_Rect						GetItemRect(FX_INT32 nIndex) const = 0;
465e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_INT32						GetCaret() const = 0;
466e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_INT32						GetSelect() const = 0;
467e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_INT32						GetTopItem() const = 0;
468e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_INT32						GetItemIndex(const CPDF_Point & point) const = 0;
469e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_INT32						GetFirstSelected() const = 0;
470e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
471e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							AddString(FX_LPCWSTR string) = 0;
472e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetTopItem(FX_INT32 nIndex) = 0;
473e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							Select(FX_INT32 nItemIndex) = 0;
474e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							SetCaret(FX_INT32 nItemIndex) = 0;
475e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							Empty() = 0;
476e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							Cancel() = 0;
477e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual CFX_WideString					GetText() const = 0;
478e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
479e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
480e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							OnMouseDown(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
481e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							OnMouseMove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
482e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							OnVK_UP(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
483e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							OnVK_DOWN(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
484e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							OnVK_LEFT(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
485e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							OnVK_RIGHT(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
486e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							OnVK_HOME(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
487e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							OnVK_END(FX_BOOL bShift,FX_BOOL bCtrl) = 0;
488e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual void							OnVK(FX_INT32 nItemIndex,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
489e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov	virtual FX_BOOL							OnChar(FX_WORD nChar,FX_BOOL bShift,FX_BOOL bCtrl) = 0;
490e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
491e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganovprotected:
492e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov        ~IFX_List() { }
493e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov};
494e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov
495e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov#endif  // FPDFSDK_INCLUDE_FXEDIT_FX_EDIT_H_
496