LCOV - code coverage report
Current view: top level - sw/source/core/text - widorp.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 9 9 100.0 %
Date: 2015-06-13 12:38:46 Functions: 6 6 100.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_WIDORP_HXX
      20             : #define INCLUDED_SW_SOURCE_CORE_TEXT_WIDORP_HXX
      21             : class SwTextFrm;
      22             : 
      23             : #include "swtypes.hxx"
      24             : #include "itrtxt.hxx"
      25             : 
      26             : class SwTextFrmBreak
      27             : {
      28             : private:
      29             :     SwTwips  nRstHeight;
      30             :     SwTwips  nOrigin;
      31             : protected:
      32             :     SwTextFrm *pFrm;
      33             :     bool     bBreak;
      34             :     bool     bKeep;
      35             : public:
      36             :     SwTextFrmBreak( SwTextFrm *pFrm, const SwTwips nRst = 0  );
      37             :     bool IsBreakNow( SwTextMargin &rLine );
      38             : 
      39             :     bool IsBroken() const     { return bBreak; }
      40         368 :     bool IsKeepAlways() const { return bKeep; }
      41             :     void Keep()               { bKeep = true; }
      42             :     void Break()              { bKeep = false; bBreak = true; }
      43             : 
      44             :     inline bool GetKeep() const { return bKeep; }
      45         191 :     inline void SetKeep( const bool bNew ) { bKeep = bNew; }
      46             : 
      47             :     bool IsInside( SwTextMargin &rLine ) const;
      48             : 
      49             :     // In order to be able to handle special cases with Footnote.
      50             :     // SetRstHeight sets the rest height for SwTextFrmBreak. 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 SwTextMargin &rLine );
      56             :     SwTwips GetRstHeight() const { return nRstHeight; }
      57             : };
      58             : 
      59             : class WidowsAndOrphans : public SwTextFrmBreak
      60             : {
      61             : private:
      62             :     sal_uInt16   nWidLines, nOrphLines;
      63             : 
      64             : public:
      65             :     WidowsAndOrphans( SwTextFrm *pFrm, const SwTwips nRst = 0,
      66             :         bool bCheckKeep = true );
      67             :     bool FindWidows( SwTextFrm *pFrm, SwTextMargin &rLine );
      68          12 :     sal_uInt16 GetWidowsLines() const
      69          12 :     { return nWidLines; }
      70         232 :     sal_uInt16 GetOrphansLines() const
      71         232 :     { return nOrphLines; }
      72         189 :     void ClrOrphLines(){ nOrphLines = 0; }
      73             : 
      74             :     bool FindBreak( SwTextFrm *pFrm, SwTextMargin &rLine, bool bHasToFit );
      75             :     bool WouldFit( SwTextMargin &rLine, SwTwips &rMaxHeight, bool bTest );
      76             :     // OD 2004-02-25 #i16128# - rename method to avoid confusion with base class
      77             :     // method <SwTextFrmBreak::IsBreakNow>, which isn't virtual.
      78      195826 :     bool IsBreakNowWidAndOrp( SwTextMargin &rLine )
      79             :     {
      80      195826 :         return ( rLine.GetLineNr() > nOrphLines ) && IsBreakNow( rLine );
      81             :     }
      82             : };
      83             : 
      84             : #endif
      85             : 
      86             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11