LCOV - code coverage report
Current view: top level - libreoffice/sw/source/core/text - widorp.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 9 22.2 %
Date: 2012-12-27 Functions: 1 6 16.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 _WIDORP_HXX
      20             : #define _WIDORP_HXX
      21             : class SwTxtFrm;
      22             : 
      23             : #include "swtypes.hxx"
      24             : #include "itrtxt.hxx"
      25             : 
      26             : class SwTxtFrmBreak
      27             : {
      28             : private:
      29             :     SwTwips  nRstHeight;
      30             :     SwTwips  nOrigin;
      31             : protected:
      32             :     SwTxtFrm *pFrm;
      33             :     sal_Bool     bBreak;
      34             :     sal_Bool     bKeep;
      35             : public:
      36             :     SwTxtFrmBreak( SwTxtFrm *pFrm, const SwTwips nRst = 0  );
      37             :     sal_Bool IsBreakNow( SwTxtMargin &rLine );
      38             : 
      39             :     sal_Bool IsBroken() const   { return bBreak; }
      40           0 :     sal_Bool IsKeepAlways() const { return bKeep; }
      41             :     void Keep()             { bKeep = sal_True; }
      42             :     void Break()                { bKeep = sal_False; bBreak = sal_True; }
      43             : 
      44             :     inline sal_Bool GetKeep() const { return bKeep; }
      45           0 :     inline void SetKeep( const sal_Bool bNew ) { bKeep = bNew; }
      46             : 
      47             :     sal_Bool IsInside( SwTxtMargin &rLine ) const;
      48             : 
      49             :     // In order to be able to handle special cases with Ftn.
      50             :     // SetRstHeight sets the rest height for SwTxtFrmBreak. This is needed
      51             :     // to call TruncLines() without IsBreakNow() returning another value.
      52             :     // We assume that rLine is pointing to the last non-fitting line.
      53             : 
      54             :     // OD 2004-02-27 #106629# - no longer inline
      55             :     void SetRstHeight( const SwTxtMargin &rLine );
      56             :     SwTwips GetRstHeight() const { return nRstHeight; }
      57             : };
      58             : 
      59             : class WidowsAndOrphans : public SwTxtFrmBreak
      60             : {
      61             : private:
      62             :     MSHORT   nWidLines, nOrphLines;
      63             : 
      64             : public:
      65             :     WidowsAndOrphans( SwTxtFrm *pFrm, const SwTwips nRst = 0,
      66             :         sal_Bool bCheckKeep = sal_True );
      67             :     sal_Bool FindWidows( SwTxtFrm *pFrm, SwTxtMargin &rLine );
      68           0 :     MSHORT GetWidowsLines() const
      69           0 :     { return nWidLines; }
      70           0 :     MSHORT GetOrphansLines() const
      71           0 :     { return nOrphLines; }
      72           0 :     void ClrOrphLines(){ nOrphLines = 0; }
      73             : 
      74             :     sal_Bool FindBreak( SwTxtFrm *pFrm, SwTxtMargin &rLine, sal_Bool bHasToFit );
      75             :     sal_Bool WouldFit( SwTxtMargin &rLine, SwTwips &rMaxHeight, sal_Bool bTest );
      76             :     // OD 2004-02-25 #i16128# - rename method to avoid confusion with base class
      77             :     // method <SwTxtFrmBreak::IsBreakNow>, which isn't virtual.
      78        2071 :     sal_Bool IsBreakNowWidAndOrp( SwTxtMargin &rLine )
      79             :     {
      80        2071 :         return ( rLine.GetLineNr() > nOrphLines ) && IsBreakNow( rLine );
      81             :     }
      82             : };
      83             : 
      84             : 
      85             : #endif
      86             : 
      87             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10