LCOV - code coverage report
Current view: top level - sw/source/core/text - porrst.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 13 18 72.2 %
Date: 2015-06-13 12:38:46 Functions: 13 20 65.0 %
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_PORRST_HXX
      20             : #define INCLUDED_SW_SOURCE_CORE_TEXT_PORRST_HXX
      21             : #include "porlay.hxx"
      22             : #include "porexp.hxx"
      23             : 
      24             : #define LINE_BREAK_WIDTH        150
      25             : #define SPECIAL_FONT_HEIGHT     200
      26             : 
      27             : class SwTextFormatInfo;
      28             : 
      29           0 : class SwTmpEndPortion : public SwLinePortion
      30             : {
      31             : public:
      32             :     explicit SwTmpEndPortion( const SwLinePortion &rPortion );
      33             :     virtual void Paint( const SwTextPaintInfo &rInf ) const SAL_OVERRIDE;
      34             :     OUTPUT_OPERATOR_OVERRIDE
      35             : };
      36             : 
      37        1114 : class SwBreakPortion : public SwLinePortion
      38             : {
      39             : public:
      40             :     explicit SwBreakPortion( const SwLinePortion &rPortion );
      41             :     // Returns 0 if we have no usable data
      42             :     virtual SwLinePortion *Compress() SAL_OVERRIDE;
      43             :     virtual void Paint( const SwTextPaintInfo &rInf ) const SAL_OVERRIDE;
      44             :     virtual bool Format( SwTextFormatInfo &rInf ) SAL_OVERRIDE;
      45             :     virtual sal_uInt16 GetViewWidth( const SwTextSizeInfo &rInf ) const SAL_OVERRIDE;
      46             :     virtual sal_Int32 GetCrsrOfst( const sal_uInt16 nOfst ) const SAL_OVERRIDE;
      47             : 
      48             :     // Accessibility: pass information about this portion to the PortionHandler
      49             :     virtual void HandlePortion( SwPortionHandler& rPH ) const SAL_OVERRIDE;
      50             : 
      51             :     OUTPUT_OPERATOR_OVERRIDE
      52             : };
      53             : 
      54         866 : class SwKernPortion : public SwLinePortion
      55             : {
      56             :     short nKern;
      57             :     bool bBackground;
      58             :     bool bGridKern;
      59             : 
      60             : public:
      61             : 
      62             :     // This constructor automatically appends the portion to rPortion
      63             :     // bBG indicates, that the background of the kerning portion has to
      64             :     // be painted, e.g., if the portion if positioned between to fields.
      65             :     // bGridKern indicates, that the kerning portion is used to provide
      66             :     // additional space in grid mode.
      67             :     SwKernPortion( SwLinePortion &rPortion, short nKrn,
      68             :                    bool bBG = false, bool bGridKern = false );
      69             : 
      70             :     // This constructor only sets the height and ascent to the values
      71             :     // of rPortion. It is only used for kerning portions for grid mode
      72             :     explicit SwKernPortion( const SwLinePortion &rPortion );
      73             : 
      74             :     virtual void FormatEOL( SwTextFormatInfo &rInf ) SAL_OVERRIDE;
      75             :     virtual void Paint( const SwTextPaintInfo &rInf ) const SAL_OVERRIDE;
      76             : 
      77             :     OUTPUT_OPERATOR_OVERRIDE
      78             : };
      79             : 
      80           6 : class SwArrowPortion : public SwLinePortion
      81             : {
      82             :     Point aPos;
      83             :     bool bLeft;
      84             : public:
      85             :     explicit SwArrowPortion( const SwLinePortion &rPortion );
      86             :     explicit SwArrowPortion( const SwTextPaintInfo &rInf );
      87             :     virtual void Paint( const SwTextPaintInfo &rInf ) const SAL_OVERRIDE;
      88             :     virtual SwLinePortion *Compress() SAL_OVERRIDE;
      89           6 :     inline bool IsLeft() const { return bLeft; }
      90           6 :     inline const Point& GetPos() const { return aPos; }
      91             :     OUTPUT_OPERATOR_OVERRIDE
      92             : };
      93             : 
      94             : // The characters which are forbidden at the start of a line like the dot and
      95             : // other punctuation marks are allowed to display in the margin of the page
      96             : // by a user option.
      97             : // The SwHangingPortion is the corresponding textportion to do that.
      98           0 : class SwHangingPortion : public SwTextPortion
      99             : {
     100             :     sal_uInt16 nInnerWidth;
     101             : public:
     102           0 :     explicit SwHangingPortion( SwPosSize aSize ) : nInnerWidth( aSize.Width() )
     103           0 :         { SetWhichPor( POR_HNG );  SetLen( 1 ); Height( aSize.Height() ); }
     104             : 
     105           0 :     sal_uInt16 GetInnerWidth() const { return nInnerWidth; }
     106             : };
     107             : 
     108             : // Used to hide text
     109           8 : class SwHiddenTextPortion : public SwLinePortion
     110             : {
     111             : public:
     112           4 :     explicit SwHiddenTextPortion( sal_Int32 nLen )
     113           4 :         { SetWhichPor( POR_HIDDEN_TXT );  SetLen( nLen ); }
     114             : 
     115             :     virtual void Paint( const SwTextPaintInfo &rInf ) const SAL_OVERRIDE;
     116             :     virtual bool Format( SwTextFormatInfo &rInf ) SAL_OVERRIDE;
     117             : };
     118             : 
     119         560 : class SwControlCharPortion : public SwLinePortion
     120             : {
     121             : 
     122             : private:
     123             :     mutable sal_uInt16 mnViewWidth;            // used to cache a calculated value
     124             :     mutable sal_uInt16 mnHalfCharWidth;        // used to cache a calculated value
     125             :     sal_Unicode mcChar;
     126             : 
     127             : public:
     128             : 
     129         280 :     explicit SwControlCharPortion( sal_Unicode cChar )
     130         280 :         : mnViewWidth( 0 ), mnHalfCharWidth( 0 ), mcChar( cChar )
     131             :     {
     132         280 :         SetWhichPor( POR_CONTROLCHAR ); SetLen( 1 );
     133         280 :     }
     134             : 
     135             :     virtual void Paint( const SwTextPaintInfo &rInf ) const SAL_OVERRIDE;
     136             :     virtual bool Format( SwTextFormatInfo &rInf ) SAL_OVERRIDE;
     137             :     virtual sal_uInt16 GetViewWidth( const SwTextSizeInfo& rInf ) const SAL_OVERRIDE;
     138             : };
     139             : 
     140             : #endif
     141             : 
     142             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11