30#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
31#include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
32#include <com/sun/star/beans/XPropertySet.hpp>
33#include <com/sun/star/frame/XController.hpp>
53 bool PrintModel (
const SlideSorterModel& rModel)
55 for (sal_Int32 nIndex=0,nCount=rModel.GetPageCount(); nIndex<nCount; ++nIndex)
62 nIndex <<
" " << pDescriptor->GetPageIndex() <<
" "
63 << pDescriptor->GetVisualState().mnPageId <<
" "
65 <<
" " << pDescriptor->GetPage());
75 bool CheckModel (
const SlideSorterModel& rModel)
77 for (sal_Int32 nIndex=0,nCount=rModel.GetPageCount(); nIndex<nCount; ++nIndex)
86 if (nIndex != pDescriptor->GetPageIndex())
89 assert(nIndex == pDescriptor->GetPageIndex());
92 if (nIndex != pDescriptor->GetVisualState().mnPageId)
95 assert(nIndex == pDescriptor->GetVisualState().mnPageId);
106void collectUIInformation(
const OUString& num,
const OUString& rAction)
109 aDescription.
aID =
"impress_win_or_draw_win";
111 aDescription.
aAction = rAction;
112 aDescription.
aKeyWord =
"ImpressWindowUIObject";
113 aDescription.
aParent =
"MainWindow";
147 bool bEditModeChanged =
false;
152 bEditModeChanged =
true;
154 return bEditModeChanged;
163 const sal_Int32 nPageIndex,
164 const bool bCreate)
const
166 ::osl::MutexGuard aGuard (
maMutex);
173 if (pDescriptor ==
nullptr && bCreate &&
mxSlides.is())
176 pDescriptor = std::make_shared<PageDescriptor>(
177 Reference<drawing::XDrawPage>(
mxSlides->getByIndex(nPageIndex),UNO_QUERY),
189 ::osl::MutexGuard aGuard (
maMutex);
192 Reference<beans::XPropertySet> xSet (rxSlide, UNO_QUERY);
197 const Any aNumber (xSet->getPropertyValue(
"Number"));
198 sal_Int16 nNumber (-1);
203 && pDescriptor->GetXDrawPage() == rxSlide)
208 catch (uno::Exception&)
229 if (pDescriptor->GetXDrawPage() == rxSlide)
238 if (pPage ==
nullptr)
241 ::osl::MutexGuard aGuard (
maMutex);
244 sal_Int16 nNumber ((pPage->
GetPageNum()-1)/2);
247 && pDescriptor->GetPage() == pPage)
267 if (pDescriptor->GetPage() == pPage)
278 return pDescriptor->GetPage()->GetPageNum();
292 ::osl::MutexGuard aGuard (
maMutex);
295 bool bIsUpToDate (
true);
329 ::std::vector<SharedPageDescriptor> aDescriptors;
332 ::osl::MutexGuard aGuard (
maMutex);
336 for (
auto& rxDescriptor : aDescriptors)
338 if (rxDescriptor !=
nullptr)
340 if (rxDescriptor.use_count() > 1)
344 "trying to delete page descriptor that is still used with"
345 " count " << rxDescriptor.use_count());
349 rxDescriptor.reset();
356 ::osl::MutexGuard aGuard (
maMutex);
363 pDescriptor->GetPage()->SetSelected(bIsSelected);
369 ::osl::MutexGuard aGuard (
maMutex);
375 const bool bIsSelected (pDescriptor->GetPage()->IsSelected());
381 const Reference<container::XIndexAccess>& rxSlides)
383 ::osl::MutexGuard aGuard (
maMutex);
406 pDescriptor->GetPage());
410 if (pViewShell !=
nullptr)
413 if (pPage !=
nullptr)
421 if (pFrameView !=
nullptr)
439 ::osl::MutexGuard aGuard (
maMutex);
445 ::osl::MutexGuard aGuard (
maMutex);
447 Reference<container::XIndexAccess> xPages;
457 Reference<drawing::XMasterPagesSupplier> xSupplier (
461 xPages = xSupplier->getMasterPages();
468 Reference<drawing::XDrawPagesSupplier> xSupplier (
472 xPages = xSupplier->getDrawPages();
510 pDescriptor->SetState(
523 if (pDescriptor->SetState(
527 aRepaintRegion.
Union(pDescriptor->GetBoundingBox());
530 return aRepaintRegion;
535 ::osl::MutexGuard aGuard (
maMutex);
538 if (pPage ==
nullptr)
583 std::make_shared<PageDescriptor>(
584 Reference<drawing::XDrawPage>(
mxSlides->getByIndex(
nIndex),UNO_QUERY),
618 bool bMarkedSelected(
false);
631 collectUIInformation(OUString::number(
nIndex + 1),
"Delete_Slide_or_Page");
633 return bMarkedSelected;
645 if (nDescriptorIndex < nFirstIndex)
647 if (rpDescriptor->GetPageIndex()!=nDescriptorIndex)
649 assert(rpDescriptor->GetPageIndex()==nDescriptorIndex);
654 rpDescriptor->SetPageIndex(nDescriptorIndex);
663 if (pModel !=
nullptr)
SlideSorter & mrSlideSorter
SdPage * GetSdPage(sal_uInt16 nPgNum, PageKind ePgKind) const
SdPage * GetMasterSdPage(sal_uInt16 nPgNum, PageKind ePgKind)
sal_uInt16 GetSdPageCount(PageKind ePgKind) const
PageKind GetPageKind() const
sal_uInt16 GetPageNum() const
bool IsMasterPage() const
static UITestLogger & getInstance()
void logEvent(const EventDescription &rDescription)
sal_uInt16 GetSelectedPage() const
DrawDocShell * GetDocShell() const
SdDrawDocument * GetDocument() const
Base class of the stacked shell hierarchy.
virtual SdPage * getCurrentPage() const =0
FrameView * GetFrameView()
Show previews for all the slides in a document and allow the user to insert or delete slides and modi...
css::uno::Reference< css::frame::XController > GetXController() const
Return the XController object of the main view.
SD_DLLPUBLIC controller::SlideSorterController & GetController() const
ViewShell * GetViewShell() const
Return the view shell that was given at construction.
ViewShellBase * GetViewShellBase() const
Return the ViewShellBase object.
void CountSelectedPages()
Call this method after the model has changed to set the number of selected pages.
std::shared_ptr< SlotManager > const & GetSlotManager() const
std::shared_ptr< CurrentSlideManager > const & GetCurrentSlideManager() const
SD_DLLPUBLIC PageSelector & GetPageSelector()
void SetDocumentSlides(const css::uno::Reference< css::container::XIndexAccess > &rxSlides)
Provide the set of pages to be displayed in the slide sorter.
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.
The model of the slide sorter gives access to the slides that are to be displayed in the slide sorter...
void SynchronizeModelSelection()
Set the selection of the called model to exactly that of the document.
bool SetEditMode(EditMode eEditMode)
Set a new edit mode and return whether the edit mode really has been changed.
bool NotifyPageEvent(const SdrPage *pPage)
Typically called from controller::Listener this method handles the insertion and deletion of single p...
SlideSorterModel(SlideSorter &rSlideSorter)
void UpdatePageList()
This method is called when the edit mode has changed.
SdDrawDocument * GetDocument()
This method is present to let the view create a ShowView for displaying slides.
sal_Int32 GetPageCount() const
Return the number of slides in the document regardless of whether they are visible or not or whether ...
css::uno::Reference< css::container::XIndexAccess > GetDocumentSlides() const
Return the set of pages that is currently displayed by the slide sorter.
mutable ::std::vector< SharedPageDescriptor > maPageDescriptors
css::uno::Reference< css::container::XIndexAccess > mxSlides
SharedPageDescriptor GetPageDescriptor(const sal_Int32 nPageIndex, const bool bCreate=true) const
Return a page descriptor for the page with the specified index.
void SetDocumentSlides(const css::uno::Reference< css::container::XIndexAccess > &rxSlides)
Set the XIndexAccess from which the called SlideSorterModel takes its pages.
bool DeleteSlide(const SdPage *pPage)
void SaveCurrentSelection()
The current selection is saved by copying the ST_Selected state into ST_WasSelected for slides.
vcl::Region RestoreSelection()
The current selection is restored from the ST_WasSelected state from the slides.
void ClearDescriptorList()
Delete all descriptors that currently are in the container.
sal_Int32 GetIndex(const css::uno::Reference< css::drawing::XDrawPage > &rxSlide) const
Return a page descriptor for the given XDrawPage.
void SynchronizeDocumentSelection()
Set the selection of the document to exactly that of the called model.
void UpdateIndices(const sal_Int32 nFirstIndex)
void Resync()
Call this method after the document has changed its structure.
SlideSorter & mrSlideSorter
SdPage * GetPage(const sal_Int32 nCoreIndex) const
void AdaptSize()
Resize the descriptor container according to current values of page kind and edit mode.
void InsertSlide(SdPage *pPage, bool bMarkSelected)
sal_uInt16 GetCoreIndex(const sal_Int32 nIndex) const
Return an index for accessing an SdrModel that corresponds to the given SlideSorterModel index.
mutable::osl::Mutex maMutex
void Union(const tools::Rectangle &rRegion)
#define DBG_UNHANDLED_EXCEPTION(...)
#define SAL_INFO(area, stream)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
sal_Int32 FromCoreIndex(const sal_uInt16 nCoreIndex)
std::shared_ptr< PageDescriptor > SharedPageDescriptor
std::map< OUString, OUString > aParameters
Reference< XController > xController