From 81a3085b250deafd18a2183a311cc57e2ec1c6f0 Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Tue, 12 Jun 2018 22:00:25 +0000 Subject: Refactor modification of Contents in CPDF_PageContentGenerator. This is a pure refactor, there should be no change in behavior. It prepares for the next CL, which will allow modification of content streams. Bug: pdfium:1051 Change-Id: I01ca3e897efe423e89df75e1f31cd67539cc3d08 Reviewed-on: https://pdfium-review.googlesource.com/34470 Commit-Queue: Henrique Nakashima Reviewed-by: dsinclair --- core/fpdfapi/edit/cpdf_pagecontentgenerator.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'core/fpdfapi/edit/cpdf_pagecontentgenerator.h') diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.h b/core/fpdfapi/edit/cpdf_pagecontentgenerator.h index a6cf215734..677d29267b 100644 --- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.h +++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.h @@ -7,6 +7,8 @@ #ifndef CORE_FPDFAPI_EDIT_CPDF_PAGECONTENTGENERATOR_H_ #define CORE_FPDFAPI_EDIT_CPDF_PAGECONTENTGENERATOR_H_ +#include +#include #include #include @@ -41,6 +43,23 @@ class CPDF_PageContentGenerator { ByteString RealizeResource(const CPDF_Object* pResource, const ByteString& bsType); + // Returns a map from content stream index to new stream data. Unmodified + // streams are not touched. + std::map> + GenerateModifiedStreams(); + + // Generate new stream data with all dirty page objects. + bool GenerateStreamWithNewObjects(std::ostringstream* buf); + + // Add buffer as a stream in page's 'Contents' + void UpdateContentStreams( + std::map>* buf); + + // Set the stream index of all page objects with stream index == + // |CPDF_PageObject::kNoContentStream|. These are new objects that had not + // been parsed from or written to any content stream yet. + void UpdateStreamlessPageObjects(int new_content_stream_index); + UnownedPtr const m_pObjHolder; UnownedPtr const m_pDocument; std::vector> m_pageObjects; -- cgit v1.2.3