1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_INC_SLIDESORTER_HXX
21 #define INCLUDED_SD_SOURCE_UI_INC_SLIDESORTER_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>
32 #include <vcl/scrbar.hxx>
36 namespace vcl
{ class Window
; }
44 namespace sd
{ namespace slidesorter
{ namespace model
{
45 class SlideSorterModel
;
48 namespace sd
{ namespace slidesorter
{ namespace view
{
49 class SlideSorterView
;
53 namespace sd
{ namespace slidesorter
{ namespace controller
{
54 class SlideSorterController
;
59 namespace sd
{ namespace slidesorter
{
61 /** Show previews for all the slides in a document and allow the user to
62 insert or delete slides and modify the order of the slides.
64 This class is a facade for the model, view, and controller classes.
65 It is a hub that allows access to the various parts of a slide sorter.
67 Note that this class is not in its final state.
70 : private ::boost::noncopyable
72 friend class controller::SlotManager
;
74 virtual ~SlideSorter();
76 /** Return whether the called SlideSorter object is valid and calling
77 its Get(Model,View,Controller) methods is safe. When <FALSE/> is
78 called then no other methods should be called.
79 Calling this method should be necessary only during startup and
80 shutdown (when that can be detected).
82 bool IsValid() const { return mbIsValid
;}
84 /** Create a new slide sorter that is strongly coupled to the given view
85 shell. Use this function for a slide sorter in the left pane.
87 Typically a SlideSorterViewShell object.
88 @param rpContentWindow
89 Typically the content window of the ViewShell.
90 @param rpHorizontalScrollBar
91 Typically the horizontal scroll bar of the ViewShell.
92 @param rpVerticalScrollBar
93 Typically the vertical scroll bar of the ViewShell.
95 The little square enclosed by the two scroll bars. Typically
96 the one from the ViewShell.
98 static ::boost::shared_ptr
<SlideSorter
> CreateSlideSorter (
99 ViewShell
& rViewShell
,
100 sd::Window
* pContentWindow
,
101 ScrollBar
* pHorizontalScrollBar
,
102 ScrollBar
* pVerticalScrollBar
,
103 ScrollBarBox
* pScrollBarBox
);
105 /** Create a new slide sorter that is losely coupled to the given view
106 shell. The view shell may even be missing.
108 ViewShellBase object of the enclosing application.
112 The parent window of the internally created content window and
115 static ::boost::shared_ptr
<SlideSorter
> CreateSlideSorter (
116 ViewShellBase
& rBase
,
117 ViewShell
* pViewShell
,
118 vcl::Window
& rParentWindow
);
120 /** Return the control of the vertical scroll bar.
122 VclPtr
<ScrollBar
> GetVerticalScrollBar() const { return mpVerticalScrollBar
;}
124 /** Return the control of the horizontal scroll bar.
126 VclPtr
<ScrollBar
> GetHorizontalScrollBar() const { return mpHorizontalScrollBar
;}
128 /** Return the scroll bar filler that paints the little square that is
129 enclosed by the two scroll bars.
131 VclPtr
<ScrollBarBox
> GetScrollBarFiller (void) const { return mpScrollBarBox
;}
133 /** Return the content window. This is a sibling and is geometrically
134 enclosed by the scroll bars.
136 VclPtr
<sd::Window
> GetContentWindow() const { return mpContentWindow
;}
138 model::SlideSorterModel
& GetModel() const;
140 view::SlideSorterView
& GetView() const;
142 controller::SlideSorterController
& GetController() const;
144 /** Return the view shell that was given at construction.
148 ViewShell
* GetViewShell() const { return mpViewShell
;}
150 /** Return the XController object of the main view.
152 ::com::sun::star::uno::Reference
<com::sun::star::frame::XController
>
153 GetXController() const;
155 /** Return the ViewShellBase object.
159 ViewShellBase
* GetViewShellBase() const { return mpViewShellBase
;}
161 void Paint (const Rectangle
& rRepaintArea
);
163 /** Place and size the controls and windows. You may want to call this
164 method when something has changed that for instance affects the
165 visibility state of the scroll bars.
167 void ArrangeGUIElements (
168 const Point
& rOffset
,
171 bool RelocateToWindow (vcl::Window
* pWindow
);
173 /** Set the current function at the view shell or, when it is not
174 present, set it at the content window. This method supports the use
175 of functions even when there is no SlideSorterViewShell.
177 void SetCurrentFunction (const rtl::Reference
<FuPoor
>& rpFunction
);
179 /** Return a collection of properties that are used throughout the slide
182 ::boost::shared_ptr
<controller::Properties
> GetProperties() const;
184 /** Return the active theme which gives access to colors and fonts.
186 ::boost::shared_ptr
<view::Theme
> GetTheme() const;
189 /** This virtual method makes it possible to create a specialization of
190 the slide sorter view shell that works with its own implementation
191 of model, view, and controller. The default implementation simply
192 calls the CreateModel(), CreateView(), and CreateController()
193 methods in this order.
195 void CreateModelViewController();
197 /** Create the model for the view shell. When called from the default
198 implementation of CreateModelViewController() then neither view nor
199 controller do exist. Test their pointers when in doubt.
201 model::SlideSorterModel
* CreateModel();
203 /** Create the view for the view shell. When called from the default
204 implementation of CreateModelViewController() then the model but not
205 the controller does exist. Test their pointers when in doubt.
207 view::SlideSorterView
* CreateView();
209 /** Create the controller for the view shell. When called from the default
210 implementation of CreateModelViewController() then both the view and
211 the controller do exist. Test their pointers when in doubt.
213 controller::SlideSorterController
* CreateController();
218 ::boost::scoped_ptr
<controller::SlideSorterController
> mpSlideSorterController
;
219 ::boost::scoped_ptr
<model::SlideSorterModel
> mpSlideSorterModel
;
220 ::boost::scoped_ptr
<view::SlideSorterView
> mpSlideSorterView
;
221 ::com::sun::star::uno::WeakReference
<com::sun::star::frame::XController
> mxControllerWeak
;
222 ViewShell
* mpViewShell
;
223 ViewShellBase
* mpViewShellBase
;
224 VclPtr
<sd::Window
> mpContentWindow
;
225 bool mbOwnesContentWindow
;
226 VclPtr
<ScrollBar
> mpHorizontalScrollBar
;
227 VclPtr
<ScrollBar
> mpVerticalScrollBar
;
228 VclPtr
<ScrollBarBox
> mpScrollBarBox
;
230 /** Set this flag to <TRUE/> to force a layout before the next paint.
232 bool mbLayoutPending
;
234 /** Some slide sorter wide properties that are used in different
237 ::boost::shared_ptr
<controller::Properties
> mpProperties
;
238 ::boost::shared_ptr
<view::Theme
> mpTheme
;
241 ViewShell
& rViewShell
,
242 sd::Window
* pContentWindow
,
243 ScrollBar
* pHorizontalScrollBar
,
244 ScrollBar
* pVerticalScrollBar
,
245 ScrollBarBox
* pScrollBarBox
);
247 ViewShellBase
& rBase
,
248 ViewShell
* pViewShell
,
249 vcl::Window
& rParentWindow
);
252 /** Create the controls for the slide sorter. This are the tab bar
253 for switching the edit mode, the scroll bar, and the actual
254 slide sorter view window.
255 This method is usually called exactly one time from the
258 void SetupControls (vcl::Window
* pParentWindow
);
260 /** This method is usually called exactly one time from the
263 void SetupListeners();
265 /** Release the listeners that have been installed in SetupListeners().
267 void ReleaseListeners();
270 } } // end of namespace ::sd::slidesorter
274 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */