incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1400124 - in /incubator/ooo/trunk/main: sc/source/ui/drawfunc/fudraw.cxx sw/source/ui/docvw/edtwin.cxx
Date Fri, 19 Oct 2012 15:09:57 GMT
Author: alg
Date: Fri Oct 19 15:09:57 2012
New Revision: 1400124

URL: http://svn.apache.org/viewvc?rev=1400124&view=rev
Log:
#121236# Added support for fast move of objects with cursor keys (holding shift) for Writer
and Calc (was alraedy in Draw/Impress)

Modified:
    incubator/ooo/trunk/main/sc/source/ui/drawfunc/fudraw.cxx
    incubator/ooo/trunk/main/sw/source/ui/docvw/edtwin.cxx

Modified: incubator/ooo/trunk/main/sc/source/ui/drawfunc/fudraw.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/ui/drawfunc/fudraw.cxx?rev=1400124&r1=1400123&r2=1400124&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/ui/drawfunc/fudraw.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/ui/drawfunc/fudraw.cxx Fri Oct 19 15:09:57 2012
@@ -504,6 +504,11 @@ sal_Bool __EXPORT FuDraw::KeyInput(const
 						nX *= aLogicSizeOnePixel.Width();
 						nY *= aLogicSizeOnePixel.Height();
 					}
