Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cpdf_pagecontentgenerator.h
Go to the documentation of this file.
1// Copyright 2016 The PDFium Authors
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 <stdint.h>
11
12#include <map>
13#include <vector>
14
15#include "core/fxcrt/bytestring.h"
16#include "core/fxcrt/fx_string_wrappers.h"
17#include "core/fxcrt/unowned_ptr.h"
18
20class CPDF_Document;
21class CPDF_FormObject;
22class CPDF_ImageObject;
23class CPDF_Object;
24class CPDF_PageObject;
26class CPDF_Path;
27class CPDF_PathObject;
28class CPDF_TextObject;
29
31 public:
34
35 void GenerateContent();
36 bool ProcessPageObjects(fxcrt::ostringstream* buf);
37
38 private:
40
41 void ProcessPageObject(fxcrt::ostringstream* buf, CPDF_PageObject* pPageObj);
42 void ProcessPathPoints(fxcrt::ostringstream* buf, CPDF_Path* pPath);
43 void ProcessPath(fxcrt::ostringstream* buf, CPDF_PathObject* pPathObj);
44 void ProcessForm(fxcrt::ostringstream* buf, CPDF_FormObject* pFormObj);
45 void ProcessImage(fxcrt::ostringstream* buf, CPDF_ImageObject* pImageObj);
46 void ProcessGraphics(fxcrt::ostringstream* buf, CPDF_PageObject* pPageObj);
47 void ProcessDefaultGraphics(fxcrt::ostringstream* buf);
48 void ProcessText(fxcrt::ostringstream* buf, CPDF_TextObject* pTextObj);
49 ByteString GetOrCreateDefaultGraphics() const;
50 ByteString RealizeResource(const CPDF_Object* pResource,
51 const ByteString& bsType) const;
52 const CPDF_ContentMarks* ProcessContentMarks(fxcrt::ostringstream* buf,
53 const CPDF_PageObject* pPageObj,
54 const CPDF_ContentMarks* pPrev);
55 void FinishMarks(fxcrt::ostringstream* buf,
56 const CPDF_ContentMarks* pContentMarks);
57
58 // Returns a map from content stream index to new stream data. Unmodified
59 // streams are not touched.
60 std::map<int32_t, fxcrt::ostringstream> GenerateModifiedStreams();
61
62 // For each entry in `new_stream_data`, adds the string buffer to the page's
63 // content stream.
64 void UpdateContentStreams(
65 std::map<int32_t, fxcrt::ostringstream>&& new_stream_data);
66
67 // Sets the stream index of all page objects with stream index ==
68 // |CPDF_PageObject::kNoContentStream|. These are new objects that had not
69 // been parsed from or written to any content stream yet.
70 void UpdateStreamlessPageObjects(int new_content_stream_index);
71
72 // Updates the resource dictionary for `m_pObjHolder` to account for all the
73 // changes.
74 void UpdateResourcesDict();
75
76 UnownedPtr<CPDF_PageObjectHolder> const m_pObjHolder;
77 UnownedPtr<CPDF_Document> const m_pDocument;
78 std::vector<UnownedPtr<CPDF_PageObject>> m_pageObjects;
79 ByteString m_DefaultGraphicsName;
80};
81
82#endif // CORE_FPDFAPI_EDIT_CPDF_PAGECONTENTGENERATOR_H_
float GetLineDashPhase() const
float GetLineWidth() const
CFX_GraphStateData::LineCap GetLineCap() const
CFX_GraphStateData::LineJoin GetLineJoin() const
bool HasRef() const
const CPDF_Color * GetStrokeColor() const
const CPDF_Color * GetFillColor() const
bool GetRGB(int *R, int *G, int *B) const
bool IsColorSpaceRGB() const
const ByteString & GetName() const
const ByteString & GetPropertyName() const
ParamType GetParamType() const
const CFX_Matrix & form_matrix() const
float GetStrokeAlpha() const
BlendMode GetBlendType() const
ByteString GetBlendMode() const
void SetImage(RetainPtr< CPDF_Image > pImage)
const CFX_Matrix & matrix() const
bool ProcessPageObjects(fxcrt::ostringstream *buf)
CPDF_PageContentGenerator(CPDF_PageObjectHolder *pObjHolder)
const CPDF_ColorState & color_state() const
void SetDirty(bool value)
const CPDF_GeneralState & general_state() const
const ByteString & GetResourceName() const
const CPDF_ClipPath & clip_path() const
virtual Type GetType() const =0
CPDF_GeneralState & mutable_general_state()
const CPDF_ContentMarks * GetContentMarks() const
void SetResourceName(const ByteString &resource_name)
const CFX_GraphState & graph_state() const
bool has_winding_filltype() const
bool stroke() const
const CFX_Matrix & matrix() const
bool has_alternate_filltype() const
bool has_no_filltype() const
bool IsRect() const
Definition cpdf_path.cpp:37
CFX_Matrix GetTextMatrix() const
float GetFontSize() const
TextRenderingMode GetTextRenderMode() const
static ByteString Format(const char *pFormat,...)
ByteString & operator=(ByteString &&that) noexcept
bool IsEmpty() const
Definition bytestring.h:119
CharType operator[](const size_t index) const
Definition bytestring.h:150
ByteString PDF_NameEncode(const ByteString &orig)
BlendMode
Definition fx_dib.h:49
#define CHECK(cvref)