diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/inc/pagefrm.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/layout/calcmove.cxx | 32 | ||||
-rw-r--r-- | sw/source/core/layout/pagechg.cxx | 28 | ||||
-rw-r--r-- | sw/source/core/text/widorp.cxx | 19 |
4 files changed, 40 insertions, 42 deletions
diff --git a/sw/source/core/inc/pagefrm.hxx b/sw/source/core/inc/pagefrm.hxx index 840c580ff382..2df4c1d58a37 100644 --- a/sw/source/core/inc/pagefrm.hxx +++ b/sw/source/core/inc/pagefrm.hxx @@ -334,6 +334,9 @@ public: static const vcl::Font& GetEmptyPageFont(); static SwTwips GetSidebarBorderWidth( const SwViewShell* ); + + /// Adjust a bottom-of-page-frame - bottom-of-text-frame difference in case whitespace is hidden. + void HandleWhitespaceHiddenDiff(SwTwips& nDiff); }; inline SwContentFrame *SwPageFrame::FindFirstBodyContent() diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index 21d479a79131..84daf90e8c5b 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -1522,32 +1522,12 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) const long nPrtBottom = (GetUpper()->*fnRect->fnGetPrtBottom)(); long nBottomDist = (Frame().*fnRect->fnBottomDist)(nPrtBottom); - SwViewShell* pShell = getRootFrame()->GetCurrShell(); - if (pShell && pShell->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(); - } - } - } + // Hide whitespace may require not to insert a new page. + SwPageFrame* pPageFrame = FindPageFrame(); + long nOldBottomDist = nBottomDist; + pPageFrame->HandleWhitespaceHiddenDiff(nBottomDist); + if (nOldBottomDist != nBottomDist) + pPageFrame->InvalidateSize(); if( nBottomDist >= 0 ) { diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index 34adb7a7ea4f..967ee2fe5305 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -2287,6 +2287,34 @@ bool SwPageFrame::IsOverHeaderFooterArea( const Point& rPt, FrameControlType &rC return false; } +void SwPageFrame::HandleWhitespaceHiddenDiff(SwTwips& nDiff) +{ + SwViewShell* pShell = getRootFrame()->GetCurrShell(); + if (pShell && pShell->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 (nDiff < 0) + { + // Content frame doesn't fit the actual size, check if it fits the nominal one. + const SwFrameFormat* pPageFormat = static_cast<const SwFrameFormat*>(GetRegisteredIn()); + const Size& rPageSize = pPageFormat->GetFrameSize().GetSize(); + long nWhitespace = rPageSize.getHeight() - Frame().Height(); + if (nWhitespace > -nDiff) + { + // It does: don't move it and invalidate our page frame so + // that it gets a larger height. + nDiff = 0; + } + } + } +} + SwTextGridItem const* GetGridItem(SwPageFrame const*const pPage) { if (pPage && pPage->HasGrid()) diff --git a/sw/source/core/text/widorp.cxx b/sw/source/core/text/widorp.cxx index 322bdab3797e..c75a9586ef19 100644 --- a/sw/source/core/text/widorp.cxx +++ b/sw/source/core/text/widorp.cxx @@ -37,10 +37,7 @@ #include "itrtxt.hxx" #include "sectfrm.hxx" #include "ftnfrm.hxx" -#include "rootfrm.hxx" -#include "viewopt.hxx" #include "pagefrm.hxx" -#include "fmtfsize.hxx" #undef WIDOWTWIPS @@ -132,19 +129,9 @@ bool SwTextFrameBreak::IsInside( SwTextMargin &rLine ) const (*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; - } - } + // Hide whitespace may require not to insert a new page. + SwPageFrame* pPageFrame = m_pFrame->FindPageFrame(); + pPageFrame->HandleWhitespaceHiddenDiff(nDiff); // If everything is inside the existing frame the result is true; bFit = nDiff >= 0; |