LibreOffice Module sd (master) 1
|
Calculate the size and position of page objects displayed by a slide sorter. More...
#include <SlsLayouter.hxx>
Classes | |
class | Implementation |
Public Types | |
enum | Orientation { HORIZONTAL , VERTICAL , GRID } |
Public Member Functions | |
Layouter (sd::Window *rpWindow, const std::shared_ptr< Theme > &rpTheme) | |
~Layouter () | |
std::shared_ptr< PageObjectLayouter > const & | GetPageObjectLayouter () const |
void | SetColumnCount (sal_Int32 nMinimalColumnCount, sal_Int32 nMaximalColumnCount) |
Set the interval of valid column counts. More... | |
bool | Rearrange (const Orientation eOrientation, const Size &rWindowSize, const Size &rPreviewModelSize, const sal_uInt32 nPageCount) |
Central method of this class. More... | |
sal_Int32 | GetColumnCount () const |
Return the number of columns. More... | |
sal_Int32 | GetIndex (const sal_Int32 nRow, const sal_Int32 nColumn) const |
Size const & | GetPageObjectSize () const |
::tools::Rectangle | GetPageObjectBox (const sal_Int32 nIndex, const bool bIncludeBorderAndGap) const |
Return the bounding box in window coordinates of the nIndex-th page object. More... | |
::tools::Rectangle | GetTotalBoundingBox () const |
Return the bounding box in model coordinates of the page that contains the given amount of page objects. More... | |
Range | GetRangeOfVisiblePageObjects (const ::tools::Rectangle &rVisibleArea) const |
Return the index of the first fully or partially visible page object. More... | |
sal_Int32 | GetIndexAtPoint (const Point &rModelPosition, const bool bIncludePageBorders, const bool bClampToValidRange=true) const |
Return the index of the page object that is rendered at the given point. More... | |
InsertPosition | GetInsertPosition (const Point &rModelPosition, const Size &rIndicatorSize, model::SlideSorterModel const &rModel) const |
Return an object that describes the logical and visual properties of where to do an insert operation when the user would release the mouse button at the given position after a drag operation and of where and how to display an insertion indicator. More... | |
Range | GetValidHorizontalSizeRange () const |
Range | GetValidVerticalSizeRange () const |
Private Attributes | |
std::unique_ptr< Implementation > | mpImplementation |
VclPtr< sd::Window > | mpWindow |
Calculate the size and position of page objects displayed by a slide sorter.
The layouter takes into account various input values: 1.) Size of the window in which the slide sorter is displayed. 2.) Desired and minimal and maximal widths of page objects. 3.) Minimal and maximal number of columns. 4.) Vertical and horizontal gaps between objects in adjacent columns. 5.) Borders around every page object. 6.) Vertical and horizontal borders between enclosing page and outer page objects. From these, it calculates various output values: 1.) The width of page objects. 2.) The number of columns. 3.) The size of the enclosing page.
Sizes and lengths are all in pixel except where explicitly stated otherwise.
The GetIndex... methods may return indices that are larger than or equal to (zero based) the number of pages. This is so because the number of pages is not known to the class instances. Indices are calculated with reference to the general grid layout of page objects.
Definition at line 59 of file SlsLayouter.hxx.
Enumerator | |
---|---|
HORIZONTAL | |
VERTICAL | |
GRID |
Definition at line 62 of file SlsLayouter.hxx.
sd::slidesorter::view::Layouter::Layouter | ( | sd::Window * | rpWindow, |
const std::shared_ptr< Theme > & | rpTheme | ||
) |
Definition at line 295 of file SlsLayouter.cxx.
References mpWindow.
sd::slidesorter::view::Layouter::~Layouter | ( | ) |
Definition at line 303 of file SlsLayouter.cxx.
sal_Int32 sd::slidesorter::view::Layouter::GetColumnCount | ( | ) | const |
Return the number of columns.
Definition at line 337 of file SlsLayouter.cxx.
References mpImplementation.
Referenced by sd::slidesorter::controller::SlotManager::GetAttrState(), GetInsertPosition(), sd::slidesorter::view::InsertAnimator::Implementation::GetRun(), sd::slidesorter::controller::FocusManager::MoveFocus(), and sd::slidesorter::SlideSorterViewShell::WriteFrameViewData().
sal_Int32 sd::slidesorter::view::Layouter::GetIndex | ( | const sal_Int32 | nRow, |
const sal_Int32 | nColumn | ||
) | const |
Definition at line 342 of file SlsLayouter.cxx.
References mpImplementation.
Referenced by sd::slidesorter::view::Layouter::Implementation::GetRangeOfVisiblePageObjects(), and sd::slidesorter::view::InsertAnimator::Implementation::GetRun().
sal_Int32 sd::slidesorter::view::Layouter::GetIndexAtPoint | ( | const Point & | rModelPosition, |
const bool | bIncludePageBorders, | ||
const bool | bClampToValidRange = true |
||
) | const |
Return the index of the page object that is rendered at the given point.
rPosition | The position is expected to be in model coordinates relative to the page origin. |
bIncludePageBorders | When <TRUE> then include the page borders into the calculation, i.e. when a point lies in the border of a page object but not on the actual page area the index of that page is returned; otherwise -1 would be returned to indicate that no page object has been hit. |
bClampToValidRange | When <TRUE> then values outside the valid range [0,mnPageCount) are mapped to 0 (when smaller than 0) or mnPageCount-1 when equal to or larger than mnPageCount. When <FALSE> then -1 is returned for values outside the valid range. |
Definition at line 396 of file SlsLayouter.cxx.
References sd::slidesorter::view::Layouter::Implementation::GM_NONE, sd::slidesorter::view::Layouter::Implementation::GM_PAGE_BORDER, mpImplementation, Point::X(), and Point::Y().
Referenced by sd::slidesorter::controller::ScrollBarManager::Scroll().
InsertPosition sd::slidesorter::view::Layouter::GetInsertPosition | ( | const Point & | rModelPosition, |
const Size & | rIndicatorSize, | ||
model::SlideSorterModel const & | rModel | ||
) | const |
Return an object that describes the logical and visual properties of where to do an insert operation when the user would release the mouse button at the given position after a drag operation and of where and how to display an insertion indicator.
rModelPosition | The position in the model coordinate system for which to determine the insertion page index. The position does not have to be over a page object to return a valid value. |
rIndicatorSize | The size of the insertion indicator. This size is used to adapt the location when at the left or right of a row or at the top or bottom of a column. |
rModel | The model is used to get access to the selection states of the pages. This in turn is used to determine the visual bounding boxes. |
Definition at line 364 of file SlsLayouter.cxx.
References GetColumnCount(), and mpImplementation.
Referenced by sd::slidesorter::controller::InsertionIndicatorHandler::SetPosition().
tools::Rectangle sd::slidesorter::view::Layouter::GetPageObjectBox | ( | const sal_Int32 | nIndex, |
const bool | bIncludeBorderAndGap | ||
) | const |
Return the bounding box in window coordinates of the nIndex-th page object.
Definition at line 352 of file SlsLayouter.cxx.
References mpImplementation, and nIndex.
Referenced by sd::slidesorter::view::Layouter::Implementation::CalculateGeometricPosition(), sd::slidesorter::view::Layouter::Implementation::GetPageObjectBox(), sd::slidesorter::controller::VisibleAreaManager::RequestVisible(), and sd::slidesorter::controller::ScrollBarManager::Scroll().
std::shared_ptr< PageObjectLayouter > const & sd::slidesorter::view::Layouter::GetPageObjectLayouter | ( | ) | const |
Definition at line 307 of file SlsLayouter.cxx.
References mpImplementation.
Referenced by sd::slidesorter::controller::SlideSorterController::Command(), sd::slidesorter::view::InsertionIndicatorOverlay::Create(), sd::slidesorter::view::ToolTip::DoShow(), accessibility::AccessibleSlideSorterObject::getBounds(), sd::slidesorter::controller::SlideSorterController::GetPageAt(), sd::slidesorter::view::PageObjectPainter::GetPreviewBitmap(), sd::slidesorter::view::PageObjectPainter::PaintPageObject(), and sd::slidesorter::view::PageObjectPainter::UpdatePageObjectLayouter().
Size const & sd::slidesorter::view::Layouter::GetPageObjectSize | ( | ) | const |
Definition at line 347 of file SlsLayouter.cxx.
References mpImplementation.
Referenced by sd::slidesorter::controller::ScrollBarManager::Scroll().
Range sd::slidesorter::view::Layouter::GetRangeOfVisiblePageObjects | ( | const ::tools::Rectangle & | rVisibleArea | ) | const |
Return the index of the first fully or partially visible page object.
This takes into account only the vertical dimension.
Definition at line 391 of file SlsLayouter.cxx.
References mpImplementation.
tools::Rectangle sd::slidesorter::view::Layouter::GetTotalBoundingBox | ( | ) | const |
Return the bounding box in model coordinates of the page that contains the given amount of page objects.
Definition at line 359 of file SlsLayouter.cxx.
References mpImplementation.
Referenced by sd::slidesorter::controller::ScrollBarManager::TestScrollBarVisibilities().
Range sd::slidesorter::view::Layouter::GetValidHorizontalSizeRange | ( | ) | const |
Definition at line 381 of file SlsLayouter.cxx.
References mpImplementation.
Range sd::slidesorter::view::Layouter::GetValidVerticalSizeRange | ( | ) | const |
Definition at line 386 of file SlsLayouter.cxx.
References mpImplementation.
bool sd::slidesorter::view::Layouter::Rearrange | ( | const Orientation | eOrientation, |
const Size & | rWindowSize, | ||
const Size & | rPreviewModelSize, | ||
const sal_uInt32 | nPageCount | ||
) |
Central method of this class.
It takes the input values and calculates the output values. Both given sizes must not be 0 in any dimension or the call is ignored.
eOrientation | This defines the generally layout and specifies whether there may be more than one row or more than one column. |
rWindowSize | The size of the window in pixels that the slide sorter is displayed in. This can differ from the size of mpWindow during detection of whether or not the scroll bars should be visible. |
rPreviewModelSize | Size of each page in model coordinates. |
rpWindow | The map mode of this window is adapted to the new layout of the page objects. |
Definition at line 323 of file SlsLayouter.cxx.
References sd::slidesorter::view::Layouter::Implementation::Create(), mpImplementation, and mpWindow.
Referenced by sd::slidesorter::controller::ScrollBarManager::TestScrollBarVisibilities().
void sd::slidesorter::view::Layouter::SetColumnCount | ( | sal_Int32 | nMinimalColumnCount, |
sal_Int32 | nMaximalColumnCount | ||
) |
Set the interval of valid column counts.
When nMinimalColumnCount <= nMaximalColumnCount is not fulfilled then the call is ignored.
nMinimalColumnCount | The default value is 1. The question whether higher values make any sense is left to the caller. |
nMaximalColumnCount | The default value is 5. |
Definition at line 312 of file SlsLayouter.cxx.
References mpImplementation.
Referenced by sd::slidesorter::controller::SlotManager::FuTemporary(), and sd::slidesorter::SlideSorterViewShell::ReadFrameViewData().
|
private |
Definition at line 187 of file SlsLayouter.hxx.
Referenced by GetColumnCount(), GetIndex(), GetIndexAtPoint(), GetInsertPosition(), GetPageObjectBox(), GetPageObjectLayouter(), GetPageObjectSize(), GetRangeOfVisiblePageObjects(), GetTotalBoundingBox(), GetValidHorizontalSizeRange(), GetValidVerticalSizeRange(), Rearrange(), and SetColumnCount().
|
private |
Definition at line 188 of file SlsLayouter.hxx.
Referenced by Rearrange(), and sd::slidesorter::view::Layouter::Implementation::Rearrange().