#ifndef _FS_SEARCH_C_H_
#define _FS_SEARCH_C_H_

#ifdef __cplusplus
extern "C" {
#endif



typedef enum _FSSearchFlags {
e_FSSearchFlagsSearchNormal        = 0x00,
e_FSSearchMatchCase      = 0x01,
e_FSSearchMatchWholeWord    = 0x02,
e_FSSearchConsecutive     = 0x04,
e_FSSearchNotMatchFullWidth     = 0x20,
}FSSearchFlags;


typedef struct _FSSearchCancelCallback {
  void* user_data;
  FS_BOOL (*NeedToCancelNow)(void* user_data);
}FSSearchCancelCallback;


typedef enum _FSTextParseFlags {
e_FSTextParseFlagsParseTextNormal = 0x0000,
e_FSParseTextOutputHyphen = 0x0001,
e_FSParseTextUseStreamOrder = 0x0002,
}FSTextParseFlags;



typedef enum _FSTextOrderFlag {
e_FSTextStreamOrder = 0,
e_FSTextDisplayOrder = 1,
}FSTextOrderFlag;



typedef enum _FSTextCharFlag {
e_FSTextCharFlagUnknown = -1,
e_FSTextCharFlagNormal = 0,
e_FSGenerated = 1,
e_FSUnUnicode = 2,
e_FSHyphen = 3,
e_FSComboWord = 4,
}FSTextCharFlag;


typedef struct _FSTextPageCharInfo {
  FS_FONT_HANDLE font;
  FSTextCharFlag flag;
  float font_size;
  float origin_x;
  float origin_y;
  FSRectF char_box;
  FSRectF char_outbox;
  FSMatrix matrix;
}FSTextPageCharInfo;

FSErrorCode FSDK_TextPage_Create(const FS_PDFPAGE_HANDLE page, int flags, FS_TEXTPAGE_HANDLE* textpage_return_value);
FSErrorCode FSDK_TextPage_Release(FS_TEXTPAGE_HANDLE textpage_handle);
FSErrorCode FSDK_TextPage_IsEmpty(FS_TEXTPAGE_HANDLE textpage_handle, FS_BOOL* return_value);
FSErrorCode FSDK_TextPage_GetCharCount(FS_TEXTPAGE_HANDLE textpage_handle, int* return_value);
FSErrorCode FSDK_TextPage_GetCharInfo(FS_TEXTPAGE_HANDLE textpage_handle, int char_index, FSTextPageCharInfo* return_value);
FSErrorCode FSDK_TextPage_GetChars(FS_TEXTPAGE_HANDLE textpage_handle, int start, int count, FS_WSTR* return_value);
FSErrorCode FSDK_TextPage_GetIndexAtPos(FS_TEXTPAGE_HANDLE textpage_handle, float x, float y, float tolerance, int* return_value);
FSErrorCode FSDK_TextPage_GetTextInRect(FS_TEXTPAGE_HANDLE textpage_handle, const FSRectF rect, FS_WSTR* return_value);
FSErrorCode FSDK_TextPage_GetText(FS_TEXTPAGE_HANDLE textpage_handle, FSTextOrderFlag flag, FS_WSTR* return_value);
FSErrorCode FSDK_TextPage_GetWordAtPos(FS_TEXTPAGE_HANDLE textpage_handle, float x, float y, float tolerance, FS_RANGE_HANDLE* return_value);
FSErrorCode FSDK_TextPage_GetTextRectCount(FS_TEXTPAGE_HANDLE textpage_handle, int start, int count, int* return_value);
FSErrorCode FSDK_TextPage_GetTextRect(FS_TEXTPAGE_HANDLE textpage_handle, int rect_index, FSRectF* return_value);
FSErrorCode FSDK_TextPage_GetBaselineRotation(FS_TEXTPAGE_HANDLE textpage_handle, int rect_index, FSRotation* return_value);
FSErrorCode FSDK_TextPage_GetTextRectArrayByRect(FS_TEXTPAGE_HANDLE textpage_handle, const FSRectF rect, FSRectF* return_rectf_array, FS_UINT32* return_array_length);
FSErrorCode FSDK_TextPage_GetCharRange(FS_TEXTPAGE_HANDLE textpage_handle, const FSRectF rect, FS_RANGE_HANDLE* return_value);
FSErrorCode FSDK_TextPage_GetTextUnderAnnot(FS_TEXTPAGE_HANDLE textpage_handle,  FS_ANNOT_HANDLE annot, FS_WSTR* return_value);
FSErrorCode FSDK_TextSearch_Create(const FS_PDFDOC_HANDLE document, FSSearchCancelCallback* cancel, int flags, FS_TEXTSEARCH_HANDLE* textsearch_return_value);
FSErrorCode FSDK_TextSearch_Create0(const FS_XFADOC_HANDLE xfa_document, FSSearchCancelCallback* cancel, FS_TEXTSEARCH_HANDLE* textsearch_return_value);
FSErrorCode FSDK_TextSearch_Create1(const FS_TEXTPAGE_HANDLE text_page, FS_TEXTSEARCH_HANDLE* textsearch_return_value);
FSErrorCode FSDK_TextSearch_Create2(const FS_ANNOT_HANDLE annot, FS_TEXTSEARCH_HANDLE* textsearch_return_value);
FSErrorCode FSDK_TextSearch_Release(FS_TEXTSEARCH_HANDLE textsearch_handle);
FSErrorCode FSDK_TextSearch_IsEmpty(FS_TEXTSEARCH_HANDLE textsearch_handle, FS_BOOL* return_value);
FSErrorCode FSDK_TextSearch_SetPattern(FS_TEXTSEARCH_HANDLE textsearch_handle, const wchar_t* key_words, FS_BOOL is_regex_search, FS_BOOL* return_value);
FSErrorCode FSDK_TextSearch_SetStartPage(FS_TEXTSEARCH_HANDLE textsearch_handle, int page_index, FS_BOOL* return_value);
FSErrorCode FSDK_TextSearch_SetEndPage(FS_TEXTSEARCH_HANDLE textsearch_handle, int page_index, FS_BOOL* return_value);
FSErrorCode FSDK_TextSearch_SetStartCharacter(FS_TEXTSEARCH_HANDLE textsearch_handle, int char_index, FS_BOOL* return_value);
FSErrorCode FSDK_TextSearch_SetSearchFlags(FS_TEXTSEARCH_HANDLE textsearch_handle, FS_UINT32 search_flags, FS_BOOL* return_value);
FSErrorCode FSDK_TextSearch_FindNext(FS_TEXTSEARCH_HANDLE textsearch_handle, FS_BOOL* return_value);
FSErrorCode FSDK_TextSearch_FindPrev(FS_TEXTSEARCH_HANDLE textsearch_handle, FS_BOOL* return_value);
FSErrorCode FSDK_TextSearch_GetMatchRects(FS_TEXTSEARCH_HANDLE textsearch_handle, FSRectF* return_rectf_array, FS_UINT32* return_array_length);
FSErrorCode FSDK_TextSearch_GetMatchPageIndex(FS_TEXTSEARCH_HANDLE textsearch_handle, int* return_value);
FSErrorCode FSDK_TextSearch_GetMatchSentence(FS_TEXTSEARCH_HANDLE textsearch_handle, FS_WSTR* return_value);
FSErrorCode FSDK_TextSearch_GetMatchSentenceStartIndex(FS_TEXTSEARCH_HANDLE textsearch_handle, int* return_value);
FSErrorCode FSDK_TextSearch_GetMatchSentenceEndIndex(FS_TEXTSEARCH_HANDLE textsearch_handle, int* return_value);
FSErrorCode FSDK_TextSearch_GetMatchStartCharIndex(FS_TEXTSEARCH_HANDLE textsearch_handle, int* return_value);
FSErrorCode FSDK_TextSearch_GetMatchEndCharIndex(FS_TEXTSEARCH_HANDLE textsearch_handle, int* return_value);
FSErrorCode FSDK_TextLink_Release(FS_TEXTLINK_HANDLE textlink_handle);
FSErrorCode FSDK_TextLink_IsEmpty(FS_TEXTLINK_HANDLE textlink_handle, FS_BOOL* return_value);
FSErrorCode FSDK_TextLink_GetURI(FS_TEXTLINK_HANDLE textlink_handle, FS_WSTR* return_value);
FSErrorCode FSDK_TextLink_GetStartCharIndex(FS_TEXTLINK_HANDLE textlink_handle, int* return_value);
FSErrorCode FSDK_TextLink_GetEndCharIndex(FS_TEXTLINK_HANDLE textlink_handle, int* return_value);
FSErrorCode FSDK_TextLink_GetRects(FS_TEXTLINK_HANDLE textlink_handle, FSRectF* return_rectf_array, FS_UINT32* return_array_length);
FSErrorCode FSDK_PageTextLinks_Create(const FS_TEXTPAGE_HANDLE page, FS_PAGETEXTLINKS_HANDLE* pagetextlinks_return_value);
FSErrorCode FSDK_PageTextLinks_IsEmpty(FS_PAGETEXTLINKS_HANDLE pagetextlinks_handle, FS_BOOL* return_value);
FSErrorCode FSDK_PageTextLinks_Release(FS_PAGETEXTLINKS_HANDLE pagetextlinks_handle);
FSErrorCode FSDK_PageTextLinks_GetTextLinkCount(FS_PAGETEXTLINKS_HANDLE pagetextlinks_handle, int* return_value);
FSErrorCode FSDK_PageTextLinks_GetTextLink(FS_PAGETEXTLINKS_HANDLE pagetextlinks_handle, int index, FS_TEXTLINK_HANDLE* return_value);
#ifdef __cplusplus
}
#endif
#endif
