xref: /trunk/main/slideshow/source/engine/slide/userpaintoverlay.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef INCLUDED_SLIDESHOW_USERPAINTOVERLAY_HXX
29 #define INCLUDED_SLIDESHOW_USERPAINTOVERLAY_HXX
30 
31 #include <basegfx/polygon/b2dpolypolygon.hxx>
32 
33 #include "unoview.hxx"
34 #include "rgbcolor.hxx"
35 
36 #include <boost/utility.hpp>
37 #include <boost/shared_ptr.hpp>
38 #include <vector>
39 
40 /* Definition of UserPaintOverlay class */
41 
42 namespace slideshow
43 {
44     namespace internal
45     {
46         class EventMultiplexer;
47         struct SlideShowContext;
48 
49         class PaintOverlayHandler;
50         typedef ::boost::shared_ptr< class UserPaintOverlay > UserPaintOverlaySharedPtr;
51         typedef ::std::vector< ::cppcanvas::PolyPolygonSharedPtr> PolyPolygonVector;
52         /** Slide overlay, which can be painted into by the user.
53 
54             This class registers itself at the EventMultiplexer,
55             listening for mouse clicks and moves. When the mouse is
56             dragged, a hand sketching in the selected color is shown.
57         */
58         class UserPaintOverlay : private boost::noncopyable
59         {
60         public:
61             /** Create a UserPaintOverlay
62 
63                 @param rStrokeColor
64                 Color to use for drawing
65 
66                 @param nStrokeWidth
67                 Width of the stroked path
68              */
69             static UserPaintOverlaySharedPtr create( const RGBColor&          rStrokeColor,
70                                                      double                   nStrokeWidth,
71                                                      const SlideShowContext&  rContext,
72                                                      const PolyPolygonVector& rPolygons,
73                                                      bool                     bActive);
74             ~UserPaintOverlay();
75             PolyPolygonVector getPolygons();
76             void drawPolygons();
77 
78             void update_settings( bool bUserPaintEnabled, RGBColor const& aUserPaintColor, double dUserPaintStrokeWidth );
79 
80 
81         private:
82             UserPaintOverlay( const RGBColor&          rStrokeColor,
83                               double                   nStrokeWidth,
84                               const SlideShowContext&  rContext,
85                               const PolyPolygonVector& rPolygons,
86                               bool                    bActive );
87 
88             ::boost::shared_ptr<PaintOverlayHandler>    mpHandler;
89             EventMultiplexer&                           mrMultiplexer;
90         };
91     }
92 }
93 
94 #endif /* INCLUDED_SLIDESHOW_USERPAINTOVERLAY_HXX */
95