LibreOffice Module sd (master) 1
SlsPageSelector.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
23
24#include <vector>
25#include <memory>
26
27#include <sddllapi.h>
28
29class SdPage;
30
31namespace sd::slidesorter
32{
33class SlideSorter;
34}
36{
37class SlideSorterModel;
38}
39
41{
42class SlideSorterController;
43
54{
55public:
56 explicit PageSelector(SlideSorter& rSlideSorter);
57 PageSelector(const PageSelector&) = delete;
59
60 // Exported for unit test
63
68 void GetCoreSelection();
69
73 void SetCoreSelection();
74
78 void SelectPage(int nPageIndex);
82 void SelectPage(const SdPage* pPage);
86 void SelectPage(const model::SharedPageDescriptor& rpDescriptor);
87
93 SD_DLLPUBLIC bool IsPageSelected(int nPageIndex);
94
100 SD_DLLPUBLIC bool IsPageExcluded(int nPageIndex);
101
106 void DeselectPage(int nPageIndex);
108 const bool bUpdateCurrentPage = true);
109
115 int GetPageCount() const;
117
124
125 typedef ::std::vector<SdPage*> PageSelection;
126
134 std::shared_ptr<PageSelection> GetPageSelection() const;
135
150 void SetPageSelection(const std::shared_ptr<PageSelection>& rSelection,
151 const bool bUpdateCurrentPage);
152
156 void CountSelectedPages();
157
163 {
164 public:
165 UpdateLock(SlideSorter const& rSlideSorter);
166 UpdateLock(PageSelector& rPageSelector);
167 ~UpdateLock();
168 void Release();
169
170 private:
172 };
173
175 {
176 public:
177 BroadcastLock(SlideSorter const& rSlideSorter);
178 BroadcastLock(PageSelector& rPageSelector);
180
181 private:
183 };
184
185private:
197
204 void EnableBroadcasting();
205
210 void DisableBroadcasting();
211
212 void UpdateCurrentPage(const bool bUpdateOnlyWhenPending = false);
213
214 void CheckConsistency() const;
215};
216
217} // end of namespace ::sd::slidesorter::controller
218
219/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Show previews for all the slides in a document and allow the user to insert or delete slides and modi...
Definition: SlideSorter.hxx:62
Use the UpdateLock whenever you do a complex selection, i.e.
A sub-controller that handles page selection of the slide browser.
void DisableBroadcasting()
Disable the broadcasting of selection change events.
PageSelector(const PageSelector &)=delete
void EnableBroadcasting()
Enable the broadcasting of selection change events.
SD_DLLPUBLIC bool IsPageExcluded(int nPageIndex)
Return whether the specified page is excluded.
void DeselectPage(int nPageIndex)
Deselect the descriptor that is associated with the given page.
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...
void DeselectPage(const model::SharedPageDescriptor &rpDescriptor, const bool bUpdateCurrentPage=true)
SD_DLLPUBLIC bool IsPageSelected(int nPageIndex)
Return whether the specified page is selected.
const model::SharedPageDescriptor & GetSelectionAnchor() const
Return the anchor for a range selection.
void SelectPage(const model::SharedPageDescriptor &rpDescriptor)
Select the specified descriptor.
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...
PageSelector & operator=(const PageSelector &)=delete
void SelectPage(int nPageIndex)
Select the specified descriptor.
The model of the slide sorter gives access to the slides that are to be displayed in the slide sorter...
std::shared_ptr< PageDescriptor > SharedPageDescriptor
#define SD_DLLPUBLIC
Definition: sddllapi.h:27