LCOV - code coverage report
Current view: top level - libreoffice/sw/source/core/text - portab.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 7 30 23.3 %
Date: 2012-12-27 Functions: 6 23 26.1 %
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 _PORTAB_HXX
      20             : #define _PORTAB_HXX
      21             : 
      22             : #include "porglue.hxx"
      23             : 
      24             : /*************************************************************************
      25             :  *                      class SwTabPortion
      26             :  *************************************************************************/
      27             : 
      28          69 : class SwTabPortion : public SwFixPortion
      29             : {
      30             :     const KSHORT nTabPos;
      31             :     const sal_Unicode cFill;
      32             :     const bool bAutoTabStop;
      33             : 
      34             :     // Format() branches either into PreFormat() or PostFormat()
      35             :     sal_Bool PreFormat( SwTxtFormatInfo &rInf );
      36             : public:
      37             :     SwTabPortion( const KSHORT nTabPos, const sal_Unicode cFill = '\0', const bool bAutoTab = true );
      38             :     virtual void Paint( const SwTxtPaintInfo &rInf ) const;
      39             :     virtual sal_Bool Format( SwTxtFormatInfo &rInf );
      40             :     virtual void FormatEOL( SwTxtFormatInfo &rInf );
      41             :     sal_Bool PostFormat( SwTxtFormatInfo &rInf );
      42          48 :     inline  sal_Bool IsFilled() const { return 0 != cFill; }
      43          69 :     inline  KSHORT GetTabPos() const { return nTabPos; }
      44           0 :     inline  bool IsAutoTabStop() const { return bAutoTabStop; }
      45             : 
      46             :     // Accessibility: pass information about this portion to the PortionHandler
      47             :     virtual void HandlePortion( SwPortionHandler& rPH ) const;
      48             : 
      49             :     OUTPUT_OPERATOR
      50             : };
      51             : 
      52             : /*************************************************************************
      53             :  *                  class SwTabLeftPortion
      54             :  *************************************************************************/
      55             : 
      56         138 : class SwTabLeftPortion : public SwTabPortion
      57             : {
      58             : public:
      59          69 :     inline SwTabLeftPortion( const KSHORT nTabPosVal, const sal_Unicode cFillChar='\0', bool bAutoTab = true )
      60          69 :          : SwTabPortion( nTabPosVal, cFillChar, bAutoTab )
      61          69 :     { SetWhichPor( POR_TABLEFT ); }
      62             :     OUTPUT_OPERATOR
      63             : };
      64             : 
      65             : /*************************************************************************
      66             :  *                  class SwTabRightPortion
      67             :  *************************************************************************/
      68             : 
      69           0 : class SwTabRightPortion : public SwTabPortion
      70             : {
      71             : public:
      72           0 :     inline SwTabRightPortion( const KSHORT nTabPosVal, const sal_Unicode cFillChar='\0' )
      73           0 :          : SwTabPortion( nTabPosVal, cFillChar )
      74           0 :     { SetWhichPor( POR_TABRIGHT ); }
      75             :     OUTPUT_OPERATOR
      76             : };
      77             : 
      78             : /*************************************************************************
      79             :  *                  class SwTabCenterPortion
      80             :  *************************************************************************/
      81             : 
      82           0 : class SwTabCenterPortion : public SwTabPortion
      83             : {
      84             : public:
      85           0 :     inline SwTabCenterPortion( const KSHORT nTabPosVal, const sal_Unicode cFillChar='\0' )
      86           0 :          : SwTabPortion( nTabPosVal, cFillChar )
      87           0 :     { SetWhichPor( POR_TABCENTER ); }
      88             :     OUTPUT_OPERATOR
      89             : };
      90             : 
      91             : /*************************************************************************
      92             :  *                  class SwTabDecimalPortion
      93             :  *************************************************************************/
      94             : 
      95           0 : class SwTabDecimalPortion : public SwTabPortion
      96             : {
      97             :     const sal_Unicode mcTab;
      98             : 
      99             :     /*
     100             :      * During text formatting, we already store the width of the portions
     101             :      * following the tab stop up to the decimal position. This value is
     102             :      * evaluated during pLastTab->FormatEOL. FME 2006-01-06 #127428#.
     103             :      */
     104             :     sal_uInt16 mnWidthOfPortionsUpTpDecimalPosition;
     105             : 
     106             : public:
     107           0 :     inline SwTabDecimalPortion( const KSHORT nTabPosVal, const sal_Unicode cTab,
     108             :                                 const sal_Unicode cFillChar = '\0' )
     109             :          : SwTabPortion( nTabPosVal, cFillChar ),
     110             :            mcTab(cTab),
     111           0 :            mnWidthOfPortionsUpTpDecimalPosition( USHRT_MAX )
     112           0 :     { SetWhichPor( POR_TABDECIMAL ); }
     113             : 
     114           0 :     inline sal_Unicode GetTabDecimal() const { return mcTab; }
     115             : 
     116           0 :     inline void SetWidthOfPortionsUpToDecimalPosition( sal_uInt16 nNew )
     117             :     {
     118           0 :         mnWidthOfPortionsUpTpDecimalPosition = nNew;
     119           0 :     }
     120           0 :     inline sal_uInt16 GetWidthOfPortionsUpToDecimalPosition() const
     121             :     {
     122           0 :         return mnWidthOfPortionsUpTpDecimalPosition;
     123             :     }
     124             : 
     125             :     OUTPUT_OPERATOR
     126             : };
     127             : 
     128             : 
     129             : /*************************************************************************
     130             :  *                  class SwAutoTabDecimalPortion
     131             :  *************************************************************************/
     132             : 
     133           0 : class SwAutoTabDecimalPortion : public SwTabDecimalPortion
     134             : {
     135             : public:
     136           0 :     inline SwAutoTabDecimalPortion( const KSHORT nTabPosVal, const sal_Unicode cTab,
     137             :                                     const sal_Unicode cFillChar = '\0' )
     138           0 :          : SwTabDecimalPortion( nTabPosVal, cTab, cFillChar )
     139           0 :     { SetLen( 0 ); }
     140             :     virtual void Paint( const SwTxtPaintInfo &rInf ) const;
     141             : };
     142             : 
     143             : 
     144             : CLASSIO( SwTabPortion )
     145             : CLASSIO( SwTabLeftPortion )
     146             : CLASSIO( SwTabRightPortion )
     147             : CLASSIO( SwTabCenterPortion )
     148             : CLASSIO( SwTabDecimalPortion )
     149             : 
     150             : 
     151             : #endif
     152             : 
     153             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10