sw/source/core/doc/tblrwcl.cxx | 2 sw/source/core/docnode/ndtbl.cxx | 60 - sw/source/core/docnode/ndtbl1.cxx | 26 sw/source/core/frmedt/fetab.cxx | 54 - sw/source/core/frmedt/fews.cxx | 48 - sw/source/core/frmedt/tblsel.cxx | 110 +-- sw/source/core/inc/frame.hxx | 74 +- sw/source/core/layout/anchoreddrawobject.cxx | 2 sw/source/core/layout/anchoredobject.cxx | 12 sw/source/core/layout/calcmove.cxx | 150 ++-- sw/source/core/layout/flowfrm.cxx | 20 sw/source/core/layout/fly.cxx | 82 +- sw/source/core/layout/flycnt.cxx | 10 sw/source/core/layout/flyincnt.cxx | 2 sw/source/core/layout/flylay.cxx | 62 - sw/source/core/layout/frmtool.cxx | 34 sw/source/core/layout/ftnfrm.cxx | 85 +- sw/source/core/layout/layact.cxx | 42 - sw/source/core/layout/layouter.cxx | 4 sw/source/core/layout/pagechg.cxx | 12 sw/source/core/layout/paintfrm.cxx | 26 sw/source/core/layout/sectfrm.cxx | 157 ++-- sw/source/core/layout/tabfrm.cxx | 356 ++++------ sw/source/core/layout/trvlfrm.cxx | 248 +++--- sw/source/core/layout/wsfrm.cxx | 161 ++-- sw/source/core/objectpositioning/anchoredobjectposition.cxx | 118 +-- sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx | 6 sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx | 148 ++-- sw/source/core/objectpositioning/tolayoutanchoredobjectposition.cxx | 14 sw/source/core/text/EnhancedPDFExportHelper.cxx | 20 sw/source/core/text/frmcrsr.cxx | 74 +- sw/source/core/text/frmform.cxx | 78 +- sw/source/core/text/frminf.cxx | 12 sw/source/core/text/itratr.cxx | 4 sw/source/core/text/itrcrsr.cxx | 12 sw/source/core/text/itrform2.cxx | 20 sw/source/core/text/porrst.cxx | 6 sw/source/core/text/txtfly.cxx | 113 +-- sw/source/core/text/txtfrm.cxx | 74 +- sw/source/core/text/txtftn.cxx | 44 - sw/source/core/text/widorp.cxx | 36 - sw/source/core/txtnode/txtedt.cxx | 42 - 42 files changed, 1341 insertions(+), 1319 deletions(-)
New commits: commit 34132442982c6c936dc1fa3f23bc68b22b4e2eae Author: Mike Kaganski <mike.kagan...@collabora.com> Date: Tue Dec 6 22:46:31 2016 +0300 SwRectFnSet: hide pointer-to-(member)function syntax Change-Id: I700e51dbfe0768642d482556299407f8f198e998 Reviewed-on: https://gerrit.libreoffice.org/31709 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Michael Stahl <mst...@redhat.com> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 0e4a3eb..46f29d3 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -1070,7 +1070,7 @@ bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn const SwRowFrame* pRow = GetRowFrame( *pSelBox->GetUpper() ); OSL_ENSURE( pRow, "Where is the SwTableLine's Frame?" ); SwRectFnSet aRectFnSet(pRow); - pRowHeights[ n ] = (pRow->Frame().*aRectFnSet->fnGetHeight)(); + pRowHeights[ n ] = aRectFnSet.GetHeight(pRow->Frame()); } } diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index f3604c1..633f3a8 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -2535,14 +2535,14 @@ void SwDoc::GetTabCols( SwTabCols &rFill, const SwCursor* pCursor, // Set fixed points, LeftMin in Document coordinates, all others relative SwRectFnSet aRectFnSet(pTab); const SwPageFrame* pPage = pTab->FindPageFrame(); - const sal_uLong nLeftMin = (pTab->Frame().*aRectFnSet->fnGetLeft)() - - (pPage->Frame().*aRectFnSet->fnGetLeft)(); - const sal_uLong nRightMax = (pTab->Frame().*aRectFnSet->fnGetRight)() - - (pPage->Frame().*aRectFnSet->fnGetLeft)(); + const sal_uLong nLeftMin = aRectFnSet.GetLeft(pTab->Frame()) - + aRectFnSet.GetLeft(pPage->Frame()); + const sal_uLong nRightMax = aRectFnSet.GetRight(pTab->Frame()) - + aRectFnSet.GetLeft(pPage->Frame()); rFill.SetLeftMin ( nLeftMin ); - rFill.SetLeft ( (pTab->Prt().*aRectFnSet->fnGetLeft)() ); - rFill.SetRight ( (pTab->Prt().*aRectFnSet->fnGetRight)()); + rFill.SetLeft ( aRectFnSet.GetLeft(pTab->Prt()) ); + rFill.SetRight ( aRectFnSet.GetRight(pTab->Prt())); rFill.SetRightMax( nRightMax - nLeftMin ); pTab->GetTable()->GetTabCols( rFill, pBox ); @@ -2614,12 +2614,12 @@ void SwDoc::GetTabRows( SwTabCols &rFill, const SwCursor* , // Set fixed points, LeftMin in Document coordinates, all others relative SwRectFnSet aRectFnSet(pTab); const SwPageFrame* pPage = pTab->FindPageFrame(); - const long nLeftMin = ( aRectFnSet.bVert ? + const long nLeftMin = ( aRectFnSet.IsVert() ? pTab->GetPrtLeft() - pPage->Frame().Left() : pTab->GetPrtTop() - pPage->Frame().Top() ); - const long nLeft = aRectFnSet.bVert ? LONG_MAX : 0; - const long nRight = (pTab->Prt().*aRectFnSet->fnGetHeight)(); - const long nRightMax = aRectFnSet.bVert ? nRight : LONG_MAX; + const long nLeft = aRectFnSet.IsVert() ? LONG_MAX : 0; + const long nRight = aRectFnSet.GetHeight(pTab->Prt()); + const long nRightMax = aRectFnSet.IsVert() ? nRight : LONG_MAX; rFill.SetLeftMin( nLeftMin ); rFill.SetLeft( nLeft ); @@ -2640,8 +2640,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().*aRectFnSet->fnGetTop)(); - long nLowerBorder = (pFrame->Frame().*aRectFnSet->fnGetBottom)(); + long nUpperBorder = aRectFnSet.GetTop(pFrame->Frame()); + long nLowerBorder = aRectFnSet.GetBottom(pFrame->Frame()); // get boundaries for nUpperBorder: aIter = aBoundaries.find( nUpperBorder ); @@ -2689,10 +2689,10 @@ void SwDoc::GetTabRows( SwTabCols &rFill, const SwCursor* , size_t nIdx = 0; for ( aIter = aBoundaries.begin(); aIter != aBoundaries.end(); ++aIter ) { - const long nTabTop = (pTab->*aRectFnSet->fnGetPrtTop)(); - const long nKey = (*aRectFnSet->fnYDiff)( (*aIter).first, nTabTop ); + const long nTabTop = aRectFnSet.GetPrtTop(*pTab); + const long nKey = aRectFnSet.YDiff( (*aIter).first, nTabTop ); const std::pair< long, long > aTmpPair = (*aIter).second; - const long nFirst = (*aRectFnSet->fnYDiff)( aTmpPair.first, nTabTop ); + const long nFirst = aRectFnSet.YDiff( aTmpPair.first, nTabTop ); const long nSecond = aTmpPair.second; aHiddenIter = aHidden.find( (*aIter).first ); @@ -2734,7 +2734,7 @@ void SwDoc::SetTabCols( const SwTabCols &rNew, bool bCurRowOnly, // #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().*aRectFnSet->fnGetWidth)(); + SwTwips nPrtWidth = aRectFnSet.GetWidth(pTab->Prt()); { SvxShadowItem aShadow( rTab.GetFrameFormat()->GetShadow() ); nPrtWidth += aShadow.CalcShadowSpace( SvxShadowItemSide::LEFT ) + @@ -2750,15 +2750,15 @@ void SwDoc::SetTabCols( const SwTabCols &rNew, bool bCurRowOnly, SwTabCols aOld( rNew.Count() ); const SwPageFrame* pPage = pTab->FindPageFrame(); - const sal_uLong nLeftMin = (pTab->Frame().*aRectFnSet->fnGetLeft)() - - (pPage->Frame().*aRectFnSet->fnGetLeft)(); - const sal_uLong nRightMax = (pTab->Frame().*aRectFnSet->fnGetRight)() - - (pPage->Frame().*aRectFnSet->fnGetLeft)(); + const sal_uLong nLeftMin = aRectFnSet.GetLeft(pTab->Frame()) - + aRectFnSet.GetLeft(pPage->Frame()); + const sal_uLong nRightMax = aRectFnSet.GetRight(pTab->Frame()) - + aRectFnSet.GetLeft(pPage->Frame()); // Set fixed points, LeftMin in Document coordinates, all others relative aOld.SetLeftMin ( nLeftMin ); - aOld.SetLeft ( (pTab->Prt().*aRectFnSet->fnGetLeft)() ); - aOld.SetRight ( (pTab->Prt().*aRectFnSet->fnGetRight)()); + aOld.SetLeft ( aRectFnSet.GetLeft(pTab->Prt()) ); + aOld.SetRight ( aRectFnSet.GetRight(pTab->Prt())); aOld.SetRightMax( nRightMax - nLeftMin ); rTab.GetTabCols( aOld, pBox ); @@ -2788,9 +2788,9 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, bool bCurColOnly, // Set fixed points, LeftMin in Document coordinates, all others relative const SwPageFrame* pPage = pTab->FindPageFrame(); - aOld.SetRight( (pTab->Prt().*aRectFnSet->fnGetHeight)() ); + aOld.SetRight( aRectFnSet.GetHeight(pTab->Prt()) ); long nLeftMin; - if ( aRectFnSet.bVert ) + if ( aRectFnSet.IsVert() ) { nLeftMin = pTab->GetPrtLeft() - pPage->Frame().Left(); aOld.SetLeft ( LONG_MAX ); @@ -2816,8 +2816,8 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, bool bCurColOnly, for ( size_t i = 0; i <= nCount; ++i ) { - const size_t nIdxStt = aRectFnSet.bVert ? nCount - i : i - 1; - const size_t nIdxEnd = aRectFnSet.bVert ? nCount - i - 1 : i; + const size_t nIdxStt = aRectFnSet.IsVert() ? nCount - i : i - 1; + const size_t nIdxEnd = aRectFnSet.IsVert() ? nCount - i - 1 : i; const long nOldRowStart = i == 0 ? 0 : aOld[ nIdxStt ]; const long nOldRowEnd = i == nCount ? aOld.GetRight() : aOld[ nIdxEnd ]; @@ -2844,9 +2844,9 @@ void SwDoc::SetTabRows( const SwTabCols &rNew, bool bCurColOnly, { if ( pFrame->IsCellFrame() && pFrame->FindTabFrame() == pTab ) { - const long nLowerBorder = (pFrame->Frame().*aRectFnSet->fnGetBottom)(); - const sal_uLong nTabTop = (pTab->*aRectFnSet->fnGetPrtTop)(); - if ( std::abs( (*aRectFnSet->fnYInc)( nTabTop, nOldRowEnd ) - nLowerBorder ) <= ROWFUZZY ) + const long nLowerBorder = aRectFnSet.GetBottom(pFrame->Frame()); + const sal_uLong nTabTop = aRectFnSet.GetPrtTop(*pTab); + if ( std::abs( aRectFnSet.YInc( nTabTop, nOldRowEnd ) - nLowerBorder ) <= ROWFUZZY ) { if ( !bCurColOnly || pFrame == pBoxFrame ) { @@ -2864,7 +2864,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().*aRectFnSet->fnGetHeight)() + nDiff; + const long nNewSize = aRectFnSet.GetHeight(pFrame->Frame()) + 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 15f146c..9224bbb 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -1275,20 +1275,20 @@ static sal_uInt16 lcl_CalcCellFit( const SwLayoutFrame *pCell ) SwRectFnSet aRectFnSet(pCell); while ( pFrame ) { - const SwTwips nAdd = (pFrame->Frame().*aRectFnSet->fnGetWidth)() - - (pFrame->Prt().*aRectFnSet->fnGetWidth)(); + const SwTwips nAdd = aRectFnSet.GetWidth(pFrame->Frame()) - + aRectFnSet.GetWidth(pFrame->Prt()); // 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().*aRectFnSet->fnGetWidth)(); + aRectFnSet.GetWidth(pFrame->Prt()); 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().*aRectFnSet->fnGetWidth)() - - (pCell->Prt().*aRectFnSet->fnGetWidth)(); + nRet += aRectFnSet.GetWidth(pCell->Frame()) - + aRectFnSet.GetWidth(pCell->Prt()); // To compensate for the accuracy of calculation later on in SwTable::SetTabCols // we keep adding up a little. @@ -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().*aRectFnSet->fnGetLeft)() ) + if ( rCols.GetLeftMin() != aRectFnSet.GetLeft(pTab->Frame()) ) { - const long nDiff = (pTab->Frame().*aRectFnSet->fnGetLeft)() - rCols.GetLeftMin(); + const long nDiff = aRectFnSet.GetLeft(pTab->Frame()) - rCols.GetLeftMin(); nColLeft += nDiff; nColRight += nDiff; } - const long nCellLeft = (pCell->Frame().*aRectFnSet->fnGetLeft)(); - const long nCellRight = (pCell->Frame().*aRectFnSet->fnGetRight)(); + const long nCellLeft = aRectFnSet.GetLeft(pCell->Frame()); + const long nCellRight = aRectFnSet.GetRight(pCell->Frame()); // Calculate overlapping value long nWidth = 0; @@ -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().*aRectFnSet->fnGetLeft)(); - const long nCRight = (pCell->Frame().*aRectFnSet->fnGetRight)(); + const long nCLeft = aRectFnSet.GetLeft(pCell->Frame()); + const long nCRight = aRectFnSet.GetRight(pCell->Frame()); 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().*aRectFnSet->fnGetLeft)()) ) + if ( rCols.GetLeftMin() != sal_uInt16(aRectFnSet.GetLeft(pTab->Frame())) ) { - const long nDiff = (pTab->Frame().*aRectFnSet->fnGetLeft)() - rCols.GetLeftMin(); + const long nDiff = aRectFnSet.GetLeft(pTab->Frame()) - rCols.GetLeftMin(); nLeftA += nDiff; nRightA += nDiff; } diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index ae41921..417ec4a 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -530,18 +530,18 @@ void SwFEShell::GetTabCols_( SwTabCols &rToFill, const SwFrame *pBox ) SwRectFnSet aRectFnSet(pTab); const SwPageFrame* pPage = pTab->FindPageFrame(); - const sal_uLong nLeftMin = (pTab->Frame().*aRectFnSet->fnGetLeft)() - - (pPage->Frame().*aRectFnSet->fnGetLeft)(); - const sal_uLong nRightMax = (pTab->Frame().*aRectFnSet->fnGetRight)() - - (pPage->Frame().*aRectFnSet->fnGetLeft)(); + const sal_uLong nLeftMin = aRectFnSet.GetLeft(pTab->Frame()) - + aRectFnSet.GetLeft(pPage->Frame()); + const sal_uLong nRightMax = aRectFnSet.GetRight(pTab->Frame()) - + aRectFnSet.GetLeft(pPage->Frame()); if (g_pColumnCacheLastTabFrame != pTab) { // if TabFrame was changed, we only shift a little bit // as the width is the same SwRectFnSet fnRectX(g_pColumnCacheLastTabFrame); - if ((g_pColumnCacheLastTabFrame->Frame().*fnRectX->fnGetWidth)() == - (pTab->Frame().*aRectFnSet->fnGetWidth)() ) + if (fnRectX.GetWidth(g_pColumnCacheLastTabFrame->Frame()) == + aRectFnSet.GetWidth(pTab->Frame()) ) { pLastCols->SetLeftMin( nLeftMin ); @@ -553,8 +553,8 @@ void SwFEShell::GetTabCols_( SwTabCols &rToFill, const SwFrame *pBox ) if ( !bDel && pLastCols->GetLeftMin () == (sal_uInt16)nLeftMin && - pLastCols->GetLeft () == (sal_uInt16)(pTab->Prt().*aRectFnSet->fnGetLeft)() && - pLastCols->GetRight () == (sal_uInt16)(pTab->Prt().*aRectFnSet->fnGetRight)()&& + pLastCols->GetLeft () == (sal_uInt16)aRectFnSet.GetLeft(pTab->Prt()) && + pLastCols->GetRight () == (sal_uInt16)aRectFnSet.GetRight(pTab->Prt())&& pLastCols->GetRightMax() == (sal_uInt16)nRightMax - pLastCols->GetLeftMin() ) { if (g_pColumnCacheLastCellFrame != pBox) @@ -593,12 +593,12 @@ void SwFEShell::GetTabRows_( SwTabCols &rToFill, const SwFrame *pBox ) bDel = false; SwRectFnSet aRectFnSet(pTab); const SwPageFrame* pPage = pTab->FindPageFrame(); - const long nLeftMin = ( aRectFnSet.bVert ? + const long nLeftMin = ( aRectFnSet.IsVert() ? pTab->GetPrtLeft() - pPage->Frame().Left() : pTab->GetPrtTop() - pPage->Frame().Top() ); - const long nLeft = aRectFnSet.bVert ? LONG_MAX : 0; - const long nRight = (pTab->Prt().*aRectFnSet->fnGetHeight)(); - const long nRightMax = aRectFnSet.bVert ? nRight : LONG_MAX; + const long nLeft = aRectFnSet.IsVert() ? LONG_MAX : 0; + const long nRight = aRectFnSet.GetHeight(pTab->Prt()); + const long nRightMax = aRectFnSet.IsVert() ? nRight : LONG_MAX; if (g_pRowCacheLastTabFrame != pTab || g_pRowCacheLastCellFrame != pBox) bDel = true; @@ -1359,7 +1359,7 @@ size_t SwFEShell::GetCurTabColNum() const if( pFrame->FindTabFrame()->IsRightToLeft() ) { - long nX = (pFrame->Frame().*aRectFnSet->fnGetRight)() - (pPage->Frame().*aRectFnSet->fnGetLeft)(); + long nX = aRectFnSet.GetRight(pFrame->Frame()) - aRectFnSet.GetLeft(pPage->Frame()); const long nRight = aTabCols.GetLeftMin() + aTabCols.GetRight(); @@ -1376,8 +1376,8 @@ size_t SwFEShell::GetCurTabColNum() const } else { - const long nX = (pFrame->Frame().*aRectFnSet->fnGetLeft)() - - (pPage->Frame().*aRectFnSet->fnGetLeft)(); + const long nX = aRectFnSet.GetLeft(pFrame->Frame()) - + aRectFnSet.GetLeft(pPage->Frame()); const long nLeft = aTabCols.GetLeftMin(); @@ -1465,15 +1465,15 @@ static const SwCellFrame *lcl_FindFrame( const SwLayoutFrame *pLay, const Point aTabRect.Pos() += pFrame->Frame().Pos(); const SwTwips nLeft = bRTL ? - (aTabRect.*aRectFnSet->fnGetRight)() : - (aTabRect.*aRectFnSet->fnGetLeft)(); - const SwTwips nTop = (aTabRect.*aRectFnSet->fnGetTop)(); + aRectFnSet.GetRight(aTabRect) : + aRectFnSet.GetLeft(aTabRect); + const SwTwips nTop = aRectFnSet.GetTop(aTabRect); - SwTwips& rPointX = aRectFnSet.bVert ? aPt.Y() : aPt.X(); - SwTwips& rPointY = aRectFnSet.bVert ? aPt.X() : aPt.Y(); + SwTwips& rPointX = aRectFnSet.IsVert() ? aPt.Y() : aPt.X(); + SwTwips& rPointY = aRectFnSet.IsVert() ? aPt.X() : aPt.Y(); - const SwTwips nXDiff = (*aRectFnSet->fnXDiff)( nLeft, rPointX ) * ( bRTL ? (-1) : 1 ); - const SwTwips nYDiff = (*aRectFnSet->fnYDiff)( nTop, rPointY ); + const SwTwips nXDiff = aRectFnSet.XDiff( nLeft, rPointX ) * ( bRTL ? (-1) : 1 ); + const SwTwips nYDiff = aRectFnSet.YDiff( nTop, rPointY ); bCloseToRow = nXDiff >= 0 && nXDiff < nFuzzy; bCloseToCol = nYDiff >= 0 && nYDiff < nFuzzy; @@ -1497,7 +1497,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.*aRectFnSet->fnGetPos)(); + aPt = bRTL ? aTabRect.TopRight() : aRectFnSet.GetPos(aTabRect); else if ( bCloseToRow ) rPointX = nLeft; else if ( bCloseToCol ) @@ -1574,8 +1574,8 @@ static const SwCellFrame *lcl_FindFrame( const SwLayoutFrame *pLay, const Point SwRectFnSet aRectFnSet(pTabFrame); - const SwTwips nTabTop = (aTabRect.*aRectFnSet->fnGetTop)(); - const SwTwips nMouseTop = aRectFnSet.bVert ? rPt.X() : rPt.Y(); + const SwTwips nTabTop = aRectFnSet.GetTop(aTabRect); + const SwTwips nMouseTop = aRectFnSet.IsVert() ? rPt.X() : rPt.Y(); // Do not allow to drag upper table border: if ( !::IsSame( nTabTop, nMouseTop ) ) @@ -2178,7 +2178,7 @@ bool SwFEShell::SetColRowWidthHeight( sal_uInt16 eType, sal_uInt16 nDiff ) // then it should be recalculated to absolute values now const SwFormatFrameSize& rTableFrameSz = pTab->GetFormat()->GetFrameSize(); SwRectFnSet aRectFnSet(pTab); - long nPrtWidth = (pTab->Prt().*aRectFnSet->fnGetWidth)(); + long nPrtWidth = aRectFnSet.GetWidth(pTab->Prt()); if( TBLVAR_CHGABS == pTab->GetTable()->GetTableChgMode() && ( eType & nsTableChgWidthHeightType::WH_COL_LEFT || eType & nsTableChgWidthHeightType::WH_COL_RIGHT ) && text::HoriOrientation::NONE == pTab->GetFormat()->GetHoriOrient().GetHoriOrient() && @@ -2192,7 +2192,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().*aRectFnSet->fnGetWidth)()); + nDiff = sal_uInt16(aRectFnSet.GetWidth(pFrame->Frame())); // 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 58d0c90..3f596e2 100644 --- a/sw/source/core/frmedt/fews.cxx +++ b/sw/source/core/frmedt/fews.cxx @@ -758,12 +758,12 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, if ( bRTL ) aPos = pFrame->Frame().TopRight(); else - aPos = (pFrame->Frame().*aRectFnSet->fnGetPos)(); + aPos = aRectFnSet.GetPos(pFrame->Frame()); - if( aRectFnSet.bVert || aRectFnSet.bVertL2R ) + if( aRectFnSet.IsVert() || aRectFnSet.IsVertL2R() ) { - bVertic = aRectFnSet.bVert; - bVerticalL2R = aRectFnSet.bVertL2R; + bVertic = aRectFnSet.IsVert(); + bVerticalL2R = aRectFnSet.IsVertL2R(); _bMirror = false; // no mirroring in vertical environment switch ( _eHoriRelOrient ) { @@ -813,7 +813,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, } } - if ( aRectFnSet.bVert && !aRectFnSet.bVertL2R ) + if ( aRectFnSet.IsVert() && !aRectFnSet.IsVertL2R() ) { switch ( _eVertRelOrient ) { @@ -825,7 +825,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, break; } } - else if ( aRectFnSet.bVertL2R ) + else if ( aRectFnSet.IsVertL2R() ) { switch ( _eVertRelOrient ) { @@ -884,7 +884,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, if ( bRTL ) aPos = pFrame->Frame().TopRight(); else - aPos = (pFrame->Frame().*aRectFnSet->fnGetPos)(); + aPos = aRectFnSet.GetPos(pFrame->Frame()); // #i17567# - allow negative positions // for fly frames anchor to paragraph/to character. if ((_nAnchorId == FLY_AT_PARA) || (_nAnchorId == FLY_AT_CHAR)) @@ -912,11 +912,11 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, // to page areas. if ( _eVertRelOrient == text::RelOrientation::PAGE_FRAME || _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA ) { - if ( aRectFnSet.bVert && !aRectFnSet.bVertL2R ) + if ( aRectFnSet.IsVert() && !aRectFnSet.IsVertL2R() ) { aPos.X() = aVertEnvironRect.Right(); } - else if ( aRectFnSet.bVertL2R ) + else if ( aRectFnSet.IsVertL2R() ) { aPos.X() = aVertEnvironRect.Left(); } @@ -936,7 +936,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, // to page areas. if ( _eVertRelOrient == text::RelOrientation::PAGE_FRAME || _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA ) { - if ( aRectFnSet.bVert && !aRectFnSet.bVertL2R ) + if ( aRectFnSet.IsVert() && !aRectFnSet.IsVertL2R() ) { aPos.X() = aVertEnvironRect.Right(); if ( _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA ) @@ -944,7 +944,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, aPos.setX(aPos.getX() - rVertEnvironLayFrame.GetRightMargin()); } } - else if ( aRectFnSet.bVertL2R ) + else if ( aRectFnSet.IsVertL2R() ) { aPos.X() = aVertEnvironRect.Left(); if ( _eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA ) @@ -995,7 +995,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, SwPosition aDefaultContentPos( *(pTextFrame->GetTextNode()) ); pTextFrame->GetAutoPos( aChRect, aDefaultContentPos ); } - nTop = (aChRect.*aRectFnSet->fnGetBottom)(); + nTop = aRectFnSet.GetBottom(aChRect); } else { @@ -1010,7 +1010,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, pTextFrame->GetTopOfLine( nTop, aDefaultContentPos ); } } - if ( aRectFnSet.bVert || aRectFnSet.bVertL2R ) + if ( aRectFnSet.IsVert() || aRectFnSet.IsVertL2R() ) { aPos.setX(nTop); } @@ -1039,8 +1039,8 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, SwPosition aDefaultContentPos( *(pTextFrame->GetTextNode()) ); pTextFrame->GetAutoPos( aChRect, aDefaultContentPos ); } - nLeft = (aChRect.*aRectFnSet->fnGetLeft)(); - if ( aRectFnSet.bVert || aRectFnSet.bVertL2R ) + nLeft = aRectFnSet.GetLeft(aChRect); + if ( aRectFnSet.IsVert() || aRectFnSet.IsVertL2R() ) { aPos.setY(nLeft); } @@ -1049,7 +1049,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, aPos.setX(nLeft); } } - if ( aRectFnSet.bVert || aRectFnSet.bVertL2R ) + if ( aRectFnSet.IsVert() || aRectFnSet.IsVertL2R() ) { _orRect = SwRect( aVertEnvironRect.Left(), aHoriEnvironRect.Top(), @@ -1077,13 +1077,13 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, if ( pUpper->IsCellFrame() )//MA_FLY_HEIGHT { const SwFrame* pTab = pUpper->FindTabFrame(); - long nBottom = (pTab->GetUpper()->*aRectFnSet->fnGetPrtBottom)(); - (_orRect.*aRectFnSet->fnSetBottom)( nBottom ); + long nBottom = aRectFnSet.GetPrtBottom(*pTab->GetUpper()); + aRectFnSet.SetBottom( _orRect, nBottom ); } } // only use 90% of height for character bound { - if( aRectFnSet.bVert || aRectFnSet.bVertL2R ) + if( aRectFnSet.IsVert() || aRectFnSet.IsVertL2R() ) _orRect.Width( (_orRect.Width()*9)/10 ); else _orRect.Height( (_orRect.Height()*9)/10 ); @@ -1093,10 +1093,10 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, const SwTwips nBaseOfstForFly = ( pFrame->IsTextFrame() && pFly ) ? static_cast<const SwTextFrame*>(pFrame)->GetBaseOfstForFly( !bWrapThrough ) : 0; - if( aRectFnSet.bVert || aRectFnSet.bVertL2R ) + if( aRectFnSet.IsVert() || aRectFnSet.IsVertL2R() ) { - bVertic = aRectFnSet.bVert; - bVerticalL2R = aRectFnSet.bVertL2R; + bVertic = aRectFnSet.IsVert(); + bVerticalL2R = aRectFnSet.IsVertL2R(); _bMirror = false; switch ( _eHoriRelOrient ) @@ -1104,12 +1104,12 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect, case text::RelOrientation::FRAME_RIGHT: { aPos.setY(aPos.getY() + pFrame->Prt().Height()); - aPos += (pFrame->Prt().*aRectFnSet->fnGetPos)(); + aPos += aRectFnSet.GetPos(pFrame->Prt()); break; } case text::RelOrientation::PRINT_AREA: { - aPos += (pFrame->Prt().*aRectFnSet->fnGetPos)(); + aPos += aRectFnSet.GetPos(pFrame->Prt()); aPos.setY(aPos.getY() + nBaseOfstForFly); break; } diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index 610b83e..d7ae1b4 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -522,8 +522,8 @@ bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd ) // ignore if FrameRect is outside the union - const long nXFuzzy = aRectFnSet.bVert ? 0 : 20; - const long nYFuzzy = aRectFnSet.bVert ? 20 : 0; + const long nXFuzzy = aRectFnSet.IsVert() ? 0 : 20; + const long nYFuzzy = aRectFnSet.IsVert() ? 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().*aRectFnSet->fnGetTop)() != nYPos ) + if( aRectFnSet.GetTop(rCF.pFrame->Frame()) != nYPos ) { // new row if( n ) @@ -592,20 +592,20 @@ bool ChkChartSel( const SwNode& rSttNd, const SwNode& rEndNd ) } } nCellCnt = 1; - nYPos = (rCF.pFrame->Frame().*aRectFnSet->fnGetTop)(); - nHeight = (rCF.pFrame->Frame().*aRectFnSet->fnGetHeight)(); + nYPos = aRectFnSet.GetTop(rCF.pFrame->Frame()); + nHeight = aRectFnSet.GetHeight(rCF.pFrame->Frame()); nXPos = bRTL ? - (rCF.pFrame->Frame().*aRectFnSet->fnGetLeft)() : - (rCF.pFrame->Frame().*aRectFnSet->fnGetRight)(); + aRectFnSet.GetLeft(rCF.pFrame->Frame()) : + aRectFnSet.GetRight(rCF.pFrame->Frame()); } else if( nXPos == ( bRTL ? - (rCF.pFrame->Frame().*aRectFnSet->fnGetRight)() : - (rCF.pFrame->Frame().*aRectFnSet->fnGetLeft)() ) && - nHeight == (rCF.pFrame->Frame().*aRectFnSet->fnGetHeight)() ) + aRectFnSet.GetRight(rCF.pFrame->Frame()) : + aRectFnSet.GetLeft(rCF.pFrame->Frame()) ) && + nHeight == aRectFnSet.GetHeight(rCF.pFrame->Frame()) ) { nXPos += ( bRTL ? (-1) : 1 ) * - (rCF.pFrame->Frame().*aRectFnSet->fnGetWidth)(); + aRectFnSet.GetWidth(rCF.pFrame->Frame()); ++nCellCnt; } else @@ -983,8 +983,8 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, pLastBox = pBox; rBoxes.insert( pBox ); aPosArr.insert( - CmpLPt( (pCell->Frame().*aRectFnSet->fnGetPos)(), - pBox, aRectFnSet.bVert ) ); + CmpLPt( aRectFnSet.GetPos(pCell->Frame()), + pBox, aRectFnSet.IsVert() ) ); 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().*aRectFnSet->fnGetPos)(), - pBox, aRectFnSet.bVert ) ); + CmpLPt( aRectFnSet.GetPos(pCell->Frame()), + pBox, aRectFnSet.IsVert() ) ); } } // 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().*aRectFnSet->fnGetPos)(), - pBox, aRectFnSet.bVert ) ); + CmpLPt( aRectFnSet.GetPos(pCell->Frame()), + pBox, aRectFnSet.IsVert() ) ); 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, aRectFnSet.bVert )); + pCell->Frame().Top()), pBox, aRectFnSet.IsVert() )); if( pUndo ) pUndo->AddNewBox( pBox->GetSttIdx() ); @@ -1266,7 +1266,7 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes, nWidth = 0; long nY = !aPosArr.empty() ? - ( aRectFnSet.bVert ? + ( aRectFnSet.IsVert() ? 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 == ( aRectFnSet.bVert ? rPt.X() : rPt.Y() ) ) // same Y level? + if( nY == ( aRectFnSet.IsVert() ? rPt.X() : rPt.Y() ) ) // same Y level? nWidth += rPt.pSelBox->GetFrameFormat()->GetFrameSize().GetWidth(); else bCalcWidth = false; // one line ready @@ -1611,13 +1611,13 @@ static void lcl_FindStartEndCol( const SwLayoutFrame *&rpStart, if ( pTab->GetTable()->IsNewModel() ) { - nSX = (rpStart->Frame().*aRectFnSet->fnGetLeft )(); - nSX2 = (rpStart->Frame().*aRectFnSet->fnGetRight)(); + nSX = aRectFnSet.GetLeft(rpStart->Frame()); + nSX2 = aRectFnSet.GetRight(rpStart->Frame()); } else { - const SwTwips nPrtWidth = (pTab->Prt().*aRectFnSet->fnGetWidth)(); - nSX = ::lcl_CalcWish( rpStart, nWish, nPrtWidth ) + (pTab->*aRectFnSet->fnGetPrtLeft)(); + const SwTwips nPrtWidth = aRectFnSet.GetWidth(pTab->Prt()); + nSX = ::lcl_CalcWish( rpStart, nWish, nPrtWidth ) + aRectFnSet.GetPrtLeft(*pTab); 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().*aRectFnSet->fnGetLeft)() < nSX && - (pTmp->Frame().*aRectFnSet->fnGetRight)()< nSX2 ) || - ( bRTL && (pTmp->Frame().*aRectFnSet->fnGetLeft)() > nSX && - (pTmp->Frame().*aRectFnSet->fnGetRight)()> nSX2 ) ) ) ) + ( ( ! bRTL && aRectFnSet.GetLeft(pTmp->Frame()) < nSX && + aRectFnSet.GetRight(pTmp->Frame())< nSX2 ) || + ( bRTL && aRectFnSet.GetLeft(pTmp->Frame()) > nSX && + aRectFnSet.GetRight(pTmp->Frame())> nSX2 ) ) ) ) pTmp = pTmp->GetNextLayoutLeaf(); if ( pTmp ) @@ -1660,12 +1660,12 @@ static void lcl_FindStartEndCol( const SwLayoutFrame *&rpStart, if ( pTab->GetTable()->IsNewModel() ) { - nEX = (rpEnd->Frame().*aRectFnSet->fnGetLeft )(); + nEX = aRectFnSet.GetLeft(rpEnd->Frame()); } else { - const SwTwips nPrtWidth = (pTab->Prt().*aRectFnSet->fnGetWidth)(); - nEX = ::lcl_CalcWish( rpEnd, nWish, nPrtWidth ) + (pTab->*aRectFnSet->fnGetPrtLeft)(); + const SwTwips nPrtWidth = aRectFnSet.GetWidth(pTab->Prt()); + nEX = ::lcl_CalcWish( rpEnd, nWish, nPrtWidth ) + aRectFnSet.GetPrtLeft(*pTab); } 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().*aRectFnSet->fnGetLeft)() < nEX ) || - ( ! bRTL && (rpEnd->Frame().*aRectFnSet->fnGetLeft)() > nEX ) ) + while ( ( bRTL && aRectFnSet.GetLeft(rpEnd->Frame()) < nEX ) || + ( ! bRTL && aRectFnSet.GetLeft(rpEnd->Frame()) > 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().*aRectFnSet->fnGetLeft)() > nEX ) // first skip line + while ( pTmpLeaf && aRectFnSet.GetLeft(pTmpLeaf->Frame()) > nEX ) // first skip line pTmpLeaf = pTmpLeaf->GetNextLayoutLeaf(); - while ( pTmpLeaf && (pTmpLeaf->Frame().*aRectFnSet->fnGetLeft)() < nSX && - (pTmpLeaf->Frame().*aRectFnSet->fnGetRight)()< nSX2 ) + while ( pTmpLeaf && aRectFnSet.GetLeft(pTmpLeaf->Frame()) < nSX && + aRectFnSet.GetRight(pTmpLeaf->Frame())< 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().*aRectFnSet->fnGetLeft)() < nSX && - (rpStart->Frame().*aRectFnSet->fnGetRight)()< nSX2 ) + aRectFnSet.GetLeft(rpStart->Frame()) < nSX && + aRectFnSet.GetRight(rpStart->Frame())< 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().*aRectFnSet->fnGetLeft)() < nEX )//erstmal die Zeile ueberspr. + while ( pTmpLeaf && aRectFnSet.GetLeft(pTmpLeaf->Frame()) < nEX )//erstmal die Zeile ueberspr. pTmpLeaf = pTmpLeaf->GetPrevLayoutLeaf(); - while ( pTmpLeaf && (pTmpLeaf->Frame().*aRectFnSet->fnGetLeft)() > nEX ) + while ( pTmpLeaf && aRectFnSet.GetLeft(pTmpLeaf->Frame()) > 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().*aRectFnSet->fnGetLeft)() > nEX ) + while ( aRectFnSet.GetLeft(rpEnd->Frame()) > nEX ) rpEnd = rpEnd->GetPrevLayoutLeaf(); } else @@ -1768,15 +1768,15 @@ void MakeSelUnions( SwSelUnions& rUnions, const SwLayoutFrame *pStart, else { SwRectFnSet aRectFnSet(pTable); - long nSttTop = (pStart->Frame().*aRectFnSet->fnGetTop)(); - long nEndTop = (pEnd->Frame().*aRectFnSet->fnGetTop)(); + long nSttTop = aRectFnSet.GetTop(pStart->Frame()); + long nEndTop = aRectFnSet.GetTop(pEnd->Frame()); if( nSttTop == nEndTop ) { - if( (pStart->Frame().*aRectFnSet->fnGetLeft)() > - (pEnd->Frame().*aRectFnSet->fnGetLeft)() ) + if( aRectFnSet.GetLeft(pStart->Frame()) > + aRectFnSet.GetLeft(pEnd->Frame()) ) bExchange = true; } - else if( aRectFnSet.bVert == ( nSttTop < nEndTop ) ) + else if( aRectFnSet.IsVert() == ( nSttTop < nEndTop ) ) bExchange = true; } if ( bExchange ) @@ -1807,8 +1807,8 @@ void MakeSelUnions( SwSelUnions& rUnions, const SwLayoutFrame *pStart, while ( pTable ) { SwRectFnSet aRectFnSet(pTable); - const long nOfst = (pTable->*aRectFnSet->fnGetPrtLeft)(); - const long nPrtWidth = (pTable->Prt().*aRectFnSet->fnGetWidth)(); + const long nOfst = aRectFnSet.GetPrtLeft(*pTable); + const long nPrtWidth = aRectFnSet.GetWidth(pTable->Prt()); 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().*aRectFnSet->fnGetTop)(); + nSt2 = aRectFnSet.GetTop(pStart->Frame()); else - nSt2 = (pTable->Frame().*aRectFnSet->fnGetTop)(); + nSt2 = aRectFnSet.GetTop(pTable->Frame()); if( pTable->IsAnLower( pEnd ) ) - nEd2 = (pEnd->Frame().*aRectFnSet->fnGetBottom)(); + nEd2 = aRectFnSet.GetBottom(pEnd->Frame()); else - nEd2 = (pTable->Frame().*aRectFnSet->fnGetBottom)(); + nEd2 = aRectFnSet.GetBottom(pTable->Frame()); Point aSt, aEd; if( nSt1 > nEd1 ) { @@ -1840,7 +1840,7 @@ void MakeSelUnions( SwSelUnions& rUnions, const SwLayoutFrame *pStart, nSt2 = nEd2; nEd2 = nTmp; } - if( aRectFnSet.bVert ) + if( aRectFnSet.IsVert() ) { aSt = Point( nSt2, nSt1 ); aEd = Point( nEd2, nEd1 ); @@ -1918,7 +1918,7 @@ void MakeSelUnions( SwSelUnions& rUnions, const SwLayoutFrame *pStart, aUnion.Width( 0 ); } - if( (aUnion.*aRectFnSet->fnGetWidth)() ) + if( aRectFnSet.GetWidth(aUnion) ) { rUnions.push_back(SwSelUnion(aUnion, const_cast<SwTabFrame*>(pTable))); } @@ -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().*aRectFnSet->fnGetWidth)() < nMinValue ) + if( aRectFnSet.GetWidth(pCell->Frame()) < nMinValue ) return false; } diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx index e8f56ce..4ba2cf4 100644 --- a/sw/source/core/inc/frame.hxx +++ b/sw/source/core/inc/frame.hxx @@ -1140,13 +1140,10 @@ struct SwRectFnCollection typedef SwRectFnCollection* SwRectFn; +// This class allows to use proper methods regardless of orientation (LTR/RTL, horizontal or vertical) extern SwRectFn fnRectHori, fnRectVert, fnRectB2T, fnRectVL2R, fnRectVertL2R; -struct SwRectFnSet { - bool bVert; - bool bRev; - bool bVertL2R; - SwRectFn fnRect; - +class SwRectFnSet { +public: explicit SwRectFnSet(const SwFrame *pFrame) : bVert(pFrame->IsVertical()) , bRev(pFrame->IsReverse()) @@ -1157,9 +1154,6 @@ struct SwRectFnSet { (bRev ? fnRectB2T : fnRectHori); } - // Convenience operator to simplify pointer-to-member syntax - SwRectFn operator ->() const { return fnRect; } - void Refresh(const SwFrame *pFrame) { bVert = pFrame->IsVertical(); @@ -1170,11 +1164,71 @@ struct SwRectFnSet { (bRev ? fnRectB2T : fnRectHori); } - bool PosDiff(const SwRect &rRect1, const SwRect &rRect2) + bool IsVert() const { return bVert; } + bool IsRev() const { return bRev; } + bool IsVertL2R() const { return bVertL2R; } + SwRectFn FnRect() const { return fnRect; } + + bool PosDiff(const SwRect &rRect1, const SwRect &rRect2) const { return ((rRect1.*fnRect->fnGetTop)() != (rRect2.*fnRect->fnGetTop)() || (rRect1.*fnRect->fnGetLeft)() != (rRect2.*fnRect->fnGetLeft)()); } + + long GetTop (const SwRect& rRect) const { return (rRect.*fnRect->fnGetTop) (); } + long GetBottom(const SwRect& rRect) const { return (rRect.*fnRect->fnGetBottom)(); } + long GetLeft (const SwRect& rRect) const { return (rRect.*fnRect->fnGetLeft) (); } + long GetRight (const SwRect& rRect) const { return (rRect.*fnRect->fnGetRight) (); } + long GetWidth (const SwRect& rRect) const { return (rRect.*fnRect->fnGetWidth) (); } + long GetHeight(const SwRect& rRect) const { return (rRect.*fnRect->fnGetHeight)(); } + Point GetPos (const SwRect& rRect) const { return (rRect.*fnRect->fnGetPos) (); } + + void SetTop (SwRect& rRect, long nNew) const { (rRect.*fnRect->fnSetTop) (nNew); } + void SetBottom(SwRect& rRect, long nNew) const { (rRect.*fnRect->fnSetBottom)(nNew); } + void SetLeft (SwRect& rRect, long nNew) const { (rRect.*fnRect->fnSetLeft) (nNew); } + void SetRight (SwRect& rRect, long nNew) const { (rRect.*fnRect->fnSetRight) (nNew); } + void SetWidth (SwRect& rRect, long nNew) const { (rRect.*fnRect->fnSetWidth) (nNew); } + void SetHeight(SwRect& rRect, long nNew) const { (rRect.*fnRect->fnSetHeight)(nNew); } + + void SubTop (SwRect& rRect, long nNew) const { (rRect.*fnRect->fnSubTop) (nNew); } + void AddBottom(SwRect& rRect, long nNew) const { (rRect.*fnRect->fnAddBottom)(nNew); } + void SubLeft (SwRect& rRect, long nNew) const { (rRect.*fnRect->fnSubLeft) (nNew); } + void AddRight (SwRect& rRect, long nNew) const { (rRect.*fnRect->fnAddRight) (nNew); } + void AddWidth (SwRect& rRect, long nNew) const { (rRect.*fnRect->fnAddWidth) (nNew); } + void AddHeight(SwRect& rRect, long nNew) const { (rRect.*fnRect->fnAddHeight)(nNew); } + + void SetPosX(SwRect& rRect, long nNew) const { (rRect.*fnRect->fnSetPosX)(nNew); } + void SetPosY(SwRect& rRect, long nNew) const { (rRect.*fnRect->fnSetPosY)(nNew); } + + long GetTopMargin (const SwFrame& rFrame) const { return (rFrame.*fnRect->fnGetTopMargin) (); } + long GetBottomMargin(const SwFrame& rFrame) const { return (rFrame.*fnRect->fnGetBottomMargin)(); } + long GetLeftMargin (const SwFrame& rFrame) const { return (rFrame.*fnRect->fnGetLeftMargin) (); } + long GetRightMargin (const SwFrame& rFrame) const { return (rFrame.*fnRect->fnGetRightMargin) (); } + void SetXMargins(SwFrame& rFrame, long nLeft, long nRight) const { (rFrame.*fnRect->fnSetXMargins)(nLeft, nRight); } + void SetYMargins(SwFrame& rFrame, long nTop, long nBottom) const { (rFrame.*fnRect->fnSetYMargins)(nTop, nBottom); } + long GetPrtTop (const SwFrame& rFrame) const { return (rFrame.*fnRect->fnGetPrtTop) (); } + long GetPrtBottom (const SwFrame& rFrame) const { return (rFrame.*fnRect->fnGetPrtBottom) (); } + long GetPrtLeft (const SwFrame& rFrame) const { return (rFrame.*fnRect->fnGetPrtLeft) (); } + long GetPrtRight (const SwFrame& rFrame) const { return (rFrame.*fnRect->fnGetPrtRight) (); } + long TopDist (const SwRect& rRect, long nPos) const { return (rRect.*fnRect->fnTopDist) (nPos); } + long BottomDist(const SwRect& rRect, long nPos) const { return (rRect.*fnRect->fnBottomDist) (nPos); } + bool SetLimit (SwFrame& rFrame, long nNew) const { return (rFrame.*fnRect->fnSetLimit) (nNew); } + bool OverStep (const SwRect& rRect, long nPos) const { return (rRect.*fnRect->fnOverStep) (nPos); } + + void SetPos(SwRect& rRect, const Point& rNew) const { (rRect.*fnRect->fnSetPos)(rNew); } + void MakePos(SwFrame& rFrame, const SwFrame* pUp, const SwFrame* pPrv, bool bNotify) const { (rFrame.*fnRect->fnMakePos)(pUp, pPrv, bNotify); } + long XDiff(long n1, long n2) const { return (fnRect->fnXDiff) (n1, n2); } + long YDiff(long n1, long n2) const { return (fnRect->fnYDiff) (n1, n2); } + long YInc (long n1, long n2) const { return (fnRect->fnYInc) (n1, n2); } + + void SetLeftAndWidth(SwRect& rRect, long nLeft, long nWidth) const { (rRect.*fnRect->fnSetLeftAndWidth)(nLeft, nWidth); } + void SetTopAndHeight(SwRect& rRect, long nTop, long nHeight) const { (rRect.*fnRect->fnSetTopAndHeight)(nTop, nHeight); } + +private: + bool bVert; + bool bRev; + bool bVertL2R; + SwRectFn fnRect; }; #endif diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index 9fe438d..c4f7d99 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -493,7 +493,7 @@ void SwAnchoredDrawObject::MakeObjPosAnchoredAtLayout() SetCurrRelPos( aObjPositioning.GetRelPos() ); const SwFrame* pAnchorFrame = GetAnchorFrame(); SwRectFnSet aRectFnSet(pAnchorFrame); - const Point aAnchPos( (pAnchorFrame->Frame().*aRectFnSet->fnGetPos)() ); + const Point aAnchPos( aRectFnSet.GetPos(pAnchorFrame->Frame()) ); 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 120666e..98a9a16 100644 --- a/sw/source/core/layout/anchoredobject.cxx +++ b/sw/source/core/layout/anchoredobject.cxx @@ -273,19 +273,15 @@ void SwAnchoredObject::CheckCharRect( const SwFormatAnchor& _rAnch, // of anchor character has changed. const sal_Int16 eVertRelOrient = aVert.GetRelationOrient(); if ( ( aHori.GetRelationOrient() == text::RelOrientation::CHAR && - (aCharRect.*aRectFnSet->fnGetLeft)() != - (maLastCharRect.*aRectFnSet->fnGetLeft)() ) || + aRectFnSet.GetLeft(aCharRect) != aRectFnSet.GetLeft(maLastCharRect) ) || ( eVertRelOrient == text::RelOrientation::CHAR && - ( (aCharRect.*aRectFnSet->fnGetTop)() != - (maLastCharRect.*aRectFnSet->fnGetTop)() || - (aCharRect.*aRectFnSet->fnGetHeight)() != - (maLastCharRect.*aRectFnSet->fnGetHeight)() ) ) || + ( aRectFnSet.GetTop(aCharRect) != aRectFnSet.GetTop(maLastCharRect) || + aRectFnSet.GetHeight(aCharRect) != aRectFnSet.GetHeight(maLastCharRect) ) ) || ( ( ( eVertRelOrient == text::RelOrientation::FRAME ) || ( eVertRelOrient == text::RelOrientation::PRINT_AREA ) || ( eVertRelOrient == text::RelOrientation::PAGE_FRAME ) || ( eVertRelOrient == text::RelOrientation::PAGE_PRINT_AREA ) ) && - ( (aCharRect.*aRectFnSet->fnGetTop)() != - (maLastCharRect.*aRectFnSet->fnGetTop)() ) ) ) + ( aRectFnSet.GetTop(aCharRect) != aRectFnSet.GetTop(maLastCharRect) ) ) ) { // #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 8f65b8e..7f2a9f0 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -93,8 +93,8 @@ bool SwContentFrame::ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool, bool & ) } SwRectFnSet aRectFnSet(this); SwRectFnSet fnRectX(pNewUpper); - if( std::abs( (pNewUpper->Prt().*fnRectX->fnGetWidth)() - - (GetUpper()->Prt().*aRectFnSet->fnGetWidth)() ) > 1 ) { + if( std::abs( fnRectX.GetWidth(pNewUpper->Prt()) - + aRectFnSet.GetWidth(GetUpper()->Prt()) ) > 1 ) { // In this case, only a WouldFit_ with test move is possible nMoveAnyway = 2; } @@ -110,7 +110,7 @@ bool SwContentFrame::ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool, bool & ) const SwFrame *pPrevFrame = pNewUpper->Lower(); while ( pPrevFrame ) { - SwTwips nNewTop = (pPrevFrame->Frame().*fnRectX->fnGetBottom)(); + SwTwips nNewTop = fnRectX.GetBottom(pPrevFrame->Frame()); // OD 2004-03-01 #106629#: // consider lower spacing of last frame in a table cell { @@ -139,7 +139,7 @@ bool SwContentFrame::ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool, bool & ) } } } - (aRect.*fnRectX->fnSetTop)( nNewTop ); + fnRectX.SetTop( aRect, nNewTop ); pPrevFrame = pPrevFrame->GetNext(); } @@ -147,7 +147,7 @@ bool SwContentFrame::ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool, bool & ) nMoveAnyway |= BwdMoveNecessary( pNewPage, aRect); //determine space left in new upper frame - nSpace = (aRect.*fnRectX->fnGetHeight)(); + nSpace = fnRectX.GetHeight(aRect); const SwViewShell *pSh = pNewUpper->getRootFrame()->GetCurrShell(); if ( IsInFootnote() || (pSh && pSh->GetViewOptions()->getBrowseMode()) || @@ -186,7 +186,7 @@ bool SwContentFrame::ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool, bool & ) // we have a fresh multi-column section - so we really have to // float back unless there is no space. return pNewUpper->IsInSct() && pNewUpper->IsColBodyFrame() && - !(pNewUpper->Prt().*fnRectX->fnGetWidth)() && + !fnRectX.GetWidth(pNewUpper->Prt()) && ( pNewUpper->GetUpper()->GetPrev() || pNewUpper->GetUpper()->GetNext() ); } @@ -504,23 +504,23 @@ void SwFrame::MakePos() { bool bR2L = IsRightToLeft(); if( bR2L ) - (maFrame.*aRectFnSet->fnSetPosX)( (maFrame.*aRectFnSet->fnGetLeft)() - - (maFrame.*aRectFnSet->fnGetWidth)() ); + aRectFnSet.SetPosX( maFrame, aRectFnSet.GetLeft(maFrame) - + aRectFnSet.GetWidth(maFrame) ); else - (maFrame.*aRectFnSet->fnSetPosX)( (maFrame.*aRectFnSet->fnGetLeft)() + - (pPrv->Frame().*aRectFnSet->fnGetWidth)() ); + aRectFnSet.SetPosX( maFrame, aRectFnSet.GetLeft(maFrame) + + aRectFnSet.GetWidth(pPrv->Frame()) ); // cells may now leave their uppers - if( aRectFnSet.bVert && SwFrameType::Cell & nMyType && !mbReverse ) + if( aRectFnSet.IsVert() && SwFrameType::Cell & nMyType && !mbReverse ) maFrame.Pos().setX(maFrame.Pos().getX() - maFrame.Width() + pPrv->Frame().Width()); } - else if( aRectFnSet.bVert && FRM_NOTE_VERT & nMyType ) + else if( aRectFnSet.IsVert() && FRM_NOTE_VERT & nMyType ) { if( mbReverse ) maFrame.Pos().setX(maFrame.Pos().getX() + pPrv->Frame().Width()); else { - if ( aRectFnSet.bVertL2R ) + if ( aRectFnSet.IsVertL2R() ) maFrame.Pos().setX(maFrame.Pos().getX() + pPrv->Frame().Width()); else maFrame.Pos().setX(maFrame.Pos().getX() - maFrame.Width()); @@ -558,17 +558,17 @@ void SwFrame::MakePos() { bool bR2L = IsRightToLeft(); if( bR2L ) - (maFrame.*aRectFnSet->fnSetPosX)( (maFrame.*aRectFnSet->fnGetLeft)() - - (maFrame.*aRectFnSet->fnGetWidth)() ); + aRectFnSet.SetPosX( maFrame, aRectFnSet.GetLeft(maFrame) - + aRectFnSet.GetWidth(maFrame) ); else - (maFrame.*aRectFnSet->fnSetPosX)( (maFrame.*aRectFnSet->fnGetLeft)() + - (pPrv->Frame().*aRectFnSet->fnGetWidth)() ); + aRectFnSet.SetPosX( maFrame, aRectFnSet.GetLeft(maFrame) + + aRectFnSet.GetWidth(pPrv->Frame()) ); // cells may now leave their uppers - if( aRectFnSet.bVert && SwFrameType::Cell & nMyType && !mbReverse ) + if( aRectFnSet.IsVert() && SwFrameType::Cell & nMyType && !mbReverse ) maFrame.Pos().setX(maFrame.Pos().getX() - maFrame.Width() + pPrv->Frame().Width()); } - else if( aRectFnSet.bVert && FRM_NOTE_VERT & nMyType ) + else if( aRectFnSet.IsVert() && FRM_NOTE_VERT & nMyType ) { if( mbReverse ) maFrame.Pos().setX(maFrame.Pos().getX() + pPrv->Frame().Width()); @@ -588,14 +588,14 @@ void SwFrame::MakePos() if( FRM_NEIGHBOUR & nMyType && IsRightToLeft() ) { - if( aRectFnSet.bVert ) + if( aRectFnSet.IsVert() ) 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( aRectFnSet.bVert && !aRectFnSet.bVertL2R && FRM_NOTE_VERT & nMyType && !mbReverse ) + else if( aRectFnSet.IsVert() && !aRectFnSet.IsVertL2R() && FRM_NOTE_VERT & nMyType && !mbReverse ) maFrame.Pos().setX(maFrame.Pos().getX() - maFrame.Width() + GetUpper()->Prt().Width()); } } @@ -605,7 +605,7 @@ void SwFrame::MakePos() maFrame.Pos().setY(0); } - if( IsBodyFrame() && aRectFnSet.bVert && !aRectFnSet.bVertL2R && !mbReverse && GetUpper() ) + if( IsBodyFrame() && aRectFnSet.IsVert() && !aRectFnSet.IsVertL2R() && !mbReverse && GetUpper() ) maFrame.Pos().setX(maFrame.Pos().getX() + GetUpper()->Prt().Width() - maFrame.Width()); mbValidPos = true; } @@ -961,13 +961,13 @@ bool SwContentFrame::MakePrtArea( const SwBorderAttrs &rAttrs ) if ( static_cast<SwTextFrame*>(this)->HasFollow() ) static_cast<SwTextFrame*>(this)->JoinFrame(); - if( (Prt().*aRectFnSet->fnGetHeight)() ) + if( aRectFnSet.GetHeight(Prt()) ) static_cast<SwTextFrame*>(this)->HideHidden(); Prt().Pos().setX(0); Prt().Pos().setY(0); - (Prt().*aRectFnSet->fnSetWidth)( (Frame().*aRectFnSet->fnGetWidth)() ); - (Prt().*aRectFnSet->fnSetHeight)( 0 ); - nUpper = -( (Frame().*aRectFnSet->fnGetHeight)() ); + aRectFnSet.SetWidth( Prt(), aRectFnSet.GetWidth(Frame()) ); + aRectFnSet.SetHeight( Prt(), 0 ); + nUpper = -( aRectFnSet.GetHeight(Frame()) ); } else { @@ -977,11 +977,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->*aRectFnSet->fnSetXMargins)( nLeft, nRight ); + aRectFnSet.SetXMargins( *this, nLeft, nRight ); SwViewShell *pSh = getRootFrame()->GetCurrShell(); SwTwips nWidthArea; - if( pSh && 0!=(nWidthArea=(pSh->VisArea().*aRectFnSet->fnGetWidth)()) && + if( pSh && 0!=(nWidthArea=aRectFnSet.GetWidth(pSh->VisArea())) && GetUpper()->IsPageBodyFrame() && // but not for BodyFrames in Columns pSh->GetViewOptions()->getBrowseMode() ) { @@ -1013,23 +1013,21 @@ 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().*aRectFnSet->fnGetLeft)(); + nWidth -= aRectFnSet.GetLeft(Prt()); nWidth -= rAttrs.CalcRightLine(); nWidth = std::max( nMinWidth, nWidth ); - (Prt().*aRectFnSet->fnSetWidth)( std::min( nWidth, - (Prt().*aRectFnSet->fnGetWidth)() ) ); + aRectFnSet.SetWidth( Prt(), std::min( nWidth, aRectFnSet.GetWidth(Prt()) ) ); } - if ( (Prt().*aRectFnSet->fnGetWidth)() <= MINLAY ) + if ( aRectFnSet.GetWidth(Prt()) <= MINLAY ) { // The PrtArea should already be at least MINLAY wide, matching the // minimal values of the UI - (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 ); + aRectFnSet.SetWidth( Prt(), std::min( long(MINLAY), aRectFnSet.GetWidth(Frame()) ) ); + SwTwips nTmp = aRectFnSet.GetWidth(Frame()) - + aRectFnSet.GetWidth(Prt()); + if( aRectFnSet.GetLeft(Prt()) > nTmp ) + aRectFnSet.SetLeft( Prt(), nTmp ); } // The following rules apply for VarSize: @@ -1052,10 +1050,10 @@ bool SwContentFrame::MakePrtArea( const SwBorderAttrs &rAttrs ) nLower=0; } - (Prt().*aRectFnSet->fnSetPosY)( (!aRectFnSet.bVert || mbReverse) ? nUpper : nLower); + aRectFnSet.SetPosY( Prt(), (!aRectFnSet.IsVert() || mbReverse) ? nUpper : nLower); nUpper += nLower; - nUpper -= (Frame().*aRectFnSet->fnGetHeight)() - - (Prt().*aRectFnSet->fnGetHeight)(); + nUpper -= aRectFnSet.GetHeight(Frame()) - + aRectFnSet.GetHeight(Prt()); } // If there's a difference between old and new size, call Grow() or // Shrink() respectively. @@ -1280,8 +1278,8 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) } } - aOldFramePos = (Frame().*aRectFnSet->fnGetPos)(); - aOldPrtPos = (Prt().*aRectFnSet->fnGetPos)(); + aOldFramePos = aRectFnSet.GetPos(Frame()); + aOldPrtPos = aRectFnSet.GetPos(Prt()); if ( !mbValidPos ) MakePos(); @@ -1300,15 +1298,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().*aRectFnSet->fnGetWidth)(); + const SwTwips nNewFrameWidth = aRectFnSet.GetWidth(GetUpper()->Prt()); if ( mbValidPrtArea && nNewFrameWidth > 0 && - (Frame().*aRectFnSet->fnGetWidth)() == 0 && - (Prt().*aRectFnSet->fnGetWidth)() == 0 ) + aRectFnSet.GetWidth(Frame()) == 0 && + aRectFnSet.GetWidth(Prt()) == 0 ) { mbValidPrtArea = false; } - (Frame().*aRectFnSet->fnSetWidth)( nNewFrameWidth ); + aRectFnSet.SetWidth( Frame(), nNewFrameWidth ); // When a lower of a vertically aligned fly frame changes its size we need to recalculate content pos. if( GetUpper() && GetUpper()->IsFlyFrame() && @@ -1320,11 +1318,11 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) } if ( !mbValidPrtArea ) { - const long nOldW = (Prt().*aRectFnSet->fnGetWidth)(); + const long nOldW = aRectFnSet.GetWidth(Prt()); // #i34730# - keep current frame height - const SwTwips nOldH = (Frame().*aRectFnSet->fnGetHeight)(); + const SwTwips nOldH = aRectFnSet.GetHeight(Frame()); MakePrtArea( rAttrs ); - if ( nOldW != (Prt().*aRectFnSet->fnGetWidth)() ) + if ( nOldW != aRectFnSet.GetWidth(Prt()) ) Prepare( PREP_FIXSIZE_CHG ); // #i34730# - check, if frame height has changed. // If yes, send a PREP_ADJUST_FRM and invalidate the size flag to @@ -1333,16 +1331,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().*aRectFnSet->fnGetHeight)() ) + nOldH != aRectFnSet.GetHeight(Frame()) ) { // #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().*aRectFnSet->fnGetHeight)(); + const SwTwips nHDiff = nOldH - aRectFnSet.GetHeight(Frame()); const bool bNoPrepAdjustFrame = nHDiff > 0 && IsInTab() && GetFollow() && - ( 1 == static_cast<SwTextFrame*>(GetFollow())->GetLineCount( COMPLETE_STRING ) || (static_cast<SwTextFrame*>(GetFollow())->Frame().*aRectFnSet->fnGetWidth)() < 0 ) && + ( 1 == static_cast<SwTextFrame*>(GetFollow())->GetLineCount( COMPLETE_STRING ) || aRectFnSet.GetWidth(static_cast<SwTextFrame*>(GetFollow())->Frame()) < 0 ) && GetFollow()->CalcAddLowerSpaceAsLastInTableCell() == nHDiff; if ( !bNoPrepAdjustFrame ) { @@ -1359,15 +1357,15 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) if ( !bMustFit ) { bool bWidow = true; - const SwTwips nDeadLine = (GetUpper()->*aRectFnSet->fnGetPrtBottom)(); - if ( bMoveable && !bFormatted && ( GetFollow() || - ( (Frame().*aRectFnSet->fnOverStep)( nDeadLine ) ) ) ) + const SwTwips nDeadLine = aRectFnSet.GetPrtBottom(*GetUpper()); + if( bMoveable && !bFormatted && + ( GetFollow() || aRectFnSet.OverStep( Frame(), nDeadLine ) ) ) { Prepare( PREP_WIDOWS_ORPHANS, nullptr, false ); mbValidSize = bWidow = false; } - if( (Frame().*aRectFnSet->fnGetPos)() != aOldFramePos || - (Prt().*aRectFnSet->fnGetPos)() != aOldPrtPos ) + if( aRectFnSet.GetPos(Frame()) != aOldFramePos || + aRectFnSet.GetPos(Prt()) != aOldPrtPos ) { // In this Prepare, an InvalidateSize_() might happen. // mbValidSize becomes false and Format() gets called. @@ -1423,20 +1421,19 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) bMoveable = IsMoveable(); aRectFnSet.Refresh(this); } - Point aOldPos = (Frame().*aRectFnSet->fnGetPos)(); + Point aOldPos = aRectFnSet.GetPos(Frame()); MakePos(); - if( aOldPos != (Frame().*aRectFnSet->fnGetPos)() ) + if( aOldPos != aRectFnSet.GetPos(Frame()) ) { Prepare( PREP_POS_CHGD, static_cast<const void*>(&bFormatted), false ); if ( !mbValidSize ) { - (Frame().*aRectFnSet->fnSetWidth)( (GetUpper()-> - Prt().*aRectFnSet->fnGetWidth)() ); + aRectFnSet.SetWidth( Frame(), aRectFnSet.GetWidth(GetUpper()->Prt()) ); if ( !mbValidPrtArea ) { - const long nOldW = (Prt().*aRectFnSet->fnGetWidth)(); + const long nOldW = aRectFnSet.GetWidth(Prt()); MakePrtArea( rAttrs ); - if( nOldW != (Prt().*aRectFnSet->fnGetWidth)() ) + if( nOldW != aRectFnSet.GetWidth(Prt()) ) Prepare( PREP_FIXSIZE_CHG, nullptr, false ); } if( GetFollow() ) @@ -1496,8 +1493,8 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) { mbValidPos = false; MakePos(); - aOldFramePos = (Frame().*aRectFnSet->fnGetPos)(); - aOldPrtPos = (Prt().*aRectFnSet->fnGetPos)(); + aOldFramePos = aRectFnSet.GetPos(Frame()); + aOldPrtPos = aRectFnSet.GetPos(Prt()); } } @@ -1522,8 +1519,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()->*aRectFnSet->fnGetPrtBottom)(); - long nBottomDist = (Frame().*aRectFnSet->fnBottomDist)(nPrtBottom); + const long nPrtBottom = aRectFnSet.GetPrtBottom(*GetUpper()); + long nBottomDist = aRectFnSet.BottomDist(Frame(), nPrtBottom); // Hide whitespace may require not to insert a new page. SwPageFrame* pPageFrame = FindPageFrame(); @@ -1562,7 +1559,7 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) { const bool bMoveFwdInvalid = nullptr != GetIndNext(); const bool bNxtNew = - ( 0 == (pNxt->Prt().*aRectFnSet->fnGetHeight)() ) && + ( 0 == aRectFnSet.GetHeight(pNxt->Prt()) ) && (!pNxt->IsTextFrame() ||!static_cast<SwTextFrame*>(pNxt)->IsHiddenNow()); pNxt->Calc(getRootFrame()->GetCurrShell()->GetOut()); @@ -1590,8 +1587,7 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) { if( !bMoveable && IsInTab() ) { - long nDiff = -(Frame().*aRectFnSet->fnBottomDist)( - (GetUpper()->*aRectFnSet->fnGetPrtBottom)() ); + long nDiff = -aRectFnSet.BottomDist( Frame(), aRectFnSet.GetPrtBottom(*GetUpper()) ); long nReal = GetUpper()->Grow( nDiff ); if( nReal ) continue; @@ -1623,13 +1619,13 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) nullptr != GetNextCellLeaf( MAKEPAGE_NONE ) ) bDontMoveMe = false; - if ( bDontMoveMe && (Frame().*aRectFnSet->fnGetHeight)() > - (GetUpper()->Prt().*aRectFnSet->fnGetHeight)() ) + if ( bDontMoveMe && aRectFnSet.GetHeight(Frame()) > + aRectFnSet.GetHeight(GetUpper()->Prt()) ) { if ( !bFitPromise ) { - SwTwips nTmp = (GetUpper()->Prt().*aRectFnSet->fnGetHeight)() - - (Prt().*aRectFnSet->fnGetTop)(); + SwTwips nTmp = aRectFnSet.GetHeight(GetUpper()->Prt()) - + aRectFnSet.GetTop(Prt()); bool bSplit = !IsFwdMoveAllowed(); if ( nTmp > 0 && WouldFit( nTmp, bSplit, false ) ) { @@ -1679,7 +1675,7 @@ void SwContentFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) } const bool bCheckForGrownBody = pOldUp->IsBodyFrame(); - const long nOldBodyHeight = (pOldUp->Frame().*aRectFnSet->fnGetHeight)(); + const long nOldBodyHeight = aRectFnSet.GetHeight(pOldUp->Frame()); if ( !bMovedFwd && !MoveFwd( bMakePage, false ) ) bMakePage = false; @@ -1692,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().*aRectFnSet->fnGetHeight)() > nOldBodyHeight ) + aRectFnSet.GetHeight(pOldUp->Frame()) > nOldBodyHeight ) { bMovedFwd = false; } diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index d517103..ffa8168 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -512,7 +512,7 @@ bool SwFlowFrame::PasteTree( SwFrame *pStart, SwLayoutFrame *pParent, SwFrame *p else bRet = true; - nGrowVal += (pFloat->Frame().*aRectFnSet->fnGetHeight)(); + nGrowVal += aRectFnSet.GetHeight(pFloat->Frame()); if ( pFloat->GetNext() ) pFloat = pFloat->GetNext(); else @@ -1542,25 +1542,25 @@ SwTwips SwFlowFrame::GetUpperSpaceAmountConsideredForPageGrid_( pGrid->GetBaseHeight() + pGrid->GetRubyHeight(); SwRectFnSet aRectFnSet(&m_rThis); - const SwTwips nBodyPrtTop = (pBodyFrame->*aRectFnSet->fnGetPrtTop)(); + const SwTwips nBodyPrtTop = aRectFnSet.GetPrtTop(*pBodyFrame); const SwTwips nProposedPrtTop = - (*aRectFnSet->fnYInc)( (m_rThis.Frame().*aRectFnSet->fnGetTop)(), + aRectFnSet.YInc( aRectFnSet.GetTop(m_rThis.Frame()), _nUpperSpaceWithoutGrid ); const SwTwips nSpaceAbovePrtTop = - (*aRectFnSet->fnYDiff)( nProposedPrtTop, nBodyPrtTop ); + aRectFnSet.YDiff( nProposedPrtTop, nBodyPrtTop ); const SwTwips nSpaceOfCompleteLinesAbove = nGridLineHeight * ( nSpaceAbovePrtTop / nGridLineHeight ); SwTwips nNewPrtTop = - (*aRectFnSet->fnYInc)( nBodyPrtTop, nSpaceOfCompleteLinesAbove ); - if ( (*aRectFnSet->fnYDiff)( nProposedPrtTop, nNewPrtTop ) > 0 ) + aRectFnSet.YInc( nBodyPrtTop, nSpaceOfCompleteLinesAbove ); + if ( aRectFnSet.YDiff( nProposedPrtTop, nNewPrtTop ) > 0 ) { - nNewPrtTop = (*aRectFnSet->fnYInc)( nNewPrtTop, nGridLineHeight ); + nNewPrtTop = aRectFnSet.YInc( nNewPrtTop, nGridLineHeight ); } const SwTwips nNewUpperSpace = - (*aRectFnSet->fnYDiff)( nNewPrtTop, - (m_rThis.Frame().*aRectFnSet->fnGetTop)() ); + aRectFnSet.YDiff( nNewPrtTop, + aRectFnSet.GetTop(m_rThis.Frame()) ); nUpperSpaceAmountConsideredForPageGrid = nNewUpperSpace - _nUpperSpaceWithoutGrid; @@ -1902,7 +1902,7 @@ bool SwFlowFrame::MoveFwd( bool bMakePage, bool bPageBreak, bool bMoveAlways ) // silly things... SwRectFnSet aRectFnSet(pOldBoss); SwSaveFootnoteHeight aHeight( pOldBoss, - (pOldBoss->Frame().*aRectFnSet->fnGetBottom)() ); + aRectFnSet.GetBottom(pOldBoss->Frame()) ); 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 1ab6bd1..30d6930 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -32,7 +32,6 @@ #include <fmtsrnd.hxx> #include <fmtornt.hxx> #include <fmtcnct.hxx> -#include <layhelp.hxx> #include <ndgrf.hxx> #include <tolayoutanchoredobjectposition.hxx> #include <fmtfollowtextflow.hxx> @@ -486,10 +485,10 @@ void SwFlyFrame::ChainFrames( SwFlyFrame *pMaster, SwFlyFrame *pFollow ) // To get a text flow we need to invalidate SwFrame *pInva = pMaster->FindLastLower(); SwRectFnSet aRectFnSet(pMaster); - const long nBottom = (pMaster->*aRectFnSet->fnGetPrtBottom)(); + const long nBottom = aRectFnSet.GetPrtBottom(*pMaster); while ( pInva ) { - if( (pInva->Frame().*aRectFnSet->fnBottomDist)( nBottom ) <= 0 ) + if( aRectFnSet.BottomDist( pInva->Frame(), nBottom ) <= 0 ) { pInva->InvalidateSize(); pInva->Prepare(); @@ -1264,7 +1263,7 @@ void SwFlyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA { long nMinHeight = 0; if( IsMinHeight() ) - nMinHeight = aRectFnSet.bVert ? aRelSize.Width() : aRelSize.Height(); + nMinHeight = aRectFnSet.IsVert() ? aRelSize.Width() : aRelSize.Height(); SwTwips nRemaining = CalcContentHeight(pAttrs, nMinHeight, nUL); if( IsMinHeight() && (nRemaining + nUL) < nMinHeight ) @@ -1279,9 +1278,9 @@ void SwFlyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA if ( nRemaining < MINFLY ) nRemaining = MINFLY; - (Prt().*aRectFnSet->fnSetHeight)( nRemaining ); - nRemaining -= (Frame().*aRectFnSet->fnGetHeight)(); - (Frame().*aRectFnSet->fnAddBottom)( nRemaining + nUL ); + aRectFnSet.SetHeight( Prt(), nRemaining ); + nRemaining -= aRectFnSet.GetHeight(Frame()); + aRectFnSet.AddBottom( Frame(), nRemaining + nUL ); // #i68520# if ( nRemaining + nUL != 0 ) { @@ -1296,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().*aRectFnSet->fnGetWidth)(), (Frame().*aRectFnSet->fnGetHeight)()); + Size aSize(aRectFnSet.GetWidth(Frame()), aRectFnSet.GetHeight(Frame())); pCustomShape->SuggestTextFrameSize(aSize); // Do the calculations normally done after touching editeng text of the shape. pCustomShape->NbcSetOutlinerParaObjectForText(nullptr, nullptr); @@ -1307,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 = aRectFnSet.bVert ? aRelSize.Width() : aRelSize.Height(); + SwTwips nNewSize = aRectFnSet.IsVert() ? aRelSize.Width() : aRelSize.Height(); nNewSize -= nUL; if( nNewSize < MINFLY ) nNewSize = MINFLY; - (Prt().*aRectFnSet->fnSetHeight)( nNewSize ); - nNewSize += nUL - (Frame().*aRectFnSet->fnGetHeight)(); - (Frame().*aRectFnSet->fnAddBottom)( nNewSize ); + aRectFnSet.SetHeight( Prt(), nNewSize ); + nNewSize += nUL - aRectFnSet.GetHeight(Frame()); + aRectFnSet.AddBottom( Frame(), nNewSize ); // #i68520# if ( nNewSize != 0 ) { @@ -1324,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 = aRectFnSet.bVert ? aRelSize.Height() : aRelSize.Width(); + SwTwips nNewSize = aRectFnSet.IsVert() ? aRelSize.Height() : aRelSize.Width(); if ( rFrameSz.GetWidthSizeType() != ATT_FIX_SIZE ) { @@ -1343,9 +1342,9 @@ void SwFlyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA if( nNewSize < MINFLY ) nNewSize = MINFLY; - (Prt().*aRectFnSet->fnSetWidth)( nNewSize ); - nNewSize += nLR - (Frame().*aRectFnSet->fnGetWidth)(); - (Frame().*aRectFnSet->fnAddRight)( nNewSize ); + aRectFnSet.SetWidth( Prt(), nNewSize ); + nNewSize += nLR - aRectFnSet.GetWidth(Frame()); + aRectFnSet.AddRight( Frame(), nNewSize ); // #i68520# if ( nNewSize != 0 ) { @@ -1692,7 +1691,7 @@ void SwFlyFrame::MakeObjPos() SwRectFnSet aRectFnSet(GetAnchorFrame()); maFrame.Pos( aObjPositioning.GetRelPos() ); - maFrame.Pos() += (GetAnchorFrame()->Frame().*aRectFnSet->fnGetPos)(); + maFrame.Pos() += aRectFnSet.GetPos(GetAnchorFrame()->Frame()); // #i69335# InvalidateObjRectWithSpaces(); } @@ -1706,9 +1705,9 @@ void SwFlyFrame::MakePrtArea( const SwBorderAttrs &rAttrs ) // OD 31.07.2003 #110978# - consider vertical layout SwRectFnSet aRectFnSet(this); - (this->*aRectFnSet->fnSetXMargins)( rAttrs.CalcLeftLine(), + aRectFnSet.SetXMargins( *this, rAttrs.CalcLeftLine(), rAttrs.CalcRightLine() ); - (this->*aRectFnSet->fnSetYMargins)( rAttrs.CalcTopLine(), + aRectFnSet.SetYMargins( *this, rAttrs.CalcTopLine(), rAttrs.CalcBottomLine() ); } } @@ -1725,7 +1724,7 @@ void SwFlyFrame::MakeContentPos( const SwBorderAttrs &rAttrs ) SwRectFnSet aRectFnSet(this); long nMinHeight = 0; if( IsMinHeight() ) - nMinHeight = aRectFnSet.bVert ? aRelSize.Width() : aRelSize.Height(); + nMinHeight = aRectFnSet.IsVert() ? aRelSize.Width() : aRelSize.Height(); Point aNewContentPos; aNewContentPos = Prt().Pos(); @@ -1737,24 +1736,24 @@ void SwFlyFrame::MakeContentPos( const SwBorderAttrs &rAttrs ) SwTwips nDiff = 0; if( nContentHeight != 0) - nDiff = (Prt().*aRectFnSet->fnGetHeight)() - nContentHeight; + nDiff = aRectFnSet.GetHeight(Prt()) - nContentHeight; if( nDiff > 0 ) { if( nAdjust == SDRTEXTVERTADJUST_CENTER ) { - if( aRectFnSet.bVertL2R ) + if( aRectFnSet.IsVertL2R() ) aNewContentPos.setX(aNewContentPos.getX() + nDiff/2); - else if( aRectFnSet.bVert ) + else if( aRectFnSet.IsVert() ) aNewContentPos.setX(aNewContentPos.getX() - nDiff/2); else aNewContentPos.setY(aNewContentPos.getY() + nDiff/2); } else if( nAdjust == SDRTEXTVERTADJUST_BOTTOM ) { - if( aRectFnSet.bVertL2R ) + if( aRectFnSet.IsVertL2R() ) aNewContentPos.setX(aNewContentPos.getX() + nDiff); - else if( aRectFnSet.bVert ) + else if( aRectFnSet.IsVert() ) aNewContentPos.setX(aNewContentPos.getX() - nDiff); else aNewContentPos.setY(aNewContentPos.getY() + nDiff); @@ -1783,7 +1782,7 @@ SwTwips SwFlyFrame::Grow_( SwTwips nDist, bool bTst ) SwRectFnSet aRectFnSet(this); if ( Lower() && !IsColLocked() && !HasFixSize() ) { - SwTwips nSize = (Frame().*aRectFnSet->fnGetHeight)(); + SwTwips nSize = aRectFnSet.GetHeight(Frame()); if( nSize > 0 && nDist > ( LONG_MAX - nSize ) ) nDist = LONG_MAX - nSize; @@ -1846,7 +1845,7 @@ SwTwips SwFlyFrame::Grow_( SwTwips nDist, bool bTst ) const SwRect aNew( GetObjRectWithSpaces() ); if ( aOld != aNew ) ::Notify( this, FindPageFrame(), aOld ); - return (aNew.*aRectFnSet->fnGetHeight)()-(aOld.*aRectFnSet->fnGetHeight)(); + return aRectFnSet.GetHeight(aNew)-aRectFnSet.GetHeight(aOld); } return nDist; } @@ -1858,7 +1857,7 @@ SwTwips SwFlyFrame::Shrink_( SwTwips nDist, bool bTst ) if( Lower() && !IsColLocked() && !HasFixSize() ) { SwRectFnSet aRectFnSet(this); - SwTwips nHeight = (Frame().*aRectFnSet->fnGetHeight)(); + SwTwips nHeight = aRectFnSet.GetHeight(Frame()); if ( nDist > nHeight ) nDist = nHeight; @@ -1866,7 +1865,7 @@ SwTwips SwFlyFrame::Shrink_( SwTwips nDist, bool bTst ) if ( IsMinHeight() ) { const SwFormatFrameSize& rFormatSize = GetFormat()->GetFrameSize(); - SwTwips nFormatHeight = aRectFnSet.bVert ? rFormatSize.GetWidth() : rFormatSize.GetHeight(); + SwTwips nFormatHeight = aRectFnSet.IsVert() ? rFormatSize.GetWidth() : rFormatSize.GetHeight(); nVal = std::min( nDist, nHeight - nFormatHeight ); } @@ -1880,14 +1879,14 @@ SwTwips SwFlyFrame::Shrink_( SwTwips nDist, bool bTst ) if ( !bTst ) { SwRect aOld( GetObjRectWithSpaces() ); - (Frame().*aRectFnSet->fnSetHeight)( nHeight - nVal ); + aRectFnSet.SetHeight( Frame(), nHeight - nVal ); // #i68520# if ( nHeight - nVal != 0 ) { InvalidateObjRectWithSpaces(); } - nHeight = (Prt().*aRectFnSet->fnGetHeight)(); - (Prt().*aRectFnSet->fnSetHeight)( nHeight - nVal ); + nHeight = aRectFnSet.GetHeight(Prt()); + aRectFnSet.SetHeight( Prt(), nHeight - nVal ); InvalidatePos_(); InvalidateSize(); ::Notify( this, FindPageFrame(), aOld ); @@ -1945,8 +1944,8 @@ SwTwips SwFlyFrame::Shrink_( SwTwips nDist, bool bTst ) if ( GetAnchorFrame()->IsInFly() ) AnchorFrame()->FindFlyFrame()->Shrink( nDist, bTst ); } - return (aOld.*aRectFnSet->fnGetHeight)() - - (aNew.*aRectFnSet->fnGetHeight)(); + return aRectFnSet.GetHeight(aOld) - + aRectFnSet.GetHeight(aNew); } return nVal; } @@ -2654,18 +2653,18 @@ SwTwips SwFlyFrame::CalcContentHeight(const SwBorderAttrs *pAttrs, const SwTwips if ( Lower()->IsColumnFrame() ) { FormatWidthCols( *pAttrs, nUL, nMinHeight ); - nHeight = (Lower()->Frame().*aRectFnSet->fnGetHeight)(); + nHeight = aRectFnSet.GetHeight(Lower()->Frame()); } else { SwFrame *pFrame = Lower(); while ( pFrame ) { - nHeight += (pFrame->Frame().*aRectFnSet->fnGetHeight)(); + nHeight += aRectFnSet.GetHeight(pFrame->Frame()); 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().*aRectFnSet->fnGetHeight)(); + - aRectFnSet.GetHeight(pFrame->Prt()); else if( pFrame->IsSctFrame() && static_cast<SwSectionFrame*>(pFrame)->IsUndersized() ) nHeight += static_cast<SwSectionFrame*>(pFrame)->Undersize(); pFrame = pFrame->GetNext(); @@ -2674,9 +2673,9 @@ SwTwips SwFlyFrame::CalcContentHeight(const SwBorderAttrs *pAttrs, const SwTwips if ( GetDrawObjs() ) { const size_t nCnt = GetDrawObjs()->size(); - SwTwips nTop = (Frame().*aRectFnSet->fnGetTop)(); - SwTwips nBorder = (Frame().*aRectFnSet->fnGetHeight)() - - (Prt().*aRectFnSet->fnGetHeight)(); + SwTwips nTop = aRectFnSet.GetTop(Frame()); + SwTwips nBorder = aRectFnSet.GetHeight(Frame()) - + aRectFnSet.GetHeight(Prt()); for ( size_t i = 0; i < nCnt; ++i ) { SwAnchoredObject* pAnchoredObj = (*GetDrawObjs())[i]; @@ -2689,8 +2688,7 @@ SwTwips SwFlyFrame::CalcContentHeight(const SwBorderAttrs *pAttrs, const SwTwips pFly->Frame().Top() != FAR_AWAY && pFly->GetFormat()->GetFollowTextFlow().GetValue() ) { - SwTwips nDist = -(pFly->Frame().*aRectFnSet-> - fnBottomDist)( nTop ); + SwTwips nDist = -aRectFnSet.BottomDist( pFly->Frame(), 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 9e70c76..98c553f 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -385,10 +385,10 @@ void SwFlyAtContentFrame::MakeAll(vcl::RenderContext* pRenderContext) bool bConsiderWrapInfluenceDueToMovedFwdAnchor( false ); do { SwRectFnSet aRectFnSet(this); - Point aOldPos( (Frame().*aRectFnSet->fnGetPos)() ); + Point aOldPos( aRectFnSet.GetPos(Frame()) ); SwFlyFreeFrame::MakeAll(pRenderContext); const bool bPosChgDueToOwnFormat = - aOldPos != (Frame().*aRectFnSet->fnGetPos)(); + aOldPos != aRectFnSet.GetPos(Frame()); // #i3317# if ( !ConsiderObjWrapInfluenceOnObjPos() && OverlapsPrevColumn() ) @@ -446,7 +446,7 @@ void SwFlyAtContentFrame::MakeAll(vcl::RenderContext* pRenderContext) } } - if ( aOldPos != (Frame().*aRectFnSet->fnGetPos)() || + if ( aOldPos != aRectFnSet.GetPos(Frame()) || ( !GetValidPosFlag() && ( pFooter || bPosChgDueToOwnFormat ) ) ) { @@ -507,8 +507,8 @@ void SwFlyAtContentFrame::MakeAll(vcl::RenderContext* pRenderContext) if ( pCellFrame ) { SwRectFnSet aRectFnSet(pCellFrame); - if ( (pCellFrame->Frame().*aRectFnSet->fnGetTop)() == 0 && - (pCellFrame->Frame().*aRectFnSet->fnGetHeight)() == 0 ) + if ( aRectFnSet.GetTop(pCellFrame->Frame()) == 0 && + aRectFnSet.GetHeight(pCellFrame->Frame()) == 0 ) { bConsiderWrapInfluenceDueToMovedFwdAnchor = false; } diff --git a/sw/source/core/layout/flyincnt.cxx b/sw/source/core/layout/flyincnt.cxx index 44dfb9b..a18562d 100644 --- a/sw/source/core/layout/flyincnt.cxx +++ b/sw/source/core/layout/flyincnt.cxx @@ -73,7 +73,7 @@ void SwFlyInContentFrame::SetRefPoint( const Point& rPoint, aRef = rPoint; SetCurrRelPos( rRelAttr ); SwRectFnSet aRectFnSet(GetAnchorFrame()); - (Frame().*aRectFnSet->fnSetPos)( rPoint + rRelPos ); + aRectFnSet.SetPos( Frame(), rPoint + rRelPos ); // #i68520# InvalidateObjRectWithSpaces(); if( pNotify ) diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index 85fc5b9..4a462ad 100644 --- a/sw/source/core/layout/flylay.cxx +++ b/sw/source/core/layout/flylay.cxx @@ -176,7 +176,7 @@ void SwFlyFreeFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) if ( !mbValidPos ) { - const Point aOldPos( (Frame().*aRectFnSet->fnGetPos)() ); + const Point aOldPos( aRectFnSet.GetPos(Frame()) ); // #i26791# - use new method <MakeObjPos()> // #i34753# - no positioning, if requested. if ( IsNoMakePos() ) @@ -184,7 +184,7 @@ void SwFlyFreeFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) else // #i26791# - use new method <MakeObjPos()> MakeObjPos(); - if( aOldPos == (Frame().*aRectFnSet->fnGetPos)() ) + if( aOldPos == aRectFnSet.GetPos(Frame()) ) { if( !mbValidPos && GetAnchorFrame()->IsInSct() && !GetAnchorFrame()->FindSctFrame()->IsValid() ) @@ -217,8 +217,8 @@ void SwFlyFreeFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) #if OSL_DEBUG_LEVEL > 0 SwRectFnSet aRectFnSet(this); - OSL_ENSURE( m_bHeightClipped || ( (Frame().*aRectFnSet->fnGetHeight)() > 0 && - (Prt().*aRectFnSet->fnGetHeight)() > 0), + OSL_ENSURE( m_bHeightClipped || ( aRectFnSet.GetHeight(Frame()) > 0 && + aRectFnSet.GetHeight(Prt()) > 0), "SwFlyFreeFrame::Format(), flipping Fly." ); #endif @@ -934,16 +934,16 @@ bool CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, bool bMove ) if( rV.GetVertOrient() != text::VertOrientation::NONE && rV.GetRelationOrient() == text::RelOrientation::PRINT_AREA ) { - (rRect.*aRectFnSet->fnSetTop)( (pClip->*aRectFnSet->fnGetPrtTop)() ); - (rRect.*aRectFnSet->fnSetBottom)( (pClip->*aRectFnSet->fnGetPrtBottom)() ); + aRectFnSet.SetTop( rRect, aRectFnSet.GetPrtTop(*pClip) ); + aRectFnSet.SetBottom( rRect, aRectFnSet.GetPrtBottom(*pClip) ); } // horizontal clipping: Top and Bottom, also to PrtArea if necessary const SwFormatHoriOrient &rH = pFly->GetFormat()->GetHoriOrient(); if( rH.GetHoriOrient() != text::HoriOrientation::NONE && rH.GetRelationOrient() == text::RelOrientation::PRINT_AREA ) { - (rRect.*aRectFnSet->fnSetLeft)( (pClip->*aRectFnSet->fnGetPrtLeft)() ); - (rRect.*aRectFnSet->fnSetRight)((pClip->*aRectFnSet->fnGetPrtRight)()); + aRectFnSet.SetLeft( rRect, aRectFnSet.GetPrtLeft(*pClip) ); + aRectFnSet.SetRight(rRect, aRectFnSet.GetPrtRight(*pClip)); } } else if( pFly->IsFlyAtContentFrame() ) @@ -1019,8 +1019,8 @@ bool CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, bool bMove ) const SwLayoutFrame* pHoriClipFrame = pFly->GetAnchorFrame()->FindPageFrame()->GetUpper(); SwRectFnSet aRectFnSet(pFly->GetAnchorFrame()); - (rRect.*aRectFnSet->fnSetLeft)( (pHoriClipFrame->Frame().*aRectFnSet->fnGetLeft)() ); - (rRect.*aRectFnSet->fnSetRight)((pHoriClipFrame->Frame().*aRectFnSet->fnGetRight)()); + aRectFnSet.SetLeft( rRect, aRectFnSet.GetLeft(pHoriClipFrame->Frame()) ); + aRectFnSet.SetRight(rRect, aRectFnSet.GetRight(pHoriClipFrame->Frame())); } else { @@ -1061,8 +1061,8 @@ bool CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, bool bMove ) if (pUp) { rRect = pUp->GetUpper()->Frame(); - (rRect.*aRectFnSet->fnSetTop)( (pUp->*aRectFnSet->fnGetPrtTop)() ); - (rRect.*aRectFnSet->fnSetBottom)((pUp->*aRectFnSet->fnGetPrtBottom)()); + aRectFnSet.SetTop( rRect, aRectFnSet.GetPrtTop(*pUp) ); + aRectFnSet.SetBottom(rRect, aRectFnSet.GetPrtBottom(*pUp)); } } else @@ -1103,8 +1103,7 @@ bool CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, bool bMove ) else if ( pUp->IsCellFrame() ) //MA_FLY_HEIGHT { const SwFrame *pTab = pUp->FindTabFrame(); - (rRect.*aRectFnSet->fnSetBottom)( - (pTab->GetUpper()->*aRectFnSet->fnGetPrtBottom)() ); + aRectFnSet.SetBottom( rRect, aRectFnSet.GetPrtBottom(*pTab->GetUpper()) ); // expand to left and right cell border rRect.Left ( pUp->Frame().Left() ); rRect.Width( pUp->Frame().Width() ); ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits