LCOV - code coverage report
Current view: top level - sw/source/core/text - porglue.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 18 19 94.7 %
Date: 2015-06-13 12:38:46 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       20583 : class SwGluePortion : public SwLinePortion
      28             : {
      29             : private:
      30             :     sal_uInt16 nFixWidth;
      31             : public:
      32             :     explicit SwGluePortion( const sal_uInt16 nInitFixWidth );
      33             : 
      34             :     void Join( SwGluePortion *pVictim );
      35             : 
      36             :     inline short GetPrtGlue() const;
      37        6240 :     inline sal_uInt16 GetFixWidth() const { return nFixWidth; }
      38       19656 :     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 SwTextPaintInfo &rInf ) const SAL_OVERRIDE;
      44             :     virtual sal_Int32 GetCrsrOfst( const sal_uInt16 nOfst ) const SAL_OVERRIDE;
      45             :     virtual SwPosSize GetTextSize( const SwTextSizeInfo &rInfo ) const SAL_OVERRIDE;
      46             :     virtual bool GetExpText( const SwTextSizeInfo &rInf, OUString &rText ) const SAL_OVERRIDE;
      47             : 
      48             :     OUTPUT_OPERATOR_OVERRIDE
      49             : };
      50             : 
      51       18028 : class SwFixPortion : public SwGluePortion
      52             : {
      53             :     sal_uInt16 nFix;        // The width offset in the line
      54             : public:
      55             :     explicit SwFixPortion( const SwRect &rFlyRect );
      56             :     SwFixPortion( const sal_uInt16 nFixWidth, const sal_uInt16 nFixPos );
      57       16914 :     inline void   Fix( const sal_uInt16 nNewFix ) { nFix = nNewFix; }
      58        5840 :     inline sal_uInt16 Fix() const { return nFix; }
      59             :     OUTPUT_OPERATOR_OVERRIDE
      60             : };
      61             : 
      62        5110 : class SwMarginPortion : public SwGluePortion
      63             : {
      64             : public:
      65             :     explicit SwMarginPortion( const sal_uInt16 nFixWidth );
      66             :     void AdjustRight( const SwLineLayout* pCurr );
      67             :     OUTPUT_OPERATOR_OVERRIDE
      68             : };
      69             : 
      70        2541 : inline short SwGluePortion::GetPrtGlue() const
      71        2541 : { return Width() - nFixWidth; }
      72             : 
      73             : // The FixWidth MUST NEVER be larger than the accumulated width!
      74          10 : inline void SwGluePortion::AdjFixWidth()
      75             : {
      76          10 :     if( nFixWidth > PrtWidth() )
      77           0 :         nFixWidth = PrtWidth();
      78          10 : }
      79             : 
      80         133 : inline void SwGluePortion::MoveAllGlue( SwGluePortion *pTarget )
      81             : {
      82         133 :     MoveGlue( pTarget, GetPrtGlue() );
      83         133 : }
      84             : 
      85         988 : inline void SwGluePortion::MoveHalfGlue( SwGluePortion *pTarget )
      86             : {
      87         988 :     MoveGlue( pTarget, GetPrtGlue() / 2 );
      88         988 : }
      89             : 
      90             : #endif
      91             : 
      92             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11