Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sd / source / ui / slideshow / slideshowviewimpl.hxx
blobb8f6cab5ab69ab9e64297b5649c7c09843a24eb4
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/WindowEvent.hpp>
28 #include <com/sun/star/awt/XWindowListener.hpp>
29 #include <com/sun/star/awt/XWindow.hpp>
30 #include <com/sun/star/awt/XWindowPeer.hpp>
31 #include <com/sun/star/util/XModifyListener.hpp>
32 #include <com/sun/star/awt/XPaintListener.hpp>
33 #include <com/sun/star/awt/XPointer.hpp>
34 #include <com/sun/star/presentation/XSlideShowView.hpp>
35 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
36 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
37 #include <basegfx/matrix/b2dhommatrix.hxx>
38 #include <basegfx/utils/canvastools.hxx>
39 #include <cppcanvas/spritecanvas.hxx>
40 #include <vcl/help.hxx>
41 #include <unotools/pathoptions.hxx>
42 #include <unotools/saveopt.hxx>
43 #include <sfx2/bindings.hxx>
44 #include <sfx2/dispatch.hxx>
45 #include <sfx2/viewfrm.hxx>
46 #include <basic/sbstar.hxx>
47 #include <svx/svdpagv.hxx>
48 #include <svx/fmshell.hxx>
50 #include <svx/svxids.hrc>
51 #include <sdmod.hxx>
52 #include <cusshow.hxx>
53 #include <ViewShellBase.hxx>
54 #include <PresentationViewShell.hxx>
55 #include <ViewShell.hxx>
56 #include <drawview.hxx>
57 #include <slideshow.hxx>
58 #include <drawdoc.hxx>
59 #include "showwindow.hxx"
60 #include <optsitem.hxx>
61 #include <FrameView.hxx>
62 #include <DrawDocShell.hxx>
64 #include <app.hrc>
66 namespace sd
69 struct WrappedMouseEvent : public css::lang::EventObject
71 enum EventType
73 PRESSED,
74 RELEASED,
75 ENTERED,
76 EXITED
79 EventType meType;
80 css::awt::MouseEvent maEvent;
83 struct WrappedMouseMotionEvent : public css::lang::EventObject
85 enum EventType
87 DRAGGED,
88 MOVED
91 EventType meType;
92 css::awt::MouseEvent maEvent;
95 // SlideShowViewListeners
96 typedef std::vector< css::uno::WeakReference< css::util::XModifyListener > > ViewListenerVector;
97 class SlideShowViewListeners final
99 public:
100 SlideShowViewListeners( ::osl::Mutex& rMutex );
102 void addListener( const css::uno::Reference< css::util::XModifyListener >& _rxListener );
103 void removeListener( const css::uno::Reference< css::util::XModifyListener >& _rxListener );
104 /// @throws css::uno::Exception
105 void notify( const css::lang::EventObject& _rEvent );
106 void disposing( const css::lang::EventObject& _rEventSource );
108 private:
109 ViewListenerVector maListeners;
110 ::osl::Mutex& mrMutex;
113 // SlideShowViewPaintListeners
114 typedef ::comphelper::OListenerContainerBase< css::awt::XPaintListener,
115 css::awt::PaintEvent > SlideShowViewPaintListeners_Base;
117 class SlideShowViewPaintListeners : public SlideShowViewPaintListeners_Base
119 public:
120 SlideShowViewPaintListeners( ::osl::Mutex& rMutex );
122 protected:
123 virtual bool implTypedNotify( const css::uno::Reference< css::awt::XPaintListener >& rListener, const css::awt::PaintEvent& rEvent ) override;
126 // SlideShowViewMouseListeners
127 typedef ::comphelper::OListenerContainerBase< css::awt::XMouseListener, WrappedMouseEvent > SlideShowViewMouseListeners_Base;
129 class SlideShowViewMouseListeners : public SlideShowViewMouseListeners_Base
131 public:
132 SlideShowViewMouseListeners( ::osl::Mutex& rMutex );
134 protected:
135 virtual bool implTypedNotify( const css::uno::Reference< css::awt::XMouseListener >& rListener,
136 const WrappedMouseEvent& rEvent ) override;
140 // SlideShowViewMouseMotionListeners
141 typedef ::comphelper::OListenerContainerBase< css::awt::XMouseMotionListener,
142 WrappedMouseMotionEvent > SlideShowViewMouseMotionListeners_Base;
144 class SlideShowViewMouseMotionListeners : public SlideShowViewMouseMotionListeners_Base
146 public:
147 SlideShowViewMouseMotionListeners( ::osl::Mutex& rMutex );
149 protected:
150 virtual bool implTypedNotify( const css::uno::Reference< css::awt::XMouseMotionListener >& rListener,
151 const WrappedMouseMotionEvent& rEvent ) override;
154 // SlideShowView
155 class ShowWindow;
156 class SlideshowImpl;
158 typedef ::cppu::WeakComponentImplHelper< css::presentation::XSlideShowView,
159 css::awt::XWindowListener,
160 css::awt::XMouseListener,
161 css::awt::XMouseMotionListener > SlideShowView_Base;
163 class SlideShowView : public ::cppu::BaseMutex,
164 public SlideShowView_Base
166 public:
167 SlideShowView( ShowWindow& rOutputWindow,
168 SdDrawDocument* pDoc,
169 AnimationMode eAnimationMode,
170 SlideshowImpl* pSlideShow,
171 bool bFullScreen );
173 void ignoreNextMouseReleased() { mbMousePressedEaten = true; }
175 /// Dispose all internal references
176 virtual void SAL_CALL dispose() override;
178 /// Disposing our broadcaster
179 virtual void SAL_CALL disposing( const css::lang::EventObject& ) override;
181 /// @throws css::uno::RuntimeException
182 void paint( const css::awt::PaintEvent& e );
184 // XSlideShowView methods
185 virtual css::uno::Reference< css::rendering::XSpriteCanvas > SAL_CALL getCanvas( ) override;
186 virtual void SAL_CALL clear( ) override;
187 virtual css::geometry::AffineMatrix2D SAL_CALL getTransformation( ) override;
188 virtual css::geometry::IntegerSize2D SAL_CALL getTranslationOffset( ) override;
189 virtual void SAL_CALL addTransformationChangedListener( const css::uno::Reference< css::util::XModifyListener >& xListener ) override;
190 virtual void SAL_CALL removeTransformationChangedListener( const css::uno::Reference< css::util::XModifyListener >& xListener ) override;
191 virtual void SAL_CALL addPaintListener( const css::uno::Reference< css::awt::XPaintListener >& xListener ) override;
192 virtual void SAL_CALL removePaintListener( const css::uno::Reference< css::awt::XPaintListener >& xListener ) override;
193 virtual void SAL_CALL addMouseListener( const css::uno::Reference< css::awt::XMouseListener >& xListener ) override;
194 virtual void SAL_CALL removeMouseListener( const css::uno::Reference< css::awt::XMouseListener >& xListener ) override;
195 virtual void SAL_CALL addMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener >& xListener ) override;
196 virtual void SAL_CALL removeMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener >& xListener ) override;
197 virtual void SAL_CALL setMouseCursor( sal_Int16 nPointerShape ) override;
198 virtual css::awt::Rectangle SAL_CALL getCanvasArea( ) override;
200 // XWindowListener methods
201 virtual void SAL_CALL windowResized( const css::awt::WindowEvent& e ) override;
202 virtual void SAL_CALL windowMoved( const css::awt::WindowEvent& e ) override;
203 virtual void SAL_CALL windowShown( const css::lang::EventObject& e ) override;
204 virtual void SAL_CALL windowHidden( const css::lang::EventObject& e ) override;
206 // XMouseListener implementation
207 virtual void SAL_CALL mousePressed( const css::awt::MouseEvent& e ) override;
208 virtual void SAL_CALL mouseReleased( const css::awt::MouseEvent& e ) override;
209 virtual void SAL_CALL mouseEntered( const css::awt::MouseEvent& e ) override;
210 virtual void SAL_CALL mouseExited( const css::awt::MouseEvent& e ) override;
212 // XMouseMotionListener implementation
213 virtual void SAL_CALL mouseDragged( const css::awt::MouseEvent& e ) override;
214 virtual void SAL_CALL mouseMoved( const css::awt::MouseEvent& e ) override;
216 using cppu::WeakComponentImplHelperBase::disposing;
218 protected:
219 virtual ~SlideShowView() override {}
221 private:
222 void init();
224 void updateimpl( ::osl::ClearableMutexGuard& rGuard, SlideshowImpl* pSlideShow );
226 ::cppcanvas::SpriteCanvasSharedPtr mpCanvas;
227 css::uno::Reference< css::awt::XWindow > mxWindow;
228 css::uno::Reference< css::awt::XWindowPeer > mxWindowPeer;
229 css::uno::Reference< css::awt::XPointer > mxPointer;
230 SlideshowImpl* mpSlideShow;
231 ShowWindow& mrOutputWindow;
232 ::std::unique_ptr< SlideShowViewListeners >
233 mpViewListeners;
234 ::std::unique_ptr< SlideShowViewPaintListeners >
235 mpPaintListeners;
236 ::std::unique_ptr< SlideShowViewMouseListeners >
237 mpMouseListeners;
238 ::std::unique_ptr< SlideShowViewMouseMotionListeners >
239 mpMouseMotionListeners;
240 SdDrawDocument* mpDoc;
241 bool mbIsMouseMotionListener;
242 ::tools::Rectangle maPresentationArea;
243 AnimationMode meAnimationMode;
244 bool mbFirstPaint;
245 bool mbFullScreen;
246 bool mbMousePressedEaten;
247 css::geometry::IntegerSize2D mTranslationOffset;
250 } // namespace ::sd
252 #endif
254 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */