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 #include "addon/xfa/fs_xfa.h"
22 
28 namespace foxit {
32 namespace pdf {
38 {
39  public:
46  virtual bool NeedToCancelNow() = 0;
47 };
48 
64 class TextPage FS_FINAL : public Base {
65  public:
71  typedef enum _TextParseFlags {
79 
80 
88  explicit TextPage(const PDFPage& page, int flags = foxit::pdf::TextPage::e_ParseTextNormal);
89 
91  ~TextPage();
97  TextPage(const TextPage& other);
105  TextPage& operator = (const TextPage& other);
106 
114  bool operator == (const TextPage& other) const;
122  bool operator != (const TextPage& other) const;
123 
131  bool IsEmpty() const;
132 
138  int GetCharCount() const;
139 
154  WString GetChars(int start = 0, int count = -1) const;
155 
168  int GetIndexAtPos(float x, float y, float tolerance) const;
169 
177  WString GetTextInRect(const RectF& rect) const;
178 
193  common::Range GetWordAtPos(float x, float y, float tolerance) const;
194 
206  int GetTextRectCount(int start = 0, int count = -1);
207 
217  RectF GetTextRect(int rect_index) const;
218 
229  common::Rotation GetBaselineRotation(int rect_index);
230 
239 
240  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
241  explicit TextPage(FS_HANDLE handle = NULL);
242 };
243 
256 class TextSearch FS_FINAL : public Base {
257  public:
263  typedef enum _SearchFlags {
274  } SearchFlags;
275 
276 
289  explicit TextSearch(const PDFDoc& document, SearchCancelCallback* cancel = NULL);
290 
301  explicit TextSearch(const foxit::addon::xfa::XFADoc& xfa_document, foxit::pdf::SearchCancelCallback* cancel = NULL);
302 
308  explicit TextSearch(const foxit::pdf::TextPage& text_page);
309 
318  explicit TextSearch(const foxit::pdf::annots::Annot& annot);
319 
321  ~TextSearch();
327  TextSearch(const TextSearch& other);
335  TextSearch& operator = (const TextSearch& other);
336 
344  bool operator == (const TextSearch& other) const;
352  bool operator != (const TextSearch& other) const;
353 
361  bool IsEmpty() const;
362 
370  bool SetPattern(const wchar_t* key_words);
371 
386  bool SetStartPage(int page_index);
387 
402  bool SetEndPage(int page_index);
403 
415  bool SetSearchFlags(uint32 search_flags);
416 
423  bool FindNext();
424 
431  bool FindPrev();
432 
438  RectFArray GetMatchRects() const;
439 
448  int GetMatchPageIndex() const;
449 
456 
467 
474  int GetMatchStartCharIndex() const;
475 
482  int GetMatchEndCharIndex() const;
483 
484  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
485  explicit TextSearch(FS_HANDLE handle = NULL);
486 };
487 
496 class TextLink FS_FINAL : public Base{
497  public:
499  ~TextLink();
505  TextLink(const TextLink& other);
513  TextLink& operator = (const TextLink& other);
514 
522  bool operator == (const TextLink& other) const;
530  bool operator != (const TextLink& other) const;
531 
539  bool IsEmpty() const;
540 
549  WString GetURI();
550 
556  int GetStartCharIndex();
557 
563  int GetEndCharIndex();
564 
571  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
572  explicit TextLink(FS_HANDLE handle = NULL);
573 
574 };
575 
580 class PageTextLinks FS_FINAL : public Base{
581  public:
587  explicit PageTextLinks(const TextPage& page);
593  PageTextLinks(const PageTextLinks& other);
601  PageTextLinks& operator = (const PageTextLinks& other);
609  bool operator == (const PageTextLinks& other) const ;
617  bool operator != (const PageTextLinks& other) const ;
618 
626  bool IsEmpty() const;
628  ~PageTextLinks();
629 
635  int GetTextLinkCount();
636 
645  TextLink GetTextLink(int index);
646 
647  // User is strongly recommended NOT to use this method; otherwise unknown situation may occur.
648  explicit PageTextLinks(FS_HANDLE handle = NULL);
649 };
650 } // namespace pdf
651 } // namespace foxit
652 #endif // FS_SEARCH_H_
653 
int GetMatchStartCharIndex() const
Get the index of the first character of current match pattern, based on current match page.
bool IsEmpty() const
Check whether current object is empty or not.
If set, match the case of keyword when searching.
Definition: fs_search.h:267
Definition: fs_common.h:1026
Definition: fs_search.h:256
bool FindPrev()
Search for previous matched pattern.
bool SetPattern(const wchar_t *key_words)
Set keywords to search.
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...
~TextSearch()
Destructor.
bool SetStartPage(int page_index)
Set starting page index.
WIDE STRING CLASS.
Definition: fx_string.h:1463
int GetMatchEndCharIndex() const
Get the index of the last character of current match pattern, based on current match page.
Definition: fs_pdfdoc.h:338
If set, match the whole word of keyword when searching.
Definition: fs_search.h:269
bool operator==(const TextSearch &other) const
Equal operator.
TextParseFlags
Enumeration for parsing flags used for text page.
Definition: fs_search.h:71
If set, match the key word consecutively when searching. For example, "CC" will be matched twice in "...
Definition: fs_search.h:273
~TextPage()
Destructor.
int GetTextRectCount(int start=0, int count=-1)
Count the text rectangles within a range specified by a start index and count.
Definition: fs_xfa.h:821
RectF GetTextRect(int rect_index) const
Get the text rectangle by the index.
bool operator==(const TextPage &other) const
Equal operator.
TextSearch & operator=(const TextSearch &other)
Assign operator.
Header file for annotation related definitions and classes.
virtual bool NeedToCancelNow()=0
A callback function used to check whether to cancel the searching process or not.
int GetCharCount() const
Get the count of all the characters.
Definition: fx_basic.h:1246
bool operator!=(const TextPage &other) const
Not equal operator.
FX_UINT32 uint32
32-bit unsigned integer.
Definition: fs_basictypes.h:195
Definition: fs_pdfpage.h:306
void * FS_HANDLE
Handle type.
Definition: fs_basictypes.h:213
Header file for common definitions and classes.
int GetMatchPageIndex() const
Get the page index, to which current match belongs.
TextSearch(const PDFDoc &document, SearchCancelCallback *cancel=0)
Constructor, for a PDF document.
No special parsing options for text page.
Definition: fs_search.h:73
WString GetTextInRect(const RectF &rect) const
Get the text within a rectangle, in PDF coordinate system.
bool IsEmpty() const
Check whether current object is empty or not.
Definition: fs_basictypes.h:333
Header file for XFA related definitions and functions.
Header file for PDF page related definitions and classes.
bool FindNext()
Search for next matched pattern.
Definition: fs_annot.h:756
common::Rotation GetBaselineRotation(int rect_index)
Get the text trend (as rotation) of a specified rectangle.
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.
TextPage & operator=(const TextPage &other)
Assign operator.
Rotation
Enumeration for rotation.
Definition: fs_common.h:219
Foxit namespace.
Definition: fs_connectedpdf.h:26
int GetMatchSentenceStartIndex()
Get the index of the first character of current match pattern, based on the match sentence.
WString GetChars(int start=0, int count=-1) const
Get all the characters within a range specified by a start index and count.
#define NULL
The null-pointer value.
Definition: fx_system.h:767
No special searching options.
Definition: fs_search.h:265
WString GetMatchSentence()
Get the sentence that contains current match pattern.
Parse the text content of a PDF page by the stream order.
Definition: fs_search.h:77
SearchFlags
Enumeration for searching flags.
Definition: fs_search.h:263
TextPage(const PDFPage &page, int flags=foxit::pdf::TextPage::e_ParseTextNormal)
Constructor, from a parsed PDF page.
Definition: fs_search.h:64
Definition: fs_search.h:37
bool SetEndPage(int page_index)
Set ending page index.
bool operator!=(const TextSearch &other) const
Not equal operator.
bool SetSearchFlags(uint32 search_flags)
Set search flags.
Definition: fx_coordinates.h:627
RectFArray GetTextRectArrayByRect(const RectF rect)
Get the array of all text rectangles within the specified rectangle region.
RectFArray GetMatchRects() const
Get the rectangles of current match pattern.
Parse the text content of a PDF page with outputting the hyphen on a line feed.
Definition: fs_search.h:75

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