All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Highlights.h
Go to the documentation of this file.
1 //---------------------------------------------------------------------------------------
2 // Copyright (c) 2001-2018 by PDFTron Systems Inc. All Rights Reserved.
3 // Consult legal.txt regarding legal and license information.
4 //---------------------------------------------------------------------------------------
5 #ifndef PDFTRON_H_CPPHighlights
6 #define PDFTRON_H_CPPHighlights
7 
8 #include <Common/UString.h>
9 #include <C/PDF/TRN_Highlights.h>
10 
11 namespace pdftron {
12  namespace PDF {
13 
48 class Highlights
49 {
50  friend class PDFView;
51  friend class PDFViewCtrl;
52  friend class TextSearch;
53 public:
54 
55  struct Highlight
56  {
58  {
59  page_num = 0; //invalid
60  position = 0;
61  length = 0;
62  }
63 
64  Highlight( int pg, int pos, int len ) : page_num(pg), position(pos), length(len)
65  {}
66 
68  {}
69 
70  int page_num;
71  int position;
72  int length;
73  };
74 
78  Highlights();
79  ~Highlights();
80  Highlights(const Highlights& hlts);
81 
85  Highlights& operator = ( const Highlights& hlts );
86 
93  void Load( const UString& file_name );
94 
100  void Save( const UString& file_name );
101 
107  void Add( const Highlights& hlts );
108 
112  void Clear();
113 
122  void Begin(PDFDoc& doc);
123 
127  bool HasNext() const;
128 
132  void Next();
133 
137  int GetCurrentPageNumber() const;
138 
152  std::vector<QuadPoint> GetCurrentQuads() const;
153 
154 #ifndef SWIG
155  int GetCurrentQuads(const double* &quads) const;
156 #endif
157 
161  void Destroy();
162 
163 
164  //for xamarin use only
165  static Highlights* CreateInternal(ptrdiff_t impl);
166  ptrdiff_t GetHandleInternal();
167 
168 #ifndef SWIGHIDDEN
169 
170 //private:
171  TRN_Highlights mp_highlights;
172  //for xamarin use only
173  Highlights(TRN_Highlights impl) : mp_highlights(impl) {}
174 #endif
175 };
176 
177 
178 #include <Impl/Highlights.inl>
179 
180  } // namespace PDF
181 } // namespace pdftron
182 
183 #endif // PDFTRON_H_CPPHighlights
std::vector< QuadPoint > GetCurrentQuads() const
Highlight(const Highlight &hlt)
Definition: Highlights.h:67
Highlight(int pg, int pos, int len)
Definition: Highlights.h:64
TRN_Highlights mp_highlights
Definition: Highlights.h:171
void Save(const UString &file_name)
ptrdiff_t GetHandleInternal()
static Highlights * CreateInternal(ptrdiff_t impl)
void Load(const UString &file_name)
void Add(const Highlights &hlts)
int GetCurrentPageNumber() const
void Begin(PDFDoc &doc)
Highlights(TRN_Highlights impl)
Definition: Highlights.h:173
Highlights & operator=(const Highlights &hlts)

© 2002-2014 PDFTron Systems Inc.