LCOV - code coverage report
Current view: top level - libreoffice/svx/inc/svx - sdrpaintwindow.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 9 10 90.0 %
Date: 2012-12-17 Functions: 9 10 90.0 %
Legend: Lines: hit not hit

          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 _SDRPAINTWINDOW_HXX
      21             : #define _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             : class SdrPreRenderDevice
      45             : {
      46             :     // The original OutputDevice
      47             :     OutputDevice&                                       mrOutputDevice;
      48             : 
      49             :     // The VirtualDevice for PreRendering
      50             :     VirtualDevice                                       maPreRenderDevice;
      51             : 
      52             : public:
      53             :     explicit SdrPreRenderDevice(OutputDevice& rOriginal);
      54             :     ~SdrPreRenderDevice();
      55             : 
      56             :     void PreparePreRenderDevice();
      57             :     void OutputPreRenderDevice(const Region& rExpandedRegion);
      58             : 
      59             :     OutputDevice& GetOriginalOutputDevice() const { return mrOutputDevice; }
      60        1378 :     OutputDevice& GetPreRenderDevice() { return maPreRenderDevice; }
      61             : };
      62             : 
      63             : ////////////////////////////////////////////////////////////////////////////////////////////////////
      64             : 
      65             : class SVX_DLLPUBLIC SdrPaintWindow
      66             : {
      67             : private:
      68             :     // the OutputDevice this window represents
      69             :     OutputDevice&                                       mrOutputDevice;
      70             : 
      71             :     // the SdrPaintView this window belongs to
      72             :     SdrPaintView&                                       mrPaintView;
      73             : 
      74             :     // the new OverlayManager for the new OverlayObjects. Test add here, will
      75             :     // replace the IAOManager as soon as it works.
      76             :     rtl::Reference< ::sdr::overlay::OverlayManager >    mxOverlayManager;
      77             : 
      78             :     // The PreRenderDevice for PreRendering
      79             :     SdrPreRenderDevice*                                 mpPreRenderDevice;
      80             : 
      81             :     // The RedrawRegion used for rendering
      82             :     Region                                              maRedrawRegion;
      83             : 
      84             :     // bitfield
      85             :     // #i72889# flag if this is only a temporary target for repaint, default is false
      86             :     unsigned                                            mbTemporaryTarget : 1;
      87             : 
      88             :     /** Remember whether the mxOverlayManager supports buffering.  Using
      89             :         this flags expensive dynamic_casts on mxOverlayManager in order to
      90             :         detect this.
      91             :     */
      92             :     bool mbUseBuffer;
      93             : 
      94             :     // helpers
      95             :     /** Create mxOverlayManager member on demand.
      96             :         @param bUseBuffer
      97             :             Specifies whether to use the buffered (OverlayManagerBuffered)
      98             :             or the unbuffered (OverlayManager) version of the overlay
      99             :             manager.  When this values is different from that of the
     100             :             previous call then the overlay manager is replaced by the
     101             :             specified one.
     102             : 
     103             :             The bUseBuffer flag will typically change its value when text
     104             :             editing is started or stopped.
     105             :     */
     106             :     void impCreateOverlayManager(const bool bUseBuffer);
     107             : 
     108             : public:
     109             :     SdrPaintWindow(SdrPaintView& rNewPaintView, OutputDevice& rOut);
     110             :     ~SdrPaintWindow();
     111             : 
     112             :     // data read accesses
     113        1424 :     SdrPaintView& GetPaintView() const { return mrPaintView; }
     114       24504 :     OutputDevice& GetOutputDevice() const { return mrOutputDevice; }
     115             : 
     116             :     // OVERLAYMANAGER
     117             :     rtl::Reference< ::sdr::overlay::OverlayManager > GetOverlayManager() const;
     118             : 
     119             :     // #i73602# add flag if buffer shall be used
     120             :     void DrawOverlay(const Region& rRegion, bool bUseBuffer);
     121             : 
     122             :     // calculate visible area and return
     123             :     Rectangle GetVisibleArea() const;
     124             : 
     125             :     // Is OutDev a printer?
     126        3501 :     sal_Bool OutputToPrinter() const { return (OUTDEV_PRINTER == mrOutputDevice.GetOutDevType()); }
     127             : 
     128             :     // Is OutDev a window?
     129        4873 :     sal_Bool OutputToWindow() const { return (OUTDEV_WINDOW == mrOutputDevice.GetOutDevType()); }
     130             : 
     131             :     // Is OutDev a VirtualDevice?
     132         693 :     sal_Bool OutputToVirtualDevice() const { return (OUTDEV_VIRDEV == mrOutputDevice.GetOutDevType()); }
     133             : 
     134             :     // Is OutDev a recording MetaFile?
     135             :     sal_Bool OutputToRecordingMetaFile() const;
     136             : 
     137             :     // prepare PreRendering (evtl.)
     138             :     void PreparePreRenderDevice();
     139             :     void DestroyPreRenderDevice();
     140             :     void OutputPreRenderDevice(const Region& rExpandedRegion);
     141        2129 :     SdrPreRenderDevice* GetPreRenderDevice() const { return mpPreRenderDevice; }
     142             : 
     143             :     // RedrawRegion
     144             :     const Region& GetRedrawRegion() const;
     145             :     void SetRedrawRegion(const Region& rNew);
     146             : 
     147             :     // #i72889# read/write access to TempoparyTarget
     148         695 :     bool getTemporaryTarget() const { return (bool)mbTemporaryTarget; }
     149           0 :     void setTemporaryTarget(bool bNew) { if(bNew != (bool)mbTemporaryTarget) mbTemporaryTarget = bNew; }
     150             : 
     151             :     // #i72889# get target output device, take into account output buffering
     152        2814 :     OutputDevice& GetTargetOutputDevice() { if(mpPreRenderDevice) return mpPreRenderDevice->GetPreRenderDevice(); else return mrOutputDevice; }
     153             : };
     154             : 
     155             : // typedefs for a list of SdrPaintWindows
     156             : typedef ::std::vector< SdrPaintWindow* > SdrPaintWindowVector;
     157             : 
     158             : ////////////////////////////////////////////////////////////////////////////////////////////////////
     159             : 
     160             : #endif //_SDRPAINTWINDOW_HXX
     161             : 
     162             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10