1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef SD_SLIDESORTER_SLIDE_SORTER_HXX
#define SD_SLIDESORTER_SLIDE_SORTER_HXX
#include "fupoor.hxx"
#include "Window.hxx"
#include <com/sun/star/frame/XController.hpp>
#include <cppuhelper/weakref.hxx>
#include <sfx2/viewfrm.hxx>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/current_function.hpp>
class ScrollBar;
class ScrollBarBox;
class Window;
namespace sd {
class ViewShell;
class ViewShellBase;
class Window;
}
namespace sd { namespace slidesorter { namespace model {
class SlideSorterModel;
} } }
namespace sd { namespace slidesorter { namespace view {
class SlideSorterView;
class Theme;
} } }
namespace sd { namespace slidesorter { namespace controller {
class Listener;
class SlideSorterController;
class SlotManager;
class Properties;
} } }
typedef ::boost::shared_ptr<sd::Window> SharedSdWindow;
namespace sd { namespace 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
: private ::boost::noncopyable
{
friend class controller::SlotManager;
public:
virtual ~SlideSorter (void);
/** Return whether the called SlideSorter object is valid and calling
its Get(Model,View,Controller) methods is safe. When <FALSE/> 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 (void) const;
/** 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 ::boost::shared_ptr<SlideSorter> CreateSlideSorter (
ViewShell& rViewShell,
const ::boost::shared_ptr<sd::Window>& rpContentWindow,
const ::boost::shared_ptr<ScrollBar>& rpHorizontalScrollBar,
const ::boost::shared_ptr<ScrollBar>& rpVerticalScrollBar,
const ::boost::shared_ptr<ScrollBarBox>& rpScrollBarBox);
/** Create a new slide sorter that is losely 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 ::boost::shared_ptr<SlideSorter> CreateSlideSorter (
ViewShellBase& rBase,
ViewShell* pViewShell,
::Window& rParentWindow);
/** Return the control of the vertical scroll bar.
*/
::boost::shared_ptr<ScrollBar> GetVerticalScrollBar (void) const;
/** Return the control of the horizontal scroll bar.
*/
::boost::shared_ptr<ScrollBar> GetHorizontalScrollBar (void) const;
/** Return the scroll bar filler that paints the little square that is
enclosed by the two scroll bars.
*/
::boost::shared_ptr<ScrollBarBox> GetScrollBarFiller (void) const;
/** Return the content window. This is a sibling and is geometrically
enclosed by the scroll bars.
*/
SharedSdWindow GetContentWindow (void) const;
model::SlideSorterModel& GetModel (void) const;
view::SlideSorterView& GetView (void) const;
controller::SlideSorterController& GetController (void) const;
/** Return the view shell that was given at construction.
@return
May be empty.
*/
ViewShell* GetViewShell (void) const;
/** Return the XController object of the main view.
*/
::com::sun::star::uno::Reference<com::sun::star::frame::XController>
GetXController (void) const;
/** Return the ViewShellBase object.
@return
May be empty.
*/
ViewShellBase* GetViewShellBase (void) const;
void Paint (const 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);
SvBorder GetBorder (void);
bool RelocateToWindow (::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 FunctionReference& rpFunction);
/** Return a collection of properties that are used througout the slide
sorter.
*/
::boost::shared_ptr<controller::Properties> GetProperties (void) const;
/** Return the active theme wich gives access to colors and fonts.
*/
::boost::shared_ptr<view::Theme> GetTheme (void) const;
protected:
/** 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.
*/
virtual void CreateModelViewController (void);
/** 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.
*/
virtual model::SlideSorterModel* CreateModel (void);
/** Create the view for the view shell. When called from the default
implementation of CreateModelViewController() then the model but not
the controller does exist. Test their pointers when in doubt.
*/
virtual view::SlideSorterView* CreateView (void);
/** Create the controller for the view shell. When called from the default
implementation of CreateModelViewController() then both the view and
the controller do exist. Test their pointers when in doubt.
*/
virtual controller::SlideSorterController* CreateController (void);
private:
bool mbIsValid;
::boost::scoped_ptr<controller::SlideSorterController> mpSlideSorterController;
::boost::scoped_ptr<model::SlideSorterModel> mpSlideSorterModel;
::boost::scoped_ptr<view::SlideSorterView> mpSlideSorterView;
::com::sun::star::uno::WeakReference<com::sun::star::frame::XController> mxControllerWeak;
ViewShell* mpViewShell;
ViewShellBase* mpViewShellBase;
SharedSdWindow mpContentWindow;
bool mbOwnesContentWindow;
::boost::shared_ptr<ScrollBar> mpHorizontalScrollBar;
::boost::shared_ptr<ScrollBar> mpVerticalScrollBar;
::boost::shared_ptr<ScrollBarBox> mpScrollBarBox;
/** Set this flag to <TRUE/> to force a layout before the next paint.
*/
bool mbLayoutPending;
/** Some slide sorter wide properties that are used in different
classes.
*/
::boost::shared_ptr<controller::Properties> mpProperties;
::boost::shared_ptr<view::Theme> mpTheme;
SlideSorter (
ViewShell& rViewShell,
const ::boost::shared_ptr<sd::Window>& rpContentWindow,
const ::boost::shared_ptr<ScrollBar>& rpHorizontalScrollBar,
const ::boost::shared_ptr<ScrollBar>& rpVerticalScrollBar,
const ::boost::shared_ptr<ScrollBarBox>& rpScrollBarBox);
SlideSorter (
ViewShellBase& rBase,
ViewShell* pViewShell,
::Window& rParentWindow);
void Init (void);
/** 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 (::Window* pParentWindow);
/** This method is usually called exactly one time from the
constructor.
*/
void SetupListeners (void);
/** Release the listeners that have been installed in SetupListeners().
*/
void ReleaseListeners (void);
};
} } // end of namespace ::sd::slidesorter
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|