summaryrefslogtreecommitdiff
path: root/xfa_test/pdf/pdfium/pdfium_range.h
diff options
context:
space:
mode:
authorBo Xu <bo_xu@foxitsoftware.com>2014-10-28 23:03:33 -0700
committerBo Xu <bo_xu@foxitsoftware.com>2014-11-03 11:10:11 -0800
commitfdc00a7042d912aafaabddae4d9c84199921ef23 (patch)
tree32ab8ac91cc68d2cd15b9168782a71b3f3f5e7b9 /xfa_test/pdf/pdfium/pdfium_range.h
parente9b38fa38de2c95d8260be31c57d9272c4d127ed (diff)
downloadpdfium-fdc00a7042d912aafaabddae4d9c84199921ef23.tar.xz
Merge XFA to PDFium master at 4dc95e7 on 10/28/2014
Diffstat (limited to 'xfa_test/pdf/pdfium/pdfium_range.h')
-rw-r--r--xfa_test/pdf/pdfium/pdfium_range.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/xfa_test/pdf/pdfium/pdfium_range.h b/xfa_test/pdf/pdfium/pdfium_range.h
new file mode 100644
index 0000000000..ed8daf65bb
--- /dev/null
+++ b/xfa_test/pdf/pdfium/pdfium_range.h
@@ -0,0 +1,54 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PDF_PDFIUM_PDFIUM_RANGE_H_
+#define PDF_PDFIUM_PDFIUM_RANGE_H_
+
+#include <string>
+#include <vector>
+
+#include "base/strings/string16.h"
+#include "pdf/pdfium/pdfium_page.h"
+#include "ppapi/cpp/rect.h"
+
+namespace chrome_pdf {
+
+// Describes location of a string of characters.
+class PDFiumRange {
+ public:
+ PDFiumRange(PDFiumPage* page, int char_index, int char_count);
+ ~PDFiumRange();
+
+ // Update how many characters are in the selection. Could be negative if
+ // backwards.
+ void SetCharCount(int char_count);
+
+ int page_index() const { return page_->index(); }
+ int char_index() const { return char_index_; }
+ int char_count() const { return char_count_; }
+
+ // Gets bounding rectangles of range in screen coordinates.
+ std::vector<pp::Rect> GetScreenRects(const pp::Point& offset,
+ double zoom,
+ int rotation);
+
+ // Gets the string of characters in this range.
+ base::string16 GetText();
+
+ private:
+ PDFiumPage* page_;
+ // Index of first character.
+ int char_index_;
+ // How many characters are part of this range (negative if backwards).
+ int char_count_;
+
+ // Cache of ScreenRect, and the associated variables used when caching it.
+ std::vector<pp::Rect> cached_screen_rects_;
+ pp::Point cached_screen_rects_offset_;
+ double cached_screen_rects_zoom_;
+};
+
+} // namespace chrome_pdf
+
+#endif // PDF_PDFIUM_PDFIUM_RANGE_H_