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