ooo-build r11518 - in trunk: . patches/src680



Author: jonp
Date: Thu Feb  7 06:27:09 2008
New Revision: 11518
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11518&view=rev

Log:
	* patches/src680/sc-paste-on-enter.diff: If a cell is copied, paste the
	  contents of that cell and clear the clipboard if ENTER is pressed.
	* patches/src680/apply: Add sc-paste-on-enter.diff.


Added:
   trunk/patches/src680/sc-paste-on-enter.diff
Modified:
   trunk/ChangeLog
   trunk/patches/src680/apply

Modified: trunk/patches/src680/apply
==============================================================================
--- trunk/patches/src680/apply	(original)
+++ trunk/patches/src680/apply	Thu Feb  7 06:27:09 2008
@@ -659,6 +659,9 @@
 # Add R1C1 address support [ i#49499 for address ]
 sc-r1c1.diff, i#20857, jody
 
+# Paste clipboard when ENTER is pressed, then clear clipboard.
+sc-paste-on-enter.diff, n#358545, jonp
+
 [ CalcFixes < ooh680-m4 ]
 # Add named range support for INDIRECT and INDIRECT_XL
 sc-indirect-named-range.diff, i#4695, n#274387, kohei

Added: trunk/patches/src680/sc-paste-on-enter.diff
==============================================================================
--- (empty file)
+++ trunk/patches/src680/sc-paste-on-enter.diff	Thu Feb  7 06:27:09 2008
@@ -0,0 +1,235 @@
+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	7 Feb 2008 05:20:59 -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 );
+ };
+ 
+ #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	7 Feb 2008 05:20:59 -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	7 Feb 2008 05:21:00 -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 );
+ 				rReq.Done();
+ 			}
+-			pTabViewShell->CellContentChanged();		// => PasteFromSystem() ???
+ 			break;
+ 
+ 		case SID_CLIPBOARD_FORMAT_ITEMS:
+@@ -2270,3 +2248,40 @@ IMPL_LINK( ScCellShell, DialogClosed, Ab
+     return 0;
+ }
+ 
++void ScCellShell::PasteFromClipboard( ScViewData* pViewData, ScTabViewShell* pTabViewShell )
++{
++    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() );
++        pTabViewShell->PasteFromSystem();
++    }
++    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	7 Feb 2008 05:21:00 -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	7 Feb 2008 05:21:01 -0000
+@@ -142,6 +147,7 @@
+ #include "userdat.hxx"
+ #include "drwlayer.hxx"
+ #include "attrib.hxx"
++#include "cellsh.hxx"
+ 
+ // #114409#
+ #ifndef _SV_SALBTYPE_HXX
+@@ -2944,9 +2989,9 @@ void ScGridWindow::SelectForContextMenu(
+ 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,6 +3007,26 @@ void __EXPORT ScGridWindow::KeyInput(con
+             return;
+         }
+     }
++	else if( rKeyCode.GetCode() == KEY_RETURN && pViewData->IsPasteMode() )
++	{
++		ScTabViewShell* pTabViewShell = pViewData->GetViewShell();
++
++		ScCellShell::PasteFromClipboard( pViewData, pTabViewShell );
++
++		// Copy an empty cell to the clipboard.
++		ScDocument* pDoc = new ScDocument ();
++		BOOL b = pDoc->InsertTab( SC_TAB_APPEND, String::CreateFromAscii ( "Temp" ) );
++		ScDocument* pClipDoc = new ScDocument( SCDOCMODE_CLIP );
++		pDoc->CopyToClip( 1, 1, 1, 1, FALSE, pClipDoc, FALSE );
++		TransferableObjectDescriptor aObjDesc;
++		pViewData->GetDocShell()->FillTransferableObjectDescriptor( aObjDesc );
++		ScTransferObj* pTransferObj = new ScTransferObj( pClipDoc, aObjDesc );
++		pTransferObj->CopyToClipboard( pViewData->GetActiveWin() );
++		SC_MOD()->SetClipObject( pTransferObj, NULL );
++		delete pDoc;
++
++		pViewData->SetPasteMode( FALSE );
++	}
+ 	// wenn semi-Modeless-SfxChildWindow-Dialog oben, keine KeyInputs:
+     else if( !pViewData->IsAnyFillMode() )
+ 	{



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]