LCOV - code coverage report
Current view: top level - sw/source/core/text - portab.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 26 30 86.7 %
Date: 2015-06-13 12:38:46 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       16905 : 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( SwTextFormatInfo &rInf );
      32             : public:
      33             :     SwTabPortion( const sal_uInt16 nTabPos, const sal_Unicode cFill = '\0', const bool bAutoTab = true );
      34             :     virtual void Paint( const SwTextPaintInfo &rInf ) const SAL_OVERRIDE;
      35             :     virtual bool Format( SwTextFormatInfo &rInf ) SAL_OVERRIDE;
      36             :     virtual void FormatEOL( SwTextFormatInfo &rInf ) SAL_OVERRIDE;
      37             :     bool PostFormat( SwTextFormatInfo &rInf );
      38         549 :     inline  bool IsFilled() const { return 0 != cFill; }
      39       17717 :     inline  sal_uInt16 GetTabPos() const { return nTabPos; }
      40          46 :     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       28268 : class SwTabLeftPortion : public SwTabPortion
      49             : {
      50             : public:
      51       14134 :     inline SwTabLeftPortion( const sal_uInt16 nTabPosVal, const sal_Unicode cFillChar='\0', bool bAutoTab = true )
      52       14134 :          : SwTabPortion( nTabPosVal, cFillChar, bAutoTab )
      53       14134 :     { SetWhichPor( POR_TABLEFT ); }
      54             :     OUTPUT_OPERATOR_OVERRIDE
      55             : };
      56             : 
      57        2890 : class SwTabRightPortion : public SwTabPortion
      58             : {
      59             : public:
      60        1445 :     inline SwTabRightPortion( const sal_uInt16 nTabPosVal, const sal_Unicode cFillChar='\0' )
      61        1445 :          : SwTabPortion( nTabPosVal, cFillChar )
      62        1445 :     { SetWhichPor( POR_TABRIGHT ); }
      63             :     OUTPUT_OPERATOR_OVERRIDE
      64             : };
      65             : 
      66        2634 : class SwTabCenterPortion : public SwTabPortion
      67             : {
      68             : public:
      69        1317 :     inline SwTabCenterPortion( const sal_uInt16 nTabPosVal, const sal_Unicode cFillChar='\0' )
      70        1317 :          : SwTabPortion( nTabPosVal, cFillChar )
      71        1317 :     { SetWhichPor( POR_TABCENTER ); }
      72             :     OUTPUT_OPERATOR_OVERRIDE
      73             : };
      74             : 
      75          18 : 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           9 :     inline SwTabDecimalPortion( const sal_uInt16 nTabPosVal, const sal_Unicode cTab,
      88             :                                 const sal_Unicode cFillChar = '\0' )
      89             :          : SwTabPortion( nTabPosVal, cFillChar ),
      90             :            mcTab(cTab),
      91           9 :            mnWidthOfPortionsUpTpDecimalPosition( USHRT_MAX )
      92           9 :     { SetWhichPor( POR_TABDECIMAL ); }
      93             : 
      94           9 :     inline sal_Unicode GetTabDecimal() const { return mcTab; }
      95             : 
      96           4 :     inline void SetWidthOfPortionsUpToDecimalPosition( sal_uInt16 nNew )
      97             :     {
      98           4 :         mnWidthOfPortionsUpTpDecimalPosition = nNew;
      99           4 :     }
     100           9 :     inline sal_uInt16 GetWidthOfPortionsUpToDecimalPosition() const
     101             :     {
     102           9 :         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 SwTextPaintInfo &rInf ) const SAL_OVERRIDE;
     116             : };
     117             : 
     118             : #endif
     119             : 
     120             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11