| 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 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 public: | 27 public: |
| 28 PDFiumPage(PDFiumEngine* engine, | 28 PDFiumPage(PDFiumEngine* engine, |
| 29 int i, | 29 int i, |
| 30 const pp::Rect& r, | 30 const pp::Rect& r, |
| 31 bool available); | 31 bool available); |
| 32 ~PDFiumPage(); | 32 ~PDFiumPage(); |
| 33 // Unloads the PDFium data for this page from memory. | 33 // Unloads the PDFium data for this page from memory. |
| 34 void Unload(); | 34 void Unload(); |
| 35 // Gets the FPDF_PAGE for this page, loading and parsing it if necessary. | 35 // Gets the FPDF_PAGE for this page, loading and parsing it if necessary. |
| 36 FPDF_PAGE GetPage(); | 36 FPDF_PAGE GetPage(); |
| 37 //Get the FPDF_PAGE for printing. | 37 // Get the FPDF_PAGE for printing. |
| 38 FPDF_PAGE GetPrintPage(); | 38 FPDF_PAGE GetPrintPage(); |
| 39 //Close the printing page. | 39 // Close the printing page. |
| 40 void ClosePrintPage(); | 40 void ClosePrintPage(); |
| 41 | 41 |
| 42 // Returns FPDF_TEXTPAGE for the page, loading and parsing it if necessary. | 42 // Returns FPDF_TEXTPAGE for the page, loading and parsing it if necessary. |
| 43 FPDF_TEXTPAGE GetTextPage(); | 43 FPDF_TEXTPAGE GetTextPage(); |
| 44 | 44 |
| 45 // Returns a DictionaryValue version of the page. | 45 // Returns a DictionaryValue version of the page. |
| 46 base::Value* GetAccessibleContentAsValue(int rotation); | 46 base::Value* GetAccessibleContentAsValue(int rotation); |
| 47 | 47 |
| 48 enum Area { | 48 enum Area { |
| 49 NONSELECTABLE_AREA, | 49 NONSELECTABLE_AREA, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 Area GetLinkTarget(FPDF_LINK link, LinkTarget* target); | 105 Area GetLinkTarget(FPDF_LINK link, LinkTarget* target); |
| 106 // Returns target associated with a destination. | 106 // Returns target associated with a destination. |
| 107 Area GetDestinationTarget(FPDF_DEST destination, LinkTarget* target); | 107 Area GetDestinationTarget(FPDF_DEST destination, LinkTarget* target); |
| 108 // Returns the text in the supplied box as a Value Node | 108 // Returns the text in the supplied box as a Value Node |
| 109 base::Value* GetTextBoxAsValue(double page_height, double left, double top, | 109 base::Value* GetTextBoxAsValue(double page_height, double left, double top, |
| 110 double right, double bottom, int rotation); | 110 double right, double bottom, int rotation); |
| 111 // Helper functions for JSON generation | 111 // Helper functions for JSON generation |
| 112 base::Value* CreateTextNode(std::string text); | 112 base::Value* CreateTextNode(std::string text); |
| 113 base::Value* CreateURLNode(std::string text, std::string url); | 113 base::Value* CreateURLNode(std::string text, std::string url); |
| 114 | 114 |
| 115 class ScopedLoadCounter { |
| 116 public: |
| 117 explicit ScopedLoadCounter(PDFiumPage* page); |
| 118 ~ScopedLoadCounter(); |
| 119 |
| 120 private: |
| 121 PDFiumPage* const page_; |
| 122 }; |
| 123 |
| 115 struct Link { | 124 struct Link { |
| 116 Link(); | 125 Link(); |
| 117 ~Link(); | 126 ~Link(); |
| 118 | 127 |
| 119 std::string url; | 128 std::string url; |
| 120 // Bounding rectangles of characters. | 129 // Bounding rectangles of characters. |
| 121 std::vector<pp::Rect> rects; | 130 std::vector<pp::Rect> rects; |
| 122 }; | 131 }; |
| 123 | 132 |
| 124 PDFiumEngine* engine_; | 133 PDFiumEngine* engine_; |
| 125 FPDF_PAGE page_; | 134 FPDF_PAGE page_; |
| 126 FPDF_TEXTPAGE text_page_; | 135 FPDF_TEXTPAGE text_page_; |
| 127 int index_; | 136 int index_; |
| 137 int loading_count_; |
| 128 pp::Rect rect_; | 138 pp::Rect rect_; |
| 129 bool calculated_links_; | 139 bool calculated_links_; |
| 130 std::vector<Link> links_; | 140 std::vector<Link> links_; |
| 131 bool available_; | 141 bool available_; |
| 132 }; | 142 }; |
| 133 | 143 |
| 134 } // namespace chrome_pdf | 144 } // namespace chrome_pdf |
| 135 | 145 |
| 136 #endif // PDF_PDFIUM_PDFIUM_PAGE_H_ | 146 #endif // PDF_PDFIUM_PDFIUM_PAGE_H_ |
| OLD | NEW |