Line data Source code
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 :
20 : #ifndef INCLUDED_SD_SOURCE_UI_SLIDESORTER_INC_CONTROLLER_SLSVISIBLEAREAMANAGER_HXX
21 : #define INCLUDED_SD_SOURCE_UI_SLIDESORTER_INC_CONTROLLER_SLSVISIBLEAREAMANAGER_HXX
22 :
23 : #include "controller/SlsAnimator.hxx"
24 : #include "model/SlsSharedPageDescriptor.hxx"
25 : #include <boost/noncopyable.hpp>
26 : #include <boost/optional.hpp>
27 :
28 : namespace sd { namespace slidesorter { namespace controller {
29 :
30 : /** Manage requests for scrolling page objects into view.
31 : */
32 : class VisibleAreaManager
33 : : public ::boost::noncopyable
34 : {
35 : public:
36 : VisibleAreaManager (SlideSorter& rSlideSorter);
37 : ~VisibleAreaManager();
38 :
39 : void ActivateCurrentSlideTracking();
40 : void DeactivateCurrentSlideTracking();
41 0 : bool IsCurrentSlideTrackingActive() const { return mbIsCurrentSlideTrackingActive;}
42 :
43 : /** Request the current slide to be moved into the visible area.
44 : This request is only obeyed when the current slide tracking is
45 : active.
46 : @see ActivateCurrentSlideTracking() and DeactivateCurrentSlideTracking()
47 : */
48 : void RequestCurrentSlideVisible();
49 :
50 : /** Request to make the specified page object visible.
51 : */
52 : void RequestVisible (
53 : const model::SharedPageDescriptor& rpDescriptor,
54 : const bool bForce = false);
55 :
56 : /** Temporarily disable the update of the visible area.
57 : */
58 : class TemporaryDisabler
59 : {
60 : public:
61 : TemporaryDisabler (SlideSorter& rSlideSorter);
62 : ~TemporaryDisabler();
63 : private:
64 : VisibleAreaManager& mrVisibleAreaManager;
65 : };
66 :
67 : private:
68 : SlideSorter& mrSlideSorter;
69 :
70 : /** List of rectangle that someone wants to be moved into the visible
71 : area.
72 : Cleared on every call to ForgetVisibleRequests() and MakeVisible().
73 : */
74 : ::std::vector<Rectangle> maVisibleRequests;
75 :
76 : /** Animation id for a scroll animation that sets the top
77 : and left of the visible area to maRequestedVisibleTopLeft.
78 : */
79 : Animator::AnimationId mnScrollAnimationId;
80 : Point maRequestedVisibleTopLeft;
81 : Animator::AnimationMode meRequestedAnimationMode;
82 : bool mbIsCurrentSlideTrackingActive;
83 : int mnDisableCount;
84 :
85 : void MakeVisible();
86 : ::boost::optional<Point> GetRequestedTopLeft() const;
87 : };
88 :
89 : } } } // end of namespace ::sd::slidesorter::view
90 :
91 : #endif
92 :
93 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|