LCOV - code coverage report
Current view: top level - sw/source/core/text - porref.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 24 27 88.9 %
Date: 2015-06-13 12:38:46 Functions: 8 9 88.9 %
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 <SwPortionHandler.hxx>
      21             : #include "viewopt.hxx"
      22             : 
      23             : #include "porref.hxx"
      24             : #include "inftxt.hxx"
      25             : 
      26          18 : void SwRefPortion::Paint( const SwTextPaintInfo &rInf ) const
      27             : {
      28          18 :     if( Width() )
      29             :     {
      30          18 :         rInf.DrawViewOpt( *this, POR_REF );
      31          18 :         SwTextPortion::Paint( rInf );
      32             :     }
      33          18 : }
      34             : 
      35          58 : SwLinePortion *SwIsoRefPortion::Compress() { return this; }
      36             : 
      37          58 : SwIsoRefPortion::SwIsoRefPortion() : nViewWidth(0)
      38             : {
      39          58 :     SetLen(1);
      40          58 :     SetWhichPor( POR_ISOREF );
      41          58 : }
      42             : 
      43          89 : sal_uInt16 SwIsoRefPortion::GetViewWidth( const SwTextSizeInfo &rInf ) const
      44             : {
      45             :     // Although we are const, nViewWidth should be calculated in the last
      46             :     // moment possible
      47          89 :     SwIsoRefPortion* pThis = const_cast<SwIsoRefPortion*>(this);
      48         356 :     if( !Width() && rInf.OnWin() && SwViewOption::IsFieldShadings() &&
      49         267 :             !rInf.GetOpt().IsReadonly() && !rInf.GetOpt().IsPagePreview() )
      50             :     {
      51          89 :         if( !nViewWidth )
      52          58 :             pThis->nViewWidth = rInf.GetTextSize(OUString(' ')).Width();
      53             :     }
      54             :     else
      55           0 :         pThis->nViewWidth = 0;
      56          89 :     return nViewWidth;
      57             : }
      58             : 
      59          58 : bool SwIsoRefPortion::Format( SwTextFormatInfo &rInf )
      60             : {
      61          58 :     return SwLinePortion::Format( rInf );
      62             : }
      63             : 
      64         148 : void SwIsoRefPortion::Paint( const SwTextPaintInfo &rInf ) const
      65             : {
      66         148 :     if( Width() )
      67          89 :         rInf.DrawViewOpt( *this, POR_REF );
      68         148 : }
      69             : 
      70           0 : void SwIsoRefPortion::HandlePortion( SwPortionHandler& rPH ) const
      71             : {
      72           0 :     rPH.Special( GetLen(), OUString(), GetWhichPor() );
      73         177 : }
      74             : 
      75             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11