OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 CORE_FPDFAPI_PAGE_CPDF_DOCPAGEDATA_H_ |
| 8 #define CORE_FPDFAPI_PAGE_CPDF_DOCPAGEDATA_H_ |
| 9 |
| 10 #include <map> |
| 11 #include <set> |
| 12 |
| 13 #include "core/fpdfapi/page/cpdf_countedobject.h" |
| 14 #include "core/fxcrt/fx_coordinates.h" |
| 15 #include "core/fxcrt/fx_string.h" |
| 16 |
| 17 class CPDF_Dictionary; |
| 18 class CPDF_Document; |
| 19 class CPDF_Font; |
| 20 class CPDF_FontEncoding; |
| 21 class CPDF_IccProfile; |
| 22 class CPDF_Image; |
| 23 class CPDF_Object; |
| 24 class CPDF_Stream; |
| 25 class CPDF_StreamAcc; |
| 26 |
| 27 class CPDF_DocPageData { |
| 28 public: |
| 29 explicit CPDF_DocPageData(CPDF_Document* pPDFDoc); |
| 30 ~CPDF_DocPageData(); |
| 31 |
| 32 void Clear(bool bRelease = FALSE); |
| 33 CPDF_Font* GetFont(CPDF_Dictionary* pFontDict); |
| 34 CPDF_Font* GetStandardFont(const CFX_ByteString& fontName, |
| 35 CPDF_FontEncoding* pEncoding); |
| 36 void ReleaseFont(const CPDF_Dictionary* pFontDict); |
| 37 CPDF_ColorSpace* GetColorSpace(CPDF_Object* pCSObj, |
| 38 const CPDF_Dictionary* pResources); |
| 39 CPDF_ColorSpace* GetCopiedColorSpace(CPDF_Object* pCSObj); |
| 40 void ReleaseColorSpace(const CPDF_Object* pColorSpace); |
| 41 CPDF_Pattern* GetPattern(CPDF_Object* pPatternObj, |
| 42 bool bShading, |
| 43 const CFX_Matrix& matrix); |
| 44 void ReleasePattern(const CPDF_Object* pPatternObj); |
| 45 CPDF_Image* GetImage(CPDF_Object* pImageStream); |
| 46 void ReleaseImage(const CPDF_Object* pImageStream); |
| 47 CPDF_IccProfile* GetIccProfile(CPDF_Stream* pIccProfileStream); |
| 48 void ReleaseIccProfile(const CPDF_IccProfile* pIccProfile); |
| 49 CPDF_StreamAcc* GetFontFileStreamAcc(CPDF_Stream* pFontStream); |
| 50 void ReleaseFontFileStreamAcc(const CPDF_Stream* pFontStream); |
| 51 bool IsForceClear() const { return m_bForceClear; } |
| 52 CPDF_CountedColorSpace* FindColorSpacePtr(CPDF_Object* pCSObj) const; |
| 53 CPDF_CountedPattern* FindPatternPtr(CPDF_Object* pPatternObj) const; |
| 54 |
| 55 private: |
| 56 using CPDF_CountedFont = CPDF_CountedObject<CPDF_Font>; |
| 57 using CPDF_CountedIccProfile = CPDF_CountedObject<CPDF_IccProfile>; |
| 58 using CPDF_CountedImage = CPDF_CountedObject<CPDF_Image>; |
| 59 using CPDF_CountedStreamAcc = CPDF_CountedObject<CPDF_StreamAcc>; |
| 60 |
| 61 using CPDF_ColorSpaceMap = |
| 62 std::map<const CPDF_Object*, CPDF_CountedColorSpace*>; |
| 63 using CPDF_FontFileMap = std::map<const CPDF_Stream*, CPDF_CountedStreamAcc*>; |
| 64 using CPDF_FontMap = std::map<const CPDF_Dictionary*, CPDF_CountedFont*>; |
| 65 using CPDF_IccProfileMap = |
| 66 std::map<const CPDF_Stream*, CPDF_CountedIccProfile*>; |
| 67 using CPDF_ImageMap = std::map<uint32_t, CPDF_CountedImage*>; |
| 68 using CPDF_PatternMap = std::map<const CPDF_Object*, CPDF_CountedPattern*>; |
| 69 |
| 70 CPDF_ColorSpace* GetColorSpaceImpl(CPDF_Object* pCSObj, |
| 71 const CPDF_Dictionary* pResources, |
| 72 std::set<CPDF_Object*>* pVisited); |
| 73 |
| 74 CPDF_Document* const m_pPDFDoc; |
| 75 bool m_bForceClear; |
| 76 std::map<CFX_ByteString, CPDF_Stream*> m_HashProfileMap; |
| 77 CPDF_ColorSpaceMap m_ColorSpaceMap; |
| 78 CPDF_FontFileMap m_FontFileMap; |
| 79 CPDF_FontMap m_FontMap; |
| 80 CPDF_IccProfileMap m_IccProfileMap; |
| 81 CPDF_ImageMap m_ImageMap; |
| 82 CPDF_PatternMap m_PatternMap; |
| 83 }; |
| 84 |
| 85 #endif // CORE_FPDFAPI_PAGE_CPDF_DOCPAGEDATA_H_ |
OLD | NEW |