| OLD | NEW |
| (Empty) |
| 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 CORE_INCLUDE_FPDFDOC_FPDF_AP_H_ | |
| 8 #define CORE_INCLUDE_FPDFDOC_FPDF_AP_H_ | |
| 9 | |
| 10 #include "core/include/fpdfdoc/fpdf_vt.h" | |
| 11 | |
| 12 class IPVT_FontMap { | |
| 13 public: | |
| 14 virtual ~IPVT_FontMap() {} | |
| 15 virtual CPDF_Font* GetPDFFont(int32_t nFontIndex) = 0; | |
| 16 virtual CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) = 0; | |
| 17 }; | |
| 18 | |
| 19 struct CPVT_Dash { | |
| 20 CPVT_Dash(int32_t dash, int32_t gap, int32_t phase) | |
| 21 : nDash(dash), nGap(gap), nPhase(phase) {} | |
| 22 | |
| 23 int32_t nDash; | |
| 24 int32_t nGap; | |
| 25 int32_t nPhase; | |
| 26 }; | |
| 27 | |
| 28 struct CPVT_Color { | |
| 29 enum Type { kTransparent = 0, kGray, kRGB, kCMYK }; | |
| 30 | |
| 31 CPVT_Color(Type type = kTransparent, | |
| 32 FX_FLOAT color1 = 0.0f, | |
| 33 FX_FLOAT color2 = 0.0f, | |
| 34 FX_FLOAT color3 = 0.0f, | |
| 35 FX_FLOAT color4 = 0.0f) | |
| 36 : nColorType(type), | |
| 37 fColor1(color1), | |
| 38 fColor2(color2), | |
| 39 fColor3(color3), | |
| 40 fColor4(color4) {} | |
| 41 | |
| 42 Type nColorType; | |
| 43 FX_FLOAT fColor1; | |
| 44 FX_FLOAT fColor2; | |
| 45 FX_FLOAT fColor3; | |
| 46 FX_FLOAT fColor4; | |
| 47 }; | |
| 48 | |
| 49 class CPVT_Provider : public IPDF_VariableText_Provider { | |
| 50 public: | |
| 51 CPVT_Provider(IPVT_FontMap* pFontMap); | |
| 52 ~CPVT_Provider() override; | |
| 53 | |
| 54 // IPDF_VariableText_Provider | |
| 55 int32_t GetCharWidth(int32_t nFontIndex, | |
| 56 uint16_t word, | |
| 57 int32_t nWordStyle) override; | |
| 58 int32_t GetTypeAscent(int32_t nFontIndex) override; | |
| 59 int32_t GetTypeDescent(int32_t nFontIndex) override; | |
| 60 int32_t GetWordFontIndex(uint16_t word, | |
| 61 int32_t charset, | |
| 62 int32_t nFontIndex) override; | |
| 63 FX_BOOL IsLatinWord(uint16_t word) override; | |
| 64 int32_t GetDefaultFontIndex() override; | |
| 65 | |
| 66 private: | |
| 67 IPVT_FontMap* m_pFontMap; | |
| 68 }; | |
| 69 | |
| 70 class CPVT_GenerateAP { | |
| 71 public: | |
| 72 static FX_BOOL GenerateTextFieldAP(CPDF_Document* pDoc, | |
| 73 CPDF_Dictionary* pAnnotDict); | |
| 74 | |
| 75 static FX_BOOL GenerateComboBoxAP(CPDF_Document* pDoc, | |
| 76 CPDF_Dictionary* pAnnotDict); | |
| 77 | |
| 78 static FX_BOOL GenerateListBoxAP(CPDF_Document* pDoc, | |
| 79 CPDF_Dictionary* pAnnotDict); | |
| 80 | |
| 81 static CFX_ByteString GenerateEditAP(IPVT_FontMap* pFontMap, | |
| 82 IPDF_VariableText_Iterator* pIterator, | |
| 83 const CFX_FloatPoint& ptOffset, | |
| 84 FX_BOOL bContinuous, | |
| 85 uint16_t SubWord = 0, | |
| 86 const CPVT_WordRange* pVisible = NULL); | |
| 87 | |
| 88 static CFX_ByteString GenerateBorderAP(const CFX_FloatRect& rect, | |
| 89 FX_FLOAT fWidth, | |
| 90 const CPVT_Color& color, | |
| 91 const CPVT_Color& crLeftTop, | |
| 92 const CPVT_Color& crRightBottom, | |
| 93 int32_t nStyle, | |
| 94 const CPVT_Dash& dash); | |
| 95 | |
| 96 static CFX_ByteString GenerateColorAP(const CPVT_Color& color, | |
| 97 const FX_BOOL& bFillOrStroke); | |
| 98 }; | |
| 99 | |
| 100 #endif // CORE_INCLUDE_FPDFDOC_FPDF_AP_H_ | |
| OLD | NEW |