summaryrefslogtreecommitdiffstats
path: root/sc/source/ui/view/select.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/view/select.cxx')
-rw-r--r--sc/source/ui/view/select.cxx94
1 files changed, 47 insertions, 47 deletions
diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx
index e532e07bd518..e1463ccebf53 100644
--- a/sc/source/ui/view/select.cxx
+++ b/sc/source/ui/view/select.cxx
@@ -159,54 +159,54 @@ void ScViewFunctionSet::BeginDrag()
ScModule* pScMod = SC_MOD();
bool bRefMode = pScMod->IsFormulaMode();
- if (!bRefMode)
- {
- pViewData->GetView()->FakeButtonUp( GetWhich() ); // ButtonUp is swallowed
+ if (bRefMode)
+ return;
- ScMarkData& rMark = pViewData->GetMarkData();
- rMark.MarkToSimple();
- if ( rMark.IsMarked() && !rMark.IsMultiMarked() )
- {
- ScDocumentUniquePtr pClipDoc(new ScDocument( SCDOCMODE_CLIP ));
- // bApi = TRUE -> no error messages
- bool bCopied = pViewData->GetView()->CopyToClip( pClipDoc.get(), false, true );
- if ( bCopied )
- {
- sal_Int8 nDragActions = pViewData->GetView()->SelectionEditable() ?
- ( DND_ACTION_COPYMOVE | DND_ACTION_LINK ) :
- ( DND_ACTION_COPY | DND_ACTION_LINK );
-
- ScDocShell* pDocSh = pViewData->GetDocShell();
- TransferableObjectDescriptor aObjDesc;
- pDocSh->FillTransferableObjectDescriptor( aObjDesc );
- aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
- // maSize is set in ScTransferObj ctor
-
- rtl::Reference<ScTransferObj> pTransferObj = new ScTransferObj( std::move(pClipDoc), aObjDesc );
-
- // set position of dragged cell within range
- ScRange aMarkRange = pTransferObj->GetRange();
- SCCOL nStartX = aMarkRange.aStart.Col();
- SCROW nStartY = aMarkRange.aStart.Row();
- SCCOL nHandleX = (nPosX >= nStartX) ? nPosX - nStartX : 0;
- SCROW nHandleY = (nPosY >= nStartY) ? nPosY - nStartY : 0;
- pTransferObj->SetDragHandlePos( nHandleX, nHandleY );
- pTransferObj->SetSourceCursorPos( pViewData->GetCurX(), pViewData->GetCurY() );
- pTransferObj->SetVisibleTab( nTab );
-
- pTransferObj->SetDragSource( pDocSh, rMark );
-
- vcl::Window* pWindow = pViewData->GetActiveWin();
- if ( pWindow->IsTracking() )
- pWindow->EndTracking( TrackingEventFlags::Cancel ); // abort selecting
-
- SC_MOD()->SetDragObject( pTransferObj.get(), nullptr ); // for internal D&D
- pTransferObj->StartDrag( pWindow, nDragActions );
-
- return; // dragging started
- }
- }
- }
+ pViewData->GetView()->FakeButtonUp( GetWhich() ); // ButtonUp is swallowed
+
+ ScMarkData& rMark = pViewData->GetMarkData();
+ rMark.MarkToSimple();
+ if ( !(rMark.IsMarked() && !rMark.IsMultiMarked()) )
+ return;
+
+ ScDocumentUniquePtr pClipDoc(new ScDocument( SCDOCMODE_CLIP ));
+ // bApi = TRUE -> no error messages
+ bool bCopied = pViewData->GetView()->CopyToClip( pClipDoc.get(), false, true );
+ if ( !bCopied )
+ return;
+
+ sal_Int8 nDragActions = pViewData->GetView()->SelectionEditable() ?
+ ( DND_ACTION_COPYMOVE | DND_ACTION_LINK ) :
+ ( DND_ACTION_COPY | DND_ACTION_LINK );
+
+ ScDocShell* pDocSh = pViewData->GetDocShell();
+ TransferableObjectDescriptor aObjDesc;
+ pDocSh->FillTransferableObjectDescriptor( aObjDesc );
+ aObjDesc.maDisplayName = pDocSh->GetMedium()->GetURLObject().GetURLNoPass();
+ // maSize is set in ScTransferObj ctor
+
+ rtl::Reference<ScTransferObj> pTransferObj = new ScTransferObj( std::move(pClipDoc), aObjDesc );
+
+ // set position of dragged cell within range
+ ScRange aMarkRange = pTransferObj->GetRange();
+ SCCOL nStartX = aMarkRange.aStart.Col();
+ SCROW nStartY = aMarkRange.aStart.Row();
+ SCCOL nHandleX = (nPosX >= nStartX) ? nPosX - nStartX : 0;
+ SCROW nHandleY = (nPosY >= nStartY) ? nPosY - nStartY : 0;
+ pTransferObj->SetDragHandlePos( nHandleX, nHandleY );
+ pTransferObj->SetSourceCursorPos( pViewData->GetCurX(), pViewData->GetCurY() );
+ pTransferObj->SetVisibleTab( nTab );
+
+ pTransferObj->SetDragSource( pDocSh, rMark );
+
+ vcl::Window* pWindow = pViewData->GetActiveWin();
+ if ( pWindow->IsTracking() )
+ pWindow->EndTracking( TrackingEventFlags::Cancel ); // abort selecting
+
+ SC_MOD()->SetDragObject( pTransferObj.get(), nullptr ); // for internal D&D
+ pTransferObj->StartDrag( pWindow, nDragActions );
+
+ return; // dragging started
}