xref: /AOO41X/main/sd/source/ui/slidesorter/view/SlsLayeredDevice.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 SD_SLIDESORTER_VIEW_LAYERED_DEVICE_HXX
29 #define SD_SLIDESORTER_VIEW_LAYERED_DEVICE_HXX
30 
31 #include "view/SlsILayerPainter.hxx"
32 #include "SlideSorter.hxx"
33 
34 #include <tools/gen.hxx>
35 #include <vcl/region.hxx>
36 #include <vcl/virdev.hxx>
37 
38 #include <boost/noncopyable.hpp>
39 #include <boost/scoped_ptr.hpp>
40 #include <boost/shared_ptr.hpp>
41 #include <boost/enable_shared_from_this.hpp>
42 #include <vector>
43 
44 class Window;
45 
46 namespace sd { namespace slidesorter { namespace view {
47 
48 /** A simple wrapper around an OutputDevice that provides support for
49     independent layers and buffering.
50     Each layer may contain any number of painters.
51 */
52 class LayeredDevice
53     : public ::boost::enable_shared_from_this<LayeredDevice>
54 
55 {
56 public:
57     LayeredDevice (const SharedSdWindow& rpTargetWindow);
58     ~LayeredDevice (void);
59 
60     void Invalidate (
61         const Rectangle& rInvalidationBox,
62         const sal_Int32 nLayer);
63     void InvalidateAllLayers (
64         const Rectangle& rInvalidationBox);
65     void InvalidateAllLayers (
66         const Region& rInvalidationRegion);
67 
68     void RegisterPainter (
69         const SharedILayerPainter& rPainter,
70         const sal_Int32 nLayer);
71 
72     void RemovePainter (
73         const SharedILayerPainter& rPainter,
74         const sal_Int32 nLayer);
75 
76     bool HasPainter (const sal_Int32 nLayer);
77 
78     bool HandleMapModeChange (void);
79     void Repaint (const Region& rRepaintRegion);
80 
81     void Resize (void);
82 
83     void Dispose (void);
84 
85 private:
86     SharedSdWindow mpTargetWindow;
87     class LayerContainer;
88     ::boost::scoped_ptr<LayerContainer> mpLayers;
89     ::boost::scoped_ptr<VirtualDevice> mpBackBuffer;
90     MapMode maSavedMapMode;
91 
92     void RepaintRectangle (const Rectangle& rRepaintRectangle);
93 };
94 
95 
96 
97 } } } // end of namespace ::sd::slidesorter::view
98 
99 #endif
100