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#pragma once
20
21#include <swtypes.hxx>
22#include "itrtxt.hxx"
23
24class SwTextFrame;
25
27{
28private:
31protected:
34 bool m_bKeep;
35public:
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{
54private:
56
57public:
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 m_nOrphLines; }
64
65 bool FindBreak( SwTextFrame *pFrame, SwTextMargin &rLine, bool bHasToFit );
66 bool WouldFit( SwTextMargin &rLine, SwTwips &rMaxHeight, bool bTest, bool bMoveBwd );
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() > m_nOrphLines ) {
76 return IsBreakNow( rLine );
77 }
78 return false;
79 }
80};
81
82/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool IsDummy() const
Definition: porlay.hxx:151
SwTextFrameBreak(SwTextFrame *pFrame, const SwTwips nRst=0)
Definition: widorp.cxx:60
SwTwips m_nOrigin
Definition: widorp.hxx:30
bool IsBreakNow(SwTextMargin &rLine)
Definition: widorp.cxx:224
void SetRstHeight(const SwTextMargin &rLine)
Definition: widorp.cxx:270
void SetKeep(const bool bNew)
Definition: widorp.hxx:40
bool IsKeepAlways() const
Definition: widorp.hxx:38
SwTextFrame * m_pFrame
Definition: widorp.hxx:32
bool IsInside(SwTextMargin const &rLine) const
BP 18.6.93: Widows.
Definition: widorp.cxx:106
SwTwips m_nRstHeight
Definition: widorp.hxx:29
Represents the visualization of a paragraph.
Definition: txtfrm.hxx:168
const SwLineLayout * GetCurr() const
Definition: itrtxt.hxx:83
sal_Int32 GetLineNr() const
Definition: itrtxt.hxx:87
const SwLineLayout * GetPrev()
Definition: itrtxt.cxx:83
sal_uInt16 GetOrphansLines() const
Definition: widorp.hxx:61
sal_uInt16 m_nOrphLines
Definition: widorp.hxx:55
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:377
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:428
WidowsAndOrphans(SwTextFrame *pFrame, const SwTwips nRst=0, bool bCheckKeep=true)
Definition: widorp.cxx:288
bool IsBreakNowWidAndOrp(SwTextMargin &rLine)
Definition: widorp.hxx:69
void ClrOrphLines()
Definition: widorp.hxx:63
sal_uInt16 m_nWidLines
Definition: widorp.hxx:55
bool WouldFit(SwTextMargin &rLine, SwTwips &rMaxHeight, bool bTest, bool bMoveBwd)
Definition: widorp.cxx:576
tools::Long SwTwips
Definition: swtypes.hxx:51