xref: /trunk/main/sd/source/ui/slideshow/showwindow.hxx (revision 4d7c9de0)
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 
GetBlankColor() const82 	const Color&		GetBlankColor() const { return maShowBackground.GetColor(); }
83 
84 	void			SetPreviewMode();
85 	void			SetPresentationArea( const Rectangle& rPresArea );
86 
SetMouseAutoHide(bool bMouseAutoHide)87 	void			SetMouseAutoHide( bool bMouseAutoHide ) { mbMouseAutoHide = bMouseAutoHide; }
88 
GetShowWindowMode() const89 	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 	//Overload the sd::Window's CreateAccessible to create a different accessible object
106     virtual ::com::sun::star::uno::Reference<
107         ::com::sun::star::accessibility::XAccessible>
108         CreateAccessible (void);
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