root/trunk/src/JobFind.h
| Revision 172, 3.2 kB (checked in by jordi, 2 years ago) |
|---|
| Line | |
|---|---|
| 1 | // ePDFView - A lightweight PDF Viewer. |
| 2 | // Copyright (C) 2006 Emma's Software. |
| 3 | // |
| 4 | // This program is free software; you can redistribute it and/or modify |
| 5 | // it under the terms of the GNU General Public License as published by |
| 6 | // the Free Software Foundation; either version 2 of the License, or |
| 7 | // (at your option) any later version. |
| 8 | // |
| 9 | // This program is distributed in the hope that it will be useful, |
| 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | // GNU General Public License for more details. |
| 13 | // |
| 14 | // You should have received a copy of the GNU General Public License |
| 15 | // along with this program; if not, write to the Free Software |
| 16 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 | |
| 18 | #if !defined (__JOB_FIND_H__) |
| 19 | #define __JOB_FIND_H__ |
| 20 | |
| 21 | namespace ePDFView |
| 22 | { |
| 23 | // Forward declarations. |
| 24 | class FindPter; |
| 25 | |
| 26 | /// |
| 27 | /// @brief The search direction. |
| 28 | /// |
| 29 | typedef enum _FindDirection |
| 30 | { |
| 31 | /// Search forwards. |
| 32 | FIND_DIRECTION_FORWARDS, |
| 33 | /// Search backwards. |
| 34 | FIND_DIRECTION_BACKWARDS |
| 35 | } FindDirection; |
| 36 | |
| 37 | /// |
| 38 | /// @class JobFind |
| 39 | /// @brief A background job that finds text on the document. |
| 40 | /// |
| 41 | class JobFind: public IJob |
| 42 | { |
| 43 | public: |
| 44 | JobFind (void); |
| 45 | ~JobFind (void); |
| 46 | |
| 47 | void cancel (void); |
| 48 | void dequeue (void); |
| 49 | void enqueue (void); |
| 50 | gint getCurrentPage (void); |
| 51 | FindDirection getDirection (void); |
| 52 | IDocument *getDocument (void); |
| 53 | FindPter *getFindPter (void); |
| 54 | GList *getResults (void); |
| 55 | gint getResultsPage (void); |
| 56 | gint getStartingPage (void); |
| 57 | const gchar *getTextToFind (void); |
| 58 | gboolean isCanceled (void); |
| 59 | gboolean isEnqueued (void); |
| 60 | gboolean run (void); |
| 61 | void setCurrentPage (gint pageNum); |
| 62 | void setDirection (FindDirection direction); |
| 63 | void setDocument (IDocument *document); |
| 64 | void setFindPter (FindPter *pter); |
| 65 | void setResults (gint pageNum, GList *results); |
| 66 | void setStartingPage (gint pageNum); |
| 67 | void setTextToFind (const gchar *textToFind); |
| 68 | |
| 69 | protected: |
| 70 | /// Tells if the job has been canceled. |
| 71 | gboolean m_Canceled; |
| 72 | /// The current page to search the text. |
| 73 | gint m_CurrentPage; |
| 74 | /// The next page to look for the text: the next or the previous. |
| 75 | FindDirection m_Direction; |
| 76 | /// The document to search the text from. |
| 77 | IDocument *m_Document; |
| 78 | /// Tells if the job is enqueued. |
| 79 | gboolean m_Enqueued; |
| 80 | /// The presenter to tell when a change happens. |
| 81 | FindPter *m_FindPter; |
| 82 | /// The search results of a page. |
| 83 | GList *m_Results; |
| 84 | /// The page number where m_Results belongs to. |
| 85 | gint m_ResultsPage; |
| 86 | /// The starting page of the search. |
| 87 | gint m_StartingPage; |
| 88 | /// The search to find on the document. |
| 89 | gchar *m_TextToFind; |
| 90 | }; |
| 91 | } |
| 92 | |
| 93 | #endif // !__JOB_FIND_H__ |
Note: See TracBrowser
for help on using the browser.
