/src/libreoffice/include/svx/sdrpaintwindow.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
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 . |
18 | | */ |
19 | | |
20 | | #ifndef INCLUDED_SVX_SDRPAINTWINDOW_HXX |
21 | | #define INCLUDED_SVX_SDRPAINTWINDOW_HXX |
22 | | |
23 | | #include <rtl/ref.hxx> |
24 | | #include <vcl/virdev.hxx> |
25 | | #include <svx/svxdllapi.h> |
26 | | #include <memory> |
27 | | |
28 | | class SdrPaintView; |
29 | | namespace sdr::overlay { class OverlayManager; } |
30 | | |
31 | | |
32 | | #ifdef _MSC_VER // broken msvc template instantiation |
33 | | #include <svx/sdr/overlay/overlaymanager.hxx> |
34 | | #endif |
35 | | |
36 | | /// paint the transparent children of rWin that overlap rPixelRect |
37 | | /// (for example, transparent form controls like check boxes) |
38 | | void SVXCORE_DLLPUBLIC |
39 | | PaintTransparentChildren(vcl::Window const & rWindow, tools::Rectangle const& rPixelRect); |
40 | | |
41 | | class SdrPreRenderDevice |
42 | | { |
43 | | // The original OutputDevice |
44 | | VclPtr<OutputDevice> mpOutputDevice; |
45 | | |
46 | | // The VirtualDevice for PreRendering |
47 | | VclPtr<VirtualDevice> mpPreRenderDevice; |
48 | | |
49 | | public: |
50 | | explicit SdrPreRenderDevice(OutputDevice& rOriginal); |
51 | | ~SdrPreRenderDevice(); |
52 | | |
53 | | void PreparePreRenderDevice(); |
54 | | void OutputPreRenderDevice(const vcl::Region& rExpandedRegion); |
55 | | |
56 | 0 | OutputDevice& GetPreRenderDevice() { return *mpPreRenderDevice; } |
57 | | }; |
58 | | |
59 | | class SVXCORE_DLLPUBLIC SdrPaintWindow |
60 | | { |
61 | | private: |
62 | | // the OutputDevice this window represents |
63 | | VclPtr<OutputDevice> mpOutputDevice; |
64 | | |
65 | | /// In case mrOutputDevice is a buffer for a vcl::Window, this is the window. |
66 | | VclPtr<vcl::Window> mpWindow; |
67 | | |
68 | | // the SdrPaintView this window belongs to |
69 | | SdrPaintView& mrPaintView; |
70 | | |
71 | | // the new OverlayManager for the new OverlayObjects. Test add here, will |
72 | | // replace the IAOManager as soon as it works. |
73 | | rtl::Reference< sdr::overlay::OverlayManager > mxOverlayManager; |
74 | | |
75 | | // The PreRenderDevice for PreRendering |
76 | | std::unique_ptr<SdrPreRenderDevice> mpPreRenderDevice; |
77 | | |
78 | | // The RedrawRegion used for rendering |
79 | | vcl::Region maRedrawRegion; |
80 | | |
81 | | // #i72889# flag if this is only a temporary target for repaint, default is false |
82 | | bool mbTemporaryTarget : 1; |
83 | | |
84 | | bool mbOutputToWindow : 1; |
85 | | |
86 | | // ref to patched |
87 | | SdrPaintWindow* mpPatched; |
88 | | |
89 | | // helpers |
90 | | void impCreateOverlayManager(); |
91 | | |
92 | | public: |
93 | | SdrPaintWindow(SdrPaintView& rNewPaintView, OutputDevice& rOut, vcl::Window* pWindow = nullptr); |
94 | | ~SdrPaintWindow(); |
95 | | |
96 | | // allow reference to patched, see patchPaintWindow/unpatchPaintWindow |
97 | 0 | void setPatched(SdrPaintWindow* pPaintWindow) { mpPatched = pPaintWindow; } |
98 | 0 | SdrPaintWindow* getPatched() const { return mpPatched; } |
99 | | |
100 | | // data read accesses |
101 | 1.85M | OutputDevice& GetOutputDevice() const { return *mpOutputDevice; } |
102 | 0 | vcl::Window* GetWindow() const { return mpWindow; } |
103 | | |
104 | | // OVERLAYMANAGER |
105 | | rtl::Reference< sdr::overlay::OverlayManager > const & GetOverlayManager() const; |
106 | | |
107 | | // #i73602# add flag if buffer shall be used |
108 | | void DrawOverlay(const vcl::Region& rRegion); |
109 | | |
110 | | // calculate visible area and return |
111 | | tools::Rectangle GetVisibleArea() const; |
112 | | |
113 | | // Is OutDev a printer? |
114 | 251k | bool OutputToPrinter() const { return (OUTDEV_PRINTER == mpOutputDevice->GetOutDevType()); } |
115 | | |
116 | | // Is OutDev a window? |
117 | 703k | bool OutputToWindow() const { return mbOutputToWindow; } |
118 | | |
119 | 0 | void SetOutputToWindow(bool bOutputToWindow) { mbOutputToWindow = bOutputToWindow; } |
120 | | |
121 | | // Is OutDev a recording MetaFile? |
122 | | bool OutputToRecordingMetaFile() const; |
123 | | |
124 | | // prepare PreRendering (evtl.) |
125 | | void PreparePreRenderDevice(); |
126 | | void OutputPreRenderDevice(const vcl::Region& rExpandedRegion); |
127 | 418k | SdrPreRenderDevice* GetPreRenderDevice() const { return mpPreRenderDevice.get(); } |
128 | | |
129 | | // RedrawRegion |
130 | 418k | const vcl::Region& GetRedrawRegion() const { return maRedrawRegion;} |
131 | | void SetRedrawRegion(const vcl::Region& rNew); |
132 | | |
133 | | // #i72889# read/write access to TemporaryTarget |
134 | 83.4k | bool getTemporaryTarget() const { return mbTemporaryTarget; } |
135 | 0 | void setTemporaryTarget(bool bNew) { mbTemporaryTarget = bNew; } |
136 | | |
137 | | // #i72889# get target output device, take into account output buffering |
138 | 334k | OutputDevice& GetTargetOutputDevice() { if(mpPreRenderDevice) return mpPreRenderDevice->GetPreRenderDevice(); else return *mpOutputDevice; } |
139 | | }; |
140 | | |
141 | | #endif // INCLUDED_SVX_SDRPAINTWINDOW_HXX |
142 | | |
143 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |