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 _REFLOWED_PAGE_H | 7 #ifndef _REFLOWED_PAGE_H |
8 #define _REFLOWED_PAGE_H | 8 #define _REFLOWED_PAGE_H |
9 #include "../../include/reflow/reflowengine.h" | 9 #include "../../include/reflow/reflowengine.h" |
10 #define GET_SIGNED(a) ( (a)>0 ? a/a : (a==0 ? 0 : -a/a) ) | 10 #define GET_SIGNED(a) ((a) > 0 ? a / a : (a == 0 ? 0 : -a / a)) |
11 class CRF_Data; | 11 class CRF_Data; |
12 class CRF_LineData; | 12 class CRF_LineData; |
13 class CRF_CharData; | 13 class CRF_CharData; |
14 class CRF_PathData; | 14 class CRF_PathData; |
15 class CRF_ImageData; | 15 class CRF_ImageData; |
16 class CRF_Table; | 16 class CRF_Table; |
17 class CRF_AttrOperation; | 17 class CRF_AttrOperation; |
18 class CRF_OperationDate; | 18 class CRF_OperationDate; |
19 class CPDF_ReflowedPage; | 19 class CPDF_ReflowedPage; |
20 class CPDF_Rect; | 20 class CPDF_Rect; |
21 class CFX_Object; | 21 class CFX_Object; |
22 typedef CFX_SegmentedArray<CRF_Data*> CRF_DataPtrArray; | 22 typedef CFX_SegmentedArray<CRF_Data*> CRF_DataPtrArray; |
23 class CRF_CharState; | 23 class CRF_CharState; |
24 typedef CFX_SegmentedArray<CRF_CharState> CRF_CharStateArray; | 24 typedef CFX_SegmentedArray<CRF_CharState> CRF_CharStateArray; |
25 #define SST_GE» » 1 | 25 #define SST_GE 1 |
26 #define SST_BLSE» 2 | 26 #define SST_BLSE 2 |
27 #define SST_ILSE» 3 | 27 #define SST_ILSE 3 |
28 #define SST_IE» » 4 | 28 #define SST_IE 4 |
29 class CPDF_LayoutProcessor_Reflow : public IPDF_LayoutProcessor, public CFX_Obje
ct | 29 class CPDF_LayoutProcessor_Reflow : public IPDF_LayoutProcessor, |
30 { | 30 public CFX_Object { |
31 public: | 31 public: |
32 CPDF_LayoutProcessor_Reflow(); | 32 CPDF_LayoutProcessor_Reflow(); |
33 ~CPDF_LayoutProcessor_Reflow(); | 33 ~CPDF_LayoutProcessor_Reflow(); |
34 void Init(FX_FLOAT TopIndent, FX_FLOAT fWidth, FX_FLOAT fHeight, CPDF_Reflow
edPage* pReflowedPage, int flags, FX_FLOAT lineSpace); | 34 void Init(FX_FLOAT TopIndent, |
35 | 35 FX_FLOAT fWidth, |
36 LayoutStatus» StartProcess(IPDF_LayoutElement* pElement, IFX_Pause* pP
ause, const CFX_AffineMatrix* pPDFMatrix = NULL); | 36 FX_FLOAT fHeight, |
37 LayoutStatus» Continue(); | 37 CPDF_ReflowedPage* pReflowedPage, |
38 int»» » » GetPosition(); | 38 int flags, |
39 protected: | 39 FX_FLOAT lineSpace); |
40 void» FitPageMode(); | 40 |
41 void» ProcessElement(IPDF_LayoutElement* pElement, FX_FLOAT reflowWidt
h); | 41 LayoutStatus StartProcess(IPDF_LayoutElement* pElement, |
42 FX_FLOAT GetElmWidth(IPDF_LayoutElement* pElement); | 42 IFX_Pause* pPause, |
43 CFX_FloatRect GetElmBBox(IPDF_LayoutElement* pElement); | 43 const CFX_AffineMatrix* pPDFMatrix = NULL); |
44 void» ProcessTable(FX_FLOAT dx); | 44 LayoutStatus Continue(); |
45 void» ProcessObjs(IPDF_LayoutElement* pElement, FX_FLOAT reflowWidth); | 45 int GetPosition(); |
46 void» ProcessObject(CPDF_PageObject* pObj, FX_FLOAT reflowWidth, CFX_A
ffineMatrix objMatrix); | 46 |
47 void» ProcessTextObject(CPDF_TextObject *pObj, FX_FLOAT reflowWidth, C
FX_AffineMatrix objMatrix); | 47 protected: |
48 void» ProcessPathObject(CPDF_PathObject *pObj, FX_FLOAT reflowWidth); | 48 void FitPageMode(); |
49 void» ProcessUnitaryObjs(CPDF_PageObjects *pObjs, FX_FLOAT reflowWidth
, CFX_AffineMatrix objMatrix); | 49 void ProcessElement(IPDF_LayoutElement* pElement, FX_FLOAT reflowWidth); |
50 FX_INT32 LogicPreObj(CPDF_TextObject* pObj); | 50 FX_FLOAT GetElmWidth(IPDF_LayoutElement* pElement); |
51 int ProcessInsertObject(CPDF_TextObject* pObj, CFX_AffineMatrix formMatrix); | 51 CFX_FloatRect GetElmBBox(IPDF_LayoutElement* pElement); |
52 FX_WCHAR GetPreChar(); | 52 void ProcessTable(FX_FLOAT dx); |
53 FX_BOOL IsSameTextObject(CPDF_TextObject* pTextObj1, CPDF_TextObject* pTextO
bj2); | 53 void ProcessObjs(IPDF_LayoutElement* pElement, FX_FLOAT reflowWidth); |
54 int GetCharWidth(FX_DWORD charCode, CPDF_Font* pFont) const; | 54 void ProcessObject(CPDF_PageObject* pObj, |
55 FX_BOOL» IsCanBreakAfter(FX_DWORD unicode); | 55 FX_FLOAT reflowWidth, |
56 FX_BOOL» IsCanBreakBefore(FX_DWORD unicode); | 56 CFX_AffineMatrix objMatrix); |
57 FX_INT32 GetElementTypes(LayoutType layoutType); | 57 void ProcessTextObject(CPDF_TextObject* pObj, |
58 void» » » » CreateRFData(CPDF_PageObject* pObj, CFX_
AffineMatrix* pMatrix = NULL); | 58 FX_FLOAT reflowWidth, |
59 CRF_CharState*» » GetCharState(CPDF_TextObject* pObj, CPDF_Font* p
Font, FX_FLOAT fHeight, FX_ARGB color); | 59 CFX_AffineMatrix objMatrix); |
60 FX_FLOAT» » ConverWidth(FX_FLOAT width); | 60 void ProcessPathObject(CPDF_PathObject* pObj, FX_FLOAT reflowWidth); |
61 void» AddData2CurrLine(CRF_Data* pData); | 61 void ProcessUnitaryObjs(CPDF_PageObjects* pObjs, |
62 void» AddTemp2CurrLine(int begin, int count ); | 62 FX_FLOAT reflowWidth, |
63 void» Transform(const CFX_AffineMatrix* pMatrix, CRF_Data* pData); | 63 CFX_AffineMatrix objMatrix); |
64 void» Transform(const CFX_AffineMatrix* pMatrix, CRF_DataPtrArray* pDa
taArray, int beginPos, int count = 0); | 64 FX_INT32 LogicPreObj(CPDF_TextObject* pObj); |
65 FX_FLOAT GetDatasWidth( int beginPos, int endpos); | 65 int ProcessInsertObject(CPDF_TextObject* pObj, CFX_AffineMatrix formMatrix); |
66 void» UpdateCurrLine(); | 66 FX_WCHAR GetPreChar(); |
67 FX_BOOL» FinishedCurrLine(); | 67 FX_BOOL IsSameTextObject(CPDF_TextObject* pTextObj1, |
68 int m_flags; | 68 CPDF_TextObject* pTextObj2); |
69 CFX_AffineMatrix m_PDFMatrix; | 69 int GetCharWidth(FX_DWORD charCode, CPDF_Font* pFont) const; |
70 LayoutStatus» m_Status; | 70 FX_BOOL IsCanBreakAfter(FX_DWORD unicode); |
71 CPDF_TextObject* m_pPreObj; | 71 FX_BOOL IsCanBreakBefore(FX_DWORD unicode); |
72 CFX_AffineMatrix m_perMatrix; | 72 FX_INT32 GetElementTypes(LayoutType layoutType); |
73 IPDF_LayoutElement*»m_pLayoutElement; | 73 void CreateRFData(CPDF_PageObject* pObj, CFX_AffineMatrix* pMatrix = NULL); |
74 IPDF_LayoutElement* m_pRootElement; | 74 CRF_CharState* GetCharState(CPDF_TextObject* pObj, |
75 FX_FLOAT» » m_CurrRefWidth; | 75 CPDF_Font* pFont, |
76 IFX_Pause*» » m_pPause; | 76 FX_FLOAT fHeight, |
77 LayoutEnum» » m_CurrWritingMode; | 77 FX_ARGB color); |
78 CPDF_ReflowedPage*» m_pReflowedPage; | 78 FX_FLOAT ConverWidth(FX_FLOAT width); |
79 FX_FLOAT» » m_fRefWidth; | 79 void AddData2CurrLine(CRF_Data* pData); |
80 FX_FLOAT» » m_TopIndent; | 80 void AddTemp2CurrLine(int begin, int count); |
81 FX_FLOAT» » m_fLineSpace; | 81 void Transform(const CFX_AffineMatrix* pMatrix, CRF_Data* pData); |
82 FX_FLOAT» » m_fScreenHeight; | 82 void Transform(const CFX_AffineMatrix* pMatrix, |
83 FX_FLOAT» » m_fCurrMaxWidth; | 83 CRF_DataPtrArray* pDataArray, |
84 FX_FLOAT» » m_fCurrLineWidth; | 84 int beginPos, |
85 FX_FLOAT» » m_fCurrLineHeight; | 85 int count = 0); |
86 CRF_DataPtrArray*» m_pCurrLine; | 86 FX_FLOAT GetDatasWidth(int beginPos, int endpos); |
87 CRF_DataPtrArray*» m_pTempLine; | 87 void UpdateCurrLine(); |
88 FX_BOOL» » » m_bIllustration; | 88 FX_BOOL FinishedCurrLine(); |
89 FX_FLOAT» » m_fLineHeight; | 89 int m_flags; |
90 LayoutEnum» » m_TextAlign; | 90 CFX_AffineMatrix m_PDFMatrix; |
91 FX_FLOAT» » m_StartIndent; | 91 LayoutStatus m_Status; |
92 CFX_ArrayTemplate<CRF_Table*> m_TableArray; | 92 CPDF_TextObject* m_pPreObj; |
93 int»» » » m_PausePosition; | 93 CFX_AffineMatrix m_perMatrix; |
| 94 IPDF_LayoutElement* m_pLayoutElement; |
| 95 IPDF_LayoutElement* m_pRootElement; |
| 96 FX_FLOAT m_CurrRefWidth; |
| 97 IFX_Pause* m_pPause; |
| 98 LayoutEnum m_CurrWritingMode; |
| 99 CPDF_ReflowedPage* m_pReflowedPage; |
| 100 FX_FLOAT m_fRefWidth; |
| 101 FX_FLOAT m_TopIndent; |
| 102 FX_FLOAT m_fLineSpace; |
| 103 FX_FLOAT m_fScreenHeight; |
| 104 FX_FLOAT m_fCurrMaxWidth; |
| 105 FX_FLOAT m_fCurrLineWidth; |
| 106 FX_FLOAT m_fCurrLineHeight; |
| 107 CRF_DataPtrArray* m_pCurrLine; |
| 108 CRF_DataPtrArray* m_pTempLine; |
| 109 FX_BOOL m_bIllustration; |
| 110 FX_FLOAT m_fLineHeight; |
| 111 LayoutEnum m_TextAlign; |
| 112 FX_FLOAT m_StartIndent; |
| 113 CFX_ArrayTemplate<CRF_Table*> m_TableArray; |
| 114 int m_PausePosition; |
94 }; | 115 }; |
95 struct RF_TableCell { | 116 struct RF_TableCell { |
96 int»» » m_BeginPos; | 117 int m_BeginPos; |
97 int»» » m_EndPos; | 118 int m_EndPos; |
98 FX_FLOAT m_MaxWidth; | 119 FX_FLOAT m_MaxWidth; |
99 FX_FLOAT m_PosX; | 120 FX_FLOAT m_PosX; |
100 FX_FLOAT» m_PosY; | 121 FX_FLOAT m_PosY; |
101 FX_FLOAT» m_CellWidth; | 122 FX_FLOAT m_CellWidth; |
102 FX_FLOAT m_CellHeight; | 123 FX_FLOAT m_CellHeight; |
103 int»» » m_RowSpan; | 124 int m_RowSpan; |
104 int»» » m_ColSpan; | 125 int m_ColSpan; |
105 LayoutEnum» m_BlockAlign; | 126 LayoutEnum m_BlockAlign; |
106 LayoutEnum» m_InlineAlign; | 127 LayoutEnum m_InlineAlign; |
107 }; | 128 }; |
108 typedef CFX_ArrayTemplate<RF_TableCell*> CRF_TableCellArray; | 129 typedef CFX_ArrayTemplate<RF_TableCell*> CRF_TableCellArray; |
109 class CRF_Table : public CFX_Object | 130 class CRF_Table : public CFX_Object { |
110 { | 131 public: |
111 public: | 132 CRF_Table() { |
112 CRF_Table() | 133 m_TableWidth = 0; |
113 { | 134 m_nCol = 0; |
114 m_TableWidth = 0; | 135 } |
115 m_nCol = 0; | 136 CRF_TableCellArray m_pCellArray; |
116 } | 137 CFX_WordArray m_nCell; |
117 CRF_TableCellArray m_pCellArray; | 138 int m_nCol; |
118 CFX_WordArray m_nCell; | 139 FX_FLOAT m_TableWidth; |
119 int m_nCol; | 140 FX_FLOAT m_ReflowPageHeight; |
120 FX_FLOAT m_TableWidth; | 141 }; |
121 FX_FLOAT m_ReflowPageHeight; | 142 class CRF_CharState : public CFX_Object { |
122 }; | 143 public: |
123 class CRF_CharState : public CFX_Object | 144 CPDF_Font* m_pFont; |
124 { | 145 FX_ARGB m_Color; |
125 public: | 146 FX_BOOL m_bVert; |
126 CPDF_Font* m_pFont; | 147 FX_FLOAT m_fFontSize; |
127 FX_ARGB m_Color; | 148 FX_FLOAT m_fAscent; |
128 FX_BOOL m_bVert; | 149 FX_FLOAT m_fDescent; |
129 FX_FLOAT m_fFontSize; | 150 |
130 FX_FLOAT m_fAscent; | 151 CPDF_TextObject* m_pTextObj; |
131 FX_FLOAT m_fDescent; | 152 }; |
132 | 153 class CRF_PageInfo : public CFX_Object { |
133 CPDF_TextObject* m_pTextObj; | 154 public: |
134 }; | 155 CRF_PageInfo(CPDF_PageObject* pPageObj, CRF_PageInfo* pParent = NULL) |
135 class CRF_PageInfo : public CFX_Object | 156 : m_pPageObj(pPageObj), m_pParent(pParent) {} |
136 { | 157 CPDF_PageObject* GetPageObj() { return m_pPageObj; } |
137 public: | 158 CPDF_Dictionary* GetFormDict() { |
138 CRF_PageInfo(CPDF_PageObject* pPageObj, CRF_PageInfo* pParent = NULL) | 159 if (NULL == m_pParent) { |
139 : m_pPageObj(pPageObj) , m_pParent(pParent) | 160 return NULL; |
140 { | 161 } |
141 } | 162 CPDF_PageObject* pParentObj = m_pParent->GetPageObj(); |
142 CPDF_PageObject* GetPageObj() | 163 if (NULL == pParentObj || PDFPAGE_FORM != pParentObj->m_Type) { |
143 { | 164 return NULL; |
144 return m_pPageObj; | 165 } |
145 } | 166 return ((CPDF_FormObject*)pParentObj)->m_pForm->m_pResources; |
146 CPDF_Dictionary* GetFormDict() | 167 } |
147 { | 168 |
148 if (NULL == m_pParent) { | 169 protected: |
149 return NULL; | 170 CPDF_PageObject* m_pPageObj; |
150 } | 171 CRF_PageInfo* m_pParent; |
151 CPDF_PageObject* pParentObj = m_pParent->GetPageObj(); | 172 }; |
152 if (NULL == pParentObj || PDFPAGE_FORM != pParentObj->m_Type) { | 173 class CPDF_ReflowedPage : public IPDF_ReflowedPage, |
153 return NULL; | 174 public CFX_PrivateData, |
154 } | 175 public CFX_Object { |
155 return ((CPDF_FormObject*)pParentObj)->m_pForm->m_pResources; | 176 public: |
156 } | 177 CPDF_ReflowedPage(CFX_GrowOnlyPool* pMemoryPool); |
157 protected: | 178 ~CPDF_ReflowedPage(); |
158 CPDF_PageObject* m_pPageObj; | 179 CFX_PrivateData* GetPrivateDataCtrl() { return this; }; |
159 CRF_PageInfo* m_pParent; | 180 void GetDisplayMatrix(CFX_AffineMatrix& matrix, |
160 }; | 181 FX_INT32 xPos, |
161 class CPDF_ReflowedPage : public IPDF_ReflowedPage, public CFX_PrivateData, publ
ic CFX_Object | 182 FX_INT32 yPos, |
162 { | 183 FX_INT32 xSize, |
163 public: | 184 FX_INT32 ySize, |
164 | 185 FX_INT32 iRotate, |
165 CPDF_ReflowedPage(CFX_GrowOnlyPool* pMemoryPool); | 186 const CFX_AffineMatrix* pPageMatrix); |
166 ~CPDF_ReflowedPage(); | 187 |
167 CFX_PrivateData* GetPrivateDataCtrl() | 188 FX_FLOAT GetPageHeight(); |
168 { | 189 FX_FLOAT GetPageWidth() { return m_PageWidth; }; |
169 return this; | 190 void FocusGetData(const CFX_AffineMatrix matrix, |
170 }; | 191 FX_INT32 x, |
171 void GetDisplayMatrix(CFX_AffineMatrix& matrix, FX_INT32 xPos
, FX_INT32 yPos, FX_INT32 xSize, FX_INT32 ySize, FX_INT32 iRotate, const CFX_Aff
ineMatrix* pPageMatrix); | 192 FX_INT32 y, |
172 | 193 CFX_ByteString& str); |
173 FX_FLOAT GetPageHeight() ; | 194 FX_BOOL FocusGetPosition(const CFX_AffineMatrix matrix, |
174 FX_FLOAT GetPageWidth() | 195 CFX_ByteString str, |
175 { | 196 FX_INT32& x, |
176 return m_PageWidth; | 197 FX_INT32& y); |
177 }; | 198 CRF_DataPtrArray* m_pReflowed; |
178 void FocusGetData(const CFX_AffineMatrix matrix, FX_INT32 x,
FX_INT32 y, CFX_ByteString& str); | 199 FX_FLOAT m_PageWidth; |
179 FX_BOOL FocusGetPosition(const CFX_AffineMatrix matrix, CFX_Byte
String str, FX_INT32& x, FX_INT32& y); | 200 FX_FLOAT m_PageHeight; |
180 CRF_DataPtrArray* m_pReflowed; | 201 FX_BOOL m_bWaiting; |
181 FX_FLOAT m_PageWidth; | 202 CRF_CharStateArray* m_pCharState; |
182 FX_FLOAT m_PageHeight; | 203 CFX_GrowOnlyPool* m_pMemoryPool; |
183 FX_BOOL m_bWaiting; | 204 FX_BOOL m_bCreateMemoryPool; |
184 CRF_CharStateArray* m_pCharState; | 205 CPDF_Page* m_pPDFPage; |
185 CFX_GrowOnlyPool* m_pMemoryPool; | 206 FX_BOOL RetainPageObjsMemberShip(); |
186 FX_BOOL m_bCreateMemoryPool; | 207 void MarkPageObjMemberShip(CPDF_PageObject* pObj, CRF_PageInfo* pParent); |
187 CPDF_Page* m_pPDFPage; | 208 void ReleasePageObjsMemberShip(); |
188 FX_BOOL RetainPageObjsMemberShip(); | 209 CPDF_Dictionary* GetFormResDict(CPDF_PageObject* pObj); |
189 void MarkPageObjMemberShip(CPDF_PageO
bject* pObj, CRF_PageInfo* pParent); | 210 |
190 void ReleasePageObjsMemberShip(); | 211 CFX_MapPtrToPtr* m_pPageInfos; |
191 CPDF_Dictionary* GetFormResDict(CPDF_PageObject* pObj); | 212 }; |
192 | 213 class CPDF_ProgressiveReflowPageParser |
193 CFX_MapPtrToPtr* m_pPageInfos; | 214 : public IPDF_ProgressiveReflowPageParser, |
194 }; | 215 public CFX_Object { |
195 class CPDF_ProgressiveReflowPageParser : public IPDF_ProgressiveReflowPageParser
, public CFX_Object | 216 public: |
196 { | 217 CPDF_ProgressiveReflowPageParser(); |
197 public: | 218 ~CPDF_ProgressiveReflowPageParser(); |
198 CPDF_ProgressiveReflowPageParser(); | 219 void Init(); |
199 ~CPDF_ProgressiveReflowPageParser() ; | 220 |
200 void Init(); | 221 ParseStatus GetStatus() { return m_Status; }; |
201 | 222 |
202 ParseStatus GetStatus() | 223 void SetParserStyle(RF_ParseStyle style) { m_ParseStyle = style; }; |
203 { | 224 void Start(IPDF_ReflowedPage* pReflowPage, |
204 return m_Status; | 225 CPDF_Page* pPage, |
205 }; | 226 FX_FLOAT TopIndent, |
206 | 227 FX_FLOAT fWidth, |
207 void SetParserStyle(RF_ParseStyle style) | 228 FX_FLOAT fHeight, |
208 { | 229 IFX_Pause* pPause, |
209 m_ParseStyle = style; | 230 int flags); |
210 }; | 231 void Continue(IFX_Pause* pPause); |
211 void Start(IPDF_ReflowedPage* pReflowPage, CPDF_Page*
pPage, FX_FLOAT TopIndent, FX_FLOAT fWidth, FX_FLOAT fHeight, IFX_Pause* pPause
, int flags); | 232 int GetPosition(); |
212 void Continue(IFX_Pause* pPause); | 233 |
213 int GetPosition() ; | 234 void Clear(); |
214 | 235 ParseStatus m_Status; |
215 void Clear(); | 236 |
216 ParseStatus m_Status; | 237 protected: |
217 protected: | 238 RF_ParseStyle m_ParseStyle; |
218 RF_ParseStyle m_ParseStyle; | 239 CPDF_Page* m_pPDFPage; |
219 CPDF_Page* m_pPDFPage; | 240 IFX_Pause* m_pPause; |
220 IFX_Pause* m_pPause; | 241 CPDF_ReflowedPage* m_pReflowPage; |
221 CPDF_ReflowedPage* m_pReflowPage; | 242 FX_FLOAT m_TopIndent; |
222 FX_FLOAT m_TopIndent; | 243 FX_FLOAT m_ReflowedWidth; |
223 FX_FLOAT m_ReflowedWidth; | 244 FX_FLOAT m_fScreenHeight; |
224 FX_FLOAT m_fScreenHeight; | 245 IPDF_LayoutProvider* m_pProvider; |
225 IPDF_LayoutProvider* m_pProvider; | 246 IPDF_LayoutProcessor* m_pReflowEngine; |
226 IPDF_LayoutProcessor* m_pReflowEngine; | 247 int m_nObjProcessed; |
227 int m_nObjProcessed; | 248 int m_flags; |
228 int m_flags; | 249 }; |
229 }; | 250 class CPDF_ProgressiveReflowPageRender |
230 class CPDF_ProgressiveReflowPageRender : public IPDF_ProgressiveReflowPageRender
, public CFX_Object | 251 : public IPDF_ProgressiveReflowPageRender, |
231 { | 252 public CFX_Object { |
232 public: | 253 public: |
233 CPDF_ProgressiveReflowPageRender(); | 254 CPDF_ProgressiveReflowPageRender(); |
234 ~CPDF_ProgressiveReflowPageRender() ; | 255 ~CPDF_ProgressiveReflowPageRender(); |
235 | 256 |
236 RenderStatus GetStatus() | 257 RenderStatus GetStatus() { return m_Status; }; |
237 { | 258 |
238 return m_Status; | 259 void SetDisplayColor(FX_COLORREF color); |
239 }; | 260 void Start(IPDF_ReflowedPage* pReflowPage, |
240 | 261 CFX_RenderDevice* pDevice, |
241 | 262 const CFX_AffineMatrix* pMatrix, |
242 void SetDisplayColor(FX_COLORREF color); | 263 IFX_Pause* pPause, |
243 void Start(IPDF_ReflowedPage* pReflowPage, CFX_RenderDevice*
pDevice, const CFX_AffineMatrix* pMatrix, IFX_Pause* pPause, int DitherBits); | 264 int DitherBits); |
244 void Continue(IFX_Pause* pPause); | 265 void Continue(IFX_Pause* pPause); |
245 int GetPosition(); | 266 int GetPosition(); |
246 | 267 |
247 | 268 void Clear(); |
248 void Clear(); | 269 |
249 protected: | 270 protected: |
250 void Display(IFX_Pause* pPause); | 271 void Display(IFX_Pause* pPause); |
251 RenderStatus m_Status; | 272 RenderStatus m_Status; |
252 CPDF_ReflowedPage* m_pReflowPage; | 273 CPDF_ReflowedPage* m_pReflowPage; |
253 CFX_AffineMatrix* m_pDisplayMatrix; | 274 CFX_AffineMatrix* m_pDisplayMatrix; |
254 int m_CurrNum; | 275 int m_CurrNum; |
255 IFX_FontEncoding* m_pFontEncoding; | 276 IFX_FontEncoding* m_pFontEncoding; |
256 CFX_RenderDevice* m_pFXDevice; | 277 CFX_RenderDevice* m_pFXDevice; |
257 int m_DitherBits; | 278 int m_DitherBits; |
258 FX_COLORREF m_DisplayColor; | 279 FX_COLORREF m_DisplayColor; |
259 typedef struct CRF_TextDataAtt { | 280 typedef struct CRF_TextDataAtt { |
260 CRF_TextDataAtt() | 281 CRF_TextDataAtt() { |
261 { | 282 pFont = NULL; |
262 pFont = NULL; | 283 fFontSize = 0.0f; |
263 fFontSize = 0.0f; | 284 Color = 0; |
264 Color = 0; | 285 } |
265 } | 286 CRF_TextDataAtt(CPDF_Font* font, FX_FLOAT fontSize, FX_ARGB color) { |
266 CRF_TextDataAtt(CPDF_Font* font, FX_FLOAT fontSize, FX_ARGB color) | 287 pFont = font; |
267 { | 288 fFontSize = fontSize; |
268 pFont = font; | 289 Color = color; |
269 fFontSize = fontSize; | 290 } |
270 Color = color; | 291 CPDF_Font* pFont; |
271 } | 292 FX_FLOAT fFontSize; |
272 CPDF_Font* pFont; | 293 FX_ARGB Color; |
273 FX_FLOAT fFontSize; | 294 } CRF_TEXTDATAATT; |
274 FX_ARGB Color; | 295 inline bool isTextDataAttSame(CRF_TEXTDATAATT data1, CRF_TEXTDATAATT data2) { |
275 } CRF_TEXTDATAATT; | 296 if (data1.pFont != data2.pFont) { |
276 inline bool isTextDataAttSame(CRF_TEXTDATAATT data1, CRF_TEXTDATAATT data2) | 297 return false; |
277 { | 298 } |
278 if (data1.pFont != data2.pFont) { | 299 if (data1.Color != data2.Color) { |
279 return false; | 300 return false; |
280 } | 301 } |
281 if (data1.Color != data2.Color) { | 302 if (fabs(data1.fFontSize - data2.fFontSize) > 0.0f) { |
282 return false; | 303 return false; |
283 } | 304 } |
284 if (fabs(data1.fFontSize - data2.fFontSize) > 0.0f) { | 305 return true; |
285 return false; | 306 }; |
286 } | 307 }; |
287 return true; | 308 #define TYPE_UNKNOW 0 |
288 }; | 309 #define TYPE_TEXT 1 |
289 }; | 310 #define TYPE_PATH 2 |
290 #define TYPE_UNKNOW 0 | 311 #define TYPE_IMAGE 3 |
291 #define TYPE_TEXT 1 | 312 #define TYPE_LINE 4 |
292 #define TYPE_PATH 2 | 313 class CRF_Data : public CFX_Object { |
293 #define TYPE_IMAGE 3 | 314 public: |
294 #define TYPE_LINE 4 | 315 typedef enum { Unknow, Text, Image, Path, Line, paragraph } RF_DataType; |
295 class CRF_Data : public CFX_Object | 316 CRF_Data() { |
296 { | 317 m_Type = Unknow; |
297 public: | 318 m_Width = 0; |
298 typedef enum {Unknow, Text, Image, Path, Line, paragraph} RF_DataType; | 319 m_PosY = 0; |
299 CRF_Data() | 320 m_PosX = 0; |
300 { | 321 m_Height = 0; |
301 m_Type = Unknow; | 322 } |
302 m_Width = 0; | 323 RF_DataType GetType() { return m_Type; } |
303 m_PosY = 0; | 324 virtual ~CRF_Data() {} |
304 m_PosX = 0; | 325 RF_DataType m_Type; |
305 m_Height = 0; | 326 FX_FLOAT m_PosX; |
306 } | 327 FX_FLOAT m_PosY; |
307 RF_DataType GetType() | 328 FX_FLOAT m_Width; |
308 { | 329 FX_FLOAT m_Height; |
309 return m_Type; | 330 }; |
310 } | 331 class CRF_LineData : public CRF_Data { |
311 virtual ~CRF_Data() {} | 332 public: |
312 RF_DataType m_Type; | 333 CRF_LineData() { m_Type = Line; } |
313 FX_FLOAT m_PosX; | 334 }; |
314 FX_FLOAT m_PosY; | 335 class CRF_CharData : public CRF_Data { |
315 FX_FLOAT m_Width; | 336 public: |
316 FX_FLOAT m_Height; | 337 CRF_CharData() { |
317 }; | 338 m_Type = Text; |
318 class CRF_LineData : public CRF_Data | 339 m_CharCode = -1; |
319 { | 340 } |
320 public: | 341 CRF_CharState* m_pCharState; |
321 CRF_LineData() | 342 FX_DWORD m_CharCode; |
322 { | 343 }; |
323 m_Type = Line; | 344 class CRF_ImageData : public CRF_Data { |
324 } | 345 public: |
325 }; | 346 CRF_ImageData() { |
326 class CRF_CharData : public CRF_Data | 347 m_Type = Image; |
327 { | 348 m_pBitmap = NULL; |
328 public: | 349 } |
329 CRF_CharData() | 350 ~CRF_ImageData() { |
330 { | 351 if (m_pBitmap) { |
331 m_Type = Text; | 352 delete m_pBitmap; |
332 m_CharCode = -1; | 353 } |
333 } | 354 m_pBitmap = NULL; |
334 CRF_CharState* m_pCharState; | 355 } |
335 FX_DWORD m_CharCode; | 356 CFX_AffineMatrix m_Matrix; |
336 }; | 357 CFX_DIBitmap* m_pBitmap; |
337 class CRF_ImageData : public CRF_Data | 358 }; |
338 { | 359 class CRF_PathData : public CRF_Data { |
339 public: | 360 public: |
340 CRF_ImageData() | 361 CRF_PathData() { |
341 { | 362 m_Type = Path; |
342 m_Type = Image; | 363 m_bDecoration = FALSE; |
343 m_pBitmap = NULL; | 364 } |
344 } | 365 ~CRF_PathData(){}; |
345 ~CRF_ImageData() | 366 FX_BOOL m_bDecoration; |
346 { | 367 CPDF_Path m_pPathData; |
347 if(m_pBitmap) { | 368 CFX_AffineMatrix m_pPath2Device; |
348 delete m_pBitmap; | 369 CPDF_GraphState m_pGraphState; |
349 } | 370 FX_ARGB m_fill_argb; |
350 m_pBitmap = NULL; | 371 FX_ARGB m_stroke_argb; |
351 } | 372 int m_fill_mode; |
352 CFX_AffineMatrix m_Matrix; | |
353 CFX_DIBitmap* m_pBitmap; | |
354 }; | |
355 class CRF_PathData : public CRF_Data | |
356 { | |
357 public: | |
358 CRF_PathData() | |
359 { | |
360 m_Type = Path; | |
361 m_bDecoration = FALSE; | |
362 } | |
363 ~CRF_PathData() {}; | |
364 FX_BOOL m_bDecoration; | |
365 CPDF_Path m_pPathData; | |
366 CFX_AffineMatrix m_pPath2Device; | |
367 CPDF_GraphState m_pGraphState; | |
368 FX_ARGB m_fill_argb; | |
369 FX_ARGB m_stroke_argb; | |
370 int m_fill_mode; | |
371 }; | 373 }; |
372 #endif | 374 #endif |
OLD | NEW |