gui::PageViewMode_TextSelection Class Reference

#include <pageviewmode.h>

Inheritance diagram for gui::PageViewMode_TextSelection:
gui::PageViewMode gui::PageViewMode_TextMarking

List of all members.

Public Slots

virtual void mousePressLeftButton (QMouseEvent *e, QPainter *p, QWidget *w)
virtual void mouseReleaseLeftButton (QMouseEvent *e, QPainter *p, QWidget *w)
virtual void mouseMoveWithPressedLeftButton (QMouseEvent *e, QPainter *p, QWidget *w)
virtual void repaint (QPainter &p, QWidget *w)
virtual void setSelectedRegion (QRegion r)
virtual void clearWorkOperators ()
virtual void clearSelectedOperators ()
virtual void addWorkOperators (const std::vector< boost::shared_ptr< PdfOperator > > &wOps)
virtual void addSelectedOperators (const std::vector< boost::shared_ptr< PdfOperator > > &sOps)

Public Member Functions

 PageViewMode_TextSelection (const QString &drawingObject, const QString &_scriptFncAtMouseRelease, const QString &_scriptFncAtMoveSelectedObjects, const QString &_scriptFncAtResizeSelectedObjects)

Protected Member Functions

virtual void setMappingCursor ()
virtual void reorderSelectedOp ()
void updateSelection (const BBoxOfObjectOnPage< boost::shared_ptr< PdfOperator > > *first, const BBoxOfObjectOnPage< boost::shared_ptr< PdfOperator > > *last, QRegion *selOpsRegion=NULL, std::vector< boost::shared_ptr< PdfOperator > > *selOps=NULL)
const BBoxOfObjectOnPage
< boost::shared_ptr
< PdfOperator > > * 
getNearestObject (const QPoint &point)

Protected Attributes

Rect2DArray< boost::shared_ptr
< PdfOperator > > 
arrayOfBBoxes
const BBoxOfObjectOnPage
< boost::shared_ptr
< PdfOperator > > * 
firstSelectedObject
const BBoxOfObjectOnPage
< boost::shared_ptr
< PdfOperator > > * 
lastSelectedObject

Detailed Description

Class is STRATEGY pattern for mode construction. Includes method for selecting objects on page and manipulating with him.

This implementation is for standard way to selecting text (line by line).


Constructor & Destructor Documentation

gui::PageViewMode_TextSelection::PageViewMode_TextSelection ( const QString &  drawingObject,
const QString &  _scriptFncAtMouseRelease,
const QString &  _scriptFncAtMoveSelectedObjects,
const QString &  _scriptFncAtResizeSelectedObjects 
)

Standard constructor.

Parameters:
drawingObject Text definition of drawing method (see DrawingObjectFactory)
_scriptFncAtMouseRelease Script command for call after selected object(s)
_scriptFncAtMoveSelectedObjects Script command for call after move selected object(s)
_scriptFncAtResizeSelectedObjects Script command for call after resize selected object(s)

References setMappingCursor().


Member Function Documentation

void gui::PageViewMode_TextSelection::addSelectedOperators ( const std::vector< boost::shared_ptr< PdfOperator > > &  sOps  )  [virtual, slot]

Add operators selected on the page.

Parameters:
sOps Vector of operators.

Method filter only text operator.

Reimplemented from gui::PageViewMode.

Reimplemented in gui::PageViewMode_TextMarking.

References iterator::DoubleListIterator< Item >::getCurrent(), iterator::DoubleListIterator< Item >::isEnd(), gui::PageViewMode::isMoving, gui::PageViewMode::isPressedLeftButton, and gui::PageViewMode::isResizing.

void gui::PageViewMode_TextSelection::addWorkOperators ( const std::vector< boost::shared_ptr< PdfOperator > > &  wOps  )  [virtual, slot]
void gui::PageViewMode_TextSelection::clearSelectedOperators (  )  [virtual, slot]

Clear all operators which are selected on the page.

Reimplemented from gui::PageViewMode.

References firstSelectedObject, and lastSelectedObject.

