LibreOffice Module sd (master) 1
Classes | Public Types | Public Member Functions | Private Attributes | List of all members
sd::slidesorter::view::Layouter Class Reference

Calculate the size and position of page objects displayed by a slide sorter. More...

#include <SlsLayouter.hxx>

Collaboration diagram for sd::slidesorter::view::Layouter:
[legend]

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< ImplementationmpImplementation
 
VclPtr< sd::WindowmpWindow
 

Detailed Description

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.

Member Enumeration Documentation

◆ Orientation

Enumerator
HORIZONTAL 
VERTICAL 
GRID 

Definition at line 62 of file SlsLayouter.hxx.

Constructor & Destructor Documentation

◆ Layouter()

sd::slidesorter::view::Layouter::Layouter ( sd::Window rpWindow,
const std::shared_ptr< Theme > &  rpTheme 
)

Definition at line 295 of file SlsLayouter.cxx.

References mpWindow.

◆ ~Layouter()

sd::slidesorter::view::Layouter::~Layouter ( )

Definition at line 303 of file SlsLayouter.cxx.

Member Function Documentation

◆ GetColumnCount()

sal_Int32 sd::slidesorter::view::Layouter::GetColumnCount ( ) const

◆ GetIndex()

sal_Int32 sd::slidesorter::view::Layouter::GetIndex ( const sal_Int32  nRow,
const sal_Int32  nColumn 
) const

◆ GetIndexAtPoint()

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.

Parameters
rPositionThe position is expected to be in model coordinates relative to the page origin.
bIncludePageBordersWhen <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.
bClampToValidRangeWhen <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.
Returns
The returned index may be larger than the number of existing page objects.

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().

◆ GetInsertPosition()

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.

Parameters
rModelPositionThe 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.
rIndicatorSizeThe 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.
rModelThe 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().

◆ GetPageObjectBox()

tools::Rectangle sd::slidesorter::view::Layouter::GetPageObjectBox ( const sal_Int32  nIndex,
const bool  bIncludeBorderAndGap 
) const

◆ GetPageObjectLayouter()

std::shared_ptr< PageObjectLayouter > const & sd::slidesorter::view::Layouter::GetPageObjectLayouter ( ) const

◆ GetPageObjectSize()

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().

◆ GetRangeOfVisiblePageObjects()

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.

Returns
The second index may be larger than the number of existing page objects.

Definition at line 391 of file SlsLayouter.cxx.

References mpImplementation.

◆ GetTotalBoundingBox()

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().

◆ GetValidHorizontalSizeRange()

Range sd::slidesorter::view::Layouter::GetValidHorizontalSizeRange ( ) const

Definition at line 381 of file SlsLayouter.cxx.

References mpImplementation.

◆ GetValidVerticalSizeRange()

Range sd::slidesorter::view::Layouter::GetValidVerticalSizeRange ( ) const

Definition at line 386 of file SlsLayouter.cxx.

References mpImplementation.

◆ Rearrange()

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.

Parameters
eOrientationThis defines the generally layout and specifies whether there may be more than one row or more than one column.
rWindowSizeThe 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.
rPreviewModelSizeSize of each page in model coordinates.
rpWindowThe map mode of this window is adapted to the new layout of the page objects.
Returns
The return value indicates whether the Get... methods can be used to obtain valid values (<TRUE>).

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().

◆ SetColumnCount()

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.

Parameters
nMinimalColumnCountThe default value is 1. The question whether higher values make any sense is left to the caller.
nMaximalColumnCountThe 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().

Member Data Documentation

◆ mpImplementation

std::unique_ptr<Implementation> sd::slidesorter::view::Layouter::mpImplementation
private

◆ mpWindow

VclPtr<sd::Window> sd::slidesorter::view::Layouter::mpWindow
private

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