| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef CORE_FPDFDOC_INCLUDE_FPDF_DOC_H_ | 7 #ifndef CORE_FPDFDOC_INCLUDE_FPDF_DOC_H_ |
| 8 #define CORE_FPDFDOC_INCLUDE_FPDF_DOC_H_ | 8 #define CORE_FPDFDOC_INCLUDE_FPDF_DOC_H_ |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <unordered_map> | 12 #include <unordered_map> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" | 15 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" |
| 16 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" | 16 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" |
| 17 #include "core/fpdfdoc/cpdf_annot.h" |
| 18 #include "core/fpdfdoc/cpdf_annotlist.h" |
| 17 #include "core/fxge/include/fx_dib.h" | 19 #include "core/fxge/include/fx_dib.h" |
| 18 | 20 |
| 19 class CFDF_Document; | 21 class CFDF_Document; |
| 20 class CFieldTree; | 22 class CFieldTree; |
| 21 class CFX_RenderDevice; | 23 class CFX_RenderDevice; |
| 22 class CPDF_AAction; | 24 class CPDF_AAction; |
| 23 class CPDF_Action; | 25 class CPDF_Action; |
| 24 class CPDF_ActionFields; | 26 class CPDF_ActionFields; |
| 25 class CPDF_Annot; | |
| 26 class CPDF_AnnotList; | |
| 27 class CPDF_ApSettings; | 27 class CPDF_ApSettings; |
| 28 class CPDF_Bookmark; | 28 class CPDF_Bookmark; |
| 29 class CPDF_BookmarkTree; | 29 class CPDF_BookmarkTree; |
| 30 class CPDF_DefaultAppearance; | 30 class CPDF_DefaultAppearance; |
| 31 class CPDF_Dest; | 31 class CPDF_Dest; |
| 32 class CPDF_DocJSActions; | 32 class CPDF_DocJSActions; |
| 33 class CPDF_Document; | 33 class CPDF_Document; |
| 34 class CPDF_FileSpec; | 34 class CPDF_FileSpec; |
| 35 class CPDF_Font; | 35 class CPDF_Font; |
| 36 class CPDF_Form; | 36 class CPDF_Form; |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 CPDF_Dictionary* GetDict() const { return m_pDict; } | 299 CPDF_Dictionary* GetDict() const { return m_pDict; } |
| 300 | 300 |
| 301 CFX_FloatRect GetRect(); | 301 CFX_FloatRect GetRect(); |
| 302 CPDF_Dest GetDest(CPDF_Document* pDoc); | 302 CPDF_Dest GetDest(CPDF_Document* pDoc); |
| 303 CPDF_Action GetAction(); | 303 CPDF_Action GetAction(); |
| 304 | 304 |
| 305 protected: | 305 protected: |
| 306 CPDF_Dictionary* m_pDict; | 306 CPDF_Dictionary* m_pDict; |
| 307 }; | 307 }; |
| 308 | 308 |
| 309 #define ANNOTFLAG_INVISIBLE 0x0001 | |
| 310 #define ANNOTFLAG_HIDDEN 0x0002 | |
| 311 #define ANNOTFLAG_PRINT 0x0004 | |
| 312 #define ANNOTFLAG_NOZOOM 0x0008 | |
| 313 #define ANNOTFLAG_NOROTATE 0x0010 | |
| 314 #define ANNOTFLAG_NOVIEW 0x0020 | |
| 315 #define ANNOTFLAG_READONLY 0x0040 | |
| 316 #define ANNOTFLAG_LOCKED 0x0080 | |
| 317 #define ANNOTFLAG_TOGGLENOVIEW 0x0100 | |
| 318 | |
| 319 class CPDF_Annot { | |
| 320 public: | |
| 321 enum AppearanceMode { Normal, Rollover, Down }; | |
| 322 | |
| 323 CPDF_Annot(CPDF_Dictionary* pDict, CPDF_Document* pDocument); | |
| 324 ~CPDF_Annot(); | |
| 325 | |
| 326 CFX_ByteString GetSubType() const; | |
| 327 uint32_t GetFlags() const; | |
| 328 void GetRect(CFX_FloatRect& rect) const; | |
| 329 const CPDF_Dictionary* GetAnnotDict() const { return m_pAnnotDict; } | |
| 330 CPDF_Dictionary* GetAnnotDict() { return m_pAnnotDict; } | |
| 331 FX_BOOL DrawAppearance(CPDF_Page* pPage, | |
| 332 CFX_RenderDevice* pDevice, | |
| 333 const CFX_Matrix* pUser2Device, | |
| 334 AppearanceMode mode, | |
| 335 const CPDF_RenderOptions* pOptions); | |
| 336 FX_BOOL DrawInContext(const CPDF_Page* pPage, | |
| 337 CPDF_RenderContext* pContext, | |
| 338 const CFX_Matrix* pUser2Device, | |
| 339 AppearanceMode mode); | |
| 340 void ClearCachedAP(); | |
| 341 void DrawBorder(CFX_RenderDevice* pDevice, | |
| 342 const CFX_Matrix* pUser2Device, | |
| 343 const CPDF_RenderOptions* pOptions); | |
| 344 CPDF_Form* GetAPForm(const CPDF_Page* pPage, AppearanceMode mode); | |
| 345 | |
| 346 private: | |
| 347 CPDF_Dictionary* const m_pAnnotDict; | |
| 348 CPDF_Document* const m_pDocument; | |
| 349 const CFX_ByteString m_sSubtype; | |
| 350 std::map<CPDF_Stream*, CPDF_Form*> m_APMap; | |
| 351 }; | |
| 352 | |
| 353 class CPDF_AnnotList { | |
| 354 public: | |
| 355 explicit CPDF_AnnotList(CPDF_Page* pPage); | |
| 356 ~CPDF_AnnotList(); | |
| 357 | |
| 358 void DisplayAnnots(CPDF_Page* pPage, | |
| 359 CPDF_RenderContext* pContext, | |
| 360 FX_BOOL bPrinting, | |
| 361 CFX_Matrix* pMatrix, | |
| 362 FX_BOOL bShowWidget, | |
| 363 CPDF_RenderOptions* pOptions) { | |
| 364 DisplayAnnots(pPage, nullptr, pContext, bPrinting, pMatrix, | |
| 365 bShowWidget ? 3 : 1, pOptions, nullptr); | |
| 366 } | |
| 367 | |
| 368 void DisplayAnnots(CPDF_Page* pPage, | |
| 369 CFX_RenderDevice* pDevice, | |
| 370 CPDF_RenderContext* pContext, | |
| 371 FX_BOOL bPrinting, | |
| 372 CFX_Matrix* pMatrix, | |
| 373 uint32_t dwAnnotFlags, | |
| 374 CPDF_RenderOptions* pOptions, | |
| 375 FX_RECT* pClipRect); | |
| 376 size_t Count() const { return m_AnnotList.size(); } | |
| 377 CPDF_Annot* GetAt(size_t index) const { return m_AnnotList[index].get(); } | |
| 378 const std::vector<std::unique_ptr<CPDF_Annot>>& All() const { | |
| 379 return m_AnnotList; | |
| 380 } | |
| 381 | |
| 382 protected: | |
| 383 void DisplayPass(CPDF_Page* pPage, | |
| 384 CFX_RenderDevice* pDevice, | |
| 385 CPDF_RenderContext* pContext, | |
| 386 FX_BOOL bPrinting, | |
| 387 CFX_Matrix* pMatrix, | |
| 388 FX_BOOL bWidget, | |
| 389 CPDF_RenderOptions* pOptions, | |
| 390 FX_RECT* clip_rect); | |
| 391 | |
| 392 CPDF_Document* const m_pDocument; | |
| 393 std::vector<std::unique_ptr<CPDF_Annot>> m_AnnotList; | |
| 394 }; | |
| 395 | |
| 396 #define COLORTYPE_TRANSPARENT 0 | 309 #define COLORTYPE_TRANSPARENT 0 |
| 397 #define COLORTYPE_GRAY 1 | 310 #define COLORTYPE_GRAY 1 |
| 398 #define COLORTYPE_RGB 2 | 311 #define COLORTYPE_RGB 2 |
| 399 #define COLORTYPE_CMYK 3 | 312 #define COLORTYPE_CMYK 3 |
| 400 class CPDF_DefaultAppearance { | 313 class CPDF_DefaultAppearance { |
| 401 public: | 314 public: |
| 402 CPDF_DefaultAppearance() {} | 315 CPDF_DefaultAppearance() {} |
| 403 explicit CPDF_DefaultAppearance(const CFX_ByteString& csDA) : m_csDA(csDA) {} | 316 explicit CPDF_DefaultAppearance(const CFX_ByteString& csDA) : m_csDA(csDA) {} |
| 404 | 317 |
| 405 CPDF_DefaultAppearance(const CPDF_DefaultAppearance& cDA) { | 318 CPDF_DefaultAppearance(const CPDF_DefaultAppearance& cDA) { |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 CFX_WideString GetCaption(const CFX_ByteString& csEntry) const; | 842 CFX_WideString GetCaption(const CFX_ByteString& csEntry) const; |
| 930 CPDF_Stream* GetIcon(const CFX_ByteString& csEntry) const; | 843 CPDF_Stream* GetIcon(const CFX_ByteString& csEntry) const; |
| 931 | 844 |
| 932 CPDF_Dictionary* const m_pDict; | 845 CPDF_Dictionary* const m_pDict; |
| 933 }; | 846 }; |
| 934 | 847 |
| 935 CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, | 848 CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, |
| 936 CPDF_Annot::AppearanceMode mode); | 849 CPDF_Annot::AppearanceMode mode); |
| 937 | 850 |
| 938 #endif // CORE_FPDFDOC_INCLUDE_FPDF_DOC_H_ | 851 #endif // CORE_FPDFDOC_INCLUDE_FPDF_DOC_H_ |
| OLD | NEW |