From 455a4199482324c888ea5892c660da354435c091 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 16 Mar 2016 09:48:56 -0400 Subject: Move core/include/fpdfapi/fpdf_page.h to correct locations. This CL splits the fpdf_page.h header into the individual classes and moves them to the correct core/fpdfapi locations. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1805663002 . --- BUILD.gn | 13 +- .../fpdf_edit/cpdf_pagecontentgenerator.cpp | 163 ++++++++++++++++++++ core/fpdfapi/fpdf_edit/fpdf_edit_content.cpp | 161 -------------------- core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp | 1 - core/fpdfapi/fpdf_edit/fpdf_edit_image.cpp | 2 +- core/fpdfapi/fpdf_edit/include/cpdf_creator.h | 1 - .../fpdf_edit/include/cpdf_pagecontentgenerator.h | 42 +++++ core/fpdfapi/fpdf_font/fpdf_font.cpp | 2 +- core/fpdfapi/fpdf_font/fpdf_font_charset.cpp | 1 - core/fpdfapi/fpdf_font/fpdf_font_cid.cpp | 1 - core/fpdfapi/fpdf_page/cpdf_form.cpp | 65 ++++++++ core/fpdfapi/fpdf_page/cpdf_pageobjectholder.cpp | 73 +++++++++ core/fpdfapi/fpdf_page/cpdf_pageobjectlist.cpp | 17 +++ core/fpdfapi/fpdf_page/cpdf_pageobjectlist.h | 21 +++ core/fpdfapi/fpdf_page/cpdf_parseoptions.cpp | 12 ++ core/fpdfapi/fpdf_page/cpdf_parseoptions.h | 22 +++ core/fpdfapi/fpdf_page/fpdf_page.cpp | 133 +--------------- core/fpdfapi/fpdf_page/fpdf_page_colors.cpp | 1 - core/fpdfapi/fpdf_page/fpdf_page_doc.cpp | 1 - core/fpdfapi/fpdf_page/fpdf_page_func.cpp | 1 - core/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp | 1 - core/fpdfapi/fpdf_page/fpdf_page_image.cpp | 1 - core/fpdfapi/fpdf_page/fpdf_page_parser.cpp | 2 +- core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp | 3 +- core/fpdfapi/fpdf_page/fpdf_page_path.cpp | 1 - core/fpdfapi/fpdf_page/fpdf_page_pattern.cpp | 2 +- core/fpdfapi/fpdf_page/include/cpdf_form.h | 44 ++++++ core/fpdfapi/fpdf_page/include/cpdf_page.h | 57 +++++++ .../fpdf_page/include/cpdf_pageobjectholder.h | 67 ++++++++ core/fpdfapi/fpdf_page/pageint.h | 3 +- core/fpdfapi/fpdf_render/fpdf_render.cpp | 2 + core/fpdfapi/fpdf_render/fpdf_render_cache.cpp | 2 + core/fpdfapi/fpdf_render/fpdf_render_image.cpp | 3 + core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp | 1 + core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp | 2 + core/fpdfapi/fpdf_render/fpdf_render_text.cpp | 2 + .../fpdf_render/include/cpdf_progressiverenderer.h | 2 +- core/fpdfdoc/doc_annot.cpp | 3 +- core/fpdfdoc/doc_bookmark.cpp | 1 - core/fpdfdoc/doc_form.cpp | 2 +- core/fpdfdoc/doc_formcontrol.cpp | 2 +- core/fpdfdoc/doc_link.cpp | 2 +- core/fpdfdoc/doc_tagged.cpp | 1 - core/fpdftext/fpdf_text_int.cpp | 1 - core/fpdftext/fpdf_text_int.h | 4 +- core/fpdftext/include/ipdf_textpage.h | 1 - core/include/fpdfapi/fpdf_page.h | 169 --------------------- fpdfsdk/DEPS | 1 + fpdfsdk/formfiller/FFL_CBA_Fontmap.cpp | 2 +- fpdfsdk/formfiller/FFL_FormFiller.cpp | 2 +- fpdfsdk/formfiller/FFL_IFormFiller.cpp | 2 +- fpdfsdk/fpdf_flatten.cpp | 2 +- fpdfsdk/fpdf_progressive.cpp | 1 + fpdfsdk/fpdf_transformpage.cpp | 2 +- fpdfsdk/fpdfdoc.cpp | 2 +- fpdfsdk/fpdfeditpage.cpp | 4 +- fpdfsdk/fpdfformfill.cpp | 2 +- fpdfsdk/fpdftext.cpp | 1 + fpdfsdk/fpdfview.cpp | 1 + fpdfsdk/fpdfxfa/fpdfxfa_page.cpp | 2 +- fpdfsdk/fsdk_annothandler.cpp | 2 +- fpdfsdk/fsdk_baseform.cpp | 2 +- fpdfsdk/fsdk_mgr.cpp | 2 +- fpdfsdk/fxedit/fxet_pageobjs.cpp | 2 +- fpdfsdk/javascript/Document.cpp | 2 +- fpdfsdk/javascript/Field.cpp | 2 +- fpdfsdk/pdfwindow/PWL_Edit.cpp | 2 +- fpdfsdk/pdfwindow/PWL_FontMap.cpp | 2 +- fpdfsdk/pdfwindow/PWL_Icon.cpp | 2 +- pdfium.gyp | 13 +- xfa/fxfa/app/DEPS | 1 + xfa/fxfa/app/xfa_ffwidget.cpp | 2 +- 72 files changed, 662 insertions(+), 510 deletions(-) create mode 100644 core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp delete mode 100644 core/fpdfapi/fpdf_edit/fpdf_edit_content.cpp create mode 100644 core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h create mode 100644 core/fpdfapi/fpdf_page/cpdf_form.cpp create mode 100644 core/fpdfapi/fpdf_page/cpdf_pageobjectholder.cpp create mode 100644 core/fpdfapi/fpdf_page/cpdf_pageobjectlist.cpp create mode 100644 core/fpdfapi/fpdf_page/cpdf_pageobjectlist.h create mode 100644 core/fpdfapi/fpdf_page/cpdf_parseoptions.cpp create mode 100644 core/fpdfapi/fpdf_page/cpdf_parseoptions.h create mode 100644 core/fpdfapi/fpdf_page/include/cpdf_form.h create mode 100644 core/fpdfapi/fpdf_page/include/cpdf_page.h create mode 100644 core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h delete mode 100644 core/include/fpdfapi/fpdf_page.h diff --git a/BUILD.gn b/BUILD.gn index a4ea471fcf..4b5edbba92 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -301,18 +301,25 @@ static_library("fpdfapi") { "core/fpdfapi/fpdf_cmaps/Korea1/cmaps_korea1.cpp", "core/fpdfapi/fpdf_cmaps/cmap_int.h", "core/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp", + "core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp", "core/fpdfapi/fpdf_edit/editint.h", - "core/fpdfapi/fpdf_edit/fpdf_edit_content.cpp", "core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp", "core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp", "core/fpdfapi/fpdf_edit/fpdf_edit_image.cpp", "core/fpdfapi/fpdf_edit/include/cpdf_creator.h", + "core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h", "core/fpdfapi/fpdf_font/font_int.h", "core/fpdfapi/fpdf_font/fpdf_font.cpp", "core/fpdfapi/fpdf_font/fpdf_font_charset.cpp", "core/fpdfapi/fpdf_font/fpdf_font_cid.cpp", "core/fpdfapi/fpdf_font/ttgsubtable.cpp", "core/fpdfapi/fpdf_font/ttgsubtable.h", + "core/fpdfapi/fpdf_page/cpdf_form.cpp", + "core/fpdfapi/fpdf_page/cpdf_pageobjectholder.cpp", + "core/fpdfapi/fpdf_page/cpdf_pageobjectlist.cpp", + "core/fpdfapi/fpdf_page/cpdf_pageobjectlist.h", + "core/fpdfapi/fpdf_page/cpdf_parseoptions.cpp", + "core/fpdfapi/fpdf_page/cpdf_parseoptions.h", "core/fpdfapi/fpdf_page/fpdf_page.cpp", "core/fpdfapi/fpdf_page/fpdf_page_colors.cpp", "core/fpdfapi/fpdf_page/fpdf_page_doc.cpp", @@ -323,6 +330,9 @@ static_library("fpdfapi") { "core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp", "core/fpdfapi/fpdf_page/fpdf_page_path.cpp", "core/fpdfapi/fpdf_page/fpdf_page_pattern.cpp", + "core/fpdfapi/fpdf_page/include/cpdf_form.h", + "core/fpdfapi/fpdf_page/include/cpdf_page.h", + "core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h", "core/fpdfapi/fpdf_page/pageint.h", "core/fpdfapi/fpdf_parser/cfdf_document.cpp", "core/fpdfapi/fpdf_parser/cpdf_array.cpp", @@ -390,7 +400,6 @@ static_library("fpdfapi") { "core/fpdfapi/include/cpdf_modulemgr.h", "core/fpdfapi/ipdf_pagemodule.h", "core/fpdfapi/ipdf_rendermodule.h", - "core/include/fpdfapi/fpdf_page.h", "core/include/fpdfapi/fpdf_pageobj.h", "core/include/fpdfapi/fpdf_resource.h", ] diff --git a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp new file mode 100644 index 0000000000..a09aa1f9b3 --- /dev/null +++ b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp @@ -0,0 +1,163 @@ +// 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" + +CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& ar, CFX_Matrix& matrix) { + ar << matrix.a << " " << matrix.b << " " << matrix.c << " " << matrix.d << " " + << matrix.e << " " << matrix.f; + return ar; +} + +CPDF_PageContentGenerator::CPDF_PageContentGenerator(CPDF_Page* pPage) + : m_pPage(pPage), m_pDocument(m_pPage->m_pDocument) { + for (const auto& pObj : *pPage->GetPageObjectList()) + InsertPageObject(pObj.get()); +} + +FX_BOOL CPDF_PageContentGenerator::InsertPageObject( + CPDF_PageObject* pPageObject) { + return pPageObject && m_pageObjects.Add(pPageObject); +} + +void CPDF_PageContentGenerator::GenerateContent() { + CFX_ByteTextBuf buf; + CPDF_Dictionary* pPageDict = m_pPage->m_pFormDict; + for (int i = 0; i < m_pageObjects.GetSize(); ++i) { + CPDF_PageObject* pPageObj = m_pageObjects[i]; + if (!pPageObj || !pPageObj->IsImage()) { + continue; + } + ProcessImage(buf, pPageObj->AsImage()); + } + CPDF_Object* pContent = + pPageDict ? pPageDict->GetElementValue("Contents") : NULL; + if (pContent) { + pPageDict->RemoveAt("Contents"); + } + CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL); + pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE); + m_pDocument->AddIndirectObject(pStream); + pPageDict->SetAtReference("Contents", m_pDocument, pStream->GetObjNum()); +} +CFX_ByteString CPDF_PageContentGenerator::RealizeResource( + CPDF_Object* pResourceObj, + const FX_CHAR* szType) { + if (!m_pPage->m_pResources) { + m_pPage->m_pResources = new CPDF_Dictionary; + int objnum = m_pDocument->AddIndirectObject(m_pPage->m_pResources); + m_pPage->m_pFormDict->SetAtReference("Resources", m_pDocument, objnum); + } + CPDF_Dictionary* pResList = m_pPage->m_pResources->GetDictBy(szType); + if (!pResList) { + pResList = new CPDF_Dictionary; + m_pPage->m_pResources->SetAt(szType, pResList); + } + m_pDocument->AddIndirectObject(pResourceObj); + CFX_ByteString name; + int idnum = 1; + while (1) { + name.Format("FX%c%d", szType[0], idnum); + if (!pResList->KeyExist(name)) { + break; + } + idnum++; + } + pResList->AddReference(name, m_pDocument, pResourceObj->GetObjNum()); + return name; +} +void CPDF_PageContentGenerator::ProcessImage(CFX_ByteTextBuf& buf, + CPDF_ImageObject* pImageObj) { + if ((pImageObj->m_Matrix.a == 0 && pImageObj->m_Matrix.b == 0) || + (pImageObj->m_Matrix.c == 0 && pImageObj->m_Matrix.d == 0)) { + return; + } + buf << "q " << pImageObj->m_Matrix << " cm "; + if (!pImageObj->m_pImage->IsInline()) { + CPDF_Stream* pStream = pImageObj->m_pImage->GetStream(); + FX_DWORD dwSavedObjNum = pStream->GetObjNum(); + CFX_ByteString name = RealizeResource(pStream, "XObject"); + if (dwSavedObjNum == 0) { + if (pImageObj->m_pImage) + pImageObj->m_pImage->Release(); + pImageObj->m_pImage = m_pDocument->GetPageData()->GetImage(pStream); + } + buf << "/" << PDF_NameEncode(name) << " Do Q\n"; + } +} +void CPDF_PageContentGenerator::ProcessForm(CFX_ByteTextBuf& buf, + const uint8_t* data, + FX_DWORD size, + CFX_Matrix& matrix) { + if (!data || !size) { + return; + } + CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL); + CPDF_Dictionary* pFormDict = new CPDF_Dictionary; + pFormDict->SetAtName("Type", "XObject"); + pFormDict->SetAtName("Subtype", "Form"); + CFX_FloatRect bbox = m_pPage->GetPageBBox(); + matrix.TransformRect(bbox); + pFormDict->SetAtRect("BBox", bbox); + pStream->InitStream((uint8_t*)data, size, pFormDict); + buf << "q " << matrix << " cm "; + CFX_ByteString name = RealizeResource(pStream, "XObject"); + buf << "/" << PDF_NameEncode(name) << " Do Q\n"; +} +void CPDF_PageContentGenerator::TransformContent(CFX_Matrix& matrix) { + CPDF_Dictionary* pDict = m_pPage->m_pFormDict; + CPDF_Object* pContent = pDict ? pDict->GetElementValue("Contents") : NULL; + if (!pContent) + return; + + CFX_ByteTextBuf buf; + if (CPDF_Array* pArray = pContent->AsArray()) { + int iCount = pArray->GetCount(); + CPDF_StreamAcc** pContentArray = FX_Alloc(CPDF_StreamAcc*, iCount); + int size = 0; + int i = 0; + for (i = 0; i < iCount; ++i) { + pContent = pArray->GetElement(i); + CPDF_Stream* pStream = ToStream(pContent); + if (!pStream) + continue; + + CPDF_StreamAcc* pStreamAcc = new CPDF_StreamAcc(); + pStreamAcc->LoadAllData(pStream); + pContentArray[i] = pStreamAcc; + size += pContentArray[i]->GetSize() + 1; + } + int pos = 0; + uint8_t* pBuf = FX_Alloc(uint8_t, size); + for (i = 0; i < iCount; ++i) { + FXSYS_memcpy(pBuf + pos, pContentArray[i]->GetData(), + pContentArray[i]->GetSize()); + pos += pContentArray[i]->GetSize() + 1; + pBuf[pos - 1] = ' '; + delete pContentArray[i]; + } + ProcessForm(buf, pBuf, size, matrix); + FX_Free(pBuf); + FX_Free(pContentArray); + } else if (CPDF_Stream* pStream = pContent->AsStream()) { + CPDF_StreamAcc contentStream; + contentStream.LoadAllData(pStream); + ProcessForm(buf, contentStream.GetData(), contentStream.GetSize(), matrix); + } + CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL); + pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE); + m_pDocument->AddIndirectObject(pStream); + m_pPage->m_pFormDict->SetAtReference("Contents", m_pDocument, + pStream->GetObjNum()); +} diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_content.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_content.cpp deleted file mode 100644 index 6010a04369..0000000000 --- a/core/fpdfapi/fpdf_edit/fpdf_edit_content.cpp +++ /dev/null @@ -1,161 +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 - -#include "core/fpdfapi/fpdf_edit/include/cpdf_creator.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 << " " - << matrix.e << " " << matrix.f; - return ar; -} - -CPDF_PageContentGenerator::CPDF_PageContentGenerator(CPDF_Page* pPage) - : m_pPage(pPage), m_pDocument(m_pPage->m_pDocument) { - for (const auto& pObj : *pPage->GetPageObjectList()) - InsertPageObject(pObj.get()); -} - -FX_BOOL CPDF_PageContentGenerator::InsertPageObject( - CPDF_PageObject* pPageObject) { - return pPageObject && m_pageObjects.Add(pPageObject); -} - -void CPDF_PageContentGenerator::GenerateContent() { - CFX_ByteTextBuf buf; - CPDF_Dictionary* pPageDict = m_pPage->m_pFormDict; - for (int i = 0; i < m_pageObjects.GetSize(); ++i) { - CPDF_PageObject* pPageObj = m_pageObjects[i]; - if (!pPageObj || !pPageObj->IsImage()) { - continue; - } - ProcessImage(buf, pPageObj->AsImage()); - } - CPDF_Object* pContent = - pPageDict ? pPageDict->GetElementValue("Contents") : NULL; - if (pContent) { - pPageDict->RemoveAt("Contents"); - } - CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL); - pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE); - m_pDocument->AddIndirectObject(pStream); - pPageDict->SetAtReference("Contents", m_pDocument, pStream->GetObjNum()); -} -CFX_ByteString CPDF_PageContentGenerator::RealizeResource( - CPDF_Object* pResourceObj, - const FX_CHAR* szType) { - if (!m_pPage->m_pResources) { - m_pPage->m_pResources = new CPDF_Dictionary; - int objnum = m_pDocument->AddIndirectObject(m_pPage->m_pResources); - m_pPage->m_pFormDict->SetAtReference("Resources", m_pDocument, objnum); - } - CPDF_Dictionary* pResList = m_pPage->m_pResources->GetDictBy(szType); - if (!pResList) { - pResList = new CPDF_Dictionary; - m_pPage->m_pResources->SetAt(szType, pResList); - } - m_pDocument->AddIndirectObject(pResourceObj); - CFX_ByteString name; - int idnum = 1; - while (1) { - name.Format("FX%c%d", szType[0], idnum); - if (!pResList->KeyExist(name)) { - break; - } - idnum++; - } - pResList->AddReference(name, m_pDocument, pResourceObj->GetObjNum()); - return name; -} -void CPDF_PageContentGenerator::ProcessImage(CFX_ByteTextBuf& buf, - CPDF_ImageObject* pImageObj) { - if ((pImageObj->m_Matrix.a == 0 && pImageObj->m_Matrix.b == 0) || - (pImageObj->m_Matrix.c == 0 && pImageObj->m_Matrix.d == 0)) { - return; - } - buf << "q " << pImageObj->m_Matrix << " cm "; - if (!pImageObj->m_pImage->IsInline()) { - CPDF_Stream* pStream = pImageObj->m_pImage->GetStream(); - FX_DWORD dwSavedObjNum = pStream->GetObjNum(); - CFX_ByteString name = RealizeResource(pStream, "XObject"); - if (dwSavedObjNum == 0) { - if (pImageObj->m_pImage) - pImageObj->m_pImage->Release(); - pImageObj->m_pImage = m_pDocument->GetPageData()->GetImage(pStream); - } - buf << "/" << PDF_NameEncode(name) << " Do Q\n"; - } -} -void CPDF_PageContentGenerator::ProcessForm(CFX_ByteTextBuf& buf, - const uint8_t* data, - FX_DWORD size, - CFX_Matrix& matrix) { - if (!data || !size) { - return; - } - CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL); - CPDF_Dictionary* pFormDict = new CPDF_Dictionary; - pFormDict->SetAtName("Type", "XObject"); - pFormDict->SetAtName("Subtype", "Form"); - CFX_FloatRect bbox = m_pPage->GetPageBBox(); - matrix.TransformRect(bbox); - pFormDict->SetAtRect("BBox", bbox); - pStream->InitStream((uint8_t*)data, size, pFormDict); - buf << "q " << matrix << " cm "; - CFX_ByteString name = RealizeResource(pStream, "XObject"); - buf << "/" << PDF_NameEncode(name) << " Do Q\n"; -} -void CPDF_PageContentGenerator::TransformContent(CFX_Matrix& matrix) { - CPDF_Dictionary* pDict = m_pPage->m_pFormDict; - CPDF_Object* pContent = pDict ? pDict->GetElementValue("Contents") : NULL; - if (!pContent) - return; - - CFX_ByteTextBuf buf; - if (CPDF_Array* pArray = pContent->AsArray()) { - int iCount = pArray->GetCount(); - CPDF_StreamAcc** pContentArray = FX_Alloc(CPDF_StreamAcc*, iCount); - int size = 0; - int i = 0; - for (i = 0; i < iCount; ++i) { - pContent = pArray->GetElement(i); - CPDF_Stream* pStream = ToStream(pContent); - if (!pStream) - continue; - - CPDF_StreamAcc* pStreamAcc = new CPDF_StreamAcc(); - pStreamAcc->LoadAllData(pStream); - pContentArray[i] = pStreamAcc; - size += pContentArray[i]->GetSize() + 1; - } - int pos = 0; - uint8_t* pBuf = FX_Alloc(uint8_t, size); - for (i = 0; i < iCount; ++i) { - FXSYS_memcpy(pBuf + pos, pContentArray[i]->GetData(), - pContentArray[i]->GetSize()); - pos += pContentArray[i]->GetSize() + 1; - pBuf[pos - 1] = ' '; - delete pContentArray[i]; - } - ProcessForm(buf, pBuf, size, matrix); - FX_Free(pBuf); - FX_Free(pContentArray); - } else if (CPDF_Stream* pStream = pContent->AsStream()) { - CPDF_StreamAcc contentStream; - contentStream.LoadAllData(pStream); - ProcessForm(buf, contentStream.GetData(), contentStream.GetSize(), matrix); - } - CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL); - pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE); - m_pDocument->AddIndirectObject(pStream); - m_pPage->m_pFormDict->SetAtReference("Contents", m_pDocument, - pStream->GetObjNum()); -} 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 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(*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 +#include + +class CPDF_PageObject; + +class CPDF_PageObjectList + : public std::deque> { + 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 +#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(*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 #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 +#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 +#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 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 #include -#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 #include +#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 #include +#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 +#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 +#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 +#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 +#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 #include +#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 -#include - -#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> { - 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 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 m_pageObjects; -}; - -#endif // CORE_INCLUDE_FPDFAPI_FPDF_PAGE_H_ diff --git a/fpdfsdk/DEPS b/fpdfsdk/DEPS index a351ff794f..d81d04b1c4 100644 --- a/fpdfsdk/DEPS +++ b/fpdfsdk/DEPS @@ -3,6 +3,7 @@ include_rules = [ '+core/fpdftext/include', '+core/fpdfapi/include', '+core/fpdfapi/fpdf_edit/include', + '+core/fpdfapi/fpdf_page/include', '+core/fpdfapi/fpdf_parser/include', '+core/fpdfapi/fpdf_render/include', '+javascript/IJavaScript.h', diff --git a/fpdfsdk/formfiller/FFL_CBA_Fontmap.cpp b/fpdfsdk/formfiller/FFL_CBA_Fontmap.cpp index 44e9cdd89e..d7488d1592 100644 --- a/fpdfsdk/formfiller/FFL_CBA_Fontmap.cpp +++ b/fpdfsdk/formfiller/FFL_CBA_Fontmap.cpp @@ -6,9 +6,9 @@ #include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h" +#include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" -#include "core/include/fpdfapi/fpdf_page.h" #include "fpdfsdk/include/fsdk_baseannot.h" CBA_FontMap::CBA_FontMap(CPDFSDK_Annot* pAnnot, diff --git a/fpdfsdk/formfiller/FFL_FormFiller.cpp b/fpdfsdk/formfiller/FFL_FormFiller.cpp index fbf0fd2ec6..e764c19270 100644 --- a/fpdfsdk/formfiller/FFL_FormFiller.cpp +++ b/fpdfsdk/formfiller/FFL_FormFiller.cpp @@ -6,7 +6,7 @@ #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" -#include "core/include/fpdfapi/fpdf_page.h" +#include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h" #include "fpdfsdk/include/fsdk_common.h" #include "fpdfsdk/include/fsdk_mgr.h" diff --git a/fpdfsdk/formfiller/FFL_IFormFiller.cpp b/fpdfsdk/formfiller/FFL_IFormFiller.cpp index 4c5537e8f8..8cc7b40c9f 100644 --- a/fpdfsdk/formfiller/FFL_IFormFiller.cpp +++ b/fpdfsdk/formfiller/FFL_IFormFiller.cpp @@ -6,8 +6,8 @@ #include "fpdfsdk/include/formfiller/FFL_IFormFiller.h" +#include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/include/fpdfapi/fpdf_page.h" #include "fpdfsdk/include/formfiller/FFL_CheckBox.h" #include "fpdfsdk/include/formfiller/FFL_ComboBox.h" #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp index bb982ca78b..92351364d3 100644 --- a/fpdfsdk/fpdf_flatten.cpp +++ b/fpdfsdk/fpdf_flatten.cpp @@ -8,10 +8,10 @@ #include +#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_number.h" -#include "core/include/fpdfapi/fpdf_page.h" #include "fpdfsdk/include/fsdk_define.h" typedef CFX_ArrayTemplate CPDF_ObjectArray; diff --git a/fpdfsdk/fpdf_progressive.cpp b/fpdfsdk/fpdf_progressive.cpp index f4af9c4699..1450f8e74b 100644 --- a/fpdfsdk/fpdf_progressive.cpp +++ b/fpdfsdk/fpdf_progressive.cpp @@ -6,6 +6,7 @@ #include "public/fpdf_progressive.h" +#include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h" #include "fpdfsdk/include/fsdk_define.h" #include "fpdfsdk/include/fsdk_rendercontext.h" diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp index 033e49fdf7..ad119279f7 100644 --- a/fpdfsdk/fpdf_transformpage.cpp +++ b/fpdfsdk/fpdf_transformpage.cpp @@ -6,11 +6,11 @@ #include "public/fpdf_transformpage.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_number.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" -#include "core/include/fpdfapi/fpdf_page.h" #include "fpdfsdk/include/fsdk_define.h" namespace { diff --git a/fpdfsdk/fpdfdoc.cpp b/fpdfsdk/fpdfdoc.cpp index cb05df19e9..6a65e4ae22 100644 --- a/fpdfsdk/fpdfdoc.cpp +++ b/fpdfsdk/fpdfdoc.cpp @@ -8,9 +8,9 @@ #include +#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/include/fpdfapi/fpdf_page.h" #include "fpdfsdk/include/fsdk_define.h" #include "third_party/base/stl_util.h" diff --git a/fpdfsdk/fpdfeditpage.cpp b/fpdfsdk/fpdfeditpage.cpp index 493329c360..1345a1dbb1 100644 --- a/fpdfsdk/fpdfeditpage.cpp +++ b/fpdfsdk/fpdfeditpage.cpp @@ -6,11 +6,13 @@ #include "public/fpdf_edit.h" +#include "core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h" +#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_number.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" -#include "core/include/fpdfapi/fpdf_page.h" #include "fpdfsdk/include/fsdk_define.h" #include "public/fpdf_formfill.h" #include "third_party/base/stl_util.h" diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp index fea66a05c5..9230910a1f 100644 --- a/fpdfsdk/fpdfformfill.cpp +++ b/fpdfsdk/fpdfformfill.cpp @@ -9,9 +9,9 @@ #include #include +#include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" -#include "core/include/fpdfapi/fpdf_page.h" #include "fpdfsdk/include/fsdk_define.h" #include "fpdfsdk/include/fsdk_mgr.h" #include "public/fpdfview.h" diff --git a/fpdfsdk/fpdftext.cpp b/fpdfsdk/fpdftext.cpp index 3e64d8e2c4..cbb8e00a40 100644 --- a/fpdfsdk/fpdftext.cpp +++ b/fpdfsdk/fpdftext.cpp @@ -6,6 +6,7 @@ #include "public/fpdf_text.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" diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index acad659495..1c9024d836 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -8,6 +8,7 @@ #include +#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_render/include/cpdf_renderoptions.h" diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp index 120d1ba24d..89638c0e82 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp @@ -6,8 +6,8 @@ #include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h" +#include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/include/fpdfapi/fpdf_page.h" #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" #include "fpdfsdk/include/fpdfxfa/fpdfxfa_util.h" #include "fpdfsdk/include/fsdk_define.h" diff --git a/fpdfsdk/fsdk_annothandler.cpp b/fpdfsdk/fsdk_annothandler.cpp index 0b6f2e1889..725679dd14 100644 --- a/fpdfsdk/fsdk_annothandler.cpp +++ b/fpdfsdk/fsdk_annothandler.cpp @@ -9,8 +9,8 @@ #include #include +#include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/include/fpdfapi/fpdf_page.h" #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" #include "fpdfsdk/include/fsdk_define.h" #include "fpdfsdk/include/fsdk_mgr.h" diff --git a/fpdfsdk/fsdk_baseform.cpp b/fpdfsdk/fsdk_baseform.cpp index 4bb5374ac9..d260ecb17b 100644 --- a/fpdfsdk/fsdk_baseform.cpp +++ b/fpdfsdk/fsdk_baseform.cpp @@ -10,10 +10,10 @@ #include #include +#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/include/fpdfapi/fpdf_page.h" #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" #include "fpdfsdk/include/fsdk_actionhandler.h" #include "fpdfsdk/include/fsdk_baseannot.h" diff --git a/fpdfsdk/fsdk_mgr.cpp b/fpdfsdk/fsdk_mgr.cpp index e8654d39eb..57eba21194 100644 --- a/fpdfsdk/fsdk_mgr.cpp +++ b/fpdfsdk/fsdk_mgr.cpp @@ -9,9 +9,9 @@ #include #include +#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/include/fpdfapi/fpdf_page.h" #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" #include "fpdfsdk/include/fsdk_define.h" #include "fpdfsdk/include/javascript/IJavaScript.h" diff --git a/fpdfsdk/fxedit/fxet_pageobjs.cpp b/fpdfsdk/fxedit/fxet_pageobjs.cpp index 660f4a475f..7a229ee352 100644 --- a/fpdfsdk/fxedit/fxet_pageobjs.cpp +++ b/fpdfsdk/fxedit/fxet_pageobjs.cpp @@ -4,9 +4,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h" #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" #include "core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h" -#include "core/include/fpdfapi/fpdf_page.h" #include "core/include/fpdfapi/fpdf_pageobj.h" #include "fpdfsdk/include/fx_systemhandler.h" #include "fpdfsdk/include/fxedit/fx_edit.h" diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp index 5f6291b35a..144d428989 100644 --- a/fpdfsdk/javascript/Document.cpp +++ b/fpdfsdk/javascript/Document.cpp @@ -8,8 +8,8 @@ #include +#include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/include/fpdfapi/fpdf_page.h" #include "fpdfsdk/include/fsdk_mgr.h" #include "fpdfsdk/include/javascript/IJavaScript.h" #include "fpdfsdk/javascript/Field.h" diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp index 1ccd756fad..495512486d 100644 --- a/fpdfsdk/javascript/Field.cpp +++ b/fpdfsdk/javascript/Field.cpp @@ -11,7 +11,7 @@ #include #include -#include "core/include/fpdfapi/fpdf_page.h" +#include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "fpdfsdk/include/fsdk_mgr.h" #include "fpdfsdk/include/javascript/IJavaScript.h" #include "fpdfsdk/javascript/Document.h" diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp index c2b3864074..808b2b56bf 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp @@ -8,7 +8,7 @@ #include -#include "core/include/fpdfapi/fpdf_page.h" +#include "core/include/fpdfapi/fpdf_resource.h" #include "core/include/fxcrt/fx_safe_types.h" #include "core/include/fxcrt/fx_xml.h" #include "core/include/fxge/fx_ge.h" diff --git a/fpdfsdk/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/pdfwindow/PWL_FontMap.cpp index 2b9f17cf59..ff9e2a3e39 100644 --- a/fpdfsdk/pdfwindow/PWL_FontMap.cpp +++ b/fpdfsdk/pdfwindow/PWL_FontMap.cpp @@ -8,7 +8,7 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" -#include "core/include/fpdfapi/fpdf_page.h" +#include "core/include/fpdfapi/fpdf_resource.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" namespace { diff --git a/fpdfsdk/pdfwindow/PWL_Icon.cpp b/fpdfsdk/pdfwindow/PWL_Icon.cpp index 6fa65cf1e5..3e5911eb26 100644 --- a/fpdfsdk/pdfwindow/PWL_Icon.cpp +++ b/fpdfsdk/pdfwindow/PWL_Icon.cpp @@ -7,7 +7,7 @@ #include "fpdfsdk/include/pdfwindow/PWL_Icon.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/include/fpdfapi/fpdf_page.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" diff --git a/pdfium.gyp b/pdfium.gyp index cdbf184970..fed93b7828 100644 --- a/pdfium.gyp +++ b/pdfium.gyp @@ -316,17 +316,24 @@ 'core/fpdfapi/fpdf_cmaps/Korea1/UniKS-UCS2-V_1.cpp', 'core/fpdfapi/fpdf_cmaps/Korea1/UniKS-UTF16-H_0.cpp', 'core/fpdfapi/fpdf_edit/editint.h', - 'core/fpdfapi/fpdf_edit/fpdf_edit_content.cpp', + 'core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp', 'core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp', 'core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp', 'core/fpdfapi/fpdf_edit/fpdf_edit_image.cpp', 'core/fpdfapi/fpdf_edit/include/cpdf_creator.h', + 'core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h', 'core/fpdfapi/fpdf_font/font_int.h', 'core/fpdfapi/fpdf_font/fpdf_font.cpp', 'core/fpdfapi/fpdf_font/fpdf_font_charset.cpp', 'core/fpdfapi/fpdf_font/fpdf_font_cid.cpp', 'core/fpdfapi/fpdf_font/ttgsubtable.cpp', 'core/fpdfapi/fpdf_font/ttgsubtable.h', + 'core/fpdfapi/fpdf_page/cpdf_form.cpp', + 'core/fpdfapi/fpdf_page/cpdf_pageobjectlist.cpp', + 'core/fpdfapi/fpdf_page/cpdf_pageobjectlist.h', + 'core/fpdfapi/fpdf_page/cpdf_pageobjectholder.cpp', + 'core/fpdfapi/fpdf_page/cpdf_parseoptions.cpp', + 'core/fpdfapi/fpdf_page/cpdf_parseoptions.h', 'core/fpdfapi/fpdf_page/fpdf_page.cpp', 'core/fpdfapi/fpdf_page/fpdf_page_colors.cpp', 'core/fpdfapi/fpdf_page/fpdf_page_doc.cpp', @@ -337,6 +344,9 @@ 'core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp', 'core/fpdfapi/fpdf_page/fpdf_page_path.cpp', 'core/fpdfapi/fpdf_page/fpdf_page_pattern.cpp', + 'core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h', + 'core/fpdfapi/fpdf_page/include/cpdf_form.h', + 'core/fpdfapi/fpdf_page/include/cpdf_page.h', 'core/fpdfapi/fpdf_page/pageint.h', 'core/fpdfapi/fpdf_parser/cfdf_document.cpp', 'core/fpdfapi/fpdf_parser/cpdf_array.cpp', @@ -404,7 +414,6 @@ 'core/fpdfapi/include/cpdf_modulemgr.h', 'core/fpdfapi/ipdf_rendermodule.h', 'core/fpdfapi/ipdf_pagemodule.h', - 'core/include/fpdfapi/fpdf_page.h', 'core/include/fpdfapi/fpdf_pageobj.h', 'core/include/fpdfapi/fpdf_resource.h', ], diff --git a/xfa/fxfa/app/DEPS b/xfa/fxfa/app/DEPS index d92f3de033..6678121ef9 100644 --- a/xfa/fxfa/app/DEPS +++ b/xfa/fxfa/app/DEPS @@ -1,4 +1,5 @@ include_rules = [ '+core/fdrm/crypto/include', + '+core/fpdfapi/fpdf_page/include', '+core/fpdfapi/fpdf_parser/include', ] diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp index 315394629d..450c4ed6a0 100644 --- a/xfa/fxfa/app/xfa_ffwidget.cpp +++ b/xfa/fxfa/app/xfa_ffwidget.cpp @@ -8,7 +8,7 @@ #include -#include "core/include/fpdfapi/fpdf_page.h" +#include "core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h" #include "core/include/fxcodec/fx_codec.h" #include "xfa/fxfa/app/xfa_ffapp.h" #include "xfa/fxfa/app/xfa_ffdoc.h" -- cgit v1.2.3