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_PLUGIN_VIEW_IMPL_H_
00028 #define PDF_PLUGIN_VIEW_IMPL_H_
00029
00030 #include "plugin_inc.h"
00031 #include "render_settings_impl.h"
00032 #include "render_result_impl.h"
00033 #include "interfaces_utils.h"
00034 #include "listeners.h"
00035
00036 #include "pdf_page.h"
00037 #include "pdf_renderer.h"
00038
00039 namespace pdf
00040 {
00041
00042 class PluginDocImpl;
00043
00044 class PDFRenderAttributes;
00045
00046
00047
00048 class PluginViewImpl : public IPluginUnknown
00049 , public IPluginView
00050 , public IPluginViewSettings
00051 , public IPluginRender
00052 , public IPluginFont
00053 , public IPluginEventBroadcaster
00054
00055 {
00056 public:
00057 explicit PluginViewImpl(PluginDocImpl *doc);
00058 ~PluginViewImpl(void);
00059
00060 public:
00061 utils::Signal<PluginViewImpl *> release_signal;
00062
00063 private:
00064
00065 static PluginStatus query_interface_impl(
00066 IPluginUnknown *thiz,
00067 const UDSString *id,
00068 void **ptr );
00069
00070 static int release_impl(
00071 IPluginUnknown *thiz );
00072
00073 static int get_page_number_impl(
00074 IPluginUnknown *thiz,
00075 const UDSString *anchor );
00076
00077 static PluginStatus get_page_name_impl(
00078 IPluginUnknown *thiz,
00079 const UDSString *page_start_anchor,
00080 UDSString *name);
00081
00082 static PluginStatus get_rendered_page_start_impl(
00083 IPluginUnknown *thiz,
00084 const UDSString *anchor,
00085 UDSString *start_anchor );
00086
00087 static PluginStatus get_physical_page_start_impl(
00088 IPluginUnknown *thiz,
00089 const UDSString *anchor,
00090 UDSString *start_anchor );
00091
00092 static int get_number_of_pages_impl(
00093 IPluginUnknown *thiz);
00094
00095 static PluginStatus get_anchor_by_page_impl(
00096 IPluginUnknown *thiz,
00097 unsigned int page,
00098 UDSString *start_of_page_anchor);
00099
00100 static PluginStatus get_prev_page_impl(
00101 IPluginUnknown *thiz,
00102 UDSString *start_of_page_anchor);
00103
00104 static PluginStatus get_next_page_impl(
00105 IPluginUnknown *thiz,
00106 UDSString *start_of_page_anchor);
00107
00108 static PluginStatus get_cover_page_impl(
00109 IPluginUnknown *thiz,
00110 const int width,
00111 const int height,
00112 PluginBitmapAttributes *cover_page);
00113
00114 static PluginStatus set_display_size_impl(
00115 IPluginUnknown *thiz,
00116 const int width,
00117 const int height );
00118
00119 static PluginStatus set_DPI_impl(
00120 IPluginUnknown *thiz,
00121 const unsigned int dpi );
00122
00123 static PluginStatus set_color_depth_impl(
00124 IPluginUnknown *thiz,
00125 const unsigned int color_depth );
00126
00127 static PluginStatus render_impl(
00128 IPluginUnknown *thiz,
00129 const UDSString *start_of_page_anchor,
00130 const int page_offset,
00131 IPluginUnknown *settings,
00132 const RenderArea *area,
00133 const unsigned int refId );
00134
00135 static IPluginUnknown * create_render_settings_impl(
00136 IPluginUnknown *thiz );
00137
00138 static PluginStatus set_memory_limit_impl(
00139 IPluginUnknown *thiz,
00140 const unsigned int bytes );
00141
00142 static PluginStatus get_original_size_impl(
00143 IPluginUnknown *thiz,
00144 const UDSString *start_of_page_anchor,
00145 unsigned int *width,
00146 unsigned int *height );
00147
00148 static PluginStatus get_page_content_area_impl(
00149 IPluginUnknown *thiz,
00150 const UDSString *start_of_page_anchor,
00151 RenderArea *area );
00152
00153 static PluginStatus get_original_rotation_impl(
00154 IPluginUnknown *thiz,
00155 const UDSString *start_of_page_anchor,
00156 PluginRotationDegree *rotation );
00157
00158 static int get_font_size_impl(
00159 IPluginUnknown *thiz );
00160
00161 static PluginStatus set_font_size_impl(
00162 IPluginUnknown *thiz,
00163 const unsigned int font_size );
00164
00165 static PluginStatus get_font_family_impl(
00166 IPluginUnknown *thiz,
00167 UDSString *font_family );
00168
00169 static PluginStatus set_font_family_impl(
00170 IPluginUnknown *thiz,
00171 const UDSString *font_family );
00172
00173 static PluginStatus add_event_receiver_impl(
00174 IPluginUnknown *thiz,
00175 const PluginEvent plugin_event,
00176 EventFunc callback,
00177 void *user_data,
00178 unsigned long *handler_id );
00179
00180 static PluginStatus remove_event_receiver_impl(
00181 IPluginUnknown *thiz,
00182 unsigned long handler_id );
00183
00184 private:
00185 typedef PluginRenderSettingsImpl * RenderSettingsPtr;
00186 typedef std::vector<RenderSettingsPtr> RenderSettings;
00187 typedef std::vector<RenderSettingsPtr>::iterator RenderSettingsIter;
00188
00189 typedef PluginRenderResultImpl * RenderResultPtr;
00190 typedef std::vector<RenderResultPtr> RenderResults;
00191 typedef std::vector<RenderResultPtr>::iterator RenderResultIter;
00192
00193 private:
00194 static utils::ObjectTable<PluginViewImpl> g_instances_table;
00195
00196
00197 PluginDocImpl *document;
00198 RenderSettings render_settings;
00199 RenderResults render_results;
00200 utils::Listeners listeners;
00201
00202 PDFRenderer *renderer;
00203
00204 private:
00205 void send_render_request(int page_num,
00206 const PDFRenderAttributes &page_attr,
00207 const RenderArea *area,
00208 const unsigned int refId);
00209
00210
00211
00212
00213 void handle_page_ready(RenderResultPtr result, RenderStatus stat);
00214
00215 void on_render_settings_released(PluginRenderSettingsImpl * settings);
00216 void on_render_result_released(PluginRenderResultImpl * result);
00217 };
00218
00219 };
00220
00221 #endif
00222
00223
00224