| 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_PDFIUM_PDFIUM_ENGINE_H_ | 5 #ifndef PDF_PDFIUM_PDFIUM_ENGINE_H_ |
| 6 #define PDF_PDFIUM_PDFIUM_ENGINE_H_ | 6 #define PDF_PDFIUM_PDFIUM_ENGINE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 pp::Buffer_Dev PrintPagesAsPDF(const PP_PrintPageNumberRange_Dev* page_ranges, | 311 pp::Buffer_Dev PrintPagesAsPDF(const PP_PrintPageNumberRange_Dev* page_ranges, |
| 312 uint32_t page_range_count, | 312 uint32_t page_range_count, |
| 313 const PP_PrintSettings_Dev& print_settings); | 313 const PP_PrintSettings_Dev& print_settings); |
| 314 | 314 |
| 315 pp::Buffer_Dev GetFlattenedPrintData(const FPDF_DOCUMENT& doc); | 315 pp::Buffer_Dev GetFlattenedPrintData(const FPDF_DOCUMENT& doc); |
| 316 void FitContentsToPrintableAreaIfRequired( | 316 void FitContentsToPrintableAreaIfRequired( |
| 317 const FPDF_DOCUMENT& doc, | 317 const FPDF_DOCUMENT& doc, |
| 318 const PP_PrintSettings_Dev& print_settings); | 318 const PP_PrintSettings_Dev& print_settings); |
| 319 void SaveSelectedFormForPrint(); | 319 void SaveSelectedFormForPrint(); |
| 320 | 320 |
| 321 // Checks if |page| has selected text in a form element. If so, sets that as |
| 322 // the plugin's text selection. |
| 323 void SetFormSelectedText(FPDF_FORMHANDLE form_handle, FPDF_PAGE page); |
| 324 |
| 321 // Given a mouse event, returns which page and character location it's closest | 325 // Given a mouse event, returns which page and character location it's closest |
| 322 // to. | 326 // to. |
| 323 PDFiumPage::Area GetCharIndex(const pp::MouseInputEvent& event, | 327 PDFiumPage::Area GetCharIndex(const pp::MouseInputEvent& event, |
| 324 int* page_index, | 328 int* page_index, |
| 325 int* char_index, | 329 int* char_index, |
| 326 int* form_type, | 330 int* form_type, |
| 327 PDFiumPage::LinkTarget* target); | 331 PDFiumPage::LinkTarget* target); |
| 328 PDFiumPage::Area GetCharIndex(const pp::Point& point, | 332 PDFiumPage::Area GetCharIndex(const pp::Point& point, |
| 329 int* page_index, | 333 int* page_index, |
| 330 int* char_index, | 334 int* char_index, |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 pp::ImageData* image_data, | 434 pp::ImageData* image_data, |
| 431 void** region, | 435 void** region, |
| 432 int* stride) const; | 436 int* stride) const; |
| 433 | 437 |
| 434 // Called when the selection changes. | 438 // Called when the selection changes. |
| 435 void OnSelectionChanged(); | 439 void OnSelectionChanged(); |
| 436 | 440 |
| 437 // Common code shared by RotateClockwise() and RotateCounterclockwise(). | 441 // Common code shared by RotateClockwise() and RotateCounterclockwise(). |
| 438 void RotateInternal(); | 442 void RotateInternal(); |
| 439 | 443 |
| 440 // Setting selection status of document. | 444 // Sets text selection status of document. This does not include text |
| 445 // within form text fields. |
| 441 void SetSelecting(bool selecting); | 446 void SetSelecting(bool selecting); |
| 442 | 447 |
| 448 // Sets whether or not focus is in form text field or form combobox text |
| 449 // field. |
| 450 void SetInFormTextArea(bool in_form_text_area); |
| 451 |
| 443 bool PageIndexInBounds(int index) const; | 452 bool PageIndexInBounds(int index) const; |
| 444 | 453 |
| 445 void ScheduleTouchTimer(const pp::TouchInputEvent& event); | 454 void ScheduleTouchTimer(const pp::TouchInputEvent& event); |
| 446 void KillTouchTimer(int timer_id); | 455 void KillTouchTimer(int timer_id); |
| 447 void HandleLongPress(const pp::TouchInputEvent& event); | 456 void HandleLongPress(const pp::TouchInputEvent& event); |
| 448 | 457 |
| 449 // FPDF_FORMFILLINFO callbacks. | 458 // FPDF_FORMFILLINFO callbacks. |
| 450 static void Form_Invalidate(FPDF_FORMFILLINFO* param, | 459 static void Form_Invalidate(FPDF_FORMFILLINFO* param, |
| 451 FPDF_PAGE page, | 460 FPDF_PAGE page, |
| 452 double left, | 461 double left, |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 | 642 |
| 634 // The indexes of the pages pending download. | 643 // The indexes of the pages pending download. |
| 635 std::vector<int> pending_pages_; | 644 std::vector<int> pending_pages_; |
| 636 | 645 |
| 637 // During handling of input events we don't want to unload any pages in | 646 // During handling of input events we don't want to unload any pages in |
| 638 // callbacks to us from PDFium, since the current page can change while PDFium | 647 // callbacks to us from PDFium, since the current page can change while PDFium |
| 639 // code still has a pointer to it. | 648 // code still has a pointer to it. |
| 640 bool defer_page_unload_; | 649 bool defer_page_unload_; |
| 641 std::vector<int> deferred_page_unloads_; | 650 std::vector<int> deferred_page_unloads_; |
| 642 | 651 |
| 643 // Used for selection. There could be more than one range if selection spans | 652 // Used for text selection, but does not include text within form text fields. |
| 644 // more than one page. | 653 // There could be more than one range if selection spans more than one page. |
| 645 std::vector<PDFiumRange> selection_; | 654 std::vector<PDFiumRange> selection_; |
| 646 // True if we're in the middle of selection. | 655 // True if we're in the middle of text selection. |
| 647 bool selecting_; | 656 bool selecting_; |
| 648 | 657 |
| 658 // True if focus is in form text field or form combobox text field. |
| 659 bool in_form_text_area_; |
| 660 |
| 649 MouseDownState mouse_down_state_; | 661 MouseDownState mouse_down_state_; |
| 650 | 662 |
| 651 // Used for searching. | 663 // Used for searching. |
| 652 std::vector<PDFiumRange> find_results_; | 664 std::vector<PDFiumRange> find_results_; |
| 653 // Which page to search next. | 665 // Which page to search next. |
| 654 int next_page_to_search_; | 666 int next_page_to_search_; |
| 655 // Where to stop searching. | 667 // Where to stop searching. |
| 656 int last_page_to_search_; | 668 int last_page_to_search_; |
| 657 int last_character_index_to_search_; // -1 if search until end of page. | 669 int last_character_index_to_search_; // -1 if search until end of page. |
| 658 // Which result the user has currently selected. | 670 // Which result the user has currently selected. |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 bool GetPDFPageSizeByIndex(const void* pdf_buffer, | 810 bool GetPDFPageSizeByIndex(const void* pdf_buffer, |
| 799 int pdf_buffer_size, | 811 int pdf_buffer_size, |
| 800 int page_number, | 812 int page_number, |
| 801 double* width, | 813 double* width, |
| 802 double* height) override; | 814 double* height) override; |
| 803 }; | 815 }; |
| 804 | 816 |
| 805 } // namespace chrome_pdf | 817 } // namespace chrome_pdf |
| 806 | 818 |
| 807 #endif // PDF_PDFIUM_PDFIUM_ENGINE_H_ | 819 #endif // PDF_PDFIUM_PDFIUM_ENGINE_H_ |
| OLD | NEW |