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

Generated by: LCOV version 1.11