LCOV - code coverage report
Current view: top level - sw/source/core/text - txtpaint.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 11 11 100.0 %
Date: 2012-08-25 Functions: 5 5 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 6 8 75.0 %

           Branch data     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 sal_Bool     bOn;
      34                 :            :           sal_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                 :       9175 :     inline void ChgClip( const SwRect &rRect, const SwTxtFrm* pFrm = 0,
      43                 :            :                          sal_Bool bEnlargeRect = sal_False)
      44         [ +  - ]:       9175 :              { if( pOut ) _ChgClip( rRect, pFrm, bEnlargeRect ); }
      45                 :            :            void Reset();
      46                 :        206 :     inline sal_Bool IsOn()  const { return bOn; }
      47                 :      29877 :     inline sal_Bool IsChg() const { return bChg; }
      48                 :            :     inline sal_Bool IsOut() const { return 0 != pOut; }
      49                 :            :     inline OutputDevice *GetOut() { return pOut; }
      50                 :            : };
      51                 :            : 
      52                 :      14019 : inline SwSaveClip::SwSaveClip( OutputDevice* pOutDev ) :
      53                 :      13922 :     bOn( pOutDev && pOutDev->IsClipRegion() ),
      54                 :            :     bChg( sal_False ),
      55   [ +  +  +  + ]:      27941 :     pOut(pOutDev)
      56                 :      14019 : {}
      57                 :            : 
      58                 :      14019 : inline SwSaveClip::~SwSaveClip()
      59                 :            : {
      60         [ +  - ]:      14019 :     Reset();
      61                 :      14019 : }
      62                 :            : 
      63                 :            : #ifdef DBG_UTIL
      64                 :            : 
      65                 :            : /*************************************************************************
      66                 :            :  *                          class SwDbgOut
      67                 :            :  *************************************************************************/
      68                 :            : 
      69                 :            : class SwDbgOut
      70                 :            : {
      71                 :            : protected:
      72                 :            :         OutputDevice* pOut;
      73                 :            : public:
      74                 :            :         inline SwDbgOut( OutputDevice* pOutDev, const sal_Bool bOn = sal_True );
      75                 :            : };
      76                 :            : 
      77                 :            : /*************************************************************************
      78                 :            :  *                          class DbgBrush
      79                 :            :  *************************************************************************/
      80                 :            : 
      81                 :            : class DbgBackColor : public SwDbgOut
      82                 :            : {
      83                 :            :         Color   aOldFillColor;
      84                 :            : public:
      85                 :            :         DbgBackColor( OutputDevice* pOut, const sal_Bool bOn = sal_True,
      86                 :            :                   ColorData nColor = COL_YELLOW );
      87                 :            :        ~DbgBackColor();
      88                 :            : };
      89                 :            : 
      90                 :            : /*************************************************************************
      91                 :            :  *                          class DbgRect
      92                 :            :  *************************************************************************/
      93                 :            : 
      94                 :            : class DbgRect : public SwDbgOut
      95                 :            : {
      96                 :            : public:
      97                 :            :         DbgRect( OutputDevice* pOut, const Rectangle &rRect,
      98                 :            :                  const sal_Bool bOn = sal_True,
      99                 :            :                  ColorData eColor = COL_LIGHTBLUE );
     100                 :            : };
     101                 :            : 
     102                 :            : /*************************************************************************
     103                 :            :  *                      Inline-Implementierung
     104                 :            :  *************************************************************************/
     105                 :            : 
     106                 :            : inline SwDbgOut::SwDbgOut( OutputDevice* pOutDev, const sal_Bool bOn )
     107                 :            :                :pOut( bOn ? pOutDev : 0 )
     108                 :            : { }
     109                 :            : 
     110                 :            : 
     111                 :            : inline DbgBackColor::DbgBackColor( OutputDevice* pOutDev, const sal_Bool bOn,
     112                 :            :                            ColorData eColor )
     113                 :            :     :SwDbgOut( pOutDev, bOn )
     114                 :            : {
     115                 :            :     if( pOut )
     116                 :            :     {
     117                 :            :         aOldFillColor = pOut->GetFillColor();
     118                 :            :         pOut->SetFillColor( Color(eColor) );
     119                 :            :     }
     120                 :            : }
     121                 :            : 
     122                 :            : inline DbgBackColor::~DbgBackColor()
     123                 :            : {
     124                 :            :     if( pOut )
     125                 :            :     {
     126                 :            :         pOut->SetFillColor( aOldFillColor );
     127                 :            :     }
     128                 :            : }
     129                 :            : 
     130                 :            : inline DbgRect::DbgRect( OutputDevice* pOutDev, const Rectangle &rRect,
     131                 :            :                          const sal_Bool bOn,
     132                 :            :                          ColorData eColor )
     133                 :            :     : SwDbgOut( pOutDev, bOn )
     134                 :            : {
     135                 :            :     if( pOut )
     136                 :            :     {
     137                 :            :         const Color aColor( eColor );
     138                 :            :         Color aLineColor = pOut->GetLineColor();
     139                 :            :         pOut->SetLineColor( aColor );
     140                 :            :         Color aFillColor = pOut->GetFillColor();
     141                 :            :         pOut->SetFillColor( Color(COL_TRANSPARENT) );
     142                 :            :         pOut->DrawRect( rRect );
     143                 :            :         pOut->SetLineColor( aLineColor );
     144                 :            :         pOut->SetFillColor( aFillColor );
     145                 :            :     }
     146                 :            : }
     147                 :            : 
     148                 :            : #endif
     149                 :            : 
     150                 :            : 
     151                 :            : 
     152                 :            : #endif
     153                 :            : 
     154                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10