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

A sub-controller that handles page selection of the slide browser. More...

#include <SlsPageSelector.hxx>

Collaboration diagram for sd::slidesorter::controller::PageSelector:
[legend]

Classes

class  BroadcastLock
 
class  UpdateLock
 Use the UpdateLock whenever you do a complex selection, i.e. More...
 

Public Types

typedef ::std::vector< SdPage * > PageSelection
 

Public Member Functions

 PageSelector (SlideSorter &rSlideSorter)
 
 PageSelector (const PageSelector &)=delete
 
PageSelectoroperator= (const PageSelector &)=delete
 
SD_DLLPUBLIC void SelectAllPages ()
 
SD_DLLPUBLIC void DeselectAllPages ()
 
void GetCoreSelection ()
 Update the selection state of all page descriptors to be the same as that of the corresponding pages of the SdPage objects and issue redraw requests where necessary. More...
 
void SetCoreSelection ()
 Update the selection state of the SdPage objects to be the same as that of the corresponding page descriptors. More...
 
void SelectPage (int nPageIndex)
 Select the specified descriptor. More...
 
void SelectPage (const SdPage *pPage)
 Select the descriptor that is associated with the given page. More...
 
void SelectPage (const model::SharedPageDescriptor &rpDescriptor)
 Select the specified descriptor. More...
 
SD_DLLPUBLIC bool IsPageSelected (int nPageIndex)
 Return whether the specified page is selected. More...
 
SD_DLLPUBLIC bool IsPageExcluded (int nPageIndex)
 Return whether the specified page is excluded. More...
 
void DeselectPage (int nPageIndex)
 Deselect the descriptor that is associated with the given page. More...
 
void DeselectPage (const model::SharedPageDescriptor &rpDescriptor, const bool bUpdateCurrentPage=true)
 
int GetPageCount () const
 This convenience method returns the same number of pages that SlideSorterModel.GetPageCount() returns. More...
 
int GetSelectedPageCount () const
 
const model::SharedPageDescriptorGetSelectionAnchor () const
 Return the anchor for a range selection. More...
 
std::shared_ptr< PageSelectionGetPageSelection () const
 Return an object that describes the current selection. More...
 
void SetPageSelection (const std::shared_ptr< PageSelection > &rSelection, const bool bUpdateCurrentPage)
 Restore a page selection according to the given selection object. More...
 
void CountSelectedPages ()
 Call this method after the model has changed to set the number of selected pages. More...
 

Private Member Functions

void EnableBroadcasting ()
 Enable the broadcasting of selection change events. More...
 
void DisableBroadcasting ()
 Disable the broadcasting of selection change events. More...
 
void UpdateCurrentPage (const bool bUpdateOnlyWhenPending=false)
 
void CheckConsistency () const
 

Private Attributes

model::SlideSorterModelmrModel
 
SlideSortermrSlideSorter
 
SlideSorterControllermrController
 
int mnSelectedPageCount
 
int mnBroadcastDisableLevel
 
bool mbSelectionChangeBroadcastPending
 
model::SharedPageDescriptor mpMostRecentlySelectedPage
 
model::SharedPageDescriptor mpSelectionAnchor
 Anchor for a range selection. More...
 
sal_Int32 mnUpdateLockCount
 
bool mbIsUpdateCurrentPagePending
 

Detailed Description

A sub-controller that handles page selection of the slide browser.

Selecting a page does not make it the current page (of the main view) automatically as this would not be desired in a multi selection. This has to be done explicitly by calling the CurrentSlideManager::SetCurrentSlide() method.

Indices of pages relate always to the number of all pages in the model (as returned by GetPageCount()) not just the selected pages.

Definition at line 53 of file SlsPageSelector.hxx.

Member Typedef Documentation

◆ PageSelection

Definition at line 125 of file SlsPageSelector.hxx.

Constructor & Destructor Documentation

◆ PageSelector() [1/2]

sd::slidesorter::controller::PageSelector::PageSelector ( SlideSorter rSlideSorter)
explicit

Definition at line 44 of file SlsPageSelector.cxx.

References CountSelectedPages(), GetController(), and mrModel.

◆ PageSelector() [2/2]

sd::slidesorter::controller::PageSelector::PageSelector ( const PageSelector )
delete

Member Function Documentation

◆ CheckConsistency()

void sd::slidesorter::controller::PageSelector::CheckConsistency ( ) const
private

◆ CountSelectedPages()

void sd::slidesorter::controller::PageSelector::CountSelectedPages ( )

◆ DeselectAllPages()

void sd::slidesorter::controller::PageSelector::DeselectAllPages ( )

◆ DeselectPage() [1/2]

void sd::slidesorter::controller::PageSelector::DeselectPage ( const model::SharedPageDescriptor rpDescriptor,
const bool  bUpdateCurrentPage = true 
)

◆ DeselectPage() [2/2]

