text::PluginViewImpl Class Reference

Implement all interfaces of view object. If view object provider does not want to support optional interface, it may remove the interface from parent class list. More...

#include <view_impl.h>

Inheritance diagram for text::PluginViewImpl:
Inheritance graph
[legend]
Collaboration diagram for text::PluginViewImpl:
Collaboration graph
[legend]

Public Member Functions

 PluginViewImpl (PluginDocImpl *doc)
 ~PluginViewImpl (void)
TextViewget_text_view ()
TextControllerget_text_controller ()
IPluginUnknownget_bounding_rectangles_from_range_impl (const Position &page_start_pos, const PluginRange *range)
 Get bounding rectangles given by specified range.
PluginStatus get_anchor_from_coordinates_impl (const Position &page_start_pos, const int x, const int y, UDSString *anchor)
 Get anchor given by specified coordinates.

Detailed Description

Implement all interfaces of view object. If view object provider does not want to support optional interface, it may remove the interface from parent class list.

Definition at line 47 of file plaintext/plugin_impl/view_impl.h.


Constructor & Destructor Documentation

text::PluginViewImpl::PluginViewImpl ( PluginDocImpl doc  )  [explicit]

Definition at line 37 of file plaintext/plugin_impl/view_impl.cpp.

References IPluginEventBroadcaster::add_event_receiver, utils::ObjectTable< T >::add_interface(), utils::Signal< A1, A2, A3, A4, A5 >::add_slot(), IPluginRender::create_render_settings, IPluginView::get_anchor_by_page, IPluginView::get_cover_page, IPluginFont::get_font_family, IPluginFont::get_font_size, IPluginView::get_next_page, IPluginView::get_number_of_pages, IPluginRender::get_original_size, IPluginRender::get_page_content_area, IPluginView::get_page_name, IPluginView::get_page_number, IPluginView::get_physical_page_start, IPluginView::get_prev_page, IPluginView::get_rendered_page_start, text::TextView::pagination_end_signal, text::TextView::pagination_start_signal, _IPluginUnknown::query_interface, _IPluginUnknown::release, IPluginEventBroadcaster::remove_event_receiver, IPluginRender::render, text::TextView::render_done_signal, IPluginViewSettings::set_color_depth, IPluginViewSettings::set_display_size, IPluginViewSettings::set_DPI, IPluginFont::set_font_family, IPluginFont::set_font_size, and IPluginRender::set_memory_limit.

00038 : document(doc)
00039 , view(&document->get_model())
00040 , controller(&document->get_model(), &view)
00041 {
00042     assert(document);
00043 
00044     // IPluginUnknown
00045     query_interface = query_interface_impl;
00046     release         = release_impl;
00047 
00048     // IPluginView
00049     get_page_number         = get_page_number_impl;
00050     get_page_name           = get_page_name_impl;
00051     get_number_of_pages     = get_number_of_pages_impl;
00052     get_anchor_by_page      = get_anchor_by_page_impl;
00053     get_prev_page           = get_prev_page_impl;
00054     get_next_page           = get_next_page_impl;
00055     get_rendered_page_start = get_rendered_page_start_impl;
00056     get_physical_page_start = get_physical_page_start_impl;
00057     get_cover_page          = get_cover_page_impl;
00058 
00059     // IPluginViewSettings
00060     set_display_size    = set_display_size_impl;
00061     set_DPI             = set_DPI_impl;
00062     set_color_depth     = set_color_depth_impl;
00063 
00064     // IPluginRender
00065     render                  = render_impl;
00066     create_render_settings  = create_render_settings_impl;
00067     set_memory_limit        = set_memory_limit_impl;
00068     get_original_size       = get_original_size_impl;
00069     get_page_content_area   = get_page_content_area_impl;
00070 
00071     // IPluginFont
00072     get_font_size   = get_font_size_impl;
00073     set_font_size   = set_font_size_impl;
00074     get_font_family = get_font_family_impl;
00075     set_font_family = set_font_family_impl;
00076 
00077     // IPluginEventBroadcaster
00078     add_event_receiver      = add_event_receiver_impl;
00079     remove_event_receiver   = remove_event_receiver_impl;
00080 
00081     g_instances_table.add_interface<IPluginUnknown>(this);
00082     g_instances_table.add_interface<IPluginView>(this);
00083     g_instances_table.add_interface<IPluginViewSettings>(this);
00084     g_instances_table.add_interface<IPluginRender>(this);
00085     g_instances_table.add_interface<IPluginEventBroadcaster>(this);
00086     g_instances_table.add_interface<IPluginFont>(this);
00087 
00088     // Initialize signals.
00089     view.render_done_signal.add_slot(this,
00090         &PluginViewImpl::on_render_done);
00091     view.pagination_start_signal.add_slot(this,
00092         &PluginViewImpl::on_pagination_start);
00093     view.pagination_end_signal.add_slot(this,
00094         &PluginViewImpl::on_pagination_done);
00095 }

