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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 { | 99 { |
100 if (this == &other) { | 100 if (this == &other) { |
101 return; | 101 return; |
102 } | 102 } |
103 this->rcSection = other.rcSection; | 103 this->rcSection = other.rcSection; |
104 this->nTotalLine = other.nTotalLine; | 104 this->nTotalLine = other.nTotalLine; |
105 if (other.pSecProps) { | 105 if (other.pSecProps) { |
106 if (pSecProps) { | 106 if (pSecProps) { |
107 *pSecProps = *other.pSecProps; | 107 *pSecProps = *other.pSecProps; |
108 } else { | 108 } else { |
109 pSecProps = FX_NEW CPVT_SecProps(*other.pSecProps); | 109 pSecProps = new CPVT_SecProps(*other.pSecProps); |
110 } | 110 } |
111 } | 111 } |
112 if (other.pWordProps) { | 112 if (other.pWordProps) { |
113 if (pWordProps) { | 113 if (pWordProps) { |
114 *pWordProps = *other.pWordProps; | 114 *pWordProps = *other.pWordProps; |
115 } else { | 115 } else { |
116 pWordProps = FX_NEW CPVT_WordProps(*other.pWordProps); | 116 pWordProps = new CPVT_WordProps(*other.pWordProps); |
117 } | 117 } |
118 } | 118 } |
119 } | 119 } |
120 CPVT_FloatRect rcSection; | 120 CPVT_FloatRect rcSection; |
121 FX_INT32 nTotalLine; | 121 FX_INT32 nTotalLine; |
122 CPVT_SecProps* pSecProps; | 122 CPVT_SecProps* pSecProps; |
123 CPVT_WordProps* pWordProps; | 123 CPVT_WordProps* pWordProps; |
124 }; | 124 }; |
125 struct CPVT_LineInfo { | 125 struct CPVT_LineInfo { |
126 CPVT_LineInfo() : nTotalWord(0), nBeginWordIndex(-1), nEndWordIndex(-1), | 126 CPVT_LineInfo() : nTotalWord(0), nBeginWordIndex(-1), nEndWordIndex(-1), |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 if (this == &word) { | 162 if (this == &word) { |
163 return; | 163 return; |
164 } | 164 } |
165 this->Word = word.Word; | 165 this->Word = word.Word; |
166 this->nCharset = word.nCharset; | 166 this->nCharset = word.nCharset; |
167 this->nFontIndex = word.nFontIndex; | 167 this->nFontIndex = word.nFontIndex; |
168 if (word.pWordProps) { | 168 if (word.pWordProps) { |
169 if (pWordProps) { | 169 if (pWordProps) { |
170 *pWordProps = *word.pWordProps; | 170 *pWordProps = *word.pWordProps; |
171 } else { | 171 } else { |
172 pWordProps = FX_NEW CPVT_WordProps(*word.pWordProps); | 172 pWordProps = new CPVT_WordProps(*word.pWordProps); |
173 } | 173 } |
174 } | 174 } |
175 } | 175 } |
176 FX_WORD Word; | 176 FX_WORD Word; |
177 FX_INT32 nCharset; | 177 FX_INT32 nCharset; |
178 FX_FLOAT fWordX; | 178 FX_FLOAT fWordX; |
179 FX_FLOAT fWordY; | 179 FX_FLOAT fWordY; |
180 FX_FLOAT fWordTail; | 180 FX_FLOAT fWordTail; |
181 FX_INT32 nFontIndex; | 181 FX_INT32 nFontIndex; |
182 CPVT_WordProps* pWordProps; | 182 CPVT_WordProps* pWordProps; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 { | 251 { |
252 for (FX_INT32 i = 0, sz = GetSize(); i < sz; i++) { | 252 for (FX_INT32 i = 0, sz = GetSize(); i < sz; i++) { |
253 delete GetAt(i); | 253 delete GetAt(i); |
254 } | 254 } |
255 m_Lines.RemoveAll(); | 255 m_Lines.RemoveAll(); |
256 m_nTotal = 0; | 256 m_nTotal = 0; |
257 } | 257 } |
258 FX_INT32 Add(cons
t CPVT_LineInfo & lineinfo) | 258 FX_INT32 Add(cons
t CPVT_LineInfo & lineinfo) |
259 { | 259 { |
260 if (m_nTotal >= GetSize()) { | 260 if (m_nTotal >= GetSize()) { |
261 if (CLine * pLine = FX_NEW CLine) { | 261 CLine* pLine = new CLine; |
262 pLine->m_LineInfo = lineinfo; | 262 pLine->m_LineInfo = lineinfo; |
263 m_Lines.Add(pLine); | 263 m_Lines.Add(pLine); |
264 return m_nTotal++; | 264 } else if (CLine* pLine = GetAt(m_nTotal)) { |
265 } | 265 pLine->m_LineInfo = lineinfo; |
266 return m_nTotal; | |
267 } else { | |
268 if (CLine * pLine = GetAt(m_nTotal)) { | |
269 pLine->m_LineInfo = lineinfo; | |
270 } | |
271 return m_nTotal++; | |
272 } | 266 } |
| 267 return m_nTotal++; |
273 } | 268 } |
274 void
Clear() | 269 void
Clear() |
275 { | 270 { |
276 for (FX_INT32 i = GetSize() - 1; i >= m_nTotal; i--) { | 271 for (FX_INT32 i = GetSize() - 1; i >= m_nTotal; i--) { |
277 delete GetAt(i); | 272 delete GetAt(i); |
278 m_Lines.RemoveAt(i); | 273 m_Lines.RemoveAt(i); |
279 } | 274 } |
280 } | 275 } |
281 private: | 276 private: |
282 CPVT_ArrayTemplate<CLine*> m_Lines; | 277 CPVT_ArrayTemplate<CLine*> m_Lines; |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 const CPVT_WordPlace & GetAt() const | 629 const CPVT_WordPlace & GetAt() const |
635 { | 630 { |
636 return m_CurPos; | 631 return m_CurPos; |
637 }; | 632 }; |
638 private: | 633 private: |
639 CPVT_WordPlace m_CurPos
; | 634 CPVT_WordPlace m_CurPos
; |
640 CPDF_VariableText * m_pVT; | 635 CPDF_VariableText * m_pVT; |
641 }; | 636 }; |
642 | 637 |
643 #endif // _PDF_VT_H_ | 638 #endif // _PDF_VT_H_ |
OLD | NEW |