summaryrefslogtreecommitdiff
path: root/sw/source/core/layout/trvlfrm.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-03-19 13:41:19 +0100
committerMiklos Vajna <vmiklos@suse.cz>2013-03-19 13:44:25 +0100
commita996678ed30804e16103e1cfdc439c8546e5d3b0 (patch)
treec6167c71a47a592d56f4acaed38f0bdaa6ecba93 /sw/source/core/layout/trvlfrm.cxx
parent5c0dd406207e42aae4d3dbaca8235cc5ab01bc6b (diff)
bnc#802888 SwPageFrm: let macro fields have priority over background objects
The intention is to get similar behavior as 61f467c8974d6b6face41e7027d75ae4ddb6fdb2, except this applies to single clicks, while that one affected only double-click. Change-Id: Idddc26aa8cd064f89fb4f99b3ad7a5430ac455bc
Diffstat (limited to 'sw/source/core/layout/trvlfrm.cxx')
-rw-r--r--sw/source/core/layout/trvlfrm.cxx19
1 files changed, 18 insertions, 1 deletions
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index 7728a986385d..a1ace40aabdf 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -50,6 +50,9 @@
#include <dcontact.hxx>
// OD 2004-05-24 #i28701#
#include <sortedobjs.hxx>
+#include <txatbase.hxx>
+#include <fmtfld.hxx>
+#include <fldbas.hxx>
// FLT_MAX
#include <cfloat>
@@ -290,10 +293,24 @@ sal_Bool SwPageFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint,
bValidTextDistance = true;
}
+ bool bConsiderBackground = true;
+ // If the text position if a macro 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->Which() == RES_MACROFLD)
+ bConsiderBackground = false;
+ }
+ }
+
double nBackDistance = 0;
bool bValidBackDistance = false;
SwCntntNode* pBackNd = aBackPos.nNode.GetNode( ).GetCntntNode( );
- if ( pBackNd )
+ if ( pBackNd && bConsiderBackground)
{
// FIXME There are still cases were we don't have the proper node here.
SwCntntFrm* pBackFrm = pBackNd->getLayoutFrm( getRootFrm( ) );