1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _SDRPAINTWINDOW_HXX
21 #define _SDRPAINTWINDOW_HXX
23 #include <rtl/ref.hxx>
24 #include <vcl/virdev.hxx>
25 #include "svx/svxdllapi.h"
27 ////////////////////////////////////////////////////////////////////////////////////////////////////
36 } // end of namespace overlay
37 } // end of namespace sdr
39 #ifdef _MSC_VER // broken msvc template instantiation
40 #include <svx/sdr/overlay/overlaymanager.hxx>
42 ////////////////////////////////////////////////////////////////////////////////////////////////////
44 /// paint the transparent children of rWin that overlap rPixelRect
45 /// (for example, transparent form controls like check boxes)
47 PaintTransparentChildren(Window
& rWindow
, Rectangle
const& rPixelRect
);
50 class SdrPreRenderDevice
52 // The original OutputDevice
53 OutputDevice
& mrOutputDevice
;
55 // The VirtualDevice for PreRendering
56 VirtualDevice maPreRenderDevice
;
59 explicit SdrPreRenderDevice(OutputDevice
& rOriginal
);
60 ~SdrPreRenderDevice();
62 void PreparePreRenderDevice();
63 void OutputPreRenderDevice(const Region
& rExpandedRegion
);
65 OutputDevice
& GetOriginalOutputDevice() const { return mrOutputDevice
; }
66 OutputDevice
& GetPreRenderDevice() { return maPreRenderDevice
; }
69 ////////////////////////////////////////////////////////////////////////////////////////////////////
71 class SVX_DLLPUBLIC SdrPaintWindow
74 // the OutputDevice this window represents
75 OutputDevice
& mrOutputDevice
;
77 // the SdrPaintView this window belongs to
78 SdrPaintView
& mrPaintView
;
80 // the new OverlayManager for the new OverlayObjects. Test add here, will
81 // replace the IAOManager as soon as it works.
82 rtl::Reference
< ::sdr::overlay::OverlayManager
> mxOverlayManager
;
84 // The PreRenderDevice for PreRendering
85 SdrPreRenderDevice
* mpPreRenderDevice
;
87 // The RedrawRegion used for rendering
88 Region maRedrawRegion
;
91 // #i72889# flag if this is only a temporary target for repaint, default is false
92 unsigned mbTemporaryTarget
: 1;
94 /** Remember whether the mxOverlayManager supports buffering. Using
95 this flags expensive dynamic_casts on mxOverlayManager in order to
101 void impCreateOverlayManager();
104 SdrPaintWindow(SdrPaintView
& rNewPaintView
, OutputDevice
& rOut
);
107 // data read accesses
108 SdrPaintView
& GetPaintView() const { return mrPaintView
; }
109 OutputDevice
& GetOutputDevice() const { return mrOutputDevice
; }
112 rtl::Reference
< ::sdr::overlay::OverlayManager
> GetOverlayManager() const;
114 // #i73602# add flag if buffer shall be used
115 void DrawOverlay(const Region
& rRegion
);
117 // calculate visible area and return
118 Rectangle
GetVisibleArea() const;
120 // Is OutDev a printer?
121 bool OutputToPrinter() const { return (OUTDEV_PRINTER
== mrOutputDevice
.GetOutDevType()); }
123 // Is OutDev a window?
124 sal_Bool
OutputToWindow() const { return (OUTDEV_WINDOW
== mrOutputDevice
.GetOutDevType()); }
126 // Is OutDev a VirtualDevice?
127 sal_Bool
OutputToVirtualDevice() const { return (OUTDEV_VIRDEV
== mrOutputDevice
.GetOutDevType()); }
129 // Is OutDev a recording MetaFile?
130 bool OutputToRecordingMetaFile() const;
132 // prepare PreRendering (evtl.)
133 void PreparePreRenderDevice();
134 void DestroyPreRenderDevice();
135 void OutputPreRenderDevice(const Region
& rExpandedRegion
);
136 SdrPreRenderDevice
* GetPreRenderDevice() const { return mpPreRenderDevice
; }
139 const Region
& GetRedrawRegion() const;
140 void SetRedrawRegion(const Region
& rNew
);
142 // #i72889# read/write access to TempoparyTarget
143 bool getTemporaryTarget() const { return (bool)mbTemporaryTarget
; }
144 void setTemporaryTarget(bool bNew
) { if(bNew
!= (bool)mbTemporaryTarget
) mbTemporaryTarget
= bNew
; }
146 // #i72889# get target output device, take into account output buffering
147 OutputDevice
& GetTargetOutputDevice() { if(mpPreRenderDevice
) return mpPreRenderDevice
->GetPreRenderDevice(); else return mrOutputDevice
; }
150 // typedefs for a list of SdrPaintWindows
151 typedef ::std::vector
< SdrPaintWindow
* > SdrPaintWindowVector
;
153 ////////////////////////////////////////////////////////////////////////////////////////////////////
155 #endif //_SDRPAINTWINDOW_HXX
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */