Home | History | Annotate | Download | only in fpdfdoc
      1 // Copyright 2016 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_FPDFDOC_CPVT_GENERATEAP_H_
      8 #define CORE_FPDFDOC_CPVT_GENERATEAP_H_
      9 
     10 #include "core/fpdfdoc/cpdf_defaultappearance.h"
     11 #include "core/fpdfdoc/cpdf_variabletext.h"
     12 #include "core/fpdfdoc/cpvt_color.h"
     13 #include "core/fpdfdoc/cpvt_dash.h"
     14 #include "core/fxcrt/fx_coordinates.h"
     15 #include "core/fxcrt/fx_string.h"
     16 #include "core/fxcrt/fx_system.h"
     17 
     18 class CPDF_Dictionary;
     19 class CPDF_Document;
     20 class IPVT_FontMap;
     21 
     22 struct CPVT_WordRange;
     23 
     24 bool FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict);
     25 
     26 class CPVT_GenerateAP {
     27  public:
     28   static bool GenerateCircleAP(CPDF_Document* pDoc,
     29                                CPDF_Dictionary* pAnnotDict);
     30   static bool GenerateComboBoxAP(CPDF_Document* pDoc,
     31                                  CPDF_Dictionary* pAnnotDict);
     32   static bool GenerateHighlightAP(CPDF_Document* pDoc,
     33                                   CPDF_Dictionary* pAnnotDict);
     34   static bool GenerateInkAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict);
     35   static bool GenerateListBoxAP(CPDF_Document* pDoc,
     36                                 CPDF_Dictionary* pAnnotDict);
     37   static bool GeneratePopupAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict);
     38   static bool GenerateSquareAP(CPDF_Document* pDoc,
     39                                CPDF_Dictionary* pAnnotDict);
     40   static bool GenerateSquigglyAP(CPDF_Document* pDoc,
     41                                  CPDF_Dictionary* pAnnotDict);
     42   static bool GenerateStrikeOutAP(CPDF_Document* pDoc,
     43                                   CPDF_Dictionary* pAnnotDict);
     44   static bool GenerateTextAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict);
     45   static bool GenerateTextFieldAP(CPDF_Document* pDoc,
     46                                   CPDF_Dictionary* pAnnotDict);
     47   static bool GenerateUnderlineAP(CPDF_Document* pDoc,
     48                                   CPDF_Dictionary* pAnnotDict);
     49   static CFX_ByteString GenerateEditAP(IPVT_FontMap* pFontMap,
     50                                        CPDF_VariableText::Iterator* pIterator,
     51                                        const CFX_PointF& ptOffset,
     52                                        bool bContinuous,
     53                                        uint16_t SubWord);
     54   static CFX_ByteString GenerateBorderAP(const CFX_FloatRect& rect,
     55                                          FX_FLOAT fWidth,
     56                                          const CPVT_Color& color,
     57                                          const CPVT_Color& crLeftTop,
     58                                          const CPVT_Color& crRightBottom,
     59                                          BorderStyle nStyle,
     60                                          const CPVT_Dash& dash);
     61   static CFX_ByteString GenerateColorAP(const CPVT_Color& color,
     62                                         PaintOperation nOperation);
     63 
     64   static CFX_ByteString GetPDFWordString(IPVT_FontMap* pFontMap,
     65                                          int32_t nFontIndex,
     66                                          uint16_t Word,
     67                                          uint16_t SubWord);
     68   static CFX_ByteString GetWordRenderString(const CFX_ByteString& strWords);
     69   static CFX_ByteString GetFontSetString(IPVT_FontMap* pFontMap,
     70                                          int32_t nFontIndex,
     71                                          FX_FLOAT fFontSize);
     72 };
     73 
     74 #endif  // CORE_FPDFDOC_CPVT_GENERATEAP_H_
     75