LCOV - code coverage report
Current view: top level - sw/source/core/text - txtpaint.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 11 11 100.0 %
Date: 2015-06-13 12:38:46 Functions: 5 5 100.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             : #ifndef INCLUDED_SW_SOURCE_CORE_TEXT_TXTPAINT_HXX
      20             : #define INCLUDED_SW_SOURCE_CORE_TEXT_TXTPAINT_HXX
      21             : #include <vcl/outdev.hxx>
      22             : 
      23             : class SwRect;               // SwSaveClip
      24             : #include <txtfrm.hxx>
      25             : 
      26             : class SwSaveClip
      27             : {
      28             :     vcl::Region   aClip;
      29             :     const bool     bOn;
      30             :           bool     bChg;
      31             : protected:
      32             :     VclPtr<OutputDevice> pOut;
      33             :     void _ChgClip( const SwRect &rRect, const SwTextFrm* pFrm,
      34             :                    bool bEnlargeRect );
      35             : public:
      36       14309 :     explicit SwSaveClip(OutputDevice* pOutDev)
      37       14309 :         : bOn(pOutDev && pOutDev->IsClipRegion())
      38             :         , bChg(false)
      39       28618 :         , pOut(pOutDev)
      40             :     {
      41       14309 :     }
      42             : 
      43             :     inline ~SwSaveClip();
      44        7728 :     inline void ChgClip( const SwRect &rRect, const SwTextFrm* pFrm = 0,
      45             :                          bool bEnlargeRect = false)
      46        7728 :              { if( pOut ) _ChgClip( rRect, pFrm, bEnlargeRect ); }
      47             :            void Reset();
      48         280 :     inline bool IsOn()  const { return bOn; }
      49       22211 :     inline bool IsChg() const { return bChg; }
      50             :     inline OutputDevice *GetOut() { return pOut; }
      51             : };
      52             : 
      53       28618 : inline SwSaveClip::~SwSaveClip()
      54             : {
      55       14309 :     Reset();
      56       14309 : }
      57             : 
      58             : #ifdef DBG_UTIL
      59             : 
      60             : class SwDbgOut
      61             : {
      62             : protected:
      63             :         VclPtr<OutputDevice> pOut;
      64             : public:
      65             :         inline SwDbgOut( OutputDevice* pOutDev, const bool bOn = true );
      66             : };
      67             : 
      68             : class DbgBackColor : public SwDbgOut
      69             : {
      70             :         Color   aOldFillColor;
      71             : public:
      72             :         DbgBackColor( OutputDevice* pOut, const bool bOn = true,
      73             :                   ColorData nColor = COL_YELLOW );
      74             :        ~DbgBackColor();
      75             : };
      76             : 
      77             : class DbgRect : public SwDbgOut
      78             : {
      79             : public:
      80             :         DbgRect( OutputDevice* pOut, const Rectangle &rRect,
      81             :                  const bool bOn = true,
      82             :                  ColorData eColor = COL_LIGHTBLUE );
      83             : };
      84             : 
      85             : inline SwDbgOut::SwDbgOut( OutputDevice* pOutDev, const bool bOn )
      86             :                :pOut( bOn ? pOutDev : 0 )
      87             : { }
      88             : 
      89             : inline DbgBackColor::DbgBackColor( OutputDevice* pOutDev, const bool bOn,
      90             :                            ColorData eColor )
      91             :     :SwDbgOut( pOutDev, bOn )
      92             : {
      93             :     if( pOut )
      94             :     {
      95             :         aOldFillColor = pOut->GetFillColor();
      96             :         pOut->SetFillColor( Color(eColor) );
      97             :     }
      98             : }
      99             : 
     100             : inline DbgBackColor::~DbgBackColor()
     101             : {
     102             :     if( pOut )
     103             :     {
     104             :         pOut->SetFillColor( aOldFillColor );
     105             :     }
     106             : }
     107             : 
     108             : inline DbgRect::DbgRect( OutputDevice* pOutDev, const Rectangle &rRect,
     109             :                          const bool bOn,
     110             :                          ColorData eColor )
     111             :     : SwDbgOut( pOutDev, bOn )
     112             : {
     113             :     if( pOut )
     114             :     {
     115             :         const Color aColor( eColor );
     116             :         Color aLineColor = pOut->GetLineColor();
     117             :         pOut->SetLineColor( aColor );
     118             :         Color aFillColor = pOut->GetFillColor();
     119             :         pOut->SetFillColor( Color(COL_TRANSPARENT) );
     120             :         pOut->DrawRect( rRect );
     121             :         pOut->SetLineColor( aLineColor );
     122             :         pOut->SetFillColor( aFillColor );
     123             :     }
     124             : }
     125             : 
     126             : #endif
     127             : 
     128             : #endif
     129             : 
     130             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11