From 310438fb97a2363bd0901401ad2506febd64361b Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 8 Mar 2016 13:10:55 -0800 Subject: Split off CPDF_Document into its own .cpp/.h files. R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1780503002 . --- BUILD.gn | 3 +- core/include/fpdfapi/cpdf_document.h | 124 ++++++++ core/include/fpdfapi/fpdf_parser.h | 127 +------- core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp | 1 + core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp | 1 + core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp | 1 + core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp | 1 + core/src/fpdfapi/fpdf_font/fpdf_font.cpp | 1 + core/src/fpdfapi/fpdf_page/fpdf_page.cpp | 1 + core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp | 1 + core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp | 1 + .../fpdfapi/fpdf_page/fpdf_page_graph_state.cpp | 1 + core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp | 1 + core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp | 1 + .../src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp | 1 + core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp | 1 + core/src/fpdfapi/fpdf_parser/cpdf_document.cpp | 350 +++++++++++++++++++++ .../fpdfapi/fpdf_parser/fpdf_parser_document.cpp | 338 -------------------- .../src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp | 1 + core/src/fpdfapi/fpdf_render/fpdf_render.cpp | 1 + core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp | 9 +- core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp | 1 + .../fpdfapi/fpdf_render/fpdf_render_loadimage.cpp | 1 + core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp | 1 + core/src/fpdfdoc/doc_action.cpp | 1 + core/src/fpdfdoc/doc_annot.cpp | 1 + core/src/fpdfdoc/doc_ap.cpp | 1 + core/src/fpdfdoc/doc_basic.cpp | 1 + core/src/fpdfdoc/doc_bookmark.cpp | 1 + core/src/fpdfdoc/doc_form.cpp | 1 + core/src/fpdfdoc/doc_formcontrol.cpp | 1 + core/src/fpdfdoc/doc_formfield.cpp | 1 + core/src/fpdfdoc/doc_metadata.cpp | 1 + core/src/fpdfdoc/doc_ocg.cpp | 1 + core/src/fpdfdoc/doc_tagged.cpp | 1 + core/src/fpdfdoc/doc_utils.cpp | 1 + core/src/fpdfdoc/doc_viewerPreferences.cpp | 1 + fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp | 1 + fpdfsdk/src/formfiller/FFL_IFormFiller.cpp | 1 + fpdfsdk/src/fpdf_dataavail.cpp | 1 + fpdfsdk/src/fpdf_ext.cpp | 1 + fpdfsdk/src/fpdf_flatten.cpp | 1 + fpdfsdk/src/fpdf_transformpage.cpp | 1 + fpdfsdk/src/fpdfdoc.cpp | 1 + fpdfsdk/src/fpdfdoc_unittest.cpp | 1 + fpdfsdk/src/fpdfeditpage.cpp | 1 + fpdfsdk/src/fpdfformfill.cpp | 1 + fpdfsdk/src/fpdfppo.cpp | 1 + fpdfsdk/src/fpdfsave.cpp | 1 + fpdfsdk/src/fpdfview.cpp | 1 + fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp | 1 + fpdfsdk/src/fpdfxfa/fpdfxfa_page.cpp | 1 + fpdfsdk/src/fsdk_annothandler.cpp | 1 + fpdfsdk/src/fsdk_baseannot.cpp | 1 + fpdfsdk/src/fsdk_baseform.cpp | 1 + fpdfsdk/src/fsdk_mgr.cpp | 5 +- fpdfsdk/src/javascript/Document.cpp | 1 + fpdfsdk/src/pdfwindow/PWL_FontMap.cpp | 1 + pdfium.gyp | 3 +- xfa/src/fxfa/app/xfa_ffdoc.cpp | 1 + xfa/src/fxfa/app/xfa_fontmgr.cpp | 1 + 61 files changed, 536 insertions(+), 476 deletions(-) create mode 100644 core/include/fpdfapi/cpdf_document.h create mode 100644 core/src/fpdfapi/fpdf_parser/cpdf_document.cpp delete mode 100644 core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp diff --git a/BUILD.gn b/BUILD.gn index 007f2ae7d2..06f33a72b7 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -237,6 +237,7 @@ static_library("fpdfdoc") { static_library("fpdfapi") { sources = [ + "core/include/fpdfapi/cpdf_document.h", "core/include/fpdfapi/fpdf_module.h", "core/include/fpdfapi/fpdf_objects.h", "core/include/fpdfapi/fpdf_page.h", @@ -331,10 +332,10 @@ static_library("fpdfapi") { "core/src/fpdfapi/fpdf_page/fpdf_page_path.cpp", "core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp", "core/src/fpdfapi/fpdf_page/pageint.h", + "core/src/fpdfapi/fpdf_parser/cpdf_document.cpp", "core/src/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp", "core/src/fpdfapi/fpdf_parser/cpdf_syntax_parser.h", "core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp", - "core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp", "core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp", "core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp", "core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp", 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 +#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 +#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 +#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 +#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 +#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 +#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/cpdf_document.cpp b/core/src/fpdfapi/fpdf_parser/cpdf_document.cpp new file mode 100644 index 0000000000..f837c00509 --- /dev/null +++ b/core/src/fpdfapi/fpdf_parser/cpdf_document.cpp @@ -0,0 +1,350 @@ +// Copyright 2014 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 + +#include "core/include/fpdfapi/cpdf_document.h" + +#include + +#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 { + +int CountPages(CPDF_Dictionary* pPages, + std::set* visited_pages) { + int count = pPages->GetIntegerBy("Count"); + if (count > 0 && count < FPDF_PAGE_MAX_NUM) { + return count; + } + CPDF_Array* pKidList = pPages->GetArrayBy("Kids"); + if (!pKidList) { + return 0; + } + count = 0; + for (FX_DWORD i = 0; i < pKidList->GetCount(); i++) { + CPDF_Dictionary* pKid = pKidList->GetDictAt(i); + if (!pKid || pdfium::ContainsKey(*visited_pages, pKid)) { + continue; + } + if (pKid->KeyExist("Kids")) { + // Use |visited_pages| to help detect circular references of pages. + ScopedSetInsertion local_add(visited_pages, pKid); + count += CountPages(pKid, visited_pages); + } else { + // This page is a leaf node. + count++; + } + } + pPages->SetAtInteger("Count", count); + return count; +} + +} // namespace + +CPDF_Document::CPDF_Document(CPDF_Parser* pParser) + : CPDF_IndirectObjectHolder(pParser) { + ASSERT(pParser); + m_pRootDict = NULL; + m_pInfoDict = NULL; + m_bLinearized = FALSE; + m_dwFirstPageNo = 0; + m_dwFirstPageObjNum = 0; + m_pDocPage = CPDF_ModuleMgr::Get()->GetPageModule()->CreateDocData(this); + m_pDocRender = CPDF_ModuleMgr::Get()->GetRenderModule()->CreateDocData(this); +} +CPDF_DocPageData* CPDF_Document::GetValidatePageData() { + if (m_pDocPage) { + return m_pDocPage; + } + m_pDocPage = CPDF_ModuleMgr::Get()->GetPageModule()->CreateDocData(this); + return m_pDocPage; +} +CPDF_DocRenderData* CPDF_Document::GetValidateRenderData() { + if (m_pDocRender) { + return m_pDocRender; + } + m_pDocRender = CPDF_ModuleMgr::Get()->GetRenderModule()->CreateDocData(this); + return m_pDocRender; +} +void CPDF_Document::LoadDoc() { + m_LastObjNum = m_pParser->GetLastObjNum(); + CPDF_Object* pRootObj = GetIndirectObject(m_pParser->GetRootObjNum()); + if (!pRootObj) { + return; + } + m_pRootDict = pRootObj->GetDict(); + if (!m_pRootDict) { + return; + } + CPDF_Object* pInfoObj = GetIndirectObject(m_pParser->GetInfoObjNum()); + if (pInfoObj) { + m_pInfoDict = pInfoObj->GetDict(); + } + CPDF_Array* pIDArray = m_pParser->GetIDArray(); + if (pIDArray) { + m_ID1 = pIDArray->GetStringAt(0); + m_ID2 = pIDArray->GetStringAt(1); + } + m_PageList.SetSize(RetrievePageCount()); +} +void CPDF_Document::LoadAsynDoc(CPDF_Dictionary* pLinearized) { + m_bLinearized = TRUE; + m_LastObjNum = m_pParser->GetLastObjNum(); + CPDF_Object* pIndirectObj = GetIndirectObject(m_pParser->GetRootObjNum()); + m_pRootDict = pIndirectObj ? pIndirectObj->GetDict() : nullptr; + if (!m_pRootDict) { + return; + } + pIndirectObj = GetIndirectObject(m_pParser->GetInfoObjNum()); + m_pInfoDict = pIndirectObj ? pIndirectObj->GetDict() : nullptr; + CPDF_Array* pIDArray = m_pParser->GetIDArray(); + if (pIDArray) { + m_ID1 = pIDArray->GetStringAt(0); + m_ID2 = pIDArray->GetStringAt(1); + } + FX_DWORD dwPageCount = 0; + CPDF_Object* pCount = pLinearized->GetElement("N"); + if (ToNumber(pCount)) + dwPageCount = pCount->GetInteger(); + + m_PageList.SetSize(dwPageCount); + CPDF_Object* pNo = pLinearized->GetElement("P"); + if (ToNumber(pNo)) + m_dwFirstPageNo = pNo->GetInteger(); + + CPDF_Object* pObjNum = pLinearized->GetElement("O"); + if (ToNumber(pObjNum)) + m_dwFirstPageObjNum = pObjNum->GetInteger(); +} +void CPDF_Document::LoadPages() { + m_PageList.SetSize(RetrievePageCount()); +} +CPDF_Document::~CPDF_Document() { + if (m_pDocPage) { + CPDF_ModuleMgr::Get()->GetPageModule()->ReleaseDoc(this); + CPDF_ModuleMgr::Get()->GetPageModule()->ClearStockFont(this); + } + if (m_pDocRender) { + CPDF_ModuleMgr::Get()->GetRenderModule()->DestroyDocData(m_pDocRender); + } +} +#define FX_MAX_PAGE_LEVEL 1024 +CPDF_Dictionary* CPDF_Document::_FindPDFPage(CPDF_Dictionary* pPages, + int iPage, + int nPagesToGo, + int level) { + CPDF_Array* pKidList = pPages->GetArrayBy("Kids"); + if (!pKidList) { + if (nPagesToGo == 0) { + return pPages; + } + return NULL; + } + if (level >= FX_MAX_PAGE_LEVEL) { + return NULL; + } + int nKids = pKidList->GetCount(); + for (int i = 0; i < nKids; i++) { + CPDF_Dictionary* pKid = pKidList->GetDictAt(i); + if (!pKid) { + nPagesToGo--; + continue; + } + if (pKid == pPages) { + continue; + } + if (!pKid->KeyExist("Kids")) { + if (nPagesToGo == 0) { + return pKid; + } + m_PageList.SetAt(iPage - nPagesToGo, pKid->GetObjNum()); + nPagesToGo--; + } else { + int nPages = pKid->GetIntegerBy("Count"); + if (nPagesToGo < nPages) { + return _FindPDFPage(pKid, iPage, nPagesToGo, level + 1); + } + nPagesToGo -= nPages; + } + } + return NULL; +} + +CPDF_Dictionary* CPDF_Document::GetPage(int iPage) { + if (iPage < 0 || iPage >= m_PageList.GetSize()) + return nullptr; + + if (m_bLinearized && (iPage == (int)m_dwFirstPageNo)) { + if (CPDF_Dictionary* pDict = + ToDictionary(GetIndirectObject(m_dwFirstPageObjNum))) { + return pDict; + } + } + + int objnum = m_PageList.GetAt(iPage); + if (objnum) { + if (CPDF_Dictionary* pDict = ToDictionary(GetIndirectObject(objnum))) + return pDict; + } + + CPDF_Dictionary* pRoot = GetRoot(); + if (!pRoot) + return nullptr; + + CPDF_Dictionary* pPages = pRoot->GetDictBy("Pages"); + if (!pPages) + return nullptr; + + CPDF_Dictionary* pPage = _FindPDFPage(pPages, iPage, iPage, 0); + if (!pPage) + return nullptr; + + m_PageList.SetAt(iPage, pPage->GetObjNum()); + return pPage; +} + +int CPDF_Document::_FindPageIndex(CPDF_Dictionary* pNode, + FX_DWORD& skip_count, + FX_DWORD objnum, + int& index, + int level) { + if (pNode->KeyExist("Kids")) { + CPDF_Array* pKidList = pNode->GetArrayBy("Kids"); + if (!pKidList) { + return -1; + } + if (level >= FX_MAX_PAGE_LEVEL) { + return -1; + } + FX_DWORD count = pNode->GetIntegerBy("Count"); + if (count <= skip_count) { + skip_count -= count; + index += count; + return -1; + } + if (count && count == pKidList->GetCount()) { + for (FX_DWORD i = 0; i < count; i++) { + if (CPDF_Reference* pKid = ToReference(pKidList->GetElement(i))) { + if (pKid->GetRefObjNum() == objnum) { + m_PageList.SetAt(index + i, objnum); + return index + i; + } + } + } + } + for (FX_DWORD i = 0; i < pKidList->GetCount(); i++) { + CPDF_Dictionary* pKid = pKidList->GetDictAt(i); + if (!pKid) { + continue; + } + if (pKid == pNode) { + continue; + } + int found_index = + _FindPageIndex(pKid, skip_count, objnum, index, level + 1); + if (found_index >= 0) { + return found_index; + } + } + } else { + if (objnum == pNode->GetObjNum()) { + return index; + } + if (skip_count) { + skip_count--; + } + index++; + } + return -1; +} +int CPDF_Document::GetPageIndex(FX_DWORD objnum) { + FX_DWORD nPages = m_PageList.GetSize(); + FX_DWORD skip_count = 0; + FX_BOOL bSkipped = FALSE; + for (FX_DWORD i = 0; i < nPages; i++) { + FX_DWORD objnum1 = m_PageList.GetAt(i); + if (objnum1 == objnum) { + return i; + } + if (!bSkipped && objnum1 == 0) { + skip_count = i; + bSkipped = TRUE; + } + } + CPDF_Dictionary* pRoot = GetRoot(); + if (!pRoot) { + return -1; + } + CPDF_Dictionary* pPages = pRoot->GetDictBy("Pages"); + if (!pPages) { + return -1; + } + int index = 0; + return _FindPageIndex(pPages, skip_count, objnum, index); +} +int CPDF_Document::GetPageCount() const { + return m_PageList.GetSize(); +} + +int CPDF_Document::RetrievePageCount() const { + CPDF_Dictionary* pRoot = GetRoot(); + if (!pRoot) { + return 0; + } + CPDF_Dictionary* pPages = pRoot->GetDictBy("Pages"); + if (!pPages) { + return 0; + } + if (!pPages->KeyExist("Kids")) { + return 1; + } + std::set visited_pages; + visited_pages.insert(pPages); + return CountPages(pPages, &visited_pages); +} + +FX_DWORD CPDF_Document::GetUserPermissions(FX_BOOL bCheckRevision) const { + if (!m_pParser) { + return (FX_DWORD)-1; + } + return m_pParser->GetPermissions(bCheckRevision); +} + +FX_BOOL CPDF_Document::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const { + auto it = m_IndirectObjs.find(objnum); + if (it != m_IndirectObjs.end()) { + CPDF_Stream* pStream = it->second->AsStream(); + bForm = pStream && pStream->GetDict()->GetStringBy("Subtype") == "Form"; + return TRUE; + } + if (!m_pParser) { + bForm = FALSE; + return TRUE; + } + return m_pParser->IsFormStream(objnum, bForm); +} + +void CPDF_Document::ClearPageData() { + if (m_pDocPage) + CPDF_ModuleMgr::Get()->GetPageModule()->ClearDoc(this); +} + +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_document.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp deleted file mode 100644 index a63b0ed336..0000000000 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp +++ /dev/null @@ -1,338 +0,0 @@ -// Copyright 2014 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 - -#include "core/include/fpdfapi/fpdf_parser.h" - -#include - -#include "core/include/fpdfapi/fpdf_module.h" -#include "third_party/base/stl_util.h" - -namespace { - -int CountPages(CPDF_Dictionary* pPages, - std::set* visited_pages) { - int count = pPages->GetIntegerBy("Count"); - if (count > 0 && count < FPDF_PAGE_MAX_NUM) { - return count; - } - CPDF_Array* pKidList = pPages->GetArrayBy("Kids"); - if (!pKidList) { - return 0; - } - count = 0; - for (FX_DWORD i = 0; i < pKidList->GetCount(); i++) { - CPDF_Dictionary* pKid = pKidList->GetDictAt(i); - if (!pKid || pdfium::ContainsKey(*visited_pages, pKid)) { - continue; - } - if (pKid->KeyExist("Kids")) { - // Use |visited_pages| to help detect circular references of pages. - ScopedSetInsertion local_add(visited_pages, pKid); - count += CountPages(pKid, visited_pages); - } else { - // This page is a leaf node. - count++; - } - } - pPages->SetAtInteger("Count", count); - return count; -} - -} // namespace - -CPDF_Document::CPDF_Document(CPDF_Parser* pParser) - : CPDF_IndirectObjectHolder(pParser) { - ASSERT(pParser); - m_pRootDict = NULL; - m_pInfoDict = NULL; - m_bLinearized = FALSE; - m_dwFirstPageNo = 0; - m_dwFirstPageObjNum = 0; - m_pDocPage = CPDF_ModuleMgr::Get()->GetPageModule()->CreateDocData(this); - m_pDocRender = CPDF_ModuleMgr::Get()->GetRenderModule()->CreateDocData(this); -} -CPDF_DocPageData* CPDF_Document::GetValidatePageData() { - if (m_pDocPage) { - return m_pDocPage; - } - m_pDocPage = CPDF_ModuleMgr::Get()->GetPageModule()->CreateDocData(this); - return m_pDocPage; -} -CPDF_DocRenderData* CPDF_Document::GetValidateRenderData() { - if (m_pDocRender) { - return m_pDocRender; - } - m_pDocRender = CPDF_ModuleMgr::Get()->GetRenderModule()->CreateDocData(this); - return m_pDocRender; -} -void CPDF_Document::LoadDoc() { - m_LastObjNum = m_pParser->GetLastObjNum(); - CPDF_Object* pRootObj = GetIndirectObject(m_pParser->GetRootObjNum()); - if (!pRootObj) { - return; - } - m_pRootDict = pRootObj->GetDict(); - if (!m_pRootDict) { - return; - } - CPDF_Object* pInfoObj = GetIndirectObject(m_pParser->GetInfoObjNum()); - if (pInfoObj) { - m_pInfoDict = pInfoObj->GetDict(); - } - CPDF_Array* pIDArray = m_pParser->GetIDArray(); - if (pIDArray) { - m_ID1 = pIDArray->GetStringAt(0); - m_ID2 = pIDArray->GetStringAt(1); - } - m_PageList.SetSize(RetrievePageCount()); -} -void CPDF_Document::LoadAsynDoc(CPDF_Dictionary* pLinearized) { - m_bLinearized = TRUE; - m_LastObjNum = m_pParser->GetLastObjNum(); - CPDF_Object* pIndirectObj = GetIndirectObject(m_pParser->GetRootObjNum()); - m_pRootDict = pIndirectObj ? pIndirectObj->GetDict() : nullptr; - if (!m_pRootDict) { - return; - } - pIndirectObj = GetIndirectObject(m_pParser->GetInfoObjNum()); - m_pInfoDict = pIndirectObj ? pIndirectObj->GetDict() : nullptr; - CPDF_Array* pIDArray = m_pParser->GetIDArray(); - if (pIDArray) { - m_ID1 = pIDArray->GetStringAt(0); - m_ID2 = pIDArray->GetStringAt(1); - } - FX_DWORD dwPageCount = 0; - CPDF_Object* pCount = pLinearized->GetElement("N"); - if (ToNumber(pCount)) - dwPageCount = pCount->GetInteger(); - - m_PageList.SetSize(dwPageCount); - CPDF_Object* pNo = pLinearized->GetElement("P"); - if (ToNumber(pNo)) - m_dwFirstPageNo = pNo->GetInteger(); - - CPDF_Object* pObjNum = pLinearized->GetElement("O"); - if (ToNumber(pObjNum)) - m_dwFirstPageObjNum = pObjNum->GetInteger(); -} -void CPDF_Document::LoadPages() { - m_PageList.SetSize(RetrievePageCount()); -} -CPDF_Document::~CPDF_Document() { - if (m_pDocPage) { - CPDF_ModuleMgr::Get()->GetPageModule()->ReleaseDoc(this); - CPDF_ModuleMgr::Get()->GetPageModule()->ClearStockFont(this); - } - if (m_pDocRender) { - CPDF_ModuleMgr::Get()->GetRenderModule()->DestroyDocData(m_pDocRender); - } -} -#define FX_MAX_PAGE_LEVEL 1024 -CPDF_Dictionary* CPDF_Document::_FindPDFPage(CPDF_Dictionary* pPages, - int iPage, - int nPagesToGo, - int level) { - CPDF_Array* pKidList = pPages->GetArrayBy("Kids"); - if (!pKidList) { - if (nPagesToGo == 0) { - return pPages; - } - return NULL; - } - if (level >= FX_MAX_PAGE_LEVEL) { - return NULL; - } - int nKids = pKidList->GetCount(); - for (int i = 0; i < nKids; i++) { - CPDF_Dictionary* pKid = pKidList->GetDictAt(i); - if (!pKid) { - nPagesToGo--; - continue; - } - if (pKid == pPages) { - continue; - } - if (!pKid->KeyExist("Kids")) { - if (nPagesToGo == 0) { - return pKid; - } - m_PageList.SetAt(iPage - nPagesToGo, pKid->GetObjNum()); - nPagesToGo--; - } else { - int nPages = pKid->GetIntegerBy("Count"); - if (nPagesToGo < nPages) { - return _FindPDFPage(pKid, iPage, nPagesToGo, level + 1); - } - nPagesToGo -= nPages; - } - } - return NULL; -} - -CPDF_Dictionary* CPDF_Document::GetPage(int iPage) { - if (iPage < 0 || iPage >= m_PageList.GetSize()) - return nullptr; - - if (m_bLinearized && (iPage == (int)m_dwFirstPageNo)) { - if (CPDF_Dictionary* pDict = - ToDictionary(GetIndirectObject(m_dwFirstPageObjNum))) { - return pDict; - } - } - - int objnum = m_PageList.GetAt(iPage); - if (objnum) { - if (CPDF_Dictionary* pDict = ToDictionary(GetIndirectObject(objnum))) - return pDict; - } - - CPDF_Dictionary* pRoot = GetRoot(); - if (!pRoot) - return nullptr; - - CPDF_Dictionary* pPages = pRoot->GetDictBy("Pages"); - if (!pPages) - return nullptr; - - CPDF_Dictionary* pPage = _FindPDFPage(pPages, iPage, iPage, 0); - if (!pPage) - return nullptr; - - m_PageList.SetAt(iPage, pPage->GetObjNum()); - return pPage; -} - -int CPDF_Document::_FindPageIndex(CPDF_Dictionary* pNode, - FX_DWORD& skip_count, - FX_DWORD objnum, - int& index, - int level) { - if (pNode->KeyExist("Kids")) { - CPDF_Array* pKidList = pNode->GetArrayBy("Kids"); - if (!pKidList) { - return -1; - } - if (level >= FX_MAX_PAGE_LEVEL) { - return -1; - } - FX_DWORD count = pNode->GetIntegerBy("Count"); - if (count <= skip_count) { - skip_count -= count; - index += count; - return -1; - } - if (count && count == pKidList->GetCount()) { - for (FX_DWORD i = 0; i < count; i++) { - if (CPDF_Reference* pKid = ToReference(pKidList->GetElement(i))) { - if (pKid->GetRefObjNum() == objnum) { - m_PageList.SetAt(index + i, objnum); - return index + i; - } - } - } - } - for (FX_DWORD i = 0; i < pKidList->GetCount(); i++) { - CPDF_Dictionary* pKid = pKidList->GetDictAt(i); - if (!pKid) { - continue; - } - if (pKid == pNode) { - continue; - } - int found_index = - _FindPageIndex(pKid, skip_count, objnum, index, level + 1); - if (found_index >= 0) { - return found_index; - } - } - } else { - if (objnum == pNode->GetObjNum()) { - return index; - } - if (skip_count) { - skip_count--; - } - index++; - } - return -1; -} -int CPDF_Document::GetPageIndex(FX_DWORD objnum) { - FX_DWORD nPages = m_PageList.GetSize(); - FX_DWORD skip_count = 0; - FX_BOOL bSkipped = FALSE; - for (FX_DWORD i = 0; i < nPages; i++) { - FX_DWORD objnum1 = m_PageList.GetAt(i); - if (objnum1 == objnum) { - return i; - } - if (!bSkipped && objnum1 == 0) { - skip_count = i; - bSkipped = TRUE; - } - } - CPDF_Dictionary* pRoot = GetRoot(); - if (!pRoot) { - return -1; - } - CPDF_Dictionary* pPages = pRoot->GetDictBy("Pages"); - if (!pPages) { - return -1; - } - int index = 0; - return _FindPageIndex(pPages, skip_count, objnum, index); -} -int CPDF_Document::GetPageCount() const { - return m_PageList.GetSize(); -} - -int CPDF_Document::RetrievePageCount() const { - CPDF_Dictionary* pRoot = GetRoot(); - if (!pRoot) { - return 0; - } - CPDF_Dictionary* pPages = pRoot->GetDictBy("Pages"); - if (!pPages) { - return 0; - } - if (!pPages->KeyExist("Kids")) { - return 1; - } - std::set visited_pages; - visited_pages.insert(pPages); - return CountPages(pPages, &visited_pages); -} - -FX_DWORD CPDF_Document::GetUserPermissions(FX_BOOL bCheckRevision) const { - if (!m_pParser) { - return (FX_DWORD)-1; - } - return m_pParser->GetPermissions(bCheckRevision); -} - -FX_BOOL CPDF_Document::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const { - auto it = m_IndirectObjs.find(objnum); - if (it != m_IndirectObjs.end()) { - CPDF_Stream* pStream = it->second->AsStream(); - bForm = pStream && pStream->GetDict()->GetStringBy("Subtype") == "Form"; - return TRUE; - } - if (!m_pParser) { - bForm = FALSE; - return TRUE; - } - return m_pParser->IsFormStream(objnum, bForm); -} - -void CPDF_Document::ClearPageData() { - if (m_pDocPage) - CPDF_ModuleMgr::Get()->GetPageModule()->ClearDoc(this); -} - -void CPDF_Document::ClearRenderData() { - if (m_pDocRender) - CPDF_ModuleMgr::Get()->GetRenderModule()->ClearDocData(m_pDocRender); -} 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 #include +#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 #include +#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 #include +#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 #include +#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 +#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 +#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) diff --git a/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp b/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp index b28cdf7749..fecc2c6581 100644 --- a/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp +++ b/fpdfsdk/src/formfiller/FFL_CBA_Fontmap.cpp @@ -6,6 +6,7 @@ #include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h" +#include "core/include/fpdfapi/cpdf_document.h" #include "core/include/fpdfapi/fpdf_page.h" #include "fpdfsdk/include/fsdk_baseannot.h" diff --git a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp index 2cad12b4e8..75f18e7c73 100644 --- a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp +++ b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp @@ -6,6 +6,7 @@ #include "fpdfsdk/include/formfiller/FFL_IFormFiller.h" +#include "core/include/fpdfapi/cpdf_document.h" #include "fpdfsdk/include/formfiller/FFL_CheckBox.h" #include "fpdfsdk/include/formfiller/FFL_ComboBox.h" #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" diff --git a/fpdfsdk/src/fpdf_dataavail.cpp b/fpdfsdk/src/fpdf_dataavail.cpp index 866e41edfc..1a6c29ae86 100644 --- a/fpdfsdk/src/fpdf_dataavail.cpp +++ b/fpdfsdk/src/fpdf_dataavail.cpp @@ -6,6 +6,7 @@ #include "public/fpdf_dataavail.h" +#include "core/include/fpdfapi/cpdf_document.h" #include "fpdfsdk/include/fsdk_define.h" #include "public/fpdf_formfill.h" diff --git a/fpdfsdk/src/fpdf_ext.cpp b/fpdfsdk/src/fpdf_ext.cpp index aa6725b288..55ebe09694 100644 --- a/fpdfsdk/src/fpdf_ext.cpp +++ b/fpdfsdk/src/fpdf_ext.cpp @@ -6,6 +6,7 @@ #include "public/fpdf_ext.h" +#include "core/include/fpdfapi/cpdf_document.h" #include "core/include/fxcrt/fx_xml.h" #include "fpdfsdk/include/fsdk_define.h" diff --git a/fpdfsdk/src/fpdf_flatten.cpp b/fpdfsdk/src/fpdf_flatten.cpp index 759f758e5e..fd7ef67643 100644 --- a/fpdfsdk/src/fpdf_flatten.cpp +++ b/fpdfsdk/src/fpdf_flatten.cpp @@ -8,6 +8,7 @@ #include +#include "core/include/fpdfapi/cpdf_document.h" #include "fpdfsdk/include/fsdk_define.h" typedef CFX_ArrayTemplate CPDF_ObjectArray; diff --git a/fpdfsdk/src/fpdf_transformpage.cpp b/fpdfsdk/src/fpdf_transformpage.cpp index 3d2f6511cd..d37074a1a9 100644 --- a/fpdfsdk/src/fpdf_transformpage.cpp +++ b/fpdfsdk/src/fpdf_transformpage.cpp @@ -6,6 +6,7 @@ #include "public/fpdf_transformpage.h" +#include "core/include/fpdfapi/cpdf_document.h" #include "fpdfsdk/include/fsdk_define.h" namespace { diff --git a/fpdfsdk/src/fpdfdoc.cpp b/fpdfsdk/src/fpdfdoc.cpp index 4b5da2ffc3..2794045901 100644 --- a/fpdfsdk/src/fpdfdoc.cpp +++ b/fpdfsdk/src/fpdfdoc.cpp @@ -8,6 +8,7 @@ #include +#include "core/include/fpdfapi/cpdf_document.h" #include "fpdfsdk/include/fsdk_define.h" #include "third_party/base/stl_util.h" diff --git a/fpdfsdk/src/fpdfdoc_unittest.cpp b/fpdfsdk/src/fpdfdoc_unittest.cpp index ec4684de4d..0dd03ce0b5 100644 --- a/fpdfsdk/src/fpdfdoc_unittest.cpp +++ b/fpdfsdk/src/fpdfdoc_unittest.cpp @@ -7,6 +7,7 @@ #include #include +#include "core/include/fpdfapi/cpdf_document.h" #include "core/include/fpdfapi/fpdf_module.h" #include "core/include/fpdfdoc/fpdf_doc.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/fpdfsdk/src/fpdfeditpage.cpp b/fpdfsdk/src/fpdfeditpage.cpp index 46026b593d..2661acec1b 100644 --- a/fpdfsdk/src/fpdfeditpage.cpp +++ b/fpdfsdk/src/fpdfeditpage.cpp @@ -6,6 +6,7 @@ #include "public/fpdf_edit.h" +#include "core/include/fpdfapi/cpdf_document.h" #include "fpdfsdk/include/fsdk_define.h" #include "public/fpdf_formfill.h" #include "third_party/base/stl_util.h" diff --git a/fpdfsdk/src/fpdfformfill.cpp b/fpdfsdk/src/fpdfformfill.cpp index 874082e277..31f5732ce5 100644 --- a/fpdfsdk/src/fpdfformfill.cpp +++ b/fpdfsdk/src/fpdfformfill.cpp @@ -9,6 +9,7 @@ #include #include +#include "core/include/fpdfapi/cpdf_document.h" #include "fpdfsdk/include/fsdk_define.h" #include "fpdfsdk/include/fsdk_mgr.h" #include "public/fpdfview.h" diff --git a/fpdfsdk/src/fpdfppo.cpp b/fpdfsdk/src/fpdfppo.cpp index 84ac41d60e..3b3d340a93 100644 --- a/fpdfsdk/src/fpdfppo.cpp +++ b/fpdfsdk/src/fpdfppo.cpp @@ -8,6 +8,7 @@ #include +#include "core/include/fpdfapi/cpdf_document.h" #include "fpdfsdk/include/fsdk_define.h" #include "third_party/base/stl_util.h" diff --git a/fpdfsdk/src/fpdfsave.cpp b/fpdfsdk/src/fpdfsave.cpp index ca0fa5364d..f93b52d6b7 100644 --- a/fpdfsdk/src/fpdfsave.cpp +++ b/fpdfsdk/src/fpdfsave.cpp @@ -6,6 +6,7 @@ #include "public/fpdf_save.h" +#include "core/include/fpdfapi/cpdf_document.h" #include "core/include/fpdfapi/fpdf_parser.h" #include "core/include/fpdfapi/fpdf_serial.h" #include "fpdfsdk/include/fsdk_define.h" diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp index 05c69acb99..a35952c339 100644 --- a/fpdfsdk/src/fpdfview.cpp +++ b/fpdfsdk/src/fpdfview.cpp @@ -8,6 +8,7 @@ #include +#include "core/include/fpdfapi/cpdf_document.h" #include "core/include/fxcodec/fx_codec.h" #include "core/include/fxcrt/fx_safe_types.h" #include "fpdfsdk/include/fsdk_define.h" diff --git a/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp index aaeb4d6c3f..e896441263 100644 --- a/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp +++ b/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp @@ -4,6 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "core/include/fpdfapi/cpdf_document.h" #include "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h" #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" #include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h" diff --git a/fpdfsdk/src/fpdfxfa/fpdfxfa_page.cpp b/fpdfsdk/src/fpdfxfa/fpdfxfa_page.cpp index 1f6aa12126..0210ac1c08 100644 --- a/fpdfsdk/src/fpdfxfa/fpdfxfa_page.cpp +++ b/fpdfsdk/src/fpdfxfa/fpdfxfa_page.cpp @@ -4,6 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "core/include/fpdfapi/cpdf_document.h" #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" #include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h" #include "fpdfsdk/include/fpdfxfa/fpdfxfa_util.h" diff --git a/fpdfsdk/src/fsdk_annothandler.cpp b/fpdfsdk/src/fsdk_annothandler.cpp index 5c77b3998b..ee0a4d8d73 100644 --- a/fpdfsdk/src/fsdk_annothandler.cpp +++ b/fpdfsdk/src/fsdk_annothandler.cpp @@ -6,6 +6,7 @@ #include +#include "core/include/fpdfapi/cpdf_document.h" #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" #include "fpdfsdk/include/fsdk_annothandler.h" #include "fpdfsdk/include/fsdk_define.h" diff --git a/fpdfsdk/src/fsdk_baseannot.cpp b/fpdfsdk/src/fsdk_baseannot.cpp index bd73ee3211..0c7cfac0de 100644 --- a/fpdfsdk/src/fsdk_baseannot.cpp +++ b/fpdfsdk/src/fsdk_baseannot.cpp @@ -6,6 +6,7 @@ #include +#include "core/include/fpdfapi/cpdf_document.h" #include "core/include/fxcrt/fx_ext.h" #include "fpdfsdk/include/fsdk_baseannot.h" #include "fpdfsdk/include/fsdk_define.h" diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp index 8d8b95f38e..e18959f5fd 100644 --- a/fpdfsdk/src/fsdk_baseform.cpp +++ b/fpdfsdk/src/fsdk_baseform.cpp @@ -9,6 +9,7 @@ #include #include +#include "core/include/fpdfapi/cpdf_document.h" #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" #include "fpdfsdk/include/fsdk_actionhandler.h" #include "fpdfsdk/include/fsdk_baseannot.h" diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp index 933f451538..1177ddfabc 100644 --- a/fpdfsdk/src/fsdk_mgr.cpp +++ b/fpdfsdk/src/fsdk_mgr.cpp @@ -4,11 +4,12 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "fpdfsdk/include/fsdk_mgr.h" + #include #include -#include "fpdfsdk/include/fsdk_mgr.h" - +#include "core/include/fpdfapi/cpdf_document.h" #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" #include "fpdfsdk/include/fsdk_define.h" #include "fpdfsdk/include/javascript/IJavaScript.h" diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp index 4d774426f0..f688982da5 100644 --- a/fpdfsdk/src/javascript/Document.cpp +++ b/fpdfsdk/src/javascript/Document.cpp @@ -6,6 +6,7 @@ #include "fpdfsdk/src/javascript/Document.h" +#include "core/include/fpdfapi/cpdf_document.h" #include "fpdfsdk/include/fsdk_mgr.h" // For CPDFDoc_Environment. #include "fpdfsdk/include/javascript/IJavaScript.h" #include "fpdfsdk/src/javascript/Field.h" diff --git a/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp index 89a75b2854..0a70357efd 100644 --- a/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_FontMap.cpp @@ -6,6 +6,7 @@ #include "fpdfsdk/include/pdfwindow/PWL_FontMap.h" +#include "core/include/fpdfapi/cpdf_document.h" #include "core/include/fpdfapi/fpdf_module.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" diff --git a/pdfium.gyp b/pdfium.gyp index f2161ae8de..63fa2fa630 100644 --- a/pdfium.gyp +++ b/pdfium.gyp @@ -251,6 +251,7 @@ 'target_name': 'fpdfapi', 'type': 'static_library', 'sources': [ + 'core/include/fpdfapi/cpdf_document.h', 'core/include/fpdfapi/fpdf_module.h', 'core/include/fpdfapi/fpdf_objects.h', 'core/include/fpdfapi/fpdf_page.h', @@ -345,10 +346,10 @@ 'core/src/fpdfapi/fpdf_page/fpdf_page_path.cpp', 'core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp', 'core/src/fpdfapi/fpdf_page/pageint.h', + 'core/src/fpdfapi/fpdf_parser/cpdf_document.cpp', 'core/src/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp', 'core/src/fpdfapi/fpdf_parser/cpdf_syntax_parser.h', 'core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp', - 'core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp', 'core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp', 'core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp', 'core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp', diff --git a/xfa/src/fxfa/app/xfa_ffdoc.cpp b/xfa/src/fxfa/app/xfa_ffdoc.cpp index f088a79fb6..1c277aad9d 100644 --- a/xfa/src/fxfa/app/xfa_ffdoc.cpp +++ b/xfa/src/fxfa/app/xfa_ffdoc.cpp @@ -6,6 +6,7 @@ #include "xfa/src/fxfa/app/xfa_ffdoc.h" +#include "core/include/fpdfapi/cpdf_document.h" #include "core/include/fpdfdoc/fpdf_doc.h" #include "core/include/fxcrt/fx_ext.h" #include "xfa/include/fwl/core/fwl_note.h" diff --git a/xfa/src/fxfa/app/xfa_fontmgr.cpp b/xfa/src/fxfa/app/xfa_fontmgr.cpp index cc5de78d63..1b9fb5f01c 100644 --- a/xfa/src/fxfa/app/xfa_fontmgr.cpp +++ b/xfa/src/fxfa/app/xfa_fontmgr.cpp @@ -8,6 +8,7 @@ #include +#include "core/include/fpdfapi/cpdf_document.h" #include "core/include/fpdfapi/fpdf_resource.h" #include "xfa/src/fxfa/app/xfa_ffapp.h" #include "xfa/src/fxfa/app/xfa_ffdoc.h" -- cgit v1.2.3