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