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_pageorganizer.h
Go to the documentation of this file.
1// Copyright 2024 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_PAGEORGANIZER_H_
8#define CORE_FPDFAPI_EDIT_CPDF_PAGEORGANIZER_H_
9
10#include <stdint.h>
11
12#include <map>
13
14#include "core/fxcrt/bytestring.h"
15#include "core/fxcrt/retain_ptr.h"
16#include "core/fxcrt/unowned_ptr.h"
17
18class CPDF_Dictionary;
19class CPDF_Document;
20class CPDF_Object;
21class CPDF_Reference;
22
24 protected:
27
28 // Must be called after construction before doing anything else.
29 bool Init();
30
32
33 CPDF_Document* dest() { return dest_doc_; }
34 const CPDF_Document* dest() const { return dest_doc_; }
35
36 CPDF_Document* src() { return src_doc_; }
37 const CPDF_Document* src() const { return src_doc_; }
38
39 void AddObjectMapping(uint32_t old_page_obj_num, uint32_t new_page_obj_num) {
40 object_number_map_[old_page_obj_num] = new_page_obj_num;
41 }
42
43 void ClearObjectNumberMap() { object_number_map_.clear(); }
44
45 static bool CopyInheritable(RetainPtr<CPDF_Dictionary> dest_page_dict,
46 RetainPtr<const CPDF_Dictionary> src_page_dict,
47 const ByteString& key);
48
50 RetainPtr<const CPDF_Dictionary> dict,
51 const ByteString& src_tag);
52
53 private:
54 bool InitDestDoc();
55
56 uint32_t GetNewObjId(CPDF_Reference* ref);
57
58 UnownedPtr<CPDF_Document> const dest_doc_;
59 UnownedPtr<CPDF_Document> const src_doc_;
60
61 // Mapping of source object number to destination object number.
62 std::map<uint32_t, uint32_t> object_number_map_;
63};
64
65#endif // CORE_FPDFAPI_EDIT_CPDF_PAGEORGANIZER_H_
fxcrt::ByteString ByteString
Definition bytestring.h:180
#define DCHECK
Definition check.h:33
void Scale(float sx, float sy)
std::vector< RetainPtr< CPDF_Object > >::const_iterator const_iterator
Definition cpdf_array.h:29
std::map< ByteString, RetainPtr< CPDF_Object >, std::less<> > DictMap
bool ExportNPagesToOne(pdfium::span< const uint32_t > page_indices, const CFX_SizeF &dest_page_size, size_t pages_on_x_axis, size_t pages_on_y_axis)
static ByteString GenerateSubPageContentStreamForTesting(const ByteString &xobject_name, const NupPageSettings &settings)
CPDF_NPageToOneExporter(CPDF_Document *dest_doc, CPDF_Document *src_doc)
std::unique_ptr< XObjectContext > CreateXObjectContextFromPage(int src_page_index)
static bool CopyInheritable(RetainPtr< CPDF_Dictionary > dest_page_dict, RetainPtr< const CPDF_Dictionary > src_page_dict, const ByteString &key)
CPDF_Document * dest()
const CPDF_Document * dest() const
static RetainPtr< const CPDF_Object > PageDictGetInheritableTag(RetainPtr< const CPDF_Dictionary > dict, const ByteString &src_tag)
CPDF_PageOrganizer(CPDF_Document *dest_doc, CPDF_Document *src_doc)
const CPDF_Document * src() const
CPDF_Document * src()
bool UpdateReference(RetainPtr< CPDF_Object > obj)
void AddObjectMapping(uint32_t old_page_obj_num, uint32_t new_page_obj_num)
static ByteString Format(const char *pFormat,...)
ByteString & operator+=(const char *str)
CFX_PTemplate< float > CFX_PointF
CFX_STemplate< float > CFX_SizeF
pdfium::CheckedNumeric< int32_t > FX_SAFE_INT32
const char kMediaBox[]
const char kContents[]
fxcrt::ByteStringView ByteStringView
UnownedPtr< CPDF_Document > dest_doc
RetainPtr< CPDF_Stream > xobject