1// Copyright 2016 PDFium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7#ifndef CORE_FPDFAPI_PAGE_CPDF_PAGEOBJECTHOLDER_H_ 8#define CORE_FPDFAPI_PAGE_CPDF_PAGEOBJECTHOLDER_H_ 9 10#include <memory> 11 12#include "core/fpdfapi/page/cpdf_pageobjectlist.h" 13#include "core/fxcrt/fx_coordinates.h" 14#include "core/fxcrt/fx_system.h" 15 16class IFX_Pause; 17class CPDF_Dictionary; 18class CPDF_Stream; 19class CPDF_Document; 20class CPDF_ContentParser; 21 22#define PDFTRANS_GROUP 0x0100 23#define PDFTRANS_ISOLATED 0x0200 24#define PDFTRANS_KNOCKOUT 0x0400 25 26class CPDF_PageObjectHolder { 27 public: 28 CPDF_PageObjectHolder(); 29 virtual ~CPDF_PageObjectHolder(); 30 31 void ContinueParse(IFX_Pause* pPause); 32 bool IsParsed() const { return m_ParseState == CONTENT_PARSED; } 33 34 CPDF_PageObjectList* GetPageObjectList() { return &m_PageObjectList; } 35 const CPDF_PageObjectList* GetPageObjectList() const { 36 return &m_PageObjectList; 37 } 38 39 bool BackgroundAlphaNeeded() const { return m_bBackgroundAlphaNeeded; } 40 void SetBackgroundAlphaNeeded(bool needed) { 41 m_bBackgroundAlphaNeeded = needed; 42 } 43 44 bool HasImageMask() const { return m_bHasImageMask; } 45 void SetHasImageMask(bool value) { m_bHasImageMask = value; } 46 47 void Transform(const CFX_Matrix& matrix); 48 CFX_FloatRect CalcBoundingBox() const; 49 50 CPDF_Dictionary* m_pFormDict; 51 CPDF_Stream* m_pFormStream; 52 CPDF_Document* m_pDocument; 53 CPDF_Dictionary* m_pPageResources; 54 CPDF_Dictionary* m_pResources; 55 CFX_FloatRect m_BBox; 56 int m_Transparency; 57 58 protected: 59 enum ParseState { CONTENT_NOT_PARSED, CONTENT_PARSING, CONTENT_PARSED }; 60 61 void LoadTransInfo(); 62 63 bool m_bBackgroundAlphaNeeded; 64 bool m_bHasImageMask; 65 ParseState m_ParseState; 66 std::unique_ptr<CPDF_ContentParser> m_pParser; 67 CPDF_PageObjectList m_PageObjectList; 68}; 69 70#endif // CORE_FPDFAPI_PAGE_CPDF_PAGEOBJECTHOLDER_H_ 71