OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef _FX_EDIT_H_ | 7 #ifndef _FX_EDIT_H_ |
8 #define _FX_EDIT_H_ | 8 #define _FX_EDIT_H_ |
9 | 9 |
10 #define PVTWORD_STYLE_NORMAL 0x0000L | 10 #define PVTWORD_STYLE_NORMAL 0x0000L |
(...skipping 26 matching lines...) Expand all Loading... |
37 class IFX_Edit_Iterator; | 37 class IFX_Edit_Iterator; |
38 class IFX_Edit_UndoItem; | 38 class IFX_Edit_UndoItem; |
39 class IFX_Edit; | 39 class IFX_Edit; |
40 class IFX_List_Notify; | 40 class IFX_List_Notify; |
41 class IFX_List; | 41 class IFX_List; |
42 class IFX_SystemHandler; | 42 class IFX_SystemHandler; |
43 | 43 |
44 class IFX_Edit_FontMap | 44 class IFX_Edit_FontMap |
45 { | 45 { |
46 public: | 46 public: |
| 47 virtual ~IFX_Edit_FontMap() { } |
47 //map a fontindex to pdf font. | 48 //map a fontindex to pdf font. |
48 virtual CPDF_Font * GetPDFFo
nt(FX_INT32 nFontIndex) = 0; | 49 virtual CPDF_Font * GetPDFFo
nt(FX_INT32 nFontIndex) = 0; |
49 //get the alias of a pdf font. | 50 //get the alias of a pdf font. |
50 virtual CFX_ByteString GetPDFFontAlias(
FX_INT32 nFontIndex) = 0; | 51 virtual CFX_ByteString GetPDFFontAlias(
FX_INT32 nFontIndex) = 0; |
51 //get the index of a font that can show a word. | 52 //get the index of a font that can show a word. |
52 virtual FX_INT32 GetWordF
ontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex) = 0; | 53 virtual FX_INT32 GetWordF
ontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex) = 0; |
53 //get the charcode of word from unicode | 54 //get the charcode of word from unicode |
54 virtual FX_INT32 CharCode
FromUnicode(FX_INT32 nFontIndex, FX_WORD word) = 0; | 55 virtual FX_INT32 CharCode
FromUnicode(FX_INT32 nFontIndex, FX_WORD word) = 0; |
55 //get the charset of unicode | 56 //get the charset of unicode |
56 virtual FX_INT32 CharSetF
romUnicode(FX_WORD word, FX_INT32 nOldCharset) = 0; | 57 virtual FX_INT32 CharSetF
romUnicode(FX_WORD word, FX_INT32 nOldCharset) = 0; |
57 }; | 58 }; |
58 | 59 |
59 class IFX_Edit_Notify | 60 class IFX_Edit_Notify |
60 { | 61 { |
61 //this class is implemented by user | |
62 public: | 62 public: |
| 63 virtual ~IFX_Edit_Notify() { } |
63 //set the horizontal scrollbar information. | 64 //set the horizontal scrollbar information. |
64 virtual void IOnSetSc
rollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, | 65 virtual void IOnSetSc
rollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, |
65
FX_FLOAT fContentMin, FX_FLOAT fContentMax, | 66
FX_FLOAT fContentMin, FX_FLOAT fContentMax, |
66
FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0; | 67
FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0; |
67 //set the vertical scrollbar information. | 68 //set the vertical scrollbar information. |
68 virtual void IOnSetSc
rollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, | 69 virtual void IOnSetSc
rollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, |
69
FX_FLOAT fContentMin, FX_FLOAT fContentMax, | 70
FX_FLOAT fContentMin, FX_FLOAT fContentMax, |
70
FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0; | 71
FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0; |
71 //set the position of horizontal scrollbar. | 72 //set the position of horizontal scrollbar. |
72 virtual void IOnSetSc
rollPosX(FX_FLOAT fx) = 0; | 73 virtual void IOnSetSc
rollPosX(FX_FLOAT fx) = 0; |
73 //set the position of vertical scrollbar. | 74 //set the position of vertical scrollbar. |
74 virtual void IOnSetSc
rollPosY(FX_FLOAT fy) = 0; | 75 virtual void IOnSetSc
rollPosY(FX_FLOAT fy) = 0; |
75 //set the caret information. | 76 //set the caret information. |
76 virtual void IOnSetCa
ret(FX_BOOL bVisible,const CPDF_Point & ptHead,const CPDF_Point & ptFoot, const
CPVT_WordPlace& place) = 0; | 77 virtual void IOnSetCa
ret(FX_BOOL bVisible,const CPDF_Point & ptHead,const CPDF_Point & ptFoot, const
CPVT_WordPlace& place) = 0; |
77 //if the caret position is changed ,send the information of current post
ion to user. | 78 //if the caret position is changed ,send the information of current post
ion to user. |
78 virtual void IOnCaret
Change(const CPVT_SecProps & secProps, const CPVT_WordProps & wordProps) = 0; | 79 virtual void IOnCaret
Change(const CPVT_SecProps & secProps, const CPVT_WordProps & wordProps) = 0; |
79 //if the text area is changed, send the information to user. | 80 //if the text area is changed, send the information to user. |
80 virtual void IOnConte
ntChange(const CPDF_Rect& rcContent) = 0; | 81 virtual void IOnConte
ntChange(const CPDF_Rect& rcContent) = 0; |
81 //Invalidate the rectangle relative to the bounding box of edit. | 82 //Invalidate the rectangle relative to the bounding box of edit. |
82 virtual void IOnInval
idateRect(CPDF_Rect * pRect) = 0; | 83 virtual void IOnInval
idateRect(CPDF_Rect * pRect) = 0; |
83 }; | 84 }; |
84 | 85 |
85 class IFX_Edit_OprNotify | 86 class IFX_Edit_OprNotify |
86 { | 87 { |
87 //this class is implemented by user | |
88 public: | 88 public: |
| 89 virtual ~IFX_Edit_OprNotify() { } |
| 90 |
89 //OprType: 0 | 91 //OprType: 0 |
90 virtual void OnInsert
Word(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0; | 92 virtual void OnInsert
Word(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0; |
91 //OprType: 1 | 93 //OprType: 1 |
92 virtual void OnInsert
Return(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0; | 94 virtual void OnInsert
Return(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0; |
93 //OprType: 2 | 95 //OprType: 2 |
94 virtual void OnBackSp
ace(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0; | 96 virtual void OnBackSp
ace(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0; |
95 //OprType: 3 | 97 //OprType: 3 |
96 virtual void OnDelete
(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0; | 98 virtual void OnDelete
(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0; |
97 //OprType: 4 | 99 //OprType: 4 |
98 virtual void OnClear(
const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0; | 100 virtual void OnClear(
const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace) = 0; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 //get the current position. | 138 //get the current position. |
137 virtual const CPVT_WordPlace & GetAt() const = 0; | 139 virtual const CPVT_WordPlace & GetAt() const = 0; |
138 | 140 |
139 //get the edit which this iterator belongs to | 141 //get the edit which this iterator belongs to |
140 virtual IFX_Edit* GetEdit(
) const = 0; | 142 virtual IFX_Edit* GetEdit(
) const = 0; |
141 }; | 143 }; |
142 | 144 |
143 class IFX_Edit_UndoItem | 145 class IFX_Edit_UndoItem |
144 { | 146 { |
145 public: | 147 public: |
| 148 virtual void Release(
) = 0; |
146 virtual void Undo() =
0; | 149 virtual void Undo() =
0; |
147 virtual void Redo() =
0; | 150 virtual void Redo() =
0; |
148 virtual CFX_WideString GetUndoTitle() =
0; | 151 virtual CFX_WideString GetUndoTitle() =
0; |
149 » virtual void» » » » » » » Release(
) = 0; | 152 |
| 153 protected: |
| 154 ~IFX_Edit_UndoItem() { } |
150 }; | 155 }; |
151 | 156 |
152 class FXET_CLASS IFX_Edit | 157 class FXET_CLASS IFX_Edit |
153 { | 158 { |
154 public: | 159 public: |
155 static IFX_Edit* NewEdit(
); | 160 static IFX_Edit* NewEdit(
); |
156 static void DelEdit(
IFX_Edit* pEdit); | 161 static void DelEdit(
IFX_Edit* pEdit); |
157 | 162 |
158 public: | 163 //set a IFX_Edit_FontMap pointer implemented by user. |
159 » //set a IFX_Edit_FontMap pointer implemented by user. | |
160 virtual void SetFontM
ap(IFX_Edit_FontMap* pFontMap) = 0; | 164 virtual void SetFontM
ap(IFX_Edit_FontMap* pFontMap) = 0; |
161 //if user don't like to use FontMap, implement VTProvider and set it dir
ectly. | 165 //if user don't like to use FontMap, implement VTProvider and set it dir
ectly. |
162 virtual void SetVTPro
vider(IPDF_VariableText_Provider* pProvider) = 0; | 166 virtual void SetVTPro
vider(IPDF_VariableText_Provider* pProvider) = 0; |
163 //set a IFX_Edit_Notify pointer implemented by user. | 167 //set a IFX_Edit_Notify pointer implemented by user. |
164 virtual void SetNotif
y(IFX_Edit_Notify * pNotify) = 0; | 168 virtual void SetNotif
y(IFX_Edit_Notify * pNotify) = 0; |
165 virtual void SetOprNo
tify(IFX_Edit_OprNotify* pOprNotify) = 0; | 169 virtual void SetOprNo
tify(IFX_Edit_OprNotify* pOprNotify) = 0; |
166 //get a pointer allocated by CPDF_Edit, by this pointer, user can iterat
e the contents of edit, but don't need to release. | 170 //get a pointer allocated by CPDF_Edit, by this pointer, user can iterat
e the contents of edit, but don't need to release. |
167 virtual IFX_Edit_Iterator* GetIterator() =
0; | 171 virtual IFX_Edit_Iterator* GetIterator() =
0; |
168 //get a VT pointer relative to this edit. | 172 //get a VT pointer relative to this edit. |
169 virtual IPDF_VariableText* GetVariableText(
) = 0; | 173 virtual IPDF_VariableText* GetVariableText(
) = 0; |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 virtual FX_BOOL IsTextFu
ll() const = 0; | 368 virtual FX_BOOL IsTextFu
ll() const = 0; |
365 virtual FX_BOOL CanUndo(
) const = 0; | 369 virtual FX_BOOL CanUndo(
) const = 0; |
366 virtual FX_BOOL CanRedo(
) const = 0; | 370 virtual FX_BOOL CanRedo(
) const = 0; |
367 //if the content is changed after settext? | 371 //if the content is changed after settext? |
368 virtual FX_BOOL IsModifi
ed() const = 0; | 372 virtual FX_BOOL IsModifi
ed() const = 0; |
369 //get the total words in edit | 373 //get the total words in edit |
370 virtual FX_INT32 GetTotal
Words() const = 0; | 374 virtual FX_INT32 GetTotal
Words() const = 0; |
371 | 375 |
372 virtual void AddUndoI
tem(IFX_Edit_UndoItem* pUndoItem) = 0; | 376 virtual void AddUndoI
tem(IFX_Edit_UndoItem* pUndoItem) = 0; |
373 | 377 |
374 public: | |
375 static CFX_ByteString GetEditAppearanc
eStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, | 378 static CFX_ByteString GetEditAppearanc
eStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, |
376
const CPVT_WordRange* pRange = NULL, | 379
const CPVT_WordRange* pRange = NULL, |
377
FX_BOOL bContinuous = TRUE, FX_WORD SubWord = 0); | 380
FX_BOOL bContinuous = TRUE, FX_WORD SubWord = 0); |
378 static CFX_ByteString GetSelectAppeara
nceStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, const CPVT_WordRange* pR
ange = NULL); | 381 static CFX_ByteString GetSelectAppeara
nceStream(IFX_Edit* pEdit, const CPDF_Point & ptOffset, const CPVT_WordRange* pR
ange = NULL); |
379 static void
DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit,
FX_COLORREF crTextFill, FX_COLORREF crTextStroke, | 382 static void
DrawEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEdit,
FX_COLORREF crTextFill, FX_COLORREF crTextStroke, |
380
const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, con
st CPVT_WordRange* pRange, IFX_SystemHandler* pSystemHandler, void* pFFLData); | 383
const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, con
st CPVT_WordRange* pRange, IFX_SystemHandler* pSystemHandler, void* pFFLData); |
381 static void
DrawUnderline(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pE
dit, FX_COLORREF color, | 384 static void
DrawUnderline(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pE
dit, FX_COLORREF color, |
382
const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, con
st CPVT_WordRange* pRange); | 385
const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, con
st CPVT_WordRange* pRange); |
383 static void
DrawRichEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEd
it, | 386 static void
DrawRichEdit(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, IFX_Edit* pEd
it, |
384
const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, con
st CPVT_WordRange* pRange); | 387
const CPDF_Rect& rcClip, const CPDF_Point& ptOffset, con
st CPVT_WordRange* pRange); |
385 static void
GeneratePageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit, | 388 static void
GeneratePageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit, |
386
const CPDF_Point& ptOffset, const CPVT_WordRange* pRange
, FX_COLORREF crText, CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray); | 389
const CPDF_Point& ptOffset, const CPVT_WordRange* pRange
, FX_COLORREF crText, CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray); |
387 static void
GenerateRichPageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit, | 390 static void
GenerateRichPageObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit, |
388
const CPDF_Point& ptOffset, const CPVT_WordRange* pRange
, CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray); | 391
const CPDF_Point& ptOffset, const CPVT_WordRange* pRange
, CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray); |
389 static void
GenerateUnderlineObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit, | 392 static void
GenerateUnderlineObjects(CPDF_PageObjects* pPageObjects, IFX_Edit* pEdit, |
390
const CPDF_Point& ptOffset, const CPVT_WordRange* pRange
, FX_COLORREF color); | 393
const CPDF_Point& ptOffset, const CPVT_WordRange* pRange
, FX_COLORREF color); |
| 394 |
| 395 protected: |
| 396 ~IFX_Edit() { } |
391 }; | 397 }; |
392 | 398 |
393 class IFX_List_Notify | 399 class IFX_List_Notify |
394 { | 400 { |
395 //this class is implemented by user | |
396 public: | 401 public: |
| 402 virtual ~IFX_List_Notify() { } |
397 //set the horizontal scrollbar information. | 403 //set the horizontal scrollbar information. |
398 virtual void IOnSetSc
rollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, | 404 virtual void IOnSetSc
rollInfoX(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, |
399
FX_FLOAT fContentMin, FX_FLOAT fContentMax, | 405
FX_FLOAT fContentMin, FX_FLOAT fContentMax, |
400
FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0; | 406
FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0; |
401 //set the vertical scrollbar information. | 407 //set the vertical scrollbar information. |
402 virtual void IOnSetSc
rollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, | 408 virtual void IOnSetSc
rollInfoY(FX_FLOAT fPlateMin, FX_FLOAT fPlateMax, |
403
FX_FLOAT fContentMin, FX_FLOAT fContentMax, | 409
FX_FLOAT fContentMin, FX_FLOAT fContentMax, |
404
FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0; | 410
FX_FLOAT fSmallStep, FX_FLOAT fBigStep) = 0; |
405 //set the position of horizontal scrollbar. | 411 //set the position of horizontal scrollbar. |
406 virtual void IOnSetSc
rollPosX(FX_FLOAT fx) = 0; | 412 virtual void IOnSetSc
rollPosX(FX_FLOAT fx) = 0; |
407 //set the position of vertical scrollbar. | 413 //set the position of vertical scrollbar. |
408 virtual void IOnSetSc
rollPosY(FX_FLOAT fy) = 0; | 414 virtual void IOnSetSc
rollPosY(FX_FLOAT fy) = 0; |
409 //Invalidate the rectangle relative to the bounding box of edit. | 415 //Invalidate the rectangle relative to the bounding box of edit. |
410 virtual void IOnInval
idateRect(CPDF_Rect * pRect) = 0; | 416 virtual void IOnInval
idateRect(CPDF_Rect * pRect) = 0; |
411 }; | 417 }; |
412 | 418 |
413 class FXET_CLASS IFX_List | 419 class FXET_CLASS IFX_List |
414 { | 420 { |
415 public: | 421 public: |
416 static IFX_List* NewList(
); | 422 static IFX_List* NewList(
); |
417 static void
DelList(IFX_List* pList); | 423 static void
DelList(IFX_List* pList); |
418 | 424 |
419 public: | |
420 virtual void SetFontM
ap(IFX_Edit_FontMap * pFontMap) = 0; | 425 virtual void SetFontM
ap(IFX_Edit_FontMap * pFontMap) = 0; |
421 virtual void SetNotif
y(IFX_List_Notify * pNotify) = 0; | 426 virtual void SetNotif
y(IFX_List_Notify * pNotify) = 0; |
422 | 427 |
423 virtual void SetPlate
Rect(const CPDF_Rect & rect) = 0; | 428 virtual void SetPlate
Rect(const CPDF_Rect & rect) = 0; |
424 virtual void SetFontS
ize(FX_FLOAT fFontSize) = 0; | 429 virtual void SetFontS
ize(FX_FLOAT fFontSize) = 0; |
425 | 430 |
426 virtual CPDF_Rect GetPlate
Rect() const = 0; | 431 virtual CPDF_Rect GetPlate
Rect() const = 0; |
427 virtual CPDF_Rect GetConte
ntRect() const = 0; | 432 virtual CPDF_Rect GetConte
ntRect() const = 0; |
428 | 433 |
429 virtual FX_FLOAT GetFontS
ize() const = 0; | 434 virtual FX_FLOAT GetFontS
ize() const = 0; |
(...skipping 28 matching lines...) Expand all Loading... |
458 virtual void OnMouseD
own(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0; | 463 virtual void OnMouseD
own(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0; |
459 virtual void OnMouseM
ove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0; | 464 virtual void OnMouseM
ove(const CPDF_Point & point,FX_BOOL bShift,FX_BOOL bCtrl) = 0; |
460 virtual void OnVK_UP(
FX_BOOL bShift,FX_BOOL bCtrl) = 0; | 465 virtual void OnVK_UP(
FX_BOOL bShift,FX_BOOL bCtrl) = 0; |
461 virtual void OnVK_DOW
N(FX_BOOL bShift,FX_BOOL bCtrl) = 0; | 466 virtual void OnVK_DOW
N(FX_BOOL bShift,FX_BOOL bCtrl) = 0; |
462 virtual void OnVK_LEF
T(FX_BOOL bShift,FX_BOOL bCtrl) = 0; | 467 virtual void OnVK_LEF
T(FX_BOOL bShift,FX_BOOL bCtrl) = 0; |
463 virtual void OnVK_RIG
HT(FX_BOOL bShift,FX_BOOL bCtrl) = 0; | 468 virtual void OnVK_RIG
HT(FX_BOOL bShift,FX_BOOL bCtrl) = 0; |
464 virtual void OnVK_HOM
E(FX_BOOL bShift,FX_BOOL bCtrl) = 0; | 469 virtual void OnVK_HOM
E(FX_BOOL bShift,FX_BOOL bCtrl) = 0; |
465 virtual void OnVK_END
(FX_BOOL bShift,FX_BOOL bCtrl) = 0; | 470 virtual void OnVK_END
(FX_BOOL bShift,FX_BOOL bCtrl) = 0; |
466 virtual void OnVK(FX_
INT32 nItemIndex,FX_BOOL bShift,FX_BOOL bCtrl) = 0; | 471 virtual void OnVK(FX_
INT32 nItemIndex,FX_BOOL bShift,FX_BOOL bCtrl) = 0; |
467 virtual FX_BOOL OnChar(F
X_WORD nChar,FX_BOOL bShift,FX_BOOL bCtrl) = 0; | 472 virtual FX_BOOL OnChar(F
X_WORD nChar,FX_BOOL bShift,FX_BOOL bCtrl) = 0; |
| 473 |
| 474 protected: |
| 475 ~IFX_List() { } |
468 }; | 476 }; |
469 | 477 |
470 #endif | 478 #endif |
471 | 479 |
OLD | NEW |