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 "core/fpdftext/fpdf_text_int.h" | 7 #include "core/fpdftext/fpdf_text_int.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <cctype> | 10 #include <cctype> |
(...skipping 2167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2178 if (_IsIgnoreSpaceCharacter(curChar)) { | 2178 if (_IsIgnoreSpaceCharacter(curChar)) { |
2179 if (pos > 0 && curChar == 0x2019) { | 2179 if (pos > 0 && curChar == 0x2019) { |
2180 pos++; | 2180 pos++; |
2181 continue; | 2181 continue; |
2182 } | 2182 } |
2183 if (pos > 0) { | 2183 if (pos > 0) { |
2184 m_csFindWhatArray.push_back(csWord.Mid(0, pos)); | 2184 m_csFindWhatArray.push_back(csWord.Mid(0, pos)); |
2185 } | 2185 } |
2186 m_csFindWhatArray.push_back(curStr); | 2186 m_csFindWhatArray.push_back(curStr); |
2187 if (pos == csWord.GetLength() - 1) { | 2187 if (pos == csWord.GetLength() - 1) { |
2188 csWord.Empty(); | 2188 csWord.clear(); |
2189 break; | 2189 break; |
2190 } | 2190 } |
2191 csWord = csWord.Right(csWord.GetLength() - pos - 1); | 2191 csWord = csWord.Right(csWord.GetLength() - pos - 1); |
2192 pos = 0; | 2192 pos = 0; |
2193 continue; | 2193 continue; |
2194 } | 2194 } |
2195 pos++; | 2195 pos++; |
2196 } | 2196 } |
2197 if (!csWord.IsEmpty()) { | 2197 if (!csWord.IsEmpty()) { |
2198 m_csFindWhatArray.push_back(csWord); | 2198 m_csFindWhatArray.push_back(csWord); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2251 FX_BOOL CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString, | 2251 FX_BOOL CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString, |
2252 const FX_WCHAR* lpszFullString, | 2252 const FX_WCHAR* lpszFullString, |
2253 int iSubString, | 2253 int iSubString, |
2254 FX_WCHAR chSep) { | 2254 FX_WCHAR chSep) { |
2255 if (!lpszFullString) { | 2255 if (!lpszFullString) { |
2256 return FALSE; | 2256 return FALSE; |
2257 } | 2257 } |
2258 while (iSubString--) { | 2258 while (iSubString--) { |
2259 lpszFullString = FXSYS_wcschr(lpszFullString, chSep); | 2259 lpszFullString = FXSYS_wcschr(lpszFullString, chSep); |
2260 if (!lpszFullString) { | 2260 if (!lpszFullString) { |
2261 rString.Empty(); | 2261 rString.clear(); |
2262 return FALSE; | 2262 return FALSE; |
2263 } | 2263 } |
2264 lpszFullString++; | 2264 lpszFullString++; |
2265 while (*lpszFullString == chSep) { | 2265 while (*lpszFullString == chSep) { |
2266 lpszFullString++; | 2266 lpszFullString++; |
2267 } | 2267 } |
2268 } | 2268 } |
2269 const FX_WCHAR* lpchEnd = FXSYS_wcschr(lpszFullString, chSep); | 2269 const FX_WCHAR* lpchEnd = FXSYS_wcschr(lpszFullString, chSep); |
2270 int nLen = lpchEnd ? (int)(lpchEnd - lpszFullString) | 2270 int nLen = lpchEnd ? (int)(lpchEnd - lpszFullString) |
2271 : (int)FXSYS_wcslen(lpszFullString); | 2271 : (int)FXSYS_wcslen(lpszFullString); |
2272 ASSERT(nLen >= 0); | 2272 ASSERT(nLen >= 0); |
2273 FXSYS_memcpy(rString.GetBuffer(nLen), lpszFullString, | 2273 FXSYS_memcpy(rString.GetBuffer(nLen), lpszFullString, |
2274 nLen * sizeof(FX_WCHAR)); | 2274 nLen * sizeof(FX_WCHAR)); |
2275 rString.ReleaseBuffer(); | 2275 rString.ReleaseBuffer(); |
2276 return TRUE; | 2276 return TRUE; |
2277 } | 2277 } |
2278 | 2278 |
2279 CFX_WideString CPDF_TextPageFind::MakeReverse(const CFX_WideString& str) { | 2279 CFX_WideString CPDF_TextPageFind::MakeReverse(const CFX_WideString& str) { |
2280 CFX_WideString str2; | 2280 CFX_WideString str2; |
2281 str2.Empty(); | 2281 str2.clear(); |
2282 int nlen = str.GetLength(); | 2282 int nlen = str.GetLength(); |
2283 for (int i = nlen - 1; i >= 0; i--) { | 2283 for (int i = nlen - 1; i >= 0; i--) { |
2284 str2 += str.GetAt(i); | 2284 str2 += str.GetAt(i); |
2285 } | 2285 } |
2286 return str2; | 2286 return str2; |
2287 } | 2287 } |
2288 | 2288 |
2289 void CPDF_TextPageFind::GetRectArray(CFX_RectArray& rects) const { | 2289 void CPDF_TextPageFind::GetRectArray(CFX_RectArray& rects) const { |
2290 rects.Copy(m_resArray); | 2290 rects.Copy(m_resArray); |
2291 } | 2291 } |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2511 if (!m_bIsParsed || index < 0 || index >= m_LinkList.GetSize()) { | 2511 if (!m_bIsParsed || index < 0 || index >= m_LinkList.GetSize()) { |
2512 return; | 2512 return; |
2513 } | 2513 } |
2514 CPDF_LinkExt* link = NULL; | 2514 CPDF_LinkExt* link = NULL; |
2515 link = m_LinkList.GetAt(index); | 2515 link = m_LinkList.GetAt(index); |
2516 if (!link) { | 2516 if (!link) { |
2517 return; | 2517 return; |
2518 } | 2518 } |
2519 m_pTextPage->GetRectArray(link->m_Start, link->m_Count, rects); | 2519 m_pTextPage->GetRectArray(link->m_Start, link->m_Count, rects); |
2520 } | 2520 } |
OLD | NEW |