Chromium Code Reviews| Index: core/fpdfdoc/doc_annot.h |
| diff --git a/core/fpdfdoc/doc_annot.h b/core/fpdfdoc/doc_annot.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..54b8d0c947a5021a546685d599ee92353e7171be |
| --- /dev/null |
| +++ b/core/fpdfdoc/doc_annot.h |
| @@ -0,0 +1,109 @@ |
| +// Copyright 2016 PDFium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| + |
| +#ifndef CORE_FPDFDOC_DOC_ANNOT_H_ |
| +#define CORE_FPDFDOC_DOC_ANNOT_H_ |
| + |
|
Lei Zhang
2016/07/20 01:34:07
No #includes seems fragile. i.e. it only works if
jaepark
2016/07/20 02:29:51
Done.
|
| +class CFX_RenderDevice; |
| +class CPDF_Annot; |
| +class CPDF_AnnotList; |
| +class CPDF_Document; |
| +class CPDF_Form; |
| +class CPDF_Page; |
| +class CPDF_RenderOptions; |
| +class CPDF_RenderContext; |
| + |
| +#define ANNOTFLAG_UNKNOWN 0x0000 |
| +#define ANNOTFLAG_INVISIBLE 0x0001 |
| +#define ANNOTFLAG_HIDDEN 0x0002 |
| +#define ANNOTFLAG_PRINT 0x0004 |
| +#define ANNOTFLAG_NOZOOM 0x0008 |
| +#define ANNOTFLAG_NOROTATE 0x0010 |
| +#define ANNOTFLAG_NOVIEW 0x0020 |
| +#define ANNOTFLAG_READONLY 0x0040 |
| +#define ANNOTFLAG_LOCKED 0x0080 |
| +#define ANNOTFLAG_TOGGLENOVIEW 0x0100 |
| +#define ANNOTFLAG_LOCKEDCONTENTS 0x0200 |
| + |
| +class CPDF_Annot { |
| + public: |
| + enum AppearanceMode { Normal, Rollover, Down }; |
| + |
| + CPDF_Annot(CPDF_Dictionary* pDict, CPDF_AnnotList* pList); |
| + ~CPDF_Annot(); |
| + |
| + CFX_ByteString GetSubType() const; |
| + uint32_t GetFlags() const; |
| + void GetRect(CFX_FloatRect& rect) const; |
| + const CPDF_Dictionary* GetAnnotDict() const { return m_pAnnotDict; } |
| + CPDF_Dictionary* GetAnnotDict() { return m_pAnnotDict; } |
| + FX_BOOL DrawAppearance(CPDF_Page* pPage, |
| + CFX_RenderDevice* pDevice, |
| + const CFX_Matrix* pUser2Device, |
| + AppearanceMode mode, |
| + const CPDF_RenderOptions* pOptions); |
| + FX_BOOL DrawInContext(const CPDF_Page* pPage, |
| + CPDF_RenderContext* pContext, |
| + const CFX_Matrix* pUser2Device, |
| + AppearanceMode mode); |
| + void ClearCachedAP(); |
| + void DrawBorder(CFX_RenderDevice* pDevice, |
| + const CFX_Matrix* pUser2Device, |
| + const CPDF_RenderOptions* pOptions); |
| + CPDF_Form* GetAPForm(const CPDF_Page* pPage, AppearanceMode mode); |
| + |
| + private: |
| + CPDF_Dictionary* const m_pAnnotDict; |
| + CPDF_AnnotList* const m_pList; |
| + const CFX_ByteString m_sSubtype; |
| + std::map<CPDF_Stream*, CPDF_Form*> m_APMap; |
| +}; |
| + |
| +class CPDF_AnnotList { |
| + public: |
| + explicit CPDF_AnnotList(CPDF_Page* pPage); |
| + ~CPDF_AnnotList(); |
| + |
| + void DisplayAnnots(CPDF_Page* pPage, |
| + CPDF_RenderContext* pContext, |
| + FX_BOOL bPrinting, |
| + CFX_Matrix* pMatrix, |
| + FX_BOOL bShowWidget, |
| + CPDF_RenderOptions* pOptions) { |
| + DisplayAnnots(pPage, nullptr, pContext, bPrinting, pMatrix, |
| + bShowWidget ? 3 : 1, pOptions, nullptr); |
| + } |
| + |
| + void DisplayAnnots(CPDF_Page* pPage, |
| + CFX_RenderDevice* pDevice, |
| + CPDF_RenderContext* pContext, |
| + FX_BOOL bPrinting, |
| + CFX_Matrix* pMatrix, |
| + uint32_t dwAnnotFlags, |
| + CPDF_RenderOptions* pOptions, |
| + FX_RECT* pClipRect); |
| + size_t Count() const { return m_AnnotList.size(); } |
| + CPDF_Annot* GetAt(size_t index) const { return m_AnnotList[index].get(); } |
| + const std::vector<std::unique_ptr<CPDF_Annot>>& All() const { |
| + return m_AnnotList; |
| + } |
| + CPDF_Document* GetDocument() const { return m_pDocument; } |
| + |
| + protected: |
| + void DisplayPass(CPDF_Page* pPage, |
| + CFX_RenderDevice* pDevice, |
| + CPDF_RenderContext* pContext, |
| + FX_BOOL bPrinting, |
| + CFX_Matrix* pMatrix, |
| + FX_BOOL bWidget, |
| + CPDF_RenderOptions* pOptions, |
| + FX_RECT* clip_rect); |
| + |
| + CPDF_Document* const m_pDocument; |
| + std::vector<std::unique_ptr<CPDF_Annot>> m_AnnotList; |
| +}; |
| + |
| +#endif // CORE_FPDFDOC_DOC_ANNOT_H_ |