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 _PDF_TXTPROC_H_ | 7 #ifndef _PDF_TXTPROC_H_ |
8 #define _PDF_TXTPROC_H_ | 8 #define _PDF_TXTPROC_H_ |
9 class CTextColumn : public CFX_Object | 9 class CTextColumn : public CFX_Object { |
10 { | 10 public: |
11 public: | 11 FX_FLOAT m_AvgPos; |
12 FX_FLOAT» m_AvgPos; | 12 int m_Count; |
13 int»» m_Count; | 13 int m_TextPos; |
14 int»» m_TextPos; | |
15 }; | 14 }; |
16 class CTextBox : public CFX_Object | 15 class CTextBox : public CFX_Object { |
17 { | 16 public: |
18 public: | 17 CFX_WideString m_Text; |
19 CFX_WideString» m_Text; | 18 FX_FLOAT m_Left; |
20 FX_FLOAT» m_Left; | 19 FX_FLOAT m_Right; |
21 FX_FLOAT» m_Right; | 20 FX_FLOAT m_SpaceWidth; |
22 FX_FLOAT» m_SpaceWidth; | 21 FX_FLOAT m_Top; |
23 FX_FLOAT» m_Top; | 22 FX_FLOAT m_Bottom; |
24 FX_FLOAT» m_Bottom; | 23 FX_FLOAT m_FontSizeV; |
25 FX_FLOAT» m_FontSizeV; | 24 CTextColumn* m_pColumn; |
26 CTextColumn* m_pColumn; | |
27 }; | 25 }; |
28 class CTextBaseLine : public CFX_Object | 26 class CTextBaseLine : public CFX_Object { |
29 { | 27 public: |
30 public: | 28 CTextBaseLine(); |
31 CTextBaseLine(); | 29 ~CTextBaseLine(); |
32 ~CTextBaseLine(); | 30 void InsertTextBox(FX_FLOAT leftx, |
33 void» InsertTextBox(FX_FLOAT leftx, FX_FLOAT rightx, FX_FLOAT topy, FX
_FLOAT bottomy, | 31 FX_FLOAT rightx, |
34 FX_FLOAT spacew, FX_FLOAT fontsize_v, const CFX_WideSt
ring& str); | 32 FX_FLOAT topy, |
35 FX_BOOL» GetWidth(FX_FLOAT& leftx, FX_FLOAT& rightx); | 33 FX_FLOAT bottomy, |
36 FX_BOOL» CanMerge(CTextBaseLine* pOther); | 34 FX_FLOAT spacew, |
37 void» Merge(CTextBaseLine* pOther); | 35 FX_FLOAT fontsize_v, |
38 void» MergeBoxes(); | 36 const CFX_WideString& str); |
39 void» CountChars(int& count, FX_FLOAT& width, int& minchars); | 37 FX_BOOL GetWidth(FX_FLOAT& leftx, FX_FLOAT& rightx); |
40 void» WriteOutput(CFX_WideString& str, FX_FLOAT leftx, FX_FLOAT width,
int iWidth); | 38 FX_BOOL CanMerge(CTextBaseLine* pOther); |
41 FX_FLOAT» m_BaseLine; | 39 void Merge(CTextBaseLine* pOther); |
42 FX_FLOAT» m_Top; | 40 void MergeBoxes(); |
43 FX_FLOAT» m_Bottom; | 41 void CountChars(int& count, FX_FLOAT& width, int& minchars); |
44 FX_FLOAT» m_MaxFontSizeV; | 42 void WriteOutput(CFX_WideString& str, |
45 CFX_PtrArray» » m_TextList; | 43 FX_FLOAT leftx, |
| 44 FX_FLOAT width, |
| 45 int iWidth); |
| 46 FX_FLOAT m_BaseLine; |
| 47 FX_FLOAT m_Top; |
| 48 FX_FLOAT m_Bottom; |
| 49 FX_FLOAT m_MaxFontSizeV; |
| 50 CFX_PtrArray m_TextList; |
46 }; | 51 }; |
47 class CPDF_PageObject; | 52 class CPDF_PageObject; |
48 class CPDF_TextObject; | 53 class CPDF_TextObject; |
49 class CTextPage : public CFX_Object | 54 class CTextPage : public CFX_Object { |
50 { | 55 public: |
51 public: | 56 CTextPage(); |
52 CTextPage(); | 57 ~CTextPage(); |
53 ~CTextPage(); | 58 void ProcessObject(CPDF_PageObject* pObj); |
54 void» ProcessObject(CPDF_PageObject* pObj); | 59 CTextBaseLine* InsertTextBox(CTextBaseLine* pBaseLine, |
55 CTextBaseLine* InsertTextBox(CTextBaseLine* pBaseLine, FX_FLOAT basey, FX_FL
OAT leftx, | 60 FX_FLOAT basey, |
56 FX_FLOAT rightx, FX_FLOAT topy, FX_FLOAT bottom
y, FX_FLOAT spacew, FX_FLOAT fontsize_v, | 61 FX_FLOAT leftx, |
57 CFX_ByteString& str, CPDF_Font* pFont); | 62 FX_FLOAT rightx, |
58 void» WriteOutput(CFX_WideStringArray& lines, int iMinWidth); | 63 FX_FLOAT topy, |
59 FX_BOOL» m_bAutoWidth; | 64 FX_FLOAT bottomy, |
60 FX_BOOL» m_bKeepColumn; | 65 FX_FLOAT spacew, |
61 FX_BOOL» m_bBreakSpace; | 66 FX_FLOAT fontsize_v, |
62 FX_BOOL» m_bOCR; | 67 CFX_ByteString& str, |
63 private: | 68 CPDF_Font* pFont); |
64 CFX_PtrArray» m_BaseLines; | 69 void WriteOutput(CFX_WideStringArray& lines, int iMinWidth); |
65 CFX_PtrArray» m_TextColumns; | 70 FX_BOOL m_bAutoWidth; |
66 void» FindColumns(); | 71 FX_BOOL m_bKeepColumn; |
67 CTextColumn*» FindColumn(FX_FLOAT xpos); | 72 FX_BOOL m_bBreakSpace; |
68 void» BreakSpace(CPDF_TextObject* pTextObj); | 73 FX_BOOL m_bOCR; |
| 74 |
| 75 private: |
| 76 CFX_PtrArray m_BaseLines; |
| 77 CFX_PtrArray m_TextColumns; |
| 78 void FindColumns(); |
| 79 CTextColumn* FindColumn(FX_FLOAT xpos); |
| 80 void BreakSpace(CPDF_TextObject* pTextObj); |
69 }; | 81 }; |
70 #endif | 82 #endif |
OLD | NEW |