LibreOffice Module sd (master) 1
|
A sub-controller that handles page selection of the slide browser. More...
#include <SlsPageSelector.hxx>
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 | |
PageSelector & | operator= (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::SharedPageDescriptor & | GetSelectionAnchor () const |
Return the anchor for a range selection. More... | |
std::shared_ptr< PageSelection > | GetPageSelection () 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::SlideSorterModel & | mrModel |
SlideSorter & | mrSlideSorter |
SlideSorterController & | mrController |
int | mnSelectedPageCount |
int | mnBroadcastDisableLevel |
bool | mbSelectionChangeBroadcastPending |
model::SharedPageDescriptor | mpMostRecentlySelectedPage |
model::SharedPageDescriptor | mpSelectionAnchor |
Anchor for a range selection. More... | |
sal_Int32 | mnUpdateLockCount |
bool | mbIsUpdateCurrentPagePending |
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.
typedef ::std::vector<SdPage*> sd::slidesorter::controller::PageSelector::PageSelection |
Definition at line 125 of file SlsPageSelector.hxx.
|
explicit |
Definition at line 44 of file SlsPageSelector.cxx.
References CountSelectedPages(), GetController(), and mrModel.
|
delete |
|
private |
Definition at line 192 of file SlsPageSelector.cxx.
References sd::slidesorter::model::SlideSorterModel::GetPageCount(), sd::slidesorter::model::SlideSorterModel::GetPageDescriptor(), mnSelectedPageCount, and mrModel.
void sd::slidesorter::controller::PageSelector::CountSelectedPages | ( | ) |
Call this method after the model has changed to set the number of selected pages.
Definition at line 235 of file SlsPageSelector.cxx.
References sd::slidesorter::model::PageEnumerationProvider::CreateSelectedPagesEnumeration(), sd::slidesorter::model::PageEnumeration::GetNextElement(), sd::slidesorter::model::PageEnumeration::HasMoreElements(), mnSelectedPageCount, and mrModel.
Referenced by sd::slidesorter::controller::SelectionManager::DeleteSelectedPages(), PageSelector(), sd::slidesorter::model::SlideSorterModel::Resync(), and sd::slidesorter::model::SlideSorterModel::SetDocumentSlides().
void sd::slidesorter::controller::PageSelector::DeselectAllPages | ( | ) |
Definition at line 67 of file SlsPageSelector.cxx.
References DBG_ASSERT, DeselectPage(), sd::slidesorter::model::SlideSorterModel::GetPageCount(), mnSelectedPageCount, mpSelectionAnchor, mrModel, and mrSlideSorter.
Referenced by accessibility::AccessibleSlideSorterView::clearAccessibleSelection(), sd::slidesorter::controller::SelectionFunction::ModeHandler::DeselectAllPages(), sd::DrawViewShell::DuplicateSelectedSlides(), sd::slidesorter::controller::SlotManager::DuplicateSelectedSlides(), sd::slidesorter::controller::SelectionObserver::EndObservation(), sd::slidesorter::controller::IMPL_LINK(), sd::slidesorter::controller::SlotManager::InsertSlide(), sd::slidesorter::controller::CurrentSlideManager::NotifyCurrentSlideChange(), sd::framework::ViewShellWrapper::select(), sd::SdUnoSlideView::select(), and sd::slidesorter::controller::Clipboard::SelectPageRange().
void sd::slidesorter::controller::PageSelector::DeselectPage | ( | const model::SharedPageDescriptor & | rpDescriptor, |
const bool | bUpdateCurrentPage = true |
||
) |
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().
|
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().
|
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.
void sd::slidesorter::controller::PageSelector::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.
Definition at line 82 of file SlsPageSelector.cxx.
References sd::slidesorter::model::PageEnumerationProvider::CreateAllPagesEnumeration(), sd::slidesorter::SlideSorter::GetController(), sd::slidesorter::model::PageEnumeration::GetNextElement(), sd::slidesorter::controller::SlideSorterController::GetSelectionManager(), sd::slidesorter::SlideSorter::GetView(), sd::slidesorter::controller::SlideSorterController::GetVisibleAreaManager(), sd::slidesorter::model::PageEnumeration::HasMoreElements(), mbSelectionChangeBroadcastPending, mnBroadcastDisableLevel, mnSelectedPageCount, mrController, mrModel, mrSlideSorter, sd::slidesorter::view::SlideSorterView::RequestRepaint(), and sd::slidesorter::controller::VisibleAreaManager::RequestVisible().
Referenced by sd::slidesorter::controller::Listener::frameAction().
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().
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.
Definition at line 263 of file SlsPageSelector.cxx.
References GetPageCount(), sd::slidesorter::model::SlideSorterModel::GetPageDescriptor(), GetSelectedPageCount(), mrModel, and nIndex.
Referenced by UpdateCurrentPage().
|
inline |
Definition at line 116 of file SlsPageSelector.hxx.
References mnSelectedPageCount.
Referenced by sd::slidesorter::controller::SelectionObserver::EndObservation(), sd::slidesorter::controller::SlotManager::GetClipboardState(), sd::slidesorter::controller::SlotManager::GetInsertionPosition(), sd::slidesorter::controller::SlotManager::GetMenuState(), GetPageSelection(), accessibility::AccessibleSlideSorterView::getSelectedAccessibleChildCount(), sd::SdUnoSlideView::getSelection(), and sd::slidesorter::controller::SlotManager::GetStatusBarState().
|
inline |
Return the anchor for a range selection.
This usually is the first selected page after all pages have been deselected.
Definition at line 123 of file SlsPageSelector.hxx.
References mpSelectionAnchor.
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.
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().
|
delete |
void sd::slidesorter::controller::PageSelector::SelectAllPages | ( | ) |
Definition at line 57 of file SlsPageSelector.cxx.
References sd::slidesorter::model::SlideSorterModel::GetPageCount(), mrModel, mrSlideSorter, and SelectPage().
Referenced by sd::slidesorter::controller::SlotManager::FuTemporary(), and accessibility::AccessibleSlideSorterView::selectAllAccessibleChildren().
void sd::slidesorter::controller::PageSelector::SelectPage | ( | const model::SharedPageDescriptor & | rpDescriptor | ) |
Select the specified descriptor.
The selection state of the other descriptors is not affected.
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().
void sd::slidesorter::controller::PageSelector::SelectPage | ( | int | nPageIndex | ) |
Select the specified descriptor.
The selection state of the other descriptors is not affected.
Definition at line 124 of file SlsPageSelector.cxx.
References sd::slidesorter::model::SlideSorterModel::GetPageDescriptor(), mrModel, and SelectPage().
Referenced by sd::slidesorter::controller::SelectionManager::DeleteSelectedPages(), sd::DrawViewShell::DuplicateSelectedSlides(), sd::slidesorter::controller::SlotManager::DuplicateSelectedSlides(), sd::slidesorter::controller::SelectionObserver::EndObservation(), sd::slidesorter::controller::IMPL_LINK(), sd::slidesorter::controller::SlotManager::InsertSlide(), sd::slidesorter::controller::SelectionFunction::KeyInput(), sd::slidesorter::controller::SelectionFunction::MoveFocus(), sd::slidesorter::controller::CurrentSlideManager::NotifyCurrentSlideChange(), sd::slidesorter::controller::Listener::propertyChange(), sd::framework::ViewShellWrapper::select(), sd::SdUnoSlideView::select(), accessibility::AccessibleSlideSorterView::selectAccessibleChild(), SelectAllPages(), sd::slidesorter::controller::SelectionFunction::ModeHandler::SelectOnePage(), SelectPage(), sd::slidesorter::controller::Clipboard::SelectPageRange(), and SetPageSelection().
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.
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.
rSelection | Typically 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. |
bUpdateCurrentPage | When <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().
|
private |
Definition at line 289 of file SlsPageSelector.cxx.
References sd::slidesorter::controller::SlideSorterController::GetCurrentSlideManager(), GetPageCount(), sd::slidesorter::model::SlideSorterModel::GetPageDescriptor(), GetPageSelection(), mbIsUpdateCurrentPagePending, mnUpdateLockCount, mrController, mrModel, nIndex, and SetPageSelection().
Referenced by SetPageSelection().
|
private |
Definition at line 196 of file SlsPageSelector.hxx.
Referenced by UpdateCurrentPage().
|
private |
Definition at line 191 of file SlsPageSelector.hxx.
Referenced by EnableBroadcasting(), and GetCoreSelection().
|
private |
Definition at line 190 of file SlsPageSelector.hxx.
Referenced by DisableBroadcasting(), EnableBroadcasting(), and GetCoreSelection().
|
private |
Definition at line 189 of file SlsPageSelector.hxx.
Referenced by CheckConsistency(), CountSelectedPages(), DeselectAllPages(), GetCoreSelection(), and GetSelectedPageCount().
|
private |
Definition at line 195 of file SlsPageSelector.hxx.
Referenced by UpdateCurrentPage(), and sd::slidesorter::controller::PageSelector::UpdateLock::UpdateLock().
|
private |
Definition at line 192 of file SlsPageSelector.hxx.
|
private |
Anchor for a range selection.
Definition at line 194 of file SlsPageSelector.hxx.
Referenced by DeselectAllPages(), and GetSelectionAnchor().
|
private |
Definition at line 188 of file SlsPageSelector.hxx.
Referenced by EnableBroadcasting(), GetCoreSelection(), and UpdateCurrentPage().
|
private |
Definition at line 186 of file SlsPageSelector.hxx.
Referenced by CheckConsistency(), CountSelectedPages(), DeselectAllPages(), DeselectPage(), GetCoreSelection(), GetPageCount(), GetPageSelection(), IsPageExcluded(), IsPageSelected(), SelectAllPages(), SelectPage(), SetCoreSelection(), and UpdateCurrentPage().
|
private |
Definition at line 187 of file SlsPageSelector.hxx.
Referenced by DeselectAllPages(), GetCoreSelection(), and SelectAllPages().