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 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_SLIDESHOW_VIEWBACKGROUNDSHAPE_HXX
21 : #define INCLUDED_SLIDESHOW_VIEWBACKGROUNDSHAPE_HXX
22 :
23 : #include <com/sun/star/uno/Reference.hxx>
24 : #include <com/sun/star/rendering/XBitmap.hpp>
25 :
26 : #include <basegfx/range/b2drectangle.hxx>
27 : #include <basegfx/matrix/b2dhommatrix.hxx>
28 : #include <cppcanvas/spritecanvas.hxx>
29 :
30 : #include <boost/shared_ptr.hpp>
31 : #include <boost/utility.hpp>
32 :
33 : #include "gdimtftools.hxx"
34 : #include "viewlayer.hxx"
35 :
36 :
37 : namespace slideshow
38 : {
39 : namespace internal
40 : {
41 : /** This class is the viewable representation of a draw
42 : document's background, associated to a specific View
43 :
44 : The class is able to render the associated background on
45 : View implementations.
46 : */
47 0 : class ViewBackgroundShape : private boost::noncopyable
48 : {
49 : public:
50 : /** Create a ViewBackgroundShape for the given View
51 :
52 : @param rView
53 : The associated View object.
54 :
55 : @param rShapeBounds
56 : Bounds of the background shape, in document coordinate
57 : system.
58 : */
59 : ViewBackgroundShape( const ViewLayerSharedPtr& rViewLayer,
60 : const ::basegfx::B2DRectangle& rShapeBounds );
61 :
62 : /** Query the associated view layer of this shape
63 : */
64 : ViewLayerSharedPtr getViewLayer() const;
65 :
66 : bool render( const GDIMetaFileSharedPtr& rMtf ) const;
67 :
68 : private:
69 : /** Prefetch bitmap for given canvas
70 : */
71 : bool prefetch( const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas,
72 : const GDIMetaFileSharedPtr& rMtf ) const;
73 :
74 : /** The view layer this object is part of.
75 : */
76 : ViewLayerSharedPtr mpViewLayer;
77 :
78 : /// Generated content bitmap, already with correct output size
79 : mutable ::com::sun::star::uno::Reference<
80 : ::com::sun::star::rendering::XBitmap > mxBitmap;
81 :
82 : /// The last metafile a render object was generated for
83 : mutable GDIMetaFileSharedPtr mpLastMtf;
84 :
85 : /// The canvas, mpRenderer is associated with
86 : mutable ::basegfx::B2DHomMatrix maLastTransformation;
87 :
88 : const ::basegfx::B2DRectangle maBounds;
89 : };
90 :
91 : typedef ::boost::shared_ptr< ViewBackgroundShape > ViewBackgroundShapeSharedPtr;
92 :
93 : }
94 : }
95 :
96 : #endif /* INCLUDED_SLIDESHOW_VIEWBACKGROUNDSHAPE_HXX */
97 :
98 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|