summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-12-16 09:49:18 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-12-16 10:09:12 +0100
commit2c23d4ee1e1370b20560e47db7efaeaac1d94b26 (patch)
tree9ba748d213897efe935bb4493e9dacd6325784f2 /sw/source/core
parentd0cf72f253a3cb8335601ebf2c5b1b99ab63e6b1 (diff)
tdf#96515 sw Hide Whitespace: avoid creating unneeded page frames
Change-Id: I9b273543ccf2eaa87116c6e1475860e9e872c445
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/layout/calcmove.cxx29
1 files changed, 28 insertions, 1 deletions
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index cac6574158d9..922041702f1e 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -1520,7 +1520,34 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/)
// Bottom(). This might happen with undersized TextFrames on the lower edge of a
// multi-column section
const long nPrtBottom = (GetUpper()->*fnRect->fnGetPrtBottom)();
- const long nBottomDist = (Frame().*fnRect->fnBottomDist)( nPrtBottom );
+ long nBottomDist = (Frame().*fnRect->fnBottomDist)(nPrtBottom);
+
+ if (getRootFrame()->GetCurrShell()->GetViewOptions()->IsWhitespaceHidden())
+ {
+ // When whitespace is hidden, the page frame has two heights: the
+ // nominal (defined by the frame format), and the actual (which is
+ // at most the nominal height, but can be smaller in case there is
+ // no content for the whole page).
+ // The layout size is the actual one, but we want to move the
+ // content frame to a new page only in case it doesn't fit the
+ // nominal size.
+ if (nBottomDist < 0)
+ {
+ // Content frame doesn't fit the actual size, check if it fits the nominal one.
+ SwPageFrame* pPageFrame = 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 > -nBottomDist)
+ {
+ // It does: don't move it and invalidate our page frame so
+ // that it gets a larger height.
+ nBottomDist = 0;
+ pPageFrame->InvalidateSize();
+ }
+ }
+ }
+
if( nBottomDist >= 0 )
{
if ( bKeep && bMoveable )