xref: /trunk/main/svx/inc/svx/sdrpaintwindow.hxx (revision a56bd57b)
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 _SDRPAINTWINDOW_HXX
25cdf0e10cSrcweir #define _SDRPAINTWINDOW_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifndef _VIRDEV_HXX //autogen
28cdf0e10cSrcweir #include <vcl/virdev.hxx>
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir #include "svx/svxdllapi.h"
31cdf0e10cSrcweir 
32cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
33cdf0e10cSrcweir // predeclarations
34cdf0e10cSrcweir class SdrPaintView;
35cdf0e10cSrcweir 
36cdf0e10cSrcweir namespace sdr
37cdf0e10cSrcweir {
38cdf0e10cSrcweir 	namespace overlay
39cdf0e10cSrcweir 	{
40cdf0e10cSrcweir 		class OverlayManager;
41cdf0e10cSrcweir 	} // end of namespace overlay
42cdf0e10cSrcweir } // end of namespace sdr
43cdf0e10cSrcweir 
44cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
45cdf0e10cSrcweir 
46cdf0e10cSrcweir class SdrPreRenderDevice
47cdf0e10cSrcweir {
48cdf0e10cSrcweir 	// The original OutputDevice
49cdf0e10cSrcweir 	OutputDevice&										mrOutputDevice;
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 	// The VirtualDevice for PreRendering
52cdf0e10cSrcweir 	VirtualDevice										maPreRenderDevice;
53cdf0e10cSrcweir 
54cdf0e10cSrcweir public:
55cdf0e10cSrcweir 	SdrPreRenderDevice(OutputDevice& rOriginal);
56cdf0e10cSrcweir 	~SdrPreRenderDevice();
57cdf0e10cSrcweir 
58cdf0e10cSrcweir 	void PreparePreRenderDevice();
59cdf0e10cSrcweir 	void OutputPreRenderDevice(const Region& rExpandedRegion);
60cdf0e10cSrcweir 
GetOriginalOutputDevice() const61cdf0e10cSrcweir 	OutputDevice& GetOriginalOutputDevice() const { return mrOutputDevice; }
GetPreRenderDevice()62cdf0e10cSrcweir 	OutputDevice& GetPreRenderDevice() { return maPreRenderDevice; }
63cdf0e10cSrcweir };
64cdf0e10cSrcweir 
65cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
66cdf0e10cSrcweir 
67cdf0e10cSrcweir class SVX_DLLPUBLIC SdrPaintWindow
68cdf0e10cSrcweir {
69cdf0e10cSrcweir private:
70cdf0e10cSrcweir 	// the OutputDevice this window represents
71cdf0e10cSrcweir 	OutputDevice&										mrOutputDevice;
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 	// the SdrPaintView this window belongs to
74cdf0e10cSrcweir 	SdrPaintView&										mrPaintView;
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 	// the new OverlayManager for the new OverlayObjects. Test add here, will
77cdf0e10cSrcweir 	// replace the IAOManager as soon as it works.
78cdf0e10cSrcweir 	::sdr::overlay::OverlayManager*						mpOverlayManager;
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 	// The PreRenderDevice for PreRendering
81cdf0e10cSrcweir 	SdrPreRenderDevice*									mpPreRenderDevice;
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 	// The RedrawRegion used for rendering
84cdf0e10cSrcweir 	Region												maRedrawRegion;
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	// bitfield
87cdf0e10cSrcweir 	// #i72889# flag if this is only a temporary target for repaint, default is false
88cdf0e10cSrcweir 	unsigned											mbTemporaryTarget : 1;
89cdf0e10cSrcweir 
90cdf0e10cSrcweir     /** Remember whether the mpOverlayManager supports buffering.  Using
91cdf0e10cSrcweir         this flags expensive dynamic_casts on mpOverlayManager in order to
92cdf0e10cSrcweir         detect this.
93cdf0e10cSrcweir     */
94cdf0e10cSrcweir     bool mbUseBuffer;
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 	// helpers
97*a56bd57bSArmin Le Grand     void impCreateOverlayManager();
98cdf0e10cSrcweir 
99cdf0e10cSrcweir public:
100cdf0e10cSrcweir 	SdrPaintWindow(SdrPaintView& rNewPaintView, OutputDevice& rOut);
101cdf0e10cSrcweir 	~SdrPaintWindow();
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 	// data read accesses
GetPaintView() const104cdf0e10cSrcweir 	SdrPaintView& GetPaintView() const { return mrPaintView; }
GetOutputDevice() const105cdf0e10cSrcweir 	OutputDevice& GetOutputDevice() const { return mrOutputDevice; }
106cdf0e10cSrcweir 
107cdf0e10cSrcweir 	// OVERLAYMANAGER
108cdf0e10cSrcweir 	::sdr::overlay::OverlayManager* GetOverlayManager() const;
109cdf0e10cSrcweir 	// #i73602# add flag if buffer shall be used
110*a56bd57bSArmin Le Grand 	void DrawOverlay(const Region& rRegion);
111cdf0e10cSrcweir 	void HideOverlay(const Region& rRegion);
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 	// calculate visible area and return
114cdf0e10cSrcweir 	Rectangle GetVisibleArea() const;
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 	// Is OutDev a printer?
OutputToPrinter() const117cdf0e10cSrcweir 	sal_Bool OutputToPrinter() const { return (OUTDEV_PRINTER == mrOutputDevice.GetOutDevType()); }
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 	// Is OutDev a window?
OutputToWindow() const120cdf0e10cSrcweir 	sal_Bool OutputToWindow() const { return (OUTDEV_WINDOW == mrOutputDevice.GetOutDevType()); }
121cdf0e10cSrcweir 
122cdf0e10cSrcweir 	// Is OutDev a VirtualDevice?
OutputToVirtualDevice() const123cdf0e10cSrcweir 	sal_Bool OutputToVirtualDevice() const { return (OUTDEV_VIRDEV == mrOutputDevice.GetOutDevType()); }
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 	// Is OutDev a recording MetaFile?
126cdf0e10cSrcweir 	sal_Bool OutputToRecordingMetaFile() const;
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 	// prepare PreRendering (evtl.)
129cdf0e10cSrcweir 	void PreparePreRenderDevice();
130cdf0e10cSrcweir 	void DestroyPreRenderDevice();
131cdf0e10cSrcweir 	void OutputPreRenderDevice(const Region& rExpandedRegion);
GetPreRenderDevice() const132cdf0e10cSrcweir 	SdrPreRenderDevice* GetPreRenderDevice() const { return mpPreRenderDevice; }
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 	// RedrawRegion
135cdf0e10cSrcweir 	const Region& GetRedrawRegion() const;
136cdf0e10cSrcweir 	void SetRedrawRegion(const Region& rNew);
137cdf0e10cSrcweir 
138cdf0e10cSrcweir 	// #i72889# read/write access to TempoparyTarget
getTemporaryTarget() const139cdf0e10cSrcweir 	bool getTemporaryTarget() const { return (bool)mbTemporaryTarget; }
setTemporaryTarget(bool bNew)140cdf0e10cSrcweir 	void setTemporaryTarget(bool bNew) { if(bNew != (bool)mbTemporaryTarget) mbTemporaryTarget = bNew; }
141cdf0e10cSrcweir 
142cdf0e10cSrcweir 	// #i72889# get target output device, take into account output buffering
GetTargetOutputDevice()143cdf0e10cSrcweir 	OutputDevice& GetTargetOutputDevice() { if(mpPreRenderDevice) return mpPreRenderDevice->GetPreRenderDevice(); else return mrOutputDevice; }
144cdf0e10cSrcweir };
145cdf0e10cSrcweir 
146cdf0e10cSrcweir // typedefs for a list of SdrPaintWindows
147cdf0e10cSrcweir typedef ::std::vector< SdrPaintWindow* > SdrPaintWindowVector;
148cdf0e10cSrcweir 
149cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
150cdf0e10cSrcweir 
151cdf0e10cSrcweir #endif //_SDRPAINTWINDOW_HXX
152cdf0e10cSrcweir 
153