+					else if(rKEvt.GetKeyCode().IsShift()) // #121236# Support for shift key in calc
+					{
+						nX *= 1000;
+						nY *= 1000;
+					}
 					else
 					{
 						// old, fixed move distance

Modified: incubator/ooo/trunk/main/sw/source/ui/docvw/edtwin.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/ui/docvw/edtwin.cxx?rev=1400124&r1=1400123&r2=1400124&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sw/source/ui/docvw/edtwin.cxx (original)
+++ incubator/ooo/trunk/main/sw/source/ui/docvw/edtwin.cxx Fri Oct 19 15:09:57 2012
@@ -965,6 +965,12 @@ void SwEditWin::FlushInBuffer()
 #define MOVE_RIGHT_SMALL    6
 #define MOVE_DOWN_SMALL     7
 
+// #121236# Support for shift key in writer
+#define MOVE_LEFT_HUGE      8
+#define MOVE_UP_HUGE        9
+#define MOVE_RIGHT_HUGE     10
+#define MOVE_DOWN_HUGE      11
+
 void SwEditWin::ChangeFly( sal_uInt8 nDir, sal_Bool bWeb )
 {
     SwWrtShell &rSh = rView.GetWrtShell();
@@ -987,11 +993,18 @@ void SwEditWin::ChangeFly( sal_uInt8 nDi
         rSh.GetFlyFrmAttr( aSet );
         RndStdIds eAnchorId = ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetAnchorId();
         Size aSnap;
+        bool bHuge(MOVE_LEFT_HUGE == nDir ||
+            MOVE_UP_HUGE == nDir ||
+            MOVE_RIGHT_HUGE == nDir ||
+            MOVE_DOWN_HUGE == nDir);
+
         if(MOVE_LEFT_SMALL == nDir ||
             MOVE_UP_SMALL == nDir ||
             MOVE_RIGHT_SMALL == nDir ||
             MOVE_DOWN_SMALL == nDir )
+        {
             aSnap = PixelToLogic(Size(1,1));
+        }
         else
         {
             aSnap = rSh.GetViewOptions()->GetSnapSize();
@@ -1003,6 +1016,12 @@ void SwEditWin::ChangeFly( sal_uInt8 nDi
                 aSnap.Height() = Max( (sal_uLong)1, (sal_uLong)aSnap.Height() / nDiv );
         }
 
+        if(bHuge)
+        {
+            // #121236# 567twips == 1cm, but just take three times the normal snap
+            aSnap = Size(aSnap.Width() * 3, aSnap.Height() * 3);
+        }
+
         SwRect aBoundRect;
         Point aRefPoint;
         // OD 18.09.2003 #i18732# - adjustment for allowing vertical position
@@ -1026,15 +1045,31 @@ void SwEditWin::ChangeFly( sal_uInt8 nDi
         switch ( nDir )
         {
             case MOVE_LEFT_BIG:
-            case MOVE_LEFT_SMALL: aTmp.Left( aTmp.Left() - nLeft ); break;
+            case MOVE_LEFT_HUGE:
+            case MOVE_LEFT_SMALL: aTmp.Left( aTmp.Left() - nLeft ); 
+                break;
+            
             case MOVE_UP_BIG:
-            case MOVE_UP_SMALL: aTmp.Top( aTmp.Top() - nUp ); break;
-            case MOVE_RIGHT_SMALL: if( aTmp.Width() < aSnap.Width() + MINFLY ) break;
-                    nRight = aSnap.Width(); // kein break
-            case MOVE_RIGHT_BIG: aTmp.Left( aTmp.Left() + nRight ); break;
-            case MOVE_DOWN_SMALL: if( aTmp.Height() < aSnap.Height() + MINFLY ) break;
-                    nDown = aSnap.Height(); // kein break
-            case MOVE_DOWN_BIG: aTmp.Top( aTmp.Top() + nDown ); break;
+            case MOVE_UP_HUGE:
+            case MOVE_UP_SMALL: aTmp.Top( aTmp.Top() - nUp ); 
+                break;
+            
+            case MOVE_RIGHT_SMALL: 
+                if( aTmp.Width() < aSnap.Width() + MINFLY ) 
+                    break;
+                nRight = aSnap.Width(); // kein break
+            case MOVE_RIGHT_HUGE: 
+            case MOVE_RIGHT_BIG: aTmp.Left( aTmp.Left() + nRight ); 
+                break;
+
+            case MOVE_DOWN_SMALL: 
+                if( aTmp.Height() < aSnap.Height() + MINFLY ) 
+                    break;
+                nDown = aSnap.Height(); // kein break
+            case MOVE_DOWN_HUGE: 
+            case MOVE_DOWN_BIG: aTmp.Top( aTmp.Top() + nDown ); 
+                break;
+
             default: ASSERT( sal_True, "ChangeFly: Unknown direction." );
         }
         sal_Bool bSet = sal_False;
@@ -1142,33 +1177,38 @@ void SwEditWin::ChangeDrawing( sal_uInt8
 
     long nX = 0;
     long nY = 0;
-    sal_Bool bOnePixel = sal_False;
+    const sal_Bool bOnePixel(
+        MOVE_LEFT_SMALL == nDir || 
+        MOVE_UP_SMALL == nDir || 
+        MOVE_RIGHT_SMALL == nDir || 
+        MOVE_DOWN_SMALL == nDir);
+    const sal_Bool bHuge(
+        MOVE_LEFT_HUGE == nDir || 
+        MOVE_UP_HUGE == nDir || 
+        MOVE_RIGHT_HUGE == nDir || 
+        MOVE_DOWN_HUGE == nDir);
     sal_uInt16 nAnchorDir = SW_MOVE_UP;
     switch(nDir)
     {
         case MOVE_LEFT_SMALL:
-            bOnePixel = sal_True;
-            //no break;
+        case MOVE_LEFT_HUGE:
         case MOVE_LEFT_BIG:
             nX = -1;
             nAnchorDir = SW_MOVE_LEFT;
         break;
         case MOVE_UP_SMALL:
-            bOnePixel = sal_True;
-            //no break;
+        case MOVE_UP_HUGE:
         case MOVE_UP_BIG:
             nY = -1;
         break;
         case MOVE_RIGHT_SMALL:
-            bOnePixel = sal_True;
-            //no break;
+        case MOVE_RIGHT_HUGE:
         case MOVE_RIGHT_BIG:
             nX = +1;
             nAnchorDir = SW_MOVE_RIGHT;
         break;
         case MOVE_DOWN_SMALL:
-            bOnePixel = sal_True;
-            //no break;
+        case MOVE_DOWN_HUGE:
         case MOVE_DOWN_BIG:
             nY = +1;
             nAnchorDir = SW_MOVE_DOWN;
@@ -1187,7 +1227,14 @@ void SwEditWin::ChangeDrawing( sal_uInt8
             aSnap.Height() = Max( (sal_uLong)1, (sal_uLong)aSnap.Height() / nDiv );
 
         if(bOnePixel)
+        {
             aSnap = PixelToLogic(Size(1,1));
+        }
+        else if(bHuge)
+        {
+            // #121236# 567twips == 1cm, but just take three times the normal snap
+            aSnap = Size(aSnap.Width() * 3, aSnap.Height() * 3);
+        }
 
         nX *= aSnap.Width();
         nY *= aSnap.Height();
@@ -1578,19 +1625,23 @@ void SwEditWin::KeyInput(const KeyEvent 
                 switch( rKeyCode.GetModifier() | rKeyCode.GetCode() )
                 {
                 case KEY_RIGHT | KEY_MOD2:
+                case KEY_RIGHT | KEY_SHIFT:
                     eKeyState = KS_ColRightBig;
                     eFlyState = KS_Fly_Change;
-                    nDir = MOVE_RIGHT_SMALL;
+                    nDir = rKeyCode.GetModifier() & KEY_SHIFT ? MOVE_RIGHT_HUGE : MOVE_RIGHT_SMALL;
                     goto KEYINPUT_CHECKTABLE;
 
                 case KEY_LEFT | KEY_MOD2:
+                case KEY_LEFT | KEY_SHIFT:
                     eKeyState = KS_ColRightSmall;
                     eFlyState = KS_Fly_Change;
-                    nDir = MOVE_LEFT_SMALL;
+                    nDir = rKeyCode.GetModifier() & KEY_SHIFT ? MOVE_LEFT_HUGE : MOVE_LEFT_SMALL;
                     goto KEYINPUT_CHECKTABLE;
+
                 case KEY_RIGHT | KEY_MOD2 | KEY_SHIFT:
                     eKeyState = KS_ColLeftSmall;
                     goto KEYINPUT_CHECKTABLE;
+
                 case KEY_LEFT | KEY_MOD2 | KEY_SHIFT:
                     eKeyState = KS_ColLeftBig;
                     goto KEYINPUT_CHECKTABLE;
@@ -1598,26 +1649,33 @@ void SwEditWin::KeyInput(const KeyEvent 
                 case KEY_RIGHT | KEY_MOD2 | KEY_MOD1:
                     eKeyState = KS_CellRightBig;
                     goto KEYINPUT_CHECKTABLE;
+
                 case KEY_LEFT | KEY_MOD2 | KEY_MOD1:
                     eKeyState = KS_CellRightSmall;
                     goto KEYINPUT_CHECKTABLE;
+
                 case KEY_RIGHT | KEY_MOD2 | KEY_SHIFT | KEY_MOD1:
                     eKeyState = KS_CellLeftSmall;
                     goto KEYINPUT_CHECKTABLE;
+
                 case KEY_LEFT | KEY_MOD2 | KEY_SHIFT | KEY_MOD1:
                     eKeyState = KS_CellLeftBig;
                     goto KEYINPUT_CHECKTABLE;
 
                 case KEY_UP | KEY_MOD2:
+                case KEY_UP | KEY_SHIFT:
                     eKeyState = KS_ColBottomSmall;
                     eFlyState = KS_Fly_Change;
-                    nDir = MOVE_UP_SMALL;
+                    nDir = rKeyCode.GetModifier() & KEY_SHIFT ? MOVE_UP_HUGE : MOVE_UP_SMALL;
                     goto KEYINPUT_CHECKTABLE;
+
                 case KEY_DOWN | KEY_MOD2:
+                case KEY_DOWN | KEY_SHIFT:
                     eKeyState = KS_ColBottomBig;
                     eFlyState = KS_Fly_Change;
-                    nDir = MOVE_DOWN_SMALL;
+                    nDir = rKeyCode.GetModifier() & KEY_SHIFT ? MOVE_DOWN_HUGE : MOVE_DOWN_SMALL;
                     goto KEYINPUT_CHECKTABLE;
+
 //              case KEY_UP | KEY_MOD2 | KEY_SHIFT:
 //                  eKeyState = KS_ColTopBig;
 //                  goto KEYINPUT_CHECKTABLE;
@@ -1628,12 +1686,15 @@ void SwEditWin::KeyInput(const KeyEvent 
                 case KEY_UP | KEY_MOD2 | KEY_MOD1:
                     eKeyState = KS_CellBottomSmall;
                     goto KEYINPUT_CHECKTABLE;
+
                 case KEY_DOWN | KEY_MOD2 | KEY_MOD1:
                     eKeyState = KS_CellBottomBig;
                     goto KEYINPUT_CHECKTABLE;
+
                 case KEY_UP | KEY_MOD2 | KEY_SHIFT | KEY_MOD1:
                     eKeyState = KS_CellTopBig;
                     goto KEYINPUT_CHECKTABLE;
+
                 case KEY_DOWN | KEY_MOD2 | KEY_SHIFT | KEY_MOD1:
                     eKeyState = KS_CellTopSmall;
                     goto KEYINPUT_CHECKTABLE;



Mime
View raw message