summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sw/inc/fldbas.hxx2
-rw-r--r--sw/source/core/fields/fldbas.cxx15
-rw-r--r--sw/source/core/layout/trvlfrm.cxx19
-rw-r--r--sw/source/ui/wrtsh/wrtsh2.cxx2
4 files changed, 37 insertions, 1 deletions
diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index 93c749599074..a3280f849930 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -352,6 +352,8 @@ public:
void SetAutomaticLanguage(sal_Bool bSet){bIsAutomaticLanguage = bSet;}
virtual String GetDescription() const;
+ /// Is this field clickable?
+ bool IsClickable() const;
};
inline SwFieldType* SwField::GetTyp() const
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index 2a693ea48810..93645332de30 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -764,6 +764,21 @@ String SwField::GetDescription() const
return SW_RES(STR_FIELD);
}
+bool SwField::IsClickable() const
+{
+ switch (Which())
+ {
+ case RES_JUMPEDITFLD:
+ case RES_MACROFLD:
+ case RES_GETREFFLD:
+ case RES_INPUTFLD:
+ case RES_SETEXPFLD:
+ case RES_DROPDOWN:
+ return true;
+ }
+ return false;
+}
+
sal_uInt16 SwFldTypes::GetPos(const SwFieldType* pFieldType) const
{
const_iterator it = std::find(begin(), end(), pFieldType);
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index ee907cd17468..0fa03e1f7792 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -61,6 +61,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>
@@ -301,10 +304,24 @@ 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( );
- if ( pBackNd )
+ if ( pBackNd && bConsiderBackground)
{
// FIXME There are still cases were we don't have the proper node here.
SwCntntFrm* pBackFrm = pBackNd->getLayoutFrm( getRootFrm( ) );
diff --git a/sw/source/ui/wrtsh/wrtsh2.cxx b/sw/source/ui/wrtsh/wrtsh2.cxx
index 16196cc6b6e1..4d180b549d70 100644
--- a/sw/source/ui/wrtsh/wrtsh2.cxx
+++ b/sw/source/ui/wrtsh/wrtsh2.cxx
@@ -307,6 +307,8 @@ void SwWrtShell::ClickToField( const SwField& rFld )
case RES_DROPDOWN :
StartDropDownFldDlg( (SwField*)&rFld, sal_False );
break;
+ default:
+ SAL_WARN_IF(rFld.IsClickable(), "sw", "unhandled clickable field!");
}
bIsInClickToEdit = sal_False;