[Libreoffice-commits] core.git: sw/inc sw/source

Miklos Vajna vmiklos at suse.cz
Tue Mar 19 06:29:04 PDT 2013


 sw/inc/fldbas.hxx                 |    2 ++
 sw/source/core/fields/fldbas.cxx  |   15 +++++++++++++++
 sw/source/core/layout/trvlfrm.cxx |    4 ++--
 sw/source/ui/wrtsh/wrtsh2.cxx     |    2 ++
 4 files changed, 21 insertions(+), 2 deletions(-)

New commits:
commit e76e2c4ce76457e518b007b970e1b0c2742f8d6e
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue Mar 19 14:25:39 2013 +0100

    add SwField::IsClickable and use it from SwWrtShell and SwPageFrm
    
    Change-Id: I3d856dc11297b2ad73859ff9c2d529e8cd4727b2

diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index c8e9fd7..55834ff 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 8134348..9353219 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 a1ace40..8f4f0be 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 74d4537..335f01c 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;


More information about the Libreoffice-commits mailing list