LibreOffice Module svx (master)  1
sdrpaintwindow.hxx
Go to the documentation of this file.
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 
30 namespace sdr
31 {
32  namespace overlay
33  {
34  class OverlayManager;
35  }
36 }
37 
38 #ifdef _MSC_VER // broken msvc template instantiation
40 #endif
41 
45 PaintTransparentChildren(vcl::Window const & rWindow, tools::Rectangle const& rPixelRect);
46 
48 {
49  // The original OutputDevice
51 
52  // The VirtualDevice for PreRendering
54 
55 public:
56  explicit SdrPreRenderDevice(OutputDevice& rOriginal);
58 
60  void OutputPreRenderDevice(const vcl::Region& rExpandedRegion);
61 
63 };
64 
66 {
67 private:
68  // the OutputDevice this window represents
70 
73 
74  // the SdrPaintView this window belongs to
76 
77  // the new OverlayManager for the new OverlayObjects. Test add here, will
78  // replace the IAOManager as soon as it works.
80 
81  // The PreRenderDevice for PreRendering
82  std::unique_ptr<SdrPreRenderDevice> mpPreRenderDevice;
83 
84  // The RedrawRegion used for rendering
86 
87  // #i72889# flag if this is only a temporary target for repaint, default is false
88  bool mbTemporaryTarget : 1;
89 
90  bool mbOutputToWindow : 1;
91 
92  // ref to patched
94 
95  // helpers
96  void impCreateOverlayManager();
97 
98 public:
99  SdrPaintWindow(SdrPaintView& rNewPaintView, OutputDevice& rOut, vcl::Window* pWindow = nullptr);
100  ~SdrPaintWindow();
101 
102  // allow reference to patched, see patchPaintWindow/unpatchPaintWindow
103  void setPatched(SdrPaintWindow* pPaintWindow) { mpPatched = pPaintWindow; }
104  SdrPaintWindow* getPatched() const { return mpPatched; }
105 
106  // data read accesses
107  OutputDevice& GetOutputDevice() const { return *mpOutputDevice; }
108  vcl::Window* GetWindow() const { return mpWindow; }
109 
110  // OVERLAYMANAGER
111  rtl::Reference< sdr::overlay::OverlayManager > const & GetOverlayManager() const;
112 
113  // #i73602# add flag if buffer shall be used
114  void DrawOverlay(const vcl::Region& rRegion);
115 
116  // calculate visible area and return
117  tools::Rectangle GetVisibleArea() const;
118 
119  // Is OutDev a printer?
120  bool OutputToPrinter() const { return (OUTDEV_PRINTER == mpOutputDevice->GetOutDevType()); }
121 
122  // Is OutDev a window?
123  bool OutputToWindow() const { return mbOutputToWindow; }
124 
125  void SetOutputToWindow(bool bOutputToWindow) { mbOutputToWindow = bOutputToWindow; }
126 
127  // Is OutDev a recording MetaFile?
128  bool OutputToRecordingMetaFile() const;
129 
130  // prepare PreRendering (evtl.)
131  void PreparePreRenderDevice();
132  void DestroyPreRenderDevice();
133  void OutputPreRenderDevice(const vcl::Region& rExpandedRegion);
134  SdrPreRenderDevice* GetPreRenderDevice() const { return mpPreRenderDevice.get(); }
135 
136  // RedrawRegion
137  const vcl::Region& GetRedrawRegion() const { return maRedrawRegion;}
138  void SetRedrawRegion(const vcl::Region& rNew);
139 
140  // #i72889# read/write access to TemporaryTarget
141  bool getTemporaryTarget() const { return mbTemporaryTarget; }
142  void setTemporaryTarget(bool bNew) { mbTemporaryTarget = bNew; }
143 
144  // #i72889# get target output device, take into account output buffering
145  OutputDevice& GetTargetOutputDevice() { if(mpPreRenderDevice) return mpPreRenderDevice->GetPreRenderDevice(); else return *mpOutputDevice; }
146 };
147 
148 #endif // INCLUDED_SVX_SDRPAINTWINDOW_HXX
149 
150 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OutDevType GetOutDevType() const
rtl::Reference< sdr::overlay::OverlayManager > mxOverlayManager
SdrPreRenderDevice * GetPreRenderDevice() const
SdrPaintWindow * getPatched() const
OutputDevice & GetPreRenderDevice()
void setPatched(SdrPaintWindow *pPaintWindow)
OutputDevice & GetTargetOutputDevice()
bool OutputToWindow() const
VclPtr< OutputDevice > mpOutputDevice
OUTDEV_PRINTER
SdrPaintWindow * mpPatched
void setTemporaryTarget(bool bNew)
SdrPreRenderDevice(OutputDevice &rOriginal)
void SetOutputToWindow(bool bOutputToWindow)
bool getTemporaryTarget() const
const vcl::Region & GetRedrawRegion() const
VclPtr< OutputDevice > mpOutputDevice
bool OutputToPrinter() const
VclPtr< VirtualDevice > mpPreRenderDevice
void SVXCORE_DLLPUBLIC PaintTransparentChildren(vcl::Window const &rWindow, tools::Rectangle const &rPixelRect)
paint the transparent children of rWin that overlap rPixelRect (for example, transparent form control...
vcl::Window * GetWindow() const
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
void OutputPreRenderDevice(const vcl::Region &rExpandedRegion)
VclPtr< vcl::Window > mpWindow
In case mrOutputDevice is a buffer for a vcl::Window, this is the window.
vcl::Region maRedrawRegion
OutputDevice & GetOutputDevice() const
std::unique_ptr< SdrPreRenderDevice > mpPreRenderDevice
SdrPaintView & mrPaintView