[Libreoffice-commits] .: Branch 'distro/suse/suse-3.6' - sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Nov 16 08:49:02 PST 2012


 sw/source/ui/docvw/edtwin.cxx |   24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

New commits:
commit 90bb5281988d8088cd73a4134b162be1165bde61
Author: Cédric Bosdonnat <cedric.bosdonnat at free.fr>
Date:   Fri Nov 16 13:37:04 2012 +0100

    n#780277: select field when clicking it instead of having cursor before it
    
    Change-Id: I93d623b62e9357a71bfca3403cc98092ef58c7e4

diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index 2afa975..712b31f 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -2974,6 +2974,8 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
                                 bExecDrawTextLink = sal_True;
                         }
 
+                        SwContentAtPos aFieldAtPos ( SwContentAtPos::SW_FIELD );
+
                         // only try to select frame, if pointer already was
                         // switched accordingly
                         if ( aActHitType != SDRHIT_NONE && !rSh.IsSelFrmMode() &&
@@ -3090,6 +3092,19 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
                             }
                         }
 
+                        // Are we selecting a field?
+                        else if ( rSh.GetContentAtPos( aDocPos, aFieldAtPos ) )
+                        {
+                            // select work, AdditionalMode if applicable
+                            if ( KEY_MOD1 == rMEvt.GetModifier() && !rSh.IsAddMode() )
+                            {
+                                rSh.EnterAddMode();
+                                rSh.SelWrd( &aDocPos );
+                                rSh.LeaveAddMode();
+                            }
+                            else
+                                rSh.SelWrd( &aDocPos );
+                        }
                         break;
                     }
                     case 2:
@@ -4213,7 +4228,8 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
             }
             else
             {
-                if ( !rSh.IsInSelect() && rSh.ChgCurrPam( aDocPt ) )
+                SwContentAtPos aFieldAtPos ( SwContentAtPos::SW_FIELD );
+                if ( !rSh.IsInSelect() && rSh.ChgCurrPam( aDocPt ) && !rSh.GetContentAtPos( aDocPt, aFieldAtPos ) )
                 {
                     const sal_Bool bTmpNoInterrupt = bNoInterrupt;
                     bNoInterrupt = sal_False;
@@ -4257,8 +4273,12 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt)
                                                     SwContentAtPos::SW_INETATTR |
                                                     SwContentAtPos::SW_SMARTTAG  | SwContentAtPos::SW_FORMCTRL);
 
-                        if( rSh.GetContentAtPos( aDocPt, aCntntAtPos, sal_True ) )
+                        if( rSh.GetContentAtPos( aDocPt, aCntntAtPos, sal_False ) )
                         {
+                            // Do it again if we're not on a field to update the cursor accordingly
+                            if ( SwContentAtPos::SW_FIELD != aCntntAtPos.eCntntAtPos )
+                                rSh.GetContentAtPos( aDocPt, aCntntAtPos, sal_True );
+
                             sal_Bool bViewLocked = rSh.IsViewLocked();
                             if( !bViewLocked && !rSh.IsReadOnlyAvailable() &&
                                 aCntntAtPos.IsInProtectSect() )


More information about the Libreoffice-commits mailing list