void sd::slidesorter::controller::PageSelector::DeselectPage ( int  nPageIndex)

Deselect the descriptor that is associated with the given page.

The current page is updated to the first slide of the remaining selection.

Definition at line 162 of file SlsPageSelector.cxx.

References DeselectPage(), sd::slidesorter::model::SlideSorterModel::GetPageDescriptor(), and mrModel.

Referenced by accessibility::AccessibleSlideSorterView::deselectAccessibleChild(), DeselectAllPages(), DeselectPage(), sd::slidesorter::controller::SelectionFunction::KeyInput(), and sd::slidesorter::controller::SelectionFunction::MoveFocus().

◆ DisableBroadcasting()

void sd::slidesorter::controller::PageSelector::DisableBroadcasting ( )
private

Disable the broadcasting of selection change events.

Subsequent changes of the selection will set a flag that triggers the sending of events when EnableBroadcasting() is called.

Definition at line 258 of file SlsPageSelector.cxx.

References mnBroadcastDisableLevel.

Referenced by sd::slidesorter::controller::PageSelector::BroadcastLock::BroadcastLock().

◆ EnableBroadcasting()

void sd::slidesorter::controller::PageSelector::EnableBroadcasting ( )
private

Enable the broadcasting of selection change events.

This calls the SlideSorterController::SelectionHasChanged() method to do the actual work. When EnableBroadcasting has been called as many times as DisableBroadcasting() was called before and the selection has been changed in the meantime, this change will be broadcasted.

Definition at line 247 of file SlsPageSelector.cxx.

References sd::slidesorter::controller::SlideSorterController::GetSelectionManager(), mbSelectionChangeBroadcastPending, mnBroadcastDisableLevel, and mrController.

◆ GetCoreSelection()

void sd::slidesorter::controller::PageSelector::GetCoreSelection ( )

◆ GetPageCount()

int sd::slidesorter::controller::PageSelector::GetPageCount ( ) const

This convenience method returns the same number of pages that SlideSorterModel.GetPageCount() returns.

It is included here so that it is self contained for iterating over all pages to select or deselect them.

Definition at line 230 of file SlsPageSelector.cxx.

References sd::slidesorter::model::SlideSorterModel::GetPageCount(), and mrModel.

Referenced by sd::slidesorter::controller::SelectionObserver::EndObservation(), sd::slidesorter::controller::SlotManager::GetClipboardState(), sd::slidesorter::controller::SlotManager::GetInsertionPosition(), GetPageSelection(), accessibility::AccessibleSlideSorterView::getSelectedAccessibleChild(), and UpdateCurrentPage().

◆ GetPageSelection()

std::shared_ptr< PageSelector::PageSelection > sd::slidesorter::controller::PageSelector::GetPageSelection ( ) const

Return an object that describes the current selection.

The caller can use that object to later restore the selection.

Returns
The object returned describes the selection via indices. So even if pages are exchanged a later call to SetPageSelection() is valid.

Definition at line 263 of file SlsPageSelector.cxx.

References GetPageCount(), sd::slidesorter::model::SlideSorterModel::GetPageDescriptor(), GetSelectedPageCount(), mrModel, and nIndex.

Referenced by UpdateCurrentPage().

◆ GetSelectedPageCount()

int sd::slidesorter::controller::PageSelector::GetSelectedPageCount ( ) const
inline

◆ GetSelectionAnchor()

const model::SharedPageDescriptor & sd::slidesorter::controller::PageSelector::GetSelectionAnchor ( ) const
inline

Return the anchor for a range selection.

This usually is the first selected page after all pages have been deselected.

Returns
The returned anchor may be NULL.

Definition at line 123 of file SlsPageSelector.hxx.

References mpSelectionAnchor.

◆ IsPageExcluded()

bool sd::slidesorter::controller::PageSelector::IsPageExcluded ( int  nPageIndex)

Return whether the specified page is excluded.

This convenience method is a substitute for SlideSorterModel::GetPageDescriptor(i)->HasState(ST_Excluded) is included here to make this class more self contained.

Definition at line 221 of file SlsPageSelector.cxx.

References sd::slidesorter::model::SlideSorterModel::GetPageDescriptor(), and mrModel.

◆ IsPageSelected()

bool sd::slidesorter::controller::PageSelector::IsPageSelected ( int  nPageIndex)

Return whether the specified page is selected.

This convenience method is a substitute for SlideSorterModel::GetPageDescriptor(i)->HasState(ST_Selected) is included here to make this class more self contained.

Definition at line 212 of file SlsPageSelector.cxx.

References sd::slidesorter::model::SlideSorterModel::GetPageDescriptor(), and mrModel.

Referenced by accessibility::AccessibleSlideSorterObject::getAccessibleStateSet(), sd::slidesorter::controller::SlotManager::GetInsertionPosition(), accessibility::AccessibleSlideSorterView::getSelectedAccessibleChild(), and accessibility::AccessibleSlideSorterView::isAccessibleChildSelected().

