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