LibreOffice Module sd (master) 1
|
This class is a part of the controller and handles the selection of slides. More...
#include <SlsSelectionManager.hxx>
Public Member Functions | |
SelectionManager (SlideSorter &rSlideSorter) | |
Create a new SelectionManager for the given slide sorter. More... | |
~SelectionManager () | |
void | DeleteSelectedPages (const bool bSelectFollowingPage=true) |
Delete the currently selected slides. More... | |
void | SelectionHasChanged () |
Call this method after the selection has changed (possible several calls to the PageSelector) to invalidate the relevant slots and send appropriate events. More... | |
void | AddSelectionChangeListener (const Link< LinkParamNone *, void > &rListener) |
Add a listener that is called when the selection of the slide sorter changes. More... | |
void | RemoveSelectionChangeListener (const Link< LinkParamNone *, void > &rListener) |
Remove a listener that was called when the selection of the slide sorter changes. More... | |
sal_Int32 | GetInsertionPosition () const |
Return the position where to insert pasted slides based on the current selection. More... | |
void | SetInsertionPosition (const sal_Int32 nInsertionPosition) |
Store an insertion position temporarily. More... | |
const std::shared_ptr< SelectionObserver > & | GetSelectionObserver () const |
Private Member Functions | |
void | DeleteSelectedNormalPages (const ::std::vector< SdPage * > &rSelectedNormalPages) |
Delete the given list of normal pages. More... | |
void | DeleteSelectedMasterPages (const ::std::vector< SdPage * > &rSelectedMasterPages) |
Delete the given list of master pages. More... | |
Private Attributes | |
SlideSorter & | mrSlideSorter |
SlideSorterController & | mrController |
::std::vector< Link< LinkParamNone *, void > > | maSelectionChangeListeners |
sal_Int32 | mnInsertionPosition |
The insertion position is only temporarily valid. More... | |
std::shared_ptr< SelectionObserver > | mpSelectionObserver |
This class is a part of the controller and handles the selection of slides.
It has methods to modify the selected slides (delete them or move them to other places in the document), change the visible area so to make the selected slides visible, tell listeners when the selection changes.
Definition at line 46 of file SlsSelectionManager.hxx.
sd::slidesorter::controller::SelectionManager::SelectionManager | ( | SlideSorter & | rSlideSorter | ) |
Create a new SelectionManager for the given slide sorter.
Definition at line 56 of file SlsSelectionManager.cxx.
References GetController(), and make_shared().
sd::slidesorter::controller::SelectionManager::~SelectionManager | ( | ) |
Definition at line 64 of file SlsSelectionManager.cxx.
void sd::slidesorter::controller::SelectionManager::AddSelectionChangeListener | ( | const Link< LinkParamNone *, void > & | rListener | ) |
Add a listener that is called when the selection of the slide sorter changes.
rListener | When this method is called multiple times for the same listener the second and all following calls are ignored. Each listener is added only once. |
Definition at line 250 of file SlsSelectionManager.cxx.
References maSelectionChangeListeners.
|
private |
Delete the given list of master pages.
This method is a helper function for DeleteSelectedPages().
rSelectedMasterPages | A list of master pages. Supplying normal pages is an error. |
Definition at line 182 of file SlsSelectionManager.cxx.
References Exception, sd::slidesorter::model::FromCoreIndex(), sd::slidesorter::model::SlideSorterModel::GetDocument(), sd::slidesorter::model::SlideSorterModel::GetEditMode(), sd::slidesorter::SlideSorter::GetModel(), SdrModel::getUnoModel(), MasterPage, mrSlideSorter, and TOOLS_WARN_EXCEPTION.
Referenced by DeleteSelectedPages().
|
private |
Delete the given list of normal pages.
This method is a helper function for DeleteSelectedPages().
rSelectedNormalPages | A list of normal pages. Supplying master pages is an error. |
Definition at line 149 of file SlsSelectionManager.cxx.
References Exception, sd::slidesorter::model::FromCoreIndex(), sd::slidesorter::model::SlideSorterModel::GetDocument(), sd::slidesorter::model::SlideSorterModel::GetEditMode(), sd::slidesorter::SlideSorter::GetModel(), SdrModel::getUnoModel(), mrSlideSorter, Page, and TOOLS_WARN_EXCEPTION.
Referenced by DeleteSelectedPages().
void sd::slidesorter::controller::SelectionManager::DeleteSelectedPages | ( | const bool | bSelectFollowingPage = true | ) |
Delete the currently selected slides.
When this method returns the selection is empty.
bSelectFollowingPage | When <TRUE> then after deleting the selected pages make the slide after the last selected page the new current page. When <FALSE> then make the first slide before the selected pages the new current slide. |
Definition at line 68 of file SlsSelectionManager.cxx.
References SdrEditView::BegUndo(), sd::slidesorter::controller::PageSelector::CountSelectedPages(), DeleteSelectedMasterPages(), DeleteSelectedNormalPages(), Draw, SdrEditView::EndUndo(), sd::View::GetDoc(), SdDrawDocument::GetDocumentType(), sd::slidesorter::model::SlideSorterModel::GetEditMode(), sd::slidesorter::controller::SlideSorterController::GetFocusManager(), sd::slidesorter::SlideSorter::GetModel(), sd::slidesorter::model::PageEnumeration::GetNextElement(), sd::slidesorter::model::SlideSorterModel::GetPageCount(), sd::slidesorter::controller::SlideSorterController::GetPageSelector(), sd::slidesorter::SlideSorter::GetView(), sd::slidesorter::SlideSorter::GetViewShell(), sd::slidesorter::controller::SlideSorterController::HandleModelChange(), sd::slidesorter::model::PageEnumeration::HasMoreElements(), sd::slidesorter::controller::FocusManager::IsFocusShowing(), mrController, mrSlideSorter, Page, sd::slidesorter::controller::SlideSorterController::ModelChangeLock::Release(), SdResId(), sd::slidesorter::controller::PageSelector::SelectPage(), sd::slidesorter::controller::FocusManager::SetFocusedPage(), and sd::slidesorter::controller::FocusManager::ToggleFocus().
sal_Int32 sd::slidesorter::controller::SelectionManager::GetInsertionPosition | ( | ) | const |
Return the position where to insert pasted slides based on the current selection.
When there is a selection then the insert position is behind the last slide. When the selection is empty then most of the time the insert position is at the end of the document. There is an exception right after the display of a popup-menu. The position of the associated insertion marker is stored here and reset the next time the selection changes.
Definition at line 270 of file SlsSelectionManager.cxx.
References sd::slidesorter::model::PageEnumerationProvider::CreateSelectedPagesEnumeration(), sd::slidesorter::model::FromCoreIndex(), sd::slidesorter::SlideSorter::GetModel(), sd::slidesorter::model::PageEnumeration::GetNextElement(), sd::slidesorter::model::SlideSorterModel::GetPageCount(), sd::slidesorter::model::PageEnumeration::HasMoreElements(), mnInsertionPosition, and mrSlideSorter.
|
inline |
Definition at line 103 of file SlsSelectionManager.hxx.
References mpSelectionObserver.
void sd::slidesorter::controller::SelectionManager::RemoveSelectionChangeListener | ( | const Link< LinkParamNone *, void > & | rListener | ) |
Remove a listener that was called when the selection of the slide sorter changes.
rListener | It is safe to pass a listener that was not added are has been removed previously. Such calls are ignored. |
Definition at line 261 of file SlsSelectionManager.cxx.
References maSelectionChangeListeners.
void sd::slidesorter::controller::SelectionManager::SelectionHasChanged | ( | ) |
Call this method after the selection has changed (possible several calls to the PageSelector) to invalidate the relevant slots and send appropriate events.
Definition at line 215 of file SlsSelectionManager.cxx.
References sd::slidesorter::controller::SlideSorterController::GetCurrentSlideManager(), sd::slidesorter::SlideSorter::GetViewShell(), SfxShell::Invalidate(), maSelectionChangeListeners, mnInsertionPosition, mrController, mrSlideSorter, and sd::ViewShell::UpdatePreview().
void sd::slidesorter::controller::SelectionManager::SetInsertionPosition | ( | const sal_Int32 | nInsertionPosition | ) |
Store an insertion position temporarily.
It is reset when the selection changes the next time.
Definition at line 293 of file SlsSelectionManager.cxx.
References sd::slidesorter::SlideSorter::GetModel(), sd::slidesorter::model::SlideSorterModel::GetPageCount(), mnInsertionPosition, and mrSlideSorter.
|
private |
Definition at line 112 of file SlsSelectionManager.hxx.
Referenced by AddSelectionChangeListener(), RemoveSelectionChangeListener(), and SelectionHasChanged().
|
private |
The insertion position is only temporarily valid.
Negative values indicate that the explicit insertion position is not valid. In this case GetInsertionPosition() calculates it from the current selection.
Definition at line 118 of file SlsSelectionManager.hxx.
Referenced by GetInsertionPosition(), SelectionHasChanged(), and SetInsertionPosition().
|
private |
Definition at line 120 of file SlsSelectionManager.hxx.
Referenced by GetSelectionObserver().
|
private |
Definition at line 110 of file SlsSelectionManager.hxx.
Referenced by DeleteSelectedPages(), and SelectionHasChanged().
|
private |
Definition at line 109 of file SlsSelectionManager.hxx.
Referenced by DeleteSelectedMasterPages(), DeleteSelectedNormalPages(), DeleteSelectedPages(), GetInsertionPosition(), SelectionHasChanged(), and SetInsertionPosition().