From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001
From: Daniel Baumann
Date: Sun, 7 Apr 2024 11:06:44 +0200
Subject: Adding upstream version 4:7.4.7.
Signed-off-by: Daniel Baumann
---
.../ui/slidesorter/inc/cache/SlsCacheContext.hxx | 98 ++++++
.../ui/slidesorter/inc/cache/SlsPageCache.hxx | 141 +++++++++
.../slidesorter/inc/cache/SlsPageCacheManager.hxx | 155 ++++++++++
.../inc/controller/SlideSorterController.hxx | 327 +++++++++++++++++++++
.../inc/controller/SlsAnimationFunction.hxx | 77 +++++
.../ui/slidesorter/inc/controller/SlsAnimator.hxx | 122 ++++++++
.../ui/slidesorter/inc/controller/SlsClipboard.hxx | 208 +++++++++++++
.../inc/controller/SlsCurrentSlideManager.hxx | 112 +++++++
.../slidesorter/inc/controller/SlsFocusManager.hxx | 211 +++++++++++++
.../controller/SlsInsertionIndicatorHandler.hxx | 138 +++++++++
.../slidesorter/inc/controller/SlsPageSelector.hxx | 219 ++++++++++++++
.../slidesorter/inc/controller/SlsProperties.hxx | 125 ++++++++
.../inc/controller/SlsScrollBarManager.hxx | 248 ++++++++++++++++
.../inc/controller/SlsSelectionFunction.hxx | 145 +++++++++
.../inc/controller/SlsSelectionManager.hxx | 139 +++++++++
.../inc/controller/SlsSelectionObserver.hxx | 77 +++++
.../slidesorter/inc/controller/SlsSlotManager.hxx | 98 ++++++
.../inc/controller/SlsTransferableData.hxx | 78 +++++
.../inc/controller/SlsVisibleAreaManager.hxx | 90 ++++++
.../ui/slidesorter/inc/model/SlideSorterModel.hxx | 227 ++++++++++++++
.../ui/slidesorter/inc/model/SlsEnumeration.hxx | 44 +++
.../ui/slidesorter/inc/model/SlsPageDescriptor.hxx | 144 +++++++++
.../slidesorter/inc/model/SlsPageEnumeration.hxx | 95 ++++++
.../inc/model/SlsPageEnumerationProvider.hxx | 51 ++++
.../inc/model/SlsSharedPageDescriptor.hxx | 32 ++
.../ui/slidesorter/inc/model/SlsVisualState.hxx | 47 +++
.../ui/slidesorter/inc/view/SlideSorterView.hxx | 225 ++++++++++++++
.../ui/slidesorter/inc/view/SlsILayerPainter.hxx | 53 ++++
.../ui/slidesorter/inc/view/SlsInsertAnimator.hxx | 59 ++++
.../inc/view/SlsInsertionIndicatorOverlay.hxx | 101 +++++++
sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx | 237 +++++++++++++++
.../slidesorter/inc/view/SlsPageObjectLayouter.hxx | 144 +++++++++
.../slidesorter/inc/view/SlsPageObjectPainter.hxx | 119 ++++++++
sd/source/ui/slidesorter/inc/view/SlsTheme.hxx | 135 +++++++++
sd/source/ui/slidesorter/inc/view/SlsToolTip.hxx | 75 +++++
35 files changed, 4596 insertions(+)
create mode 100644 sd/source/ui/slidesorter/inc/cache/SlsCacheContext.hxx
create mode 100644 sd/source/ui/slidesorter/inc/cache/SlsPageCache.hxx
create mode 100644 sd/source/ui/slidesorter/inc/cache/SlsPageCacheManager.hxx
create mode 100644 sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
create mode 100644 sd/source/ui/slidesorter/inc/controller/SlsAnimationFunction.hxx
create mode 100644 sd/source/ui/slidesorter/inc/controller/SlsAnimator.hxx
create mode 100644 sd/source/ui/slidesorter/inc/controller/SlsClipboard.hxx
create mode 100644 sd/source/ui/slidesorter/inc/controller/SlsCurrentSlideManager.hxx
create mode 100644 sd/source/ui/slidesorter/inc/controller/SlsFocusManager.hxx
create mode 100644 sd/source/ui/slidesorter/inc/controller/SlsInsertionIndicatorHandler.hxx
create mode 100644 sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx
create mode 100644 sd/source/ui/slidesorter/inc/controller/SlsProperties.hxx
create mode 100644 sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx
create mode 100644 sd/source/ui/slidesorter/inc/controller/SlsSelectionFunction.hxx
create mode 100644 sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx
create mode 100644 sd/source/ui/slidesorter/inc/controller/SlsSelectionObserver.hxx
create mode 100644 sd/source/ui/slidesorter/inc/controller/SlsSlotManager.hxx
create mode 100644 sd/source/ui/slidesorter/inc/controller/SlsTransferableData.hxx
create mode 100644 sd/source/ui/slidesorter/inc/controller/SlsVisibleAreaManager.hxx
create mode 100644 sd/source/ui/slidesorter/inc/model/SlideSorterModel.hxx
create mode 100644 sd/source/ui/slidesorter/inc/model/SlsEnumeration.hxx
create mode 100644 sd/source/ui/slidesorter/inc/model/SlsPageDescriptor.hxx
create mode 100644 sd/source/ui/slidesorter/inc/model/SlsPageEnumeration.hxx
create mode 100644 sd/source/ui/slidesorter/inc/model/SlsPageEnumerationProvider.hxx
create mode 100644 sd/source/ui/slidesorter/inc/model/SlsSharedPageDescriptor.hxx
create mode 100644 sd/source/ui/slidesorter/inc/model/SlsVisualState.hxx
create mode 100644 sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
create mode 100644 sd/source/ui/slidesorter/inc/view/SlsILayerPainter.hxx
create mode 100644 sd/source/ui/slidesorter/inc/view/SlsInsertAnimator.hxx
create mode 100644 sd/source/ui/slidesorter/inc/view/SlsInsertionIndicatorOverlay.hxx
create mode 100644 sd/source/ui/slidesorter/inc/view/SlsLayouter.hxx
create mode 100644 sd/source/ui/slidesorter/inc/view/SlsPageObjectLayouter.hxx
create mode 100644 sd/source/ui/slidesorter/inc/view/SlsPageObjectPainter.hxx
create mode 100644 sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
create mode 100644 sd/source/ui/slidesorter/inc/view/SlsToolTip.hxx
(limited to 'sd/source/ui/slidesorter/inc')
diff --git a/sd/source/ui/slidesorter/inc/cache/SlsCacheContext.hxx b/sd/source/ui/slidesorter/inc/cache/SlsCacheContext.hxx
new file mode 100644
index 000000000..12993fdbb
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/cache/SlsCacheContext.hxx
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include
+#include
+#include
+#include
+
+namespace com::sun::star::uno
+{
+class XInterface;
+}
+
+class SdrPage;
+
+namespace sd::slidesorter::cache
+{
+typedef const SdrPage* CacheKey;
+
+/** This interface allows the individualisation of different instances of
+ the PreviewCache.
+*/
+class CacheContext
+{
+public:
+ virtual ~CacheContext() {}
+
+ /** This method is called when the asynchronous creation of a preview
+ has been finished.
+ @param aKey
+ The key of the page for which the preview has been created.
+ */
+ virtual void NotifyPreviewCreation(CacheKey aKey) = 0;
+
+ /** Called to determine whether the system is idle and a preview can be
+ created without annoying the user.
+ */
+ virtual bool IsIdle() = 0;
+
+ /** This method is used to determine whether a page is currently visible
+ or not. It is called when the cache becomes too large and some
+ previews have to be released or scaled down.
+ */
+ virtual bool IsVisible(CacheKey aKey) = 0;
+
+ /** Return the page associated with the given key. Note that different
+ keys may map to a single page (this may be the case with custom
+ slide shows.)
+ */
+ virtual const SdrPage* GetPage(CacheKey aKey) = 0;
+
+ /** This method is used when the request queue is filled. It asks for
+ the list of visible entries and maybe for the list of not visible
+ entries and creates preview creation requests for them.
+ @param bVisible
+ When this is then the implementation can decide whether
+ to allow rendering of previews that are not visible (ahead of
+ time). When not then return an empty pointer or an empty vector.
+ */
+ virtual std::shared_ptr> GetEntryList(bool bVisible) = 0;
+
+ /** Return the priority that defines the order in which previews are
+ created for different keys/pages. Typically the visible pages come
+ first, then top-down, left-to-right.
+ */
+ virtual sal_Int32 GetPriority(CacheKey aKey) = 0;
+
+ /** Return the model to which the pages belong for which the called
+ cache manages the previews. Different caches that belong to the
+ same model but have different preview sizes may access previews of
+ each other in order to create fast previews of the previews.
+ */
+ virtual css::uno::Reference GetModel() = 0;
+};
+
+typedef std::shared_ptr SharedCacheContext;
+
+} // end of namespace ::sd::slidesorter::cache
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/cache/SlsPageCache.hxx b/sd/source/ui/slidesorter/inc/cache/SlsPageCache.hxx
new file mode 100644
index 000000000..4fb596195
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/cache/SlsPageCache.hxx
@@ -0,0 +1,141 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include
+#include
+#include
+
+class Size;
+
+namespace sd::slidesorter::cache
+{
+class GenericPageCache;
+
+/** The page cache is responsible for the creation and storage of preview
+ bitmaps of pages that are shown by the slide sorter.
+
+
Bitmaps for previews and a cache are used to speed up the display
+ (painting) of the slide sorter. But, of course, we have to limit this
+ time-space-tradeoff by limiting the amount of space that can be use to
+ store bitmaps.
+
+
There are several strategies employed by this class to shorten the
+ perceived time that is used to paint the slide sorter:
+
+
Rendering pages ahead of time. Additionally to rendering the
+ visible slides we try to render part or all of the slides that are not
+ (yet) visible. This, of course, makes sense only when the computer is
+ otherwise idle while doing that.
+
When the size of the slides on the screen changes we mark the
+ bitmaps as needing an update but use them while the new bitmap in the
+ correct size is not available.
+
Give the UI the chance to handle user events between the rendering
+ of differe slides.
+
Limit the amount of space that may be used for storing preview
+ bitmaps and throw.
+
+
+
There is another somewhat similar methods for requesting new previews:
+ GetPreviewBitmap() schedules a re-rendering (when necessary) and
+ returns the preview what is currently available, either as a preview of
+ the preview or, when nothing has changed since the last call, as the
+ final thing.
+
+*/
+class PageCache
+{
+public:
+ /** The page cache is created with a reference to the slide sorter so
+ that it has access to both the view and the model and so can fill
+ itself with requests for all or just the visible pages.
+
+ It is the task of the PageCacheManager to create new objects of this
+ class.
+ */
+ PageCache(const Size& rPreviewSize, const bool bDoSuperSampling,
+ const SharedCacheContext& rpCacheContext);
+
+ ~PageCache();
+
+ void ChangeSize(const Size& rPreviewSize, const bool bDoSuperSampling);
+
+ /** Request a preview bitmap for the specified page object in the
+ specified size. The returned bitmap may be a preview of the
+ preview, i.e. either a scaled (up or down) version of a previous
+ preview (of the wrong size) or an empty bitmap. In this case a
+ request for the generation of a new preview is created and inserted
+ into the request queue. When the preview is available in the right
+ size the page shape will be told to paint itself again. When it
+ then calls this method again if receives the correctly sized preview
+ bitmap.
+ @param rRequestData
+ This data is used to determine the preview.
+ @param bResize
+ When then when the available bitmap has not the
+ requested size, it is scaled before it is returned. When
+ then the bitmap is returned in the wrong size and it is
+ the task of the caller to scale it.
+ @return
+ Returns a bitmap that is either empty, contains a scaled (up or
+ down) version or is the requested bitmap.
+ */
+ BitmapEx GetPreviewBitmap(const CacheKey aKey, const bool bResize);
+
+ BitmapEx GetMarkedPreviewBitmap(const CacheKey aKey);
+ void SetMarkedPreviewBitmap(const CacheKey aKey, const BitmapEx& rBitmap);
+
+ /** When the requested preview bitmap does not yet exist or is not
+ up-to-date then the rendering of one is scheduled. Otherwise this
+ method does nothing.
+ */
+ void RequestPreviewBitmap(const CacheKey aKey);
+
+ /** Tell the cache that the bitmap associated with the given request
+ data is not up-to-date anymore. This will invalidate all previews
+ in other caches that represent the same page as well.
+ A new preview is requested and will lead
+ eventually to a repaint of the associated page object.
+ */
+ void InvalidatePreviewBitmap(const CacheKey aKey);
+
+ /** Call this method when all preview bitmaps have to be generated anew.
+ This is the case when the size of the page objects on the screen has
+ changed or when the model has changed.
+ */
+ void InvalidateCache();
+
+ /** With the precious flag you can control whether a bitmap can be
+ removed or reduced in size to make room for other bitmaps or is so
+ precious that it will not touched. A typical use is to set the
+ precious flag for exactly the visible pages.
+ */
+ void SetPreciousFlag(const CacheKey aKey, const bool bIsPrecious);
+
+ void Pause();
+ void Resume();
+
+private:
+ std::unique_ptr mpImplementation;
+};
+
+} // end of namespace ::sd::slidesorter::cache
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/cache/SlsPageCacheManager.hxx b/sd/source/ui/slidesorter/inc/cache/SlsPageCacheManager.hxx
new file mode 100644
index 000000000..eaddea5b2
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/cache/SlsPageCacheManager.hxx
@@ -0,0 +1,155 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include
+#include
+#include
+#include
+
+class Size;
+class SdrPage;
+
+namespace sd::slidesorter::cache {
+
+class BitmapCache;
+
+/** Provide and manage the preview bitmap caches for all slide sorter
+ instances. There is one cache per active slide sorter plus a small
+ number of caches that are no longer in use. The later are kept to speed
+ up the switching between views.
+*/
+class PageCacheManager
+{
+public:
+ typedef std::vector< std::pair > > BestFittingPageCaches;
+ typedef css::uno::Reference DocumentKey;
+
+ /** Return the one instance of the PageCacheManager class.
+ */
+ static std::shared_ptr Instance();
+
+ /** Look up the cache for the given model in which the previews have the
+ specified size. If no such cache exists, then one is created. When
+ a new BitmapCache is created its Recycle() method is called with a
+ sorted list of existing caches from which the new one initialize its
+ previews.
+ @return
+ The returned cache lives as long as somebody keeps a shared
+ pointer and the ReleaseCache() method has not been called.
+ */
+ std::shared_ptr GetCache (
+ const DocumentKey& pDocument,
+ const Size& rPreviewSize);
+
+ /** Tell the cache manager to release its own reference to the specified
+ cache. After that the cache will live as long as the caller (and
+ maybe others) holds its reference.
+ */
+ void ReleaseCache (const std::shared_ptr& rpCache);
+
+ /** This is an information to the cache manager that the size of preview
+ bitmaps in the specified cache has changed.
+
+ */
+ std::shared_ptr ChangeSize (
+ const std::shared_ptr& rpCache,
+ const Size& rOldPreviewSize,
+ const Size& rNewPreviewSize);
+
+ /** Invalidate the preview bitmap for one slide that belongs to the
+ specified document. The bitmaps for this slide in all caches are
+ marked as out-of-date and will be re-created when they are requested
+ the next time.
+ */
+ bool InvalidatePreviewBitmap (
+ const DocumentKey& pDocument,
+ const SdrPage* pPage);
+
+ /** Invalidate the preview bitmaps for all slides that belong to the
+ specified document. This is necessary after model changes that
+ affect e.g. page number fields.
+ */
+ void InvalidateAllPreviewBitmaps (const DocumentKey& pDocument);
+
+ /** Invalidate all the caches that are currently in use and destroy
+ those that are not. This is used for example when the high contrast
+ mode is turned on or off.
+ */
+ void InvalidateAllCaches();
+
+ /** Call this method when a page has been deleted and its preview
+ is not needed anymore.
+ */
+ void ReleasePreviewBitmap (const SdrPage* pPage);
+
+private:
+ /** Singleton instance of the cache manager. Note that this is a weak
+ pointer. The (implementation class of) ViewShellBase holds a
+ shared_ptr so that the cache manager has the same life time as the
+ ViewShellBase.
+ */
+ static std::weak_ptr mpInstance;
+
+ /// List of active caches.
+ class PageCacheContainer;
+ std::unique_ptr mpPageCaches;
+
+ /// List of inactive, recently used caches.
+ class RecentlyUsedPageCaches;
+ std::unique_ptr mpRecentlyUsedPageCaches;
+
+ /** The maximal number of recently used caches that are kept alive after
+ they have become inactive, i.e. after they are not used anymore by a
+ slide sorter.
+ */
+ static const sal_uInt32 mnMaximalRecentlyCacheCount = 2;
+
+ PageCacheManager();
+ ~PageCacheManager();
+
+ class Deleter;
+ friend class Deleter;
+
+ std::shared_ptr GetRecentlyUsedCache(
+ const DocumentKey& pDocument,
+ const Size& rSize);
+
+ /** Add the given cache to the list of recently used caches for the
+ document. There is one such list per document. Each least has at
+ most mnMaximalRecentlyCacheCount members.
+ */
+ void PutRecentlyUsedCache(
+ DocumentKey const & pDocument,
+ const Size& rPreviewSize,
+ const std::shared_ptr& rpCache);
+
+ /** This method is used internally to initialize a newly created
+ BitmapCache with already existing previews.
+ */
+ void Recycle (
+ const std::shared_ptr& rpCache,
+ const DocumentKey& pDocument,
+ const Size& rPreviewSize);
+};
+
+} // end of namespace ::sd::slidesorter::cache
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx b/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
new file mode 100644
index 000000000..10c2aa13e
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
@@ -0,0 +1,327 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+#include
+
+#include
+#include
+
+namespace com::sun::star::container
+{
+class XIndexAccess;
+}
+namespace com::sun::star::uno
+{
+template class Reference;
+}
+namespace sd
+{
+class FuPoor;
+}
+namespace sd
+{
+class Window;
+}
+namespace vcl
+{
+class Window;
+}
+
+namespace sd::slidesorter
+{
+class SlideSorter;
+}
+namespace sd::slidesorter::view
+{
+class SlideSorterView;
+}
+namespace sd::slidesorter::model
+{
+class SlideSorterModel;
+}
+
+class CommandEvent;
+class SdPage;
+class SfxItemSet;
+class SfxRequest;
+class VclSimpleEvent;
+class VclWindowEvent;
+
+namespace sd::slidesorter::controller
+{
+class Animator;
+class Clipboard;
+class CurrentSlideManager;
+class FocusManager;
+class InsertionIndicatorHandler;
+class Listener;
+class PageSelector;
+class ScrollBarManager;
+class SelectionFunction;
+class SelectionManager;
+class SlotManager;
+class VisibleAreaManager;
+
+class SlideSorterController final
+{
+public:
+ /** Create a new controller for the slide sorter.
+ @param pParentWindow
+ The window that contains the controls of the new
+ controller.
+ */
+ SlideSorterController(SlideSorter& rSlideSorter);
+
+ /** Late initialization. Call this method once a new object has been
+ created.
+ */
+ void Init();
+
+ ~SlideSorterController();
+
+ void Dispose();
+
+ /** Place and size the scroll bars and the browser window so that the
+ given rectangle is filled.
+ */
+ void Resize(const ::tools::Rectangle& rAvailableSpace);
+
+ /** Determine which of the UI elements--the scroll bars, the scroll bar
+ filler, the actual slide sorter view--are visible and place them in
+ the area last passed to Resize().
+ @param bForce
+ When is given ( is the default) then the content
+ window and with it the SlideSorterView is resized event when its
+ size does not change (the size does change when the visibility
+ of scroll bars changes.)
+ */
+ void Rearrange(bool bForce);
+
+ /** Return the descriptor of the page that is rendered under the
+ given position. This takes the IsOnlyPreviewTriggersMouseOver
+ property into account.
+ @return
+ Returns a pointer to a page descriptor instead of a
+ reference because when no page is found at the position
+ then NULL is returned to indicate this.
+ */
+ model::SharedPageDescriptor GetPageAt(const Point& rPixelPosition);
+
+ // Exported for unit test
+ SD_DLLPUBLIC PageSelector& GetPageSelector();
+ FocusManager& GetFocusManager();
+ // Exported for unit test
+ SD_DLLPUBLIC controller::Clipboard& GetClipboard();
+
+ /** Return the object that manages the scroll bars.
+ */
+ ScrollBarManager& GetScrollBarManager();
+
+ std::shared_ptr const& GetCurrentSlideManager() const;
+ std::shared_ptr const& GetSlotManager() const;
+ std::shared_ptr const& GetSelectionManager() const;
+ std::shared_ptr const& GetInsertionIndicatorHandler() const;
+
+ /** This method forwards the call to the SlideSorterView and executes
+ pending operations like moving selected pages into the visible area.
+ */
+ void Paint(const ::tools::Rectangle& rRect, vcl::Window* pWin);
+
+ void FuTemporary(SfxRequest& rRequest);
+ void FuPermanent(SfxRequest& rRequest);
+ void FuSupport(SfxRequest& rRequest);
+ bool Command(const CommandEvent& rEvent, ::sd::Window* pWindow);
+
+ void GetCtrlState(SfxItemSet& rSet);
+ void GetStatusBarState(SfxItemSet& rSet);
+
+ void ExecCtrl(SfxRequest& rRequest);
+ void GetAttrState(SfxItemSet& rSet);
+
+ /** Create an object of this inner class to prevent updates due to model
+ changes.
+ */
+ class ModelChangeLock
+ {
+ public:
+ ModelChangeLock(SlideSorterController& rController);
+ ~ModelChangeLock() COVERITY_NOEXCEPT_FALSE;
+ void Release();
+
+ private:
+ SlideSorterController* mpController;
+ };
+ friend class ModelChangeLock;
+
+ /** Handle a change of the model, that is, handle the removal and
+ insertion of whole pages or a change of the edit mode.
+
+ This method is a convenience function that simply calls
+ PreModelChange() and then PostModelChange().
+ */
+ void HandleModelChange();
+
+ DECL_LINK(WindowEventHandler, VclWindowEvent&, void);
+ DECL_LINK(ApplicationEventHandler, VclSimpleEvent&, void);
+
+ /** Update the display of all pages. This involves a redraw and
+ releasing previews and caches.
+ */
+ void UpdateAllPages();
+
+ /** This factory method creates a selection function.
+ */
+ rtl::Reference CreateSelectionFunction(SfxRequest& rRequest);
+
+ /** When the current function of the view shell is the slide sorter
+ selection function then return a reference to it. Otherwise return
+ an empty reference.
+ */
+ ::rtl::Reference GetCurrentSelectionFunction() const;
+
+ /** Prepare for a change of the edit mode. Depending on the current
+ edit mode we may save the selection so that it can be restored when
+ later changing back to the current edit mode.
+ */
+ void PrepareEditModeChange();
+
+ /** Set a new edit mode and return whether the edit mode really
+ has been changed. For proper saving and restoring of the selection
+ this method should be called between calls to
+ PrepareEditModeChange() and FinishEditModeChange().
+ */
+ void ChangeEditMode(EditMode eEditMode);
+
+ /** Finish the change of the edit mode. Here we may select a page or
+ restore a previously saved selection.
+ */
+ void FinishEditModeChange();
+
+ /** Call this method when the name of one of the pages has changed.
+ This is then notified to the accessibility object, when that exists.
+ @param nPageIndex
+ The index of the page whose name has been changed.
+ @param rsOldName
+ The old name of the page. The new name can be taken from the
+ page object.
+ */
+ void PageNameHasChanged(int nPageIndex, const OUString& rsOldName);
+
+ /** Provide the set of pages to be displayed in the slide sorter. The
+ GetDocumentSlides() method can be found only in the SlideSorterModel.
+ */
+ void SetDocumentSlides(const css::uno::Reference& rxSlides);
+
+ /** Return an Animator object.
+ */
+ const std::shared_ptr& GetAnimator() const { return mpAnimator; }
+
+ VisibleAreaManager& GetVisibleAreaManager() const;
+
+ void CheckForMasterPageAssignment();
+ void CheckForSlideTransitionAssignment();
+
+private:
+ SlideSorter& mrSlideSorter;
+ model::SlideSorterModel& mrModel;
+ view::SlideSorterView& mrView;
+ std::unique_ptr mpPageSelector;
+ std::unique_ptr mpFocusManager;
+ std::shared_ptr mpSlotManager;
+ std::unique_ptr mpScrollBarManager;
+ mutable std::shared_ptr mpCurrentSlideManager;
+ std::shared_ptr mpSelectionManager;
+ std::unique_ptr mpClipboard;
+ std::shared_ptr mpInsertionIndicatorHandler;
+ std::shared_ptr mpAnimator;
+ std::unique_ptr mpVisibleAreaManager;
+
+ // The listener listens to UNO events and thus is a UNO object.
+ ::rtl::Reference mpListener;
+
+ int mnModelChangeLockCount;
+ bool mbIsForcedRearrangePending;
+ bool mbContextMenuOpen;
+
+ bool mbPostModelChangePending;
+
+ /** This array stores the indices of the selected page descriptors at
+ the time when the edit mode is switched to EditMode::MasterPage. With this
+ we can restore the selection when switching back to EditMode::Page mode.
+ */
+ ::std::vector maSelectionBeforeSwitch;
+ /// The current page before the edit mode is switched to EditMode::MasterPage.
+ int mnCurrentPageBeforeSwitch;
+
+ /** The master page to select after the edit mode is changed. This
+ member is used to pass the pointer from PrepareEditModeChange() to
+ FinishEditModeChange().
+ */
+ SdPage* mpEditModeChangeMasterPage;
+
+ /** This rectangle in the parent window encloses scroll bars and slide
+ sorter window. It is set when Resize() is called.
+ */
+ ::tools::Rectangle maTotalWindowArea;
+
+ /** This counter is used to avoid processing of reentrant calls to
+ Paint().
+ */
+ sal_Int32 mnPaintEntranceCount;
+
+ /** Prepare for several model changes, i.e. prevent time-consuming and
+ non-critical operations like repaints until UnlockModelChange() is
+ called. Critical operations like releasing references to pages that
+ do not exist anymore are executed.
+ */
+ void LockModelChange();
+
+ /** Further calls to HandleModelChange() will result in a full featured
+ update of model, view, and controller. When HandleModelChange() has
+ been called since the last LockModelChange() then this is done right
+ away to bring the view up-to-date.
+ */
+ void UnlockModelChange();
+
+ /** Prepare for a model change. This method does all the things that
+ need to be done _before_ the model changes, e.g. because they need
+ access to the model data before the change.
+ */
+ void PreModelChange();
+
+ /** Complete a model change. This includes the recreation of data
+ structures that depend on the model and the request for a repaint to
+ show the changes.
+ */
+ void PostModelChange();
+};
+
+} // end of namespace ::sd::slidesorter::controller
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsAnimationFunction.hxx b/sd/source/ui/slidesorter/inc/controller/SlsAnimationFunction.hxx
new file mode 100644
index 000000000..b4847de1a
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlsAnimationFunction.hxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include
+
+#include
+#include
+
+
+namespace sd::slidesorter::controller {
+
+class AnimationBezierFunction
+{
+public:
+ /** Create a cubic bezier curve whose start and end points are given
+ implicitly as P0=(0,0) and P3=(1,1). The second control point is
+ implicitly given as P2=(1-nY1,1-nX1).
+ */
+ AnimationBezierFunction (
+ const double nX1,
+ const double nY1);
+
+ ::basegfx::B2DPoint operator() (const double nT);
+
+private:
+ const double mnX1;
+ const double mnY1;
+ const double mnX2;
+ const double mnY2;
+
+ static double EvaluateComponent (
+ const double nT,
+ const double nV1,
+ const double nV2);
+};
+
+/** Turn a parametric function into one whose y-Values depend on its
+ x-Values. Note a lot of interpolation takes place. The resulting
+ accuracy should be good enough for the purpose of acceleration
+ function for animations.
+*/
+class AnimationParametricFunction
+{
+public:
+ typedef ::std::function ParametricFunction;
+ AnimationParametricFunction (const ParametricFunction& rFunction);
+
+ double operator() (const double nX);
+
+private:
+ /** y-Values of the parametric function given to the constructor
+ evaluated (and interpolated) for evenly spaced x-Values.
+ */
+ ::std::vector maY;
+};
+
+} // end of namespace ::sd::slidesorter::controller
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsAnimator.hxx b/sd/source/ui/slidesorter/inc/controller/SlsAnimator.hxx
new file mode 100644
index 000000000..8c9ec9e81
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlsAnimator.hxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include
+#include