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 <cctype> | |
8 | |
7 #include "../../../third_party/base/nonstd_unique_ptr.h" | 9 #include "../../../third_party/base/nonstd_unique_ptr.h" |
8 #include "../../include/fpdfapi/fpdf_page.h" | 10 #include "../../include/fpdfapi/fpdf_page.h" |
9 #include "../../include/fpdfapi/fpdf_pageobj.h" | 11 #include "../../include/fpdfapi/fpdf_pageobj.h" |
10 #include "../../include/fpdfapi/fpdf_resource.h" | 12 #include "../../include/fpdfapi/fpdf_resource.h" |
11 #include "../../include/fpdftext/fpdf_text.h" | 13 #include "../../include/fpdftext/fpdf_text.h" |
12 #include "../../include/fxcrt/fx_bidi.h" | 14 #include "../../include/fxcrt/fx_bidi.h" |
13 #include "../../include/fxcrt/fx_ucd.h" | 15 #include "../../include/fxcrt/fx_ucd.h" |
14 #include "text_int.h" | 16 #include "text_int.h" |
15 #include "txtproc.h" | 17 #include "txtproc.h" |
16 | 18 |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
429 } | 431 } |
430 } | 432 } |
431 } | 433 } |
432 } | 434 } |
433 str.Empty(); | 435 str.Empty(); |
434 str += sBuffer; | 436 str += sBuffer; |
435 } | 437 } |
436 static FX_BOOL IsNumber(CFX_WideString& str) { | 438 static FX_BOOL IsNumber(CFX_WideString& str) { |
437 for (int i = 0; i < str.GetLength(); i++) { | 439 for (int i = 0; i < str.GetLength(); i++) { |
438 FX_WCHAR ch = str[i]; | 440 FX_WCHAR ch = str[i]; |
439 if ((ch < '0' || ch > '9') && ch != '-' && ch != '+' && ch != '.' && | 441 if (!std::isdigit(ch) && ch != '-' && ch != '+' && ch != '.' && ch != ' ') |
Tom Sepez
2015/11/04 18:42:45
this should be iswdigit(), otherwise risk undefine
dsinclair
2015/11/04 20:16:23
Done. Added todo for --.+ +.--
Tom Sepez
2015/11/04 20:33:11
nice.
| |
440 ch != ' ') { | |
441 return FALSE; | 442 return FALSE; |
442 } | |
443 } | 443 } |
444 return TRUE; | 444 return TRUE; |
445 } | 445 } |
446 void CTextPage::FindColumns() { | 446 void CTextPage::FindColumns() { |
447 int i; | 447 int i; |
448 for (i = 0; i < m_BaseLines.GetSize(); i++) { | 448 for (i = 0; i < m_BaseLines.GetSize(); i++) { |
449 CTextBaseLine* pBaseLine = (CTextBaseLine*)m_BaseLines.GetAt(i); | 449 CTextBaseLine* pBaseLine = (CTextBaseLine*)m_BaseLines.GetAt(i); |
450 for (int j = 0; j < pBaseLine->m_TextList.GetSize(); j++) { | 450 for (int j = 0; j < pBaseLine->m_TextList.GetSize(); j++) { |
451 CTextBox* pTextBox = (CTextBox*)pBaseLine->m_TextList.GetAt(j); | 451 CTextBox* pTextBox = (CTextBox*)pBaseLine->m_TextList.GetAt(j); |
452 CTextColumn* pColumn = FindColumn(pTextBox->m_Right); | 452 CTextColumn* pColumn = FindColumn(pTextBox->m_Right); |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
783 FX_DWORD flags) { | 783 FX_DWORD flags) { |
784 buffer.EstimateSize(0, 10240); | 784 buffer.EstimateSize(0, 10240); |
785 CPDF_Page page; | 785 CPDF_Page page; |
786 page.Load(pDoc, pPage); | 786 page.Load(pDoc, pPage); |
787 CPDF_ParseOptions options; | 787 CPDF_ParseOptions options; |
788 options.m_bTextOnly = TRUE; | 788 options.m_bTextOnly = TRUE; |
789 options.m_bSeparateForm = FALSE; | 789 options.m_bSeparateForm = FALSE; |
790 page.ParseContent(&options); | 790 page.ParseContent(&options); |
791 GetTextStream_Unicode(buffer, &page, TRUE, NULL); | 791 GetTextStream_Unicode(buffer, &page, TRUE, NULL); |
792 } | 792 } |
OLD | NEW |