LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/source/core/text - portox.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 26 30 86.7 %
Date: 2013-07-09 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"  // SwViewOptions
      22             : 
      23             : #include "portox.hxx"
      24             : #include "inftxt.hxx"       // GetTxtSize()
      25             : 
      26             : /*************************************************************************
      27             :  *               virtual SwToxPortion::Paint()
      28             :  *************************************************************************/
      29             : 
      30          24 : void SwToxPortion::Paint( const SwTxtPaintInfo &rInf ) const
      31             : {
      32          24 :     if( Width() )
      33             :     {
      34          24 :         rInf.DrawViewOpt( *this, POR_TOX );
      35          24 :         SwTxtPortion::Paint( rInf );
      36             :     }
      37          24 : }
      38             : 
      39             : /*************************************************************************
      40             :  *                      class SwIsoToxPortion
      41             :  *************************************************************************/
      42             : 
      43          56 : SwLinePortion *SwIsoToxPortion::Compress() { return this; }
      44             : 
      45          56 : SwIsoToxPortion::SwIsoToxPortion() : nViewWidth(0)
      46             : {
      47          56 :     SetLen(1);
      48          56 :     SetWhichPor( POR_ISOTOX );
      49          56 : }
      50             : 
      51             : /*************************************************************************
      52             :  *               virtual SwIsoToxPortion::GetViewWidth()
      53             :  *************************************************************************/
      54             : 
      55          83 : KSHORT SwIsoToxPortion::GetViewWidth( const SwTxtSizeInfo &rInf ) const
      56             : {
      57             :     // Although we are const, nViewWidth should be calculated in the last
      58             :     // moment possible
      59          83 :     SwIsoToxPortion* pThis = (SwIsoToxPortion*)this;
      60             :     // nViewWidth need to be calculated
      61         332 :     if( !Width() && rInf.OnWin() &&
      62         166 :         !rInf.GetOpt().IsPagePreview() &&
      63         249 :             !rInf.GetOpt().IsReadonly() && SwViewOption::IsFieldShadings()   )
      64             :     {
      65          83 :         if( !nViewWidth )
      66          55 :             pThis->nViewWidth = rInf.GetTxtSize(OUString(' ')).Width();
      67             :     }
      68             :     else
      69           0 :         pThis->nViewWidth = 0;
      70          83 :     return nViewWidth;
      71             : }
      72             : 
      73             : /*************************************************************************
      74             :  *                 virtual SwIsoToxPortion::Format()
      75             :  *************************************************************************/
      76             : 
      77          56 : sal_Bool SwIsoToxPortion::Format( SwTxtFormatInfo &rInf )
      78             : {
      79          56 :     const sal_Bool bFull = SwLinePortion::Format( rInf );
      80          56 :     return bFull;
      81             : }
      82             : 
      83             : /*************************************************************************
      84             :  *               virtual SwIsoToxPortion::Paint()
      85             :  *************************************************************************/
      86             : 
      87         138 : void SwIsoToxPortion::Paint( const SwTxtPaintInfo &rInf ) const
      88             : {
      89         138 :     if( Width() )
      90          83 :         rInf.DrawViewOpt( *this, POR_TOX );
      91         138 : }
      92             : 
      93             : /*************************************************************************
      94             :  *              virtual SwIsoToxPortion::HandlePortion()
      95             :  *************************************************************************/
      96             : 
      97           0 : void SwIsoToxPortion::HandlePortion( SwPortionHandler& rPH ) const
      98             : {
      99           0 :     String aString;
     100           0 :     rPH.Special( GetLen(), aString, GetWhichPor() );
     101          99 : }
     102             : 
     103             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10