◆ operator=()

PageSelector & sd::slidesorter::controller::PageSelector::operator= ( const PageSelector )
delete

◆ SelectAllPages()

void sd::slidesorter::controller::PageSelector::SelectAllPages ( )

◆ SelectPage() [1/3]

void sd::slidesorter::controller::PageSelector::SelectPage ( const model::SharedPageDescriptor rpDescriptor)

Select the specified descriptor.

The selection state of the other descriptors is not affected.

◆ SelectPage() [2/3]

void sd::slidesorter::controller::PageSelector::SelectPage ( const SdPage pPage)

Select the descriptor that is associated with the given page.

The selection state of the other descriptors is not affected.

Definition at line 131 of file SlsPageSelector.cxx.

References sd::slidesorter::model::SlideSorterModel::GetIndex(), sd::slidesorter::model::SlideSorterModel::GetPageDescriptor(), mrModel, and SelectPage().

◆ SelectPage() [3/3]

void sd::slidesorter::controller::PageSelector::SelectPage ( int  nPageIndex)

◆ SetCoreSelection()

void sd::slidesorter::controller::PageSelector::SetCoreSelection ( )

Update the selection state of the SdPage objects to be the same as that of the corresponding page descriptors.

Definition at line 113 of file SlsPageSelector.cxx.

References sd::slidesorter::model::PageEnumerationProvider::CreateAllPagesEnumeration(), sd::slidesorter::model::PageEnumeration::GetNextElement(), sd::slidesorter::model::PageEnumeration::HasMoreElements(), and mrModel.

◆ SetPageSelection()

void sd::slidesorter::controller::PageSelector::SetPageSelection ( const std::shared_ptr< PageSelection > &  rSelection,
const bool  bUpdateCurrentPage 
)

Restore a page selection according to the given selection object.

Parameters
rSelectionTypically obtained by calling GetPageSelection() this object is used to restore the selection. If pages were exchanged since the last call to GetPageSelection() it is still valid to call this method with the selection. When pages have been inserted or removed the result may be unexpected.
bUpdateCurrentPageWhen <TRUE> (the default value) then after setting the selection update the current page to the first page of the selection. When called from within UpdateCurrentPage() then this flag is used to prevent a recursion loop.

Definition at line 279 of file SlsPageSelector.cxx.

References SelectPage(), and UpdateCurrentPage().

Referenced by UpdateCurrentPage().

◆ UpdateCurrentPage()

void sd::slidesorter::controller::PageSelector::UpdateCurrentPage ( const bool  bUpdateOnlyWhenPending = false)
private

Member Data Documentation

◆ mbIsUpdateCurrentPagePending

bool sd::slidesorter::controller::PageSelector::mbIsUpdateCurrentPagePending
private

Definition at line 196 of file SlsPageSelector.hxx.

Referenced by UpdateCurrentPage().

◆ mbSelectionChangeBroadcastPending

bool sd::slidesorter::controller::PageSelector::mbSelectionChangeBroadcastPending
private

Definition at line 191 of file SlsPageSelector.hxx.

Referenced by EnableBroadcasting(), and GetCoreSelection().

◆ mnBroadcastDisableLevel

int sd::slidesorter::controller::PageSelector::mnBroadcastDisableLevel
private

Definition at line 190 of file SlsPageSelector.hxx.

Referenced by DisableBroadcasting(), EnableBroadcasting(), and GetCoreSelection().

◆ mnSelectedPageCount

int sd::slidesorter::controller::PageSelector::mnSelectedPageCount
private

◆ mnUpdateLockCount

sal_Int32 sd::slidesorter::controller::PageSelector::mnUpdateLockCount
private

◆ mpMostRecentlySelectedPage

model::SharedPageDescriptor sd::slidesorter::controller::PageSelector::mpMostRecentlySelectedPage
private

Definition at line 192 of file SlsPageSelector.hxx.

◆ mpSelectionAnchor

model::SharedPageDescriptor sd::slidesorter::controller::PageSelector::mpSelectionAnchor
private

Anchor for a range selection.

Definition at line 194 of file SlsPageSelector.hxx.

Referenced by DeselectAllPages(), and GetSelectionAnchor().

◆ mrController

SlideSorterController& sd::slidesorter::controller::PageSelector::mrController
private

Definition at line 188 of file SlsPageSelector.hxx.

Referenced by EnableBroadcasting(), GetCoreSelection(), and UpdateCurrentPage().

◆ mrModel

model::SlideSorterModel& sd::slidesorter::controller::PageSelector::mrModel
private

◆ mrSlideSorter

SlideSorter& sd::slidesorter::controller::PageSelector::mrSlideSorter
private

Definition at line 187 of file SlsPageSelector.hxx.

Referenced by DeselectAllPages(), GetCoreSelection(), and SelectAllPages().


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