LCOV - code coverage report
Current view: top level - sw/source/ui/docvw - edtdd.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 247 0.0 %
Date: 2012-08-25 Functions: 0 13 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 393 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <hintids.hxx>
      30                 :            : 
      31                 :            : 
      32                 :            : #include <svx/svdview.hxx>
      33                 :            : #include <editeng/outliner.hxx>
      34                 :            : #include <svx/svdobj.hxx>
      35                 :            : #include <sot/exchange.hxx>
      36                 :            : #include <sot/formats.hxx>
      37                 :            : #include <sfx2/bindings.hxx>
      38                 :            : 
      39                 :            : #include <sfx2/viewfrm.hxx>
      40                 :            : #include <fmturl.hxx>
      41                 :            : #include <frmfmt.hxx>
      42                 :            : #include <wrtsh.hxx>
      43                 :            : #include <edtwin.hxx>
      44                 :            : #include <view.hxx>
      45                 :            : #include <viewopt.hxx>
      46                 :            : #include <swdtflvr.hxx>
      47                 :            : #include <swmodule.hxx>
      48                 :            : #include <docsh.hxx>
      49                 :            : #include <wdocsh.hxx>
      50                 :            : #include <swundo.hxx>
      51                 :            : 
      52                 :            : using namespace ::com::sun::star;
      53                 :            : 
      54                 :            : // no include "dbgoutsw.hxx" here!!!!!!
      55                 :            : 
      56                 :            : extern sal_Bool bNoInterrupt;
      57                 :            : extern sal_Bool bFrmDrag;
      58                 :            : extern sal_Bool bDDTimerStarted;
      59                 :            : 
      60                 :            : sal_Bool bExecuteDrag = sal_False;
      61                 :            : 
      62                 :          0 : void SwEditWin::StartDDTimer()
      63                 :            : {
      64                 :          0 :     aTimer.SetTimeoutHdl(LINK(this, SwEditWin, DDHandler));
      65                 :          0 :     aTimer.SetTimeout(480);
      66                 :          0 :     aTimer.Start();
      67                 :          0 :     bDDTimerStarted = sal_True;
      68                 :          0 : }
      69                 :            : 
      70                 :            : 
      71                 :          0 : void SwEditWin::StopDDTimer(SwWrtShell *pSh, const Point &rPt)
      72                 :            : {
      73                 :          0 :     aTimer.Stop();
      74                 :          0 :     bDDTimerStarted = sal_False;
      75         [ #  # ]:          0 :     if(!pSh->IsSelFrmMode())
      76                 :          0 :         pSh->SetCursor(&rPt, false);
      77                 :          0 :     aTimer.SetTimeoutHdl(LINK(this,SwEditWin, TimerHandler));
      78                 :          0 : }
      79                 :            : 
      80                 :          0 : void SwEditWin::StartDrag( sal_Int8 /*nAction*/, const Point& rPosPixel )
      81                 :            : {
      82                 :          0 :     SwWrtShell &rSh = rView.GetWrtShell();
      83         [ #  # ]:          0 :     if( rSh.GetDrawView() )
      84                 :            :     {
      85         [ #  # ]:          0 :         CommandEvent aDragEvent( rPosPixel, COMMAND_STARTDRAG, sal_True );
      86 [ #  # ][ #  # ]:          0 :         if( rSh.GetDrawView()->Command( aDragEvent, this ) )
                 [ #  # ]
      87                 :            :         {
      88         [ #  # ]:          0 :             rView.GetViewFrame()->GetBindings().InvalidateAll(sal_False);
      89                 :          0 :             return; // Event von der SdrView ausgewertet
      90                 :            :         }
      91                 :            :     }
      92                 :            : 
      93 [ #  # ][ #  # ]:          0 :     if ( !pApplyTempl && !rSh.IsDrawCreate() && !IsDrawAction())
         [ #  # ][ #  # ]
      94                 :            :     {
      95                 :          0 :         sal_Bool bStart = sal_False, bDelSelect = sal_False;
      96                 :          0 :         SdrObject *pObj = NULL;
      97         [ #  # ]:          0 :         Point aDocPos( PixelToLogic( rPosPixel ) );
      98 [ #  # ][ #  # ]:          0 :         if ( !rSh.IsInSelect() && rSh.ChgCurrPam( aDocPos, sal_True, sal_True))
         [ #  # ][ #  # ]
      99                 :            :             //We are not selecting and aren't at a selection
     100                 :          0 :             bStart = sal_True;
     101 [ #  # ][ #  # ]:          0 :         else if ( !bFrmDrag && rSh.IsSelFrmMode() &&
         [ #  # ][ #  # ]
     102         [ #  # ]:          0 :                     rSh.IsInsideSelectedObj( aDocPos ) )
     103                 :            :         {
     104                 :            :             //We are not dragging internally and are not at an
     105                 :            :             //object (frame, draw object)
     106                 :            : 
     107                 :          0 :             bStart = sal_True;
     108                 :            :         }
     109 [ #  # ][ #  # ]:          0 :         else if( !bFrmDrag && rView.GetDocShell()->IsReadOnly() &&
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     110         [ #  # ]:          0 :                 OBJCNT_NONE != rSh.GetObjCntType( aDocPos, pObj ))
     111                 :            :         {
     112         [ #  # ]:          0 :             rSh.LockPaint();
     113 [ #  # ][ #  # ]:          0 :             if( rSh.SelectObj( aDocPos, 0, pObj ))
     114                 :          0 :                 bStart = bDelSelect = sal_True;
     115                 :            :             else
     116         [ #  # ]:          0 :                 rSh.UnlockPaint();
     117                 :            :         }
     118                 :            :         else
     119                 :            :         {
     120         [ #  # ]:          0 :             SwContentAtPos aSwContentAtPos( SwContentAtPos::SW_INETATTR );
     121                 :            :             bStart = rSh.GetContentAtPos( aDocPos,
     122                 :            :                         aSwContentAtPos,
     123 [ #  # ][ #  # ]:          0 :                         sal_False );
     124                 :            :         }
     125                 :            : 
     126 [ #  # ][ #  # ]:          0 :         if ( bStart && !bIsInDrag )
     127                 :            :         {
     128                 :          0 :             bMBPressed = sal_False;
     129         [ #  # ]:          0 :             ReleaseMouse();
     130                 :          0 :             bFrmDrag = sal_False;
     131                 :          0 :             bExecuteDrag = sal_True;
     132                 :          0 :             SwEditWin::nDDStartPosY = aDocPos.Y();
     133                 :          0 :             SwEditWin::nDDStartPosX = aDocPos.X();
     134                 :          0 :             aMovePos = aDocPos;
     135         [ #  # ]:          0 :             StartExecuteDrag();
     136         [ #  # ]:          0 :             if( bDelSelect )
     137                 :            :             {
     138         [ #  # ]:          0 :                 rSh.UnSelectFrm();
     139         [ #  # ]:          0 :                 rSh.UnlockPaint();
     140                 :            :             }
     141                 :            :         }
     142                 :            :     }
     143                 :            : }
     144                 :            : 
     145                 :          0 : void SwEditWin::StartExecuteDrag()
     146                 :            : {
     147 [ #  # ][ #  # ]:          0 :     if( !bExecuteDrag || bIsInDrag )
     148                 :          0 :         return;
     149                 :            : 
     150                 :          0 :     bIsInDrag = sal_True;
     151                 :            : 
     152         [ #  # ]:          0 :     SwTransferable* pTransfer = new SwTransferable( rView.GetWrtShell() );
     153                 :            :     uno::Reference<
     154 [ #  # ][ #  # ]:          0 :         datatransfer::XTransferable > xRef( pTransfer );
     155                 :            : 
     156         [ #  # ]:          0 :     pTransfer->StartDrag( this, aMovePos );
     157                 :            : }
     158                 :            : 
     159                 :          0 : void SwEditWin::DragFinished()
     160                 :            : {
     161                 :          0 :     DropCleanup();
     162                 :          0 :     aTimer.SetTimeoutHdl( LINK(this,SwEditWin, TimerHandler) );
     163                 :          0 :     bIsInDrag = sal_False;
     164                 :          0 : }
     165                 :            : 
     166                 :            : 
     167                 :          0 : void SwEditWin::DropCleanup()
     168                 :            : {
     169                 :          0 :     SwWrtShell &rSh =  rView.GetWrtShell();
     170                 :            : 
     171                 :            :     // reset statuses
     172                 :          0 :     bNoInterrupt = sal_False;
     173         [ #  # ]:          0 :     if ( bOldIdleSet )
     174                 :            :     {
     175                 :          0 :         ((SwViewOption*)rSh.GetViewOptions())->SetIdle( bOldIdle );
     176                 :          0 :         bOldIdleSet = sal_False;
     177                 :            :     }
     178         [ #  # ]:          0 :     if ( pUserMarker )
     179                 :          0 :         CleanupDropUserMarker();
     180                 :            :     else
     181                 :          0 :         rSh.UnSetVisCrsr();
     182                 :            : 
     183                 :          0 : }
     184                 :            : 
     185                 :          0 : void SwEditWin::CleanupDropUserMarker()
     186                 :            : {
     187         [ #  # ]:          0 :     if ( pUserMarker )
     188                 :            :     {
     189         [ #  # ]:          0 :         delete pUserMarker;
     190                 :          0 :         pUserMarker = 0;
     191                 :          0 :         pUserMarkerObj = 0;
     192                 :            :     }
     193                 :          0 : }
     194                 :            : 
     195                 :            : 
     196                 :            : //exhibition hack (MA,MBA)
     197                 :          0 : void lcl_SelectShellForDrop( SwView &rView )
     198                 :            : {
     199         [ #  # ]:          0 :     if ( !rView.GetCurShell() )
     200                 :          0 :         rView.SelectShell();
     201                 :          0 : }
     202                 :            : 
     203                 :          0 : sal_Int8 SwEditWin::ExecuteDrop( const ExecuteDropEvent& rEvt )
     204                 :            : {
     205         [ #  # ]:          0 :     ::lcl_SelectShellForDrop( GetView() );
     206         [ #  # ]:          0 :     DropCleanup();
     207                 :          0 :     sal_Int8 nRet = DND_ACTION_NONE;
     208                 :            : 
     209                 :            :     //A Drop to an open OutlinerView doesn't concern us (also see QueryDrop)
     210                 :          0 :     SwWrtShell &rSh = rView.GetWrtShell();
     211         [ #  # ]:          0 :     const Point aDocPt( PixelToLogic( rEvt.maPosPixel ));
     212                 :          0 :     SdrObject *pObj = 0;
     213                 :            :     OutlinerView* pOLV;
     214         [ #  # ]:          0 :     rSh.GetObjCntType( aDocPt, pObj );
     215                 :            : 
     216 [ #  # ][ #  # ]:          0 :     if( pObj && 0 != ( pOLV = rSh.GetDrawView()->GetTextEditOutlinerView() ))
         [ #  # ][ #  # ]
     217                 :            :     {
     218         [ #  # ]:          0 :         Rectangle aRect( pOLV->GetOutputArea() );
     219 [ #  # ][ #  # ]:          0 :         aRect.Union( pObj->GetLogicRect() );
     220 [ #  # ][ #  # ]:          0 :         const Point aPos = pOLV->GetWindow()->PixelToLogic(rEvt.maPosPixel);
     221 [ #  # ][ #  # ]:          0 :         if ( aRect.IsInside(aPos) )
     222                 :            :         {
     223         [ #  # ]:          0 :             rSh.StartAllAction();
     224         [ #  # ]:          0 :             rSh.EndAllAction();
     225                 :          0 :             return nRet;
     226                 :            :         }
     227                 :            :     }
     228                 :            : 
     229                 :            : 
     230                 :            :     //                          There's a special treatment for file lists with a single
     231                 :            :     //                          element, that depends on the actual content of the
     232                 :            :     //                          Transferable to be accessible. Since the transferable
     233                 :            :     //                          may only be accessed after the drop has been accepted
     234                 :            :     //                          (according to KA due to Java D&D), we'll have to
     235                 :            :     //                          reevaluate the drop action once more _with_ the
     236                 :            :     //                          Transferable.
     237                 :            :     sal_uInt16 nEventAction;
     238                 :            :     sal_Int8 nUserOpt = rEvt.mbDefault ? EXCHG_IN_ACTION_DEFAULT
     239         [ #  # ]:          0 :                                        : rEvt.mnAction;
     240                 :            :     m_nDropAction = SotExchange::GetExchangeAction(
     241                 :          0 :                                 GetDataFlavorExVector(),
     242                 :            :                                 m_nDropDestination,
     243                 :            :                                 rEvt.mnAction,
     244                 :            :                                 nUserOpt, m_nDropFormat, nEventAction, 0,
     245         [ #  # ]:          0 :                                 &rEvt.maDropEvent.Transferable );
     246                 :            : 
     247                 :            : 
     248         [ #  # ]:          0 :     TransferableDataHelper aData( rEvt.maDropEvent.Transferable );
     249                 :          0 :     nRet = rEvt.mnAction;
     250         [ #  # ]:          0 :     if( !SwTransferable::PasteData( aData, rSh, m_nDropAction, m_nDropFormat,
     251         [ #  # ]:          0 :                                 m_nDropDestination, sal_False, rEvt.mbDefault, &aDocPt, nRet))
     252                 :          0 :         nRet = DND_ACTION_NONE;
     253 [ #  # ][ #  # ]:          0 :     else if ( SW_MOD()->pDragDrop )
     254                 :            :         //Don't clean up anymore at internal D&D!
     255         [ #  # ]:          0 :         SW_MOD()->pDragDrop->SetCleanUp( sal_False );
     256                 :            : 
     257         [ #  # ]:          0 :     return nRet;
     258                 :            : }
     259                 :            : 
     260                 :            : 
     261                 :          0 : sal_uInt16 SwEditWin::GetDropDestination( const Point& rPixPnt, SdrObject ** ppObj )
     262                 :            : {
     263                 :          0 :     SwWrtShell &rSh = rView.GetWrtShell();
     264         [ #  # ]:          0 :     const Point aDocPt( PixelToLogic( rPixPnt ) );
     265 [ #  # ][ #  # ]:          0 :     if( rSh.ChgCurrPam( aDocPt ) || rSh.IsOverReadOnlyPos( aDocPt ) )
         [ #  # ][ #  # ]
                 [ #  # ]
     266                 :          0 :         return 0;
     267                 :            : 
     268                 :          0 :     SdrObject *pObj = NULL;
     269         [ #  # ]:          0 :     const ObjCntType eType = rSh.GetObjCntType( aDocPt, pObj );
     270                 :            : 
     271                 :            :     //Drop to OutlinerView (TextEdit in Drawing) should decide it on its own!
     272         [ #  # ]:          0 :     if( pObj )
     273                 :            :     {
     274         [ #  # ]:          0 :         OutlinerView* pOLV = rSh.GetDrawView()->GetTextEditOutlinerView();
     275         [ #  # ]:          0 :         if ( pOLV )
     276                 :            :         {
     277         [ #  # ]:          0 :             Rectangle aRect( pOLV->GetOutputArea() );
     278 [ #  # ][ #  # ]:          0 :             aRect.Union( pObj->GetLogicRect() );
     279 [ #  # ][ #  # ]:          0 :             const Point aPos = pOLV->GetWindow()->PixelToLogic( rPixPnt );
     280 [ #  # ][ #  # ]:          0 :             if( aRect.IsInside( aPos ) )
     281                 :          0 :                 return 0;
     282                 :            :         }
     283                 :            :     }
     284                 :            : 
     285                 :            :     //What do we want to drop on now?
     286                 :          0 :     sal_uInt16 nDropDestination = 0;
     287                 :            : 
     288                 :            :     //Did anything else arrive from the DrawingEngine?
     289         [ #  # ]:          0 :     if( OBJCNT_NONE != eType )
     290                 :            :     {
     291   [ #  #  #  #  :          0 :         switch ( eType )
                #  #  # ]
     292                 :            :         {
     293                 :            :         case OBJCNT_GRF:
     294                 :            :             {
     295                 :            :                 sal_Bool bLink,
     296 [ #  # ][ #  # ]:          0 :                     bIMap = 0 != rSh.GetFmtFromObj( aDocPt )->GetURL().GetMap();
     297         [ #  # ]:          0 :                 String aDummy;
     298         [ #  # ]:          0 :                 rSh.GetGrfAtPos( aDocPt, aDummy, bLink );
     299 [ #  # ][ #  # ]:          0 :                 if ( bLink && bIMap )
     300                 :          0 :                     nDropDestination = EXCHG_DEST_DOC_LNKD_GRAPH_W_IMAP;
     301         [ #  # ]:          0 :                 else if ( bLink )
     302                 :          0 :                     nDropDestination = EXCHG_DEST_DOC_LNKD_GRAPHOBJ;
     303         [ #  # ]:          0 :                 else if ( bIMap )
     304                 :          0 :                     nDropDestination = EXCHG_DEST_DOC_GRAPH_W_IMAP;
     305                 :            :                 else
     306         [ #  # ]:          0 :                     nDropDestination = EXCHG_DEST_DOC_GRAPHOBJ;
     307                 :            :             }
     308                 :          0 :             break;
     309                 :            :         case OBJCNT_FLY:
     310 [ #  # ][ #  # ]:          0 :             if( rSh.GetView().GetDocShell()->ISA(SwWebDocShell) )
         [ #  # ][ #  # ]
     311                 :          0 :                 nDropDestination = EXCHG_DEST_DOC_TEXTFRAME_WEB;
     312                 :            :             else
     313                 :          0 :                 nDropDestination = EXCHG_DEST_DOC_TEXTFRAME;
     314                 :          0 :             break;
     315                 :          0 :         case OBJCNT_OLE:        nDropDestination = EXCHG_DEST_DOC_OLEOBJ; break;
     316                 :            :         case OBJCNT_CONTROL:    /* no Action avail */
     317                 :          0 :         case OBJCNT_SIMPLE:     nDropDestination = EXCHG_DEST_DOC_DRAWOBJ; break;
     318                 :          0 :         case OBJCNT_URLBUTTON:  nDropDestination = EXCHG_DEST_DOC_URLBUTTON; break;
     319                 :          0 :         case OBJCNT_GROUPOBJ:   nDropDestination = EXCHG_DEST_DOC_GROUPOBJ;     break;
     320                 :            : 
     321                 :            :         default: OSL_ENSURE( !this, "new ObjectType?" );
     322                 :            :         }
     323                 :            :     }
     324         [ #  # ]:          0 :     if ( !nDropDestination )
     325                 :            :     {
     326 [ #  # ][ #  # ]:          0 :         if( rSh.GetView().GetDocShell()->ISA(SwWebDocShell) )
         [ #  # ][ #  # ]
     327                 :          0 :             nDropDestination = EXCHG_DEST_SWDOC_FREE_AREA_WEB;
     328                 :            :         else
     329                 :          0 :             nDropDestination = EXCHG_DEST_SWDOC_FREE_AREA;
     330                 :            :     }
     331         [ #  # ]:          0 :     if( ppObj )
     332                 :          0 :         *ppObj = pObj;
     333                 :          0 :     return nDropDestination;
     334                 :            : }
     335                 :            : 
     336                 :          0 : sal_Int8 SwEditWin::AcceptDrop( const AcceptDropEvent& rEvt )
     337                 :            : {
     338         [ #  # ]:          0 :     if( rEvt.mbLeaving )
     339                 :            :     {
     340         [ #  # ]:          0 :         DropCleanup();
     341                 :          0 :         return rEvt.mnAction;
     342                 :            :     }
     343                 :            : 
     344 [ #  # ][ #  # ]:          0 :     if( rView.GetDocShell()->IsReadOnly() )
                 [ #  # ]
     345                 :          0 :         return DND_ACTION_NONE;
     346                 :            : 
     347                 :          0 :     SwWrtShell &rSh = rView.GetWrtShell();
     348                 :            : 
     349                 :          0 :     Point aPixPt( rEvt.maPosPixel );
     350                 :            : 
     351                 :            :     // If the cursor is near the inner boundary
     352                 :            :     // we attempt to scroll towards the desired direction.
     353                 :          0 :     Point aPoint;
     354         [ #  # ]:          0 :     Rectangle aWin(aPoint,GetOutputSizePixel());
     355                 :          0 :     const int nMargin = 10;
     356                 :          0 :     aWin.Left() += nMargin;
     357                 :          0 :     aWin.Top() += nMargin;
     358                 :          0 :     aWin.Right() -= nMargin;
     359                 :          0 :     aWin.Bottom() -= nMargin;
     360 [ #  # ][ #  # ]:          0 :     if(!aWin.IsInside(aPixPt)) {
     361                 :            :         static sal_uLong last_tick = 0;
     362         [ #  # ]:          0 :         sal_uLong current_tick = Time::GetSystemTicks();
     363         [ #  # ]:          0 :         if((current_tick-last_tick) > 500) {
     364                 :          0 :             last_tick = current_tick;
     365         [ #  # ]:          0 :             if(!bOldIdleSet) {
     366                 :          0 :                 bOldIdle = rSh.GetViewOptions()->IsIdle();
     367                 :          0 :                 ((SwViewOption *)rSh.GetViewOptions())->SetIdle(sal_False);
     368                 :          0 :                 bOldIdleSet = sal_True;
     369                 :            :             }
     370         [ #  # ]:          0 :             CleanupDropUserMarker();
     371         [ #  # ]:          0 :             if(aPixPt.X() > aWin.Right()) aPixPt.X() += nMargin;
     372         [ #  # ]:          0 :             if(aPixPt.X() < aWin.Left()) aPixPt.X() -= nMargin;
     373         [ #  # ]:          0 :             if(aPixPt.Y() > aWin.Bottom()) aPixPt.Y() += nMargin;
     374         [ #  # ]:          0 :             if(aPixPt.Y() < aWin.Top()) aPixPt.Y() -= nMargin;
     375         [ #  # ]:          0 :             Point aDocPt(PixelToLogic(aPixPt));
     376                 :          0 :             SwRect rect(aDocPt,Size(1,1));
     377         [ #  # ]:          0 :             rSh.MakeVisible(rect);
     378                 :            :         }
     379                 :            :     }
     380                 :            : 
     381         [ #  # ]:          0 :     if(bOldIdleSet) {
     382                 :          0 :         ((SwViewOption *)rSh.GetViewOptions())->SetIdle( bOldIdle );
     383                 :          0 :         bOldIdleSet = sal_False;
     384                 :            :     }
     385                 :            : 
     386                 :          0 :     SdrObject *pObj = NULL;
     387         [ #  # ]:          0 :     m_nDropDestination = GetDropDestination( aPixPt, &pObj );
     388         [ #  # ]:          0 :     if( !m_nDropDestination )
     389                 :          0 :         return DND_ACTION_NONE;
     390                 :            : 
     391                 :            :     sal_uInt16 nEventAction;
     392                 :            :     sal_Int8 nUserOpt = rEvt.mbDefault ? EXCHG_IN_ACTION_DEFAULT
     393         [ #  # ]:          0 :                                        : rEvt.mnAction;
     394                 :            : 
     395                 :            :     m_nDropAction = SotExchange::GetExchangeAction(
     396                 :          0 :                                 GetDataFlavorExVector(),
     397                 :            :                                 m_nDropDestination,
     398                 :            :                                 rEvt.mnAction,
     399         [ #  # ]:          0 :                                 nUserOpt, m_nDropFormat, nEventAction );
     400                 :            : 
     401         [ #  # ]:          0 :     if( EXCHG_INOUT_ACTION_NONE != m_nDropAction )
     402                 :            :     {
     403         [ #  # ]:          0 :         const Point aDocPt( PixelToLogic( aPixPt ) );
     404                 :            : 
     405                 :            :         //With the default action we still want to have a say.
     406         [ #  # ]:          0 :         SwModule *pMod = SW_MOD();
     407         [ #  # ]:          0 :         if( pMod->pDragDrop )
     408                 :            :         {
     409                 :          0 :             sal_Bool bCleanup = sal_False;
     410                 :            :             //Drawing objects in Headers/Footers are not allowed
     411                 :            : 
     412                 :          0 :             SwWrtShell *pSrcSh = pMod->pDragDrop->GetShell();
     413 [ #  # ][ #  # ]:          0 :             if( (pSrcSh->GetSelFrmType() == FRMTYPE_DRAWOBJ) &&
         [ #  # ][ #  # ]
                 [ #  # ]
     414         [ #  # ]:          0 :                 pSrcSh->IsSelContainsControl() &&
     415         [ #  # ]:          0 :                  (rSh.GetFrmType( &aDocPt, sal_False ) & (FRMTYPE_HEADER|FRMTYPE_FOOTER)) )
     416                 :            :             {
     417                 :          0 :                 bCleanup = sal_True;
     418                 :            :             }
     419                 :            :             // don't more position protected objects!
     420 [ #  # ][ #  # ]:          0 :             else if( DND_ACTION_MOVE == rEvt.mnAction &&
                 [ #  # ]
     421         [ #  # ]:          0 :                      pSrcSh->IsSelObjProtected( FLYPROTECT_POS ) )
     422                 :            :             {
     423                 :          0 :                 bCleanup = sal_True;
     424                 :            :             }
     425         [ #  # ]:          0 :             else if( rEvt.mbDefault )
     426                 :            :             {
     427                 :            :                 //              internal Drag&Drop: within same Doc a Move
     428                 :            :                 //              otherwise a Copy - Task 54974
     429                 :          0 :                 nEventAction = pSrcSh->GetDoc() == rSh.GetDoc()
     430                 :            :                                     ? DND_ACTION_MOVE
     431         [ #  # ]:          0 :                                     : DND_ACTION_COPY;
     432                 :            :             }
     433         [ #  # ]:          0 :             if ( bCleanup )
     434                 :            :             {
     435         [ #  # ]:          0 :                 CleanupDropUserMarker();
     436         [ #  # ]:          0 :                 rSh.UnSetVisCrsr();
     437                 :          0 :                 return DND_ACTION_NONE;
     438                 :            :             }
     439                 :            :         }
     440                 :            :         else
     441                 :            :         {
     442                 :            :             //D&D from outside of SW should be a Copy per default.
     443 [ #  # ][ #  # ]:          0 :             if( EXCHG_IN_ACTION_DEFAULT == nEventAction &&
     444                 :            :                 DND_ACTION_MOVE == rEvt.mnAction )
     445                 :          0 :                 nEventAction = DND_ACTION_COPY;
     446                 :            : 
     447 [ #  # ][ #  # ]:          0 :             if( (SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE == m_nDropFormat &&
                 [ #  # ]
     448                 :            :                  EXCHG_IN_ACTION_LINK == m_nDropAction) ||
     449                 :            :                  SOT_FORMATSTR_ID_SBA_CTRLDATAEXCHANGE == m_nDropFormat  )
     450                 :            :             {
     451 [ #  # ][ #  # ]:          0 :                 SdrMarkView* pMView = PTR_CAST( SdrMarkView, rSh.GetDrawView() );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     452 [ #  # ][ #  # ]:          0 :                 if( pMView && !pMView->IsDesignMode() )
                 [ #  # ]
     453                 :          0 :                     return DND_ACTION_NONE;
     454                 :            :             }
     455                 :            :         }
     456                 :            : 
     457         [ #  # ]:          0 :         if ( EXCHG_IN_ACTION_DEFAULT != nEventAction )
     458                 :          0 :             nUserOpt = (sal_Int8)nEventAction;
     459                 :            : 
     460                 :            :         // show DropCursor or UserMarker ?
     461 [ #  # ][ #  # ]:          0 :         if( EXCHG_DEST_SWDOC_FREE_AREA_WEB == m_nDropDestination ||
     462                 :            :             EXCHG_DEST_SWDOC_FREE_AREA == m_nDropDestination )
     463                 :            :         {
     464         [ #  # ]:          0 :             CleanupDropUserMarker();
     465         [ #  # ]:          0 :             SwContentAtPos aCont( SwContentAtPos::SW_CONTENT_CHECK );
     466 [ #  # ][ #  # ]:          0 :             if(rSh.GetContentAtPos(aDocPt, aCont))
     467 [ #  # ][ #  # ]:          0 :                 rSh.SwCrsrShell::SetVisCrsr( aDocPt );
     468                 :            :         }
     469                 :            :         else
     470                 :            :         {
     471         [ #  # ]:          0 :             rSh.UnSetVisCrsr();
     472                 :            : 
     473         [ #  # ]:          0 :             if ( pUserMarkerObj != pObj )
     474                 :            :             {
     475         [ #  # ]:          0 :                 CleanupDropUserMarker();
     476                 :          0 :                 pUserMarkerObj = pObj;
     477                 :            : 
     478         [ #  # ]:          0 :                 if(pUserMarkerObj)
     479                 :            :                 {
     480 [ #  # ][ #  # ]:          0 :                     pUserMarker = new SdrDropMarkerOverlay( *rSh.GetDrawView(), *pUserMarkerObj );
                 [ #  # ]
     481                 :            :                 }
     482                 :            :             }
     483                 :            :         }
     484                 :          0 :         return nUserOpt;
     485                 :            :     }
     486                 :            : 
     487         [ #  # ]:          0 :     CleanupDropUserMarker();
     488         [ #  # ]:          0 :     rSh.UnSetVisCrsr();
     489                 :          0 :     return DND_ACTION_NONE;
     490                 :            : }
     491                 :            : 
     492                 :            : 
     493                 :          0 : IMPL_LINK_NOARG(SwEditWin, DDHandler)
     494                 :            : {
     495                 :          0 :     bDDTimerStarted = sal_False;
     496                 :          0 :     aTimer.Stop();
     497                 :          0 :     aTimer.SetTimeout(240);
     498                 :          0 :     bMBPressed = sal_False;
     499                 :          0 :     ReleaseMouse();
     500                 :          0 :     bFrmDrag = sal_False;
     501                 :            : 
     502         [ #  # ]:          0 :     if ( rView.GetViewFrame() )
     503                 :            :     {
     504                 :          0 :         bExecuteDrag = sal_True;
     505                 :          0 :         StartExecuteDrag();
     506                 :            :     }
     507                 :          0 :     return 0;
     508                 :            : }
     509                 :            : 
     510                 :            : 
     511                 :            : 
     512                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10