1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef INCLUDED_SLIDESHOW_SLIDEBITMAP_HXX
25 #define INCLUDED_SLIDESHOW_SLIDEBITMAP_HXX
26 
27 #include <com/sun/star/uno/Reference.hxx>
28 #include <cppcanvas/canvas.hxx>
29 #include <cppcanvas/bitmap.hxx>
30 
31 #include <basegfx/point/b2dpoint.hxx>
32 #include <basegfx/polygon/b2dpolypolygon.hxx>
33 
34 #include <boost/shared_ptr.hpp>
35 #include <boost/noncopyable.hpp>
36 
37 namespace com { namespace sun { namespace star { namespace rendering
38 {
39     class XBitmap;
40 } } } }
41 
42 
43 /* Definition of SlideBitmap class */
44 
45 namespace slideshow
46 {
47     namespace internal
48     {
49 
50         /** Little wrapper encapsulating an XBitmap
51 
52         	This is to insulate us from changes to the preferred
53         	transport format for bitmaps (using a sole XBitmap here is
54         	a hack, since it is not guaranteed to work, or to work
55         	without data loss, across different canvases). And since
56         	we don't want to revert to a VCL Bitmap here, have to wait
57         	until basegfx bitmap tooling is ready.
58 
59             TODO(F2): Add support for Canvas-independent bitmaps
60             here. Then, Slide::getInitialSlideBitmap and
61             Slide::getFinalSlideBitmap must also be adapted (they no
62             longer need a Canvas ptr, which is actually a hack now).
63          */
64         class SlideBitmap : private boost::noncopyable
65         {
66         public:
67             SlideBitmap( const ::cppcanvas::BitmapSharedPtr& rBitmap );
68 
69             bool 				draw( const ::cppcanvas::CanvasSharedPtr& rCanvas ) const;
70             ::basegfx::B2ISize 	getSize() const;
getOutputPos() const71             ::basegfx::B2DPoint getOutputPos() const{return maOutputPos;}
72             void				move( const ::basegfx::B2DPoint& rNewPos );
73             void				clip( const ::basegfx::B2DPolyPolygon& rClipPoly );
74 
75             ::com::sun::star::uno::Reference<
76                 ::com::sun::star::rendering::XBitmap >    getXBitmap();
77 
78         private:
79             ::basegfx::B2DPoint										maOutputPos;
80             ::basegfx::B2DPolyPolygon								maClipPoly;
81 
82             // TODO(Q2): Remove UNO bitmap as the transport medium
83             ::com::sun::star::uno::Reference<
84                 ::com::sun::star::rendering::XBitmap >		mxBitmap;
85         };
86 
87         typedef ::boost::shared_ptr< SlideBitmap > SlideBitmapSharedPtr;
88     }
89 }
90 
91 #endif /* INCLUDED_SLIDESHOW_SLIDEBITMAP_HXX */
92