13334a7e6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
33334a7e6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
43334a7e6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
53334a7e6SAndrew Rist  * distributed with this work for additional information
63334a7e6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
73334a7e6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
83334a7e6SAndrew Rist  * "License"); you may not use this file except in compliance
93334a7e6SAndrew Rist  * with the License.  You may obtain a copy of the License at
103334a7e6SAndrew Rist  *
113334a7e6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
123334a7e6SAndrew Rist  *
133334a7e6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
143334a7e6SAndrew Rist  * software distributed under the License is distributed on an
153334a7e6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
163334a7e6SAndrew Rist  * KIND, either express or implied.  See the License for the
173334a7e6SAndrew Rist  * specific language governing permissions and limitations
183334a7e6SAndrew Rist  * under the License.
193334a7e6SAndrew Rist  *
203334a7e6SAndrew Rist  *************************************************************/
213334a7e6SAndrew Rist 
223334a7e6SAndrew 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 			OverlayManagerBuffered(
75*a56bd57bSArmin Le Grand                 OutputDevice& rOutputDevice,
76cdf0e10cSrcweir 				bool bRefreshWithPreRendering = false);
77cdf0e10cSrcweir 			virtual ~OverlayManagerBuffered();
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 			// complete redraw
80cdf0e10cSrcweir 			virtual void completeRedraw(const Region& rRegion, OutputDevice* pPreRenderDevice = 0L) const;
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 			// flush. Do buffered updates.
83cdf0e10cSrcweir 			virtual void flush();
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 			// #i68597# part of content gets copied, react on it
86cdf0e10cSrcweir 			virtual void copyArea(const Point& rDestPt, const Point& rSrcPt, const Size& rSrcSize);
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 			// restore part of background. Implemented form buffered versions only.
89cdf0e10cSrcweir 			virtual void restoreBackground(const Region& rRegion) const;
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 			// invalidate the given range at local OutputDevice
92cdf0e10cSrcweir 			virtual void invalidateRange(const basegfx::B2DRange& rRange);
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 			// access to RefreshWithPreRendering Flag
DoRefreshWithPreRendering() const95cdf0e10cSrcweir 			bool DoRefreshWithPreRendering() const { return mbRefreshWithPreRendering; }
96cdf0e10cSrcweir 			void SetRefreshWithPreRendering(bool bNew);
97cdf0e10cSrcweir 		};
98cdf0e10cSrcweir 	} // end of namespace overlay
99cdf0e10cSrcweir } // end of namespace sdr
100cdf0e10cSrcweir 
101cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
102cdf0e10cSrcweir 
103cdf0e10cSrcweir #endif //_SDR_OVERLAY_OVERLAYMANAGERBUFFERED_HXX
104cdf0e10cSrcweir 
105cdf0e10cSrcweir // eof
106