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