diff options
Diffstat (limited to 'sw/source/core/layout/trvlfrm.cxx')
-rw-r--r-- | sw/source/core/layout/trvlfrm.cxx | 74 |
1 files changed, 42 insertions, 32 deletions
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index 5f8e3aa995..a8445e90dd 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -70,8 +70,9 @@ namespace { const SwVirtFlyDrawObj* pObj = static_cast<const SwVirtFlyDrawObj*>(aIter()); const SwAnchoredObject* pAnchoredObj = GetUserCall( aIter() )->GetAnchoredObj( aIter() ); - const SwFormatSurround& rSurround = pAnchoredObj->GetFrameFormat().GetSurround(); - const SvxOpaqueItem& rOpaque = pAnchoredObj->GetFrameFormat().GetOpaque(); + const SwFrameFormat* pObjFormat = pAnchoredObj->GetFrameFormat(); + const SwFormatSurround& rSurround = pObjFormat->GetSurround(); + const SvxOpaqueItem& rOpaque = pObjFormat->GetOpaque(); bool bInBackground = ( rSurround.GetSurround() == css::text::WrapTextMode_THROUGH ) && !rOpaque.GetValue(); bool bBackgroundMatches = bInBackground == bSearchBackground; @@ -2599,40 +2600,49 @@ void SwRootFrame::CalcFrameRects(SwShellCursor const& rCursor, SwRects & rRects, // splitting of portions vertically (causes spurious extra PDF annotations) if (eMode == RectsMode::NoAnchoredFlys) { - assert(pStartFrame == pEndFrame); // link or field all in 1 frame - assert(pStartFrame->IsTextFrame()); - SwTextGridItem const*const pGrid(GetGridItem(pStartFrame->FindPageFrame())); - SwTextPaintInfo info(static_cast<SwTextFrame*>(pStartFrame), pStartFrame->FindPageFrame()->getFrameArea()); - SwTextPainter painter(static_cast<SwTextFrame*>(pStartFrame), &info); - // because nothing outside the start/end has been added, it doesn't - // matter to match exactly the start/end, subtracting outside is no-op - painter.CharToLine(static_cast<SwTextFrame*>(pStartFrame)->MapModelToViewPos(*pStartPos)); - do - { - info.SetPos(painter.GetTopLeft()); - bool const bAdjustBaseLine( - painter.GetLineInfo().HasSpecialAlign(pStartFrame->IsVertical()) - || nullptr != pGrid || painter.GetCurr()->GetHangingBaseline()); - SwTwips nAscent, nHeight; - painter.CalcAscentAndHeight(nAscent, nHeight); - SwTwips const nOldY(info.Y()); - for (SwLinePortion const* pLP = painter.GetCurr()->GetFirstPortion(); - pLP; pLP = pLP->GetNextPortion()) + for (SwContentFrame * pFrame = pStartFrame; ; pFrame = pFrame->GetFollow()) + { + assert(pFrame->IsTextFrame()); + SwTextGridItem const*const pGrid(GetGridItem(pFrame->FindPageFrame())); + SwTextPaintInfo info(static_cast<SwTextFrame*>(pFrame), pFrame->FindPageFrame()->getFrameArea()); + SwTextPainter painter(static_cast<SwTextFrame*>(pFrame), &info); + // because nothing outside the start/end has been added, it doesn't + // matter to match exactly the start/end, subtracting outside is no-op + if (pFrame == pStartFrame) { - if (pLP->IsFlyPortion()) + painter.CharToLine(static_cast<SwTextFrame*>(pFrame)->MapModelToViewPos(*pStartPos)); + } + do + { + info.SetPos(painter.GetTopLeft()); + bool const bAdjustBaseLine( + painter.GetLineInfo().HasSpecialAlign(pFrame->IsVertical()) + || nullptr != pGrid || painter.GetCurr()->GetHangingBaseline()); + SwTwips nAscent, nHeight; + painter.CalcAscentAndHeight(nAscent, nHeight); + SwTwips const nOldY(info.Y()); + for (SwLinePortion const* pLP = painter.GetCurr()->GetFirstPortion(); + pLP; pLP = pLP->GetNextPortion()) { - info.Y(info.Y() + (bAdjustBaseLine - ? painter.AdjustBaseLine(*painter.GetCurr(), pLP) - : nAscent)); - SwRect flyPortion; - info.CalcRect(*pLP, &flyPortion); - Sub(aRegion, flyPortion); - info.Y(nOldY); + if (pLP->IsFlyPortion()) + { + info.Y(info.Y() + (bAdjustBaseLine + ? painter.AdjustBaseLine(*painter.GetCurr(), pLP) + : nAscent)); + SwRect flyPortion; + info.CalcRect(*pLP, &flyPortion); + Sub(aRegion, flyPortion); + info.Y(nOldY); + } + pLP->Move(info); } - pLP->Move(info); + } + while (painter.Next()); + if (pFrame == pEndFrame) + { + break; } } - while (painter.Next()); } else while (pPage) { @@ -2646,7 +2656,7 @@ void SwRootFrame::CalcFrameRects(SwShellCursor const& rCursor, SwRects & rRects, continue; const SwVirtFlyDrawObj* pObj = pFly->GetVirtDrawObj(); const SwFormatSurround &rSur = pFly->GetFormat()->GetSurround(); - SwFormatAnchor const& rAnchor(pAnchoredObj->GetFrameFormat().GetAnchor()); + SwFormatAnchor const& rAnchor(pAnchoredObj->GetFrameFormat()->GetAnchor()); const SwPosition* anchoredAt = rAnchor.GetContentAnchor(); bool inSelection = ( anchoredAt != nullptr |