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/include/fpdfdoc/fpdf_doc.h" | 7 #include "../../core/include/fpdfdoc/fpdf_doc.h" |
8 #include "../../core/include/fpdftext/fpdf_text.h" | 8 #include "../../core/include/fpdftext/fpdf_text.h" |
9 #include "../../public/fpdf_text.h" | 9 #include "../../public/fpdf_text.h" |
10 | 10 |
11 #ifdef _WIN32 | 11 #ifdef _WIN32 |
12 #include <tchar.h> | 12 #include <tchar.h> |
13 #endif | 13 #endif |
14 | 14 |
15 // jabdelmalek: commented out to build on Linux. Not used. | 15 // jabdelmalek: commented out to build on Linux. Not used. |
16 // extern HANDLE g_hModule; | 16 // extern HANDLE g_hModule; |
17 | 17 |
18 DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page) | 18 DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page) |
19 { | 19 { |
20 if (!page) return NULL; | 20 if (!page) return NULL; |
21 IPDF_TextPage* textpage=NULL; | 21 IPDF_TextPage* textpage=NULL; |
22 CPDF_ViewerPreferences viewRef(((CPDF_Page*)page)->m_pDocument); | 22 CPDF_ViewerPreferences viewRef(((CPDF_Page*)page)->m_pDocument); |
23 textpage=IPDF_TextPage::CreateTextPage((CPDF_Page*)page,viewRef.IsDirect
ionR2L()); | 23 textpage=IPDF_TextPage::CreateTextPage((CPDF_Page*)page,viewRef.IsDirect
ionR2L()); |
24 textpage->ParseTextPage(); | 24 textpage->ParseTextPage(); |
25 return textpage; | 25 return textpage; |
26 } | 26 } |
27 DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page) | 27 DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page) |
28 { | 28 { |
29 » if (text_page){ | 29 delete (IPDF_TextPage*)text_page; |
30 » » IPDF_TextPage* textpage=(IPDF_TextPage*)text_page; | |
31 » » delete textpage; | |
32 » » text_page=NULL; | |
33 » } | |
34 } | 30 } |
35 DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page) | 31 DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page) |
36 { | 32 { |
37 if (!text_page) return -1; | 33 if (!text_page) return -1; |
38 IPDF_TextPage* textpage=(IPDF_TextPage*)text_page; | 34 IPDF_TextPage* textpage=(IPDF_TextPage*)text_page; |
39 return textpage->CountChars(); | 35 return textpage->CountChars(); |
40 } | 36 } |
41 DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, int
index) | 37 DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, int
index) |
42 { | 38 { |
43 if (!text_page) return -1; | 39 if (!text_page) return -1; |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 if (rect_index >= 0 && rect_index < rectArray.GetSize()) { | 235 if (rect_index >= 0 && rect_index < rectArray.GetSize()) { |
240 CFX_FloatRect rect=rectArray.GetAt(rect_index); | 236 CFX_FloatRect rect=rectArray.GetAt(rect_index); |
241 *left=rect.left; | 237 *left=rect.left; |
242 *right=rect.right; | 238 *right=rect.right; |
243 *top=rect.top; | 239 *top=rect.top; |
244 *bottom=rect.bottom; | 240 *bottom=rect.bottom; |
245 } | 241 } |
246 } | 242 } |
247 DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page) | 243 DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page) |
248 { | 244 { |
249 » if (!link_page) return; | 245 delete (IPDF_LinkExtract*)link_page; |
250 » IPDF_LinkExtract* pageLink=(IPDF_LinkExtract*)link_page; | |
251 » delete pageLink; | |
252 » pageLink =NULL; | |
253 } | 246 } |
254 | 247 |
OLD | NEW |