1 // Copyright 2014 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_SRC_REFLOW_LAYOUTPROVIDER_TAGGEDPDF_H_ 8 #define CORE_SRC_REFLOW_LAYOUTPROVIDER_TAGGEDPDF_H_ 9 10 #include "../../include/reflow/reflowengine.h" 11 12 class CPDF_LayoutElement : public IPDF_LayoutElement 13 { 14 public: 15 CPDF_LayoutElement(); 16 ~CPDF_LayoutElement(); 17 18 LayoutType GetType(); GetRect(CFX_FloatRect & rcRect)19 void GetRect(CFX_FloatRect& rcRect) {}; 20 21 int CountAttrValues(LayoutAttr attr_type); 22 23 LayoutEnum GetEnumAttr(LayoutAttr attr_type, int index); 24 FX_FLOAT GetNumberAttr(LayoutAttr attr_type, int index); 25 FX_COLORREF GetColorAttr(LayoutAttr attr_type, int index); 26 27 int CountChildren(); 28 29 IPDF_LayoutElement* GetChild(int index); 30 31 IPDF_LayoutElement* GetParent(); 32 33 int CountObjects(); 34 CPDF_PageObject* GetObject(int index); 35 FX_BOOL AddObject(CPDF_PageObject* pObj); 36 CPDF_StructElement* m_pTaggedElement; 37 CPDF_LayoutElement* m_pParentElement; 38 CFX_PtrArray m_ChildArray; 39 LayoutType ConvertLayoutType(FX_BSTR name); 40 CFX_ByteStringC ConvertLayoutType(LayoutType type); 41 CFX_ByteStringC ConvertLayoutAttr(LayoutAttr attr); 42 LayoutEnum ConvertLayoutEnum(CFX_ByteStringC Enum); 43 44 protected: 45 FX_BOOL IsInheritable(LayoutAttr attr_type); 46 CFX_ByteStringC GetAttrOwner(LayoutAttr attr_type); 47 CFX_ByteStringC GetDefaultNameValue(LayoutAttr attr_type); 48 FX_FLOAT GetDefaultFloatValue(LayoutAttr attr_type); 49 FX_COLORREF GetDefaultColorValue(LayoutAttr attr_type); 50 CFX_PtrArray m_ObjArray; 51 }; 52 class CPDF_LayoutProvider_TaggedPDF : public IPDF_LayoutProvider 53 { 54 public: 55 CPDF_LayoutProvider_TaggedPDF(); 56 ~CPDF_LayoutProvider_TaggedPDF(); SetLayoutProviderStyle(LAYOUTPROVIDER_STYLE style)57 void SetLayoutProviderStyle(LAYOUTPROVIDER_STYLE style) {}; 58 Init(CPDF_PageObjects * pPage)59 void Init(CPDF_PageObjects* pPage) 60 { 61 m_pPage = pPage; 62 m_Status = LayoutReady; 63 }; 64 65 LayoutStatus StartLoad(IFX_Pause* pPause = NULL); 66 LayoutStatus Continue(); 67 int GetPosition(); 68 GetRoot()69 IPDF_LayoutElement* GetRoot() 70 { 71 return m_pRoot; 72 }; 73 74 protected: 75 void ProcessElement(CPDF_LayoutElement*pParent, CPDF_StructElement* pTaggedElement); 76 LayoutStatus m_Status; 77 CPDF_StructElement* m_pCurTaggedElement; 78 CPDF_LayoutElement* m_pRoot; 79 IFX_Pause* m_pPause; 80 CPDF_PageObjects* m_pPage; 81 CPDF_StructTree* m_pPageTree; 82 int m_TopElementIndex; 83 }; 84 85 #endif // CORE_SRC_REFLOW_LAYOUTPROVIDER_TAGGEDPDF_H_ 86