fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / sd / source / ui / inc / SlideSorter.hxx
blobcd3098d32290a26e0b7032f0383dd50609dbf5f6
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 SD_SLIDESORTER_SLIDE_SORTER_HXX
21 #define SD_SLIDESORTER_SLIDE_SORTER_HXX
23 #include "fupoor.hxx"
24 #include "Window.hxx"
25 #include <com/sun/star/frame/XController.hpp>
26 #include <cppuhelper/weakref.hxx>
27 #include <sfx2/viewfrm.hxx>
28 #include <boost/noncopyable.hpp>
29 #include <boost/shared_ptr.hpp>
30 #include <boost/scoped_ptr.hpp>
31 #include <boost/current_function.hpp>
34 class ScrollBar;
35 class ScrollBarBox;
36 class Window;
39 namespace sd {
40 class ViewShell;
41 class ViewShellBase;
42 class Window;
45 namespace sd { namespace slidesorter { namespace model {
46 class SlideSorterModel;
47 } } }
49 namespace sd { namespace slidesorter { namespace view {
50 class SlideSorterView;
51 class Theme;
52 } } }
54 namespace sd { namespace slidesorter { namespace controller {
55 class SlideSorterController;
56 class SlotManager;
57 class Properties;
58 } } }
61 typedef ::boost::shared_ptr<sd::Window> SharedSdWindow;
64 namespace sd { namespace slidesorter {
66 /** Show previews for all the slides in a document and allow the user to
67 insert or delete slides and modify the order of the slides.
69 This class is a facade for the model, view, and controller classes.
70 It is a hub that allows access to the various parts of a slide sorter.
72 Note that this class is not in its final state.
74 class SlideSorter
75 : private ::boost::noncopyable
77 friend class controller::SlotManager;
78 public:
79 virtual ~SlideSorter (void);
81 /** Return whether the called SlideSorter object is valid and calling
82 its Get(Model,View,Controller) methods is safe. When <FALSE/> is
83 called then no other methods should be called.
84 Calling this method should be necessary only during startup and
85 shutdown (when that can be detected).
87 bool IsValid (void) const;
89 /** Create a new slide sorter that is strongly coupled to the given view
90 shell. Use this function for a slide sorter in the left pane.
91 @param rViewShell
92 Typically a SlideSorterViewShell object.
93 @param rpContentWindow
94 Typically the content window of the ViewShell.
95 @param rpHorizontalScrollBar
96 Typically the horizontal scroll bar of the ViewShell.
97 @param rpVerticalScrollBar
98 Typically the vertical scroll bar of the ViewShell.
99 @param rpScrollBarBox
100 The little square enclosed by the two scroll bars. Typically
101 the one from the ViewShell.
103 static ::boost::shared_ptr<SlideSorter> CreateSlideSorter (
104 ViewShell& rViewShell,
105 const ::boost::shared_ptr<sd::Window>& rpContentWindow,
106 const ::boost::shared_ptr<ScrollBar>& rpHorizontalScrollBar,
107 const ::boost::shared_ptr<ScrollBar>& rpVerticalScrollBar,
108 const ::boost::shared_ptr<ScrollBarBox>& rpScrollBarBox);
110 /** Create a new slide sorter that is losely coupled to the given view
111 shell. The view shell may even be missing.
112 @param rBase
113 ViewShellBase object of the enclosing application.
114 @param pViewShell
115 Supply when at hand.
116 @param rParentWindow
117 The parent window of the internally created content window and
118 scroll bars.
120 static ::boost::shared_ptr<SlideSorter> CreateSlideSorter (
121 ViewShellBase& rBase,
122 ViewShell* pViewShell,
123 ::Window& rParentWindow);
125 /** Return the control of the vertical scroll bar.
127 ::boost::shared_ptr<ScrollBar> GetVerticalScrollBar (void) const;
129 /** Return the control of the horizontal scroll bar.
131 ::boost::shared_ptr<ScrollBar> GetHorizontalScrollBar (void) const;
133 /** Return the scroll bar filler that paints the little square that is
134 enclosed by the two scroll bars.
136 ::boost::shared_ptr<ScrollBarBox> GetScrollBarFiller (void) const;
138 /** Return the content window. This is a sibling and is geometrically
139 enclosed by the scroll bars.
141 SharedSdWindow GetContentWindow (void) const;
143 model::SlideSorterModel& GetModel (void) const;
145 view::SlideSorterView& GetView (void) const;
147 controller::SlideSorterController& GetController (void) const;
149 /** Return the view shell that was given at construction.
150 @return
151 May be empty.
153 ViewShell* GetViewShell (void) const;
155 /** Return the XController object of the main view.
157 ::com::sun::star::uno::Reference<com::sun::star::frame::XController>
158 GetXController (void) const;
160 /** Return the ViewShellBase object.
161 @return
162 May be empty.
164 ViewShellBase* GetViewShellBase (void) const;
166 void Paint (const Rectangle& rRepaintArea);
168 /** Place and size the controls and windows. You may want to call this
169 method when something has changed that for instance affects the
170 visibility state of the scroll bars.
172 void ArrangeGUIElements (
173 const Point& rOffset,
174 const Size& rSize);
175 SvBorder GetBorder (void);
177 bool RelocateToWindow (::Window* pWindow);
179 /** Set the current function at the view shell or, when it is not
180 present, set it at the content window. This method supports the use
181 of functions even when there is no SlideSorterViewShell.
183 void SetCurrentFunction (const FunctionReference& rpFunction);
185 /** Return a collection of properties that are used througout the slide
186 sorter.
188 ::boost::shared_ptr<controller::Properties> GetProperties (void) const;
190 /** Return the active theme which gives access to colors and fonts.
192 ::boost::shared_ptr<view::Theme> GetTheme (void) const;
194 protected:
195 /** This virtual method makes it possible to create a specialization of
196 the slide sorter view shell that works with its own implementation
197 of model, view, and controller. The default implementation simply
198 calls the CreateModel(), CreateView(), and CreateController()
199 methods in this order.
201 virtual void CreateModelViewController (void);
203 /** Create the model for the view shell. When called from the default
204 implementation of CreateModelViewController() then neither view nor
205 controller do exist. Test their pointers when in doubt.
207 virtual model::SlideSorterModel* CreateModel (void);
209 /** Create the view for the view shell. When called from the default
210 implementation of CreateModelViewController() then the model but not
211 the controller does exist. Test their pointers when in doubt.
213 virtual view::SlideSorterView* CreateView (void);
215 /** Create the controller for the view shell. When called from the default
216 implementation of CreateModelViewController() then both the view and
217 the controller do exist. Test their pointers when in doubt.
219 virtual controller::SlideSorterController* CreateController (void);
221 private:
222 bool mbIsValid;
224 ::boost::scoped_ptr<controller::SlideSorterController> mpSlideSorterController;
225 ::boost::scoped_ptr<model::SlideSorterModel> mpSlideSorterModel;
226 ::boost::scoped_ptr<view::SlideSorterView> mpSlideSorterView;
227 ::com::sun::star::uno::WeakReference<com::sun::star::frame::XController> mxControllerWeak;
228 ViewShell* mpViewShell;
229 ViewShellBase* mpViewShellBase;
230 SharedSdWindow mpContentWindow;
231 bool mbOwnesContentWindow;
232 ::boost::shared_ptr<ScrollBar> mpHorizontalScrollBar;
233 ::boost::shared_ptr<ScrollBar> mpVerticalScrollBar;
234 ::boost::shared_ptr<ScrollBarBox> mpScrollBarBox;
236 /** Set this flag to <TRUE/> to force a layout before the next paint.
238 bool mbLayoutPending;
240 /** Some slide sorter wide properties that are used in different
241 classes.
243 ::boost::shared_ptr<controller::Properties> mpProperties;
244 ::boost::shared_ptr<view::Theme> mpTheme;
246 SlideSorter (
247 ViewShell& rViewShell,
248 const ::boost::shared_ptr<sd::Window>& rpContentWindow,
249 const ::boost::shared_ptr<ScrollBar>& rpHorizontalScrollBar,
250 const ::boost::shared_ptr<ScrollBar>& rpVerticalScrollBar,
251 const ::boost::shared_ptr<ScrollBarBox>& rpScrollBarBox);
252 SlideSorter (
253 ViewShellBase& rBase,
254 ViewShell* pViewShell,
255 ::Window& rParentWindow);
257 void Init (void);
258 /** Create the controls for the slide sorter. This are the tab bar
259 for switching the edit mode, the scroll bar, and the actual
260 slide sorter view window.
261 This method is usually called exactly one time from the
262 constructor.
264 void SetupControls (::Window* pParentWindow);
266 /** This method is usually called exactly one time from the
267 constructor.
269 void SetupListeners (void);
271 /** Release the listeners that have been installed in SetupListeners().
273 void ReleaseListeners (void);
276 } } // end of namespace ::sd::slidesorter
278 #endif
280 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */