1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: sdrpaintwindow.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SDRPAINTWINDOW_HXX
32 #define _SDRPAINTWINDOW_HXX
34 #ifndef _VIRDEV_HXX //autogen
35 #include <vcl/virdev.hxx>
37 #include "svx/svxdllapi.h"
39 ////////////////////////////////////////////////////////////////////////////////////////////////////
48 } // end of namespace overlay
49 } // end of namespace sdr
51 ////////////////////////////////////////////////////////////////////////////////////////////////////
53 class SdrPreRenderDevice
55 // The original OutputDevice
56 OutputDevice
& mrOutputDevice
;
58 // The VirtualDevice for PreRendering
59 VirtualDevice maPreRenderDevice
;
62 SdrPreRenderDevice(OutputDevice
& rOriginal
);
63 ~SdrPreRenderDevice();
65 void PreparePreRenderDevice();
66 void OutputPreRenderDevice(const Region
& rExpandedRegion
);
68 OutputDevice
& GetOriginalOutputDevice() const { return mrOutputDevice
; }
69 OutputDevice
& GetPreRenderDevice() { return maPreRenderDevice
; }
72 ////////////////////////////////////////////////////////////////////////////////////////////////////
74 class SVX_DLLPUBLIC SdrPaintWindow
77 // the OutputDevice this window represents
78 OutputDevice
& mrOutputDevice
;
80 // the SdrPaintView this window belongs to
81 SdrPaintView
& mrPaintView
;
83 // the new OverlayManager for the new OverlayObjects. Test add here, will
84 // replace the IAOManager as soon as it works.
85 ::sdr::overlay::OverlayManager
* mpOverlayManager
;
87 // The PreRenderDevice for PreRendering
88 SdrPreRenderDevice
* mpPreRenderDevice
;
90 // The RedrawRegion used for rendering
91 Region maRedrawRegion
;
94 // #i72889# flag if this is only a temporary target for repaint, default is false
95 unsigned mbTemporaryTarget
: 1;
97 /** Remember whether the mpOverlayManager supports buffering. Using
98 this flags expensive dynamic_casts on mpOverlayManager in order to
104 /** Create mpOverlayManager member on demand.
106 Specifies whether to use the buffered (OverlayManagerBuffered)
107 or the unbuffered (OverlayManager) version of the overlay
108 manager. When this values is different from that of the
109 previous call then the overlay manager is replaced by the
112 The bUseBuffer flag will typically change its value when text
113 editing is started or stopped.
115 void impCreateOverlayManager(const bool bUseBuffer
);
118 SdrPaintWindow(SdrPaintView
& rNewPaintView
, OutputDevice
& rOut
);
121 // data read accesses
122 SdrPaintView
& GetPaintView() const { return mrPaintView
; }
123 OutputDevice
& GetOutputDevice() const { return mrOutputDevice
; }
126 ::sdr::overlay::OverlayManager
* GetOverlayManager() const;
127 // #i73602# add flag if buffer shall be used
128 void DrawOverlay(const Region
& rRegion
, bool bUseBuffer
);
129 void HideOverlay(const Region
& rRegion
);
131 // calculate visible area and return
132 Rectangle
GetVisibleArea() const;
134 // Is OutDev a printer?
135 sal_Bool
OutputToPrinter() const { return (OUTDEV_PRINTER
== mrOutputDevice
.GetOutDevType()); }
137 // Is OutDev a window?
138 sal_Bool
OutputToWindow() const { return (OUTDEV_WINDOW
== mrOutputDevice
.GetOutDevType()); }
140 // Is OutDev a VirtualDevice?
141 sal_Bool
OutputToVirtualDevice() const { return (OUTDEV_VIRDEV
== mrOutputDevice
.GetOutDevType()); }
143 // Is OutDev a recording MetaFile?
144 sal_Bool
OutputToRecordingMetaFile() const;
146 // prepare PreRendering (evtl.)
147 void PreparePreRenderDevice();
148 void DestroyPreRenderDevice();
149 void OutputPreRenderDevice(const Region
& rExpandedRegion
);
150 SdrPreRenderDevice
* GetPreRenderDevice() const { return mpPreRenderDevice
; }
153 const Region
& GetRedrawRegion() const;
154 void SetRedrawRegion(const Region
& rNew
);
156 // #i72889# read/write access to TempoparyTarget
157 bool getTemporaryTarget() const { return (bool)mbTemporaryTarget
; }
158 void setTemporaryTarget(bool bNew
) { if(bNew
!= (bool)mbTemporaryTarget
) mbTemporaryTarget
= bNew
; }
160 // #i72889# get target output device, take into account output buffering
161 OutputDevice
& GetTargetOutputDevice() { if(mpPreRenderDevice
) return mpPreRenderDevice
->GetPreRenderDevice(); else return mrOutputDevice
; }
164 // typedefs for a list of SdrPaintWindows
165 typedef ::std::vector
< SdrPaintWindow
* > SdrPaintWindowVector
;
167 ////////////////////////////////////////////////////////////////////////////////////////////////////
169 #endif //_SDRPAINTWINDOW_HXX