| 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 #include "../../include/fpdfapi/fpdf_pageobj.h" | 7 #include "../../include/fpdfapi/fpdf_pageobj.h" |
| 8 #include "../../include/fpdfapi/fpdf_page.h" | 8 #include "../../include/fpdfapi/fpdf_page.h" |
| 9 #include "text_int.h" |
| 10 |
| 9 class CPDF_TextStream { | 11 class CPDF_TextStream { |
| 10 public: | 12 public: |
| 11 CPDF_TextStream(CFX_WideTextBuf& buffer, | 13 CPDF_TextStream(CFX_WideTextBuf& buffer, |
| 12 FX_BOOL bUseLF, | 14 FX_BOOL bUseLF, |
| 13 CFX_PtrArray* pObjArray); | 15 CFX_PtrArray* pObjArray); |
| 14 ~CPDF_TextStream() {} | 16 ~CPDF_TextStream() {} |
| 15 FX_BOOL ProcessObject(const CPDF_TextObject* pObj, FX_BOOL bFirstLine); | 17 FX_BOOL ProcessObject(const CPDF_TextObject* pObj, FX_BOOL bFirstLine); |
| 16 CFX_WideTextBuf& m_Buffer; | 18 CFX_WideTextBuf& m_Buffer; |
| 17 FX_BOOL m_bUseLF; | 19 FX_BOOL m_bUseLF; |
| 18 CFX_PtrArray* m_pObjArray; | 20 CFX_PtrArray* m_pObjArray; |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 if (m_pObjArray) { | 288 if (m_pObjArray) { |
| 287 for (int i = 0; i < unicode_str.GetLength(); i++) { | 289 for (int i = 0; i < unicode_str.GetLength(); i++) { |
| 288 m_pObjArray->Add((void*)pObj); | 290 m_pObjArray->Add((void*)pObj); |
| 289 m_pObjArray->Add((void*)(intptr_t)item_index); | 291 m_pObjArray->Add((void*)(intptr_t)item_index); |
| 290 } | 292 } |
| 291 } | 293 } |
| 292 } | 294 } |
| 293 } | 295 } |
| 294 return FALSE; | 296 return FALSE; |
| 295 } | 297 } |
| 296 void _PDF_GetTextStream_Unicode(CFX_WideTextBuf& buffer, | 298 void GetTextStream_Unicode(CFX_WideTextBuf& buffer, |
| 297 CPDF_PageObjects* pPage, | 299 CPDF_PageObjects* pPage, |
| 298 FX_BOOL bUseLF, | 300 FX_BOOL bUseLF, |
| 299 CFX_PtrArray* pObjArray) { | 301 CFX_PtrArray* pObjArray) { |
| 300 CPDF_TextStream textstream(buffer, bUseLF, pObjArray); | 302 CPDF_TextStream textstream(buffer, bUseLF, pObjArray); |
| 301 FX_POSITION pos = pPage->GetFirstObjectPosition(); | 303 FX_POSITION pos = pPage->GetFirstObjectPosition(); |
| 302 while (pos) { | 304 while (pos) { |
| 303 CPDF_PageObject* pObject = pPage->GetNextObject(pos); | 305 CPDF_PageObject* pObject = pPage->GetNextObject(pos); |
| 304 if (pObject == NULL) { | 306 if (pObject == NULL) { |
| 305 continue; | 307 continue; |
| 306 } | 308 } |
| 307 if (pObject->m_Type != PDFPAGE_TEXT) { | 309 if (pObject->m_Type != PDFPAGE_TEXT) { |
| 308 continue; | 310 continue; |
| 309 } | 311 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 326 CPDF_PageObject* pObject = page.GetNextObject(pos); | 328 CPDF_PageObject* pObject = page.GetNextObject(pos); |
| 327 if (pObject->m_Type != PDFPAGE_TEXT) { | 329 if (pObject->m_Type != PDFPAGE_TEXT) { |
| 328 continue; | 330 continue; |
| 329 } | 331 } |
| 330 if (textstream.ProcessObject((CPDF_TextObject*)pObject, TRUE)) { | 332 if (textstream.ProcessObject((CPDF_TextObject*)pObject, TRUE)) { |
| 331 break; | 333 break; |
| 332 } | 334 } |
| 333 } | 335 } |
| 334 return buffer.GetWideString(); | 336 return buffer.GetWideString(); |
| 335 } | 337 } |
| OLD | NEW |