summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-03-08 13:10:55 -0800
committerTom Sepez <tsepez@chromium.org>2016-03-08 13:10:55 -0800
commit310438fb97a2363bd0901401ad2506febd64361b (patch)
tree82e5fc7ed110134123aded5884ec4ca917e2b39f /core
parentb70f5a44635d29981abac766d727ff54daea2c37 (diff)
downloadpdfium-310438fb97a2363bd0901401ad2506febd64361b.tar.xz
Split off CPDF_Document into its own .cpp/.h files.
R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1780503002 .
Diffstat (limited to 'core')
-rw-r--r--core/include/fpdfapi/cpdf_document.h124
-rw-r--r--core/include/fpdfapi/fpdf_parser.h127
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp1
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp1
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp1
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp1
-rw-r--r--core/src/fpdfapi/fpdf_font/fpdf_font.cpp1
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page.cpp1
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp1
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp1
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp1
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp1
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp1
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp1
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp1
-rw-r--r--core/src/fpdfapi/fpdf_parser/cpdf_document.cpp (renamed from core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp)14
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp1
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render.cpp1
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp9
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp1
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp1
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp1
-rw-r--r--core/src/fpdfdoc/doc_action.cpp1
-rw-r--r--core/src/fpdfdoc/doc_annot.cpp1
-rw-r--r--core/src/fpdfdoc/doc_ap.cpp1
-rw-r--r--core/src/fpdfdoc/doc_basic.cpp1
-rw-r--r--core/src/fpdfdoc/doc_bookmark.cpp1
-rw-r--r--core/src/fpdfdoc/doc_form.cpp1
-rw-r--r--core/src/fpdfdoc/doc_formcontrol.cpp1
-rw-r--r--core/src/fpdfdoc/doc_formfield.cpp1
-rw-r--r--core/src/fpdfdoc/doc_metadata.cpp1
-rw-r--r--core/src/fpdfdoc/doc_ocg.cpp1
-rw-r--r--core/src/fpdfdoc/doc_tagged.cpp1
-rw-r--r--core/src/fpdfdoc/doc_utils.cpp1
-rw-r--r--core/src/fpdfdoc/doc_viewerPreferences.cpp1
35 files changed, 170 insertions, 135 deletions
diff --git a/core/include/fpdfapi/cpdf_document.h b/core/include/fpdfapi/cpdf_document.h
new file mode 100644
index 0000000000..bba89c822c
--- /dev/null
+++ b/core/include/fpdfapi/cpdf_document.h
@@ -0,0 +1,124 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_INCLUDE_FPDFAPI_CPDF_DOCUMENT_H_
+#define CORE_INCLUDE_FPDFAPI_CPDF_DOCUMENT_H_
+
+#include "core/include/fpdfapi/fpdf_objects.h"
+#include "core/include/fxcrt/fx_basic.h"
+
+class CFX_Font;
+class CPDF_ColorSpace;
+class CPDF_DocPageData;
+class CPDF_DocRenderData;
+class CPDF_Font;
+class CPDF_FontEncoding;
+class CPDF_IccProfile;
+class CPDF_Image;
+class CPDF_Pattern;
+
+class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder {
+ public:
+ CPDF_Document();
+ explicit CPDF_Document(CPDF_Parser* pParser);
+ ~CPDF_Document();
+
+ CPDF_Parser* GetParser() const { return m_pParser; }
+ CPDF_Dictionary* GetRoot() const { return m_pRootDict; }
+ CPDF_Dictionary* GetInfo() const { return m_pInfoDict; }
+
+ void GetID(CFX_ByteString& id1, CFX_ByteString& id2) const {
+ id1 = m_ID1;
+ id2 = m_ID2;
+ }
+
+ int GetPageCount() const;
+ CPDF_Dictionary* GetPage(int iPage);
+ int GetPageIndex(FX_DWORD objnum);
+ FX_DWORD GetUserPermissions(FX_BOOL bCheckRevision = FALSE) const;
+ CPDF_DocPageData* GetPageData() { return GetValidatePageData(); }
+ void ClearPageData();
+ void RemoveColorSpaceFromPageData(CPDF_Object* pObject);
+
+ CPDF_DocRenderData* GetRenderData() { return GetValidateRenderData(); }
+ void ClearRenderData();
+ void ClearRenderFont();
+
+ FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const;
+
+ // |pFontDict| must not be null.
+ CPDF_Font* LoadFont(CPDF_Dictionary* pFontDict);
+ CPDF_ColorSpace* LoadColorSpace(CPDF_Object* pCSObj,
+ CPDF_Dictionary* pResources = NULL);
+
+ CPDF_Pattern* LoadPattern(CPDF_Object* pObj,
+ FX_BOOL bShading,
+ const CFX_Matrix* matrix = NULL);
+
+ CPDF_Image* LoadImageF(CPDF_Object* pObj);
+ CPDF_StreamAcc* LoadFontFile(CPDF_Stream* pStream);
+ CPDF_IccProfile* LoadIccProfile(CPDF_Stream* pStream);
+
+#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
+
+ CPDF_Font* AddWindowsFont(LOGFONTA* pLogFont,
+ FX_BOOL bVert,
+ FX_BOOL bTranslateName = FALSE);
+ CPDF_Font* AddWindowsFont(LOGFONTW* pLogFont,
+ FX_BOOL bVert,
+ FX_BOOL bTranslateName = FALSE);
+#endif
+#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
+ CPDF_Font* AddMacFont(CTFontRef pFont,
+ FX_BOOL bVert,
+ FX_BOOL bTranslateName = FALSE);
+#endif
+
+ CPDF_Font* AddStandardFont(const FX_CHAR* font, CPDF_FontEncoding* pEncoding);
+ CPDF_Font* AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert);
+ void CreateNewDoc();
+
+ CPDF_Dictionary* CreateNewPage(int iPage);
+ void DeletePage(int iPage);
+
+ void LoadDoc();
+ void LoadAsynDoc(CPDF_Dictionary* pLinearized);
+ void LoadPages();
+
+ protected:
+ // Retrieve page count information by getting count value from the tree nodes
+ // or walking through the tree nodes to calculate it.
+ int RetrievePageCount() const;
+ CPDF_Dictionary* _FindPDFPage(CPDF_Dictionary* pPages,
+ int iPage,
+ int nPagesToGo,
+ int level);
+ int _FindPageIndex(CPDF_Dictionary* pNode,
+ FX_DWORD& skip_count,
+ FX_DWORD objnum,
+ int& index,
+ int level = 0);
+ FX_BOOL CheckOCGVisible(CPDF_Dictionary* pOCG, FX_BOOL bPrinting);
+ CPDF_DocPageData* GetValidatePageData();
+ CPDF_DocRenderData* GetValidateRenderData();
+ friend class CPDF_Creator;
+ friend class CPDF_Parser;
+ friend class CPDF_DataAvail;
+ friend class CPDF_OCContext;
+
+ CPDF_Dictionary* m_pRootDict;
+ CPDF_Dictionary* m_pInfoDict;
+ CFX_ByteString m_ID1;
+ CFX_ByteString m_ID2;
+ FX_BOOL m_bLinearized;
+ FX_DWORD m_dwFirstPageNo;
+ FX_DWORD m_dwFirstPageObjNum;
+ CFX_DWordArray m_PageList;
+ CPDF_DocPageData* m_pDocPage;
+ CPDF_DocRenderData* m_pDocRender;
+};
+
+#endif // CORE_INCLUDE_FPDFAPI_CPDF_DOCUMENT_H_
diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h
index 1b09aa0148..ec7a98cb91 100644
--- a/core/include/fpdfapi/fpdf_parser.h
+++ b/core/include/fpdfapi/fpdf_parser.h
@@ -18,6 +18,7 @@ class CFX_Font;
class CFX_Matrix;
class CPDF_ColorSpace;
class CPDF_CryptoHandler;
+class CPDF_Document;
class CPDF_DocPageData;
class CPDF_DocRenderData;
class CPDF_Font;
@@ -83,132 +84,6 @@ class ScopedSetInsertion {
// Indexed by 8-bit char code, contains unicode code points.
extern const FX_WORD PDFDocEncoding[256];
-class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder {
- public:
- CPDF_Document();
- explicit CPDF_Document(CPDF_Parser* pParser);
-
- ~CPDF_Document();
-
- CPDF_Parser* GetParser() const { return m_pParser; }
-
- CPDF_Dictionary* GetRoot() const { return m_pRootDict; }
-
- CPDF_Dictionary* GetInfo() const { return m_pInfoDict; }
-
- void GetID(CFX_ByteString& id1, CFX_ByteString& id2) const {
- id1 = m_ID1;
- id2 = m_ID2;
- }
-
- int GetPageCount() const;
-
- CPDF_Dictionary* GetPage(int iPage);
-
- int GetPageIndex(FX_DWORD objnum);
-
- FX_DWORD GetUserPermissions(FX_BOOL bCheckRevision = FALSE) const;
-
- CPDF_DocPageData* GetPageData() { return GetValidatePageData(); }
-
- void ClearPageData();
-
- void RemoveColorSpaceFromPageData(CPDF_Object* pObject);
-
- CPDF_DocRenderData* GetRenderData() { return GetValidateRenderData(); }
-
- void ClearRenderData();
-
- void ClearRenderFont();
-
- FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const;
-
- // |pFontDict| must not be null.
- CPDF_Font* LoadFont(CPDF_Dictionary* pFontDict);
-
- CPDF_ColorSpace* LoadColorSpace(CPDF_Object* pCSObj,
- CPDF_Dictionary* pResources = NULL);
-
- CPDF_Pattern* LoadPattern(CPDF_Object* pObj,
- FX_BOOL bShading,
- const CFX_Matrix* matrix = NULL);
-
- CPDF_Image* LoadImageF(CPDF_Object* pObj);
-
- CPDF_StreamAcc* LoadFontFile(CPDF_Stream* pStream);
-
- CPDF_IccProfile* LoadIccProfile(CPDF_Stream* pStream);
-
-#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-
- CPDF_Font* AddWindowsFont(LOGFONTA* pLogFont,
- FX_BOOL bVert,
- FX_BOOL bTranslateName = FALSE);
- CPDF_Font* AddWindowsFont(LOGFONTW* pLogFont,
- FX_BOOL bVert,
- FX_BOOL bTranslateName = FALSE);
-#endif
-#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- CPDF_Font* AddMacFont(CTFontRef pFont,
- FX_BOOL bVert,
- FX_BOOL bTranslateName = FALSE);
-#endif
-
- CPDF_Font* AddStandardFont(const FX_CHAR* font, CPDF_FontEncoding* pEncoding);
-
- CPDF_Font* AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert);
-
- void CreateNewDoc();
-
- CPDF_Dictionary* CreateNewPage(int iPage);
-
- void DeletePage(int iPage);
-
- void LoadDoc();
- void LoadAsynDoc(CPDF_Dictionary* pLinearized);
- void LoadPages();
-
- protected:
- CPDF_Dictionary* m_pRootDict;
-
- CPDF_Dictionary* m_pInfoDict;
-
- CFX_ByteString m_ID1;
-
- CFX_ByteString m_ID2;
-
- FX_BOOL m_bLinearized;
-
- FX_DWORD m_dwFirstPageNo;
-
- FX_DWORD m_dwFirstPageObjNum;
-
- CFX_DWordArray m_PageList;
-
- // Retrieve page count information by getting count value from the tree nodes
- // or walking through the tree nodes to calculate it.
- int RetrievePageCount() const;
- CPDF_Dictionary* _FindPDFPage(CPDF_Dictionary* pPages,
- int iPage,
- int nPagesToGo,
- int level);
- int _FindPageIndex(CPDF_Dictionary* pNode,
- FX_DWORD& skip_count,
- FX_DWORD objnum,
- int& index,
- int level = 0);
- FX_BOOL CheckOCGVisible(CPDF_Dictionary* pOCG, FX_BOOL bPrinting);
- CPDF_DocPageData* GetValidatePageData();
- CPDF_DocRenderData* GetValidateRenderData();
- friend class CPDF_Creator;
- friend class CPDF_Parser;
- friend class CPDF_DataAvail;
- friend class CPDF_OCContext;
-
- CPDF_DocPageData* m_pDocPage;
-
- CPDF_DocRenderData* m_pDocRender;
-};
class CPDF_SimpleParser {
public:
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
index 77c58f0925..ad19b5d685 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
@@ -4,6 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfapi/fpdf_module.h"
#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fpdfapi/fpdf_serial.h"
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
index 878dc2ab2a..ac01bf901c 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
@@ -8,6 +8,7 @@
#include <vector>
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfapi/fpdf_parser.h"
#include "core/include/fpdfapi/fpdf_serial.h"
#include "core/include/fxcrt/fx_ext.h"
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
index bc3de20857..8b1571a496 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
@@ -6,6 +6,7 @@
#include <limits.h>
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfapi/fpdf_module.h"
#include "core/include/fpdfapi/fpdf_page.h"
#include "core/src/fpdfapi/fpdf_page/pageint.h"
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
index 2b68a0403f..0d2f83682e 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
@@ -4,6 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfapi/fpdf_module.h"
#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fpdfapi/fpdf_render.h"
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
index ecdb2d7deb..d9bc148326 100644
--- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
+++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
@@ -6,6 +6,7 @@
#include "core/src/fpdfapi/fpdf_font/font_int.h"
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfapi/fpdf_module.h"
#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fpdfapi/fpdf_pageobj.h"
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
index 77707624d2..1868d263d3 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
@@ -8,6 +8,7 @@
#include <algorithm>
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfapi/fpdf_module.h"
#include "core/include/fpdfapi/fpdf_page.h"
#include "third_party/base/stl_util.h"
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
index 49fb331a94..a43aff18cb 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
@@ -10,6 +10,7 @@
#include <algorithm>
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfapi/fpdf_module.h"
#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fxcodec/fx_codec.h"
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp
index 85b026f8e8..fbf236d472 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp
@@ -7,6 +7,7 @@
#include "core/src/fpdfapi/fpdf_page/pageint.h"
#include "core/include/fdrm/fx_crypt.h"
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfapi/fpdf_module.h"
#include "core/include/fpdfapi/fpdf_page.h"
#include "core/src/fpdfapi/fpdf_font/font_int.h"
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
index a294d3bce7..eff2ff4009 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
@@ -8,6 +8,7 @@
#include <algorithm>
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfapi/fpdf_module.h"
#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fpdfapi/fpdf_pageobj.h"
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp
index c5e29a4b77..64d3264128 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp
@@ -6,6 +6,7 @@
#include "core/src/fpdfapi/fpdf_page/pageint.h"
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fpdfapi/fpdf_pageobj.h"
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index 1df4f3db37..7114f764ac 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -6,6 +6,7 @@
#include "core/src/fpdfapi/fpdf_page/pageint.h"
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfapi/fpdf_module.h"
#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fpdfapi/fpdf_serial.h"
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index b49607e743..a808c2948b 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -8,6 +8,7 @@
#include <limits.h>
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfapi/fpdf_module.h"
#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fxcodec/fx_codec.h"
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
index d56e65c084..0287b4fed3 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
@@ -6,6 +6,7 @@
#include "core/src/fpdfapi/fpdf_page/pageint.h"
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfapi/fpdf_page.h"
namespace {
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp b/core/src/fpdfapi/fpdf_parser/cpdf_document.cpp
index a63b0ed336..f837c00509 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
+++ b/core/src/fpdfapi/fpdf_parser/cpdf_document.cpp
@@ -4,11 +4,14 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "core/include/fpdfapi/fpdf_parser.h"
+#include "core/include/fpdfapi/cpdf_document.h"
#include <set>
#include "core/include/fpdfapi/fpdf_module.h"
+#include "core/include/fpdfapi/fpdf_parser.h"
+#include "core/include/fxge/fx_font.h"
+#include "core/src/fpdfapi/fpdf_render/render_int.h"
#include "third_party/base/stl_util.h"
namespace {
@@ -336,3 +339,12 @@ void CPDF_Document::ClearRenderData() {
if (m_pDocRender)
CPDF_ModuleMgr::Get()->GetRenderModule()->ClearDocData(m_pDocRender);
}
+
+void CPDF_Document::ClearRenderFont() {
+ if (!m_pDocRender)
+ return;
+
+ CFX_FontCache* pCache = m_pDocRender->GetFontCache();
+ if (pCache)
+ pCache->FreeCache(FALSE);
+}
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index a00d1bc98d..2b61cdc2a2 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -12,6 +12,7 @@
#include <utility>
#include <vector>
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfapi/fpdf_module.h"
#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fxcrt/fx_ext.h"
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp
index 4c7abea30c..c054f95abd 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp
@@ -6,6 +6,7 @@
#include "core/src/fpdfapi/fpdf_render/render_int.h"
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfapi/fpdf_module.h"
#include "core/include/fpdfapi/fpdf_render.h"
#include "core/include/fxge/fx_ge.h"
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp
index d95885f434..9636d1b23a 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp
@@ -6,6 +6,7 @@
#include "core/src/fpdfapi/fpdf_render/render_int.h"
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfapi/fpdf_pageobj.h"
#include "core/include/fpdfapi/fpdf_render.h"
#include "core/include/fxge/fx_ge.h"
@@ -331,11 +332,3 @@ void CPDF_ImageCacheEntry::CalcSize() {
m_dwCacheSize = FPDF_ImageCache_EstimateImageSize(m_pCachedBitmap) +
FPDF_ImageCache_EstimateImageSize(m_pCachedMask);
}
-void CPDF_Document::ClearRenderFont() {
- if (m_pDocRender) {
- CFX_FontCache* pCache = m_pDocRender->GetFontCache();
- if (pCache) {
- pCache->FreeCache(FALSE);
- }
- }
-}
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
index b91f258371..0f9b88e638 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
@@ -9,6 +9,7 @@
#include <utility>
#include <vector>
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfapi/fpdf_module.h"
#include "core/include/fpdfapi/fpdf_pageobj.h"
#include "core/include/fpdfapi/fpdf_render.h"
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
index 2aa1b0e6df..709733c56f 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
@@ -10,6 +10,7 @@
#include <memory>
#include <vector>
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfapi/fpdf_module.h"
#include "core/include/fpdfapi/fpdf_pageobj.h"
#include "core/include/fpdfapi/fpdf_render.h"
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
index aa10809496..7051537ef3 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
@@ -6,6 +6,7 @@
#include "core/src/fpdfapi/fpdf_render/render_int.h"
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfapi/fpdf_pageobj.h"
#include "core/include/fpdfapi/fpdf_render.h"
#include "core/include/fxge/fx_ge.h"
diff --git a/core/src/fpdfdoc/doc_action.cpp b/core/src/fpdfdoc/doc_action.cpp
index 94235d2aee..9a0ba57951 100644
--- a/core/src/fpdfdoc/doc_action.cpp
+++ b/core/src/fpdfdoc/doc_action.cpp
@@ -4,6 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfdoc/fpdf_doc.h"
CPDF_Dest CPDF_Action::GetDest(CPDF_Document* pDoc) const {
diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp
index 09b6e8d673..07fca72cab 100644
--- a/core/src/fpdfdoc/doc_annot.cpp
+++ b/core/src/fpdfdoc/doc_annot.cpp
@@ -4,6 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfapi/fpdf_pageobj.h"
#include "core/include/fpdfdoc/fpdf_doc.h"
diff --git a/core/src/fpdfdoc/doc_ap.cpp b/core/src/fpdfdoc/doc_ap.cpp
index 7fe06e2b5d..3028169cd9 100644
--- a/core/src/fpdfdoc/doc_ap.cpp
+++ b/core/src/fpdfdoc/doc_ap.cpp
@@ -4,6 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfdoc/fpdf_ap.h"
#include "core/include/fpdfdoc/fpdf_doc.h"
#include "core/include/fpdfdoc/fpdf_vt.h"
diff --git a/core/src/fpdfdoc/doc_basic.cpp b/core/src/fpdfdoc/doc_basic.cpp
index bc88ddc828..09d74f546a 100644
--- a/core/src/fpdfdoc/doc_basic.cpp
+++ b/core/src/fpdfdoc/doc_basic.cpp
@@ -4,6 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfdoc/fpdf_doc.h"
const int nMaxRecursion = 32;
diff --git a/core/src/fpdfdoc/doc_bookmark.cpp b/core/src/fpdfdoc/doc_bookmark.cpp
index d7e2e2fcab..71c8f039f0 100644
--- a/core/src/fpdfdoc/doc_bookmark.cpp
+++ b/core/src/fpdfdoc/doc_bookmark.cpp
@@ -7,6 +7,7 @@
#include <memory>
#include <vector>
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfdoc/fpdf_doc.h"
CPDF_Bookmark CPDF_BookmarkTree::GetFirstChild(
diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp
index 7a6db90f32..8080dc7597 100644
--- a/core/src/fpdfdoc/doc_form.cpp
+++ b/core/src/fpdfdoc/doc_form.cpp
@@ -4,6 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfdoc/fpdf_doc.h"
#include "core/src/fpdfdoc/doc_utils.h"
#include "third_party/base/stl_util.h"
diff --git a/core/src/fpdfdoc/doc_formcontrol.cpp b/core/src/fpdfdoc/doc_formcontrol.cpp
index 4cfd4527e2..665da0acef 100644
--- a/core/src/fpdfdoc/doc_formcontrol.cpp
+++ b/core/src/fpdfdoc/doc_formcontrol.cpp
@@ -6,6 +6,7 @@
#include <algorithm>
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfdoc/fpdf_doc.h"
CPDF_FormControl::CPDF_FormControl(CPDF_FormField* pField,
diff --git a/core/src/fpdfdoc/doc_formfield.cpp b/core/src/fpdfdoc/doc_formfield.cpp
index a7cc484361..915af33c29 100644
--- a/core/src/fpdfdoc/doc_formfield.cpp
+++ b/core/src/fpdfdoc/doc_formfield.cpp
@@ -4,6 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfdoc/fpdf_doc.h"
#include "core/src/fpdfdoc/doc_utils.h"
diff --git a/core/src/fpdfdoc/doc_metadata.cpp b/core/src/fpdfdoc/doc_metadata.cpp
index 593cffbebb..78364c4cbf 100644
--- a/core/src/fpdfdoc/doc_metadata.cpp
+++ b/core/src/fpdfdoc/doc_metadata.cpp
@@ -4,6 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfdoc/fpdf_doc.h"
#include "core/include/fxcrt/fx_xml.h"
diff --git a/core/src/fpdfdoc/doc_ocg.cpp b/core/src/fpdfdoc/doc_ocg.cpp
index a18924c1dc..6f6e54675b 100644
--- a/core/src/fpdfdoc/doc_ocg.cpp
+++ b/core/src/fpdfdoc/doc_ocg.cpp
@@ -4,6 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfdoc/fpdf_doc.h"
static int32_t FPDFDOC_OCG_FindGroup(const CPDF_Object* pObject,
diff --git a/core/src/fpdfdoc/doc_tagged.cpp b/core/src/fpdfdoc/doc_tagged.cpp
index a7eea11b02..d4ce4a4b31 100644
--- a/core/src/fpdfdoc/doc_tagged.cpp
+++ b/core/src/fpdfdoc/doc_tagged.cpp
@@ -4,6 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fpdfapi/fpdf_parser.h"
#include "core/include/fpdfdoc/fpdf_tagged.h"
diff --git a/core/src/fpdfdoc/doc_utils.cpp b/core/src/fpdfdoc/doc_utils.cpp
index 67a9324251..bc09c9a2c4 100644
--- a/core/src/fpdfdoc/doc_utils.cpp
+++ b/core/src/fpdfdoc/doc_utils.cpp
@@ -6,6 +6,7 @@
#include <algorithm>
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfdoc/fpdf_doc.h"
#include "core/src/fpdfdoc/doc_utils.h"
diff --git a/core/src/fpdfdoc/doc_viewerPreferences.cpp b/core/src/fpdfdoc/doc_viewerPreferences.cpp
index 6ef09255c6..582f3a5a93 100644
--- a/core/src/fpdfdoc/doc_viewerPreferences.cpp
+++ b/core/src/fpdfdoc/doc_viewerPreferences.cpp
@@ -4,6 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "core/include/fpdfapi/cpdf_document.h"
#include "core/include/fpdfdoc/fpdf_doc.h"
CPDF_ViewerPreferences::CPDF_ViewerPreferences(CPDF_Document* pDoc)