summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 0fa03e1f7792..05935ba2f656 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -269,13 +269,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 && 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;
@@ -291,7 +306,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 )
@@ -304,20 +318,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( );