| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef _AUTOREFLOW_H | 7 #ifndef _AUTOREFLOW_H |
| 8 #define _AUTOREFLOW_H | 8 #define _AUTOREFLOW_H |
| 9 #include "../../include/reflow/reflowengine.h" | 9 #include "../../include/reflow/reflowengine.h" |
| 10 #include "reflowedpage.h" | 10 #include "reflowedpage.h" |
| 11 class CPDF_AutoReflowElement; | 11 class CPDF_AutoReflowElement; |
| 12 class CPDF_AutoReflowLayoutProvider; | 12 class CPDF_AutoReflowLayoutProvider; |
| 13 typedef CFX_ArrayTemplate<CPDF_AutoReflowElement*> CAR_ElmPtrArray; | 13 typedef CFX_ArrayTemplate<CPDF_AutoReflowElement*> CAR_ElmPtrArray; |
| 14 typedef CFX_ArrayTemplate<CPDF_PageObject*> CAR_ObjPtrArray; | 14 typedef CFX_ArrayTemplate<CPDF_PageObject*> CAR_ObjPtrArray; |
| 15 class CRF_CELL : public CFX_Object | 15 class CRF_CELL : public CFX_Object { |
| 16 { | 16 public: |
| 17 public: | 17 CRF_CELL(){}; |
| 18 CRF_CELL() { }; | 18 ~CRF_CELL(){}; |
| 19 ~CRF_CELL() { }; | 19 CFX_PtrList m_ObjList; |
| 20 CFX_PtrList»» m_ObjList; | 20 int m_CellWritingMode; |
| 21 int»» » m_CellWritingMode; | 21 FX_RECT m_BBox; |
| 22 FX_RECT» » m_BBox; | |
| 23 }; | 22 }; |
| 24 class CPDF_AutoReflowElement : public IPDF_LayoutElement, public CFX_Object | 23 class CPDF_AutoReflowElement : public IPDF_LayoutElement, public CFX_Object { |
| 25 { | 24 public: |
| 26 public: | 25 CPDF_AutoReflowElement(LayoutType layoutType = LayoutUnknown, |
| 27 CPDF_AutoReflowElement(LayoutType layoutType = LayoutUnknown , CPDF_AutoRefl
owElement* pParent = NULL) ; | 26 CPDF_AutoReflowElement* pParent = NULL); |
| 28 ~CPDF_AutoReflowElement(); | 27 ~CPDF_AutoReflowElement(); |
| 29 LayoutType GetType() | 28 LayoutType GetType() { return m_ElmType; } |
| 30 { | 29 void GetRect(CFX_FloatRect& rcRect){}; |
| 31 return m_ElmType; | |
| 32 } | |
| 33 void» GetRect(CFX_FloatRect& rcRect) {}; | |
| 34 | 30 |
| 35 int CountAttrValues(LayoutAttr attr_type); | 31 int CountAttrValues(LayoutAttr attr_type); |
| 36 LayoutEnum GetEnumAttr(LayoutAttr attr_type, int index); | 32 LayoutEnum GetEnumAttr(LayoutAttr attr_type, int index); |
| 37 FX_FLOAT GetNumberAttr(LayoutAttr attr_type, int index); | 33 FX_FLOAT GetNumberAttr(LayoutAttr attr_type, int index); |
| 38 FX_COLORREF GetColorAttr(LayoutAttr attr_type, int index); | 34 FX_COLORREF GetColorAttr(LayoutAttr attr_type, int index); |
| 39 | 35 |
| 40 int CountChildren() | 36 int CountChildren() { return m_ChildArray.GetSize(); } |
| 41 { | 37 IPDF_LayoutElement* GetChild(int index) { return m_ChildArray.GetAt(index); } |
| 42 return m_ChildArray.GetSize(); | |
| 43 } | |
| 44 IPDF_LayoutElement* GetChild(int index) | |
| 45 { | |
| 46 return m_ChildArray.GetAt(index); | |
| 47 } | |
| 48 | 38 |
| 49 IPDF_LayoutElement* GetParent() | 39 IPDF_LayoutElement* GetParent() { return m_pParentElm; } |
| 50 { | 40 int CountObjects() { return m_ObjArray.GetSize(); } |
| 51 return m_pParentElm; | 41 CPDF_PageObject* GetObject(int index) { return m_ObjArray.GetAt(index); } |
| 52 } | 42 CPDF_AutoReflowElement* m_pParentElm; |
| 53 int»» CountObjects() | 43 LayoutType m_ElmType; |
| 54 { | 44 CAR_ElmPtrArray m_ChildArray; |
| 55 return m_ObjArray.GetSize(); | 45 CAR_ObjPtrArray m_ObjArray; |
| 56 } | 46 FX_FLOAT m_SpaceBefore; |
| 57 CPDF_PageObject*» GetObject(int index) | |
| 58 { | |
| 59 return m_ObjArray.GetAt(index); | |
| 60 } | |
| 61 CPDF_AutoReflowElement* m_pParentElm; | |
| 62 LayoutType» » m_ElmType; | |
| 63 CAR_ElmPtrArray m_ChildArray; | |
| 64 CAR_ObjPtrArray m_ObjArray; | |
| 65 FX_FLOAT» » m_SpaceBefore; | |
| 66 }; | 47 }; |
| 67 #define AUTOREFLOW_STEP_GENERATELINE» » 1 | 48 #define AUTOREFLOW_STEP_GENERATELINE 1 |
| 68 #define AUTOREFLOW_STEP_GENERATEParagraph» 2 | 49 #define AUTOREFLOW_STEP_GENERATEParagraph 2 |
| 69 #define AUTOREFLOW_STEP_CREATEELEMENT» » 3 | 50 #define AUTOREFLOW_STEP_CREATEELEMENT 3 |
| 70 #define AUTOREFLOW_STEP_REMOVEDATA» » » 4 | 51 #define AUTOREFLOW_STEP_REMOVEDATA 4 |
| 71 class CPDF_AutoReflowLayoutProvider : public IPDF_LayoutProvider, public CFX_Obj
ect | 52 class CPDF_AutoReflowLayoutProvider : public IPDF_LayoutProvider, |
| 72 { | 53 public CFX_Object { |
| 73 public: | 54 public: |
| 74 CPDF_AutoReflowLayoutProvider(CPDF_PageObjects* pPage, FX_BOOL bReadOrder); | 55 CPDF_AutoReflowLayoutProvider(CPDF_PageObjects* pPage, FX_BOOL bReadOrder); |
| 75 ~CPDF_AutoReflowLayoutProvider(); | 56 ~CPDF_AutoReflowLayoutProvider(); |
| 76 void» SetLayoutProviderStyle(LAYOUTPROVIDER_STYLE Style) | 57 void SetLayoutProviderStyle(LAYOUTPROVIDER_STYLE Style) { m_Style = Style; } |
| 77 { | 58 LayoutStatus StartLoad(IFX_Pause* pPause = NULL); |
| 78 m_Style = Style; | 59 LayoutStatus Continue(); |
| 79 } | 60 int GetPosition(); |
| 80 LayoutStatus StartLoad(IFX_Pause* pPause = NULL); | 61 IPDF_LayoutElement* GetRoot() { return m_pRoot; } |
| 81 LayoutStatus Continue(); | 62 FX_FLOAT GetObjMinCell(CPDF_PageObject* pObj); |
| 82 int» » » GetPosition(); | 63 void Conver2AppreceOrder(const CPDF_PageObjects* pStreamOrderObjs, |
| 83 IPDF_LayoutElement* GetRoot() | 64 CPDF_PageObjects* pAppraceOrderObjs); |
| 84 { | 65 void ReleaseElm(CPDF_AutoReflowElement*& pElm, |
| 85 return m_pRoot; | 66 FX_BOOL bReleaseChildren = TRUE); |
| 86 } | 67 void GenerateCell(); |
| 87 FX_FLOAT GetObjMinCell(CPDF_PageObject* pObj); | 68 void GenerateStructTree(); |
| 88 void Conver2AppreceOrder(const CPDF_PageObjects* pStreamOrderObjs, CPDF_Page
Objects* pAppraceOrderObjs); | 69 void GenerateLine(CFX_PtrArray& cellArray); |
| 89 void» ReleaseElm(CPDF_AutoReflowElement*& pElm, FX_BOOL bReleaseChildr
en = TRUE); | 70 void GenerateParagraph(CFX_PtrArray& cellArray); |
| 90 void GenerateCell(); | 71 void CreateElement(); |
| 91 void GenerateStructTree(); | 72 void AddObjectArray(CPDF_AutoReflowElement* pElm, CFX_PtrList& ObjList); |
| 92 void GenerateLine(CFX_PtrArray& cellArray); | 73 FX_FLOAT GetLayoutOrderHeight(CPDF_PageObject* pCurObj); |
| 93 void GenerateParagraph(CFX_PtrArray& cellArray); | 74 FX_FLOAT GetLayoutOrderWidth(CPDF_PageObject* pCurObj); |
| 94 void CreateElement(); | 75 int GetWritingMode(CPDF_PageObject* pPreObj, CPDF_PageObject* pCurObj); |
| 95 void AddObjectArray(CPDF_AutoReflowElement* pElm, CFX_PtrList& ObjList); | 76 int GetRectStart(FX_RECT rect); |
| 96 FX_FLOAT GetLayoutOrderHeight(CPDF_PageObject* pCurObj); | 77 int GetRectEnd(FX_RECT rect); |
| 97 FX_FLOAT GetLayoutOrderWidth(CPDF_PageObject* pCurObj); | 78 int GetRectTop(FX_RECT rect); |
| 98 int GetWritingMode(CPDF_PageObject* pPreObj, CPDF_PageObject* pCurObj); | 79 int GetRectBottom(FX_RECT rect); |
| 99 int GetRectStart(FX_RECT rect); | 80 int GetRectHeight(FX_RECT rect); |
| 100 int GetRectEnd(FX_RECT rect); | 81 int GetRectWidth(FX_RECT rect); |
| 101 int GetRectTop(FX_RECT rect); | 82 void ProcessObj(CFX_PtrArray& cellArray, |
| 102 int GetRectBottom(FX_RECT rect); | 83 CPDF_PageObject* pObj, |
| 103 int GetRectHeight(FX_RECT rect); | 84 CFX_AffineMatrix matrix); |
| 104 int GetRectWidth(FX_RECT rect); | 85 FX_INT32 LogicPreObj(CPDF_PageObject* pObj); |
| 105 void ProcessObj(CFX_PtrArray& cellArray, CPDF_PageObject* pObj, CFX_AffineMa
trix matrix); | |
| 106 FX_INT32 LogicPreObj(CPDF_PageObject* pObj); | |
| 107 | 86 |
| 108 CPDF_AutoReflowElement* m_pRoot; | 87 CPDF_AutoReflowElement* m_pRoot; |
| 109 CPDF_AutoReflowElement* m_pCurrElm; | 88 CPDF_AutoReflowElement* m_pCurrElm; |
| 110 CPDF_Page*» m_pPDFPage; | 89 CPDF_Page* m_pPDFPage; |
| 111 IFX_Pause*» m_pPause; | 90 IFX_Pause* m_pPause; |
| 112 CFX_AffineMatrix m_PDFDisplayMatrix; | 91 CFX_AffineMatrix m_PDFDisplayMatrix; |
| 113 CPDF_PageObject* m_pPreObj; | 92 CPDF_PageObject* m_pPreObj; |
| 114 LayoutStatus m_Status; | 93 LayoutStatus m_Status; |
| 115 int m_WritingMode; | 94 int m_WritingMode; |
| 116 CFX_PtrArray m_CellArray; | 95 CFX_PtrArray m_CellArray; |
| 117 FX_BOOL» » m_bReadOrder; | 96 FX_BOOL m_bReadOrder; |
| 118 LAYOUTPROVIDER_STYLE m_Style; | 97 LAYOUTPROVIDER_STYLE m_Style; |
| 119 CFX_PtrArray m_cellArray; | 98 CFX_PtrArray m_cellArray; |
| 120 int»» » m_Step; | 99 int m_Step; |
| 121 }; | 100 }; |
| 122 #endif | 101 #endif |
| OLD | NEW |