| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 if (m_CharIndex[i + 1] + m_CharIndex[i] > CharIndex) { | 253 if (m_CharIndex[i + 1] + m_CharIndex[i] > CharIndex) { |
| 254 if (CharIndex - m_CharIndex[i] < 0) | 254 if (CharIndex - m_CharIndex[i] < 0) |
| 255 return -1; | 255 return -1; |
| 256 | 256 |
| 257 return CharIndex - m_CharIndex[i] + count - m_CharIndex[i + 1]; | 257 return CharIndex - m_CharIndex[i] + count - m_CharIndex[i + 1]; |
| 258 } | 258 } |
| 259 } | 259 } |
| 260 return -1; | 260 return -1; |
| 261 } | 261 } |
| 262 | 262 |
| 263 void CPDF_TextPage::GetRectArray(int start, | 263 std::vector<CFX_FloatRect> CPDF_TextPage::GetRectArray(int start, |
| 264 int nCount, | 264 int nCount) const { |
| 265 CFX_RectArray* rectArray) const { | 265 if (start < 0 || nCount == 0 || !m_bIsParsed) |
| 266 if (start < 0 || nCount == 0) { | 266 return std::vector<CFX_FloatRect>(); |
| 267 return; | 267 |
| 268 } | |
| 269 if (!m_bIsParsed) { | |
| 270 return; | |
| 271 } | |
| 272 CPDF_TextObject* pCurObj = NULL; | |
| 273 CFX_FloatRect rect; | |
| 274 int curPos = start; | |
| 275 FX_BOOL flagNewRect = TRUE; | |
| 276 if (nCount + start > pdfium::CollectionSize<int>(m_CharList) || | 268 if (nCount + start > pdfium::CollectionSize<int>(m_CharList) || |
| 277 nCount == -1) { | 269 nCount == -1) { |
| 278 nCount = pdfium::CollectionSize<int>(m_CharList) - start; | 270 nCount = pdfium::CollectionSize<int>(m_CharList) - start; |
| 279 } | 271 } |
| 272 |
| 273 std::vector<CFX_FloatRect> rectArray; |
| 274 CPDF_TextObject* pCurObj = nullptr; |
| 275 CFX_FloatRect rect; |
| 276 int curPos = start; |
| 277 FX_BOOL flagNewRect = TRUE; |
| 280 while (nCount--) { | 278 while (nCount--) { |
| 281 PAGECHAR_INFO info_curchar = m_CharList[curPos++]; | 279 PAGECHAR_INFO info_curchar = m_CharList[curPos++]; |
| 282 if (info_curchar.m_Flag == FPDFTEXT_CHAR_GENERATED) { | 280 if (info_curchar.m_Flag == FPDFTEXT_CHAR_GENERATED) { |
| 283 continue; | 281 continue; |
| 284 } | 282 } |
| 285 if (info_curchar.m_CharBox.Width() < 0.01 || | 283 if (info_curchar.m_CharBox.Width() < 0.01 || |
| 286 info_curchar.m_CharBox.Height() < 0.01) { | 284 info_curchar.m_CharBox.Height() < 0.01) { |
| 287 continue; | 285 continue; |
| 288 } | 286 } |
| 289 if (!pCurObj) { | 287 if (!pCurObj) { |
| 290 pCurObj = info_curchar.m_pTextObj; | 288 pCurObj = info_curchar.m_pTextObj; |
| 291 } | 289 } |
| 292 if (pCurObj != info_curchar.m_pTextObj) { | 290 if (pCurObj != info_curchar.m_pTextObj) { |
| 293 rectArray->Add(rect); | 291 rectArray.push_back(rect); |
| 294 pCurObj = info_curchar.m_pTextObj; | 292 pCurObj = info_curchar.m_pTextObj; |
| 295 flagNewRect = TRUE; | 293 flagNewRect = TRUE; |
| 296 } | 294 } |
| 297 if (flagNewRect) { | 295 if (flagNewRect) { |
| 298 FX_FLOAT orgX = info_curchar.m_OriginX, orgY = info_curchar.m_OriginY; | 296 FX_FLOAT orgX = info_curchar.m_OriginX, orgY = info_curchar.m_OriginY; |
| 299 CFX_Matrix matrix, matrix_reverse; | 297 CFX_Matrix matrix, matrix_reverse; |
| 300 info_curchar.m_pTextObj->GetTextMatrix(&matrix); | 298 info_curchar.m_pTextObj->GetTextMatrix(&matrix); |
| 301 matrix.Concat(info_curchar.m_Matrix); | 299 matrix.Concat(info_curchar.m_Matrix); |
| 302 matrix_reverse.SetReverse(matrix); | 300 matrix_reverse.SetReverse(matrix); |
| 303 matrix_reverse.Transform(orgX, orgY); | 301 matrix_reverse.Transform(orgX, orgY); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 rect.right = info_curchar.m_CharBox.right; | 334 rect.right = info_curchar.m_CharBox.right; |
| 337 } | 335 } |
| 338 if (rect.top < info_curchar.m_CharBox.top) { | 336 if (rect.top < info_curchar.m_CharBox.top) { |
| 339 rect.top = info_curchar.m_CharBox.top; | 337 rect.top = info_curchar.m_CharBox.top; |
| 340 } | 338 } |
| 341 if (rect.bottom > info_curchar.m_CharBox.bottom) { | 339 if (rect.bottom > info_curchar.m_CharBox.bottom) { |
| 342 rect.bottom = info_curchar.m_CharBox.bottom; | 340 rect.bottom = info_curchar.m_CharBox.bottom; |
| 343 } | 341 } |
| 344 } | 342 } |
| 345 } | 343 } |
| 346 rectArray->Add(rect); | 344 rectArray.push_back(rect); |
| 345 return rectArray; |
| 347 } | 346 } |
| 348 | 347 |
| 349 int CPDF_TextPage::GetIndexAtPos(CFX_FloatPoint point, | 348 int CPDF_TextPage::GetIndexAtPos(CFX_FloatPoint point, |
| 350 FX_FLOAT xTolerance, | 349 FX_FLOAT xTolerance, |
| 351 FX_FLOAT yTolerance) const { | 350 FX_FLOAT yTolerance) const { |
| 352 if (!m_bIsParsed) | 351 if (!m_bIsParsed) |
| 353 return -3; | 352 return -3; |
| 354 | 353 |
| 355 int pos = 0; | 354 int pos = 0; |
| 356 int NearPos = -1; | 355 int NearPos = -1; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 IsAddLineFeed = false; | 419 IsAddLineFeed = false; |
| 421 } | 420 } |
| 422 } else { | 421 } else { |
| 423 IsContainPreChar = false; | 422 IsContainPreChar = false; |
| 424 IsAddLineFeed = true; | 423 IsAddLineFeed = true; |
| 425 } | 424 } |
| 426 } | 425 } |
| 427 return strText; | 426 return strText; |
| 428 } | 427 } |
| 429 | 428 |
| 430 void CPDF_TextPage::GetRectsArrayByRect(const CFX_FloatRect& rect, | 429 std::vector<CFX_FloatRect> CPDF_TextPage::GetRectsArrayByRect( |
| 431 CFX_RectArray& resRectArray) const { | 430 const CFX_FloatRect& rect) const { |
| 432 if (!m_bIsParsed) | 431 if (!m_bIsParsed) |
| 433 return; | 432 return std::vector<CFX_FloatRect>(); |
| 434 | 433 |
| 435 CFX_FloatRect curRect; | 434 CFX_FloatRect curRect; |
| 435 std::vector<CFX_FloatRect> result; |
| 436 bool flagNewRect = true; | 436 bool flagNewRect = true; |
| 437 CPDF_TextObject* pCurObj = nullptr; | 437 CPDF_TextObject* pCurObj = nullptr; |
| 438 for (auto info_curchar : m_CharList) { | 438 for (auto info_curchar : m_CharList) { |
| 439 if (info_curchar.m_Flag == FPDFTEXT_CHAR_GENERATED) { | 439 if (info_curchar.m_Flag == FPDFTEXT_CHAR_GENERATED) { |
| 440 continue; | 440 continue; |
| 441 } | 441 } |
| 442 if (!IsRectIntersect(rect, info_curchar.m_CharBox)) { | 442 if (!IsRectIntersect(rect, info_curchar.m_CharBox)) { |
| 443 continue; | 443 continue; |
| 444 } | 444 } |
| 445 if (!pCurObj) { | 445 if (!pCurObj) { |
| 446 pCurObj = info_curchar.m_pTextObj; | 446 pCurObj = info_curchar.m_pTextObj; |
| 447 } | 447 } |
| 448 if (pCurObj != info_curchar.m_pTextObj) { | 448 if (pCurObj != info_curchar.m_pTextObj) { |
| 449 resRectArray.Add(curRect); | 449 result.push_back(curRect); |
| 450 pCurObj = info_curchar.m_pTextObj; | 450 pCurObj = info_curchar.m_pTextObj; |
| 451 flagNewRect = true; | 451 flagNewRect = true; |
| 452 } | 452 } |
| 453 if (flagNewRect) { | 453 if (flagNewRect) { |
| 454 curRect = info_curchar.m_CharBox; | 454 curRect = info_curchar.m_CharBox; |
| 455 curRect.Normalize(); | 455 curRect.Normalize(); |
| 456 flagNewRect = false; | 456 flagNewRect = false; |
| 457 } else { | 457 } else { |
| 458 info_curchar.m_CharBox.Normalize(); | 458 info_curchar.m_CharBox.Normalize(); |
| 459 curRect.left = std::min(curRect.left, info_curchar.m_CharBox.left); | 459 curRect.left = std::min(curRect.left, info_curchar.m_CharBox.left); |
| 460 curRect.bottom = std::min(curRect.bottom, info_curchar.m_CharBox.bottom); | 460 curRect.bottom = std::min(curRect.bottom, info_curchar.m_CharBox.bottom); |
| 461 curRect.right = std::max(curRect.right, info_curchar.m_CharBox.right); | 461 curRect.right = std::max(curRect.right, info_curchar.m_CharBox.right); |
| 462 curRect.top = std::max(curRect.top, info_curchar.m_CharBox.top); | 462 curRect.top = std::max(curRect.top, info_curchar.m_CharBox.top); |
| 463 } | 463 } |
| 464 } | 464 } |
| 465 resRectArray.Add(curRect); | 465 result.push_back(curRect); |
| 466 return result; |
| 466 } | 467 } |
| 467 | 468 |
| 468 int CPDF_TextPage::GetIndexAtPos(FX_FLOAT x, | 469 int CPDF_TextPage::GetIndexAtPos(FX_FLOAT x, |
| 469 FX_FLOAT y, | 470 FX_FLOAT y, |
| 470 FX_FLOAT xTolerance, | 471 FX_FLOAT xTolerance, |
| 471 FX_FLOAT yTolerance) const { | 472 FX_FLOAT yTolerance) const { |
| 472 CFX_FloatPoint point(x, y); | 473 CFX_FloatPoint point(x, y); |
| 473 return GetIndexAtPos(point, xTolerance, yTolerance); | 474 return GetIndexAtPos(point, xTolerance, yTolerance); |
| 474 } | 475 } |
| 475 | 476 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 } | 585 } |
| 585 | 586 |
| 586 int CPDF_TextPage::CountRects(int start, int nCount) { | 587 int CPDF_TextPage::CountRects(int start, int nCount) { |
| 587 if (!m_bIsParsed || start < 0) | 588 if (!m_bIsParsed || start < 0) |
| 588 return -1; | 589 return -1; |
| 589 | 590 |
| 590 if (nCount == -1 || | 591 if (nCount == -1 || |
| 591 nCount + start > pdfium::CollectionSize<int>(m_CharList)) { | 592 nCount + start > pdfium::CollectionSize<int>(m_CharList)) { |
| 592 nCount = pdfium::CollectionSize<int>(m_CharList) - start; | 593 nCount = pdfium::CollectionSize<int>(m_CharList) - start; |
| 593 } | 594 } |
| 594 m_SelRects.RemoveAll(); | 595 m_SelRects = GetRectArray(start, nCount); |
| 595 GetRectArray(start, nCount, &m_SelRects); | 596 return pdfium::CollectionSize<int>(m_SelRects); |
| 596 return m_SelRects.GetSize(); | |
| 597 } | 597 } |
| 598 | 598 |
| 599 void CPDF_TextPage::GetRect(int rectIndex, | 599 void CPDF_TextPage::GetRect(int rectIndex, |
| 600 FX_FLOAT& left, | 600 FX_FLOAT& left, |
| 601 FX_FLOAT& top, | 601 FX_FLOAT& top, |
| 602 FX_FLOAT& right, | 602 FX_FLOAT& right, |
| 603 FX_FLOAT& bottom) const { | 603 FX_FLOAT& bottom) const { |
| 604 if (!m_bIsParsed) | 604 if (!m_bIsParsed) |
| 605 return; | 605 return; |
| 606 | 606 |
| 607 if (rectIndex < 0 || rectIndex >= m_SelRects.GetSize()) | 607 if (rectIndex < 0 || rectIndex >= pdfium::CollectionSize<int>(m_SelRects)) |
| 608 return; | 608 return; |
| 609 | 609 |
| 610 left = m_SelRects.GetAt(rectIndex).left; | 610 left = m_SelRects[rectIndex].left; |
| 611 top = m_SelRects.GetAt(rectIndex).top; | 611 top = m_SelRects[rectIndex].top; |
| 612 right = m_SelRects.GetAt(rectIndex).right; | 612 right = m_SelRects[rectIndex].right; |
| 613 bottom = m_SelRects.GetAt(rectIndex).bottom; | 613 bottom = m_SelRects[rectIndex].bottom; |
| 614 } | 614 } |
| 615 | 615 |
| 616 FX_BOOL CPDF_TextPage::GetBaselineRotate(int start, int end, int& Rotate) { | 616 FX_BOOL CPDF_TextPage::GetBaselineRotate(int start, int end, int& Rotate) { |
| 617 if (end == start) { | 617 if (end == start) { |
| 618 return FALSE; | 618 return FALSE; |
| 619 } | 619 } |
| 620 FPDF_CHAR_INFO info_start; | 620 FPDF_CHAR_INFO info_start; |
| 621 FPDF_CHAR_INFO info_end; | 621 FPDF_CHAR_INFO info_end; |
| 622 GetCharInfo(start, &info_start); | 622 GetCharInfo(start, &info_start); |
| 623 GetCharInfo(end, &info_end); | 623 GetCharInfo(end, &info_end); |
| (...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1990 m_IsFind = TRUE; | 1990 m_IsFind = TRUE; |
| 1991 m_resStart = 0; | 1991 m_resStart = 0; |
| 1992 m_resEnd = -1; | 1992 m_resEnd = -1; |
| 1993 return TRUE; | 1993 return TRUE; |
| 1994 } | 1994 } |
| 1995 | 1995 |
| 1996 FX_BOOL CPDF_TextPageFind::FindNext() { | 1996 FX_BOOL CPDF_TextPageFind::FindNext() { |
| 1997 if (!m_pTextPage) { | 1997 if (!m_pTextPage) { |
| 1998 return FALSE; | 1998 return FALSE; |
| 1999 } | 1999 } |
| 2000 m_resArray.RemoveAll(); | 2000 m_resArray.clear(); |
| 2001 if (m_findNextStart == -1) { | 2001 if (m_findNextStart == -1) { |
| 2002 return FALSE; | 2002 return FALSE; |
| 2003 } | 2003 } |
| 2004 if (m_strText.IsEmpty()) { | 2004 if (m_strText.IsEmpty()) { |
| 2005 m_IsFind = FALSE; | 2005 m_IsFind = FALSE; |
| 2006 return m_IsFind; | 2006 return m_IsFind; |
| 2007 } | 2007 } |
| 2008 int strLen = m_strText.GetLength(); | 2008 int strLen = m_strText.GetLength(); |
| 2009 if (m_findNextStart > strLen - 1) { | 2009 if (m_findNextStart > strLen - 1) { |
| 2010 m_IsFind = FALSE; | 2010 m_IsFind = FALSE; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2082 nStartPos = m_resStart + m_csFindWhatArray[1].GetLength(); | 2082 nStartPos = m_resStart + m_csFindWhatArray[1].GetLength(); |
| 2083 } else { | 2083 } else { |
| 2084 nStartPos = m_resStart + m_csFindWhatArray[0].GetLength(); | 2084 nStartPos = m_resStart + m_csFindWhatArray[0].GetLength(); |
| 2085 } | 2085 } |
| 2086 } | 2086 } |
| 2087 } | 2087 } |
| 2088 m_resEnd = nResultPos + m_csFindWhatArray.back().GetLength() - 1; | 2088 m_resEnd = nResultPos + m_csFindWhatArray.back().GetLength() - 1; |
| 2089 m_IsFind = TRUE; | 2089 m_IsFind = TRUE; |
| 2090 int resStart = GetCharIndex(m_resStart); | 2090 int resStart = GetCharIndex(m_resStart); |
| 2091 int resEnd = GetCharIndex(m_resEnd); | 2091 int resEnd = GetCharIndex(m_resEnd); |
| 2092 m_pTextPage->GetRectArray(resStart, resEnd - resStart + 1, &m_resArray); | 2092 m_resArray = m_pTextPage->GetRectArray(resStart, resEnd - resStart + 1); |
| 2093 if (m_flags & FPDFTEXT_CONSECUTIVE) { | 2093 if (m_flags & FPDFTEXT_CONSECUTIVE) { |
| 2094 m_findNextStart = m_resStart + 1; | 2094 m_findNextStart = m_resStart + 1; |
| 2095 m_findPreStart = m_resEnd - 1; | 2095 m_findPreStart = m_resEnd - 1; |
| 2096 } else { | 2096 } else { |
| 2097 m_findNextStart = m_resEnd + 1; | 2097 m_findNextStart = m_resEnd + 1; |
| 2098 m_findPreStart = m_resStart - 1; | 2098 m_findPreStart = m_resStart - 1; |
| 2099 } | 2099 } |
| 2100 return m_IsFind; | 2100 return m_IsFind; |
| 2101 } | 2101 } |
| 2102 | 2102 |
| 2103 FX_BOOL CPDF_TextPageFind::FindPrev() { | 2103 FX_BOOL CPDF_TextPageFind::FindPrev() { |
| 2104 if (!m_pTextPage) { | 2104 if (!m_pTextPage) { |
| 2105 return FALSE; | 2105 return FALSE; |
| 2106 } | 2106 } |
| 2107 m_resArray.RemoveAll(); | 2107 m_resArray.clear(); |
| 2108 if (m_strText.IsEmpty() || m_findPreStart < 0) { | 2108 if (m_strText.IsEmpty() || m_findPreStart < 0) { |
| 2109 m_IsFind = FALSE; | 2109 m_IsFind = FALSE; |
| 2110 return m_IsFind; | 2110 return m_IsFind; |
| 2111 } | 2111 } |
| 2112 CPDF_TextPageFind findEngine(m_pTextPage); | 2112 CPDF_TextPageFind findEngine(m_pTextPage); |
| 2113 FX_BOOL ret = findEngine.FindFirst(m_findWhat, m_flags); | 2113 FX_BOOL ret = findEngine.FindFirst(m_findWhat, m_flags); |
| 2114 if (!ret) { | 2114 if (!ret) { |
| 2115 m_IsFind = FALSE; | 2115 m_IsFind = FALSE; |
| 2116 return m_IsFind; | 2116 return m_IsFind; |
| 2117 } | 2117 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2128 MatchedCount = MatchedCount1; | 2128 MatchedCount = MatchedCount1; |
| 2129 } | 2129 } |
| 2130 } | 2130 } |
| 2131 if (order == -1) { | 2131 if (order == -1) { |
| 2132 m_IsFind = FALSE; | 2132 m_IsFind = FALSE; |
| 2133 return m_IsFind; | 2133 return m_IsFind; |
| 2134 } | 2134 } |
| 2135 m_resStart = m_pTextPage->TextIndexFromCharIndex(order); | 2135 m_resStart = m_pTextPage->TextIndexFromCharIndex(order); |
| 2136 m_resEnd = m_pTextPage->TextIndexFromCharIndex(order + MatchedCount - 1); | 2136 m_resEnd = m_pTextPage->TextIndexFromCharIndex(order + MatchedCount - 1); |
| 2137 m_IsFind = TRUE; | 2137 m_IsFind = TRUE; |
| 2138 m_pTextPage->GetRectArray(order, MatchedCount, &m_resArray); | 2138 m_resArray = m_pTextPage->GetRectArray(order, MatchedCount); |
| 2139 if (m_flags & FPDFTEXT_CONSECUTIVE) { | 2139 if (m_flags & FPDFTEXT_CONSECUTIVE) { |
| 2140 m_findNextStart = m_resStart + 1; | 2140 m_findNextStart = m_resStart + 1; |
| 2141 m_findPreStart = m_resEnd - 1; | 2141 m_findPreStart = m_resEnd - 1; |
| 2142 } else { | 2142 } else { |
| 2143 m_findNextStart = m_resEnd + 1; | 2143 m_findNextStart = m_resEnd + 1; |
| 2144 m_findPreStart = m_resStart - 1; | 2144 m_findPreStart = m_resStart - 1; |
| 2145 } | 2145 } |
| 2146 return m_IsFind; | 2146 return m_IsFind; |
| 2147 } | 2147 } |
| 2148 | 2148 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2272 CFX_WideString CPDF_TextPageFind::MakeReverse(const CFX_WideString& str) { | 2272 CFX_WideString CPDF_TextPageFind::MakeReverse(const CFX_WideString& str) { |
| 2273 CFX_WideString str2; | 2273 CFX_WideString str2; |
| 2274 str2.clear(); | 2274 str2.clear(); |
| 2275 int nlen = str.GetLength(); | 2275 int nlen = str.GetLength(); |
| 2276 for (int i = nlen - 1; i >= 0; i--) { | 2276 for (int i = nlen - 1; i >= 0; i--) { |
| 2277 str2 += str.GetAt(i); | 2277 str2 += str.GetAt(i); |
| 2278 } | 2278 } |
| 2279 return str2; | 2279 return str2; |
| 2280 } | 2280 } |
| 2281 | 2281 |
| 2282 void CPDF_TextPageFind::GetRectArray(CFX_RectArray& rects) const { | |
| 2283 rects.Copy(m_resArray); | |
| 2284 } | |
| 2285 | |
| 2286 int CPDF_TextPageFind::GetCurOrder() const { | 2282 int CPDF_TextPageFind::GetCurOrder() const { |
| 2287 return GetCharIndex(m_resStart); | 2283 return GetCharIndex(m_resStart); |
| 2288 } | 2284 } |
| 2289 | 2285 |
| 2290 int CPDF_TextPageFind::GetMatchedCount() const { | 2286 int CPDF_TextPageFind::GetMatchedCount() const { |
| 2291 int resStart = GetCharIndex(m_resStart); | 2287 int resStart = GetCharIndex(m_resStart); |
| 2292 int resEnd = GetCharIndex(m_resEnd); | 2288 int resEnd = GetCharIndex(m_resEnd); |
| 2293 return resEnd - resStart + 1; | 2289 return resEnd - resStart + 1; |
| 2294 } | 2290 } |
| 2295 | 2291 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2439 if (str.Find(L"mailto:") == -1) | 2435 if (str.Find(L"mailto:") == -1) |
| 2440 str = L"mailto:" + str; | 2436 str = L"mailto:" + str; |
| 2441 | 2437 |
| 2442 return true; | 2438 return true; |
| 2443 } | 2439 } |
| 2444 | 2440 |
| 2445 CFX_WideString CPDF_LinkExtract::GetURL(size_t index) const { | 2441 CFX_WideString CPDF_LinkExtract::GetURL(size_t index) const { |
| 2446 return index < m_LinkArray.size() ? m_LinkArray[index].m_strUrl : L""; | 2442 return index < m_LinkArray.size() ? m_LinkArray[index].m_strUrl : L""; |
| 2447 } | 2443 } |
| 2448 | 2444 |
| 2449 void CPDF_LinkExtract::GetRects(size_t index, CFX_RectArray* pRects) const { | 2445 std::vector<CFX_FloatRect> CPDF_LinkExtract::GetRects(size_t index) const { |
| 2450 if (index < m_LinkArray.size()) { | 2446 if (index >= m_LinkArray.size()) |
| 2451 m_pTextPage->GetRectArray(m_LinkArray[index].m_Start, | 2447 return std::vector<CFX_FloatRect>(); |
| 2452 m_LinkArray[index].m_Count, pRects); | 2448 |
| 2453 } | 2449 return m_pTextPage->GetRectArray(m_LinkArray[index].m_Start, |
| 2450 m_LinkArray[index].m_Count); |
| 2454 } | 2451 } |
| OLD | NEW |