Add hook to generate ios/build/util/CANARY_VERSION on iOS.
[chromium-blink-merge.git] / pdf / pdfium / pdfium_range.h
blobed8daf65bbfd8fbaf7cf74d46577fce24c15a216
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
3 // found in the LICENSE file.
5 #ifndef PDF_PDFIUM_PDFIUM_RANGE_H_
6 #define PDF_PDFIUM_PDFIUM_RANGE_H_
8 #include <string>
9 #include <vector>
11 #include "base/strings/string16.h"
12 #include "pdf/pdfium/pdfium_page.h"
13 #include "ppapi/cpp/rect.h"
15 namespace chrome_pdf {
17 // Describes location of a string of characters.
18 class PDFiumRange {
19 public:
20 PDFiumRange(PDFiumPage* page, int char_index, int char_count);
21 ~PDFiumRange();
23 // Update how many characters are in the selection. Could be negative if
24 // backwards.
25 void SetCharCount(int char_count);
27 int page_index() const { return page_->index(); }
28 int char_index() const { return char_index_; }
29 int char_count() const { return char_count_; }
31 // Gets bounding rectangles of range in screen coordinates.
32 std::vector<pp::Rect> GetScreenRects(const pp::Point& offset,
33 double zoom,
34 int rotation);
36 // Gets the string of characters in this range.
37 base::string16 GetText();
39 private:
40 PDFiumPage* page_;
41 // Index of first character.
42 int char_index_;
43 // How many characters are part of this range (negative if backwards).
44 int char_count_;
46 // Cache of ScreenRect, and the associated variables used when caching it.
47 std::vector<pp::Rect> cached_screen_rects_;
48 pp::Point cached_screen_rects_offset_;
49 double cached_screen_rects_zoom_;
52 } // namespace chrome_pdf
54 #endif // PDF_PDFIUM_PDFIUM_RANGE_H_