00001 /* 00002 * File Name: pdf_render_task.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_RENDER_TASK_H_ 00028 #define PDF_RENDER_TASK_H_ 00029 00030 #include "task.h" 00031 00032 #include "pdf_page.h" 00033 #include "pdf_define.h" 00034 #include "pdf_doc_controller.h" 00035 00036 namespace pdf 00037 { 00038 00039 /// @brief The rendering task. 00040 class PDFRenderTask : public Task 00041 { 00042 public: 00043 // constructor without existing page 00044 PDFRenderTask(int page_num, 00045 const PDFRenderAttributes &attr, 00046 PDFController *ctrl, 00047 PluginRenderResultImpl *render_res, 00048 int id = PRERENDER_REF_ID); 00049 00050 // constructor with existing page 00051 PDFRenderTask(PagePtr p, 00052 const PDFRenderAttributes &attr, 00053 PDFController *ctrl, 00054 PluginRenderResultImpl *render_res, 00055 int id = PRERENDER_REF_ID); 00056 00057 virtual ~PDFRenderTask(); 00058 00059 /// execute the rendering task 00060 void execute(); 00061 00062 /// get the pointer of PDFController intance 00063 void* get_user_data(); 00064 00065 /// get render id 00066 unsigned int get_id(); 00067 00068 private: 00069 // PDFPage 00070 PagePtr page; 00071 00072 // Page number 00073 int page_number; 00074 00075 // Render settings of the page which needs to be rendered 00076 PDFRenderAttributes page_render_attr; 00077 00078 // The reference of the document controller 00079 PDFController *doc_ctrl; 00080 00081 // The reference id 00082 int ref_id; 00083 00084 // The pointer of render result(allocated in main thread) 00085 PluginRenderResultImpl *render_result; 00086 00087 private: 00088 // Estimate whether the page is out of date 00089 bool is_page_out_of_date(); 00090 00091 }; 00092 00093 };//namespace pdf 00094 00095 #endif //PDF_RENDER_TASK_H_ 00096