sw/source/core/doc/tblrwcl.cxx | 4 sw/source/core/docnode/ndtbl.cxx | 68 - sw/source/core/docnode/ndtbl1.cxx | 32 sw/source/core/frmedt/fetab.cxx | 66 - sw/source/core/frmedt/fews.cxx | 52 - sw/source/core/frmedt/tblsel.cxx | 122 +- sw/source/core/inc/frame.hxx | 59 - sw/source/core/layout/anchoreddrawobject.cxx | 4 sw/source/core/layout/anchoredobject.cxx | 18 sw/source/core/layout/calcmove.cxx | 160 +-- sw/source/core/layout/flowfrm.cxx | 26 sw/source/core/layout/fly.cxx | 96 +- sw/source/core/layout/flycnt.cxx | 14 sw/source/core/layout/flyincnt.cxx | 4 sw/source/core/layout/flylay.cxx | 80 - sw/source/core/layout/frmtool.cxx | 60 - sw/source/core/layout/ftnfrm.cxx | 100 +- sw/source/core/layout/layact.cxx | 52 - sw/source/core/layout/layouter.cxx | 6 sw/source/core/layout/pagechg.cxx | 14 sw/source/core/layout/paintfrm.cxx | 34 sw/source/core/layout/sectfrm.cxx | 194 ++-- sw/source/core/layout/tabfrm.cxx | 412 +++++----- sw/source/core/layout/trvlfrm.cxx | 205 ++-- sw/source/core/layout/wsfrm.cxx | 187 ++-- sw/source/core/objectpositioning/anchoredobjectposition.cxx | 130 +-- sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx | 8 sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx | 158 +-- sw/source/core/objectpositioning/tolayoutanchoredobjectposition.cxx | 16 sw/source/core/text/EnhancedPDFExportHelper.cxx | 22 sw/source/core/text/frmcrsr.cxx | 84 +- sw/source/core/text/frmform.cxx | 86 +- sw/source/core/text/frminf.cxx | 14 sw/source/core/text/itratr.cxx | 6 sw/source/core/text/itrcrsr.cxx | 14 sw/source/core/text/itrform2.cxx | 28 sw/source/core/text/porrst.cxx | 10 sw/source/core/text/txtfly.cxx | 128 +-- sw/source/core/text/txtfrm.cxx | 84 +- sw/source/core/text/txtftn.cxx | 54 - sw/source/core/text/widorp.cxx | 44 - sw/source/core/txtnode/txtedt.cxx | 52 - 42 files changed, 1506 insertions(+), 1501 deletions(-)
New commits: commit 6bdcb730faa5b996882b4648b86b7caf93b8f421 Author: Mike Kaganski <mike.kagan...@collabora.com> Date: Tue Sep 20 20:51:54 2016 +0300 Replace SWRECTFN macro with a class Change-Id: Ib400c5930be84d26665b0e12a61508c8fbfd7f08 Reviewed-on: https://gerrit.libreoffice.org/29105 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index e0f13cc..8dd4f4b 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -1073,8 +1073,8 @@ bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn SwTableBox* pSelBox = rBoxes[n]; const SwRowFrame* pRow = GetRowFrame( *pSelBox->GetUpper() ); OSL_ENSURE( pRow, "Where is the SwTableLine's Frame?" ); - SWRECTFN( pRow ) - pRowHeights[ n ] = (pRow->Frame().*fnRect->fnGetHeight)(); + SwRectFnSet aRectFnSet(pRow); + pRowHeights[ n ] = (pRow->Frame().*aRectFnSet->fnGetHeight)(); } } diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 936a5b5..eb15585a 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -2532,16 +2532,16 @@ void SwDoc::GetTabCols( SwTabCols &rFill, const SwCursor* pCursor, } // Set fixed points, LeftMin in Document coordinates, all others relative - SWRECTFN( pTab ) + SwRectFnSet aRectFnSet(pTab); const SwPageFrame* pPage = pTab->FindPageFrame(); - const sal_uLong nLeftMin = (pTab->Frame().*fnRect->fnGetLeft)() - - (pPage->Frame().*fnRect->fnGetLeft)(); - const sal_uLong nRightMax = (pTab->Frame().*fnRect->fnGetRight)() - - (pPage->Frame().*fnRect->fnGetLeft)(); + const sal_uLong nLeftMin = (pTab->Frame().*aRectFnSet->fnGetLeft)() - + (pPage->Frame().*aRectFnSet->fnGetLeft)(); + const sal_uLong nRightMax = (pTab->Frame().*aRectFnSet->fnGetRight)() - + (pPage->Frame().*aRectFnSet->fnGetLeft)(); rFill.SetLeftMin ( nLeftMin ); - rFill.SetLeft ( (pTab->Prt().*fnRect->fnGetLeft)() ); - rFill.SetRight ( (pTab->Prt().*fnRect->fnGetRight)()); + rFill.SetLeft ( (pTab->Prt().*aRectFnSet->fnGetLeft)() ); + rFill.SetRight ( (pTab->Prt().*aRectFnSet->fnGetRight)()); rFill.SetRightMax( nRightMax - nLeftMin ); pTab->GetTable()->GetTabCols( rFill, pBox ); @@ -2611,14 +2611,14 @@ void SwDoc::GetTabRows( SwTabCols &rFill, const SwCursor* , const SwFrame* pFrame = pTab->GetNextLayoutLeaf(); // Set fixed points, LeftMin in Document coordinates, all others relative - SWRECTFN( pTab ) + SwRectFnSet aRectFnSet(pTab); const SwPageFrame* pPage = pTab->FindPageFrame(); - const long nLeftMin = ( bVert ? + const long nLeftMin = ( aRectFnSet.bVert ? pTab->GetPrtLeft() - pPage->Frame().Left() : pTab->GetPrtTop() - pPage->Frame().Top() ); - const long nLeft = bVert ? LONG_MAX : 0; - const long nRight = (pTab->Prt().*fnRect->fnGetHeight)(); - const long nRightMax = bVert ? nRight : LONG_MAX; + const long nLeft = aRectFnSet.bVert ? LONG_MAX : 0; + const long nRight = (pTab->Prt().*aRectFnSet->fnGetHeight)(); + const long nRightMax = aRectFnSet.bVert ? nRight : LONG_MAX; rFill.SetLeftMin( nLeftMin ); rFill.SetLeft( nLeft ); @@ -2639,8 +2639,8 @@ void SwDoc::GetTabRows( SwTabCols &rFill, const SwCursor* , if ( pFrame->IsCellFrame() && pFrame->FindTabFrame() == pTab ) { // upper and lower borders of current cell frame: - long nUpperBorder = (pFrame->Frame().*fnRect->fnGetTop)(); - long nLowerBorder = (pFrame->Frame().*fnRect->fnGetBottom)(); + long nUpperBorder = (pFrame->Frame().*aRectFnSet->fnGetTop)(); + long nLowerBorder = (pFrame->Frame().*aRectFnSet->fnGetBottom)(); // get boundaries for nUpperBorder: aIter = aBoundaries.find( nUpperBorder ); @@ -2688,10 +2688,10 @@ void SwDoc::GetTabRows( SwTabCols &rFill, const SwCursor* , size_t nIdx = 0; for ( aIter = aBoundaries.begin(); aIter != aBoundaries.end(); ++aIter ) { - const long nTabTop = (pTab->*fnRect->fnGetPrtTop)(); - const long nKey = (*fnRect->fnYDiff)( (*aIter).first, nTabTop ); + const long nTabTop = (pTab->*aRectFnSet->fnGetPrtTop)(); + const long nKey = (*aRectFnSet->fnYDiff)( (*aIter).first, nTabTop ); const std::pair< long, long > aTmpPair = (*aIter).second; - const long nFirst = (*fnRect->fnYDiff)( aTmpPair.first, nTabTop ); + const long nFirst = (*aRectFnSet->fnYDiff)( aTmpPair.first, nTabTop ); const long nSecond = aTmpPair.second; aHiddenIter = aHidden.find( (*aIter).first ); @@ -2729,11 +2729,11 @@ void SwDoc::SetTabCols( const SwTabCols &rNew, bool bCurRowOnly, // we need to switch to absolute ones. SwTable& rTab = *pTab->GetTable(); const SwFormatFrameSize& rTableFrameSz = rTab.GetFrameFormat()->GetFrameSize(); - SWRECTFN( pTab ) + SwRectFnSet aRectFnSet(pTab); // #i17174# - With fix for #i9040# the shadow size is taken // from the table width. Thus, add its left and right size to current table // printing area width in order to get the correct table size attribute. - SwTwips nPrtWidth = (pTab->Prt().*fnRect->fnGetWidth)(); + SwTwips nPrtWidth = (pTab->Prt().*aRectFnSet->fnGetWidth)(); { SvxShadowItem aShadow( rTab.GetFrameFormat()->GetShadow() ); nPrtWidth += aShadow.CalcShadowSpace( SvxShadowItemSide::LEFT ) + @@ -2749,15 +2749,15 @@ void SwDoc::SetTabCols( const SwTabCols &rNew, bool bCurRowOnly, SwTabCols aOld( rNew.Count() ); const SwPageFrame* pPage = pTab->FindPageFrame(); - const sal_uLong nLeftMin = (pTab->Frame().*fnRect->fnGetLeft)() - - (pPage->Frame().*fnRect->fnGetLeft)(); - const sal_uLong nRightMax = (pTab->Frame().*fnRect->fnGetRight)() - - (pPage->Frame().*fnRect->fnGetLeft)(); + const sal_uLong nLeftMin = (pTab->Frame().*aRectFnSet->fnGetLeft)() - + (pPage->Frame().*aRectFnSet->fnGetLeft)(); + const sal_uLong nRightMax = (pTab->Frame().*aRectFnSet->fnGetRight)() - + (pPage->Frame().*aRectFnSet->fnGetLeft)(); // Set fixed points, LeftMin in Document coordinates, all others relative aOld.SetLeftMin ( nLeftMin ); - aOld.SetLeft ( (pTab->Prt().*fnRect->fnGetLeft)() ); - aOld.SetRight ( (pTab->Prt().*fnRect->fnGetRight)()); + aOld.SetLeft ( (pTab->Prt().*aRectFnSet->fnGetLeft)() ); + aOld.SetRight ( (pTab->Prt().*aRectFnSet->fnGetRight)()); aOld.SetRightMax( nRightMax - nLeftMin ); rTab.GetTabCols( aOld, pBox ); @@ -2775,15 +2775,15 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, bool bCurColOnly, // If the Table is still using relative values (USHRT_MAX) // we need to switch to absolute ones. - SWRECTFN( pTab ) + SwRectFnSet aRectFnSet(pTab); SwTabCols aOld( rNew.Count() ); // Set fixed points, LeftMin in Document coordinates, all others relative const SwPageFrame* pPage = pTab->FindPageFrame(); - aOld.SetRight( (pTab->Prt().*fnRect->fnGetHeight)() ); + aOld.SetRight( (pTab->Prt().*aRectFnSet->fnGetHeight)() ); long nLeftMin; - if ( bVert ) + if ( aRectFnSet.bVert ) { nLeftMin = pTab->GetPrtLeft() - pPage->Frame().Left(); aOld.SetLeft ( LONG_MAX ); @@ -2809,8 +2809,8 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, bool bCurColOnly, for ( size_t i = 0; i <= nCount; ++i ) { - const size_t nIdxStt = bVert ? nCount - i : i - 1; - const size_t nIdxEnd = bVert ? nCount - i - 1 : i; + const size_t nIdxStt = aRectFnSet.bVert ? nCount - i : i - 1; + const size_t nIdxEnd = aRectFnSet.bVert ? nCount - i - 1 : i; const long nOldRowStart = i == 0 ? 0 : aOld[ nIdxStt ]; const long nOldRowEnd = i == nCount ? aOld.GetRight() : aOld[ nIdxEnd ]; @@ -2837,9 +2837,9 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, bool bCurColOnly, { if ( pFrame->IsCellFrame() && pFrame->FindTabFrame() == pTab ) { - const long nLowerBorder = (pFrame->Frame().*fnRect->fnGetBottom)(); - const sal_uLong nTabTop = (pTab->*fnRect->fnGetPrtTop)(); - if ( std::abs( (*fnRect->fnYInc)( nTabTop, nOldRowEnd ) - nLowerBorder ) <= ROWFUZZY ) + const long nLowerBorder = (pFrame->Frame().*aRectFnSet->fnGetBottom)(); + const sal_uLong nTabTop = (pTab->*aRectFnSet->fnGetPrtTop)(); + if ( std::abs( (*aRectFnSet->fnYInc)( nTabTop, nOldRowEnd ) - nLowerBorder ) <= ROWFUZZY ) { if ( !bCurColOnly || pFrame == pBoxFrame ) { @@ -2857,7 +2857,7 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, bool bCurColOnly, { // The new row height must not to be calculated from a overlapping box SwFormatFrameSize aNew( pLine->GetFrameFormat()->GetFrameSize() ); - const long nNewSize = (pFrame->Frame().*fnRect->fnGetHeight)() + nDiff; + const long nNewSize = (pFrame->Frame().*aRectFnSet->fnGetHeight)() + nDiff; if( nNewSize != aNew.GetHeight() ) { aNew.SetHeight( nNewSize ); diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index 7d728a2..15f146c 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -1272,23 +1272,23 @@ static sal_uInt16 lcl_CalcCellFit( const SwLayoutFrame *pCell ) { SwTwips nRet = 0; const SwFrame *pFrame = pCell->Lower(); // The whole Line - SWRECTFN( pCell ) + SwRectFnSet aRectFnSet(pCell); while ( pFrame ) { - const SwTwips nAdd = (pFrame->Frame().*fnRect->fnGetWidth)() - - (pFrame->Prt().*fnRect->fnGetWidth)(); + const SwTwips nAdd = (pFrame->Frame().*aRectFnSet->fnGetWidth)() - + (pFrame->Prt().*aRectFnSet->fnGetWidth)(); // pFrame does not necessarily have to be a SwTextFrame! const SwTwips nCalcFitToContent = pFrame->IsTextFrame() ? const_cast<SwTextFrame*>(static_cast<const SwTextFrame*>(pFrame))->CalcFitToContent() : - (pFrame->Prt().*fnRect->fnGetWidth)(); + (pFrame->Prt().*aRectFnSet->fnGetWidth)(); nRet = std::max( nRet, nCalcFitToContent + nAdd ); pFrame = pFrame->GetNext(); } // Surrounding border as well as left and Right Border also need to be respected - nRet += (pCell->Frame().*fnRect->fnGetWidth)() - - (pCell->Prt().*fnRect->fnGetWidth)(); + nRet += (pCell->Frame().*aRectFnSet->fnGetWidth)() - + (pCell->Prt().*aRectFnSet->fnGetWidth)(); // To compensate for the accuracy of calculation later on in SwTable::SetTabCols // we keep adding up a little. @@ -1317,7 +1317,7 @@ static void lcl_CalcSubColValues( std::vector<sal_uInt16> &rToFill, const SwTabC ::lcl_CalcCellFit( pCell ) : MINLAY + sal_uInt16(pCell->Frame().Width() - pCell->Prt().Width()); - SWRECTFN( pTab ) + SwRectFnSet aRectFnSet(pTab); for ( size_t i = 0 ; i <= rCols.Count(); ++i ) { @@ -1327,14 +1327,14 @@ static void lcl_CalcSubColValues( std::vector<sal_uInt16> &rToFill, const SwTabC nColRight += rCols.GetLeftMin(); // Adapt values to the proportions of the Table (Follows) - if ( rCols.GetLeftMin() != (pTab->Frame().*fnRect->fnGetLeft)() ) + if ( rCols.GetLeftMin() != (pTab->Frame().*aRectFnSet->fnGetLeft)() ) { - const long nDiff = (pTab->Frame().*fnRect->fnGetLeft)() - rCols.GetLeftMin(); + const long nDiff = (pTab->Frame().*aRectFnSet->fnGetLeft)() - rCols.GetLeftMin(); nColLeft += nDiff; nColRight += nDiff; } - const long nCellLeft = (pCell->Frame().*fnRect->fnGetLeft)(); - const long nCellRight = (pCell->Frame().*fnRect->fnGetRight)(); + const long nCellLeft = (pCell->Frame().*aRectFnSet->fnGetLeft)(); + const long nCellRight = (pCell->Frame().*aRectFnSet->fnGetRight)(); // Calculate overlapping value long nWidth = 0; @@ -1384,7 +1384,7 @@ static void lcl_CalcColValues( std::vector<sal_uInt16> &rToFill, const SwTabCols const SwTabFrame *pTab = pSelUnion->GetTable(); const SwRect &rUnion = pSelUnion->GetUnion(); - SWRECTFN( pTab ) + SwRectFnSet aRectFnSet(pTab); bool bRTL = pTab->IsRightToLeft(); const SwLayoutFrame *pCell = pTab->FirstCell(); @@ -1394,8 +1394,8 @@ static void lcl_CalcColValues( std::vector<sal_uInt16> &rToFill, const SwTabCols { if ( pCell->IsCellFrame() && pCell->FindTabFrame() == pTab && ::IsFrameInTableSel( rUnion, pCell ) ) { - const long nCLeft = (pCell->Frame().*fnRect->fnGetLeft)(); - const long nCRight = (pCell->Frame().*fnRect->fnGetRight)(); + const long nCLeft = (pCell->Frame().*aRectFnSet->fnGetLeft)(); + const long nCRight = (pCell->Frame().*aRectFnSet->fnGetRight)(); bool bNotInCols = true; @@ -1418,9 +1418,9 @@ static void lcl_CalcColValues( std::vector<sal_uInt16> &rToFill, const SwTabCols // Adapt values to the proportions of the Table (Follows) long nLeftA = nColLeft; long nRightA = nColRight; - if ( rCols.GetLeftMin() != sal_uInt16((pTab->Frame().*fnRect->fnGetLeft)()) ) + if ( rCols.GetLeftMin() != sal_uInt16((pTab->Frame().*aRectFnSet->fnGetLeft)()) ) { - const long nDiff = (pTab->Frame().*fnRect->fnGetLeft)() - rCols.GetLeftMin(); + const long nDiff = (pTab->Frame().*aRectFnSet->fnGetLeft)() - rCols.GetLeftMin(); nLeftA += nDiff; nRightA += nDiff; } diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index cda915d..fddaf6e 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -527,21 +527,21 @@ void SwFEShell::GetTabCols_( SwTabCols &rToFill, const SwFrame *pBox ) const if (g_pColumnCacheLastTable == pTab->GetTable()) { bDel = false; - SWRECTFN( pTab ) + SwRectFnSet aRectFnSet(pTab); const SwPageFrame* pPage = pTab->FindPageFrame(); - const sal_uLong nLeftMin = (pTab->Frame().*fnRect->fnGetLeft)() - - (pPage->Frame().*fnRect->fnGetLeft)(); - const sal_uLong nRightMax = (pTab->Frame().*fnRect->fnGetRight)() - - (pPage->Frame().*fnRect->fnGetLeft)(); + const sal_uLong nLeftMin = (pTab->Frame().*aRectFnSet->fnGetLeft)() - + (pPage->Frame().*aRectFnSet->fnGetLeft)(); + const sal_uLong nRightMax = (pTab->Frame().*aRectFnSet->fnGetRight)() - + (pPage->Frame().*aRectFnSet->fnGetLeft)(); if (g_pColumnCacheLastTabFrame != pTab) { // if TabFrame was changed, we only shift a little bit // as the width is the same - SWRECTFNX( g_pColumnCacheLastTabFrame ) + SwRectFnSet fnRectX(g_pColumnCacheLastTabFrame); if ((g_pColumnCacheLastTabFrame->Frame().*fnRectX->fnGetWidth)() == - (pTab->Frame().*fnRect->fnGetWidth)() ) + (pTab->Frame().*aRectFnSet->fnGetWidth)() ) { pLastCols->SetLeftMin( nLeftMin ); @@ -553,8 +553,8 @@ void SwFEShell::GetTabCols_( SwTabCols &rToFill, const SwFrame *pBox ) const if ( !bDel && pLastCols->GetLeftMin () == (sal_uInt16)nLeftMin && - pLastCols->GetLeft () == (sal_uInt16)(pTab->Prt().*fnRect->fnGetLeft)() && - pLastCols->GetRight () == (sal_uInt16)(pTab->Prt().*fnRect->fnGetRight)()&& + pLastCols->GetLeft () == (sal_uInt16)(pTab->Prt().*aRectFnSet->fnGetLeft)() && + pLastCols->GetRight () == (sal_uInt16)(pTab->Prt().*aRectFnSet->fnGetRight)()&& pLastCols->GetRightMax() == (sal_uInt16)nRightMax - pLastCols->GetLeftMin() ) { if (g_pColumnCacheLastCellFrame != pBox) @@ -600,14 +600,14 @@ void SwFEShell::GetTabRows_( SwTabCols &rToFill, const SwFrame *pBox ) const if (g_pRowCacheLastTable == pTab->GetTable()) { bDel = false; - SWRECTFN( pTab ) + SwRectFnSet aRectFnSet(pTab); const SwPageFrame* pPage = pTab->FindPageFrame(); - const long nLeftMin = ( bVert ? + const long nLeftMin = ( aRectFnSet.bVert ? pTab->GetPrtLeft() - pPage->Frame().Left() : pTab->GetPrtTop() - pPage->Frame().Top() ); - const long nLeft = bVert ? LONG_MAX : 0; - const long nRight = (pTab->Prt().*fnRect->fnGetHeight)(); - const long nRightMax = bVert ? nRight : LONG_MAX; + const long nLeft = aRectFnSet.bVert ? LONG_MAX : 0; + const long nRight = (pTab->Prt().*aRectFnSet->fnGetHeight)(); + const long nRightMax = aRectFnSet.bVert ? nRight : LONG_MAX; if (g_pRowCacheLastTabFrame != pTab || g_pRowCacheLastCellFrame != pBox) bDel = true; @@ -1358,7 +1358,7 @@ size_t SwFEShell::GetCurTabColNum() const size_t nRet = 0; - SWRECTFN( pFrame ) + SwRectFnSet aRectFnSet(pFrame); const SwPageFrame* pPage = pFrame->FindPageFrame(); @@ -1368,7 +1368,7 @@ size_t SwFEShell::GetCurTabColNum() const if( pFrame->FindTabFrame()->IsRightToLeft() ) { - long nX = (pFrame->Frame().*fnRect->fnGetRight)() - (pPage->Frame().*fnRect->fnGetLeft)(); + long nX = (pFrame->Frame().*aRectFnSet->fnGetRight)() - (pPage->Frame().*aRectFnSet->fnGetLeft)(); const long nRight = aTabCols.GetLeftMin() + aTabCols.GetRight(); @@ -1385,8 +1385,8 @@ size_t SwFEShell::GetCurTabColNum() const } else { - const long nX = (pFrame->Frame().*fnRect->fnGetLeft)() - - (pPage->Frame().*fnRect->fnGetLeft)(); + const long nX = (pFrame->Frame().*aRectFnSet->fnGetLeft)() - + (pPage->Frame().*aRectFnSet->fnGetLeft)(); const long nLeft = aTabCols.GetLeftMin(); @@ -1467,22 +1467,22 @@ static const SwCellFrame *lcl_FindFrame( const SwLayoutFrame *pLay, const Point // We first check if the given point is 'close' to the left or top // border of the table frame: OSL_ENSURE( pFrame, "Nested table frame without outer table" ); - SWRECTFN( pFrame ) + SwRectFnSet aRectFnSet(pFrame); const bool bRTL = pFrame->IsRightToLeft(); SwRect aTabRect = pFrame->Prt(); aTabRect.Pos() += pFrame->Frame().Pos(); const SwTwips nLeft = bRTL ? - (aTabRect.*fnRect->fnGetRight)() : - (aTabRect.*fnRect->fnGetLeft)(); - const SwTwips nTop = (aTabRect.*fnRect->fnGetTop)(); + (aTabRect.*aRectFnSet->fnGetRight)() : + (aTabRect.*aRectFnSet->fnGetLeft)(); + const SwTwips nTop = (aTabRect.*aRectFnSet->fnGetTop)(); - SwTwips& rPointX = bVert ? aPt.Y() : aPt.X(); - SwTwips& rPointY = bVert ? aPt.X() : aPt.Y(); + SwTwips& rPointX = aRectFnSet.bVert ? aPt.Y() : aPt.X(); + SwTwips& rPointY = aRectFnSet.bVert ? aPt.X() : aPt.Y(); - const SwTwips nXDiff = (*fnRect->fnXDiff)( nLeft, rPointX ) * ( bRTL ? (-1) : 1 ); - const SwTwips nYDiff = (*fnRect->fnYDiff)( nTop, rPointY ); + const SwTwips nXDiff = (*aRectFnSet->fnXDiff)( nLeft, rPointX ) * ( bRTL ? (-1) : 1 ); + const SwTwips nYDiff = (*aRectFnSet->fnYDiff)( nTop, rPointY ); bCloseToRow = nXDiff >= 0 && nXDiff < nFuzzy; bCloseToCol = nYDiff >= 0 && nYDiff < nFuzzy; @@ -1506,7 +1506,7 @@ static const SwCellFrame *lcl_FindFrame( const SwLayoutFrame *pLay, const Point // If we found the point to be 'close' to the left or top border // of the table frame, we adjust the point to be on that border: if ( bCloseToRow && bCloseToCol ) - aPt = bRTL ? aTabRect.TopRight() : (aTabRect.*fnRect->fnGetPos)(); + aPt = bRTL ? aTabRect.TopRight() : (aTabRect.*aRectFnSet->fnGetPos)(); else if ( bCloseToRow ) rPointX = nLeft; else if ( bCloseToCol ) @@ -1581,10 +1581,10 @@ static const SwCellFrame *lcl_FindFrame( const SwLayoutFrame *pLay, const Point SwRect aTabRect = pTabFrame->Prt(); aTabRect.Pos() += pTabFrame->Frame().Pos(); - SWRECTFN( pTabFrame ) + SwRectFnSet aRectFnSet(pTabFrame); - const SwTwips nTabTop = (aTabRect.*fnRect->fnGetTop)(); - const SwTwips nMouseTop = bVert ? rPt.X() : rPt.Y(); + const SwTwips nTabTop = (aTabRect.*aRectFnSet->fnGetTop)(); + const SwTwips nMouseTop = aRectFnSet.bVert ? rPt.X() : rPt.Y(); // Do not allow to drag upper table border: if ( !::IsSame( nTabTop, nMouseTop ) ) @@ -2186,8 +2186,8 @@ bool SwFEShell::SetColRowWidthHeight( sal_uInt16 eType, sal_uInt16 nDiff ) // if the table is in relative values (USHRT_MAX) // then it should be recalculated to absolute values now const SwFormatFrameSize& rTableFrameSz = pTab->GetFormat()->GetFrameSize(); - SWRECTFN( pTab ) - long nPrtWidth = (pTab->Prt().*fnRect->fnGetWidth)(); + SwRectFnSet aRectFnSet(pTab); + long nPrtWidth = (pTab->Prt().*aRectFnSet->fnGetWidth)(); if( TBLVAR_CHGABS == pTab->GetTable()->GetTableChgMode() && ( eType & nsTableChgWidthHeightType::WH_COL_LEFT || eType & nsTableChgWidthHeightType::WH_COL_RIGHT ) && text::HoriOrientation::NONE == pTab->GetFormat()->GetHoriOrient().GetHoriOrient() && @@ -2201,7 +2201,7 @@ bool SwFEShell::SetColRowWidthHeight( sal_uInt16 eType, sal_uInt16 nDiff ) if( (eType & (nsTableChgWidthHeightType::WH_FLAG_BIGGER | nsTableChgWidthHeightType::WH_FLAG_INSDEL)) == (nsTableChgWidthHeightType::WH_FLAG_BIGGER | nsTableChgWidthHeightType::WH_FLAG_INSDEL) ) { - nDiff = sal_uInt16((pFrame->Frame().*fnRect->fnGetWidth)()); + nDiff = sal_uInt16((pFrame->Frame().*aRectFnSet->fnGetWidth)()); // we must move the cursor outside the current cell before // deleting the cells. diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx index 29ed7cc..e5cbd3b 100644 --- a/sw/source/core/frmedt/fews.cxx +++ b/sw/source/core/frmedt/fews.cxx @@ -745,17 +745,17 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, if ( !pFrame ) pFrame = pTmp; _orRect = pFrame->Frame(); - SWRECTFN( pFrame ) + SwRectFnSet aRectFnSet(pFrame); bRTL = pFrame->IsRightToLeft(); if ( bRTL ) aPos = pFrame->Frame().TopRight(); else - aPos = (pFrame->Frame().*fnRect->fnGetPos)(); + aPos = (pFrame->Frame().*aRectFnSet->fnGetPos)(); - if( bVert || bVertL2R ) + if( aRectFnSet.bVert || aRectFnSet.bVertL2R ) { - bVertic = bVert; - bVerticalL2R = bVertL2R; + bVertic = aRectFnSet.bVert; + bVerticalL2R = aRectFnSet.bVertL2R; _bMirror = false; // no mirroring in vertical environment switch ( _eHoriRelOrient ) { @@ -805,7 +805,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, } } - if ( bVert && !bVertL2R ) + if ( aRectFnSet.bVert && !aRectFnSet.bVertL2R ) { switch ( _eVertRelOrient ) { @@ -817,7 +817,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, break; } } - else if ( bVertL2R ) + else if ( aRectFnSet.bVertL2R ) { switch ( _eVertRelOrient ) { @@ -856,7 +856,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, { const SwFrame* pUpper = ( pFrame->IsPageFrame() || pFrame->IsFlyFrame() ) ? pFrame : pFrame->GetUpper(); - SWRECTFN( pUpper ); + SwRectFnSet aRectFnSet(pUpper); if ( _opPercent ) { // If the size is relative from page, then full size should be counted from the page frame. @@ -876,7 +876,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, if ( bRTL ) aPos = pFrame->Frame().TopRight(); else - aPos = (pFrame->Frame().*fnRect->fnGetPos)(); + aPos = (pFrame->Frame().*aRectFnSet->fnGetPos)(); // #i17567# - allow negative positions // for fly frames anchor to paragraph/to character. if ((_nAnchorId == FLY_AT_PARA) || (_nAnchorId == FLY_AT_CHAR)) @@ -904,11 +904,11 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, // to page areas. if ( _eVertRelOrient == text::RelOrientation::PAGE_FRAME || _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA ) { - if ( bVert && !bVertL2R ) + if ( aRectFnSet.bVert && !aRectFnSet.bVertL2R ) { aPos.X() = aVertEnvironRect.Right(); } - else if ( bVertL2R ) + else if ( aRectFnSet.bVertL2R ) { aPos.X() = aVertEnvironRect.Left(); } @@ -928,7 +928,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, // to page areas. if ( _eVertRelOrient == text::RelOrientation::PAGE_FRAME || _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA ) { - if ( bVert && !bVertL2R ) + if ( aRectFnSet.bVert && !aRectFnSet.bVertL2R ) { aPos.X() = aVertEnvironRect.Right(); if ( _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA ) @@ -936,7 +936,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, aPos.setX(aPos.getX() - rVertEnvironLayFrame.GetRightMargin()); } } - else if ( bVertL2R ) + else if ( aRectFnSet.bVertL2R ) { aPos.X() = aVertEnvironRect.Left(); if ( _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA ) @@ -987,7 +987,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, SwPosition aDefaultContentPos( *(pTextFrame->GetTextNode()) ); pTextFrame->GetAutoPos( aChRect, aDefaultContentPos ); } - nTop = (aChRect.*fnRect->fnGetBottom)(); + nTop = (aChRect.*aRectFnSet->fnGetBottom)(); } else { @@ -1002,7 +1002,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, pTextFrame->GetTopOfLine( nTop, aDefaultContentPos ); } } - if ( bVert || bVertL2R ) + if ( aRectFnSet.bVert || aRectFnSet.bVertL2R ) { aPos.setX(nTop); } @@ -1031,8 +1031,8 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, SwPosition aDefaultContentPos( *(pTextFrame->GetTextNode()) ); pTextFrame->GetAutoPos( aChRect, aDefaultContentPos ); } - nLeft = (aChRect.*fnRect->fnGetLeft)(); - if ( bVert || bVertL2R ) + nLeft = (aChRect.*aRectFnSet->fnGetLeft)(); + if ( aRectFnSet.bVert || aRectFnSet.bVertL2R ) { aPos.setY(nLeft); } @@ -1041,7 +1041,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, aPos.setX(nLeft); } } - if ( bVert || bVertL2R ) + if ( aRectFnSet.bVert || aRectFnSet.bVertL2R ) { _orRect = SwRect( aVertEnvironRect.Left(), aHoriEnvironRect.Top(), @@ -1069,13 +1069,13 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, if ( pUpper->IsCellFrame() )//MA_FLY_HEIGHT { const SwFrame* pTab = pUpper->FindTabFrame(); - long nBottom = (pTab->GetUpper()->*fnRect->fnGetPrtBottom)(); - (_orRect.*fnRect->fnSetBottom)( nBottom ); + long nBottom = (pTab->GetUpper()->*aRectFnSet->fnGetPrtBottom)(); + (_orRect.*aRectFnSet->fnSetBottom)( nBottom ); } } // only use 90% of height for character bound { - if( bVert || bVertL2R ) + if( aRectFnSet.bVert || aRectFnSet.bVertL2R ) _orRect.Width( (_orRect.Width()*9)/10 ); else _orRect.Height( (_orRect.Height()*9)/10 ); @@ -1085,10 +1085,10 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, const SwTwips nBaseOfstForFly = ( pFrame->IsTextFrame() && pFly ) ? static_cast<const SwTextFrame*>(pFrame)->GetBaseOfstForFly( !bWrapThrough ) : 0; - if( bVert || bVertL2R ) + if( aRectFnSet.bVert || aRectFnSet.bVertL2R ) { - bVertic = bVert; - bVerticalL2R = bVertL2R; + bVertic = aRectFnSet.bVert; + bVerticalL2R = aRectFnSet.bVertL2R; _bMirror = false; switch ( _eHoriRelOrient ) @@ -1096,12 +1096,12 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, case text::RelOrientation::FRAME_RIGHT: { aPos.setY(aPos.getY() + pFrame->Prt().Height()); - aPos += (pFrame->Prt().*fnRect->fnGetPos)(); + aPos += (pFrame->Prt().*aRectFnSet->fnGetPos)(); break; } case text::RelOrientation::PRINT_AREA: { - aPos += (pFrame->Prt().*fnRect->fnGetPos)(); + aPos += (pFrame->Prt().*aRectFnSet->fnGetPos)(); aPos.setY(aPos.getY() + nBaseOfstForFly); break; } diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index 1410901..610b83e 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -474,7 +474,7 @@ bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd ) SwSelUnion *pUnion = &rSelUnion; const SwTabFrame *pTable = pUnion->GetTable(); - SWRECTFN( pTable ) + SwRectFnSet aRectFnSet(pTable); bool bRTL = pTable->IsRightToLeft(); if( !pTable->IsValid() && nLoopMax ) @@ -522,8 +522,8 @@ bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd ) // ignore if FrameRect is outside the union - const long nXFuzzy = bVert ? 0 : 20; - const long nYFuzzy = bVert ? 20 : 0; + const long nXFuzzy = aRectFnSet.bVert ? 0 : 20; + const long nYFuzzy = aRectFnSet.bVert ? 20 : 0; if( !( rUnion.Top() + nYFuzzy > nFrameBottom || nUnionBottom < rFrameRect.Top() + nYFuzzy || @@ -578,7 +578,7 @@ bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd ) for( n = 0 ; n < aCellFrames.size(); ++n ) { const Sort_CellFrame& rCF = aCellFrames[ n ]; - if( (rCF.pFrame->Frame().*fnRect->fnGetTop)() != nYPos ) + if( (rCF.pFrame->Frame().*aRectFnSet->fnGetTop)() != nYPos ) { // new row if( n ) @@ -592,20 +592,20 @@ bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd ) } } nCellCnt = 1; - nYPos = (rCF.pFrame->Frame().*fnRect->fnGetTop)(); - nHeight = (rCF.pFrame->Frame().*fnRect->fnGetHeight)(); + nYPos = (rCF.pFrame->Frame().*aRectFnSet->fnGetTop)(); + nHeight = (rCF.pFrame->Frame().*aRectFnSet->fnGetHeight)(); nXPos = bRTL ? - (rCF.pFrame->Frame().*fnRect->fnGetLeft)() : - (rCF.pFrame->Frame().*fnRect->fnGetRight)(); + (rCF.pFrame->Frame().*aRectFnSet->fnGetLeft)() : + (rCF.pFrame->Frame().*aRectFnSet->fnGetRight)(); } else if( nXPos == ( bRTL ? - (rCF.pFrame->Frame().*fnRect->fnGetRight)() : - (rCF.pFrame->Frame().*fnRect->fnGetLeft)() ) && - nHeight == (rCF.pFrame->Frame().*fnRect->fnGetHeight)() ) + (rCF.pFrame->Frame().*aRectFnSet->fnGetRight)() : + (rCF.pFrame->Frame().*aRectFnSet->fnGetLeft)() ) && + nHeight == (rCF.pFrame->Frame().*aRectFnSet->fnGetHeight)() ) { nXPos += ( bRTL ? (-1) : 1 ) * - (rCF.pFrame->Frame().*fnRect->fnGetWidth)(); + (rCF.pFrame->Frame().*aRectFnSet->fnGetWidth)(); ++nCellCnt; } else @@ -934,7 +934,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, long nWidth; SwTableBox* pLastBox = nullptr; - SWRECTFN( pStart->GetUpper() ) + SwRectFnSet aRectFnSet(pStart->GetUpper()); for ( auto & rSelUnion : aUnions ) { @@ -983,8 +983,8 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, pLastBox = pBox; rBoxes.insert( pBox ); aPosArr.insert( - CmpLPt( (pCell->Frame().*fnRect->fnGetPos)(), - pBox, bVert ) ); + CmpLPt( (pCell->Frame().*aRectFnSet->fnGetPos)(), + pBox, aRectFnSet.bVert ) ); pBox = pBox->GetUpper()->GetTabBoxes()[ nInsPos ]; aNew.SetWidth( nTmpWidth ); @@ -1000,8 +1000,8 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, pLastBox = pBox; rBoxes.insert( pBox ); aPosArr.insert( - CmpLPt( (pCell->Frame().*fnRect->fnGetPos)(), - pBox, bVert ) ); + CmpLPt( (pCell->Frame().*aRectFnSet->fnGetPos)(), + pBox, aRectFnSet.bVert ) ); } } // overlapping on left- or right-side @@ -1047,8 +1047,8 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, pLastBox = pBox; rBoxes.insert( pBox ); aPosArr.insert( - CmpLPt( (pCell->Frame().*fnRect->fnGetPos)(), - pBox, bVert ) ); + CmpLPt( (pCell->Frame().*aRectFnSet->fnGetPos)(), + pBox, aRectFnSet.bVert ) ); pBox = pBox->GetUpper()->GetTabBoxes()[ nInsPos+1 ]; aNew.SetWidth( nRight ); @@ -1088,7 +1088,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, pLastBox = pBox; rBoxes.insert( pBox ); aPosArr.insert( CmpLPt( Point( rUnion.Left(), - pCell->Frame().Top()), pBox, bVert )); + pCell->Frame().Top()), pBox, aRectFnSet.bVert )); if( pUndo ) pUndo->AddNewBox( pBox->GetSttIdx() ); @@ -1266,7 +1266,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, nWidth = 0; long nY = !aPosArr.empty() ? - ( bVert ? + ( aRectFnSet.bVert ? aPosArr[ 0 ].X() : aPosArr[ 0 ].Y() ) : 0; @@ -1276,7 +1276,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, const CmpLPt& rPt = aPosArr[ n ]; if( bCalcWidth ) { - if( nY == ( bVert ? rPt.X() : rPt.Y() ) ) // same Y level? + if( nY == ( aRectFnSet.bVert ? rPt.X() : rPt.Y() ) ) // same Y level? nWidth += rPt.pSelBox->GetFrameFormat()->GetFrameSize().GetWidth(); else bCalcWidth = false; // one line ready @@ -1593,7 +1593,7 @@ static void lcl_FindStartEndCol( const SwLayoutFrame *&rpStart, const SwTabFrame *pOrg = rpStart->FindTabFrame(); const SwTabFrame *pTab = pOrg; - SWRECTFN( pTab ) + SwRectFnSet aRectFnSet(pTab); bool bRTL = pTab->IsRightToLeft(); const long nTmpWish = pOrg->GetFormat()->GetFrameSize().GetWidth(); @@ -1611,13 +1611,13 @@ static void lcl_FindStartEndCol( const SwLayoutFrame *&rpStart, if ( pTab->GetTable()->IsNewModel() ) { - nSX = (rpStart->Frame().*fnRect->fnGetLeft )(); - nSX2 = (rpStart->Frame().*fnRect->fnGetRight)(); + nSX = (rpStart->Frame().*aRectFnSet->fnGetLeft )(); + nSX2 = (rpStart->Frame().*aRectFnSet->fnGetRight)(); } else { - const SwTwips nPrtWidth = (pTab->Prt().*fnRect->fnGetWidth)(); - nSX = ::lcl_CalcWish( rpStart, nWish, nPrtWidth ) + (pTab->*fnRect->fnGetPrtLeft)(); + const SwTwips nPrtWidth = (pTab->Prt().*aRectFnSet->fnGetWidth)(); + nSX = ::lcl_CalcWish( rpStart, nWish, nPrtWidth ) + (pTab->*aRectFnSet->fnGetPrtLeft)(); nSX2 = nSX + (rpStart->GetFormat()->GetFrameSize().GetWidth() * nPrtWidth / nWish); } @@ -1625,10 +1625,10 @@ static void lcl_FindStartEndCol( const SwLayoutFrame *&rpStart, while ( pTmp && (!pTmp->IsCellFrame() || - ( ( ! bRTL && (pTmp->Frame().*fnRect->fnGetLeft)() < nSX && - (pTmp->Frame().*fnRect->fnGetRight)()< nSX2 ) || - ( bRTL && (pTmp->Frame().*fnRect->fnGetLeft)() > nSX && - (pTmp->Frame().*fnRect->fnGetRight)()> nSX2 ) ) ) ) + ( ( ! bRTL && (pTmp->Frame().*aRectFnSet->fnGetLeft)() < nSX && + (pTmp->Frame().*aRectFnSet->fnGetRight)()< nSX2 ) || + ( bRTL && (pTmp->Frame().*aRectFnSet->fnGetLeft)() > nSX && + (pTmp->Frame().*aRectFnSet->fnGetRight)()> nSX2 ) ) ) ) pTmp = pTmp->GetNextLayoutLeaf(); if ( pTmp ) @@ -1660,12 +1660,12 @@ static void lcl_FindStartEndCol( const SwLayoutFrame *&rpStart, if ( pTab->GetTable()->IsNewModel() ) { - nEX = (rpEnd->Frame().*fnRect->fnGetLeft )(); + nEX = (rpEnd->Frame().*aRectFnSet->fnGetLeft )(); } else { - const SwTwips nPrtWidth = (pTab->Prt().*fnRect->fnGetWidth)(); - nEX = ::lcl_CalcWish( rpEnd, nWish, nPrtWidth ) + (pTab->*fnRect->fnGetPrtLeft)(); + const SwTwips nPrtWidth = (pTab->Prt().*aRectFnSet->fnGetWidth)(); + nEX = ::lcl_CalcWish( rpEnd, nWish, nPrtWidth ) + (pTab->*aRectFnSet->fnGetPrtLeft)(); } const SwContentFrame* pLastContent = pTab->FindLastContent(); @@ -1677,8 +1677,8 @@ static void lcl_FindStartEndCol( const SwLayoutFrame *&rpStart, while( !rpEnd->IsCellFrame() ) rpEnd = rpEnd->GetUpper(); - while ( ( bRTL && (rpEnd->Frame().*fnRect->fnGetLeft)() < nEX ) || - ( ! bRTL && (rpEnd->Frame().*fnRect->fnGetLeft)() > nEX ) ) + while ( ( bRTL && (rpEnd->Frame().*aRectFnSet->fnGetLeft)() < nEX ) || + ( ! bRTL && (rpEnd->Frame().*aRectFnSet->fnGetLeft)() > nEX ) ) { const SwLayoutFrame* pTmpLeaf = rpEnd->GetPrevLayoutLeaf(); if( !pTmpLeaf || !pTab->IsAnLower( pTmpLeaf ) ) @@ -1695,10 +1695,10 @@ static void lcl_FindStartEndCol( const SwLayoutFrame *&rpStart, { const SwLayoutFrame *pTmpLeaf = rpStart; pTmpLeaf = pTmpLeaf->GetNextLayoutLeaf(); - while ( pTmpLeaf && (pTmpLeaf->Frame().*fnRect->fnGetLeft)() > nEX ) // first skip line + while ( pTmpLeaf && (pTmpLeaf->Frame().*aRectFnSet->fnGetLeft)() > nEX ) // first skip line pTmpLeaf = pTmpLeaf->GetNextLayoutLeaf(); - while ( pTmpLeaf && (pTmpLeaf->Frame().*fnRect->fnGetLeft)() < nSX && - (pTmpLeaf->Frame().*fnRect->fnGetRight)()< nSX2 ) + while ( pTmpLeaf && (pTmpLeaf->Frame().*aRectFnSet->fnGetLeft)() < nSX && + (pTmpLeaf->Frame().*aRectFnSet->fnGetRight)()< nSX2 ) pTmpLeaf = pTmpLeaf->GetNextLayoutLeaf(); const SwTabFrame *pTmpTab = rpStart->FindTabFrame(); if ( !pTmpTab->IsAnLower( pTmpLeaf ) ) @@ -1706,8 +1706,8 @@ static void lcl_FindStartEndCol( const SwLayoutFrame *&rpStart, pTmpTab = pTmpTab->GetFollow(); rpStart = pTmpTab->FirstCell(); while ( rpStart && - (rpStart->Frame().*fnRect->fnGetLeft)() < nSX && - (rpStart->Frame().*fnRect->fnGetRight)()< nSX2 ) + (rpStart->Frame().*aRectFnSet->fnGetLeft)() < nSX && + (rpStart->Frame().*aRectFnSet->fnGetRight)()< nSX2 ) rpStart = rpStart->GetNextLayoutLeaf(); } else @@ -1717,9 +1717,9 @@ static void lcl_FindStartEndCol( const SwLayoutFrame *&rpStart, { const SwLayoutFrame *pTmpLeaf = rpEnd; pTmpLeaf = pTmpLeaf->GetPrevLayoutLeaf(); - while ( pTmpLeaf && (pTmpLeaf->Frame().*fnRect->fnGetLeft)() < nEX )//erstmal die Zeile ueberspr. + while ( pTmpLeaf && (pTmpLeaf->Frame().*aRectFnSet->fnGetLeft)() < nEX )//erstmal die Zeile ueberspr. pTmpLeaf = pTmpLeaf->GetPrevLayoutLeaf(); - while ( pTmpLeaf && (pTmpLeaf->Frame().*fnRect->fnGetLeft)() > nEX ) + while ( pTmpLeaf && (pTmpLeaf->Frame().*aRectFnSet->fnGetLeft)() > nEX ) pTmpLeaf = pTmpLeaf->GetPrevLayoutLeaf(); const SwTabFrame *pTmpTab = rpEnd->FindTabFrame(); if ( !pTmpLeaf || !pTmpTab->IsAnLower( pTmpLeaf ) ) @@ -1729,7 +1729,7 @@ static void lcl_FindStartEndCol( const SwLayoutFrame *&rpStart, rpEnd = pTmpTab->FindLastContent()->GetUpper(); while( !rpEnd->IsCellFrame() ) rpEnd = rpEnd->GetUpper(); - while ( (rpEnd->Frame().*fnRect->fnGetLeft)() > nEX ) + while ( (rpEnd->Frame().*aRectFnSet->fnGetLeft)() > nEX ) rpEnd = rpEnd->GetPrevLayoutLeaf(); } else @@ -1767,16 +1767,16 @@ void MakeSelUnions( SwSelUnions& rUnions, const SwLayoutFrame *pStart, } else { - SWRECTFN( pTable ) - long nSttTop = (pStart->Frame().*fnRect->fnGetTop)(); - long nEndTop = (pEnd->Frame().*fnRect->fnGetTop)(); + SwRectFnSet aRectFnSet(pTable); + long nSttTop = (pStart->Frame().*aRectFnSet->fnGetTop)(); + long nEndTop = (pEnd->Frame().*aRectFnSet->fnGetTop)(); if( nSttTop == nEndTop ) { - if( (pStart->Frame().*fnRect->fnGetLeft)() > - (pEnd->Frame().*fnRect->fnGetLeft)() ) + if( (pStart->Frame().*aRectFnSet->fnGetLeft)() > + (pEnd->Frame().*aRectFnSet->fnGetLeft)() ) bExchange = true; } - else if( bVert == ( nSttTop < nEndTop ) ) + else if( aRectFnSet.bVert == ( nSttTop < nEndTop ) ) bExchange = true; } if ( bExchange ) @@ -1806,9 +1806,9 @@ void MakeSelUnions( SwSelUnions& rUnions, const SwLayoutFrame *pStart, const long nWish = std::max( 1L, pTable->GetFormat()->GetFrameSize().GetWidth() ); while ( pTable ) { - SWRECTFN( pTable ) - const long nOfst = (pTable->*fnRect->fnGetPrtLeft)(); - const long nPrtWidth = (pTable->Prt().*fnRect->fnGetWidth)(); + SwRectFnSet aRectFnSet(pTable); + const long nOfst = (pTable->*aRectFnSet->fnGetPrtLeft)(); + const long nPrtWidth = (pTable->Prt().*aRectFnSet->fnGetWidth)(); long nSt1 = ::lcl_CalcWish( pStart, nWish, nPrtWidth ) + nOfst; long nEd1 = ::lcl_CalcWish( pEnd, nWish, nPrtWidth ) + nOfst; @@ -1820,13 +1820,13 @@ void MakeSelUnions( SwSelUnions& rUnions, const SwLayoutFrame *pStart, long nSt2; long nEd2; if( pTable->IsAnLower( pStart ) ) - nSt2 = (pStart->Frame().*fnRect->fnGetTop)(); + nSt2 = (pStart->Frame().*aRectFnSet->fnGetTop)(); else - nSt2 = (pTable->Frame().*fnRect->fnGetTop)(); + nSt2 = (pTable->Frame().*aRectFnSet->fnGetTop)(); if( pTable->IsAnLower( pEnd ) ) - nEd2 = (pEnd->Frame().*fnRect->fnGetBottom)(); + nEd2 = (pEnd->Frame().*aRectFnSet->fnGetBottom)(); else - nEd2 = (pTable->Frame().*fnRect->fnGetBottom)(); + nEd2 = (pTable->Frame().*aRectFnSet->fnGetBottom)(); Point aSt, aEd; if( nSt1 > nEd1 ) { @@ -1840,7 +1840,7 @@ void MakeSelUnions( SwSelUnions& rUnions, const SwLayoutFrame *pStart, nSt2 = nEd2; nEd2 = nTmp; } - if( bVert ) + if( aRectFnSet.bVert ) { aSt = Point( nSt2, nSt1 ); aEd = Point( nEd2, nEd1 ); @@ -1918,7 +1918,7 @@ void MakeSelUnions( SwSelUnions& rUnions, const SwLayoutFrame *pStart, aUnion.Width( 0 ); } - if( (aUnion.*fnRect->fnGetWidth)() ) + if( (aUnion.*aRectFnSet->fnGetWidth)() ) { rUnions.push_back(SwSelUnion(aUnion, const_cast<SwTabFrame*>(pTable))); } @@ -1962,7 +1962,7 @@ bool CheckSplitCells( const SwCursor& rCursor, sal_uInt16 nDiv, const SwLayoutFrame *pEnd = pCntNd->getLayoutFrame( pCntNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &aMkPos )->GetUpper(); - SWRECTFN( pStart->GetUpper() ) + SwRectFnSet aRectFnSet(pStart->GetUpper()); // First, compute tables and rectangles SwSelUnions aUnions; @@ -1990,7 +1990,7 @@ bool CheckSplitCells( const SwCursor& rCursor, sal_uInt16 nDiv, OSL_ENSURE( pCell->IsCellFrame(), "Frame without cell" ); if( ::IsFrameInTableSel( rSelUnion.GetUnion(), pCell ) ) { - if( (pCell->Frame().*fnRect->fnGetWidth)() < nMinValue ) + if( (pCell->Frame().*aRectFnSet->fnGetWidth)() < nMinValue ) return false; } diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx index fe43d48..95ec45a 100644 --- a/sw/source/core/inc/frame.hxx +++ b/sw/source/core/inc/frame.hxx @@ -1144,30 +1144,41 @@ struct SwRectFnCollection typedef SwRectFnCollection* SwRectFn; extern SwRectFn fnRectHori, fnRectVert, fnRectB2T, fnRectVL2R, fnRectVertL2R; -#define SWRECTFN( pFrame ) bool bVert = pFrame->IsVertical(); \ - bool bRev = pFrame->IsReverse(); \ - bool bVertL2R = pFrame->IsVertLR(); \ - SwRectFn fnRect = bVert ? \ - ( bRev ? fnRectVL2R : ( bVertL2R ? fnRectVertL2R : fnRectVert ) ): \ - ( bRev ? fnRectB2T : fnRectHori ); -#define SWRECTFNX( pFrame ) bool bVertX = pFrame->IsVertical(); \ - bool bRevX = pFrame->IsReverse(); \ - bool bVertL2RX = pFrame->IsVertLR(); \ - SwRectFn fnRectX = bVertX ? \ - ( bRevX ? fnRectVL2R : ( bVertL2RX ? fnRectVertL2R : fnRectVert ) ): \ - ( bRevX ? fnRectB2T : fnRectHori ); -#define SWREFRESHFN( pFrame ) { if( bVert != pFrame->IsVertical() || \ - bRev != pFrame->IsReverse() ) \ - bVert = pFrame->IsVertical(); \ - bRev = pFrame->IsReverse(); \ - bVertL2R = pFrame->IsVertLR(); \ - fnRect = bVert ? \ - ( bRev ? fnRectVL2R : ( bVertL2R ? fnRectVertL2R : fnRectVert ) ): \ - ( bRev ? fnRectB2T : fnRectHori ); } - -#define POS_DIFF( aFrame1, aFrame2 ) \ - ( (aFrame1.*fnRect->fnGetTop)() != (aFrame2.*fnRect->fnGetTop)() || \ - (aFrame1.*fnRect->fnGetLeft)() != (aFrame2.*fnRect->fnGetLeft)() ) +struct SwRectFnSet { + bool bVert; + bool bRev; + bool bVertL2R; + SwRectFn fnRect; + + explicit SwRectFnSet(const SwFrame *pFrame) + : bVert(pFrame->IsVertical()) + , bRev(pFrame->IsReverse()) + , bVertL2R(pFrame->IsVertLR()) + { + fnRect = bVert ? + (bRev ? fnRectVL2R : (bVertL2R ? fnRectVertL2R : fnRectVert)) : + (bRev ? fnRectB2T : fnRectHori); + } + + // Convenience operator to simplify pointer-to-member syntax + SwRectFn operator ->() const { return fnRect; } + + void Refresh(const SwFrame *pFrame) + { + bVert = pFrame->IsVertical(); + bRev = pFrame->IsReverse(); + bVertL2R = pFrame->IsVertLR(); + fnRect = bVert ? + (bRev ? fnRectVL2R : (bVertL2R ? fnRectVertL2R : fnRectVert)) : + (bRev ? fnRectB2T : fnRectHori); + } + + bool PosDiff(const SwRect &rRect1, const SwRect &rRect2) + { + return ((rRect1.*fnRect->fnGetTop)() != (rRect2.*fnRect->fnGetTop)() + || (rRect1.*fnRect->fnGetLeft)() != (rRect2.*fnRect->fnGetLeft)()); + } +}; #endif diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index ba0dd96..9559b30 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -485,8 +485,8 @@ void SwAnchoredDrawObject::MakeObjPosAnchoredAtLayout() } SetCurrRelPos( aObjPositioning.GetRelPos() ); const SwFrame* pAnchorFrame = GetAnchorFrame(); - SWRECTFN( pAnchorFrame ); - const Point aAnchPos( (pAnchorFrame->Frame().*fnRect->fnGetPos)() ); + SwRectFnSet aRectFnSet(pAnchorFrame); + const Point aAnchPos( (pAnchorFrame->Frame().*aRectFnSet->fnGetPos)() ); SetObjLeft( aAnchPos.X() + GetCurrRelPos().X() ); SetObjTop( aAnchPos.Y() + GetCurrRelPos().Y() ); } diff --git a/sw/source/core/layout/anchoredobject.cxx b/sw/source/core/layout/anchoredobject.cxx index 36d24d3..20c4a3c 100644 --- a/sw/source/core/layout/anchoredobject.cxx +++ b/sw/source/core/layout/anchoredobject.cxx @@ -262,7 +262,7 @@ void SwAnchoredObject::CheckCharRect( const SwFormatAnchor& _rAnch, { // check positioning and alignment for invalidation of position { - SWRECTFN( (&_rAnchorCharFrame) ); + SwRectFnSet aRectFnSet(&_rAnchorCharFrame); // determine positioning and alignment SwFormatVertOrient aVert( GetFrameFormat().GetVertOrient() ); SwFormatHoriOrient aHori( GetFrameFormat().GetHoriOrient() ); @@ -273,19 +273,19 @@ void SwAnchoredObject::CheckCharRect( const SwFormatAnchor& _rAnch, // of anchor character has changed. const sal_Int16 eVertRelOrient = aVert.GetRelationOrient(); if ( ( aHori.GetRelationOrient() == text::RelOrientation::CHAR && - (aCharRect.*fnRect->fnGetLeft)() != - (maLastCharRect.*fnRect->fnGetLeft)() ) || + (aCharRect.*aRectFnSet->fnGetLeft)() != + (maLastCharRect.*aRectFnSet->fnGetLeft)() ) || ( eVertRelOrient == text::RelOrientation::CHAR && - ( (aCharRect.*fnRect->fnGetTop)() != - (maLastCharRect.*fnRect->fnGetTop)() || - (aCharRect.*fnRect->fnGetHeight)() != - (maLastCharRect.*fnRect->fnGetHeight)() ) ) || + ( (aCharRect.*aRectFnSet->fnGetTop)() != + (maLastCharRect.*aRectFnSet->fnGetTop)() || + (aCharRect.*aRectFnSet->fnGetHeight)() != + (maLastCharRect.*aRectFnSet->fnGetHeight)() ) ) || ( ( ( eVertRelOrient == text::RelOrientation::FRAME ) || ( eVertRelOrient == text::RelOrientation::PRINT_AREA ) || ( eVertRelOrient == text::RelOrientation::PAGE_FRAME ) || ( eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA ) ) && - ( (aCharRect.*fnRect->fnGetTop)() != - (maLastCharRect.*fnRect->fnGetTop)() ) ) ) + ( (aCharRect.*aRectFnSet->fnGetTop)() != + (maLastCharRect.*aRectFnSet->fnGetTop)() ) ) ) { // #i26945#, #i35911# - unlock position of // anchored object, if it isn't registered at the page, diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index ef51393..c7ebf84 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -91,10 +91,10 @@ bool SwContentFrame::ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool, bool & ) return false; } } - SWRECTFN( this ) - SWRECTFNX( pNewUpper ) + SwRectFnSet aRectFnSet(this); + SwRectFnSet fnRectX(pNewUpper); if( std::abs( (pNewUpper->Prt().*fnRectX->fnGetWidth)() - - (GetUpper()->Prt().*fnRect->fnGetWidth)() ) > 1 ) { + (GetUpper()->Prt().*aRectFnSet->fnGetWidth)() ) > 1 ) { // In this case, only a WouldFit_ with test move is possible nMoveAnyway = 2; } @@ -492,7 +492,7 @@ void SwFrame::MakePos() pPrv = lcl_Prev( this, false ); const SwFrameType nMyType = GetType(); - SWRECTFN( ( IsCellFrame() && GetUpper() ? GetUpper() : this ) ) + SwRectFnSet aRectFnSet((IsCellFrame() && GetUpper() ? GetUpper() : this)); if ( !bUseUpper && pPrv ) { maFrame.Pos( pPrv->Frame().Pos() ); @@ -500,23 +500,23 @@ void SwFrame::MakePos() { bool bR2L = IsRightToLeft(); if( bR2L ) - (maFrame.*fnRect->fnSetPosX)( (maFrame.*fnRect->fnGetLeft)() - - (maFrame.*fnRect->fnGetWidth)() ); + (maFrame.*aRectFnSet->fnSetPosX)( (maFrame.*aRectFnSet->fnGetLeft)() - + (maFrame.*aRectFnSet->fnGetWidth)() ); else - (maFrame.*fnRect->fnSetPosX)( (maFrame.*fnRect->fnGetLeft)() + - (pPrv->Frame().*fnRect->fnGetWidth)() ); + (maFrame.*aRectFnSet->fnSetPosX)( (maFrame.*aRectFnSet->fnGetLeft)() + + (pPrv->Frame().*aRectFnSet->fnGetWidth)() ); // cells may now leave their uppers - if( bVert && SwFrameType::Cell & nMyType && !mbReverse ) + if( aRectFnSet.bVert && SwFrameType::Cell & nMyType && !mbReverse ) maFrame.Pos().setX(maFrame.Pos().getX() - maFrame.Width() + pPrv->Frame().Width()); } - else if( bVert && FRM_NOTE_VERT & nMyType ) + else if( aRectFnSet.bVert && FRM_NOTE_VERT & nMyType ) { if( mbReverse ) maFrame.Pos().setX(maFrame.Pos().getX() + pPrv->Frame().Width()); else { - if ( bVertL2R ) + if ( aRectFnSet.bVertL2R ) maFrame.Pos().setX(maFrame.Pos().getX() + pPrv->Frame().Width()); else maFrame.Pos().setX(maFrame.Pos().getX() - maFrame.Width()); @@ -554,17 +554,17 @@ void SwFrame::MakePos() { bool bR2L = IsRightToLeft(); if( bR2L ) - (maFrame.*fnRect->fnSetPosX)( (maFrame.*fnRect->fnGetLeft)() - - (maFrame.*fnRect->fnGetWidth)() ); + (maFrame.*aRectFnSet->fnSetPosX)( (maFrame.*aRectFnSet->fnGetLeft)() - + (maFrame.*aRectFnSet->fnGetWidth)() ); else - (maFrame.*fnRect->fnSetPosX)( (maFrame.*fnRect->fnGetLeft)() + - (pPrv->Frame().*fnRect->fnGetWidth)() ); + (maFrame.*aRectFnSet->fnSetPosX)( (maFrame.*aRectFnSet->fnGetLeft)() + + (pPrv->Frame().*aRectFnSet->fnGetWidth)() ); // cells may now leave their uppers - if( bVert && SwFrameType::Cell & nMyType && !mbReverse ) + if( aRectFnSet.bVert && SwFrameType::Cell & nMyType && !mbReverse ) maFrame.Pos().setX(maFrame.Pos().getX() - maFrame.Width() + pPrv->Frame().Width()); } - else if( bVert && FRM_NOTE_VERT & nMyType ) + else if( aRectFnSet.bVert && FRM_NOTE_VERT & nMyType ) { if( mbReverse ) maFrame.Pos().setX(maFrame.Pos().getX() + pPrv->Frame().Width()); @@ -584,14 +584,14 @@ void SwFrame::MakePos() if( FRM_NEIGHBOUR & nMyType && IsRightToLeft() ) { - if( bVert ) + if( aRectFnSet.bVert ) maFrame.Pos().setY(maFrame.Pos().getY() + GetUpper()->Prt().Height() - maFrame.Height()); else maFrame.Pos().setX(maFrame.Pos().getX() + GetUpper()->Prt().Width() - maFrame.Width()); } - else if( bVert && !bVertL2R && FRM_NOTE_VERT & nMyType && !mbReverse ) + else if( aRectFnSet.bVert && !aRectFnSet.bVertL2R && FRM_NOTE_VERT & nMyType && !mbReverse ) maFrame.Pos().setX(maFrame.Pos().getX() - maFrame.Width() + GetUpper()->Prt().Width()); } } @@ -601,7 +601,7 @@ void SwFrame::MakePos() maFrame.Pos().setY(0); } - if( IsBodyFrame() && bVert && !bVertL2R && !mbReverse && GetUpper() ) + if( IsBodyFrame() && aRectFnSet.bVert && !aRectFnSet.bVertL2R && !mbReverse && GetUpper() ) maFrame.Pos().setX(maFrame.Pos().getX() + GetUpper()->Prt().Width() - maFrame.Width()); mbValidPos = true; } @@ -949,7 +949,7 @@ bool SwContentFrame::MakePrtArea( const SwBorderAttrs &rAttrs ) { mbValidPrtArea = true; - SWRECTFN( this ) + SwRectFnSet aRectFnSet(this); const bool bTextFrame = IsTextFrame(); SwTwips nUpper = 0; if ( bTextFrame && static_cast<SwTextFrame*>(this)->IsHiddenNow() ) @@ -957,13 +957,13 @@ bool SwContentFrame::MakePrtArea( const SwBorderAttrs &rAttrs ) if ( static_cast<SwTextFrame*>(this)->HasFollow() ) static_cast<SwTextFrame*>(this)->JoinFrame(); - if( (Prt().*fnRect->fnGetHeight)() ) + if( (Prt().*aRectFnSet->fnGetHeight)() ) static_cast<SwTextFrame*>(this)->HideHidden(); Prt().Pos().setX(0); Prt().Pos().setY(0); - (Prt().*fnRect->fnSetWidth)( (Frame().*fnRect->fnGetWidth)() ); - (Prt().*fnRect->fnSetHeight)( 0 ); - nUpper = -( (Frame().*fnRect->fnGetHeight)() ); + (Prt().*aRectFnSet->fnSetWidth)( (Frame().*aRectFnSet->fnGetWidth)() ); + (Prt().*aRectFnSet->fnSetHeight)( 0 ); + nUpper = -( (Frame().*aRectFnSet->fnGetHeight)() ); } else { @@ -973,11 +973,11 @@ bool SwContentFrame::MakePrtArea( const SwBorderAttrs &rAttrs ) // the borders are simply subtracted. const long nLeft = rAttrs.CalcLeft( this ); const long nRight = rAttrs.CalcRight( this ); - (this->*fnRect->fnSetXMargins)( nLeft, nRight ); + (this->*aRectFnSet->fnSetXMargins)( nLeft, nRight ); SwViewShell *pSh = getRootFrame()->GetCurrShell(); SwTwips nWidthArea; - if( pSh && 0!=(nWidthArea=(pSh->VisArea().*fnRect->fnGetWidth)()) && + if( pSh && 0!=(nWidthArea=(pSh->VisArea().*aRectFnSet->fnGetWidth)()) && GetUpper()->IsPageBodyFrame() && // but not for BodyFrames in Columns pSh->GetViewOptions()->getBrowseMode() ) { @@ -1009,23 +1009,23 @@ bool SwContentFrame::MakePrtArea( const SwBorderAttrs &rAttrs ) const Size aBorder = pSh->GetOut()->PixelToLogic( pSh->GetBrowseBorder() ); long nWidth = nWidthArea - 2 * ( IsVertical() ? aBorder.Height() : aBorder.Width() ); - nWidth -= (Prt().*fnRect->fnGetLeft)(); + nWidth -= (Prt().*aRectFnSet->fnGetLeft)(); nWidth -= rAttrs.CalcRightLine(); nWidth = std::max( nMinWidth, nWidth ); - (Prt().*fnRect->fnSetWidth)( std::min( nWidth, - (Prt().*fnRect->fnGetWidth)() ) ); + (Prt().*aRectFnSet->fnSetWidth)( std::min( nWidth, + (Prt().*aRectFnSet->fnGetWidth)() ) ); } - if ( (Prt().*fnRect->fnGetWidth)() <= MINLAY ) + if ( (Prt().*aRectFnSet->fnGetWidth)() <= MINLAY ) { // The PrtArea should already be at least MINLAY wide, matching the // minimal values of the UI - (Prt().*fnRect->fnSetWidth)( std::min( long(MINLAY), - (Frame().*fnRect->fnGetWidth)() ) ); - SwTwips nTmp = (Frame().*fnRect->fnGetWidth)() - - (Prt().*fnRect->fnGetWidth)(); - if( (Prt().*fnRect->fnGetLeft)() > nTmp ) - (Prt().*fnRect->fnSetLeft)( nTmp ); + (Prt().*aRectFnSet->fnSetWidth)( std::min( long(MINLAY), + (Frame().*aRectFnSet->fnGetWidth)() ) ); + SwTwips nTmp = (Frame().*aRectFnSet->fnGetWidth)() - + (Prt().*aRectFnSet->fnGetWidth)(); + if( (Prt().*aRectFnSet->fnGetLeft)() > nTmp ) + (Prt().*aRectFnSet->fnSetLeft)( nTmp ); } // The following rules apply for VarSize: @@ -1048,10 +1048,10 @@ bool SwContentFrame::MakePrtArea( const SwBorderAttrs &rAttrs ) nLower=0; } - (Prt().*fnRect->fnSetPosY)( (!bVert || mbReverse) ? nUpper : nLower); + (Prt().*aRectFnSet->fnSetPosY)( (!aRectFnSet.bVert || mbReverse) ? nUpper : nLower); nUpper += nLower; - nUpper -= (Frame().*fnRect->fnGetHeight)() - - (Prt().*fnRect->fnGetHeight)(); + nUpper -= (Frame().*aRectFnSet->fnGetHeight)() - + (Prt().*aRectFnSet->fnGetHeight)(); } // If there's a difference between old and new size, call Grow() or // Shrink() respectively. @@ -1246,7 +1246,7 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) } } - SWRECTFN( this ) + SwRectFnSet aRectFnSet(this); while ( !mbValidPos || !mbValidSize || !mbValidPrtArea ) { @@ -1259,7 +1259,7 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) SwFrame *pPre = GetIndPrev(); if ( CheckMoveFwd( bMakePage, bKeep, bMovedBwd ) ) { - SWREFRESHFN( this ) + aRectFnSet.Refresh(this); bMovedFwd = true; if ( bMovedBwd ) { @@ -1276,8 +1276,8 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) } } - aOldFramePos = (Frame().*fnRect->fnGetPos)(); - aOldPrtPos = (Prt().*fnRect->fnGetPos)(); + aOldFramePos = (Frame().*aRectFnSet->fnGetPos)(); + aOldPrtPos = (Prt().*aRectFnSet->fnGetPos)(); if ( !mbValidPos ) MakePos(); @@ -1296,15 +1296,15 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) // Note: A text frame can be in such a situation, if the format is // triggered by method call <SwCursorShell::SetCursor()> after // loading the document. - const SwTwips nNewFrameWidth = (GetUpper()->Prt().*fnRect->fnGetWidth)(); + const SwTwips nNewFrameWidth = (GetUpper()->Prt().*aRectFnSet->fnGetWidth)(); if ( mbValidPrtArea && nNewFrameWidth > 0 && - (Frame().*fnRect->fnGetWidth)() == 0 && - (Prt().*fnRect->fnGetWidth)() == 0 ) + (Frame().*aRectFnSet->fnGetWidth)() == 0 && + (Prt().*aRectFnSet->fnGetWidth)() == 0 ) { mbValidPrtArea = false; } - (Frame().*fnRect->fnSetWidth)( nNewFrameWidth ); + (Frame().*aRectFnSet->fnSetWidth)( nNewFrameWidth ); // When a lower of a vertically aligned fly frame changes its size we need to recalculate content pos. if( GetUpper() && GetUpper()->IsFlyFrame() && @@ -1316,11 +1316,11 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) } if ( !mbValidPrtArea ) { - const long nOldW = (Prt().*fnRect->fnGetWidth)(); + const long nOldW = (Prt().*aRectFnSet->fnGetWidth)(); // #i34730# - keep current frame height - const SwTwips nOldH = (Frame().*fnRect->fnGetHeight)(); + const SwTwips nOldH = (Frame().*aRectFnSet->fnGetHeight)(); MakePrtArea( rAttrs ); - if ( nOldW != (Prt().*fnRect->fnGetWidth)() ) + if ( nOldW != (Prt().*aRectFnSet->fnGetWidth)() ) Prepare( PREP_FIXSIZE_CHG ); // #i34730# - check, if frame height has changed. // If yes, send a PREP_ADJUST_FRM and invalidate the size flag to @@ -1329,16 +1329,16 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) // fit and if not, performs necessary actions. // #i40150# - no check, if frame is undersized. if ( mbValidSize && !IsUndersized() && - nOldH != (Frame().*fnRect->fnGetHeight)() ) + nOldH != (Frame().*aRectFnSet->fnGetHeight)() ) { // #115759# - no PREP_ADJUST_FRM and size // invalidation, if height decreases only by the additional // lower space as last content of a table cell and an existing // follow containing one line exists. - const SwTwips nHDiff = nOldH - (Frame().*fnRect->fnGetHeight)(); + const SwTwips nHDiff = nOldH - (Frame().*aRectFnSet->fnGetHeight)(); const bool bNoPrepAdjustFrame = nHDiff > 0 && IsInTab() && GetFollow() && - ( 1 == static_cast<SwTextFrame*>(GetFollow())->GetLineCount( COMPLETE_STRING ) || (static_cast<SwTextFrame*>(GetFollow())->Frame().*fnRect->fnGetWidth)() < 0 ) && + ( 1 == static_cast<SwTextFrame*>(GetFollow())->GetLineCount( COMPLETE_STRING ) || (static_cast<SwTextFrame*>(GetFollow())->Frame().*aRectFnSet->fnGetWidth)() < 0 ) && GetFollow()->CalcAddLowerSpaceAsLastInTableCell() == nHDiff; if ( !bNoPrepAdjustFrame ) { @@ -1355,15 +1355,15 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) if ( !bMustFit ) { bool bWidow = true; - const SwTwips nDeadLine = (GetUpper()->*fnRect->fnGetPrtBottom)(); + const SwTwips nDeadLine = (GetUpper()->*aRectFnSet->fnGetPrtBottom)(); if ( bMoveable && !bFormatted && ( GetFollow() || - ( (Frame().*fnRect->fnOverStep)( nDeadLine ) ) ) ) + ( (Frame().*aRectFnSet->fnOverStep)( nDeadLine ) ) ) ) { Prepare( PREP_WIDOWS_ORPHANS, nullptr, false ); mbValidSize = bWidow = false; } - if( (Frame().*fnRect->fnGetPos)() != aOldFramePos || - (Prt().*fnRect->fnGetPos)() != aOldPrtPos ) + if( (Frame().*aRectFnSet->fnGetPos)() != aOldFramePos || + (Prt().*aRectFnSet->fnGetPos)() != aOldPrtPos ) { // In this Prepare, an InvalidateSize_() might happen. // mbValidSize becomes false and Format() gets called. @@ -1408,7 +1408,7 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) ( !bFootnote || !GetUpper()->FindFootnoteFrame()->GetPrev() ) && MoveBwd( bDummy ) ) { - SWREFRESHFN( this ) + aRectFnSet.Refresh(this); bMovedBwd = true; bFormatted = false; if ( bKeep && bMoveable ) @@ -1417,22 +1417,22 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) { bMovedFwd = true; bMoveable = IsMoveable(); - SWREFRESHFN( this ) + aRectFnSet.Refresh(this); } - Point aOldPos = (Frame().*fnRect->fnGetPos)(); + Point aOldPos = (Frame().*aRectFnSet->fnGetPos)(); MakePos(); - if( aOldPos != (Frame().*fnRect->fnGetPos)() ) + if( aOldPos != (Frame().*aRectFnSet->fnGetPos)() ) { Prepare( PREP_POS_CHGD, static_cast<const void*>(&bFormatted), false ); if ( !mbValidSize ) { - (Frame().*fnRect->fnSetWidth)( (GetUpper()-> - Prt().*fnRect->fnGetWidth)() ); + (Frame().*aRectFnSet->fnSetWidth)( (GetUpper()-> + Prt().*aRectFnSet->fnGetWidth)() ); if ( !mbValidPrtArea ) { - const long nOldW = (Prt().*fnRect->fnGetWidth)(); + const long nOldW = (Prt().*aRectFnSet->fnGetWidth)(); MakePrtArea( rAttrs ); - if( nOldW != (Prt().*fnRect->fnGetWidth)() ) + if( nOldW != (Prt().*aRectFnSet->fnGetWidth)() ) Prepare( PREP_FIXSIZE_CHG, nullptr, false ); } if( GetFollow() ) @@ -1492,8 +1492,8 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) { mbValidPos = false; MakePos(); - aOldFramePos = (Frame().*fnRect->fnGetPos)(); - aOldPrtPos = (Prt().*fnRect->fnGetPos)(); + aOldFramePos = (Frame().*aRectFnSet->fnGetPos)(); + aOldPrtPos = (Prt().*aRectFnSet->fnGetPos)(); } } @@ -1518,8 +1518,8 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) // Attention: because height == 0, it's better to use Top()+Height() instead of // Bottom(). This might happen with undersized TextFrames on the lower edge of a // multi-column section - const long nPrtBottom = (GetUpper()->*fnRect->fnGetPrtBottom)(); - long nBottomDist = (Frame().*fnRect->fnBottomDist)(nPrtBottom); + const long nPrtBottom = (GetUpper()->*aRectFnSet->fnGetPrtBottom)(); + long nBottomDist = (Frame().*aRectFnSet->fnBottomDist)(nPrtBottom); // Hide whitespace may require not to insert a new page. SwPageFrame* pPageFrame = FindPageFrame(); @@ -1558,7 +1558,7 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) { const bool bMoveFwdInvalid = nullptr != GetIndNext(); const bool bNxtNew = - ( 0 == (pNxt->Prt().*fnRect->fnGetHeight)() ) && + ( 0 == (pNxt->Prt().*aRectFnSet->fnGetHeight)() ) && (!pNxt->IsTextFrame() ||!static_cast<SwTextFrame*>(pNxt)->IsHiddenNow()); pNxt->Calc(getRootFrame()->GetCurrShell()->GetOut()); @@ -1586,8 +1586,8 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) { if( !bMoveable && IsInTab() ) { - long nDiff = -(Frame().*fnRect->fnBottomDist)( - (GetUpper()->*fnRect->fnGetPrtBottom)() ); + long nDiff = -(Frame().*aRectFnSet->fnBottomDist)( + (GetUpper()->*aRectFnSet->fnGetPrtBottom)() ); long nReal = GetUpper()->Grow( nDiff ); if( nReal ) continue; @@ -1619,13 +1619,13 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) nullptr != GetNextCellLeaf( MAKEPAGE_NONE ) ) bDontMoveMe = false; - if ( bDontMoveMe && (Frame().*fnRect->fnGetHeight)() > - (GetUpper()->Prt().*fnRect->fnGetHeight)() ) + if ( bDontMoveMe && (Frame().*aRectFnSet->fnGetHeight)() > + (GetUpper()->Prt().*aRectFnSet->fnGetHeight)() ) { if ( !bFitPromise ) { - SwTwips nTmp = (GetUpper()->Prt().*fnRect->fnGetHeight)() - - (Prt().*fnRect->fnGetTop)(); + SwTwips nTmp = (GetUpper()->Prt().*aRectFnSet->fnGetHeight)() - + (Prt().*aRectFnSet->fnGetTop)(); bool bSplit = !IsFwdMoveAllowed(); if ( nTmp > 0 && WouldFit( nTmp, bSplit, false ) ) { @@ -1675,11 +1675,11 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) } const bool bCheckForGrownBody = pOldUp->IsBodyFrame(); - const long nOldBodyHeight = (pOldUp->Frame().*fnRect->fnGetHeight)(); + const long nOldBodyHeight = (pOldUp->Frame().*aRectFnSet->fnGetHeight)(); if ( !bMovedFwd && !MoveFwd( bMakePage, false ) ) bMakePage = false; - SWREFRESHFN( this ) + aRectFnSet.Refresh(this); // If MoveFwd moves the paragraph to the next page, a following // paragraph, which contains footnotes can cause the old upper @@ -1688,7 +1688,7 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) // If pOldUp was a footnote frame, it has been deleted inside MoveFwd. // Therefore we only check for growing body frames. if ( bCheckForGrownBody && ! bMovedBwd && pOldUp != GetUpper() && - (pOldUp->Frame().*fnRect->fnGetHeight)() > nOldBodyHeight ) + (pOldUp->Frame().*aRectFnSet->fnGetHeight)() > nOldBodyHeight ) { bMovedFwd = false; } diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 0ab2319..4c4a655 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -495,7 +495,7 @@ bool SwFlowFrame::PasteTree( SwFrame *pStart, SwLayoutFrame *pParent, SwFrame *p } SwFrame *pFloat = pStart; SwFrame *pLst = nullptr; - SWRECTFN( pParent ) + SwRectFnSet aRectFnSet(pParent); SwTwips nGrowVal = 0; do { pFloat->mpUpper = pParent; @@ -512,7 +512,7 @@ bool SwFlowFrame::PasteTree( SwFrame *pStart, SwLayoutFrame *pParent, SwFrame *p else bRet = true; - nGrowVal += (pFloat->Frame().*fnRect->fnGetHeight)(); + nGrowVal += (pFloat->Frame().*aRectFnSet->fnGetHeight)(); if ( pFloat->GetNext() ) pFloat = pFloat->GetNext(); else @@ -1540,26 +1540,26 @@ SwTwips SwFlowFrame::GetUpperSpaceAmountConsideredForPageGrid_( const long nGridLineHeight = pGrid->GetBaseHeight() + pGrid->GetRubyHeight(); - SWRECTFN( (&m_rThis) ) - const SwTwips nBodyPrtTop = (pBodyFrame->*fnRect->fnGetPrtTop)(); + SwRectFnSet aRectFnSet(&m_rThis); + const SwTwips nBodyPrtTop = (pBodyFrame->*aRectFnSet->fnGetPrtTop)(); const SwTwips nProposedPrtTop = - (*fnRect->fnYInc)( (m_rThis.Frame().*fnRect->fnGetTop)(), + (*aRectFnSet->fnYInc)( (m_rThis.Frame().*aRectFnSet->fnGetTop)(), _nUpperSpaceWithoutGrid ); const SwTwips nSpaceAbovePrtTop = - (*fnRect->fnYDiff)( nProposedPrtTop, nBodyPrtTop ); + (*aRectFnSet->fnYDiff)( nProposedPrtTop, nBodyPrtTop ); const SwTwips nSpaceOfCompleteLinesAbove = nGridLineHeight * ( nSpaceAbovePrtTop / nGridLineHeight ); SwTwips nNewPrtTop = - (*fnRect->fnYInc)( nBodyPrtTop, nSpaceOfCompleteLinesAbove ); - if ( (*fnRect->fnYDiff)( nProposedPrtTop, nNewPrtTop ) > 0 ) + (*aRectFnSet->fnYInc)( nBodyPrtTop, nSpaceOfCompleteLinesAbove ); + if ( (*aRectFnSet->fnYDiff)( nProposedPrtTop, nNewPrtTop ) > 0 ) { - nNewPrtTop = (*fnRect->fnYInc)( nNewPrtTop, nGridLineHeight ); + nNewPrtTop = (*aRectFnSet->fnYInc)( nNewPrtTop, nGridLineHeight ); } const SwTwips nNewUpperSpace = - (*fnRect->fnYDiff)( nNewPrtTop, - (m_rThis.Frame().*fnRect->fnGetTop)() ); + (*aRectFnSet->fnYDiff)( nNewPrtTop, + (m_rThis.Frame().*aRectFnSet->fnGetTop)() ); nUpperSpaceAmountConsideredForPageGrid = nNewUpperSpace - _nUpperSpaceWithoutGrid; @@ -1899,9 +1899,9 @@ bool SwFlowFrame::MoveFwd( bool bMakePage, bool bPageBreak, bool bMoveAlways ) bSamePage = pNewPage == pOldPage; // Set deadline, so the footnotes don't think up // silly things... - SWRECTFN( pOldBoss ) + SwRectFnSet aRectFnSet(pOldBoss); SwSaveFootnoteHeight aHeight( pOldBoss, - (pOldBoss->Frame().*fnRect->fnGetBottom)() ); + (pOldBoss->Frame().*aRectFnSet->fnGetBottom)() ); SwContentFrame* pStart = m_rThis.IsContentFrame() ? static_cast<SwContentFrame*>(&m_rThis) : static_cast<SwLayoutFrame&>(m_rThis).ContainsContent(); OSL_ENSURE( pStart || ( m_rThis.IsTabFrame() && !static_cast<SwTabFrame&>(m_rThis).Lower() ), diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 310bf43..8f25646 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -484,11 +484,11 @@ void SwFlyFrame::ChainFrames( SwFlyFrame *pMaster, SwFlyFrame *pFollow ) { // To get a text flow we need to invalidate SwFrame *pInva = pMaster->FindLastLower(); - SWRECTFN( pMaster ) - const long nBottom = (pMaster->*fnRect->fnGetPrtBottom)(); + SwRectFnSet aRectFnSet(pMaster); + const long nBottom = (pMaster->*aRectFnSet->fnGetPrtBottom)(); while ( pInva ) { - if( (pInva->Frame().*fnRect->fnBottomDist)( nBottom ) <= 0 ) + if( (pInva->Frame().*aRectFnSet->fnBottomDist)( nBottom ) <= 0 ) { pInva->InvalidateSize(); pInva->Prepare(); @@ -1258,12 +1258,12 @@ void SwFlyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA OSL_ENSURE( pAttrs->GetSize().Height() != 0 || rFrameSz.GetHeightPercent(), "FrameAttr height is 0." ); OSL_ENSURE( pAttrs->GetSize().Width() != 0 || rFrameSz.GetWidthPercent(), "FrameAttr width is 0." ); - SWRECTFN( this ) + SwRectFnSet aRectFnSet(this); if( !HasFixSize() ) { long nMinHeight = 0; if( IsMinHeight() ) - nMinHeight = bVert ? aRelSize.Width() : aRelSize.Height(); + nMinHeight = aRectFnSet.bVert ? aRelSize.Width() : aRelSize.Height(); SwTwips nRemaining = CalcContentHeight(pAttrs, nMinHeight, nUL); if( IsMinHeight() && (nRemaining + nUL) < nMinHeight ) @@ -1278,9 +1278,9 @@ void SwFlyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA if ( nRemaining < MINFLY ) nRemaining = MINFLY; - (Prt().*fnRect->fnSetHeight)( nRemaining ); - nRemaining -= (Frame().*fnRect->fnGetHeight)(); - (Frame().*fnRect->fnAddBottom)( nRemaining + nUL ); + (Prt().*aRectFnSet->fnSetHeight)( nRemaining ); + nRemaining -= (Frame().*aRectFnSet->fnGetHeight)(); + (Frame().*aRectFnSet->fnAddBottom)( nRemaining + nUL ); // #i68520# if ( nRemaining + nUL != 0 ) { @@ -1295,7 +1295,7 @@ void SwFlyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA if (SdrObjCustomShape* pCustomShape = dynamic_cast<SdrObjCustomShape*>( pShape) ) { // The shape is a customshape: then inform it about the calculated fly size. - Size aSize((Frame().*fnRect->fnGetWidth)(), (Frame().*fnRect->fnGetHeight)()); + Size aSize((Frame().*aRectFnSet->fnGetWidth)(), (Frame().*aRectFnSet->fnGetHeight)()); pCustomShape->SuggestTextFrameSize(aSize); // Do the calculations normally done after touching editeng text of the shape. pCustomShape->NbcSetOutlinerParaObjectForText(nullptr, nullptr); @@ -1306,13 +1306,13 @@ void SwFlyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA { mbValidSize = true; // Fixed Frames do not Format itself // Flys set their size using the attr - SwTwips nNewSize = bVert ? aRelSize.Width() : aRelSize.Height(); + SwTwips nNewSize = aRectFnSet.bVert ? aRelSize.Width() : aRelSize.Height(); nNewSize -= nUL; if( nNewSize < MINFLY ) nNewSize = MINFLY; - (Prt().*fnRect->fnSetHeight)( nNewSize ); - nNewSize += nUL - (Frame().*fnRect->fnGetHeight)(); - (Frame().*fnRect->fnAddBottom)( nNewSize ); + (Prt().*aRectFnSet->fnSetHeight)( nNewSize ); + nNewSize += nUL - (Frame().*aRectFnSet->fnGetHeight)(); + (Frame().*aRectFnSet->fnAddBottom)( nNewSize ); // #i68520# if ( nNewSize != 0 ) { @@ -1323,7 +1323,7 @@ void SwFlyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA if ( !m_bFormatHeightOnly ) { OSL_ENSURE( aRelSize == CalcRel( rFrameSz ), "SwFlyFrame::Format CalcRel problem" ); - SwTwips nNewSize = bVert ? aRelSize.Height() : aRelSize.Width(); + SwTwips nNewSize = aRectFnSet.bVert ? aRelSize.Height() : aRelSize.Width(); if ( rFrameSz.GetWidthSizeType() != ATT_FIX_SIZE ) { @@ -1342,9 +1342,9 @@ void SwFlyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA if( nNewSize < MINFLY ) nNewSize = MINFLY; - (Prt().*fnRect->fnSetWidth)( nNewSize ); - nNewSize += nLR - (Frame().*fnRect->fnGetWidth)(); - (Frame().*fnRect->fnAddRight)( nNewSize ); + (Prt().*aRectFnSet->fnSetWidth)( nNewSize ); + nNewSize += nLR - (Frame().*aRectFnSet->fnGetWidth)(); + (Frame().*aRectFnSet->fnAddRight)( nNewSize ); // #i68520# if ( nNewSize != 0 ) { @@ -1695,9 +1695,9 @@ void SwFlyFrame::MakeObjPos() // update relative position SetCurrRelPos( aObjPositioning.GetRelPos() ); - SWRECTFN( GetAnchorFrame() ); + SwRectFnSet aRectFnSet(GetAnchorFrame()); maFrame.Pos( aObjPositioning.GetRelPos() ); - maFrame.Pos() += (GetAnchorFrame()->Frame().*fnRect->fnGetPos)(); + maFrame.Pos() += (GetAnchorFrame()->Frame().*aRectFnSet->fnGetPos)(); // #i69335# InvalidateObjRectWithSpaces(); } @@ -1710,10 +1710,10 @@ void SwFlyFrame::MakePrtArea( const SwBorderAttrs &rAttrs ) mbValidPrtArea = true; // OD 31.07.2003 #110978# - consider vertical layout - SWRECTFN( this ) - (this->*fnRect->fnSetXMargins)( rAttrs.CalcLeftLine(), + SwRectFnSet aRectFnSet(this); + (this->*aRectFnSet->fnSetXMargins)( rAttrs.CalcLeftLine(), rAttrs.CalcRightLine() ); - (this->*fnRect->fnSetYMargins)( rAttrs.CalcTopLine(), + (this->*aRectFnSet->fnSetYMargins)( rAttrs.CalcTopLine(), rAttrs.CalcBottomLine() ); } } @@ -1727,10 +1727,10 @@ void SwFlyFrame::MakeContentPos( const SwBorderAttrs &rAttrs ) const SwTwips nUL = rAttrs.CalcTopLine() + rAttrs.CalcBottomLine(); Size aRelSize( CalcRel( GetFormat()->GetFrameSize() ) ); - SWRECTFN( this ) + SwRectFnSet aRectFnSet(this); long nMinHeight = 0; if( IsMinHeight() ) - nMinHeight = bVert ? aRelSize.Width() : aRelSize.Height(); + nMinHeight = aRectFnSet.bVert ? aRelSize.Width() : aRelSize.Height(); Point aNewContentPos; aNewContentPos = Prt().Pos(); @@ -1742,24 +1742,24 @@ void SwFlyFrame::MakeContentPos( const SwBorderAttrs &rAttrs ) SwTwips nDiff = 0; if( nContentHeight != 0) - nDiff = (Prt().*fnRect->fnGetHeight)() - nContentHeight; + nDiff = (Prt().*aRectFnSet->fnGetHeight)() - nContentHeight; if( nDiff > 0 ) { if( nAdjust == SDRTEXTVERTADJUST_CENTER ) { - if( bVertL2R ) + if( aRectFnSet.bVertL2R ) aNewContentPos.setX(aNewContentPos.getX() + nDiff/2); - else if( bVert ) + else if( aRectFnSet.bVert ) aNewContentPos.setX(aNewContentPos.getX() - nDiff/2); else aNewContentPos.setY(aNewContentPos.getY() + nDiff/2); } else if( nAdjust == SDRTEXTVERTADJUST_BOTTOM ) { - if( bVertL2R ) + if( aRectFnSet.bVertL2R ) aNewContentPos.setX(aNewContentPos.getX() + nDiff); - else if( bVert ) + else if( aRectFnSet.bVert ) aNewContentPos.setX(aNewContentPos.getX() - nDiff); else aNewContentPos.setY(aNewContentPos.getY() + nDiff); @@ -1785,10 +1785,10 @@ void SwFlyFrame::InvalidateContentPos() SwTwips SwFlyFrame::Grow_( SwTwips nDist, bool bTst ) { - SWRECTFN( this ) + SwRectFnSet aRectFnSet(this); if ( Lower() && !IsColLocked() && !HasFixSize() ) { - SwTwips nSize = (Frame().*fnRect->fnGetHeight)(); + SwTwips nSize = (Frame().*aRectFnSet->fnGetHeight)(); if( nSize > 0 && nDist > ( LONG_MAX - nSize ) ) nDist = LONG_MAX - nSize; @@ -1851,7 +1851,7 @@ SwTwips SwFlyFrame::Grow_( SwTwips nDist, bool bTst ) const SwRect aNew( GetObjRectWithSpaces() ); if ( aOld != aNew ) ::Notify( this, FindPageFrame(), aOld ); - return (aNew.*fnRect->fnGetHeight)()-(aOld.*fnRect->fnGetHeight)(); + return (aNew.*aRectFnSet->fnGetHeight)()-(aOld.*aRectFnSet->fnGetHeight)(); } return nDist; } @@ -1862,8 +1862,8 @@ SwTwips SwFlyFrame::Shrink_( SwTwips nDist, bool bTst ) { if( Lower() && !IsColLocked() && !HasFixSize() ) { - SWRECTFN( this ) - SwTwips nHeight = (Frame().*fnRect->fnGetHeight)(); + SwRectFnSet aRectFnSet(this); + SwTwips nHeight = (Frame().*aRectFnSet->fnGetHeight)(); if ( nDist > nHeight ) nDist = nHeight; @@ -1871,7 +1871,7 @@ SwTwips SwFlyFrame::Shrink_( SwTwips nDist, bool bTst ) if ( IsMinHeight() ) { const SwFormatFrameSize& rFormatSize = GetFormat()->GetFrameSize(); - SwTwips nFormatHeight = bVert ? rFormatSize.GetWidth() : rFormatSize.GetHeight(); + SwTwips nFormatHeight = aRectFnSet.bVert ? rFormatSize.GetWidth() : rFormatSize.GetHeight(); nVal = std::min( nDist, nHeight - nFormatHeight ); } @@ -1885,14 +1885,14 @@ SwTwips SwFlyFrame::Shrink_( SwTwips nDist, bool bTst ) if ( !bTst ) { SwRect aOld( GetObjRectWithSpaces() ); - (Frame().*fnRect->fnSetHeight)( nHeight - nVal ); + (Frame().*aRectFnSet->fnSetHeight)( nHeight - nVal ); // #i68520# if ( nHeight - nVal != 0 ) { InvalidateObjRectWithSpaces(); } - nHeight = (Prt().*fnRect->fnGetHeight)(); - (Prt().*fnRect->fnSetHeight)( nHeight - nVal ); + nHeight = (Prt().*aRectFnSet->fnGetHeight)(); + (Prt().*aRectFnSet->fnSetHeight)( nHeight - nVal ); InvalidatePos_(); InvalidateSize(); ::Notify( this, FindPageFrame(), aOld ); @@ -1950,8 +1950,8 @@ SwTwips SwFlyFrame::Shrink_( SwTwips nDist, bool bTst ) if ( GetAnchorFrame()->IsInFly() ) AnchorFrame()->FindFlyFrame()->Shrink( nDist, bTst ); } - return (aOld.*fnRect->fnGetHeight)() - - (aNew.*fnRect->fnGetHeight)(); + return (aOld.*aRectFnSet->fnGetHeight)() - + (aNew.*aRectFnSet->fnGetHeight)(); } return nVal; } @@ -2655,25 +2655,25 @@ void SwFlyFrame::Calc(vcl::RenderContext* pRenderContext) const SwTwips SwFlyFrame::CalcContentHeight(const SwBorderAttrs *pAttrs, const SwTwips nMinHeight, const SwTwips nUL) { - SWRECTFN( this ) + SwRectFnSet aRectFnSet(this); SwTwips nHeight = 0; if ( Lower() ) { if ( Lower()->IsColumnFrame() ) { FormatWidthCols( *pAttrs, nUL, nMinHeight ); - nHeight = (Lower()->Frame().*fnRect->fnGetHeight)(); + nHeight = (Lower()->Frame().*aRectFnSet->fnGetHeight)(); } else { SwFrame *pFrame = Lower(); while ( pFrame ) { - nHeight += (pFrame->Frame().*fnRect->fnGetHeight)(); + nHeight += (pFrame->Frame().*aRectFnSet->fnGetHeight)(); if( pFrame->IsTextFrame() && static_cast<SwTextFrame*>(pFrame)->IsUndersized() ) // This TextFrame would like to be a bit larger nHeight += static_cast<SwTextFrame*>(pFrame)->GetParHeight() - - (pFrame->Prt().*fnRect->fnGetHeight)(); + - (pFrame->Prt().*aRectFnSet->fnGetHeight)(); else if( pFrame->IsSctFrame() && static_cast<SwSectionFrame*>(pFrame)->IsUndersized() ) nHeight += static_cast<SwSectionFrame*>(pFrame)->Undersize(); pFrame = pFrame->GetNext(); @@ -2682,9 +2682,9 @@ SwTwips SwFlyFrame::CalcContentHeight(const SwBorderAttrs *pAttrs, const SwTwips if ( GetDrawObjs() ) { const size_t nCnt = GetDrawObjs()->size(); - SwTwips nTop = (Frame().*fnRect->fnGetTop)(); - SwTwips nBorder = (Frame().*fnRect->fnGetHeight)() - - (Prt().*fnRect->fnGetHeight)(); + SwTwips nTop = (Frame().*aRectFnSet->fnGetTop)(); + SwTwips nBorder = (Frame().*aRectFnSet->fnGetHeight)() - + (Prt().*aRectFnSet->fnGetHeight)(); for ( size_t i = 0; i < nCnt; ++i ) { SwAnchoredObject* pAnchoredObj = (*GetDrawObjs())[i]; @@ -2697,7 +2697,7 @@ SwTwips SwFlyFrame::CalcContentHeight(const SwBorderAttrs *pAttrs, const SwTwips pFly->Frame().Top() != FAR_AWAY && pFly->GetFormat()->GetFollowTextFlow().GetValue() ) { - SwTwips nDist = -(pFly->Frame().*fnRect-> + SwTwips nDist = -(pFly->Frame().*aRectFnSet-> fnBottomDist)( nTop ); if( nDist > nBorder + nHeight ) nHeight = nDist - nBorder; diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index 5cb716e..9e70c76 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -384,11 +384,11 @@ void SwFlyAtContentFrame::MakeAll(vcl::RenderContext* pRenderContext) // the anchor frame, thus it has to move forward. bool bConsiderWrapInfluenceDueToMovedFwdAnchor( false ); do { - SWRECTFN( this ) - Point aOldPos( (Frame().*fnRect->fnGetPos)() ); + SwRectFnSet aRectFnSet(this); + Point aOldPos( (Frame().*aRectFnSet->fnGetPos)() ); SwFlyFreeFrame::MakeAll(pRenderContext); const bool bPosChgDueToOwnFormat = - aOldPos != (Frame().*fnRect->fnGetPos)(); + aOldPos != (Frame().*aRectFnSet->fnGetPos)(); // #i3317# if ( !ConsiderObjWrapInfluenceOnObjPos() && OverlapsPrevColumn() ) @@ -446,7 +446,7 @@ void SwFlyAtContentFrame::MakeAll(vcl::RenderContext* pRenderContext) } } - if ( aOldPos != (Frame().*fnRect->fnGetPos)() || + if ( aOldPos != (Frame().*aRectFnSet->fnGetPos)() || ( !GetValidPosFlag() && ( pFooter || bPosChgDueToOwnFormat ) ) ) { @@ -506,9 +506,9 @@ void SwFlyAtContentFrame::MakeAll(vcl::RenderContext* pRenderContext) } if ( pCellFrame ) { - SWRECTFN( pCellFrame ) - if ( (pCellFrame->Frame().*fnRect->fnGetTop)() == 0 && - (pCellFrame->Frame().*fnRect->fnGetHeight)() == 0 ) + SwRectFnSet aRectFnSet(pCellFrame); + if ( (pCellFrame->Frame().*aRectFnSet->fnGetTop)() == 0 && + (pCellFrame->Frame().*aRectFnSet->fnGetHeight)() == 0 ) { bConsiderWrapInfluenceDueToMovedFwdAnchor = false; } diff --git a/sw/source/core/layout/flyincnt.cxx b/sw/source/core/layout/flyincnt.cxx index 99a3956..44dfb9b 100644 --- a/sw/source/core/layout/flyincnt.cxx +++ b/sw/source/core/layout/flyincnt.cxx @@ -72,8 +72,8 @@ void SwFlyInContentFrame::SetRefPoint( const Point& rPoint, pNotify = new SwFlyNotify( this ); aRef = rPoint; SetCurrRelPos( rRelAttr ); - SWRECTFN( GetAnchorFrame() ) - (Frame().*fnRect->fnSetPos)( rPoint + rRelPos ); + SwRectFnSet aRectFnSet(GetAnchorFrame()); + (Frame().*aRectFnSet->fnSetPos)( rPoint + rRelPos ); // #i68520# InvalidateObjRectWithSpaces(); if( pNotify ) diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index 2fc0875..85fc5b9 100644 --- a/sw/source/core/layout/flylay.cxx +++ b/sw/source/core/layout/flylay.cxx @@ -146,7 +146,7 @@ void SwFlyFreeFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) while ( !mbValidPos || !mbValidSize || !mbValidPrtArea || m_bFormatHeightOnly || !m_bValidContentPos ) { - SWRECTFN( this ) + SwRectFnSet aRectFnSet(this); const SwFormatFrameSize *pSz; { // Additional scope, so aAccess will be destroyed before the check! @@ -176,7 +176,7 @@ void SwFlyFreeFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) if ( !mbValidPos ) { - const Point aOldPos( (Frame().*fnRect->fnGetPos)() ); + const Point aOldPos( (Frame().*aRectFnSet->fnGetPos)() ); // #i26791# - use new method <MakeObjPos()> ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits