• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef CORE_FPDFAPI_EDIT_CPDF_PAGECONTENTGENERATOR_H_
8 #define CORE_FPDFAPI_EDIT_CPDF_PAGECONTENTGENERATOR_H_
9 
10 #include <sstream>
11 #include <vector>
12 
13 #include "core/fxcrt/fx_string.h"
14 #include "core/fxcrt/fx_system.h"
15 #include "core/fxcrt/unowned_ptr.h"
16 
17 class CPDF_Document;
18 class CPDF_ImageObject;
19 class CPDF_PageObject;
20 class CPDF_PageObjectHolder;
21 class CPDF_PathObject;
22 class CPDF_TextObject;
23 
24 class CPDF_PageContentGenerator {
25  public:
26   explicit CPDF_PageContentGenerator(CPDF_PageObjectHolder* pObjHolder);
27   ~CPDF_PageContentGenerator();
28 
29   void GenerateContent();
30   bool ProcessPageObjects(std::ostringstream* buf);
31 
32  private:
33   friend class CPDF_PageContentGeneratorTest;
34 
35   void ProcessPath(std::ostringstream* buf, CPDF_PathObject* pPathObj);
36   void ProcessImage(std::ostringstream* buf, CPDF_ImageObject* pImageObj);
37   void ProcessGraphics(std::ostringstream* buf, CPDF_PageObject* pPageObj);
38   void ProcessDefaultGraphics(std::ostringstream* buf);
39   void ProcessText(std::ostringstream* buf, CPDF_TextObject* pTextObj);
40   ByteString RealizeResource(uint32_t dwResourceObjNum,
41                              const ByteString& bsType);
42 
43   UnownedPtr<CPDF_PageObjectHolder> const m_pObjHolder;
44   UnownedPtr<CPDF_Document> const m_pDocument;
45   std::vector<UnownedPtr<CPDF_PageObject>> m_pageObjects;
46 };
47 
48 #endif  // CORE_FPDFAPI_EDIT_CPDF_PAGECONTENTGENERATOR_H_
49