Here is the call graph for this function:

text::PluginViewImpl::~PluginViewImpl ( void   ) 

Definition at line 97 of file plaintext/plugin_impl/view_impl.cpp.

References utils::ObjectTable< T >::remove().

00098 {
00099     g_instances_table.remove(this);
00100 }

Here is the call graph for this function:


Member Function Documentation

PluginStatus text::PluginViewImpl::get_anchor_from_coordinates_impl ( const Position page_start_pos,
const int  x,
const int  y,
UDSString anchor 
)

Get anchor given by specified coordinates.

Parameters:
page_start_pos The start position of the page.
x The x coordinate.
y The y coordinate.
anchor The output (result) anchor.
Returns:
The operation status code.

Definition at line 466 of file plaintext/plugin_impl/view_impl.cpp.

References _UDSString::assign, text::TextView::map_view_pos_to_doc_pos(), PLUGIN_FAIL, PLUGIN_OK, text::Position::to_string(), text::ViewPosition::x, and text::ViewPosition::y.

00470 {
00471     Position doc_pos;
00472 
00473     ViewPosition view_pos;
00474     view_pos.x = x;
00475     view_pos.y = y;
00476 
00477     if (!view.map_view_pos_to_doc_pos(page_start_pos, view_pos, doc_pos))
00478     {
00479         return PLUGIN_FAIL;
00480     }
00481 
00482     anchor->assign(anchor, doc_pos.to_string().c_str());
00483     return PLUGIN_OK;
00484 }

Here is the call graph for this function:

IPluginUnknown * text::PluginViewImpl::get_bounding_rectangles_from_range_impl ( const Position page_start_pos,
const PluginRange range 
)

Get bounding rectangles given by specified range.

Parameters:
page_start_pos The start position of the page.
range Identify a range.

Definition at line 486 of file plaintext/plugin_impl/view_impl.cpp.

References text::PluginCollectionImpl::create(), PluginRange::end_anchor, text::TextView::get_bounding_rectangles(), _UDSString::get_buffer, PluginRange::start_anchor, and text::PluginCollectionImpl::take_data_ref().

00488 {
00489     std::vector<Rect> rects;
00490     Range range_internal(Position(range->start_anchor->get_buffer(range->start_anchor)),
00491                          Position(range->end_anchor->get_buffer(range->end_anchor)));
00492     view.get_bounding_rectangles(page_start_pos, rects, range_internal);
00493 
00494     PluginCollectionImpl *coll_p = new PluginCollectionImpl();
00495     coll_p->create<Rect>();
00496     std::vector<Rect>& data = coll_p->take_data_ref<Rect>();
00497     data.swap(rects);
00498 
00499     return coll_p;
00500 }

Here is the call graph for this function:

TextController* text::PluginViewImpl::get_text_controller (  )  [inline]

Definition at line 61 of file plaintext/plugin_impl/view_impl.h.

00061 {return &controller;}

TextView& text::PluginViewImpl::get_text_view (  )  [inline]

Definition at line 60 of file plaintext/plugin_impl/view_impl.h.

00060 { return view; }


The documentation for this class was generated from the following files:
Generated by  doxygen 1.6.2-20100208