| 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_VT_H_ | 7 #ifndef _PDF_VT_H_ |
| 8 #define _PDF_VT_H_ | 8 #define _PDF_VT_H_ |
| 9 | 9 |
| 10 class CPVT_Size; | 10 class CPVT_Size; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 } | 129 } |
| 130 FX_INT32 nTotalWord; | 130 FX_INT32 nTotalWord; |
| 131 FX_INT32 nBeginWordIndex; | 131 FX_INT32 nBeginWordIndex; |
| 132 FX_INT32 nEndWordIndex; | 132 FX_INT32 nEndWordIndex; |
| 133 FX_FLOAT fLineX; | 133 FX_FLOAT fLineX; |
| 134 FX_FLOAT fLineY; | 134 FX_FLOAT fLineY; |
| 135 FX_FLOAT fLineWidth; | 135 FX_FLOAT fLineWidth; |
| 136 FX_FLOAT fLineAscent; | 136 FX_FLOAT fLineAscent; |
| 137 FX_FLOAT fLineDescent; | 137 FX_FLOAT fLineDescent; |
| 138 }; | 138 }; |
| 139 struct CPVT_WordInfo : public CFX_Object { | 139 struct CPVT_WordInfo { |
| 140 CPVT_WordInfo() : Word(0), nCharset(0), | 140 CPVT_WordInfo() : Word(0), nCharset(0), |
| 141 fWordX(0.0f), fWordY(0.0f), fWordTail(0.0f), nFontIndex(-1), pWordProps(
NULL) | 141 fWordX(0.0f), fWordY(0.0f), fWordTail(0.0f), nFontIndex(-1), pWordProps(
NULL) |
| 142 { | 142 { |
| 143 } | 143 } |
| 144 CPVT_WordInfo(FX_WORD word, FX_INT32 charset, FX_INT32 fontIndex, CPVT_WordP
rops * pProps): | 144 CPVT_WordInfo(FX_WORD word, FX_INT32 charset, FX_INT32 fontIndex, CPVT_WordP
rops * pProps): |
| 145 Word(word), nCharset(charset), fWordX(0.0f), fWordY(0.0f), fWordTail(0.0
f), | 145 Word(word), nCharset(charset), fWordX(0.0f), fWordY(0.0f), fWordTail(0.0
f), |
| 146 nFontIndex(fontIndex), pWordProps(pProps) | 146 nFontIndex(fontIndex), pWordProps(pProps) |
| 147 { | 147 { |
| 148 } | 148 } |
| 149 virtual ~CPVT_WordInfo() | 149 virtual ~CPVT_WordInfo() |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 } | 208 } |
| 209 return NULL; | 209 return NULL; |
| 210 } | 210 } |
| 211 void RemoveAt(int nIndex) | 211 void RemoveAt(int nIndex) |
| 212 { | 212 { |
| 213 if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) { | 213 if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) { |
| 214 CFX_ArrayTemplate<TYPE>::RemoveAt(nIndex); | 214 CFX_ArrayTemplate<TYPE>::RemoveAt(nIndex); |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 }; | 217 }; |
| 218 class CLine : public CFX_Object | 218 class CLine |
| 219 { | 219 { |
| 220 public: | 220 public: |
| 221 CLine(); | 221 CLine(); |
| 222 virtual ~CLine(); | 222 virtual ~CLine(); |
| 223 CPVT_WordPlace GetBegin
WordPlace() const; | 223 CPVT_WordPlace GetBegin
WordPlace() const; |
| 224 CPVT_WordPlace GetEndWo
rdPlace() const; | 224 CPVT_WordPlace GetEndWo
rdPlace() const; |
| 225 CPVT_WordPlace GetPrevW
ordPlace(const CPVT_WordPlace & place) const; | 225 CPVT_WordPlace GetPrevW
ordPlace(const CPVT_WordPlace & place) const; |
| 226 CPVT_WordPlace GetNextW
ordPlace(const CPVT_WordPlace & place) const; | 226 CPVT_WordPlace GetNextW
ordPlace(const CPVT_WordPlace & place) const; |
| 227 CPVT_WordPlace LinePlac
e; | 227 CPVT_WordPlace LinePlac
e; |
| 228 CPVT_LineInfo m_LineIn
fo; | 228 CPVT_LineInfo m_LineIn
fo; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 { | 275 { |
| 276 for (FX_INT32 i = GetSize() - 1; i >= m_nTotal; i--) { | 276 for (FX_INT32 i = GetSize() - 1; i >= m_nTotal; i--) { |
| 277 delete GetAt(i); | 277 delete GetAt(i); |
| 278 m_Lines.RemoveAt(i); | 278 m_Lines.RemoveAt(i); |
| 279 } | 279 } |
| 280 } | 280 } |
| 281 private: | 281 private: |
| 282 CPVT_ArrayTemplate<CLine*> m_Lines; | 282 CPVT_ArrayTemplate<CLine*> m_Lines; |
| 283 FX_INT32 m_nTotal
; | 283 FX_INT32 m_nTotal
; |
| 284 }; | 284 }; |
| 285 class CSection : public CFX_Object | 285 class CSection |
| 286 { | 286 { |
| 287 friend class CTypeset; | 287 friend class CTypeset; |
| 288 public: | 288 public: |
| 289 CSection(CPDF_VariableText * pVT); | 289 CSection(CPDF_VariableText * pVT); |
| 290 virtual ~CSection(); | 290 virtual ~CSection(); |
| 291 void
ResetAll(); | 291 void
ResetAll(); |
| 292 void
ResetLineArray(); | 292 void
ResetLineArray(); |
| 293 void
ResetWordArray(); | 293 void
ResetWordArray(); |
| 294 void
ResetLinePlace(); | 294 void
ResetLinePlace(); |
| 295 CPVT_WordPlace AddWord(
const CPVT_WordPlace & place, const CPVT_WordInfo & wordinfo); | 295 CPVT_WordPlace AddWord(
const CPVT_WordPlace & place, const CPVT_WordInfo & wordinfo); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 { | 393 { |
| 394 CPDF_Point ptLeftTop = OutToIn(CPDF_Point(rect.left, rect.top)); | 394 CPDF_Point ptLeftTop = OutToIn(CPDF_Point(rect.left, rect.top)); |
| 395 CPDF_Point ptRightBottom = OutToIn(CPDF_Point(rect.right, rect.bottom)); | 395 CPDF_Point ptRightBottom = OutToIn(CPDF_Point(rect.right, rect.bottom)); |
| 396 return CPVT_FloatRect(ptLeftTop.x, ptLeftTop.y, ptRightBottom.x, ptRight
Bottom.y); | 396 return CPVT_FloatRect(ptLeftTop.x, ptLeftTop.y, ptRightBottom.x, ptRight
Bottom.y); |
| 397 }; | 397 }; |
| 398 | 398 |
| 399 private: | 399 private: |
| 400 CPDF_Rect m_rcPlat
e; | 400 CPDF_Rect m_rcPlat
e; |
| 401 CPVT_FloatRect m_rcCont
ent; | 401 CPVT_FloatRect m_rcCont
ent; |
| 402 }; | 402 }; |
| 403 class CPDF_VariableText : public IPDF_VariableText, public CFX_Object, private C
PDF_EditContainer | 403 class CPDF_VariableText : public IPDF_VariableText, private CPDF_EditContainer |
| 404 { | 404 { |
| 405 friend class CTypeset; | 405 friend class CTypeset; |
| 406 friend class CSection; | 406 friend class CSection; |
| 407 friend class CPDF_VariableText_Iterator; | 407 friend class CPDF_VariableText_Iterator; |
| 408 public: | 408 public: |
| 409 CPDF_VariableText(); | 409 CPDF_VariableText(); |
| 410 virtual ~CPDF_VariableText(); | 410 virtual ~CPDF_VariableText(); |
| 411 IPDF_VariableText_Provider* SetProvider(IPDF_Variabl
eText_Provider * pProvider); | 411 IPDF_VariableText_Provider* SetProvider(IPDF_Variabl
eText_Provider * pProvider); |
| 412 IPDF_VariableText_Iterator* GetIterator(); | 412 IPDF_VariableText_Iterator* GetIterator(); |
| 413 void
SetPlateRect(const CPDF_Rect & rect) | 413 void
SetPlateRect(const CPDF_Rect & rect) |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 FX_INT32 m_nHorzS
cale; | 606 FX_INT32 m_nHorzS
cale; |
| 607 FX_WORD
m_wSubWord; | 607 FX_WORD
m_wSubWord; |
| 608 FX_FLOAT m_fFontS
ize; | 608 FX_FLOAT m_fFontS
ize; |
| 609 | 609 |
| 610 private: | 610 private: |
| 611 FX_BOOL
m_bInitial; | 611 FX_BOOL
m_bInitial; |
| 612 FX_BOOL
m_bRichText; | 612 FX_BOOL
m_bRichText; |
| 613 IPDF_VariableText_Provider * m_pVTProvider; | 613 IPDF_VariableText_Provider * m_pVTProvider; |
| 614 CPDF_VariableText_Iterator * m_pVTIterator; | 614 CPDF_VariableText_Iterator * m_pVTIterator; |
| 615 }; | 615 }; |
| 616 class CPDF_VariableText_Iterator : public IPDF_VariableText_Iterator, public CFX
_Object | 616 class CPDF_VariableText_Iterator : public IPDF_VariableText_Iterator |
| 617 { | 617 { |
| 618 public: | 618 public: |
| 619 CPDF_VariableText_Iterator(CPDF_VariableText * pVT); | 619 CPDF_VariableText_Iterator(CPDF_VariableText * pVT); |
| 620 virtual ~CPDF_VariableText_Iterator(); | 620 virtual ~CPDF_VariableText_Iterator(); |
| 621 FX_BOOL
NextWord(); | 621 FX_BOOL
NextWord(); |
| 622 FX_BOOL
PrevWord(); | 622 FX_BOOL
PrevWord(); |
| 623 FX_BOOL
NextLine(); | 623 FX_BOOL
NextLine(); |
| 624 FX_BOOL
PrevLine(); | 624 FX_BOOL
PrevLine(); |
| 625 FX_BOOL
NextSection(); | 625 FX_BOOL
NextSection(); |
| 626 FX_BOOL
PrevSection(); | 626 FX_BOOL
PrevSection(); |
| 627 FX_BOOL
SetWord(const CPVT_Word & word); | 627 FX_BOOL
SetWord(const CPVT_Word & word); |
| 628 FX_BOOL
GetWord(CPVT_Word & word) const; | 628 FX_BOOL
GetWord(CPVT_Word & word) const; |
| 629 FX_BOOL
GetLine(CPVT_Line & line) const; | 629 FX_BOOL
GetLine(CPVT_Line & line) const; |
| 630 FX_BOOL
GetSection(CPVT_Section & section) const; | 630 FX_BOOL
GetSection(CPVT_Section & section) const; |
| 631 FX_BOOL
SetSection(const CPVT_Section & section); | 631 FX_BOOL
SetSection(const CPVT_Section & section); |
| 632 void
SetAt(FX_INT32 nWordIndex); | 632 void
SetAt(FX_INT32 nWordIndex); |
| 633 void
SetAt(const CPVT_WordPlace & place); | 633 void
SetAt(const CPVT_WordPlace & place); |
| 634 const CPVT_WordPlace & GetAt() const | 634 const CPVT_WordPlace & GetAt() const |
| 635 { | 635 { |
| 636 return m_CurPos; | 636 return m_CurPos; |
| 637 }; | 637 }; |
| 638 private: | 638 private: |
| 639 CPVT_WordPlace m_CurPos
; | 639 CPVT_WordPlace m_CurPos
; |
| 640 CPDF_VariableText * m_pVT; | 640 CPDF_VariableText * m_pVT; |
| 641 }; | 641 }; |
| 642 | 642 |
| 643 #endif // _PDF_VT_H_ | 643 #endif // _PDF_VT_H_ |
| OLD | NEW |