Loading...
Searching...
No Matches
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
PDFDoc.h
TextRange.h
UString.h
pdftron::PDF::Highlights::GetCurrentTextRange
TextRange GetCurrentTextRange() const
pdftron::PDF::Highlights::operator=
Highlights & operator=(const Highlights &hlts)
pdftron::PDF::Highlights::Highlights
Highlights(TRN_Highlights impl)
Definition Highlights.h:191
pdftron::PDF::Highlights::~Highlights
~Highlights()
pdftron::PDF::Highlights::Highlights
Highlights()
pdftron::PDF::Highlights::Save
void Save(const UString &file_name)
pdftron::PDF::Highlights::Add
void Add(const Highlights &hlts)
pdftron::PDF::Highlights::PDFView
friend class PDFView
Definition Highlights.h:72
pdftron::PDF::Highlights::Highlight
pdftron::PDF::Highlight Highlight
Definition Highlights.h:77
pdftron::PDF::Highlights::PDFViewCtrl
friend class PDFViewCtrl
Definition Highlights.h:73
pdftron::PDF::Highlights::Load
void Load(const UString &file_name)
pdftron::PDF::Highlights::Begin
void Begin(PDFDoc &doc)
pdftron::PDF::Highlights::GetHandleInternal
ptrdiff_t GetHandleInternal()
pdftron::PDF::Highlights::Clear
void Clear()
pdftron::PDF::Highlights::GetCurrentQuads
std::vector< QuadPoint > GetCurrentQuads() const
pdftron::PDF::Highlights::GetCurrentQuads
int GetCurrentQuads(const double *&quads) const
pdftron::PDF::Highlights::GetCurrentPageNumber
int GetCurrentPageNumber() const
pdftron::PDF::Highlights::Next
void Next()
pdftron::PDF::Highlights::Destroy
void Destroy()
pdftron::PDF::Highlights::HasNext
bool HasNext() const
pdftron::PDF::Highlights::CreateInternal
static Highlights * CreateInternal(ptrdiff_t impl)
pdftron::PDF::Highlights::mp_highlights
TRN_Highlights mp_highlights
Definition Highlights.h:189
pdftron::PDF::Highlights::Highlights
Highlights(const Highlights &hlts)
pdftron::PDF::Highlights::TextSearch
friend class TextSearch
Definition Highlights.h:74
pdftron::PDF::Highlights::SaveToString
UString SaveToString()
pdftron::PDF::PDFDoc
Definition PDFDoc.h:72
pdftron::PDF::TextRange
Definition TextRange.h:29
pdftron::UString
Definition UString.h:28
pdftron::PDF
Definition Action.h:15
pdftron
Definition BasicTypes.h:10
pdftron::PDF::Highlight
Definition Highlights.h:17
pdftron::PDF::Highlight::Highlight
Highlight()
Definition Highlights.h:18
pdftron::PDF::Highlight::position
int position
Definition Highlights.h:32
pdftron::PDF::Highlight::Highlight
Highlight(const Highlight &hlt)
Definition Highlights.h:28
pdftron::PDF::Highlight::length
int length
Definition Highlights.h:33
pdftron::PDF::Highlight::page_num
int page_num
Definition Highlights.h:31
pdftron::PDF::Highlight::Highlight
Highlight(int pg, int pos, int len)
Definition Highlights.h:25