Update ooo320-m1
[ooovba.git] / sw / source / core / text / widorp.hxx
blob01d8bd79c97e5a022a9e3abc777e38b6b81ce15d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: widorp.hxx,v $
10 * $Revision: 1.8.214.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _WIDORP_HXX
31 #define _WIDORP_HXX
32 class SwTxtFrm;
34 #include "swtypes.hxx"
35 #include "itrtxt.hxx"
37 class SwTxtFrmBreak
39 private:
40 SwTwips nRstHeight;
41 SwTwips nOrigin;
42 protected:
43 SwTxtFrm *pFrm;
44 sal_Bool bBreak;
45 sal_Bool bKeep;
46 public:
47 SwTxtFrmBreak( SwTxtFrm *pFrm, const SwTwips nRst = 0 );
48 sal_Bool IsBreakNow( SwTxtMargin &rLine );
50 sal_Bool IsBroken() const { return bBreak; }
51 sal_Bool IsKeepAlways() const { return bKeep; }
52 void Keep() { bKeep = sal_True; }
53 void Break() { bKeep = sal_False; bBreak = sal_True; }
55 inline sal_Bool GetKeep() const { return bKeep; }
56 inline void SetKeep( const sal_Bool bNew ) { bKeep = bNew; }
58 sal_Bool IsInside( SwTxtMargin &rLine ) const;
60 // Um Sonderfaelle mit Ftn behandeln zu koennen.
61 // Mit SetRstHeight wird dem SwTxtFrmBreak die Resthoehe eingestellt,
62 // Um TruncLines() rufen zu koennen, ohne dass IsBreakNow() einen
63 // anderen Wert zurueckliefert.
64 // Es wird dabei davon ausgegangen, dass rLine auf der letzten Zeile
65 // steht, die nicht mehr passt.
67 // OD 2004-02-27 #106629# - no longer inline
68 void SetRstHeight( const SwTxtMargin &rLine );
69 SwTwips GetRstHeight() const { return nRstHeight; }
72 class WidowsAndOrphans : public SwTxtFrmBreak
74 private:
75 MSHORT nWidLines, nOrphLines;
77 public:
78 WidowsAndOrphans( SwTxtFrm *pFrm, const SwTwips nRst = 0,
79 sal_Bool bCheckKeep = sal_True );
80 sal_Bool FindWidows( SwTxtFrm *pFrm, SwTxtMargin &rLine );
81 MSHORT GetWidowsLines() const
82 { return nWidLines; }
83 MSHORT GetOrphansLines() const
84 { return nOrphLines; }
85 void ClrOrphLines(){ nOrphLines = 0; }
87 sal_Bool FindBreak( SwTxtFrm *pFrm, SwTxtMargin &rLine, sal_Bool bHasToFit );
88 sal_Bool WouldFit( SwTxtMargin &rLine, SwTwips &rMaxHeight, sal_Bool bTest );
89 // OD 2004-02-25 #i16128# - rename method to avoid confusion with base class
90 // method <SwTxtFrmBreak::IsBreakNow>, which isn't virtual.
91 sal_Bool IsBreakNowWidAndOrp( SwTxtMargin &rLine )
93 return ( rLine.GetLineNr() > nOrphLines ) && IsBreakNow( rLine );
98 #endif