bump product version to 5.0.4.1
[LibreOffice.git] / slideshow / source / engine / slide / shapemanagerimpl.hxx
blob6de066c42ec247f01e9ed8dc42d646653ccb11f9
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 .
19 #ifndef INCLUDED_SLIDESHOW_SOURCE_ENGINE_SLIDE_SHAPEMANAGERIMPL_HXX
20 #define INCLUDED_SLIDESHOW_SOURCE_ENGINE_SLIDE_SHAPEMANAGERIMPL_HXX
22 #include <osl/mutex.hxx>
23 #include <cppuhelper/interfacecontainer.h>
24 #include <com/sun/star/presentation/XShapeEventListener.hpp>
26 #include "shape.hxx"
27 #include "subsettableshapemanager.hxx"
28 #include "eventmultiplexer.hxx"
29 #include "layermanager.hxx"
30 #include "viewupdate.hxx"
31 #include "shapemaps.hxx"
32 #include "cursormanager.hxx"
33 #include "hyperlinkarea.hxx"
34 #include "listenercontainer.hxx"
35 #include "shapelistenereventhandler.hxx"
36 #include "mouseeventhandler.hxx"
38 #include <boost/shared_ptr.hpp>
39 #include <boost/enable_shared_from_this.hpp>
40 #include <boost/noncopyable.hpp>
41 #include <set>
42 #include <map>
44 namespace slideshow {
45 namespace internal {
47 /** Listener class for shape events
49 This helper class registers itself on each view, and
50 broadcasts the XShapeEventListener events. The mouse motion
51 events are needed for setting the shape cursor.
53 class ShapeManagerImpl : public SubsettableShapeManager,
54 public ShapeListenerEventHandler,
55 public MouseEventHandler,
56 public ViewUpdate,
57 public boost::enable_shared_from_this<ShapeManagerImpl>,
58 private boost::noncopyable
60 public:
61 /** Create a shape event broadcaster
63 @param rEventMultiplexer
64 The slideshow-global event source, where this class
65 registeres its event handlers.
67 ShapeManagerImpl( EventMultiplexer& rMultiplexer,
68 LayerManagerSharedPtr const& rLayerManager,
69 CursorManager& rCursorManager,
70 const ShapeEventListenerMap& rGlobalListenersMap,
71 const ShapeCursorMap& rGlobalCursorMap );
73 /** Enables event listening.
75 @param bSlideBackgoundPainted
76 When true, the initial slide content on the background layer
77 is already rendered (e.g. from a previous slide
78 transition). When false, slide renders initial content of
79 slide.
81 void activate( bool bSlideBackgoundPainted );
83 /** Disables event listening.
85 void deactivate();
87 // Disposable interface
90 virtual void dispose() SAL_OVERRIDE;
92 private:
94 // MouseEventHandler interface
97 virtual bool handleMousePressed(
98 ::com::sun::star::awt::MouseEvent const& evt ) SAL_OVERRIDE;
99 virtual bool handleMouseReleased(
100 ::com::sun::star::awt::MouseEvent const& evt ) SAL_OVERRIDE;
101 virtual bool handleMouseEntered(
102 ::com::sun::star::awt::MouseEvent const& evt ) SAL_OVERRIDE;
103 virtual bool handleMouseExited(
104 ::com::sun::star::awt::MouseEvent const& evt ) SAL_OVERRIDE;
105 virtual bool handleMouseDragged(
106 ::com::sun::star::awt::MouseEvent const& evt ) SAL_OVERRIDE;
107 virtual bool handleMouseMoved(
108 ::com::sun::star::awt::MouseEvent const& evt ) SAL_OVERRIDE;
111 // ViewUpdate interface
114 virtual bool update() SAL_OVERRIDE;
115 virtual bool update( ViewSharedPtr const& rView ) SAL_OVERRIDE;
116 virtual bool needsUpdate() const SAL_OVERRIDE;
119 // ShapeManager interface
122 virtual void enterAnimationMode( const AnimatableShapeSharedPtr& rShape ) SAL_OVERRIDE;
123 virtual void leaveAnimationMode( const AnimatableShapeSharedPtr& rShape ) SAL_OVERRIDE;
124 virtual void notifyShapeUpdate( const ShapeSharedPtr& rShape ) SAL_OVERRIDE;
125 virtual ShapeSharedPtr lookupShape(
126 ::com::sun::star::uno::Reference<
127 ::com::sun::star::drawing::XShape > const & xShape ) const SAL_OVERRIDE;
128 virtual void addHyperlinkArea( const boost::shared_ptr<HyperlinkArea>& rArea ) SAL_OVERRIDE;
129 virtual void removeHyperlinkArea( const boost::shared_ptr<HyperlinkArea>& rArea ) SAL_OVERRIDE;
132 // SubsettableShapeManager interface
135 virtual boost::shared_ptr<AttributableShape> getSubsetShape(
136 const boost::shared_ptr<AttributableShape>& rOrigShape,
137 const DocTreeNode& rTreeNode ) SAL_OVERRIDE;
138 virtual void revokeSubset(
139 const boost::shared_ptr<AttributableShape>& rOrigShape,
140 const boost::shared_ptr<AttributableShape>& rSubsetShape ) SAL_OVERRIDE;
142 virtual void addIntrinsicAnimationHandler(
143 const IntrinsicAnimationEventHandlerSharedPtr& rHandler ) SAL_OVERRIDE;
144 virtual void removeIntrinsicAnimationHandler(
145 const IntrinsicAnimationEventHandlerSharedPtr& rHandler ) SAL_OVERRIDE;
146 virtual bool notifyIntrinsicAnimationsEnabled() SAL_OVERRIDE;
147 virtual bool notifyIntrinsicAnimationsDisabled() SAL_OVERRIDE;
150 // ShapeListenerEventHandler
153 virtual bool listenerAdded( const ::com::sun::star::uno::Reference<
154 ::com::sun::star::presentation::XShapeEventListener>& xListener,
155 const ::com::sun::star::uno::Reference<
156 ::com::sun::star::drawing::XShape>& xShape ) SAL_OVERRIDE;
158 virtual bool listenerRemoved( const ::com::sun::star::uno::Reference<
159 ::com::sun::star::presentation::XShapeEventListener>& xListener,
160 const ::com::sun::star::uno::Reference<
161 ::com::sun::star::drawing::XShape>& xShape ) SAL_OVERRIDE;
163 // ShapeCursorEventHandler interface
166 bool cursorChanged( const ::com::sun::star::uno::Reference<
167 ::com::sun::star::drawing::XShape>& xShape,
168 sal_Int16 nCursor );
171 OUString checkForHyperlink( ::basegfx::B2DPoint const& hitPos )const;
174 typedef std::map<ShapeSharedPtr,
175 boost::shared_ptr< ::cppu::OInterfaceContainerHelper >,
176 Shape::lessThanShape> ShapeToListenersMap;
177 typedef std::map<ShapeSharedPtr, sal_Int16,
178 Shape::lessThanShape> ShapeToCursorMap;
179 typedef std::set<HyperlinkAreaSharedPtr,
180 HyperlinkArea::lessThanArea> AreaSet;
182 typedef ThreadUnsafeListenerContainer<
183 IntrinsicAnimationEventHandlerSharedPtr,
184 std::vector<IntrinsicAnimationEventHandlerSharedPtr> > ImplIntrinsicAnimationEventHandlers;
186 EventMultiplexer& mrMultiplexer;
187 LayerManagerSharedPtr mpLayerManager;
188 CursorManager& mrCursorManager;
189 const ShapeEventListenerMap& mrGlobalListenersMap;
190 const ShapeCursorMap& mrGlobalCursorMap;
191 ShapeToListenersMap maShapeListenerMap;
192 ShapeToCursorMap maShapeCursorMap;
193 AreaSet maHyperlinkShapes;
194 ImplIntrinsicAnimationEventHandlers maIntrinsicAnimationEventHandlers;
195 bool mbEnabled;
198 } // namespace internal
199 } // namespace presentation
201 #endif // INCLUDED_SLIDESHOW_SOURCE_ENGINE_SLIDE_SHAPEMANAGERIMPL_HXX
203 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */