summaryrefslogtreecommitdiff
path: root/core/src/reflow/layoutprovider_taggedpdf.h
blob: fa6c994bf0ed7a02e1e8db3e82982ce841eb90e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// 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_SRC_REFLOW_LAYOUTPROVIDER_TAGGEDPDF_H_
#define CORE_SRC_REFLOW_LAYOUTPROVIDER_TAGGEDPDF_H_

#include "../../include/reflow/reflowengine.h"

class CPDF_LayoutElement : public IPDF_LayoutElement
{
public:
    CPDF_LayoutElement();
    ~CPDF_LayoutElement();

    LayoutType	GetType();
    void	GetRect(CFX_FloatRect& rcRect) {};

    int		CountAttrValues(LayoutAttr attr_type);

    LayoutEnum	GetEnumAttr(LayoutAttr attr_type, int index);
    FX_FLOAT	GetNumberAttr(LayoutAttr attr_type, int index);
    FX_COLORREF	GetColorAttr(LayoutAttr attr_type, int index);

    int		CountChildren();

    IPDF_LayoutElement* GetChild(int index);

    IPDF_LayoutElement* GetParent();

    int	CountObjects();
    CPDF_PageObject*	GetObject(int index);
    FX_BOOL AddObject(CPDF_PageObject* pObj);
    CPDF_StructElement* m_pTaggedElement;
    CPDF_LayoutElement* m_pParentElement;
    CFX_PtrArray	m_ChildArray;
    LayoutType ConvertLayoutType(const CFX_ByteStringC& name);
    CFX_ByteStringC ConvertLayoutType(LayoutType type);
    CFX_ByteStringC ConvertLayoutAttr(LayoutAttr attr);
    LayoutEnum ConvertLayoutEnum(CFX_ByteStringC Enum);

protected:
    FX_BOOL		IsInheritable(LayoutAttr attr_type);
    CFX_ByteStringC GetAttrOwner(LayoutAttr attr_type);
    CFX_ByteStringC GetDefaultNameValue(LayoutAttr attr_type);
    FX_FLOAT		GetDefaultFloatValue(LayoutAttr attr_type);
    FX_COLORREF		GetDefaultColorValue(LayoutAttr attr_type);
    CFX_PtrArray	m_ObjArray;
};
class CPDF_LayoutProvider_TaggedPDF : public IPDF_LayoutProvider
{
public:
    CPDF_LayoutProvider_TaggedPDF();
    ~CPDF_LayoutProvider_TaggedPDF();
    void			SetLayoutProviderStyle(LAYOUTPROVIDER_STYLE style) {};

    void	Init(CPDF_PageObjects* pPage)
    {
        m_pPage = pPage;
        m_Status = LayoutReady;
    };

    LayoutStatus	StartLoad(IFX_Pause* pPause = NULL);
    LayoutStatus	Continue();
    int		 		GetPosition();

    IPDF_LayoutElement* GetRoot()
    {
        return m_pRoot;
    };

protected:
    void ProcessElement(CPDF_LayoutElement*pParent, CPDF_StructElement* pTaggedElement);
    LayoutStatus	m_Status;
    CPDF_StructElement* m_pCurTaggedElement;
    CPDF_LayoutElement* m_pRoot;
    IFX_Pause*			m_pPause;
    CPDF_PageObjects*	m_pPage;
    CPDF_StructTree*	m_pPageTree;
    int					m_TopElementIndex;
};

#endif  // CORE_SRC_REFLOW_LAYOUTPROVIDER_TAGGEDPDF_H_