summaryrefslogtreecommitdiff
path: root/sw/source/core/layout/frmtool.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/layout/frmtool.cxx')
-rw-r--r--sw/source/core/layout/frmtool.cxx18
1 files changed, 10 insertions, 8 deletions
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index d9c3a0f5cc8b..766761b719fe 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -3422,8 +3422,9 @@ void SwFrameHolder::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
}
}
-SwFrame* GetFrameOfModify( const SwRootFrame* pLayout, SwModify const& rMod, SwFrameType const nFrameType,
- const Point* pPoint, const SwPosition *pPos, const bool bCalcFrame )
+SwFrame* GetFrameOfModify(SwRootFrame const*const pLayout, SwModify const& rMod,
+ SwFrameType const nFrameType, SwPosition const*const pPos,
+ std::pair<Point, bool> const*const pViewPosAndCalcFrame)
{
SwFrame *pMinFrame = nullptr, *pTmpFrame;
SwFrameHolder aHolder;
@@ -3444,7 +3445,7 @@ SwFrame* GetFrameOfModify( const SwRootFrame* pLayout, SwModify const& rMod, SwF
(!pTmpFrame->IsFlowFrame() ||
!SwFlowFrame::CastFlowFrame( pTmpFrame )->IsFollow() ))
{
- if( pPoint )
+ if (pViewPosAndCalcFrame)
{
// watch for Frame being deleted
if ( pMinFrame )
@@ -3452,7 +3453,7 @@ SwFrame* GetFrameOfModify( const SwRootFrame* pLayout, SwModify const& rMod, SwF
else
aHolder.Reset();
- if( bCalcFrame )
+ if (pViewPosAndCalcFrame->second)
{
// tdf#108118 prevent recursion
DisableCallbackAction a(*pTmpFrame->getRootFrame());
@@ -3480,7 +3481,8 @@ SwFrame* GetFrameOfModify( const SwRootFrame* pLayout, SwModify const& rMod, SwF
}
// for Flys go via the parent if the Fly is not yet "formatted"
- if( !bCalcFrame && pTmpFrame->GetType() & SwFrameType::Fly &&
+ if (!pViewPosAndCalcFrame->second &&
+ pTmpFrame->GetType() & SwFrameType::Fly &&
static_cast<SwFlyFrame*>(pTmpFrame)->GetAnchorFrame() &&
FAR_AWAY == pTmpFrame->getFrameArea().Pos().getX() &&
FAR_AWAY == pTmpFrame->getFrameArea().Pos().getY() )
@@ -3488,7 +3490,7 @@ SwFrame* GetFrameOfModify( const SwRootFrame* pLayout, SwModify const& rMod, SwF
else
aCalcRect = pTmpFrame->getFrameArea();
- if ( aCalcRect.IsInside( *pPoint ) )
+ if (aCalcRect.IsInside(pViewPosAndCalcFrame->first))
{
pMinFrame = pTmpFrame;
break;
@@ -3496,7 +3498,7 @@ SwFrame* GetFrameOfModify( const SwRootFrame* pLayout, SwModify const& rMod, SwF
// Point not in rectangle. Compare distances:
const Point aCalcRectCenter = aCalcRect.Center();
- const Point aDiff = aCalcRectCenter - *pPoint;
+ const Point aDiff = aCalcRectCenter - pViewPosAndCalcFrame->first;
const sal_uInt64 nCurrentDist = sal_Int64(aDiff.getX()) * sal_Int64(aDiff.getX()) + sal_Int64(aDiff.getY()) * sal_Int64(aDiff.getY()); // opt: no sqrt
if ( !pMinFrame || nCurrentDist < nMinDist )
{
@@ -3506,7 +3508,7 @@ SwFrame* GetFrameOfModify( const SwRootFrame* pLayout, SwModify const& rMod, SwF
}
else
{
- // if no pPoint is provided, take the first one
+ // if no pViewPosAndCalcFrame is provided, take the first one
pMinFrame = pTmpFrame;
break;
}