Branch libreoffice-5-0-4
[LibreOffice.git] / include / svx / sdrpaintwindow.hxx
blob36176e53d7e26af38be3fccdcb5586939593c4e1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
27 class SdrPaintView;
29 namespace sdr
31 namespace overlay
33 class OverlayManager;
37 #ifdef _MSC_VER // broken msvc template instantiation
38 #include <svx/sdr/overlay/overlaymanager.hxx>
39 #endif
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);
46 class SdrPreRenderDevice
48 // The original OutputDevice
49 OutputDevice& mrOutputDevice;
51 // The VirtualDevice for PreRendering
52 VclPtr<VirtualDevice> mpPreRenderDevice;
54 public:
55 explicit SdrPreRenderDevice(OutputDevice& rOriginal);
56 ~SdrPreRenderDevice();
58 void PreparePreRenderDevice();
59 void OutputPreRenderDevice(const vcl::Region& rExpandedRegion);
61 OutputDevice& GetOriginalOutputDevice() const { return mrOutputDevice; }
62 OutputDevice& GetPreRenderDevice() { return *mpPreRenderDevice.get(); }
65 class SVX_DLLPUBLIC SdrPaintWindow
67 private:
68 // the OutputDevice this window represents
69 OutputDevice& mrOutputDevice;
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 SdrPreRenderDevice* mpPreRenderDevice;
84 // The RedrawRegion used for rendering
85 vcl::Region maRedrawRegion;
87 // bitfield
88 // #i72889# flag if this is only a temporary target for repaint, default is false
89 bool mbTemporaryTarget : 1;
91 /** Remember whether the mxOverlayManager supports buffering. Using
92 this flags expensive dynamic_casts on mxOverlayManager in order to
93 detect this.
95 bool mbUseBuffer;
97 // helpers
98 void impCreateOverlayManager();
100 public:
101 SdrPaintWindow(SdrPaintView& rNewPaintView, OutputDevice& rOut, vcl::Window* pWindow = 0);
102 ~SdrPaintWindow();
104 // data read accesses
105 SdrPaintView& GetPaintView() const { return mrPaintView; }
106 OutputDevice& GetOutputDevice() const { return mrOutputDevice; }
107 vcl::Window* GetWindow() const { return mpWindow; }
109 // OVERLAYMANAGER
110 rtl::Reference< sdr::overlay::OverlayManager > GetOverlayManager() const;
112 // #i73602# add flag if buffer shall be used
113 void DrawOverlay(const vcl::Region& rRegion);
115 // calculate visible area and return
116 Rectangle GetVisibleArea() const;
118 // Is OutDev a printer?
119 bool OutputToPrinter() const { return (OUTDEV_PRINTER == mrOutputDevice.GetOutDevType()); }
121 // Is OutDev a window?
122 bool OutputToWindow() const { return (OUTDEV_WINDOW == mrOutputDevice.GetOutDevType()); }
124 // Is OutDev a VirtualDevice?
125 bool OutputToVirtualDevice() const { return (OUTDEV_VIRDEV == mrOutputDevice.GetOutDevType()); }
127 // Is OutDev a recording MetaFile?
128 bool OutputToRecordingMetaFile() const;
130 // prepare PreRendering (evtl.)
131 void PreparePreRenderDevice();
132 void DestroyPreRenderDevice();
133 void OutputPreRenderDevice(const vcl::Region& rExpandedRegion);
134 SdrPreRenderDevice* GetPreRenderDevice() const { return mpPreRenderDevice; }
136 // RedrawRegion
137 const vcl::Region& GetRedrawRegion() const { return maRedrawRegion;}
138 void SetRedrawRegion(const vcl::Region& rNew);
140 // #i72889# read/write access to TempoparyTarget
141 bool getTemporaryTarget() const { return (bool)mbTemporaryTarget; }
142 void setTemporaryTarget(bool bNew) { mbTemporaryTarget = bNew; }
144 // #i72889# get target output device, take into account output buffering
145 OutputDevice& GetTargetOutputDevice() { if(mpPreRenderDevice) return mpPreRenderDevice->GetPreRenderDevice(); else return mrOutputDevice; }
148 // typedefs for a list of SdrPaintWindows
149 typedef ::std::vector< SdrPaintWindow* > SdrPaintWindowVector;
151 #endif // INCLUDED_SVX_SDRPAINTWINDOW_HXX
153 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */