summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-12-13 01:28:59 +0100
committerMichael Stahl <mstahl@redhat.com>2012-12-13 12:31:40 +0100
commit2ab2046fe7d939be02649b1c69f571cb19f9aeaa (patch)
tree1c6752c8b0ad42b0273024b61a93161547908fd8
parent8376da60d5d272cf6b3ebee91934bbcd970c7658 (diff)
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 e8fbe97900f13305b17015d9044993bde4adab36) Change-Id: I3604825f654c523a37f47a9fc660647d8b3e7077 (cherry picked from commit 2fc4af311656e7d019ca802d23444e5161f820ee)
-rw-r--r--sw/source/core/layout/trvlfrm.cxx14
1 files changed, 8 insertions, 6 deletions
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index a70b08d775d3..443af12c9bcd 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -264,8 +264,12 @@ sal_Bool SwPageFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint,
if ( ( bTestBackground && bBackRet ) || !bTextRet )
{
bRet = bBackRet;
- pPos->nNode = aBackPos.nNode;
- pPos->nContent = aBackPos.nContent;
+ (*pPos) = aBackPos;
+ }
+ else if (bTextRet && !bBackRet)
+ {
+ bRet = bTextRet;
+ (*pPos) = aTextPos;
}
else
{
@@ -306,14 +310,12 @@ sal_Bool SwPageFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint,
if ( bValidTextDistance && bValidBackDistance && basegfx::fTools::more( nTextDistance, nBackDistance ) )
{
bRet = bBackRet;
- pPos->nNode = aBackPos.nNode;
- pPos->nContent = aBackPos.nContent;
+ (*pPos) = aBackPos;
}
else
{
bRet = bTextRet;
- pPos->nNode = aTextPos.nNode;
- pPos->nContent = aTextPos.nContent;
+ (*pPos) = aTextPos;
}
}
}