LCOV - code coverage report
Current view: top level - sw/source/core/text - txtpaint.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 39 0.0 %
Date: 2014-04-14 Functions: 0 2 0.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             : #include "txtpaint.hxx"
      21             : #include "swrect.hxx"
      22             : #include "rootfrm.hxx"
      23             : 
      24             : /*************************************************************************
      25             :  *                      SwSaveClip::Reset()
      26             :  *************************************************************************/
      27             : 
      28           0 : void SwSaveClip::Reset()
      29             : {
      30             :     // We recover the old state
      31           0 :     if( pOut && bChg )
      32             :     {
      33           0 :         if ( pOut->GetConnectMetaFile() )
      34           0 :             pOut->Pop();
      35             :         else
      36             :         {
      37           0 :             if( bOn )
      38           0 :                 pOut->SetClipRegion( aClip );
      39             :             else
      40           0 :                 pOut->SetClipRegion();
      41             :         }
      42           0 :         bChg = false;
      43             :     }
      44           0 : }
      45             : 
      46             : /*************************************************************************
      47             :  *                      SwSaveClip::_ChgClip()
      48             :  *************************************************************************/
      49             : 
      50           0 : void SwSaveClip::_ChgClip( const SwRect &rRect, const SwTxtFrm* pFrm,
      51             :                            bool bEnlargeRect )
      52             : {
      53           0 :     SwRect aOldRect( rRect );
      54           0 :     const bool bVertical = pFrm && pFrm->IsVertical();
      55             : 
      56           0 :     if ( pFrm && pFrm->IsRightToLeft() )
      57           0 :         pFrm->SwitchLTRtoRTL( (SwRect&)rRect );
      58             : 
      59           0 :     if ( bVertical )
      60           0 :         pFrm->SwitchHorizontalToVertical( (SwRect&)rRect );
      61             : 
      62           0 :     if ( !pOut || (!rRect.HasArea() && !pOut->IsClipRegion()) )
      63             :     {
      64           0 :         (SwRect&)rRect = aOldRect;
      65           0 :         return;
      66             :     }
      67             : 
      68           0 :     if ( !bChg )
      69             :     {
      70           0 :         if ( pOut->GetConnectMetaFile() )
      71           0 :             pOut->Push();
      72           0 :         else if ( bOn )
      73           0 :             aClip = pOut->GetClipRegion();
      74             :     }
      75             : 
      76           0 :     if ( !rRect.HasArea() )
      77           0 :         pOut->SetClipRegion();
      78             :     else
      79             :     {
      80           0 :         Rectangle aRect( rRect.SVRect() );
      81             : 
      82             :         // Having underscores in our line, we enlarged the repaint area
      83             :         // (see frmform.cxx) because for some fonts it could be too small.
      84             :         // Consequently, we have to enlarge the clipping rectangle as well.
      85           0 :         if ( bEnlargeRect && ! bVertical )
      86           0 :             aRect.Bottom() += 40;
      87             : 
      88             :         // If the ClipRect is identical, nothing will happen
      89           0 :         if( pOut->IsClipRegion() ) // no && because of Mac
      90             :         {
      91           0 :             if ( aRect == pOut->GetClipRegion().GetBoundRect() )
      92             :             {
      93           0 :                 (SwRect&)rRect = aOldRect;
      94           0 :                 return;
      95             :             }
      96             :         }
      97             : 
      98           0 :         if( SwRootFrm::HasSameRect( rRect ) )
      99           0 :             pOut->SetClipRegion();
     100             :         else
     101             :         {
     102           0 :             const Region aClipRegion( aRect );
     103           0 :             pOut->SetClipRegion( aClipRegion );
     104             :         }
     105             : #ifdef DBG_UTIL
     106             :         static bool bDbg = false;
     107             :         if( bDbg )
     108             :         {
     109             :             DbgBackColor aDbg( pOut, bDbg, COL_RED );
     110             :             pOut->DrawRect( aRect );
     111             :         }
     112             : #endif
     113             :     }
     114           0 :     bChg = true;
     115             : 
     116           0 :     (SwRect&)rRect = aOldRect;
     117             : }
     118             : 
     119             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10