Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: pdf/pdfium/pdfium_page.h

Issue 2924343005: Add functionality for copying text within form text fields and form combobox text fields (Closed)
Patch Set: Add FormTypeToArea helper, style changes Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 uint32_t* out_len, 44 uint32_t* out_len,
45 double* out_font_size, 45 double* out_font_size,
46 pp::FloatRect* out_bounds); 46 pp::FloatRect* out_bounds);
47 // Get a unicode character from the page. 47 // Get a unicode character from the page.
48 uint32_t GetCharUnicode(int char_index); 48 uint32_t GetCharUnicode(int char_index);
49 // Get the bounds of a character in page pixels. 49 // Get the bounds of a character in page pixels.
50 pp::FloatRect GetCharBounds(int char_index); 50 pp::FloatRect GetCharBounds(int char_index);
51 51
52 enum Area { 52 enum Area {
53 NONSELECTABLE_AREA, 53 NONSELECTABLE_AREA,
54 TEXT_AREA, 54 TEXT_AREA, // Area contains regular, selectable text not
55 WEBLINK_AREA, // Area is a hyperlink. 55 // within form fields.
56 DOCLINK_AREA, // Area is a link to a different part of the same document. 56 WEBLINK_AREA, // Area is a hyperlink.
57 DOCLINK_AREA, // Area is a link to a different part of the same
58 // document.
59 FORM_TEXT_AREA, // Area is a form text field or form combobox text
60 // field.
57 }; 61 };
58 62
59 struct LinkTarget { 63 struct LinkTarget {
60 // We are using std::string here which have a copy contructor. 64 // We are using std::string here which have a copy contructor.
61 // That prevents us from using union here. 65 // That prevents us from using union here.
62 std::string url; // Valid for WEBLINK_AREA only. 66 std::string url; // Valid for WEBLINK_AREA only.
63 int page; // Valid for DOCLINK_AREA only. 67 int page; // Valid for DOCLINK_AREA only.
64 }; 68 };
65 69
66 // Given a point in the document that's in this page, returns its character 70 // Given a point in the document that's in this page, returns its character
67 // index if it's near a character, and also the type of text. 71 // index if it's near a character, and also the type of text.
68 // Target is optional. It will be filled in for WEBLINK_AREA or 72 // Target is optional. It will be filled in for WEBLINK_AREA or
69 // DOCLINK_AREA only. 73 // DOCLINK_AREA only.
70 Area GetCharIndex(const pp::Point& point, 74 Area GetCharIndex(const pp::Point& point,
71 int rotation, 75 int rotation,
72 int* char_index, 76 int* char_index,
73 int* form_type, 77 int* form_type,
74 LinkTarget* target); 78 LinkTarget* target);
75 79
80 // Converts a form type to its corresponding Area.
81 Area FormTypeToArea(int form_type);
Lei Zhang 2017/06/21 00:19:46 Let's make this a static method, since its impleme
drgage 2017/06/21 01:30:24 Done.
82
76 // Gets the character at the given index. 83 // Gets the character at the given index.
77 base::char16 GetCharAtIndex(int index); 84 base::char16 GetCharAtIndex(int index);
78 85
79 // Gets the number of characters in the page. 86 // Gets the number of characters in the page.
80 int GetCharCount(); 87 int GetCharCount();
81 88
82 // Converts from page coordinates to screen coordinates. 89 // Converts from page coordinates to screen coordinates.
83 pp::Rect PageToScreen(const pp::Point& offset, 90 pp::Rect PageToScreen(const pp::Point& offset,
84 double zoom, 91 double zoom,
85 double left, 92 double left,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 int loading_count_; 146 int loading_count_;
140 pp::Rect rect_; 147 pp::Rect rect_;
141 bool calculated_links_; 148 bool calculated_links_;
142 std::vector<Link> links_; 149 std::vector<Link> links_;
143 bool available_; 150 bool available_;
144 }; 151 };
145 152
146 } // namespace chrome_pdf 153 } // namespace chrome_pdf
147 154
148 #endif // PDF_PDFIUM_PDFIUM_PAGE_H_ 155 #endif // PDF_PDFIUM_PDFIUM_PAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698