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_SLIDEBITMAP_HXX
29 #define INCLUDED_SLIDESHOW_SLIDEBITMAP_HXX
30 
31 #include <com/sun/star/uno/Reference.hxx>
32 #include <cppcanvas/canvas.hxx>
33 #include <cppcanvas/bitmap.hxx>
34 
35 #include <basegfx/point/b2dpoint.hxx>
36 #include <basegfx/polygon/b2dpolypolygon.hxx>
37 
38 #include <boost/shared_ptr.hpp>
39 #include <boost/noncopyable.hpp>
40 
41 namespace com { namespace sun { namespace star { namespace rendering
42 {
43     class XBitmap;
44 } } } }
45 
46 
47 /* Definition of SlideBitmap class */
48 
49 namespace slideshow
50 {
51     namespace internal
52     {
53 
54         /** Little wrapper encapsulating an XBitmap
55 
56         	This is to insulate us from changes to the preferred
57         	transport format for bitmaps (using a sole XBitmap here is
58         	a hack, since it is not guaranteed to work, or to work
59         	without data loss, across different canvases). And since
60         	we don't want to revert to a VCL Bitmap here, have to wait
61         	until basegfx bitmap tooling is ready.
62 
63             TODO(F2): Add support for Canvas-independent bitmaps
64             here. Then, Slide::getInitialSlideBitmap and
65             Slide::getFinalSlideBitmap must also be adapted (they no
66             longer need a Canvas ptr, which is actually a hack now).
67          */
68         class SlideBitmap : private boost::noncopyable
69         {
70         public:
71             SlideBitmap( const ::cppcanvas::BitmapSharedPtr& rBitmap );
72 
73             bool 				draw( const ::cppcanvas::CanvasSharedPtr& rCanvas ) const;
74             ::basegfx::B2ISize 	getSize() const;
75             ::basegfx::B2DPoint getOutputPos() const{return maOutputPos;}
76             void				move( const ::basegfx::B2DPoint& rNewPos );
77             void				clip( const ::basegfx::B2DPolyPolygon& rClipPoly );
78 
79             ::com::sun::star::uno::Reference<
80                 ::com::sun::star::rendering::XBitmap >    getXBitmap();
81 
82         private:
83             ::basegfx::B2DPoint										maOutputPos;
84             ::basegfx::B2DPolyPolygon								maClipPoly;
85 
86             // TODO(Q2): Remove UNO bitmap as the transport medium
87             ::com::sun::star::uno::Reference<
88                 ::com::sun::star::rendering::XBitmap >		mxBitmap;
89         };
90 
91         typedef ::boost::shared_ptr< SlideBitmap > SlideBitmapSharedPtr;
92     }
93 }
94 
95 #endif /* INCLUDED_SLIDESHOW_SLIDEBITMAP_HXX */
96