Index: sc/source/ui/inc/cellsh.hxx =================================================================== RCS file: /cvs/sc/sc/source/ui/inc/cellsh.hxx,v retrieving revision 1.8 diff -u -p -r1.8 cellsh.hxx --- sc/source/ui/inc/cellsh.hxx 27 Feb 2007 13:20:11 -0000 1.8 +++ sc/source/ui/inc/cellsh.hxx 21 Feb 2008 01:29:22 -0000 @@ -60,6 +60,7 @@ class SvxClipboardFmtItem; class TransferableDataHelper; class TransferableClipboardListener; class AbstractScLinkedAreaDlg; +class ScTabViewShell; struct CellShell_Impl { @@ -120,6 +121,7 @@ public: void ExecuteMove( SfxRequest& rReq ); void GetStateCursor( SfxItemSet& rSet ); + static void PasteFromClipboard( ScViewData* pViewData, ScTabViewShell* pTabViewShell, BOOL bShowDialog ); }; #endif Index: sc/source/ui/inc/viewdata.hxx =================================================================== RCS file: /cvs/sc/sc/source/ui/inc/viewdata.hxx,v retrieving revision 1.21 diff -u -p -r1.21 viewdata.hxx --- sc/source/ui/inc/viewdata.hxx 21 Nov 2007 19:10:07 -0000 1.21 +++ sc/source/ui/inc/viewdata.hxx 21 Feb 2008 01:29:22 -0000 @@ -208,6 +212,7 @@ private: BOOL bDelMarkValid; // nur gueltig bei SC_REFTYPE_FILL BYTE nFillMode; // Modus BOOL bPagebreak; // Seitenumbruch-Vorschaumodus + BOOL bPasteMode; BOOL bSelCtrlMouseClick; // special selection handling for ctrl-mouse-click @@ -286,6 +291,7 @@ public: SCCOL GetFixPosX() const { return pThisTab->nFixPosX; } SCROW GetFixPosY() const { return pThisTab->nFixPosY; } BOOL IsPagebreakMode() const { return bPagebreak; } + BOOL IsPasteMode() const { return bPasteMode; } void SetPosX( ScHSplitPos eWhich, SCCOL nNewPosX ); void SetPosY( ScVSplitPos eWhich, SCROW nNewPosY ); @@ -300,6 +306,7 @@ public: void SetFixPosX( SCCOL nPos ) { pThisTab->nFixPosX = nPos; } void SetFixPosY( SCROW nPos ) { pThisTab->nFixPosY = nPos; } void SetPagebreakMode( BOOL bSet ); + void SetPasteMode ( BOOL bSet ) { bPasteMode = bSet; } void SetZoomType( SvxZoomType eNew, BOOL bAll ); void SetZoom( const Fraction& rNewX, const Fraction& rNewY, BOOL bAll ); Index: sc/source/ui/view/cellsh1.cxx =================================================================== RCS file: /cvs/sc/sc/source/ui/view/cellsh1.cxx,v retrieving revision 1.48 diff -u -p -r1.48 cellsh1.cxx --- sc/source/ui/view/cellsh1.cxx 26 Nov 2007 15:20:42 -0000 1.48 +++ sc/source/ui/view/cellsh1.cxx 21 Feb 2008 01:29:30 -0000 @@ -1176,6 +1184,7 @@ void ScCellShell::ExecuteEdit( SfxReques WaitObject aWait( GetViewData()->GetDialogParent() ); pTabViewShell->CopyToClip( NULL, FALSE, FALSE, TRUE ); rReq.Done(); + GetViewData()->SetPasteMode( TRUE ); } break; @@ -1184,46 +1193,15 @@ void ScCellShell::ExecuteEdit( SfxReques WaitObject aWait( GetViewData()->GetDialogParent() ); pTabViewShell->CutToClip( NULL, TRUE ); rReq.Done(); + GetViewData()->SetPasteMode( TRUE ); } break; case SID_PASTE: { - Window* pWin = GetViewData()->GetActiveWin(); - ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin ); - ScDocument* pThisDoc = GetViewData()->GetDocument(); - ScDPObject* pDPObj = pThisDoc->GetDPAtCursor( GetViewData()->GetCurX(), - GetViewData()->GetCurY(), GetViewData()->GetTabNo() ); - if ( pOwnClip && pDPObj ) - { - // paste from Calc into DataPilot table: sort (similar to drag & drop) - - ScDocument* pClipDoc = pOwnClip->GetDocument(); - SCTAB nSourceTab = pOwnClip->GetVisibleTab(); - - SCCOL nClipStartX; - SCROW nClipStartY; - SCCOL nClipEndX; - SCROW nClipEndY; - pClipDoc->GetClipStart( nClipStartX, nClipStartY ); - pClipDoc->GetClipArea( nClipEndX, nClipEndY, TRUE ); - nClipEndX = nClipEndX + nClipStartX; - nClipEndY = nClipEndY + nClipStartY; // GetClipArea returns the difference - - ScRange aSource( nClipStartX, nClipStartY, nSourceTab, nClipEndX, nClipEndY, nSourceTab ); - BOOL bDone = pTabViewShell->DataPilotMove( aSource, GetViewData()->GetCurPos() ); - if ( !bDone ) - pTabViewShell->ErrorMessage( STR_ERR_DATAPILOT_INPUT ); - } - else - { - // normal paste - WaitObject aWait( GetViewData()->GetDialogParent() ); - pTabViewShell->PasteFromSystem(); - } + PasteFromClipboard ( GetViewData(), pTabViewShell, TRUE ); rReq.Done(); } - pTabViewShell->CellContentChanged(); // => PasteFromSystem() ??? break; case SID_CLIPBOARD_FORMAT_ITEMS: @@ -2270,3 +2248,46 @@ IMPL_LINK( ScCellShell, DialogClosed, Ab return 0; } +void ScCellShell::PasteFromClipboard( ScViewData* pViewData, ScTabViewShell* pTabViewShell, BOOL bShowDialog ) +{ + Window* pWin = pViewData->GetActiveWin(); + ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin ); + ScDocument* pThisDoc = pViewData->GetDocument(); + ScDPObject* pDPObj = pThisDoc->GetDPAtCursor( pViewData->GetCurX(), + pViewData->GetCurY(), pViewData->GetTabNo() ); + if ( pOwnClip && pDPObj ) + { + // paste from Calc into DataPilot table: sort (similar to drag & drop) + + ScDocument* pClipDoc = pOwnClip->GetDocument(); + SCTAB nSourceTab = pOwnClip->GetVisibleTab(); + + SCCOL nClipStartX; + SCROW nClipStartY; + SCCOL nClipEndX; + SCROW nClipEndY; + pClipDoc->GetClipStart( nClipStartX, nClipStartY ); + pClipDoc->GetClipArea( nClipEndX, nClipEndY, TRUE ); + nClipEndX = nClipEndX + nClipStartX; + nClipEndY = nClipEndY + nClipStartY; // GetClipArea returns the difference + + ScRange aSource( nClipStartX, nClipStartY, nSourceTab, nClipEndX, nClipEndY, nSourceTab ); + BOOL bDone = pTabViewShell->DataPilotMove( aSource, pViewData->GetCurPos() ); + if ( !bDone ) + pTabViewShell->ErrorMessage( STR_ERR_DATAPILOT_INPUT ); + } + else + { + // normal paste + WaitObject aWait( pViewData->GetDialogParent() ); + if (!pOwnClip) + pTabViewShell->PasteFromSystem(); + else { + pTabViewShell->PasteFromClip( IDF_ALL, pOwnClip->GetDocument(), + PASTE_NOFUNC, FALSE, FALSE, FALSE, INS_NONE, IDF_NONE, + bShowDialog ); // allow warning dialog + } + } + pTabViewShell->CellContentChanged(); // => PasteFromSystem() ??? +} + Index: sc/source/ui/view/viewdata.cxx =================================================================== RCS file: /cvs/sc/sc/source/ui/view/viewdata.cxx,v retrieving revision 1.61 diff -u -p -r1.61 viewdata.cxx --- sc/source/ui/view/viewdata.cxx 12 Dec 2007 13:22:01 -0000 1.61 +++ sc/source/ui/view/viewdata.cxx 21 Feb 2008 01:29:34 -0000 @@ -344,6 +327,7 @@ ScViewData::ScViewData( ScDocShell* pDoc bDelMarkValid( FALSE ), nFillMode ( SC_FILL_NONE ), bPagebreak ( FALSE ), + bPasteMode ( FALSE ), bSelCtrlMouseClick( FALSE ) { @@ -472,6 +456,7 @@ void ScViewData::InitFrom( const ScViewD aDefPageZoomX = pRef->aDefPageZoomX; aDefPageZoomY = pRef->aDefPageZoomY; bPagebreak = pRef->bPagebreak; + bPasteMode = pRef->bPasteMode; aLogicMode = pRef->aLogicMode; SetGridMode ( pRef->IsGridMode() ); Index: sc/source/ui/view/gridwin.cxx =================================================================== RCS file: /cvs/sc/sc/source/ui/view/gridwin.cxx,v retrieving revision 1.88 diff -u -p -r1.88 gridwin.cxx --- sc/source/ui/view/gridwin.cxx 12 Dec 2007 13:21:19 -0000 1.88 +++ sc/source/ui/view/gridwin.cxx 21 Feb 2008 12:49:09 -0000 @@ -142,6 +146,7 @@ #include "userdat.hxx" #include "drwlayer.hxx" #include "attrib.hxx" +#include "cellsh.hxx" // #114409# #ifndef _SV_SALBTYPE_HXX @@ -2941,12 +2986,26 @@ void ScGridWindow::SelectForContextMenu( } } +static void ClearSingleSelection( ScViewData* pViewData ) +{ + SCCOL nX; + SCROW nY; + ScDocument* pClipDoc = ScTransferObj::GetOwnClipboard( + pViewData->GetActiveWin() )->GetDocument(); + pClipDoc->GetClipArea( nX, nY, TRUE ); + if (nX == 0 && nY == 0) + { + ScTabView* pView = pViewData->GetView(); + pView->Unmark(); + } +} + void __EXPORT ScGridWindow::KeyInput(const KeyEvent& rKEvt) { // #96965# Cursor control for ref input dialog + const KeyCode& rKeyCode = rKEvt.GetKeyCode(); if( SC_MOD()->IsRefDialogOpen() ) { - const KeyCode& rKeyCode = rKEvt.GetKeyCode(); if( !rKeyCode.GetModifier() && (rKeyCode.GetCode() == KEY_F2) ) { SC_MOD()->EndReference(); @@ -2961,9 +3020,40 @@ void __EXPORT ScGridWindow::KeyInput(con return; } } + else if( rKeyCode.GetCode() == KEY_RETURN && pViewData->IsPasteMode() ) + { + ScTabViewShell* pTabViewShell = pViewData->GetViewShell(); + + ScCellShell::PasteFromClipboard( pViewData, pTabViewShell, FALSE ); + ClearSingleSelection( pViewData ); + + uno::Reference xSystemClipboard = + TransferableHelper::GetSystemClipboard(); + if (xSystemClipboard.is()) + { + xSystemClipboard->setContents( + uno::Reference(), + uno::Reference()); + } + + pViewData->SetPasteMode( FALSE ); + return; + } // wenn semi-Modeless-SfxChildWindow-Dialog oben, keine KeyInputs: else if( !pViewData->IsAnyFillMode() ) { + USHORT nGroup = rKeyCode.GetGroup(); + if (!rKeyCode.GetModifier() && + (nGroup == KEYGROUP_NUM || nGroup == KEYGROUP_ALPHA)) + pViewData->SetPasteMode( FALSE ); + else if( rKeyCode.GetCode() == KEY_TAB ) + { + ScMarkData& rMark = pViewData->GetMarkData(); + if( rMark.IsMarked() || rMark.IsMultiMarked() ) + { + ClearSingleSelection( pViewData ); + } + } // query for existing note marker before calling ViewShell's keyboard handling // which may remove the marker BOOL bHadKeyMarker = ( pNoteMarker && pNoteMarker->IsByKeyboard() );