blob: d40c87fcb1be288cc0d0bb522cc7a83fda6a8c54 [file] [log] [blame]
// Copyright 2018 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.
#include <set>
#include "core/fxcrt/fx_string_wrappers.h"
#include "core/fxcrt/retain_ptr.h"
#include "core/fxcrt/unowned_ptr.h"
class CPDF_Array;
class CPDF_Document;
class CPDF_Stream;
class CPDF_PageObjectHolder;
class CPDF_PageContentManager {
explicit CPDF_PageContentManager(const CPDF_PageObjectHolder* obj_holder);
// Gets the Content stream at a given index. If Contents is a single stream
// rather than an array, it is considered to be at index 0.
CPDF_Stream* GetStreamByIndex(size_t stream_index);
// Adds a new Content stream. Its index in the array will be returned, or 0
// if Contents is not an array, but only a single stream.
size_t AddStream(fxcrt::ostringstream* buf);
// Schedule the removal of the Content stream at a given index. It will be
// removed when ExecuteScheduledRemovals() is called.
void ScheduleRemoveStreamByIndex(size_t stream_index);
// Remove all Content streams for which ScheduleRemoveStreamByIndex() was
// called. Update the content stream of all page objects with the shifted
// indexes.
void ExecuteScheduledRemovals();
UnownedPtr<const CPDF_PageObjectHolder> const obj_holder_;
UnownedPtr<CPDF_Document> const doc_;
RetainPtr<CPDF_Array> contents_array_;
RetainPtr<CPDF_Stream> contents_stream_;
std::set<size_t> streams_to_remove_;