LibreOffice Module sd (master) 1
SlideSorterController.cxx
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
21
22#include <SlideSorter.hxx>
27#include "SlsListener.hxx"
40#include <view/SlsLayouter.hxx>
42#include <view/SlsTheme.hxx>
43#include <view/SlsToolTip.hxx>
47
48#include <drawdoc.hxx>
49#include <ViewShellBase.hxx>
50#include <Window.hxx>
51#include <FrameView.hxx>
52#include <sdpage.hxx>
53
54#include <app.hrc>
55#include <sdmod.hxx>
56#include <ViewShellHint.hxx>
59
60#include <vcl/window.hxx>
61#include <svx/svxids.hrc>
62#include <sfx2/request.hxx>
63#include <sfx2/viewfrm.hxx>
64#include <sfx2/dispatch.hxx>
65#include <tools/debug.hxx>
66#include <vcl/commandevent.hxx>
67#include <vcl/svapp.hxx>
68#include <vcl/settings.hxx>
69
70#include <com/sun/star/lang/XComponent.hpp>
71#include <com/sun/star/accessibility/AccessibleEventId.hpp>
72
73#include <memory>
74
75using namespace ::com::sun::star;
76using namespace ::com::sun::star::uno;
77using namespace ::sd::slidesorter::model;
78using namespace ::sd::slidesorter::view;
79using namespace ::sd::slidesorter::controller;
80using namespace ::basegfx;
81
83
85 : mrSlideSorter(rSlideSorter),
86 mrModel(mrSlideSorter.GetModel()),
87 mrView(mrSlideSorter.GetView()),
88 mpInsertionIndicatorHandler(std::make_shared<InsertionIndicatorHandler>(rSlideSorter)),
89 mpAnimator(std::make_shared<Animator>(rSlideSorter)),
90 mpVisibleAreaManager(new VisibleAreaManager(rSlideSorter)),
91 mnModelChangeLockCount(0),
92 mbIsForcedRearrangePending(false),
93 mbContextMenuOpen(false),
94 mbPostModelChangePending(false),
95 mnCurrentPageBeforeSwitch(0),
96 mpEditModeChangeMasterPage(nullptr),
97 mnPaintEntranceCount(0)
98{
100 OSL_ASSERT(pWindow);
101 if (!pWindow)
102 return;
103
104 // The whole background is painted by the view and controls.
105 vcl::Window* pParentWindow = pWindow->GetParent();
106 OSL_ASSERT(pParentWindow!=nullptr);
107 pParentWindow->SetBackground (Wallpaper());
108
109 // Connect the view with the window that has been created by our base
110 // class.
111 pWindow->SetBackground(Wallpaper());
112 pWindow->SetCenterAllowed(false);
113 pWindow->SetMapMode(MapMode(MapUnit::MapPixel));
115}
116
118{
119 mpCurrentSlideManager = std::make_shared<CurrentSlideManager>(mrSlideSorter);
122 mpSlotManager = std::make_shared<SlotManager>(mrSlideSorter);
124 mpSelectionManager = std::make_shared<SelectionManager>(mrSlideSorter);
126
127 // Create the selection function.
128 SfxRequest aRequest (
129 SID_OBJECT_SELECT,
130 SfxCallMode::SLOT,
133
135
136 mpPageSelector->GetCoreSelection();
137 GetSelectionManager()->SelectionHasChanged();
138}
139
141{
142 try
143 {
144 uno::Reference<lang::XComponent> xComponent = mpListener;
145 if (xComponent.is())
146 xComponent->dispose();
147 }
148 catch( uno::Exception& )
149 {
150 TOOLS_WARN_EXCEPTION( "sd", "sd::SlideSorterController::~SlideSorterController()" );
151 }
152
153 // dispose should have been called by now so that nothing is to be done
154 // to shut down cleanly.
155}
156
158{
160 mpClipboard.reset();
161 mpSelectionManager.reset();
162 mpAnimator->Dispose();
163}
164
166 const Point& aWindowPosition)
167{
168 sal_Int32 nHitPageIndex (mrView.GetPageIndexAtPoint(aWindowPosition));
169 model::SharedPageDescriptor pDescriptorAtPoint;
170 if (nHitPageIndex >= 0)
171 {
172 pDescriptorAtPoint = mrModel.GetPageDescriptor(nHitPageIndex);
173
174 // Depending on a property we may have to check that the mouse is no
175 // just over the page object but over the preview area.
176 if (pDescriptorAtPoint
177 && ! pDescriptorAtPoint->HasState(PageDescriptor::ST_Selected))
178 {
179 // Make sure that the mouse is over the preview area.
180 if ( ! mrView.GetLayouter().GetPageObjectLayouter()->GetBoundingBox(
181 pDescriptorAtPoint,
183 view::PageObjectLayouter::WindowCoordinateSystem).Contains(aWindowPosition))
184 {
185 pDescriptorAtPoint.reset();
186 }
187 }
188 }
189
190 return pDescriptorAtPoint;
191}
192
194{
195 OSL_ASSERT(mpPageSelector != nullptr);
196 return *mpPageSelector;
197}
198
200{
201 OSL_ASSERT(mpFocusManager != nullptr);
202 return *mpFocusManager;
203}
204
206{
207 OSL_ASSERT(mpClipboard != nullptr);
208 return *mpClipboard;
209}
210
212{
213 OSL_ASSERT(mpScrollBarManager != nullptr);
214 return *mpScrollBarManager;
215}
216
217std::shared_ptr<CurrentSlideManager> const & SlideSorterController::GetCurrentSlideManager() const
218{
219 OSL_ASSERT(mpCurrentSlideManager != nullptr);
221}
222
223std::shared_ptr<SlotManager> const & SlideSorterController::GetSlotManager() const
224{
225 OSL_ASSERT(mpSlotManager != nullptr);
226 return mpSlotManager;
227}
228
229std::shared_ptr<SelectionManager> const & SlideSorterController::GetSelectionManager() const
230{
231 OSL_ASSERT(mpSelectionManager != nullptr);
232 return mpSelectionManager;
233}
234
235std::shared_ptr<InsertionIndicatorHandler> const &
237{
238 OSL_ASSERT(mpInsertionIndicatorHandler != nullptr);
240}
241
243 const ::tools::Rectangle& rBBox,
244 vcl::Window* pWindow)
245{
246 if (mnPaintEntranceCount != 0)
247 return;
248
250
251 try
252 {
253 mrView.CompleteRedraw(pWindow->GetOutDev(), vcl::Region(rBBox));
254 }
255 catch (const Exception&)
256 {
257 // Ignore all exceptions.
258 }
259
261}
262
264{
265 mpSlotManager->FuTemporary (rRequest);
266}
267
269{
270 mpSlotManager->FuPermanent (rRequest);
271}
272
274{
275 mpSlotManager->FuSupport (rRequest);
276}
277
279 const CommandEvent& rEvent,
280 ::sd::Window* pWindow)
281{
282 bool bEventHasBeenHandled = false;
283
284 if (pWindow == nullptr)
285 return false;
286
287 ViewShell* pViewShell = mrSlideSorter.GetViewShell();
288 if (pViewShell == nullptr)
289 return false;
290
291 switch (rEvent.GetCommand())
292 {
293 case CommandEventId::ContextMenu:
294 {
295 SdPage* pPage = nullptr;
296 OUString aPopupId;
297
298 model::PageEnumeration aSelectedPages (
299 PageEnumerationProvider::CreateSelectedPagesEnumeration(mrModel));
300 if (aSelectedPages.HasMoreElements())
301 pPage = aSelectedPages.GetNextElement()->GetPage();
302
304 {
305 if (pPage != nullptr)
306 aPopupId = "pagepane";
307 else
308 aPopupId = "pagepanenosel";
309 }
310 else if (pPage != nullptr)
311 aPopupId = "pagepanemaster";
312 else
313 aPopupId = "pagepanenoselmaster";
314
315 std::unique_ptr<InsertionIndicatorHandler::ForceShowContext, o3tl::default_delete<InsertionIndicatorHandler::ForceShowContext>> xContext;
316 if (pPage == nullptr)
317 {
318 // When there is no selection, then we show the insertion
319 // indicator so that the user knows where a page insertion
320 // would take place.
321 mpInsertionIndicatorHandler->Start(false);
322 mpInsertionIndicatorHandler->UpdateIndicatorIcon(SD_MOD()->pTransferClip);
323 mpInsertionIndicatorHandler->UpdatePosition(
324 pWindow->PixelToLogic(rEvent.GetMousePosPixel()),
328 }
329
330 pWindow->ReleaseMouse();
331
332 Point aMenuLocation (0,0);
333 if (!rEvent.IsMouseEvent())
334 {
335 // The event is not a mouse event. Use the center of the
336 // focused page as top left position of the context menu.
337 model::SharedPageDescriptor pDescriptor (
338 GetFocusManager().GetFocusedPageDescriptor());
339 if (pDescriptor)
340 {
341 ::tools::Rectangle aBBox (
342 mrView.GetLayouter().GetPageObjectLayouter()->GetBoundingBox (
343 pDescriptor,
344 PageObjectLayouter::Part::PageObject,
345 PageObjectLayouter::ModelCoordinateSystem));
346 aMenuLocation = aBBox.Center();
347 }
348 }
349
350 if (SfxDispatcher* pDispatcher = pViewShell->GetDispatcher())
351 {
352 mbContextMenuOpen = true;
353 if (!rEvent.IsMouseEvent())
354 pDispatcher->ExecutePopup(aPopupId, pWindow, &aMenuLocation);
355 else
356 pDispatcher->ExecutePopup(aPopupId, pWindow);
357 mbContextMenuOpen = false;
360 if (pFunction.is())
361 pFunction->ResetMouseAnchor();
362 }
363 if (pPage == nullptr)
364 {
365 // Remember the position of the insertion indicator before
366 // it is hidden, so that a pending slide insertion slot call
367 // finds the right place to insert a new slide.
368 GetSelectionManager()->SetInsertionPosition(
369 GetInsertionIndicatorHandler()->GetInsertionPageIndex());
370 }
371 xContext.reset();
372 bEventHasBeenHandled = true;
373 }
374 break;
375
376 case CommandEventId::Wheel:
377 {
378 const CommandWheelData* pData = rEvent.GetWheelData();
379 if (pData == nullptr)
380 return false;
381 if (pData->IsMod1())
382 {
383 // We do not support zooming with control+mouse wheel.
384 return false;
385 }
386 // Determine whether to scroll horizontally or vertically. This
387 // depends on the orientation of the scroll bar and the
388 // IsHoriz() flag of the event.
390 == pData->IsHorz())
391 {
394 -pData->GetNotchDelta());
395 }
396 else
397 {
400 -pData->GetNotchDelta());
401 }
403
404 bEventHasBeenHandled = true;
405 }
406 break;
407
408 default: break;
409 }
410
411 return bEventHasBeenHandled;
412}
413
415{
417}
418
420{
423 {
425 }
426}
427
429{
430 // Prevent PreModelChange to execute more than once per model lock.
432 return;
433
434 if (mrSlideSorter.GetViewShell() != nullptr)
435 mrSlideSorter.GetViewShell()->Broadcast(
437
438 GetCurrentSlideManager()->PrepareModelChange();
439
442
444}
445
447{
449 mrModel.Resync();
450
452 if (pWindow)
453 {
454 GetCurrentSlideManager()->HandleModelChange();
455
457
458 pWindow->SetViewOrigin (Point (0,0));
459 pWindow->SetViewSize (mrView.GetModelArea().GetSize());
460
461 // The visibility of the scroll bars may have to be changed. Then
462 // the size of the view has to change, too. Let Rearrange() handle
463 // that.
465 }
466
467 if (mrSlideSorter.GetViewShell() != nullptr)
468 mrSlideSorter.GetViewShell()->Broadcast(
470}
471
473{
474 // Ignore this call when the document is not in a valid state, i.e. has
475 // not the same number of regular and notes pages.
476 bool bIsDocumentValid = (mrModel.GetDocument()->GetPageCount() % 2 == 1);
477
478 if (bIsDocumentValid)
479 {
480 ModelChangeLock aLock (*this);
482 }
483}
484
485IMPL_LINK(SlideSorterController, ApplicationEventHandler, VclSimpleEvent&, rEvent, void)
486{
487 auto windowEvent = dynamic_cast<VclWindowEvent *>(&rEvent);
488 if (windowEvent != nullptr) {
489 WindowEventHandler(*windowEvent);
490 }
491}
492IMPL_LINK(SlideSorterController, WindowEventHandler, VclWindowEvent&, rEvent, void)
493{
494 vcl::Window* pWindow = rEvent.GetWindow();
495 sd::Window *pActiveWindow (mrSlideSorter.GetContentWindow().get());
496 switch (rEvent.GetId())
497 {
498 case VclEventId::WindowActivate:
499 case VclEventId::WindowShow:
500 if (pActiveWindow && pWindow == pActiveWindow->GetParent())
501 mrView.RequestRepaint();
502 break;
503
504 case VclEventId::WindowHide:
505 if (pActiveWindow && pWindow == pActiveWindow->GetParent())
506 mrView.SetPageUnderMouse(SharedPageDescriptor());
507 break;
508
509 case VclEventId::WindowGetFocus:
510 if (pActiveWindow)
511 if (pWindow == pActiveWindow)
512 GetFocusManager().ShowFocus(false);
513 break;
514
515 case VclEventId::WindowLoseFocus:
516 if (pActiveWindow && pWindow == pActiveWindow)
517 {
518 GetFocusManager().HideFocus();
519 mrView.GetToolTip().Hide();
520
521 //don't scroll back to the selected slide when we lose
522 //focus due to a temporary active context menu
523 if (!mbContextMenuOpen)
524 {
525 // Select the current slide so that it is properly
526 // visualized when the focus is moved to the edit view.
527 GetPageSelector().SelectPage(GetCurrentSlideManager()->GetCurrentSlide());
528 }
529 }
530 break;
531
532 case VclEventId::ApplicationDataChanged:
533 {
534 // Invalidate the preview cache.
535 cache::PageCacheManager::Instance()->InvalidateAllCaches();
536
537 // Update the draw mode.
538 DrawModeFlags nDrawMode (Application::GetSettings().GetStyleSettings().GetHighContrastMode()
541 if (mrSlideSorter.GetViewShell() != nullptr)
542 mrSlideSorter.GetViewShell()->GetFrameView()->SetDrawMode(nDrawMode);
543 if (pActiveWindow != nullptr)
544 pActiveWindow->GetOutDev()->SetDrawMode(nDrawMode);
545 mrView.HandleDrawModeChange();
546
547 // When the system font has changed a layout has to be done.
548 mrView.Resize();
549
550 // Update theme colors.
551 mrSlideSorter.GetProperties()->HandleDataChangeEvent();
552 mrSlideSorter.GetTheme()->Update(mrSlideSorter.GetProperties());
553 mrView.HandleDataChangeEvent();
554 }
555 break;
556
557 default:
558 break;
559 }
560}
561
563{
564 if (rSet.GetItemState(SID_RELOAD) != SfxItemState::UNKNOWN)
565 {
566 // let SFx en-/disable "last version"
567 SfxViewFrame* pSlideViewFrame = SfxViewFrame::Current();
568 DBG_ASSERT(pSlideViewFrame!=nullptr,
569 "SlideSorterController::GetCtrlState: ViewFrame not found");
570 if (pSlideViewFrame)
571 {
572 pSlideViewFrame->GetSlotState (SID_RELOAD, nullptr, &rSet);
573 }
574 else // MI says: no MDIFrame --> disable
575 {
576 rSet.DisableItem(SID_RELOAD);
577 }
578 }
579
580 // Output quality.
581 if (rSet.GetItemState(SID_OUTPUT_QUALITY_COLOR)==SfxItemState::DEFAULT
582 ||rSet.GetItemState(SID_OUTPUT_QUALITY_GRAYSCALE)==SfxItemState::DEFAULT
583 ||rSet.GetItemState(SID_OUTPUT_QUALITY_BLACKWHITE)==SfxItemState::DEFAULT
584 ||rSet.GetItemState(SID_OUTPUT_QUALITY_CONTRAST)==SfxItemState::DEFAULT)
585 {
587 {
588 DrawModeFlags nMode = mrSlideSorter.GetContentWindow()->GetOutDev()->GetDrawMode();
589 sal_uInt16 nQuality = 0;
590
591 if (nMode == sd::OUTPUT_DRAWMODE_COLOR) {
592 nQuality = 0;
593 } else if (nMode == sd::OUTPUT_DRAWMODE_GRAYSCALE) {
594 nQuality = 1;
595 } else if (nMode == sd::OUTPUT_DRAWMODE_BLACKWHITE) {
596 nQuality = 2;
597 } else if (nMode == sd::OUTPUT_DRAWMODE_CONTRAST) {
598 nQuality = 3;
599 }
600
601 rSet.Put (SfxBoolItem (SID_OUTPUT_QUALITY_COLOR, nQuality==0));
602 rSet.Put (SfxBoolItem (SID_OUTPUT_QUALITY_GRAYSCALE, nQuality==1));
603 rSet.Put (SfxBoolItem (SID_OUTPUT_QUALITY_BLACKWHITE, nQuality==2));
604 rSet.Put (SfxBoolItem (SID_OUTPUT_QUALITY_CONTRAST, nQuality==3));
605 }
606 }
607
608 if (rSet.GetItemState(SID_MAIL_SCROLLBODY_PAGEDOWN) == SfxItemState::DEFAULT)
609 {
610 rSet.Put (SfxBoolItem( SID_MAIL_SCROLLBODY_PAGEDOWN, true));
611 }
612}
613
615{
616 mpSlotManager->GetStatusBarState (rSet);
617}
618
620{
621 mpSlotManager->ExecCtrl (rRequest);
622}
623
625{
626 mpSlotManager->GetAttrState (rSet);
627}
628
630{
631 // Do a redraw.
632 mrSlideSorter.GetContentWindow()->Invalidate();
633}
634
635void SlideSorterController::Resize (const ::tools::Rectangle& rAvailableSpace)
636{
637 if (maTotalWindowArea != rAvailableSpace)
638 {
639 maTotalWindowArea = rAvailableSpace;
640 Rearrange(true);
641 }
642}
643
645{
647 return;
648
650 {
652 return;
653 }
654 else
656
658 if (!pWindow)
659 return;
660
661 if (bForce)
663
664 // Place the scroll bars.
669
670 bool bSizeHasChanged (false);
671 // Only when bForce is not true we have to test for a size change in
672 // order to determine whether the window and the view have to be resized.
673 if ( ! bForce)
674 {
675 ::tools::Rectangle aCurrentContentArea (pWindow->GetPosPixel(), pWindow->GetOutputSizePixel());
676 bSizeHasChanged = (aNewContentArea != aCurrentContentArea);
677 }
678 if (bForce || bSizeHasChanged)
679 {
680 // The browser window gets the remaining space.
681 pWindow->SetPosSizePixel (aNewContentArea.TopLeft(), aNewContentArea.GetSize());
682 mrView.Resize();
683 }
684
685 // Adapt the scroll bars to the new zoom factor of the browser
686 // window and the arrangement of the page objects.
688
689 // Keep the current slide in the visible area.
691
693}
694
696{
698 return xFunc;
699}
700
702{
704 return ::rtl::Reference<SelectionFunction>(dynamic_cast<SelectionFunction*>(pFunction.get()));
705}
706
708{
709 // Before we throw away the page descriptors we prepare for selecting
710 // descriptors in the other mode and for restoring the current
711 // selection when switching back to the current mode.
713 return;
714
716
717 // Search for the first selected page and determine the master page
718 // used by its page object. It will be selected after the switch.
719 // In the same loop the current selection is stored.
720 PageEnumeration aSelectedPages (
721 PageEnumerationProvider::CreateSelectedPagesEnumeration(mrModel));
722 while (aSelectedPages.HasMoreElements())
723 {
724 SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
725 SdPage* pPage = pDescriptor->GetPage();
726 // Remember the master page of the first selected descriptor.
727 if (pPage!=nullptr && mpEditModeChangeMasterPage==nullptr)
728 mpEditModeChangeMasterPage = &static_cast<SdPage&>(
729 pPage->TRG_GetMasterPage());
730
731 maSelectionBeforeSwitch.push_back(pPage);
732 }
733
734 // Remember the current page.
735 if (mrSlideSorter.GetViewShell() != nullptr)
737 .GetMainViewShell()->GetActualPage()->GetPageNum()-1)/2;
738}
739
741{
742 if (mrModel.GetEditMode() != eEditMode)
743 {
744 ModelChangeLock aLock (*this);
746 // Do the actual edit mode switching.
747 bool bResult = mrModel.SetEditMode(eEditMode);
748 if (bResult)
750 }
751}
752
754{
756 {
757 mpPageSelector->DeselectAllPages();
758
759 // Search for the master page that was determined in
760 // PrepareEditModeChange() and make it the current page.
761 PageEnumeration aAllPages (PageEnumerationProvider::CreateAllPagesEnumeration(mrModel));
762 while (aAllPages.HasMoreElements())
763 {
764 SharedPageDescriptor pDescriptor (aAllPages.GetNextElement());
765 if (pDescriptor->GetPage() == mpEditModeChangeMasterPage)
766 {
767 GetCurrentSlideManager()->SwitchCurrentSlide(pDescriptor);
768 mpPageSelector->SelectPage(pDescriptor);
769 break;
770 }
771 }
772 }
773 else
774 {
776
778 GetCurrentSlideManager()->SwitchCurrentSlide(pDescriptor);
779
780 // Restore the selection.
781 mpPageSelector->DeselectAllPages();
782 for (const auto& rpPage : maSelectionBeforeSwitch)
783 {
784 mpPageSelector->SelectPage(rpPage);
785 }
787 }
789}
790
791void SlideSorterController::PageNameHasChanged (int nPageIndex, const OUString& rsOldName)
792{
793 // Request a repaint for the page object whose name has changed.
794 model::SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(nPageIndex));
795 if (pDescriptor)
796 mrView.RequestRepaint(pDescriptor);
797
798 // Get a pointer to the corresponding accessible object and notify
799 // that of the name change.
801 if ( ! pWindow)
802 return;
803
804 css::uno::Reference< css::accessibility::XAccessible >
805 xAccessible (pWindow->GetAccessible(false));
806 if ( ! xAccessible.is())
807 return;
808
809 // Now comes a small hack. We assume that the accessible object is
810 // an instantiation of AccessibleSlideSorterView and cast it to that
811 // class. The cleaner alternative to this cast would be a new member
812 // in which we would store the last AccessibleSlideSorterView object
813 // created by SlideSorterViewShell::CreateAccessibleDocumentView().
814 // But then there is no guaranty that the accessible object obtained
815 // from the window really is that instance last created by
816 // CreateAccessibleDocumentView().
817 // However, the dynamic cast together with the check of the result
818 // being NULL should be safe enough.
820 = dynamic_cast< ::accessibility::AccessibleSlideSorterView*>(xAccessible.get());
821 if (pAccessibleView == nullptr)
822 return;
823
825 = pAccessibleView->GetAccessibleChildImplementation(nPageIndex);
826 if (pChild == nullptr || pChild->GetPage() == nullptr)
827 return;
828
829 OUString sNewName (pChild->GetPage()->GetName());
830 pChild->FireAccessibleEvent(
831 css::accessibility::AccessibleEventId::NAME_CHANGED,
832 Any(rsOldName),
833 Any(sNewName));
834}
835
836void SlideSorterController::SetDocumentSlides (const Reference<container::XIndexAccess>& rxSlides)
837{
838 if (mrModel.GetDocumentSlides() != rxSlides)
839 {
840 ModelChangeLock aLock (*this);
842
843 mrModel.SetDocumentSlides(rxSlides);
844 }
845}
846
848{
849 OSL_ASSERT(mpVisibleAreaManager);
850 return *mpVisibleAreaManager;
851}
852
854{
855 if (mrModel.GetPageCount()%2==0)
856 return;
857 PageEnumeration aAllPages (PageEnumerationProvider::CreateAllPagesEnumeration(mrModel));
858 while (aAllPages.HasMoreElements())
859 {
860 SharedPageDescriptor pDescriptor (aAllPages.GetNextElement());
861 if (pDescriptor->UpdateMasterPage())
862 {
863 mrView.GetPreviewCache()->InvalidatePreviewBitmap (
864 pDescriptor->GetPage());
865 }
866 }
867}
868
870{
871 if (mrModel.GetPageCount()%2==0)
872 return;
873 PageEnumeration aAllPages (PageEnumerationProvider::CreateAllPagesEnumeration(mrModel));
874 while (aAllPages.HasMoreElements())
875 {
876 SharedPageDescriptor pDescriptor (aAllPages.GetNextElement());
877 if (pDescriptor->UpdateTransitionFlag())
878 {
879 mrView.GetPreviewCache()->InvalidatePreviewBitmap (
880 pDescriptor->GetPage());
881 }
882 }
883}
884
885//===== SlideSorterController::ModelChangeLock ================================
886
888 SlideSorterController& rController)
889 : mpController(&rController)
890{
892}
893
895{
896 Release();
897}
898
900{
901 if (mpController != nullptr)
902 {
903 mpController->UnlockModelChange();
904 mpController = nullptr;
905 }
906}
907
908} // end of namespace ::sd::slidesorter
909
910/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
DrawModeFlags
ChartModel & mrModel
SlideSorterView & mrView
SlideSorter & mrSlideSorter
static const AllSettings & GetSettings()
CommandEventId GetCommand() const
const CommandWheelData * GetWheelData() const
const Point & GetMousePosPixel() const
bool IsMouseEvent() const
void SetDrawMode(DrawModeFlags nDrawMode)
const OUString & GetName() const
Definition: sdpage.cxx:2505
const SfxItemPool & GetItemPool() const
sal_uInt16 GetPageCount() const
SdrPage & TRG_GetMasterPage() const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void DisableItem(sal_uInt16 nWhich)
const SfxPoolItem * GetSlotState(sal_uInt16 nSlotId, const SfxInterface *pIF=nullptr, SfxItemSet *pStateSet=nullptr)
SfxDispatcher * GetDispatcher() const
static SAL_WARN_UNUSED_RESULT SfxViewFrame * Current()
reference_type * get() const
This class makes page objects of the slide sorter accessible.
SdPage * GetPage() const
Return the page that is made accessible by the called object.
void FireAccessibleEvent(short nEventId, const css::uno::Any &rOldValue, const css::uno::Any &rNewValue)
This class makes the SlideSorterViewShell accessible.
AccessibleSlideSorterObject * GetAccessibleChildImplementation(sal_Int32 nIndex)
Return the implementation object of the specified child.
std::shared_ptr< ViewShell > GetMainViewShell() const
Return the main view shell stacked on the called ViewShellBase object.
Local derivation of the SfxHint class that defines some hint ids that are used by the ViewShell class...
Base class of the stacked shell hierarchy.
Definition: ViewShell.hxx:92
const rtl::Reference< FuPoor > & GetCurrentFunction() const
Definition: ViewShell.hxx:250
SD_DLLPUBLIC ViewShellBase & GetViewShellBase() const
Definition: viewshel.cxx:1397
An SdWindow contains the actual working area of ViewShell.
Definition: Window.hxx:45
void SetViewSize(const Size &rSize)
Set size of the whole working area which can be seen with the window.
Definition: sdwindow.cxx:320
void SetCenterAllowed(bool bIsAllowed)
Definition: sdwindow.cxx:326
void SetViewOrigin(const Point &rPnt)
Set origin of the representation in respect to the whole working area.
Definition: sdwindow.cxx:312
Show previews for all the slides in a document and allow the user to insert or delete slides and modi...
Definition: SlideSorter.hxx:62
ViewShell * GetViewShell() const
Return the view shell that was given at construction.
void SetCurrentFunction(const rtl::Reference< FuPoor > &rpFunction)
Set the current function at the view shell or, when it is not present, set it at the content window.
const VclPtr< sd::Window > & GetContentWindow() const
Return the content window.
Definition: SlideSorter.hxx:99
view::SlideSorterView & GetView() const
static std::shared_ptr< PageCacheManager > Instance()
Return the one instance of the PageCacheManager class.
Experimental class for simple eye candy animations.
Definition: SlsAnimator.hxx:39
This class manages the focus of the slide sorter.
This context make sure that the insertion indicator is shown (provided that the clipboard is not empt...
Manage the visibility and location of the insertion indicator.
Listen for events of various types and sources and react to them.
Definition: SlsListener.hxx:63
A sub-controller that handles page selection of the slide browser.
Manage the horizontal and vertical scroll bars.
::tools::Rectangle PlaceScrollBars(const ::tools::Rectangle &rAvailableArea, const bool bIsHorizontalScrollBarAllowed, const bool bIsVerticalScrollBarAllowed)
Place the scroll bars inside the given area.
void UpdateScrollBars(bool bScrollToCurrentPosition)
Set up the scroll bar, i.e.
void Scroll(const Orientation eOrientation, const sal_Int32 nDistance)
Scroll the slide sorter by setting the thumbs of the scroll bars and by moving the content of the con...
static rtl::Reference< FuPoor > Create(SlideSorter &rSlideSorter, SfxRequest &rRequest)
Create an object of this inner class to prevent updates due to model changes.
void HandleModelChange()
Handle a change of the model, that is, handle the removal and insertion of whole pages or a change of...
void PageNameHasChanged(int nPageIndex, const OUString &rsOldName)
Call this method when the name of one of the pages has changed.
::rtl::Reference< SelectionFunction > GetCurrentSelectionFunction() const
When the current function of the view shell is the slide sorter selection function then return a refe...
void Resize(const ::tools::Rectangle &rAvailableSpace)
Place and size the scroll bars and the browser window so that the given rectangle is filled.
void LockModelChange()
Prepare for several model changes, i.e.
void UnlockModelChange()
Further calls to HandleModelChange() will result in a full featured update of model,...
std::shared_ptr< SlotManager > const & GetSlotManager() const
void PrepareEditModeChange()
Prepare for a change of the edit mode.
std::unique_ptr< VisibleAreaManager > mpVisibleAreaManager
::rtl::Reference< controller::Listener > mpListener
sal_Int32 mnPaintEntranceCount
This counter is used to avoid processing of reentrant calls to Paint().
void ChangeEditMode(EditMode eEditMode)
Set a new edit mode and return whether the edit mode really has been changed.
std::shared_ptr< CurrentSlideManager > mpCurrentSlideManager
model::SharedPageDescriptor GetPageAt(const Point &rPixelPosition)
Return the descriptor of the page that is rendered under the given position.
std::shared_ptr< CurrentSlideManager > const & GetCurrentSlideManager() const
std::shared_ptr< SelectionManager > const & GetSelectionManager() const
::tools::Rectangle maTotalWindowArea
This rectangle in the parent window encloses scroll bars and slide sorter window.
SlideSorterController(SlideSorter &rSlideSorter)
Create a new controller for the slide sorter.
std::shared_ptr< SelectionManager > mpSelectionManager
void Paint(const ::tools::Rectangle &rRect, vcl::Window *pWin)
This method forwards the call to the SlideSorterView and executes pending operations like moving sele...
void Rearrange(bool bForce)
Determine which of the UI elements–the scroll bars, the scroll bar filler, the actual slide sorter vi...
ScrollBarManager & GetScrollBarManager()
Return the object that manages the scroll bars.
SdPage * mpEditModeChangeMasterPage
The master page to select after the edit mode is changed.
void SetDocumentSlides(const css::uno::Reference< css::container::XIndexAccess > &rxSlides)
Provide the set of pages to be displayed in the slide sorter.
void UpdateAllPages()
Update the display of all pages.
std::shared_ptr< InsertionIndicatorHandler > const & GetInsertionIndicatorHandler() const
std::unique_ptr< ScrollBarManager > mpScrollBarManager
::std::vector< SdPage * > maSelectionBeforeSwitch
This array stores the indices of the selected page descriptors at the time when the edit mode is swit...
std::unique_ptr< controller::Clipboard > mpClipboard
int mnCurrentPageBeforeSwitch
The current page before the edit mode is switched to EditMode::MasterPage.
void FinishEditModeChange()
Finish the change of the edit mode.
rtl::Reference< FuPoor > CreateSelectionFunction(SfxRequest &rRequest)
This factory method creates a selection function.
bool Command(const CommandEvent &rEvent, ::sd::Window *pWindow)
SD_DLLPUBLIC controller::Clipboard & GetClipboard()
std::shared_ptr< InsertionIndicatorHandler > mpInsertionIndicatorHandler
Manage requests for scrolling page objects into view.
void RequestCurrentSlideVisible()
Request the current slide to be moved into the visible area.
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.
bool SetEditMode(EditMode eEditMode)
Set a new edit mode and return whether the edit mode really has been 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.
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.
void Resync()
Call this method after the document has changed its structure.
std::shared_ptr< PageObjectLayouter > const & GetPageObjectLayouter() const
virtual void CompleteRedraw(OutputDevice *pDevice, const vcl::Region &rPaintArea, sdr::contact::ViewObjectContactRedirector *pRedirector=nullptr) override
The event will be forwarded to the View.
Layouter::Orientation GetOrientation() const
sal_Int32 GetPageIndexAtPoint(const Point &rPosition) const
Return the index of the page that is rendered at the given position.
std::shared_ptr< cache::PageCache > const & GetPreviewCache()
::tools::Rectangle GetModelArea() const
void PostModelChange()
This method is typically called after a model change took place.
void PreModelChange()
This method is typically called before a model change takes place.
void UpdatePageUnderMouse()
The page under the mouse is not highlighted in some contexts.
constexpr Point Center() const
constexpr Point TopLeft() const
constexpr Size GetSize() const
constexpr bool IsEmpty() const
vcl::Window * GetParent() const
virtual Point GetPosPixel() const
void SetMapMode()
::OutputDevice const * GetOutDev() const
void ReleaseMouse()
Point PixelToLogic(const Point &rDevicePt) const
css::uno::Reference< css::accessibility::XAccessible > GetAccessible(bool bCreate=true)
Size GetOutputSizePixel() const
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize)
void SetBackground()
#define DBG_ASSERT(sCon, aError)
#define TOOLS_WARN_EXCEPTION(area, stream)
std::unique_ptr< sal_Int32[]> pData
@ Exception
std::shared_ptr< T > make_shared(Args &&... args)
IMPL_LINK(SlideSorterController, ApplicationEventHandler, VclSimpleEvent &, rEvent, void)
std::shared_ptr< PageDescriptor > SharedPageDescriptor
const DrawModeFlags OUTPUT_DRAWMODE_CONTRAST
Definition: ViewShell.hxx:72
const DrawModeFlags OUTPUT_DRAWMODE_GRAYSCALE
Definition: ViewShell.hxx:64
const DrawModeFlags OUTPUT_DRAWMODE_BLACKWHITE
Definition: ViewShell.hxx:68
const DrawModeFlags OUTPUT_DRAWMODE_COLOR
Definition: ViewShell.hxx:62
EditMode
Definition: pres.hxx:53
#define SD_MOD()
Definition: sdmod.hxx:184
static SfxItemSet & rSet
SvxTableController * mpController