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_pagecontentmanager.h
Go to the documentation of this file.
1// Copyright 2018 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#ifndef CORE_FPDFAPI_EDIT_CPDF_PAGECONTENTMANAGER_H_
6#define CORE_FPDFAPI_EDIT_CPDF_PAGECONTENTMANAGER_H_
7
8#include <stdint.h>
9
10#include <set>
11
12#include "core/fxcrt/fx_string_wrappers.h"
13#include "core/fxcrt/retain_ptr.h"
14#include "core/fxcrt/unowned_ptr.h"
15#include "third_party/abseil-cpp/absl/types/variant.h"
16
17class CPDF_Array;
18class CPDF_Document;
20class CPDF_Stream;
21
23 public:
25 CPDF_Document* document);
27
28 // Adds a new Content stream. Its index in the array will be returned, or 0
29 // if Contents is not an array, but only a single stream.
30 size_t AddStream(fxcrt::ostringstream* buf);
31
32 // Changes the stream at `stream_index` to contain the data in `buf`. If `buf`
33 // is empty, then schedule the removal of the stream instead.
34 void UpdateStream(size_t stream_index, fxcrt::ostringstream* buf);
35
36 private:
37 // Gets the Content stream at a given index. If Contents is a single stream
38 // rather than an array, it is retrievable at index 0.
39 RetainPtr<CPDF_Stream> GetStreamByIndex(size_t stream_index);
40
41 // Schedules the removal of the Content stream at a given index. It will be
42 // removed upon CPDF_PageContentManager destruction.
43 void ScheduleRemoveStreamByIndex(size_t stream_index);
44
45 // Removes all Content streams for which ScheduleRemoveStreamByIndex() was
46 // called. Update the content stream of all page objects with the shifted
47 // indexes.
48 void ExecuteScheduledRemovals();
49
50 RetainPtr<CPDF_Stream> GetContentsStream();
51 RetainPtr<CPDF_Array> GetContentsArray();
52
53 UnownedPtr<CPDF_PageObjectHolder> const page_obj_holder_;
54 UnownedPtr<CPDF_Document> const document_;
55 const std::set<uint32_t> objects_with_multi_refs_;
56 // When holding a CPDF_Stream, the pointer may be null.
57 absl::variant<RetainPtr<CPDF_Stream>, RetainPtr<CPDF_Array>> contents_;
58 std::set<size_t> streams_to_remove_;
59};
60
61#endif // CORE_FPDFAPI_EDIT_CPDF_PAGECONTENTMANAGER_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)
void UpdateStream(size_t stream_index, fxcrt::ostringstream *buf)
size_t AddStream(fxcrt::ostringstream *buf)
CPDF_PageContentManager(CPDF_PageObjectHolder *page_obj_holder, CPDF_Document *document)
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)