| 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> | 7 #include <cctype> |
| 8 #include <cwctype> | 8 #include <cwctype> |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 } | 75 } |
| 76 return baseSpace; | 76 return baseSpace; |
| 77 } | 77 } |
| 78 | 78 |
| 79 } // namespace | 79 } // namespace |
| 80 | 80 |
| 81 CPDFText_ParseOptions::CPDFText_ParseOptions() | 81 CPDFText_ParseOptions::CPDFText_ParseOptions() |
| 82 : m_bGetCharCodeOnly(FALSE), | 82 : m_bGetCharCodeOnly(FALSE), |
| 83 m_bNormalizeObjs(TRUE), | 83 m_bNormalizeObjs(TRUE), |
| 84 m_bOutputHyphen(FALSE) {} | 84 m_bOutputHyphen(FALSE) {} |
| 85 |
| 85 IPDF_TextPage* IPDF_TextPage::CreateTextPage( | 86 IPDF_TextPage* IPDF_TextPage::CreateTextPage( |
| 86 const CPDF_Page* pPage, | 87 const CPDF_Page* pPage, |
| 87 CPDFText_ParseOptions ParserOptions) { | 88 CPDFText_ParseOptions ParserOptions) { |
| 88 return new CPDF_TextPage(pPage, ParserOptions); | 89 return new CPDF_TextPage(pPage, ParserOptions); |
| 89 } | 90 } |
| 91 |
| 90 IPDF_TextPage* IPDF_TextPage::CreateTextPage(const CPDF_Page* pPage, | 92 IPDF_TextPage* IPDF_TextPage::CreateTextPage(const CPDF_Page* pPage, |
| 91 int flags) { | 93 int flags) { |
| 92 return new CPDF_TextPage(pPage, flags); | 94 return new CPDF_TextPage(pPage, flags); |
| 93 } | 95 } |
| 96 |
| 94 IPDF_TextPage* IPDF_TextPage::CreateTextPage(const CPDF_PageObjects* pObjs, | 97 IPDF_TextPage* IPDF_TextPage::CreateTextPage(const CPDF_PageObjects* pObjs, |
| 95 int flags) { | 98 int flags) { |
| 96 return new CPDF_TextPage(pObjs, flags); | 99 return new CPDF_TextPage(pObjs, flags); |
| 97 } | 100 } |
| 101 |
| 98 IPDF_TextPageFind* IPDF_TextPageFind::CreatePageFind( | 102 IPDF_TextPageFind* IPDF_TextPageFind::CreatePageFind( |
| 99 const IPDF_TextPage* pTextPage) { | 103 const IPDF_TextPage* pTextPage) { |
| 100 return pTextPage ? new CPDF_TextPageFind(pTextPage) : nullptr; | 104 return pTextPage ? new CPDF_TextPageFind(pTextPage) : nullptr; |
| 101 } | 105 } |
| 106 |
| 102 IPDF_LinkExtract* IPDF_LinkExtract::CreateLinkExtract() { | 107 IPDF_LinkExtract* IPDF_LinkExtract::CreateLinkExtract() { |
| 103 return new CPDF_LinkExtract(); | 108 return new CPDF_LinkExtract(); |
| 104 } | 109 } |
| 110 |
| 105 #define TEXT_BLANK_CHAR L' ' | 111 #define TEXT_BLANK_CHAR L' ' |
| 106 #define TEXT_LINEFEED_CHAR L'\n' | 112 #define TEXT_LINEFEED_CHAR L'\n' |
| 107 #define TEXT_RETURN_CHAR L'\r' | 113 #define TEXT_RETURN_CHAR L'\r' |
| 108 #define TEXT_EMPTY L"" | 114 #define TEXT_EMPTY L"" |
| 109 #define TEXT_BLANK L" " | 115 #define TEXT_BLANK L" " |
| 110 #define TEXT_RETURN_LINEFEED L"\r\n" | 116 #define TEXT_RETURN_LINEFEED L"\r\n" |
| 111 #define TEXT_LINEFEED L"\n" | 117 #define TEXT_LINEFEED L"\n" |
| 112 #define TEXT_CHARRATIO_GAPDELTA 0.070 | 118 #define TEXT_CHARRATIO_GAPDELTA 0.070 |
| 113 | 119 |
| 114 CPDF_TextPage::CPDF_TextPage(const CPDF_Page* pPage, int flags) | 120 CPDF_TextPage::CPDF_TextPage(const CPDF_Page* pPage, int flags) |
| (...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1384 int nContentMark = pMarkData->CountItems(); | 1390 int nContentMark = pMarkData->CountItems(); |
| 1385 if (nContentMark < 1) { | 1391 if (nContentMark < 1) { |
| 1386 return; | 1392 return; |
| 1387 } | 1393 } |
| 1388 CFX_WideString actText; | 1394 CFX_WideString actText; |
| 1389 CPDF_Dictionary* pDict = NULL; | 1395 CPDF_Dictionary* pDict = NULL; |
| 1390 int n = 0; | 1396 int n = 0; |
| 1391 for (n = 0; n < nContentMark; n++) { | 1397 for (n = 0; n < nContentMark; n++) { |
| 1392 CPDF_ContentMarkItem& item = pMarkData->GetItem(n); | 1398 CPDF_ContentMarkItem& item = pMarkData->GetItem(n); |
| 1393 CFX_ByteString tagStr = (CFX_ByteString)item.GetName(); | 1399 CFX_ByteString tagStr = (CFX_ByteString)item.GetName(); |
| 1394 | |
| 1395 pDict = ToDictionary(static_cast<CPDF_Object*>(item.GetParam())); | 1400 pDict = ToDictionary(static_cast<CPDF_Object*>(item.GetParam())); |
| 1396 CPDF_String* temp = | 1401 CPDF_String* temp = |
| 1397 ToString(pDict ? pDict->GetElement(FX_BSTRC("ActualText")) : nullptr); | 1402 ToString(pDict ? pDict->GetElement(FX_BSTRC("ActualText")) : nullptr); |
| 1398 if (temp) { | 1403 if (temp) { |
| 1399 actText = temp->GetUnicodeText(); | 1404 actText = temp->GetUnicodeText(); |
| 1400 } | 1405 } |
| 1401 } | 1406 } |
| 1402 FX_STRSIZE nItems = actText.GetLength(); | 1407 FX_STRSIZE nItems = actText.GetLength(); |
| 1403 if (nItems < 1) { | 1408 if (nItems < 1) { |
| 1404 return; | 1409 return; |
| (...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2756 if (!m_bIsParsed || index < 0 || index >= m_LinkList.GetSize()) { | 2761 if (!m_bIsParsed || index < 0 || index >= m_LinkList.GetSize()) { |
| 2757 return; | 2762 return; |
| 2758 } | 2763 } |
| 2759 CPDF_LinkExt* link = NULL; | 2764 CPDF_LinkExt* link = NULL; |
| 2760 link = m_LinkList.GetAt(index); | 2765 link = m_LinkList.GetAt(index); |
| 2761 if (!link) { | 2766 if (!link) { |
| 2762 return; | 2767 return; |
| 2763 } | 2768 } |
| 2764 m_pTextPage->GetRectArray(link->m_Start, link->m_Count, rects); | 2769 m_pTextPage->GetRectArray(link->m_Start, link->m_Count, rects); |
| 2765 } | 2770 } |
| OLD | NEW |