diff options
author | Malte Timmermann <mt@openoffice.org> | 2001-11-22 17:16:33 +0000 |
---|---|---|
committer | Malte Timmermann <mt@openoffice.org> | 2001-11-22 17:16:33 +0000 |
commit | f8974484d77eb9297efa60efda6f9749cea23578 (patch) | |
tree | 43022f8a0022cf72f83e75648514a98595b3e8f6 /svx | |
parent | 0149a66817e468ea37ff4537821049f15d9c3abd (diff) |
#95135# Workaround for getting drop() even after rejectDrag()
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/editeng/impedit.cxx | 102 | ||||
-rw-r--r-- | svx/source/editeng/impedit.hxx | 7 |
2 files changed, 59 insertions, 50 deletions
diff --git a/svx/source/editeng/impedit.cxx b/svx/source/editeng/impedit.cxx index 347e37aa518e..4b5fdbc22eef 100644 --- a/svx/source/editeng/impedit.cxx +++ b/svx/source/editeng/impedit.cxx @@ -2,9 +2,9 @@ * * $RCSfile: impedit.cxx,v $ * - * $Revision: 1.27 $ + * $Revision: 1.28 $ * - * last change: $Author: mt $ $Date: 2001-11-14 10:56:55 $ + * last change: $Author: mt $ $Date: 2001-11-22 18:16:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1630,66 +1630,72 @@ void ImpEditView::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDro vos::OGuard aVclGuard( Application::GetSolarMutex() ); DBG_ASSERT( pDragAndDropInfo, "Drop - No Drag&Drop info?!" ); + DBG_ASSERT( pDragAndDropInfo->bDragAccepted, "Drop? Drag was not accepted!" ); - BOOL bChanges = FALSE; + if ( pDragAndDropInfo->bDragAccepted ) + { + BOOL bChanges = FALSE; - HideDDCursor(); + HideDDCursor(); - if ( pDragAndDropInfo->bStarterOfDD ) - { - pEditEngine->pImpEditEngine->UndoActionStart( EDITUNDO_DRAGANDDROP ); - pDragAndDropInfo->bUndoAction = TRUE; - } + if ( pDragAndDropInfo->bStarterOfDD ) + { + pEditEngine->pImpEditEngine->UndoActionStart( EDITUNDO_DRAGANDDROP ); + pDragAndDropInfo->bUndoAction = TRUE; + } - if ( pDragAndDropInfo->bOutlinerMode ) - { - bChanges = TRUE; - GetEditViewPtr()->MoveParagraphs( Range( pDragAndDropInfo->aBeginDragSel.nStartPara, pDragAndDropInfo->aBeginDragSel.nEndPara ), pDragAndDropInfo->nOutlinerDropDest ); - } - else - { - uno::Reference< datatransfer::XTransferable > xDataObj = rDTDE.Transferable; - if ( xDataObj.is() ) + if ( pDragAndDropInfo->bOutlinerMode ) { bChanges = TRUE; - // Selektion wegmalen... - DrawSelection(); - EditPaM aPaM( pDragAndDropInfo->aDropDest ); + GetEditViewPtr()->MoveParagraphs( Range( pDragAndDropInfo->aBeginDragSel.nStartPara, pDragAndDropInfo->aBeginDragSel.nEndPara ), pDragAndDropInfo->nOutlinerDropDest ); + } + else + { + uno::Reference< datatransfer::XTransferable > xDataObj = rDTDE.Transferable; + if ( xDataObj.is() ) + { + bChanges = TRUE; + // Selektion wegmalen... + DrawSelection(); + EditPaM aPaM( pDragAndDropInfo->aDropDest ); - PasteOrDropInfos aPasteOrDropInfos; - aPasteOrDropInfos.nAction = EE_ACTION_DROP; - aPasteOrDropInfos.nStartPara = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( aPaM.GetNode() ); - pEditEngine->pImpEditEngine->aBeginPasteOrDropHdl.Call( &aPasteOrDropInfos ); + PasteOrDropInfos aPasteOrDropInfos; + aPasteOrDropInfos.nAction = EE_ACTION_DROP; + aPasteOrDropInfos.nStartPara = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( aPaM.GetNode() ); + pEditEngine->pImpEditEngine->aBeginPasteOrDropHdl.Call( &aPasteOrDropInfos ); - EditSelection aNewSel = pEditEngine->pImpEditEngine->InsertText( xDataObj, aPaM, pEditEngine->pImpEditEngine->GetStatus().AllowPasteSpecial() ); + EditSelection aNewSel = pEditEngine->pImpEditEngine->InsertText( xDataObj, aPaM, pEditEngine->pImpEditEngine->GetStatus().AllowPasteSpecial() ); - aPasteOrDropInfos.nEndPara = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( aNewSel.Max().GetNode() ); - pEditEngine->pImpEditEngine->aEndPasteOrDropHdl.Call( &aPasteOrDropInfos ); + aPasteOrDropInfos.nEndPara = pEditEngine->pImpEditEngine->GetEditDoc().GetPos( aNewSel.Max().GetNode() ); + pEditEngine->pImpEditEngine->aEndPasteOrDropHdl.Call( &aPasteOrDropInfos ); - SetEditSelection( aNewSel ); - pEditEngine->pImpEditEngine->FormatAndUpdate( pEditEngine->pImpEditEngine->GetActiveView() ); - if ( pDragAndDropInfo->bStarterOfDD ) - { - // Nur dann setzen, wenn in gleicher Engine! - pDragAndDropInfo->aDropSel.nStartPara = pEditEngine->pImpEditEngine->aEditDoc.GetPos( aPaM.GetNode() ); - pDragAndDropInfo->aDropSel.nStartPos = aPaM.GetIndex(); - pDragAndDropInfo->aDropSel.nEndPara = pEditEngine->pImpEditEngine->aEditDoc.GetPos( aNewSel.Max().GetNode() ); - pDragAndDropInfo->aDropSel.nEndPos = aNewSel.Max().GetIndex(); - pDragAndDropInfo->bDroppedInMe = sal_True; + SetEditSelection( aNewSel ); + pEditEngine->pImpEditEngine->FormatAndUpdate( pEditEngine->pImpEditEngine->GetActiveView() ); + if ( pDragAndDropInfo->bStarterOfDD ) + { + // Nur dann setzen, wenn in gleicher Engine! + pDragAndDropInfo->aDropSel.nStartPara = pEditEngine->pImpEditEngine->aEditDoc.GetPos( aPaM.GetNode() ); + pDragAndDropInfo->aDropSel.nStartPos = aPaM.GetIndex(); + pDragAndDropInfo->aDropSel.nEndPara = pEditEngine->pImpEditEngine->aEditDoc.GetPos( aNewSel.Max().GetNode() ); + pDragAndDropInfo->aDropSel.nEndPos = aNewSel.Max().GetIndex(); + pDragAndDropInfo->bDroppedInMe = sal_True; + } } } - } - if ( bChanges ) - rDTDE.Context->acceptDrop( rDTDE.DropAction ); + if ( bChanges ) + { + rDTDE.Context->acceptDrop( rDTDE.DropAction ); + } - if ( !pDragAndDropInfo->bStarterOfDD ) - { - delete pDragAndDropInfo; - pDragAndDropInfo = NULL; - } + if ( !pDragAndDropInfo->bStarterOfDD ) + { + delete pDragAndDropInfo; + pDragAndDropInfo = NULL; + } - rDTDE.Context->dropComplete( bChanges ); + rDTDE.Context->dropComplete( bChanges ); + } } void ImpEditView::dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& rDTDEE ) throw (::com::sun::star::uno::RuntimeException) @@ -1839,6 +1845,7 @@ void ImpEditView::dragOver( const ::com::sun::star::datatransfer::dnd::DropTarge HideDDCursor(); ShowDDCursor(aEditCursor ); } + pDragAndDropInfo->bDragAccepted = TRUE; rDTDE.Context->acceptDrag( rDTDE.DropAction ); } } @@ -1847,6 +1854,7 @@ void ImpEditView::dragOver( const ::com::sun::star::datatransfer::dnd::DropTarge if ( !bAccept ) { HideDDCursor(); + pDragAndDropInfo->bDragAccepted = FALSE; rDTDE.Context->rejectDrag(); } } diff --git a/svx/source/editeng/impedit.hxx b/svx/source/editeng/impedit.hxx index 540f6782bf2d..8221b59b49f8 100644 --- a/svx/source/editeng/impedit.hxx +++ b/svx/source/editeng/impedit.hxx @@ -2,9 +2,9 @@ * * $RCSfile: impedit.hxx,v $ * - * $Revision: 1.43 $ + * $Revision: 1.44 $ * - * last change: $Author: mt $ $Date: 2001-11-14 10:56:55 $ + * last change: $Author: mt $ $Date: 2001-11-22 18:16:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -170,12 +170,13 @@ struct DragAndDropInfo sal_Bool bHasValidData : 1; sal_Bool bUndoAction : 1; sal_Bool bOutlinerMode : 1; + sal_Bool bDragAccepted : 1; DragAndDropInfo( const OutputDevice& rOutDev4VirtDev) : aBackground( rOutDev4VirtDev ) { bVisCursor = sal_False; bDroppedInMe = sal_False; bStarterOfDD = sal_False; bHasValidData = sal_False; bUndoAction = sal_False; bOutlinerMode = sal_False; - nSensibleRange = 0; nCursorWidth = 0; pField = 0; nOutlinerDropDest = 0; + nSensibleRange = 0; nCursorWidth = 0; pField = 0; nOutlinerDropDest = 0; bDragAccepted = sal_False; } }; |