31#include <osl/diagnose.h>
45 :
mrModel(rSlideSorter.GetModel()),
48 mnSelectedPageCount(0),
49 mnBroadcastDisableLevel(0),
50 mbSelectionChangeBroadcastPending(false),
52 mbIsUpdateCurrentPagePending(true)
63 for (
int nPageIndex=0; nPageIndex<nPageCount; nPageIndex++)
73 for (
int nPageIndex=0; nPageIndex<nPageCount; nPageIndex++)
77 "PageSelector::DeselectAllPages: the selected pages counter is not 0");
86 bool bSelectionHasChanged (
true);
93 if (pDescriptor->GetCoreSelection())
97 bSelectionHasChanged =
true;
100 if (pDescriptor->HasState(PageDescriptor::ST_Selected))
104 if (bSelectionHasChanged)
120 pDescriptor->SetCoreSelection();
135 if (pDescriptor && pDescriptor->GetPage()==pPage)
171 const bool bUpdateCurrentPage)
186 if (bUpdateCurrentPage)
194 int nSelectionCount (0);
195 for (
int nPageIndex=0,nPageCount=
mrModel.
GetPageCount(); nPageIndex<nPageCount; nPageIndex++)
199 if (pDescriptor->HasState(PageDescriptor::ST_Selected))
208 OSL_ENSURE(
false,
"PageSelector: Consistency error (!)");
216 return pDescriptor->HasState(PageDescriptor::ST_Selected);
225 return pDescriptor->HasState(PageDescriptor::ST_Excluded);
265 auto pSelection = std::make_shared<PageSelection>();
272 if (pDescriptor && pDescriptor->HasState(PageDescriptor::ST_Selected))
273 pSelection->push_back(pDescriptor->GetPage());
280 const std::shared_ptr<PageSelection>& rpSelection,
281 const bool bUpdateCurrentPage)
283 for (
const auto& rpPage : *rpSelection)
285 if (bUpdateCurrentPage)
310 if (pDescriptor->HasState(PageDescriptor::ST_Selected))
312 pCurrentPageDescriptor = pDescriptor;
317 if (!pCurrentPageDescriptor)
336 : mpSelector(&rSlideSorter.
GetController().GetPageSelector())
342 : mpSelector(&rSelector)
354 if (mpSelector !=
nullptr)
356 --mpSelector->mnUpdateLockCount;
357 OSL_ASSERT(mpSelector->mnUpdateLockCount >= 0);
358 if (mpSelector->mnUpdateLockCount == 0)
359 mpSelector->UpdateCurrentPage(
true);
361 mpSelector =
nullptr;
374 : mrSelector(rSelector)
381 mrSelector.EnableBroadcasting();
SlideSorterController & mrController
SlideSorter & mrSlideSorter
Show previews for all the slides in a document and allow the user to insert or delete slides and modi...
SD_DLLPUBLIC controller::SlideSorterController & GetController() const
view::SlideSorterView & GetView() const
BroadcastLock(SlideSorter const &rSlideSorter)
PageSelector & mrSelector
Use the UpdateLock whenever you do a complex selection, i.e.
UpdateLock(SlideSorter const &rSlideSorter)
PageSelector * mpSelector
A sub-controller that handles page selection of the slide browser.
void DisableBroadcasting()
Disable the broadcasting of selection change events.
bool mbSelectionChangeBroadcastPending
SD_DLLPUBLIC void SelectAllPages()
model::SlideSorterModel & mrModel
void EnableBroadcasting()
Enable the broadcasting of selection change events.
SlideSorterController & mrController
SD_DLLPUBLIC bool IsPageExcluded(int nPageIndex)
Return whether the specified page is excluded.
SlideSorter & mrSlideSorter
void DeselectPage(int nPageIndex)
Deselect the descriptor that is associated with the given page.
int GetSelectedPageCount() const
void UpdateCurrentPage(const bool bUpdateOnlyWhenPending=false)
void SetCoreSelection()
Update the selection state of the SdPage objects to be the same as that of the corresponding page des...
sal_Int32 mnUpdateLockCount
void CheckConsistency() const
bool mbIsUpdateCurrentPagePending
SD_DLLPUBLIC bool IsPageSelected(int nPageIndex)
Return whether the specified page is selected.
PageSelector(SlideSorter &rSlideSorter)
SD_DLLPUBLIC void DeselectAllPages()
int mnBroadcastDisableLevel
model::SharedPageDescriptor mpSelectionAnchor
Anchor for a range selection.
model::SharedPageDescriptor mpMostRecentlySelectedPage
void GetCoreSelection()
Update the selection state of all page descriptors to be the same as that of the corresponding pages ...
void SetPageSelection(const std::shared_ptr< PageSelection > &rSelection, const bool bUpdateCurrentPage)
Restore a page selection according to the given selection object.
std::shared_ptr< PageSelection > GetPageSelection() const
Return an object that describes the current selection.
void CountSelectedPages()
Call this method after the model has changed to set the number of selected pages.
int GetPageCount() const
This convenience method returns the same number of pages that SlideSorterModel.GetPageCount() returns...
void SelectPage(int nPageIndex)
Select the specified descriptor.
std::shared_ptr< CurrentSlideManager > const & GetCurrentSlideManager() const
std::shared_ptr< SelectionManager > const & GetSelectionManager() const
VisibleAreaManager & GetVisibleAreaManager() const
Temporarily disable the update of the visible area.
void RequestVisible(const model::SharedPageDescriptor &rpDescriptor, const bool bForce=false)
Request to make the specified page object visible.
static PageEnumeration CreateAllPagesEnumeration(const SlideSorterModel &rModel)
The returned enumeration of slides iterates over all slides of the given model.
static PageEnumeration CreateSelectedPagesEnumeration(const SlideSorterModel &rModel)
The returned enumeration of slides iterates over the currently selected slides of the given model.
Public class of page enumerations that delegates its calls to an implementation object that can filte...
virtual SharedPageDescriptor GetNextElement() override
Return the next element of the enumeration.
virtual bool HasMoreElements() const override
Return <TRUE> when the enumeration has more elements, i.e.
sal_Int32 GetPageCount() const
Return the number of slides in the document regardless of whether they are visible or not or whether ...
SharedPageDescriptor GetPageDescriptor(const sal_Int32 nPageIndex, const bool bCreate=true) const
Return a page descriptor for the page with the specified index.
sal_Int32 GetIndex(const css::uno::Reference< css::drawing::XDrawPage > &rxSlide) const
Return a page descriptor for the given XDrawPage.
bool SetState(const model::SharedPageDescriptor &rpDescriptor, const model::PageDescriptor::State eState, const bool bStateValue)
#define DBG_ASSERT(sCon, aError)
virtual std::shared_ptr< SfxDialogController > GetController() override
std::shared_ptr< PageDescriptor > SharedPageDescriptor