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