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-2023 by Apryse Software 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 <PDF/PDFDoc.h>
9 #include <Common/UString.h>
10 #include <C/PDF/TRN_Highlights.h>
11 #include <PDF/TextRange.h>
12 
13 namespace pdftron {
14  namespace PDF {
15 
16 struct Highlight
17 {
19  {
20  page_num = 0; //invalid
21  position = 0;
22  length = 0;
23  }
24 
25  Highlight(int pg, int pos, int len) : page_num(pg), position(pos), length(len)
26  {}
27 
29  {}
30 
31  int page_num;
32  int position;
33  int length;
34 };
35 
70 class Highlights
71 {
72  friend class PDFView;
73  friend class PDFViewCtrl;
74  friend class TextSearch;
75 public:
76 
81  Highlights();
82  ~Highlights();
86  Highlights(const Highlights& hlts);
87 
91  Highlights& operator = ( const Highlights& hlts );
92 
99  void Load( const UString& file_name );
100 
106  void Save( const UString& file_name );
107 
114 
120  void Add( const Highlights& hlts );
121 
125  void Clear();
126 
135  void Begin(PDFDoc& doc);
136 
140  bool HasNext() const;
141 
145  void Next();
146 
150  int GetCurrentPageNumber() const;
151 
165  std::vector<QuadPoint> GetCurrentQuads() const;
166 
167 #ifndef SWIG
168  int GetCurrentQuads(const double* &quads) const;
169 #endif
170 
175 
179  void Destroy();
180 
181 
182  //for xamarin use only
183  static Highlights* CreateInternal(ptrdiff_t impl);
184  ptrdiff_t GetHandleInternal();
185 
186 #ifndef SWIGHIDDEN
187 
188 //private:
189  TRN_Highlights mp_highlights;
190  //for xamarin use only
191  Highlights(TRN_Highlights impl) : mp_highlights(impl) {}
192 #endif
193 };
194 
195 
196 #include <Impl/Highlights.inl>
197 
198  } // namespace PDF
199 } // namespace pdftron
200 
201 #endif // PDFTRON_H_CPPHighlights
std::vector< QuadPoint > GetCurrentQuads() const
TextRange GetCurrentTextRange() const
TRN_Highlights mp_highlights
Definition: Highlights.h:189
void Save(const UString &file_name)
ptrdiff_t GetHandleInternal()
Highlight(const Highlight &hlt)
Definition: Highlights.h:28
static Highlights * CreateInternal(ptrdiff_t impl)
pdftron::PDF::Highlight Highlight
Definition: Highlights.h:77
void Load(const UString &file_name)
void Add(const Highlights &hlts)
int GetCurrentPageNumber() const
Highlight(int pg, int pos, int len)
Definition: Highlights.h:25
void Begin(PDFDoc &doc)
Highlights(TRN_Highlights impl)
Definition: Highlights.h:191
Highlights & operator=(const Highlights &hlts)