LCOV - code coverage report
Current view: top level - svx/source/svdraw - svddrgv.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 67 438 15.3 %
Date: 2012-08-25 Functions: 11 29 37.9 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 20 812 2.5 %

           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                 :            : 
      30                 :            : #include <svx/svddrgv.hxx>
      31                 :            : #include "svx/xattr.hxx"
      32                 :            : #include <svx/xpoly.hxx>
      33                 :            : #include <svx/svdetc.hxx>
      34                 :            : #include <svx/svdtrans.hxx>
      35                 :            : #include <svx/svdundo.hxx>
      36                 :            : #include <svx/svdocapt.hxx>
      37                 :            : #include <svx/svdpagv.hxx>
      38                 :            : #include <svx/svdopath.hxx>
      39                 :            : #include <svx/svdoedge.hxx>
      40                 :            : #include "svx/svdstr.hrc"
      41                 :            : #include "svx/svdglob.hxx"
      42                 :            : #include "svddrgm1.hxx"
      43                 :            : #include <svx/obj3d.hxx>
      44                 :            : #include <svx/svdoashp.hxx>
      45                 :            : #include <svx/sdrpaintwindow.hxx>
      46                 :            : #include <basegfx/polygon/b2dpolypolygontools.hxx>
      47                 :            : #include <basegfx/polygon/b2dpolygontools.hxx>
      48                 :            : #include <svx/polypolygoneditor.hxx>
      49                 :            : #include <basegfx/matrix/b2dhommatrix.hxx>
      50                 :            : #include <svx/sdr/overlay/overlaymanager.hxx>
      51                 :            : 
      52                 :            : using namespace sdr;
      53                 :            : 
      54                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
      55                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
      56                 :            : // DragView
      57                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
      58                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
      59                 :            : 
      60                 :       4699 : void SdrDragView::ImpClearVars()
      61                 :            : {
      62                 :       4699 :     bFramDrag=sal_False;
      63                 :       4699 :     eDragMode=SDRDRAG_MOVE;
      64                 :       4699 :     bDragLimit=sal_False;
      65                 :       4699 :     bMarkedHitMovesAlways=sal_False;
      66                 :       4699 :     eDragHdl=HDL_MOVE;
      67                 :       4699 :     pDragHdl=NULL;
      68                 :       4699 :     bDragHdl=sal_False;
      69                 :       4699 :     bDragSpecial=sal_False;
      70                 :       4699 :     mpCurrentSdrDragMethod=NULL;
      71                 :       4699 :     bDragStripes=sal_False;
      72                 :       4699 :     bMirrRefDragObj=sal_True;
      73                 :       4699 :     bDragWithCopy=sal_False;
      74                 :       4699 :     pInsPointUndo=NULL;
      75                 :       4699 :     bInsGluePoint=sal_False;
      76                 :       4699 :     bInsObjPointMode=sal_False;
      77                 :       4699 :     bInsGluePointMode=sal_False;
      78                 :       4699 :     nDragXorPolyLimit=100;
      79                 :       4699 :     nDragXorPointLimit=500;
      80                 :       4699 :     bNoDragXorPolys=sal_False;
      81                 :       4699 :     bAutoVertexCon=sal_True;
      82                 :       4699 :     bAutoCornerCon=sal_False;
      83                 :       4699 :     bRubberEdgeDragging=sal_True;
      84                 :       4699 :     bDetailedEdgeDragging=sal_True;
      85                 :       4699 :     nDetailedEdgeDraggingLimit=10;
      86                 :       4699 :     bResizeAtCenter=sal_False;
      87                 :       4699 :     bCrookAtCenter=sal_False;
      88                 :       4699 :     bMouseHideWhileDraggingPoints=sal_False;
      89                 :            : 
      90                 :            :     // init using default
      91                 :       4699 :     mbSolidDragging = getOptionsDrawinglayer().IsSolidDragCreate();
      92                 :       4699 : }
      93                 :            : 
      94                 :       4699 : SdrDragView::SdrDragView(SdrModel* pModel1, OutputDevice* pOut)
      95 [ +  - ][ +  - ]:       4699 : :   SdrExchangeView(pModel1,pOut)
      96                 :            : {
      97         [ +  - ]:       4699 :     ImpClearVars();
      98                 :       4699 : }
      99                 :            : 
     100         [ +  - ]:       4508 : SdrDragView::~SdrDragView()
     101                 :            : {
     102         [ -  + ]:       4508 : }
     103                 :            : 
     104                 :       2168 : sal_Bool SdrDragView::IsAction() const
     105                 :            : {
     106 [ +  - ][ -  + ]:       2168 :     return (mpCurrentSdrDragMethod || SdrExchangeView::IsAction());
     107                 :            : }
     108                 :            : 
     109                 :          0 : void SdrDragView::MovAction(const Point& rPnt)
     110                 :            : {
     111                 :          0 :     SdrExchangeView::MovAction(rPnt);
     112         [ #  # ]:          0 :     if (mpCurrentSdrDragMethod)
     113                 :            :     {
     114                 :          0 :         MovDragObj(rPnt);
     115                 :            :     }
     116                 :          0 : }
     117                 :            : 
     118                 :          0 : void SdrDragView::EndAction()
     119                 :            : {
     120         [ #  # ]:          0 :     if (mpCurrentSdrDragMethod)
     121                 :            :     {
     122                 :          0 :         EndDragObj(sal_False);
     123                 :            :     }
     124                 :          0 :     SdrExchangeView::EndAction();
     125                 :          0 : }
     126                 :            : 
     127                 :          0 : void SdrDragView::BckAction()
     128                 :            : {
     129                 :          0 :     SdrExchangeView::BckAction();
     130                 :          0 :     BrkDragObj();
     131                 :          0 : }
     132                 :            : 
     133                 :       4877 : void SdrDragView::BrkAction()
     134                 :            : {
     135                 :       4877 :     SdrExchangeView::BrkAction();
     136                 :       4877 :     BrkDragObj();
     137                 :       4877 : }
     138                 :            : 
     139                 :          0 : void SdrDragView::TakeActionRect(Rectangle& rRect) const
     140                 :            : {
     141         [ #  # ]:          0 :     if (mpCurrentSdrDragMethod)
     142                 :            :     {
     143                 :          0 :         rRect=aDragStat.GetActionRect();
     144         [ #  # ]:          0 :         if (rRect.IsEmpty())
     145                 :            :         {
     146                 :          0 :             SdrPageView* pPV = GetSdrPageView();
     147                 :            : 
     148 [ #  # ][ #  # ]:          0 :             if(pPV&& pPV->HasMarkedObjPageView())
                 [ #  # ]
     149                 :            :             {
     150                 :            :                 // #i95646# is this used..?
     151         [ #  # ]:          0 :                 const basegfx::B2DRange aBoundRange(mpCurrentSdrDragMethod->getCurrentRange());
     152                 :            :                 rRect = Rectangle(
     153                 :            :                     basegfx::fround(aBoundRange.getMinX()), basegfx::fround(aBoundRange.getMinY()),
     154 [ #  # ][ #  # ]:          0 :                     basegfx::fround(aBoundRange.getMaxX()), basegfx::fround(aBoundRange.getMaxY()));
         [ #  # ][ #  # ]
                 [ #  # ]
     155                 :            :             }
     156                 :            :         }
     157         [ #  # ]:          0 :         if (rRect.IsEmpty())
     158                 :            :         {
     159                 :          0 :             rRect=Rectangle(aDragStat.GetNow(),aDragStat.GetNow());
     160                 :            :         }
     161                 :            :     }
     162                 :            :     else
     163                 :            :     {
     164                 :          0 :         SdrExchangeView::TakeActionRect(rRect);
     165                 :            :     }
     166                 :          0 : }
     167                 :            : 
     168                 :          0 : sal_Bool SdrDragView::TakeDragObjAnchorPos(Point& rPos, sal_Bool bTR ) const
     169                 :            : {
     170         [ #  # ]:          0 :     Rectangle aR;
     171         [ #  # ]:          0 :     TakeActionRect(aR);
     172 [ #  # ][ #  # ]:          0 :     rPos = bTR ? aR.TopRight() : aR.TopLeft();
     173 [ #  # ][ #  #  :          0 :     if (GetMarkedObjectCount()==1 && IsDragObj() && // only on single selection
             #  #  #  # ]
         [ #  # ][ #  # ]
     174                 :          0 :         !IsDraggingPoints() && !IsDraggingGluePoints() && // not when moving points
     175 [ #  # ][ #  # ]:          0 :         !mpCurrentSdrDragMethod->ISA(SdrDragMovHdl)) // not when moving handles
     176                 :            :     {
     177         [ #  # ]:          0 :         SdrObject* pObj=GetMarkedObjectByIndex(0);
     178 [ #  # ][ #  # ]:          0 :         if (pObj->ISA(SdrCaptionObj))
                 [ #  # ]
     179                 :            :         {
     180         [ #  # ]:          0 :             Point aPt(((SdrCaptionObj*)pObj)->GetTailPos());
     181                 :          0 :             sal_Bool bTail=eDragHdl==HDL_POLY; // drag tail
     182 [ #  # ][ #  # ]:          0 :             sal_Bool bOwn=mpCurrentSdrDragMethod->ISA(SdrDragObjOwn); // specific to object
     183         [ #  # ]:          0 :             if (!bTail)
     184                 :            :             { // for bTail, TakeActionRect already does the right thing
     185         [ #  # ]:          0 :                 if (bOwn)
     186                 :            :                 { // bOwn may be MoveTextFrame, ResizeTextFrame, but may not (any more) be DragTail
     187                 :          0 :                     rPos=aPt;
     188                 :            :                 }
     189                 :            :                 else
     190                 :            :                 {
     191                 :            :                     // drag the whole Object (Move, Resize, ...)
     192 [ #  # ][ #  # ]:          0 :                     const basegfx::B2DPoint aTransformed(mpCurrentSdrDragMethod->getCurrentTransformation() * basegfx::B2DPoint(aPt.X(), aPt.Y()));
                 [ #  # ]
     193                 :          0 :                     rPos.X() = basegfx::fround(aTransformed.getX());
     194                 :          0 :                     rPos.Y() = basegfx::fround(aTransformed.getY());
     195                 :            :                 }
     196                 :            :             }
     197                 :            :         }
     198                 :          0 :         return sal_True;
     199                 :            :     }
     200                 :          0 :     return sal_False;
     201                 :            : }
     202                 :            : 
     203                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     204                 :            : 
     205                 :          0 : sal_Bool SdrDragView::TakeDragLimit(SdrDragMode /*eMode*/, Rectangle& /*rRect*/) const
     206                 :            : {
     207                 :          0 :     return sal_False;
     208                 :            : }
     209                 :            : 
     210                 :          0 : sal_Bool SdrDragView::BegDragObj(const Point& rPnt, OutputDevice* pOut, SdrHdl* pHdl, short nMinMov, SdrDragMethod* pForcedMeth)
     211                 :            : {
     212                 :          0 :     BrkAction();
     213                 :            : 
     214                 :          0 :     bool bRet=false;
     215                 :            :     {
     216                 :          0 :         SetDragWithCopy(sal_False);
     217                 :            :         //TODO: aAni.Reset();
     218                 :          0 :         mpCurrentSdrDragMethod=NULL;
     219                 :          0 :         bDragSpecial=sal_False;
     220                 :          0 :         bDragLimit=sal_False;
     221                 :          0 :         SdrDragMode eTmpMode=eDragMode;
     222 [ #  # ][ #  # ]:          0 :         if (eTmpMode==SDRDRAG_MOVE && pHdl!=NULL && pHdl->GetKind()!=HDL_MOVE) {
         [ #  # ][ #  # ]
     223                 :          0 :             eTmpMode=SDRDRAG_RESIZE;
     224                 :            :         }
     225         [ #  # ]:          0 :         bDragLimit=TakeDragLimit(eTmpMode,aDragLimit);
     226         [ #  # ]:          0 :         bFramDrag=ImpIsFrameHandles();
     227 [ #  # ][ #  # ]:          0 :         if (!bFramDrag &&
                 [ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
     228         [ #  # ]:          0 :             (pMarkedObj==NULL || !pMarkedObj->hasSpecialDrag()) &&
     229                 :          0 :             (pHdl==NULL || pHdl->GetObj()==NULL)) {
     230                 :          0 :             bFramDrag=sal_True;
     231                 :            :         }
     232                 :            : 
     233                 :          0 :         Point aPnt(rPnt);
     234   [ #  #  #  #  :          0 :         if(pHdl == NULL
          #  #  #  #  #  
              # ][ #  # ]
     235                 :          0 :             || pHdl->GetKind() == HDL_MOVE
     236                 :          0 :             || pHdl->GetKind() == HDL_MIRX
     237                 :          0 :             || pHdl->GetKind() == HDL_TRNS
     238                 :          0 :             || pHdl->GetKind() == HDL_GRAD)
     239                 :            :         {
     240         [ #  # ]:          0 :             aDragStat.Reset(aPnt);
     241                 :            :         }
     242                 :            :         else
     243                 :            :         {
     244         [ #  # ]:          0 :             aDragStat.Reset(pHdl->GetPos());
     245                 :            :         }
     246                 :            : 
     247                 :          0 :         aDragStat.SetView((SdrView*)this);
     248                 :          0 :         aDragStat.SetPageView(pMarkedPV);  // <<-- DragPV has to go here!!!
     249         [ #  # ]:          0 :         aDragStat.SetMinMove(ImpGetMinMovLogic(nMinMov,pOut));
     250                 :          0 :         aDragStat.SetHdl(pHdl);
     251         [ #  # ]:          0 :         aDragStat.NextPoint();
     252                 :          0 :         pDragWin=pOut;
     253                 :          0 :         pDragHdl=pHdl;
     254         [ #  # ]:          0 :         eDragHdl= pHdl==NULL ? HDL_MOVE : pHdl->GetKind();
     255 [ #  # ][ #  # ]:          0 :         bDragHdl=eDragHdl==HDL_REF1 || eDragHdl==HDL_REF2 || eDragHdl==HDL_MIRX;
                 [ #  # ]
     256                 :            : 
     257                 :            :         // Expand test for HDL_ANCHOR_TR
     258 [ #  # ][ #  # ]:          0 :         sal_Bool bNotDraggable = (HDL_ANCHOR == eDragHdl || HDL_ANCHOR_TR == eDragHdl);
     259                 :            : 
     260 [ #  # ][ #  # ]:          0 :         if(pHdl && (pHdl->GetKind() == HDL_SMARTTAG) && pForcedMeth )
         [ #  # ][ #  # ]
     261                 :            :         {
     262                 :            :             // just use the forced method for smart tags
     263                 :            :         }
     264         [ #  # ]:          0 :         else if(bDragHdl)
     265                 :            :         {
     266 [ #  # ][ #  # ]:          0 :             mpCurrentSdrDragMethod = new SdrDragMovHdl(*this);
     267                 :            :         }
     268         [ #  # ]:          0 :         else if(!bNotDraggable)
     269                 :            :         {
     270   [ #  #  #  #  :          0 :             switch (eDragMode)
                #  #  # ]
     271                 :            :             {
     272                 :            :                 case SDRDRAG_ROTATE: case SDRDRAG_SHEAR: case SDRDRAG_DISTORT:
     273                 :            :                 {
     274      [ #  #  # ]:          0 :                     switch (eDragHdl)
     275                 :            :                     {
     276                 :            :                         case HDL_LEFT:  case HDL_RIGHT:
     277                 :            :                         case HDL_UPPER: case HDL_LOWER:
     278                 :            :                         {
     279                 :            :                             // are 3D objects selected?
     280                 :          0 :                             sal_Bool b3DObjSelected = sal_False;
     281 [ #  # ][ #  # ]:          0 :                             for(sal_uInt32 a=0;!b3DObjSelected && a<GetMarkedObjectCount();a++)
                 [ #  # ]
     282                 :            :                             {
     283         [ #  # ]:          0 :                                 SdrObject* pObj = GetMarkedObjectByIndex(a);
     284 [ #  # ][ #  # ]:          0 :                                 if(pObj && pObj->ISA(E3dObject))
         [ #  # ][ #  # ]
                 [ #  # ]
     285                 :          0 :                                     b3DObjSelected = sal_True;
     286                 :            :                             }
     287                 :            :                             // If yes, allow shear even when !IsShearAllowed,
     288                 :            :                             // because 3D objects are limited rotations
     289 [ #  # ][ #  # ]:          0 :                             if (!b3DObjSelected && !IsShearAllowed())
         [ #  # ][ #  # ]
     290                 :          0 :                                 return sal_False;
     291 [ #  # ][ #  # ]:          0 :                             mpCurrentSdrDragMethod = new SdrDragShear(*this,eDragMode==SDRDRAG_ROTATE);
     292                 :          0 :                         } break;
     293                 :            :                         case HDL_UPLFT: case HDL_UPRGT:
     294                 :            :                         case HDL_LWLFT: case HDL_LWRGT:
     295                 :            :                         {
     296 [ #  # ][ #  # ]:          0 :                             if (eDragMode==SDRDRAG_SHEAR || eDragMode==SDRDRAG_DISTORT)
     297                 :            :                             {
     298 [ #  # ][ #  # ]:          0 :                                 if (!IsDistortAllowed(sal_True) && !IsDistortAllowed(sal_False)) return sal_False;
         [ #  # ][ #  # ]
                 [ #  # ]
     299 [ #  # ][ #  # ]:          0 :                                 mpCurrentSdrDragMethod = new SdrDragDistort(*this);
     300                 :            :                             }
     301                 :            :                             else
     302                 :            :                             {
     303 [ #  # ][ #  # ]:          0 :                                 if (!IsRotateAllowed(sal_True)) return sal_False;
     304 [ #  # ][ #  # ]:          0 :                                 mpCurrentSdrDragMethod = new SdrDragRotate(*this);
     305                 :            :                             }
     306                 :          0 :                         } break;
     307                 :            :                         default:
     308                 :            :                         {
     309 [ #  # ][ #  # ]:          0 :                             if (IsMarkedHitMovesAlways() && eDragHdl==HDL_MOVE)
                 [ #  # ]
     310                 :            :                             { // HDL_MOVE is true, even if Obj is hit directly
     311 [ #  # ][ #  # ]:          0 :                                 if (!IsMoveAllowed()) return sal_False;
     312 [ #  # ][ #  # ]:          0 :                                 mpCurrentSdrDragMethod = new SdrDragMove(*this);
     313                 :            :                             }
     314                 :            :                             else
     315                 :            :                             {
     316 [ #  # ][ #  # ]:          0 :                                 if (!IsRotateAllowed(sal_True)) return sal_False;
     317 [ #  # ][ #  # ]:          0 :                                 mpCurrentSdrDragMethod = new SdrDragRotate(*this);
     318                 :            :                             }
     319                 :            :                         }
     320                 :            :                     }
     321                 :          0 :                 } break;
     322                 :            :                 case SDRDRAG_MIRROR:
     323                 :            :                 {
     324 [ #  # ][ #  # ]:          0 :                     if (eDragHdl==HDL_MOVE && IsMarkedHitMovesAlways())
                 [ #  # ]
     325                 :            :                     {
     326 [ #  # ][ #  # ]:          0 :                         if (!IsMoveAllowed()) return sal_False;
     327 [ #  # ][ #  # ]:          0 :                         mpCurrentSdrDragMethod = new SdrDragMove(*this);
     328                 :            :                     }
     329                 :            :                     else
     330                 :            :                     {
     331 [ #  # ][ #  # ]:          0 :                         if (!IsMirrorAllowed(sal_True,sal_True)) return sal_False;
     332 [ #  # ][ #  # ]:          0 :                         mpCurrentSdrDragMethod = new SdrDragMirror(*this);
     333                 :            :                     }
     334                 :          0 :                 } break;
     335                 :            : 
     336                 :            :                 case SDRDRAG_CROP:
     337                 :            :                 {
     338 [ #  # ][ #  # ]:          0 :                     if (eDragHdl==HDL_MOVE && IsMarkedHitMovesAlways())
                 [ #  # ]
     339                 :            :                     {
     340 [ #  # ][ #  # ]:          0 :                         if (!IsMoveAllowed())
     341                 :          0 :                             return sal_False;
     342 [ #  # ][ #  # ]:          0 :                         mpCurrentSdrDragMethod = new SdrDragMove(*this);
     343                 :            :                     }
     344                 :            :                     else
     345                 :            :                     {
     346 [ #  # ][ #  # ]:          0 :                         if (!IsCrookAllowed(sal_True) && !IsCrookAllowed(sal_False))
         [ #  # ][ #  # ]
                 [ #  # ]
     347                 :          0 :                             return sal_False;
     348 [ #  # ][ #  # ]:          0 :                         mpCurrentSdrDragMethod = new SdrDragCrop(*this);
     349                 :            :                     }
     350                 :            :                 }
     351                 :          0 :                 break;
     352                 :            : 
     353                 :            :                 case SDRDRAG_TRANSPARENCE:
     354                 :            :                 {
     355 [ #  # ][ #  # ]:          0 :                     if(eDragHdl == HDL_MOVE && IsMarkedHitMovesAlways())
                 [ #  # ]
     356                 :            :                     {
     357 [ #  # ][ #  # ]:          0 :                         if(!IsMoveAllowed())
     358                 :          0 :                             return sal_False;
     359 [ #  # ][ #  # ]:          0 :                         mpCurrentSdrDragMethod = new SdrDragMove(*this);
     360                 :            :                     }
     361                 :            :                     else
     362                 :            :                     {
     363 [ #  # ][ #  # ]:          0 :                         if(!IsTransparenceAllowed())
     364                 :          0 :                             return sal_False;
     365                 :            : 
     366 [ #  # ][ #  # ]:          0 :                         mpCurrentSdrDragMethod = new SdrDragGradient(*this, sal_False);
     367                 :            :                     }
     368                 :          0 :                     break;
     369                 :            :                 }
     370                 :            :                 case SDRDRAG_GRADIENT:
     371                 :            :                 {
     372 [ #  # ][ #  # ]:          0 :                     if(eDragHdl == HDL_MOVE && IsMarkedHitMovesAlways())
                 [ #  # ]
     373                 :            :                     {
     374 [ #  # ][ #  # ]:          0 :                         if(!IsMoveAllowed())
     375                 :          0 :                             return sal_False;
     376 [ #  # ][ #  # ]:          0 :                         mpCurrentSdrDragMethod = new SdrDragMove(*this);
     377                 :            :                     }
     378                 :            :                     else
     379                 :            :                     {
     380 [ #  # ][ #  # ]:          0 :                         if(!IsGradientAllowed())
     381                 :          0 :                             return sal_False;
     382                 :            : 
     383 [ #  # ][ #  # ]:          0 :                         mpCurrentSdrDragMethod = new SdrDragGradient(*this);
     384                 :            :                     }
     385                 :          0 :                     break;
     386                 :            :                 }
     387                 :            : 
     388                 :            :                 case SDRDRAG_CROOK :
     389                 :            :                 {
     390 [ #  # ][ #  # ]:          0 :                     if (eDragHdl==HDL_MOVE && IsMarkedHitMovesAlways())
                 [ #  # ]
     391                 :            :                     {
     392 [ #  # ][ #  # ]:          0 :                         if (!IsMoveAllowed()) return sal_False;
     393 [ #  # ][ #  # ]:          0 :                         mpCurrentSdrDragMethod = new SdrDragMove(*this);
     394                 :            :                     }
     395                 :            :                     else
     396                 :            :                     {
     397 [ #  # ][ #  # ]:          0 :                         if (!IsCrookAllowed(sal_True) && !IsCrookAllowed(sal_False)) return sal_False;
         [ #  # ][ #  # ]
                 [ #  # ]
     398 [ #  # ][ #  # ]:          0 :                         mpCurrentSdrDragMethod = new SdrDragCrook(*this);
     399                 :            :                     }
     400                 :          0 :                 } break;
     401                 :            : 
     402                 :            :                 default:
     403                 :            :                 {
     404                 :            :                     // SDRDRAG_MOVE
     405 [ #  # ][ #  # ]:          0 :                     if((eDragHdl == HDL_MOVE) && !IsMoveAllowed())
         [ #  # ][ #  # ]
     406                 :            :                     {
     407                 :          0 :                         return sal_False;
     408                 :            :                     }
     409         [ #  # ]:          0 :                     else if(eDragHdl == HDL_GLUE)
     410                 :            :                     {
     411 [ #  # ][ #  # ]:          0 :                         mpCurrentSdrDragMethod = new SdrDragMove(*this);
     412                 :            :                     }
     413                 :            :                     else
     414                 :            :                     {
     415         [ #  # ]:          0 :                         if(bFramDrag)
     416                 :            :                         {
     417         [ #  # ]:          0 :                             if(eDragHdl == HDL_MOVE)
     418                 :            :                             {
     419 [ #  # ][ #  # ]:          0 :                                 mpCurrentSdrDragMethod = new SdrDragMove(*this);
     420                 :            :                             }
     421                 :            :                             else
     422                 :            :                             {
     423 [ #  # ][ #  # ]:          0 :                                 if(!IsResizeAllowed(sal_True))
     424                 :            :                                 {
     425                 :          0 :                                     return sal_False;
     426                 :            :                                 }
     427                 :            : 
     428                 :          0 :                                 sal_Bool bSingleTextObjMark = sal_False;    // SJ: #i100490#
     429         [ #  # ]:          0 :                                 if ( GetMarkedObjectCount() == 1 )
     430                 :            :                                 {
     431         [ #  # ]:          0 :                                     pMarkedObj=GetMarkedObjectByIndex(0);
     432         [ #  # ]:          0 :                                     if ( pMarkedObj &&
           [ #  #  #  # ]
                 [ #  # ]
     433 [ #  # ][ #  # ]:          0 :                                         pMarkedObj->ISA( SdrTextObj ) &&
     434                 :          0 :                                         static_cast<SdrTextObj*>(pMarkedObj)->IsTextFrame() )
     435                 :          0 :                                         bSingleTextObjMark = sal_True;
     436                 :            :                                 }
     437         [ #  # ]:          0 :                                 if ( bSingleTextObjMark )
     438 [ #  # ][ #  # ]:          0 :                                     mpCurrentSdrDragMethod = new SdrDragObjOwn(*this);
     439                 :            :                                 else
     440 [ #  # ][ #  # ]:          0 :                                     mpCurrentSdrDragMethod = new SdrDragResize(*this);
     441                 :            :                             }
     442                 :            :                         }
     443                 :            :                         else
     444                 :            :                         {
     445         [ #  # ]:          0 :                             if(HDL_MOVE == eDragHdl)
     446                 :            :                             {
     447 [ #  # ][ #  # ]:          0 :                                 const bool bCustomShapeSelected(1 == GetMarkedObjectCount() && GetMarkedObjectByIndex(0)->ISA(SdrObjCustomShape));
         [ #  # ][ #  # ]
                 [ #  # ]
     448                 :            : 
     449         [ #  # ]:          0 :                                 if(bCustomShapeSelected)
     450                 :            :                                 {
     451 [ #  # ][ #  # ]:          0 :                                     mpCurrentSdrDragMethod = new SdrDragMove( *this );
     452                 :            :                                 }
     453                 :            :                             }
     454         [ #  # ]:          0 :                             else if(HDL_POLY == eDragHdl)
     455                 :            :                             {
     456 [ #  # ][ #  # ]:          0 :                                 const bool bConnectorSelected(1 == GetMarkedObjectCount() && GetMarkedObjectByIndex(0)->ISA(SdrEdgeObj));
         [ #  # ][ #  # ]
                 [ #  # ]
     457                 :            : 
     458         [ #  # ]:          0 :                                 if(bConnectorSelected)
     459                 :            :                                 {
     460                 :            :                                     // #i97784#
     461                 :            :                                     // fallback to old behaviour for connectors (see
     462                 :            :                                     // text in task description for more details)
     463                 :            :                                 }
     464 [ #  # ][ #  # ]:          0 :                                 else if(!IsMoveAllowed() || !IsResizeAllowed())
         [ #  # ][ #  # ]
                 [ #  # ]
     465                 :            :                                 {
     466                 :            :                                     // #i77187#
     467                 :            :                                     // do not allow move of polygon points if object is move or size protected
     468                 :          0 :                                     return sal_False;
     469                 :            :                                 }
     470                 :            :                             }
     471                 :            : 
     472         [ #  # ]:          0 :                             if(!mpCurrentSdrDragMethod)
     473                 :            :                             {
     474                 :            :                                 // fallback to DragSpecial if no interaction defined
     475                 :          0 :                                 bDragSpecial = sal_True;
     476 [ #  # ][ #  # ]:          0 :                                 mpCurrentSdrDragMethod = new SdrDragObjOwn(*this);
     477                 :            :                             }
     478                 :            :                         }
     479                 :            :                     }
     480                 :            :                 }
     481                 :            :             }
     482                 :            :         }
     483         [ #  # ]:          0 :         if (pForcedMeth!=NULL)
     484                 :            :         {
     485 [ #  # ][ #  # ]:          0 :             delete mpCurrentSdrDragMethod;
     486                 :          0 :             mpCurrentSdrDragMethod = pForcedMeth;
     487                 :            :         }
     488                 :          0 :         aDragStat.SetDragMethod(mpCurrentSdrDragMethod);
     489         [ #  # ]:          0 :         if (mpCurrentSdrDragMethod)
     490                 :            :         {
     491         [ #  # ]:          0 :             bRet = mpCurrentSdrDragMethod->BeginSdrDrag();
     492         [ #  # ]:          0 :             if (!bRet)
     493                 :            :             {
     494 [ #  # ][ #  # ]:          0 :                 if (pHdl==NULL && IS_TYPE(SdrDragObjOwn,mpCurrentSdrDragMethod))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     495                 :            :                 {
     496                 :            :                     // Obj may not Move SpecialDrag, so try with MoveFrameDrag
     497 [ #  # ][ #  # ]:          0 :                     delete mpCurrentSdrDragMethod;
     498                 :          0 :                     mpCurrentSdrDragMethod = 0;
     499                 :          0 :                     bDragSpecial=sal_False;
     500                 :            : 
     501 [ #  # ][ #  # ]:          0 :                     if (!IsMoveAllowed())
     502                 :          0 :                         return sal_False;
     503                 :            : 
     504                 :          0 :                     bFramDrag=sal_True;
     505 [ #  # ][ #  # ]:          0 :                     mpCurrentSdrDragMethod = new SdrDragMove(*this);
     506                 :          0 :                     aDragStat.SetDragMethod(mpCurrentSdrDragMethod);
     507         [ #  # ]:          0 :                     bRet = mpCurrentSdrDragMethod->BeginSdrDrag();
     508                 :            :                 }
     509                 :            :             }
     510         [ #  # ]:          0 :             if (!bRet)
     511                 :            :             {
     512 [ #  # ][ #  # ]:          0 :                 delete mpCurrentSdrDragMethod;
     513                 :          0 :                 mpCurrentSdrDragMethod = 0;
     514                 :          0 :                 aDragStat.SetDragMethod(mpCurrentSdrDragMethod);
     515                 :            :             }
     516                 :            :         }
     517                 :            :     }
     518                 :            : 
     519                 :          0 :     return bRet;
     520                 :            : }
     521                 :            : 
     522                 :          0 : void SdrDragView::MovDragObj(const Point& rPnt)
     523                 :            : {
     524         [ #  # ]:          0 :     if (mpCurrentSdrDragMethod)
     525                 :            :     {
     526                 :          0 :         Point aPnt(rPnt);
     527         [ #  # ]:          0 :         ImpLimitToWorkArea(aPnt);
     528         [ #  # ]:          0 :         mpCurrentSdrDragMethod->MoveSdrDrag(aPnt); // this call already makes a Hide()/Show combination
     529                 :            :     }
     530                 :          0 : }
     531                 :            : 
     532                 :          0 : sal_Bool SdrDragView::EndDragObj(sal_Bool bCopy)
     533                 :            : {
     534                 :          0 :     bool bRet(false);
     535                 :            : 
     536                 :            :     // #i73341# If inserting GluePoint, do not insist on last points being different
     537 [ #  # ][ #  # ]:          0 :     if(mpCurrentSdrDragMethod && aDragStat.IsMinMoved() && (IsInsertGluePoint() || aDragStat.GetNow() != aDragStat.GetPrev()))
         [ #  # ][ #  # ]
                 [ #  # ]
     538                 :            :     {
     539                 :          0 :         sal_uIntPtr nHdlAnzMerk=0;
     540                 :            : 
     541         [ #  # ]:          0 :         if (bEliminatePolyPoints)
     542                 :            :         { // IBM Special
     543                 :          0 :             nHdlAnzMerk=GetMarkablePointCount();
     544                 :            :         }
     545                 :            : 
     546                 :          0 :         const bool bUndo = IsUndoEnabled();
     547 [ #  # ][ #  # ]:          0 :         if (IsInsertGluePoint() && bUndo)
                 [ #  # ]
     548                 :            :         {
     549         [ #  # ]:          0 :             BegUndo(aInsPointUndoStr);
     550                 :          0 :             AddUndo(pInsPointUndo);
     551                 :            :         }
     552                 :            : 
     553                 :          0 :         bRet = mpCurrentSdrDragMethod->EndSdrDrag(bCopy);
     554                 :            : 
     555 [ #  # ][ #  # ]:          0 :         if( IsInsertGluePoint() && bUndo)
                 [ #  # ]
     556                 :          0 :             EndUndo();
     557                 :            : 
     558         [ #  # ]:          0 :         delete mpCurrentSdrDragMethod;
     559                 :          0 :         mpCurrentSdrDragMethod = 0;
     560                 :            : 
     561         [ #  # ]:          0 :         if (bEliminatePolyPoints)
     562                 :            :         { // IBM Special
     563         [ #  # ]:          0 :             if (nHdlAnzMerk!=GetMarkablePointCount())
     564                 :            :             {
     565                 :          0 :                 UnmarkAllPoints();
     566                 :            :             }
     567                 :            :         }
     568                 :            : 
     569         [ #  # ]:          0 :         if (bInsPolyPoint)
     570                 :            :         {
     571                 :          0 :             SetMarkHandles();
     572                 :          0 :             bInsPolyPoint=sal_False;
     573         [ #  # ]:          0 :             if( bUndo )
     574                 :            :             {
     575         [ #  # ]:          0 :                 BegUndo(aInsPointUndoStr);
     576                 :          0 :                 AddUndo(pInsPointUndo);
     577                 :          0 :                 EndUndo();
     578                 :            :             }
     579                 :            :         }
     580                 :            : 
     581                 :          0 :         eDragHdl=HDL_MOVE;
     582                 :          0 :         pDragHdl=NULL;
     583                 :            : 
     584         [ #  # ]:          0 :         if (!bSomeObjChgdFlag)
     585                 :            :         {
     586                 :            :             // Obj did not broadcast (e. g. Writer FlyFrames)
     587         [ #  # ]:          0 :             if(!bDragHdl)
     588                 :            :             {
     589                 :          0 :                 AdjustMarkHdl();
     590                 :            :             }
     591                 :            :         }
     592                 :            :     }
     593                 :            :     else
     594                 :            :     {
     595                 :          0 :         BrkDragObj();
     596                 :            :     }
     597                 :            : 
     598                 :          0 :     bInsPolyPoint=sal_False;
     599                 :          0 :     SetInsertGluePoint(sal_False);
     600                 :            : 
     601                 :          0 :     return bRet;
     602                 :            : }
     603                 :            : 
     604                 :       4877 : void SdrDragView::BrkDragObj()
     605                 :            : {
     606         [ -  + ]:       4877 :     if (mpCurrentSdrDragMethod)
     607                 :            :     {
     608                 :          0 :         mpCurrentSdrDragMethod->CancelSdrDrag();
     609                 :            : 
     610         [ #  # ]:          0 :         delete mpCurrentSdrDragMethod;
     611                 :          0 :         mpCurrentSdrDragMethod = 0;
     612                 :            : 
     613         [ #  # ]:          0 :         if (bInsPolyPoint)
     614                 :            :         {
     615                 :          0 :             pInsPointUndo->Undo(); // delete inserted point again
     616         [ #  # ]:          0 :             delete pInsPointUndo;
     617                 :          0 :             pInsPointUndo=NULL;
     618                 :          0 :             SetMarkHandles();
     619                 :          0 :             bInsPolyPoint=sal_False;
     620                 :            :         }
     621                 :            : 
     622         [ #  # ]:          0 :         if (IsInsertGluePoint())
     623                 :            :         {
     624                 :          0 :             pInsPointUndo->Undo(); // delete inserted glue point again
     625         [ #  # ]:          0 :             delete pInsPointUndo;
     626                 :          0 :             pInsPointUndo=NULL;
     627                 :          0 :             SetInsertGluePoint(sal_False);
     628                 :            :         }
     629                 :            : 
     630                 :          0 :         eDragHdl=HDL_MOVE;
     631                 :          0 :         pDragHdl=NULL;
     632                 :            :     }
     633                 :       4877 : }
     634                 :            : 
     635                 :          0 : sal_Bool SdrDragView::IsInsObjPointPossible() const
     636                 :            : {
     637 [ #  # ][ #  # ]:          0 :     return pMarkedObj!=NULL && pMarkedObj->IsPolyObj();
     638                 :            : }
     639                 :            : 
     640                 :          0 : sal_Bool SdrDragView::ImpBegInsObjPoint(sal_Bool bIdxZwang, sal_uInt32 nIdx, const Point& rPnt, sal_Bool bNewObj, OutputDevice* pOut)
     641                 :            : {
     642                 :          0 :     sal_Bool bRet(sal_False);
     643                 :            : 
     644 [ #  # ][ #  # ]:          0 :     if(pMarkedObj && pMarkedObj->ISA(SdrPathObj))
                 [ #  # ]
     645                 :            :     {
     646                 :          0 :         SdrPathObj* pMarkedPath = (SdrPathObj*)pMarkedObj;
     647         [ #  # ]:          0 :         BrkAction();
     648 [ #  # ][ #  # ]:          0 :         pInsPointUndo = dynamic_cast< SdrUndoGeoObj* >( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pMarkedObj) );
                 [ #  # ]
     649                 :            :         DBG_ASSERT( pInsPointUndo, "svx::SdrDragView::BegInsObjPoint(), could not create correct undo object!" );
     650                 :            : 
     651         [ #  # ]:          0 :         XubString aStr(ImpGetResStr(STR_DragInsertPoint));
     652         [ #  # ]:          0 :         XubString aName;
     653         [ #  # ]:          0 :         pMarkedObj->TakeObjNameSingul(aName);
     654         [ #  # ]:          0 :         xub_StrLen nPos(aStr.SearchAscii("%1"));
     655                 :            : 
     656         [ #  # ]:          0 :         if(STRING_NOTFOUND != nPos)
     657                 :            :         {
     658         [ #  # ]:          0 :             aStr.Erase(nPos, 2);
     659         [ #  # ]:          0 :             aStr.Insert(aName, nPos);
     660                 :            :         }
     661                 :            : 
     662         [ #  # ]:          0 :         aInsPointUndoStr = aStr;
     663                 :          0 :         Point aPt(rPnt);
     664                 :            : 
     665         [ #  # ]:          0 :         if(bNewObj)
     666         [ #  # ]:          0 :             aPt = GetSnapPos(aPt,pMarkedPV);
     667                 :            : 
     668         [ #  # ]:          0 :         bool bClosed0 = pMarkedPath->IsClosedObj();
     669                 :            : 
     670         [ #  # ]:          0 :         if(bIdxZwang)
     671                 :            :         {
     672         [ #  # ]:          0 :             mnInsPointNum = pMarkedPath->NbcInsPoint(nIdx, aPt, bNewObj, sal_True);
     673                 :            :         }
     674                 :            :         else
     675                 :            :         {
     676         [ #  # ]:          0 :             mnInsPointNum = pMarkedPath->NbcInsPointOld(aPt, bNewObj, sal_True);
     677                 :            :         }
     678                 :            : 
     679 [ #  # ][ #  # ]:          0 :         if(bClosed0 != pMarkedPath->IsClosedObj())
     680                 :            :         {
     681                 :            :             // Obj was closed implicitly
     682                 :            :             // object changed
     683         [ #  # ]:          0 :             pMarkedPath->SetChanged();
     684         [ #  # ]:          0 :             pMarkedPath->BroadcastObjectChange();
     685                 :            :         }
     686                 :            : 
     687         [ #  # ]:          0 :         if(0xffffffff != mnInsPointNum)
     688                 :            :         {
     689                 :          0 :             bInsPolyPoint = sal_True;
     690         [ #  # ]:          0 :             UnmarkAllPoints();
     691         [ #  # ]:          0 :             AdjustMarkHdl();
     692                 :            : 
     693 [ #  # ][ #  # ]:          0 :             bRet = BegDragObj(rPnt, pOut, aHdl.GetHdl(mnInsPointNum), 0);
     694                 :            : 
     695         [ #  # ]:          0 :             if (bRet)
     696                 :            :             {
     697                 :          0 :                 aDragStat.SetMinMoved();
     698         [ #  # ]:          0 :                 MovDragObj(rPnt);
     699                 :            :             }
     700                 :            :         }
     701                 :            :         else
     702                 :            :         {
     703 [ #  # ][ #  # ]:          0 :             delete pInsPointUndo;
     704                 :          0 :             pInsPointUndo = NULL;
     705 [ #  # ][ #  # ]:          0 :         }
     706                 :            :     }
     707                 :            : 
     708                 :          0 :     return bRet;
     709                 :            : }
     710                 :            : 
     711                 :          0 : sal_Bool SdrDragView::EndInsObjPoint(SdrCreateCmd eCmd)
     712                 :            : {
     713         [ #  # ]:          0 :     if(IsInsObjPoint())
     714                 :            :     {
     715                 :          0 :         sal_uInt32 nNextPnt(mnInsPointNum);
     716         [ #  # ]:          0 :         Point aPnt(aDragStat.GetNow());
     717         [ #  # ]:          0 :         sal_Bool bOk=EndDragObj(sal_False);
     718 [ #  # ][ #  # ]:          0 :         if (bOk==sal_True && eCmd!=SDRCREATE_FORCEEND)
     719                 :            :         {
     720                 :            :             // Ret=True means: Action is over.
     721         [ #  # ]:          0 :             bOk=!(ImpBegInsObjPoint(sal_True, nNextPnt, aPnt, eCmd == SDRCREATE_NEXTOBJECT, pDragWin));
     722                 :            :         }
     723                 :            : 
     724                 :          0 :         return bOk;
     725                 :          0 :     } else return sal_False;
     726                 :            : }
     727                 :            : 
     728                 :          0 : sal_Bool SdrDragView::IsInsGluePointPossible() const
     729                 :            : {
     730                 :          0 :     sal_Bool bRet=sal_False;
     731 [ #  # ][ #  # ]:          0 :     if (IsInsGluePointMode() && AreObjectsMarked())
                 [ #  # ]
     732                 :            :     {
     733         [ #  # ]:          0 :         if (GetMarkedObjectCount()==1)
     734                 :            :         {
     735                 :            :             // return sal_False, if only 1 object which is a connector.
     736                 :          0 :             const SdrObject* pObj=GetMarkedObjectByIndex(0);
     737 [ #  # ][ #  # ]:          0 :             if (!HAS_BASE(SdrEdgeObj,pObj))
                 [ #  # ]
     738                 :            :             {
     739                 :          0 :                bRet=sal_True;
     740                 :            :             }
     741                 :            :         }
     742                 :            :         else
     743                 :            :         {
     744                 :          0 :             bRet=sal_True;
     745                 :            :         }
     746                 :            :     }
     747                 :          0 :     return bRet;
     748                 :            : }
     749                 :            : 
     750                 :          0 : sal_Bool SdrDragView::BegInsGluePoint(const Point& rPnt)
     751                 :            : {
     752                 :          0 :     sal_Bool bRet=sal_False;
     753                 :            :     SdrObject* pObj;
     754                 :            :     SdrPageView* pPV;
     755                 :            :     sal_uIntPtr nMarkNum;
     756 [ #  # ][ #  # ]:          0 :     if (PickMarkedObj(rPnt,pObj,pPV,&nMarkNum,SDRSEARCH_PASS2BOUND))
     757                 :            :     {
     758         [ #  # ]:          0 :         BrkAction();
     759         [ #  # ]:          0 :         UnmarkAllGluePoints();
     760 [ #  # ][ #  # ]:          0 :         pInsPointUndo= dynamic_cast< SdrUndoGeoObj* >( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj) );
                 [ #  # ]
     761                 :            :         DBG_ASSERT( pInsPointUndo, "svx::SdrDragView::BegInsObjPoint(), could not create correct undo object!" );
     762         [ #  # ]:          0 :         XubString aStr(ImpGetResStr(STR_DragInsertGluePoint));
     763 [ #  # ][ #  # ]:          0 :         XubString aName; pObj->TakeObjNameSingul(aName);
     764                 :            : 
     765         [ #  # ]:          0 :         aStr.SearchAndReplaceAscii("%1", aName);
     766                 :            : 
     767         [ #  # ]:          0 :         aInsPointUndoStr=aStr;
     768         [ #  # ]:          0 :         SdrGluePointList* pGPL=pObj->ForceGluePointList();
     769         [ #  # ]:          0 :         if (pGPL!=NULL)
     770                 :            :         {
     771         [ #  # ]:          0 :             sal_uInt16 nGlueIdx=pGPL->Insert(SdrGluePoint());
     772         [ #  # ]:          0 :             SdrGluePoint& rGP=(*pGPL)[nGlueIdx];
     773                 :          0 :             sal_uInt16 nGlueId=rGP.GetId();
     774         [ #  # ]:          0 :             rGP.SetAbsolutePos(rPnt,*pObj);
     775                 :            : 
     776                 :          0 :             SdrHdl* pHdl=NULL;
     777 [ #  # ][ #  # ]:          0 :             if (MarkGluePoint(pObj,nGlueId,pPV))
     778                 :            :             {
     779         [ #  # ]:          0 :                 pHdl=GetGluePointHdl(pObj,nGlueId);
     780                 :            :             }
     781 [ #  # ][ #  # ]:          0 :             if (pHdl!=NULL && pHdl->GetKind()==HDL_GLUE && pHdl->GetObj()==pObj && pHdl->GetObjHdlNum()==nGlueId)
         [ #  # ][ #  # ]
                 [ #  # ]
     782                 :            :             {
     783                 :          0 :                 SetInsertGluePoint(sal_True);
     784         [ #  # ]:          0 :                 bRet=BegDragObj(rPnt,NULL,pHdl,0);
     785         [ #  # ]:          0 :                 if (bRet)
     786                 :            :                 {
     787                 :          0 :                     aDragStat.SetMinMoved();
     788         [ #  # ]:          0 :                     MovDragObj(rPnt);
     789                 :            :                 }
     790                 :            :                 else
     791                 :            :                 {
     792                 :          0 :                     SetInsertGluePoint(sal_False);
     793 [ #  # ][ #  # ]:          0 :                     delete pInsPointUndo;
     794                 :          0 :                     pInsPointUndo=NULL;
     795                 :            :                 }
     796                 :            :             }
     797                 :            :             else
     798                 :            :             {
     799                 :            :                 OSL_FAIL("BegInsGluePoint(): GluePoint handle not found.");
     800                 :            :             }
     801                 :            :         }
     802                 :            :         else
     803                 :            :         {
     804                 :            :             // no glue points possible for this object (e. g. Edge)
     805                 :          0 :             SetInsertGluePoint(sal_False);
     806 [ #  # ][ #  # ]:          0 :             delete pInsPointUndo;
     807                 :          0 :             pInsPointUndo=NULL;
     808 [ #  # ][ #  # ]:          0 :         }
     809                 :            :     }
     810                 :            : 
     811                 :          0 :     return bRet;
     812                 :            : }
     813                 :            : 
     814                 :          0 : void SdrDragView::ShowDragObj()
     815                 :            : {
     816 [ #  # ][ #  # ]:          0 :     if(mpCurrentSdrDragMethod && !aDragStat.IsShown())
                 [ #  # ]
     817                 :            :     {
     818         [ #  # ]:          0 :         for(sal_uInt32 a(0); a < PaintWindowCount(); a++)
     819                 :            :         {
     820         [ #  # ]:          0 :             SdrPaintWindow* pCandidate = GetPaintWindow(a);
     821         [ #  # ]:          0 :             rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager = pCandidate->GetOverlayManager();
     822                 :            : 
     823         [ #  # ]:          0 :             if (xOverlayManager.is())
     824                 :            :             {
     825         [ #  # ]:          0 :                 mpCurrentSdrDragMethod->CreateOverlayGeometry(*xOverlayManager);
     826                 :            : 
     827                 :            :                 // #i101679# Force changed overlay to be shown
     828         [ #  # ]:          0 :                 xOverlayManager->flush();
     829                 :            :             }
     830         [ #  # ]:          0 :         }
     831                 :            : 
     832                 :          0 :         aDragStat.SetShown(sal_True);
     833                 :            :     }
     834                 :          0 : }
     835                 :            : 
     836                 :          0 : void SdrDragView::HideDragObj()
     837                 :            : {
     838 [ #  # ][ #  # ]:          0 :     if(mpCurrentSdrDragMethod && aDragStat.IsShown())
                 [ #  # ]
     839                 :            :     {
     840                 :          0 :         mpCurrentSdrDragMethod->destroyOverlayGeometry();
     841                 :          0 :         aDragStat.SetShown(sal_False);
     842                 :            :     }
     843                 :          0 : }
     844                 :            : 
     845                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     846                 :            : 
     847                 :       2023 : void SdrDragView::SetNoDragXorPolys(sal_Bool bOn)
     848                 :            : {
     849         [ +  + ]:       2023 :     if (IsNoDragXorPolys()!=bOn)
     850                 :            :     {
     851                 :         34 :         const bool bDragging(mpCurrentSdrDragMethod);
     852 [ -  + ][ #  # ]:         34 :         const bool bShown(bDragging && aDragStat.IsShown());
     853                 :            : 
     854         [ -  + ]:         34 :         if(bShown)
     855                 :            :         {
     856                 :          0 :             HideDragObj();
     857                 :            :         }
     858                 :            : 
     859                 :         34 :         bNoDragXorPolys = bOn;
     860                 :            : 
     861         [ -  + ]:         34 :         if(bDragging)
     862                 :            :         {
     863                 :            :             // force recreation of drag content
     864                 :          0 :             mpCurrentSdrDragMethod->resetSdrDragEntries();
     865                 :            :         }
     866                 :            : 
     867         [ -  + ]:         34 :         if(bShown)
     868                 :            :         {
     869                 :          0 :             ShowDragObj();
     870                 :            :         }
     871                 :            :     }
     872                 :       2023 : }
     873                 :            : 
     874                 :       2827 : void SdrDragView::SetDragStripes(sal_Bool bOn)
     875                 :            : {
     876 [ -  + ][ #  # ]:       2827 :     if (mpCurrentSdrDragMethod && aDragStat.IsShown())
                 [ -  + ]
     877                 :            :     {
     878                 :          0 :         HideDragObj();
     879                 :          0 :         bDragStripes=bOn;
     880                 :          0 :         ShowDragObj();
     881                 :            :     }
     882                 :            :     else
     883                 :            :     {
     884                 :       2827 :         bDragStripes=bOn;
     885                 :            :     }
     886                 :       2827 : }
     887                 :            : 
     888                 :          0 : sal_Bool SdrDragView::IsOrthoDesired() const
     889                 :            : {
     890 [ #  # ][ #  # ]:          0 :     if(mpCurrentSdrDragMethod && (IS_TYPE(SdrDragObjOwn, mpCurrentSdrDragMethod) || IS_TYPE(SdrDragResize, mpCurrentSdrDragMethod)))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     891                 :            :     {
     892                 :          0 :         return bOrthoDesiredOnMarked;
     893                 :            :     }
     894                 :            : 
     895                 :          0 :     return sal_False;
     896                 :            : }
     897                 :            : 
     898                 :      20058 : void SdrDragView::SetMarkHandles()
     899                 :            : {
     900         [ -  + ]:      20058 :     if( pDragHdl )
     901                 :          0 :         pDragHdl = 0;
     902                 :            : 
     903                 :      20058 :     SdrExchangeView::SetMarkHandles();
     904                 :      20058 : }
     905                 :            : 
     906                 :       1240 : void SdrDragView::SetSolidDragging(bool bOn)
     907                 :            : {
     908         [ -  + ]:       1240 :     if((bool)mbSolidDragging != bOn)
     909                 :            :     {
     910                 :          0 :         mbSolidDragging = bOn;
     911                 :            :     }
     912                 :       1240 : }
     913                 :            : 
     914                 :       2045 : bool SdrDragView::IsSolidDragging() const
     915                 :            : {
     916                 :            :     // allow each user to disable by having a local setting, but using AND for
     917                 :            :     // checking allowance
     918 [ +  - ][ +  - ]:       2045 :     return mbSolidDragging && getOptionsDrawinglayer().IsSolidDragCreate();
     919                 :            : }
     920                 :            : 
     921                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10