Kaydet (Commit) 2fc4af31 authored tarafından Michael Stahl's avatar Michael Stahl

fdo#58142: fix frame selection in SwPageFrm::GetCrsrOfst:

The function does not handle the case where a paragraph was hit but no
background frame was hit properly, which may or may not (depending on
the platform) cause it to return a position of a frame when that is
undesirable, such as when called from SwWrtShell::UnSelectFrm().

When UnselectFrm() leaves a frame selected pasting multiple pictures
leads to a crash.

(regression from e8fbe979)

Change-Id: I3604825f654c523a37f47a9fc660647d8b3e7077
üst e209615b
...@@ -264,8 +264,12 @@ sal_Bool SwPageFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint, ...@@ -264,8 +264,12 @@ sal_Bool SwPageFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint,
if ( ( bTestBackground && bBackRet ) || !bTextRet ) if ( ( bTestBackground && bBackRet ) || !bTextRet )
{ {
bRet = bBackRet; bRet = bBackRet;
pPos->nNode = aBackPos.nNode; (*pPos) = aBackPos;
pPos->nContent = aBackPos.nContent; }
else if (bTextRet && !bBackRet)
{
bRet = bTextRet;
(*pPos) = aTextPos;
} }
else else
{ {
...@@ -306,14 +310,12 @@ sal_Bool SwPageFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint, ...@@ -306,14 +310,12 @@ sal_Bool SwPageFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint,
if ( bValidTextDistance && bValidBackDistance && basegfx::fTools::more( nTextDistance, nBackDistance ) ) if ( bValidTextDistance && bValidBackDistance && basegfx::fTools::more( nTextDistance, nBackDistance ) )
{ {
bRet = bBackRet; bRet = bBackRet;
pPos->nNode = aBackPos.nNode; (*pPos) = aBackPos;
pPos->nContent = aBackPos.nContent;
} }
else else
{ {
bRet = bTextRet; bRet = bTextRet;
pPos->nNode = aTextPos.nNode; (*pPos) = aTextPos;
pPos->nContent = aTextPos.nContent;
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment