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 INCLUDED_SVX_SDRPAINTWINDOW_HXX
21 #define INCLUDED_SVX_SDRPAINTWINDOW_HXX
23 #include <rtl/ref.hxx>
24 #include <vcl/virdev.hxx>
25 #include <svx/svxdllapi.h>
38 #ifdef _MSC_VER // broken msvc template instantiation
39 #include <svx/sdr/overlay/overlaymanager.hxx>
42 /// paint the transparent children of rWin that overlap rPixelRect
43 /// (for example, transparent form controls like check boxes)
45 PaintTransparentChildren(vcl::Window
const & rWindow
, tools::Rectangle
const& rPixelRect
);
47 class SdrPreRenderDevice
49 // The original OutputDevice
50 VclPtr
<OutputDevice
> mpOutputDevice
;
52 // The VirtualDevice for PreRendering
53 VclPtr
<VirtualDevice
> mpPreRenderDevice
;
56 explicit SdrPreRenderDevice(OutputDevice
& rOriginal
);
57 ~SdrPreRenderDevice();
59 void PreparePreRenderDevice();
60 void OutputPreRenderDevice(const vcl::Region
& rExpandedRegion
);
62 OutputDevice
& GetPreRenderDevice() { return *mpPreRenderDevice
; }
65 class SVX_DLLPUBLIC SdrPaintWindow
68 // the OutputDevice this window represents
69 VclPtr
<OutputDevice
> mpOutputDevice
;
71 /// In case mrOutputDevice is a buffer for a vcl::Window, this is the window.
72 VclPtr
<vcl::Window
> mpWindow
;
74 // the SdrPaintView this window belongs to
75 SdrPaintView
& mrPaintView
;
77 // the new OverlayManager for the new OverlayObjects. Test add here, will
78 // replace the IAOManager as soon as it works.
79 rtl::Reference
< sdr::overlay::OverlayManager
> mxOverlayManager
;
81 // The PreRenderDevice for PreRendering
82 std::unique_ptr
<SdrPreRenderDevice
> mpPreRenderDevice
;
84 // The RedrawRegion used for rendering
85 vcl::Region maRedrawRegion
;
87 // #i72889# flag if this is only a temporary target for repaint, default is false
88 bool mbTemporaryTarget
: 1;
90 bool mbOutputToWindow
: 1;
93 void impCreateOverlayManager();
96 SdrPaintWindow(SdrPaintView
& rNewPaintView
, OutputDevice
& rOut
, vcl::Window
* pWindow
= nullptr);
100 SdrPaintView
& GetPaintView() const { return mrPaintView
; }
101 OutputDevice
& GetOutputDevice() const { return *mpOutputDevice
; }
102 vcl::Window
* GetWindow() const { return mpWindow
; }
105 rtl::Reference
< sdr::overlay::OverlayManager
> const & GetOverlayManager() const;
107 // #i73602# add flag if buffer shall be used
108 void DrawOverlay(const vcl::Region
& rRegion
);
110 // calculate visible area and return
111 tools::Rectangle
GetVisibleArea() const;
113 // Is OutDev a printer?
114 bool OutputToPrinter() const { return (OUTDEV_PRINTER
== mpOutputDevice
->GetOutDevType()); }
116 // Is OutDev a window?
117 bool OutputToWindow() const { return mbOutputToWindow
; }
119 void SetOutputToWindow(bool bOutputToWindow
) { mbOutputToWindow
= bOutputToWindow
; }
121 // Is OutDev a VirtualDevice?
122 bool OutputIsVirtualDevice() const { return mpOutputDevice
->IsVirtual(); }
124 // Is OutDev a recording MetaFile?
125 bool OutputToRecordingMetaFile() const;
127 // prepare PreRendering (evtl.)
128 void PreparePreRenderDevice();
129 void DestroyPreRenderDevice();
130 void OutputPreRenderDevice(const vcl::Region
& rExpandedRegion
);
131 SdrPreRenderDevice
* GetPreRenderDevice() const { return mpPreRenderDevice
.get(); }
134 const vcl::Region
& GetRedrawRegion() const { return maRedrawRegion
;}
135 void SetRedrawRegion(const vcl::Region
& rNew
);
137 // #i72889# read/write access to TemporaryTarget
138 bool getTemporaryTarget() const { return mbTemporaryTarget
; }
139 void setTemporaryTarget(bool bNew
) { mbTemporaryTarget
= bNew
; }
141 // #i72889# get target output device, take into account output buffering
142 OutputDevice
& GetTargetOutputDevice() { if(mpPreRenderDevice
) return mpPreRenderDevice
->GetPreRenderDevice(); else return *mpOutputDevice
; }
145 #endif // INCLUDED_SVX_SDRPAINTWINDOW_HXX
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */