Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(727)

Side by Side Diff: core/include/fpdfapi/cpdf_document.h

Issue 1780503002: Split off CPDF_Document into its own .cpp/.h files. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Nits. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « BUILD.gn ('k') | core/include/fpdfapi/fpdf_parser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_INCLUDE_FPDFAPI_CPDF_DOCUMENT_H_
8 #define CORE_INCLUDE_FPDFAPI_CPDF_DOCUMENT_H_
9
10 #include "core/include/fpdfapi/fpdf_objects.h"
11 #include "core/include/fxcrt/fx_basic.h"
12
13 class CFX_Font;
14 class CPDF_ColorSpace;
15 class CPDF_DocPageData;
16 class CPDF_DocRenderData;
17 class CPDF_Font;
18 class CPDF_FontEncoding;
19 class CPDF_IccProfile;
20 class CPDF_Image;
21 class CPDF_Pattern;
22
23 class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder {
24 public:
25 CPDF_Document();
26 explicit CPDF_Document(CPDF_Parser* pParser);
27 ~CPDF_Document();
28
29 CPDF_Parser* GetParser() const { return m_pParser; }
30 CPDF_Dictionary* GetRoot() const { return m_pRootDict; }
31 CPDF_Dictionary* GetInfo() const { return m_pInfoDict; }
32
33 void GetID(CFX_ByteString& id1, CFX_ByteString& id2) const {
34 id1 = m_ID1;
35 id2 = m_ID2;
36 }
37
38 int GetPageCount() const;
39 CPDF_Dictionary* GetPage(int iPage);
40 int GetPageIndex(FX_DWORD objnum);
41 FX_DWORD GetUserPermissions(FX_BOOL bCheckRevision = FALSE) const;
42 CPDF_DocPageData* GetPageData() { return GetValidatePageData(); }
43 void ClearPageData();
44 void RemoveColorSpaceFromPageData(CPDF_Object* pObject);
45
46 CPDF_DocRenderData* GetRenderData() { return GetValidateRenderData(); }
47 void ClearRenderData();
48 void ClearRenderFont();
49
50 FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const;
51
52 // |pFontDict| must not be null.
53 CPDF_Font* LoadFont(CPDF_Dictionary* pFontDict);
54 CPDF_ColorSpace* LoadColorSpace(CPDF_Object* pCSObj,
55 CPDF_Dictionary* pResources = NULL);
56
57 CPDF_Pattern* LoadPattern(CPDF_Object* pObj,
58 FX_BOOL bShading,
59 const CFX_Matrix* matrix = NULL);
60
61 CPDF_Image* LoadImageF(CPDF_Object* pObj);
62 CPDF_StreamAcc* LoadFontFile(CPDF_Stream* pStream);
63 CPDF_IccProfile* LoadIccProfile(CPDF_Stream* pStream);
64
65 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
66
67 CPDF_Font* AddWindowsFont(LOGFONTA* pLogFont,
68 FX_BOOL bVert,
69 FX_BOOL bTranslateName = FALSE);
70 CPDF_Font* AddWindowsFont(LOGFONTW* pLogFont,
71 FX_BOOL bVert,
72 FX_BOOL bTranslateName = FALSE);
73 #endif
74 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
75 CPDF_Font* AddMacFont(CTFontRef pFont,
76 FX_BOOL bVert,
77 FX_BOOL bTranslateName = FALSE);
78 #endif
79
80 CPDF_Font* AddStandardFont(const FX_CHAR* font, CPDF_FontEncoding* pEncoding);
81 CPDF_Font* AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert);
82 void CreateNewDoc();
83
84 CPDF_Dictionary* CreateNewPage(int iPage);
85 void DeletePage(int iPage);
86
87 void LoadDoc();
88 void LoadAsynDoc(CPDF_Dictionary* pLinearized);
89 void LoadPages();
90
91 protected:
92 // Retrieve page count information by getting count value from the tree nodes
93 // or walking through the tree nodes to calculate it.
94 int RetrievePageCount() const;
95 CPDF_Dictionary* _FindPDFPage(CPDF_Dictionary* pPages,
96 int iPage,
97 int nPagesToGo,
98 int level);
99 int _FindPageIndex(CPDF_Dictionary* pNode,
100 FX_DWORD& skip_count,
101 FX_DWORD objnum,
102 int& index,
103 int level = 0);
104 FX_BOOL CheckOCGVisible(CPDF_Dictionary* pOCG, FX_BOOL bPrinting);
105 CPDF_DocPageData* GetValidatePageData();
106 CPDF_DocRenderData* GetValidateRenderData();
107 friend class CPDF_Creator;
108 friend class CPDF_Parser;
109 friend class CPDF_DataAvail;
110 friend class CPDF_OCContext;
111
112 CPDF_Dictionary* m_pRootDict;
113 CPDF_Dictionary* m_pInfoDict;
114 CFX_ByteString m_ID1;
115 CFX_ByteString m_ID2;
116 FX_BOOL m_bLinearized;
117 FX_DWORD m_dwFirstPageNo;
118 FX_DWORD m_dwFirstPageObjNum;
119 CFX_DWordArray m_PageList;
120 CPDF_DocPageData* m_pDocPage;
121 CPDF_DocRenderData* m_pDocRender;
122 };
123
124 #endif // CORE_INCLUDE_FPDFAPI_CPDF_DOCUMENT_H_
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | core/include/fpdfapi/fpdf_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698