00001
00002
00003
00004
00005
00006 #ifndef HPP_CPPTextSearch
00007 #define HPP_CPPTextSearch
00008
00009 #include <PDF/PDFDoc.h>
00010 #include <Common/UString.h>
00011 #include <PDF/Highlights.h>
00012 #include <C/PDF/TRN_TextSearch.h>
00013
00014 namespace pdftron {
00015 namespace PDF {
00016
00094 class TextSearch
00095 {
00096 public:
00097
00101 TextSearch();
00102 ~TextSearch();
00103
00107 typedef TRN_UInt32 Mode;
00108
00112 enum
00113 {
00114
00115 e_reg_expression = 0x0001,
00116
00117
00118 e_case_sensitive = e_reg_expression << 1,
00119
00120
00121 e_whole_word = e_case_sensitive << 1,
00122
00123
00124 e_search_up = e_whole_word << 1,
00125
00126
00127
00128
00129 e_page_stop = e_search_up << 1,
00130
00131
00132 e_highlight = e_page_stop << 1,
00133
00134
00135
00136
00137 e_ambient_string = e_highlight << 1
00138 };
00139
00143 enum ResultCode
00144 {
00145
00146 e_done = 0,
00147
00148
00149 e_page = 1,
00150
00151
00152 e_found = 2
00153 };
00154
00169 bool Begin(PDFDoc& doc, const UString& pattern, Mode mode, int start_page = -1, int end_page = -1);
00170
00188 ResultCode Run( int& page_num, UString& result_str, UString& ambient_str, Highlights& hlts );
00189
00198 bool SetPattern(const UString& pattern);
00199
00204 Mode GetMode() const;
00205
00219 void SetMode( Mode mode );
00220
00228 int GetCurrentPage() const;
00229
00230 private:
00231 TRN_TextSearch mp_textsearch;
00232 };
00233
00234
00235 #include <Impl/TextSearch.inl>
00236
00237 };
00238 };
00239
00240 #endif