diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2016-09-20 20:51:54 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2016-09-23 08:34:12 +0000 |
commit | 6bdcb730faa5b996882b4648b86b7caf93b8f421 (patch) | |
tree | fc2795cb0b1d5df82aff3354e61c4da253424a6c /sw/source/core/docnode | |
parent | e85d92a874524f677493dda5785be11ca6e99f17 (diff) |
Replace SWRECTFN macro with a class
Change-Id: Ib400c5930be84d26665b0e12a61508c8fbfd7f08
Reviewed-on: https://gerrit.libreoffice.org/29105
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw/source/core/docnode')
-rw-r--r-- | sw/source/core/docnode/ndtbl.cxx | 68 | ||||
-rw-r--r-- | sw/source/core/docnode/ndtbl1.cxx | 32 |
2 files changed, 50 insertions, 50 deletions
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 936a5b512abd..eb15585a3989 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 7d728a29ea93..15f146c52a31 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; } |