OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium 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 #ifndef PDF_PDFIUM_PDFIUM_PAGE_H_ | 5 #ifndef PDF_PDFIUM_PDFIUM_PAGE_H_ |
6 #define PDF_PDFIUM_PDFIUM_PAGE_H_ | 6 #define PDF_PDFIUM_PDFIUM_PAGE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "ppapi/cpp/rect.h" | 12 #include "ppapi/cpp/rect.h" |
13 #include "third_party/pdfium/public/fpdf_doc.h" | 13 #include "third_party/pdfium/public/fpdf_doc.h" |
14 #include "third_party/pdfium/public/fpdf_formfill.h" | 14 #include "third_party/pdfium/public/fpdf_formfill.h" |
15 #include "third_party/pdfium/public/fpdf_text.h" | 15 #include "third_party/pdfium/public/fpdf_text.h" |
16 | 16 |
17 namespace base { | |
18 class Value; | |
19 } | |
20 | |
21 namespace chrome_pdf { | 17 namespace chrome_pdf { |
22 | 18 |
23 class PDFiumEngine; | 19 class PDFiumEngine; |
24 | 20 |
25 // Wrapper around a page from the document. | 21 // Wrapper around a page from the document. |
26 class PDFiumPage { | 22 class PDFiumPage { |
27 public: | 23 public: |
28 PDFiumPage(PDFiumEngine* engine, | 24 PDFiumPage(PDFiumEngine* engine, |
29 int i, | 25 int i, |
30 const pp::Rect& r, | 26 const pp::Rect& r, |
31 bool available); | 27 bool available); |
32 ~PDFiumPage(); | 28 ~PDFiumPage(); |
33 | 29 |
34 // Unloads the PDFium data for this page from memory. | 30 // Unloads the PDFium data for this page from memory. |
35 void Unload(); | 31 void Unload(); |
36 // Gets the FPDF_PAGE for this page, loading and parsing it if necessary. | 32 // Gets the FPDF_PAGE for this page, loading and parsing it if necessary. |
37 FPDF_PAGE GetPage(); | 33 FPDF_PAGE GetPage(); |
38 // Get the FPDF_PAGE for printing. | 34 // Get the FPDF_PAGE for printing. |
39 FPDF_PAGE GetPrintPage(); | 35 FPDF_PAGE GetPrintPage(); |
40 // Close the printing page. | 36 // Close the printing page. |
41 void ClosePrintPage(); | 37 void ClosePrintPage(); |
42 | 38 |
43 // Returns FPDF_TEXTPAGE for the page, loading and parsing it if necessary. | 39 // Returns FPDF_TEXTPAGE for the page, loading and parsing it if necessary. |
44 FPDF_TEXTPAGE GetTextPage(); | 40 FPDF_TEXTPAGE GetTextPage(); |
45 | 41 |
46 // Returns a DictionaryValue version of the page. | |
47 base::Value* GetAccessibleContentAsValue(int rotation); | |
48 | |
49 // Given a start char index, find the longest continuous run of text that's | 42 // Given a start char index, find the longest continuous run of text that's |
50 // in a single direction and with the same style and font size. Return the | 43 // in a single direction and with the same style and font size. Return the |
51 // length of that sequence and its font size and bounding box. | 44 // length of that sequence and its font size and bounding box. |
52 void GetTextRunInfo(int start_char_index, | 45 void GetTextRunInfo(int start_char_index, |
53 uint32_t* out_len, | 46 uint32_t* out_len, |
54 double* out_font_size, | 47 double* out_font_size, |
55 pp::FloatRect* out_bounds); | 48 pp::FloatRect* out_bounds); |
56 // Get a unicode character from the page. | 49 // Get a unicode character from the page. |
57 uint32_t GetCharUnicode(int char_index); | 50 uint32_t GetCharUnicode(int char_index); |
58 // Get the bounds of a character in page pixels. | 51 // Get the bounds of a character in page pixels. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 int loading_count_; | 137 int loading_count_; |
145 pp::Rect rect_; | 138 pp::Rect rect_; |
146 bool calculated_links_; | 139 bool calculated_links_; |
147 std::vector<Link> links_; | 140 std::vector<Link> links_; |
148 bool available_; | 141 bool available_; |
149 }; | 142 }; |
150 | 143 |
151 } // namespace chrome_pdf | 144 } // namespace chrome_pdf |
152 | 145 |
153 #endif // PDF_PDFIUM_PDFIUM_PAGE_H_ | 146 #endif // PDF_PDFIUM_PDFIUM_PAGE_H_ |
OLD | NEW |