xref: /trunk/main/sd/source/ui/slideshow/showwindow.hxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SD_SHOW_WINDOW_HXX
29 #define SD_SHOW_WINDOW_HXX
30 
31 #include <rtl/ref.hxx>
32 #include <sal/types.h>
33 #include <vcl/timer.hxx>
34 #include <vcl/graph.hxx>
35 
36 #ifndef SD_WINDOW_HXX
37 #include "Window.hxx"
38 #endif
39 
40 #include "slideshowimpl.hxx"
41 
42 // ----------------
43 // - SdShowWindow -
44 // ----------------
45 
46 
47 namespace sd {
48 
49 class SlideshowImpl;
50 class PreviewWindow;
51 class ViewShell;
52 
53 // -----------
54 // - Defines -
55 // -----------
56 
57 #define SLIDE_NO_TIMEOUT SAL_MAX_INT32
58 
59 // ---------
60 // - Enums -
61 // ---------
62 
63 enum ShowWindowMode
64 {
65     SHOWWINDOWMODE_NORMAL = 0,
66     SHOWWINDOWMODE_PAUSE = 1,
67     SHOWWINDOWMODE_END = 2,
68     SHOWWINDOWMODE_BLANK = 3,
69     SHOWWINDOWMODE_PREVIEW = 4
70 };
71 
72 //class ShowWindowImpl;
73 
74 class ShowWindow
75     : public ::sd::Window
76 {
77 //  friend class ShowWindowImpl;
78 public:
79     ShowWindow ( const ::rtl::Reference< ::sd::SlideshowImpl >& xController, ::Window* pParent );
80     virtual ~ShowWindow (void);
81 
82     sal_Bool            SetEndMode();
83     sal_Bool            SetPauseMode( sal_Int32 nPageIndexToRestart, sal_Int32 nTimeoutSec = SLIDE_NO_TIMEOUT, Graphic* pLogo = NULL );
84     sal_Bool            SetBlankMode( sal_Int32 nPageIndexToRestart, const Color& rBlankColor );
85 
86     const Color&        GetBlankColor() const { return maShowBackground.GetColor(); }
87 
88     void            SetPreviewMode();
89     void            SetPresentationArea( const Rectangle& rPresArea );
90 
91     void            SetMouseAutoHide( bool bMouseAutoHide ) { mbMouseAutoHide = bMouseAutoHide; }
92 
93     ShowWindowMode  GetShowWindowMode() const { return meShowWindowMode; }
94 
95     void            RestartShow( sal_Int32 nPageIndexToRestart );
96 
97     virtual void    Move();
98     virtual void    Resize();
99     virtual void    GetFocus();
100     virtual void    LoseFocus();
101 //  virtual void    GrabFocus();
102 
103     virtual void    KeyInput(const KeyEvent& rKEvt);
104     virtual void    MouseMove(const MouseEvent& rMEvt);
105     virtual void    MouseButtonUp(const MouseEvent& rMEvt);
106     virtual void    MouseButtonDown(const MouseEvent& rMEvt);
107     virtual void    Paint(const Rectangle& rRect);
108     virtual long    Notify(NotifyEvent& rNEvt);
109 
110     void            TerminateShow();
111     void            RestartShow();
112 
113 private:
114     void            DrawPauseScene( sal_Bool bTimeoutOnly );
115     void            DrawEndScene();
116     void            DrawBlankScene();
117 
118     void            DeleteWindowFromPaintView();
119     void            AddWindowToPaintView();
120 
121 private:
122     Timer           maPauseTimer;
123     Timer           maMouseTimer;
124     Wallpaper       maShowBackground;
125     Graphic         maLogo;
126     sal_uLong           mnPauseTimeout;
127     sal_Int32       mnRestartPageIndex;
128     ShowWindowMode  meShowWindowMode;
129     sal_Bool            mbShowNavigatorAfterSpecialMode;
130     Rectangle       maPresArea;
131     bool            mbMouseAutoHide;
132     bool            mbMouseCursorHidden;
133     sal_uLong           mnFirstMouseMove;
134 
135                     DECL_LINK( PauseTimeoutHdl, Timer* pTimer );
136                     DECL_LINK( MouseTimeoutHdl, Timer* pTimer );
137                     DECL_LINK( EventHdl, VclWindowEvent* pEvent );
138 
139     ::rtl::Reference< SlideshowImpl > mxController;
140 };
141 
142 } // end of namespace sd
143 
144 #endif
145