diff options
Diffstat (limited to 'core/fpdfapi/fpdf_parser')
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_document.cpp | 48 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/ipdf_occontext.cpp | 26 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/ipdf_occontext.h | 23 |
3 files changed, 27 insertions, 70 deletions
diff --git a/core/fpdfapi/fpdf_parser/cpdf_document.cpp b/core/fpdfapi/fpdf_parser/cpdf_document.cpp index 808a468016..4557af2b9e 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_document.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_document.cpp @@ -8,6 +8,8 @@ #include <set> +#include "core/fpdfapi/fpdf_page/cpdf_pagemodule.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_parser.h" @@ -15,7 +17,6 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" #include "core/fpdfapi/fpdf_render/render_int.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" -#include "core/fpdfapi/ipdf_rendermodule.h" #include "core/fxge/include/fx_font.h" #include "third_party/base/stl_util.h" @@ -54,30 +55,33 @@ int CountPages(CPDF_Dictionary* pPages, } // namespace CPDF_Document::CPDF_Document(CPDF_Parser* pParser) - : CPDF_IndirectObjectHolder(pParser) { + : CPDF_IndirectObjectHolder(pParser), + m_pRootDict(nullptr), + m_pInfoDict(nullptr), + m_bLinearized(false), + m_dwFirstPageNo(0), + m_dwFirstPageObjNum(0), + m_pDocPage(new CPDF_DocPageData(this)), + m_pDocRender(new CPDF_DocRenderData(this)) { ASSERT(pParser); - m_pRootDict = NULL; - m_pInfoDict = NULL; - m_bLinearized = FALSE; - m_dwFirstPageNo = 0; - m_dwFirstPageObjNum = 0; - m_pDocPage = CPDF_ModuleMgr::Get()->GetPageModule()->CreateDocData(this); - m_pDocRender = CPDF_ModuleMgr::Get()->GetRenderModule()->CreateDocData(this); } + CPDF_DocPageData* CPDF_Document::GetValidatePageData() { - if (m_pDocPage) { + if (m_pDocPage) return m_pDocPage; - } - m_pDocPage = CPDF_ModuleMgr::Get()->GetPageModule()->CreateDocData(this); + + m_pDocPage = new CPDF_DocPageData(this); return m_pDocPage; } + CPDF_DocRenderData* CPDF_Document::GetValidateRenderData() { - if (m_pDocRender) { + if (m_pDocRender) return m_pDocRender; - } - m_pDocRender = CPDF_ModuleMgr::Get()->GetRenderModule()->CreateDocData(this); + + m_pDocRender = new CPDF_DocRenderData(this); return m_pDocRender; } + void CPDF_Document::LoadDoc() { m_LastObjNum = m_pParser->GetLastObjNum(); CPDF_Object* pRootObj = GetIndirectObject(m_pParser->GetRootObjNum()); @@ -128,18 +132,20 @@ void CPDF_Document::LoadAsynDoc(CPDF_Dictionary* pLinearized) { if (ToNumber(pObjNum)) m_dwFirstPageObjNum = pObjNum->GetInteger(); } + void CPDF_Document::LoadPages() { m_PageList.SetSize(RetrievePageCount()); } + CPDF_Document::~CPDF_Document() { if (m_pDocPage) { - CPDF_ModuleMgr::Get()->GetPageModule()->ReleaseDoc(this); + delete this->GetPageData(); CPDF_ModuleMgr::Get()->GetPageModule()->ClearStockFont(this); } - if (m_pDocRender) { - CPDF_ModuleMgr::Get()->GetRenderModule()->DestroyDocData(m_pDocRender); - } + if (m_pDocRender) + delete m_pDocRender; } + #define FX_MAX_PAGE_LEVEL 1024 CPDF_Dictionary* CPDF_Document::_FindPDFPage(CPDF_Dictionary* pPages, int iPage, @@ -337,12 +343,12 @@ FX_BOOL CPDF_Document::IsFormStream(uint32_t objnum, FX_BOOL& bForm) const { void CPDF_Document::ClearPageData() { if (m_pDocPage) - CPDF_ModuleMgr::Get()->GetPageModule()->ClearDoc(this); + this->GetPageData()->Clear(FALSE); } void CPDF_Document::ClearRenderData() { if (m_pDocRender) - CPDF_ModuleMgr::Get()->GetRenderModule()->ClearDocData(m_pDocRender); + m_pDocRender->Clear(FALSE); } void CPDF_Document::ClearRenderFont() { diff --git a/core/fpdfapi/fpdf_parser/ipdf_occontext.cpp b/core/fpdfapi/fpdf_parser/ipdf_occontext.cpp deleted file mode 100644 index 0b98b9889e..0000000000 --- a/core/fpdfapi/fpdf_parser/ipdf_occontext.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// 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_parser/ipdf_occontext.h" - -#include "core/fpdfapi/fpdf_page/cpdf_contentmarkitem.h" -#include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h" - -IPDF_OCContext::~IPDF_OCContext() {} - -FX_BOOL IPDF_OCContext::CheckObjectVisible(const CPDF_PageObject* pObj) { - const CPDF_ContentMarkData* pData = pObj->m_ContentMark; - int nItems = pData->CountItems(); - for (int i = 0; i < nItems; i++) { - const CPDF_ContentMarkItem& item = pData->GetItem(i); - if (item.GetName() == "OC" && - item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict && - !CheckOCGVisible(item.GetParam())) { - return FALSE; - } - } - return TRUE; -} diff --git a/core/fpdfapi/fpdf_parser/ipdf_occontext.h b/core/fpdfapi/fpdf_parser/ipdf_occontext.h deleted file mode 100644 index 0108787342..0000000000 --- a/core/fpdfapi/fpdf_parser/ipdf_occontext.h +++ /dev/null @@ -1,23 +0,0 @@ -// 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_PARSER_IPDF_OCCONTEXT_H_ -#define CORE_FPDFAPI_FPDF_PARSER_IPDF_OCCONTEXT_H_ - -#include "core/fxcrt/include/fx_system.h" - -class CPDF_Dictionary; -class CPDF_PageObject; - -class IPDF_OCContext { - public: - virtual ~IPDF_OCContext(); - - virtual FX_BOOL CheckOCGVisible(const CPDF_Dictionary* pOCG) = 0; - FX_BOOL CheckObjectVisible(const CPDF_PageObject* pObj); -}; - -#endif // CORE_FPDFAPI_FPDF_PARSER_IPDF_OCCONTEXT_H_ |