LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/source/core/text - txtpaint.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 11 11 100.0 %
Date: 2013-07-09 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 _TXTPAINT_HXX
      20             : #define _TXTPAINT_HXX
      21             : #include <vcl/outdev.hxx>
      22             : 
      23             : class SwRect;               // SwSaveClip
      24             : #include <txtfrm.hxx>
      25             : 
      26             : /*************************************************************************
      27             :  *                      class SwSaveClip
      28             :  *************************************************************************/
      29             : 
      30             : class SwSaveClip
      31             : {
      32             :     Region   aClip;
      33             :     const bool     bOn;
      34             :           bool     bChg;
      35             : protected:
      36             :     OutputDevice* pOut;
      37             :     void _ChgClip( const SwRect &rRect, const SwTxtFrm* pFrm,
      38             :                    sal_Bool bEnlargeRect );
      39             : public:
      40             :     inline SwSaveClip( OutputDevice* pOut );
      41             :     inline ~SwSaveClip();
      42        4317 :     inline void ChgClip( const SwRect &rRect, const SwTxtFrm* pFrm = 0,
      43             :                          sal_Bool bEnlargeRect = sal_False)
      44        4317 :              { if( pOut ) _ChgClip( rRect, pFrm, bEnlargeRect ); }
      45             :            void Reset();
      46         138 :     inline bool IsOn()  const { return bOn; }
      47       12674 :     inline bool IsChg() const { return bChg; }
      48             :     inline OutputDevice *GetOut() { return pOut; }
      49             : };
      50             : 
      51        6695 : inline SwSaveClip::SwSaveClip( OutputDevice* pOutDev ) :
      52        6695 :     bOn( pOutDev && pOutDev->IsClipRegion() ),
      53             :     bChg( false ),
      54       13390 :     pOut(pOutDev)
      55        6695 : {}
      56             : 
      57       13390 : inline SwSaveClip::~SwSaveClip()
      58             : {
      59        6695 :     Reset();
      60        6695 : }
      61             : 
      62             : #ifdef DBG_UTIL
      63             : 
      64             : /*************************************************************************
      65             :  *                          class SwDbgOut
      66             :  *************************************************************************/
      67             : 
      68             : class SwDbgOut
      69             : {
      70             : protected:
      71             :         OutputDevice* pOut;
      72             : public:
      73             :         inline SwDbgOut( OutputDevice* pOutDev, const sal_Bool bOn = sal_True );
      74             : };
      75             : 
      76             : /*************************************************************************
      77             :  *                          class DbgBrush
      78             :  *************************************************************************/
      79             : 
      80             : class DbgBackColor : public SwDbgOut
      81             : {
      82             :         Color   aOldFillColor;
      83             : public:
      84             :         DbgBackColor( OutputDevice* pOut, const sal_Bool bOn = sal_True,
      85             :                   ColorData nColor = COL_YELLOW );
      86             :        ~DbgBackColor();
      87             : };
      88             : 
      89             : /*************************************************************************
      90             :  *                          class DbgRect
      91             :  *************************************************************************/
      92             : 
      93             : class DbgRect : public SwDbgOut
      94             : {
      95             : public:
      96             :         DbgRect( OutputDevice* pOut, const Rectangle &rRect,
      97             :                  const sal_Bool bOn = sal_True,
      98             :                  ColorData eColor = COL_LIGHTBLUE );
      99             : };
     100             : 
     101             : /*************************************************************************
     102             :  *                      Inline-Implementierung
     103             :  *************************************************************************/
     104             : 
     105             : inline SwDbgOut::SwDbgOut( OutputDevice* pOutDev, const sal_Bool bOn )
     106             :                :pOut( bOn ? pOutDev : 0 )
     107             : { }
     108             : 
     109             : 
     110             : inline DbgBackColor::DbgBackColor( OutputDevice* pOutDev, const sal_Bool bOn,
     111             :                            ColorData eColor )
     112             :     :SwDbgOut( pOutDev, bOn )
     113             : {
     114             :     if( pOut )
     115             :     {
     116             :         aOldFillColor = pOut->GetFillColor();
     117             :         pOut->SetFillColor( Color(eColor) );
     118             :     }
     119             : }
     120             : 
     121             : inline DbgBackColor::~DbgBackColor()
     122             : {
     123             :     if( pOut )
     124             :     {
     125             :         pOut->SetFillColor( aOldFillColor );
     126             :     }
     127             : }
     128             : 
     129             : inline DbgRect::DbgRect( OutputDevice* pOutDev, const Rectangle &rRect,
     130             :                          const sal_Bool bOn,
     131             :                          ColorData eColor )
     132             :     : SwDbgOut( pOutDev, bOn )
     133             : {
     134             :     if( pOut )
     135             :     {
     136             :         const Color aColor( eColor );
     137             :         Color aLineColor = pOut->GetLineColor();
     138             :         pOut->SetLineColor( aColor );
     139             :         Color aFillColor = pOut->GetFillColor();
     140             :         pOut->SetFillColor( Color(COL_TRANSPARENT) );
     141             :         pOut->DrawRect( rRect );
     142             :         pOut->SetLineColor( aLineColor );
     143             :         pOut->SetFillColor( aFillColor );
     144             :     }
     145             : }
     146             : 
     147             : #endif
     148             : 
     149             : 
     150             : 
     151             : #endif
     152             : 
     153             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10