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 "../../include/fpdfapi/fpdf_resource.h" | 7 #include "../../include/fpdfapi/fpdf_resource.h" |
8 #include "../../include/fpdfapi/fpdf_pageobj.h" | 8 #include "../../include/fpdfapi/fpdf_pageobj.h" |
9 #include "../../include/fpdftext/fpdf_text.h" | 9 #include "../../include/fpdftext/fpdf_text.h" |
10 #include "../../include/fpdfapi/fpdf_page.h" | 10 #include "../../include/fpdfapi/fpdf_page.h" |
(...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1354 AddCharInfoByRLDirection(str, n); | 1354 AddCharInfoByRLDirection(str, n); |
1355 } | 1355 } |
1356 } else { | 1356 } else { |
1357 int end = start + count1 ; | 1357 int end = start + count1 ; |
1358 for(int n = start; n < end; n++) { | 1358 for(int n = start; n < end; n++) { |
1359 AddCharInfoByLRDirection(str, n); | 1359 AddCharInfoByLRDirection(str, n); |
1360 } | 1360 } |
1361 } | 1361 } |
1362 } | 1362 } |
1363 } | 1363 } |
1364 int ntext = m_TextBuf.GetSize(); | |
1365 ntext = m_charList.GetSize(); | |
1366 order.RemoveAll(); | 1364 order.RemoveAll(); |
1367 m_TempCharList.RemoveAll(); | 1365 m_TempCharList.RemoveAll(); |
1368 m_TempTextBuf.Delete(0, m_TempTextBuf.GetLength()); | 1366 m_TempTextBuf.Delete(0, m_TempTextBuf.GetLength()); |
1369 BidiChar->Release(); | 1367 BidiChar->Release(); |
1370 } | 1368 } |
1371 void CPDF_TextPage::ProcessTextObject(CPDF_TextObject* pTextObj, const CFX_Affi
neMatrix& formMatrix, FX_POSITION ObjPos) | 1369 void CPDF_TextPage::ProcessTextObject(CPDF_TextObject* pTextObj, const CFX_Affi
neMatrix& formMatrix, FX_POSITION ObjPos) |
1372 { | 1370 { |
1373 CFX_FloatRect re(pTextObj->m_Left, pTextObj->m_Bottom, pTextObj->m_Right, pT
extObj->m_Top); | 1371 CFX_FloatRect re(pTextObj->m_Left, pTextObj->m_Bottom, pTextObj->m_Right, pT
extObj->m_Top); |
1374 if(FXSYS_fabs(pTextObj->m_Right - pTextObj->m_Left) < 0.01f ) { | 1372 if(FXSYS_fabs(pTextObj->m_Right - pTextObj->m_Left) < 0.01f ) { |
1375 return; | 1373 return; |
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2500 if(csWord.IsEmpty()) { | 2498 if(csWord.IsEmpty()) { |
2501 if(ret) { | 2499 if(ret) { |
2502 m_csFindWhatArray.Add(CFX_WideString(L"")); | 2500 m_csFindWhatArray.Add(CFX_WideString(L"")); |
2503 index++; | 2501 index++; |
2504 continue; | 2502 continue; |
2505 } else { | 2503 } else { |
2506 break; | 2504 break; |
2507 } | 2505 } |
2508 } | 2506 } |
2509 int pos = 0; | 2507 int pos = 0; |
2510 FX_BOOL bLastIgnore = FALSE; | |
2511 while(pos < csWord.GetLength()) { | 2508 while(pos < csWord.GetLength()) { |
2512 CFX_WideString curStr = csWord.Mid(pos, 1); | 2509 CFX_WideString curStr = csWord.Mid(pos, 1); |
2513 FX_WCHAR curChar = csWord.GetAt(pos); | 2510 FX_WCHAR curChar = csWord.GetAt(pos); |
2514 if (_IsIgnoreSpaceCharacter(curChar)) { | 2511 if (_IsIgnoreSpaceCharacter(curChar)) { |
2515 if (pos > 0 && curChar == 0x2019) { | 2512 if (pos > 0 && curChar == 0x2019) { |
2516 pos++; | 2513 pos++; |
2517 continue; | 2514 continue; |
2518 } | 2515 } |
2519 if (pos > 0 ) { | 2516 if (pos > 0 ) { |
2520 CFX_WideString preStr = csWord.Mid(0, pos); | 2517 CFX_WideString preStr = csWord.Mid(0, pos); |
2521 m_csFindWhatArray.Add(preStr); | 2518 m_csFindWhatArray.Add(preStr); |
2522 } | 2519 } |
2523 m_csFindWhatArray.Add(curStr); | 2520 m_csFindWhatArray.Add(curStr); |
2524 if (pos == csWord.GetLength() - 1) { | 2521 if (pos == csWord.GetLength() - 1) { |
2525 csWord.Empty(); | 2522 csWord.Empty(); |
2526 break; | 2523 break; |
2527 } | 2524 } |
2528 csWord = csWord.Right(csWord.GetLength() - pos - 1); | 2525 csWord = csWord.Right(csWord.GetLength() - pos - 1); |
2529 pos = 0; | 2526 pos = 0; |
2530 bLastIgnore = TRUE; | |
2531 continue; | 2527 continue; |
2532 } else { | |
2533 bLastIgnore = FALSE; | |
2534 } | 2528 } |
2535 pos++; | 2529 pos++; |
2536 } | 2530 } |
2537 if (!csWord.IsEmpty()) { | 2531 if (!csWord.IsEmpty()) { |
2538 m_csFindWhatArray.Add(csWord); | 2532 m_csFindWhatArray.Add(csWord); |
2539 } | 2533 } |
2540 index++; | 2534 index++; |
2541 } | 2535 } |
2542 return; | |
2543 } | 2536 } |
2544 FX_BOOL CPDF_TextPageFind::IsMatchWholeWord(const CFX_WideString& csPageText, in
t startPos, int endPos) | 2537 FX_BOOL CPDF_TextPageFind::IsMatchWholeWord(const CFX_WideString& csPageText, in
t startPos, int endPos) |
2545 { | 2538 { |
2546 int char_left = 0; | 2539 int char_left = 0; |
2547 int char_right = 0; | 2540 int char_right = 0; |
2548 int char_count = endPos - startPos + 1; | 2541 int char_count = endPos - startPos + 1; |
2549 if(char_count < 1) { | 2542 if(char_count < 1) { |
2550 return FALSE; | 2543 return FALSE; |
2551 } | 2544 } |
2552 if (char_count == 1 && csPageText.GetAt(startPos) > 255) { | 2545 if (char_count == 1 && csPageText.GetAt(startPos) > 255) { |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2843 if (!m_IsParserd || index < 0 || index >= m_LinkList.GetSize()) { | 2836 if (!m_IsParserd || index < 0 || index >= m_LinkList.GetSize()) { |
2844 return; | 2837 return; |
2845 } | 2838 } |
2846 CPDF_LinkExt* link = NULL; | 2839 CPDF_LinkExt* link = NULL; |
2847 link = m_LinkList.GetAt(index); | 2840 link = m_LinkList.GetAt(index); |
2848 if (!link) { | 2841 if (!link) { |
2849 return ; | 2842 return ; |
2850 } | 2843 } |
2851 m_pTextPage->GetRectArray(link->m_Start, link->m_Count, rects); | 2844 m_pTextPage->GetRectArray(link->m_Start, link->m_Count, rects); |
2852 } | 2845 } |
OLD | NEW |