LCOV - code coverage report
Current view: top level - sw/source/core/text - txtpaint.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 11 11 100.0 %
Date: 2014-11-03 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             :     OutputDevice* pOut;
      33             :     void _ChgClip( const SwRect &rRect, const SwTxtFrm* pFrm,
      34             :                    bool bEnlargeRect );
      35             : public:
      36             :     inline SwSaveClip( OutputDevice* pOut );
      37             :     inline ~SwSaveClip();
      38       12981 :     inline void ChgClip( const SwRect &rRect, const SwTxtFrm* pFrm = 0,
      39             :                          bool bEnlargeRect = false)
      40       12981 :              { if( pOut ) _ChgClip( rRect, pFrm, bEnlargeRect ); }
      41             :            void Reset();
      42         459 :     inline bool IsOn()  const { return bOn; }
      43       46091 :     inline bool IsChg() const { return bChg; }
      44             :     inline OutputDevice *GetOut() { return pOut; }
      45             : };
      46             : 
      47       22635 : inline SwSaveClip::SwSaveClip( OutputDevice* pOutDev ) :
      48       22635 :     bOn( pOutDev && pOutDev->IsClipRegion() ),
      49             :     bChg( false ),
      50       45270 :     pOut(pOutDev)
      51       22635 : {}
      52             : 
      53       45270 : inline SwSaveClip::~SwSaveClip()
      54             : {
      55       22635 :     Reset();
      56       22635 : }
      57             : 
      58             : #ifdef DBG_UTIL
      59             : 
      60             : class SwDbgOut
      61             : {
      62             : protected:
      63             :         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.10