Foxit PDF SDK

fs_ofdtextpage.h
1 #ifndef FS_OFD_TEXTPAGE_H_
2 #define FS_OFD_TEXTPAGE_H_
3
4 #include "common/fs_common.h"
5
11 namespace foxit {
15 namespace ofd {
16 class OFDPage;
17
19 class TextPageCharInfo FS_FINAL : public Object {
20 public:
28 explicit TextPageCharInfo(const foxit::RectF& rect, foxit::uint32 char_code, foxit::uint32 text_object_id) :
29 rect(rect),
30 char_code(char_code),
31 text_object_id(text_object_id) {}
32
38 TextPageCharInfo(const TextPageCharInfo& other) {
39 this->rect = other.rect;
40 this->char_code = other.char_code;
41 this->text_object_id = other.text_object_id;
42 }
43
51 TextPageCharInfo& operator = (const TextPageCharInfo& other) {
52 this->rect = other.rect;
53 this->char_code = other.char_code;
54 this->text_object_id = other.text_object_id;
55 return *this;
56 }
57
67 void Set(const foxit::RectF& rect, foxit::uint32 char_code, foxit::uint32 text_object_id) {
68 this->rect = rect;
69 this->char_code = char_code;
70 this->text_object_id = text_object_id;
71 }
72
76 foxit::RectF rect;
77
81 foxit::uint32 char_code;
82
86 foxit::uint32 text_object_id;
87 };
88
90 class TextPage FS_FINAL : public Base {
91 public:
97 explicit TextPage(OFDPage page);
98
100 ~TextPage();
101
107 TextPage(const TextPage& other);
108
116 TextPage& operator = (const TextPage& other);
117
125 bool operator == (const TextPage& other) const;
126
134 bool operator != (const TextPage& other) const;
135
143 bool IsEmpty() const;
144
150 int GetCharInfoCount();
151
160 TextPageCharInfo GetCharInfo(int index);
161
171 int GetCharIndexAtPos(float x_pos, float y_pos, float tolerance);
172
183 String GetText(int start_index, int count);
184
192 bool ExportToFile(const String& file_path);
193
201 bool ExportToFile(const WString& file_path);
202
210 bool ExportToFile(foxit::common::file::WriterCallback* file_writer);
211
212 explicit TextPage(FS_HANDLE handle);
213 };
214
216 class TextPageSelect FS_FINAL : public Base {
217 public:
223 typedef enum _TextSelectMode {
225 e_ModeRectBox = 0,
227 e_ModeParagraph = 1
228 } TextSelectMode;
229
230
236 explicit TextPageSelect(OFDPage page);
237
239 ~TextPageSelect();
240
246 TextPageSelect(const TextPageSelect& other);
247
255 TextPageSelect& operator = (const TextPageSelect& other);
256
264 bool operator == (const TextPageSelect& other) const;
265
273 bool operator != (const TextPageSelect& other) const;
274
282 bool IsEmpty() const;
283
289 int GetTextIDCount();
290
299 int GetTextID(int index);
300
306 String GetText();
307
313 int GetRectCount();
314
323 foxit::RectF GetRect(int index);
324
333 void SetMode(TextSelectMode mode);
334
343 void SetRange(foxit::PointF start_point, foxit::PointF end_point);
344
345 explicit TextPageSelect(FS_HANDLE handle);
346 };
347
348 } // namespace ofd
349 } // namespace foxit
350
351 #endif // FS_OFD_TEXTPAGE_H_
foxit::ofd::TextPageSelect::operator !=
bool operator !=(const TextPageSelect &other) const
不相等操作符。
foxit::ofd::TextPageSelect::GetTextIDCount
int GetTextIDCount()
获取文本ID数量。
IFX_FileWrite
文件写入接口。
Definition: fx_stream.h:470
foxit::ofd::TextPageSelect::e_ModeRectBox
模式类型：矩形选择。
Definition: fs_ofdtextpage.h:225
foxit::Object
CFX_Object Object
对象类型。
Definition: fs_basictypes.h:220
foxit::ofd::TextPageCharInfo
Definition: fs_ofdtextpage.h:19
foxit::ofd::TextPageSelect::GetRect
foxit::RectF GetRect(int index)
获取指定索引的矩形。
foxit::ofd::TextPage::operator !=
bool operator !=(const TextPage &other) const
不相等操作符。
foxit::ofd::TextPage::GetCharInfo
TextPageCharInfo GetCharInfo(int index)
获取指定索引的字符信息。
CFX_PSVTemplate
Definition: fx_coordinates.h:30
foxit::ofd::TextPage::ExportToFile
bool ExportToFile(const String &file_path)
将文本内容导出到文件中。
foxit::ofd::TextPage::operator=
TextPage & operator=(const TextPage &other)
赋值操作符。
CFX_WideString
宽字符串类
Definition: fx_string.h:1457
foxit::ofd::TextPage::~TextPage
~TextPage()
析构函数。
foxit::ofd::TextPage::GetCharIndexAtPos
int GetCharIndexAtPos(float x_pos, float y_pos, float tolerance)
获取指定位置的字符索引。
foxit::ofd::TextPage::operator==
bool operator==(const TextPage &other) const
相等操作符。
foxit::ofd::TextPageSelect::IsEmpty
bool IsEmpty() const
检查当前对象是否为空。
foxit::ofd::TextPageSelect::operator=
TextPageSelect & operator=(const TextPageSelect &other)
赋值操作符。
foxit::ofd::TextPageSelect::GetText
String GetText()
获取文本内容。
foxit::ofd::TextPage::TextPage
TextPage(OFDPage page)
带参数的构造函数。
foxit::ofd::TextPageSelect::GetRectCount
int GetRectCount()
获取矩形数量。
foxit::ofd::TextPageSelect
Definition: fs_ofdtextpage.h:216
foxit::ofd::TextPageCharInfo::operator=
TextPageCharInfo & operator=(const TextPageCharInfo &other)
赋值操作符。
Definition: fs_ofdtextpage.h:51
foxit::uint32
FX_UINT32 uint32
无符号 32 位整数。
Definition: fs_basictypes.h:195
foxit::FS_HANDLE
void * FS_HANDLE
句柄类型。
Definition: fs_basictypes.h:213
fs_common.h
通用定义和类的头文件。
foxit::ofd::TextPage
Definition: fs_ofdtextpage.h:90
foxit::ofd::TextPage::GetCharInfoCount
int GetCharInfoCount()
获取字符信息数量。
foxit::Base
Definition: fs_basictypes.h:465
foxit::ofd::TextPage::GetText
String GetText(int start_index, int count)
获取文本内容。
foxit::ofd::TextPageCharInfo::rect
foxit::RectF rect
字符的边界矩形。
Definition: fs_ofdtextpage.h:76
foxit::ofd::TextPageCharInfo::text_object_id
foxit::uint32 text_object_id
字符所属的文本对象ID。
Definition: fs_ofdtextpage.h:86
foxit::ofd::TextPageSelect::SetRange
void SetRange(foxit::PointF start_point, foxit::PointF end_point)
设置选择范围。
foxit::ofd::TextPageSelect::SetMode
void SetMode(TextSelectMode mode)
设置选择模式。
foxit::ofd::TextPageSelect::TextSelectMode
TextSelectMode
OFD文本选择模式定义枚举类型。
Definition: fs_ofdtextpage.h:223
foxit::ofd::TextPageCharInfo::char_code
foxit::uint32 char_code
字符的Unicode编码。
Definition: fs_ofdtextpage.h:81
foxit
Foxit命名空间。
Definition: fs_taggedpdf.h:27
foxit::ofd::TextPageSelect::GetTextID
int GetTextID(int index)
获取指定索引的文本ID。
CFX_ByteString
字节字符串类
Definition: fx_string.h:317
foxit::ofd::OFDPage
Definition: fs_ofdpage.h:27
foxit::ofd::TextPageSelect::~TextPageSelect
~TextPageSelect()
析构函数。
foxit::ofd::TextPageSelect::TextPageSelect
TextPageSelect(OFDPage page)
带参数的构造函数。
foxit::ofd::TextPageCharInfo::TextPageCharInfo
TextPageCharInfo(const foxit::RectF &rect, foxit::uint32 char_code, foxit::uint32 text_object_id)
带参数的构造函数。
Definition: fs_ofdtextpage.h:28
foxit::ofd::TextPage::IsEmpty
bool IsEmpty() const
检查当前对象是否为空。
foxit::ofd::TextPageCharInfo::Set
void Set(const foxit::RectF &rect, foxit::uint32 char_code, foxit::uint32 text_object_id)
设置值。
Definition: fs_ofdtextpage.h:67
foxit::ofd::TextPageSelect::operator==
bool operator==(const TextPageSelect &other) const
相等操作符。
foxit::ofd::TextPageCharInfo::TextPageCharInfo
TextPageCharInfo(const TextPageCharInfo &other)
构造函数，通过另一个OFD文本页面字符信息对象。
Definition: fs_ofdtextpage.h:38
foxit::ofd::TextPageSelect::e_ModeParagraph
模式类型：段落选择。
Definition: fs_ofdtextpage.h:227
CFX_FloatRect
Definition: fx_coordinates.h:771