pdf_prerender_policy.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
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