jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 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 | |
dsinclair | 114e46a | 2016-09-29 17:18:21 -0700 | [diff] [blame] | 7 | #ifndef FPDFSDK_CPDFSDK_BAANNOT_H_ |
| 8 | #define FPDFSDK_CPDFSDK_BAANNOT_H_ |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 9 | |
dsinclair | 1727aee | 2016-09-29 13:12:56 -0700 | [diff] [blame] | 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" |
dsinclair | a52ab74 | 2016-09-29 13:59:29 -0700 | [diff] [blame] | 14 | #include "core/fxcrt/fx_coordinates.h" |
| 15 | #include "core/fxcrt/fx_string.h" |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 16 | #include "fpdfsdk/cfx_systemhandler.h" |
dsinclair | 114e46a | 2016-09-29 17:18:21 -0700 | [diff] [blame] | 17 | #include "fpdfsdk/cpdfsdk_annot.h" |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 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 |
jaepark | 956553e | 2016-08-31 06:49:27 -0700 | [diff] [blame] | 31 | CPDF_Annot::Subtype GetAnnotSubtype() const override; |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 32 | void SetRect(const CFX_FloatRect& rect) override; |
| 33 | CFX_FloatRect GetRect() const override; |
| 34 | CPDF_Annot* GetPDFAnnot() const override; |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 35 | |
| 36 | CPDF_Dictionary* GetAnnotDict() const; |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 37 | CPDF_Annot* GetPDFPopupAnnot() const; |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 38 | |
| 39 | void SetContents(const CFX_WideString& sContents); |
| 40 | CFX_WideString GetContents() const; |
| 41 | |
| 42 | void SetAnnotName(const CFX_WideString& sName); |
| 43 | CFX_WideString GetAnnotName() const; |
| 44 | |
| 45 | void SetModifiedDate(const FX_SYSTEMTIME& st); |
| 46 | FX_SYSTEMTIME GetModifiedDate() const; |
| 47 | |
| 48 | void SetFlags(uint32_t nFlags); |
| 49 | uint32_t GetFlags() const; |
| 50 | |
| 51 | void SetAppState(const CFX_ByteString& str); |
| 52 | CFX_ByteString GetAppState() const; |
| 53 | |
| 54 | void SetStructParent(int key); |
| 55 | int GetStructParent() const; |
| 56 | |
| 57 | void SetBorderWidth(int nWidth); |
| 58 | int GetBorderWidth() const; |
| 59 | |
| 60 | void SetBorderStyle(BorderStyle nStyle); |
| 61 | BorderStyle GetBorderStyle() const; |
| 62 | |
| 63 | void SetColor(FX_COLORREF color); |
| 64 | void RemoveColor(); |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 65 | bool GetColor(FX_COLORREF& color) const; |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 66 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 67 | bool IsVisible() const; |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 68 | |
| 69 | CPDF_Action GetAction() const; |
| 70 | void SetAction(const CPDF_Action& a); |
| 71 | void RemoveAction(); |
| 72 | |
| 73 | CPDF_AAction GetAAction() const; |
| 74 | void SetAAction(const CPDF_AAction& aa); |
| 75 | void RemoveAAction(); |
| 76 | |
| 77 | virtual CPDF_Action GetAAction(CPDF_AAction::AActionType eAAT); |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 78 | virtual bool IsAppearanceValid(); |
| 79 | virtual bool IsAppearanceValid(CPDF_Annot::AppearanceMode mode); |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 80 | virtual void DrawAppearance(CFX_RenderDevice* pDevice, |
| 81 | const CFX_Matrix* pUser2Device, |
| 82 | CPDF_Annot::AppearanceMode mode, |
| 83 | const CPDF_RenderOptions* pOptions); |
| 84 | |
| 85 | void DrawBorder(CFX_RenderDevice* pDevice, |
| 86 | const CFX_Matrix* pUser2Device, |
| 87 | const CPDF_RenderOptions* pOptions); |
| 88 | |
| 89 | void ClearCachedAP(); |
| 90 | |
| 91 | void WriteAppearance(const CFX_ByteString& sAPType, |
| 92 | const CFX_FloatRect& rcBBox, |
| 93 | const CFX_Matrix& matrix, |
| 94 | const CFX_ByteString& sContents, |
| 95 | const CFX_ByteString& sAPState = ""); |
| 96 | |
jaepark | 35512aa | 2016-08-29 17:15:08 -0700 | [diff] [blame] | 97 | void SetOpenState(bool bState); |
| 98 | |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 99 | protected: |
Tom Sepez | 797ca5c | 2017-05-25 12:03:18 -0700 | [diff] [blame] | 100 | CFX_UnownedPtr<CPDF_Annot> const m_pAnnot; |
jaepark | 2736276 | 2016-08-11 13:10:39 -0700 | [diff] [blame] | 101 | }; |
| 102 | |
dsinclair | 114e46a | 2016-09-29 17:18:21 -0700 | [diff] [blame] | 103 | #endif // FPDFSDK_CPDFSDK_BAANNOT_H_ |