Referenced by gui::PageViewMode_TextMarking::mouseReleaseLeftButton().

void gui::PageViewMode_TextSelection::clearWorkOperators (  )  [virtual, slot]

Clear all operators which can be possible select on the page.

Reimplemented from gui::PageViewMode.

References arrayOfBBoxes, gui::PageViewMode::isMoving, gui::PageViewMode::isPressedLeftButton, and gui::PageViewMode::isResizing.

const BBoxOfObjectOnPage< boost::shared_ptr< PdfOperator > > * gui::PageViewMode_TextSelection::getNearestObject ( const QPoint &  point  )  [protected]

Method return the nearest text operator to point on the page.

Parameters:
point Point on the page.
Returns:
Return pointer to the nearest text operators to point point. If point is not inside any text operator, return NULL.

References arrayOfBBoxes, gui::RectArray< T >::getMaxY(), and gui::RectArray< T >::getMinY().

Referenced by mousePressLeftButton().

void gui::PageViewMode_TextSelection::mouseMoveWithPressedLeftButton ( QMouseEvent *  e,
QPainter *  p,
QWidget *  w 
) [virtual, slot]

Method is calling if is press left mouse button and is moving with mouse.

Parameters:
e Pointer to mouse event (see Qt::QMouseEvent).
p Pointer to initialized painter for draw changes (see Qt::QPainter). Method emit at end 'needRepaint' if p is NULL.
w Pointer to widget (see Qt::QWidget). E.g. for change mouse cursor above operators.
See also:
updateSelection
PageViewMode::mousePressEvent

If is selecting action (mousePressLeftButton find and select one text operator), method find the nearest text operator to mouse cursor and select all text operator from first selected text operator to it respecting word and line order.

Reimplemented from gui::PageViewMode.

References gui::PageViewMode::drawingObject, firstSelectedObject, gui::BBoxOfObjectOnPage< T >::getDownBBox(), gui::BBoxOfObjectOnPage< T >::getFirstBBox(), gui::BBoxOfObjectOnPage< T >::getLastBBox(), gui::BBoxOfObjectOnPage< T >::getLeftBBox(), gui::BBoxOfObjectOnPage< T >::getNextLineFirstBBox(), gui::BBoxOfObjectOnPage< T >::getPrevLineLastBBox(), gui::BBoxOfObjectOnPage< T >::getRightBBox(), gui::BBoxOfObjectOnPage< T >::getUpBBox(), lastSelectedObject, gui::PageViewMode::mouseSelectedRegion, gui::PageViewMode::needRepaint(), and updateSelection().

void gui::PageViewMode_TextSelection::mousePressLeftButton ( QMouseEvent *  e,
QPainter *  p,
QWidget *  w 
) [virtual, slot]

Method is calling if is release left mouse button.

Parameters:
e Pointer to mouse event (see Qt::QMouseEvent).
p Pointer to initialized painter for draw changes (see Qt::QPainter). Method emit at end 'needRepaint' if p is NULL.
w Pointer to widget (see Qt::QWidget). E.g. for change mouse cursor above operators.
See also:
mousePressLeftButton
PageViewMode::mousePressEvent

Method find the nearest text operator below mouse cursor. If cursor is not over text operator, nothing do.

Reimplemented from gui::PageViewMode.

References gui::PageViewMode::drawingObject, firstSelectedObject, getNearestObject(), gui::PageViewMode::isPressedLeftButton, lastSelectedObject, gui::PageViewMode::mouseSelectedRegion, gui::PageViewMode::needRepaint(), gui::PageViewMode::selectedOpRegion, and gui::PageViewMode::workOpRegion.

void gui::PageViewMode_TextSelection::mouseReleaseLeftButton ( QMouseEvent *  e,
QPainter *  p,
QWidget *  w 
) [virtual, slot]

Method is calling if is release left mouse button.

