LCOV - code coverage report
Current view: top level - sw/source/core/text - portab.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 26 30 86.7 %
Date: 2014-11-03 Functions: 19 23 82.6 %
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             : #ifndef INCLUDED_SW_SOURCE_CORE_TEXT_PORTAB_HXX
      20             : #define INCLUDED_SW_SOURCE_CORE_TEXT_PORTAB_HXX
      21             : 
      22             : #include "porglue.hxx"
      23             : 
      24       28646 : class SwTabPortion : public SwFixPortion
      25             : {
      26             :     const sal_uInt16 nTabPos;
      27             :     const sal_Unicode cFill;
      28             :     const bool bAutoTabStop;
      29             : 
      30             :     // Format() branches either into PreFormat() or PostFormat()
      31             :     bool PreFormat( SwTxtFormatInfo &rInf );
      32             : public:
      33             :     SwTabPortion( const sal_uInt16 nTabPos, const sal_Unicode cFill = '\0', const bool bAutoTab = true );
      34             :     virtual void Paint( const SwTxtPaintInfo &rInf ) const SAL_OVERRIDE;
      35             :     virtual bool Format( SwTxtFormatInfo &rInf ) SAL_OVERRIDE;
      36             :     virtual void FormatEOL( SwTxtFormatInfo &rInf ) SAL_OVERRIDE;
      37             :     bool PostFormat( SwTxtFormatInfo &rInf );
      38         848 :     inline  bool IsFilled() const { return 0 != cFill; }
      39       30226 :     inline  sal_uInt16 GetTabPos() const { return nTabPos; }
      40          80 :     inline  bool IsAutoTabStop() const { return bAutoTabStop; }
      41             : 
      42             :     // Accessibility: pass information about this portion to the PortionHandler
      43             :     virtual void HandlePortion( SwPortionHandler& rPH ) const SAL_OVERRIDE;
      44             : 
      45             :     OUTPUT_OPERATOR_OVERRIDE
      46             : };
      47             : 
      48       47080 : class SwTabLeftPortion : public SwTabPortion
      49             : {
      50             : public:
      51       23540 :     inline SwTabLeftPortion( const sal_uInt16 nTabPosVal, const sal_Unicode cFillChar='\0', bool bAutoTab = true )
      52       23540 :          : SwTabPortion( nTabPosVal, cFillChar, bAutoTab )
      53       23540 :     { SetWhichPor( POR_TABLEFT ); }
      54             :     OUTPUT_OPERATOR_OVERRIDE
      55             : };
      56             : 
      57        4956 : class SwTabRightPortion : public SwTabPortion
      58             : {
      59             : public:
      60        2478 :     inline SwTabRightPortion( const sal_uInt16 nTabPosVal, const sal_Unicode cFillChar='\0' )
      61        2478 :          : SwTabPortion( nTabPosVal, cFillChar )
      62        2478 :     { SetWhichPor( POR_TABRIGHT ); }
      63             :     OUTPUT_OPERATOR_OVERRIDE
      64             : };
      65             : 
      66        5220 : class SwTabCenterPortion : public SwTabPortion
      67             : {
      68             : public:
      69        2610 :     inline SwTabCenterPortion( const sal_uInt16 nTabPosVal, const sal_Unicode cFillChar='\0' )
      70        2610 :          : SwTabPortion( nTabPosVal, cFillChar )
      71        2610 :     { SetWhichPor( POR_TABCENTER ); }
      72             :     OUTPUT_OPERATOR_OVERRIDE
      73             : };
      74             : 
      75          36 : class SwTabDecimalPortion : public SwTabPortion
      76             : {
      77             :     const sal_Unicode mcTab;
      78             : 
      79             :     /*
      80             :      * During text formatting, we already store the width of the portions
      81             :      * following the tab stop up to the decimal position. This value is
      82             :      * evaluated during pLastTab->FormatEOL. FME 2006-01-06 #127428#.
      83             :      */
      84             :     sal_uInt16 mnWidthOfPortionsUpTpDecimalPosition;
      85             : 
      86             : public:
      87          18 :     inline SwTabDecimalPortion( const sal_uInt16 nTabPosVal, const sal_Unicode cTab,
      88             :                                 const sal_Unicode cFillChar = '\0' )
      89             :          : SwTabPortion( nTabPosVal, cFillChar ),
      90             :            mcTab(cTab),
      91          18 :            mnWidthOfPortionsUpTpDecimalPosition( USHRT_MAX )
      92          18 :     { SetWhichPor( POR_TABDECIMAL ); }
      93             : 
      94          18 :     inline sal_Unicode GetTabDecimal() const { return mcTab; }
      95             : 
      96           8 :     inline void SetWidthOfPortionsUpToDecimalPosition( sal_uInt16 nNew )
      97             :     {
      98           8 :         mnWidthOfPortionsUpTpDecimalPosition = nNew;
      99           8 :     }
     100          18 :     inline sal_uInt16 GetWidthOfPortionsUpToDecimalPosition() const
     101             :     {
     102          18 :         return mnWidthOfPortionsUpTpDecimalPosition;
     103             :     }
     104             : 
     105             :     OUTPUT_OPERATOR_OVERRIDE
     106             : };
     107             : 
     108           0 : class SwAutoTabDecimalPortion : public SwTabDecimalPortion
     109             : {
     110             : public:
     111           0 :     inline SwAutoTabDecimalPortion( const sal_uInt16 nTabPosVal, const sal_Unicode cTab,
     112             :                                     const sal_Unicode cFillChar = '\0' )
     113           0 :          : SwTabDecimalPortion( nTabPosVal, cTab, cFillChar )
     114           0 :     { SetLen( 0 ); }
     115             :     virtual void Paint( const SwTxtPaintInfo &rInf ) const SAL_OVERRIDE;
     116             : };
     117             : 
     118             : #endif
     119             : 
     120             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10