diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-03-19 14:25:39 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-03-19 14:28:44 +0100 |
commit | e76e2c4ce76457e518b007b970e1b0c2742f8d6e (patch) | |
tree | 0c4844795137d0e3f3921535539fd49583421732 /sw | |
parent | 5bb4a2ba1d8a6b98720868786e552aa8fd2a22eb (diff) |
add SwField::IsClickable and use it from SwWrtShell and SwPageFrm
Change-Id: I3d856dc11297b2ad73859ff9c2d529e8cd4727b2
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/fldbas.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/fields/fldbas.cxx | 15 | ||||
-rw-r--r-- | sw/source/core/layout/trvlfrm.cxx | 4 | ||||
-rw-r--r-- | sw/source/ui/wrtsh/wrtsh2.cxx | 2 |
4 files changed, 21 insertions, 2 deletions
diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx index c8e9fd7ae48d..55834ff45cb4 100644 --- a/sw/inc/fldbas.hxx +++ b/sw/inc/fldbas.hxx @@ -343,6 +343,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 813434838958..93532197dbdf 100644 --- a/sw/source/core/fields/fldbas.cxx +++ b/sw/source/core/fields/fldbas.cxx @@ -756,6 +756,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 a1ace40aabdf..8f4f0bef6a7e 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -294,7 +294,7 @@ sal_Bool SwPageFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint, } bool bConsiderBackground = true; - // If the text position if a macro field, then that should have priority. + // If the text position is a clickable field, then that should have priority. if (pTextNd->IsTxtNode()) { SwTxtNode* pTxtNd = pTextNd->GetTxtNode(); @@ -302,7 +302,7 @@ sal_Bool SwPageFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint, if (pTxtAttr) { const SwField* pField = pTxtAttr->GetFld().GetFld(); - if (pField->Which() == RES_MACROFLD) + if (pField->IsClickable()) bConsiderBackground = false; } } diff --git a/sw/source/ui/wrtsh/wrtsh2.cxx b/sw/source/ui/wrtsh/wrtsh2.cxx index 74d4537c41e2..335f01caf51e 100644 --- a/sw/source/ui/wrtsh/wrtsh2.cxx +++ b/sw/source/ui/wrtsh/wrtsh2.cxx @@ -315,6 +315,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 = false; |