summaryrefslogtreecommitdiff
path: root/sw/source/core/text/widorp.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-01-07 12:30:23 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-01-07 15:13:04 +0100
commit6d8da2b2deb4be2182ca1852cec7eb38a4c654eb (patch)
tree9e03e6275cc741e81aa0043460656b3a15ec3882 /sw/source/core/text/widorp.cxx
parente035b03a91324c7856577c64bcb715a1f36f6c8b (diff)
tdf#96943 sw Hide Whitespace: don't create pages for widow / orphan ...
... paragraphs that would otherwise fit nominal size of the page frame Change-Id: I90c3de9150b17c951e1ac4158babb7a71afee9ee
Diffstat (limited to 'sw/source/core/text/widorp.cxx')
-rw-r--r--sw/source/core/text/widorp.cxx22
1 files changed, 21 insertions, 1 deletions
diff --git a/sw/source/core/text/widorp.cxx b/sw/source/core/text/widorp.cxx
index 11e8c7aa658b..322bdab3797e 100644
--- a/sw/source/core/text/widorp.cxx
+++ b/sw/source/core/text/widorp.cxx
@@ -37,6 +37,10 @@
#include "itrtxt.hxx"
#include "sectfrm.hxx"
#include "ftnfrm.hxx"
+#include "rootfrm.hxx"
+#include "viewopt.hxx"
+#include "pagefrm.hxx"
+#include "fmtfsize.hxx"
#undef WIDOWTWIPS
@@ -126,8 +130,24 @@ bool SwTextFrameBreak::IsInside( SwTextMargin &rLine ) const
// The Frame has a height to fit on the page.
SwTwips nHeight =
(*fnRect->fnYDiff)( (m_pFrame->GetUpper()->*fnRect->fnGetPrtBottom)(), m_nOrigin );
+ SwTwips nDiff = nHeight - nLineHeight;
+
+ SwViewShell* pShell = m_pFrame->getRootFrame()->GetCurrShell();
+ if (pShell && pShell->GetViewOptions()->IsWhitespaceHidden())
+ {
+ if (nDiff < 0)
+ {
+ SwPageFrame* pPageFrame = m_pFrame->FindPageFrame();
+ const SwFrameFormat* pPageFormat = static_cast<const SwFrameFormat*>(pPageFrame->GetRegisteredIn());
+ const Size& rPageSize = pPageFormat->GetFrameSize().GetSize();
+ long nWhitespace = rPageSize.getHeight() - pPageFrame->Frame().Height();
+ if (nWhitespace > -nDiff)
+ nDiff = 0;
+ }
+ }
+
// If everything is inside the existing frame the result is true;
- bFit = nHeight >= nLineHeight;
+ bFit = nDiff >= 0;
// --> OD #i103292#
if ( !bFit )