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/fxge/include/fx_dib.h" | 17 #include "core/fxge/include/fx_dib.h" |
| 18 #include "core/fpdfdoc/doc_annot.h" |
18 | 19 |
19 class CFDF_Document; | 20 class CFDF_Document; |
20 class CFieldTree; | 21 class CFieldTree; |
21 class CFX_RenderDevice; | 22 class CFX_RenderDevice; |
22 class CPDF_AAction; | 23 class CPDF_AAction; |
23 class CPDF_Action; | 24 class CPDF_Action; |
24 class CPDF_ActionFields; | 25 class CPDF_ActionFields; |
25 class CPDF_Annot; | |
26 class CPDF_AnnotList; | |
27 class CPDF_ApSettings; | 26 class CPDF_ApSettings; |
28 class CPDF_Bookmark; | 27 class CPDF_Bookmark; |
29 class CPDF_BookmarkTree; | 28 class CPDF_BookmarkTree; |
30 class CPDF_DefaultAppearance; | 29 class CPDF_DefaultAppearance; |
31 class CPDF_Dest; | 30 class CPDF_Dest; |
32 class CPDF_DocJSActions; | 31 class CPDF_DocJSActions; |
33 class CPDF_Document; | 32 class CPDF_Document; |
34 class CPDF_FileSpec; | 33 class CPDF_FileSpec; |
35 class CPDF_Font; | 34 class CPDF_Font; |
36 class CPDF_Form; | 35 class CPDF_Form; |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 CPDF_Dictionary* GetDict() const { return m_pDict; } | 298 CPDF_Dictionary* GetDict() const { return m_pDict; } |
300 | 299 |
301 CFX_FloatRect GetRect(); | 300 CFX_FloatRect GetRect(); |
302 CPDF_Dest GetDest(CPDF_Document* pDoc); | 301 CPDF_Dest GetDest(CPDF_Document* pDoc); |
303 CPDF_Action GetAction(); | 302 CPDF_Action GetAction(); |
304 | 303 |
305 protected: | 304 protected: |
306 CPDF_Dictionary* m_pDict; | 305 CPDF_Dictionary* m_pDict; |
307 }; | 306 }; |
308 | 307 |
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_AnnotList* pList); | |
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_AnnotList* const m_pList; | |
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 CPDF_Document* GetDocument() const { return m_pDocument; } | |
382 | |
383 protected: | |
384 void DisplayPass(CPDF_Page* pPage, | |
385 CFX_RenderDevice* pDevice, | |
386 CPDF_RenderContext* pContext, | |
387 FX_BOOL bPrinting, | |
388 CFX_Matrix* pMatrix, | |
389 FX_BOOL bWidget, | |
390 CPDF_RenderOptions* pOptions, | |
391 FX_RECT* clip_rect); | |
392 | |
393 CPDF_Document* const m_pDocument; | |
394 std::vector<std::unique_ptr<CPDF_Annot>> m_AnnotList; | |
395 }; | |
396 | |
397 #define COLORTYPE_TRANSPARENT 0 | 308 #define COLORTYPE_TRANSPARENT 0 |
398 #define COLORTYPE_GRAY 1 | 309 #define COLORTYPE_GRAY 1 |
399 #define COLORTYPE_RGB 2 | 310 #define COLORTYPE_RGB 2 |
400 #define COLORTYPE_CMYK 3 | 311 #define COLORTYPE_CMYK 3 |
401 class CPDF_DefaultAppearance { | 312 class CPDF_DefaultAppearance { |
402 public: | 313 public: |
403 CPDF_DefaultAppearance() {} | 314 CPDF_DefaultAppearance() {} |
404 explicit CPDF_DefaultAppearance(const CFX_ByteString& csDA) : m_csDA(csDA) {} | 315 explicit CPDF_DefaultAppearance(const CFX_ByteString& csDA) : m_csDA(csDA) {} |
405 | 316 |
406 CPDF_DefaultAppearance(const CPDF_DefaultAppearance& cDA) { | 317 CPDF_DefaultAppearance(const CPDF_DefaultAppearance& cDA) { |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 CFX_WideString GetCaption(const CFX_ByteString& csEntry) const; | 841 CFX_WideString GetCaption(const CFX_ByteString& csEntry) const; |
931 CPDF_Stream* GetIcon(const CFX_ByteString& csEntry) const; | 842 CPDF_Stream* GetIcon(const CFX_ByteString& csEntry) const; |
932 | 843 |
933 CPDF_Dictionary* const m_pDict; | 844 CPDF_Dictionary* const m_pDict; |
934 }; | 845 }; |
935 | 846 |
936 CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, | 847 CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, |
937 CPDF_Annot::AppearanceMode mode); | 848 CPDF_Annot::AppearanceMode mode); |
938 | 849 |
939 #endif // CORE_FPDFDOC_INCLUDE_FPDF_DOC_H_ | 850 #endif // CORE_FPDFDOC_INCLUDE_FPDF_DOC_H_ |
OLD | NEW |