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 	//IAccessibility2 Implementation 2009-----
106 	//Overload the sd::Window's CreateAccessible to create a different accessible object
107     virtual ::com::sun::star::uno::Reference<
108         ::com::sun::star::accessibility::XAccessible>
109         CreateAccessible (void);
110 
111 	void			TerminateShow();
112 	void			RestartShow();
113 
114 private:
115 	void			DrawPauseScene( sal_Bool bTimeoutOnly );
116 	void			DrawEndScene();
117 	void			DrawBlankScene();
118 
119 	void			DeleteWindowFromPaintView();
120 	void			AddWindowToPaintView();
121 
122 private:
123 	Timer			maPauseTimer;
124 	Timer			maMouseTimer;
125 	Wallpaper		maShowBackground;
126 	Graphic			maLogo;
127 	sal_uLong			mnPauseTimeout;
128 	sal_Int32		mnRestartPageIndex;
129     ShowWindowMode  meShowWindowMode;
130 	sal_Bool			mbShowNavigatorAfterSpecialMode;
131 	Rectangle		maPresArea;
132 	bool			mbMouseAutoHide;
133 	bool			mbMouseCursorHidden;
134 	sal_uLong			mnFirstMouseMove;
135 
136 					DECL_LINK( PauseTimeoutHdl, Timer* pTimer );
137 					DECL_LINK( MouseTimeoutHdl, Timer* pTimer );
138 					DECL_LINK( EventHdl, VclWindowEvent* pEvent );
139 
140 	::rtl::Reference< SlideshowImpl > mxController;
141 };
142 
143 } // end of namespace sd
144 
145 #endif
146