- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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-2025 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 {
18 Highlight()
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
28 Highlight(const Highlight& hlt) : page_num(hlt.page_num), position(hlt.position), length(hlt.length)
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
77 typedef pdftron::PDF::Highlight Highlight;
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
113 UString SaveToString();
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
174 TextRange GetCurrentTextRange() const;
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
pdftron::PDF::Highlight
Definition: Highlights.h:16
pdftron::PDF::TextSearch
Definition: TextSearch.h:173
pdftron::PDF::Highlights::GetCurrentQuads
std::vector< QuadPoint > GetCurrentQuads() const
pdftron::PDF::PDFView
Definition: PDFView.h:72
UString.h
pdftron::PDF::Highlights
Definition: Highlights.h:70
pdftron::PDF::Highlights::GetCurrentTextRange
TextRange GetCurrentTextRange() const
pdftron::PDF::Highlights::mp_highlights
TRN_Highlights mp_highlights
Definition: Highlights.h:189
pdftron::PDF::Highlights::Next
void Next()
pdftron::PDF::PDFViewCtrl
Definition: PDFViewCtrl.h:65
pdftron::PDF::Highlights::Save
void Save(const UString &file_name)
pdftron::PDF::Highlights::GetHandleInternal
ptrdiff_t GetHandleInternal()
pdftron::PDF::Highlight::Highlight
Highlight(const Highlight &hlt)
Definition: Highlights.h:28
pdftron::PDF::PDFDoc
Definition: PDFDoc.h:71
pdftron::PDF::Highlights::CreateInternal
static Highlights * CreateInternal(ptrdiff_t impl)
pdftron::PDF::Highlights::SaveToString
UString SaveToString()
pdftron::PDF::Highlights::Highlight
pdftron::PDF::Highlight Highlight
Definition: Highlights.h:77
PDFDoc.h
pdftron::PDF::Highlights::Load
void Load(const UString &file_name)
pdftron::PDF::Highlight::length
int length
Definition: Highlights.h:33
pdftron::PDF::TextRange
Definition: TextRange.h:28
pdftron::PDF::Highlights::Add
void Add(const Highlights &hlts)
pdftron::PDF::Highlights::GetCurrentPageNumber
int GetCurrentPageNumber() const
pdftron::PDF::Highlight::Highlight
Highlight(int pg, int pos, int len)
Definition: Highlights.h:25
pdftron::PDF::Highlights::Highlights
Highlights()
pdftron::PDF::Highlights::Begin
void Begin(PDFDoc &doc)
pdftron::PDF::Highlight::page_num
int page_num
Definition: Highlights.h:31
pdftron::PDF::Highlight::Highlight
Highlight()
Definition: Highlights.h:18
pdftron::PDF::Highlight::position
int position
Definition: Highlights.h:32
pdftron::PDF::Highlights::Clear
void Clear()
pdftron::PDF::Highlights::Highlights
Highlights(TRN_Highlights impl)
Definition: Highlights.h:191
pdftron::PDF::Highlights::operator=
Highlights & operator=(const Highlights &hlts)
TextRange.h
pdftron::PDF::Highlights::Destroy
void Destroy()
pdftron::PDF::Highlights::HasNext
bool HasNext() const
pdftron::PDF::Highlights::~Highlights
~Highlights()
pdftron::UString
Definition: UString.h:27