1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
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
; } } } }
46 struct WrappedMouseEvent
: public css::lang::EventObject
57 css::awt::MouseEvent maEvent
;
60 struct WrappedMouseMotionEvent
: public css::lang::EventObject
69 css::awt::MouseEvent maEvent
;
72 // SlideShowViewListeners
73 typedef std::vector
< css::uno::WeakReference
< css::util::XModifyListener
> > ViewListenerVector
;
74 class SlideShowViewListeners final
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
);
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
97 SlideShowViewPaintListeners( ::osl::Mutex
& rMutex
);
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
109 SlideShowViewMouseListeners( ::osl::Mutex
& rMutex
);
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
124 SlideShowViewMouseMotionListeners( ::osl::Mutex
& rMutex
);
127 virtual bool implTypedNotify( const css::uno::Reference
< css::awt::XMouseMotionListener
>& rListener
,
128 const WrappedMouseMotionEvent
& rEvent
) override
;
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
144 SlideShowView( ShowWindow
& rOutputWindow
,
145 SdDrawDocument
* pDoc
,
146 AnimationMode eAnimationMode
,
147 SlideshowImpl
* pSlideShow
,
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
;
196 virtual ~SlideShowView() override
{}
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
>
211 ::std::unique_ptr
< SlideShowViewPaintListeners
>
213 ::std::unique_ptr
< SlideShowViewMouseListeners
>
215 ::std::unique_ptr
< SlideShowViewMouseMotionListeners
>
216 mpMouseMotionListeners
;
217 SdDrawDocument
* const mpDoc
;
218 bool mbIsMouseMotionListener
;
219 AnimationMode
const meAnimationMode
;
221 bool const mbFullScreen
;
222 bool mbMousePressedEaten
;
223 css::geometry::IntegerSize2D mTranslationOffset
;
230 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */