sw/source/core/inc/frmtool.hxx | 5 ----- sw/source/core/layout/frmtool.cxx | 10 ++++------ sw/source/core/layout/paintfrm.cxx | 18 +++++------------- sw/source/core/layout/ssfrm.cxx | 4 ++-- 4 files changed, 11 insertions(+), 26 deletions(-)
New commits: commit 8f30759a540c0b323b2fb6d873abd67f37da2ca2 Author: Justin Luth <justin_l...@sil.org> AuthorDate: Tue Oct 2 21:32:56 2018 +0300 Commit: Justin Luth <justin_l...@sil.org> CommitDate: Wed Oct 3 06:54:51 2018 +0200 tdf#41542 sw cleanup: m_bBorderDist was always true This was forced to True in LO 5.4, leaving the variable intact in case any problems arose that would make it easier to revert. But now it is time to clean it up and remove the unnecessary logic. I didn't change the indenting because I don't like obscuring the significant changes. I can do that in a followup commit. Change-Id: Iab04a6a8f4ba8ff7151cf7941f655173136258eb Reviewed-on: https://gerrit.libreoffice.org/61270 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_l...@sil.org> diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx index 55aa3f2c94a1..03888c4039df 100644 --- a/sw/source/core/inc/frmtool.hxx +++ b/sw/source/core/inc/frmtool.hxx @@ -281,9 +281,6 @@ class SwBorderAttrs : public SwCacheObj const SvxShadowItem &m_rShadow; const Size m_aFrameSize; - // Is it a frame that can have a margin without a border? - bool m_bBorderDist : 1; - // the following bool values set the cached values to INVALID - until they // are calculated for the first time bool m_bTopLine : 1; @@ -374,8 +371,6 @@ public: const Size &GetSize() const { return m_aFrameSize; } - bool IsBorderDist() const { return m_bBorderDist; } - // Should upper (or lower) border be evaluated for this frame? // #i25029# - If <_pPrevFrame> is set, its value is taken for testing, if // borders/shadow have to be joined with previous frame. diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index d2c3c6c6da94..88d7a4e38e2c 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -1975,8 +1975,6 @@ SwBorderAttrs::SwBorderAttrs(const SwModify *pMod, const SwFrame *pConstructor) // and <m_bJoinedWithNext>, which aren't initialized by default. m_bCachedJoinedWithPrev = false; m_bCachedJoinedWithNext = false; - - m_bBorderDist = true; } SwBorderAttrs::~SwBorderAttrs() @@ -2102,28 +2100,28 @@ long SwBorderAttrs::CalcLeft( const SwFrame *pCaller ) const void SwBorderAttrs::CalcTopLine_() { - m_nTopLine = m_rBox.CalcLineSpace( SvxBoxItemLine::TOP, /*bEvenIfNoLine*/m_bBorderDist ); + m_nTopLine = m_rBox.CalcLineSpace( SvxBoxItemLine::TOP, /*bEvenIfNoLine*/true ); m_nTopLine = m_nTopLine + m_rShadow.CalcShadowSpace(SvxShadowItemSide::TOP); m_bTopLine = false; } void SwBorderAttrs::CalcBottomLine_() { - m_nBottomLine = m_rBox.CalcLineSpace( SvxBoxItemLine::BOTTOM, m_bBorderDist ); + m_nBottomLine = m_rBox.CalcLineSpace( SvxBoxItemLine::BOTTOM, true ); m_nBottomLine = m_nBottomLine + m_rShadow.CalcShadowSpace(SvxShadowItemSide::BOTTOM); m_bBottomLine = false; } void SwBorderAttrs::CalcLeftLine_() { - m_nLeftLine = m_rBox.CalcLineSpace( SvxBoxItemLine::LEFT, m_bBorderDist ); + m_nLeftLine = m_rBox.CalcLineSpace( SvxBoxItemLine::LEFT, true); m_nLeftLine = m_nLeftLine + m_rShadow.CalcShadowSpace(SvxShadowItemSide::LEFT); m_bLeftLine = false; } void SwBorderAttrs::CalcRightLine_() { - m_nRightLine = m_rBox.CalcLineSpace( SvxBoxItemLine::RIGHT, m_bBorderDist ); + m_nRightLine = m_rBox.CalcLineSpace( SvxBoxItemLine::RIGHT, true ); m_nRightLine = m_nRightLine + m_rShadow.CalcShadowSpace(SvxShadowItemSide::RIGHT); m_bRightLine = false; } diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 57243e777ef1..098cc26ef718 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -1246,8 +1246,6 @@ static void lcl_CalcBorderRect( SwRect &rRect, const SwFrame *pFrame, rRect = pFrame->getFramePrintArea(); rRect.Pos() += pFrame->getFrameArea().Pos(); - if ( rAttrs.IsLine() || rAttrs.IsBorderDist() || - (bShadow && rAttrs.GetShadow().GetLocation() != SvxShadowLocation::NONE) ) { SwRectFn fnRect = pFrame->IsVertical() ? ( pFrame->IsVertLR() ? fnRectVertL2R : fnRectVert ) : fnRectHori; @@ -1257,9 +1255,7 @@ static void lcl_CalcBorderRect( SwRect &rRect, const SwFrame *pFrame, { SwTwips nDiff = rBox.GetTop() ? rBox.CalcLineSpace( SvxBoxItemLine::TOP ) : - ( rAttrs.IsBorderDist() ? - // Increase of distance by one twip is incorrect. - rBox.GetDistance( SvxBoxItemLine::TOP ) : 0 ); + rBox.GetDistance( SvxBoxItemLine::TOP ); if( nDiff ) (rRect.*fnRect->fnSubTop)( nDiff ); } @@ -1279,10 +1275,8 @@ static void lcl_CalcBorderRect( SwRect &rRect, const SwFrame *pFrame, else { nDiff = rBox.GetBottom() ? - rBox.CalcLineSpace( SvxBoxItemLine::BOTTOM ) : - ( rAttrs.IsBorderDist() ? - // Increase of distance by one twip is incorrect. - rBox.GetDistance( SvxBoxItemLine::BOTTOM ) : 0 ); + rBox.CalcLineSpace( SvxBoxItemLine::BOTTOM ) : + rBox.GetDistance( SvxBoxItemLine::BOTTOM ); } if( nDiff ) (rRect.*fnRect->fnAddBottom)( nDiff ); @@ -1290,14 +1284,12 @@ static void lcl_CalcBorderRect( SwRect &rRect, const SwFrame *pFrame, if ( rBox.GetLeft() ) (rRect.*fnRect->fnSubLeft)( rBox.CalcLineSpace( SvxBoxItemLine::LEFT ) ); - else if ( rAttrs.IsBorderDist() ) - // Increase of distance by one twip is incorrect. + else (rRect.*fnRect->fnSubLeft)( rBox.GetDistance( SvxBoxItemLine::LEFT ) ); if ( rBox.GetRight() ) (rRect.*fnRect->fnAddRight)( rBox.CalcLineSpace( SvxBoxItemLine::RIGHT ) ); - else if ( rAttrs.IsBorderDist() ) - // Increase of distance by one twip is incorrect. + else (rRect.*fnRect->fnAddRight)( rBox.GetDistance( SvxBoxItemLine::RIGHT ) ); if ( bShadow && rAttrs.GetShadow().GetLocation() != SvxShadowLocation::NONE ) diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx index 99d187faa571..8550f4a7f4f6 100644 --- a/sw/source/core/layout/ssfrm.cxx +++ b/sw/source/core/layout/ssfrm.cxx @@ -691,11 +691,11 @@ const SwRect SwFrame::UnionFrame( bool bBorder ) const const SvxBoxItem &rBox = rAttrs.GetBox(); if ( rBox.GetLeft() ) nLeft -= rBox.CalcLineSpace( SvxBoxItemLine::LEFT ); - else if ( rAttrs.IsBorderDist() ) + else nLeft -= rBox.GetDistance( SvxBoxItemLine::LEFT ) + 1; if ( rBox.GetRight() ) nAdd += rBox.CalcLineSpace( SvxBoxItemLine::RIGHT ); - else if ( rAttrs.IsBorderDist() ) + else nAdd += rBox.GetDistance( SvxBoxItemLine::RIGHT ) + 1; if( rAttrs.GetShadow().GetLocation() != SvxShadowLocation::NONE ) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits