OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PDF_ENGINE_H_ | 5 #ifndef PDF_PDF_ENGINE_H_ |
6 #define PDF_PDF_ENGINE_H_ | 6 #define PDF_PDF_ENGINE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 virtual bool HasPermission(DocumentPermission permission) const = 0; | 226 virtual bool HasPermission(DocumentPermission permission) const = 0; |
227 virtual void SelectAll() = 0; | 227 virtual void SelectAll() = 0; |
228 // Gets the number of pages in the document. | 228 // Gets the number of pages in the document. |
229 virtual int GetNumberOfPages() = 0; | 229 virtual int GetNumberOfPages() = 0; |
230 // Gets the 0-based page number of |destination|, or -1 if it does not exist. | 230 // Gets the 0-based page number of |destination|, or -1 if it does not exist. |
231 virtual int GetNamedDestinationPage(const std::string& destination) = 0; | 231 virtual int GetNamedDestinationPage(const std::string& destination) = 0; |
232 // Gets the index of the most visible page, or -1 if none are visible. | 232 // Gets the index of the most visible page, or -1 if none are visible. |
233 virtual int GetMostVisiblePage() = 0; | 233 virtual int GetMostVisiblePage() = 0; |
234 // Gets the rectangle of the page including shadow. | 234 // Gets the rectangle of the page including shadow. |
235 virtual pp::Rect GetPageRect(int index) = 0; | 235 virtual pp::Rect GetPageRect(int index) = 0; |
| 236 // Gets the rectangle of the page not including the shadow. |
| 237 virtual pp::Rect GetPageBoundsRect(int index) = 0; |
236 // Gets the rectangle of the page excluding any additional areas. | 238 // Gets the rectangle of the page excluding any additional areas. |
237 virtual pp::Rect GetPageContentsRect(int index) = 0; | 239 virtual pp::Rect GetPageContentsRect(int index) = 0; |
238 // Returns a page's rect in screen coordinates, as well as its surrounding | 240 // Returns a page's rect in screen coordinates, as well as its surrounding |
239 // border areas and bottom separator. | 241 // border areas and bottom separator. |
240 virtual pp::Rect GetPageScreenRect(int page_index) const = 0; | 242 virtual pp::Rect GetPageScreenRect(int page_index) const = 0; |
241 // Gets the offset of the vertical scrollbar from the top in document | 243 // Gets the offset of the vertical scrollbar from the top in document |
242 // coordinates. | 244 // coordinates. |
243 virtual int GetVerticalScrollbarYPosition() = 0; | 245 virtual int GetVerticalScrollbarYPosition() = 0; |
244 // Set color / grayscale rendering modes. | 246 // Set color / grayscale rendering modes. |
245 virtual void SetGrayscale(bool grayscale) = 0; | 247 virtual void SetGrayscale(bool grayscale) = 0; |
246 // Callback for timer that's set with ScheduleCallback(). | 248 // Callback for timer that's set with ScheduleCallback(). |
247 virtual void OnCallback(int id) = 0; | 249 virtual void OnCallback(int id) = 0; |
248 // Gets the JSON representation of the PDF file | 250 // Gets the JSON representation of the PDF file |
249 virtual std::string GetPageAsJSON(int index) = 0; | 251 virtual std::string GetPageAsJSON(int index) = 0; |
| 252 // Get the number of characters on a given page. |
| 253 virtual int GetCharCount(int page_index) = 0; |
| 254 // Get the width in pixels of a character on a given page. |
| 255 virtual double GetCharWidth(int page_index, int char_index) = 0; |
| 256 // Get a given unicode character on a given page. |
| 257 virtual uint32_t GetCharUnicode(int page_index, int char_index) = 0; |
| 258 // Given a start char index, find the longest continuous run of text that's |
| 259 // in a single direction and with the same style and font size. Return the |
| 260 // length of that sequence and its font size and bounding box. |
| 261 virtual void GetTextRunInfo(int page_index, |
| 262 int start_char_index, |
| 263 uint32_t* out_len, |
| 264 double* out_font_size, |
| 265 pp::FloatRect* out_bounds) = 0; |
250 // Gets the PDF document's print scaling preference. True if the document can | 266 // Gets the PDF document's print scaling preference. True if the document can |
251 // be scaled to fit. | 267 // be scaled to fit. |
252 virtual bool GetPrintScaling() = 0; | 268 virtual bool GetPrintScaling() = 0; |
253 // Returns number of copies to be printed. | 269 // Returns number of copies to be printed. |
254 virtual int GetCopiesToPrint() = 0; | 270 virtual int GetCopiesToPrint() = 0; |
255 // Returns the duplex setting. | 271 // Returns the duplex setting. |
256 virtual int GetDuplexType() = 0; | 272 virtual int GetDuplexType() = 0; |
257 // Returns true if all the pages are the same size. | 273 // Returns true if all the pages are the same size. |
258 virtual bool GetPageSizeAndUniformity(pp::Size* size) = 0; | 274 virtual bool GetPageSizeAndUniformity(pp::Size* size) = 0; |
259 | 275 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 | 352 |
337 // See the definition of GetPDFPageSizeByIndex in pdf.cc for details. | 353 // See the definition of GetPDFPageSizeByIndex in pdf.cc for details. |
338 virtual bool GetPDFPageSizeByIndex(const void* pdf_buffer, | 354 virtual bool GetPDFPageSizeByIndex(const void* pdf_buffer, |
339 int pdf_buffer_size, int page_number, | 355 int pdf_buffer_size, int page_number, |
340 double* width, double* height) = 0; | 356 double* width, double* height) = 0; |
341 }; | 357 }; |
342 | 358 |
343 } // namespace chrome_pdf | 359 } // namespace chrome_pdf |
344 | 360 |
345 #endif // PDF_PDF_ENGINE_H_ | 361 #endif // PDF_PDF_ENGINE_H_ |
OLD | NEW |