bump product version to 6.3.0.0.beta1
[LibreOffice.git] / sd / source / ui / slidesorter / inc / controller / SlsCurrentSlideManager.hxx
blob58d25f017984af98e320a54920739be387dd4437
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SD_SOURCE_UI_SLIDESORTER_INC_CONTROLLER_SLSCURRENTSLIDEMANAGER_HXX
21 #define INCLUDED_SD_SOURCE_UI_SLIDESORTER_INC_CONTROLLER_SLSCURRENTSLIDEMANAGER_HXX
23 #include <model/SlsSharedPageDescriptor.hxx>
24 #include <vcl/timer.hxx>
25 #include <tools/link.hxx>
27 class SdPage;
29 namespace sd { namespace slidesorter {
30 class SlideSorter;
31 } }
33 namespace sd { namespace slidesorter { namespace controller {
35 /** Manage the current slide. This includes setting the according flags at
36 the PageDescriptor objects and setting the current slide at the main
37 view shell.
39 Switching pages is triggered only after a little delay. This allows
40 fast travelling through a larger set of slides without having to wait
41 for the edit view to update its content after every slide change.
43 class CurrentSlideManager
45 public:
46 /** Create a new CurrentSlideManager object that manages the current
47 slide for the given SlideSorter.
49 CurrentSlideManager (SlideSorter& rSlideSorter);
51 ~CurrentSlideManager();
53 /** Call this when the current page of the main view shell has been
54 switched. Use SwitchCurrentSlide() to initiate such a switch.
56 void NotifyCurrentSlideChange (const sal_Int32 nSlideIndex);
57 void NotifyCurrentSlideChange (const SdPage* pPage);
59 /** Call this method to switch the current page of the main view shell
60 to the given slide. Use CurrentSlideHasChanged() when the current
61 slide change has been initiated by someone else.
62 @param nSlideIndex
63 Zero based index in the range [0,number-of-slides).
64 The page selection is cleared and only the new
65 current slide is selected.
67 void SwitchCurrentSlide (const sal_Int32 nSlideIndex);
68 void SwitchCurrentSlide (
69 const model::SharedPageDescriptor& rpSlide,
70 const bool bUpdateSelection = false);
72 /** Return the page descriptor for the current slide. Note, that when
73 there is no current slide then the returned pointer is empty.
75 const model::SharedPageDescriptor& GetCurrentSlide() { return mpCurrentSlide;}
77 /** Release all references to model data.
79 void PrepareModelChange();
81 /** Modify inner state in reaction to a change of the SlideSorterModel.
83 void HandleModelChange();
85 private:
86 SlideSorter& mrSlideSorter;
87 sal_Int32 mnCurrentSlideIndex;
88 model::SharedPageDescriptor mpCurrentSlide;
89 /** Timer to control the delay after which to ask
90 XController/ViewShellBase to switch to another slide.
92 Timer maSwitchPageDelayTimer;
94 void SetCurrentSlideAtViewShellBase (const model::SharedPageDescriptor& rpSlide);
95 void SetCurrentSlideAtTabControl (const model::SharedPageDescriptor& rpSlide);
96 void SetCurrentSlideAtXController (const model::SharedPageDescriptor& rpSlide);
98 /** When switching from one slide to a new current slide then this
99 method releases all ties to the old slide.
101 void ReleaseCurrentSlide();
103 /** When switching from one slide to a new current slide then this
104 method connects to the new current slide.
106 void AcquireCurrentSlide (const sal_Int32 nSlideIndex);
108 DECL_LINK(SwitchPageCallback, Timer*, void);
111 } } } // end of namespace ::sd::slidesorter::controller
113 #endif
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */