Line data Source code
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 :
27 : class SdrPaintView;
28 :
29 : namespace sdr
30 : {
31 : namespace overlay
32 : {
33 : class OverlayManager;
34 : }
35 : }
36 :
37 : #ifdef _MSC_VER // broken msvc template instantiation
38 : #include <svx/sdr/overlay/overlaymanager.hxx>
39 : #endif
40 :
41 : /// paint the transparent children of rWin that overlap rPixelRect
42 : /// (for example, transparent form controls like check boxes)
43 : void SVX_DLLPUBLIC
44 : PaintTransparentChildren(vcl::Window & rWindow, Rectangle const& rPixelRect);
45 :
46 : class SdrPreRenderDevice
47 : {
48 : // The original OutputDevice
49 : OutputDevice& mrOutputDevice;
50 :
51 : // The VirtualDevice for PreRendering
52 : VclPtr<VirtualDevice> mpPreRenderDevice;
53 :
54 : public:
55 : explicit SdrPreRenderDevice(OutputDevice& rOriginal);
56 : ~SdrPreRenderDevice();
57 :
58 : void PreparePreRenderDevice();
59 : void OutputPreRenderDevice(const vcl::Region& rExpandedRegion);
60 :
61 : OutputDevice& GetOriginalOutputDevice() const { return mrOutputDevice; }
62 43156 : OutputDevice& GetPreRenderDevice() { return *mpPreRenderDevice.get(); }
63 : };
64 :
65 : class SVX_DLLPUBLIC SdrPaintWindow
66 : {
67 : private:
68 : // the OutputDevice this window represents
69 : OutputDevice& mrOutputDevice;
70 :
71 : // the SdrPaintView this window belongs to
72 : SdrPaintView& mrPaintView;
73 :
74 : // the new OverlayManager for the new OverlayObjects. Test add here, will
75 : // replace the IAOManager as soon as it works.
76 : rtl::Reference< sdr::overlay::OverlayManager > mxOverlayManager;
77 :
78 : // The PreRenderDevice for PreRendering
79 : SdrPreRenderDevice* mpPreRenderDevice;
80 :
81 : // The RedrawRegion used for rendering
82 : vcl::Region maRedrawRegion;
83 :
84 : // bitfield
85 : // #i72889# flag if this is only a temporary target for repaint, default is false
86 : bool mbTemporaryTarget : 1;
87 :
88 : /** Remember whether the mxOverlayManager supports buffering. Using
89 : this flags expensive dynamic_casts on mxOverlayManager in order to
90 : detect this.
91 : */
92 : bool mbUseBuffer;
93 :
94 : // helpers
95 : void impCreateOverlayManager();
96 :
97 : public:
98 : SdrPaintWindow(SdrPaintView& rNewPaintView, OutputDevice& rOut);
99 : ~SdrPaintWindow();
100 :
101 : // data read accesses
102 6560 : SdrPaintView& GetPaintView() const { return mrPaintView; }
103 560138 : OutputDevice& GetOutputDevice() const { return mrOutputDevice; }
104 :
105 : // OVERLAYMANAGER
106 : rtl::Reference< sdr::overlay::OverlayManager > GetOverlayManager() const;
107 :
108 : // #i73602# add flag if buffer shall be used
109 : void DrawOverlay(const vcl::Region& rRegion);
110 :
111 : // calculate visible area and return
112 : Rectangle GetVisibleArea() const;
113 :
114 : // Is OutDev a printer?
115 68906 : bool OutputToPrinter() const { return (OUTDEV_PRINTER == mrOutputDevice.GetOutDevType()); }
116 :
117 : // Is OutDev a window?
118 56897 : bool OutputToWindow() const { return (OUTDEV_WINDOW == mrOutputDevice.GetOutDevType()); }
119 :
120 : // Is OutDev a VirtualDevice?
121 14309 : bool OutputToVirtualDevice() const { return (OUTDEV_VIRDEV == mrOutputDevice.GetOutDevType()); }
122 :
123 : // Is OutDev a recording MetaFile?
124 : bool OutputToRecordingMetaFile() const;
125 :
126 : // prepare PreRendering (evtl.)
127 : void PreparePreRenderDevice();
128 : void DestroyPreRenderDevice();
129 : void OutputPreRenderDevice(const vcl::Region& rExpandedRegion);
130 60017 : SdrPreRenderDevice* GetPreRenderDevice() const { return mpPreRenderDevice; }
131 :
132 : // RedrawRegion
133 107057 : const vcl::Region& GetRedrawRegion() const { return maRedrawRegion;}
134 : void SetRedrawRegion(const vcl::Region& rNew);
135 :
136 : // #i72889# read/write access to TempoparyTarget
137 14360 : bool getTemporaryTarget() const { return (bool)mbTemporaryTarget; }
138 0 : void setTemporaryTarget(bool bNew) { mbTemporaryTarget = bNew; }
139 :
140 : // #i72889# get target output device, take into account output buffering
141 67229 : OutputDevice& GetTargetOutputDevice() { if(mpPreRenderDevice) return mpPreRenderDevice->GetPreRenderDevice(); else return mrOutputDevice; }
142 : };
143 :
144 : // typedefs for a list of SdrPaintWindows
145 : typedef ::std::vector< SdrPaintWindow* > SdrPaintWindowVector;
146 :
147 : #endif // INCLUDED_SVX_SDRPAINTWINDOW_HXX
148 :
149 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|