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