00001 /* 00002 * File Name: plugin_view.h 00003 */ 00004 00005 /* 00006 * This file is part of uds-plugin-common. 00007 * 00008 * uds-plugin-common 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-common 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 PLUGIN_VIEW_H_ 00028 #define PLUGIN_VIEW_H_ 00029 00030 #ifdef __cplusplus 00031 extern "C" { 00032 #endif 00033 00034 #include "plugin_type.h" 00035 #include "plugin_unknown.h" 00036 #include "plugin_render_result.h" 00037 00038 /** 00039 * @brief Universal Document Shell Plugin View interface. 00040 */ 00041 typedef struct 00042 { 00043 /** 00044 * @brief Get page number by a specified anchor. 00045 * @param thiz IPluginUnknown pointer of the view object. 00046 * @param anchor Location of user specified content. 00047 * @return The page location of the specified anchor. The location is 00048 * represented by number. 00049 */ 00050 int (* get_page_number)( IPluginUnknown *thiz, 00051 const UDSString *anchor ); 00052 00053 /** 00054 * @brief Retrieve page name by a specified anchor. 00055 * @param thiz IPluginUnknown pointer of the view object. 00056 * @param page_start_anchor The start anchor of the page. 00057 * @param name It serves as output parameter. The returned page name 00058 * is stored in the name. 00059 * 00060 * @return This function returns PLUGIN_OK if plugin can store the 00061 * page name into the @name. Otherwise it returns false. 00062 * This function is useful for image plugin when UDS works in 00063 * thumbnail mode. UDS can display the file name instead of page number. 00064 */ 00065 PluginStatus (*get_page_name)( IPluginUnknown *thiz, 00066 const UDSString *page_start_anchor, 00067 UDSString *name); 00068 00069 /** 00070 * @brief Returns an anchor pointing to the start of the rendered page 00071 * 00072 * @param thiz [in] IPluginUnknown pointer of view object. 00073 * @param anchor [in] The anchor of the requested page 00074 * @param start_anchor [out] Anchor pointing to the start of the rendered page 00075 * 00076 * @return PLUGIN_OK If plugin can find the page that contain the object specified by range. 00077 * It returns other values if something wrong with 00078 */ 00079 PluginStatus (* get_rendered_page_start)( IPluginUnknown *thiz, 00080 const UDSString *anchor, 00081 UDSString *start_anchor ); 00082 00083 /** 00084 * @brief Returns an anchor poiting to the start of the physical page 00085 * 00086 * When the plugin renders only physical pages, this function doesn't have to be implementated. The 00087 * default implementation willcall get_rendered_page_start() 00088 * 00089 * @param thiz IPluginUnknown pointer of view object. 00090 * @param start_anchor [out] Anchor pointing to the start of the physical page 00091 * @return PLUGIN_OK Iff plugin can find the page that contain the object specified by range. 00092 * It returns other values if something wrong with 00093 */ 00094 PluginStatus (* get_physical_page_start)( IPluginUnknown *thiz, 00095 const UDSString *anchor, 00096 UDSString *start_anchor ); 00097 00098 00099 /** 00100 * @brief Get the total number of the pages rendered by this view object. 00101 * @param thiz IPluginUnknown pointer of the view object. 00102 * @return The number of total pages rendered by this view object. 00103 */ 00104 int (* get_number_of_pages) ( IPluginUnknown *thiz ); 00105 00106 /** 00107 * @brief Get anchor position corresponding to the specified page. 00108 * @param thiz IPluginUnknown pointer of the view object. 00109 * @param page The specified page number. 00110 * @param start_of_page_anchor The returned anchor position. 00111 * @return TODO. Add return code here. 00112 */ 00113 PluginStatus (* get_anchor_by_page)( IPluginUnknown *thiz, 00114 unsigned int page, 00115 UDSString *start_of_page_anchor ); 00116 00117 /** 00118 * @brief Get the anchor for the beginning position of the previous page. 00119 * @param thiz IPluginUnknown pointer of the view object. 00120 * @param start_of_page_anchor The returned anchor position. 00121 * @return TODO. Add return code here. 00122 */ 00123 PluginStatus (* get_prev_page)( IPluginUnknown *thiz, 00124 UDSString *start_of_page_anchor ); 00125 00126 /** 00127 * @brief Get the anchor for the beginning position of the next page. 00128 * @param thiz IPluginUnknown pointer of the view object. 00129 * @param start_of_page_anchor The returned anchor position. 00130 * @return TODO. Add return code here. 00131 */ 00132 PluginStatus (* get_next_page)( IPluginUnknown *thiz, 00133 UDSString *start_of_page_anchor ); 00134 00135 /** 00136 * @brief Get the cover page of document. 00137 * @param thiz IPluginUnknown pointer of the view object. 00138 * @param width The desired cover page width. 00139 * @param height The desired cover page height. 00140 * @param cover_page The result image of cover page. 00141 * @return This function returns PLUGIN_OK if view object is able to 00142 * render the cover page successfully, otherwise it returns PLUGIN_FAIL. 00143 */ 00144 PluginStatus (* get_cover_page)( IPluginUnknown *thiz, 00145 const int width, 00146 const int height, 00147 PluginBitmapAttributes *cover_page); 00148 00149 } IPluginView; 00150 00151 #ifdef __cplusplus 00152 } 00153 #endif 00154 00155 #endif 00156