LCOV - code coverage report
Current view: top level - sw/source/core/text - porglue.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 18 19 94.7 %
Date: 2014-11-03 Functions: 12 14 85.7 %
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_PORGLUE_HXX
      20             : #define INCLUDED_SW_SOURCE_CORE_TEXT_PORGLUE_HXX
      21             : 
      22             : #include "porlin.hxx"
      23             : 
      24             : class SwRect;
      25             : class SwLineLayout;
      26             : 
      27       35638 : class SwGluePortion : public SwLinePortion
      28             : {
      29             : private:
      30             :     sal_uInt16 nFixWidth;
      31             : public:
      32             :                 SwGluePortion( const sal_uInt16 nInitFixWidth );
      33             : 
      34             :     void Join( SwGluePortion *pVictim );
      35             : 
      36             :     inline short GetPrtGlue() const;
      37       11522 :     inline sal_uInt16 GetFixWidth() const { return nFixWidth; }
      38       33718 :     inline void SetFixWidth( const sal_uInt16 nNew ) { nFixWidth = nNew; }
      39             :     void MoveGlue( SwGluePortion *pTarget, const short nPrtGlue );
      40             :     inline void MoveAllGlue( SwGluePortion *pTarget );
      41             :     inline void MoveHalfGlue( SwGluePortion *pTarget );
      42             :     inline void AdjFixWidth();
      43             :     virtual void Paint( const SwTxtPaintInfo &rInf ) const SAL_OVERRIDE;
      44             :     virtual sal_Int32 GetCrsrOfst( const sal_uInt16 nOfst ) const SAL_OVERRIDE;
      45             :     virtual SwPosSize GetTxtSize( const SwTxtSizeInfo &rInfo ) const SAL_OVERRIDE;
      46             :     virtual bool GetExpTxt( const SwTxtSizeInfo &rInf, OUString &rTxt ) const SAL_OVERRIDE;
      47             : 
      48             :     OUTPUT_OPERATOR_OVERRIDE
      49             : };
      50             : 
      51       31012 : class SwFixPortion : public SwGluePortion
      52             : {
      53             :     sal_uInt16 nFix;        // The width offset in the line
      54             : public:
      55             :         SwFixPortion( const SwRect &rFlyRect );
      56             :         SwFixPortion( const sal_uInt16 nFixWidth, const sal_uInt16 nFixPos );
      57       28652 :     inline void   Fix( const sal_uInt16 nNewFix ) { nFix = nNewFix; }
      58       11206 :     inline sal_uInt16 Fix() const { return nFix; }
      59             :     OUTPUT_OPERATOR_OVERRIDE
      60             : };
      61             : 
      62        9252 : class SwMarginPortion : public SwGluePortion
      63             : {
      64             : public:
      65             :         SwMarginPortion( const sal_uInt16 nFixWidth );
      66             :         void AdjustRight( const SwLineLayout* pCurr );
      67             :     OUTPUT_OPERATOR_OVERRIDE
      68             : };
      69             : 
      70        4534 : inline short SwGluePortion::GetPrtGlue() const
      71        4534 : { return Width() - nFixWidth; }
      72             : 
      73             : // The FixWidth MUST NEVER be larger than the accumulated width!
      74          20 : inline void SwGluePortion::AdjFixWidth()
      75             : {
      76          20 :     if( nFixWidth > PrtWidth() )
      77           0 :         nFixWidth = PrtWidth();
      78          20 : }
      79             : 
      80         262 : inline void SwGluePortion::MoveAllGlue( SwGluePortion *pTarget )
      81             : {
      82         262 :     MoveGlue( pTarget, GetPrtGlue() );
      83         262 : }
      84             : 
      85        1700 : inline void SwGluePortion::MoveHalfGlue( SwGluePortion *pTarget )
      86             : {
      87        1700 :     MoveGlue( pTarget, GetPrtGlue() / 2 );
      88        1700 : }
      89             : 
      90             : #endif
      91             : 
      92             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10