summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp (renamed from core/fpdfapi/fpdf_edit/fpdf_edit_content.cpp)6
-rw-r--r--core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp1
-rw-r--r--core/fpdfapi/fpdf_edit/fpdf_edit_image.cpp2
-rw-r--r--core/fpdfapi/fpdf_edit/include/cpdf_creator.h1
-rw-r--r--core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h42
-rw-r--r--core/fpdfapi/fpdf_font/fpdf_font.cpp2
-rw-r--r--core/fpdfapi/fpdf_font/fpdf_font_charset.cpp1
-rw-r--r--core/fpdfapi/fpdf_font/fpdf_font_cid.cpp1
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_form.cpp65
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_pageobjectholder.cpp73
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_pageobjectlist.cpp17
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_pageobjectlist.h21
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_parseoptions.cpp12
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_parseoptions.h22
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page.cpp133
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_colors.cpp1
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_doc.cpp1
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_func.cpp1
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp1
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_image.cpp1
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_parser.cpp2
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp3
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_path.cpp1
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_pattern.cpp2
-rw-r--r--core/fpdfapi/fpdf_page/include/cpdf_form.h44
-rw-r--r--core/fpdfapi/fpdf_page/include/cpdf_page.h57
-rw-r--r--core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h67
-rw-r--r--core/fpdfapi/fpdf_page/pageint.h3
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render.cpp2
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_cache.cpp2
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_image.cpp3
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp1
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp2
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_text.cpp2
-rw-r--r--core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h2
-rw-r--r--core/fpdfdoc/doc_annot.cpp3
-rw-r--r--core/fpdfdoc/doc_bookmark.cpp1
-rw-r--r--core/fpdfdoc/doc_form.cpp2
-rw-r--r--core/fpdfdoc/doc_formcontrol.cpp2
-rw-r--r--core/fpdfdoc/doc_link.cpp2
-rw-r--r--core/fpdfdoc/doc_tagged.cpp1
-rw-r--r--core/fpdftext/fpdf_text_int.cpp1
-rw-r--r--core/fpdftext/fpdf_text_int.h4
-rw-r--r--core/fpdftext/include/ipdf_textpage.h1
-rw-r--r--core/include/fpdfapi/fpdf_page.h169
45 files changed, 455 insertions, 328 deletions
diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_content.cpp b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp
index 6010a04369..a09aa1f9b3 100644
--- a/core/fpdfapi/fpdf_edit/fpdf_edit_content.cpp
+++ b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp
@@ -1,16 +1,18 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
+// Copyright 2016 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.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h"
+
#include "core/fpdfapi/fpdf_edit/include/cpdf_creator.h"
+#include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
#include "core/fpdfapi/fpdf_page/pageint.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h"
-#include "core/include/fpdfapi/fpdf_page.h"
CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& ar, CFX_Matrix& matrix) {
ar << matrix.a << " " << matrix.b << " " << matrix.c << " " << matrix.d << " "
diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
index 121498ccd2..46d6d1feeb 100644
--- a/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
+++ b/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
@@ -13,7 +13,6 @@
#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h"
#include "core/fpdfapi/include/cpdf_modulemgr.h"
#include "core/fpdfapi/ipdf_rendermodule.h"
-#include "core/include/fpdfapi/fpdf_page.h"
CPDF_Document::CPDF_Document() : CPDF_IndirectObjectHolder(NULL) {
m_pRootDict = NULL;
diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_image.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
index fec596cdb2..50e4f79881 100644
--- a/core/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
+++ b/core/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
@@ -4,6 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
#include "core/fpdfapi/fpdf_page/pageint.h"
#include "core/fpdfapi/fpdf_parser/cpdf_boolean.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
@@ -13,7 +14,6 @@
#include "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h"
#include "core/fpdfapi/fpdf_render/render_int.h"
#include "core/fpdfapi/include/cpdf_modulemgr.h"
-#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fxcodec/fx_codec.h"
CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, FX_DWORD size) {
diff --git a/core/fpdfapi/fpdf_edit/include/cpdf_creator.h b/core/fpdfapi/fpdf_edit/include/cpdf_creator.h
index 5b5671b7e9..7be92f956b 100644
--- a/core/fpdfapi/fpdf_edit/include/cpdf_creator.h
+++ b/core/fpdfapi/fpdf_edit/include/cpdf_creator.h
@@ -7,7 +7,6 @@
#ifndef CORE_FPDFAPI_FPDF_EDIT_INCLUDE_CPDF_CREATOR_H_
#define CORE_FPDFAPI_FPDF_EDIT_INCLUDE_CPDF_CREATOR_H_
-#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fpdfapi/fpdf_pageobj.h"
class CPDF_Parser;
diff --git a/core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h b/core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h
new file mode 100644
index 0000000000..8aea084798
--- /dev/null
+++ b/core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h
@@ -0,0 +1,42 @@
+// Copyright 2016 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.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FPDFAPI_FPDF_EDIT_INCLUDE_CPDF_PAGECONTENTGENERATOR_H_
+#define CORE_FPDFAPI_FPDF_EDIT_INCLUDE_CPDF_PAGECONTENTGENERATOR_H_
+
+#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
+#include "core/include/fxcrt/fx_basic.h"
+#include "core/include/fxcrt/fx_coordinates.h"
+#include "core/include/fxcrt/fx_system.h"
+
+class CPDF_Object;
+class CPDF_Page;
+class CPDF_PageObject;
+class CPDF_ImageObject;
+
+class CPDF_PageContentGenerator {
+ public:
+ explicit CPDF_PageContentGenerator(CPDF_Page* pPage);
+
+ FX_BOOL InsertPageObject(CPDF_PageObject* pPageObject);
+ void GenerateContent();
+ void TransformContent(CFX_Matrix& matrix);
+
+ private:
+ void ProcessImage(CFX_ByteTextBuf& buf, CPDF_ImageObject* pImageObj);
+ void ProcessForm(CFX_ByteTextBuf& buf,
+ const uint8_t* data,
+ FX_DWORD size,
+ CFX_Matrix& matrix);
+ CFX_ByteString RealizeResource(CPDF_Object* pResourceObj,
+ const FX_CHAR* szType);
+
+ CPDF_Page* m_pPage;
+ CPDF_Document* m_pDocument;
+ CFX_ArrayTemplate<CPDF_PageObject*> m_pageObjects;
+};
+
+#endif // CORE_FPDFAPI_FPDF_EDIT_INCLUDE_CPDF_PAGECONTENTGENERATOR_H_
diff --git a/core/fpdfapi/fpdf_font/fpdf_font.cpp b/core/fpdfapi/fpdf_font/fpdf_font.cpp
index b1db0ebe09..5e9b0edfa0 100644
--- a/core/fpdfapi/fpdf_font/fpdf_font.cpp
+++ b/core/fpdfapi/fpdf_font/fpdf_font.cpp
@@ -6,6 +6,7 @@
#include "core/fpdfapi/fpdf_font/font_int.h"
+#include "core/fpdfapi/fpdf_page/include/cpdf_form.h"
#include "core/fpdfapi/fpdf_page/pageint.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
@@ -14,7 +15,6 @@
#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h"
#include "core/fpdfapi/include/cpdf_modulemgr.h"
-#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fpdfapi/fpdf_pageobj.h"
#include "core/include/fpdfapi/fpdf_resource.h"
#include "core/include/fxcrt/fx_ext.h"
diff --git a/core/fpdfapi/fpdf_font/fpdf_font_charset.cpp b/core/fpdfapi/fpdf_font/fpdf_font_charset.cpp
index 40ec22107b..642efd62ca 100644
--- a/core/fpdfapi/fpdf_font/fpdf_font_charset.cpp
+++ b/core/fpdfapi/fpdf_font/fpdf_font_charset.cpp
@@ -5,7 +5,6 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h"
-#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fpdfapi/fpdf_resource.h"
#include "core/include/fxge/fx_freetype.h"
diff --git a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp
index 321fc593fe..1295c624ad 100644
--- a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp
+++ b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp
@@ -12,7 +12,6 @@
#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h"
#include "core/fpdfapi/include/cpdf_modulemgr.h"
-#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fpdfapi/fpdf_resource.h"
#include "core/include/fxcrt/fx_ext.h"
#include "core/include/fxge/fx_freetype.h"
diff --git a/core/fpdfapi/fpdf_page/cpdf_form.cpp b/core/fpdfapi/fpdf_page/cpdf_form.cpp
new file mode 100644
index 0000000000..a1160397fc
--- /dev/null
+++ b/core/fpdfapi/fpdf_page/cpdf_form.cpp
@@ -0,0 +1,65 @@
+// Copyright 2016 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.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fpdfapi/fpdf_page/include/cpdf_form.h"
+
+#include "core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h"
+#include "core/fpdfapi/fpdf_page/pageint.h"
+#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
+#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h"
+
+CPDF_Form::CPDF_Form(CPDF_Document* pDoc,
+ CPDF_Dictionary* pPageResources,
+ CPDF_Stream* pFormStream,
+ CPDF_Dictionary* pParentResources) {
+ m_pDocument = pDoc;
+ m_pFormStream = pFormStream;
+ m_pFormDict = pFormStream ? pFormStream->GetDict() : NULL;
+ m_pResources = m_pFormDict->GetDictBy("Resources");
+ m_pPageResources = pPageResources;
+ if (!m_pResources) {
+ m_pResources = pParentResources;
+ }
+ if (!m_pResources) {
+ m_pResources = pPageResources;
+ }
+ m_Transparency = 0;
+ LoadTransInfo();
+}
+
+CPDF_Form::~CPDF_Form() {}
+
+void CPDF_Form::StartParse(CPDF_AllStates* pGraphicStates,
+ CFX_Matrix* pParentMatrix,
+ CPDF_Type3Char* pType3Char,
+ CPDF_ParseOptions* pOptions,
+ int level) {
+ if (m_ParseState == CONTENT_PARSED || m_ParseState == CONTENT_PARSING) {
+ return;
+ }
+ m_pParser.reset(new CPDF_ContentParser);
+ m_pParser->Start(this, pGraphicStates, pParentMatrix, pType3Char, pOptions,
+ level);
+ m_ParseState = CONTENT_PARSING;
+}
+
+void CPDF_Form::ParseContent(CPDF_AllStates* pGraphicStates,
+ CFX_Matrix* pParentMatrix,
+ CPDF_Type3Char* pType3Char,
+ CPDF_ParseOptions* pOptions,
+ int level) {
+ StartParse(pGraphicStates, pParentMatrix, pType3Char, pOptions, level);
+ ContinueParse(NULL);
+}
+
+CPDF_Form* CPDF_Form::Clone() const {
+ CPDF_Form* pCloneForm =
+ new CPDF_Form(m_pDocument, m_pPageResources, m_pFormStream, m_pResources);
+ for (const auto& pObj : m_PageObjectList)
+ pCloneForm->m_PageObjectList.emplace_back(pObj->Clone());
+
+ return pCloneForm;
+}
diff --git a/core/fpdfapi/fpdf_page/cpdf_pageobjectholder.cpp b/core/fpdfapi/fpdf_page/cpdf_pageobjectholder.cpp
new file mode 100644
index 0000000000..a1392f647e
--- /dev/null
+++ b/core/fpdfapi/fpdf_page/cpdf_pageobjectholder.cpp
@@ -0,0 +1,73 @@
+// Copyright 2016 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.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h"
+
+#include "core/fpdfapi/fpdf_page/pageint.h"
+
+CPDF_PageObjectHolder::CPDF_PageObjectHolder()
+ : m_pFormDict(nullptr),
+ m_pFormStream(nullptr),
+ m_pDocument(nullptr),
+ m_pPageResources(nullptr),
+ m_pResources(nullptr),
+ m_Transparency(0),
+ m_bBackgroundAlphaNeeded(FALSE),
+ m_bHasImageMask(FALSE),
+ m_ParseState(CONTENT_NOT_PARSED) {}
+
+void CPDF_PageObjectHolder::ContinueParse(IFX_Pause* pPause) {
+ if (!m_pParser) {
+ return;
+ }
+ m_pParser->Continue(pPause);
+ if (m_pParser->GetStatus() == CPDF_ContentParser::Done) {
+ m_ParseState = CONTENT_PARSED;
+ m_pParser.reset();
+ }
+}
+
+void CPDF_PageObjectHolder::Transform(const CFX_Matrix& matrix) {
+ for (auto& pObj : m_PageObjectList)
+ pObj->Transform(matrix);
+}
+
+CFX_FloatRect CPDF_PageObjectHolder::CalcBoundingBox() const {
+ if (m_PageObjectList.empty())
+ return CFX_FloatRect(0, 0, 0, 0);
+
+ FX_FLOAT left = 1000000.0f;
+ FX_FLOAT right = -1000000.0f;
+ FX_FLOAT bottom = 1000000.0f;
+ FX_FLOAT top = -1000000.0f;
+ for (const auto& pObj : m_PageObjectList) {
+ left = std::min(left, pObj->m_Left);
+ right = std::max(right, pObj->m_Right);
+ bottom = std::min(bottom, pObj->m_Bottom);
+ top = std::max(top, pObj->m_Top);
+ }
+ return CFX_FloatRect(left, bottom, right, top);
+}
+
+void CPDF_PageObjectHolder::LoadTransInfo() {
+ if (!m_pFormDict) {
+ return;
+ }
+ CPDF_Dictionary* pGroup = m_pFormDict->GetDictBy("Group");
+ if (!pGroup) {
+ return;
+ }
+ if (pGroup->GetStringBy("S") != "Transparency") {
+ return;
+ }
+ m_Transparency |= PDFTRANS_GROUP;
+ if (pGroup->GetIntegerBy("I")) {
+ m_Transparency |= PDFTRANS_ISOLATED;
+ }
+ if (pGroup->GetIntegerBy("K")) {
+ m_Transparency |= PDFTRANS_KNOCKOUT;
+ }
+}
diff --git a/core/fpdfapi/fpdf_page/cpdf_pageobjectlist.cpp b/core/fpdfapi/fpdf_page/cpdf_pageobjectlist.cpp
new file mode 100644
index 0000000000..36fb672849
--- /dev/null
+++ b/core/fpdfapi/fpdf_page/cpdf_pageobjectlist.cpp
@@ -0,0 +1,17 @@
+// Copyright 2016 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.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fpdfapi/fpdf_page/cpdf_pageobjectlist.h"
+
+#include "core/fpdfapi/fpdf_page/pageint.h"
+#include "core/include/fpdfapi/fpdf_pageobj.h"
+#include "third_party/base/stl_util.h"
+
+CPDF_PageObject* CPDF_PageObjectList::GetPageObjectByIndex(int index) {
+ if (index < 0 || index >= pdfium::CollectionSize<int>(*this))
+ return nullptr;
+ return (*this)[index].get();
+}
diff --git a/core/fpdfapi/fpdf_page/cpdf_pageobjectlist.h b/core/fpdfapi/fpdf_page/cpdf_pageobjectlist.h
new file mode 100644
index 0000000000..360bb26e8b
--- /dev/null
+++ b/core/fpdfapi/fpdf_page/cpdf_pageobjectlist.h
@@ -0,0 +1,21 @@
+// Copyright 2016 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.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FPDFAPI_FPDF_PAGE_CPDF_PAGEOBJECTLIST_H_
+#define CORE_FPDFAPI_FPDF_PAGE_CPDF_PAGEOBJECTLIST_H_
+
+#include <deque>
+#include <memory>
+
+class CPDF_PageObject;
+
+class CPDF_PageObjectList
+ : public std::deque<std::unique_ptr<CPDF_PageObject>> {
+ public:
+ CPDF_PageObject* GetPageObjectByIndex(int index);
+};
+
+#endif // CORE_FPDFAPI_FPDF_PAGE_CPDF_PAGEOBJECTLIST_H_
diff --git a/core/fpdfapi/fpdf_page/cpdf_parseoptions.cpp b/core/fpdfapi/fpdf_page/cpdf_parseoptions.cpp
new file mode 100644
index 0000000000..d22b6f13c9
--- /dev/null
+++ b/core/fpdfapi/fpdf_page/cpdf_parseoptions.cpp
@@ -0,0 +1,12 @@
+// Copyright 2016 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.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "core/fpdfapi/fpdf_page/cpdf_parseoptions.h"
+
+CPDF_ParseOptions::CPDF_ParseOptions()
+ : m_bTextOnly(FALSE),
+ m_bMarkedContent(TRUE),
+ m_bSeparateForm(TRUE),
+ m_bDecodeInlineImage(FALSE) {}
diff --git a/core/fpdfapi/fpdf_page/cpdf_parseoptions.h b/core/fpdfapi/fpdf_page/cpdf_parseoptions.h
new file mode 100644
index 0000000000..cd1bb69948
--- /dev/null
+++ b/core/fpdfapi/fpdf_page/cpdf_parseoptions.h
@@ -0,0 +1,22 @@
+// Copyright 2016 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.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FPDFAPI_FPDF_PAGE_CPDF_PARSEOPTIONS_H_
+#define CORE_FPDFAPI_FPDF_PAGE_CPDF_PARSEOPTIONS_H_
+
+#include "core/include/fxcrt/fx_system.h"
+
+class CPDF_ParseOptions {
+ public:
+ CPDF_ParseOptions();
+
+ FX_BOOL m_bTextOnly;
+ FX_BOOL m_bMarkedContent;
+ FX_BOOL m_bSeparateForm;
+ FX_BOOL m_bDecodeInlineImage;
+};
+
+#endif // CORE_FPDFAPI_FPDF_PAGE_CPDF_PARSEOPTIONS_H_
diff --git a/core/fpdfapi/fpdf_page/fpdf_page.cpp b/core/fpdfapi/fpdf_page/fpdf_page.cpp
index 2cec0928dd..ad54e320bc 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page.cpp
@@ -8,12 +8,13 @@
#include <algorithm>
+#include "core/fpdfapi/fpdf_page/include/cpdf_form.h"
+#include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
#include "core/fpdfapi/include/cpdf_modulemgr.h"
#include "core/fpdfapi/ipdf_rendermodule.h"
-#include "core/include/fpdfapi/fpdf_page.h"
#include "third_party/base/stl_util.h"
CPDF_PageObject::CPDF_PageObject() {}
@@ -463,76 +464,6 @@ void CPDF_FormObject::CalcBoundingBox() {
m_Top = form_rect.top;
}
-CPDF_PageObject* CPDF_PageObjectList::GetPageObjectByIndex(int index) {
- if (index < 0 || index >= pdfium::CollectionSize<int>(*this))
- return nullptr;
- return (*this)[index].get();
-}
-
-CPDF_PageObjectHolder::CPDF_PageObjectHolder()
- : m_pFormDict(nullptr),
- m_pFormStream(nullptr),
- m_pDocument(nullptr),
- m_pPageResources(nullptr),
- m_pResources(nullptr),
- m_Transparency(0),
- m_bBackgroundAlphaNeeded(FALSE),
- m_bHasImageMask(FALSE),
- m_ParseState(CONTENT_NOT_PARSED) {}
-
-void CPDF_PageObjectHolder::ContinueParse(IFX_Pause* pPause) {
- if (!m_pParser) {
- return;
- }
- m_pParser->Continue(pPause);
- if (m_pParser->GetStatus() == CPDF_ContentParser::Done) {
- m_ParseState = CONTENT_PARSED;
- m_pParser.reset();
- }
-}
-
-void CPDF_PageObjectHolder::Transform(const CFX_Matrix& matrix) {
- for (auto& pObj : m_PageObjectList)
- pObj->Transform(matrix);
-}
-
-CFX_FloatRect CPDF_PageObjectHolder::CalcBoundingBox() const {
- if (m_PageObjectList.empty())
- return CFX_FloatRect(0, 0, 0, 0);
-
- FX_FLOAT left = 1000000.0f;
- FX_FLOAT right = -1000000.0f;
- FX_FLOAT bottom = 1000000.0f;
- FX_FLOAT top = -1000000.0f;
- for (const auto& pObj : m_PageObjectList) {
- left = std::min(left, pObj->m_Left);
- right = std::max(right, pObj->m_Right);
- bottom = std::min(bottom, pObj->m_Bottom);
- top = std::max(top, pObj->m_Top);
- }
- return CFX_FloatRect(left, bottom, right, top);
-}
-
-void CPDF_PageObjectHolder::LoadTransInfo() {
- if (!m_pFormDict) {
- return;
- }
- CPDF_Dictionary* pGroup = m_pFormDict->GetDictBy("Group");
- if (!pGroup) {
- return;
- }
- if (pGroup->GetStringBy("S") != "Transparency") {
- return;
- }
- m_Transparency |= PDFTRANS_GROUP;
- if (pGroup->GetIntegerBy("I")) {
- m_Transparency |= PDFTRANS_ISOLATED;
- }
- if (pGroup->GetIntegerBy("K")) {
- m_Transparency |= PDFTRANS_KNOCKOUT;
- }
-}
-
CPDF_Page::CPDF_Page() : m_pPageRender(nullptr) {}
void CPDF_Page::Load(CPDF_Document* pDocument,
@@ -650,59 +581,6 @@ CPDF_Object* CPDF_Page::GetPageAttr(const CFX_ByteStringC& name) const {
return FPDFAPI_GetPageAttr(m_pFormDict, name);
}
-CPDF_Form::CPDF_Form(CPDF_Document* pDoc,
- CPDF_Dictionary* pPageResources,
- CPDF_Stream* pFormStream,
- CPDF_Dictionary* pParentResources) {
- m_pDocument = pDoc;
- m_pFormStream = pFormStream;
- m_pFormDict = pFormStream ? pFormStream->GetDict() : NULL;
- m_pResources = m_pFormDict->GetDictBy("Resources");
- m_pPageResources = pPageResources;
- if (!m_pResources) {
- m_pResources = pParentResources;
- }
- if (!m_pResources) {
- m_pResources = pPageResources;
- }
- m_Transparency = 0;
- LoadTransInfo();
-}
-
-CPDF_Form::~CPDF_Form() {}
-
-void CPDF_Form::StartParse(CPDF_AllStates* pGraphicStates,
- CFX_Matrix* pParentMatrix,
- CPDF_Type3Char* pType3Char,
- CPDF_ParseOptions* pOptions,
- int level) {
- if (m_ParseState == CONTENT_PARSED || m_ParseState == CONTENT_PARSING) {
- return;
- }
- m_pParser.reset(new CPDF_ContentParser);
- m_pParser->Start(this, pGraphicStates, pParentMatrix, pType3Char, pOptions,
- level);
- m_ParseState = CONTENT_PARSING;
-}
-
-void CPDF_Form::ParseContent(CPDF_AllStates* pGraphicStates,
- CFX_Matrix* pParentMatrix,
- CPDF_Type3Char* pType3Char,
- CPDF_ParseOptions* pOptions,
- int level) {
- StartParse(pGraphicStates, pParentMatrix, pType3Char, pOptions, level);
- ContinueParse(NULL);
-}
-
-CPDF_Form* CPDF_Form::Clone() const {
- CPDF_Form* pCloneForm =
- new CPDF_Form(m_pDocument, m_pPageResources, m_pFormStream, m_pResources);
- for (const auto& pObj : m_PageObjectList)
- pCloneForm->m_PageObjectList.emplace_back(pObj->Clone());
-
- return pCloneForm;
-}
-
void CPDF_Page::GetDisplayMatrix(CFX_Matrix& matrix,
int xPos,
int yPos,
@@ -756,10 +634,3 @@ void CPDF_Page::GetDisplayMatrix(CFX_Matrix& matrix,
matrix = m_PageMatrix;
matrix.Concat(display_matrix);
}
-
-CPDF_ParseOptions::CPDF_ParseOptions() {
- m_bTextOnly = FALSE;
- m_bMarkedContent = TRUE;
- m_bSeparateForm = TRUE;
- m_bDecodeInlineImage = FALSE;
-}
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/fpdfapi/fpdf_page/fpdf_page_colors.cpp
index 040821bc06..d4b69f2d3f 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_colors.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_colors.cpp
@@ -15,7 +15,6 @@
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h"
#include "core/fpdfapi/include/cpdf_modulemgr.h"
-#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fxcodec/fx_codec.h"
namespace {
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
index 9da5d1fe00..0d0c373c56 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
@@ -13,7 +13,6 @@
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
#include "core/fpdfapi/include/cpdf_modulemgr.h"
#include "core/fpdfapi/ipdf_pagemodule.h"
-#include "core/include/fpdfapi/fpdf_page.h"
namespace {
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/fpdfapi/fpdf_page/fpdf_page_func.cpp
index 00ca2d8d18..4bf7c06a7b 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_func.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_func.cpp
@@ -15,7 +15,6 @@
#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h"
-#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fxcrt/fx_safe_types.h"
#include "third_party/base/numerics/safe_conversions_impl.h"
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp b/core/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
index 99156411f6..cd81b97112 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
@@ -12,7 +12,6 @@
#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
#include "core/fpdfapi/fpdf_render/render_int.h"
-#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fpdfapi/fpdf_pageobj.h"
#include "third_party/base/stl_util.h"
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_image.cpp b/core/fpdfapi/fpdf_page/fpdf_page_image.cpp
index cd89725de2..247b0b9703 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_image.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_image.cpp
@@ -8,7 +8,6 @@
#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
-#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fpdfapi/fpdf_pageobj.h"
CPDF_ImageObject::CPDF_ImageObject() : m_pImage(nullptr) {}
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index 69ff8da21f..b62579813a 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -9,6 +9,7 @@
#include <vector>
#include "core/fpdfapi/fpdf_edit/include/cpdf_creator.h"
+#include "core/fpdfapi/fpdf_page/include/cpdf_form.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
@@ -16,7 +17,6 @@
#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h"
#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h"
-#include "core/include/fpdfapi/fpdf_page.h"
namespace {
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index 36be007b68..c1bb70ff80 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -8,6 +8,8 @@
#include <limits.h>
+#include "core/fpdfapi/fpdf_page/include/cpdf_form.h"
+#include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
#include "core/fpdfapi/fpdf_parser/cpdf_boolean.h"
#include "core/fpdfapi/fpdf_parser/cpdf_null.h"
#include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h"
@@ -19,7 +21,6 @@
#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h"
#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h"
#include "core/fpdfapi/include/cpdf_modulemgr.h"
-#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fxcodec/fx_codec.h"
#include "core/include/fxcrt/fx_ext.h"
#include "core/include/fxcrt/fx_safe_types.h"
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_path.cpp b/core/fpdfapi/fpdf_page/fpdf_page_path.cpp
index 07c6ae1a80..286dfdfb1c 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_path.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_path.cpp
@@ -6,7 +6,6 @@
#include "core/fpdfapi/fpdf_page/pageint.h"
-#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fpdfapi/fpdf_pageobj.h"
CPDF_PathObject::CPDF_PathObject() {}
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
index 7e22661624..fbb2c28373 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
@@ -8,10 +8,10 @@
#include <algorithm>
+#include "core/fpdfapi/fpdf_page/include/cpdf_form.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
-#include "core/include/fpdfapi/fpdf_page.h"
namespace {
diff --git a/core/fpdfapi/fpdf_page/include/cpdf_form.h b/core/fpdfapi/fpdf_page/include/cpdf_form.h
new file mode 100644
index 0000000000..3b9f1cc7fb
--- /dev/null
+++ b/core/fpdfapi/fpdf_page/include/cpdf_form.h
@@ -0,0 +1,44 @@
+// Copyright 2016 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.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_FORM_H_
+#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_FORM_H_
+
+#include "core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h"
+
+class CPDF_Document;
+class CPDF_Dictionary;
+class CPDF_Stream;
+class CPDF_AllStates;
+class CFX_Matrix;
+class CPDF_Type3Char;
+class CPDF_ParseOptions;
+
+class CPDF_Form : public CPDF_PageObjectHolder {
+ public:
+ CPDF_Form(CPDF_Document* pDocument,
+ CPDF_Dictionary* pPageResources,
+ CPDF_Stream* pFormStream,
+ CPDF_Dictionary* pParentResources = NULL);
+
+ ~CPDF_Form();
+
+ void StartParse(CPDF_AllStates* pGraphicStates,
+ CFX_Matrix* pParentMatrix,
+ CPDF_Type3Char* pType3Char,
+ CPDF_ParseOptions* pOptions,
+ int level = 0);
+
+ void ParseContent(CPDF_AllStates* pGraphicStates,
+ CFX_Matrix* pParentMatrix,
+ CPDF_Type3Char* pType3Char,
+ CPDF_ParseOptions* pOptions,
+ int level = 0);
+
+ CPDF_Form* Clone() const;
+};
+
+#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_FORM_H_
diff --git a/core/fpdfapi/fpdf_page/include/cpdf_page.h b/core/fpdfapi/fpdf_page/include/cpdf_page.h
new file mode 100644
index 0000000000..82c88d1c37
--- /dev/null
+++ b/core/fpdfapi/fpdf_page/include/cpdf_page.h
@@ -0,0 +1,57 @@
+// Copyright 2016 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.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PAGE_H_
+#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PAGE_H_
+
+#include "core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h"
+#include "core/include/fxcrt/fx_basic.h"
+#include "core/include/fxcrt/fx_coordinates.h"
+#include "core/include/fxcrt/fx_system.h"
+
+class CPDF_Document;
+class CPDF_Dictionary;
+class CPDF_Object;
+class CPDF_PageRenderCache;
+class CPDF_ParseOptions;
+
+class CPDF_Page : public CPDF_PageObjectHolder, public CFX_PrivateData {
+ public:
+ CPDF_Page();
+ ~CPDF_Page();
+
+ void Load(CPDF_Document* pDocument,
+ CPDF_Dictionary* pPageDict,
+ FX_BOOL bPageCache = TRUE);
+
+ void ParseContent(CPDF_ParseOptions* pOptions);
+
+ void GetDisplayMatrix(CFX_Matrix& matrix,
+ int xPos,
+ int yPos,
+ int xSize,
+ int ySize,
+ int iRotate) const;
+
+ FX_FLOAT GetPageWidth() const { return m_PageWidth; }
+ FX_FLOAT GetPageHeight() const { return m_PageHeight; }
+ CFX_FloatRect GetPageBBox() const { return m_BBox; }
+ const CFX_Matrix& GetPageMatrix() const { return m_PageMatrix; }
+ CPDF_Object* GetPageAttr(const CFX_ByteStringC& name) const;
+ CPDF_PageRenderCache* GetRenderCache() const { return m_pPageRender; }
+
+ protected:
+ friend class CPDF_ContentParser;
+
+ void StartParse(CPDF_ParseOptions* pOptions);
+
+ FX_FLOAT m_PageWidth;
+ FX_FLOAT m_PageHeight;
+ CFX_Matrix m_PageMatrix;
+ CPDF_PageRenderCache* m_pPageRender;
+};
+
+#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PAGE_H_
diff --git a/core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h b/core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h
new file mode 100644
index 0000000000..b0ab376956
--- /dev/null
+++ b/core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h
@@ -0,0 +1,67 @@
+// Copyright 2016 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.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PAGEOBJECTHOLDER_H_
+#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PAGEOBJECTHOLDER_H_
+
+#include "core/fpdfapi/fpdf_page/cpdf_pageobjectlist.h"
+#include "core/include/fxcrt/fx_coordinates.h"
+#include "core/include/fxcrt/fx_system.h"
+
+class IFX_Pause;
+class CPDF_Dictionary;
+class CPDF_Stream;
+class CPDF_Document;
+class CPDF_ContentParser;
+
+#define PDFTRANS_GROUP 0x0100
+#define PDFTRANS_ISOLATED 0x0200
+#define PDFTRANS_KNOCKOUT 0x0400
+
+class CPDF_PageObjectHolder {
+ public:
+ CPDF_PageObjectHolder();
+
+ void ContinueParse(IFX_Pause* pPause);
+ bool IsParsed() const { return m_ParseState == CONTENT_PARSED; }
+
+ CPDF_PageObjectList* GetPageObjectList() { return &m_PageObjectList; }
+ const CPDF_PageObjectList* GetPageObjectList() const {
+ return &m_PageObjectList;
+ }
+
+ FX_BOOL BackgroundAlphaNeeded() const { return m_bBackgroundAlphaNeeded; }
+ void SetBackgroundAlphaNeeded(FX_BOOL needed) {
+ m_bBackgroundAlphaNeeded = needed;
+ }
+
+ FX_BOOL HasImageMask() const { return m_bHasImageMask; }
+ void SetHasImageMask(FX_BOOL value) { m_bHasImageMask = value; }
+
+ void Transform(const CFX_Matrix& matrix);
+ CFX_FloatRect CalcBoundingBox() const;
+
+ CPDF_Dictionary* m_pFormDict;
+ CPDF_Stream* m_pFormStream;
+ CPDF_Document* m_pDocument;
+ CPDF_Dictionary* m_pPageResources;
+ CPDF_Dictionary* m_pResources;
+ CFX_FloatRect m_BBox;
+ int m_Transparency;
+
+ protected:
+ enum ParseState { CONTENT_NOT_PARSED, CONTENT_PARSING, CONTENT_PARSED };
+
+ void LoadTransInfo();
+
+ FX_BOOL m_bBackgroundAlphaNeeded;
+ FX_BOOL m_bHasImageMask;
+ ParseState m_ParseState;
+ std::unique_ptr<CPDF_ContentParser> m_pParser;
+ CPDF_PageObjectList m_PageObjectList;
+};
+
+#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PAGEOBJECTHOLDER_H_
diff --git a/core/fpdfapi/fpdf_page/pageint.h b/core/fpdfapi/fpdf_page/pageint.h
index 8818bc9af0..eab3d42b2b 100644
--- a/core/fpdfapi/fpdf_page/pageint.h
+++ b/core/fpdfapi/fpdf_page/pageint.h
@@ -12,7 +12,8 @@
#include <unordered_map>
#include <vector>
-#include "core/include/fpdfapi/fpdf_page.h"
+#include "core/fpdfapi/fpdf_page/cpdf_parseoptions.h"
+#include "core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h"
#include "core/include/fpdfapi/fpdf_pageobj.h"
class CPDF_AllStates;
diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp
index 94398df296..b52a7459eb 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp
@@ -6,6 +6,8 @@
#include "core/fpdfapi/fpdf_render/render_int.h"
+#include "core/fpdfapi/fpdf_page/include/cpdf_form.h"
+#include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
#include "core/fpdfapi/fpdf_page/pageint.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp b/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp
index fbe07842d9..298dea0504 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp
@@ -6,6 +6,8 @@
#include "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h"
+#include "core/fpdfapi/fpdf_page/cpdf_parseoptions.h"
+#include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
#include "core/fpdfapi/fpdf_page/pageint.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
#include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h"
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp
index 963ff246d9..b2c89853d7 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp
@@ -9,6 +9,9 @@
#include <utility>
#include <vector>
+#include "core/fpdfapi/fpdf_page/cpdf_parseoptions.h"
+#include "core/fpdfapi/fpdf_page/include/cpdf_form.h"
+#include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
#include "core/fpdfapi/fpdf_page/pageint.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
index 905e7a60c6..56af308232 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
@@ -10,6 +10,7 @@
#include <memory>
#include <vector>
+#include "core/fpdfapi/fpdf_page/cpdf_parseoptions.h"
#include "core/fpdfapi/fpdf_page/pageint.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
index 2e259126cf..8fef5b3ae4 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
@@ -6,6 +6,8 @@
#include "core/fpdfapi/fpdf_render/render_int.h"
+#include "core/fpdfapi/fpdf_page/cpdf_parseoptions.h"
+#include "core/fpdfapi/fpdf_page/include/cpdf_form.h"
#include "core/fpdfapi/fpdf_page/pageint.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
index 4db224939d..07790bdf4d 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
@@ -6,6 +6,8 @@
#include "core/fpdfapi/fpdf_render/render_int.h"
+#include "core/fpdfapi/fpdf_page/cpdf_parseoptions.h"
+#include "core/fpdfapi/fpdf_page/include/cpdf_form.h"
#include "core/fpdfapi/fpdf_page/pageint.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
diff --git a/core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h b/core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h
index eddd4b0c83..e5c0d9d6d8 100644
--- a/core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h
+++ b/core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h
@@ -9,8 +9,8 @@
#include <memory>
+#include "core/fpdfapi/fpdf_page/cpdf_pageobjectlist.h"
#include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h"
-#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fxcrt/fx_coordinates.h"
#include "core/include/fxcrt/fx_system.h"
diff --git a/core/fpdfdoc/doc_annot.cpp b/core/fpdfdoc/doc_annot.cpp
index 219d61151d..52f21922c7 100644
--- a/core/fpdfdoc/doc_annot.cpp
+++ b/core/fpdfdoc/doc_annot.cpp
@@ -4,13 +4,14 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "core/fpdfapi/fpdf_page/include/cpdf_form.h"
+#include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h"
#include "core/fpdfapi/fpdf_parser/ipdf_occontext.h"
#include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h"
#include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h"
-#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fpdfapi/fpdf_pageobj.h"
#include "core/include/fpdfdoc/fpdf_doc.h"
diff --git a/core/fpdfdoc/doc_bookmark.cpp b/core/fpdfdoc/doc_bookmark.cpp
index 908960e497..6acd247df8 100644
--- a/core/fpdfdoc/doc_bookmark.cpp
+++ b/core/fpdfdoc/doc_bookmark.cpp
@@ -10,7 +10,6 @@
#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h"
-#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fpdfdoc/fpdf_doc.h"
CPDF_Bookmark CPDF_BookmarkTree::GetFirstChild(
diff --git a/core/fpdfdoc/doc_form.cpp b/core/fpdfdoc/doc_form.cpp
index bcb2dcc00e..8329a5f68a 100644
--- a/core/fpdfdoc/doc_form.cpp
+++ b/core/fpdfdoc/doc_form.cpp
@@ -6,12 +6,12 @@
#include <vector>
+#include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
#include "core/fpdfapi/fpdf_parser/include/cfdf_document.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h"
#include "core/fpdfdoc/doc_utils.h"
-#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fpdfdoc/fpdf_doc.h"
#include "third_party/base/stl_util.h"
diff --git a/core/fpdfdoc/doc_formcontrol.cpp b/core/fpdfdoc/doc_formcontrol.cpp
index eab190279c..425c3a1ac3 100644
--- a/core/fpdfdoc/doc_formcontrol.cpp
+++ b/core/fpdfdoc/doc_formcontrol.cpp
@@ -6,11 +6,11 @@
#include <algorithm>
+#include "core/fpdfapi/fpdf_page/include/cpdf_form.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h"
#include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h"
-#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fpdfdoc/fpdf_doc.h"
CPDF_FormControl::CPDF_FormControl(CPDF_FormField* pField,
diff --git a/core/fpdfdoc/doc_link.cpp b/core/fpdfdoc/doc_link.cpp
index 6c7ecdec4b..b1a6a732ff 100644
--- a/core/fpdfdoc/doc_link.cpp
+++ b/core/fpdfdoc/doc_link.cpp
@@ -8,8 +8,8 @@
#include <vector>
+#include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
-#include "core/include/fpdfapi/fpdf_page.h"
CPDF_LinkList::CPDF_LinkList() {}
diff --git a/core/fpdfdoc/doc_tagged.cpp b/core/fpdfdoc/doc_tagged.cpp
index 5795b36120..4be0d6c973 100644
--- a/core/fpdfdoc/doc_tagged.cpp
+++ b/core/fpdfdoc/doc_tagged.cpp
@@ -12,7 +12,6 @@
#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h"
#include "core/fpdfdoc/doc_utils.h"
#include "core/fpdfdoc/tagged_int.h"
-#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fpdfdoc/fpdf_tagged.h"
const int nMaxRecursion = 32;
diff --git a/core/fpdftext/fpdf_text_int.cpp b/core/fpdftext/fpdf_text_int.cpp
index 0b237972fb..be01648d45 100644
--- a/core/fpdftext/fpdf_text_int.cpp
+++ b/core/fpdftext/fpdf_text_int.cpp
@@ -19,7 +19,6 @@
#include "core/fpdftext/include/ipdf_textpage.h"
#include "core/fpdftext/include/ipdf_textpagefind.h"
#include "core/fpdftext/unicodenormalization.h"
-#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fpdfapi/fpdf_pageobj.h"
#include "core/include/fpdfapi/fpdf_resource.h"
#include "core/include/fxcrt/fx_bidi.h"
diff --git a/core/fpdftext/fpdf_text_int.h b/core/fpdftext/fpdf_text_int.h
index 7ebf653f27..dc82d3f7d7 100644
--- a/core/fpdftext/fpdf_text_int.h
+++ b/core/fpdftext/fpdf_text_int.h
@@ -10,10 +10,12 @@
#include <deque>
#include <vector>
+#include "core/fpdfapi/fpdf_page/cpdf_pageobjectlist.h"
+#include "core/fpdfapi/fpdf_page/include/cpdf_form.h"
+#include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
#include "core/fpdftext/include/ipdf_linkextract.h"
#include "core/fpdftext/include/ipdf_textpage.h"
#include "core/fpdftext/include/ipdf_textpagefind.h"
-#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fxcrt/fx_basic.h"
class CFX_BidiChar;
diff --git a/core/fpdftext/include/ipdf_textpage.h b/core/fpdftext/include/ipdf_textpage.h
index 1698e9ab28..6808eae511 100644
--- a/core/fpdftext/include/ipdf_textpage.h
+++ b/core/fpdftext/include/ipdf_textpage.h
@@ -7,7 +7,6 @@
#ifndef CORE_FPDFTEXT_INCLUDE_IPDF_TEXTPAGE_H_
#define CORE_FPDFTEXT_INCLUDE_IPDF_TEXTPAGE_H_
-#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fpdfapi/fpdf_pageobj.h"
#include "core/include/fxcrt/fx_coordinates.h"
#include "core/include/fxcrt/fx_system.h"
diff --git a/core/include/fpdfapi/fpdf_page.h b/core/include/fpdfapi/fpdf_page.h
deleted file mode 100644
index 534faf2c2b..0000000000
--- a/core/include/fpdfapi/fpdf_page.h
+++ /dev/null
@@ -1,169 +0,0 @@
-// Copyright 2014 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.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef CORE_INCLUDE_FPDFAPI_FPDF_PAGE_H_
-#define CORE_INCLUDE_FPDFAPI_FPDF_PAGE_H_
-
-#include <deque>
-#include <memory>
-
-#include "core/include/fpdfapi/fpdf_resource.h"
-#include "core/include/fxge/fx_dib.h"
-
-class CPDF_Page;
-class CPDF_Form;
-class CPDF_ParseOptions;
-class CPDF_PageObject;
-class CPDF_PageRenderCache;
-class CPDF_AllStates;
-class CPDF_ContentParser;
-class CPDF_ImageObject;
-
-#define PDFTRANS_GROUP 0x0100
-#define PDFTRANS_ISOLATED 0x0200
-#define PDFTRANS_KNOCKOUT 0x0400
-
-class CPDF_PageObjectList
- : public std::deque<std::unique_ptr<CPDF_PageObject>> {
- public:
- CPDF_PageObject* GetPageObjectByIndex(int index);
-};
-
-class CPDF_PageObjectHolder {
- public:
- CPDF_PageObjectHolder();
-
- void ContinueParse(IFX_Pause* pPause);
- bool IsParsed() const { return m_ParseState == CONTENT_PARSED; }
-
- CPDF_PageObjectList* GetPageObjectList() { return &m_PageObjectList; }
- const CPDF_PageObjectList* GetPageObjectList() const {
- return &m_PageObjectList;
- }
-
- FX_BOOL BackgroundAlphaNeeded() const { return m_bBackgroundAlphaNeeded; }
- void SetBackgroundAlphaNeeded(FX_BOOL needed) {
- m_bBackgroundAlphaNeeded = needed;
- }
-
- FX_BOOL HasImageMask() const { return m_bHasImageMask; }
- void SetHasImageMask(FX_BOOL value) { m_bHasImageMask = value; }
-
- void Transform(const CFX_Matrix& matrix);
- CFX_FloatRect CalcBoundingBox() const;
-
- CPDF_Dictionary* m_pFormDict;
- CPDF_Stream* m_pFormStream;
- CPDF_Document* m_pDocument;
- CPDF_Dictionary* m_pPageResources;
- CPDF_Dictionary* m_pResources;
- CFX_FloatRect m_BBox;
- int m_Transparency;
-
- protected:
- enum ParseState { CONTENT_NOT_PARSED, CONTENT_PARSING, CONTENT_PARSED };
-
- void LoadTransInfo();
-
- FX_BOOL m_bBackgroundAlphaNeeded;
- FX_BOOL m_bHasImageMask;
- ParseState m_ParseState;
- std::unique_ptr<CPDF_ContentParser> m_pParser;
- CPDF_PageObjectList m_PageObjectList;
-};
-
-class CPDF_Page : public CPDF_PageObjectHolder, public CFX_PrivateData {
- public:
- CPDF_Page();
- ~CPDF_Page();
-
- void Load(CPDF_Document* pDocument,
- CPDF_Dictionary* pPageDict,
- FX_BOOL bPageCache = TRUE);
-
- void ParseContent(CPDF_ParseOptions* pOptions);
-
- void GetDisplayMatrix(CFX_Matrix& matrix,
- int xPos,
- int yPos,
- int xSize,
- int ySize,
- int iRotate) const;
-
- FX_FLOAT GetPageWidth() const { return m_PageWidth; }
- FX_FLOAT GetPageHeight() const { return m_PageHeight; }
- CFX_FloatRect GetPageBBox() const { return m_BBox; }
- const CFX_Matrix& GetPageMatrix() const { return m_PageMatrix; }
- CPDF_Object* GetPageAttr(const CFX_ByteStringC& name) const;
- CPDF_PageRenderCache* GetRenderCache() const { return m_pPageRender; }
-
- protected:
- friend class CPDF_ContentParser;
- void StartParse(CPDF_ParseOptions* pOptions);
-
- FX_FLOAT m_PageWidth;
- FX_FLOAT m_PageHeight;
- CFX_Matrix m_PageMatrix;
- CPDF_PageRenderCache* m_pPageRender;
-};
-class CPDF_ParseOptions {
- public:
- CPDF_ParseOptions();
-
- FX_BOOL m_bTextOnly;
-
- FX_BOOL m_bMarkedContent;
-
- FX_BOOL m_bSeparateForm;
-
- FX_BOOL m_bDecodeInlineImage;
-};
-class CPDF_Form : public CPDF_PageObjectHolder {
- public:
- CPDF_Form(CPDF_Document* pDocument,
- CPDF_Dictionary* pPageResources,
- CPDF_Stream* pFormStream,
- CPDF_Dictionary* pParentResources = NULL);
-
- ~CPDF_Form();
-
- void StartParse(CPDF_AllStates* pGraphicStates,
- CFX_Matrix* pParentMatrix,
- CPDF_Type3Char* pType3Char,
- CPDF_ParseOptions* pOptions,
- int level = 0);
-
- void ParseContent(CPDF_AllStates* pGraphicStates,
- CFX_Matrix* pParentMatrix,
- CPDF_Type3Char* pType3Char,
- CPDF_ParseOptions* pOptions,
- int level = 0);
-
- CPDF_Form* Clone() const;
-};
-class CPDF_PageContentGenerator {
- public:
- explicit CPDF_PageContentGenerator(CPDF_Page* pPage);
-
- FX_BOOL InsertPageObject(CPDF_PageObject* pPageObject);
- void GenerateContent();
- void TransformContent(CFX_Matrix& matrix);
-
- private:
- void ProcessImage(CFX_ByteTextBuf& buf, CPDF_ImageObject* pImageObj);
- void ProcessForm(CFX_ByteTextBuf& buf,
- const uint8_t* data,
- FX_DWORD size,
- CFX_Matrix& matrix);
- CFX_ByteString RealizeResource(CPDF_Object* pResourceObj,
- const FX_CHAR* szType);
-
- CPDF_Page* m_pPage;
- CPDF_Document* m_pDocument;
- CFX_ArrayTemplate<CPDF_PageObject*> m_pageObjects;
-};
-
-#endif // CORE_INCLUDE_FPDFAPI_FPDF_PAGE_H_