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 <algorithm> | 7 #include <algorithm> |
8 #include <cctype> | 8 #include <cctype> |
9 #include <cwctype> | 9 #include <cwctype> |
10 #include <memory> | 10 #include <memory> |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 return (FX_STRSIZE)wFind; | 143 return (FX_STRSIZE)wFind; |
144 } | 144 } |
145 | 145 |
146 } // namespace | 146 } // namespace |
147 | 147 |
148 CPDF_TextPage::CPDF_TextPage(const CPDF_Page* pPage, FPDFText_Direction flags) | 148 CPDF_TextPage::CPDF_TextPage(const CPDF_Page* pPage, FPDFText_Direction flags) |
149 : m_pPage(pPage), | 149 : m_pPage(pPage), |
150 m_parserflag(flags), | 150 m_parserflag(flags), |
151 m_pPreTextObj(nullptr), | 151 m_pPreTextObj(nullptr), |
152 m_bIsParsed(false), | 152 m_bIsParsed(false), |
153 m_TextlineDir(-1), | 153 m_TextlineDir(-1) { |
154 m_CurlineRect(0, 0, 0, 0) { | |
155 m_TextBuf.EstimateSize(0, 10240); | 154 m_TextBuf.EstimateSize(0, 10240); |
156 pPage->GetDisplayMatrix(m_DisplayMatrix, 0, 0, (int)pPage->GetPageWidth(), | 155 pPage->GetDisplayMatrix(m_DisplayMatrix, 0, 0, (int)pPage->GetPageWidth(), |
157 (int)pPage->GetPageHeight(), 0); | 156 (int)pPage->GetPageHeight(), 0); |
158 } | 157 } |
159 | 158 |
| 159 CPDF_TextPage::~CPDF_TextPage() {} |
| 160 |
160 bool CPDF_TextPage::IsControlChar(const PAGECHAR_INFO& charInfo) { | 161 bool CPDF_TextPage::IsControlChar(const PAGECHAR_INFO& charInfo) { |
161 switch (charInfo.m_Unicode) { | 162 switch (charInfo.m_Unicode) { |
162 case 0x2: | 163 case 0x2: |
163 case 0x3: | 164 case 0x3: |
164 case 0x93: | 165 case 0x93: |
165 case 0x94: | 166 case 0x94: |
166 case 0x96: | 167 case 0x96: |
167 case 0x97: | 168 case 0x97: |
168 case 0x98: | 169 case 0x98: |
169 case 0xfffe: | 170 case 0xfffe: |
(...skipping 1655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1825 m_CharIndex.push_back(i + 1); | 1826 m_CharIndex.push_back(i + 1); |
1826 } | 1827 } |
1827 } | 1828 } |
1828 } | 1829 } |
1829 int indexSize = pdfium::CollectionSize<int>(m_CharIndex); | 1830 int indexSize = pdfium::CollectionSize<int>(m_CharIndex); |
1830 if (indexSize % 2) { | 1831 if (indexSize % 2) { |
1831 m_CharIndex.erase(m_CharIndex.begin() + indexSize - 1); | 1832 m_CharIndex.erase(m_CharIndex.begin() + indexSize - 1); |
1832 } | 1833 } |
1833 } | 1834 } |
1834 | 1835 |
| 1836 CPDF_TextPageFind::~CPDF_TextPageFind() {} |
| 1837 |
1835 int CPDF_TextPageFind::GetCharIndex(int index) const { | 1838 int CPDF_TextPageFind::GetCharIndex(int index) const { |
1836 return m_pTextPage->CharIndexFromTextIndex(index); | 1839 return m_pTextPage->CharIndexFromTextIndex(index); |
1837 } | 1840 } |
1838 | 1841 |
1839 FX_BOOL CPDF_TextPageFind::FindFirst(const CFX_WideString& findwhat, | 1842 FX_BOOL CPDF_TextPageFind::FindFirst(const CFX_WideString& findwhat, |
1840 int flags, | 1843 int flags, |
1841 int startPos) { | 1844 int startPos) { |
1842 if (!m_pTextPage) { | 1845 if (!m_pTextPage) { |
1843 return FALSE; | 1846 return FALSE; |
1844 } | 1847 } |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2336 return index < m_LinkArray.size() ? m_LinkArray[index].m_strUrl : L""; | 2339 return index < m_LinkArray.size() ? m_LinkArray[index].m_strUrl : L""; |
2337 } | 2340 } |
2338 | 2341 |
2339 std::vector<CFX_FloatRect> CPDF_LinkExtract::GetRects(size_t index) const { | 2342 std::vector<CFX_FloatRect> CPDF_LinkExtract::GetRects(size_t index) const { |
2340 if (index >= m_LinkArray.size()) | 2343 if (index >= m_LinkArray.size()) |
2341 return std::vector<CFX_FloatRect>(); | 2344 return std::vector<CFX_FloatRect>(); |
2342 | 2345 |
2343 return m_pTextPage->GetRectArray(m_LinkArray[index].m_Start, | 2346 return m_pTextPage->GetRectArray(m_LinkArray[index].m_Start, |
2344 m_LinkArray[index].m_Count); | 2347 m_LinkArray[index].m_Count); |
2345 } | 2348 } |
OLD | NEW |