From 1771a71f8140944eafa66f0e1f0779de4c0631af Mon Sep 17 00:00:00 2001 From: dsinclair Date: Thu, 29 Sep 2016 11:56:56 -0700 Subject: Move core/fpdfapi/fpdf_edit/include to core/fpdfapi/fpdf_edit BUG=pdfium:611 Review-Url: https://codereview.chromium.org/2381863003 --- BUILD.gn | 4 +- core/fpdfapi/fpdf_edit/cpdf_creator.h | 101 +++++++++++++++++++++ .../fpdf_edit/cpdf_pagecontentgenerator.cpp | 4 +- core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.h | 43 +++++++++ core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp | 2 +- core/fpdfapi/fpdf_edit/include/cpdf_creator.h | 101 --------------------- .../fpdf_edit/include/cpdf_pagecontentgenerator.h | 43 --------- core/fpdfapi/fpdf_page/fpdf_page_parser.cpp | 2 +- core/fpdfapi/fpdf_parser/cfdf_document.cpp | 2 +- fpdfsdk/DEPS | 2 +- fpdfsdk/fpdfeditpage.cpp | 2 +- fpdfsdk/fpdfsave.cpp | 2 +- 12 files changed, 154 insertions(+), 154 deletions(-) create mode 100644 core/fpdfapi/fpdf_edit/cpdf_creator.h create mode 100644 core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.h delete mode 100644 core/fpdfapi/fpdf_edit/include/cpdf_creator.h delete mode 100644 core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h diff --git a/BUILD.gn b/BUILD.gn index a9c9d59a9d..5fb57192c3 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -392,11 +392,11 @@ static_library("fpdfapi") { "core/fpdfapi/fpdf_cmaps/Korea1/cmaps_korea1.cpp", "core/fpdfapi/fpdf_cmaps/cmap_int.h", "core/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp", + "core/fpdfapi/fpdf_edit/cpdf_creator.h", "core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp", + "core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.h", "core/fpdfapi/fpdf_edit/editint.h", "core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp", - "core/fpdfapi/fpdf_edit/include/cpdf_creator.h", - "core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h", "core/fpdfapi/fpdf_font/cpdf_cidfont.cpp", "core/fpdfapi/fpdf_font/cpdf_cidfont.h", "core/fpdfapi/fpdf_font/cpdf_font.cpp", diff --git a/core/fpdfapi/fpdf_edit/cpdf_creator.h b/core/fpdfapi/fpdf_edit/cpdf_creator.h new file mode 100644 index 0000000000..ec2536f01c --- /dev/null +++ b/core/fpdfapi/fpdf_edit/cpdf_creator.h @@ -0,0 +1,101 @@ +// 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 + +#ifndef CORE_FPDFAPI_FPDF_EDIT_CPDF_CREATOR_H_ +#define CORE_FPDFAPI_FPDF_EDIT_CPDF_CREATOR_H_ + +#include + +#include "core/fxcrt/include/fx_basic.h" + +class CPDF_Array; +class CPDF_CryptoHandler; +class CPDF_Dictionary; +class CPDF_Document; +class CPDF_Object; +class CPDF_Parser; +class CPDF_XRefStream; + +#define FPDFCREATE_INCREMENTAL 1 +#define FPDFCREATE_NO_ORIGINAL 2 +#define FPDFCREATE_PROGRESSIVE 4 +#define FPDFCREATE_OBJECTSTREAM 8 + +CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& buf, const CPDF_Object* pObj); + +class CPDF_Creator { + public: + explicit CPDF_Creator(CPDF_Document* pDoc); + ~CPDF_Creator(); + + void RemoveSecurity(); + bool Create(IFX_StreamWrite* pFile, uint32_t flags = 0); + int32_t Continue(IFX_Pause* pPause = nullptr); + FX_BOOL SetFileVersion(int32_t fileVersion = 17); + + private: + friend class CPDF_ObjectStream; + friend class CPDF_XRefStream; + + bool Create(uint32_t flags); + void ResetStandardSecurity(); + void Clear(); + + void InitOldObjNumOffsets(); + void InitNewObjNumOffsets(); + void InitID(FX_BOOL bDefault = TRUE); + + void AppendNewObjNum(uint32_t objbum); + int32_t AppendObjectNumberToXRef(uint32_t objnum); + + int32_t WriteDoc_Stage1(IFX_Pause* pPause); + int32_t WriteDoc_Stage2(IFX_Pause* pPause); + int32_t WriteDoc_Stage3(IFX_Pause* pPause); + int32_t WriteDoc_Stage4(IFX_Pause* pPause); + + int32_t WriteOldIndirectObject(uint32_t objnum); + int32_t WriteOldObjs(IFX_Pause* pPause); + int32_t WriteNewObjs(FX_BOOL bIncremental, IFX_Pause* pPause); + int32_t WriteIndirectObj(const CPDF_Object* pObj); + int32_t WriteDirectObj(uint32_t objnum, + const CPDF_Object* pObj, + FX_BOOL bEncrypt = TRUE); + int32_t WriteIndirectObjectToStream(const CPDF_Object* pObj); + int32_t WriteIndirectObj(uint32_t objnum, const CPDF_Object* pObj); + int32_t WriteIndirectObjectToStream(uint32_t objnum, + const uint8_t* pBuffer, + uint32_t dwSize); + + int32_t WriteStream(const CPDF_Object* pStream, + uint32_t objnum, + CPDF_CryptoHandler* pCrypto); + + CPDF_Document* const m_pDocument; + CPDF_Parser* const m_pParser; + FX_BOOL m_bSecurityChanged; + CPDF_Dictionary* m_pEncryptDict; + uint32_t m_dwEncryptObjNum; + FX_BOOL m_bEncryptCloned; + CPDF_CryptoHandler* m_pCryptoHandler; + // Whether this owns the crypto handler |m_pCryptoHandler|. + FX_BOOL m_bLocalCryptoHandler; + CPDF_Object* m_pMetadata; + std::unique_ptr m_pXRefStream; + int32_t m_ObjectStreamSize; + uint32_t m_dwLastObjNum; + CFX_FileBufferArchive m_File; + FX_FILESIZE m_Offset; + int32_t m_iStage; + uint32_t m_dwFlags; + FX_POSITION m_Pos; + FX_FILESIZE m_XrefStart; + CFX_FileSizeListArray m_ObjectOffset; + CFX_ArrayTemplate m_NewObjNumArray; + std::unique_ptr> m_pIDArray; + int32_t m_FileVersion; +}; + +#endif // CORE_FPDFAPI_FPDF_EDIT_CPDF_CREATOR_H_ diff --git a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp index 45d40170d6..7cf7b69ff2 100644 --- a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp +++ b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp @@ -4,9 +4,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h" +#include "core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.h" -#include "core/fpdfapi/fpdf_edit/include/cpdf_creator.h" +#include "core/fpdfapi/fpdf_edit/cpdf_creator.h" #include "core/fpdfapi/fpdf_page/include/cpdf_image.h" #include "core/fpdfapi/fpdf_page/include/cpdf_imageobject.h" #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" diff --git a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.h b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.h new file mode 100644 index 0000000000..d5a69caef8 --- /dev/null +++ b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.h @@ -0,0 +1,43 @@ +// 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_FPDFAPI_FPDF_EDIT_CPDF_PAGECONTENTGENERATOR_H_ +#define CORE_FPDFAPI_FPDF_EDIT_CPDF_PAGECONTENTGENERATOR_H_ + +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fxcrt/include/fx_basic.h" +#include "core/fxcrt/include/fx_coordinates.h" +#include "core/fxcrt/include/fx_system.h" + +class CPDF_Object; +class CPDF_Page; +class CPDF_PageObject; +class CPDF_ImageObject; + +class CPDF_PageContentGenerator { + public: + explicit CPDF_PageContentGenerator(CPDF_Page* pPage); + ~CPDF_PageContentGenerator(); + + FX_BOOL InsertPageObject(CPDF_PageObject* pPageObject); + void GenerateContent(); + void TransformContent(CFX_Matrix& matrix); + + private: + void ProcessImage(CFX_ByteTextBuf& buf, CPDF_ImageObject* pImageObj); + void ProcessForm(CFX_ByteTextBuf& buf, + const uint8_t* data, + uint32_t size, + CFX_Matrix& matrix); + CFX_ByteString RealizeResource(CPDF_Object* pResourceObj, + const CFX_ByteString& bsType); + + CPDF_Page* m_pPage; + CPDF_Document* m_pDocument; + CFX_ArrayTemplate m_pageObjects; +}; + +#endif // CORE_FPDFAPI_FPDF_EDIT_CPDF_PAGECONTENTGENERATOR_H_ diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp index d29b9834fa..05847232f6 100644 --- a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp +++ b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp @@ -8,7 +8,7 @@ #include -#include "core/fpdfapi/fpdf_edit/include/cpdf_creator.h" +#include "core/fpdfapi/fpdf_edit/cpdf_creator.h" #include "core/fpdfapi/fpdf_parser/cpdf_crypto_handler.h" #include "core/fpdfapi/fpdf_parser/cpdf_security_handler.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" diff --git a/core/fpdfapi/fpdf_edit/include/cpdf_creator.h b/core/fpdfapi/fpdf_edit/include/cpdf_creator.h deleted file mode 100644 index d922e216ff..0000000000 --- a/core/fpdfapi/fpdf_edit/include/cpdf_creator.h +++ /dev/null @@ -1,101 +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 - -#ifndef CORE_FPDFAPI_FPDF_EDIT_INCLUDE_CPDF_CREATOR_H_ -#define CORE_FPDFAPI_FPDF_EDIT_INCLUDE_CPDF_CREATOR_H_ - -#include - -#include "core/fxcrt/include/fx_basic.h" - -class CPDF_Array; -class CPDF_CryptoHandler; -class CPDF_Dictionary; -class CPDF_Document; -class CPDF_Object; -class CPDF_Parser; -class CPDF_XRefStream; - -#define FPDFCREATE_INCREMENTAL 1 -#define FPDFCREATE_NO_ORIGINAL 2 -#define FPDFCREATE_PROGRESSIVE 4 -#define FPDFCREATE_OBJECTSTREAM 8 - -CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& buf, const CPDF_Object* pObj); - -class CPDF_Creator { - public: - explicit CPDF_Creator(CPDF_Document* pDoc); - ~CPDF_Creator(); - - void RemoveSecurity(); - bool Create(IFX_StreamWrite* pFile, uint32_t flags = 0); - int32_t Continue(IFX_Pause* pPause = nullptr); - FX_BOOL SetFileVersion(int32_t fileVersion = 17); - - private: - friend class CPDF_ObjectStream; - friend class CPDF_XRefStream; - - bool Create(uint32_t flags); - void ResetStandardSecurity(); - void Clear(); - - void InitOldObjNumOffsets(); - void InitNewObjNumOffsets(); - void InitID(FX_BOOL bDefault = TRUE); - - void AppendNewObjNum(uint32_t objbum); - int32_t AppendObjectNumberToXRef(uint32_t objnum); - - int32_t WriteDoc_Stage1(IFX_Pause* pPause); - int32_t WriteDoc_Stage2(IFX_Pause* pPause); - int32_t WriteDoc_Stage3(IFX_Pause* pPause); - int32_t WriteDoc_Stage4(IFX_Pause* pPause); - - int32_t WriteOldIndirectObject(uint32_t objnum); - int32_t WriteOldObjs(IFX_Pause* pPause); - int32_t WriteNewObjs(FX_BOOL bIncremental, IFX_Pause* pPause); - int32_t WriteIndirectObj(const CPDF_Object* pObj); - int32_t WriteDirectObj(uint32_t objnum, - const CPDF_Object* pObj, - FX_BOOL bEncrypt = TRUE); - int32_t WriteIndirectObjectToStream(const CPDF_Object* pObj); - int32_t WriteIndirectObj(uint32_t objnum, const CPDF_Object* pObj); - int32_t WriteIndirectObjectToStream(uint32_t objnum, - const uint8_t* pBuffer, - uint32_t dwSize); - - int32_t WriteStream(const CPDF_Object* pStream, - uint32_t objnum, - CPDF_CryptoHandler* pCrypto); - - CPDF_Document* const m_pDocument; - CPDF_Parser* const m_pParser; - FX_BOOL m_bSecurityChanged; - CPDF_Dictionary* m_pEncryptDict; - uint32_t m_dwEncryptObjNum; - FX_BOOL m_bEncryptCloned; - CPDF_CryptoHandler* m_pCryptoHandler; - // Whether this owns the crypto handler |m_pCryptoHandler|. - FX_BOOL m_bLocalCryptoHandler; - CPDF_Object* m_pMetadata; - std::unique_ptr m_pXRefStream; - int32_t m_ObjectStreamSize; - uint32_t m_dwLastObjNum; - CFX_FileBufferArchive m_File; - FX_FILESIZE m_Offset; - int32_t m_iStage; - uint32_t m_dwFlags; - FX_POSITION m_Pos; - FX_FILESIZE m_XrefStart; - CFX_FileSizeListArray m_ObjectOffset; - CFX_ArrayTemplate m_NewObjNumArray; - std::unique_ptr> m_pIDArray; - int32_t m_FileVersion; -}; - -#endif // CORE_FPDFAPI_FPDF_EDIT_INCLUDE_CPDF_CREATOR_H_ diff --git a/core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h b/core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h deleted file mode 100644 index adcac171a5..0000000000 --- a/core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h +++ /dev/null @@ -1,43 +0,0 @@ -// 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_FPDFAPI_FPDF_EDIT_INCLUDE_CPDF_PAGECONTENTGENERATOR_H_ -#define CORE_FPDFAPI_FPDF_EDIT_INCLUDE_CPDF_PAGECONTENTGENERATOR_H_ - -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fxcrt/include/fx_basic.h" -#include "core/fxcrt/include/fx_coordinates.h" -#include "core/fxcrt/include/fx_system.h" - -class CPDF_Object; -class CPDF_Page; -class CPDF_PageObject; -class CPDF_ImageObject; - -class CPDF_PageContentGenerator { - public: - explicit CPDF_PageContentGenerator(CPDF_Page* pPage); - ~CPDF_PageContentGenerator(); - - FX_BOOL InsertPageObject(CPDF_PageObject* pPageObject); - void GenerateContent(); - void TransformContent(CFX_Matrix& matrix); - - private: - void ProcessImage(CFX_ByteTextBuf& buf, CPDF_ImageObject* pImageObj); - void ProcessForm(CFX_ByteTextBuf& buf, - const uint8_t* data, - uint32_t size, - CFX_Matrix& matrix); - CFX_ByteString RealizeResource(CPDF_Object* pResourceObj, - const CFX_ByteString& bsType); - - CPDF_Page* m_pPage; - CPDF_Document* m_pDocument; - CFX_ArrayTemplate m_pageObjects; -}; - -#endif // CORE_FPDFAPI_FPDF_EDIT_INCLUDE_CPDF_PAGECONTENTGENERATOR_H_ diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp index 881f9eed25..55943fdfe5 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -10,7 +10,7 @@ #include #include -#include "core/fpdfapi/fpdf_edit/include/cpdf_creator.h" +#include "core/fpdfapi/fpdf_edit/cpdf_creator.h" #include "core/fpdfapi/fpdf_font/cpdf_type3font.h" #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" #include "core/fpdfapi/fpdf_page/cpdf_allstates.h" diff --git a/core/fpdfapi/fpdf_parser/cfdf_document.cpp b/core/fpdfapi/fpdf_parser/cfdf_document.cpp index 128c513c60..46b9ff5191 100644 --- a/core/fpdfapi/fpdf_parser/cfdf_document.cpp +++ b/core/fpdfapi/fpdf_parser/cfdf_document.cpp @@ -6,7 +6,7 @@ #include "core/fpdfapi/fpdf_parser/include/cfdf_document.h" -#include "core/fpdfapi/fpdf_edit/include/cpdf_creator.h" +#include "core/fpdfapi/fpdf_edit/cpdf_creator.h" #include "core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" diff --git a/fpdfsdk/DEPS b/fpdfsdk/DEPS index 463991d905..04ade247c3 100644 --- a/fpdfsdk/DEPS +++ b/fpdfsdk/DEPS @@ -1,7 +1,7 @@ include_rules = [ '+core/fpdftext/include', '+core/fpdfapi/include', - '+core/fpdfapi/fpdf_edit/include', + '+core/fpdfapi/fpdf_edit', '+core/fpdfapi/fpdf_page/include', '+core/fpdfapi/fpdf_parser/include', '+core/fpdfapi/fpdf_render/include', diff --git a/fpdfsdk/fpdfeditpage.cpp b/fpdfsdk/fpdfeditpage.cpp index 9ab7f0718e..5358a69cd2 100644 --- a/fpdfsdk/fpdfeditpage.cpp +++ b/fpdfsdk/fpdfeditpage.cpp @@ -10,7 +10,7 @@ #include #include -#include "core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h" +#include "core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.h" #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" #include "core/fpdfapi/fpdf_page/include/cpdf_formobject.h" #include "core/fpdfapi/fpdf_page/include/cpdf_imageobject.h" diff --git a/fpdfsdk/fpdfsave.cpp b/fpdfsdk/fpdfsave.cpp index aa03e6d13c..0f4a5b5a46 100644 --- a/fpdfsdk/fpdfsave.cpp +++ b/fpdfsdk/fpdfsave.cpp @@ -8,7 +8,7 @@ #include -#include "core/fpdfapi/fpdf_edit/include/cpdf_creator.h" +#include "core/fpdfapi/fpdf_edit/cpdf_creator.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" -- cgit v1.2.3