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 FPDFSDK_FXEDIT_INCLUDE_FX_EDIT_H_ | 7 #ifndef FPDFSDK_FXEDIT_INCLUDE_FX_EDIT_H_ |
8 #define FPDFSDK_FXEDIT_INCLUDE_FX_EDIT_H_ | 8 #define FPDFSDK_FXEDIT_INCLUDE_FX_EDIT_H_ |
9 | 9 |
10 #include "core/fpdfdoc/include/cpdf_variabletext.h" | 10 #include "core/fpdfdoc/include/cpdf_variabletext.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 FX_FLOAT fBigStep) = 0; | 70 FX_FLOAT fBigStep) = 0; |
71 // set the position of horizontal scrollbar. | 71 // set the position of horizontal scrollbar. |
72 virtual void IOnSetScrollPosX(FX_FLOAT fx) = 0; | 72 virtual void IOnSetScrollPosX(FX_FLOAT fx) = 0; |
73 // set the position of vertical scrollbar. | 73 // set the position of vertical scrollbar. |
74 virtual void IOnSetScrollPosY(FX_FLOAT fy) = 0; | 74 virtual void IOnSetScrollPosY(FX_FLOAT fy) = 0; |
75 // set the caret information. | 75 // set the caret information. |
76 virtual void IOnSetCaret(FX_BOOL bVisible, | 76 virtual void IOnSetCaret(FX_BOOL bVisible, |
77 const CFX_FloatPoint& ptHead, | 77 const CFX_FloatPoint& ptHead, |
78 const CFX_FloatPoint& ptFoot, | 78 const CFX_FloatPoint& ptFoot, |
79 const CPVT_WordPlace& place) = 0; | 79 const CPVT_WordPlace& place) = 0; |
80 // if the caret position is changed ,send the information of current postion | |
81 // to user. | |
82 virtual void IOnCaretChange(const CPVT_SecProps& secProps, | |
83 const CPVT_WordProps& wordProps) = 0; | |
84 // if the text area is changed, send the information to user. | 80 // if the text area is changed, send the information to user. |
85 virtual void IOnContentChange(const CFX_FloatRect& rcContent) = 0; | 81 virtual void IOnContentChange(const CFX_FloatRect& rcContent) = 0; |
86 // Invalidate the rectangle relative to the bounding box of edit. | 82 // Invalidate the rectangle relative to the bounding box of edit. |
87 virtual void IOnInvalidateRect(CFX_FloatRect* pRect) = 0; | 83 virtual void IOnInvalidateRect(CFX_FloatRect* pRect) = 0; |
88 }; | 84 }; |
89 | 85 |
90 class IFX_Edit_OprNotify { | 86 class IFX_Edit_OprNotify { |
91 public: | 87 public: |
92 virtual ~IFX_Edit_OprNotify() {} | 88 virtual ~IFX_Edit_OprNotify() {} |
93 | 89 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 // is set, the text is allowed to scroll. | 231 // is set, the text is allowed to scroll. |
236 virtual void SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0; | 232 virtual void SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0; |
237 | 233 |
238 // set the font size of all words. | 234 // set the font size of all words. |
239 virtual void SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE) = 0; | 235 virtual void SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE) = 0; |
240 | 236 |
241 // the text is allowed to auto-scroll, allow the text overflow? | 237 // the text is allowed to auto-scroll, allow the text overflow? |
242 virtual void SetTextOverflow(FX_BOOL bAllowed = FALSE, | 238 virtual void SetTextOverflow(FX_BOOL bAllowed = FALSE, |
243 FX_BOOL bPaint = TRUE) = 0; | 239 FX_BOOL bPaint = TRUE) = 0; |
244 | 240 |
245 // query if the edit is richedit. | |
246 virtual FX_BOOL IsRichText() const = 0; | |
247 | |
248 // set the edit is richedit. | |
249 virtual void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE) = 0; | |
250 | |
251 // set the fontsize of selected text. | |
252 virtual FX_BOOL SetRichFontSize(FX_FLOAT fFontSize) = 0; | |
253 | |
254 // set the fontindex of selected text, user can change the font of selected | |
255 // text. | |
256 virtual FX_BOOL SetRichFontIndex(int32_t nFontIndex) = 0; | |
257 | |
258 // set the textcolor of selected text. | |
259 virtual FX_BOOL SetRichTextColor(FX_COLORREF dwColor) = 0; | |
260 | |
261 // set the text script type of selected text. (0:normal 1:superscript | |
262 // 2:subscript) | |
263 virtual FX_BOOL SetRichTextScript( | |
264 CPDF_VariableText::ScriptType nScriptType) = 0; | |
265 | |
266 // set the bold font style of selected text. | |
267 virtual FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE) = 0; | |
268 | |
269 // set the italic font style of selected text. | |
270 virtual FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE) = 0; | |
271 | |
272 // set the underline style of selected text. | |
273 virtual FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE) = 0; | |
274 | |
275 // set the crossout style of selected text. | |
276 virtual FX_BOOL SetRichTextCrossout(FX_BOOL bCrossout = TRUE) = 0; | |
277 | |
278 // set the charspace of selected text, in user coordinate. | |
279 virtual FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace) = 0; | |
280 | |
281 // set the horizontal scale of selected text, default value is 100. | |
282 virtual FX_BOOL SetRichTextHorzScale(int32_t nHorzScale = 100) = 0; | |
283 | |
284 // set the leading of selected section, in user coordinate. | |
285 virtual FX_BOOL SetRichTextLineLeading(FX_FLOAT fLineLeading) = 0; | |
286 | |
287 // set the indent of selected section, in user coordinate. | |
288 virtual FX_BOOL SetRichTextLineIndent(FX_FLOAT fLineIndent) = 0; | |
289 | |
290 // set the alignment of selected section, nAlignment(0:left 1:middle 2:right) | |
291 virtual FX_BOOL SetRichTextAlignment(int32_t nAlignment) = 0; | |
292 | |
293 // set the selected range of text. | 241 // set the selected range of text. |
294 // if nStartChar == 0 and nEndChar == -1, select all the text. | 242 // if nStartChar == 0 and nEndChar == -1, select all the text. |
295 virtual void SetSel(int32_t nStartChar, int32_t nEndChar) = 0; | 243 virtual void SetSel(int32_t nStartChar, int32_t nEndChar) = 0; |
296 | 244 |
297 // get the selected range of text. | 245 // get the selected range of text. |
298 virtual void GetSel(int32_t& nStartChar, int32_t& nEndChar) const = 0; | 246 virtual void GetSel(int32_t& nStartChar, int32_t& nEndChar) const = 0; |
299 | 247 |
300 // select all the text. | 248 // select all the text. |
301 virtual void SelectAll() = 0; | 249 virtual void SelectAll() = 0; |
302 | 250 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 virtual void Paint() = 0; | 354 virtual void Paint() = 0; |
407 | 355 |
408 // allow to refresh screen? | 356 // allow to refresh screen? |
409 virtual void EnableRefresh(FX_BOOL bRefresh) = 0; | 357 virtual void EnableRefresh(FX_BOOL bRefresh) = 0; |
410 | 358 |
411 virtual void RefreshWordRange(const CPVT_WordRange& wr) = 0; | 359 virtual void RefreshWordRange(const CPVT_WordRange& wr) = 0; |
412 | 360 |
413 // allow undo/redo? | 361 // allow undo/redo? |
414 virtual void EnableUndo(FX_BOOL bUndo) = 0; | 362 virtual void EnableUndo(FX_BOOL bUndo) = 0; |
415 | 363 |
416 // allow notify? | |
417 virtual void EnableNotify(FX_BOOL bNotify) = 0; | |
418 | |
419 // allow opr notify? | 364 // allow opr notify? |
420 virtual void EnableOprNotify(FX_BOOL bNotify) = 0; | 365 virtual void EnableOprNotify(FX_BOOL bNotify) = 0; |
421 | 366 |
422 // map word place to word index. | 367 // map word place to word index. |
423 virtual int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const = 0; | 368 virtual int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const = 0; |
424 // map word index to word place. | 369 // map word index to word place. |
425 virtual CPVT_WordPlace WordIndexToWordPlace(int32_t index) const = 0; | 370 virtual CPVT_WordPlace WordIndexToWordPlace(int32_t index) const = 0; |
426 | 371 |
427 // get the beginning position of a line | 372 // get the beginning position of a line |
428 virtual CPVT_WordPlace GetLineBeginPlace( | 373 virtual CPVT_WordPlace GetLineBeginPlace( |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 static void DrawEdit(CFX_RenderDevice* pDevice, | 431 static void DrawEdit(CFX_RenderDevice* pDevice, |
487 CFX_Matrix* pUser2Device, | 432 CFX_Matrix* pUser2Device, |
488 IFX_Edit* pEdit, | 433 IFX_Edit* pEdit, |
489 FX_COLORREF crTextFill, | 434 FX_COLORREF crTextFill, |
490 FX_COLORREF crTextStroke, | 435 FX_COLORREF crTextStroke, |
491 const CFX_FloatRect& rcClip, | 436 const CFX_FloatRect& rcClip, |
492 const CFX_FloatPoint& ptOffset, | 437 const CFX_FloatPoint& ptOffset, |
493 const CPVT_WordRange* pRange, | 438 const CPVT_WordRange* pRange, |
494 CFX_SystemHandler* pSystemHandler, | 439 CFX_SystemHandler* pSystemHandler, |
495 void* pFFLData); | 440 void* pFFLData); |
496 static void DrawUnderline(CFX_RenderDevice* pDevice, | |
497 CFX_Matrix* pUser2Device, | |
498 IFX_Edit* pEdit, | |
499 FX_COLORREF color, | |
500 const CFX_FloatRect& rcClip, | |
501 const CFX_FloatPoint& ptOffset, | |
502 const CPVT_WordRange* pRange); | |
503 static void DrawRichEdit(CFX_RenderDevice* pDevice, | |
504 CFX_Matrix* pUser2Device, | |
505 IFX_Edit* pEdit, | |
506 const CFX_FloatRect& rcClip, | |
507 const CFX_FloatPoint& ptOffset, | |
508 const CPVT_WordRange* pRange); | |
509 static void GeneratePageObjects( | 441 static void GeneratePageObjects( |
510 CPDF_PageObjectHolder* pObjectHolder, | 442 CPDF_PageObjectHolder* pObjectHolder, |
511 IFX_Edit* pEdit, | 443 IFX_Edit* pEdit, |
512 const CFX_FloatPoint& ptOffset, | 444 const CFX_FloatPoint& ptOffset, |
513 const CPVT_WordRange* pRange, | 445 const CPVT_WordRange* pRange, |
514 FX_COLORREF crText, | 446 FX_COLORREF crText, |
515 CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray); | 447 CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray); |
516 static void GenerateRichPageObjects( | |
517 CPDF_PageObjectHolder* pObjectHolder, | |
518 IFX_Edit* pEdit, | |
519 const CFX_FloatPoint& ptOffset, | |
520 const CPVT_WordRange* pRange, | |
521 CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray); | |
522 static void GenerateUnderlineObjects(CPDF_PageObjectHolder* pObjectHolder, | |
523 IFX_Edit* pEdit, | |
524 const CFX_FloatPoint& ptOffset, | |
525 const CPVT_WordRange* pRange, | |
526 FX_COLORREF color); | |
527 | 448 |
528 protected: | 449 protected: |
529 virtual ~IFX_Edit() {} | 450 virtual ~IFX_Edit() {} |
530 }; | 451 }; |
531 | 452 |
532 class IFX_List_Notify { | 453 class IFX_List_Notify { |
533 public: | 454 public: |
534 // set the horizontal scrollbar information. | 455 // set the horizontal scrollbar information. |
535 virtual void IOnSetScrollInfoX(FX_FLOAT fPlateMin, | 456 virtual void IOnSetScrollInfoX(FX_FLOAT fPlateMin, |
536 FX_FLOAT fPlateMax, | 457 FX_FLOAT fPlateMax, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 protected: | 537 protected: |
617 virtual ~IFX_List() {} | 538 virtual ~IFX_List() {} |
618 }; | 539 }; |
619 | 540 |
620 CFX_ByteString GetPDFWordString(IPVT_FontMap* pFontMap, | 541 CFX_ByteString GetPDFWordString(IPVT_FontMap* pFontMap, |
621 int32_t nFontIndex, | 542 int32_t nFontIndex, |
622 uint16_t Word, | 543 uint16_t Word, |
623 uint16_t SubWord); | 544 uint16_t SubWord); |
624 | 545 |
625 #endif // FPDFSDK_FXEDIT_INCLUDE_FX_EDIT_H_ | 546 #endif // FPDFSDK_FXEDIT_INCLUDE_FX_EDIT_H_ |
OLD | NEW |