summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/scmod.hxx35
-rw-r--r--sc/source/ui/app/drwtrans.cxx19
-rw-r--r--sc/source/ui/app/scmod.cxx33
-rw-r--r--sc/source/ui/app/transobj.cxx33
-rw-r--r--sc/source/ui/inc/drwtrans.hxx5
-rw-r--r--sc/source/ui/inc/gridwin.hxx25
-rw-r--r--sc/source/ui/inc/transobj.hxx14
-rw-r--r--sc/source/ui/view/drawvie4.cxx85
-rw-r--r--sc/source/ui/view/gridwin.cxx429
-rw-r--r--sc/source/ui/view/select.cxx40
-rw-r--r--sc/source/ui/view/tabcont.cxx6
-rw-r--r--sc/source/ui/view/viewfun5.cxx16
-rw-r--r--sc/source/ui/view/viewfun7.cxx8
13 files changed, 617 insertions, 131 deletions
diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx
index 21c7b87cf..f837e9ec2 100644
--- a/sc/inc/scmod.hxx
+++ b/sc/inc/scmod.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: scmod.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: nn $ $Date: 2001-02-14 19:11:26 $
+ * last change: $Author: nn $ $Date: 2001-03-23 19:20:40 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -126,19 +126,23 @@ class ScDrawTransferObj;
struct ScDragData
{
- ScDocument* pDoc;
- ScMarkData aMarkData;
- USHORT nStartX, nStartY, nTabNo, nSizeX, nSizeY;
- USHORT nHandleX, nHandleY;
- USHORT nFlags;
- SdrModel* pSdrModel;
- SdrView* pSdrView;
- String aLinkDoc;
- String aLinkTable;
- String aLinkArea;
- ScDocument* pJumpLocalDoc;
- String aJumpTarget;
- String aJumpText;
+// ScDocument* pDoc;
+// ScMarkData aMarkData;
+// USHORT nStartX, nStartY, nTabNo, nSizeX, nSizeY;
+// USHORT nHandleX, nHandleY;
+// USHORT nFlags;
+// SdrModel* pSdrModel;
+// SdrView* pSdrView;
+
+ ScTransferObj* pCellTransfer;
+ ScDrawTransferObj* pDrawTransfer;
+
+ String aLinkDoc;
+ String aLinkTable;
+ String aLinkArea;
+ ScDocument* pJumpLocalDoc;
+ String aJumpTarget;
+ String aJumpText;
};
struct ScClipData
@@ -200,6 +204,7 @@ public:
// Drag & Drop:
const ScDragData& GetDragData() const { return aDragData; }
+ void SetDragObject( ScTransferObj* pCellObj, ScDrawTransferObj* pDrawObj );
void ResetDragObject();
void SetDragObject( const ScMarkData& rMarkData, const ScRange& rRange,
USHORT nHandleX, USHORT nHandleY,
diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx
index 5df1a2bab..5613b7c7e 100644
--- a/sc/source/ui/app/drwtrans.cxx
+++ b/sc/source/ui/app/drwtrans.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: drwtrans.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: nn $ $Date: 2001-02-14 19:14:35 $
+ * last change: $Author: nn $ $Date: 2001-03-23 19:21:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -85,6 +85,7 @@
#include <svtools/itempool.hxx>
#include <svtools/urlbmk.hxx>
#include <tools/urlobj.hxx>
+#include <vos/mutex.hxx>
#include "drwtrans.hxx"
#include "docsh.hxx"
@@ -220,6 +221,8 @@ ScDrawTransferObj::ScDrawTransferObj( SdrModel* pClipModel, ScDocShell* pContain
ScDrawTransferObj::~ScDrawTransferObj()
{
+ Application::GetSolarMutex().acquire(); //! ???
+
ScModule* pScMod = SC_MOD();
if ( pScMod->GetClipData().pDrawClipboard == this )
{
@@ -229,6 +232,8 @@ ScDrawTransferObj::~ScDrawTransferObj()
delete pModel;
delete pBookmark;
+
+ Application::GetSolarMutex().release(); //! ???
}
// static
@@ -421,6 +426,16 @@ void ScDrawTransferObj::ObjectReleased()
TransferableHelper::ObjectReleased();
}
+void ScDrawTransferObj::DragFinished( sal_Int8 nDropAction )
+{
+ //! test for internal move
+
+ if ( nDropAction == DND_ACTION_MOVE )
+ {
+ //! delete selected objects in source document
+ }
+}
+
SvInPlaceObjectRef ScDrawTransferObj::GetSingleObject()
{
// if single OLE object was copied, get its object
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index d09590f03..5ce8efccb 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: scmod.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: nn $ $Date: 2001-02-14 19:12:19 $
+ * last change: $Author: nn $ $Date: 2001-03-23 19:21:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -637,6 +637,9 @@ void ScModule::GetState( SfxItemSet& rSet )
void ScModule::SetDragObject( const ScMarkData& rMarkData,const ScRange& rRange,
USHORT nHandleX, USHORT nHandleY, ScDocument* pDoc, USHORT nFlags )
{
+ DBG_ERROR("SetDragObject is obsolete");
+
+#ifdef OLD_DND
aDragData.aMarkData = rMarkData;
USHORT nStartX = rRange.aStart.Col();
USHORT nStartY = rRange.aStart.Row();
@@ -659,27 +662,47 @@ void ScModule::SetDragObject( const ScMarkData& rMarkData,const ScRange& rRange,
aDragData.pJumpLocalDoc = NULL;
aDragData.aJumpTarget.Erase();
aDragData.aJumpText.Erase();
+#endif
}
void ScModule::ResetDragObject()
{
- SetDragObject(ScMarkData(),ScRange(),0,0,0,0 );
+ aDragData.pCellTransfer = NULL;
+ aDragData.pDrawTransfer = NULL;
+
+ aDragData.aLinkDoc.Erase();
+ aDragData.aLinkTable.Erase();
+ aDragData.aLinkArea.Erase();
+ aDragData.pJumpLocalDoc = NULL;
+ aDragData.aJumpTarget.Erase();
+ aDragData.aJumpText.Erase();
bDragWasIntern = FALSE;
}
+void ScModule::SetDragObject( ScTransferObj* pCellObj, ScDrawTransferObj* pDrawObj )
+{
+ ResetDragObject();
+ aDragData.pCellTransfer = pCellObj;
+ aDragData.pDrawTransfer = pDrawObj;
+}
+
void ScModule::SetDragObject( SdrModel* pModel, SdrView* pView, USHORT nFlags )
{
+ DBG_ERROR("SetDragObject is obsolete");
+
+#ifdef OLD_DND
SetDragObject(ScMarkData(),ScRange(),0,0,0,0 );
aDragData.pSdrModel = pModel;
aDragData.pSdrView = pView;
aDragData.nFlags = nFlags;
+#endif
}
void ScModule::SetDragLink( const String& rDoc, const String& rTab, const String& rArea )
{
- SetDragObject(ScMarkData(),ScRange(),0,0,0,0 );
+ ResetDragObject();
aDragData.aLinkDoc = rDoc;
aDragData.aLinkTable = rTab;
@@ -688,7 +711,7 @@ void ScModule::SetDragLink( const String& rDoc, const String& rTab, const String
void ScModule::SetDragJump( ScDocument* pLocalDoc, const String& rTarget, const String& rText )
{
- SetDragObject( ScMarkData(),ScRange(),0,0,0,0 );
+ ResetDragObject();
aDragData.pJumpLocalDoc = pLocalDoc;
aDragData.aJumpTarget = rTarget;
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index 8789daa13..61d57f7c2 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: transobj.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: nn $ $Date: 2001-02-14 19:14:35 $
+ * last change: $Author: nn $ $Date: 2001-03-23 19:21:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -147,7 +147,9 @@ void ScTransferObj::PaintToDev( OutputDevice* pDev, ScDocument* pDoc, double nPr
ScTransferObj::ScTransferObj( ScDocument* pClipDoc, const TransferableObjectDescriptor& rDesc ) :
aObjDesc( rDesc ),
- pDoc( pClipDoc )
+ pDoc( pClipDoc ),
+ nDragHandleX( 0 ),
+ nDragHandleY( 0 )
{
DBG_ASSERT(pDoc->IsClipboard(), "wrong document");
@@ -200,6 +202,11 @@ ScTransferObj::~ScTransferObj()
DBG_ERROR("ScTransferObj wasn't released");
pScMod->SetClipObject( NULL, NULL );
}
+ if ( pScMod->GetDragData().pCellTransfer == this )
+ {
+ DBG_ERROR("ScTransferObj wasn't released");
+ pScMod->ResetDragObject();
+ }
delete pDoc; // ScTransferObj is owner of clipboard document
}
@@ -422,6 +429,26 @@ void ScTransferObj::ObjectReleased()
TransferableHelper::ObjectReleased();
}
+void ScTransferObj::DragFinished( sal_Int8 nDropAction )
+{
+ if ( nDropAction == DND_ACTION_MOVE )
+ {
+ //! ...
+ }
+
+ ScModule* pScMod = SC_MOD();
+ if ( pScMod->GetDragData().pCellTransfer == this )
+ pScMod->ResetDragObject();
+
+ TransferableHelper::DragFinished( nDropAction );
+}
+
+void ScTransferObj::SetDragHandlePos( USHORT nX, USHORT nY )
+{
+ nDragHandleX = nX;
+ nDragHandleY = nY;
+}
+
//
// initialize aDocShellRef with a live document from the ClipDoc
//
diff --git a/sc/source/ui/inc/drwtrans.hxx b/sc/source/ui/inc/drwtrans.hxx
index 13837e87e..3a1d27785 100644
--- a/sc/source/ui/inc/drwtrans.hxx
+++ b/sc/source/ui/inc/drwtrans.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: drwtrans.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: nn $ $Date: 2001-02-14 19:15:49 $
+ * last change: $Author: nn $ $Date: 2001-03-23 19:26:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -106,6 +106,7 @@ public:
virtual sal_Bool WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
virtual void ObjectReleased();
+ virtual void DragFinished( sal_Int8 nDropAction );
SdrModel* GetModel() { return pModel; }
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 7ac077914..87c2c92aa 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: gridwin.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: nn $ $Date: 2001-03-20 16:50:16 $
+ * last change: $Author: nn $ $Date: 2001-03-23 19:26:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -66,6 +66,10 @@
#include <tools/string.hxx>
#endif
+#ifndef _TRANSFER_HXX
+#include <svtools/transfer.hxx>
+#endif
+
// nur auf dem MAC Auto-Filter per Popup
#ifdef MAC
#define AUTOFILTER_POPUP
@@ -73,9 +77,17 @@
#undef AUTOFILTER_POPUP
#endif
+#ifndef SC_VIEWUTIL_HXX
#include "viewutil.hxx"
+#endif
+
+#ifndef SC_VIEWDATA_HXX
#include "viewdata.hxx"
+#endif
+
+#ifndef SC_CBUTTON_HXX
#include "cbutton.hxx"
+#endif
// ---------------------------------------------------------------------------
@@ -129,7 +141,7 @@ public:
};
-class ScGridWindow : public Window
+class ScGridWindow : public Window, public DropTargetHelper, public DragSourceHelper
{
// ScFilterListBox wird immer fuer Auswahlliste benutzt
friend class ScFilterListBox;
@@ -244,6 +256,9 @@ private:
BOOL QueryDropPrivate( DropEvent& rEvt );
BOOL DropPrivate( const DropEvent& rEvt );
+ sal_Int8 AcceptPrivateDrop( const AcceptDropEvent& rEvt );
+ sal_Int8 ExecutePrivateDrop( const ExecuteDropEvent& rEvt );
+
BOOL DrawMouseButtonDown(const MouseEvent& rMEvt);
BOOL DrawMouseButtonUp(const MouseEvent& rMEvt);
BOOL DrawMouseMove(const MouseEvent& rMEvt);
@@ -298,6 +313,10 @@ protected:
virtual void RequestHelp( const HelpEvent& rEvt );
virtual void Command( const CommandEvent& rCEvt );
+ virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
+ virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
+ virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
+
public:
ScGridWindow( Window* pParent, ScViewData* pData, ScSplitPos eWhichPos );
~ScGridWindow();
diff --git a/sc/source/ui/inc/transobj.hxx b/sc/source/ui/inc/transobj.hxx
index cf0361c2c..b1a326113 100644
--- a/sc/source/ui/inc/transobj.hxx
+++ b/sc/source/ui/inc/transobj.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: transobj.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: nn $ $Date: 2001-02-14 19:15:49 $
+ * last change: $Author: nn $ $Date: 2001-03-23 19:26:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -83,6 +83,8 @@ private:
TransferableDataHelper aOleData;
TransferableObjectDescriptor aObjDesc;
SvEmbeddedObjectRef aDocShellRef;
+ USHORT nDragHandleX;
+ USHORT nDragHandleY;
void InitDocShell();
static void StripRefs( ScDocument* pDoc, USHORT nStartX, USHORT nStartY,
@@ -102,8 +104,14 @@ public:
virtual sal_Bool WriteObject( SotStorageStreamRef& rxOStm, void* pUserObject, sal_uInt32 nUserObjectId,
const ::com::sun::star::datatransfer::DataFlavor& rFlavor );
virtual void ObjectReleased();
+ virtual void DragFinished( sal_Int8 nDropAction );
- ScDocument* GetDocument() { return pDoc; }
+ ScDocument* GetDocument() { return pDoc; } // owned by ScTransferObj
+ const ScRange& GetRange() const { return aBlock; }
+ USHORT GetDragHandleX() const { return nDragHandleX; }
+ USHORT GetDragHandleY() const { return nDragHandleY; }
+
+ void SetDragHandlePos( USHORT nX, USHORT nY );
static ScTransferObj* GetOwnClipboard();
};
diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx
index 783f41681..dfc57c561 100644
--- a/sc/source/ui/view/drawvie4.cxx
+++ b/sc/source/ui/view/drawvie4.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: drawvie4.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: nn $ $Date: 2001-02-14 19:27:31 $
+ * last change: $Author: nn $ $Date: 2001-03-23 19:24:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -405,7 +405,7 @@
#include "viewdata.hxx"
#include "document.hxx"
#include "docsh.hxx"
-#include "dataobj.hxx"
+//#include "dataobj.hxx"
#include "drwtrans.hxx"
#include "drawutil.hxx"
#include "scmod.hxx"
@@ -494,7 +494,8 @@ BOOL ScDrawView::BeginDrag( Window* pWindow, const Point& rStartPos )
SdrView aEditView( GetModel() );
lcl_InitMarks( aEditView, *this, nTab );
- BegUndo( ScGlobal::GetRscString( STR_UNDO_DRAGDROP ) );
+ //BegUndo( ScGlobal::GetRscString( STR_UNDO_DRAGDROP ) );
+ //! in DragDone!
//---------------------------------------------------------
ScDocShellRef aDragShellRef;
@@ -506,48 +507,64 @@ BOOL ScDrawView::BeginDrag( Window* pWindow, const Point& rStartPos )
//---------------------------------------------------------
ScDrawLayer::SetGlobalDrawPersist(aDragShellRef);
- SdrModel* pDragModel = GetAllMarkedModel();
+ SdrModel* pModel = GetAllMarkedModel();
ScDrawLayer::SetGlobalDrawPersist(NULL);
- SvDataObjectRef pDragServer = new ScDataObject(pDragModel,
- pViewData->GetDocShell(), bOneOle);
- pScMod->SetDragObject(pDragModel, &aEditView, 0);
- DropAction eDropAction = pDragServer->ExecuteDrag(pWindow,
- POINTER_MOVEDATA, POINTER_COPYDATA, POINTER_LINKDATA,
- DRAG_ALL, &aRegion);
- BOOL bIntern = pScMod->GetDragIntern();
- pScMod->ResetDragObject();
- pDragServer.Clear(); // enthaelt Referenzen auf pDragShell
+ ScDocShell* pDocSh = pViewData->GetDocShell();
- //---------------------------------------------------------
+ TransferableObjectDescriptor aObjDesc;
+ pDocSh->FillTransferableObjectDescriptor( aObjDesc );
+ aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
+ // maSize is set in ScDrawTransferObj ctor
- switch (eDropAction)
- {
- case DROP_MOVE:
- case DROP_DISCARD:
- if (!bIntern)
- aEditView.DeleteMarked();
- break;
+ ScDrawTransferObj* pTransferObj = new ScDrawTransferObj( pModel, pDocSh, aObjDesc );
+ uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj );
- case DROP_NONE:
- case DROP_COPY:
- case DROP_LINK:
- case DROP_PRINT:
- break;
+ //pScMod->SetDragObject(pDragModel, &aEditView, 0);
+ //! keep pTransferObj pointer instead
- default:
- break;
- }
+ pTransferObj->StartDrag( pWindow, DND_ACTION_COPYMOVE | DND_ACTION_LINK );
+ }
+
+ return bReturn;
+}
- if (eDropAction != DROP_NONE)
- bReturn = TRUE;
+#if 0
- EndUndo();
+void ScDrawView::DragDone()
+{
+ BOOL bIntern = pScMod->GetDragIntern();
+ pScMod->ResetDragObject();
+ pDragServer.Clear(); // enthaelt Referenzen auf pDragShell
+
+ //---------------------------------------------------------
+
+ switch (eDropAction)
+ {
+ case DROP_MOVE:
+ case DROP_DISCARD:
+ if (!bIntern)
+ aEditView.DeleteMarked();
+ break;
+
+ case DROP_NONE:
+ case DROP_COPY:
+ case DROP_LINK:
+ case DROP_PRINT:
+ break;
+
+ default:
+ break;
}
- return bReturn;
+ if (eDropAction != DROP_NONE)
+ bReturn = TRUE;
+
+ EndUndo();
}
+#endif
+
void ScDrawView::DoCopy()
{
BOOL bAnyOle, bOneOle;
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index b08659a7f..10c2c5b51 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: gridwin.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: nn $ $Date: 2001-03-20 16:51:57 $
+ * last change: $Author: nn $ $Date: 2001-03-23 19:24:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -147,6 +147,7 @@
#endif
#include "dpobject.hxx"
#include "dpoutput.hxx"
+#include "transobj.hxx"
using namespace com::sun::star;
@@ -389,6 +390,8 @@ BOOL lcl_IsEditableMatrix( ScDocument* pDoc, const ScRange& rRange )
// WB_DIALOGCONTROL noetig fuer UNO-Controls
ScGridWindow::ScGridWindow( Window* pParent, ScViewData* pData, ScSplitPos eWhichPos ) :
Window( pParent, WB_CLIPCHILDREN | WB_DIALOGCONTROL ),
+ DropTargetHelper( this ),
+ DragSourceHelper( this ),
pViewData( pData ),
eWhich( eWhichPos ),
pNoteMarker( NULL ),
@@ -439,7 +442,7 @@ ScGridWindow::ScGridWindow( Window* pParent, ScViewData* pData, ScSplitPos eWhic
SetBackground();
SetMapMode(pViewData->GetLogicMode(eWhich));
- EnableDrop();
+// EnableDrop();
EnableChildTransparentMode();
SetDialogControlFlags( WINDOW_DLGCTRL_RETURN | WINDOW_DLGCTRL_WANTFOCUS );
@@ -2095,10 +2098,53 @@ void ScGridWindow::Tracking( const TrackingEvent& rTEvt )
MouseMove( rMEvt );
}
+void ScGridWindow::StartDrag( sal_Int8 nAction, const Point& rPosPixel )
+{
+ if ( pFilterBox || nPagebreakMouse )
+ return;
+
+ HideNoteMarker();
+
+ CommandEvent aDragEvent( rPosPixel, COMMAND_STARTDRAG, TRUE );
+
+ if (bEEMouse)
+ {
+ EditView* pEditView;
+ USHORT nEditCol;
+ USHORT nEditRow;
+ pViewData->GetEditView( eWhich, pEditView, nEditCol, nEditRow );
+
+ // #63263# don't remove the edit view while switching views
+ ScModule* pScMod = SC_MOD();
+ pScMod->SetInEditCommand( TRUE );
+
+ pEditView->Command( aDragEvent );
+
+ ScInputHandler* pHdl = pScMod->GetInputHdl();
+ if (pHdl)
+ pHdl->DataChanged();
+
+ pScMod->SetInEditCommand( FALSE );
+ if (!pViewData->IsActive()) // dropped to different view?
+ {
+ ScInputHandler* pHdl = pScMod->GetInputHdl( pViewData->GetViewShell() );
+ if ( pHdl && pViewData->HasEditView( eWhich ) )
+ {
+ pHdl->CancelHandler();
+ ShowCursor(); // missing from KillEditView
+ }
+ }
+ }
+ else
+ if ( !DrawCommand(aDragEvent) )
+ pViewData->GetView()->GetSelEngine()->Command( aDragEvent );
+}
+
void __EXPORT ScGridWindow::Command( const CommandEvent& rCEvt )
{
USHORT nCmd = rCEvt.GetCommand();
ScModule* pScMod = SC_MOD();
+ DBG_ASSERT( nCmd != COMMAND_STARTDRAG, "ScGridWindow::Command called with COMMAND_STARTDRAG" );
if ( nCmd == COMMAND_STARTEXTTEXTINPUT ||
nCmd == COMMAND_ENDEXTTEXTINPUT ||
@@ -2132,7 +2178,7 @@ void __EXPORT ScGridWindow::Command( const CommandEvent& rCEvt )
return;
}
- if ( rCEvt.GetCommand() == COMMAND_VOICE )
+ if ( nCmd == COMMAND_VOICE )
{
// Der Handler wird nur gerufen, wenn ein Text-Cursor aktiv ist,
// also muss es eine EditView oder ein editiertes Zeichenobjekt geben
@@ -2173,9 +2219,6 @@ void __EXPORT ScGridWindow::Command( const CommandEvent& rCEvt )
return;
}
- if ( nCmd == COMMAND_STARTDRAG && ( pFilterBox || nPagebreakMouse ) )
- return;
-
if ( nCmd == COMMAND_CONTEXTMENU && !SC_MOD()->GetIsWaterCan() )
{
if (pViewData->IsAnyFillMode())
@@ -2229,45 +2272,6 @@ void __EXPORT ScGridWindow::Command( const CommandEvent& rCEvt )
SfxDispatcher::ExecutePopup();
}
}
- else
- {
- // #53414# Notiz-/Redlining-Tiphilfe wegnehmen
- if ( nCmd == COMMAND_STARTDRAG )
- HideNoteMarker();
-
- if (bEEMouse)
- {
- EditView* pEditView;
- USHORT nEditCol;
- USHORT nEditRow;
- pViewData->GetEditView( eWhich, pEditView, nEditCol, nEditRow );
-
- // #63263# verhindern, dass die EditView beim View-Umschalten wegkommt
- pScMod->SetInEditCommand( TRUE );
-
- pEditView->Command( rCEvt );
- if ( nCmd == COMMAND_STARTDRAG )
- {
- ScInputHandler* pHdl = pScMod->GetInputHdl();
- if (pHdl)
- pHdl->DataChanged();
- }
-
- pScMod->SetInEditCommand( FALSE );
- if (!pViewData->IsActive()) // auf andere View gedroppt?
- {
- ScInputHandler* pHdl = pScMod->GetInputHdl( pViewData->GetViewShell() );
- if ( pHdl && pViewData->HasEditView( eWhich ) )
- {
- pHdl->CancelHandler();
- ShowCursor(); // fehlt bei KillEditView
- }
- }
- }
- else
- if ( !DrawCommand(rCEvt) )
- pViewData->GetView()->GetSelEngine()->Command( rCEvt );
- }
}
void __EXPORT ScGridWindow::KeyInput(const KeyEvent& rKEvt)
@@ -2339,6 +2343,7 @@ BOOL ScGridWindow::QueryDropPrivate( DropEvent& rEvt )
return TRUE;
}
+#ifdef OLD_DND
const ScDragData& rData = SC_MOD()->GetDragData();
if ( rData.nSizeX != 0 && rData.nSizeY != 0 )
{
@@ -2418,6 +2423,7 @@ BOOL ScGridWindow::QueryDropPrivate( DropEvent& rEvt )
#endif
}
}
+#endif
return TRUE;
}
@@ -2500,6 +2506,7 @@ BOOL lcl_TestScenarioRedliningDrop( ScDocument* pDoc, const ScRange& aDragRange)
}
+#ifdef OLD_DND
ScRange lcl_MakeDropRange(short nPosX, short nPosY,USHORT nTab, const ScDragData& rData)
{
// Liefert den Range fuer einen Drop zurueck
@@ -2519,6 +2526,7 @@ ScRange lcl_MakeDropRange(short nPosX, short nPosY,USHORT nTab, const ScDragData
return ScRange(nCol1, nRow1, nTab,
nCol2, nRow2, nTab);
}
+#endif
BOOL __EXPORT ScGridWindow::QueryDrop( DropEvent& rEvt )
{
@@ -2526,8 +2534,8 @@ BOOL __EXPORT ScGridWindow::QueryDrop( DropEvent& rEvt )
if (rEvt.IsLeaveWindow())
{
DrawMarkDropObj( NULL );
- if (rData.pDoc)
- return QueryDropPrivate( rEvt ); // internen Drop-Rahmen wegnehmen
+ if (rData.pCellTransfer)
+ return QueryDropPrivate( rEvt ); // hide drop marker for internal D&D
else
return TRUE;
}
@@ -2544,6 +2552,7 @@ BOOL __EXPORT ScGridWindow::QueryDrop( DropEvent& rEvt )
Point aPos = rEvt.GetPosPixel();
pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY );
+#ifdef OLD_DND
ScRange aDropRange = lcl_MakeDropRange(nPosX,nPosY,nTab,rData);
ScRange aSourceRange =lcl_MakeDropRange(rData.nStartX,rData.nStartY,nTab,rData);
@@ -2557,13 +2566,16 @@ BOOL __EXPORT ScGridWindow::QueryDrop( DropEvent& rEvt )
}
return FALSE;
}
+#endif
BOOL bReturn = FALSE;
- if (rData.pDoc)
+ if (rData.pCellTransfer)
{
+#ifdef OLD_DND
if ( rData.nSizeX<=MAXCOL && rData.nSizeY<=MAXROW && !rEvt.IsLeaveWindow() )
DropScroll( rEvt.GetPosPixel() );
+#endif
bReturn = QueryDropPrivate( rEvt );
}
else
@@ -2592,9 +2604,11 @@ BOOL __EXPORT ScGridWindow::QueryDrop( DropEvent& rEvt )
{
// wenn nicht im Dokument, dann Default = COPY
+#ifdef OLD_DND
if ( !IsMyModel(rData.pSdrView) ) // Drawing innerhalb des Doc?
if ( rEvt.IsDefaultAction() && rEvt.GetAction() == DROP_MOVE )
rEvt.SetAction( DROP_COPY );
+#endif
SvDataObjectRef pObject = SvDataObject::PasteDragServer(rEvt);
DropAction eAction = rEvt.GetAction();
@@ -2602,7 +2616,7 @@ BOOL __EXPORT ScGridWindow::QueryDrop( DropEvent& rEvt )
ScDocument* pThisDoc = pViewData->GetDocument();
SdrObject* pHitObj = pThisDoc->GetObjectAtPoint(
pViewData->GetTabNo(), PixelToLogic(rEvt.GetPosPixel()) );
- if ( pHitObj && eAction == DROP_LINK && !rData.pSdrModel )
+ if ( pHitObj && eAction == DROP_LINK && !rData.pDrawTransfer )
{
if ( pObject->HasFormat(SOT_FORMATSTR_ID_SVXB)
|| pObject->HasFormat(FORMAT_GDIMETAFILE)
@@ -2684,6 +2698,8 @@ BOOL ScGridWindow::DropPrivate( const DropEvent& rEvt )
const ScDragData& rData = pScMod->GetDragData();
BOOL bRet = TRUE;
+
+#ifdef OLD_DND
ScDocument* pSourceDoc = rData.pDoc;
ScDocument* pThisDoc = pViewData->GetDocument();
ScViewFunc* pView = pViewData->GetView();
@@ -2847,6 +2863,7 @@ BOOL ScGridWindow::DropPrivate( const DropEvent& rEvt )
}
}
}
+#endif
bDragRect = FALSE; // bei naechstem IsLeave-QueryDrop nicht zeichnen
return bRet;
@@ -2861,7 +2878,7 @@ BOOL __EXPORT ScGridWindow::Drop( const DropEvent& rEvt )
ScModule* pScMod = SC_MOD();
const ScDragData& rData = pScMod->GetDragData();
- if (rData.pDoc)
+ if (rData.pCellTransfer)
return DropPrivate( rEvt );
if ( rData.aLinkDoc.Len() )
@@ -2905,6 +2922,7 @@ BOOL __EXPORT ScGridWindow::Drop( const DropEvent& rEvt )
Point aLogicPos = PixelToLogic(rEvt.GetPosPixel());
+#ifdef OLD_DND
if (rData.pSdrModel)
{
bPasteIsMove = (rEvt.GetAction() == DROP_MOVE && !(rData.nFlags & SC_DROP_NAVIGATOR));
@@ -2913,6 +2931,7 @@ BOOL __EXPORT ScGridWindow::Drop( const DropEvent& rEvt )
bPasteIsMove = FALSE;
return TRUE;
}
+#endif
Point aPos = rEvt.GetPosPixel();
short nPosX;
@@ -2960,6 +2979,314 @@ BOOL __EXPORT ScGridWindow::Drop( const DropEvent& rEvt )
//--------------------------------------------------------
+sal_Int8 ScGridWindow::AcceptPrivateDrop( const AcceptDropEvent& rEvt )
+{
+ if ( rEvt.mbLeaving )
+ {
+ if (bDragRect)
+ pViewData->GetView()->DrawDragRect( nDragStartX, nDragStartY, nDragEndX, nDragEndY, eWhich );
+ bDragRect = FALSE;
+ return rEvt.mnAction;
+ }
+
+ const ScDragData& rData = SC_MOD()->GetDragData();
+ if ( rData.pCellTransfer )
+ {
+ Point aPos = rEvt.maPosPixel;
+
+ ScDocument* pSourceDoc = NULL; //! rData.pDoc;
+ ScDocument* pThisDoc = pViewData->GetDocument();
+ if (pSourceDoc == pThisDoc)
+ {
+ if ( pThisDoc->HasChartAtPoint(pViewData->GetTabNo(), PixelToLogic(aPos)) )
+ {
+ if (bDragRect) // Rechteck loeschen
+ {
+ pViewData->GetView()->DrawDragRect( nDragStartX, nDragStartY, nDragEndX, nDragEndY, eWhich );
+ bDragRect = FALSE;
+ }
+
+ //! highlight chart? (selection border?)
+
+ sal_Int8 nRet = rEvt.mnAction;
+//! if ( rEvt.GetAction() == DROP_LINK )
+//! bOk = rEvt.SetAction( DROP_COPY ); // can't link onto chart
+ return nRet;
+ }
+ }
+//! else
+//! if ( rEvt.GetAction() == DROP_MOVE )
+//! rEvt.SetAction( DROP_COPY ); // different doc: default=COPY
+
+
+//! if ( rData.nFlags & SC_DROP_TABLE ) // whole sheet?
+//! {
+//! BOOL bOk = pThisDoc->IsDocEditable();
+//! return bOk ? rEvt.mnAction : 0; // don't draw selection frame
+//! }
+
+ short nPosX;
+ short nPosY;
+ pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY );
+
+ ScRange aSourceRange = rData.pCellTransfer->GetRange();
+ USHORT nSizeX = aSourceRange.aEnd.Col() - aSourceRange.aStart.Col() + 1;
+ USHORT nSizeY = aSourceRange.aEnd.Row() - aSourceRange.aStart.Row() + 1;
+
+ short nNewDragX = nPosX - rData.pCellTransfer->GetDragHandleX();
+ if (nNewDragX<0) nNewDragX=0;
+ if (nNewDragX+(nSizeX-1) > MAXCOL)
+ nNewDragX = MAXCOL-(nSizeX-1);
+ short nNewDragY = nPosY - rData.pCellTransfer->GetDragHandleY();
+ if (nNewDragY<0) nNewDragY=0;
+ if (nNewDragY+(nSizeY-1) > MAXROW)
+ nNewDragY = MAXROW-(nSizeY-1);
+
+ if ( nNewDragX != (short) nDragStartX || nNewDragY != (short) nDragStartY || !bDragRect )
+ {
+ if (bDragRect)
+ pViewData->GetView()->DrawDragRect( nDragStartX, nDragStartY, nDragEndX, nDragEndY, eWhich );
+
+ nDragStartX = nNewDragX;
+ nDragStartY = nNewDragY;
+ nDragEndX = nDragStartX+nSizeX-1;
+ nDragEndY = nDragStartY+nSizeY-1;
+ bDragRect = TRUE;
+
+ pViewData->GetView()->DrawDragRect( nDragStartX, nDragStartY, nDragEndX, nDragEndY, eWhich );
+
+ // Zielposition als Tip-Hilfe anzeigen
+#if 0
+ if (Help::IsQuickHelpEnabled())
+ {
+ USHORT nTab = pViewData->GetTabNo();
+ ScRange aRange( nDragStartX, nDragStartY, nTab, nDragEndX, nDragEndY, nTab );
+ String aHelpStr;
+ aRange.Format( aHelpStr, SCA_VALID ); // nicht-3D
+
+ Point aPos = Pointer::GetPosPixel();
+ USHORT nAlign = QUICKHELP_BOTTOM|QUICKHELP_RIGHT;
+ Rectangle aRect( aPos, aPos );
+ Help::ShowQuickHelp(aRect, aHelpStr, nAlign);
+ }
+#endif
+ }
+ }
+
+ return rEvt.mnAction;
+}
+
+sal_Int8 ScGridWindow::AcceptDrop( const AcceptDropEvent& rEvt )
+{
+ const ScDragData& rData = SC_MOD()->GetDragData();
+ if ( rEvt.mbLeaving )
+ {
+ DrawMarkDropObj( NULL );
+ if ( rData.pCellTransfer )
+ return AcceptPrivateDrop( rEvt ); // hide drop marker for internal D&D
+ else
+ return rEvt.mnAction;
+ }
+
+ if ( pViewData->GetDocShell()->IsReadOnly() )
+ return DND_ACTION_NONE;
+
+ sal_Int8 nRet = DND_ACTION_NONE;
+
+ if (rData.pCellTransfer)
+ {
+#ifdef OLD_DND
+ if ( rData.nSizeX<=MAXCOL && rData.nSizeY<=MAXROW && !rEvt.IsLeaveWindow() )
+ DropScroll( rEvt.GetPosPixel() );
+#endif
+ nRet = AcceptPrivateDrop( rEvt );
+ }
+ else
+ {
+ switch ( rEvt.mnAction )
+ {
+ case DND_ACTION_COPY:
+ case DND_ACTION_MOVE:
+ case DND_ACTION_COPYMOVE:
+ {
+ BOOL bMove = ( rEvt.mnAction == DND_ACTION_MOVE );
+ if ( IsDropFormatSupported( SOT_FORMATSTR_ID_EMBED_SOURCE ) ||
+ IsDropFormatSupported( SOT_FORMATSTR_ID_LINK_SOURCE ) ||
+ IsDropFormatSupported( SOT_FORMATSTR_ID_EMBED_SOURCE_OLE ) ||
+ IsDropFormatSupported( SOT_FORMATSTR_ID_LINK_SOURCE_OLE ) ||
+ IsDropFormatSupported( SOT_FORMAT_STRING ) ||
+ IsDropFormatSupported( SOT_FORMATSTR_ID_SYLK ) ||
+ IsDropFormatSupported( SOT_FORMATSTR_ID_LINK ) ||
+ IsDropFormatSupported( SOT_FORMATSTR_ID_HTML ) ||
+ IsDropFormatSupported( SOT_FORMATSTR_ID_HTML_SIMPLE ) ||
+ IsDropFormatSupported( SOT_FORMATSTR_ID_DIF ) ||
+ IsDropFormatSupported( SOT_FORMATSTR_ID_DRAWING ) ||
+ IsDropFormatSupported( SOT_FORMATSTR_ID_SVXB ) ||
+ IsDropFormatSupported( SOT_FORMAT_RTF ) ||
+ IsDropFormatSupported( SOT_FORMAT_GDIMETAFILE ) ||
+ IsDropFormatSupported( SOT_FORMAT_BITMAP ) ||
+ IsDropFormatSupported( SOT_FORMATSTR_ID_SBA_DATAEXCHANGE ) ||
+ ( !bMove && IsDropFormatSupported( SOT_FORMAT_FILE ) ) )
+ {
+ nRet = rEvt.mnAction;
+ }
+ }
+ //! allow SOT_FORMAT_FILE and INetBookmark formats if not moving
+ break;
+ }
+ }
+
+ return nRet;
+}
+
+ULONG lcl_GetDropFormatId( const uno::Reference<datatransfer::XTransferable>& xTransfer )
+{
+ ULONG nFormatId = 0;
+ TransferableDataHelper aDataHelper( xTransfer );
+
+ //! if INetBookmark but not SOT_FORMATSTR_ID_SBA_DATAEXCHANGE, use INetBookmark
+
+ if ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_DRAWING ) )
+ nFormatId = SOT_FORMATSTR_ID_DRAWING;
+ else if ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_SVXB ) )
+ nFormatId = SOT_FORMATSTR_ID_SVXB;
+ else if ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_EMBED_SOURCE ) )
+ {
+ //! if this is a Writer object, use RTF
+ nFormatId = SOT_FORMATSTR_ID_EMBED_SOURCE;
+ }
+ else if ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_LINK_SOURCE ) )
+ nFormatId = SOT_FORMATSTR_ID_LINK_SOURCE;
+ else if ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_SBA_DATAEXCHANGE ) )
+ nFormatId = SOT_FORMATSTR_ID_SBA_DATAEXCHANGE;
+ else if ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE ) )
+ nFormatId = SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE;
+ else if ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_BIFF_5 ) )
+ nFormatId = SOT_FORMATSTR_ID_BIFF_5;
+ else if ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_EMBED_SOURCE_OLE ) )
+ nFormatId = SOT_FORMATSTR_ID_EMBED_SOURCE_OLE;
+ else if ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_LINK_SOURCE_OLE ) )
+ nFormatId = SOT_FORMATSTR_ID_LINK_SOURCE_OLE;
+ else if ( aDataHelper.HasFormat( SOT_FORMAT_RTF ) )
+ nFormatId = SOT_FORMAT_RTF;
+ else if ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_HTML ) )
+ nFormatId = SOT_FORMATSTR_ID_HTML;
+ else if ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_HTML_SIMPLE ) )
+ nFormatId = SOT_FORMATSTR_ID_HTML_SIMPLE;
+ else if ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_SYLK ) )
+ nFormatId = SOT_FORMATSTR_ID_SYLK;
+ else if ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_LINK ) )
+ nFormatId = SOT_FORMATSTR_ID_LINK;
+ else if ( aDataHelper.HasFormat( SOT_FORMAT_STRING ) )
+ nFormatId = SOT_FORMAT_STRING;
+ else if ( aDataHelper.HasFormat( SOT_FORMAT_GDIMETAFILE ) )
+ nFormatId = SOT_FORMAT_GDIMETAFILE;
+ else if ( aDataHelper.HasFormat( SOT_FORMAT_BITMAP ) )
+ nFormatId = SOT_FORMAT_BITMAP;
+ else if ( aDataHelper.HasFormat( SOT_FORMAT_FILE ) )
+ nFormatId = SOT_FORMAT_FILE;
+
+ return nFormatId;
+}
+
+sal_Int8 ScGridWindow::ExecutePrivateDrop( const ExecuteDropEvent& rEvt )
+{
+ // hide drop marker
+ if (bDragRect)
+ pViewData->GetView()->DrawDragRect( nDragStartX, nDragStartY, nDragEndX, nDragEndY, eWhich );
+ bDragRect = FALSE;
+
+ ScModule* pScMod = SC_MOD();
+ const ScDragData& rData = pScMod->GetDragData();
+ ScTransferObj* pTransObj = rData.pCellTransfer;
+ if ( !pTransObj )
+ return 0;
+
+//! ScDocument* pSourceDoc = ...
+ ScDocument* pSourceDoc = pViewData->GetDocument(); //! Test !!!
+ ScDocument* pThisDoc = pViewData->GetDocument();
+ ScViewFunc* pView = pViewData->GetView();
+ USHORT nFlags = 0; //! rData.nFlags
+
+ BOOL bIsMove = ( rEvt.mnAction == DND_ACTION_MOVE );
+ BOOL bIsLink = ( rEvt.mnAction == DND_ACTION_LINK );
+
+ ScRange aSource = pTransObj->GetRange();
+ BOOL bDone = FALSE;
+
+ if (pSourceDoc == pThisDoc)
+ {
+ if ( nFlags & SC_DROP_TABLE ) // whole sheet?
+ {
+ if ( pThisDoc->IsDocEditable() )
+ {
+ USHORT nSrcTab = aSource.aStart.Tab();
+ USHORT nDestTab = pViewData->GetTabNo();
+ pViewData->GetDocShell()->MoveTable( nSrcTab, nDestTab, !bIsMove, TRUE ); // with Undo
+ pView->SetTabNo( nDestTab, TRUE );
+ bDone = TRUE;
+ }
+ }
+ else // move/copy block
+ {
+ Point aPos = rEvt.maPosPixel;
+ String aChartName;
+ if (pThisDoc->HasChartAtPoint( pViewData->GetTabNo(), PixelToLogic(aPos), &aChartName ))
+ {
+ String aRangeName;
+ aSource.Format( aRangeName, SCR_ABS_3D, pThisDoc );
+ SfxStringItem aNameItem( SID_CHART_NAME, aChartName );
+ SfxStringItem aRangeItem( SID_CHART_SOURCE, aRangeName );
+ USHORT nId = bIsMove ? SID_CHART_SOURCE : SID_CHART_ADDSOURCE;
+ pViewData->GetDispatcher().Execute( nId, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+ &aRangeItem, &aNameItem, (void*) NULL );
+ }
+ else if ( nDragStartX != aSource.aStart.Col() || nDragStartY != aSource.aStart.Row() ||
+ aSource.aStart.Tab() != pViewData->GetTabNo() )
+ {
+ ScAddress aDest( nDragStartX, nDragStartY, pViewData->GetTabNo() );
+ if ( bIsLink )
+ pView->LinkBlock( aSource, aDest );
+ else
+ pView->MoveBlockTo( aSource, aDest, bIsMove );
+ }
+
+ pScMod->SetDragIntern(); // don't delete source in ExecuteDrag
+ bDone = TRUE;
+ }
+ }
+
+ sal_Int8 nRet = bDone ? rEvt.mnAction : DND_ACTION_NONE;
+ return nRet;
+}
+
+sal_Int8 ScGridWindow::ExecuteDrop( const ExecuteDropEvent& rEvt )
+{
+ DrawMarkDropObj( NULL ); // drawing layer
+
+ ScModule* pScMod = SC_MOD();
+ const ScDragData& rData = pScMod->GetDragData();
+ if (rData.pCellTransfer)
+ return ExecutePrivateDrop( rEvt );
+
+ Point aPos = rEvt.maPosPixel;
+ short nPosX;
+ short nPosY;
+ pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY );
+ Point aLogicPos = PixelToLogic( aPos );
+
+ BOOL bDone = FALSE;
+ ULONG nFormatId = lcl_GetDropFormatId( rEvt.maDropEvent.Transferable );
+ if ( nFormatId )
+ bDone = pViewData->GetView()->PasteDataFormat(
+ nFormatId, rEvt.maDropEvent.Transferable, nPosX, nPosY, &aLogicPos );
+
+ sal_Int8 nRet = bDone ? rEvt.mnAction : DND_ACTION_NONE;
+ return nRet;
+}
+
+//--------------------------------------------------------
+
void ScGridWindow::UpdateEditViewPos()
{
if (pViewData->HasEditView(eWhich))
diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx
index 63123bd67..c03603af1 100644
--- a/sc/source/ui/view/select.cxx
+++ b/sc/source/ui/view/select.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: select.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:45:09 $
+ * last change: $Author: nn $ $Date: 2001-03-23 19:24:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -67,17 +67,23 @@
// INCLUDE ---------------------------------------------------------------
+#include <tools/urlobj.hxx>
#include <vcl/sound.hxx>
+#include <sfx2/docfile.hxx>
#include "select.hxx"
#include "sc.hrc"
#include "tabvwsh.hxx"
#include "scmod.hxx"
#include "document.hxx"
-#include "dataobj.hxx"
+//#include "dataobj.hxx"
+#include "transobj.hxx"
+#include "docsh.hxx"
extern USHORT nScFillModeMouseModifier; // global.cxx
+using namespace com::sun::star;
+
// STATIC DATA -----------------------------------------------------------
static Point aSwitchPos; //! Member
@@ -141,6 +147,33 @@ void __EXPORT ScViewFunctionSet::BeginDrag()
rMark.MarkToSimple();
if ( rMark.IsMarked() && !rMark.IsMultiMarked() )
{
+ ScDocument* pClipDoc = new ScDocument( SCDOCMODE_CLIP );
+ pViewData->GetView()->CopyToClip( pClipDoc, FALSE );
+
+ ScDocShell* pDocSh = pViewData->GetDocShell();
+ TransferableObjectDescriptor aObjDesc;
+ pDocSh->FillTransferableObjectDescriptor( aObjDesc );
+ aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
+ // maSize is set in ScTransferObj ctor
+
+ ScTransferObj* pTransferObj = new ScTransferObj( pClipDoc, aObjDesc );
+ uno::Reference<datatransfer::XTransferable> xTransferable( pTransferObj );
+
+ // set position of dragged cell within range
+ ScRange aMarkRange = pTransferObj->GetRange();
+ USHORT nStartX = aMarkRange.aStart.Col();
+ USHORT nStartY = aMarkRange.aStart.Row();
+ USHORT nHandleX = (nPosX >= (short) nStartX) ? nPosX - nStartX : 0;
+ USHORT nHandleY = (nPosY >= (short) nStartY) ? nPosY - nStartY : 0;
+ pTransferObj->SetDragHandlePos( nHandleX, nHandleY );
+
+ Window* pWindow = pViewData->GetActiveWin();
+ SC_MOD()->SetDragObject( pTransferObj, NULL ); // for internal D&D
+ pTransferObj->StartDrag( pWindow, DND_ACTION_COPYMOVE | DND_ACTION_LINK );
+
+#if 0
+ // old api:
+
ScDocument* pDoc = pViewData->GetDocument();
ScRange aMarkRange;
rMark.GetMarkArea( aMarkRange );
@@ -182,6 +215,7 @@ void __EXPORT ScViewFunctionSet::BeginDrag()
default:
break;
}
+#endif
return; // Dragging passiert
}
diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx
index 0545b489a..5e4b13dd0 100644
--- a/sc/source/ui/view/tabcont.cxx
+++ b/sc/source/ui/view/tabcont.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: tabcont.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: nn $ $Date: 2000-09-22 18:37:38 $
+ * last change: $Author: nn $ $Date: 2001-03-23 19:24:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -461,6 +461,7 @@ BOOL __EXPORT ScTabControl::Drop( const DropEvent& rEvt )
{
EndSwitchPage();
+#ifdef OLD_DND
ScModule* pScMod = SC_MOD();
ScDocument* pSourceDoc = pScMod->GetDragData().pDoc;
if (pSourceDoc && bDragging)
@@ -478,6 +479,7 @@ BOOL __EXPORT ScTabControl::Drop( const DropEvent& rEvt )
else
Sound::Beep();
}
+#endif
return FALSE;
}
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index 9a238ded6..e015cc7aa 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: viewfun5.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: nn $ $Date: 2001-02-21 18:10:05 $
+ * last change: $Author: nn $ $Date: 2001-03-23 19:24:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1019,8 +1019,10 @@ BOOL ScViewFunc::PasteDataFormat( ULONG nFormatId,
ScDocument* pClipDoc = new ScDocument( SCDOCMODE_CLIP );
USHORT nFirstCol, nFirstRow, nLastCol, nLastRow;
- pSrcDoc->GetDataStart( nSrcTab, nFirstCol, nFirstRow );
- pSrcDoc->GetCellArea( nSrcTab, nLastCol, nLastRow );
+ if ( pSrcDoc->GetDataStart( nSrcTab, nFirstCol, nFirstRow ) )
+ pSrcDoc->GetCellArea( nSrcTab, nLastCol, nLastRow );
+ else
+ nFirstCol = nFirstRow = nLastCol = nLastRow = 0;
pSrcDoc->CopyToClip( nFirstCol, nFirstRow, nLastCol, nLastRow,
FALSE, pClipDoc, FALSE, &aSrcMark );
ScGlobal::SetClipDocName( xDocShRef->GetTitle( SFX_TITLE_FULLNAME ) );
@@ -1277,8 +1279,10 @@ BOOL ScViewFunc::PasteDataFormat( ULONG nFormatId,
{
DBG_ERROR("no dimension"); //! possible?
USHORT nFirstCol, nFirstRow, nLastCol, nLastRow;
- pInsDoc->GetDataStart( nSrcTab, nFirstCol, nFirstRow );
- pInsDoc->GetCellArea( nSrcTab, nLastCol, nLastRow );
+ if ( pInsDoc->GetDataStart( nSrcTab, nFirstCol, nFirstRow ) )
+ pInsDoc->GetCellArea( nSrcTab, nLastCol, nLastRow );
+ else
+ nFirstCol = nFirstRow = nLastCol = nLastRow = 0;
aSource = ScRange( nFirstCol, nFirstRow, nSrcTab,
nLastCol, nLastRow, nSrcTab );
}
diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx
index 792666af4..2481bf692 100644
--- a/sc/source/ui/view/viewfun7.cxx
+++ b/sc/source/ui/view/viewfun7.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: viewfun7.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: jp $ $Date: 2001-03-08 20:53:32 $
+ * last change: $Author: nn $ $Date: 2001-03-23 19:24:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -432,6 +432,7 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, BOOL bGrou
pRef->SetMapMode( MapMode(MAP_100TH_MM) );
}
+#ifdef OLD_DND
SdrView* pDragEditView = SC_MOD()->GetDragData().pSdrView;
if (pDragEditView)
{
@@ -439,11 +440,13 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, BOOL bGrou
if (aPos.X() < 0) aPos.X() = 0;
if (aPos.Y() < 0) aPos.Y() = 0;
}
+#endif
ScDrawView* pDrawView = GetScDrawView();
if (bGroup)
pDrawView->BegUndo( ScGlobal::GetRscString( STR_UNDO_PASTE ) );
+#ifdef OLD_DND
BOOL bSameDoc = ( pDragEditView && pDragEditView->GetModel() == pDrawView->GetModel() );
if (bSameDoc)
{
@@ -495,6 +498,7 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, BOOL bGrou
}
}
else
+#endif
{
bPasteIsMove = FALSE; // kein internes Verschieben passiert