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 --- sd/source/ui/inc/SlideSorter.hxx | 248 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 248 insertions(+) create mode 100644 sd/source/ui/inc/SlideSorter.hxx (limited to 'sd/source/ui/inc/SlideSorter.hxx') diff --git a/sd/source/ui/inc/SlideSorter.hxx b/sd/source/ui/inc/SlideSorter.hxx new file mode 100644 index 000000000..9ed70cf9b --- /dev/null +++ b/sd/source/ui/inc/SlideSorter.hxx @@ -0,0 +1,248 @@ +/* -*- 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 vcl { class Window; } +namespace com::sun::star::frame { class XController; } +namespace rtl { template class Reference; } + +namespace sd { +class ViewShell; +class ViewShellBase; +class Window; +class FuPoor; +} + +namespace sd::slidesorter::model { class SlideSorterModel; } + +namespace sd::slidesorter::view { + class SlideSorterView; + class Theme; +} + +namespace sd::slidesorter::controller { + class SlideSorterController; + class SlotManager; + class Properties; +} + +namespace sd::slidesorter { + +/** Show previews for all the slides in a document and allow the user to + insert or delete slides and modify the order of the slides. + + This class is a facade for the model, view, and controller classes. + It is a hub that allows access to the various parts of a slide sorter. + + Note that this class is not in its final state. +*/ +class SlideSorter final +{ + friend class controller::SlotManager; +public: + ~SlideSorter(); + + /// Forbid copy construction and copy assignment + SlideSorter(const SlideSorter&) = delete; + SlideSorter& operator=(const SlideSorter&) = delete; + + /** Return whether the called SlideSorter object is valid and calling + its Get(Model,View,Controller) methods is safe. When is + called then no other methods should be called. + Calling this method should be necessary only during startup and + shutdown (when that can be detected). + */ + bool IsValid() const { return mbIsValid;} + + /** Create a new slide sorter that is strongly coupled to the given view + shell. Use this function for a slide sorter in the left pane. + @param rViewShell + Typically a SlideSorterViewShell object. + @param rpContentWindow + Typically the content window of the ViewShell. + @param rpHorizontalScrollBar + Typically the horizontal scroll bar of the ViewShell. + @param rpVerticalScrollBar + Typically the vertical scroll bar of the ViewShell. + @param rpScrollBarBox + The little square enclosed by the two scroll bars. Typically + the one from the ViewShell. + */ + static std::shared_ptr CreateSlideSorter ( + ViewShell& rViewShell, + sd::Window* pContentWindow, + ScrollBar* pHorizontalScrollBar, + ScrollBar* pVerticalScrollBar, + ScrollBarBox* pScrollBarBox); + + /** Create a new slide sorter that is loosely coupled to the given view + shell. The view shell may even be missing. + @param rBase + ViewShellBase object of the enclosing application. + @param pViewShell + Supply when at hand. + @param rParentWindow + The parent window of the internally created content window and + scroll bars. + */ + static std::shared_ptr CreateSlideSorter ( + ViewShellBase& rBase, + vcl::Window& rParentWindow); + + /** Return the control of the vertical scroll bar. + */ + const VclPtr& GetVerticalScrollBar() const { return mpVerticalScrollBar;} + + /** Return the control of the horizontal scroll bar. + */ + const VclPtr& GetHorizontalScrollBar() const { return mpHorizontalScrollBar;} + + /** Return the scroll bar filler that paints the little square that is + enclosed by the two scroll bars. + */ + const VclPtr& GetScrollBarFiller (void) const { return mpScrollBarBox;} + + /** Return the content window. This is a sibling and is geometrically + enclosed by the scroll bars. + */ + const VclPtr& GetContentWindow() const { return mpContentWindow;} + + model::SlideSorterModel& GetModel() const; + + view::SlideSorterView& GetView() const; + + // Exported for unit test + SD_DLLPUBLIC controller::SlideSorterController& GetController() const; + + /** Return the view shell that was given at construction. + @return + May be empty. + */ + ViewShell* GetViewShell() const { return mpViewShell;} + + /** Return the XController object of the main view. + */ + css::uno::Reference + GetXController() const; + + /** Return the ViewShellBase object. + @return + May be empty. + */ + ViewShellBase* GetViewShellBase() const { return mpViewShellBase;} + + void Paint (const ::tools::Rectangle& rRepaintArea); + + /** Place and size the controls and windows. You may want to call this + method when something has changed that for instance affects the + visibility state of the scroll bars. + */ + void ArrangeGUIElements ( + const Point& rOffset, + const Size& rSize); + + void RelocateToWindow (vcl::Window* pWindow); + + /** Set the current function at the view shell or, when it is not + present, set it at the content window. This method supports the use + of functions even when there is no SlideSorterViewShell. + */ + void SetCurrentFunction (const rtl::Reference& rpFunction); + + /** Return a collection of properties that are used throughout the slide + sorter. + */ + std::shared_ptr const & GetProperties() const; + + /** Return the active theme which gives access to colors and fonts. + */ + std::shared_ptr const & GetTheme() const; + +private: + /** This virtual method makes it possible to create a specialization of + the slide sorter view shell that works with its own implementation + of model, view, and controller. The default implementation simply + calls the CreateModel(), CreateView(), and CreateController() + methods in this order. + */ + void CreateModelViewController(); + + /** Create the model for the view shell. When called from the default + implementation of CreateModelViewController() then neither view nor + controller do exist. Test their pointers when in doubt. + */ + model::SlideSorterModel* CreateModel(); + + bool mbIsValid; + + std::unique_ptr mpSlideSorterController; + std::unique_ptr mpSlideSorterModel; + std::unique_ptr mpSlideSorterView; + css::uno::WeakReference mxControllerWeak; + ViewShell* mpViewShell; + ViewShellBase* mpViewShellBase; + VclPtr mpContentWindow; + VclPtr mpHorizontalScrollBar; + VclPtr mpVerticalScrollBar; + VclPtr mpScrollBarBox; + + /** Some slide sorter wide properties that are used in different + classes. + */ + std::shared_ptr mpProperties; + std::shared_ptr mpTheme; + + SlideSorter ( + ViewShell& rViewShell, + sd::Window* pContentWindow, + ScrollBar* pHorizontalScrollBar, + ScrollBar* pVerticalScrollBar, + ScrollBarBox* pScrollBarBox); + SlideSorter ( + ViewShellBase& rBase, + vcl::Window& rParentWindow); + + void Init(); + /** Create the controls for the slide sorter. This are the tab bar + for switching the edit mode, the scroll bar, and the actual + slide sorter view window. + This method is usually called exactly one time from the + constructor. + */ + void SetupControls(); + + /** This method is usually called exactly one time from the + constructor. + */ + void SetupListeners(); + + /** Release the listeners that have been installed in SetupListeners(). + */ + void ReleaseListeners(); +}; + +} // end of namespace ::sd::slidesorter + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3