44#include <osl/diagnose.h>
68 class Painter :
public ILayerPainter
71 explicit Painter (SlideSorterView& rView) :
mrView(rView) {}
73 virtual void Paint (
OutputDevice& rDevice, const ::tools::Rectangle& rRepaintArea)
override
75 mrView.Paint(rDevice,rRepaintArea);
87class BackgroundPainter
88 :
public ILayerPainter
92 BackgroundPainter(
const BackgroundPainter&) =
delete;
93 BackgroundPainter& operator=(
const BackgroundPainter&) =
delete;
95 virtual void Paint (
OutputDevice& rDevice, const ::tools::Rectangle& rRepaintArea)
override
114 *rSlideSorter.GetModel().GetDocument(),
115 rSlideSorter.GetContentWindow()->GetOutDev(),
116 rSlideSorter.GetViewShell()),
118 mrModel(rSlideSorter.GetModel()),
120 mpLayouter (new
Layouter(rSlideSorter.GetContentWindow(), rSlideSorter.GetTheme())),
121 mbPageObjectVisibilitiesValid (false),
123 maVisiblePageRange(-1,-1),
125 mbPreciousFlagUpdatePending(true),
130 mbIsRearrangePending(true)
257 std::shared_ptr<BackgroundPainter> pPainter (
293 const bool bRearrangeSuccess (
299 if (bRearrangeSuccess)
319 while (pWindow!=
nullptr && pDockingWindow==
nullptr)
325 if (pDockingWindow !=
nullptr)
327 const ::tools::Long nScrollBarSize (
336 aRange.
Min() + nScrollBarSize,
337 aRange.
Max() + nScrollBarSize));
346 aRange.
Min() + nScrollBarSize,
347 aRange.
Max() + nScrollBarSize));
354 const sal_Int32 nAdditionalSize (10);
356 mpLayouter->GetValidHorizontalSizeRange().Min()
383 const ::tools::Rectangle aViewBox (
mpLayouter->GetTotalBoundingBox());
387 std::shared_ptr<PageObjectLayouter> pPageObjectLayouter(
389 if (pPageObjectLayouter)
391 const Size aNewPreviewSize (
mpLayouter->GetPageObjectLayouter()->GetPreviewSize());
406 pDescriptor->SetBoundingBox(
mpLayouter->GetPageObjectBox(pDescriptor->GetPageIndex(),
false));
429 const Range aRange (
mpLayouter->GetRangeOfVisiblePageObjects(aViewArea));
446 PageDescriptor::ST_Visible,
458 for (
const auto& rLink : aChangeListeners)
484 pCache->SetPreciousFlag(
485 pDescriptor->GetPage(),
554static ::canvas::tools::ElapsedTime gaTimer;
555static const size_t gFrameTimeCount (10);
556static size_t gFrameTimeIndex (0);
557static ::std::vector<double> gFrameTimes (gFrameTimeCount, 0);
558static double gFrameTimeSum (0);
559static const ::tools::Rectangle gFrameTimeBox (10,10,150,20);
560static double gnLastFrameStart = 0;
577 const double nStartTime (gaTimer.getElapsedTime());
599 const double nEndTime (gaTimer.getElapsedTime());
600 SAL_INFO(
"sd.timing",
"SlideSorterView::CompleteRedraw end after " << (nEndTime-nStartTime)*1000 <<
" ms");
601 gFrameTimeSum -= gFrameTimes[gFrameTimeIndex];
602 gFrameTimes[gFrameTimeIndex] = nStartTime - gnLastFrameStart;
603 gnLastFrameStart = nStartTime;
604 gFrameTimeSum += gFrameTimes[gFrameTimeIndex];
605 gFrameTimeIndex = (gFrameTimeIndex+1) % gFrameTimeCount;
612 OUString::number(1 / (gFrameTimeSum / gFrameTimeCount)),
613 DrawTextFlags::Right | DrawTextFlags::VCenter);
620 const ::tools::Rectangle& rRepaintArea)
622 if (rRepaintArea.IsEmpty())
641 const Range aRange (
mpLayouter->GetRangeOfVisiblePageObjects(rRepaintArea));
644 std::vector<Graphic*> graphics;
648 if (!pDescriptor || ! pDescriptor->HasState(PageDescriptor::ST_Visible))
650 pDescriptor->GetPage()->getGraphicsForPrefetch(graphics);
658 pDescriptor->GetPage()->getGraphicsForPrefetch(graphics);
660 if(graphics.size() > 1)
666 if (!pDescriptor || ! pDescriptor->HasState(PageDescriptor::ST_Visible))
692 std::make_shared<cache::PageCache>(
746 if ((pVScrollBar && pVScrollBar->IsVisible() && pVScrollBar->HasGrab())
747 || (pHScrollBar && pHScrollBar->IsVisible() && pHScrollBar->HasGrab()))
760 if (aWindowBox.Contains(aPointerState.maPos))
771 const Point& rMousePosition)
797 const PageDescriptor::State eState,
798 const bool bStateValue)
803 const bool bModified (rpDescriptor->SetState(eState, bStateValue));
809 if (rpDescriptor->HasState(PageDescriptor::ST_Visible))
813 if (eState != PageDescriptor::ST_WasSelected)
830 :
mrView(rSlideSorter.GetView()),
831 mpWindow(rSlideSorter.GetContentWindow())
840 OSL_ASSERT(
mrView.mnLockRedrawSmph>0);
841 --
mrView.mnLockRedrawSmph;
842 if (
mrView.mnLockRedrawSmph == 0)
const std::shared_ptr< LayeredDevice > mpLayeredDevice
SlideSorter & mrSlideSorter
static const AllSettings & GetSettings()
static bool HasFastScale()
void MakeGraphicsAvailableThreaded(std::vector< Graphic * > &rGraphics)
static GraphicFilter & GetGraphicFilter()
void DrawRect(const tools::Rectangle &rRect)
bool Contains(tools::Long nIs) const
void SetPageVisible(bool bOn=true)
virtual void ConfigurationChanged(utl::ConfigurationBroadcaster *, ConfigurationHints) override
void SetMinOutputSizePixel(const Size &rSize)
void reset(reference_type *pBody)
reference_type * get() const
void SetValidSizeRange(const Range &rValidSizeRange)
When docked the given range is passed to the parent SplitWindow.
Orientation GetOrientation() const
When the TitledDockingWindow is docked and managed by a split window it can derive its orientation fr...
bool IsMainViewShell() const
Return <TRUE> when the called view shell is the main sub shell of its ViewShellBase object,...
virtual void DragFinished(sal_Int8 nDropAction)
sal_uInt16 mnLockRedrawSmph
An SdWindow contains the actual working area of ViewShell.
void SetViewSize(const Size &rSize)
Set size of the whole working area which can be seen with the window.
void SetViewOrigin(const Point &rPnt)
Set origin of the representation in respect to the whole working area.
Show previews for all the slides in a document and allow the user to insert or delete slides and modi...
const VclPtr< ScrollAdaptor > & GetHorizontalScrollBar() const
Return the control of the horizontal scroll bar.
std::shared_ptr< view::Theme > const & GetTheme() const
Return the active theme which gives access to colors and fonts.
SD_DLLPUBLIC controller::SlideSorterController & GetController() const
ViewShell * GetViewShell() const
Return the view shell that was given at construction.
const VclPtr< ScrollAdaptor > & GetVerticalScrollBar() const
Return the control of the vertical scroll bar.
const VclPtr< sd::Window > & GetContentWindow() const
Return the content window.
static std::shared_ptr< PageCacheManager > Instance()
Return the one instance of the PageCacheManager class.
void DragFinished(sal_Int8 nDropAction)
model::SharedPageDescriptor GetPageAt(const Point &rPixelPosition)
Return the descriptor of the page that is rendered under the given position.
SD_DLLPUBLIC controller::Clipboard & GetClipboard()
static PageEnumeration CreateAllPagesEnumeration(const SlideSorterModel &rModel)
The returned enumeration of slides iterates over all 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.
::osl::Mutex & GetMutex()
Return the mutex so that the caller can lock it and then safely access the model.
A simple wrapper around an OutputDevice that provides support for independent layers and buffering.
Calculate the size and position of page objects displayed by a slide sorter.
void Dispose()
When the DrawLock is disposed then it will not request a repaint on destruction.
DrawLock(SlideSorter const &rSlideSorter)
view::SlideSorterView & mrView
void RemoveVisibilityChangeListener(const Link< LinkParamNone *, void > &rListener)
Remove a listener that is called when the set of visible slides changes.
Range const & GetVisiblePageRange()
Return the range of currently visible page objects including the first and last one in that range.
void InvalidatePageObjectVisibilities()
This tells the view that it has to re-determine the visibility of the page objects before painting th...
std::shared_ptr< LayeredDevice > mpLayeredDevice
SharedILayerPainter mpBackgroundPainter
Layouter::Orientation meOrientation
bool mbPageObjectVisibilitiesValid
SlideSorterView(SlideSorter &rSlideSorter)
Create a new view for the slide sorter.
view::Layouter & GetLayouter()
void HandleDataChangeEvent()
bool mbPreciousFlagUpdatePending
std::unique_ptr< ToolTip, o3tl::default_delete< ToolTip > > mpToolTip
std::shared_ptr< PageObjectPainter > mpPageObjectPainter
bool mbIsRearrangePending
virtual void CompleteRedraw(OutputDevice *pDevice, const vcl::Region &rPaintArea, sdr::contact::ViewObjectContactRedirector *pRedirector=nullptr) override
The event will be forwarded to the View.
void HandleDrawModeChange()
vcl::Region maRedrawRegion
sal_Int32 GetPageIndexAtPoint(const Point &rPosition) const
Return the index of the page that is rendered at the given position.
virtual ~SlideSorterView() override
virtual void ConfigurationChanged(utl::ConfigurationBroadcaster *pBroadcaster, ConfigurationHints nHint) override
virtual void ModelHasChanged() override
void HandleModelChange()
This method is a convenience function that simply calls PreModelChange() and then PostModelChange().
void SetPageUnderMouse(const model::SharedPageDescriptor &rpDescriptor)
bool SetState(const model::SharedPageDescriptor &rpDescriptor, const model::PageDescriptor::State eState, const bool bStateValue)
::std::vector< Link< LinkParamNone *, void > > maVisibilityChangeListeners
std::shared_ptr< cache::PageCache > mpPreviewCache
void DeterminePageObjectVisibilities()
Determine the visibility of all page objects.
std::shared_ptr< PageObjectPainter > const & GetPageObjectPainter()
std::shared_ptr< cache::PageCache > const & GetPreviewCache()
void AddVisibilityChangeListener(const Link< LinkParamNone *, void > &rListener)
Add a shape to the page.
ToolTip & GetToolTip() const
::std::unique_ptr< Layouter > mpLayouter
void UpdatePreciousFlags()
void Paint(OutputDevice &rDevice, const ::tools::Rectangle &rRepaintArea)
::tools::Rectangle GetModelArea() const
void PostModelChange()
This method is typically called after a model change took place.
bool SetOrientation(const Layouter::Orientation eOrientation)
Set the general way of layouting the page objects.
model::SlideSorterModel & mrModel
void PreModelChange()
This method is typically called before a model change takes place.
virtual void DragFinished(sal_Int8 nDropAction) override
SlideSorter & mrSlideSorter
void UpdatePageUnderMouse()
The page under the mouse is not highlighted in some contexts.
model::SharedPageDescriptor mpPageUnderMouse
Collection of colors and styles that are used to paint the slide sorter view.
void Union(const tools::Rectangle &rRegion)
vcl::Window * GetParent() const
bool IsMouseCaptured() const
PointerState GetPointerState()
virtual Point GetPosPixel() const
Point PixelToLogic(const Point &rDevicePt) const
virtual Size GetSizePixel() const
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
constexpr ::Color COL_BLUE(0x00, 0x00, 0x80)
#define SAL_INFO(area, stream)
std::shared_ptr< T > make_shared(Args &&... args)
std::shared_ptr< PageDescriptor > SharedPageDescriptor
std::shared_ptr< ILayerPainter > SharedILayerPainter
std::shared_ptr< ILayerInvalidator > SharedILayerInvalidator
VclPtr< vcl::Window > mpWindow