merge to XFA: Fix -Wnon-virtual-dtor compiler warnings.
[pdfium.git] / core / include / fpdfdoc / fpdf_ap.h
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4  
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #ifndef _FPDF_AP_H_
8 #define _FPDF_AP_H_
9
10 #include "../fxcrt/fx_basic.h"
11 #include "../fpdfapi/fpdf_parser.h"
12 #include "fpdf_vt.h"
13 class IPVT_FontMap
14 {
15 public:
16     virtual ~IPVT_FontMap() { }
17     virtual CPDF_Font*                                          GetPDFFont(FX_INT32 nFontIndex) = 0;
18     virtual CFX_ByteString                                      GetPDFFontAlias(FX_INT32 nFontIndex) = 0;
19 };
20 struct CPVT_Dash {
21
22     CPVT_Dash(FX_INT32 dash, FX_INT32 gap, FX_INT32 phase) : nDash(dash), nGap(gap), nPhase(phase)
23     {}
24
25     FX_INT32                    nDash;
26
27     FX_INT32                    nGap;
28
29     FX_INT32                    nPhase;
30 };
31 #define CT_TRANSPARENT          0
32 #define CT_GRAY                         1
33 #define CT_RGB                          2
34 #define CT_CMYK                         3
35 struct CPVT_Color {
36
37     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         : nColorType(type), fColor1(color1), fColor2(color2), fColor3(color3), fColor4(color4)
39     {}
40
41     FX_INT32                    nColorType;
42     FX_FLOAT                    fColor1;
43     FX_FLOAT                    fColor2;
44     FX_FLOAT                    fColor3;
45     FX_FLOAT                    fColor4;
46 };
47 class CPVT_Provider : public IPDF_VariableText_Provider
48 {
49 public:
50
51     CPVT_Provider(IPVT_FontMap * pFontMap);
52
53     virtual ~CPVT_Provider();
54
55     FX_INT32                                            GetCharWidth(FX_INT32 nFontIndex, FX_WORD word, FX_INT32 nWordStyle);
56
57     FX_INT32                                            GetTypeAscent(FX_INT32 nFontIndex);
58
59     FX_INT32                                            GetTypeDescent(FX_INT32 nFontIndex);
60
61     FX_INT32                                            GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex);
62
63     FX_BOOL                                                     IsLatinWord(FX_WORD word);
64
65     FX_INT32                                            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                                                      GenerateTextFieldAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict);
80
81     static FX_BOOL                                                      GenerateComboBoxAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict);
82
83     static FX_BOOL                                                      GenerateListBoxAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict);
84
85     static CFX_ByteString                                       GenerateEditAP(IPVT_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_Color & crRightBottom,
90             FX_INT32 nStyle, const CPVT_Dash & dash);
91
92     static CFX_ByteString                                       GenerateColorAP(const CPVT_Color & color, const FX_BOOL & bFillOrStroke);
93 };
94
95 #endif  // _FPDF_AP_H_