Chromium Code Reviews| 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 // Sets plugin's selected text to be selected text in form text field | |
| 322 // if available. | |
| 323 void SetFormSelectedText(const FPDF_FORMHANDLE& form_handle, | |
| 324 const FPDF_PAGE& page); | |
| 325 | |
| 321 // Given a mouse event, returns which page and character location it's closest | 326 // Given a mouse event, returns which page and character location it's closest |
| 322 // to. | 327 // to. |
| 323 PDFiumPage::Area GetCharIndex(const pp::MouseInputEvent& event, | 328 PDFiumPage::Area GetCharIndex(const pp::MouseInputEvent& event, |
| 324 int* page_index, | 329 int* page_index, |
| 325 int* char_index, | 330 int* char_index, |
| 326 int* form_type, | 331 int* form_type, |
| 327 PDFiumPage::LinkTarget* target); | 332 PDFiumPage::LinkTarget* target); |
| 328 PDFiumPage::Area GetCharIndex(const pp::Point& point, | 333 PDFiumPage::Area GetCharIndex(const pp::Point& point, |
| 329 int* page_index, | 334 int* page_index, |
| 330 int* char_index, | 335 int* char_index, |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 430 pp::ImageData* image_data, | 435 pp::ImageData* image_data, |
| 431 void** region, | 436 void** region, |
| 432 int* stride) const; | 437 int* stride) const; |
| 433 | 438 |
| 434 // Called when the selection changes. | 439 // Called when the selection changes. |
| 435 void OnSelectionChanged(); | 440 void OnSelectionChanged(); |
| 436 | 441 |
| 437 // Common code shared by RotateClockwise() and RotateCounterclockwise(). | 442 // Common code shared by RotateClockwise() and RotateCounterclockwise(). |
| 438 void RotateInternal(); | 443 void RotateInternal(); |
| 439 | 444 |
| 440 // Setting selection status of document. | 445 // Setting text selection status of document. This does not include text |
| 446 // within form text fields. | |
| 441 void SetSelecting(bool selecting); | 447 void SetSelecting(bool selecting); |
| 442 | 448 |
| 449 // Sets status of whether or not focus is in form text field. | |
| 450 void SetInFormTextField(bool in_form_text_field); | |
| 451 | |
| 452 // Sets status of whether or not focus is in form combobox text field. | |
| 453 void SetInFormComboboxTextField(bool in_form_combobox_text_field); | |
| 454 | |
| 443 bool PageIndexInBounds(int index) const; | 455 bool PageIndexInBounds(int index) const; |
| 444 | 456 |
| 445 void ScheduleTouchTimer(const pp::TouchInputEvent& event); | 457 void ScheduleTouchTimer(const pp::TouchInputEvent& event); |
| 446 void KillTouchTimer(int timer_id); | 458 void KillTouchTimer(int timer_id); |
| 447 void HandleLongPress(const pp::TouchInputEvent& event); | 459 void HandleLongPress(const pp::TouchInputEvent& event); |
| 448 | 460 |
| 449 // FPDF_FORMFILLINFO callbacks. | 461 // FPDF_FORMFILLINFO callbacks. |
| 450 static void Form_Invalidate(FPDF_FORMFILLINFO* param, | 462 static void Form_Invalidate(FPDF_FORMFILLINFO* param, |
| 451 FPDF_PAGE page, | 463 FPDF_PAGE page, |
| 452 double left, | 464 double left, |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 633 | 645 |
| 634 // The indexes of the pages pending download. | 646 // The indexes of the pages pending download. |
| 635 std::vector<int> pending_pages_; | 647 std::vector<int> pending_pages_; |
| 636 | 648 |
| 637 // During handling of input events we don't want to unload any pages in | 649 // 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 | 650 // callbacks to us from PDFium, since the current page can change while PDFium |
| 639 // code still has a pointer to it. | 651 // code still has a pointer to it. |
| 640 bool defer_page_unload_; | 652 bool defer_page_unload_; |
| 641 std::vector<int> deferred_page_unloads_; | 653 std::vector<int> deferred_page_unloads_; |
| 642 | 654 |
| 643 // Used for selection. There could be more than one range if selection spans | 655 // Used for text selection, but does not include text within form text fields. |
| 644 // more than one page. | 656 // There could be more than one range if selection spans more than one page. |
| 645 std::vector<PDFiumRange> selection_; | 657 std::vector<PDFiumRange> selection_; |
| 646 // True if we're in the middle of selection. | 658 // True if we're in the middle of text selection. |
| 647 bool selecting_; | 659 bool selecting_; |
| 648 | 660 |
| 661 // True if focus is on form text field. | |
| 662 bool in_form_text_field_; | |
| 663 | |
| 664 // True if focus is on form combobox text field. | |
| 665 bool in_form_combobox_text_field_; | |
|
Lei Zhang
2017/06/17 01:55:16
Do you really need a separate boolean? There's onl
drgage
2017/06/19 21:53:52
Done.
| |
| 666 | |
| 649 MouseDownState mouse_down_state_; | 667 MouseDownState mouse_down_state_; |
| 650 | 668 |
| 651 // Used for searching. | 669 // Used for searching. |
| 652 std::vector<PDFiumRange> find_results_; | 670 std::vector<PDFiumRange> find_results_; |
| 653 // Which page to search next. | 671 // Which page to search next. |
| 654 int next_page_to_search_; | 672 int next_page_to_search_; |
| 655 // Where to stop searching. | 673 // Where to stop searching. |
| 656 int last_page_to_search_; | 674 int last_page_to_search_; |
| 657 int last_character_index_to_search_; // -1 if search until end of page. | 675 int last_character_index_to_search_; // -1 if search until end of page. |
| 658 // Which result the user has currently selected. | 676 // 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, | 816 bool GetPDFPageSizeByIndex(const void* pdf_buffer, |
| 799 int pdf_buffer_size, | 817 int pdf_buffer_size, |
| 800 int page_number, | 818 int page_number, |
| 801 double* width, | 819 double* width, |
| 802 double* height) override; | 820 double* height) override; |
| 803 }; | 821 }; |
| 804 | 822 |
| 805 } // namespace chrome_pdf | 823 } // namespace chrome_pdf |
| 806 | 824 |
| 807 #endif // PDF_PDFIUM_PDFIUM_ENGINE_H_ | 825 #endif // PDF_PDFIUM_PDFIUM_ENGINE_H_ |
| OLD | NEW |