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