1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 #ifndef _SDRPAINTWINDOW_HXX 23 #define _SDRPAINTWINDOW_HXX 24 25 #ifndef _VIRDEV_HXX //autogen 26 #include <vcl/virdev.hxx> 27 #endif 28 #include "svx/svxdllapi.h" 29 30 // predeclarations 31 class SdrPaintView; 32 33 namespace sdr 34 { 35 namespace overlay 36 { 37 class OverlayManager; 38 } // end of namespace overlay 39 } // end of namespace sdr 40 41 //////////////////////////////////////////////////////////////////////////////////////////////////// 42 43 class SdrPreRenderDevice 44 { 45 // The original OutputDevice 46 OutputDevice& mrOutputDevice; 47 48 // The VirtualDevice for PreRendering 49 VirtualDevice maPreRenderDevice; 50 51 public: 52 SdrPreRenderDevice(OutputDevice& rOriginal); 53 ~SdrPreRenderDevice(); 54 55 void PreparePreRenderDevice(); 56 void OutputPreRenderDevice(const Region& rExpandedRegion); 57 GetOriginalOutputDevice() const58 OutputDevice& GetOriginalOutputDevice() const { return mrOutputDevice; } GetPreRenderDevice()59 OutputDevice& GetPreRenderDevice() { return maPreRenderDevice; } 60 }; 61 62 //////////////////////////////////////////////////////////////////////////////////////////////////// 63 64 class SVX_DLLPUBLIC SdrPaintWindow 65 { 66 private: 67 // the OutputDevice this window represents 68 OutputDevice& mrOutputDevice; 69 70 // the SdrPaintView this window belongs to 71 SdrPaintView& mrPaintView; 72 73 // the new OverlayManager for the new OverlayObjects. Test add here, will 74 // replace the IAOManager as soon as it works. 75 ::sdr::overlay::OverlayManager* mpOverlayManager; 76 77 // The PreRenderDevice for PreRendering 78 SdrPreRenderDevice* mpPreRenderDevice; 79 80 // The RedrawRegion used for rendering 81 Region maRedrawRegion; 82 83 // bitfield 84 // #i72889# flag if this is only a temporary target for repaint, default is false 85 unsigned mbTemporaryTarget : 1; 86 87 /** Remember whether the mpOverlayManager supports buffering. Using 88 this flags expensive dynamic_casts on mpOverlayManager in order to 89 detect this. 90 */ 91 bool mbUseBuffer; 92 93 // helpers 94 void impCreateOverlayManager(); 95 96 public: 97 SdrPaintWindow(SdrPaintView& rNewPaintView, OutputDevice& rOut); 98 ~SdrPaintWindow(); 99 100 // data read accesses GetPaintView() const101 SdrPaintView& GetPaintView() const { return mrPaintView; } GetOutputDevice() const102 OutputDevice& GetOutputDevice() const { return mrOutputDevice; } 103 104 // OVERLAYMANAGER 105 ::sdr::overlay::OverlayManager* GetOverlayManager() const; 106 // #i73602# add flag if buffer shall be used 107 void DrawOverlay(const Region& rRegion); 108 void HideOverlay(const Region& rRegion); 109 110 // calculate visible area and return 111 Rectangle GetVisibleArea() const; 112 113 // Is OutDev a printer? OutputToPrinter() const114 sal_Bool OutputToPrinter() const { return (OUTDEV_PRINTER == mrOutputDevice.GetOutDevType()); } 115 116 // Is OutDev a window? OutputToWindow() const117 sal_Bool OutputToWindow() const { return (OUTDEV_WINDOW == mrOutputDevice.GetOutDevType()); } 118 119 // Is OutDev a VirtualDevice? OutputToVirtualDevice() const120 sal_Bool OutputToVirtualDevice() const { return (OUTDEV_VIRDEV == mrOutputDevice.GetOutDevType()); } 121 122 // Is OutDev a recording MetaFile? 123 sal_Bool OutputToRecordingMetaFile() const; 124 125 // prepare PreRendering (evtl.) 126 void PreparePreRenderDevice(); 127 void DestroyPreRenderDevice(); 128 void OutputPreRenderDevice(const Region& rExpandedRegion); GetPreRenderDevice() const129 SdrPreRenderDevice* GetPreRenderDevice() const { return mpPreRenderDevice; } 130 131 // RedrawRegion 132 const Region& GetRedrawRegion() const; 133 void SetRedrawRegion(const Region& rNew); 134 135 // #i72889# read/write access to TemporaryTarget getTemporaryTarget() const136 bool getTemporaryTarget() const { return (bool)mbTemporaryTarget; } setTemporaryTarget(bool bNew)137 void setTemporaryTarget(bool bNew) { if(bNew != (bool)mbTemporaryTarget) mbTemporaryTarget = bNew; } 138 139 // #i72889# get target output device, take into account output buffering GetTargetOutputDevice()140 OutputDevice& GetTargetOutputDevice() { if(mpPreRenderDevice) return mpPreRenderDevice->GetPreRenderDevice(); else return mrOutputDevice; } 141 }; 142 143 // typedefs for a list of SdrPaintWindows 144 typedef ::std::vector< SdrPaintWindow* > SdrPaintWindowVector; 145 146 //////////////////////////////////////////////////////////////////////////////////////////////////// 147 148 #endif //_SDRPAINTWINDOW_HXX 149 150 /* vim: set noet sw=4 ts=4: */ 151