summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2012-10-19 14:09:57 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-06-12 09:14:55 +0100
commit2d64de59c2109e378e4d38d6cad2510226c05435 (patch)
tree387cd0c0f93009c04ceba5311511aca676c5a2ed
parente2e0db8f2967d866cba5c5400617d97aceaeefe9 (diff)
Resolves: #i121236# Added support for fast move of objects with cursor keys
(holding shift) for Writer and Calc (was alraedy in Draw/Impress) (cherry picked from commit d794e5f9ebb756958725183bbfcc88f457d1bc1d) Conflicts: sw/source/ui/docvw/edtwin.cxx Change-Id: I74e0ba40fa0900915adc84f722105e7fdddb0a19
-rw-r--r--sc/source/ui/drawfunc/fudraw.cxx5
-rw-r--r--sw/source/ui/docvw/edtwin.cxx102
2 files changed, 86 insertions, 21 deletions
diff --git a/sc/source/ui/drawfunc/fudraw.cxx b/sc/source/ui/drawfunc/fudraw.cxx
index 64e8c89daea2..6f73d8adebc1 100644
--- a/sc/source/ui/drawfunc/fudraw.cxx
+++ b/sc/source/ui/drawfunc/fudraw.cxx
@@ -461,6 +461,11 @@ sal_Bool FuDraw::KeyInput(const KeyEvent& rKEvt)
nX *= aLogicSizeOnePixel.Width();
nY *= aLogicSizeOnePixel.Height();
}
+ else if(rKEvt.GetKeyCode().IsShift()) // #i121236# Support for shift key in calc
+ {
+ nX *= 1000;
+ nY *= 1000;
+ }
else
{
// old, fixed move distance
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index f0b19519d350..6105a5619765 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -982,6 +982,12 @@ void SwEditWin::FlushInBuffer()
#define MOVE_RIGHT_SMALL 6
#define MOVE_DOWN_SMALL 7
+// #i121236# 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 = m_rView.GetWrtShell();
@@ -1001,11 +1007,18 @@ void SwEditWin::ChangeFly( sal_uInt8 nDir, sal_Bool bWeb )
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();
@@ -1017,6 +1030,12 @@ void SwEditWin::ChangeFly( sal_uInt8 nDir, sal_Bool bWeb )
aSnap.Height() = std::max( (sal_uLong)1, (sal_uLong)aSnap.Height() / nDiv );
}
+ if(bHuge)
+ {
+ // #i121236# 567twips == 1cm, but just take three times the normal snap
+ aSnap = Size(aSnap.Width() * 3, aSnap.Height() * 3);
+ }
+
SwRect aBoundRect;
Point aRefPoint;
// adjustment for allowing vertical position
@@ -1039,15 +1058,31 @@ void SwEditWin::ChangeFly( sal_uInt8 nDir, sal_Bool bWeb )
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(); // no 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(); // no 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(); // no 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(); // no break
+ case MOVE_DOWN_HUGE:
+ case MOVE_DOWN_BIG: aTmp.Top( aTmp.Top() + nDown );
+ break;
+
default: OSL_ENSURE(true, "ChangeFly: Unknown direction." );
}
bool bSet = false;
@@ -1151,33 +1186,38 @@ void SwEditWin::ChangeDrawing( sal_uInt8 nDir )
long nX = 0;
long nY = 0;
- bool bOnePixel = false;
+ const bool bOnePixel(
+ MOVE_LEFT_SMALL == nDir ||
+ MOVE_UP_SMALL == nDir ||
+ MOVE_RIGHT_SMALL == nDir ||
+ MOVE_DOWN_SMALL == nDir);
+ const 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 = true;
- //no break;
+ case MOVE_LEFT_HUGE:
case MOVE_LEFT_BIG:
nX = -1;
nAnchorDir = SW_MOVE_LEFT;
break;
case MOVE_UP_SMALL:
- bOnePixel = true;
- //no break;
+ case MOVE_UP_HUGE:
case MOVE_UP_BIG:
nY = -1;
break;
case MOVE_RIGHT_SMALL:
- bOnePixel = true;
- //no break;
+ case MOVE_RIGHT_HUGE:
case MOVE_RIGHT_BIG:
nX = +1;
nAnchorDir = SW_MOVE_RIGHT;
break;
case MOVE_DOWN_SMALL:
- bOnePixel = true;
- //no break;
+ case MOVE_DOWN_HUGE:
case MOVE_DOWN_BIG:
nY = +1;
nAnchorDir = SW_MOVE_DOWN;
@@ -1196,7 +1236,14 @@ void SwEditWin::ChangeDrawing( sal_uInt8 nDir )
aSnap.Height() = std::max( (sal_uLong)1, (sal_uLong)aSnap.Height() / nDiv );
if(bOnePixel)
+ {
aSnap = PixelToLogic(Size(1,1));
+ }
+ else if(bHuge)
+ {
+ // #i121236# 567twips == 1cm, but just take three times the normal snap
+ aSnap = Size(aSnap.Width() * 3, aSnap.Height() * 3);
+ }
nX *= aSnap.Width();
nY *= aSnap.Height();
@@ -1597,19 +1644,23 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt)
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;
@@ -1617,36 +1668,45 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt)
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_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;