LibreOffice Module sw (master)  1
widorp.hxx
Go to the documentation of this file.
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 SwTextFrame;
22 
23 #include <swtypes.hxx>
24 #include "itrtxt.hxx"
25 
27 {
28 private:
31 protected:
33  bool m_bBreak;
34  bool m_bKeep;
35 public:
36  SwTextFrameBreak( SwTextFrame *pFrame, const SwTwips nRst = 0 );
37  bool IsBreakNow( SwTextMargin &rLine );
38  bool IsKeepAlways() const { return m_bKeep; }
39 
40  void SetKeep( const bool bNew ) { m_bKeep = bNew; }
41 
42  bool IsInside( SwTextMargin const &rLine ) const;
43 
44  // In order to be able to handle special cases with Footnote.
45  // SetRstHeight sets the rest height for SwTextFrameBreak. This is needed
46  // to call TruncLines() without IsBreakNow() returning another value.
47  // We assume that rLine is pointing to the last non-fitting line.
48 
49  void SetRstHeight( const SwTextMargin &rLine );
50 };
51 
53 {
54 private:
55  sal_uInt16 nWidLines, nOrphLines;
56 
57 public:
58  WidowsAndOrphans( SwTextFrame *pFrame, const SwTwips nRst = 0,
59  bool bCheckKeep = true );
60  bool FindWidows( SwTextFrame *pFrame, SwTextMargin &rLine );
61  sal_uInt16 GetOrphansLines() const
62  { return nOrphLines; }
63  void ClrOrphLines(){ nOrphLines = 0; }
64 
65  bool FindBreak( SwTextFrame *pFrame, SwTextMargin &rLine, bool bHasToFit );
66  bool WouldFit( SwTextMargin &rLine, SwTwips &rMaxHeight, bool bTest );
67  // i#16128 - This method is named this way to avoid confusion with
68  // base class method <SwTextFrameBreak::IsBreakNow>, which isn't virtual.
70  {
71  bool isOnFirstLine = (rLine.GetLineNr() == 1 && !rLine.GetPrev());
72  if ( isOnFirstLine && rLine.GetCurr()->IsDummy()) {
73  return IsBreakNow( rLine );
74  }
75  if ( rLine.GetLineNr() > nOrphLines ) {
76  return IsBreakNow( rLine );
77  }
78  return false;
79  }
80 };
81 
82 #endif
83 
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool FindWidows(SwTextFrame *pFrame, SwTextMargin &rLine)
FindWidows positions the SwTextMargin of the Master to the line where to break by examining and forma...
Definition: widorp.cxx:354
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:149
bool FindBreak(SwTextFrame *pFrame, SwTextMargin &rLine, bool bHasToFit)
The Find*-Methods do not only search, but adjust the SwTextMargin to the line where the paragraph sho...
Definition: widorp.cxx:303
void SetRstHeight(const SwTextMargin &rLine)
Definition: widorp.cxx:206
sal_uInt16 GetLineNr() const
Definition: itrtxt.hxx:87
void ClrOrphLines()
Definition: widorp.hxx:63
long SwTwips
Definition: swtypes.hxx:49
bool WouldFit(SwTextMargin &rLine, SwTwips &rMaxHeight, bool bTest)
Definition: widorp.cxx:478
bool IsKeepAlways() const
Definition: widorp.hxx:38
sal_uInt16 GetOrphansLines() const
Definition: widorp.hxx:61
bool IsBreakNowWidAndOrp(SwTextMargin &rLine)
Definition: widorp.hxx:69
SwTwips m_nOrigin
Definition: widorp.hxx:30
SwTwips m_nRstHeight
Definition: widorp.hxx:29
bool IsDummy() const
Definition: porlay.hxx:135
bool IsInside(SwTextMargin const &rLine) const
BP 18.6.93: Widows.
Definition: widorp.cxx:104
const SwLineLayout * GetPrev()
Definition: itrtxt.cxx:84
SwTextFrameBreak(SwTextFrame *pFrame, const SwTwips nRst=0)
Definition: widorp.cxx:58
sal_uInt16 nOrphLines
Definition: widorp.hxx:55
bool IsBreakNow(SwTextMargin &rLine)
Definition: widorp.cxx:168
sal_uInt16 nWidLines
Definition: widorp.hxx:55
WidowsAndOrphans(SwTextFrame *pFrame, const SwTwips nRst=0, bool bCheckKeep=true)
Definition: widorp.cxx:224
void SetKeep(const bool bNew)
Definition: widorp.hxx:40
const SwLineLayout * GetCurr() const
Definition: itrtxt.hxx:83
SwTextFrame * m_pFrame
Definition: widorp.hxx:32