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 _SDR_OVERLAY_OVERLAYMANAGERBUFFERED_HXX
25 #define _SDR_OVERLAY_OVERLAYMANAGERBUFFERED_HXX
26 
27 #include <svx/sdr/overlay/overlaymanager.hxx>
28 #include <basegfx/range/b2irange.hxx>
29 #include <vcl/virdev.hxx>
30 
31 //////////////////////////////////////////////////////////////////////////////
32 // predeclarations
33 
34 class VirtualDevice;
35 
36 //////////////////////////////////////////////////////////////////////////////
37 
38 namespace sdr
39 {
40 	namespace overlay
41 	{
42 		class OverlayManagerBuffered : public OverlayManager
43 		{
44 		protected:
45 			// The VirtualDevice for draw window content buffering, this
46 			// is the view content without overlay
47 			VirtualDevice							maBufferDevice;
48 
49 			// #i73602# The VirtualDevice for OverlayPaint buffering. This
50 			// is an extra device to avoid flickering of overlay paints
51 			VirtualDevice							maOutputBufferDevice;
52 
53 			// Timer for buffering
54 			Timer									maBufferTimer;
55 
56 			// Range for buffering (in pixel to be independent from mapMode)
57 			basegfx::B2IRange						maBufferRememberedRangePixel;
58 
59 			// bitfield
60 			// Flag to decide if PreRendering shall be used for overlay refreshes.
61 			// Default is false.
62 			unsigned								mbRefreshWithPreRendering : 1;
63 
64 			// link for timer
65 			DECL_LINK(ImpBufferTimerHandler, AutoTimer*);
66 
67 			// Internal methods for buffering
68 			void ImpPrepareBufferDevice();
69 			void ImpRestoreBackground() const ;
70 			void ImpRestoreBackground(const Region& rRegionPixel) const;
71 			void ImpSaveBackground(const Region& rRegion, OutputDevice* pPreRenderDevice = 0L);
72 
73 		public:
74 			OverlayManagerBuffered(
75                 OutputDevice& rOutputDevice,
76 				bool bRefreshWithPreRendering = false);
77 			virtual ~OverlayManagerBuffered();
78 
79 			// complete redraw
80 			virtual void completeRedraw(const Region& rRegion, OutputDevice* pPreRenderDevice = 0L) const;
81 
82 			// flush. Do buffered updates.
83 			virtual void flush();
84 
85 			// #i68597# part of content gets copied, react on it
86 			virtual void copyArea(const Point& rDestPt, const Point& rSrcPt, const Size& rSrcSize);
87 
88 			// restore part of background. Implemented form buffered versions only.
89 			virtual void restoreBackground(const Region& rRegion) const;
90 
91 			// invalidate the given range at local OutputDevice
92 			virtual void invalidateRange(const basegfx::B2DRange& rRange);
93 
94 			// access to RefreshWithPreRendering Flag
DoRefreshWithPreRendering() const95 			bool DoRefreshWithPreRendering() const { return mbRefreshWithPreRendering; }
96 			void SetRefreshWithPreRendering(bool bNew);
97 		};
98 	} // end of namespace overlay
99 } // end of namespace sdr
100 
101 //////////////////////////////////////////////////////////////////////////////
102 
103 #endif //_SDR_OVERLAY_OVERLAYMANAGERBUFFERED_HXX
104 
105 // eof
106