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

This class is a part of the controller and handles the selection of slides. More...

#include <SlsSelectionManager.hxx>

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

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

SlideSortermrSlideSorter
 
SlideSorterControllermrController
 
::std::vector< Link< LinkParamNone *, void > > maSelectionChangeListeners
 
sal_Int32 mnInsertionPosition
 The insertion position is only temporarily valid. More...
 
std::shared_ptr< SelectionObservermpSelectionObserver
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ SelectionManager()

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

◆ ~SelectionManager()

sd::slidesorter::controller::SelectionManager::~SelectionManager ( )

Definition at line 64 of file SlsSelectionManager.cxx.

Member Function Documentation

◆ AddSelectionChangeListener()

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.

Parameters
rListenerWhen 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.

◆ DeleteSelectedMasterPages()

void sd::slidesorter::controller::SelectionManager::DeleteSelectedMasterPages ( const ::std::vector< SdPage * > &  rSelectedMasterPages)
private

Delete the given list of master pages.

This method is a helper function for DeleteSelectedPages().

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

◆ DeleteSelectedNormalPages()

void sd::slidesorter::controller::SelectionManager::DeleteSelectedNormalPages ( const ::std::vector< SdPage * > &  rSelectedNormalPages)
private

Delete the given list of normal pages.

This method is a helper function for DeleteSelectedPages().

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

◆ DeleteSelectedPages()

void sd::slidesorter::controller::SelectionManager::DeleteSelectedPages ( const bool  bSelectFollowingPage = true)

Delete the currently selected slides.

When this method returns the selection is empty.

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

◆ GetInsertionPosition()

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.

◆ GetSelectionObserver()

const std::shared_ptr< SelectionObserver > & sd::slidesorter::controller::SelectionManager::GetSelectionObserver ( ) const
inline

Definition at line 103 of file SlsSelectionManager.hxx.

References mpSelectionObserver.

◆ RemoveSelectionChangeListener()

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.

Parameters
rListenerIt 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.

◆ SelectionHasChanged()

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

◆ SetInsertionPosition()

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.

Member Data Documentation

◆ maSelectionChangeListeners

::std::vector<Link<LinkParamNone*, void> > sd::slidesorter::controller::SelectionManager::maSelectionChangeListeners
private

◆ mnInsertionPosition

sal_Int32 sd::slidesorter::controller::SelectionManager::mnInsertionPosition
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().

◆ mpSelectionObserver

std::shared_ptr<SelectionObserver> sd::slidesorter::controller::SelectionManager::mpSelectionObserver
private

Definition at line 120 of file SlsSelectionManager.hxx.

Referenced by GetSelectionObserver().

◆ mrController

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

Definition at line 110 of file SlsSelectionManager.hxx.

Referenced by DeleteSelectedPages(), and SelectionHasChanged().

◆ mrSlideSorter

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

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