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(TextOrientation::Unknown), | 153 m_TextlineDir(TextOrientation::Unknown) { |
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 1652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1822 m_CharIndex.push_back(i + 1); | 1823 m_CharIndex.push_back(i + 1); |
1823 } | 1824 } |
1824 } | 1825 } |
1825 } | 1826 } |
1826 int indexSize = pdfium::CollectionSize<int>(m_CharIndex); | 1827 int indexSize = pdfium::CollectionSize<int>(m_CharIndex); |
1827 if (indexSize % 2) { | 1828 if (indexSize % 2) { |
1828 m_CharIndex.erase(m_CharIndex.begin() + indexSize - 1); | 1829 m_CharIndex.erase(m_CharIndex.begin() + indexSize - 1); |
1829 } | 1830 } |
1830 } | 1831 } |
1831 | 1832 |
| 1833 CPDF_TextPageFind::~CPDF_TextPageFind() {} |
| 1834 |
1832 int CPDF_TextPageFind::GetCharIndex(int index) const { | 1835 int CPDF_TextPageFind::GetCharIndex(int index) const { |
1833 return m_pTextPage->CharIndexFromTextIndex(index); | 1836 return m_pTextPage->CharIndexFromTextIndex(index); |
1834 } | 1837 } |
1835 | 1838 |
1836 FX_BOOL CPDF_TextPageFind::FindFirst(const CFX_WideString& findwhat, | 1839 FX_BOOL CPDF_TextPageFind::FindFirst(const CFX_WideString& findwhat, |
1837 int flags, | 1840 int flags, |
1838 int startPos) { | 1841 int startPos) { |
1839 if (!m_pTextPage) { | 1842 if (!m_pTextPage) { |
1840 return FALSE; | 1843 return FALSE; |
1841 } | 1844 } |
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2333 return index < m_LinkArray.size() ? m_LinkArray[index].m_strUrl : L""; | 2336 return index < m_LinkArray.size() ? m_LinkArray[index].m_strUrl : L""; |
2334 } | 2337 } |
2335 | 2338 |
2336 std::vector<CFX_FloatRect> CPDF_LinkExtract::GetRects(size_t index) const { | 2339 std::vector<CFX_FloatRect> CPDF_LinkExtract::GetRects(size_t index) const { |
2337 if (index >= m_LinkArray.size()) | 2340 if (index >= m_LinkArray.size()) |
2338 return std::vector<CFX_FloatRect>(); | 2341 return std::vector<CFX_FloatRect>(); |
2339 | 2342 |
2340 return m_pTextPage->GetRectArray(m_LinkArray[index].m_Start, | 2343 return m_pTextPage->GetRectArray(m_LinkArray[index].m_Start, |
2341 m_LinkArray[index].m_Count); | 2344 m_LinkArray[index].m_Count); |
2342 } | 2345 } |
OLD | NEW |