Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : */
10 :
11 : #ifndef POINTERSYMBOL_HXX_INCLUDED
12 : #define POINTERSYMBOL_HXX_INCLUDED
13 :
14 : #include <com/sun/star/rendering/XBitmap.hpp>
15 : #include <cppcanvas/customsprite.hxx>
16 :
17 : #include "com/sun/star/uno/Reference.hxx"
18 :
19 : #include "vieweventhandler.hxx"
20 : #include "screenupdater.hxx"
21 : #include "eventmultiplexer.hxx"
22 : #include "unoview.hxx"
23 :
24 : #include <boost/shared_ptr.hpp>
25 : #include <boost/bind.hpp>
26 : #include <boost/utility.hpp>
27 : #include <vector>
28 :
29 : using namespace com::sun::star;
30 :
31 : namespace slideshow {
32 : namespace internal {
33 :
34 : class EventMultiplexer;
35 : typedef boost::shared_ptr<class PointerSymbol> PointerSymbolSharedPtr;
36 :
37 : /// On-screen 'laser pointer' from the Impress remote control
38 0 : class PointerSymbol : public ViewEventHandler,
39 : private ::boost::noncopyable
40 : {
41 : public:
42 : static PointerSymbolSharedPtr create( const ::com::sun::star::uno::Reference<
43 : ::com::sun::star::rendering::XBitmap>& xBitmap,
44 : ScreenUpdater& rScreenUpdater,
45 : EventMultiplexer& rEventMultiplexer,
46 : const UnoViewContainer& rViewContainer );
47 :
48 : /** Shows the pointer symbol.
49 : */
50 : void show() { setVisible(true); }
51 :
52 : /** Hides the pointer symbol.
53 : */
54 : void hide() { setVisible(false); }
55 : /** Use this method to update the pointer's position
56 : */
57 : void setVisible( const bool bVisible );
58 : virtual void viewsChanged(const ::com::sun::star::geometry::RealPoint2D pos);
59 :
60 : private:
61 : PointerSymbol( const ::com::sun::star::uno::Reference<
62 : ::com::sun::star::rendering::XBitmap>& xBitmap,
63 : ScreenUpdater& rScreenUpdater,
64 : const UnoViewContainer& rViewContainer );
65 :
66 : // ViewEventHandler
67 : virtual void viewAdded( const UnoViewSharedPtr& rView ) SAL_OVERRIDE;
68 : virtual void viewRemoved( const UnoViewSharedPtr& rView ) SAL_OVERRIDE;
69 : virtual void viewChanged( const UnoViewSharedPtr& rView ) SAL_OVERRIDE;
70 : virtual void viewsChanged() SAL_OVERRIDE;
71 :
72 : ::basegfx::B2DPoint calcSpritePos( UnoViewSharedPtr const & rView ) const;
73 :
74 : template <typename func_type>
75 : void for_each_sprite( func_type const & func ) const
76 : {
77 : ViewsVecT::const_iterator iPos( maViews.begin() );
78 : const ViewsVecT::const_iterator iEnd( maViews.end() );
79 : for ( ; iPos != iEnd; ++iPos )
80 : if( iPos->second )
81 : func( iPos->second );
82 : }
83 :
84 : typedef ::std::vector<
85 : ::std::pair<UnoViewSharedPtr,
86 : cppcanvas::CustomSpriteSharedPtr> > ViewsVecT;
87 :
88 : ::com::sun::star::uno::Reference<
89 : ::com::sun::star::rendering::XBitmap> mxBitmap;
90 :
91 : ViewsVecT maViews;
92 : ScreenUpdater& mrScreenUpdater;
93 : ::com::sun::star::geometry::RealPoint2D maPos;
94 : bool mbVisible;
95 : };
96 :
97 : } // namespace internal
98 : } // namespace presentation
99 :
100 : #endif
101 :
102 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|