Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SDRPAINTWINDOW_HXX
30 : : #define _SDRPAINTWINDOW_HXX
31 : :
32 : : #include <rtl/ref.hxx>
33 : : #include <vcl/virdev.hxx>
34 : : #include "svx/svxdllapi.h"
35 : :
36 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
37 : : // predeclarations
38 : : class SdrPaintView;
39 : :
40 : : namespace sdr
41 : : {
42 : : namespace overlay
43 : : {
44 : : class OverlayManager;
45 : : } // end of namespace overlay
46 : : } // end of namespace sdr
47 : :
48 : : #ifdef _MSC_VER // broken msvc template instantiation
49 : : #include <svx/sdr/overlay/overlaymanager.hxx>
50 : : #endif
51 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
52 : :
53 : : class SdrPreRenderDevice
54 : : {
55 : : // The original OutputDevice
56 : : OutputDevice& mrOutputDevice;
57 : :
58 : : // The VirtualDevice for PreRendering
59 : : VirtualDevice maPreRenderDevice;
60 : :
61 : : public:
62 : : explicit SdrPreRenderDevice(OutputDevice& rOriginal);
63 : : ~SdrPreRenderDevice();
64 : :
65 : : void PreparePreRenderDevice();
66 : : void OutputPreRenderDevice(const Region& rExpandedRegion);
67 : :
68 : : OutputDevice& GetOriginalOutputDevice() const { return mrOutputDevice; }
69 : 13691 : OutputDevice& GetPreRenderDevice() { return maPreRenderDevice; }
70 : : };
71 : :
72 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
73 : :
74 : : class SVX_DLLPUBLIC SdrPaintWindow
75 : : {
76 : : private:
77 : : // the OutputDevice this window represents
78 : : OutputDevice& mrOutputDevice;
79 : :
80 : : // the SdrPaintView this window belongs to
81 : : SdrPaintView& mrPaintView;
82 : :
83 : : // the new OverlayManager for the new OverlayObjects. Test add here, will
84 : : // replace the IAOManager as soon as it works.
85 : : rtl::Reference< ::sdr::overlay::OverlayManager > mxOverlayManager;
86 : :
87 : : // The PreRenderDevice for PreRendering
88 : : SdrPreRenderDevice* mpPreRenderDevice;
89 : :
90 : : // The RedrawRegion used for rendering
91 : : Region maRedrawRegion;
92 : :
93 : : // bitfield
94 : : // #i72889# flag if this is only a temporary target for repaint, default is false
95 : : unsigned mbTemporaryTarget : 1;
96 : :
97 : : /** Remember whether the mxOverlayManager supports buffering. Using
98 : : this flags expensive dynamic_casts on mxOverlayManager in order to
99 : : detect this.
100 : : */
101 : : bool mbUseBuffer;
102 : :
103 : : // helpers
104 : : /** Create mxOverlayManager member on demand.
105 : : @param bUseBuffer
106 : : Specifies whether to use the buffered (OverlayManagerBuffered)
107 : : or the unbuffered (OverlayManager) version of the overlay
108 : : manager. When this values is different from that of the
109 : : previous call then the overlay manager is replaced by the
110 : : specified one.
111 : :
112 : : The bUseBuffer flag will typically change its value when text
113 : : editing is started or stopped.
114 : : */
115 : : void impCreateOverlayManager(const bool bUseBuffer);
116 : :
117 : : public:
118 : : SdrPaintWindow(SdrPaintView& rNewPaintView, OutputDevice& rOut);
119 : : ~SdrPaintWindow();
120 : :
121 : : // data read accesses
122 : : SdrPaintView& GetPaintView() const { return mrPaintView; }
123 : 2729 : OutputDevice& GetOutputDevice() const { return mrOutputDevice; }
124 : :
125 : : // OVERLAYMANAGER
126 : : rtl::Reference< ::sdr::overlay::OverlayManager > GetOverlayManager() const;
127 : :
128 : : // #i73602# add flag if buffer shall be used
129 : : void DrawOverlay(const Region& rRegion, bool bUseBuffer);
130 : :
131 : : // calculate visible area and return
132 : : Rectangle GetVisibleArea() const;
133 : :
134 : : // Is OutDev a printer?
135 : : sal_Bool OutputToPrinter() const { return (OUTDEV_PRINTER == mrOutputDevice.GetOutDevType()); }
136 : :
137 : : // Is OutDev a window?
138 : 0 : sal_Bool OutputToWindow() const { return (OUTDEV_WINDOW == mrOutputDevice.GetOutDevType()); }
139 : :
140 : : // Is OutDev a VirtualDevice?
141 : : sal_Bool OutputToVirtualDevice() const { return (OUTDEV_VIRDEV == mrOutputDevice.GetOutDevType()); }
142 : :
143 : : // Is OutDev a recording MetaFile?
144 : : sal_Bool OutputToRecordingMetaFile() const;
145 : :
146 : : // prepare PreRendering (evtl.)
147 : : void PreparePreRenderDevice();
148 : : void DestroyPreRenderDevice();
149 : : void OutputPreRenderDevice(const Region& rExpandedRegion);
150 : 24864 : SdrPreRenderDevice* GetPreRenderDevice() const { return mpPreRenderDevice; }
151 : :
152 : : // RedrawRegion
153 : : const Region& GetRedrawRegion() const;
154 : : void SetRedrawRegion(const Region& rNew);
155 : :
156 : : // #i72889# read/write access to TempoparyTarget
157 : : bool getTemporaryTarget() const { return (bool)mbTemporaryTarget; }
158 : : void setTemporaryTarget(bool bNew) { if(bNew != (bool)mbTemporaryTarget) mbTemporaryTarget = bNew; }
159 : :
160 : : // #i72889# get target output device, take into account output buffering
161 [ + - ]: 13691 : OutputDevice& GetTargetOutputDevice() { if(mpPreRenderDevice) return mpPreRenderDevice->GetPreRenderDevice(); else return mrOutputDevice; }
162 : : };
163 : :
164 : : // typedefs for a list of SdrPaintWindows
165 : : typedef ::std::vector< SdrPaintWindow* > SdrPaintWindowVector;
166 : :
167 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
168 : :
169 : : #endif //_SDRPAINTWINDOW_HXX
170 : :
171 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|