summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-06-10 14:48:59 +0200
committerMiklos Vajna <vmiklos@suse.cz>2013-06-10 16:14:57 +0200
commit1a2bfc240f3ba37280e91b02999967e41963fd12 (patch)
tree96c0bbfc1e2751fc76a655712a26e8a2d60d6a6d /sw
parentc07f2af71c2bb1dc06cf1a1d46aa1ff424c1acb7 (diff)
bnc#802888 SwPageFrm: one more clickable field fix
This is similar to a996678ed30804e16103e1cfdc439c8546e5d3b0. If we have both a background object and some clickable field to select, we should always prefer the clickable field. This time, the problem was to click on a clickable field, when the cursor was in normal text and we had a full-page background object. Change-Id: Id25036d8cb2ddf62011c22bfc50844b793b942bd (cherry picked from commit 721baad94ee81d9d6281edb93ee45936f6e0e496) Conflicts: sw/source/core/layout/trvlfrm.cxx
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/layout/trvlfrm.cxx32
1 files changed, 16 insertions, 16 deletions
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index 517cb84d5454..6e60864d4364 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -258,13 +258,28 @@ sal_Bool SwPageFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint,
}
}
+ bool bConsiderBackground = true;
+ SwCntntNode* pTextNd = aTextPos.nNode.GetNode( ).GetCntntNode( );
+ // If the text position is a clickable field, then that should have priority.
+ if (pTextNd->IsTxtNode())
+ {
+ SwTxtNode* pTxtNd = pTextNd->GetTxtNode();
+ SwTxtAttr* pTxtAttr = pTxtNd->GetTxtAttrForCharAt(aTextPos.nContent.GetIndex(), RES_TXTATR_FIELD);
+ if (pTxtAttr)
+ {
+ const SwField* pField = pTxtAttr->GetFld().GetFld();
+ if (pField->IsClickable())
+ bConsiderBackground = false;
+ }
+ }
+
// Check objects in the background if nothing else matched
if ( GetSortedObjs() )
{
bBackRet = lcl_GetCrsrOfst_Objects( this, true, &aBackPos, rPoint, pCMS );
}
- if ( ( bTestBackground && bBackRet ) || !bTextRet )
+ if ( ( bConsiderBackground && bTestBackground && bBackRet ) || !bTextRet )
{
bRet = bBackRet;
(*pPos) = aBackPos;
@@ -280,7 +295,6 @@ sal_Bool SwPageFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint,
* text and brackground object, then we compute the distance between both
* would-be positions and the click point. The shortest distance wins.
*/
- SwCntntNode* pTextNd = aTextPos.nNode.GetNode( ).GetCntntNode( );
double nTextDistance = 0;
bool bValidTextDistance = false;
if ( pTextNd )
@@ -293,20 +307,6 @@ sal_Bool SwPageFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint,
bValidTextDistance = true;
}
- bool bConsiderBackground = true;
- // If the text position is a clickable field, then that should have priority.
- if (pTextNd->IsTxtNode())
- {
- SwTxtNode* pTxtNd = pTextNd->GetTxtNode();
- SwTxtAttr* pTxtAttr = pTxtNd->GetTxtAttrForCharAt(aTextPos.nContent.GetIndex(), RES_TXTATR_FIELD);
- if (pTxtAttr)
- {
- const SwField* pField = pTxtAttr->GetFld().GetFld();
- if (pField->IsClickable())
- bConsiderBackground = false;
- }
- }
-
double nBackDistance = 0;
bool bValidBackDistance = false;
SwCntntNode* pBackNd = aBackPos.nNode.GetNode( ).GetCntntNode( );