My Project
fs_search.h
Go to the documentation of this file.
1 
15 #ifndef FS_SEARCH_H_
16 #define FS_SEARCH_H_
17 
18 #include "common/fs_common.h"
19 #include "pdf/annots/fs_annot.h"
20 #include "pdf/fs_pdfpage.h"
21 #ifndef _FX_NO_XFA_
22 #include "addon/xfa/fs_xfa.h"
23 #endif
24 
30 namespace foxit {
34 namespace pdf {
40 {
41  public:
48  virtual bool NeedToCancelNow() = 0;
49 };
50 
66 class TextPage FS_FINAL : public Base {
67  public:
73  typedef enum _TextParseFlags {
81 
82 
90  explicit TextPage(const PDFPage& page, int flags = foxit::pdf::TextPage::e_ParseTextNormal);
91 
93  ~TextPage();
99  TextPage(const TextPage& other);
107  TextPage& operator = (const TextPage& other);
108 
116  bool operator == (const TextPage& other) const;
124  bool operator != (const TextPage& other) const;
125 
133  bool IsEmpty() const;
134 
140  int GetCharCount() const;
141 
156  WString GetChars(int start = 0, int count = -1) const;
157 
170  int GetIndexAtPos(float x, float y, float tolerance) const;
171 
179  WString GetTextInRect(const RectF& rect) const;
180 
195  common::Range GetWordAtPos(float x, float y, float tolerance) const;
196 
208  int GetTextRectCount(int start = 0, int count = -1);
209 
219  RectF GetTextRect(int rect_index) const;
220 
231  common::Rotation GetBaselineRotation(int rect_index);
232 
241 
242  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
243  explicit TextPage(FS_HANDLE handle = NULL);
244 };
245 
258 class TextSearch FS_FINAL : public Base {
259  public:
265  typedef enum _SearchFlags {
274  } SearchFlags;
275 
276 
289  explicit TextSearch(const PDFDoc& document, SearchCancelCallback* cancel = NULL);
290 
291  #ifndef _FX_NO_XFA_
292 
303  explicit TextSearch(const foxit::addon::xfa::XFADoc& xfa_document, foxit::pdf::SearchCancelCallback* cancel = NULL);
304 #endif
305 
310  explicit TextSearch(const foxit::pdf::TextPage& text_page);
311 
320  explicit TextSearch(const foxit::pdf::annots::Annot& annot);
321 
323  ~TextSearch();
329  TextSearch(const TextSearch& other);
337  TextSearch& operator = (const TextSearch& other);
338 
346  bool operator == (const TextSearch& other) const;
354  bool operator != (const TextSearch& other) const;
355 
363  bool IsEmpty() const;
364 
372  bool SetPattern(const wchar_t* key_words);
373 
388  bool SetStartPage(int page_index);
389 
404  bool SetEndPage(int page_index);
405 
417  bool SetSearchFlags(uint32 search_flags);
418 
425  bool FindNext();
426 
433  bool FindPrev();
434 
440  RectFArray GetMatchRects() const;
441 
450  int GetMatchPageIndex() const;
451 
458 
469 
476  int GetMatchStartCharIndex() const;
477 
484  int GetMatchEndCharIndex() const;
485 
486  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
487  explicit TextSearch(FS_HANDLE handle = NULL);
488 };
489 
498 class TextLink FS_FINAL : public Base{
499  public:
501  ~TextLink();
507  TextLink(const TextLink& other);
515  TextLink& operator = (const TextLink& other);
516 
524  bool operator == (const TextLink& other) const;
532  bool operator != (const TextLink& other) const;
533 
541  bool IsEmpty() const;
542 
551  WString GetURI();
552 
558  int GetStartCharIndex();
559 
565  int GetEndCharIndex();
566 
573  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
574  explicit TextLink(FS_HANDLE handle = NULL);
575 
576 };
577 
582 class PageTextLinks FS_FINAL : public Base{
583  public:
589  explicit PageTextLinks(const TextPage& page);
595  PageTextLinks(const PageTextLinks& other);
603  PageTextLinks& operator = (const PageTextLinks& other);
611  bool operator == (const PageTextLinks& other) const ;
619  bool operator != (const PageTextLinks& other) const ;
620 
628  bool IsEmpty() const;
630  ~PageTextLinks();
631 
637  int GetTextLinkCount();
638 
647  TextLink GetTextLink(int index);
648 
649  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
650  explicit PageTextLinks(FS_HANDLE handle = NULL);
651 };
652 } // namespace pdf
653 } // namespace foxit
654 #endif // FS_SEARCH_H_
655 
TextParseFlags
Enumeration for parsing flags used for text page.
Definition: fs_search.h:73
If set, match the case of keyword when searching.
Definition: fs_search.h:269
bool IsEmpty() const
Check whether current object is empty or not.
void * FS_HANDLE
Handle type.
Definition: fs_basictypes.h:216
Parse the text content of a PDF page with outputting the hyphen on a line feed.
Definition: fs_search.h:77
Definition: fs_annot.h:749
int GetCharCount() const
Get the count of all the characters.
bool SetEndPage(int page_index)
Set ending page index.
int GetMatchStartCharIndex() const
Get the index of the first character of current match pattern, based on current match page.
TextPage & operator=(const TextPage &other)
Assign operator.
virtual bool NeedToCancelNow()=0
A callback function used to check whether to cancel the searching process or not.
RectF GetTextRect(int rect_index) const
Get the text rectangle by the index.
Definition: fs_search.h:66
common::Range GetWordAtPos(float x, float y, float tolerance) const
Get the character range of a word at or around a specified position on the page, in PDF coordinate sy...
Header file for common definitions and classes.
RectFArray GetMatchRects() const
Get the rectangles of current match pattern.
Definition: fx_basic.h:1287
bool operator !=(const TextSearch &other) const
Not equal operator.
common::Rotation GetBaselineRotation(int rect_index)
Get the text trend (as rotation) of a specified rectangle.
int GetMatchEndCharIndex() const
Get the index of the last character of current match pattern, based on current match page.
bool operator==(const TextSearch &other) const
Equal operator.
Parse the text content of a PDF page by the stream order.
Definition: fs_search.h:79
bool FindPrev()
Search for previous matched pattern.
RectFArray GetTextRectArrayByRect(const RectF rect)
Get the array of all text rectangles within the specified rectangle region.
Header file for XFA related definitions and functions.
WString GetChars(int start=0, int count=-1) const
Get all the characters within a range specified by a start index and count.
bool SetPattern(const wchar_t *key_words)
Set keywords to search.
int GetMatchPageIndex() const
Get the page index, to which current match belongs.
TextSearch(const PDFDoc &document, SearchCancelCallback *cancel=0)
Constructor, for a PDF document.
bool SetStartPage(int page_index)
Set starting page index.
int GetIndexAtPos(float x, float y, float tolerance) const
Get the character index at or around a specified position on the page, in PDF coordinate system.
Rotation
Enumeration for rotation.
Definition: fs_common.h:221
If set, match the whole word of keyword when searching.
Definition: fs_search.h:271
If set, match the key word consecutively when searching. For example, "CC" will be matched twice in "...
Definition: fs_search.h:273
Header file for PDF page related definitions and classes.
Foxit namespace.
Definition: fs_connectedpdf.h:26
No special parsing options for text page.
Definition: fs_search.h:75
TextPage(const PDFPage &page, int flags=foxit::pdf::TextPage::e_ParseTextNormal)
Constructor, from a parsed PDF page.
Definition: fs_xfa.h:819
TextSearch & operator=(const TextSearch &other)
Assign operator.
WString GetTextInRect(const RectF &rect) const
Get the text within a rectangle, in PDF coordinate system.
bool FindNext()
Search for next matched pattern.
bool IsEmpty() const
Check whether current object is empty or not.
#define NULL
The null-pointer value.
Definition: fx_system.h:773
No special searching options.
Definition: fs_search.h:267
Definition: fx_coordinates.h:763
SearchFlags
Enumeration for searching flags.
Definition: fs_search.h:265
Definition: fs_search.h:258
Definition: fs_pdfdoc.h:338
Definition: fs_pdfpage.h:307
Definition: fs_search.h:39
bool SetSearchFlags(uint32 search_flags)
Set search flags.
~TextPage()
Destructor.
bool operator !=(const TextPage &other) const
Not equal operator.
Header file for annotation related definitions and classes.
WIDE STRING CLASS.
Definition: fx_string.h:1470
WString GetMatchSentence()
Get the sentence that contains current match pattern.
Definition: fs_common.h:1033
int GetTextRectCount(int start=0, int count=-1)
Count the text rectangles within a range specified by a start index and count.
FX_UINT32 uint32
32-bit unsigned integer.
Definition: fs_basictypes.h:198
int GetMatchSentenceStartIndex()
Get the index of the first character of current match pattern, based on the match sentence.
~TextSearch()
Destructor.
Definition: fs_basictypes.h:342
bool operator==(const TextPage &other) const
Equal operator.

Foxit Software Corporation Logo
@2019 Foxit Software Incorporated. All rights reserved.