Parameters:
e Pointer to mouse event (see Qt::QMouseEvent).
p Pointer to initialized painter for draw changes (see Qt::QPainter). Method emit at end 'needRepaint' if p is NULL.
w Pointer to widget (see Qt::QWidget). E.g. for change mouse cursor above operators.
See also:
mousePressLeftButton
PageViewMode::mousePressEvent

Method end selection text.

Reimplemented from gui::PageViewMode.

Reimplemented in gui::PageViewMode_TextMarking.

References gui::PageViewMode::drawingObject, firstSelectedObject, lastSelectedObject, gui::PageViewMode::mouseSelectedRegion, gui::PageViewMode::needRepaint(), gui::PageViewMode::newSelectedOperators(), reorderSelectedOp(), gui::PageViewMode::selectedOperators, gui::PageViewMode::selectedOpRegion, and updateSelection().

void gui::PageViewMode_TextSelection::reorderSelectedOp (  )  [protected, virtual]

Method reorder selected operators to order by from top to bottom and from left to right on the line.

References firstSelectedObject, lastSelectedObject, and gui::PageViewMode::selectedOperators.

Referenced by mouseReleaseLeftButton().

void gui::PageViewMode_TextSelection::repaint ( QPainter &  p,
QWidget *  w 
) [virtual, slot]

Repaint method for draw actual state of mode (selected region, moving and resizing in action, ...).

Parameters:
p Pointer to initialized painter for draw changes (see Qt::QPainter). Method emit at end 'needRepaint' if p is NULL.
w Pointer to widget (see Qt::QWidget). E.g. for change mouse cursor above operators.

It is only drawing method use, if viewing parent need clear repaint.

Reimplemented from gui::PageViewMode.

References gui::PageViewMode::drawingObject, gui::PageViewMode::isMoving, gui::PageViewMode::isPressedLeftButton, gui::PageViewMode::isResizing, and gui::PageViewMode::mouseSelectedRegion.

void gui::PageViewMode_TextSelection::setMappingCursor (  )  [protected, virtual]

Set mapping cursors for viewing on the page for actual selection mode

Reimplemented from gui::PageViewMode.

Reimplemented in gui::PageViewMode_TextMarking.

References gui::PageViewMode::mappingResizingModeToCursor, and gui::PageViewMode::onUnselectedObject.

Referenced by PageViewMode_TextSelection().

void gui::PageViewMode_TextSelection::setSelectedRegion ( QRegion  r  )  [virtual, slot]

Set selection region on the page.

Parameters:
r Which region to set.

Reimplemented from gui::PageViewMode.

void gui::PageViewMode_TextSelection::updateSelection ( const BBoxOfObjectOnPage< boost::shared_ptr< PdfOperator > > *  first,
const BBoxOfObjectOnPage< boost::shared_ptr< PdfOperator > > *  last,
QRegion *  selOpsRegion = NULL,
std::vector< boost::shared_ptr< PdfOperator > > *  selOps = NULL 
) [protected]

Method update selected operators and add new or remove operators from vector of selected operators.

Parameters:
first First selected operator (pointer to sorted structure by line and word on line)
last Last selected operator (pointer to sorted structure by line and word on line)
selOpsRegion Bounding region of all selected operators.
selOps Vector of selected operators.

Method find the nearest text operator to mouse cursor and select all text operator from first selected text operator to it respecting word and line order. New selected operators add to selOps. Removed selected operators remove from that. Actualize selOpsRegion by selOps.

References gui::PageViewMode::getBBox(), gui::BBoxOfObjectOnPage< T >::getLeftBBox(), gui::BBoxOfObjectOnPage< T >::getNextLineFirstBBox(), gui::BBoxOfObjectOnPage< T >::getObject(), gui::BBoxOfObjectOnPage< T >::getPrevLineLastBBox(), and gui::BBoxOfObjectOnPage< T >::getRightBBox().

Referenced by mouseMoveWithPressedLeftButton(), and mouseReleaseLeftButton().


Member Data Documentation

2D array of bboxes objects for special selection

Referenced by addWorkOperators(), clearWorkOperators(), and getNearestObject().


The documentation for this class was generated from the following files: