android: Update app-specific/MIME type icons
[LibreOffice.git] / sw / source / core / text / widorp.hxx
blob996a7fc913bc9a62c4ecbbb080b804cfed30bb31
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #pragma once
21 #include <swtypes.hxx>
22 #include "itrtxt.hxx"
24 class SwTextFrame;
26 class SwTextFrameBreak
28 private:
29 SwTwips m_nRstHeight;
30 SwTwips m_nOrigin;
31 protected:
32 SwTextFrame *m_pFrame;
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; }
40 void SetKeep( const bool bNew ) { m_bKeep = bNew; }
42 bool IsInside( SwTextMargin const &rLine ) const;
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.
49 void SetRstHeight( const SwTextMargin &rLine );
52 class WidowsAndOrphans : public SwTextFrameBreak
54 private:
55 sal_uInt16 m_nWidLines, m_nOrphLines;
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 m_nOrphLines; }
63 void ClrOrphLines(){ m_nOrphLines = 0; }
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.
69 bool IsBreakNowWidAndOrp( SwTextMargin &rLine )
71 bool isOnFirstLine = (rLine.GetLineNr() == 1 && !rLine.GetPrev());
72 if ( isOnFirstLine && rLine.GetCurr()->IsDummy()) {
73 return IsBreakNow( rLine );
75 if ( rLine.GetLineNr() > m_nOrphLines ) {
76 return IsBreakNow( rLine );
78 return false;
82 namespace sw {
84 auto FindNonFlyPortion(SwLineLayout const& rLine) -> bool;
86 } // namespace sw
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */