diff options
Diffstat (limited to 'sw/source/core/layout/tabfrm.cxx')
-rw-r--r-- | sw/source/core/layout/tabfrm.cxx | 397 |
1 files changed, 235 insertions, 162 deletions
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index c840c62649ea..cdf0ef0b9d01 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -199,7 +199,7 @@ static SwTwips lcl_GetHeightOfRows( const SwFrame* pStart, long nCount ) SwRectFnSet aRectFnSet(pStart); while ( pStart && nCount > 0 ) { - nRet += aRectFnSet.GetHeight(pStart->Frame()); + nRet += aRectFnSet.GetHeight(pStart->getSwFrame()); pStart = pStart->GetNext(); --nCount; } @@ -266,7 +266,7 @@ static void lcl_InvalidateLowerObjs( SwLayoutFrame& _rLayoutFrame, // modification of the anchored object resp. it's attributes // due to the movement SwObjPositioningInProgress aObjPosInProgress( *pAnchoredObj ); - pAnchoredObj->SetObjLeft( _pPageFrame->Frame().Right() ); + pAnchoredObj->SetObjLeft( _pPageFrame->getSwFrame().Right() ); // #115759# - reset character rectangle, // top of line and relative position in order to assure, // that anchored object is correctly positioned. @@ -344,7 +344,7 @@ static void lcl_ShrinkCellsAndAllContent( SwRowFrame& rRow ) { lcl_ShrinkCellsAndAllContent( *pTmpRow ); - if (aRectFnSet.GetHeight(pTmpRow->Frame()) > 0) + if (aRectFnSet.GetHeight(pTmpRow->getSwFrame()) > 0) bAllRowsCollapsed = false; pTmpRow = static_cast<SwRowFrame*>(pTmpRow->GetNext()); @@ -353,21 +353,27 @@ static void lcl_ShrinkCellsAndAllContent( SwRowFrame& rRow ) if (bAllRowsCollapsed) { // All rows of this table have 0 height -> set height of the table itself as well. - aRectFnSet.SetHeight(pTmp->Frame(), 0); - aRectFnSet.SetTop(pTmp->Prt(), 0); - aRectFnSet.SetHeight(pTmp->Prt(), 0); + SwFrameRect::FrameWriteAccess aFrm(*pTmp); + aRectFnSet.SetHeight(aFrm, 0); + + SwFrameRect::PrintWriteAccess aPrt(*pTmp); + aRectFnSet.SetTop(aPrt, 0); + aRectFnSet.SetHeight(aPrt, 0); } else bAllLowersCollapsed = false; } else { - pTmp->Shrink(aRectFnSet.GetHeight(pTmp->Frame())); - aRectFnSet.SetTop(pTmp->Prt(), 0); - aRectFnSet.SetHeight(pTmp->Prt(), 0); + pTmp->Shrink(aRectFnSet.GetHeight(pTmp->getSwFrame())); + SwFrameRect::PrintWriteAccess aPrt(*pTmp); + aRectFnSet.SetTop(aPrt, 0); + aRectFnSet.SetHeight(aPrt, 0); - if (aRectFnSet.GetHeight(pTmp->Frame()) > 0) + if (aRectFnSet.GetHeight(pTmp->getSwFrame()) > 0) + { bAllLowersCollapsed = false; + } } pTmp = pTmp->GetPrev(); @@ -382,9 +388,12 @@ static void lcl_ShrinkCellsAndAllContent( SwRowFrame& rRow ) if (bAllLowersCollapsed) { // All lower frame of this cell have 0 height -> set height of the cell itself as well. - aRectFnSet.SetHeight(pCurrMasterCell->Frame(), 0); - aRectFnSet.SetTop(pCurrMasterCell->Prt(), 0); - aRectFnSet.SetHeight(pCurrMasterCell->Prt(), 0); + SwFrameRect::FrameWriteAccess aFrm(*pCurrMasterCell); + aRectFnSet.SetHeight(aFrm, 0); + + SwFrameRect::PrintWriteAccess aPrt(*pCurrMasterCell); + aRectFnSet.SetTop(aPrt, 0); + aRectFnSet.SetHeight(aPrt, 0); } else bAllCellsCollapsed = false; @@ -395,9 +404,12 @@ static void lcl_ShrinkCellsAndAllContent( SwRowFrame& rRow ) if (bAllCellsCollapsed) { // All cells have 0 height -> set height of row as well. - aRectFnSet.SetHeight(rRow.Frame(), 0); - aRectFnSet.SetTop(rRow.Prt(), 0); - aRectFnSet.SetHeight(rRow.Prt(), 0); + SwFrameRect::FrameWriteAccess aFrm(rRow); + aRectFnSet.SetHeight(aFrm, 0); + + SwFrameRect::PrintWriteAccess aPrt(rRow); + aRectFnSet.SetTop(aPrt, 0); + aRectFnSet.SetHeight(aPrt, 0); } } @@ -520,7 +532,7 @@ static void lcl_PreprocessRowsInCells( SwTabFrame& rTab, SwRowFrame& rLastLine, // 2. The borders of the cells inside the row // 3. The minimum height of the row if ( pTmpLastLineRow->HasFixSize() ) - nMinHeight = aRectFnSet.GetHeight(pTmpLastLineRow->Frame()); + nMinHeight = aRectFnSet.GetHeight(pTmpLastLineRow->getSwFrame()); else { { @@ -574,8 +586,8 @@ static void lcl_PreprocessRowsInCells( SwTabFrame& rTab, SwRowFrame& rLastLine, lcl_MoveFootnotes( rTab, *rTab.GetFollow(), *pTmpLastLineRow ); pTmpLastLineRow->RemoveFromLayout(); pTmpLastLineRow->InsertBefore( pCurrFollowFlowLineCell, nullptr ); - pTmpLastLineRow->Shrink( aRectFnSet.GetHeight(pTmpLastLineRow->Frame()) ); - pCurrFollowFlowLineCell->Grow( aRectFnSet.GetHeight(pTmpLastLineRow->Frame()) ); + pTmpLastLineRow->Shrink( aRectFnSet.GetHeight(pTmpLastLineRow->getSwFrame()) ); + pCurrFollowFlowLineCell->Grow( aRectFnSet.GetHeight(pTmpLastLineRow->getSwFrame()) ); pTmpLastLineRow = pTmp; } } @@ -629,7 +641,7 @@ static bool lcl_RecalcSplitLine( SwRowFrame& rLastLine, SwRowFrame& rFollowLine, vcl::RenderContext* pRenderContext = rLastLine.getRootFrame()->GetCurrShell()->GetOut(); SwTabFrame& rTab = static_cast<SwTabFrame&>(*rLastLine.GetUpper()); SwRectFnSet aRectFnSet(rTab.GetUpper()); - SwTwips nCurLastLineHeight = aRectFnSet.GetHeight(rLastLine.Frame()); + SwTwips nCurLastLineHeight = aRectFnSet.GetHeight(rLastLine.getSwFrame()); // If there are nested cells in rLastLine, the recalculation of the last // line needs some preprocessing. @@ -706,7 +718,7 @@ static bool lcl_RecalcSplitLine( SwRowFrame& rLastLine, SwRowFrame& rFollowLine, // 1. Check if table fits to its upper. // #i26945# - include check, if objects fit const SwTwips nDistanceToUpperPrtBottom = - aRectFnSet.BottomDist(rTab.Frame(), aRectFnSet.GetPrtBottom(*rTab.GetUpper())); + aRectFnSet.BottomDist(rTab.getSwFrame(), aRectFnSet.GetPrtBottom(*rTab.GetUpper())); if ( nDistanceToUpperPrtBottom < 0 || !rTab.DoesObjsFit() ) bRet = false; @@ -781,9 +793,13 @@ static void lcl_AdjustRowSpanCells( SwRowFrame* pRow ) { // calculate height of cell: const long nNewCellHeight = lcl_GetHeightOfRows( pRow, nLayoutRowSpan ); - const long nDiff = nNewCellHeight - aRectFnSet.GetHeight(pCellFrame->Frame()); + const long nDiff = nNewCellHeight - aRectFnSet.GetHeight(pCellFrame->getSwFrame()); + if ( nDiff ) - aRectFnSet.AddBottom(pCellFrame->Frame(), nDiff); + { + SwFrameRect::FrameWriteAccess aFrm(*pCellFrame); + aRectFnSet.AddBottom(aFrm, nDiff); + } } pCellFrame = static_cast<SwCellFrame*>(pCellFrame->GetNext()); @@ -864,7 +880,7 @@ bool SwTabFrame::RemoveFollowFlowLine() while ( pRow && nRowsToMove-- > 1 ) { SwFrame* pNxt = pRow->GetNext(); - nGrow += aRectFnSet.GetHeight(pRow->Frame()); + nGrow += aRectFnSet.GetHeight(pRow->getSwFrame()); // The footnotes have to be moved: lcl_MoveFootnotes( *GetFollow(), *this, static_cast<SwRowFrame&>(*pRow) ); @@ -980,20 +996,20 @@ bool SwTabFrame::Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowK sal_uInt16 nRowCount = 0; // pRow currently points to the first row SwTwips nRemainingSpaceForLastRow = - aRectFnSet.YDiff(nCutPos, aRectFnSet.GetTop(Frame())); + aRectFnSet.YDiff(nCutPos, aRectFnSet.GetTop(getSwFrame())); nRemainingSpaceForLastRow -= aRectFnSet.GetTopMargin(*this); // Make pRow point to the line that does not fit anymore: while( pRow->GetNext() && - nRemainingSpaceForLastRow >= ( aRectFnSet.GetHeight(pRow->Frame()) + + nRemainingSpaceForLastRow >= ( aRectFnSet.GetHeight(pRow->getSwFrame()) + (IsCollapsingBorders() ? pRow->GetBottomLineSize() : 0 ) ) ) { if( bTryToSplit || !pRow->IsRowSpanLine() || - 0 != aRectFnSet.GetHeight(pRow->Frame()) ) + 0 != aRectFnSet.GetHeight(pRow->getSwFrame()) ) ++nRowCount; - nRemainingSpaceForLastRow -= aRectFnSet.GetHeight(pRow->Frame()); + nRemainingSpaceForLastRow -= aRectFnSet.GetHeight(pRow->getSwFrame()); pRow = static_cast<SwRowFrame*>(pRow->GetNext()); } @@ -1045,7 +1061,7 @@ bool SwTabFrame::Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowK { const SwRowFrame* pLowerRow = static_cast<SwRowFrame*>(pLowerCell->Lower()); if ( !pLowerRow->IsRowSplitAllowed() && - aRectFnSet.GetHeight(pLowerRow->Frame()) > nRemainingSpaceForLastRow ) + aRectFnSet.GetHeight(pLowerRow->getSwFrame()) > nRemainingSpaceForLastRow ) { bKeepNextRow = true; break; @@ -1062,7 +1078,7 @@ bool SwTabFrame::Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowK if ( bKeepNextRow ) { pRow = GetFirstNonHeadlineRow(); - if ( pRow && pRow->IsRowSpanLine() && 0 == aRectFnSet.GetHeight(pRow->Frame()) ) + if ( pRow && pRow->IsRowSpanLine() && 0 == aRectFnSet.GetHeight(pRow->getSwFrame()) ) pRow = static_cast<SwRowFrame*>(pRow->GetNext()); if ( pRow ) { @@ -1139,9 +1155,16 @@ bool SwTabFrame::Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowK pFoll = new SwTabFrame( *this ); // We give the follow table an initial width. - aRectFnSet.AddWidth(pFoll->Frame(), aRectFnSet.GetWidth(Frame())); - aRectFnSet.AddWidth(pFoll->Prt(), aRectFnSet.GetWidth(Prt())); - aRectFnSet.SetLeft(pFoll->Frame(), aRectFnSet.GetLeft(Frame())); + { + SwFrameRect::FrameWriteAccess aFrm(*pFoll); + aRectFnSet.AddWidth(aFrm, aRectFnSet.GetWidth(getSwFrame())); + aRectFnSet.SetLeft(aFrm, aRectFnSet.GetLeft(getSwFrame())); + } + + { + SwFrameRect::PrintWriteAccess aPrt(*pFoll); + aRectFnSet.AddWidth(aPrt, aRectFnSet.GetWidth(getSwPrint())); + } // Insert the new follow table pFoll->InsertBehind( GetUpper(), this ); @@ -1225,7 +1248,7 @@ bool SwTabFrame::Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowK while ( pRow ) { SwFrame* pNxt = pRow->GetNext(); - nShrink += aRectFnSet.GetHeight(pRow->Frame()); + nShrink += aRectFnSet.GetHeight(pRow->getSwFrame()); // The footnotes do not have to be moved, this is done in the // MoveFwd of the follow table!!! pRow->RemoveFromLayout(); @@ -1244,7 +1267,7 @@ bool SwTabFrame::Split( const SwTwips nCutPos, bool bTryToSplit, bool bTableRowK while ( pRow ) { SwFrame* pNxt = pRow->GetNext(); - nShrink += aRectFnSet.GetHeight(pRow->Frame()); + nShrink += aRectFnSet.GetHeight(pRow->getSwFrame()); // The footnotes have to be moved: lcl_MoveFootnotes( *this, *GetFollow(), *pRow ); @@ -1303,7 +1326,7 @@ bool SwTabFrame::Join() while ( pRow ) { pNxt = pRow->GetNext(); - nHeight += aRectFnSet.GetHeight(pRow->Frame()); + nHeight += aRectFnSet.GetHeight(pRow->getSwFrame()); pRow->RemoveFromLayout(); pRow->InvalidateAll_(); pRow->InsertBehind( this, pPrv ); @@ -1344,7 +1367,7 @@ void SwInvalidatePositions( SwFrame *pFrame, long nBottom ) pFrame = pFrame->GetNext(); } while ( pFrame && ( bAll || - aRectFnSet.YDiff( aRectFnSet.GetTop(pFrame->Frame()), nBottom ) < 0 ) ); + aRectFnSet.YDiff( aRectFnSet.GetTop(pFrame->getSwFrame()), nBottom ) < 0 ) ); } void SwInvalidateAll( SwFrame *pFrame, long nBottom ) @@ -1379,7 +1402,7 @@ void SwInvalidateAll( SwFrame *pFrame, long nBottom ) pFrame = pFrame->GetNext(); } while ( pFrame && ( bAll || - aRectFnSet.YDiff( aRectFnSet.GetTop(pFrame->Frame()), nBottom ) < 0 ) ); + aRectFnSet.YDiff( aRectFnSet.GetTop(pFrame->getSwFrame()), nBottom ) < 0 ) ); } // #i29550# @@ -1489,7 +1512,7 @@ bool SwContentFrame::CalcLowers( SwLayoutFrame* pLay, const SwLayoutFrame* pDont } pCnt->GetUpper()->Calc(pRenderContext); } - if( ! bAll && aRectFnSet.YDiff(aRectFnSet.GetTop(pCnt->Frame()), nBottom) > 0 ) + if( ! bAll && aRectFnSet.YDiff(aRectFnSet.GetTop(pCnt->getSwFrame()), nBottom) > 0 ) break; pCnt = pCnt->GetNextContentFrame(); } @@ -1537,7 +1560,7 @@ static bool lcl_InnerCalcLayout( SwFrame *pFrame, pFrame = pFrame->GetNext(); } while( pFrame && ( bAll || - aRectFnSet.YDiff(aRectFnSet.GetTop(pFrame->Frame()), nBottom) < 0 ) + aRectFnSet.YDiff(aRectFnSet.GetTop(pFrame->getSwFrame()), nBottom) < 0 ) && pFrame->GetUpper() == pOldUp ); return bRet; } @@ -1880,7 +1903,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) } // a new one is moved forwards immediately - if ( !Frame().Top() && IsFollow() ) + if ( !getSwFrame().Top() && IsFollow() ) { SwFrame *pPre = GetPrev(); if ( pPre && pPre->IsTabFrame() && static_cast<SwTabFrame*>(pPre)->GetFollow() == this) @@ -1909,12 +1932,12 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) bSplit = false; } - Point aOldPos( aRectFnSet.GetPos(Frame()) ); + Point aOldPos( aRectFnSet.GetPos(getSwFrame()) ); MakePos(); - if ( aOldPos != aRectFnSet.GetPos(Frame()) ) + if ( aOldPos != aRectFnSet.GetPos(getSwFrame()) ) { - if ( aOldPos.Y() != aRectFnSet.GetTop(Frame()) ) + if ( aOldPos.Y() != aRectFnSet.GetTop(getSwFrame()) ) { SwHTMLTableLayout *pLayout = GetTable()->GetHTMLTableLayout(); if( pLayout ) @@ -1948,20 +1971,20 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) { SwFrame* pFrame = GetFirstNonHeadlineRow(); if ( pFrame ) - n1StLineHeight = aRectFnSet.GetHeight(pFrame->Frame()); + n1StLineHeight = aRectFnSet.GetHeight(pFrame->getSwFrame()); } if ( !mbValidSize || !mbValidPrtArea ) { - const long nOldPrtWidth = aRectFnSet.GetWidth(Prt()); - const long nOldFrameWidth = aRectFnSet.GetWidth(Frame()); - const Point aOldPrtPos = aRectFnSet.GetPos(Prt()); + const long nOldPrtWidth = aRectFnSet.GetWidth(getSwPrint()); + const long nOldFrameWidth = aRectFnSet.GetWidth(getSwFrame()); + const Point aOldPrtPos = aRectFnSet.GetPos(getSwPrint()); Format( getRootFrame()->GetCurrShell()->GetOut(), pAttrs ); SwHTMLTableLayout *pLayout = GetTable()->GetHTMLTableLayout(); if ( pLayout && - (aRectFnSet.GetWidth(Prt()) != nOldPrtWidth || - aRectFnSet.GetWidth(Frame()) != nOldFrameWidth) ) + (aRectFnSet.GetWidth(getSwPrint()) != nOldPrtWidth || + aRectFnSet.GetWidth(getSwFrame()) != nOldFrameWidth) ) { pAccess.reset(); m_bCalcLowers |= pLayout->Resize( @@ -1969,7 +1992,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) pAccess = o3tl::make_unique<SwBorderAttrAccess>(SwFrame::GetCache(), this); pAttrs = pAccess->Get(); } - if ( aOldPrtPos != aRectFnSet.GetPos(Prt()) ) + if ( aOldPrtPos != aRectFnSet.GetPos(getSwPrint()) ) aNotify.SetLowersComplete( false ); } @@ -1985,7 +2008,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) { // Only if the height of the first line got smaller. SwFrame *pFrame = GetFirstNonHeadlineRow(); - if( pFrame && n1StLineHeight >aRectFnSet.GetHeight(pFrame->Frame()) ) + if( pFrame && n1StLineHeight >aRectFnSet.GetHeight(pFrame->getSwFrame()) ) { SwTabFrame *pMaster = FindMaster(); bool bDummy; @@ -2004,9 +2027,9 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) MoveLowerFootnotes( nullptr, pOldBoss, nullptr, true ); if ( bReformat || bKeep ) { - long nOldTop = aRectFnSet.GetTop(Frame()); + long nOldTop = aRectFnSet.GetTop(getSwFrame()); MakePos(); - if( nOldTop != aRectFnSet.GetTop(Frame()) ) + if( nOldTop != aRectFnSet.GetTop(getSwFrame()) ) { SwHTMLTableLayout *pHTMLLayout = GetTable()->GetHTMLTableLayout(); @@ -2054,7 +2077,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) // table frame bottom to the bottom of the upper printing area. // Note: negative values denotes the situation that table frame doesn't fit in its upper. SwTwips nDistanceToUpperPrtBottom = - aRectFnSet.BottomDist(Frame(), aRectFnSet.GetPrtBottom(*GetUpper())); + aRectFnSet.BottomDist(getSwFrame(), aRectFnSet.GetPrtBottom(*GetUpper())); /// In online layout try to grow upper of table frame, if table frame doesn't fit in its upper. const SwViewShell *pSh = getRootFrame()->GetCurrShell(); @@ -2064,7 +2087,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) if ( GetUpper()->Grow( -nDistanceToUpperPrtBottom ) ) { // upper is grown --> recalculate <nDistanceToUpperPrtBottom> - nDistanceToUpperPrtBottom = aRectFnSet.BottomDist(Frame(), aRectFnSet.GetPrtBottom(*GetUpper())); + nDistanceToUpperPrtBottom = aRectFnSet.BottomDist(getSwFrame(), aRectFnSet.GetPrtBottom(*GetUpper())); } } @@ -2085,7 +2108,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) SwTwips nDeadLine = aRectFnSet.GetPrtBottom(*pTmp); if ( bBrowseMode ) nDeadLine += pTmp->Grow( LONG_MAX, true ); - if( aRectFnSet.BottomDist( Frame(), nDeadLine ) > 0 ) + if( aRectFnSet.BottomDist( getSwFrame(), nDeadLine ) > 0 ) { // First, we remove an existing follow flow line. if ( HasFollowFlowLine() ) @@ -2121,7 +2144,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) continue; } - const SwTwips nOld = aRectFnSet.GetHeight(Frame()); + const SwTwips nOld = aRectFnSet.GetHeight(getSwFrame()); long nRowsToMove = lcl_GetMaximumLayoutRowSpan( *pRow ); SwFrame* pRowToMove = pRow; @@ -2154,7 +2177,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) pRowToMove = pNextRow; } - if ( nOld != aRectFnSet.GetHeight(Frame()) ) + if ( nOld != aRectFnSet.GetHeight(getSwFrame()) ) lcl_RecalcTable( *this, static_cast<SwLayoutFrame*>(pRow), aNotify ); continue; @@ -2292,7 +2315,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) // all kinds of unexpected things could happen. if ( !bEmulateTableKeepFwdMoveAllowed || ( IsInSct() && (FindSctFrame())->Lower()->IsColumnFrame() && - 0 == aRectFnSet.GetHeight(GetUpper()->Frame()) + 0 == aRectFnSet.GetHeight(GetUpper()->getSwFrame()) ) ) { bTryToSplit = false; @@ -2318,7 +2341,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) // One more check if its really necessary to split the table. // 1. The table either has to exceed the deadline or // 2. We explicitly want to cut off the last row. - if( aRectFnSet.BottomDist( Frame(), nDeadLine ) > 0 && !bLastRowHasToMoveToFollow ) + if( aRectFnSet.BottomDist( getSwFrame(), nDeadLine ) > 0 && !bLastRowHasToMoveToFollow ) { continue; } @@ -2355,7 +2378,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) ++nMinNumOfLines; const SwTwips nBreakLine = aRectFnSet.YInc( - aRectFnSet.GetTop(Frame()), + aRectFnSet.GetTop(getSwFrame()), aRectFnSet.GetTopMargin(*this) + lcl_GetHeightOfRows( GetLower(), nMinNumOfLines ) ); @@ -2448,7 +2471,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) const bool bOldJoinLock = GetFollow()->IsJoinLocked(); GetFollow()->LockJoin(); ::lcl_RecalcRow( static_cast<SwRowFrame&>(*GetFollow()->Lower()), - fnRectX.GetBottom(GetFollow()->GetUpper()->Frame()) ); + fnRectX.GetBottom(GetFollow()->GetUpper()->getSwFrame()) ); // #i43913# // #i63632# Do not unlock the // follow if it wasn't locked before. @@ -2551,7 +2574,7 @@ void SwTabFrame::MakeAll(vcl::RenderContext* pRenderContext) // and can cause layout loops, if table doesn't fit and isn't // allowed to split. SwTwips nDistToUpperPrtBottom = - aRectFnSet.BottomDist( Frame(), aRectFnSet.GetPrtBottom(*GetUpper())); + aRectFnSet.BottomDist( getSwFrame(), aRectFnSet.GetPrtBottom(*GetUpper())); if ( nDistToUpperPrtBottom >= 0 || bTryToSplit ) { lcl_RecalcTable( *this, nullptr, aNotify ); @@ -2606,10 +2629,10 @@ bool SwTabFrame::CalcFlyOffsets( SwTwips& rUpper, { SwRectFnSet aRectFnSet(this); const bool bConsiderWrapOnObjPos = rIDSA.get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION); - long nPrtPos = aRectFnSet.GetTop(Frame()); + long nPrtPos = aRectFnSet.GetTop(getSwFrame()); nPrtPos = aRectFnSet.YInc( nPrtPos, rUpper ); - SwRect aRect( Frame() ); - long nYDiff = aRectFnSet.YDiff( aRectFnSet.GetTop(Prt()), rUpper ); + SwRect aRect( getSwFrame() ); + long nYDiff = aRectFnSet.YDiff( aRectFnSet.GetTop(getSwPrint()), rUpper ); if( nYDiff > 0 ) aRectFnSet.AddBottom( aRect, -nYDiff ); for ( size_t i = 0; i < pPage->GetSortedObjs()->size(); ++i ) @@ -2696,7 +2719,7 @@ bool SwTabFrame::CalcFlyOffsets( SwTwips& rUpper, { const long nWidth = aRectFnSet.XDiff( aRectFnSet.GetRight(aFlyRect), - aRectFnSet.GetLeft(pFly->GetAnchorFrame()->Frame()) ); + aRectFnSet.GetLeft(pFly->GetAnchorFrame()->getSwFrame()) ); rLeftOffset = std::max( rLeftOffset, nWidth ); bInvalidatePrtArea = true; } @@ -2705,7 +2728,7 @@ bool SwTabFrame::CalcFlyOffsets( SwTwips& rUpper, text::HoriOrientation::RIGHT == rHori.GetHoriOrient() ) { const long nWidth = aRectFnSet.XDiff( - aRectFnSet.GetRight(pFly->GetAnchorFrame()->Frame()), + aRectFnSet.GetRight(pFly->GetAnchorFrame()->getSwFrame()), aRectFnSet.GetLeft(aFlyRect) ); rRightOffset = std::max( rRightOffset, nWidth ); bInvalidatePrtArea = true; @@ -2713,7 +2736,7 @@ bool SwTabFrame::CalcFlyOffsets( SwTwips& rUpper, } } } - rUpper = aRectFnSet.YDiff( nPrtPos, aRectFnSet.GetTop(Frame()) ); + rUpper = aRectFnSet.YDiff( nPrtPos, aRectFnSet.GetTop(getSwFrame()) ); } return bInvalidatePrtArea; @@ -2728,10 +2751,13 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA SwRectFnSet aRectFnSet(this); if ( !mbValidSize ) { - long nDiff = aRectFnSet.GetWidth(GetUpper()->Prt()) - - aRectFnSet.GetWidth(Frame()); + long nDiff = aRectFnSet.GetWidth(GetUpper()->getSwPrint()) - + aRectFnSet.GetWidth(getSwFrame()); if( nDiff ) - aRectFnSet.AddRight( maFrame, nDiff ); + { + SwFrameRect::FrameWriteAccess aFrm(*this); + aRectFnSet.AddRight( aFrm, nDiff ); + } } //VarSize is always the height. @@ -2766,8 +2792,8 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA //If the adjustment is 0, the borders are set according to the border //attributes. - const SwTwips nOldHeight = aRectFnSet.GetHeight(Prt()); - const SwTwips nMax = aRectFnSet.GetWidth(maFrame); + const SwTwips nOldHeight = aRectFnSet.GetHeight(getSwPrint()); + const SwTwips nMax = aRectFnSet.GetWidth(getSwFrame()); // OD 14.03.2003 #i9040# - adjust variable names. const SwTwips nLeftLine = pAttrs->CalcLeftLine(); @@ -2947,12 +2973,14 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA //The page width can be bigger because objects with //"over-size" are possible (RootFrame::ImplCalcBrowseWidth()) long nWidth = pSh->GetBrowseWidth(); - nWidth -= Prt().Left(); + nWidth -= getSwPrint().Left(); nWidth -= pAttrs->CalcRightLine(); - Prt().Width( std::min( nWidth, Prt().Width() ) ); + + SwFrameRect::PrintWriteAccess aPrt(*this); + aPrt.Width( std::min( nWidth, aPrt.Width() ) ); } - if ( nOldHeight != aRectFnSet.GetHeight(Prt()) ) + if ( nOldHeight != aRectFnSet.GetHeight(getSwPrint()) ) mbValidSize = false; } @@ -2965,13 +2993,13 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA SwFrame *pFrame = m_pLower; while ( pFrame ) { - nRemaining += aRectFnSet.GetHeight(pFrame->Frame()); + nRemaining += aRectFnSet.GetHeight(pFrame->getSwFrame()); pFrame = pFrame->GetNext(); } //And now add the borders nRemaining += nUpper + nLower; - nDiff = aRectFnSet.GetHeight(Frame()) - nRemaining; + nDiff = aRectFnSet.GetHeight(getSwFrame()) - nRemaining; if ( nDiff > 0 ) Shrink( nDiff ); else if ( nDiff < 0 ) @@ -2982,7 +3010,7 @@ void SwTabFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA SwTwips SwTabFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) { SwRectFnSet aRectFnSet(this); - SwTwips nHeight = aRectFnSet.GetHeight(Frame()); + SwTwips nHeight = aRectFnSet.GetHeight(getSwFrame()); if( nHeight > 0 && nDist > ( LONG_MAX - nHeight ) ) nDist = LONG_MAX - nHeight; @@ -2991,15 +3019,15 @@ SwTwips SwTabFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) if ( GetUpper() ) { - SwRect aOldFrame( Frame() ); + SwRect aOldFrame( getSwFrame() ); //The upper only grows as far as needed. nReal provides the distance //which is already available. - SwTwips nReal = aRectFnSet.GetHeight(GetUpper()->Prt()); + SwTwips nReal = aRectFnSet.GetHeight(GetUpper()->getSwPrint()); SwFrame *pFrame = GetUpper()->Lower(); while ( pFrame && GetFollow() != pFrame ) { - nReal -= aRectFnSet.GetHeight(pFrame->Frame()); + nReal -= aRectFnSet.GetHeight(pFrame->getSwFrame()); pFrame = pFrame->GetNext(); } @@ -3016,7 +3044,10 @@ SwTwips SwTabFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) if ( !bTst ) { - aRectFnSet.AddBottom( Frame(), nDist ); + { + SwFrameRect::FrameWriteAccess aFrm(*this); + aRectFnSet.AddBottom( aFrm, nDist ); + } SwRootFrame *pRootFrame = getRootFrame(); if( pRootFrame && pRootFrame->IsAnyShellAccessible() && @@ -3170,7 +3201,7 @@ void SwTabFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew, CheckPageDescs( pPage ); if (GetFormat()->GetPageDesc().GetNumOffset()) static_cast<SwRootFrame*>(pPage->GetUpper())->SetVirtPageNum( true ); - SwDocPosUpdate aMsgHint( pPage->Frame().Top() ); + SwDocPosUpdate aMsgHint( pPage->getSwFrame().Top() ); GetFormat()->GetDoc()->getIDocumentFieldsAccess().UpdatePageFields( &aMsgHint ); } } @@ -3337,33 +3368,33 @@ bool SwTabFrame::ShouldBwdMoved( SwLayoutFrame *pNewUpper, bool, bool &rReformat if ( !SwFlowFrame::IsMoveBwdJump() ) { - long nOldWidth = aRectFnSet.GetWidth(GetUpper()->Prt()); + long nOldWidth = aRectFnSet.GetWidth(GetUpper()->getSwPrint()); SwRectFnSet fnRectX(pNewUpper); - long nNewWidth = fnRectX.GetWidth(pNewUpper->Prt()); + long nNewWidth = fnRectX.GetWidth(pNewUpper->getSwPrint()); if( std::abs( nNewWidth - nOldWidth ) < 2 ) { - bMoveAnyway = BwdMoveNecessary( pOldPage, Frame() ) > 1; + bMoveAnyway = BwdMoveNecessary( pOldPage, getSwFrame() ) > 1; if( !bMoveAnyway ) { - SwRect aRect( pNewUpper->Prt() ); - aRect.Pos() += pNewUpper->Frame().Pos(); + SwRect aRect( pNewUpper->getSwPrint() ); + aRect.Pos() += pNewUpper->getSwFrame().Pos(); const SwFrame *pPrevFrame = pNewUpper->Lower(); while ( pPrevFrame && pPrevFrame != this ) { - fnRectX.SetTop( aRect, fnRectX.GetBottom(pPrevFrame->Frame()) ); + fnRectX.SetTop( aRect, fnRectX.GetBottom(pPrevFrame->getSwFrame()) ); pPrevFrame = pPrevFrame->GetNext(); } bMoveAnyway = BwdMoveNecessary( pNewPage, aRect) > 1; // #i54861# Due to changes made in PrepareMake, // the tabfrm may not have a correct position. Therefore - // it is possible that pNewUpper->Prt().Height == 0. In this + // it is possible that pNewUpper->getSwPrint().Height == 0. In this // case the above calculation of nSpace might give wrong // results and we really do not want to MoveBackward into a // 0 height frame. If nTmpSpace is already <= 0, we take this // value: const SwTwips nTmpSpace = fnRectX.GetHeight(aRect); - if ( fnRectX.GetHeight(pNewUpper->Prt()) > 0 || nTmpSpace <= 0 ) + if ( fnRectX.GetHeight(pNewUpper->getSwPrint()) > 0 || nTmpSpace <= 0 ) nSpace = nTmpSpace; const SwViewShell *pSh = getRootFrame()->GetCurrShell(); @@ -3497,11 +3528,11 @@ void SwTabFrame::Cut() SwFrame::DestroyFrame(pUp); } } - else if( aRectFnSet.GetHeight(Frame()) ) + else if( aRectFnSet.GetHeight(getSwFrame()) ) { // OD 26.08.2003 #i18103# - *no* 'ColUnlock' of section - // undo changes of fix for #104992# - pUp->Shrink( Frame().Height() ); + pUp->Shrink( getSwFrame().Height() ); } } @@ -3535,10 +3566,10 @@ void SwTabFrame::Paste( SwFrame* pParent, SwFrame* pSibling ) } SwRectFnSet aRectFnSet(this); - if( aRectFnSet.GetHeight(Frame()) ) - pParent->Grow( aRectFnSet.GetHeight(Frame()) ); + if( aRectFnSet.GetHeight(getSwFrame()) ) + pParent->Grow( aRectFnSet.GetHeight(getSwFrame()) ); - if( aRectFnSet.GetWidth(Frame()) != aRectFnSet.GetWidth(pParent->Prt()) ) + if( aRectFnSet.GetWidth(getSwFrame()) != aRectFnSet.GetWidth(pParent->getSwPrint()) ) Prepare( PREP_FIXSIZE_CHG ); if ( GetPrev() ) { @@ -3740,14 +3771,14 @@ long CalcHeightWithFlys( const SwFrame *pFrame ) const SwTwips nFrameDiff = aRectFnSet.YDiff( - aRectFnSet.GetTop(pTmp->Frame()), - aRectFnSet.GetTop(pFrame->Frame()) ); + aRectFnSet.GetTop(pTmp->getSwFrame()), + aRectFnSet.GetTop(pFrame->getSwFrame()) ); nHeight = std::max( nHeight, nDistOfFlyBottomToAnchorTop + nFrameDiff - - aRectFnSet.GetHeight(pFrame->Frame()) ); + aRectFnSet.GetHeight(pFrame->getSwFrame()) ); // #i56115# The first height calculation - // gives wrong results if pFrame->Prt().Y() > 0. We do + // gives wrong results if pFrame->getSwPrint().Y() > 0. We do // a second calculation based on the actual rectangles of // pFrame and pAnchoredObj, and use the maximum of the results. // I do not want to remove the first calculation because @@ -3755,7 +3786,7 @@ long CalcHeightWithFlys( const SwFrame *pFrame ) // might be the better option to calculate nHeight. const SwTwips nDistOfFlyBottomToAnchorTop2 = aRectFnSet.YDiff( aRectFnSet.GetBottom(pAnchoredObj->GetObjRect()), - aRectFnSet.GetBottom(pFrame->Frame()) ); + aRectFnSet.GetBottom(pFrame->getSwFrame()) ); nHeight = std::max( nHeight, nDistOfFlyBottomToAnchorTop2 ); } @@ -3826,7 +3857,7 @@ static SwTwips lcl_CalcMinCellHeight( const SwLayoutFrame *_pCell, } else { - long nLowHeight = aRectFnSet.GetHeight(pLow->Frame()); + long nLowHeight = aRectFnSet.GetHeight(pLow->getSwFrame()); nHeight += nLowHeight; // #i26945# if ( _bConsiderObjs ) @@ -3906,7 +3937,7 @@ static SwTwips lcl_CalcMinRowHeight( const SwRowFrame* _pRow, const SwFrame* pMasterRow = rMaster.GetUpper(); while ( pMasterRow && pMasterRow != _pRow ) { - nTmp -= aRectFnSet.GetHeight(pMasterRow->Frame()); + nTmp -= aRectFnSet.GetHeight(pMasterRow->getSwFrame()); pMasterRow = pMasterRow->GetNext(); } } @@ -4043,7 +4074,7 @@ static SwTwips lcl_calcHeightOfRowBeforeThisFrame(const SwRowFrame& rRow) { // The found row frame belongs to a table frame that precedes // (above) this one in chain. So, include it in the sum - nResult += aRectFnSet.GetHeight(pCurRow->Frame()); + nResult += aRectFnSet.GetHeight(pCurRow->getSwFrame()); } } } @@ -4062,10 +4093,14 @@ void SwRowFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA //RowFrames don't have borders and so on therefore the PrtArea always //matches the Frame. mbValidPrtArea = true; - maPrt.Left( 0 ); - maPrt.Top( 0 ); - maPrt.Width ( maFrame.Width() ); - maPrt.Height( maFrame.Height() ); + + { + SwFrameRect::PrintWriteAccess aPrt(*this); + aPrt.Left( 0 ); + aPrt.Top( 0 ); + aPrt.Width ( getSwFrame().Width() ); + aPrt.Height( getSwFrame().Height() ); + } // #i29550# // Here we calculate the top-printing area for the lower cell frames @@ -4178,7 +4213,7 @@ void SwRowFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA OSL_ENSURE( rFrameSize.GetSize().Height() > 0, "Has it" ); } #endif - const SwTwips nDiff = aRectFnSet.GetHeight(Frame()) - + const SwTwips nDiff = aRectFnSet.GetHeight(getSwFrame()) - ( HasFixSize() && !IsRowSpanLine() ? pAttrs->GetSize().Height() // #i26945# @@ -4199,10 +4234,10 @@ void SwRowFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderA if ( !GetNext() ) { //The last fills the remaining space in the upper. - SwTwips nDiff = aRectFnSet.GetHeight(GetUpper()->Prt()); + SwTwips nDiff = aRectFnSet.GetHeight(GetUpper()->getSwPrint()); SwFrame *pSibling = GetUpper()->Lower(); do - { nDiff -= aRectFnSet.GetHeight(pSibling->Frame()); + { nDiff -= aRectFnSet.GetHeight(pSibling->getSwFrame()); pSibling = pSibling->GetNext(); } while ( pSibling ); if ( nDiff > 0 ) @@ -4239,10 +4274,14 @@ void SwRowFrame::AdjustCells( const SwTwips nHeight, const bool bHeight ) if ( pCellFrame->GetTabBox()->getRowSpan() < 1 ) { // Set height of current (covered) cell to new line height. - const long nDiff = nHeight - aRectFnSet.GetHeight(pCellFrame->Frame()); + const long nDiff = nHeight - aRectFnSet.GetHeight(pCellFrame->getSwFrame()); if ( nDiff ) { - aRectFnSet.AddBottom( pCellFrame->Frame(), nDiff ); + { + SwFrameRect::FrameWriteAccess aFrm(*pCellFrame); + aRectFnSet.AddBottom( aFrm, nDiff ); + } + pCellFrame->InvalidatePrt_(); } } @@ -4271,7 +4310,7 @@ void SwRowFrame::AdjustCells( const SwTwips nHeight, const bool bHeight ) // Use new height for the current row: nSumRowHeight += pToAdjustRow == this ? nHeight : - aRectFnSet.GetHeight(pToAdjustRow->Frame()); + aRectFnSet.GetHeight(pToAdjustRow->getSwFrame()); if ( nRowSpan-- == 1 ) break; @@ -4282,11 +4321,12 @@ void SwRowFrame::AdjustCells( const SwTwips nHeight, const bool bHeight ) if ( pToAdjustRow && pToAdjustRow != this ) pToAdjustRow->InvalidateSize_(); - const long nDiff = nSumRowHeight - aRectFnSet.GetHeight(pToAdjust->Frame()); + const long nDiff = nSumRowHeight - aRectFnSet.GetHeight(pToAdjust->getSwFrame()); if ( nDiff ) { - aOldFrame = pToAdjust->Frame(); - aRectFnSet.AddBottom( pToAdjust->Frame(), nDiff ); + aOldFrame = pToAdjust->getSwFrame(); + SwFrameRect::FrameWriteAccess aFrm(*pToAdjust); + aRectFnSet.AddBottom( aFrm, nDiff ); pNotify = pToAdjust; } @@ -4346,13 +4386,16 @@ SwTwips SwRowFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) // There may still be some space left in my direct upper: const SwTwips nAdditionalSpace = - aRectFnSet.BottomDist( Frame(), aRectFnSet.GetPrtBottom(*GetUpper()->GetUpper()) ); + aRectFnSet.BottomDist( getSwFrame(), aRectFnSet.GetPrtBottom(*GetUpper()->GetUpper()) ); if ( bRestrictTableGrowth && nAdditionalSpace > 0 ) { nReal = std::min( nAdditionalSpace, nDist ); nDist -= nReal; if ( !bTst ) - aRectFnSet.AddBottom( Frame(), nReal ); + { + SwFrameRect::FrameWriteAccess aFrm(*this); + aRectFnSet.AddBottom( aFrm, nReal ); + } } } @@ -4378,7 +4421,7 @@ SwTwips SwRowFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) if ( !bTst ) { SwRectFnSet fnRectX(this); - AdjustCells( fnRectX.GetHeight(Prt()) + nReal, true ); + AdjustCells( fnRectX.GetHeight(getSwPrint()) + nReal, true ); if ( nReal ) SetCompletePaint(); } @@ -4391,7 +4434,7 @@ SwTwips SwRowFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) SwRectFnSet aRectFnSet(this); if( HasFixSize() ) { - AdjustCells( aRectFnSet.GetHeight(Prt()), true ); + AdjustCells( aRectFnSet.GetHeight(getSwPrint()), true ); return 0L; } @@ -4413,7 +4456,7 @@ SwTwips SwRowFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) // Only necessary to calculate minimal row height if height // of pRow is at least nMinHeight. Otherwise nMinHeight is the // minimum height. - if( nMinHeight < aRectFnSet.GetHeight(Frame()) ) + if( nMinHeight < aRectFnSet.GetHeight(getSwFrame()) ) { // #i26945# OSL_ENSURE( FindTabFrame(), "<SwRowFrame::ShrinkFrame(..)> - no table frame -> crash." ); @@ -4421,8 +4464,8 @@ SwTwips SwRowFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) nMinHeight = lcl_CalcMinRowHeight( this, bConsiderObjs ); } - if ( (aRectFnSet.GetHeight(Frame()) - nRealDist) < nMinHeight ) - nRealDist = aRectFnSet.GetHeight(Frame()) - nMinHeight; + if ( (aRectFnSet.GetHeight(getSwFrame()) - nRealDist) < nMinHeight ) + nRealDist = aRectFnSet.GetHeight(getSwFrame()) - nMinHeight; } if ( nRealDist < 0 ) nRealDist = 0; @@ -4432,11 +4475,14 @@ SwTwips SwRowFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) { if ( !bTst ) { - SwTwips nHeight = aRectFnSet.GetHeight(Frame()); - aRectFnSet.SetHeight( Frame(), nHeight - nReal ); + SwTwips nHeight = aRectFnSet.GetHeight(getSwFrame()); + SwFrameRect::FrameWriteAccess aFrm(*this); + aRectFnSet.SetHeight( aFrm, nHeight - nReal ); if( IsVertical() && !IsVertLR() && !aRectFnSet.IsRev() ) - Frame().Pos().X() += nReal; + { + aFrm.Pos().X() += nReal; + } } SwLayoutFrame* pFrame = GetUpper(); @@ -4448,11 +4494,14 @@ SwTwips SwRowFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) if ( !bTst ) { nReal -= nTmp; - SwTwips nHeight = aRectFnSet.GetHeight(Frame()); - aRectFnSet.SetHeight( Frame(), nHeight + nReal ); + SwTwips nHeight = aRectFnSet.GetHeight(getSwFrame()); + SwFrameRect::FrameWriteAccess aFrm(*this); + aRectFnSet.SetHeight( aFrm, nHeight + nReal ); if( IsVertical() && !IsVertLR() && !aRectFnSet.IsRev() ) - Frame().Pos().X() -= nReal; + { + aFrm.Pos().X() -= nReal; + } } nReal = nTmp; } @@ -4478,7 +4527,7 @@ SwTwips SwRowFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) pMasterTab->InvalidatePos(); } } - AdjustCells( aRectFnSet.GetHeight(Prt()) - nReal, true ); + AdjustCells( aRectFnSet.GetHeight(getSwPrint()) - nReal, true ); } return nReal; } @@ -4578,22 +4627,28 @@ static bool lcl_ArrangeLowers( SwLayoutFrame *pLay, long lYStart, bool bInva ) SwRectFnSet aRectFnSet(pLay); while ( pFrame ) { - long nFrameTop = aRectFnSet.GetTop(pFrame->Frame()); + long nFrameTop = aRectFnSet.GetTop(pFrame->getSwFrame()); if( nFrameTop != lYStart ) { bRet = true; const long lDiff = aRectFnSet.YDiff( lYStart, nFrameTop ); const long lDiffX = lYStart - nFrameTop; - aRectFnSet.SubTop( pFrame->Frame(), -lDiff ); - aRectFnSet.AddBottom( pFrame->Frame(), lDiff ); + + { + SwFrameRect::FrameWriteAccess aFrm(*pFrame); + aRectFnSet.SubTop( aFrm, -lDiff ); + aRectFnSet.AddBottom( aFrm, lDiff ); + } + pFrame->SetCompletePaint(); + if ( !pFrame->GetNext() ) pFrame->SetRetouche(); if( bInva ) pFrame->Prepare( PREP_POS_CHGD ); if ( pFrame->IsLayoutFrame() && static_cast<SwLayoutFrame*>(pFrame)->Lower() ) lcl_ArrangeLowers( static_cast<SwLayoutFrame*>(pFrame), - aRectFnSet.GetTop(static_cast<SwLayoutFrame*>(pFrame)->Lower()->Frame()) + aRectFnSet.GetTop(static_cast<SwLayoutFrame*>(pFrame)->Lower()->getSwFrame()) + lDiffX, bInva ); if ( pFrame->GetDrawObjs() ) { @@ -4635,13 +4690,17 @@ static bool lcl_ArrangeLowers( SwLayoutFrame *pLay, long lYStart, bool bInva ) // #i52904# - no direct move of objects, // whose vertical position doesn't depend on anchor frame. const bool bDirectMove = - FAR_AWAY != pFly->Frame().Top() && + FAR_AWAY != pFly->getSwFrame().Top() && bVertPosDepOnAnchor && !pFly->ConsiderObjWrapInfluenceOnObjPos(); if ( bDirectMove ) { - aRectFnSet.SubTop( pFly->Frame(), -lDiff ); - aRectFnSet.AddBottom( pFly->Frame(), lDiff ); + { + SwFrameRect::FrameWriteAccess aFrm(*pFly); + aRectFnSet.SubTop( aFrm, -lDiff ); + aRectFnSet.AddBottom( aFrm, lDiff ); + } + pFly->GetVirtDrawObj()->SetRectsDirty(); // --> OD 2004-08-17 - also notify view of <SdrObject> // instance, which represents the Writer fly frame in @@ -4765,7 +4824,7 @@ static bool lcl_ArrangeLowers( SwLayoutFrame *pLay, long lYStart, bool bInva ) // Columns and cells are ordered horizontal, not vertical if( !pFrame->IsColumnFrame() && !pFrame->IsCellFrame() ) lYStart = aRectFnSet.YInc( lYStart, - aRectFnSet.GetHeight(pFrame->Frame()) ); + aRectFnSet.GetHeight(pFrame->getSwFrame()) ); // Nowadays, the content inside a cell can flow into the follow table. // Thus, the cell may only grow up to the end of the environment. @@ -4773,7 +4832,7 @@ static bool lcl_ArrangeLowers( SwLayoutFrame *pLay, long lYStart, bool bInva ) // Therefore we have to trigger a formatting for the frames, which do // not fit into the cell anymore: SwTwips nDistanceToUpperPrtBottom = - aRectFnSet.BottomDist( pFrame->Frame(), aRectFnSet.GetPrtBottom(*pLay) ); + aRectFnSet.BottomDist( pFrame->getSwFrame(), aRectFnSet.GetPrtBottom(*pLay) ); // #i56146# - Revise fix of issue #i26945# // do *not* consider content inside fly frames, if it's an undersized paragraph. // #i26945# - consider content inside fly frames @@ -4852,7 +4911,7 @@ void SwCellFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder OSL_ENSURE( nWidth <= nWish, "Width of cell larger than table." ); OSL_ENSURE( nWidth > 0, "Box without width" ); - const long nPrtWidth = aRectFnSet.GetWidth(pTab->Prt()); + const long nPrtWidth = aRectFnSet.GetWidth(pTab->getSwPrint()); if ( nWish != nPrtWidth ) { // Avoid rounding problems, at least for the new table model @@ -4883,7 +4942,7 @@ void SwCellFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder SwTwips nSumFrameWidths = 0; while ( pTmpCell != this ) { - nSumFrameWidths += aRectFnSet.GetWidth(pTmpCell->Frame()); + nSumFrameWidths += aRectFnSet.GetWidth(pTmpCell->getSwFrame()); pTmpCell = pTmpCell->GetNext(); } @@ -4903,23 +4962,37 @@ void SwCellFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder else { OSL_ENSURE( pAttrs->GetSize().Width() > 0, "Box without width" ); - nWidth = aRectFnSet.GetWidth(GetUpper()->Prt()); + nWidth = aRectFnSet.GetWidth(GetUpper()->getSwPrint()); SwFrame *pPre = GetUpper()->Lower(); while ( pPre != this ) { - nWidth -= aRectFnSet.GetWidth(pPre->Frame()); + nWidth -= aRectFnSet.GetWidth(pPre->getSwFrame()); pPre = pPre->GetNext(); } } - const long nDiff = nWidth - aRectFnSet.GetWidth(Frame()); - if( IsNeighbourFrame() && IsRightToLeft() ) - aRectFnSet.SubLeft( Frame(), nDiff ); - else - aRectFnSet.AddRight( Frame(), nDiff ); - aRectFnSet.AddRight( Prt(), nDiff ); + + const long nDiff = nWidth - aRectFnSet.GetWidth(getSwFrame()); + + { + SwFrameRect::FrameWriteAccess aFrm(*this); + + if( IsNeighbourFrame() && IsRightToLeft() ) + { + aRectFnSet.SubLeft( aFrm, nDiff ); + } + else + { + aRectFnSet.AddRight( aFrm, nDiff ); + } + } + + { + SwFrameRect::PrintWriteAccess aPrt(*this); + aRectFnSet.AddRight( aPrt, nDiff ); + } //Adjust the height, it's defined through the content and the border. - const long nDiffHeight = nRemaining - aRectFnSet.GetHeight(Frame()); + const long nDiffHeight = nRemaining - aRectFnSet.GetHeight(getSwFrame()); if ( nDiffHeight ) { if ( nDiffHeight > 0 ) @@ -4966,7 +5039,7 @@ void SwCellFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder //No alignment if border with flow overlaps the cell. if ( pPg->GetSortedObjs() ) { - SwRect aRect( Prt() ); aRect += Frame().Pos(); + SwRect aRect( getSwPrint() ); aRect += getSwFrame().Pos(); for (SwAnchoredObject* pAnchoredObj : *pPg->GetSortedObjs()) { SwRect aTmp( pAnchoredObj->GetObjRect() ); @@ -5006,11 +5079,11 @@ void SwCellFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorder } } - long nPrtHeight = aRectFnSet.GetHeight(Prt()); + long nPrtHeight = aRectFnSet.GetHeight(getSwPrint()); if( ( bVertDir && ( nRemaining -= lcl_CalcTopAndBottomMargin( *this, *pAttrs ) ) < nPrtHeight ) || - aRectFnSet.GetTop(Lower()->Frame()) != aRectFnSet.GetPrtTop(*this) ) + aRectFnSet.GetTop(Lower()->getSwFrame()) != aRectFnSet.GetPrtTop(*this) ) { - long nDiff = aRectFnSet.GetHeight(Prt()) - nRemaining; + long nDiff = aRectFnSet.GetHeight(getSwPrint()) - nRemaining; if ( nDiff >= 0 ) { long lTopOfst = 0; @@ -5291,12 +5364,12 @@ static SwTwips lcl_CalcHeightOfFirstContentLine( const SwRowFrame& rSourceLine ) // If we are in a split row, there may be some space // left in the cell frame of the master row. // We look for the minimum of all first line heights; - SwTwips nReal = aRectFnSet.GetHeight(pPrevCell->Prt()); + SwTwips nReal = aRectFnSet.GetHeight(pPrevCell->getSwPrint()); const SwFrame* pFrame = pPrevCell->Lower(); const SwFrame* pLast = pFrame; while ( pFrame ) { - nReal -= aRectFnSet.GetHeight(pFrame->Frame()); + nReal -= aRectFnSet.GetHeight(pFrame->getSwFrame()); pLast = pFrame; pFrame = pFrame->GetNext(); } @@ -5382,7 +5455,7 @@ SwTwips SwTabFrame::CalcHeightOfFirstContentLine() const if ( bDontSplit ) { // Table is not allowed to split: Take the whole height, that's all - return aRectFnSet.GetHeight(Frame()); + return aRectFnSet.GetHeight(getSwFrame()); } SwTwips nTmpHeight = 0; @@ -5433,7 +5506,7 @@ SwTwips SwTabFrame::CalcHeightOfFirstContentLine() const if ( pFirstRow ) { const bool bSplittable = pFirstRow->IsRowSplitAllowed(); - const SwTwips nFirstLineHeight = aRectFnSet.GetHeight(pFirstRow->Frame()); + const SwTwips nFirstLineHeight = aRectFnSet.GetHeight(pFirstRow->getSwFrame()); if ( !bSplittable ) { |