sw/inc/fldbas.hxx | 2 ++ sw/source/core/fields/fldbas.cxx | 15 +++++++++++++++ sw/source/core/layout/trvlfrm.cxx | 19 ++++++++++++++++++- sw/source/ui/wrtsh/wrtsh2.cxx | 2 ++ 4 files changed, 37 insertions(+), 1 deletion(-)
New commits: commit df3ec1cd965bc6f34846cd86f303f3473e672031 Author: Miklos Vajna <[email protected]> Date: Tue Mar 19 13:41:19 2013 +0100 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 (cherry picked from commits a996678ed30804e16103e1cfdc439c8546e5d3b0 and e76e2c4ce76457e518b007b970e1b0c2742f8d6e) diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx index 93c7495..a3280f8 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 2a693ea..9364533 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 ee907cd..0fa03e1 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 16196cc..4d180b5 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; _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
