| 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 #define _FPDF_AP_H_ | 7 #define _FPDF_AP_H_ |
| 8 #include "../fxcrt/fx_basic.h" | 8 #include "../fxcrt/fx_basic.h" |
| 9 #include "../fpdfapi/fpdf_parser.h" | 9 #include "../fpdfapi/fpdf_parser.h" |
| 10 #include "fpdf_vt.h" | 10 #include "fpdf_vt.h" |
| 11 class IPVT_FontMap | 11 class IPVT_FontMap { |
| 12 { | 12 public: |
| 13 public: | 13 virtual CPDF_Font* GetPDFFont(FX_INT32 nFontIndex) = 0; |
| 14 | 14 |
| 15 virtual CPDF_Font*» » » » » » GetPDFFont(FX_IN
T32 nFontIndex) = 0; | 15 virtual CFX_ByteString GetPDFFontAlias(FX_INT32 nFontIndex) = 0; |
| 16 | |
| 17 virtual CFX_ByteString» » » » » GetPDFFontAlias(
FX_INT32 nFontIndex) = 0; | |
| 18 }; | 16 }; |
| 19 struct CPVT_Dash { | 17 struct CPVT_Dash { |
| 18 CPVT_Dash(FX_INT32 dash, FX_INT32 gap, FX_INT32 phase) |
| 19 : nDash(dash), nGap(gap), nPhase(phase) {} |
| 20 | 20 |
| 21 CPVT_Dash(FX_INT32 dash, FX_INT32 gap, FX_INT32 phase) : nDash(dash), nGap(g
ap), nPhase(phase) | 21 FX_INT32 nDash; |
| 22 {} | |
| 23 | 22 |
| 24 FX_INT32» » » nDash; | 23 FX_INT32 nGap; |
| 25 | 24 |
| 26 FX_INT32» » » nGap; | 25 FX_INT32 nPhase; |
| 26 }; |
| 27 #define CT_TRANSPARENT 0 |
| 28 #define CT_GRAY 1 |
| 29 #define CT_RGB 2 |
| 30 #define CT_CMYK 3 |
| 31 struct CPVT_Color { |
| 32 CPVT_Color(FX_INT32 type = 0, |
| 33 FX_FLOAT color1 = 0.0f, |
| 34 FX_FLOAT color2 = 0.0f, |
| 35 FX_FLOAT color3 = 0.0f, |
| 36 FX_FLOAT color4 = 0.0f) |
| 37 : nColorType(type), |
| 38 fColor1(color1), |
| 39 fColor2(color2), |
| 40 fColor3(color3), |
| 41 fColor4(color4) {} |
| 27 | 42 |
| 28 FX_INT32» » » nPhase; | 43 FX_INT32 nColorType; |
| 44 FX_FLOAT fColor1; |
| 45 FX_FLOAT fColor2; |
| 46 FX_FLOAT fColor3; |
| 47 FX_FLOAT fColor4; |
| 29 }; | 48 }; |
| 30 #define CT_TRANSPARENT» » 0 | 49 class CPVT_Provider : public IPDF_VariableText_Provider { |
| 31 #define»CT_GRAY»» » » 1 | 50 public: |
| 32 #define»CT_RGB» » » » 2 | 51 CPVT_Provider(IPVT_FontMap* pFontMap); |
| 33 #define»CT_CMYK»» » » 3 | |
| 34 struct CPVT_Color { | |
| 35 | 52 |
| 36 CPVT_Color(FX_INT32 type = 0, FX_FLOAT color1 = 0.0f, FX_FLOAT color2 = 0.0f
, FX_FLOAT color3 = 0.0f, FX_FLOAT color4 = 0.0f) | 53 virtual ~CPVT_Provider(); |
| 37 : nColorType(type), fColor1(color1), fColor2(color2), fColor3(color3), f
Color4(color4) | |
| 38 {} | |
| 39 | 54 |
| 40 FX_INT32» » » nColorType; | 55 FX_INT32 GetCharWidth(FX_INT32 nFontIndex, FX_WORD word, FX_INT32 nWordStyle); |
| 41 FX_FLOAT» » » fColor1; | 56 |
| 42 FX_FLOAT» » » fColor2; | 57 FX_INT32 GetTypeAscent(FX_INT32 nFontIndex); |
| 43 FX_FLOAT» » » fColor3; | 58 |
| 44 FX_FLOAT» » » fColor4; | 59 FX_INT32 GetTypeDescent(FX_INT32 nFontIndex); |
| 60 |
| 61 FX_INT32 GetWordFontIndex(FX_WORD word, |
| 62 FX_INT32 charset, |
| 63 FX_INT32 nFontIndex); |
| 64 |
| 65 FX_BOOL IsLatinWord(FX_WORD word); |
| 66 |
| 67 FX_INT32 GetDefaultFontIndex(); |
| 68 |
| 69 private: |
| 70 IPVT_FontMap* m_pFontMap; |
| 45 }; | 71 }; |
| 46 class CPVT_Provider : public IPDF_VariableText_Provider | 72 #define PBS_SOLID 0 |
| 47 { | 73 #define PBS_DASH 1 |
| 48 public: | 74 #define PBS_BEVELED 2 |
| 75 #define PBS_INSET 3 |
| 76 #define PBS_UNDERLINED 4 |
| 77 class CPVT_GenerateAP { |
| 78 public: |
| 79 static FX_BOOL GenerateTextFieldAP(CPDF_Document* pDoc, |
| 80 CPDF_Dictionary* pAnnotDict); |
| 49 | 81 |
| 50 CPVT_Provider(IPVT_FontMap * pFontMap); | 82 static FX_BOOL GenerateComboBoxAP(CPDF_Document* pDoc, |
| 83 CPDF_Dictionary* pAnnotDict); |
| 51 | 84 |
| 52 virtual ~CPVT_Provider(); | 85 static FX_BOOL GenerateListBoxAP(CPDF_Document* pDoc, |
| 86 CPDF_Dictionary* pAnnotDict); |
| 53 | 87 |
| 54 FX_INT32» » » » » » GetCharWidth(FX_INT32 nF
ontIndex, FX_WORD word, FX_INT32 nWordStyle); | 88 static CFX_ByteString GenerateEditAP(IPVT_FontMap* pFontMap, |
| 89 IPDF_VariableText_Iterator* pIterator, |
| 90 const CPDF_Point& ptOffset, |
| 91 FX_BOOL bContinuous, |
| 92 FX_WORD SubWord = 0, |
| 93 const CPVT_WordRange* pVisible = NULL); |
| 55 | 94 |
| 56 FX_INT32» » » » » » GetTypeAscent(FX_INT32 n
FontIndex); | 95 static CFX_ByteString GenerateBorderAP(const CPDF_Rect& rect, |
| 96 FX_FLOAT fWidth, |
| 97 const CPVT_Color& color, |
| 98 const CPVT_Color& crLeftTop, |
| 99 const CPVT_Color& crRightBottom, |
| 100 FX_INT32 nStyle, |
| 101 const CPVT_Dash& dash); |
| 57 | 102 |
| 58 FX_INT32» » » » » » GetTypeDescent(FX_INT32
nFontIndex); | 103 static CFX_ByteString GenerateColorAP(const CPVT_Color& color, |
| 59 | 104 const FX_BOOL& bFillOrStroke); |
| 60 FX_INT32» » » » » » GetWordFontIndex(FX_WORD
word, FX_INT32 charset, FX_INT32 nFontIndex); | |
| 61 | |
| 62 FX_BOOL» » » » » » » IsLatinWord(FX_W
ORD word); | |
| 63 | |
| 64 FX_INT32» » » » » » GetDefaultFontIndex(); | |
| 65 private: | |
| 66 | |
| 67 IPVT_FontMap *» m_pFontMap; | |
| 68 }; | 105 }; |
| 69 #define PBS_SOLID 0 | |
| 70 #define PBS_DASH 1 | |
| 71 #define PBS_BEVELED 2 | |
| 72 #define PBS_INSET 3 | |
| 73 #define PBS_UNDERLINED 4 | |
| 74 class CPVT_GenerateAP | |
| 75 { | |
| 76 public: | |
| 77 | |
| 78 static FX_BOOL Generate
TextFieldAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict); | |
| 79 | |
| 80 static FX_BOOL Generate
ComboBoxAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict); | |
| 81 | |
| 82 static FX_BOOL Generate
ListBoxAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict); | |
| 83 | |
| 84 static CFX_ByteString GenerateEditAP(I
PVT_FontMap * pFontMap, IPDF_VariableText_Iterator * pIterator, | |
| 85 const CPDF_Point & ptOffset, FX_BOOL bContinuous, FX_WORD SubWord =
0, const CPVT_WordRange * pVisible = NULL); | |
| 86 | |
| 87 static CFX_ByteString GenerateBorderAP
(const CPDF_Rect & rect, FX_FLOAT fWidth, | |
| 88 const CPVT_Color & color, const CPVT_Color & crLeftTop, const CPVT_C
olor & crRightBottom, | |
| 89 FX_INT32 nStyle, const CPVT_Dash & dash); | |
| 90 | |
| 91 static CFX_ByteString GenerateColorAP(
const CPVT_Color & color, const FX_BOOL & bFillOrStroke); | |
| 92 }; | |
| OLD | NEW |