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 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 } | 1153 } |
1154 } | 1154 } |
1155 } | 1155 } |
1156 void CPDF_TextPage::AddCharInfoByLRDirection(CFX_WideString& str, int i) | 1156 void CPDF_TextPage::AddCharInfoByLRDirection(CFX_WideString& str, int i) |
1157 { | 1157 { |
1158 PAGECHAR_INFO Info = *(PAGECHAR_INFO*)m_TempCharList.GetAt(i); | 1158 PAGECHAR_INFO Info = *(PAGECHAR_INFO*)m_TempCharList.GetAt(i); |
1159 FX_WCHAR wChar = str.GetAt(i); | 1159 FX_WCHAR wChar = str.GetAt(i); |
1160 if(!IsControlChar(&Info)) { | 1160 if(!IsControlChar(&Info)) { |
1161 Info.m_Index = m_TextBuf.GetLength(); | 1161 Info.m_Index = m_TextBuf.GetLength(); |
1162 if (wChar >= 0xFB00 && wChar <= 0xFB06) { | 1162 if (wChar >= 0xFB00 && wChar <= 0xFB06) { |
1163 FX_LPWSTR pDst = NULL; | 1163 FX_WCHAR* pDst = NULL; |
1164 FX_STRSIZE nCount = FX_Unicode_GetNormalization(wChar, pDst); | 1164 FX_STRSIZE nCount = FX_Unicode_GetNormalization(wChar, pDst); |
1165 if (nCount >= 1) { | 1165 if (nCount >= 1) { |
1166 pDst = FX_Alloc(FX_WCHAR, nCount); | 1166 pDst = FX_Alloc(FX_WCHAR, nCount); |
1167 FX_Unicode_GetNormalization(wChar, pDst); | 1167 FX_Unicode_GetNormalization(wChar, pDst); |
1168 for (int nIndex = 0; nIndex < nCount; nIndex++) { | 1168 for (int nIndex = 0; nIndex < nCount; nIndex++) { |
1169 PAGECHAR_INFO Info2 = Info; | 1169 PAGECHAR_INFO Info2 = Info; |
1170 Info2.m_Unicode = pDst[nIndex]; | 1170 Info2.m_Unicode = pDst[nIndex]; |
1171 Info2.m_Flag = FPDFTEXT_CHAR_PIECE; | 1171 Info2.m_Flag = FPDFTEXT_CHAR_PIECE; |
1172 m_TextBuf.AppendChar(Info2.m_Unicode); | 1172 m_TextBuf.AppendChar(Info2.m_Unicode); |
1173 if( !m_ParseOptions.m_bGetCharCodeOnly) { | 1173 if( !m_ParseOptions.m_bGetCharCodeOnly) { |
(...skipping 11 matching lines...) Expand all Loading... |
1185 if( !m_ParseOptions.m_bGetCharCodeOnly) { | 1185 if( !m_ParseOptions.m_bGetCharCodeOnly) { |
1186 m_charList.Add(Info); | 1186 m_charList.Add(Info); |
1187 } | 1187 } |
1188 } | 1188 } |
1189 void CPDF_TextPage::AddCharInfoByRLDirection(CFX_WideString& str, int i) | 1189 void CPDF_TextPage::AddCharInfoByRLDirection(CFX_WideString& str, int i) |
1190 { | 1190 { |
1191 PAGECHAR_INFO Info = *(PAGECHAR_INFO*)m_TempCharList.GetAt(i); | 1191 PAGECHAR_INFO Info = *(PAGECHAR_INFO*)m_TempCharList.GetAt(i); |
1192 if(!IsControlChar(&Info)) { | 1192 if(!IsControlChar(&Info)) { |
1193 Info.m_Index = m_TextBuf.GetLength(); | 1193 Info.m_Index = m_TextBuf.GetLength(); |
1194 FX_WCHAR wChar = FX_GetMirrorChar(str.GetAt(i), TRUE, FALSE); | 1194 FX_WCHAR wChar = FX_GetMirrorChar(str.GetAt(i), TRUE, FALSE); |
1195 FX_LPWSTR pDst = NULL; | 1195 FX_WCHAR* pDst = NULL; |
1196 FX_STRSIZE nCount = FX_Unicode_GetNormalization(wChar, pDst); | 1196 FX_STRSIZE nCount = FX_Unicode_GetNormalization(wChar, pDst); |
1197 if (nCount >= 1) { | 1197 if (nCount >= 1) { |
1198 pDst = FX_Alloc(FX_WCHAR, nCount); | 1198 pDst = FX_Alloc(FX_WCHAR, nCount); |
1199 FX_Unicode_GetNormalization(wChar, pDst); | 1199 FX_Unicode_GetNormalization(wChar, pDst); |
1200 for (int nIndex = 0; nIndex < nCount; nIndex++) { | 1200 for (int nIndex = 0; nIndex < nCount; nIndex++) { |
1201 PAGECHAR_INFO Info2 = Info; | 1201 PAGECHAR_INFO Info2 = Info; |
1202 Info2.m_Unicode = pDst[nIndex]; | 1202 Info2.m_Unicode = pDst[nIndex]; |
1203 Info2.m_Flag = FPDFTEXT_CHAR_PIECE; | 1203 Info2.m_Flag = FPDFTEXT_CHAR_PIECE; |
1204 m_TextBuf.AppendChar(Info2.m_Unicode); | 1204 m_TextBuf.AppendChar(Info2.m_Unicode); |
1205 if( !m_ParseOptions.m_bGetCharCodeOnly) { | 1205 if( !m_ParseOptions.m_bGetCharCodeOnly) { |
(...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2557 if (char_count > 0) { | 2557 if (char_count > 0) { |
2558 if (csPageText.GetAt(startPos) >= L'0' && csPageText.GetAt(startPos) <=
L'9' && char_left >= L'0' && char_left <= L'9') { | 2558 if (csPageText.GetAt(startPos) >= L'0' && csPageText.GetAt(startPos) <=
L'9' && char_left >= L'0' && char_left <= L'9') { |
2559 return FALSE; | 2559 return FALSE; |
2560 } | 2560 } |
2561 if (csPageText.GetAt(endPos) >= L'0' && csPageText.GetAt(endPos) <= L'9'
&& char_right >= L'0' && char_right <= L'9') { | 2561 if (csPageText.GetAt(endPos) >= L'0' && csPageText.GetAt(endPos) <= L'9'
&& char_right >= L'0' && char_right <= L'9') { |
2562 return FALSE; | 2562 return FALSE; |
2563 } | 2563 } |
2564 } | 2564 } |
2565 return TRUE; | 2565 return TRUE; |
2566 } | 2566 } |
2567 FX_BOOL CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString, FX_LPCWSTR
lpszFullString, | 2567 FX_BOOL CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString, const FX_WC
HAR* lpszFullString, |
2568 int iSubString, FX_WCHAR chSep) | 2568 int iSubString, FX_WCHAR chSep) |
2569 { | 2569 { |
2570 if (lpszFullString == NULL) { | 2570 if (lpszFullString == NULL) { |
2571 return FALSE; | 2571 return FALSE; |
2572 } | 2572 } |
2573 while (iSubString--) { | 2573 while (iSubString--) { |
2574 lpszFullString = FXSYS_wcschr(lpszFullString, chSep); | 2574 lpszFullString = FXSYS_wcschr(lpszFullString, chSep); |
2575 if (lpszFullString == NULL) { | 2575 if (lpszFullString == NULL) { |
2576 rString.Empty(); | 2576 rString.Empty(); |
2577 return FALSE; | 2577 return FALSE; |
2578 } | 2578 } |
2579 lpszFullString++; | 2579 lpszFullString++; |
2580 while(*lpszFullString == chSep) { | 2580 while(*lpszFullString == chSep) { |
2581 lpszFullString++; | 2581 lpszFullString++; |
2582 } | 2582 } |
2583 } | 2583 } |
2584 FX_LPCWSTR lpchEnd = FXSYS_wcschr(lpszFullString, chSep); | 2584 const FX_WCHAR* lpchEnd = FXSYS_wcschr(lpszFullString, chSep); |
2585 int nLen = (lpchEnd == NULL) ? | 2585 int nLen = (lpchEnd == NULL) ? |
2586 (int)FXSYS_wcslen(lpszFullString) : (int)(lpchEnd - lpszFullStrin
g); | 2586 (int)FXSYS_wcslen(lpszFullString) : (int)(lpchEnd - lpszFullStrin
g); |
2587 ASSERT(nLen >= 0); | 2587 ASSERT(nLen >= 0); |
2588 FXSYS_memcpy32(rString.GetBuffer(nLen), lpszFullString, nLen * sizeof(FX_WCH
AR)); | 2588 FXSYS_memcpy32(rString.GetBuffer(nLen), lpszFullString, nLen * sizeof(FX_WCH
AR)); |
2589 rString.ReleaseBuffer(); | 2589 rString.ReleaseBuffer(); |
2590 return TRUE; | 2590 return TRUE; |
2591 } | 2591 } |
2592 CFX_WideString CPDF_TextPageFind::MakeReverse(const CFX_WideString& str) | 2592 CFX_WideString CPDF_TextPageFind::MakeReverse(const CFX_WideString& str) |
2593 { | 2593 { |
2594 CFX_WideString str2; | 2594 CFX_WideString str2; |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2831 if (!m_IsParserd || index < 0 || index >= m_LinkList.GetSize()) { | 2831 if (!m_IsParserd || index < 0 || index >= m_LinkList.GetSize()) { |
2832 return; | 2832 return; |
2833 } | 2833 } |
2834 CPDF_LinkExt* link = NULL; | 2834 CPDF_LinkExt* link = NULL; |
2835 link = m_LinkList.GetAt(index); | 2835 link = m_LinkList.GetAt(index); |
2836 if (!link) { | 2836 if (!link) { |
2837 return ; | 2837 return ; |
2838 } | 2838 } |
2839 m_pTextPage->GetRectArray(link->m_Start, link->m_Count, rects); | 2839 m_pTextPage->GetRectArray(link->m_Start, link->m_Count, rects); |
2840 } | 2840 } |
OLD | NEW |