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