| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DOCUMENT_H_ | 7 #ifndef CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DOCUMENT_H_ |
| 8 #define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DOCUMENT_H_ | 8 #define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DOCUMENT_H_ |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 class CPDF_Document : public CPDF_IndirectObjectHolder { | 41 class CPDF_Document : public CPDF_IndirectObjectHolder { |
| 42 public: | 42 public: |
| 43 explicit CPDF_Document(std::unique_ptr<CPDF_Parser> pParser); | 43 explicit CPDF_Document(std::unique_ptr<CPDF_Parser> pParser); |
| 44 ~CPDF_Document() override; | 44 ~CPDF_Document() override; |
| 45 | 45 |
| 46 CPDF_Parser* GetParser() const { return m_pParser.get(); } | 46 CPDF_Parser* GetParser() const { return m_pParser.get(); } |
| 47 CPDF_Dictionary* GetRoot() const { return m_pRootDict; } | 47 CPDF_Dictionary* GetRoot() const { return m_pRootDict; } |
| 48 CPDF_Dictionary* GetInfo() const { return m_pInfoDict; } | 48 CPDF_Dictionary* GetInfo() const { return m_pInfoDict; } |
| 49 | 49 |
| 50 void GetID(CFX_ByteString& id1, CFX_ByteString& id2) const { | |
| 51 id1 = m_ID1; | |
| 52 id2 = m_ID2; | |
| 53 } | |
| 54 | |
| 55 int GetPageCount() const; | 50 int GetPageCount() const; |
| 56 CPDF_Dictionary* GetPage(int iPage); | 51 CPDF_Dictionary* GetPage(int iPage); |
| 57 int GetPageIndex(uint32_t objnum); | 52 int GetPageIndex(uint32_t objnum); |
| 58 uint32_t GetUserPermissions() const; | 53 uint32_t GetUserPermissions() const; |
| 59 CPDF_DocPageData* GetPageData() const { return m_pDocPage; } | 54 CPDF_DocPageData* GetPageData() const { return m_pDocPage; } |
| 60 void ClearPageData(); | |
| 61 void RemoveColorSpaceFromPageData(CPDF_Object* pObject); | |
| 62 | 55 |
| 63 std::unique_ptr<JBig2_DocumentContext>* CodecContext() { | 56 std::unique_ptr<JBig2_DocumentContext>* CodecContext() { |
| 64 return &m_pCodecContext; | 57 return &m_pCodecContext; |
| 65 } | 58 } |
| 66 std::unique_ptr<CPDF_LinkList>* LinksContext() { return &m_pLinksContext; } | 59 std::unique_ptr<CPDF_LinkList>* LinksContext() { return &m_pLinksContext; } |
| 67 | 60 |
| 68 CPDF_DocRenderData* GetRenderData() const { return m_pDocRender.get(); } | 61 CPDF_DocRenderData* GetRenderData() const { return m_pDocRender.get(); } |
| 69 void ClearRenderData(); | |
| 70 void ClearRenderFont(); | |
| 71 | 62 |
| 72 FX_BOOL IsFormStream(uint32_t objnum, FX_BOOL& bForm) const; | 63 FX_BOOL IsFormStream(uint32_t objnum, FX_BOOL& bForm) const; |
| 73 | 64 |
| 74 // |pFontDict| must not be null. | 65 // |pFontDict| must not be null. |
| 75 CPDF_Font* LoadFont(CPDF_Dictionary* pFontDict); | 66 CPDF_Font* LoadFont(CPDF_Dictionary* pFontDict); |
| 76 CPDF_ColorSpace* LoadColorSpace(CPDF_Object* pCSObj, | 67 CPDF_ColorSpace* LoadColorSpace(CPDF_Object* pCSObj, |
| 77 CPDF_Dictionary* pResources = nullptr); | 68 CPDF_Dictionary* pResources = nullptr); |
| 78 | 69 |
| 79 CPDF_Pattern* LoadPattern(CPDF_Object* pObj, | 70 CPDF_Pattern* LoadPattern(CPDF_Object* pObj, |
| 80 FX_BOOL bShading, | 71 FX_BOOL bShading, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 95 CPDF_Font* AddStandardFont(const FX_CHAR* font, CPDF_FontEncoding* pEncoding); | 86 CPDF_Font* AddStandardFont(const FX_CHAR* font, CPDF_FontEncoding* pEncoding); |
| 96 CPDF_Font* AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert); | 87 CPDF_Font* AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert); |
| 97 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 88 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
| 98 CPDF_Font* AddWindowsFont(LOGFONTA* pLogFont, | 89 CPDF_Font* AddWindowsFont(LOGFONTA* pLogFont, |
| 99 FX_BOOL bVert, | 90 FX_BOOL bVert, |
| 100 FX_BOOL bTranslateName = FALSE); | 91 FX_BOOL bTranslateName = FALSE); |
| 101 CPDF_Font* AddWindowsFont(LOGFONTW* pLogFont, | 92 CPDF_Font* AddWindowsFont(LOGFONTW* pLogFont, |
| 102 FX_BOOL bVert, | 93 FX_BOOL bVert, |
| 103 FX_BOOL bTranslateName = FALSE); | 94 FX_BOOL bTranslateName = FALSE); |
| 104 #endif | 95 #endif |
| 105 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | |
| 106 CPDF_Font* AddMacFont(CTFontRef pFont, | |
| 107 FX_BOOL bVert, | |
| 108 FX_BOOL bTranslateName = FALSE); | |
| 109 #endif | |
| 110 | 96 |
| 111 protected: | 97 protected: |
| 112 friend class CPDF_Creator; | 98 friend class CPDF_Creator; |
| 113 friend class CPDF_Parser; | 99 friend class CPDF_Parser; |
| 114 friend class CPDF_DataAvail; | 100 friend class CPDF_DataAvail; |
| 115 friend class CPDF_OCContext; | 101 friend class CPDF_OCContext; |
| 116 | 102 |
| 117 // Retrieve page count information by getting count value from the tree nodes | 103 // Retrieve page count information by getting count value from the tree nodes |
| 118 int RetrievePageCount() const; | 104 int RetrievePageCount() const; |
| 119 CPDF_Dictionary* FindPDFPage(CPDF_Dictionary* pPages, | 105 CPDF_Dictionary* FindPDFPage(CPDF_Dictionary* pPages, |
| 120 int iPage, | 106 int iPage, |
| 121 int nPagesToGo, | 107 int nPagesToGo, |
| 122 int level); | 108 int level); |
| 123 int FindPageIndex(CPDF_Dictionary* pNode, | 109 int FindPageIndex(CPDF_Dictionary* pNode, |
| 124 uint32_t& skip_count, | 110 uint32_t& skip_count, |
| 125 uint32_t objnum, | 111 uint32_t objnum, |
| 126 int& index, | 112 int& index, |
| 127 int level = 0); | 113 int level = 0); |
| 128 FX_BOOL CheckOCGVisible(CPDF_Dictionary* pOCG, FX_BOOL bPrinting); | |
| 129 CPDF_Object* ParseIndirectObject(uint32_t objnum) override; | 114 CPDF_Object* ParseIndirectObject(uint32_t objnum) override; |
| 130 | 115 |
| 131 std::unique_ptr<CPDF_Parser> m_pParser; | 116 std::unique_ptr<CPDF_Parser> m_pParser; |
| 132 CPDF_Dictionary* m_pRootDict; | 117 CPDF_Dictionary* m_pRootDict; |
| 133 CPDF_Dictionary* m_pInfoDict; | 118 CPDF_Dictionary* m_pInfoDict; |
| 134 CFX_ByteString m_ID1; | |
| 135 CFX_ByteString m_ID2; | |
| 136 bool m_bLinearized; | 119 bool m_bLinearized; |
| 137 int m_iFirstPageNo; | 120 int m_iFirstPageNo; |
| 138 uint32_t m_dwFirstPageObjNum; | 121 uint32_t m_dwFirstPageObjNum; |
| 139 CFX_ArrayTemplate<uint32_t> m_PageList; | 122 CFX_ArrayTemplate<uint32_t> m_PageList; |
| 140 // TODO(thestig): Figure out why this cannot be a std::unique_ptr. | 123 // TODO(thestig): Figure out why this cannot be a std::unique_ptr. |
| 141 CPDF_DocPageData* m_pDocPage; | 124 CPDF_DocPageData* m_pDocPage; |
| 142 std::unique_ptr<CPDF_DocRenderData> m_pDocRender; | 125 std::unique_ptr<CPDF_DocRenderData> m_pDocRender; |
| 143 std::unique_ptr<JBig2_DocumentContext> m_pCodecContext; | 126 std::unique_ptr<JBig2_DocumentContext> m_pCodecContext; |
| 144 std::unique_ptr<CPDF_LinkList> m_pLinksContext; | 127 std::unique_ptr<CPDF_LinkList> m_pLinksContext; |
| 145 | 128 |
| 146 private: | 129 private: |
| 147 void LoadDocInternal(); | 130 void LoadDocInternal(); |
| 148 }; | 131 }; |
| 149 | 132 |
| 150 #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DOCUMENT_H_ | 133 #endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DOCUMENT_H_ |
| OLD | NEW |