images/plugin_impl/view_impl.h

Go to the documentation of this file.
00001 /*
00002  * File Name: view_impl.h
00003  */
00004 
00005 /*
00006  * This file is part of uds-plugin-images.
00007  *
00008  * uds-plugin-images 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-images 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 IMAGES_PLUGIN_VIEW_IMPL_H_
00028 #define IMAGES_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 #include "images_renderer.h"
00036 #include "image_page.h"
00037 
00038 namespace images
00039 {
00040 
00041 class PluginDocImpl;
00042 
00043 /// @brief Implement all interfaces of view object. If view object
00044 /// provider does not want to support optional interface, it may
00045 /// remove the interface from parent class list.
00046 class PluginViewImpl : public IPluginUnknown
00047                      , public IPluginView
00048                      , public IPluginViewSettings
00049                      , public IPluginRender
00050                      , public IPluginFont
00051                      , public IPluginEventBroadcaster
00052                      
00053 {
00054 public:
00055     explicit PluginViewImpl(PluginDocImpl *doc);
00056     ~PluginViewImpl(void);
00057 
00058 public:
00059     void stop_renderer(void);
00060     
00061 public:
00062     Signal<PluginViewImpl *> release_signal;
00063 
00064 private:
00065     void render_page_ready(ImagePage * page,
00066                            const unsigned int ref_id,
00067                            ImageRenderStatus status,
00068                            void * user_data);
00069 private:
00070     // IPluginUnknown
00071     static PluginStatus query_interface_impl(
00072         IPluginUnknown      *thiz,
00073         const UDSString     *id, 
00074         void                **ptr );
00075 
00076     static int release_impl(
00077         IPluginUnknown      *thiz );
00078 
00079     static int get_page_number_impl(
00080         IPluginUnknown      *thiz,
00081         const UDSString     *anchor );
00082 
00083     static PluginStatus get_page_name_impl(
00084             IPluginUnknown  *thiz,
00085             const UDSString *anchor,
00086             UDSString       *name);
00087 
00088     static int get_number_of_pages_impl(
00089         IPluginUnknown      *thiz);
00090 
00091     static PluginStatus get_anchor_by_page_impl(
00092         IPluginUnknown      *thiz,
00093         unsigned int        page,
00094         UDSString           *anchor);
00095 
00096     static PluginStatus get_prev_page_impl(
00097         IPluginUnknown      *thiz,
00098         UDSString           *anchor);
00099 
00100     static PluginStatus get_next_page_impl(
00101         IPluginUnknown *thiz,
00102         UDSString      *anchor);
00103 
00104     static PluginStatus get_rendered_page_start_impl(
00105         IPluginUnknown  *thiz,
00106         const UDSString *anchor,
00107         UDSString       *start_anchor);
00108 
00109     static PluginStatus get_physical_page_start_impl(
00110         IPluginUnknown  *thiz,
00111         const UDSString *anchor,
00112         UDSString       *start_anchor);
00113 
00114     static PluginStatus get_cover_page_impl (
00115         IPluginUnknown *thiz,
00116         const int      width,
00117         const int      height,
00118         PluginBitmapAttributes *cover_page);
00119 
00120     static PluginStatus set_display_size_impl(
00121         IPluginUnknown      *thiz,
00122         const int           width,
00123         const int           height );
00124 
00125     static PluginStatus set_DPI_impl( 
00126         IPluginUnknown      *thiz,
00127         const unsigned int  dpi );
00128 
00129     static PluginStatus set_color_depth_impl(
00130         IPluginUnknown        *thiz,
00131         const unsigned int    color_depth );
00132 
00133     static PluginStatus render_impl(
00134         IPluginUnknown      *thiz,
00135         const UDSString     *anchor,
00136         const int           page_offset,
00137         IPluginUnknown      *settings,
00138         const RenderArea    *area, 
00139         const unsigned int  refId );
00140 
00141     static IPluginUnknown * create_render_settings_impl(
00142         IPluginUnknown      *thiz );
00143 
00144     static PluginStatus set_memory_limit_impl(
00145         IPluginUnknown       *thiz,   
00146         const unsigned int   bytes );
00147 
00148     static PluginStatus get_original_size_impl(
00149         IPluginUnknown       *thiz,
00150         const UDSString      *anchor,
00151         unsigned int         *width,
00152         unsigned int         *height );
00153 
00154     static PluginStatus get_page_content_area_impl(
00155         IPluginUnknown       *thiz,
00156         const UDSString      *start_of_page_anchor,
00157         RenderArea           *area );
00158 
00159     static PluginStatus get_original_rotation_impl(
00160         IPluginUnknown       *thiz,
00161         const UDSString      *anchor,
00162         PluginRotationDegree *rotation );
00163 
00164     static int get_font_size_impl(
00165         IPluginUnknown      *thiz );
00166 
00167     static PluginStatus set_font_size_impl(
00168         IPluginUnknown      *thiz, 
00169         const unsigned int  font_size );
00170 
00171     static PluginStatus get_font_family_impl(
00172         IPluginUnknown      *thiz, 
00173         UDSString           *font_family );
00174 
00175     static PluginStatus set_font_family_impl(
00176         IPluginUnknown      *thiz, 
00177         const UDSString     *font_family );
00178 
00179     static PluginStatus add_event_receiver_impl(
00180         IPluginUnknown      *thiz,
00181         const PluginEvent   plugin_event,
00182         EventFunc           callback,
00183         void                *user_data,
00184         unsigned long       *handler_id );
00185 
00186     static PluginStatus remove_event_receiver_impl(
00187         IPluginUnknown      *thiz,
00188         unsigned long       handler_id );
00189 
00190 private:
00191     typedef PluginRenderSettingsImpl * RenderSettingsPtr;
00192     typedef std::vector<RenderSettingsPtr> RenderSettings;
00193     typedef std::vector<RenderSettingsPtr>::iterator RenderSettingsIter;
00194 
00195     typedef PluginRenderResultImpl * RenderResultPtr;
00196     typedef std::vector<RenderResultPtr> RenderResults;
00197     typedef std::vector<RenderResultPtr>::iterator RenderResultIter;
00198 
00199 
00200     static utils::ObjectTable<PluginViewImpl> g_instances_table;
00201     PluginDocImpl *document; ///< Reference to the document.
00202     images::ImagesRenderer *renderer;
00203     images::ImagePageAttrs render_req_attributes;
00204     RenderSettings render_settings;
00205     RenderResults render_results;
00206     utils::Listeners listeners;
00207 
00208 private:
00209     void on_render_settings_released(PluginRenderSettingsImpl * settings);
00210     void on_render_result_released(PluginRenderResultImpl * result);
00211     void remove_slots(void);
00212 };
00213 
00214 };  // namespace images
00215 
00216 #endif
00217 
00218 
00219 
Generated by  doxygen 1.6.2-20100208