Chromium Code Reviews| 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_INCLUDE_FXEDIT_FX_EDIT_H_ | 7 #ifndef FPDFSDK_INCLUDE_FXEDIT_FX_EDIT_H_ |
| 8 #define FPDFSDK_INCLUDE_FXEDIT_FX_EDIT_H_ | 8 #define FPDFSDK_INCLUDE_FXEDIT_FX_EDIT_H_ |
| 9 | 9 |
| 10 #include "core/fpdfdoc/include/cpdf_variabletext.h" | |
| 10 #include "core/fxcrt/include/fx_basic.h" | 11 #include "core/fxcrt/include/fx_basic.h" |
| 11 #include "core/include/fpdfdoc/fpdf_vt.h" | |
| 12 #include "core/include/fxge/fx_dib.h" | 12 #include "core/include/fxge/fx_dib.h" |
| 13 | 13 |
| 14 class CPDF_Font; | |
| 15 class CPDF_PageObjectHolder; | |
| 16 class CPDF_TextObject; | |
| 17 class CFX_FloatPoint; | |
| 18 class CFX_Matrix; | |
| 14 class CFX_RenderDevice; | 19 class CFX_RenderDevice; |
| 15 class CPDF_Font; | |
| 16 class CFX_Matrix; | |
| 17 class CPDF_PageObjectHolder; | |
| 18 class CFX_FloatPoint; | |
| 19 class CPDF_TextObject; | |
| 20 class IFX_Edit; | 20 class IFX_Edit; |
| 21 class IFX_Edit_FontMap; | 21 class IPVT_FontMap; |
| 22 class IFX_Edit_Iterator; | 22 class IFX_Edit_Iterator; |
| 23 class IFX_Edit_Notify; | 23 class IFX_Edit_Notify; |
| 24 class IFX_Edit_UndoItem; | 24 class IFX_Edit_UndoItem; |
| 25 class IFX_List; | 25 class IFX_List; |
| 26 class IFX_List_Notify; | 26 class IFX_List_Notify; |
| 27 class IFX_SystemHandler; | 27 class IFX_SystemHandler; |
| 28 | 28 |
| 29 struct CPVT_Line; | 29 struct CPVT_Line; |
| 30 struct CPVT_SecProps; | 30 struct CPVT_SecProps; |
| 31 struct CPVT_Section; | 31 struct CPVT_Section; |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 44 #define PVTWORD_STYLE_ITALIC 0x0040L | 44 #define PVTWORD_STYLE_ITALIC 0x0040L |
| 45 | 45 |
| 46 #define FX_EDIT_ISLATINWORD(u) \ | 46 #define FX_EDIT_ISLATINWORD(u) \ |
| 47 (u == 0x2D || (u <= 0x005A && u >= 0x0041) || \ | 47 (u == 0x2D || (u <= 0x005A && u >= 0x0041) || \ |
| 48 (u <= 0x007A && u >= 0x0061) || (u <= 0x02AF && u >= 0x00C0)) | 48 (u <= 0x007A && u >= 0x0061) || (u <= 0x02AF && u >= 0x00C0)) |
| 49 | 49 |
| 50 #ifndef DEFAULT_CHARSET | 50 #ifndef DEFAULT_CHARSET |
| 51 #define DEFAULT_CHARSET 1 | 51 #define DEFAULT_CHARSET 1 |
| 52 #endif | 52 #endif |
| 53 | 53 |
| 54 class IFX_Edit_FontMap { | |
| 55 public: | |
| 56 virtual ~IFX_Edit_FontMap() {} | |
| 57 // map a fontindex to pdf font. | |
| 58 virtual CPDF_Font* GetPDFFont(int32_t nFontIndex) = 0; | |
| 59 // get the alias of a pdf font. | |
| 60 virtual CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) = 0; | |
| 61 // get the index of a font that can show a word. | |
| 62 virtual int32_t GetWordFontIndex(uint16_t word, | |
| 63 int32_t charset, | |
| 64 int32_t nFontIndex) = 0; | |
| 65 // get the charcode of word from unicode | |
| 66 virtual int32_t CharCodeFromUnicode(int32_t nFontIndex, uint16_t word) = 0; | |
| 67 // get the charset of unicode | |
| 68 virtual int32_t CharSetFromUnicode(uint16_t word, int32_t nOldCharset) = 0; | |
| 69 }; | |
| 70 | |
| 71 class IFX_Edit_Notify { | 54 class IFX_Edit_Notify { |
| 72 public: | 55 public: |
| 73 virtual ~IFX_Edit_Notify() {} | 56 virtual ~IFX_Edit_Notify() {} |
| 74 // set the horizontal scrollbar information. | 57 // set the horizontal scrollbar information. |
| 75 virtual void IOnSetScrollInfoX(FX_FLOAT fPlateMin, | 58 virtual void IOnSetScrollInfoX(FX_FLOAT fPlateMin, |
| 76 FX_FLOAT fPlateMax, | 59 FX_FLOAT fPlateMax, |
| 77 FX_FLOAT fContentMin, | 60 FX_FLOAT fContentMin, |
| 78 FX_FLOAT fContentMax, | 61 FX_FLOAT fContentMax, |
| 79 FX_FLOAT fSmallStep, | 62 FX_FLOAT fSmallStep, |
| 80 FX_FLOAT fBigStep) = 0; | 63 FX_FLOAT fBigStep) = 0; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 virtual void Undo() = 0; | 159 virtual void Undo() = 0; |
| 177 virtual void Redo() = 0; | 160 virtual void Redo() = 0; |
| 178 virtual CFX_WideString GetUndoTitle() = 0; | 161 virtual CFX_WideString GetUndoTitle() = 0; |
| 179 }; | 162 }; |
| 180 | 163 |
| 181 class IFX_Edit { | 164 class IFX_Edit { |
| 182 public: | 165 public: |
| 183 static IFX_Edit* NewEdit(); | 166 static IFX_Edit* NewEdit(); |
| 184 static void DelEdit(IFX_Edit* pEdit); | 167 static void DelEdit(IFX_Edit* pEdit); |
| 185 | 168 |
| 186 // set a IFX_Edit_FontMap pointer implemented by user. | 169 // set a IPVT_FontMap pointer implemented by user. |
|
Tom Sepez
2016/04/05 16:58:23
nit: blank line before each new // comment here, a
dsinclair
2016/04/05 17:29:20
Done.
| |
| 187 virtual void SetFontMap(IFX_Edit_FontMap* pFontMap) = 0; | 170 virtual void SetFontMap(IPVT_FontMap* pFontMap) = 0; |
| 188 // if user don't like to use FontMap, implement VTProvider and set it | 171 // if user don't like to use FontMap, implement VTProvider and set it |
| 189 // directly. | 172 // directly. |
| 190 virtual void SetVTProvider(IPDF_VariableText::Provider* pProvider) = 0; | 173 virtual void SetVTProvider(CPDF_VariableText::Provider* pProvider) = 0; |
| 191 // set a IFX_Edit_Notify pointer implemented by user. | 174 // set a IFX_Edit_Notify pointer implemented by user. |
| 192 virtual void SetNotify(IFX_Edit_Notify* pNotify) = 0; | 175 virtual void SetNotify(IFX_Edit_Notify* pNotify) = 0; |
| 193 virtual void SetOprNotify(IFX_Edit_OprNotify* pOprNotify) = 0; | 176 virtual void SetOprNotify(IFX_Edit_OprNotify* pOprNotify) = 0; |
| 194 // get a pointer allocated by CPDF_Edit, by this pointer, user can iterate the | 177 // get a pointer allocated by CPDF_Edit, by this pointer, user can iterate the |
| 195 // contents of edit, but don't need to release. | 178 // contents of edit, but don't need to release. |
| 196 virtual IFX_Edit_Iterator* GetIterator() = 0; | 179 virtual IFX_Edit_Iterator* GetIterator() = 0; |
| 197 // get a VT pointer relative to this edit. | 180 // get a VT pointer relative to this edit. |
| 198 virtual IPDF_VariableText* GetVariableText() = 0; | 181 virtual CPDF_VariableText* GetVariableText() = 0; |
| 199 // get the IFX_Edit_FontMap pointer set by user. | 182 // get the IPVT_FontMap pointer set by user. |
| 200 virtual IFX_Edit_FontMap* GetFontMap() = 0; | 183 virtual IPVT_FontMap* GetFontMap() = 0; |
| 201 | 184 |
| 202 // initialize the edit. | 185 // initialize the edit. |
| 203 virtual void Initialize() = 0; | 186 virtual void Initialize() = 0; |
| 204 | 187 |
| 205 // set the bounding box of the text area. | 188 // set the bounding box of the text area. |
| 206 virtual void SetPlateRect(const CFX_FloatRect& rect, | 189 virtual void SetPlateRect(const CFX_FloatRect& rect, |
| 207 FX_BOOL bPaint = TRUE) = 0; | 190 FX_BOOL bPaint = TRUE) = 0; |
| 208 // set the scroll origin | 191 // set the scroll origin |
| 209 virtual void SetScrollPos(const CFX_FloatPoint& point) = 0; | 192 virtual void SetScrollPos(const CFX_FloatPoint& point) = 0; |
| 210 | 193 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 virtual void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE) = 0; | 233 virtual void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE) = 0; |
| 251 // set the fontsize of selected text. | 234 // set the fontsize of selected text. |
| 252 virtual FX_BOOL SetRichFontSize(FX_FLOAT fFontSize) = 0; | 235 virtual FX_BOOL SetRichFontSize(FX_FLOAT fFontSize) = 0; |
| 253 // set the fontindex of selected text, user can change the font of selected | 236 // set the fontindex of selected text, user can change the font of selected |
| 254 // text. | 237 // text. |
| 255 virtual FX_BOOL SetRichFontIndex(int32_t nFontIndex) = 0; | 238 virtual FX_BOOL SetRichFontIndex(int32_t nFontIndex) = 0; |
| 256 // set the textcolor of selected text. | 239 // set the textcolor of selected text. |
| 257 virtual FX_BOOL SetRichTextColor(FX_COLORREF dwColor) = 0; | 240 virtual FX_BOOL SetRichTextColor(FX_COLORREF dwColor) = 0; |
| 258 // set the text script type of selected text. (0:normal 1:superscript | 241 // set the text script type of selected text. (0:normal 1:superscript |
| 259 // 2:subscript) | 242 // 2:subscript) |
| 260 virtual FX_BOOL SetRichTextScript(int32_t nScriptType) = 0; | 243 virtual FX_BOOL SetRichTextScript( |
| 244 CPDF_VariableText::ScriptType nScriptType) = 0; | |
| 261 // set the bold font style of selected text. | 245 // set the bold font style of selected text. |
| 262 virtual FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE) = 0; | 246 virtual FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE) = 0; |
| 263 // set the italic font style of selected text. | 247 // set the italic font style of selected text. |
| 264 virtual FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE) = 0; | 248 virtual FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE) = 0; |
| 265 // set the underline style of selected text. | 249 // set the underline style of selected text. |
| 266 virtual FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE) = 0; | 250 virtual FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE) = 0; |
| 267 // set the crossout style of selected text. | 251 // set the crossout style of selected text. |
| 268 virtual FX_BOOL SetRichTextCrossout(FX_BOOL bCrossout = TRUE) = 0; | 252 virtual FX_BOOL SetRichTextCrossout(FX_BOOL bCrossout = TRUE) = 0; |
| 269 // set the charspace of selected text, in user coordinate. | 253 // set the charspace of selected text, in user coordinate. |
| 270 virtual FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace) = 0; | 254 virtual FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace) = 0; |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 505 | 489 |
| 506 protected: | 490 protected: |
| 507 virtual ~IFX_List_Notify() {} | 491 virtual ~IFX_List_Notify() {} |
| 508 }; | 492 }; |
| 509 | 493 |
| 510 class IFX_List { | 494 class IFX_List { |
| 511 public: | 495 public: |
| 512 static IFX_List* NewList(); | 496 static IFX_List* NewList(); |
| 513 static void DelList(IFX_List* pList); | 497 static void DelList(IFX_List* pList); |
| 514 | 498 |
| 515 virtual void SetFontMap(IFX_Edit_FontMap* pFontMap) = 0; | 499 virtual void SetFontMap(IPVT_FontMap* pFontMap) = 0; |
| 516 virtual void SetNotify(IFX_List_Notify* pNotify) = 0; | 500 virtual void SetNotify(IFX_List_Notify* pNotify) = 0; |
| 517 | 501 |
| 518 virtual void SetPlateRect(const CFX_FloatRect& rect) = 0; | 502 virtual void SetPlateRect(const CFX_FloatRect& rect) = 0; |
| 519 virtual void SetFontSize(FX_FLOAT fFontSize) = 0; | 503 virtual void SetFontSize(FX_FLOAT fFontSize) = 0; |
| 520 | 504 |
| 521 virtual CFX_FloatRect GetPlateRect() const = 0; | 505 virtual CFX_FloatRect GetPlateRect() const = 0; |
| 522 virtual CFX_FloatRect GetContentRect() const = 0; | 506 virtual CFX_FloatRect GetContentRect() const = 0; |
| 523 | 507 |
| 524 virtual FX_FLOAT GetFontSize() const = 0; | 508 virtual FX_FLOAT GetFontSize() const = 0; |
| 525 virtual IFX_Edit* GetItemEdit(int32_t nIndex) const = 0; | 509 virtual IFX_Edit* GetItemEdit(int32_t nIndex) const = 0; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 561 virtual void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | 545 virtual void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) = 0; |
| 562 virtual void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | 546 virtual void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) = 0; |
| 563 virtual void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) = 0; | 547 virtual void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) = 0; |
| 564 virtual void OnVK(int32_t nItemIndex, FX_BOOL bShift, FX_BOOL bCtrl) = 0; | 548 virtual void OnVK(int32_t nItemIndex, FX_BOOL bShift, FX_BOOL bCtrl) = 0; |
| 565 virtual FX_BOOL OnChar(uint16_t nChar, FX_BOOL bShift, FX_BOOL bCtrl) = 0; | 549 virtual FX_BOOL OnChar(uint16_t nChar, FX_BOOL bShift, FX_BOOL bCtrl) = 0; |
| 566 | 550 |
| 567 protected: | 551 protected: |
| 568 virtual ~IFX_List() {} | 552 virtual ~IFX_List() {} |
| 569 }; | 553 }; |
| 570 | 554 |
| 571 CFX_ByteString GetPDFWordString(IFX_Edit_FontMap* pFontMap, | 555 CFX_ByteString GetPDFWordString(IPVT_FontMap* pFontMap, |
| 572 int32_t nFontIndex, | 556 int32_t nFontIndex, |
| 573 uint16_t Word, | 557 uint16_t Word, |
| 574 uint16_t SubWord); | 558 uint16_t SubWord); |
| 575 | 559 |
| 576 #endif // FPDFSDK_INCLUDE_FXEDIT_FX_EDIT_H_ | 560 #endif // FPDFSDK_INCLUDE_FXEDIT_FX_EDIT_H_ |
| OLD | NEW |