Kaydet (Commit) f05da45c authored tarafından Ashod Nakashian's avatar Ashod Nakashian Kaydeden (comit) Caolán McNamara

SwPageFrm::MakeAll Refactored

Browser and Hide Whitespace page height now use
SwPageFrm::GetContentHeight, which is const.

A few improvements are done for both paths as well.

Change-Id: I73a8e920ccfa96d76cbbb002bed6a85f2e636ede
Reviewed-on: https://gerrit.libreoffice.org/19730Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 910c31ab
...@@ -111,7 +111,7 @@ protected: ...@@ -111,7 +111,7 @@ protected:
virtual void SwClientNotify(const SwModify&, const SfxHint&) override; virtual void SwClientNotify(const SwModify&, const SfxHint&) override;
/// Calculate the content height of a page (without columns). /// Calculate the content height of a page (without columns).
size_t GetContentHeight(); size_t GetContentHeight(const long nTop, const long nBottom) const;
public: public:
DECL_FIXEDMEMPOOL_NEWDEL(SwPageFrm) DECL_FIXEDMEMPOOL_NEWDEL(SwPageFrm)
......
...@@ -116,15 +116,20 @@ public: ...@@ -116,15 +116,20 @@ public:
bool CalcMinDiff( SwTwips& rMinDiff ) const; bool CalcMinDiff( SwTwips& rMinDiff ) const;
/** /**
* If we don't pass a @param bOverSize or false, the return value is > 0 for * Returns the size delta that the section would like to be
* undersized Frames, or 0 * greater if it has undersized TextFrms in it.
* *
* If we don't pass a @param bOverSize or false, the return value
* is > 0 for undersized Frames, or 0 otherwise.
* If @param bOverSize == true, we can also get a negative return value, * If @param bOverSize == true, we can also get a negative return value,
* if the SectionFrm is not completely filled, which happens often for * if the SectionFrm is not completely filled, which happens often for
* e.g. SectionFrms with Follows. * e.g. SectionFrms with Follows.
*
* If necessary the undersized-flag is corrected.
* We need this in the FormatWidthCols to "deflate" columns there. * We need this in the FormatWidthCols to "deflate" columns there.
*/ */
long Undersize( bool bOverSize = false ); SwTwips Undersize(bool bOverSize = false);
SwTwips Undersize() const;
/// Adapt size to surroundings /// Adapt size to surroundings
void _CheckClipping( bool bGrow, bool bMaximize ); void _CheckClipping( bool bGrow, bool bMaximize );
......
...@@ -2492,21 +2492,18 @@ void SwSectionFrm::InvalidateFootnotePos() ...@@ -2492,21 +2492,18 @@ void SwSectionFrm::InvalidateFootnotePos()
} }
} }
/** Returns the value that the section would like to be SwTwips SwSectionFrm::Undersize() const
* greater if it has undersized TextFrms in it,
* otherwise Null.
* If necessary the undersized-flag is corrected.
*/
long SwSectionFrm::Undersize( bool bOverSize )
{ {
m_bUndersized = false; SWRECTFN(this);
SWRECTFN( this ) return InnerHeight() - (Prt().*fnRect->fnGetHeight)();
long nRet = InnerHeight() - (Prt().*fnRect->fnGetHeight)(); }
if( nRet > 0 )
m_bUndersized = true; SwTwips SwSectionFrm::Undersize(bool bOverSize)
else if( !bOverSize ) {
nRet = 0; SWRECTFN(this);
return nRet; const auto nRet = InnerHeight() - (Prt().*fnRect->fnGetHeight)();
m_bUndersized = (nRet > 0);
return (nRet <= 0 && !bOverSize) ? 0 : nRet;
} }
void SwSectionFrm::CalcFootnoteContent() void SwSectionFrm::CalcFootnoteContent()
......
...@@ -2938,7 +2938,7 @@ void SwLayoutFrm::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder ...@@ -2938,7 +2938,7 @@ void SwLayoutFrm::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder
const sal_uInt16 nRight = (sal_uInt16)pAttrs->CalcRight(this); const sal_uInt16 nRight = (sal_uInt16)pAttrs->CalcRight(this);
const sal_uInt16 nLower = pAttrs->CalcBottom(); const sal_uInt16 nLower = pAttrs->CalcBottom();
bool bVert = IsVertical() && !IsPageFrm(); const bool bVert = IsVertical() && !IsPageFrm();
SwRectFn fnRect = bVert ? ( IsVertLR() ? fnRectVertL2R : fnRectVert ) : fnRectHori; SwRectFn fnRect = bVert ? ( IsVertLR() ? fnRectVertL2R : fnRectVert ) : fnRectHori;
if ( !mbValidPrtArea ) if ( !mbValidPrtArea )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment