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 "public/fpdf_text.h" | 7 #include "public/fpdf_text.h" |
8 | 8 |
| 9 #include "core/include/fpdfdoc/fpdf_doc.h" |
| 10 #include "core/include/fpdftext/fpdf_text.h" |
| 11 #include "fpdfsdk/include/fsdk_define.h" |
| 12 |
9 #ifdef PDF_ENABLE_XFA | 13 #ifdef PDF_ENABLE_XFA |
10 #include "../include/fpdfxfa/fpdfxfa_doc.h" | 14 #include "../include/fpdfxfa/fpdfxfa_doc.h" |
11 #include "../include/fpdfxfa/fpdfxfa_page.h" | 15 #include "../include/fpdfxfa/fpdfxfa_page.h" |
12 #endif | 16 #endif // PDF_ENABLE_XFA |
13 #include "core/include/fpdfdoc/fpdf_doc.h" | |
14 #include "core/include/fpdftext/fpdf_text.h" | |
15 #include "fpdfsdk/include/fsdk_define.h" | |
16 | 17 |
17 #ifdef _WIN32 | 18 #ifdef _WIN32 |
18 #include <tchar.h> | 19 #include <tchar.h> |
19 #endif | 20 #endif |
20 | 21 |
21 DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page) { | 22 DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page) { |
22 CPDF_Page* pPDFPage = CPDFPageFromFPDFPage(page); | 23 CPDF_Page* pPDFPage = CPDFPageFromFPDFPage(page); |
23 if (!pPDFPage) | 24 if (!pPDFPage) |
24 return nullptr; | 25 return nullptr; |
25 #ifndef PDF_ENABLE_XFA | 26 #ifdef PDF_ENABLE_XFA |
26 CPDF_ViewerPreferences viewRef(pPDFPage->m_pDocument); | |
27 #else | |
28 CPDFXFA_Page* pPage = (CPDFXFA_Page*)page; | 27 CPDFXFA_Page* pPage = (CPDFXFA_Page*)page; |
29 CPDFXFA_Document* pDoc = pPage->GetDocument(); | 28 CPDFXFA_Document* pDoc = pPage->GetDocument(); |
30 CPDF_ViewerPreferences viewRef(pDoc->GetPDFDoc()); | 29 CPDF_ViewerPreferences viewRef(pDoc->GetPDFDoc()); |
31 #endif | 30 #else // PDF_ENABLE_XFA |
| 31 CPDF_ViewerPreferences viewRef(pPDFPage->m_pDocument); |
| 32 #endif // PDF_ENABLE_XFA |
32 IPDF_TextPage* textpage = | 33 IPDF_TextPage* textpage = |
33 IPDF_TextPage::CreateTextPage(pPDFPage, viewRef.IsDirectionR2L()); | 34 IPDF_TextPage::CreateTextPage(pPDFPage, viewRef.IsDirectionR2L()); |
34 textpage->ParseTextPage(); | 35 textpage->ParseTextPage(); |
35 return textpage; | 36 return textpage; |
36 } | 37 } |
37 DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page) { | 38 DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page) { |
38 delete (IPDF_TextPage*)text_page; | 39 delete (IPDF_TextPage*)text_page; |
39 } | 40 } |
40 DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page) { | 41 DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page) { |
41 if (!text_page) | 42 if (!text_page) |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 CFX_FloatRect rect = rectArray.GetAt(rect_index); | 288 CFX_FloatRect rect = rectArray.GetAt(rect_index); |
288 *left = rect.left; | 289 *left = rect.left; |
289 *right = rect.right; | 290 *right = rect.right; |
290 *top = rect.top; | 291 *top = rect.top; |
291 *bottom = rect.bottom; | 292 *bottom = rect.bottom; |
292 } | 293 } |
293 } | 294 } |
294 DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page) { | 295 DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page) { |
295 delete (IPDF_LinkExtract*)link_page; | 296 delete (IPDF_LinkExtract*)link_page; |
296 } | 297 } |
OLD | NEW |