1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SD_SHOW_WINDOW_HXX
25 #define SD_SHOW_WINDOW_HXX
26 
27 #include <rtl/ref.hxx>
28 #include <sal/types.h>
29 #include <vcl/timer.hxx>
30 #include <vcl/graph.hxx>
31 
32 #ifndef SD_WINDOW_HXX
33 #include "Window.hxx"
34 #endif
35 
36 #include "slideshowimpl.hxx"
37 
38 // ----------------
39 // - SdShowWindow -
40 // ----------------
41 
42 
43 namespace sd {
44 
45 class SlideshowImpl;
46 class PreviewWindow;
47 class ViewShell;
48 
49 // -----------
50 // - Defines -
51 // -----------
52 
53 #define SLIDE_NO_TIMEOUT SAL_MAX_INT32
54 
55 // ---------
56 // - Enums -
57 // ---------
58 
59 enum ShowWindowMode
60 {
61     SHOWWINDOWMODE_NORMAL = 0,
62     SHOWWINDOWMODE_PAUSE = 1,
63     SHOWWINDOWMODE_END = 2,
64     SHOWWINDOWMODE_BLANK = 3,
65 	SHOWWINDOWMODE_PREVIEW = 4
66 };
67 
68 //class ShowWindowImpl;
69 
70 class ShowWindow
71     : public ::sd::Window
72 {
73 //	friend class ShowWindowImpl;
74 public:
75 	ShowWindow ( const ::rtl::Reference< ::sd::SlideshowImpl >& xController, ::Window* pParent );
76     virtual ~ShowWindow (void);
77 
78    	sal_Bool			SetEndMode();
79 	sal_Bool			SetPauseMode( sal_Int32 nPageIndexToRestart, sal_Int32 nTimeoutSec = SLIDE_NO_TIMEOUT, Graphic* pLogo = NULL );
80 	sal_Bool			SetBlankMode( sal_Int32 nPageIndexToRestart, const Color& rBlankColor );
81 
82 	const Color&		GetBlankColor() const { return maShowBackground.GetColor(); }
83 
84 	void			SetPreviewMode();
85 	void			SetPresentationArea( const Rectangle& rPresArea );
86 
87 	void			SetMouseAutoHide( bool bMouseAutoHide ) { mbMouseAutoHide = bMouseAutoHide; }
88 
89 	ShowWindowMode  GetShowWindowMode() const { return meShowWindowMode; }
90 
91 	void			RestartShow( sal_Int32 nPageIndexToRestart );
92 
93     virtual void	Move();
94     virtual void	Resize();
95     virtual void	GetFocus();
96     virtual void	LoseFocus();
97 //	virtual void	GrabFocus();
98 
99 	virtual void	KeyInput(const KeyEvent& rKEvt);
100 	virtual void	MouseMove(const MouseEvent& rMEvt);
101 	virtual void	MouseButtonUp(const MouseEvent& rMEvt);
102 	virtual void	MouseButtonDown(const MouseEvent& rMEvt);
103 	virtual void	Paint(const Rectangle& rRect);
104 	virtual long	Notify(NotifyEvent& rNEvt);
105 
106 	void			TerminateShow();
107 	void			RestartShow();
108 
109 private:
110 	void			DrawPauseScene( sal_Bool bTimeoutOnly );
111 	void			DrawEndScene();
112 	void			DrawBlankScene();
113 
114 	void			DeleteWindowFromPaintView();
115 	void			AddWindowToPaintView();
116 
117 private:
118 	Timer			maPauseTimer;
119 	Timer			maMouseTimer;
120 	Wallpaper		maShowBackground;
121 	Graphic			maLogo;
122 	sal_uLong			mnPauseTimeout;
123 	sal_Int32		mnRestartPageIndex;
124     ShowWindowMode  meShowWindowMode;
125 	sal_Bool			mbShowNavigatorAfterSpecialMode;
126 	Rectangle		maPresArea;
127 	bool			mbMouseAutoHide;
128 	bool			mbMouseCursorHidden;
129 	sal_uLong			mnFirstMouseMove;
130 
131 					DECL_LINK( PauseTimeoutHdl, Timer* pTimer );
132 					DECL_LINK( MouseTimeoutHdl, Timer* pTimer );
133 					DECL_LINK( EventHdl, VclWindowEvent* pEvent );
134 
135 	::rtl::Reference< SlideshowImpl > mxController;
136 };
137 
138 } // end of namespace sd
139 
140 #endif
141