Home | History | Annotate | Download | only in fpdfsdk
      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 FPDFSDK_CPDFSDK_BAANNOT_H_
      8 #define FPDFSDK_CPDFSDK_BAANNOT_H_
      9 
     10 #include "core/fpdfdoc/cpdf_aaction.h"
     11 #include "core/fpdfdoc/cpdf_action.h"
     12 #include "core/fpdfdoc/cpdf_annot.h"
     13 #include "core/fpdfdoc/cpdf_defaultappearance.h"
     14 #include "core/fxcrt/fx_coordinates.h"
     15 #include "core/fxcrt/fx_string.h"
     16 #include "fpdfsdk/cfx_systemhandler.h"
     17 #include "fpdfsdk/cpdfsdk_annot.h"
     18 
     19 class CFX_Matrix;
     20 class CFX_RenderDevice;
     21 class CPDF_Dictionary;
     22 class CPDF_RenderOptions;
     23 class CPDFSDK_PageView;
     24 
     25 class CPDFSDK_BAAnnot : public CPDFSDK_Annot {
     26  public:
     27   CPDFSDK_BAAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView);
     28   ~CPDFSDK_BAAnnot() override;
     29 
     30   // CPDFSDK_Annot
     31   CPDF_Annot::Subtype GetAnnotSubtype() const override;
     32   void SetRect(const CFX_FloatRect& rect) override;
     33   CFX_FloatRect GetRect() const override;
     34   CPDF_Annot* GetPDFAnnot() const override;
     35   void Annot_OnDraw(CFX_RenderDevice* pDevice,
     36                     CFX_Matrix* pUser2Device,
     37                     CPDF_RenderOptions* pOptions) override;
     38 
     39   CPDF_Dictionary* GetAnnotDict() const;
     40   CPDF_Annot* GetPDFPopupAnnot() const;
     41 
     42   void SetContents(const CFX_WideString& sContents);
     43   CFX_WideString GetContents() const;
     44 
     45   void SetAnnotName(const CFX_WideString& sName);
     46   CFX_WideString GetAnnotName() const;
     47 
     48   void SetModifiedDate(const FX_SYSTEMTIME& st);
     49   FX_SYSTEMTIME GetModifiedDate() const;
     50 
     51   void SetFlags(uint32_t nFlags);
     52   uint32_t GetFlags() const;
     53 
     54   void SetAppState(const CFX_ByteString& str);
     55   CFX_ByteString GetAppState() const;
     56 
     57   void SetStructParent(int key);
     58   int GetStructParent() const;
     59 
     60   void SetBorderWidth(int nWidth);
     61   int GetBorderWidth() const;
     62 
     63   void SetBorderStyle(BorderStyle nStyle);
     64   BorderStyle GetBorderStyle() const;
     65 
     66   void SetColor(FX_COLORREF color);
     67   void RemoveColor();
     68   bool GetColor(FX_COLORREF& color) const;
     69 
     70   bool IsVisible() const;
     71 
     72   CPDF_Action GetAction() const;
     73   void SetAction(const CPDF_Action& a);
     74   void RemoveAction();
     75 
     76   CPDF_AAction GetAAction() const;
     77   void SetAAction(const CPDF_AAction& aa);
     78   void RemoveAAction();
     79 
     80   virtual CPDF_Action GetAAction(CPDF_AAction::AActionType eAAT);
     81   virtual bool IsAppearanceValid();
     82   virtual bool IsAppearanceValid(CPDF_Annot::AppearanceMode mode);
     83   virtual void DrawAppearance(CFX_RenderDevice* pDevice,
     84                               const CFX_Matrix* pUser2Device,
     85                               CPDF_Annot::AppearanceMode mode,
     86                               const CPDF_RenderOptions* pOptions);
     87 
     88   void DrawBorder(CFX_RenderDevice* pDevice,
     89                   const CFX_Matrix* pUser2Device,
     90                   const CPDF_RenderOptions* pOptions);
     91 
     92   void ClearCachedAP();
     93 
     94   void WriteAppearance(const CFX_ByteString& sAPType,
     95                        const CFX_FloatRect& rcBBox,
     96                        const CFX_Matrix& matrix,
     97                        const CFX_ByteString& sContents,
     98                        const CFX_ByteString& sAPState = "");
     99 
    100   void SetOpenState(bool bState);
    101 
    102  protected:
    103   CPDF_Annot* const m_pAnnot;
    104 };
    105 
    106 #endif  // FPDFSDK_CPDFSDK_BAANNOT_H_
    107