bump product version to 6.3.0.0.beta1
[LibreOffice.git] / sd / source / ui / slideshow / slideshowviewimpl.hxx
blob984f7e1a010a0aba0cf8337694c43c9d26c0e963
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SD_SOURCE_UI_SLIDESHOW_SLIDESHOWVIEWIMPL_HXX
21 #define INCLUDED_SD_SOURCE_UI_SLIDESHOW_SLIDESHOWVIEWIMPL_HXX
23 #include <memory>
24 #include <cppuhelper/compbase.hxx>
25 #include <cppuhelper/basemutex.hxx>
26 #include <comphelper/listenernotification.hxx>
27 #include <com/sun/star/awt/XWindowListener.hpp>
28 #include <com/sun/star/util/XModifyListener.hpp>
29 #include <com/sun/star/awt/XPaintListener.hpp>
30 #include <com/sun/star/presentation/XSlideShowView.hpp>
31 #include <cppcanvas/spritecanvas.hxx>
32 #include <tools/gen.hxx>
34 #include <slideshow.hxx>
36 namespace com { namespace sun { namespace star { namespace awt { class XPointer; } } } }
37 namespace com { namespace sun { namespace star { namespace awt { class XWindow; } } } }
38 namespace com { namespace sun { namespace star { namespace awt { class XWindowPeer; } } } }
39 namespace com { namespace sun { namespace star { namespace awt { struct WindowEvent; } } } }
40 namespace com { namespace sun { namespace star { namespace rendering { class XSpriteCanvas; } } } }
41 class SdDrawDocument;
43 namespace sd
46 struct WrappedMouseEvent : public css::lang::EventObject
48 enum EventType
50 PRESSED,
51 RELEASED,
52 ENTERED,
53 EXITED
56 EventType meType;
57 css::awt::MouseEvent maEvent;
60 struct WrappedMouseMotionEvent : public css::lang::EventObject
62 enum EventType
64 DRAGGED,
65 MOVED
68 EventType meType;
69 css::awt::MouseEvent maEvent;
72 // SlideShowViewListeners
73 typedef std::vector< css::uno::WeakReference< css::util::XModifyListener > > ViewListenerVector;
74 class SlideShowViewListeners final
76 public:
77 SlideShowViewListeners( ::osl::Mutex& rMutex );
79 void addListener( const css::uno::Reference< css::util::XModifyListener >& _rxListener );
80 void removeListener( const css::uno::Reference< css::util::XModifyListener >& _rxListener );
81 /// @throws css::uno::Exception
82 void notify( const css::lang::EventObject& _rEvent );
83 void disposing( const css::lang::EventObject& _rEventSource );
85 private:
86 ViewListenerVector maListeners;
87 ::osl::Mutex& mrMutex;
90 // SlideShowViewPaintListeners
91 typedef ::comphelper::OListenerContainerBase< css::awt::XPaintListener,
92 css::awt::PaintEvent > SlideShowViewPaintListeners_Base;
94 class SlideShowViewPaintListeners : public SlideShowViewPaintListeners_Base
96 public:
97 SlideShowViewPaintListeners( ::osl::Mutex& rMutex );
99 protected:
100 virtual bool implTypedNotify( const css::uno::Reference< css::awt::XPaintListener >& rListener, const css::awt::PaintEvent& rEvent ) override;
103 // SlideShowViewMouseListeners
104 typedef ::comphelper::OListenerContainerBase< css::awt::XMouseListener, WrappedMouseEvent > SlideShowViewMouseListeners_Base;
106 class SlideShowViewMouseListeners : public SlideShowViewMouseListeners_Base
108 public:
109 SlideShowViewMouseListeners( ::osl::Mutex& rMutex );
111 protected:
112 virtual bool implTypedNotify( const css::uno::Reference< css::awt::XMouseListener >& rListener,
113 const WrappedMouseEvent& rEvent ) override;
117 // SlideShowViewMouseMotionListeners
118 typedef ::comphelper::OListenerContainerBase< css::awt::XMouseMotionListener,
119 WrappedMouseMotionEvent > SlideShowViewMouseMotionListeners_Base;
121 class SlideShowViewMouseMotionListeners : public SlideShowViewMouseMotionListeners_Base
123 public:
124 SlideShowViewMouseMotionListeners( ::osl::Mutex& rMutex );
126 protected:
127 virtual bool implTypedNotify( const css::uno::Reference< css::awt::XMouseMotionListener >& rListener,
128 const WrappedMouseMotionEvent& rEvent ) override;
131 // SlideShowView
132 class ShowWindow;
133 class SlideshowImpl;
135 typedef ::cppu::WeakComponentImplHelper< css::presentation::XSlideShowView,
136 css::awt::XWindowListener,
137 css::awt::XMouseListener,
138 css::awt::XMouseMotionListener > SlideShowView_Base;
140 class SlideShowView : public ::cppu::BaseMutex,
141 public SlideShowView_Base
143 public:
144 SlideShowView( ShowWindow& rOutputWindow,
145 SdDrawDocument* pDoc,
146 AnimationMode eAnimationMode,
147 SlideshowImpl* pSlideShow,
148 bool bFullScreen );
150 void ignoreNextMouseReleased() { mbMousePressedEaten = true; }
152 /// Dispose all internal references
153 virtual void SAL_CALL dispose() override;
155 /// Disposing our broadcaster
156 virtual void SAL_CALL disposing( const css::lang::EventObject& ) override;
158 /// @throws css::uno::RuntimeException
159 void paint( const css::awt::PaintEvent& e );
161 // XSlideShowView methods
162 virtual css::uno::Reference< css::rendering::XSpriteCanvas > SAL_CALL getCanvas( ) override;
163 virtual void SAL_CALL clear( ) override;
164 virtual css::geometry::AffineMatrix2D SAL_CALL getTransformation( ) override;
165 virtual css::geometry::IntegerSize2D SAL_CALL getTranslationOffset( ) override;
166 virtual void SAL_CALL addTransformationChangedListener( const css::uno::Reference< css::util::XModifyListener >& xListener ) override;
167 virtual void SAL_CALL removeTransformationChangedListener( const css::uno::Reference< css::util::XModifyListener >& xListener ) override;
168 virtual void SAL_CALL addPaintListener( const css::uno::Reference< css::awt::XPaintListener >& xListener ) override;
169 virtual void SAL_CALL removePaintListener( const css::uno::Reference< css::awt::XPaintListener >& xListener ) override;
170 virtual void SAL_CALL addMouseListener( const css::uno::Reference< css::awt::XMouseListener >& xListener ) override;
171 virtual void SAL_CALL removeMouseListener( const css::uno::Reference< css::awt::XMouseListener >& xListener ) override;
172 virtual void SAL_CALL addMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener >& xListener ) override;
173 virtual void SAL_CALL removeMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener >& xListener ) override;
174 virtual void SAL_CALL setMouseCursor( sal_Int16 nPointerShape ) override;
175 virtual css::awt::Rectangle SAL_CALL getCanvasArea( ) override;
177 // XWindowListener methods
178 virtual void SAL_CALL windowResized( const css::awt::WindowEvent& e ) override;
179 virtual void SAL_CALL windowMoved( const css::awt::WindowEvent& e ) override;
180 virtual void SAL_CALL windowShown( const css::lang::EventObject& e ) override;
181 virtual void SAL_CALL windowHidden( const css::lang::EventObject& e ) override;
183 // XMouseListener implementation
184 virtual void SAL_CALL mousePressed( const css::awt::MouseEvent& e ) override;
185 virtual void SAL_CALL mouseReleased( const css::awt::MouseEvent& e ) override;
186 virtual void SAL_CALL mouseEntered( const css::awt::MouseEvent& e ) override;
187 virtual void SAL_CALL mouseExited( const css::awt::MouseEvent& e ) override;
189 // XMouseMotionListener implementation
190 virtual void SAL_CALL mouseDragged( const css::awt::MouseEvent& e ) override;
191 virtual void SAL_CALL mouseMoved( const css::awt::MouseEvent& e ) override;
193 using cppu::WeakComponentImplHelperBase::disposing;
195 protected:
196 virtual ~SlideShowView() override {}
198 private:
199 void init();
201 void updateimpl( ::osl::ClearableMutexGuard& rGuard, SlideshowImpl* pSlideShow );
203 ::cppcanvas::SpriteCanvasSharedPtr mpCanvas;
204 css::uno::Reference< css::awt::XWindow > mxWindow;
205 css::uno::Reference< css::awt::XWindowPeer > mxWindowPeer;
206 css::uno::Reference< css::awt::XPointer > mxPointer;
207 SlideshowImpl* mpSlideShow;
208 ShowWindow& mrOutputWindow;
209 ::std::unique_ptr< SlideShowViewListeners >
210 mpViewListeners;
211 ::std::unique_ptr< SlideShowViewPaintListeners >
212 mpPaintListeners;
213 ::std::unique_ptr< SlideShowViewMouseListeners >
214 mpMouseListeners;
215 ::std::unique_ptr< SlideShowViewMouseMotionListeners >
216 mpMouseMotionListeners;
217 SdDrawDocument* const mpDoc;
218 bool mbIsMouseMotionListener;
219 AnimationMode const meAnimationMode;
220 bool mbFirstPaint;
221 bool const mbFullScreen;
222 bool mbMousePressedEaten;
223 css::geometry::IntegerSize2D mTranslationOffset;
226 } // namespace ::sd
228 #endif
230 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */