Branch data 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 : :
21 : : #include "SlideSorter.hxx"
22 : :
23 : : #include "SlideSorterChildWindow.hrc"
24 : : #include "SlideSorterViewShell.hxx"
25 : : #include "controller/SlideSorterController.hxx"
26 : : #include "controller/SlsScrollBarManager.hxx"
27 : : #include "controller/SlsProperties.hxx"
28 : : #include "controller/SlsAnimator.hxx"
29 : : #include "view/SlideSorterView.hxx"
30 : : #include "view/SlsTheme.hxx"
31 : : #include "model/SlideSorterModel.hxx"
32 : :
33 : : #include "glob.hrc"
34 : : #include "DrawController.hxx"
35 : : #include "ViewShellBase.hxx"
36 : : #include "ViewShellManager.hxx"
37 : : #include "Window.hxx"
38 : :
39 : : #include <vcl/scrbar.hxx>
40 : : #include <vcl/svapp.hxx>
41 : :
42 : : #include <sfx2/dispatch.hxx>
43 : : #include "sdresid.hxx"
44 : :
45 : : using namespace ::com::sun::star::uno;
46 : : using namespace ::com::sun::star;
47 : :
48 : :
49 : : namespace sd { namespace slidesorter {
50 : :
51 : : namespace {
52 : : class ContentWindow : public ::sd::Window
53 : : {
54 : : public:
55 : : ContentWindow(::Window& rParent, SlideSorter& rSlideSorter);
56 : : ~ContentWindow (void);
57 : : void SetCurrentFunction (const FunctionReference& rpFunction);
58 : : virtual void Paint(const Rectangle& rRect);
59 : : virtual void KeyInput (const KeyEvent& rEvent);
60 : : virtual void MouseMove (const MouseEvent& rEvent);
61 : : virtual void MouseButtonUp (const MouseEvent& rEvent);
62 : : virtual void MouseButtonDown (const MouseEvent& rEvent);
63 : : virtual void Command (const CommandEvent& rEvent);
64 : : virtual long Notify (NotifyEvent& rEvent);
65 : :
66 : : private:
67 : : SlideSorter& mrSlideSorter;
68 : : FunctionReference mpCurrentFunction;
69 : : };
70 : : }
71 : :
72 : :
73 : :
74 : :
75 : : //===== SlideSorter ===========================================================
76 : :
77 : 130 : ::boost::shared_ptr<SlideSorter> SlideSorter::CreateSlideSorter(
78 : : ViewShell& rViewShell,
79 : : const ::boost::shared_ptr<sd::Window>& rpContentWindow,
80 : : const ::boost::shared_ptr<ScrollBar>& rpHorizontalScrollBar,
81 : : const ::boost::shared_ptr<ScrollBar>& rpVerticalScrollBar,
82 : : const ::boost::shared_ptr<ScrollBarBox>& rpScrollBarBox)
83 : : {
84 : : ::boost::shared_ptr<SlideSorter> pSlideSorter(
85 : : new SlideSorter(
86 : : rViewShell,
87 : : rpContentWindow,
88 : : rpHorizontalScrollBar,
89 : : rpVerticalScrollBar,
90 [ + - ][ + - ]: 130 : rpScrollBarBox));
91 [ + - ]: 130 : pSlideSorter->Init();
92 : 130 : return pSlideSorter;
93 : : }
94 : :
95 : :
96 : :
97 : :
98 : 0 : ::boost::shared_ptr<SlideSorter> SlideSorter::CreateSlideSorter (
99 : : ViewShellBase& rBase,
100 : : ViewShell* pViewShell,
101 : : ::Window& rParentWindow)
102 : : {
103 : : ::boost::shared_ptr<SlideSorter> pSlideSorter(
104 : : new SlideSorter(
105 : : rBase,
106 : : pViewShell,
107 [ # # ][ # # ]: 0 : rParentWindow));
108 [ # # ]: 0 : pSlideSorter->Init();
109 : 0 : return pSlideSorter;
110 : : }
111 : :
112 : :
113 : :
114 : :
115 : 130 : SlideSorter::SlideSorter (
116 : : ViewShell& rViewShell,
117 : : const ::boost::shared_ptr<sd::Window>& rpContentWindow,
118 : : const ::boost::shared_ptr<ScrollBar>& rpHorizontalScrollBar,
119 : : const ::boost::shared_ptr<ScrollBar>& rpVerticalScrollBar,
120 : : const ::boost::shared_ptr<ScrollBarBox>& rpScrollBarBox)
121 : : : mbIsValid(false),
122 : : mpSlideSorterController(),
123 : : mpSlideSorterModel(),
124 : : mpSlideSorterView(),
125 : : mxControllerWeak(),
126 : : mpViewShell(&rViewShell),
127 [ + - ]: 130 : mpViewShellBase(&rViewShell.GetViewShellBase()),
128 : : mpContentWindow(rpContentWindow),
129 : : mbOwnesContentWindow(false),
130 : : mpHorizontalScrollBar(rpHorizontalScrollBar),
131 : : mpVerticalScrollBar(rpVerticalScrollBar),
132 : : mpScrollBarBox(rpScrollBarBox),
133 : : mbLayoutPending(true),
134 : 0 : mpProperties(new controller::Properties()),
135 [ + - ][ + - ]: 260 : mpTheme(new view::Theme(mpProperties))
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ]
136 : : {
137 : 130 : }
138 : :
139 : :
140 : :
141 : :
142 : 0 : SlideSorter::SlideSorter (
143 : : ViewShellBase& rBase,
144 : : ViewShell* pViewShell,
145 : : ::Window& rParentWindow)
146 : : : mbIsValid(false),
147 : : mpSlideSorterController(),
148 : : mpSlideSorterModel(),
149 : : mpSlideSorterView(),
150 : : mxControllerWeak(),
151 : : mpViewShell(pViewShell),
152 : : mpViewShellBase(&rBase),
153 [ # # ]: 0 : mpContentWindow(new ContentWindow(rParentWindow,*this )),
154 : : mbOwnesContentWindow(true),
155 [ # # ]: 0 : mpHorizontalScrollBar(new ScrollBar(&rParentWindow,WinBits(WB_HSCROLL | WB_DRAG))),
156 [ # # ]: 0 : mpVerticalScrollBar(new ScrollBar(&rParentWindow,WinBits(WB_VSCROLL | WB_DRAG))),
157 [ # # ]: 0 : mpScrollBarBox(new ScrollBarBox(&rParentWindow)),
158 : : mbLayoutPending(true),
159 : 0 : mpProperties(new controller::Properties()),
160 [ # # ][ # # ]: 0 : mpTheme(new view::Theme(mpProperties))
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
161 : : {
162 : 0 : }
163 : :
164 : :
165 : :
166 : :
167 : 130 : void SlideSorter::Init (void)
168 : : {
169 [ + - ]: 130 : if (mpViewShellBase != NULL)
170 [ + - ][ + - ]: 130 : mxControllerWeak = mpViewShellBase->GetController();
171 : :
172 : : // Reinitialize colors in Properties with window specific values.
173 [ + - ]: 130 : if (mpContentWindow)
174 : : {
175 : : mpProperties->SetBackgroundColor(
176 [ + - ]: 130 : mpContentWindow->GetSettings().GetStyleSettings().GetWindowColor());
177 : : mpProperties->SetTextColor(
178 [ + - ]: 130 : mpContentWindow->GetSettings().GetStyleSettings().GetWindowTextColor());
179 : : mpProperties->SetSelectionColor(
180 [ + - ]: 130 : mpContentWindow->GetSettings().GetStyleSettings().GetMenuHighlightColor());
181 : : mpProperties->SetHighlightColor(
182 [ + - ]: 130 : mpContentWindow->GetSettings().GetStyleSettings().GetMenuHighlightColor());
183 : : }
184 : :
185 [ + - ]: 130 : CreateModelViewController ();
186 : :
187 [ + - ]: 130 : SetupListeners ();
188 : :
189 : : // Initialize the window.
190 [ + - ]: 130 : SharedSdWindow pContentWindow (GetContentWindow());
191 [ + - ]: 130 : if (pContentWindow)
192 : : {
193 [ + - ]: 130 : ::Window* pParentWindow = pContentWindow->GetParent();
194 [ + - ]: 130 : if (pParentWindow != NULL)
195 [ + - ][ + - ]: 130 : pParentWindow->SetBackground(Wallpaper());
[ + - ]
196 [ + - ][ + - ]: 130 : pContentWindow->SetBackground(Wallpaper());
[ + - ]
197 [ + - ]: 130 : pContentWindow->SetViewOrigin (Point(0,0));
198 : : // We do our own scrolling while dragging a page selection.
199 [ + - ]: 130 : pContentWindow->SetUseDropScroll (false);
200 : : // Change the winbits so that the active window accepts the focus.
201 [ + - ][ + - ]: 130 : pContentWindow->SetStyle ((pContentWindow->GetStyle() & ~WB_DIALOGCONTROL) | WB_TABSTOP);
202 [ + - ]: 130 : pContentWindow->Hide();
203 : :
204 : : // Set view pointer of base class.
205 [ + - ]: 130 : SetupControls(pParentWindow);
206 : :
207 : 130 : mbIsValid = true;
208 [ + - ]: 130 : }
209 : 130 : }
210 : :
211 : :
212 : :
213 : :
214 [ + - ][ + - ]: 130 : SlideSorter::~SlideSorter (void)
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
215 : : {
216 : 130 : mbIsValid = false;
217 : :
218 [ + - ]: 130 : ReleaseListeners();
219 : :
220 : : // Dispose model, view and controller to avoid calls between them when
221 : : // they are being destructed and one or two of them are already gone.
222 [ + - ]: 130 : mpSlideSorterController->Dispose();
223 [ + - ]: 130 : mpSlideSorterView->Dispose();
224 [ + - ]: 130 : mpSlideSorterModel->Dispose();
225 : :
226 : : // Reset the auto pointers explicitly to control the order of destruction.
227 [ + - ]: 130 : mpSlideSorterController.reset();
228 [ + - ]: 130 : mpSlideSorterView.reset();
229 [ + - ]: 130 : mpSlideSorterModel.reset();
230 : :
231 [ + - ]: 130 : mpHorizontalScrollBar.reset();
232 [ + - ]: 130 : mpVerticalScrollBar.reset();
233 [ + - ]: 130 : mpScrollBarBox.reset();
234 : :
235 : 130 : if (mbOwnesContentWindow)
236 : : {
237 : : OSL_ASSERT(mpContentWindow.unique());
238 : : }
239 : : else
240 : : {
241 : : // Assume that outside this class only the owner holds a reference
242 : : // to the content window.
243 : : OSL_ASSERT(mpContentWindow.use_count()==2);
244 : : }
245 [ + - ]: 130 : mpContentWindow.reset();
246 [ - + ]: 260 : }
247 : :
248 : :
249 : :
250 : :
251 : 0 : bool SlideSorter::IsValid (void) const
252 : : {
253 : 0 : return mbIsValid;
254 : : }
255 : :
256 : :
257 : :
258 : :
259 : 867 : ::boost::shared_ptr<ScrollBar> SlideSorter::GetVerticalScrollBar (void) const
260 : : {
261 : 867 : return mpVerticalScrollBar;
262 : : }
263 : :
264 : :
265 : :
266 : :
267 : :
268 : 607 : ::boost::shared_ptr<ScrollBar> SlideSorter::GetHorizontalScrollBar (void) const
269 : : {
270 : 607 : return mpHorizontalScrollBar;
271 : : }
272 : :
273 : :
274 : :
275 : :
276 : 130 : ::boost::shared_ptr<ScrollBarBox> SlideSorter::GetScrollBarFiller (void) const
277 : : {
278 : 130 : return mpScrollBarBox;
279 : : }
280 : :
281 : :
282 : :
283 : :
284 : 4772 : model::SlideSorterModel& SlideSorter::GetModel (void) const
285 : : {
286 : : OSL_ASSERT(mpSlideSorterModel.get()!=NULL);
287 : 4772 : return *mpSlideSorterModel;
288 : : }
289 : :
290 : :
291 : :
292 : :
293 : 7080 : view::SlideSorterView& SlideSorter::GetView (void) const
294 : : {
295 : : OSL_ASSERT(mpSlideSorterView.get()!=NULL);
296 : 7080 : return *mpSlideSorterView;
297 : : }
298 : :
299 : :
300 : :
301 : :
302 : 4394 : controller::SlideSorterController& SlideSorter::GetController (void) const
303 : : {
304 : : OSL_ASSERT(mpSlideSorterController.get()!=NULL);
305 : 4394 : return *mpSlideSorterController;
306 : : }
307 : :
308 : :
309 : :
310 : :
311 : 390 : Reference<frame::XController> SlideSorter::GetXController (void) const
312 : : {
313 : 390 : Reference<frame::XController> xController(mxControllerWeak);
314 : 390 : return xController;
315 : : }
316 : :
317 : :
318 : :
319 : :
320 : 0 : void SlideSorter::Paint (const Rectangle& rRepaintArea)
321 : : {
322 [ # # ]: 0 : GetController().Paint(
323 : : rRepaintArea,
324 [ # # ]: 0 : GetContentWindow().get());
325 : 0 : }
326 : :
327 : :
328 : :
329 : :
330 : 190922 : ::SharedSdWindow SlideSorter::GetContentWindow (void) const
331 : : {
332 : 190922 : return mpContentWindow;
333 : : }
334 : :
335 : :
336 : :
337 : :
338 : 10336 : ViewShellBase* SlideSorter::GetViewShellBase (void) const
339 : : {
340 : 10336 : return mpViewShellBase;
341 : : }
342 : :
343 : :
344 : :
345 : :
346 : 3037 : ViewShell* SlideSorter::GetViewShell (void) const
347 : : {
348 : 3037 : return mpViewShell;
349 : : }
350 : :
351 : :
352 : :
353 : :
354 : 260 : void SlideSorter::SetupControls (::Window* )
355 : : {
356 [ + - ]: 260 : GetVerticalScrollBar()->Show();
357 : 260 : mpSlideSorterController->GetScrollBarManager().LateInitialization();
358 : 260 : }
359 : :
360 : :
361 : :
362 : :
363 : 260 : void SlideSorter::SetupListeners (void)
364 : : {
365 [ + - ]: 260 : SharedSdWindow pWindow (GetContentWindow());
366 [ + - ]: 260 : if (pWindow)
367 : : {
368 [ + - ]: 260 : ::Window* pParentWindow = pWindow->GetParent();
369 [ + - ]: 260 : if (pParentWindow != NULL)
370 : : pParentWindow->AddEventListener(
371 : 260 : LINK(
372 : : mpSlideSorterController.get(),
373 : : controller::SlideSorterController,
374 [ + - ][ + - ]: 260 : WindowEventHandler));
375 : 260 : pWindow->AddEventListener(
376 : 260 : LINK(
377 : : mpSlideSorterController.get(),
378 : : controller::SlideSorterController,
379 [ + - + - ]: 520 : WindowEventHandler));
380 : : }
381 : : Application::AddEventListener(
382 : 260 : LINK(
383 : : mpSlideSorterController.get(),
384 : : controller::SlideSorterController,
385 [ + - ][ + - ]: 260 : WindowEventHandler));
386 : :
387 [ + - ][ + - ]: 260 : mpSlideSorterController->GetScrollBarManager().Connect();
[ + - ]
388 : 260 : }
389 : :
390 : :
391 : :
392 : :
393 : 260 : void SlideSorter::ReleaseListeners (void)
394 : : {
395 [ + - ][ + - ]: 260 : mpSlideSorterController->GetScrollBarManager().Disconnect();
396 : :
397 [ + - ]: 260 : SharedSdWindow pWindow (GetContentWindow());
398 [ + - ]: 260 : if (pWindow)
399 : : {
400 : 260 : pWindow->RemoveEventListener(
401 : 260 : LINK(mpSlideSorterController.get(),
402 : : controller::SlideSorterController,
403 [ + - + - ]: 520 : WindowEventHandler));
404 : :
405 [ + - ]: 260 : ::Window* pParentWindow = pWindow->GetParent();
406 [ + - ]: 260 : if (pParentWindow != NULL)
407 : : pParentWindow->RemoveEventListener(
408 : 260 : LINK(mpSlideSorterController.get(),
409 : : controller::SlideSorterController,
410 [ + - ][ + - ]: 260 : WindowEventHandler));
411 : : }
412 : : Application::RemoveEventListener(
413 : 260 : LINK(mpSlideSorterController.get(),
414 : : controller::SlideSorterController,
415 [ + - ][ + - ]: 260 : WindowEventHandler));
[ + - ]
416 : 260 : }
417 : :
418 : :
419 : :
420 : :
421 : 130 : void SlideSorter::CreateModelViewController (void)
422 : : {
423 : 130 : mpSlideSorterModel.reset(CreateModel());
424 : : DBG_ASSERT (mpSlideSorterModel.get()!=NULL,
425 : : "Can not create model for slide browser");
426 : :
427 : 130 : mpSlideSorterView.reset(CreateView());
428 : : DBG_ASSERT (mpSlideSorterView.get()!=NULL,
429 : : "Can not create view for slide browser");
430 : :
431 : 130 : mpSlideSorterController.reset(CreateController());
432 : : DBG_ASSERT (mpSlideSorterController.get()!=NULL,
433 : : "Can not create controller for slide browser");
434 : :
435 : : // Now that model, view, and controller are constructed, do the
436 : : // initialization that relies on all three being in place.
437 : 130 : mpSlideSorterModel->Init();
438 : 130 : mpSlideSorterController->Init();
439 : 130 : mpSlideSorterView->Init();
440 : 130 : }
441 : :
442 : :
443 : :
444 : :
445 : 130 : model::SlideSorterModel* SlideSorter::CreateModel (void)
446 : : {
447 : : // Get pointers to the document.
448 : 130 : ViewShellBase* pViewShellBase = GetViewShellBase();
449 [ + - ]: 130 : if (pViewShellBase != NULL)
450 : : {
451 : : OSL_ASSERT (pViewShellBase->GetDocument() != NULL);
452 : :
453 [ + - ]: 130 : return new model::SlideSorterModel(*this);
454 : : }
455 : : else
456 : 130 : return NULL;
457 : : }
458 : :
459 : :
460 : :
461 : :
462 : 130 : view::SlideSorterView* SlideSorter::CreateView (void)
463 : : {
464 [ + - ]: 130 : return new view::SlideSorterView (*this);
465 : : }
466 : :
467 : :
468 : :
469 : :
470 : 130 : controller::SlideSorterController* SlideSorter::CreateController (void)
471 : : {
472 : : controller::SlideSorterController* pController
473 [ + - ]: 130 : = new controller::SlideSorterController (*this);
474 : 130 : return pController;
475 : : }
476 : :
477 : :
478 : :
479 : :
480 : 263 : void SlideSorter::ArrangeGUIElements (
481 : : const Point& rOffset,
482 : : const Size& rSize)
483 : : {
484 : 263 : Point aOrigin (rOffset);
485 : :
486 [ + + + - : 925 : if (rSize.Width()>0
+ - ][ + - ]
[ + + ]
487 : 133 : && rSize.Height()>0
488 [ + - ][ + + ]: 396 : && GetContentWindow()
[ + - ][ # # ]
489 [ + - ][ + - ]: 396 : && GetContentWindow()->IsVisible())
[ + + ][ + - ]
[ # # ]
490 : : {
491 : : // Prevent untimely redraws while the view is not yet correctly
492 : : // resized.
493 [ + - ]: 133 : view::SlideSorterView::DrawLock aLock (*this);
494 [ + - ][ + - ]: 133 : GetContentWindow()->EnablePaint (sal_False);
[ + - ]
495 : :
496 [ + - ][ + - ]: 133 : mpSlideSorterController->Resize (Rectangle(aOrigin, rSize));
497 : :
498 [ + - ][ + - ]: 133 : GetContentWindow()->EnablePaint (sal_True);
[ + - ]
499 : :
500 [ + - ]: 133 : mbLayoutPending = false;
501 : : }
502 : 263 : }
503 : :
504 : :
505 : :
506 : :
507 : 0 : SvBorder SlideSorter::GetBorder (void)
508 : : {
509 : 0 : SvBorder aBorder;
510 : :
511 [ # # ]: 0 : ::boost::shared_ptr<ScrollBar> pScrollBar = GetVerticalScrollBar();
512 [ # # ][ # # ]: 0 : if (pScrollBar.get() != NULL && pScrollBar->IsVisible())
[ # # ][ # # ]
513 : 0 : aBorder.Right() = pScrollBar->GetOutputSizePixel().Width();
514 : :
515 [ # # ][ # # ]: 0 : pScrollBar = GetHorizontalScrollBar();
[ # # ]
516 [ # # ][ # # ]: 0 : if (pScrollBar.get() != NULL && pScrollBar->IsVisible())
[ # # ][ # # ]
517 : 0 : aBorder.Bottom() = pScrollBar->GetOutputSizePixel().Height();
518 : :
519 [ # # ]: 0 : return aBorder;
520 : : }
521 : :
522 : :
523 : :
524 : :
525 : 130 : bool SlideSorter::RelocateToWindow (::Window* pParentWindow)
526 : : {
527 : : // Stop all animations for they have been started for the old window.
528 [ + - ]: 130 : mpSlideSorterController->GetAnimator()->RemoveAllAnimations();
529 : :
530 : 130 : ReleaseListeners();
531 : :
532 [ + - ]: 130 : if (mpViewShell != NULL)
533 : 130 : mpViewShell->ViewShell::RelocateToParentWindow(pParentWindow);
534 : :
535 : 130 : SetupControls(mpViewShell->GetParentWindow());
536 : 130 : SetupListeners();
537 : :
538 : : // For accessibility we have to shortly hide the content window. This
539 : : // triggers the construction of a new accessibility object for the new
540 : : // view shell. (One is created earlier while the construtor of the base
541 : : // class is executed. But because at that time the correct
542 : : // accessibility object can not be constructed we do that now.)
543 [ + - ]: 130 : if (mpContentWindow.get() !=NULL)
544 : : {
545 : 130 : mpContentWindow->Hide();
546 : 130 : mpContentWindow->Show();
547 : : }
548 : :
549 : 130 : return true;
550 : : }
551 : :
552 : :
553 : :
554 : :
555 : 130 : void SlideSorter::SetCurrentFunction (const FunctionReference& rpFunction)
556 : : {
557 [ + - ]: 130 : if (GetViewShell() != NULL)
558 : : {
559 : 130 : GetViewShell()->SetCurrentFunction(rpFunction);
560 : 130 : GetViewShell()->SetOldFunction(rpFunction);
561 : : }
562 : : else
563 : : {
564 [ # # ]: 0 : ContentWindow* pWindow = dynamic_cast<ContentWindow*>(GetContentWindow().get());
565 [ # # ]: 0 : if (pWindow != NULL)
566 : 0 : pWindow->SetCurrentFunction(rpFunction);
567 : : }
568 : 130 : }
569 : :
570 : :
571 : :
572 : :
573 : 260 : ::boost::shared_ptr<controller::Properties> SlideSorter::GetProperties (void) const
574 : : {
575 : : OSL_ASSERT(mpProperties);
576 : 260 : return mpProperties;
577 : : }
578 : :
579 : :
580 : :
581 : :
582 : 3770 : ::boost::shared_ptr<view::Theme> SlideSorter::GetTheme (void) const
583 : : {
584 : : OSL_ASSERT(mpTheme);
585 : 3770 : return mpTheme;
586 : : }
587 : :
588 : :
589 : :
590 : :
591 : : //===== ContentWindow =========================================================
592 : :
593 : : namespace {
594 : :
595 : 0 : ContentWindow::ContentWindow(
596 : : ::Window& rParent,
597 : : SlideSorter& rSlideSorter)
598 : : : ::sd::Window(&rParent),
599 : : mrSlideSorter(rSlideSorter),
600 : 0 : mpCurrentFunction()
601 : : {
602 [ # # ][ # # ]: 0 : SetDialogControlFlags(GetDialogControlFlags() & ~WINDOW_DLGCTRL_WANTFOCUS);
603 [ # # ][ # # ]: 0 : SetStyle(GetStyle() | WB_NOPOINTERFOCUS);
604 : 0 : }
605 : :
606 : :
607 : :
608 : :
609 [ # # ]: 0 : ContentWindow::~ContentWindow (void)
610 : : {
611 [ # # ]: 0 : }
612 : :
613 : :
614 : :
615 : :
616 : 0 : void ContentWindow::SetCurrentFunction (const FunctionReference& rpFunction)
617 : : {
618 : 0 : mpCurrentFunction = rpFunction;
619 : 0 : }
620 : :
621 : :
622 : :
623 : :
624 : 0 : void ContentWindow::Paint (const Rectangle& rRect)
625 : : {
626 : 0 : mrSlideSorter.Paint(rRect);
627 : 0 : }
628 : :
629 : :
630 : :
631 : :
632 : 0 : void ContentWindow::KeyInput (const KeyEvent& rEvent)
633 : : {
634 [ # # ]: 0 : if (mpCurrentFunction.is())
635 : 0 : mpCurrentFunction->KeyInput(rEvent);
636 : 0 : }
637 : :
638 : :
639 : :
640 : :
641 : 0 : void ContentWindow::MouseMove (const MouseEvent& rEvent)
642 : : {
643 [ # # ]: 0 : if (mpCurrentFunction.is())
644 : 0 : mpCurrentFunction->MouseMove(rEvent);
645 : 0 : }
646 : :
647 : :
648 : :
649 : :
650 : 0 : void ContentWindow::MouseButtonUp(const MouseEvent& rEvent)
651 : : {
652 [ # # ]: 0 : if (mpCurrentFunction.is())
653 : 0 : mpCurrentFunction->MouseButtonUp(rEvent);
654 : 0 : }
655 : :
656 : :
657 : :
658 : :
659 : 0 : void ContentWindow::MouseButtonDown(const MouseEvent& rEvent)
660 : : {
661 [ # # ]: 0 : if (mpCurrentFunction.is())
662 : 0 : mpCurrentFunction->MouseButtonDown(rEvent);
663 : 0 : }
664 : :
665 : :
666 : :
667 : :
668 : 0 : void ContentWindow::Command(const CommandEvent& rEvent)
669 : : {
670 [ # # ]: 0 : if (mpCurrentFunction.is())
671 : 0 : mpCurrentFunction->Command(rEvent);
672 : 0 : }
673 : :
674 : :
675 : :
676 : :
677 : 0 : long ContentWindow::Notify (NotifyEvent& rEvent)
678 : : {
679 : : (void)rEvent;
680 : 0 : return 0;
681 : : }
682 : :
683 : :
684 : :
685 : : } // end of anonymous namespace
686 : :
687 : :
688 : :
689 : :
690 : :
691 : : } } // end of namespace ::sd::slidesorter
692 : :
693 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|