Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _WIDORP_HXX
29 : : #define _WIDORP_HXX
30 : : class SwTxtFrm;
31 : :
32 : : #include "swtypes.hxx"
33 : : #include "itrtxt.hxx"
34 : :
35 : : class SwTxtFrmBreak
36 : : {
37 : : private:
38 : : SwTwips nRstHeight;
39 : : SwTwips nOrigin;
40 : : protected:
41 : : SwTxtFrm *pFrm;
42 : : sal_Bool bBreak;
43 : : sal_Bool bKeep;
44 : : public:
45 : : SwTxtFrmBreak( SwTxtFrm *pFrm, const SwTwips nRst = 0 );
46 : : sal_Bool IsBreakNow( SwTxtMargin &rLine );
47 : :
48 : : sal_Bool IsBroken() const { return bBreak; }
49 : 130 : sal_Bool IsKeepAlways() const { return bKeep; }
50 : : void Keep() { bKeep = sal_True; }
51 : : void Break() { bKeep = sal_False; bBreak = sal_True; }
52 : :
53 : : inline sal_Bool GetKeep() const { return bKeep; }
54 : 50 : inline void SetKeep( const sal_Bool bNew ) { bKeep = bNew; }
55 : :
56 : : sal_Bool IsInside( SwTxtMargin &rLine ) const;
57 : :
58 : : // In order to be able to handle special cases with Ftn.
59 : : // SetRstHeight sets the rest height for SwTxtFrmBreak. This is needed
60 : : // to call TruncLines() without IsBreakNow() returning another value.
61 : : // We assume that rLine is pointing to the last non-fitting line.
62 : :
63 : : // OD 2004-02-27 #106629# - no longer inline
64 : : void SetRstHeight( const SwTxtMargin &rLine );
65 : : SwTwips GetRstHeight() const { return nRstHeight; }
66 : : };
67 : :
68 : : class WidowsAndOrphans : public SwTxtFrmBreak
69 : : {
70 : : private:
71 : : MSHORT nWidLines, nOrphLines;
72 : :
73 : : public:
74 : : WidowsAndOrphans( SwTxtFrm *pFrm, const SwTwips nRst = 0,
75 : : sal_Bool bCheckKeep = sal_True );
76 : : sal_Bool FindWidows( SwTxtFrm *pFrm, SwTxtMargin &rLine );
77 : 4 : MSHORT GetWidowsLines() const
78 : 4 : { return nWidLines; }
79 : 60 : MSHORT GetOrphansLines() const
80 : 60 : { return nOrphLines; }
81 : 50 : void ClrOrphLines(){ nOrphLines = 0; }
82 : :
83 : : sal_Bool FindBreak( SwTxtFrm *pFrm, SwTxtMargin &rLine, sal_Bool bHasToFit );
84 : : sal_Bool WouldFit( SwTxtMargin &rLine, SwTwips &rMaxHeight, sal_Bool bTest );
85 : : // OD 2004-02-25 #i16128# - rename method to avoid confusion with base class
86 : : // method <SwTxtFrmBreak::IsBreakNow>, which isn't virtual.
87 : 87975 : sal_Bool IsBreakNowWidAndOrp( SwTxtMargin &rLine )
88 : : {
89 [ + + ][ + + ]: 87975 : return ( rLine.GetLineNr() > nOrphLines ) && IsBreakNow( rLine );
90 : : }
91 : : };
92 : :
93 : :
94 : : #endif
95 : :
96 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|