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