pdf_prerender_policy.h

Go to the documentation of this file.
00001 /*
00002  * File Name: pdf_prerender_policy.h
00003  */
00004 
00005 /*
00006  * This file is part of uds-plugin-pdf.
00007  *
00008  * uds-plugin-pdf is free software: you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation, either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * uds-plugin-pdf is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program. If not, see <http://www.gnu.org/licenses/>.
00020  */
00021 
00022 /**
00023  * Copyright (C) 2008 iRex Technologies B.V.
00024  * All rights reserved.
00025  */
00026 
00027 #ifndef PDF_PRERENDER_POLICY_H
00028 #define PDF_PRERENDER_POLICY_H
00029 
00030 #include "pdf_define.h"
00031 #include "pdf_render_requests.h"
00032 
00033 namespace pdf
00034 {
00035 
00036 using namespace std;
00037 
00038 class PDFPrerenderPolicy
00039 {
00040 public:
00041     PDFPrerenderPolicy();
00042     virtual ~PDFPrerenderPolicy();
00043 
00044     virtual void generate_requests_list(const int current_page,
00045                                         const int previous_page,
00046                                         const int total,
00047                                         std::vector<size_t> & result) = 0;
00048 
00049     virtual int get_allowed_hyperlinks_number() = 0;
00050 
00051     void set_prerender(bool prerender_on) { is_prerender = prerender_on; }
00052     bool support_prerender() const { return is_prerender; }
00053     PDFRenderRequests & get_requests() { return requests; }
00054 protected:
00055     PDFRenderRequests requests;
00056 private:
00057     bool is_prerender;
00058 };
00059 
00060 class PDFPrerenderPolicyNormal : public PDFPrerenderPolicy
00061 {
00062 public:
00063     PDFPrerenderPolicyNormal();
00064     virtual ~PDFPrerenderPolicyNormal();
00065 
00066     virtual void generate_requests_list(const int current_page,
00067                                         const int previous_page,
00068                                         const int total,
00069                                         std::vector<size_t> & result);
00070 
00071     virtual int get_allowed_hyperlinks_number();
00072 
00073 private:
00074     void next_pages_first(const int current_page,
00075                           const int total,
00076                           bool forward,
00077                           std::vector<size_t> & result);
00078 
00079     void faraway_pages_first(const int current_page,
00080                              const int total,
00081                              bool forward,
00082                              std::vector<size_t> & result);
00083 
00084     void nearby_pages_first(const int current_page,
00085                             const int total,
00086                             std::vector<size_t> & result);
00087 };
00088 
00089 };
00090 
00091 #endif
Generated by  doxygen 1.6.2-20100208