1*3334a7e6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*3334a7e6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*3334a7e6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*3334a7e6SAndrew Rist  * distributed with this work for additional information
6*3334a7e6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*3334a7e6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*3334a7e6SAndrew Rist  * "License"); you may not use this file except in compliance
9*3334a7e6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*3334a7e6SAndrew Rist  *
11*3334a7e6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*3334a7e6SAndrew Rist  *
13*3334a7e6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*3334a7e6SAndrew Rist  * software distributed under the License is distributed on an
15*3334a7e6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*3334a7e6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*3334a7e6SAndrew Rist  * specific language governing permissions and limitations
18*3334a7e6SAndrew Rist  * under the License.
19*3334a7e6SAndrew Rist  *
20*3334a7e6SAndrew Rist  *************************************************************/
21*3334a7e6SAndrew Rist 
22*3334a7e6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SDR_OVERLAY_OVERLAYMANAGERBUFFERED_HXX
25cdf0e10cSrcweir #define _SDR_OVERLAY_OVERLAYMANAGERBUFFERED_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <svx/sdr/overlay/overlaymanager.hxx>
28cdf0e10cSrcweir #include <basegfx/range/b2irange.hxx>
29cdf0e10cSrcweir #include <vcl/virdev.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
32cdf0e10cSrcweir // predeclarations
33cdf0e10cSrcweir 
34cdf0e10cSrcweir class VirtualDevice;
35cdf0e10cSrcweir 
36cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
37cdf0e10cSrcweir 
38cdf0e10cSrcweir namespace sdr
39cdf0e10cSrcweir {
40cdf0e10cSrcweir 	namespace overlay
41cdf0e10cSrcweir 	{
42cdf0e10cSrcweir 		class OverlayManagerBuffered : public OverlayManager
43cdf0e10cSrcweir 		{
44cdf0e10cSrcweir 		protected:
45cdf0e10cSrcweir 			// The VirtualDevice for draw window content buffering, this
46cdf0e10cSrcweir 			// is the view content without overlay
47cdf0e10cSrcweir 			VirtualDevice							maBufferDevice;
48cdf0e10cSrcweir 
49cdf0e10cSrcweir 			// #i73602# The VirtualDevice for OverlayPaint buffering. This
50cdf0e10cSrcweir 			// is an extra device to avoid flickering of overlay paints
51cdf0e10cSrcweir 			VirtualDevice							maOutputBufferDevice;
52cdf0e10cSrcweir 
53cdf0e10cSrcweir 			// Timer for buffering
54cdf0e10cSrcweir 			Timer									maBufferTimer;
55cdf0e10cSrcweir 
56cdf0e10cSrcweir 			// Range for buffering (in pixel to be independent from mapMode)
57cdf0e10cSrcweir 			basegfx::B2IRange						maBufferRememberedRangePixel;
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 			// bitfield
60cdf0e10cSrcweir 			// Flag to decide if PreRendering shall be used for overlay refreshes.
61cdf0e10cSrcweir 			// Default is false.
62cdf0e10cSrcweir 			unsigned								mbRefreshWithPreRendering : 1;
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 			// link for timer
65cdf0e10cSrcweir 			DECL_LINK(ImpBufferTimerHandler, AutoTimer*);
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 			// Internal methods for buffering
68cdf0e10cSrcweir 			void ImpPrepareBufferDevice();
69cdf0e10cSrcweir 			void ImpRestoreBackground() const ;
70cdf0e10cSrcweir 			void ImpRestoreBackground(const Region& rRegionPixel) const;
71cdf0e10cSrcweir 			void ImpSaveBackground(const Region& rRegion, OutputDevice* pPreRenderDevice = 0L);
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 		public:
74cdf0e10cSrcweir 			// when handing over another OverlayManager at construction, the OverlayObjects
75cdf0e10cSrcweir 			// will be taken over from it. The new one will have added all OverlayObjects
76cdf0e10cSrcweir 			// while the handed over one will have none
77cdf0e10cSrcweir 			OverlayManagerBuffered(
78cdf0e10cSrcweir 				OutputDevice& rOutputDevice,
79cdf0e10cSrcweir 				OverlayManager* pOldOverlayManager = 0,
80cdf0e10cSrcweir 				bool bRefreshWithPreRendering = false);
81cdf0e10cSrcweir 			virtual ~OverlayManagerBuffered();
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 			// complete redraw
84cdf0e10cSrcweir 			virtual void completeRedraw(const Region& rRegion, OutputDevice* pPreRenderDevice = 0L) const;
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 			// flush. Do buffered updates.
87cdf0e10cSrcweir 			virtual void flush();
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 			// #i68597# part of content gets copied, react on it
90cdf0e10cSrcweir 			virtual void copyArea(const Point& rDestPt, const Point& rSrcPt, const Size& rSrcSize);
91cdf0e10cSrcweir 
92cdf0e10cSrcweir 			// restore part of background. Implemented form buffered versions only.
93cdf0e10cSrcweir 			virtual void restoreBackground(const Region& rRegion) const;
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 			// invalidate the given range at local OutputDevice
96cdf0e10cSrcweir 			virtual void invalidateRange(const basegfx::B2DRange& rRange);
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 			// access to RefreshWithPreRendering Flag
99cdf0e10cSrcweir 			bool DoRefreshWithPreRendering() const { return mbRefreshWithPreRendering; }
100cdf0e10cSrcweir 			void SetRefreshWithPreRendering(bool bNew);
101cdf0e10cSrcweir 		};
102cdf0e10cSrcweir 	} // end of namespace overlay
103cdf0e10cSrcweir } // end of namespace sdr
104cdf0e10cSrcweir 
105cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
106cdf0e10cSrcweir 
107cdf0e10cSrcweir #endif //_SDR_OVERLAY_OVERLAYMANAGERBUFFERED_HXX
108cdf0e10cSrcweir 
109cdf0e10cSrcweir // eof
110