LCOV - code coverage report
Current view: top level - svx/source/svdraw - svddrgmt.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1796 0.0 %
Date: 2012-08-25 Functions: 0 196 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 3099 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                 :            : 
      30                 :            : #include "svddrgm1.hxx"
      31                 :            : #include <math.h>
      32                 :            : 
      33                 :            : #ifndef _MATH_H
      34                 :            : #define _MATH_H
      35                 :            : #endif
      36                 :            : #include <tools/bigint.hxx>
      37                 :            : #include <vcl/svapp.hxx>
      38                 :            : 
      39                 :            : #include "svx/xattr.hxx"
      40                 :            : #include <svx/xpoly.hxx>
      41                 :            : #include <svx/svdetc.hxx>
      42                 :            : #include <svx/svdtrans.hxx>
      43                 :            : #include <svx/svdundo.hxx>
      44                 :            : #include <svx/svdmark.hxx>
      45                 :            : #include <svx/svdocapt.hxx>
      46                 :            : #include <svx/svdpagv.hxx>
      47                 :            : #include "svx/svdstr.hrc"   // names taken from the resource
      48                 :            : #include "svx/svdglob.hxx"  // StringCache
      49                 :            : #include <svx/svddrgv.hxx>
      50                 :            : #include <svx/svdograf.hxx>
      51                 :            : #include <svx/dialogs.hrc>
      52                 :            : #include <svx/dialmgr.hxx>
      53                 :            : #include <svx/sdgcpitm.hxx>
      54                 :            : #include <basegfx/polygon/b2dpolygon.hxx>
      55                 :            : #include <basegfx/polygon/b2dpolygontools.hxx>
      56                 :            : #include <svx/sdr/overlay/overlaypolypolygon.hxx>
      57                 :            : #include <svx/sdr/overlay/overlaymanager.hxx>
      58                 :            : #include <svx/sdr/overlay/overlayrollingrectangle.hxx>
      59                 :            : #include <svx/sdrpagewindow.hxx>
      60                 :            : #include <svx/sdrpaintwindow.hxx>
      61                 :            : #include <basegfx/matrix/b2dhommatrix.hxx>
      62                 :            : #include <basegfx/polygon/b2dpolypolygontools.hxx>
      63                 :            : #include <svx/sdr/contact/viewobjectcontact.hxx>
      64                 :            : #include <svx/sdr/contact/viewcontact.hxx>
      65                 :            : #include <svx/sdr/contact/displayinfo.hxx>
      66                 :            : #include <svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx>
      67                 :            : #include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
      68                 :            : #include <svx/sdr/contact/objectcontact.hxx>
      69                 :            : #include "svx/svditer.hxx"
      70                 :            : #include <svx/svdopath.hxx>
      71                 :            : #include <svx/polypolygoneditor.hxx>
      72                 :            : #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
      73                 :            : #include <drawinglayer/primitive2d/transformprimitive2d.hxx>
      74                 :            : #include <drawinglayer/primitive2d/markerarrayprimitive2d.hxx>
      75                 :            : #include <svx/sdr/primitive2d/sdrattributecreator.hxx>
      76                 :            : #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
      77                 :            : #include <svx/svdoole2.hxx>
      78                 :            : #include <svx/svdovirt.hxx>
      79                 :            : #include <svx/svdouno.hxx>
      80                 :            : #include <svx/sdr/primitive2d/sdrprimitivetools.hxx>
      81                 :            : #include <basegfx/matrix/b2dhommatrixtools.hxx>
      82                 :            : #include <drawinglayer/attribute/sdrlineattribute.hxx>
      83                 :            : #include <drawinglayer/attribute/sdrlinestartendattribute.hxx>
      84                 :            : 
      85                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
      86                 :            : 
      87                 :          0 : SdrDragEntry::SdrDragEntry()
      88                 :          0 : :   mbAddToTransparent(false)
      89                 :            : {
      90                 :          0 : }
      91                 :            : 
      92                 :          0 : SdrDragEntry::~SdrDragEntry()
      93                 :            : {
      94         [ #  # ]:          0 : }
      95                 :            : 
      96                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
      97                 :            : 
      98                 :          0 : SdrDragEntryPolyPolygon::SdrDragEntryPolyPolygon(const basegfx::B2DPolyPolygon& rOriginalPolyPolygon)
      99                 :            : :   SdrDragEntry(),
     100         [ #  # ]:          0 :     maOriginalPolyPolygon(rOriginalPolyPolygon)
     101                 :            : {
     102                 :          0 : }
     103                 :            : 
     104         [ #  # ]:          0 : SdrDragEntryPolyPolygon::~SdrDragEntryPolyPolygon()
     105                 :            : {
     106         [ #  # ]:          0 : }
     107                 :            : 
     108                 :          0 : drawinglayer::primitive2d::Primitive2DSequence SdrDragEntryPolyPolygon::createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod)
     109                 :            : {
     110                 :          0 :     drawinglayer::primitive2d::Primitive2DSequence aRetval;
     111                 :            : 
     112 [ #  # ][ #  # ]:          0 :     if(maOriginalPolyPolygon.count())
     113                 :            :     {
     114         [ #  # ]:          0 :         basegfx::B2DPolyPolygon aCopy(maOriginalPolyPolygon);
     115         [ #  # ]:          0 :         const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
     116                 :            : 
     117         [ #  # ]:          0 :         rDragMethod.applyCurrentTransformationToPolyPolygon(aCopy);
     118         [ #  # ]:          0 :         basegfx::BColor aColA(aSvtOptionsDrawinglayer.GetStripeColorA().getBColor());
     119         [ #  # ]:          0 :         basegfx::BColor aColB(aSvtOptionsDrawinglayer.GetStripeColorB().getBColor());
     120         [ #  # ]:          0 :         const double fStripeLength(aSvtOptionsDrawinglayer.GetStripeLength());
     121                 :            : 
     122 [ #  # ][ #  # ]:          0 :         if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
     123                 :            :         {
     124 [ #  # ][ #  # ]:          0 :             aColA = aColB = Application::GetSettings().GetStyleSettings().GetHighlightColor().getBColor();
                 [ #  # ]
     125                 :          0 :             aColB.invert();
     126                 :            :         }
     127                 :            : 
     128                 :            :         drawinglayer::primitive2d::Primitive2DReference aPolyPolygonMarkerPrimitive2D(
     129 [ #  # ][ #  # ]:          0 :             new drawinglayer::primitive2d::PolyPolygonMarkerPrimitive2D(aCopy, aColA, aColB, fStripeLength));
                 [ #  # ]
     130                 :            : 
     131 [ #  # ][ #  # ]:          0 :         aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aPolyPolygonMarkerPrimitive2D, 1);
         [ #  # ][ #  # ]
                 [ #  # ]
     132                 :            :     }
     133                 :            : 
     134                 :          0 :     return aRetval;
     135                 :            : }
     136                 :            : 
     137                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     138                 :            : 
     139                 :          0 : SdrDragEntrySdrObject::SdrDragEntrySdrObject(const SdrObject& rOriginal, sdr::contact::ObjectContact& rObjectContact, bool bModify)
     140                 :            : :   SdrDragEntry(),
     141                 :            :     maOriginal(rOriginal),
     142                 :            :     mpClone(0),
     143                 :            :     mrObjectContact(rObjectContact),
     144                 :          0 :     mbModify(bModify)
     145                 :            : {
     146                 :            :     // add SdrObject parts to transparent overlay stuff
     147                 :          0 :     setAddToTransparent(true);
     148                 :          0 : }
     149                 :            : 
     150                 :          0 : SdrDragEntrySdrObject::~SdrDragEntrySdrObject()
     151                 :            : {
     152         [ #  # ]:          0 :     if(mpClone)
     153                 :            :     {
     154         [ #  # ]:          0 :         SdrObject::Free(mpClone);
     155                 :            :     }
     156         [ #  # ]:          0 : }
     157                 :            : 
     158                 :          0 : drawinglayer::primitive2d::Primitive2DSequence SdrDragEntrySdrObject::createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod)
     159                 :            : {
     160                 :            :     // for the moment, i need to re-create the clone in all cases. I need to figure
     161                 :            :     // out when clone and original have the same class, so that i can use operator=
     162                 :            :     // in those cases
     163                 :            : 
     164                 :          0 :     const SdrObject* pSource = &maOriginal;
     165                 :            : 
     166         [ #  # ]:          0 :     if(mpClone)
     167                 :            :     {
     168         [ #  # ]:          0 :         SdrObject::Free(mpClone);
     169                 :          0 :         mpClone = 0;
     170                 :            :     }
     171                 :            : 
     172         [ #  # ]:          0 :     if(mbModify)
     173                 :            :     {
     174         [ #  # ]:          0 :         if(!mpClone)
     175                 :            :         {
     176         [ #  # ]:          0 :             mpClone = maOriginal.getFullDragClone();
     177                 :            :         }
     178                 :            : 
     179                 :            :         // apply original transformation, implemented at the DragMethods
     180         [ #  # ]:          0 :         rDragMethod.applyCurrentTransformationToSdrObject(*mpClone);
     181                 :            : 
     182                 :            :         // choose source for geometry data
     183                 :          0 :         pSource = mpClone;
     184                 :            :     }
     185                 :            : 
     186                 :            :     // get VOC and Primitive2DSequence
     187         [ #  # ]:          0 :     sdr::contact::ViewContact& rVC = pSource->GetViewContact();
     188         [ #  # ]:          0 :     sdr::contact::ViewObjectContact& rVOC = rVC.GetViewObjectContact(mrObjectContact);
     189         [ #  # ]:          0 :     sdr::contact::DisplayInfo aDisplayInfo;
     190                 :            : 
     191                 :            :     // Do not use the last ViewPort set at the OC from the last ProcessDisplay(),
     192                 :            :     // here we want the complete primitive sequence without visibility clippings
     193         [ #  # ]:          0 :     mrObjectContact.resetViewPort();
     194                 :            : 
     195 [ #  # ][ #  # ]:          0 :     return rVOC.getPrimitive2DSequenceHierarchy(aDisplayInfo);
     196                 :            : }
     197                 :            : 
     198                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     199                 :            : 
     200                 :          0 : SdrDragEntryPrimitive2DSequence::SdrDragEntryPrimitive2DSequence(
     201                 :            :     const drawinglayer::primitive2d::Primitive2DSequence& rSequence,
     202                 :            :     bool bAddToTransparent)
     203                 :            : :   SdrDragEntry(),
     204         [ #  # ]:          0 :     maPrimitive2DSequence(rSequence)
     205                 :            : {
     206                 :            :     // add parts to transparent overlay stuff if necessary
     207                 :          0 :     setAddToTransparent(bAddToTransparent);
     208                 :          0 : }
     209                 :            : 
     210         [ #  # ]:          0 : SdrDragEntryPrimitive2DSequence::~SdrDragEntryPrimitive2DSequence()
     211                 :            : {
     212         [ #  # ]:          0 : }
     213                 :            : 
     214                 :          0 : drawinglayer::primitive2d::Primitive2DSequence SdrDragEntryPrimitive2DSequence::createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod)
     215                 :            : {
     216                 :            :     drawinglayer::primitive2d::Primitive2DReference aTransformPrimitive2D(
     217                 :            :         new drawinglayer::primitive2d::TransformPrimitive2D(
     218                 :          0 :             rDragMethod.getCurrentTransformation(),
     219 [ #  # ][ #  # ]:          0 :             maPrimitive2DSequence));
         [ #  # ][ #  # ]
                 [ #  # ]
     220                 :            : 
     221         [ #  # ]:          0 :     return drawinglayer::primitive2d::Primitive2DSequence(&aTransformPrimitive2D, 1);
     222                 :            : }
     223                 :            : 
     224                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     225                 :            : 
     226                 :          0 : SdrDragEntryPointGlueDrag::SdrDragEntryPointGlueDrag(const std::vector< basegfx::B2DPoint >& rPositions, bool bIsPointDrag)
     227                 :            : :   maPositions(rPositions),
     228         [ #  # ]:          0 :     mbIsPointDrag(bIsPointDrag)
     229                 :            : {
     230                 :            :     // add SdrObject parts to transparent overlay stuff
     231                 :          0 :     setAddToTransparent(true);
     232                 :          0 : }
     233                 :            : 
     234                 :          0 : SdrDragEntryPointGlueDrag::~SdrDragEntryPointGlueDrag()
     235                 :            : {
     236         [ #  # ]:          0 : }
     237                 :            : 
     238                 :          0 : drawinglayer::primitive2d::Primitive2DSequence SdrDragEntryPointGlueDrag::createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod)
     239                 :            : {
     240                 :          0 :     drawinglayer::primitive2d::Primitive2DSequence aRetval;
     241                 :            : 
     242         [ #  # ]:          0 :     if(!maPositions.empty())
     243                 :            :     {
     244         [ #  # ]:          0 :         basegfx::B2DPolygon aPolygon;
     245                 :          0 :         sal_uInt32 a(0);
     246                 :            : 
     247         [ #  # ]:          0 :         for(a = 0; a < maPositions.size(); a++)
     248                 :            :         {
     249         [ #  # ]:          0 :             aPolygon.append(maPositions[a]);
     250                 :            :         }
     251                 :            : 
     252         [ #  # ]:          0 :         basegfx::B2DPolyPolygon aPolyPolygon(aPolygon);
     253                 :            : 
     254         [ #  # ]:          0 :         rDragMethod.applyCurrentTransformationToPolyPolygon(aPolyPolygon);
     255                 :            : 
     256         [ #  # ]:          0 :         const basegfx::B2DPolygon aTransformed(aPolyPolygon.getB2DPolygon(0));
     257         [ #  # ]:          0 :         std::vector< basegfx::B2DPoint > aTransformedPositions;
     258                 :            : 
     259 [ #  # ][ #  # ]:          0 :         aTransformedPositions.reserve(aTransformed.count());
     260                 :            : 
     261 [ #  # ][ #  # ]:          0 :         for(a = 0; a < aTransformed.count(); a++)
     262                 :            :         {
     263 [ #  # ][ #  # ]:          0 :             aTransformedPositions.push_back(aTransformed.getB2DPoint(a));
     264                 :            :         }
     265                 :            : 
     266         [ #  # ]:          0 :         if(mbIsPointDrag)
     267                 :            :         {
     268         [ #  # ]:          0 :             const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
     269         [ #  # ]:          0 :             basegfx::BColor aColor(aSvtOptionsDrawinglayer.GetStripeColorA().getBColor());
     270                 :            : 
     271 [ #  # ][ #  # ]:          0 :             if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
     272                 :            :             {
     273 [ #  # ][ #  # ]:          0 :                 aColor = Application::GetSettings().GetStyleSettings().GetHighlightColor().getBColor();
     274                 :            :             }
     275                 :            : 
     276                 :            :             drawinglayer::primitive2d::Primitive2DReference aMarkerArrayPrimitive2D(
     277                 :            :                 new drawinglayer::primitive2d::MarkerArrayPrimitive2D(aTransformedPositions,
     278 [ #  # ][ #  # ]:          0 :                     drawinglayer::primitive2d::createDefaultCross_3x3(aColor)));
         [ #  # ][ #  # ]
                 [ #  # ]
     279                 :            : 
     280 [ #  # ][ #  # ]:          0 :             aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aMarkerArrayPrimitive2D, 1);
         [ #  # ][ #  # ]
     281                 :            :         }
     282                 :            :         else
     283                 :            :         {
     284                 :            :             drawinglayer::primitive2d::Primitive2DReference aMarkerArrayPrimitive2D(
     285                 :            :                 new drawinglayer::primitive2d::MarkerArrayPrimitive2D(aTransformedPositions,
     286 [ #  # ][ #  # ]:          0 :                                                                       SdrHdl::createGluePointBitmap()));
         [ #  # ][ #  # ]
                 [ #  # ]
     287 [ #  # ][ #  # ]:          0 :             aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aMarkerArrayPrimitive2D, 1);
                 [ #  # ]
     288 [ #  # ][ #  # ]:          0 :         }
                 [ #  # ]
     289                 :            :     }
     290                 :            : 
     291                 :          0 :     return aRetval;
     292                 :            : }
     293                 :            : 
     294                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     295                 :            : 
     296         [ #  # ]:          0 : TYPEINIT0(SdrDragMethod);
     297                 :            : 
     298                 :          0 : void SdrDragMethod::resetSdrDragEntries()
     299                 :            : {
     300                 :            :     // clear entries; creation is on demand
     301                 :          0 :     clearSdrDragEntries();
     302                 :          0 : }
     303                 :            : 
     304                 :          0 : basegfx::B2DRange SdrDragMethod::getCurrentRange() const
     305                 :            : {
     306                 :          0 :     return getB2DRangeFromOverlayObjectList();
     307                 :            : }
     308                 :            : 
     309                 :          0 : void SdrDragMethod::createSdrDragEntries()
     310                 :            : {
     311 [ #  # ][ #  # ]:          0 :     if(getSdrDragView().GetSdrPageView() && getSdrDragView().GetSdrPageView()->HasMarkedObjPageView())
                 [ #  # ]
     312                 :            :     {
     313         [ #  # ]:          0 :         if(getSdrDragView().IsDraggingPoints())
     314                 :            :         {
     315                 :          0 :             createSdrDragEntries_PointDrag();
     316                 :            :         }
     317         [ #  # ]:          0 :         else if(getSdrDragView().IsDraggingGluePoints())
     318                 :            :         {
     319                 :          0 :             createSdrDragEntries_GlueDrag();
     320                 :            :         }
     321                 :            :         else
     322                 :            :         {
     323         [ #  # ]:          0 :             if(getSolidDraggingActive())
     324                 :            :             {
     325                 :          0 :                 createSdrDragEntries_SolidDrag();
     326                 :            :             }
     327                 :            :             else
     328                 :            :             {
     329                 :          0 :                 createSdrDragEntries_PolygonDrag();
     330                 :            :             }
     331                 :            :         }
     332                 :            :     }
     333                 :          0 : }
     334                 :            : 
     335                 :          0 : void SdrDragMethod::createSdrDragEntryForSdrObject(const SdrObject& rOriginal, sdr::contact::ObjectContact& rObjectContact, bool bModify)
     336                 :            : {
     337                 :            :     // add full object drag; Clone() at the object has to work
     338                 :            :     // for this
     339         [ #  # ]:          0 :     addSdrDragEntry(new SdrDragEntrySdrObject(rOriginal, rObjectContact, bModify));
     340                 :          0 : }
     341                 :            : 
     342                 :          0 : void SdrDragMethod::createSdrDragEntries_SolidDrag()
     343                 :            : {
     344                 :          0 :     const sal_uInt32 nMarkAnz(getSdrDragView().GetMarkedObjectCount());
     345                 :          0 :     SdrPageView* pPV = getSdrDragView().GetSdrPageView();
     346                 :            : 
     347         [ #  # ]:          0 :     if(pPV)
     348                 :            :     {
     349         [ #  # ]:          0 :         for(sal_uInt32 a(0); a < nMarkAnz; a++)
     350                 :            :         {
     351                 :          0 :             SdrMark* pM = getSdrDragView().GetSdrMarkByIndex(a);
     352                 :            : 
     353         [ #  # ]:          0 :             if(pM->GetPageView() == pPV)
     354                 :            :             {
     355                 :          0 :                 const SdrObject* pObject = pM->GetMarkedSdrObj();
     356                 :            : 
     357         [ #  # ]:          0 :                 if(pObject)
     358                 :            :                 {
     359         [ #  # ]:          0 :                     if(pPV->PageWindowCount())
     360                 :            :                     {
     361 [ #  # ][ #  # ]:          0 :                         sdr::contact::ObjectContact& rOC = pPV->GetPageWindow(0)->GetObjectContact();
     362         [ #  # ]:          0 :                         SdrObjListIter aIter(*pObject);
     363                 :            : 
     364         [ #  # ]:          0 :                         while(aIter.IsMore())
     365                 :            :                         {
     366         [ #  # ]:          0 :                             SdrObject* pCandidate = aIter.Next();
     367                 :            : 
     368         [ #  # ]:          0 :                             if(pCandidate)
     369                 :            :                             {
     370         [ #  # ]:          0 :                                 const bool bSuppressFullDrag(!pCandidate->supportsFullDrag());
     371                 :          0 :                                 bool bAddWireframe(bSuppressFullDrag);
     372                 :            : 
     373 [ #  # ][ #  # ]:          0 :                                 if(!bAddWireframe && !pCandidate->HasLineStyle())
         [ #  # ][ #  # ]
     374                 :            :                                 {
     375                 :            :                                     // add wireframe for objects without outline
     376                 :          0 :                                     bAddWireframe = true;
     377                 :            :                                 }
     378                 :            : 
     379         [ #  # ]:          0 :                                 if(!bSuppressFullDrag)
     380                 :            :                                 {
     381                 :            :                                     // add full object drag; Clone() at the object has to work
     382                 :            :                                     // for this
     383         [ #  # ]:          0 :                                     createSdrDragEntryForSdrObject(*pCandidate, rOC, true);
     384                 :            :                                 }
     385                 :            : 
     386         [ #  # ]:          0 :                                 if(bAddWireframe)
     387                 :            :                                 {
     388                 :            :                                     // when dragging a 50% transparent copy of a filled or not filled object without
     389                 :            :                                     // outline, this is normally hard to see. Add extra wireframe in that case. This
     390                 :            :                                     // works nice e.g. with text frames etc.
     391 [ #  # ][ #  # ]:          0 :                                     addSdrDragEntry(new SdrDragEntryPolyPolygon(pCandidate->TakeXorPoly()));
         [ #  # ][ #  # ]
                 [ #  # ]
     392                 :            :                                 }
     393                 :            :                             }
     394                 :          0 :                         }
     395                 :            :                     }
     396                 :            :                 }
     397                 :            :             }
     398                 :            :         }
     399                 :            :     }
     400                 :          0 : }
     401                 :            : 
     402                 :          0 : void SdrDragMethod::createSdrDragEntries_PolygonDrag()
     403                 :            : {
     404                 :          0 :     const sal_uInt32 nMarkAnz(getSdrDragView().GetMarkedObjectCount());
     405 [ #  # ][ #  # ]:          0 :     bool bNoPolygons(getSdrDragView().IsNoDragXorPolys() || nMarkAnz > getSdrDragView().GetDragXorPolyLimit());
     406         [ #  # ]:          0 :     basegfx::B2DPolyPolygon aResult;
     407                 :          0 :     sal_uInt32 nPointCount(0);
     408                 :            : 
     409 [ #  # ][ #  # ]:          0 :     for(sal_uInt32 a(0); !bNoPolygons && a < nMarkAnz; a++)
                 [ #  # ]
     410                 :            :     {
     411         [ #  # ]:          0 :         SdrMark* pM = getSdrDragView().GetSdrMarkByIndex(a);
     412                 :            : 
     413         [ #  # ]:          0 :         if(pM->GetPageView() == getSdrDragView().GetSdrPageView())
     414                 :            :         {
     415 [ #  # ][ #  # ]:          0 :             const basegfx::B2DPolyPolygon aNewPolyPolygon(pM->GetMarkedSdrObj()->TakeXorPoly());
     416                 :            : 
     417 [ #  # ][ #  # ]:          0 :             for(sal_uInt32 b(0); b < aNewPolyPolygon.count(); b++)
     418                 :            :             {
     419 [ #  # ][ #  # ]:          0 :                 nPointCount += aNewPolyPolygon.getB2DPolygon(b).count();
                 [ #  # ]
     420                 :            :             }
     421                 :            : 
     422         [ #  # ]:          0 :             if(nPointCount > getSdrDragView().GetDragXorPointLimit())
     423                 :            :             {
     424                 :          0 :                 bNoPolygons = true;
     425                 :            :             }
     426                 :            : 
     427         [ #  # ]:          0 :             if(!bNoPolygons)
     428                 :            :             {
     429         [ #  # ]:          0 :                 aResult.append(aNewPolyPolygon);
     430         [ #  # ]:          0 :             }
     431                 :            :         }
     432                 :            :     }
     433                 :            : 
     434         [ #  # ]:          0 :     if(bNoPolygons)
     435                 :            :     {
     436                 :          0 :         const Rectangle aR(getSdrDragView().GetSdrPageView()->MarkSnap());
     437         [ #  # ]:          0 :         const basegfx::B2DRange aNewRectangle(aR.Left(), aR.Top(), aR.Right(), aR.Bottom());
     438         [ #  # ]:          0 :         basegfx::B2DPolygon aNewPolygon(basegfx::tools::createPolygonFromRect(aNewRectangle));
     439                 :            : 
     440 [ #  # ][ #  # ]:          0 :         aResult = basegfx::B2DPolyPolygon(basegfx::tools::expandToCurve(aNewPolygon));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     441                 :            :     }
     442                 :            : 
     443 [ #  # ][ #  # ]:          0 :     if(aResult.count())
     444                 :            :     {
     445 [ #  # ][ #  # ]:          0 :         addSdrDragEntry(new SdrDragEntryPolyPolygon(aResult));
                 [ #  # ]
     446         [ #  # ]:          0 :     }
     447                 :          0 : }
     448                 :            : 
     449                 :          0 : void SdrDragMethod::createSdrDragEntries_PointDrag()
     450                 :            : {
     451                 :          0 :     const sal_uInt32 nMarkAnz(getSdrDragView().GetMarkedObjectCount());
     452         [ #  # ]:          0 :     std::vector< basegfx::B2DPoint > aPositions;
     453                 :            : 
     454         [ #  # ]:          0 :     for(sal_uInt32 nm(0); nm < nMarkAnz; nm++)
     455                 :            :     {
     456         [ #  # ]:          0 :         SdrMark* pM = getSdrDragView().GetSdrMarkByIndex(nm);
     457                 :            : 
     458         [ #  # ]:          0 :         if(pM->GetPageView() == getSdrDragView().GetSdrPageView())
     459                 :            :         {
     460                 :          0 :             const SdrUShortCont* pPts = pM->GetMarkedPoints();
     461                 :            : 
     462 [ #  # ][ #  # ]:          0 :             if(pPts && !pPts->empty())
                 [ #  # ]
     463                 :            :             {
     464         [ #  # ]:          0 :                 const SdrObject* pObj = pM->GetMarkedSdrObj();
     465         [ #  # ]:          0 :                 const SdrPathObj* pPath = dynamic_cast< const SdrPathObj* >(pObj);
     466                 :            : 
     467         [ #  # ]:          0 :                 if(pPath)
     468                 :            :                 {
     469         [ #  # ]:          0 :                     const basegfx::B2DPolyPolygon aPathXPP = pPath->GetPathPoly();
     470                 :            : 
     471 [ #  # ][ #  # ]:          0 :                     if(aPathXPP.count())
     472                 :            :                     {
     473 [ #  # ][ #  # ]:          0 :                         for(SdrUShortCont::const_iterator it = pPts->begin(); it != pPts->end(); ++it)
                 [ #  # ]
     474                 :            :                         {
     475                 :            :                             sal_uInt32 nPolyNum, nPointNum;
     476         [ #  # ]:          0 :                             const sal_uInt16 nObjPt = *it;
     477                 :            : 
     478 [ #  # ][ #  # ]:          0 :                             if(sdr::PolyPolygonEditor::GetRelativePolyPoint(aPathXPP, nObjPt, nPolyNum, nPointNum))
     479                 :            :                             {
     480 [ #  # ][ #  # ]:          0 :                                 aPositions.push_back(aPathXPP.getB2DPolygon(nPolyNum).getB2DPoint(nPointNum));
         [ #  # ][ #  # ]
     481                 :            :                             }
     482                 :            :                         }
     483         [ #  # ]:          0 :                     }
     484                 :            :                 }
     485                 :            :             }
     486                 :            :         }
     487                 :            :     }
     488                 :            : 
     489         [ #  # ]:          0 :     if(!aPositions.empty())
     490                 :            :     {
     491 [ #  # ][ #  # ]:          0 :         addSdrDragEntry(new SdrDragEntryPointGlueDrag(aPositions, true));
                 [ #  # ]
     492                 :          0 :     }
     493                 :          0 : }
     494                 :            : 
     495                 :          0 : void SdrDragMethod::createSdrDragEntries_GlueDrag()
     496                 :            : {
     497                 :          0 :     const sal_uInt32 nMarkAnz(getSdrDragView().GetMarkedObjectCount());
     498         [ #  # ]:          0 :     std::vector< basegfx::B2DPoint > aPositions;
     499                 :            : 
     500         [ #  # ]:          0 :     for(sal_uInt32 nm(0); nm < nMarkAnz; nm++)
     501                 :            :     {
     502         [ #  # ]:          0 :         SdrMark* pM = getSdrDragView().GetSdrMarkByIndex(nm);
     503                 :            : 
     504         [ #  # ]:          0 :         if(pM->GetPageView() == getSdrDragView().GetSdrPageView())
     505                 :            :         {
     506                 :          0 :             const SdrUShortCont* pPts = pM->GetMarkedGluePoints();
     507                 :            : 
     508 [ #  # ][ #  # ]:          0 :             if(pPts && !pPts->empty())
                 [ #  # ]
     509                 :            :             {
     510         [ #  # ]:          0 :                 const SdrObject* pObj = pM->GetMarkedSdrObj();
     511         [ #  # ]:          0 :                 const SdrGluePointList* pGPL = pObj->GetGluePointList();
     512                 :            : 
     513         [ #  # ]:          0 :                 if(pGPL)
     514                 :            :                 {
     515 [ #  # ][ #  # ]:          0 :                     for(SdrUShortCont::const_iterator it = pPts->begin(); it != pPts->end(); ++it)
                 [ #  # ]
     516                 :            :                     {
     517         [ #  # ]:          0 :                         const sal_uInt16 nObjPt = *it;
     518         [ #  # ]:          0 :                         const sal_uInt16 nGlueNum(pGPL->FindGluePoint(nObjPt));
     519                 :            : 
     520         [ #  # ]:          0 :                         if(SDRGLUEPOINT_NOTFOUND != nGlueNum)
     521                 :            :                         {
     522 [ #  # ][ #  # ]:          0 :                             const Point aPoint((*pGPL)[nGlueNum].GetAbsolutePos(*pObj));
     523         [ #  # ]:          0 :                             aPositions.push_back(basegfx::B2DPoint(aPoint.X(), aPoint.Y()));
     524                 :            :                         }
     525                 :            :                     }
     526                 :            :                 }
     527                 :            :             }
     528                 :            :         }
     529                 :            :     }
     530                 :            : 
     531         [ #  # ]:          0 :     if(!aPositions.empty())
     532                 :            :     {
     533 [ #  # ][ #  # ]:          0 :         addSdrDragEntry(new SdrDragEntryPointGlueDrag(aPositions, false));
                 [ #  # ]
     534                 :          0 :     }
     535                 :          0 : }
     536                 :            : 
     537                 :          0 : void SdrDragMethod::ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, XubString& rStr, sal_uInt16 nVal) const
     538                 :            : {
     539                 :          0 :     sal_uInt16 nOpt=0;
     540         [ #  # ]:          0 :     if (IsDraggingPoints()) {
     541                 :          0 :         nOpt=IMPSDR_POINTSDESCRIPTION;
     542         [ #  # ]:          0 :     } else if (IsDraggingGluePoints()) {
     543                 :          0 :         nOpt=IMPSDR_GLUEPOINTSDESCRIPTION;
     544                 :            :     }
     545                 :          0 :     getSdrDragView().ImpTakeDescriptionStr(nStrCacheID,rStr,nVal,nOpt);
     546                 :          0 : }
     547                 :            : 
     548                 :          0 : SdrObject* SdrDragMethod::GetDragObj() const
     549                 :            : {
     550                 :          0 :     SdrObject* pObj=NULL;
     551         [ #  # ]:          0 :     if (getSdrDragView().pDragHdl!=NULL) pObj=getSdrDragView().pDragHdl->GetObj();
     552         [ #  # ]:          0 :     if (pObj==NULL) pObj=getSdrDragView().pMarkedObj;
     553                 :          0 :     return pObj;
     554                 :            : }
     555                 :            : 
     556                 :          0 : SdrPageView* SdrDragMethod::GetDragPV() const
     557                 :            : {
     558                 :          0 :     SdrPageView* pPV=NULL;
     559         [ #  # ]:          0 :     if (getSdrDragView().pDragHdl!=NULL) pPV=getSdrDragView().pDragHdl->GetPageView();
     560         [ #  # ]:          0 :     if (pPV==NULL) pPV=getSdrDragView().pMarkedPV;
     561                 :          0 :     return pPV;
     562                 :            : }
     563                 :            : 
     564                 :          0 : void SdrDragMethod::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
     565                 :            : {
     566                 :            :     // the original applies the transformation using TRGetBaseGeometry/TRSetBaseGeometry.
     567                 :            :     // Later this should be the only needed one for linear transforms (not for SdrDragCrook and
     568                 :            :     // SdrDragDistort, those are NOT linear). Currently, this can not yet be used since the
     569                 :            :     // special handling of rotate/mirror due to the not-being-able to handle it in the old
     570                 :            :     // drawinglayer stuff. Text would currently not correctly be mirrored in the preview.
     571         [ #  # ]:          0 :     basegfx::B2DHomMatrix aObjectTransform;
     572         [ #  # ]:          0 :     basegfx::B2DPolyPolygon aObjectPolyPolygon;
     573         [ #  # ]:          0 :     bool bPolyUsed(rTarget.TRGetBaseGeometry(aObjectTransform, aObjectPolyPolygon));
     574                 :            : 
     575                 :            :     // apply transform to object transform
     576 [ #  # ][ #  # ]:          0 :     aObjectTransform *= getCurrentTransformation();
                 [ #  # ]
     577                 :            : 
     578         [ #  # ]:          0 :     if(bPolyUsed)
     579                 :            :     {
     580                 :            :         // do something special since the object size is in the polygon
     581                 :            :         // break up matrix to get the scale
     582                 :          0 :         basegfx::B2DTuple aScale;
     583                 :          0 :         basegfx::B2DTuple aTranslate;
     584                 :            :         double fRotate, fShearX;
     585         [ #  # ]:          0 :         aObjectTransform.decompose(aScale, aTranslate, fRotate, fShearX);
     586                 :            : 
     587                 :            :         // get polygon's position and size
     588         [ #  # ]:          0 :         const basegfx::B2DRange aPolyRange(aObjectPolyPolygon.getB2DRange());
     589                 :            : 
     590                 :            :         // get the scaling factors (do not mirror, this is in the object transformation)
     591 [ #  # ][ #  # ]:          0 :         const double fScaleX(fabs(aScale.getX()) / (basegfx::fTools::equalZero(aPolyRange.getWidth()) ? 1.0 : aPolyRange.getWidth()));
                 [ #  # ]
     592 [ #  # ][ #  # ]:          0 :         const double fScaleY(fabs(aScale.getY()) / (basegfx::fTools::equalZero(aPolyRange.getHeight()) ? 1.0 : aPolyRange.getHeight()));
                 [ #  # ]
     593                 :            : 
     594                 :            :         // prepare transform matrix for polygon
     595                 :            :         basegfx::B2DHomMatrix aPolyTransform(basegfx::tools::createTranslateB2DHomMatrix(
     596 [ #  # ][ #  # ]:          0 :             -aPolyRange.getMinX(), -aPolyRange.getMinY()));
                 [ #  # ]
     597         [ #  # ]:          0 :         aPolyTransform.scale(fScaleX, fScaleY);
     598                 :            : 
     599                 :            :         // transform the polygon
     600 [ #  # ][ #  # ]:          0 :         aObjectPolyPolygon.transform(aPolyTransform);
     601                 :            :     }
     602                 :            : 
     603 [ #  # ][ #  # ]:          0 :     rTarget.TRSetBaseGeometry(getCurrentTransformation() * aObjectTransform, aObjectPolyPolygon);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     604                 :          0 : }
     605                 :            : 
     606                 :          0 : void SdrDragMethod::applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget)
     607                 :            : {
     608                 :            :     // original uses CurrentTransformation
     609         [ #  # ]:          0 :     rTarget.transform(getCurrentTransformation());
     610                 :          0 : }
     611                 :            : 
     612                 :          0 : SdrDragMethod::SdrDragMethod(SdrDragView& rNewView)
     613                 :            : :   maSdrDragEntries(),
     614                 :            :     maOverlayObjectList(),
     615                 :            :     mrSdrDragView(rNewView),
     616                 :            :     mbMoveOnly(false),
     617 [ #  # ][ #  # ]:          0 :     mbSolidDraggingActive(getSdrDragView().IsSolidDragging())
     618                 :            : {
     619 [ #  # ][ #  # ]:          0 :     if(mbSolidDraggingActive && Application::GetSettings().GetStyleSettings().GetHighContrastMode())
         [ #  # ][ #  # ]
     620                 :            :     {
     621                 :            :         // fallback to wireframe when high contrast is used
     622                 :          0 :         mbSolidDraggingActive = false;
     623                 :            :     }
     624                 :          0 : }
     625                 :            : 
     626         [ #  # ]:          0 : SdrDragMethod::~SdrDragMethod()
     627                 :            : {
     628         [ #  # ]:          0 :     clearSdrDragEntries();
     629         [ #  # ]:          0 : }
     630                 :            : 
     631                 :          0 : void SdrDragMethod::Show()
     632                 :            : {
     633                 :          0 :     getSdrDragView().ShowDragObj();
     634                 :          0 : }
     635                 :            : 
     636                 :          0 : void SdrDragMethod::Hide()
     637                 :            : {
     638                 :          0 :     getSdrDragView().HideDragObj();
     639                 :          0 : }
     640                 :            : 
     641                 :          0 : basegfx::B2DHomMatrix SdrDragMethod::getCurrentTransformation()
     642                 :            : {
     643                 :          0 :     return basegfx::B2DHomMatrix();
     644                 :            : }
     645                 :            : 
     646                 :          0 : void SdrDragMethod::CancelSdrDrag()
     647                 :            : {
     648                 :          0 :     Hide();
     649                 :          0 : }
     650                 :            : 
     651                 :          0 : void SdrDragMethod::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlayManager)
     652                 :            : {
     653                 :            :     // create SdrDragEntries on demand
     654         [ #  # ]:          0 :     if(maSdrDragEntries.empty())
     655                 :            :     {
     656                 :          0 :         createSdrDragEntries();
     657                 :            :     }
     658                 :            : 
     659                 :            :     // if there are entries, derive OverlayObjects from the entries, including
     660                 :            :     // modification from current interactive state
     661         [ #  # ]:          0 :     if(!maSdrDragEntries.empty())
     662                 :            :     {
     663         [ #  # ]:          0 :         drawinglayer::primitive2d::Primitive2DSequence aResult;
     664         [ #  # ]:          0 :         drawinglayer::primitive2d::Primitive2DSequence aResultTransparent;
     665                 :            : 
     666         [ #  # ]:          0 :         for(sal_uInt32 a(0); a < maSdrDragEntries.size(); a++)
     667                 :            :         {
     668         [ #  # ]:          0 :             SdrDragEntry* pCandidate = maSdrDragEntries[a];
     669                 :            : 
     670         [ #  # ]:          0 :             if(pCandidate)
     671                 :            :             {
     672         [ #  # ]:          0 :                 const drawinglayer::primitive2d::Primitive2DSequence aCandidateResult(pCandidate->createPrimitive2DSequenceInCurrentState(*this));
     673                 :            : 
     674         [ #  # ]:          0 :                 if(aCandidateResult.hasElements())
     675                 :            :                 {
     676         [ #  # ]:          0 :                     if(pCandidate->getAddToTransparent())
     677                 :            :                     {
     678         [ #  # ]:          0 :                         drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aResultTransparent, aCandidateResult);
     679                 :            :                     }
     680                 :            :                     else
     681                 :            :                     {
     682         [ #  # ]:          0 :                         drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aResult, aCandidateResult);
     683                 :            :                     }
     684         [ #  # ]:          0 :                 }
     685                 :            :             }
     686                 :            :         }
     687                 :            : 
     688 [ #  # ][ #  # ]:          0 :         if(DoAddConnectorOverlays())
     689                 :            :         {
     690         [ #  # ]:          0 :             const drawinglayer::primitive2d::Primitive2DSequence aConnectorOverlays(AddConnectorOverlays());
     691                 :            : 
     692         [ #  # ]:          0 :             if(aConnectorOverlays.hasElements())
     693                 :            :             {
     694                 :            :                 // add connector overlays to transparent part
     695         [ #  # ]:          0 :                 drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(aResultTransparent, aConnectorOverlays);
     696         [ #  # ]:          0 :             }
     697                 :            :         }
     698                 :            : 
     699         [ #  # ]:          0 :         if(aResult.hasElements())
     700                 :            :         {
     701 [ #  # ][ #  # ]:          0 :             sdr::overlay::OverlayObject* pNewOverlayObject = new sdr::overlay::OverlayPrimitive2DSequenceObject(aResult);
     702         [ #  # ]:          0 :             rOverlayManager.add(*pNewOverlayObject);
     703         [ #  # ]:          0 :             addToOverlayObjectList(*pNewOverlayObject);
     704                 :            :         }
     705                 :            : 
     706         [ #  # ]:          0 :         if(aResultTransparent.hasElements())
     707                 :            :         {
     708 [ #  # ][ #  # ]:          0 :             drawinglayer::primitive2d::Primitive2DReference aUnifiedTransparencePrimitive2D(new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D(aResultTransparent, 0.5));
                 [ #  # ]
     709 [ #  # ][ #  # ]:          0 :             aResultTransparent = drawinglayer::primitive2d::Primitive2DSequence(&aUnifiedTransparencePrimitive2D, 1);
                 [ #  # ]
     710                 :            : 
     711 [ #  # ][ #  # ]:          0 :             sdr::overlay::OverlayObject* pNewOverlayObject = new sdr::overlay::OverlayPrimitive2DSequenceObject(aResultTransparent);
     712         [ #  # ]:          0 :             rOverlayManager.add(*pNewOverlayObject);
     713         [ #  # ]:          0 :             addToOverlayObjectList(*pNewOverlayObject);
     714 [ #  # ][ #  # ]:          0 :         }
     715                 :            :     }
     716                 :            : 
     717                 :            :     // add DragStripes if necessary (help lines cross the page when dragging)
     718         [ #  # ]:          0 :     if(getSdrDragView().IsDragStripes())
     719                 :            :     {
     720         [ #  # ]:          0 :         Rectangle aActionRectangle;
     721         [ #  # ]:          0 :         getSdrDragView().TakeActionRect(aActionRectangle);
     722                 :            : 
     723                 :          0 :         const basegfx::B2DPoint aTopLeft(aActionRectangle.Left(), aActionRectangle.Top());
     724                 :          0 :         const basegfx::B2DPoint aBottomRight(aActionRectangle.Right(), aActionRectangle.Bottom());
     725                 :            :         sdr::overlay::OverlayRollingRectangleStriped* pNew = new sdr::overlay::OverlayRollingRectangleStriped(
     726 [ #  # ][ #  # ]:          0 :             aTopLeft, aBottomRight, true, false);
     727                 :            : 
     728         [ #  # ]:          0 :         rOverlayManager.add(*pNew);
     729         [ #  # ]:          0 :         addToOverlayObjectList(*pNew);
     730                 :            :     }
     731                 :          0 : }
     732                 :            : 
     733                 :          0 : void SdrDragMethod::destroyOverlayGeometry()
     734                 :            : {
     735                 :          0 :     clearOverlayObjectList();
     736                 :          0 : }
     737                 :            : 
     738                 :          0 : bool SdrDragMethod::DoAddConnectorOverlays()
     739                 :            : {
     740                 :            :     // these conditions are translated from SdrDragView::ImpDrawEdgeXor
     741                 :          0 :     const SdrMarkList& rMarkedNodes = getSdrDragView().GetEdgesOfMarkedNodes();
     742                 :            : 
     743         [ #  # ]:          0 :     if(!rMarkedNodes.GetMarkCount())
     744                 :            :     {
     745                 :          0 :         return false;
     746                 :            :     }
     747                 :            : 
     748 [ #  # ][ #  # ]:          0 :     if(!getSdrDragView().IsRubberEdgeDragging() && !getSdrDragView().IsDetailedEdgeDragging())
                 [ #  # ]
     749                 :            :     {
     750                 :          0 :         return false;
     751                 :            :     }
     752                 :            : 
     753 [ #  # ][ #  # ]:          0 :     if(getSdrDragView().IsDraggingPoints() || getSdrDragView().IsDraggingGluePoints())
                 [ #  # ]
     754                 :            :     {
     755                 :          0 :         return false;
     756                 :            :     }
     757                 :            : 
     758 [ #  # ][ #  # ]:          0 :     if(!getMoveOnly() && !(
                 [ #  # ]
     759                 :          0 :         IS_TYPE(SdrDragMove, this) || IS_TYPE(SdrDragResize, this) ||
     760   [ #  #  #  # ]:          0 :         IS_TYPE(SdrDragRotate,this) || IS_TYPE(SdrDragMirror,this)))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     761                 :            :     {
     762                 :          0 :         return false;
     763                 :            :     }
     764                 :            : 
     765 [ #  # ][ #  # ]:          0 :     const bool bDetail(getSdrDragView().IsDetailedEdgeDragging() && getMoveOnly());
     766                 :            : 
     767 [ #  # ][ #  # ]:          0 :     if(!bDetail && !getSdrDragView().IsRubberEdgeDragging())
                 [ #  # ]
     768                 :            :     {
     769                 :          0 :         return false;
     770                 :            :     }
     771                 :            : 
     772                 :            :     // one more migrated from SdrEdgeObj::NspToggleEdgeXor
     773 [ #  # ][ #  # ]:          0 :     if(IS_TYPE(SdrDragObjOwn, this) || IS_TYPE(SdrDragMovHdl, this))
         [ #  # ][ #  # ]
                 [ #  # ]
     774                 :            :     {
     775                 :          0 :         return false;
     776                 :            :     }
     777                 :            : 
     778                 :          0 :     return true;
     779                 :            : }
     780                 :            : 
     781                 :          0 : drawinglayer::primitive2d::Primitive2DSequence SdrDragMethod::AddConnectorOverlays()
     782                 :            : {
     783                 :          0 :     drawinglayer::primitive2d::Primitive2DSequence aRetval;
     784 [ #  # ][ #  # ]:          0 :     const bool bDetail(getSdrDragView().IsDetailedEdgeDragging() && getMoveOnly());
     785         [ #  # ]:          0 :     const SdrMarkList& rMarkedNodes = getSdrDragView().GetEdgesOfMarkedNodes();
     786                 :            : 
     787         [ #  # ]:          0 :     for(sal_uInt16 a(0); a < rMarkedNodes.GetMarkCount(); a++)
     788                 :            :     {
     789         [ #  # ]:          0 :         SdrMark* pEM = rMarkedNodes.GetMark(a);
     790                 :            : 
     791 [ #  # ][ #  # ]:          0 :         if(pEM && pEM->GetMarkedSdrObj())
         [ #  # ][ #  # ]
     792                 :            :         {
     793 [ #  # ][ #  # ]:          0 :             SdrEdgeObj* pEdge = dynamic_cast< SdrEdgeObj* >(pEM->GetMarkedSdrObj());
     794                 :            : 
     795         [ #  # ]:          0 :             if(pEdge)
     796                 :            :             {
     797         [ #  # ]:          0 :                 const basegfx::B2DPolygon aEdgePolygon(pEdge->ImplAddConnectorOverlay(*this, pEM->IsCon1(), pEM->IsCon2(), bDetail));
     798                 :            : 
     799 [ #  # ][ #  # ]:          0 :                 if(aEdgePolygon.count())
     800                 :            :                 {
     801                 :            :                     // this polygon is a temporary calculated connector path, so it is not possible to fetch
     802                 :            :                     // the needed primitives directly from the pEdge object which does not get changed. If full
     803                 :            :                     // drag is on, use the SdrObjects ItemSet to create a adequate representation
     804                 :          0 :                     bool bUseSolidDragging(getSolidDraggingActive());
     805                 :            : 
     806         [ #  # ]:          0 :                     if(bUseSolidDragging)
     807                 :            :                     {
     808                 :            :                         // switch off solid dragging if connector is not visible
     809 [ #  # ][ #  # ]:          0 :                         if(!pEdge->HasLineStyle())
     810                 :            :                         {
     811                 :          0 :                             bUseSolidDragging = false;
     812                 :            :                         }
     813                 :            :                     }
     814                 :            : 
     815         [ #  # ]:          0 :                     if(bUseSolidDragging)
     816                 :            :                     {
     817         [ #  # ]:          0 :                         const SfxItemSet& rItemSet = pEdge->GetMergedItemSet();
     818                 :            :                         const drawinglayer::attribute::SdrLineAttribute aLine(
     819         [ #  # ]:          0 :                             drawinglayer::primitive2d::createNewSdrLineAttribute(rItemSet));
     820                 :            : 
     821 [ #  # ][ #  # ]:          0 :                         if(!aLine.isDefault())
     822                 :            :                         {
     823                 :            :                             const drawinglayer::attribute::SdrLineStartEndAttribute aLineStartEnd(
     824                 :            :                                 drawinglayer::primitive2d::createNewSdrLineStartEndAttribute(
     825                 :            :                                     rItemSet,
     826 [ #  # ][ #  # ]:          0 :                                     aLine.getWidth()));
     827                 :            : 
     828                 :            :                             drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(
     829                 :            :                                 aRetval, drawinglayer::primitive2d::createPolygonLinePrimitive(
     830                 :            :                                     aEdgePolygon,
     831                 :            :                                     basegfx::B2DHomMatrix(),
     832                 :            :                                     aLine,
     833 [ #  # ][ #  # ]:          0 :                                     aLineStartEnd));
         [ #  # ][ #  # ]
                 [ #  # ]
     834         [ #  # ]:          0 :                         }
     835                 :            :                     }
     836                 :            :                     else
     837                 :            :                     {
     838         [ #  # ]:          0 :                         const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
     839         [ #  # ]:          0 :                         basegfx::BColor aColA(aSvtOptionsDrawinglayer.GetStripeColorA().getBColor());
     840         [ #  # ]:          0 :                         basegfx::BColor aColB(aSvtOptionsDrawinglayer.GetStripeColorB().getBColor());
     841         [ #  # ]:          0 :                         const double fStripeLength(aSvtOptionsDrawinglayer.GetStripeLength());
     842                 :            : 
     843 [ #  # ][ #  # ]:          0 :                         if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
     844                 :            :                         {
     845 [ #  # ][ #  # ]:          0 :                             aColA = aColB = Application::GetSettings().GetStyleSettings().GetHighlightColor().getBColor();
                 [ #  # ]
     846                 :          0 :                             aColB.invert();
     847                 :            :                         }
     848                 :            : 
     849                 :            :                         drawinglayer::primitive2d::Primitive2DReference aPolyPolygonMarkerPrimitive2D(
     850                 :            :                             new drawinglayer::primitive2d::PolyPolygonMarkerPrimitive2D(
     851 [ #  # ][ #  # ]:          0 :                                 basegfx::B2DPolyPolygon(aEdgePolygon), aColA, aColB, fStripeLength));
         [ #  # ][ #  # ]
                 [ #  # ]
     852 [ #  # ][ #  # ]:          0 :                         drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aPolyPolygonMarkerPrimitive2D);
     853                 :            :                     }
     854         [ #  # ]:          0 :                 }
     855                 :            :             }
     856                 :            :         }
     857                 :            :     }
     858                 :            : 
     859                 :          0 :     return aRetval;
     860                 :            : }
     861                 :            : 
     862                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     863                 :            : 
     864 [ #  # ][ #  # ]:          0 : TYPEINIT1(SdrDragMovHdl,SdrDragMethod);
     865                 :            : 
     866                 :          0 : SdrDragMovHdl::SdrDragMovHdl(SdrDragView& rNewView)
     867                 :          0 : :   SdrDragMethod(rNewView)
     868                 :            : {
     869                 :          0 : }
     870                 :            : 
     871                 :          0 : void SdrDragMovHdl::createSdrDragEntries()
     872                 :            : {
     873                 :            :     // SdrDragMovHdl does not use the default drags,
     874                 :            :     // but creates nothing
     875                 :          0 : }
     876                 :            : 
     877                 :          0 : void SdrDragMovHdl::TakeSdrDragComment(XubString& rStr) const
     878                 :            : {
     879         [ #  # ]:          0 :     rStr=ImpGetResStr(STR_DragMethMovHdl);
     880 [ #  # ][ #  # ]:          0 :     if (getSdrDragView().IsDragWithCopy()) rStr+=ImpGetResStr(STR_EditWithCopy);
     881                 :          0 : }
     882                 :            : 
     883                 :          0 : bool SdrDragMovHdl::BeginSdrDrag()
     884                 :            : {
     885         [ #  # ]:          0 :     if( !GetDragHdl() )
     886                 :          0 :         return false;
     887                 :            : 
     888                 :          0 :     DragStat().Ref1()=GetDragHdl()->GetPos();
     889                 :          0 :     DragStat().SetShown(!DragStat().IsShown());
     890                 :          0 :     SdrHdlKind eKind=GetDragHdl()->GetKind();
     891                 :          0 :     SdrHdl* pH1=GetHdlList().GetHdl(HDL_REF1);
     892                 :          0 :     SdrHdl* pH2=GetHdlList().GetHdl(HDL_REF2);
     893                 :            : 
     894         [ #  # ]:          0 :     if (eKind==HDL_MIRX)
     895                 :            :     {
     896 [ #  # ][ #  # ]:          0 :         if (pH1==NULL || pH2==NULL)
     897                 :            :         {
     898                 :            :             OSL_FAIL("SdrDragMovHdl::BeginSdrDrag(): Moving the axis of reflection: reference handles not found.");
     899                 :          0 :             return false;
     900                 :            :         }
     901                 :            : 
     902                 :          0 :         DragStat().SetActionRect(Rectangle(pH1->GetPos(),pH2->GetPos()));
     903                 :            :     }
     904                 :            :     else
     905                 :            :     {
     906                 :          0 :         Point aPt(GetDragHdl()->GetPos());
     907         [ #  # ]:          0 :         DragStat().SetActionRect(Rectangle(aPt,aPt));
     908                 :            :     }
     909                 :            : 
     910                 :          0 :     return true;
     911                 :            : }
     912                 :            : 
     913                 :          0 : void SdrDragMovHdl::MoveSdrDrag(const Point& rNoSnapPnt)
     914                 :            : {
     915                 :          0 :     Point aPnt(rNoSnapPnt);
     916                 :            : 
     917 [ #  # ][ #  # ]:          0 :     if ( GetDragHdl() && DragStat().CheckMinMoved(rNoSnapPnt))
         [ #  # ][ #  # ]
     918                 :            :     {
     919         [ #  # ]:          0 :         if (GetDragHdl()->GetKind()==HDL_MIRX)
     920                 :            :         {
     921         [ #  # ]:          0 :             SdrHdl* pH1=GetHdlList().GetHdl(HDL_REF1);
     922         [ #  # ]:          0 :             SdrHdl* pH2=GetHdlList().GetHdl(HDL_REF2);
     923                 :            : 
     924 [ #  # ][ #  # ]:          0 :             if (pH1==NULL || pH2==NULL)
     925                 :          0 :                 return;
     926                 :            : 
     927         [ #  # ]:          0 :             if (!DragStat().IsNoSnap())
     928                 :            :             {
     929                 :          0 :                 long nBestXSnap=0;
     930                 :          0 :                 long nBestYSnap=0;
     931                 :          0 :                 bool bXSnapped=false;
     932                 :          0 :                 bool bYSnapped=false;
     933         [ #  # ]:          0 :                 Point aDif(aPnt-DragStat().GetStart());
     934         [ #  # ]:          0 :                 getSdrDragView().CheckSnap(Ref1()+aDif,NULL,nBestXSnap,nBestYSnap,bXSnapped,bYSnapped);
     935         [ #  # ]:          0 :                 getSdrDragView().CheckSnap(Ref2()+aDif,NULL,nBestXSnap,nBestYSnap,bXSnapped,bYSnapped);
     936                 :          0 :                 aPnt.X()+=nBestXSnap;
     937                 :          0 :                 aPnt.Y()+=nBestYSnap;
     938                 :            :             }
     939                 :            : 
     940 [ #  # ][ #  # ]:          0 :             if (aPnt!=DragStat().GetNow())
     941                 :            :             {
     942         [ #  # ]:          0 :                 Hide();
     943         [ #  # ]:          0 :                 DragStat().NextMove(aPnt);
     944 [ #  # ][ #  # ]:          0 :                 Point aDif(DragStat().GetNow()-DragStat().GetStart());
     945         [ #  # ]:          0 :                 pH1->SetPos(Ref1()+aDif);
     946         [ #  # ]:          0 :                 pH2->SetPos(Ref2()+aDif);
     947                 :            : 
     948         [ #  # ]:          0 :                 SdrHdl* pHM = GetHdlList().GetHdl(HDL_MIRX);
     949                 :            : 
     950         [ #  # ]:          0 :                 if(pHM)
     951         [ #  # ]:          0 :                     pHM->Touch();
     952                 :            : 
     953         [ #  # ]:          0 :                 Show();
     954         [ #  # ]:          0 :                 DragStat().SetActionRect(Rectangle(pH1->GetPos(),pH2->GetPos()));
     955                 :            :             }
     956                 :            :         }
     957                 :            :         else
     958                 :            :         {
     959 [ #  # ][ #  # ]:          0 :             if (!DragStat().IsNoSnap()) SnapPos(aPnt);
     960                 :          0 :             long nSA=0;
     961                 :            : 
     962         [ #  # ]:          0 :             if (getSdrDragView().IsAngleSnapEnabled())
     963                 :          0 :                 nSA=getSdrDragView().GetSnapAngle();
     964                 :            : 
     965 [ #  # ][ #  # ]:          0 :             if (getSdrDragView().IsMirrorAllowed(true,true))
     966                 :            :             { // limited
     967 [ #  # ][ #  # ]:          0 :                 if (!getSdrDragView().IsMirrorAllowed(false,false)) nSA=4500;
     968 [ #  # ][ #  # ]:          0 :                 if (!getSdrDragView().IsMirrorAllowed(true,false)) nSA=9000;
     969                 :            :             }
     970                 :            : 
     971 [ #  # ][ #  # ]:          0 :             if (getSdrDragView().IsOrtho() && nSA!=9000)
                 [ #  # ]
     972                 :          0 :                 nSA=4500;
     973                 :            : 
     974         [ #  # ]:          0 :             if (nSA!=0)
     975                 :            :             { // angle snapping
     976                 :          0 :                 SdrHdlKind eRef=HDL_REF1;
     977                 :            : 
     978         [ #  # ]:          0 :                 if (GetDragHdl()->GetKind()==HDL_REF1)
     979                 :          0 :                     eRef=HDL_REF2;
     980                 :            : 
     981         [ #  # ]:          0 :                 SdrHdl* pH=GetHdlList().GetHdl(eRef);
     982                 :            : 
     983         [ #  # ]:          0 :                 if (pH!=NULL)
     984                 :            :                 {
     985                 :          0 :                     Point aRef(pH->GetPos());
     986 [ #  # ][ #  # ]:          0 :                     long nWink=NormAngle360(GetAngle(aPnt-aRef));
     987                 :          0 :                     long nNeuWink=nWink;
     988                 :          0 :                     nNeuWink+=nSA/2;
     989                 :          0 :                     nNeuWink/=nSA;
     990                 :          0 :                     nNeuWink*=nSA;
     991         [ #  # ]:          0 :                     nNeuWink=NormAngle360(nNeuWink);
     992                 :          0 :                     double a=(nNeuWink-nWink)*nPi180;
     993                 :          0 :                     double nSin=sin(a);
     994                 :          0 :                     double nCos=cos(a);
     995                 :          0 :                     RotatePoint(aPnt,aRef,nSin,nCos);
     996                 :            : 
     997                 :            :                     // eliminate rounding errors for certain values
     998         [ #  # ]:          0 :                     if (nSA==9000)
     999                 :            :                     {
    1000 [ #  # ][ #  # ]:          0 :                         if (nNeuWink==0    || nNeuWink==18000) aPnt.Y()=aRef.Y();
    1001 [ #  # ][ #  # ]:          0 :                         if (nNeuWink==9000 || nNeuWink==27000) aPnt.X()=aRef.X();
    1002                 :            :                     }
    1003                 :            : 
    1004         [ #  # ]:          0 :                     if (nSA==4500)
    1005         [ #  # ]:          0 :                         OrthoDistance8(aRef,aPnt,true);
    1006                 :            :                 }
    1007                 :            :             }
    1008                 :            : 
    1009 [ #  # ][ #  # ]:          0 :             if (aPnt!=DragStat().GetNow())
    1010                 :            :             {
    1011         [ #  # ]:          0 :                 Hide();
    1012         [ #  # ]:          0 :                 DragStat().NextMove(aPnt);
    1013 [ #  # ][ #  # ]:          0 :                 GetDragHdl()->SetPos(DragStat().GetNow());
    1014         [ #  # ]:          0 :                 SdrHdl* pHM = GetHdlList().GetHdl(HDL_MIRX);
    1015                 :            : 
    1016         [ #  # ]:          0 :                 if(pHM)
    1017         [ #  # ]:          0 :                     pHM->Touch();
    1018                 :            : 
    1019         [ #  # ]:          0 :                 Show();
    1020         [ #  # ]:          0 :                 DragStat().SetActionRect(Rectangle(aPnt,aPnt));
    1021                 :            :             }
    1022                 :            :         }
    1023                 :            :     }
    1024                 :            : }
    1025                 :            : 
    1026                 :          0 : bool SdrDragMovHdl::EndSdrDrag(bool /*bCopy*/)
    1027                 :            : {
    1028         [ #  # ]:          0 :     if( GetDragHdl() )
    1029                 :            :     {
    1030   [ #  #  #  # ]:          0 :         switch (GetDragHdl()->GetKind())
    1031                 :            :         {
    1032                 :            :             case HDL_REF1:
    1033                 :          0 :                 Ref1()=DragStat().GetNow();
    1034                 :          0 :                 break;
    1035                 :            : 
    1036                 :            :             case HDL_REF2:
    1037                 :          0 :                 Ref2()=DragStat().GetNow();
    1038                 :          0 :                 break;
    1039                 :            : 
    1040                 :            :             case HDL_MIRX:
    1041                 :          0 :                 Ref1()+=DragStat().GetNow()-DragStat().GetStart();
    1042                 :          0 :                 Ref2()+=DragStat().GetNow()-DragStat().GetStart();
    1043                 :          0 :                 break;
    1044                 :            : 
    1045                 :          0 :             default: break;
    1046                 :            :         }
    1047                 :            :     }
    1048                 :            : 
    1049                 :          0 :     return true;
    1050                 :            : }
    1051                 :            : 
    1052                 :          0 : void SdrDragMovHdl::CancelSdrDrag()
    1053                 :            : {
    1054                 :          0 :     Hide();
    1055                 :            : 
    1056                 :          0 :     SdrHdl* pHdl = GetDragHdl();
    1057         [ #  # ]:          0 :     if( pHdl )
    1058                 :          0 :         pHdl->SetPos(DragStat().GetRef1());
    1059                 :            : 
    1060                 :          0 :     SdrHdl* pHM = GetHdlList().GetHdl(HDL_MIRX);
    1061                 :            : 
    1062         [ #  # ]:          0 :     if(pHM)
    1063                 :          0 :         pHM->Touch();
    1064                 :          0 : }
    1065                 :            : 
    1066                 :          0 : Pointer SdrDragMovHdl::GetSdrDragPointer() const
    1067                 :            : {
    1068                 :          0 :     const SdrHdl* pHdl = GetDragHdl();
    1069                 :            : 
    1070         [ #  # ]:          0 :     if (pHdl!=NULL)
    1071                 :            :     {
    1072                 :          0 :         return pHdl->GetPointer();
    1073                 :            :     }
    1074                 :            : 
    1075                 :          0 :     return Pointer(POINTER_REFHAND);
    1076                 :            : }
    1077                 :            : 
    1078                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    1079                 :            : 
    1080 [ #  # ][ #  # ]:          0 : TYPEINIT1(SdrDragObjOwn,SdrDragMethod);
    1081                 :            : 
    1082                 :          0 : SdrDragObjOwn::SdrDragObjOwn(SdrDragView& rNewView)
    1083                 :            : :   SdrDragMethod(rNewView),
    1084                 :          0 :     mpClone(0)
    1085                 :            : {
    1086         [ #  # ]:          0 :     const SdrObject* pObj = GetDragObj();
    1087                 :            : 
    1088         [ #  # ]:          0 :     if(pObj)
    1089                 :            :     {
    1090                 :            :         // suppress full drag for some object types
    1091         [ #  # ]:          0 :         setSolidDraggingActive(pObj->supportsFullDrag());
    1092                 :            :     }
    1093                 :          0 : }
    1094                 :            : 
    1095                 :          0 : SdrDragObjOwn::~SdrDragObjOwn()
    1096                 :            : {
    1097         [ #  # ]:          0 :     if(mpClone)
    1098                 :            :     {
    1099         [ #  # ]:          0 :         SdrObject::Free(mpClone);
    1100                 :            :     }
    1101         [ #  # ]:          0 : }
    1102                 :            : 
    1103                 :          0 : void SdrDragObjOwn::createSdrDragEntries()
    1104                 :            : {
    1105         [ #  # ]:          0 :     if(mpClone)
    1106                 :            :     {
    1107         [ #  # ]:          0 :         basegfx::B2DPolyPolygon aDragPolyPolygon;
    1108                 :          0 :         bool bAddWireframe(true);
    1109                 :            : 
    1110         [ #  # ]:          0 :         if(getSolidDraggingActive())
    1111                 :            :         {
    1112                 :          0 :             SdrPageView* pPV = getSdrDragView().GetSdrPageView();
    1113                 :            : 
    1114 [ #  # ][ #  # ]:          0 :             if(pPV && pPV->PageWindowCount())
                 [ #  # ]
    1115                 :            :             {
    1116 [ #  # ][ #  # ]:          0 :                 sdr::contact::ObjectContact& rOC = pPV->GetPageWindow(0)->GetObjectContact();
    1117 [ #  # ][ #  # ]:          0 :                 addSdrDragEntry(new SdrDragEntrySdrObject(*mpClone, rOC, false));
                 [ #  # ]
    1118                 :            : 
    1119                 :            :                 // potentially no wireframe needed, full drag works
    1120                 :          0 :                 bAddWireframe = false;
    1121                 :            :             }
    1122                 :            :         }
    1123                 :            : 
    1124         [ #  # ]:          0 :         if(!bAddWireframe)
    1125                 :            :         {
    1126                 :            :             // check for extra conditions for wireframe, e.g. no border at
    1127                 :            :             // objects
    1128 [ #  # ][ #  # ]:          0 :             if(!mpClone->HasLineStyle())
    1129                 :            :             {
    1130                 :          0 :                 bAddWireframe = true;
    1131                 :            :             }
    1132                 :            :         }
    1133                 :            : 
    1134         [ #  # ]:          0 :         if(bAddWireframe)
    1135                 :            :         {
    1136                 :            :             // use wireframe poly when full drag is off or did not work
    1137 [ #  # ][ #  # ]:          0 :             aDragPolyPolygon = mpClone->TakeXorPoly();
                 [ #  # ]
    1138                 :            :         }
    1139                 :            : 
    1140                 :            :         // add evtl. extra DragPolyPolygon
    1141         [ #  # ]:          0 :         const basegfx::B2DPolyPolygon aSpecialDragPolyPolygon(mpClone->getSpecialDragPoly(DragStat()));
    1142                 :            : 
    1143 [ #  # ][ #  # ]:          0 :         if(aSpecialDragPolyPolygon.count())
    1144                 :            :         {
    1145         [ #  # ]:          0 :             aDragPolyPolygon.append(aSpecialDragPolyPolygon);
    1146                 :            :         }
    1147                 :            : 
    1148 [ #  # ][ #  # ]:          0 :         if(aDragPolyPolygon.count())
    1149                 :            :         {
    1150 [ #  # ][ #  # ]:          0 :             addSdrDragEntry(new SdrDragEntryPolyPolygon(aDragPolyPolygon));
                 [ #  # ]
    1151 [ #  # ][ #  # ]:          0 :         }
    1152                 :            :     }
    1153                 :          0 : }
    1154                 :            : 
    1155                 :          0 : void SdrDragObjOwn::TakeSdrDragComment(XubString& rStr) const
    1156                 :            : {
    1157                 :            :     // #i103058# get info string from the clone preferred, the original will
    1158                 :            :     // not be changed. For security, use original as fallback
    1159         [ #  # ]:          0 :     if(mpClone)
    1160                 :            :     {
    1161         [ #  # ]:          0 :         rStr = mpClone->getSpecialDragComment(DragStat());
    1162                 :            :     }
    1163                 :            :     else
    1164                 :            :     {
    1165                 :          0 :         const SdrObject* pObj = GetDragObj();
    1166                 :            : 
    1167         [ #  # ]:          0 :         if(pObj)
    1168                 :            :         {
    1169         [ #  # ]:          0 :             rStr = pObj->getSpecialDragComment(DragStat());
    1170                 :            :         }
    1171                 :            :     }
    1172                 :          0 : }
    1173                 :            : 
    1174                 :          0 : bool SdrDragObjOwn::BeginSdrDrag()
    1175                 :            : {
    1176         [ #  # ]:          0 :     if(!mpClone)
    1177                 :            :     {
    1178                 :          0 :         const SdrObject* pObj = GetDragObj();
    1179                 :            : 
    1180 [ #  # ][ #  # ]:          0 :         if(pObj && !pObj->IsResizeProtect())
                 [ #  # ]
    1181                 :            :         {
    1182         [ #  # ]:          0 :             if(pObj->beginSpecialDrag(DragStat()))
    1183                 :            :             {
    1184                 :            :                 // create initial clone to have a start visualization
    1185                 :          0 :                 mpClone = pObj->getFullDragClone();
    1186                 :          0 :                 mpClone->applySpecialDrag(DragStat());
    1187                 :            : 
    1188                 :          0 :                 return true;
    1189                 :            :             }
    1190                 :            :         }
    1191                 :            :     }
    1192                 :            : 
    1193                 :          0 :     return false;
    1194                 :            : }
    1195                 :            : 
    1196                 :          0 : void SdrDragObjOwn::MoveSdrDrag(const Point& rNoSnapPnt)
    1197                 :            : {
    1198                 :          0 :     const SdrObject* pObj = GetDragObj();
    1199                 :            : 
    1200         [ #  # ]:          0 :     if(pObj)
    1201                 :            :     {
    1202                 :          0 :         Point aPnt(rNoSnapPnt);
    1203         [ #  # ]:          0 :         SdrPageView* pPV = GetDragPV();
    1204                 :            : 
    1205         [ #  # ]:          0 :         if(pPV)
    1206                 :            :         {
    1207         [ #  # ]:          0 :             if(!DragStat().IsNoSnap())
    1208                 :            :             {
    1209         [ #  # ]:          0 :                 SnapPos(aPnt);
    1210                 :            :             }
    1211                 :            : 
    1212         [ #  # ]:          0 :             if(getSdrDragView().IsOrtho())
    1213                 :            :             {
    1214         [ #  # ]:          0 :                 if (DragStat().IsOrtho8Possible())
    1215                 :            :                 {
    1216 [ #  # ][ #  # ]:          0 :                     OrthoDistance8(DragStat().GetStart(),aPnt,getSdrDragView().IsBigOrtho());
    1217                 :            :                 }
    1218         [ #  # ]:          0 :                 else if (DragStat().IsOrtho4Possible())
    1219                 :            :                 {
    1220 [ #  # ][ #  # ]:          0 :                     OrthoDistance4(DragStat().GetStart(),aPnt,getSdrDragView().IsBigOrtho());
    1221                 :            :                 }
    1222                 :            :             }
    1223                 :            : 
    1224 [ #  # ][ #  # ]:          0 :             if(DragStat().CheckMinMoved(rNoSnapPnt))
    1225                 :            :             {
    1226 [ #  # ][ #  # ]:          0 :                 if(aPnt != DragStat().GetNow())
    1227                 :            :                 {
    1228         [ #  # ]:          0 :                     Hide();
    1229         [ #  # ]:          0 :                     DragStat().NextMove(aPnt);
    1230                 :            : 
    1231                 :            :                     // since SdrDragObjOwn currently supports no transformation of
    1232                 :            :                     // existing SdrDragEntries but only their recreation, a recreation
    1233                 :            :                     // after every move is needed in this mode. Delete existing
    1234                 :            :                     // SdrDragEntries here  to force their recreation in the following Show().
    1235         [ #  # ]:          0 :                     clearSdrDragEntries();
    1236                 :            : 
    1237                 :            :                     // delete current clone (after the last reference to it is deleted above)
    1238         [ #  # ]:          0 :                     if(mpClone)
    1239                 :            :                     {
    1240         [ #  # ]:          0 :                         SdrObject::Free(mpClone);
    1241                 :          0 :                         mpClone = 0;
    1242                 :            :                     }
    1243                 :            : 
    1244                 :            :                     // create a new clone and modify to current drag state
    1245         [ #  # ]:          0 :                     if(!mpClone)
    1246                 :            :                     {
    1247         [ #  # ]:          0 :                         mpClone = pObj->getFullDragClone();
    1248         [ #  # ]:          0 :                         mpClone->applySpecialDrag(DragStat());
    1249                 :            :                     }
    1250                 :            : 
    1251         [ #  # ]:          0 :                     Show();
    1252                 :            :                 }
    1253                 :            :             }
    1254                 :            :         }
    1255                 :            :     }
    1256                 :          0 : }
    1257                 :            : 
    1258                 :          0 : bool SdrDragObjOwn::EndSdrDrag(bool /*bCopy*/)
    1259                 :            : {
    1260         [ #  # ]:          0 :     Hide();
    1261                 :          0 :     SdrUndoAction* pUndo = NULL;
    1262                 :          0 :     SdrUndoAction* pUndo2 = NULL;
    1263         [ #  # ]:          0 :     std::vector< SdrUndoAction* > vConnectorUndoActions;
    1264                 :          0 :     bool bRet = false;
    1265         [ #  # ]:          0 :     SdrObject* pObj = GetDragObj();
    1266                 :            : 
    1267         [ #  # ]:          0 :     if(pObj)
    1268                 :            :     {
    1269         [ #  # ]:          0 :         const bool bUndo = getSdrDragView().IsUndoEnabled();
    1270                 :            : 
    1271         [ #  # ]:          0 :         if( bUndo )
    1272                 :            :         {
    1273 [ #  # ][ #  # ]:          0 :             if(!getSdrDragView().IsInsObjPoint() && pObj->IsInserted() )
         [ #  # ][ #  # ]
    1274                 :            :             {
    1275         [ #  # ]:          0 :                 if (DragStat().IsEndDragChangesAttributes())
    1276                 :            :                 {
    1277 [ #  # ][ #  # ]:          0 :                     pUndo=getSdrDragView().GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj);
    1278                 :            : 
    1279         [ #  # ]:          0 :                     if (DragStat().IsEndDragChangesGeoAndAttributes())
    1280                 :            :                     {
    1281         [ #  # ]:          0 :                         vConnectorUndoActions = getSdrDragView().CreateConnectorUndo( *pObj );
    1282 [ #  # ][ #  # ]:          0 :                         pUndo2 = getSdrDragView().GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj);
    1283                 :            :                     }
    1284                 :            :                 }
    1285                 :            :                 else
    1286                 :            :                 {
    1287         [ #  # ]:          0 :                     vConnectorUndoActions = getSdrDragView().CreateConnectorUndo( *pObj );
    1288 [ #  # ][ #  # ]:          0 :                     pUndo= getSdrDragView().GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj);
    1289                 :            :                 }
    1290                 :            :             }
    1291                 :            : 
    1292         [ #  # ]:          0 :             if( pUndo )
    1293                 :            :             {
    1294 [ #  # ][ #  # ]:          0 :                 getSdrDragView().BegUndo( pUndo->GetComment() );
         [ #  # ][ #  # ]
    1295                 :            :             }
    1296                 :            :             else
    1297                 :            :             {
    1298         [ #  # ]:          0 :                 getSdrDragView().BegUndo();
    1299                 :            :             }
    1300                 :            :         }
    1301                 :            : 
    1302                 :            :         // Maybe use operator = for setting changed object data (do not change selection in
    1303                 :            :         // view, this will destroy the interactor). This is possible since a clone is now
    1304                 :            :         // directly modified by the modifiers. Only SdrTableObj is adding own UNDOs
    1305                 :            :         // in its SdrTableObj::endSpecialDrag, so currently not possible. OTOH it uses
    1306                 :            :         // a CreateUndoGeoObject(), so maybe setting SetEndDragChangesAttributes is okay. I
    1307                 :            :         // will test this now
    1308         [ #  # ]:          0 :         Rectangle aBoundRect0;
    1309                 :            : 
    1310 [ #  # ][ #  # ]:          0 :         if(pObj->GetUserCall())
    1311                 :            :         {
    1312         [ #  # ]:          0 :             aBoundRect0 = pObj->GetLastBoundRect();
    1313                 :            :         }
    1314                 :            : 
    1315         [ #  # ]:          0 :         bRet = pObj->applySpecialDrag(DragStat());
    1316                 :            : 
    1317         [ #  # ]:          0 :         if(bRet)
    1318                 :            :         {
    1319         [ #  # ]:          0 :             pObj->SetChanged();
    1320         [ #  # ]:          0 :             pObj->BroadcastObjectChange();
    1321         [ #  # ]:          0 :             pObj->SendUserCall( SDRUSERCALL_RESIZE, aBoundRect0 );
    1322                 :            :         }
    1323                 :            : 
    1324         [ #  # ]:          0 :         if(bRet)
    1325                 :            :         {
    1326         [ #  # ]:          0 :             if( bUndo )
    1327                 :            :             {
    1328         [ #  # ]:          0 :                 getSdrDragView().AddUndoActions( vConnectorUndoActions );
    1329                 :            : 
    1330         [ #  # ]:          0 :                 if ( pUndo )
    1331                 :            :                 {
    1332         [ #  # ]:          0 :                     getSdrDragView().AddUndo(pUndo);
    1333                 :            :                 }
    1334                 :            : 
    1335         [ #  # ]:          0 :                 if ( pUndo2 )
    1336                 :            :                 {
    1337         [ #  # ]:          0 :                     getSdrDragView().AddUndo(pUndo2);
    1338                 :            :                 }
    1339                 :            :             }
    1340                 :            :         }
    1341                 :            :         else
    1342                 :            :         {
    1343         [ #  # ]:          0 :             if( bUndo )
    1344                 :            :             {
    1345                 :          0 :                 std::vector< SdrUndoAction* >::iterator vConnectorUndoIter( vConnectorUndoActions.begin() );
    1346                 :            : 
    1347 [ #  # ][ #  # ]:          0 :                 while( vConnectorUndoIter != vConnectorUndoActions.end() )
    1348                 :            :                 {
    1349 [ #  # ][ #  # ]:          0 :                     delete *vConnectorUndoIter++;
                 [ #  # ]
    1350                 :            :                 }
    1351                 :            : 
    1352 [ #  # ][ #  # ]:          0 :                 delete pUndo;
    1353 [ #  # ][ #  # ]:          0 :                 delete pUndo2;
    1354                 :            :             }
    1355                 :            :         }
    1356                 :            : 
    1357         [ #  # ]:          0 :         if( bUndo )
    1358         [ #  # ]:          0 :             getSdrDragView().EndUndo();
    1359                 :            :     }
    1360                 :            : 
    1361                 :          0 :     return bRet;
    1362                 :            : }
    1363                 :            : 
    1364                 :          0 : Pointer SdrDragObjOwn::GetSdrDragPointer() const
    1365                 :            : {
    1366                 :          0 :     const SdrHdl* pHdl=GetDragHdl();
    1367                 :            : 
    1368         [ #  # ]:          0 :     if (pHdl)
    1369                 :            :     {
    1370                 :          0 :         return pHdl->GetPointer();
    1371                 :            :     }
    1372                 :            : 
    1373                 :          0 :     return Pointer(POINTER_MOVE);
    1374                 :            : }
    1375                 :            : 
    1376                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    1377                 :            : 
    1378 [ #  # ][ #  # ]:          0 : TYPEINIT1(SdrDragMove,SdrDragMethod);
    1379                 :            : 
    1380                 :          0 : void SdrDragMove::createSdrDragEntryForSdrObject(const SdrObject& rOriginal, sdr::contact::ObjectContact& rObjectContact, bool /*bModify*/)
    1381                 :            : {
    1382                 :            :     // for SdrDragMove, use current Primitive2DSequence of SdrObject visualization
    1383                 :            :     // in given ObjectContact directly
    1384         [ #  # ]:          0 :     sdr::contact::ViewContact& rVC = rOriginal.GetViewContact();
    1385         [ #  # ]:          0 :     sdr::contact::ViewObjectContact& rVOC = rVC.GetViewObjectContact(rObjectContact);
    1386         [ #  # ]:          0 :     sdr::contact::DisplayInfo aDisplayInfo;
    1387                 :            : 
    1388                 :            :     // Do not use the last ViewPort set at the OC from the last ProcessDisplay(),
    1389                 :            :     // here we want the complete primitive sequence without visible clippings
    1390         [ #  # ]:          0 :     rObjectContact.resetViewPort();
    1391                 :            : 
    1392 [ #  # ][ #  # ]:          0 :     addSdrDragEntry(new SdrDragEntryPrimitive2DSequence(rVOC.getPrimitive2DSequenceHierarchy(aDisplayInfo), true));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1393                 :          0 : }
    1394                 :            : 
    1395                 :          0 : void SdrDragMove::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
    1396                 :            : {
    1397         [ #  # ]:          0 :     rTarget.Move(Size(DragStat().GetDX(), DragStat().GetDY()));
    1398                 :          0 : }
    1399                 :            : 
    1400                 :          0 : SdrDragMove::SdrDragMove(SdrDragView& rNewView)
    1401                 :          0 : :   SdrDragMethod(rNewView)
    1402                 :            : {
    1403                 :          0 :     setMoveOnly(true);
    1404                 :          0 : }
    1405                 :            : 
    1406                 :          0 : void SdrDragMove::TakeSdrDragComment(XubString& rStr) const
    1407                 :            : {
    1408                 :          0 :     rtl::OUString aStr;
    1409                 :            : 
    1410         [ #  # ]:          0 :     ImpTakeDescriptionStr(STR_DragMethMove, rStr);
    1411         [ #  # ]:          0 :     rStr.AppendAscii(" (x=");
    1412 [ #  # ][ #  # ]:          0 :     getSdrDragView().GetModel()->TakeMetricStr(DragStat().GetDX(), aStr);
    1413 [ #  # ][ #  # ]:          0 :     rStr.Append(aStr);
                 [ #  # ]
    1414         [ #  # ]:          0 :     rStr.AppendAscii(" y=");
    1415 [ #  # ][ #  # ]:          0 :     getSdrDragView().GetModel()->TakeMetricStr(DragStat().GetDY(), aStr);
    1416 [ #  # ][ #  # ]:          0 :     rStr.Append(aStr);
                 [ #  # ]
    1417         [ #  # ]:          0 :     rStr += sal_Unicode(')');
    1418                 :            : 
    1419         [ #  # ]:          0 :     if(getSdrDragView().IsDragWithCopy())
    1420                 :            :     {
    1421 [ #  # ][ #  # ]:          0 :         if(!getSdrDragView().IsInsObjPoint() && !getSdrDragView().IsInsGluePoint())
                 [ #  # ]
    1422                 :            :         {
    1423 [ #  # ][ #  # ]:          0 :             rStr += ImpGetResStr(STR_EditWithCopy);
                 [ #  # ]
    1424                 :            :         }
    1425                 :          0 :     }
    1426                 :          0 : }
    1427                 :            : 
    1428                 :          0 : bool SdrDragMove::BeginSdrDrag()
    1429                 :            : {
    1430                 :          0 :     DragStat().SetActionRect(GetMarkedRect());
    1431                 :          0 :     Show();
    1432                 :            : 
    1433                 :          0 :     return true;
    1434                 :            : }
    1435                 :            : 
    1436                 :          0 : basegfx::B2DHomMatrix SdrDragMove::getCurrentTransformation()
    1437                 :            : {
    1438                 :          0 :     return basegfx::tools::createTranslateB2DHomMatrix(DragStat().GetDX(), DragStat().GetDY());
    1439                 :            : }
    1440                 :            : 
    1441                 :          0 : void SdrDragMove::ImpCheckSnap(const Point& rPt)
    1442                 :            : {
    1443                 :          0 :     Point aPt(rPt);
    1444         [ #  # ]:          0 :     sal_uInt16 nRet=SnapPos(aPt);
    1445                 :          0 :     aPt-=rPt;
    1446                 :            : 
    1447         [ #  # ]:          0 :     if ((nRet & SDRSNAP_XSNAPPED) !=0)
    1448                 :            :     {
    1449         [ #  # ]:          0 :         if (bXSnapped)
    1450                 :            :         {
    1451         [ #  # ]:          0 :             if (Abs(aPt.X())<Abs(nBestXSnap))
    1452                 :            :             {
    1453                 :          0 :                 nBestXSnap=aPt.X();
    1454                 :            :             }
    1455                 :            :         }
    1456                 :            :         else
    1457                 :            :         {
    1458                 :          0 :             nBestXSnap=aPt.X();
    1459                 :          0 :             bXSnapped=true;
    1460                 :            :         }
    1461                 :            :     }
    1462                 :            : 
    1463         [ #  # ]:          0 :     if ((nRet & SDRSNAP_YSNAPPED) !=0)
    1464                 :            :     {
    1465         [ #  # ]:          0 :         if (bYSnapped)
    1466                 :            :         {
    1467         [ #  # ]:          0 :             if (Abs(aPt.Y())<Abs(nBestYSnap))
    1468                 :            :             {
    1469                 :          0 :                 nBestYSnap=aPt.Y();
    1470                 :            :             }
    1471                 :            :         }
    1472                 :            :         else
    1473                 :            :         {
    1474                 :          0 :             nBestYSnap=aPt.Y();
    1475                 :          0 :             bYSnapped=true;
    1476                 :            :         }
    1477                 :            :     }
    1478                 :          0 : }
    1479                 :            : 
    1480                 :          0 : void SdrDragMove::MoveSdrDrag(const Point& rNoSnapPnt_)
    1481                 :            : {
    1482                 :          0 :     nBestXSnap=0;
    1483                 :          0 :     nBestYSnap=0;
    1484                 :          0 :     bXSnapped=false;
    1485                 :          0 :     bYSnapped=false;
    1486                 :          0 :     Point aNoSnapPnt(rNoSnapPnt_);
    1487         [ #  # ]:          0 :     const Rectangle& aSR=GetMarkedRect();
    1488         [ #  # ]:          0 :     long nMovedx=aNoSnapPnt.X()-DragStat().GetStart().X();
    1489         [ #  # ]:          0 :     long nMovedy=aNoSnapPnt.Y()-DragStat().GetStart().Y();
    1490                 :          0 :     Point aLO(aSR.TopLeft());      aLO.X()+=nMovedx; aLO.Y()+=nMovedy;
    1491         [ #  # ]:          0 :     Point aRU(aSR.BottomRight());  aRU.X()+=nMovedx; aRU.Y()+=nMovedy;
    1492                 :          0 :     Point aLU(aLO.X(),aRU.Y());
    1493                 :          0 :     Point aRO(aRU.X(),aLO.Y());
    1494         [ #  # ]:          0 :     ImpCheckSnap(aLO);
    1495                 :            : 
    1496         [ #  # ]:          0 :     if (!getSdrDragView().IsMoveSnapOnlyTopLeft())
    1497                 :            :     {
    1498         [ #  # ]:          0 :         ImpCheckSnap(aRO);
    1499         [ #  # ]:          0 :         ImpCheckSnap(aLU);
    1500         [ #  # ]:          0 :         ImpCheckSnap(aRU);
    1501                 :            :     }
    1502                 :            : 
    1503                 :          0 :     Point aPnt(aNoSnapPnt.X()+nBestXSnap,aNoSnapPnt.Y()+nBestYSnap);
    1504                 :          0 :     bool bOrtho=getSdrDragView().IsOrtho();
    1505                 :            : 
    1506         [ #  # ]:          0 :     if (bOrtho)
    1507 [ #  # ][ #  # ]:          0 :         OrthoDistance8(DragStat().GetStart(),aPnt,getSdrDragView().IsBigOrtho());
    1508                 :            : 
    1509 [ #  # ][ #  # ]:          0 :     if (DragStat().CheckMinMoved(aNoSnapPnt))
    1510                 :            :     {
    1511                 :          0 :         Point aPt1(aPnt);
    1512                 :          0 :         Rectangle aLR(getSdrDragView().GetWorkArea());
    1513         [ #  # ]:          0 :         bool bWorkArea=!aLR.IsEmpty();
    1514                 :          0 :         bool bDragLimit=IsDragLimit();
    1515                 :            : 
    1516 [ #  # ][ #  # ]:          0 :         if (bDragLimit || bWorkArea)
    1517                 :            :         {
    1518         [ #  # ]:          0 :             Rectangle aSR2(GetMarkedRect());
    1519         [ #  # ]:          0 :             Point aD(aPt1-DragStat().GetStart());
    1520                 :            : 
    1521         [ #  # ]:          0 :             if (bDragLimit)
    1522                 :            :             {
    1523                 :          0 :                 Rectangle aR2(GetDragLimitRect());
    1524                 :            : 
    1525         [ #  # ]:          0 :                 if (bWorkArea)
    1526         [ #  # ]:          0 :                     aLR.Intersection(aR2);
    1527                 :            :                 else
    1528                 :          0 :                     aLR=aR2;
    1529                 :            :             }
    1530                 :            : 
    1531 [ #  # ][ #  # ]:          0 :             if (aSR2.Left()>aLR.Left() || aSR2.Right()<aLR.Right())
                 [ #  # ]
    1532                 :            :             { // any space to move to?
    1533         [ #  # ]:          0 :                 aSR2.Move(aD.X(),0);
    1534                 :            : 
    1535         [ #  # ]:          0 :                 if (aSR2.Left()<aLR.Left())
    1536                 :            :                 {
    1537                 :          0 :                     aPt1.X()-=aSR2.Left()-aLR.Left();
    1538                 :            :                 }
    1539         [ #  # ]:          0 :                 else if (aSR2.Right()>aLR.Right())
    1540                 :            :                 {
    1541                 :          0 :                     aPt1.X()-=aSR2.Right()-aLR.Right();
    1542                 :            :                 }
    1543                 :            :             }
    1544                 :            :             else
    1545         [ #  # ]:          0 :                 aPt1.X()=DragStat().GetStart().X(); // no space to move to
    1546                 :            : 
    1547 [ #  # ][ #  # ]:          0 :             if (aSR2.Top()>aLR.Top() || aSR2.Bottom()<aLR.Bottom())
                 [ #  # ]
    1548                 :            :             { // any space to move to?
    1549         [ #  # ]:          0 :                 aSR2.Move(0,aD.Y());
    1550                 :            : 
    1551         [ #  # ]:          0 :                 if (aSR2.Top()<aLR.Top())
    1552                 :            :                 {
    1553                 :          0 :                     aPt1.Y()-=aSR2.Top()-aLR.Top();
    1554                 :            :                 }
    1555         [ #  # ]:          0 :                 else if (aSR2.Bottom()>aLR.Bottom())
    1556                 :            :                 {
    1557                 :          0 :                     aPt1.Y()-=aSR2.Bottom()-aLR.Bottom();
    1558                 :            :                 }
    1559                 :            :             }
    1560                 :            :             else
    1561         [ #  # ]:          0 :                 aPt1.Y()=DragStat().GetStart().Y(); // no space to move to
    1562                 :            :         }
    1563                 :            : 
    1564         [ #  # ]:          0 :         if (getSdrDragView().IsDraggingGluePoints())
    1565                 :            :         { // restrict glue points to the BoundRect of the Obj
    1566         [ #  # ]:          0 :             aPt1-=DragStat().GetStart();
    1567                 :          0 :             const SdrMarkList& rML=GetMarkedObjectList();
    1568                 :          0 :             sal_uLong nMarkAnz=rML.GetMarkCount();
    1569                 :            : 
    1570         [ #  # ]:          0 :             for (sal_uLong nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++)
    1571                 :            :             {
    1572         [ #  # ]:          0 :                 const SdrMark* pM=rML.GetMark(nMarkNum);
    1573                 :          0 :                 const SdrUShortCont* pPts=pM->GetMarkedGluePoints();
    1574         [ #  # ]:          0 :                 sal_uLong nPtAnz=pPts==NULL ? 0 : pPts->size();
    1575                 :            : 
    1576         [ #  # ]:          0 :                 if (nPtAnz!=0)
    1577                 :            :                 {
    1578         [ #  # ]:          0 :                     const SdrObject* pObj=pM->GetMarkedSdrObj();
    1579         [ #  # ]:          0 :                     const SdrGluePointList* pGPL=pObj->GetGluePointList();
    1580         [ #  # ]:          0 :                     Rectangle aBound(pObj->GetCurrentBoundRect());
    1581                 :            : 
    1582 [ #  # ][ #  # ]:          0 :                     for (SdrUShortCont::const_iterator it = pPts->begin(); it != pPts->end(); ++it)
                 [ #  # ]
    1583                 :            :                     {
    1584         [ #  # ]:          0 :                         sal_uInt16 nId = *it;
    1585         [ #  # ]:          0 :                         sal_uInt16 nGlueNum=pGPL->FindGluePoint(nId);
    1586                 :            : 
    1587         [ #  # ]:          0 :                         if (nGlueNum!=SDRGLUEPOINT_NOTFOUND)
    1588                 :            :                         {
    1589 [ #  # ][ #  # ]:          0 :                             Point aPt((*pGPL)[nGlueNum].GetAbsolutePos(*pObj));
    1590                 :          0 :                             aPt+=aPt1; // move by this much
    1591         [ #  # ]:          0 :                             if (aPt.X()<aBound.Left()  ) aPt1.X()-=aPt.X()-aBound.Left()  ;
    1592         [ #  # ]:          0 :                             if (aPt.X()>aBound.Right() ) aPt1.X()-=aPt.X()-aBound.Right() ;
    1593         [ #  # ]:          0 :                             if (aPt.Y()<aBound.Top()   ) aPt1.Y()-=aPt.Y()-aBound.Top()   ;
    1594         [ #  # ]:          0 :                             if (aPt.Y()>aBound.Bottom()) aPt1.Y()-=aPt.Y()-aBound.Bottom();
    1595                 :            :                         }
    1596                 :            :                     }
    1597                 :            :                 }
    1598                 :            :             }
    1599                 :            : 
    1600         [ #  # ]:          0 :             aPt1+=DragStat().GetStart();
    1601                 :            :         }
    1602                 :            : 
    1603         [ #  # ]:          0 :         if (bOrtho)
    1604 [ #  # ][ #  # ]:          0 :             OrthoDistance8(DragStat().GetStart(),aPt1,false);
    1605                 :            : 
    1606 [ #  # ][ #  # ]:          0 :         if (aPt1!=DragStat().GetNow())
    1607                 :            :         {
    1608         [ #  # ]:          0 :             Hide();
    1609         [ #  # ]:          0 :             DragStat().NextMove(aPt1);
    1610         [ #  # ]:          0 :             Rectangle aAction(GetMarkedRect());
    1611 [ #  # ][ #  # ]:          0 :             aAction.Move(DragStat().GetDX(),DragStat().GetDY());
                 [ #  # ]
    1612                 :          0 :             DragStat().SetActionRect(aAction);
    1613         [ #  # ]:          0 :             Show();
    1614                 :            :         }
    1615                 :            :     }
    1616                 :          0 : }
    1617                 :            : 
    1618                 :          0 : bool SdrDragMove::EndSdrDrag(bool bCopy)
    1619                 :            : {
    1620                 :          0 :     Hide();
    1621                 :            : 
    1622 [ #  # ][ #  # ]:          0 :     if (getSdrDragView().IsInsObjPoint() || getSdrDragView().IsInsGluePoint())
                 [ #  # ]
    1623                 :          0 :         bCopy=false;
    1624                 :            : 
    1625         [ #  # ]:          0 :     if (IsDraggingPoints())
    1626                 :            :     {
    1627         [ #  # ]:          0 :         getSdrDragView().MoveMarkedPoints(Size(DragStat().GetDX(),DragStat().GetDY()),bCopy);
    1628                 :            :     }
    1629         [ #  # ]:          0 :     else if (IsDraggingGluePoints())
    1630                 :            :     {
    1631         [ #  # ]:          0 :         getSdrDragView().MoveMarkedGluePoints(Size(DragStat().GetDX(),DragStat().GetDY()),bCopy);
    1632                 :            :     }
    1633                 :            :     else
    1634                 :            :     {
    1635         [ #  # ]:          0 :         getSdrDragView().MoveMarkedObj(Size(DragStat().GetDX(),DragStat().GetDY()),bCopy);
    1636                 :            :     }
    1637                 :            : 
    1638                 :          0 :     return true;
    1639                 :            : }
    1640                 :            : 
    1641                 :          0 : Pointer SdrDragMove::GetSdrDragPointer() const
    1642                 :            : {
    1643 [ #  # ][ #  # ]:          0 :     if (IsDraggingPoints() || IsDraggingGluePoints())
                 [ #  # ]
    1644                 :            :     {
    1645                 :          0 :         return Pointer(POINTER_MOVEPOINT);
    1646                 :            :     }
    1647                 :            :     else
    1648                 :            :     {
    1649                 :          0 :         return Pointer(POINTER_MOVE);
    1650                 :            :     }
    1651                 :            : }
    1652                 :            : 
    1653                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    1654                 :            : 
    1655 [ #  # ][ #  # ]:          0 : TYPEINIT1(SdrDragResize,SdrDragMethod);
    1656                 :            : 
    1657                 :          0 : SdrDragResize::SdrDragResize(SdrDragView& rNewView)
    1658                 :            : :   SdrDragMethod(rNewView),
    1659                 :            :     aXFact(1,1),
    1660 [ #  # ][ #  # ]:          0 :     aYFact(1,1)
    1661                 :            : {
    1662                 :          0 : }
    1663                 :            : 
    1664                 :          0 : void SdrDragResize::TakeSdrDragComment(XubString& rStr) const
    1665                 :            : {
    1666         [ #  # ]:          0 :     ImpTakeDescriptionStr(STR_DragMethResize, rStr);
    1667         [ #  # ]:          0 :     bool bEqual(aXFact == aYFact);
    1668         [ #  # ]:          0 :     Fraction aFact1(1,1);
    1669         [ #  # ]:          0 :     Point aStart(DragStat().GetStart());
    1670                 :          0 :     Point aRef(DragStat().GetRef1());
    1671                 :          0 :     sal_Int32 nXDiv(aStart.X() - aRef.X());
    1672                 :            : 
    1673         [ #  # ]:          0 :     if(!nXDiv)
    1674                 :          0 :         nXDiv = 1;
    1675                 :            : 
    1676                 :          0 :     sal_Int32 nYDiv(aStart.Y() - aRef.Y());
    1677                 :            : 
    1678         [ #  # ]:          0 :     if(!nYDiv)
    1679                 :          0 :         nYDiv = 1;
    1680                 :            : 
    1681 [ #  # ][ #  # ]:          0 :     bool bX(aXFact != aFact1 && Abs(nXDiv) > 1);
                 [ #  # ]
    1682 [ #  # ][ #  # ]:          0 :     bool bY(aYFact != aFact1 && Abs(nYDiv) > 1);
                 [ #  # ]
    1683                 :            : 
    1684 [ #  # ][ #  # ]:          0 :     if(bX || bY)
    1685                 :            :     {
    1686         [ #  # ]:          0 :         XubString aStr;
    1687                 :            : 
    1688         [ #  # ]:          0 :         rStr.AppendAscii(" (");
    1689                 :            : 
    1690         [ #  # ]:          0 :         if(bX)
    1691                 :            :         {
    1692         [ #  # ]:          0 :             if(!bEqual)
    1693         [ #  # ]:          0 :                 rStr.AppendAscii("x=");
    1694                 :            : 
    1695         [ #  # ]:          0 :             getSdrDragView().GetModel()->TakePercentStr(aXFact, aStr);
    1696         [ #  # ]:          0 :             rStr += aStr;
    1697                 :            :         }
    1698                 :            : 
    1699 [ #  # ][ #  # ]:          0 :         if(bY && !bEqual)
    1700                 :            :         {
    1701         [ #  # ]:          0 :             if(bX)
    1702         [ #  # ]:          0 :                 rStr += sal_Unicode(' ');
    1703                 :            : 
    1704         [ #  # ]:          0 :             rStr.AppendAscii("y=");
    1705         [ #  # ]:          0 :             getSdrDragView().GetModel()->TakePercentStr(aYFact, aStr);
    1706         [ #  # ]:          0 :             rStr += aStr;
    1707                 :            :         }
    1708                 :            : 
    1709 [ #  # ][ #  # ]:          0 :         rStr += sal_Unicode(')');
    1710                 :            :     }
    1711                 :            : 
    1712         [ #  # ]:          0 :     if(getSdrDragView().IsDragWithCopy())
    1713 [ #  # ][ #  # ]:          0 :         rStr += ImpGetResStr(STR_EditWithCopy);
                 [ #  # ]
    1714                 :          0 : }
    1715                 :            : 
    1716                 :          0 : bool SdrDragResize::BeginSdrDrag()
    1717                 :            : {
    1718                 :          0 :     SdrHdlKind eRefHdl=HDL_MOVE;
    1719                 :          0 :     SdrHdl* pRefHdl=NULL;
    1720                 :            : 
    1721   [ #  #  #  #  :          0 :     switch (GetDragHdlKind())
             #  #  #  #  
                      # ]
    1722                 :            :     {
    1723                 :          0 :         case HDL_UPLFT: eRefHdl=HDL_LWRGT; break;
    1724                 :          0 :         case HDL_UPPER: eRefHdl=HDL_LOWER; DragStat().SetHorFixed(true); break;
    1725                 :          0 :         case HDL_UPRGT: eRefHdl=HDL_LWLFT; break;
    1726                 :          0 :         case HDL_LEFT : eRefHdl=HDL_RIGHT; DragStat().SetVerFixed(true); break;
    1727                 :          0 :         case HDL_RIGHT: eRefHdl=HDL_LEFT ; DragStat().SetVerFixed(true); break;
    1728                 :          0 :         case HDL_LWLFT: eRefHdl=HDL_UPRGT; break;
    1729                 :          0 :         case HDL_LOWER: eRefHdl=HDL_UPPER; DragStat().SetHorFixed(true); break;
    1730                 :          0 :         case HDL_LWRGT: eRefHdl=HDL_UPLFT; break;
    1731                 :          0 :         default: break;
    1732                 :            :     }
    1733                 :            : 
    1734         [ #  # ]:          0 :     if (eRefHdl!=HDL_MOVE)
    1735                 :          0 :         pRefHdl=GetHdlList().GetHdl(eRefHdl);
    1736                 :            : 
    1737 [ #  # ][ #  # ]:          0 :     if (pRefHdl!=NULL && !getSdrDragView().IsResizeAtCenter())
                 [ #  # ]
    1738                 :            :     {
    1739                 :          0 :         DragStat().Ref1()=pRefHdl->GetPos();
    1740                 :            :     }
    1741                 :            :     else
    1742                 :            :     {
    1743                 :          0 :         SdrHdl* pRef1=GetHdlList().GetHdl(HDL_UPLFT);
    1744                 :          0 :         SdrHdl* pRef2=GetHdlList().GetHdl(HDL_LWRGT);
    1745                 :            : 
    1746 [ #  # ][ #  # ]:          0 :         if (pRef1!=NULL && pRef2!=NULL)
    1747                 :            :         {
    1748         [ #  # ]:          0 :             DragStat().Ref1()=Rectangle(pRef1->GetPos(),pRef2->GetPos()).Center();
    1749                 :            :         }
    1750                 :            :         else
    1751                 :            :         {
    1752                 :          0 :             DragStat().Ref1()=GetMarkedRect().Center();
    1753                 :            :         }
    1754                 :            :     }
    1755                 :            : 
    1756                 :          0 :     Show();
    1757                 :            : 
    1758                 :          0 :     return true;
    1759                 :            : }
    1760                 :            : 
    1761                 :          0 : basegfx::B2DHomMatrix SdrDragResize::getCurrentTransformation()
    1762                 :            : {
    1763                 :            :     basegfx::B2DHomMatrix aRetval(basegfx::tools::createTranslateB2DHomMatrix(
    1764                 :          0 :         -DragStat().Ref1().X(), -DragStat().Ref1().Y()));
    1765 [ #  # ][ #  # ]:          0 :     aRetval.scale(aXFact, aYFact);
                 [ #  # ]
    1766         [ #  # ]:          0 :     aRetval.translate(DragStat().Ref1().X(), DragStat().Ref1().Y());
    1767                 :            : 
    1768                 :          0 :     return aRetval;
    1769                 :            : }
    1770                 :            : 
    1771                 :          0 : void SdrDragResize::MoveSdrDrag(const Point& rNoSnapPnt)
    1772                 :            : {
    1773         [ #  # ]:          0 :     Point aPnt(GetSnapPos(rNoSnapPnt));
    1774         [ #  # ]:          0 :     Point aStart(DragStat().GetStart());
    1775                 :          0 :     Point aRef(DragStat().GetRef1());
    1776         [ #  # ]:          0 :     Fraction aMaxFact(0x7FFFFFFF,1);
    1777                 :          0 :     Rectangle aLR(getSdrDragView().GetWorkArea());
    1778         [ #  # ]:          0 :     bool bWorkArea=!aLR.IsEmpty();
    1779                 :          0 :     bool bDragLimit=IsDragLimit();
    1780                 :            : 
    1781 [ #  # ][ #  # ]:          0 :     if (bDragLimit || bWorkArea)
    1782                 :            :     {
    1783         [ #  # ]:          0 :         Rectangle aSR(GetMarkedRect());
    1784                 :            : 
    1785         [ #  # ]:          0 :         if (bDragLimit)
    1786                 :            :         {
    1787                 :          0 :             Rectangle aR2(GetDragLimitRect());
    1788                 :            : 
    1789         [ #  # ]:          0 :             if (bWorkArea)
    1790         [ #  # ]:          0 :                 aLR.Intersection(aR2);
    1791                 :            :             else
    1792                 :          0 :                 aLR=aR2;
    1793                 :            :         }
    1794                 :            : 
    1795         [ #  # ]:          0 :         if (aPnt.X()<aLR.Left())
    1796                 :          0 :             aPnt.X()=aLR.Left();
    1797         [ #  # ]:          0 :         else if (aPnt.X()>aLR.Right())
    1798                 :          0 :             aPnt.X()=aLR.Right();
    1799                 :            : 
    1800         [ #  # ]:          0 :         if (aPnt.Y()<aLR.Top())
    1801                 :          0 :             aPnt.Y()=aLR.Top();
    1802         [ #  # ]:          0 :         else if (aPnt.Y()>aLR.Bottom())
    1803                 :          0 :             aPnt.Y()=aLR.Bottom();
    1804                 :            : 
    1805         [ #  # ]:          0 :         if (aRef.X()>aSR.Left())
    1806                 :            :         {
    1807         [ #  # ]:          0 :             Fraction aMax(aRef.X()-aLR.Left(),aRef.X()-aSR.Left());
    1808                 :            : 
    1809 [ #  # ][ #  # ]:          0 :             if (aMax<aMaxFact)
    1810         [ #  # ]:          0 :                 aMaxFact=aMax;
    1811                 :            :         }
    1812                 :            : 
    1813         [ #  # ]:          0 :         if (aRef.X()<aSR.Right())
    1814                 :            :         {
    1815         [ #  # ]:          0 :             Fraction aMax(aLR.Right()-aRef.X(),aSR.Right()-aRef.X());
    1816                 :            : 
    1817 [ #  # ][ #  # ]:          0 :             if (aMax<aMaxFact)
    1818         [ #  # ]:          0 :                 aMaxFact=aMax;
    1819                 :            :         }
    1820                 :            : 
    1821         [ #  # ]:          0 :         if (aRef.Y()>aSR.Top())
    1822                 :            :         {
    1823         [ #  # ]:          0 :             Fraction aMax(aRef.Y()-aLR.Top(),aRef.Y()-aSR.Top());
    1824                 :            : 
    1825 [ #  # ][ #  # ]:          0 :             if (aMax<aMaxFact)
    1826         [ #  # ]:          0 :                 aMaxFact=aMax;
    1827                 :            :         }
    1828                 :            : 
    1829         [ #  # ]:          0 :         if (aRef.Y()<aSR.Bottom())
    1830                 :            :         {
    1831         [ #  # ]:          0 :             Fraction aMax(aLR.Bottom()-aRef.Y(),aSR.Bottom()-aRef.Y());
    1832                 :            : 
    1833 [ #  # ][ #  # ]:          0 :             if (aMax<aMaxFact)
    1834         [ #  # ]:          0 :                 aMaxFact=aMax;
    1835                 :            :         }
    1836                 :            :     }
    1837                 :            : 
    1838         [ #  # ]:          0 :     long nXDiv=aStart.X()-aRef.X(); if (nXDiv==0) nXDiv=1;
    1839         [ #  # ]:          0 :     long nYDiv=aStart.Y()-aRef.Y(); if (nYDiv==0) nYDiv=1;
    1840                 :          0 :     long nXMul=aPnt.X()-aRef.X();
    1841                 :          0 :     long nYMul=aPnt.Y()-aRef.Y();
    1842                 :            : 
    1843         [ #  # ]:          0 :     if (nXDiv<0)
    1844                 :            :     {
    1845                 :          0 :         nXDiv=-nXDiv;
    1846                 :          0 :         nXMul=-nXMul;
    1847                 :            :     }
    1848                 :            : 
    1849         [ #  # ]:          0 :     if (nYDiv<0)
    1850                 :            :     {
    1851                 :          0 :         nYDiv=-nYDiv;
    1852                 :          0 :         nYMul=-nYMul;
    1853                 :            :     }
    1854                 :            : 
    1855         [ #  # ]:          0 :     bool bXNeg=nXMul<0; if (bXNeg) nXMul=-nXMul;
    1856         [ #  # ]:          0 :     bool bYNeg=nYMul<0; if (bYNeg) nYMul=-nYMul;
    1857 [ #  # ][ #  # ]:          0 :     bool bOrtho=getSdrDragView().IsOrtho() || !getSdrDragView().IsResizeAllowed(false);
                 [ #  # ]
    1858                 :            : 
    1859 [ #  # ][ #  # ]:          0 :     if (!DragStat().IsHorFixed() && !DragStat().IsVerFixed())
                 [ #  # ]
    1860                 :            :     {
    1861 [ #  # ][ #  # ]:          0 :         if (Abs(nXDiv)<=1 || Abs(nYDiv)<=1)
                 [ #  # ]
    1862                 :          0 :             bOrtho=false;
    1863                 :            : 
    1864         [ #  # ]:          0 :         if (bOrtho)
    1865                 :            :         {
    1866 [ #  # ][ #  # ]:          0 :             if ((Fraction(nXMul,nXDiv)>Fraction(nYMul,nYDiv)) !=getSdrDragView().IsBigOrtho())
         [ #  # ][ #  # ]
    1867                 :            :             {
    1868                 :          0 :                 nXMul=nYMul;
    1869                 :          0 :                 nXDiv=nYDiv;
    1870                 :            :             }
    1871                 :            :             else
    1872                 :            :             {
    1873                 :          0 :                 nYMul=nXMul;
    1874                 :          0 :                 nYDiv=nXDiv;
    1875                 :            :             }
    1876                 :            :         }
    1877                 :            :     }
    1878                 :            :     else
    1879                 :            :     {
    1880         [ #  # ]:          0 :         if (bOrtho)
    1881                 :            :         {
    1882         [ #  # ]:          0 :             if (DragStat().IsHorFixed())
    1883                 :            :             {
    1884                 :          0 :                 bXNeg=false;
    1885                 :          0 :                 nXMul=nYMul;
    1886                 :          0 :                 nXDiv=nYDiv;
    1887                 :            :             }
    1888                 :            : 
    1889         [ #  # ]:          0 :             if (DragStat().IsVerFixed())
    1890                 :            :             {
    1891                 :          0 :                 bYNeg=false;
    1892                 :          0 :                 nYMul=nXMul;
    1893                 :          0 :                 nYDiv=nXDiv;
    1894                 :            :             }
    1895                 :            :         }
    1896                 :            :         else
    1897                 :            :         {
    1898         [ #  # ]:          0 :             if (DragStat().IsHorFixed())
    1899                 :            :             {
    1900                 :          0 :                 bXNeg=false;
    1901                 :          0 :                 nXMul=1;
    1902                 :          0 :                 nXDiv=1;
    1903                 :            :             }
    1904                 :            : 
    1905         [ #  # ]:          0 :             if (DragStat().IsVerFixed())
    1906                 :            :             {
    1907                 :          0 :                 bYNeg=false;
    1908                 :          0 :                 nYMul=1;
    1909                 :          0 :                 nYDiv=1;
    1910                 :            :             }
    1911                 :            :         }
    1912                 :            :     }
    1913                 :            : 
    1914         [ #  # ]:          0 :     Fraction aNeuXFact(nXMul,nXDiv);
    1915         [ #  # ]:          0 :     Fraction aNeuYFact(nYMul,nYDiv);
    1916                 :            : 
    1917         [ #  # ]:          0 :     if (bOrtho)
    1918                 :            :     {
    1919 [ #  # ][ #  # ]:          0 :         if (aNeuXFact>aMaxFact)
    1920                 :            :         {
    1921         [ #  # ]:          0 :             aNeuXFact=aMaxFact;
    1922         [ #  # ]:          0 :             aNeuYFact=aMaxFact;
    1923                 :            :         }
    1924                 :            : 
    1925 [ #  # ][ #  # ]:          0 :         if (aNeuYFact>aMaxFact)
    1926                 :            :         {
    1927         [ #  # ]:          0 :             aNeuXFact=aMaxFact;
    1928         [ #  # ]:          0 :             aNeuYFact=aMaxFact;
    1929                 :            :         }
    1930                 :            :     }
    1931                 :            : 
    1932         [ #  # ]:          0 :     if (bXNeg)
    1933 [ #  # ][ #  # ]:          0 :         aNeuXFact=Fraction(-aNeuXFact.GetNumerator(),aNeuXFact.GetDenominator());
    1934                 :            : 
    1935         [ #  # ]:          0 :     if (bYNeg)
    1936 [ #  # ][ #  # ]:          0 :         aNeuYFact=Fraction(-aNeuYFact.GetNumerator(),aNeuYFact.GetDenominator());
    1937                 :            : 
    1938 [ #  # ][ #  # ]:          0 :     if (DragStat().CheckMinMoved(aPnt))
    1939                 :            :     {
    1940 [ #  # ][ #  # ]:          0 :         if ((!DragStat().IsHorFixed() && aPnt.X()!=DragStat().GetNow().X()) ||
           [ #  #  #  #  
           #  # ][ #  # ]
    1941         [ #  # ]:          0 :             (!DragStat().IsVerFixed() && aPnt.Y()!=DragStat().GetNow().Y()))
    1942                 :            :         {
    1943         [ #  # ]:          0 :             Hide();
    1944         [ #  # ]:          0 :             DragStat().NextMove(aPnt);
    1945         [ #  # ]:          0 :             aXFact=aNeuXFact;
    1946         [ #  # ]:          0 :             aYFact=aNeuYFact;
    1947         [ #  # ]:          0 :             Show();
    1948                 :            :         }
    1949                 :            :     }
    1950                 :          0 : }
    1951                 :            : 
    1952                 :          0 : void SdrDragResize::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
    1953                 :            : {
    1954                 :          0 :     rTarget.Resize(DragStat().Ref1(),aXFact,aYFact);
    1955                 :          0 : }
    1956                 :            : 
    1957                 :          0 : bool SdrDragResize::EndSdrDrag(bool bCopy)
    1958                 :            : {
    1959                 :          0 :     Hide();
    1960                 :            : 
    1961         [ #  # ]:          0 :     if (IsDraggingPoints())
    1962                 :            :     {
    1963                 :          0 :         getSdrDragView().ResizeMarkedPoints(DragStat().Ref1(),aXFact,aYFact,bCopy);
    1964                 :            :     }
    1965         [ #  # ]:          0 :     else if (IsDraggingGluePoints())
    1966                 :            :     {
    1967                 :          0 :         getSdrDragView().ResizeMarkedGluePoints(DragStat().Ref1(),aXFact,aYFact,bCopy);
    1968                 :            :     }
    1969                 :            :     else
    1970                 :            :     {
    1971                 :          0 :         getSdrDragView().ResizeMarkedObj(DragStat().Ref1(),aXFact,aYFact,bCopy);
    1972                 :            :     }
    1973                 :            : 
    1974                 :          0 :     return true;
    1975                 :            : }
    1976                 :            : 
    1977                 :          0 : Pointer SdrDragResize::GetSdrDragPointer() const
    1978                 :            : {
    1979                 :          0 :     const SdrHdl* pHdl=GetDragHdl();
    1980                 :            : 
    1981         [ #  # ]:          0 :     if (pHdl!=NULL)
    1982                 :            :     {
    1983                 :          0 :         return pHdl->GetPointer();
    1984                 :            :     }
    1985                 :            : 
    1986                 :          0 :     return Pointer(POINTER_MOVE);
    1987                 :            : }
    1988                 :            : 
    1989                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    1990                 :            : 
    1991 [ #  # ][ #  # ]:          0 : TYPEINIT1(SdrDragRotate,SdrDragMethod);
    1992                 :            : 
    1993                 :          0 : void SdrDragRotate::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
    1994                 :            : {
    1995                 :          0 :     rTarget.Rotate(DragStat().GetRef1(), nWink, sin(nWink*nPi180), cos(nWink*nPi180));
    1996                 :          0 : }
    1997                 :            : 
    1998                 :          0 : SdrDragRotate::SdrDragRotate(SdrDragView& rNewView)
    1999                 :            : :   SdrDragMethod(rNewView),
    2000                 :            :     nSin(0.0),
    2001                 :            :     nCos(1.0),
    2002                 :            :     nWink0(0),
    2003                 :            :     nWink(0),
    2004                 :          0 :     bRight(false)
    2005                 :            : {
    2006                 :          0 : }
    2007                 :            : 
    2008                 :          0 : void SdrDragRotate::TakeSdrDragComment(XubString& rStr) const
    2009                 :            : {
    2010         [ #  # ]:          0 :     ImpTakeDescriptionStr(STR_DragMethRotate, rStr);
    2011         [ #  # ]:          0 :     rStr.AppendAscii(" (");
    2012         [ #  # ]:          0 :     sal_Int32 nTmpWink(NormAngle360(nWink));
    2013                 :            : 
    2014 [ #  # ][ #  # ]:          0 :     if(bRight && nWink)
    2015                 :            :     {
    2016                 :          0 :         nTmpWink -= 36000;
    2017                 :            :     }
    2018                 :            : 
    2019                 :          0 :     rtl::OUString aStr;
    2020         [ #  # ]:          0 :     getSdrDragView().GetModel()->TakeWinkStr(nTmpWink, aStr);
    2021 [ #  # ][ #  # ]:          0 :     rStr.Append(aStr);
                 [ #  # ]
    2022         [ #  # ]:          0 :     rStr += sal_Unicode(')');
    2023                 :            : 
    2024         [ #  # ]:          0 :     if(getSdrDragView().IsDragWithCopy())
    2025 [ #  # ][ #  # ]:          0 :         rStr += ImpGetResStr(STR_EditWithCopy);
                 [ #  # ]
    2026                 :          0 : }
    2027                 :            : 
    2028                 :          0 : bool SdrDragRotate::BeginSdrDrag()
    2029                 :            : {
    2030                 :          0 :     SdrHdl* pH=GetHdlList().GetHdl(HDL_REF1);
    2031                 :            : 
    2032         [ #  # ]:          0 :     if (pH!=NULL)
    2033                 :            :     {
    2034                 :          0 :         Show();
    2035                 :          0 :         DragStat().Ref1()=pH->GetPos();
    2036         [ #  # ]:          0 :         nWink0=GetAngle(DragStat().GetStart()-DragStat().GetRef1());
    2037                 :          0 :         return true;
    2038                 :            :     }
    2039                 :            :     else
    2040                 :            :     {
    2041                 :            :         OSL_FAIL("SdrDragRotate::BeginSdrDrag(): No reference point handle found.");
    2042                 :          0 :         return false;
    2043                 :            :     }
    2044                 :            : }
    2045                 :            : 
    2046                 :          0 : basegfx::B2DHomMatrix SdrDragRotate::getCurrentTransformation()
    2047                 :            : {
    2048                 :            :     return basegfx::tools::createRotateAroundPoint(
    2049                 :          0 :         DragStat().GetRef1().X(), DragStat().GetRef1().Y(),
    2050                 :          0 :         -atan2(nSin, nCos));
    2051                 :            : }
    2052                 :            : 
    2053                 :          0 : void SdrDragRotate::MoveSdrDrag(const Point& rPnt_)
    2054                 :            : {
    2055                 :          0 :     Point aPnt(rPnt_);
    2056 [ #  # ][ #  # ]:          0 :     if (DragStat().CheckMinMoved(aPnt))
    2057                 :            :     {
    2058 [ #  # ][ #  # ]:          0 :         long nNeuWink=NormAngle360(GetAngle(aPnt-DragStat().GetRef1())-nWink0);
    2059                 :          0 :         long nSA=0;
    2060                 :            : 
    2061         [ #  # ]:          0 :         if (getSdrDragView().IsAngleSnapEnabled())
    2062                 :          0 :             nSA=getSdrDragView().GetSnapAngle();
    2063                 :            : 
    2064 [ #  # ][ #  # ]:          0 :         if (!getSdrDragView().IsRotateAllowed(false))
    2065                 :          0 :             nSA=9000;
    2066                 :            : 
    2067         [ #  # ]:          0 :         if (nSA!=0)
    2068                 :            :         { // angle snapping
    2069                 :          0 :             nNeuWink+=nSA/2;
    2070                 :          0 :             nNeuWink/=nSA;
    2071                 :          0 :             nNeuWink*=nSA;
    2072                 :            :         }
    2073                 :            : 
    2074         [ #  # ]:          0 :         nNeuWink=NormAngle180(nNeuWink);
    2075                 :            : 
    2076         [ #  # ]:          0 :         if (nWink!=nNeuWink)
    2077                 :            :         {
    2078         [ #  # ]:          0 :             sal_uInt16 nSekt0=GetAngleSector(nWink);
    2079         [ #  # ]:          0 :             sal_uInt16 nSekt1=GetAngleSector(nNeuWink);
    2080                 :            : 
    2081 [ #  # ][ #  # ]:          0 :             if (nSekt0==0 && nSekt1==3)
    2082                 :          0 :                 bRight=true;
    2083                 :            : 
    2084 [ #  # ][ #  # ]:          0 :             if (nSekt0==3 && nSekt1==0)
    2085                 :          0 :                 bRight=false;
    2086                 :            : 
    2087                 :          0 :             nWink=nNeuWink;
    2088                 :          0 :             double a=nWink*nPi180;
    2089                 :          0 :             double nSin1=sin(a); // calculate now, so as little time as possible
    2090                 :          0 :             double nCos1=cos(a); // passes between Hide() and Show()
    2091         [ #  # ]:          0 :             Hide();
    2092                 :          0 :             nSin=nSin1;
    2093                 :          0 :             nCos=nCos1;
    2094         [ #  # ]:          0 :             DragStat().NextMove(aPnt);
    2095         [ #  # ]:          0 :             Show();
    2096                 :            :         }
    2097                 :            :     }
    2098                 :          0 : }
    2099                 :            : 
    2100                 :          0 : bool SdrDragRotate::EndSdrDrag(bool bCopy)
    2101                 :            : {
    2102                 :          0 :     Hide();
    2103                 :            : 
    2104         [ #  # ]:          0 :     if (nWink!=0)
    2105                 :            :     {
    2106         [ #  # ]:          0 :         if (IsDraggingPoints())
    2107                 :            :         {
    2108                 :          0 :             getSdrDragView().RotateMarkedPoints(DragStat().GetRef1(),nWink,bCopy);
    2109                 :            :         }
    2110         [ #  # ]:          0 :         else if (IsDraggingGluePoints())
    2111                 :            :         {
    2112                 :          0 :             getSdrDragView().RotateMarkedGluePoints(DragStat().GetRef1(),nWink,bCopy);
    2113                 :            :         }
    2114                 :            :         else
    2115                 :            :         {
    2116                 :          0 :             getSdrDragView().RotateMarkedObj(DragStat().GetRef1(),nWink,bCopy);
    2117                 :            :         }
    2118                 :            :     }
    2119                 :          0 :     return true;
    2120                 :            : }
    2121                 :            : 
    2122                 :          0 : Pointer SdrDragRotate::GetSdrDragPointer() const
    2123                 :            : {
    2124                 :          0 :     return Pointer(POINTER_ROTATE);
    2125                 :            : }
    2126                 :            : 
    2127                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    2128                 :            : 
    2129 [ #  # ][ #  # ]:          0 : TYPEINIT1(SdrDragShear,SdrDragMethod);
    2130                 :            : 
    2131                 :          0 : SdrDragShear::SdrDragShear(SdrDragView& rNewView, bool bSlant1)
    2132                 :            : :   SdrDragMethod(rNewView),
    2133                 :            :     aFact(1,1),
    2134                 :            :     nWink0(0),
    2135                 :            :     nWink(0),
    2136                 :            :     nTan(0.0),
    2137                 :            :     bVertical(false),
    2138                 :            :     bResize(false),
    2139                 :            :     bUpSideDown(false),
    2140         [ #  # ]:          0 :     bSlant(bSlant1)
    2141                 :            : {
    2142                 :          0 : }
    2143                 :            : 
    2144                 :          0 : void SdrDragShear::TakeSdrDragComment(XubString& rStr) const
    2145                 :            : {
    2146         [ #  # ]:          0 :     ImpTakeDescriptionStr(STR_DragMethShear, rStr);
    2147         [ #  # ]:          0 :     rStr.AppendAscii(" (");
    2148                 :            : 
    2149                 :          0 :     sal_Int32 nTmpWink(nWink);
    2150                 :            : 
    2151         [ #  # ]:          0 :     if(bUpSideDown)
    2152                 :          0 :         nTmpWink += 18000;
    2153                 :            : 
    2154         [ #  # ]:          0 :     nTmpWink = NormAngle180(nTmpWink);
    2155                 :            : 
    2156                 :          0 :     rtl::OUString aStr;
    2157         [ #  # ]:          0 :     getSdrDragView().GetModel()->TakeWinkStr(nTmpWink, aStr);
    2158 [ #  # ][ #  # ]:          0 :     rStr.Append(aStr);
                 [ #  # ]
    2159         [ #  # ]:          0 :     rStr += sal_Unicode(')');
    2160                 :            : 
    2161         [ #  # ]:          0 :     if(getSdrDragView().IsDragWithCopy())
    2162 [ #  # ][ #  # ]:          0 :         rStr += ImpGetResStr(STR_EditWithCopy);
                 [ #  # ]
    2163                 :          0 : }
    2164                 :            : 
    2165                 :          0 : bool SdrDragShear::BeginSdrDrag()
    2166                 :            : {
    2167                 :          0 :     SdrHdlKind eRefHdl=HDL_MOVE;
    2168                 :          0 :     SdrHdl* pRefHdl=NULL;
    2169                 :            : 
    2170   [ #  #  #  #  :          0 :     switch (GetDragHdlKind())
                      # ]
    2171                 :            :     {
    2172                 :          0 :         case HDL_UPPER: eRefHdl=HDL_LOWER; break;
    2173                 :          0 :         case HDL_LOWER: eRefHdl=HDL_UPPER; break;
    2174                 :          0 :         case HDL_LEFT : eRefHdl=HDL_RIGHT; bVertical=true; break;
    2175                 :          0 :         case HDL_RIGHT: eRefHdl=HDL_LEFT ; bVertical=true; break;
    2176                 :          0 :         default: break;
    2177                 :            :     }
    2178                 :            : 
    2179         [ #  # ]:          0 :     if (eRefHdl!=HDL_MOVE)
    2180                 :          0 :         pRefHdl=GetHdlList().GetHdl(eRefHdl);
    2181                 :            : 
    2182         [ #  # ]:          0 :     if (pRefHdl!=NULL)
    2183                 :            :     {
    2184                 :          0 :         DragStat().Ref1()=pRefHdl->GetPos();
    2185         [ #  # ]:          0 :         nWink0=GetAngle(DragStat().GetStart()-DragStat().GetRef1());
    2186                 :            :     }
    2187                 :            :     else
    2188                 :            :     {
    2189                 :            :         OSL_FAIL("SdrDragShear::BeginSdrDrag(): No reference point handle for shearing found.");
    2190                 :          0 :         return false;
    2191                 :            :     }
    2192                 :            : 
    2193                 :          0 :     Show();
    2194                 :          0 :     return true;
    2195                 :            : }
    2196                 :            : 
    2197                 :          0 : basegfx::B2DHomMatrix SdrDragShear::getCurrentTransformation()
    2198                 :            : {
    2199                 :            :     basegfx::B2DHomMatrix aRetval(basegfx::tools::createTranslateB2DHomMatrix(
    2200                 :          0 :         -DragStat().GetRef1().X(), -DragStat().GetRef1().Y()));
    2201                 :            : 
    2202         [ #  # ]:          0 :     if (bResize)
    2203                 :            :     {
    2204         [ #  # ]:          0 :         if (bVertical)
    2205                 :            :         {
    2206 [ #  # ][ #  # ]:          0 :             aRetval.scale(aFact, 1.0);
    2207         [ #  # ]:          0 :             aRetval.shearY(-nTan);
    2208                 :            :         }
    2209                 :            :         else
    2210                 :            :         {
    2211 [ #  # ][ #  # ]:          0 :             aRetval.scale(1.0, aFact);
    2212         [ #  # ]:          0 :             aRetval.shearX(-nTan);
    2213                 :            :         }
    2214                 :            :     }
    2215                 :            : 
    2216         [ #  # ]:          0 :     aRetval.translate(DragStat().GetRef1().X(), DragStat().GetRef1().Y());
    2217                 :            : 
    2218                 :          0 :     return aRetval;
    2219                 :            : }
    2220                 :            : 
    2221                 :          0 : void SdrDragShear::MoveSdrDrag(const Point& rPnt)
    2222                 :            : {
    2223         [ #  # ]:          0 :     if (DragStat().CheckMinMoved(rPnt))
    2224                 :            :     {
    2225                 :          0 :         bResize=!getSdrDragView().IsOrtho();
    2226                 :          0 :         long nSA=0;
    2227                 :            : 
    2228         [ #  # ]:          0 :         if (getSdrDragView().IsAngleSnapEnabled())
    2229                 :          0 :             nSA=getSdrDragView().GetSnapAngle();
    2230                 :            : 
    2231         [ #  # ]:          0 :         Point aP0(DragStat().GetStart());
    2232                 :          0 :         Point aPnt(rPnt);
    2233         [ #  # ]:          0 :         Fraction aNeuFact(1,1);
    2234                 :            : 
    2235                 :            :         // if angle snapping not activated, snap to raster (except when using slant)
    2236 [ #  # ][ #  # ]:          0 :         if (nSA==0 && !bSlant)
    2237         [ #  # ]:          0 :             aPnt=GetSnapPos(aPnt);
    2238                 :            : 
    2239 [ #  # ][ #  # ]:          0 :         if (!bSlant && !bResize)
    2240                 :            :         { // shear, but no resize
    2241         [ #  # ]:          0 :             if (bVertical)
    2242                 :          0 :                 aPnt.X()=aP0.X();
    2243                 :            :             else
    2244                 :          0 :                 aPnt.Y()=aP0.Y();
    2245                 :            :         }
    2246                 :            : 
    2247                 :          0 :         Point aRef(DragStat().GetRef1());
    2248                 :          0 :         Point aDif(aPnt-aRef);
    2249                 :            : 
    2250                 :          0 :         long nNeuWink=0;
    2251                 :            : 
    2252         [ #  # ]:          0 :         if (bSlant)
    2253                 :            :         {
    2254 [ #  # ][ #  # ]:          0 :             nNeuWink=NormAngle180(-(GetAngle(aDif)-nWink0));
    2255                 :            : 
    2256         [ #  # ]:          0 :             if (bVertical)
    2257         [ #  # ]:          0 :                 nNeuWink=NormAngle180(-nNeuWink);
    2258                 :            :         }
    2259                 :            :         else
    2260                 :            :         {
    2261         [ #  # ]:          0 :             if (bVertical)
    2262 [ #  # ][ #  # ]:          0 :                 nNeuWink=NormAngle180(GetAngle(aDif));
    2263                 :            :             else
    2264 [ #  # ][ #  # ]:          0 :                 nNeuWink=NormAngle180(-(GetAngle(aDif)-9000));
    2265                 :            : 
    2266 [ #  # ][ #  # ]:          0 :             if (nNeuWink<-9000 || nNeuWink>9000)
    2267         [ #  # ]:          0 :                 nNeuWink=NormAngle180(nNeuWink+18000);
    2268                 :            : 
    2269         [ #  # ]:          0 :             if (bResize)
    2270                 :            :             {
    2271                 :          0 :                 Point aPt2(aPnt);
    2272                 :            : 
    2273         [ #  # ]:          0 :                 if (nSA!=0)
    2274         [ #  # ]:          0 :                     aPt2=GetSnapPos(aPnt); // snap this one in any case
    2275                 :            : 
    2276         [ #  # ]:          0 :                 if (bVertical)
    2277                 :            :                 {
    2278 [ #  # ][ #  # ]:          0 :                     aNeuFact=Fraction(aPt2.X()-aRef.X(),aP0.X()-aRef.X());
    2279                 :            :                 }
    2280                 :            :                 else
    2281                 :            :                 {
    2282 [ #  # ][ #  # ]:          0 :                     aNeuFact=Fraction(aPt2.Y()-aRef.Y(),aP0.Y()-aRef.Y());
    2283                 :            :                 }
    2284                 :            :             }
    2285                 :            :         }
    2286                 :            : 
    2287                 :          0 :         bool bNeg=nNeuWink<0;
    2288                 :            : 
    2289         [ #  # ]:          0 :         if (bNeg)
    2290                 :          0 :             nNeuWink=-nNeuWink;
    2291                 :            : 
    2292         [ #  # ]:          0 :         if (nSA!=0)
    2293                 :            :         { // angle snapping
    2294                 :          0 :             nNeuWink+=nSA/2;
    2295                 :          0 :             nNeuWink/=nSA;
    2296                 :          0 :             nNeuWink*=nSA;
    2297                 :            :         }
    2298                 :            : 
    2299         [ #  # ]:          0 :         nNeuWink=NormAngle360(nNeuWink);
    2300 [ #  # ][ #  # ]:          0 :         bUpSideDown=nNeuWink>9000 && nNeuWink<27000;
    2301                 :            : 
    2302         [ #  # ]:          0 :         if (bSlant)
    2303                 :            :         { // calculate resize for slant
    2304                 :            :             // when angle snapping is activated, disable 89 degree limit
    2305                 :          0 :             long nTmpWink=nNeuWink;
    2306         [ #  # ]:          0 :             if (bUpSideDown) nNeuWink-=18000;
    2307         [ #  # ]:          0 :             if (bNeg) nTmpWink=-nTmpWink;
    2308                 :          0 :             bResize=true;
    2309                 :          0 :             double nCos=cos(nTmpWink*nPi180);
    2310 [ #  # ][ #  # ]:          0 :             aNeuFact=nCos;
    2311         [ #  # ]:          0 :             Kuerzen(aFact,10); // three decimals should be enough
    2312                 :            :         }
    2313                 :            : 
    2314         [ #  # ]:          0 :         if (nNeuWink>8900)
    2315                 :          0 :             nNeuWink=8900;
    2316                 :            : 
    2317         [ #  # ]:          0 :         if (bNeg)
    2318                 :          0 :             nNeuWink=-nNeuWink;
    2319                 :            : 
    2320 [ #  # ][ #  # ]:          0 :         if (nWink!=nNeuWink || aFact!=aNeuFact)
         [ #  # ][ #  # ]
    2321                 :            :         {
    2322                 :          0 :             nWink=nNeuWink;
    2323         [ #  # ]:          0 :             aFact=aNeuFact;
    2324                 :          0 :             double a=nWink*nPi180;
    2325                 :          0 :             double nTan1=0.0;
    2326                 :          0 :             nTan1=tan(a); // calculate now, so as little time as possible passes between Hide() and Show()
    2327         [ #  # ]:          0 :             Hide();
    2328                 :          0 :             nTan=nTan1;
    2329         [ #  # ]:          0 :             DragStat().NextMove(rPnt);
    2330         [ #  # ]:          0 :             Show();
    2331                 :            :         }
    2332                 :            :     }
    2333                 :          0 : }
    2334                 :            : 
    2335                 :          0 : void SdrDragShear::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
    2336                 :            : {
    2337         [ #  # ]:          0 :     if (bResize)
    2338                 :            :     {
    2339         [ #  # ]:          0 :         if (bVertical)
    2340                 :            :         {
    2341         [ #  # ]:          0 :             rTarget.Resize(DragStat().GetRef1(),aFact,Fraction(1,1));
    2342                 :            :         }
    2343                 :            :         else
    2344                 :            :         {
    2345         [ #  # ]:          0 :             rTarget.Resize(DragStat().GetRef1(),Fraction(1,1),aFact);
    2346                 :            :         }
    2347                 :            :     }
    2348                 :            : 
    2349         [ #  # ]:          0 :     if (nWink!=0)
    2350                 :            :     {
    2351                 :          0 :         rTarget.Shear(DragStat().GetRef1(),nWink,tan(nWink*nPi180),bVertical);
    2352                 :            :     }
    2353                 :          0 : }
    2354                 :            : 
    2355                 :          0 : bool SdrDragShear::EndSdrDrag(bool bCopy)
    2356                 :            : {
    2357                 :          0 :     Hide();
    2358                 :            : 
    2359 [ #  # ][ #  # ]:          0 :     if (bResize && aFact==Fraction(1,1))
         [ #  # ][ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
    2360                 :          0 :         bResize=false;
    2361                 :            : 
    2362 [ #  # ][ #  # ]:          0 :     if (nWink!=0 || bResize)
    2363                 :            :     {
    2364 [ #  # ][ #  # ]:          0 :         if (nWink!=0 && bResize)
    2365                 :            :         {
    2366         [ #  # ]:          0 :             XubString aStr;
    2367         [ #  # ]:          0 :             ImpTakeDescriptionStr(STR_EditShear,aStr);
    2368                 :            : 
    2369         [ #  # ]:          0 :             if (bCopy)
    2370 [ #  # ][ #  # ]:          0 :                 aStr+=ImpGetResStr(STR_EditWithCopy);
                 [ #  # ]
    2371                 :            : 
    2372 [ #  # ][ #  # ]:          0 :             getSdrDragView().BegUndo(aStr);
    2373                 :            :         }
    2374                 :            : 
    2375         [ #  # ]:          0 :         if (bResize)
    2376                 :            :         {
    2377         [ #  # ]:          0 :             if (bVertical)
    2378                 :            :             {
    2379         [ #  # ]:          0 :                 getSdrDragView().ResizeMarkedObj(DragStat().GetRef1(),aFact,Fraction(1,1),bCopy);
    2380                 :            :             }
    2381                 :            :             else
    2382                 :            :             {
    2383         [ #  # ]:          0 :                 getSdrDragView().ResizeMarkedObj(DragStat().GetRef1(),Fraction(1,1),aFact,bCopy);
    2384                 :            :             }
    2385                 :            : 
    2386                 :          0 :             bCopy=false;
    2387                 :            :         }
    2388                 :            : 
    2389         [ #  # ]:          0 :         if (nWink!=0)
    2390                 :            :         {
    2391                 :          0 :             getSdrDragView().ShearMarkedObj(DragStat().GetRef1(),nWink,bVertical,bCopy);
    2392                 :            :         }
    2393                 :            : 
    2394 [ #  # ][ #  # ]:          0 :         if (nWink!=0 && bResize)
    2395                 :          0 :             getSdrDragView().EndUndo();
    2396                 :            : 
    2397                 :          0 :         return true;
    2398                 :            :     }
    2399                 :            : 
    2400                 :          0 :     return false;
    2401                 :            : }
    2402                 :            : 
    2403                 :          0 : Pointer SdrDragShear::GetSdrDragPointer() const
    2404                 :            : {
    2405         [ #  # ]:          0 :     if (bVertical)
    2406                 :          0 :         return Pointer(POINTER_VSHEAR);
    2407                 :            :     else
    2408                 :          0 :         return Pointer(POINTER_HSHEAR);
    2409                 :            : }
    2410                 :            : 
    2411                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    2412                 :            : 
    2413 [ #  # ][ #  # ]:          0 : TYPEINIT1(SdrDragMirror,SdrDragMethod);
    2414                 :            : 
    2415                 :          0 : void SdrDragMirror::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
    2416                 :            : {
    2417         [ #  # ]:          0 :     if(bMirrored)
    2418                 :            :     {
    2419                 :          0 :         rTarget.Mirror(DragStat().GetRef1(), DragStat().GetRef2());
    2420                 :            :     }
    2421                 :          0 : }
    2422                 :            : 
    2423                 :          0 : SdrDragMirror::SdrDragMirror(SdrDragView& rNewView)
    2424                 :            : :   SdrDragMethod(rNewView),
    2425                 :            :     nWink(0),
    2426                 :            :     bMirrored(false),
    2427                 :          0 :     bSide0(false)
    2428                 :            : {
    2429                 :          0 : }
    2430                 :            : 
    2431                 :          0 : bool SdrDragMirror::ImpCheckSide(const Point& rPnt) const
    2432                 :            : {
    2433         [ #  # ]:          0 :     long nWink1=GetAngle(rPnt-DragStat().GetRef1());
    2434                 :          0 :     nWink1-=nWink;
    2435                 :          0 :     nWink1=NormAngle360(nWink1);
    2436                 :            : 
    2437                 :          0 :     return nWink1<18000;
    2438                 :            : }
    2439                 :            : 
    2440                 :          0 : void SdrDragMirror::TakeSdrDragComment(XubString& rStr) const
    2441                 :            : {
    2442         [ #  # ]:          0 :     if (aDif.X()==0)
    2443                 :          0 :         ImpTakeDescriptionStr(STR_DragMethMirrorHori,rStr);
    2444         [ #  # ]:          0 :     else if (aDif.Y()==0)
    2445                 :          0 :         ImpTakeDescriptionStr(STR_DragMethMirrorVert,rStr);
    2446         [ #  # ]:          0 :     else if (Abs(aDif.X())==Abs(aDif.Y()))
    2447                 :          0 :         ImpTakeDescriptionStr(STR_DragMethMirrorDiag,rStr);
    2448                 :            :     else
    2449                 :          0 :         ImpTakeDescriptionStr(STR_DragMethMirrorFree,rStr);
    2450                 :            : 
    2451         [ #  # ]:          0 :     if (getSdrDragView().IsDragWithCopy())
    2452         [ #  # ]:          0 :         rStr+=ImpGetResStr(STR_EditWithCopy);
    2453                 :          0 : }
    2454                 :            : 
    2455                 :          0 : bool SdrDragMirror::BeginSdrDrag()
    2456                 :            : {
    2457                 :          0 :     SdrHdl* pH1=GetHdlList().GetHdl(HDL_REF1);
    2458                 :          0 :     SdrHdl* pH2=GetHdlList().GetHdl(HDL_REF2);
    2459                 :            : 
    2460 [ #  # ][ #  # ]:          0 :     if (pH1!=NULL && pH2!=NULL)
    2461                 :            :     {
    2462                 :          0 :         DragStat().Ref1()=pH1->GetPos();
    2463                 :          0 :         DragStat().Ref2()=pH2->GetPos();
    2464                 :          0 :         Ref1()=pH1->GetPos();
    2465                 :          0 :         Ref2()=pH2->GetPos();
    2466                 :          0 :         aDif=pH2->GetPos()-pH1->GetPos();
    2467 [ #  # ][ #  # ]:          0 :         bool b90=(aDif.X()==0) || aDif.Y()==0;
    2468 [ #  # ][ #  # ]:          0 :         bool b45=b90 || (Abs(aDif.X())==Abs(aDif.Y()));
    2469                 :          0 :         nWink=NormAngle360(GetAngle(aDif));
    2470                 :            : 
    2471 [ #  # ][ #  # ]:          0 :         if (!getSdrDragView().IsMirrorAllowed(false,false) && !b45)
                 [ #  # ]
    2472                 :          0 :             return false; // free choice of axis angle not allowed
    2473                 :            : 
    2474 [ #  # ][ #  # ]:          0 :         if (!getSdrDragView().IsMirrorAllowed(true,false) && !b90)
                 [ #  # ]
    2475                 :          0 :             return false;  // 45 degrees not allowed either
    2476                 :            : 
    2477                 :          0 :         bSide0=ImpCheckSide(DragStat().GetStart());
    2478                 :          0 :         Show();
    2479                 :          0 :         return true;
    2480                 :            :     }
    2481                 :            :     else
    2482                 :            :     {
    2483                 :            :         OSL_FAIL("SdrDragMirror::BeginSdrDrag(): Axis of reflection not found.");
    2484                 :          0 :         return false;
    2485                 :            :     }
    2486                 :            : }
    2487                 :            : 
    2488                 :          0 : basegfx::B2DHomMatrix SdrDragMirror::getCurrentTransformation()
    2489                 :            : {
    2490                 :          0 :     basegfx::B2DHomMatrix aRetval;
    2491                 :            : 
    2492         [ #  # ]:          0 :     if (bMirrored)
    2493                 :            :     {
    2494                 :          0 :         const double fDeltaX(DragStat().GetRef2().X() - DragStat().GetRef1().X());
    2495                 :          0 :         const double fDeltaY(DragStat().GetRef2().Y() - DragStat().GetRef1().Y());
    2496                 :          0 :         const double fRotation(atan2(fDeltaY, fDeltaX));
    2497                 :            : 
    2498 [ #  # ][ #  # ]:          0 :         aRetval = basegfx::tools::createTranslateB2DHomMatrix(-DragStat().GetRef1().X(), -DragStat().GetRef1().Y());
                 [ #  # ]
    2499         [ #  # ]:          0 :         aRetval.rotate(-fRotation);
    2500         [ #  # ]:          0 :         aRetval.scale(1.0, -1.0);
    2501         [ #  # ]:          0 :         aRetval.rotate(fRotation);
    2502         [ #  # ]:          0 :         aRetval.translate(DragStat().GetRef1().X(), DragStat().GetRef1().Y());
    2503                 :            :     }
    2504                 :            : 
    2505                 :          0 :     return aRetval;
    2506                 :            : }
    2507                 :            : 
    2508                 :          0 : void SdrDragMirror::MoveSdrDrag(const Point& rPnt)
    2509                 :            : {
    2510         [ #  # ]:          0 :     if (DragStat().CheckMinMoved(rPnt))
    2511                 :            :     {
    2512                 :          0 :         bool bNeuSide=ImpCheckSide(rPnt);
    2513                 :          0 :         bool bNeuMirr=bSide0!=bNeuSide;
    2514                 :            : 
    2515         [ #  # ]:          0 :         if (bMirrored!=bNeuMirr)
    2516                 :            :         {
    2517                 :          0 :             Hide();
    2518                 :          0 :             bMirrored=bNeuMirr;
    2519                 :          0 :             DragStat().NextMove(rPnt);
    2520                 :          0 :             Show();
    2521                 :            :         }
    2522                 :            :     }
    2523                 :          0 : }
    2524                 :            : 
    2525                 :          0 : bool SdrDragMirror::EndSdrDrag(bool bCopy)
    2526                 :            : {
    2527                 :          0 :     Hide();
    2528                 :            : 
    2529         [ #  # ]:          0 :     if (bMirrored)
    2530                 :            :     {
    2531                 :          0 :         getSdrDragView().MirrorMarkedObj(DragStat().GetRef1(),DragStat().GetRef2(),bCopy);
    2532                 :            :     }
    2533                 :            : 
    2534                 :          0 :     return true;
    2535                 :            : }
    2536                 :            : 
    2537                 :          0 : Pointer SdrDragMirror::GetSdrDragPointer() const
    2538                 :            : {
    2539                 :          0 :     return Pointer(POINTER_MIRROR);
    2540                 :            : }
    2541                 :            : 
    2542                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    2543                 :            : 
    2544 [ #  # ][ #  # ]:          0 : TYPEINIT1(SdrDragGradient, SdrDragMethod);
    2545                 :            : 
    2546                 :          0 : SdrDragGradient::SdrDragGradient(SdrDragView& rNewView, bool bGrad)
    2547                 :            : :   SdrDragMethod(rNewView),
    2548                 :            :     pIAOHandle(NULL),
    2549                 :          0 :     bIsGradient(bGrad)
    2550                 :            : {
    2551                 :          0 : }
    2552                 :            : 
    2553                 :          0 : void SdrDragGradient::TakeSdrDragComment(XubString& rStr) const
    2554                 :            : {
    2555         [ #  # ]:          0 :     if(IsGradient())
    2556                 :          0 :         ImpTakeDescriptionStr(STR_DragMethGradient, rStr);
    2557                 :            :     else
    2558                 :          0 :         ImpTakeDescriptionStr(STR_DragMethTransparence, rStr);
    2559                 :          0 : }
    2560                 :            : 
    2561                 :          0 : bool SdrDragGradient::BeginSdrDrag()
    2562                 :            : {
    2563                 :          0 :     bool bRetval(false);
    2564                 :            : 
    2565         [ #  # ]:          0 :     pIAOHandle = (SdrHdlGradient*)GetHdlList().GetHdl(IsGradient() ? HDL_GRAD : HDL_TRNS);
    2566                 :            : 
    2567         [ #  # ]:          0 :     if(pIAOHandle)
    2568                 :            :     {
    2569                 :            :         // save old values
    2570                 :          0 :         DragStat().Ref1() = pIAOHandle->GetPos();
    2571                 :          0 :         DragStat().Ref2() = pIAOHandle->Get2ndPos();
    2572                 :            : 
    2573                 :            :         // what was hit?
    2574                 :          0 :         bool bHit(false);
    2575                 :          0 :         SdrHdlColor* pColHdl = pIAOHandle->GetColorHdl1();
    2576                 :            : 
    2577                 :            :         // init handling flags
    2578                 :          0 :         pIAOHandle->SetMoveSingleHandle(false);
    2579                 :          0 :         pIAOHandle->SetMoveFirstHandle(false);
    2580                 :            : 
    2581                 :            :         // test first color handle
    2582         [ #  # ]:          0 :         if(pColHdl)
    2583                 :            :         {
    2584 [ #  # ][ #  # ]:          0 :             basegfx::B2DPoint aPosition(DragStat().GetStart().X(), DragStat().GetStart().Y());
    2585                 :            : 
    2586 [ #  # ][ #  # ]:          0 :             if(pColHdl->getOverlayObjectList().isHitLogic(aPosition))
    2587                 :            :             {
    2588                 :          0 :                 bHit = true;
    2589                 :          0 :                 pIAOHandle->SetMoveSingleHandle(true);
    2590                 :          0 :                 pIAOHandle->SetMoveFirstHandle(true);
    2591                 :          0 :             }
    2592                 :            :         }
    2593                 :            : 
    2594                 :            :         // test second color handle
    2595                 :          0 :         pColHdl = pIAOHandle->GetColorHdl2();
    2596                 :            : 
    2597 [ #  # ][ #  # ]:          0 :         if(!bHit && pColHdl)
    2598                 :            :         {
    2599 [ #  # ][ #  # ]:          0 :             basegfx::B2DPoint aPosition(DragStat().GetStart().X(), DragStat().GetStart().Y());
    2600                 :            : 
    2601 [ #  # ][ #  # ]:          0 :             if(pColHdl->getOverlayObjectList().isHitLogic(aPosition))
    2602                 :            :             {
    2603                 :          0 :                 bHit = true;
    2604                 :          0 :                 pIAOHandle->SetMoveSingleHandle(true);
    2605                 :          0 :             }
    2606                 :            :         }
    2607                 :            : 
    2608                 :            :         // test gradient handle itself
    2609         [ #  # ]:          0 :         if(!bHit)
    2610                 :            :         {
    2611 [ #  # ][ #  # ]:          0 :             basegfx::B2DPoint aPosition(DragStat().GetStart().X(), DragStat().GetStart().Y());
    2612                 :            : 
    2613 [ #  # ][ #  # ]:          0 :             if(pIAOHandle->getOverlayObjectList().isHitLogic(aPosition))
    2614                 :            :             {
    2615                 :          0 :                 bHit = true;
    2616                 :          0 :             }
    2617                 :            :         }
    2618                 :            : 
    2619                 :            :         // everything up and running :o}
    2620                 :          0 :         bRetval = bHit;
    2621                 :            :     }
    2622                 :            :     else
    2623                 :            :     {
    2624                 :            :         OSL_FAIL("SdrDragGradient::BeginSdrDrag(): IAOGradient not found.");
    2625                 :            :     }
    2626                 :            : 
    2627                 :          0 :     return bRetval;
    2628                 :            : }
    2629                 :            : 
    2630                 :          0 : void SdrDragGradient::MoveSdrDrag(const Point& rPnt)
    2631                 :            : {
    2632 [ #  # ][ #  # ]:          0 :     if(pIAOHandle && DragStat().CheckMinMoved(rPnt))
                 [ #  # ]
    2633                 :            :     {
    2634         [ #  # ]:          0 :         DragStat().NextMove(rPnt);
    2635                 :            : 
    2636                 :            :         // Do the Move here!!! DragStat().GetStart()
    2637         [ #  # ]:          0 :         Point aMoveDiff = rPnt - DragStat().GetStart();
    2638                 :            : 
    2639         [ #  # ]:          0 :         if(pIAOHandle->IsMoveSingleHandle())
    2640                 :            :         {
    2641         [ #  # ]:          0 :             if(pIAOHandle->IsMoveFirstHandle())
    2642                 :            :             {
    2643         [ #  # ]:          0 :                 pIAOHandle->SetPos(DragStat().Ref1() + aMoveDiff);
    2644         [ #  # ]:          0 :                 if(pIAOHandle->GetColorHdl1())
    2645         [ #  # ]:          0 :                     pIAOHandle->GetColorHdl1()->SetPos(DragStat().Ref1() + aMoveDiff);
    2646                 :            :             }
    2647                 :            :             else
    2648                 :            :             {
    2649         [ #  # ]:          0 :                 pIAOHandle->Set2ndPos(DragStat().Ref2() + aMoveDiff);
    2650         [ #  # ]:          0 :                 if(pIAOHandle->GetColorHdl2())
    2651         [ #  # ]:          0 :                     pIAOHandle->GetColorHdl2()->SetPos(DragStat().Ref2() + aMoveDiff);
    2652                 :            :             }
    2653                 :            :         }
    2654                 :            :         else
    2655                 :            :         {
    2656         [ #  # ]:          0 :             pIAOHandle->SetPos(DragStat().Ref1() + aMoveDiff);
    2657         [ #  # ]:          0 :             pIAOHandle->Set2ndPos(DragStat().Ref2() + aMoveDiff);
    2658                 :            : 
    2659         [ #  # ]:          0 :             if(pIAOHandle->GetColorHdl1())
    2660         [ #  # ]:          0 :                 pIAOHandle->GetColorHdl1()->SetPos(DragStat().Ref1() + aMoveDiff);
    2661                 :            : 
    2662         [ #  # ]:          0 :             if(pIAOHandle->GetColorHdl2())
    2663         [ #  # ]:          0 :                 pIAOHandle->GetColorHdl2()->SetPos(DragStat().Ref2() + aMoveDiff);
    2664                 :            :         }
    2665                 :            : 
    2666                 :            :         // new state
    2667 [ #  # ][ #  # ]:          0 :         pIAOHandle->FromIAOToItem(getSdrDragView().GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(), false, false);
                 [ #  # ]
    2668                 :            :     }
    2669                 :          0 : }
    2670                 :            : 
    2671                 :          0 : bool SdrDragGradient::EndSdrDrag(bool /*bCopy*/)
    2672                 :            : {
    2673                 :          0 :     Ref1() = pIAOHandle->GetPos();
    2674                 :          0 :     Ref2() = pIAOHandle->Get2ndPos();
    2675                 :            : 
    2676                 :            :     // new state
    2677                 :          0 :     pIAOHandle->FromIAOToItem(getSdrDragView().GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(), true, true);
    2678                 :            : 
    2679                 :          0 :     return true;
    2680                 :            : }
    2681                 :            : 
    2682                 :          0 : void SdrDragGradient::CancelSdrDrag()
    2683                 :            : {
    2684                 :            :     // restore old values
    2685                 :          0 :     pIAOHandle->SetPos(DragStat().Ref1());
    2686                 :          0 :     pIAOHandle->Set2ndPos(DragStat().Ref2());
    2687                 :            : 
    2688         [ #  # ]:          0 :     if(pIAOHandle->GetColorHdl1())
    2689                 :          0 :         pIAOHandle->GetColorHdl1()->SetPos(DragStat().Ref1());
    2690                 :            : 
    2691         [ #  # ]:          0 :     if(pIAOHandle->GetColorHdl2())
    2692                 :          0 :         pIAOHandle->GetColorHdl2()->SetPos(DragStat().Ref2());
    2693                 :            : 
    2694                 :            :     // new state
    2695                 :          0 :     pIAOHandle->FromIAOToItem(getSdrDragView().GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(), true, false);
    2696                 :          0 : }
    2697                 :            : 
    2698                 :          0 : Pointer SdrDragGradient::GetSdrDragPointer() const
    2699                 :            : {
    2700                 :          0 :     return Pointer(POINTER_REFHAND);
    2701                 :            : }
    2702                 :            : 
    2703                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    2704                 :            : 
    2705 [ #  # ][ #  # ]:          0 : TYPEINIT1(SdrDragCrook,SdrDragMethod);
    2706                 :            : 
    2707                 :          0 : SdrDragCrook::SdrDragCrook(SdrDragView& rNewView)
    2708                 :            : :   SdrDragMethod(rNewView),
    2709                 :            :     aFact(1,1),
    2710                 :            :     bContortionAllowed(false),
    2711                 :            :     bNoContortionAllowed(false),
    2712                 :            :     bContortion(false),
    2713                 :            :     bResizeAllowed(false),
    2714                 :            :     bResize(false),
    2715                 :            :     bRotateAllowed(false),
    2716                 :            :     bRotate(false),
    2717                 :            :     bVertical(false),
    2718                 :            :     bValid(false),
    2719                 :            :     bLft(false),
    2720                 :            :     bRgt(false),
    2721                 :            :     bUpr(false),
    2722                 :            :     bLwr(false),
    2723                 :            :     bAtCenter(false),
    2724                 :            :     nWink(0),
    2725                 :            :     nMarkSize(0),
    2726 [ #  # ][ #  # ]:          0 :     eMode(SDRCROOK_ROTATE)
    2727                 :            : {
    2728                 :          0 : }
    2729                 :            : 
    2730                 :          0 : void SdrDragCrook::TakeSdrDragComment(XubString& rStr) const
    2731                 :            : {
    2732         [ #  # ]:          0 :     ImpTakeDescriptionStr(!bContortion ? STR_DragMethCrook : STR_DragMethCrookContortion, rStr);
    2733                 :            : 
    2734         [ #  # ]:          0 :     if(bValid)
    2735                 :            :     {
    2736         [ #  # ]:          0 :         rStr.AppendAscii(" (");
    2737                 :            : 
    2738                 :          0 :         sal_Int32 nVal(nWink);
    2739                 :            : 
    2740         [ #  # ]:          0 :         if(bAtCenter)
    2741                 :          0 :             nVal *= 2;
    2742                 :            : 
    2743                 :          0 :         nVal = Abs(nVal);
    2744                 :          0 :         rtl::OUString aStr;
    2745         [ #  # ]:          0 :         getSdrDragView().GetModel()->TakeWinkStr(nVal, aStr);
    2746 [ #  # ][ #  # ]:          0 :         rStr.Append(aStr);
                 [ #  # ]
    2747         [ #  # ]:          0 :         rStr += sal_Unicode(')');
    2748                 :            :     }
    2749                 :            : 
    2750         [ #  # ]:          0 :     if(getSdrDragView().IsDragWithCopy())
    2751         [ #  # ]:          0 :         rStr += ImpGetResStr(STR_EditWithCopy);
    2752                 :          0 : }
    2753                 :            : 
    2754                 :            : // These defines parameterize the created raster
    2755                 :            : // for interactions
    2756                 :            : #define DRAG_CROOK_RASTER_MINIMUM   (4)
    2757                 :            : #define DRAG_CROOK_RASTER_MAXIMUM   (15)
    2758                 :            : #define DRAG_CROOK_RASTER_DISTANCE  (30)
    2759                 :            : 
    2760                 :          0 : basegfx::B2DPolyPolygon impCreateDragRaster(SdrPageView& rPageView, const Rectangle& rMarkRect)
    2761                 :            : {
    2762                 :          0 :     basegfx::B2DPolyPolygon aRetval;
    2763                 :            : 
    2764         [ #  # ]:          0 :     if(rPageView.PageWindowCount())
    2765                 :            :     {
    2766         [ #  # ]:          0 :         OutputDevice& rOut = (rPageView.GetPageWindow(0)->GetPaintWindow().GetOutputDevice());
    2767         [ #  # ]:          0 :         Rectangle aPixelSize = rOut.LogicToPixel(rMarkRect);
    2768         [ #  # ]:          0 :         sal_uInt32 nHorDiv(aPixelSize.GetWidth() / DRAG_CROOK_RASTER_DISTANCE);
    2769         [ #  # ]:          0 :         sal_uInt32 nVerDiv(aPixelSize.GetHeight() / DRAG_CROOK_RASTER_DISTANCE);
    2770                 :            : 
    2771         [ #  # ]:          0 :         if(nHorDiv > DRAG_CROOK_RASTER_MAXIMUM)
    2772                 :          0 :             nHorDiv = DRAG_CROOK_RASTER_MAXIMUM;
    2773         [ #  # ]:          0 :         if(nHorDiv < DRAG_CROOK_RASTER_MINIMUM)
    2774                 :          0 :             nHorDiv = DRAG_CROOK_RASTER_MINIMUM;
    2775                 :            : 
    2776         [ #  # ]:          0 :         if(nVerDiv > DRAG_CROOK_RASTER_MAXIMUM)
    2777                 :          0 :             nVerDiv = DRAG_CROOK_RASTER_MAXIMUM;
    2778         [ #  # ]:          0 :         if(nVerDiv < DRAG_CROOK_RASTER_MINIMUM)
    2779                 :          0 :             nVerDiv = DRAG_CROOK_RASTER_MINIMUM;
    2780                 :            : 
    2781         [ #  # ]:          0 :         const double fXLen(rMarkRect.GetWidth() / (double)nHorDiv);
    2782         [ #  # ]:          0 :         const double fYLen(rMarkRect.GetHeight() / (double)nVerDiv);
    2783                 :          0 :         double fYPos(rMarkRect.Top());
    2784                 :            :         sal_uInt32 a, b;
    2785                 :            : 
    2786         [ #  # ]:          0 :         for(a = 0; a <= nVerDiv; a++)
    2787                 :            :         {
    2788                 :            :             // horizontal lines
    2789         [ #  # ]:          0 :             for(b = 0; b < nHorDiv; b++)
    2790                 :            :             {
    2791         [ #  # ]:          0 :                 basegfx::B2DPolygon aHorLineSegment;
    2792                 :            : 
    2793                 :          0 :                 const double fNewX(rMarkRect.Left() + (b * fXLen));
    2794         [ #  # ]:          0 :                 aHorLineSegment.append(basegfx::B2DPoint(fNewX, fYPos));
    2795                 :            :                 aHorLineSegment.appendBezierSegment(
    2796                 :            :                     basegfx::B2DPoint(fNewX + (fXLen * (1.0 / 3.0)), fYPos),
    2797                 :            :                     basegfx::B2DPoint(fNewX + (fXLen * (2.0 / 3.0)), fYPos),
    2798         [ #  # ]:          0 :                     basegfx::B2DPoint(fNewX + fXLen, fYPos));
    2799         [ #  # ]:          0 :                 aRetval.append(aHorLineSegment);
    2800         [ #  # ]:          0 :             }
    2801                 :            : 
    2802                 :            :             // increments
    2803                 :          0 :             fYPos += fYLen;
    2804                 :            :         }
    2805                 :            : 
    2806                 :          0 :         double fXPos(rMarkRect.Left());
    2807                 :            : 
    2808         [ #  # ]:          0 :         for(a = 0; a <= nHorDiv; a++)
    2809                 :            :         {
    2810                 :            :             // vertical lines
    2811         [ #  # ]:          0 :             for(b = 0; b < nVerDiv; b++)
    2812                 :            :             {
    2813         [ #  # ]:          0 :                 basegfx::B2DPolygon aVerLineSegment;
    2814                 :            : 
    2815                 :          0 :                 const double fNewY(rMarkRect.Top() + (b * fYLen));
    2816         [ #  # ]:          0 :                 aVerLineSegment.append(basegfx::B2DPoint(fXPos, fNewY));
    2817                 :            :                 aVerLineSegment.appendBezierSegment(
    2818                 :            :                     basegfx::B2DPoint(fXPos, fNewY + (fYLen * (1.0 / 3.0))),
    2819                 :            :                     basegfx::B2DPoint(fXPos, fNewY + (fYLen * (2.0 / 3.0))),
    2820         [ #  # ]:          0 :                     basegfx::B2DPoint(fXPos, fNewY + fYLen));
    2821         [ #  # ]:          0 :                 aRetval.append(aVerLineSegment);
    2822         [ #  # ]:          0 :             }
    2823                 :            : 
    2824                 :            :             // increments
    2825                 :          0 :             fXPos += fXLen;
    2826                 :            :         }
    2827                 :            :     }
    2828                 :            : 
    2829                 :          0 :     return aRetval;
    2830                 :            : }
    2831                 :            : 
    2832                 :          0 : void SdrDragCrook::createSdrDragEntries()
    2833                 :            : {
    2834                 :            :     // Add extended frame raster first, so it will be behind objects
    2835         [ #  # ]:          0 :     if(getSdrDragView().GetSdrPageView())
    2836                 :            :     {
    2837 [ #  # ][ #  # ]:          0 :         const basegfx::B2DPolyPolygon aDragRaster(impCreateDragRaster(*getSdrDragView().GetSdrPageView(), GetMarkedRect()));
    2838                 :            : 
    2839 [ #  # ][ #  # ]:          0 :         if(aDragRaster.count())
    2840                 :            :         {
    2841 [ #  # ][ #  # ]:          0 :             addSdrDragEntry(new SdrDragEntryPolyPolygon(aDragRaster));
                 [ #  # ]
    2842         [ #  # ]:          0 :         }
    2843                 :            :     }
    2844                 :            : 
    2845                 :            :     // call parent
    2846                 :          0 :     SdrDragMethod::createSdrDragEntries();
    2847                 :          0 : }
    2848                 :            : 
    2849                 :          0 : bool SdrDragCrook::BeginSdrDrag()
    2850                 :            : {
    2851                 :          0 :     bContortionAllowed=getSdrDragView().IsCrookAllowed(false);
    2852                 :          0 :     bNoContortionAllowed=getSdrDragView().IsCrookAllowed(true);
    2853                 :          0 :     bResizeAllowed=getSdrDragView().IsResizeAllowed(false);
    2854                 :          0 :     bRotateAllowed=getSdrDragView().IsRotateAllowed(false);
    2855                 :            : 
    2856 [ #  # ][ #  # ]:          0 :     if (bContortionAllowed || bNoContortionAllowed)
    2857                 :            :     {
    2858 [ #  # ][ #  # ]:          0 :         bVertical=(GetDragHdlKind()==HDL_LOWER || GetDragHdlKind()==HDL_UPPER);
    2859                 :          0 :         aMarkRect=GetMarkedRect();
    2860                 :          0 :         aMarkCenter=aMarkRect.Center();
    2861         [ #  # ]:          0 :         nMarkSize=bVertical ? (aMarkRect.GetHeight()-1) : (aMarkRect.GetWidth()-1);
    2862                 :          0 :         aCenter=aMarkCenter;
    2863                 :          0 :         aStart=DragStat().GetStart();
    2864                 :          0 :         Show();
    2865                 :          0 :         return true;
    2866                 :            :     }
    2867                 :            :     else
    2868                 :            :     {
    2869                 :          0 :         return false;
    2870                 :            :     }
    2871                 :            : }
    2872                 :            : 
    2873                 :          0 : void SdrDragCrook::_MovAllPoints(basegfx::B2DPolyPolygon& rTarget)
    2874                 :            : {
    2875                 :          0 :     SdrPageView* pPV = getSdrDragView().GetSdrPageView();
    2876                 :            : 
    2877         [ #  # ]:          0 :     if(pPV)
    2878                 :            :     {
    2879         [ #  # ]:          0 :         XPolyPolygon aTempPolyPoly(rTarget);
    2880                 :            : 
    2881         [ #  # ]:          0 :         if (pPV->HasMarkedObjPageView())
    2882                 :            :         {
    2883         [ #  # ]:          0 :             sal_uInt16 nPolyAnz=aTempPolyPoly.Count();
    2884                 :            : 
    2885 [ #  # ][ #  # ]:          0 :             if (!bContortion && !getSdrDragView().IsNoDragXorPolys())
                 [ #  # ]
    2886                 :            :             {
    2887                 :          0 :                 sal_uInt16 n1st=0,nLast=0;
    2888                 :          0 :                 Point aC(aCenter);
    2889                 :            : 
    2890         [ #  # ]:          0 :                 while (n1st<nPolyAnz)
    2891                 :            :                 {
    2892                 :          0 :                     nLast=n1st;
    2893 [ #  # ][ #  # ]:          0 :                     while (nLast<nPolyAnz && aTempPolyPoly[nLast].GetPointCount()!=0) nLast++;
         [ #  # ][ #  # ]
                 [ #  # ]
    2894 [ #  # ][ #  # ]:          0 :                     Rectangle aBound(aTempPolyPoly[n1st].GetBoundRect());
    2895                 :            :                     sal_uInt16 i;
    2896                 :            : 
    2897         [ #  # ]:          0 :                     for (i=n1st+1; i<nLast; i++)
    2898                 :            :                     {
    2899 [ #  # ][ #  # ]:          0 :                         aBound.Union(aTempPolyPoly[n1st].GetBoundRect());
                 [ #  # ]
    2900                 :            :                     }
    2901                 :            : 
    2902         [ #  # ]:          0 :                     Point aCtr0(aBound.Center());
    2903                 :          0 :                     Point aCtr1(aCtr0);
    2904                 :            : 
    2905         [ #  # ]:          0 :                     if (bResize)
    2906                 :            :                     {
    2907         [ #  # ]:          0 :                         Fraction aFact1(1,1);
    2908                 :            : 
    2909         [ #  # ]:          0 :                         if (bVertical)
    2910                 :            :                         {
    2911 [ #  # ][ #  # ]:          0 :                             ResizePoint(aCtr1,aC,aFact1,aFact);
                 [ #  # ]
    2912                 :            :                         }
    2913                 :            :                         else
    2914                 :            :                         {
    2915 [ #  # ][ #  # ]:          0 :                             ResizePoint(aCtr1,aC,aFact,aFact1);
                 [ #  # ]
    2916                 :            :                         }
    2917                 :            :                     }
    2918                 :            : 
    2919                 :          0 :                     bool bRotOk=false;
    2920                 :          0 :                     double nSin=0,nCos=0;
    2921                 :            : 
    2922 [ #  # ][ #  # ]:          0 :                     if (aRad.X()!=0 && aRad.Y()!=0)
                 [ #  # ]
    2923                 :            :                     {
    2924                 :          0 :                         bRotOk=bRotate;
    2925                 :            : 
    2926   [ #  #  #  # ]:          0 :                         switch (eMode)
    2927                 :            :                         {
    2928         [ #  # ]:          0 :                             case SDRCROOK_ROTATE : CrookRotateXPoint (aCtr1,NULL,NULL,aC,aRad,nSin,nCos,bVertical);           break;
    2929         [ #  # ]:          0 :                             case SDRCROOK_SLANT  : CrookSlantXPoint  (aCtr1,NULL,NULL,aC,aRad,nSin,nCos,bVertical);           break;
    2930         [ #  # ]:          0 :                             case SDRCROOK_STRETCH: CrookStretchXPoint(aCtr1,NULL,NULL,aC,aRad,nSin,nCos,bVertical,aMarkRect); break;
    2931                 :            :                         } // switch
    2932                 :            :                     }
    2933                 :            : 
    2934                 :          0 :                     aCtr1-=aCtr0;
    2935                 :            : 
    2936         [ #  # ]:          0 :                     for (i=n1st; i<nLast; i++)
    2937                 :            :                     {
    2938         [ #  # ]:          0 :                         if (bRotOk)
    2939                 :            :                         {
    2940 [ #  # ][ #  # ]:          0 :                             RotateXPoly(aTempPolyPoly[i],aCtr0,nSin,nCos);
    2941                 :            :                         }
    2942                 :            : 
    2943 [ #  # ][ #  # ]:          0 :                         aTempPolyPoly[i].Move(aCtr1.X(),aCtr1.Y());
    2944                 :            :                     }
    2945                 :            : 
    2946                 :          0 :                     n1st=nLast+1;
    2947                 :            :                 }
    2948                 :            :             }
    2949                 :            :             else
    2950                 :            :             {
    2951                 :            :                 sal_uInt16 i,j;
    2952                 :            : 
    2953         [ #  # ]:          0 :                 for (j=0; j<nPolyAnz; j++)
    2954                 :            :                 {
    2955         [ #  # ]:          0 :                     XPolygon& aPol=aTempPolyPoly[j];
    2956         [ #  # ]:          0 :                     sal_uInt16 nPtAnz=aPol.GetPointCount();
    2957                 :          0 :                     i=0;
    2958                 :            : 
    2959         [ #  # ]:          0 :                     while (i<nPtAnz)
    2960                 :            :                     {
    2961         [ #  # ]:          0 :                         Point* pPnt=&aPol[i];
    2962                 :          0 :                         Point* pC1=NULL;
    2963                 :          0 :                         Point* pC2=NULL;
    2964                 :            : 
    2965 [ #  # ][ #  # ]:          0 :                         if (i+1<nPtAnz && aPol.IsControl(i))
         [ #  # ][ #  # ]
    2966                 :            :                         { // control point on the left
    2967                 :          0 :                             pC1=pPnt;
    2968                 :          0 :                             i++;
    2969         [ #  # ]:          0 :                             pPnt=&aPol[i];
    2970                 :            :                         }
    2971                 :            : 
    2972                 :          0 :                         i++;
    2973                 :            : 
    2974 [ #  # ][ #  # ]:          0 :                         if (i<nPtAnz && aPol.IsControl(i))
         [ #  # ][ #  # ]
    2975                 :            :                         { // control point on the right
    2976         [ #  # ]:          0 :                             pC2=&aPol[i];
    2977                 :          0 :                             i++;
    2978                 :            :                         }
    2979                 :            : 
    2980         [ #  # ]:          0 :                         _MovCrookPoint(*pPnt,pC1,pC2);
    2981                 :            :                     }
    2982                 :            :                 }
    2983                 :            :             }
    2984                 :            :         }
    2985                 :            : 
    2986 [ #  # ][ #  # ]:          0 :         rTarget = aTempPolyPoly.getB2DPolyPolygon();
         [ #  # ][ #  # ]
    2987                 :            :     }
    2988                 :          0 : }
    2989                 :            : 
    2990                 :          0 : void SdrDragCrook::_MovCrookPoint(Point& rPnt, Point* pC1, Point* pC2)
    2991                 :            : {
    2992                 :          0 :     bool bVert=bVertical;
    2993                 :          0 :     bool bC1=pC1!=NULL;
    2994                 :          0 :     bool bC2=pC2!=NULL;
    2995                 :          0 :     Point aC(aCenter);
    2996                 :            : 
    2997         [ #  # ]:          0 :     if (bResize)
    2998                 :            :     {
    2999         [ #  # ]:          0 :         Fraction aFact1(1,1);
    3000                 :            : 
    3001         [ #  # ]:          0 :         if (bVert)
    3002                 :            :         {
    3003 [ #  # ][ #  # ]:          0 :             ResizePoint(rPnt,aC,aFact1,aFact);
                 [ #  # ]
    3004                 :            : 
    3005         [ #  # ]:          0 :             if (bC1)
    3006 [ #  # ][ #  # ]:          0 :                 ResizePoint(*pC1,aC,aFact1,aFact);
                 [ #  # ]
    3007                 :            : 
    3008         [ #  # ]:          0 :             if (bC2)
    3009 [ #  # ][ #  # ]:          0 :                 ResizePoint(*pC2,aC,aFact1,aFact);
                 [ #  # ]
    3010                 :            :         }
    3011                 :            :         else
    3012                 :            :         {
    3013 [ #  # ][ #  # ]:          0 :             ResizePoint(rPnt,aC,aFact,aFact1);
                 [ #  # ]
    3014                 :            : 
    3015         [ #  # ]:          0 :             if (bC1)
    3016 [ #  # ][ #  # ]:          0 :                 ResizePoint(*pC1,aC,aFact,aFact1);
                 [ #  # ]
    3017                 :            : 
    3018         [ #  # ]:          0 :             if (bC2)
    3019 [ #  # ][ #  # ]:          0 :                 ResizePoint(*pC2,aC,aFact,aFact1);
                 [ #  # ]
    3020                 :            :         }
    3021                 :            :     }
    3022                 :            : 
    3023 [ #  # ][ #  # ]:          0 :     if (aRad.X()!=0 && aRad.Y()!=0)
                 [ #  # ]
    3024                 :            :     {
    3025                 :            :         double nSin,nCos;
    3026                 :            : 
    3027   [ #  #  #  # ]:          0 :         switch (eMode)
    3028                 :            :         {
    3029         [ #  # ]:          0 :             case SDRCROOK_ROTATE : CrookRotateXPoint (rPnt,pC1,pC2,aC,aRad,nSin,nCos,bVert);           break;
    3030         [ #  # ]:          0 :             case SDRCROOK_SLANT  : CrookSlantXPoint  (rPnt,pC1,pC2,aC,aRad,nSin,nCos,bVert);           break;
    3031         [ #  # ]:          0 :             case SDRCROOK_STRETCH: CrookStretchXPoint(rPnt,pC1,pC2,aC,aRad,nSin,nCos,bVert,aMarkRect); break;
    3032                 :            :         } // switch
    3033                 :            :     }
    3034                 :          0 : }
    3035                 :            : 
    3036                 :          0 : void SdrDragCrook::MoveSdrDrag(const Point& rPnt)
    3037                 :            : {
    3038         [ #  # ]:          0 :     if (DragStat().CheckMinMoved(rPnt))
    3039                 :            :     {
    3040                 :          0 :         Point aPnt(rPnt);
    3041                 :          0 :         bool bNeuMoveOnly=getSdrDragView().IsMoveOnlyDragging();
    3042                 :          0 :         bAtCenter=false;
    3043                 :          0 :         SdrCrookMode eNeuMode=getSdrDragView().GetCrookMode();
    3044 [ #  # ][ #  # ]:          0 :         bool bNeuContortion=!bNeuMoveOnly && ((bContortionAllowed && !getSdrDragView().IsCrookNoContortion()) || !bNoContortionAllowed);
         [ #  # ][ #  # ]
    3045 [ #  # ][ #  # ]:          0 :         bResize=!getSdrDragView().IsOrtho() && bResizeAllowed && !bNeuMoveOnly;
                 [ #  # ]
    3046 [ #  # ][ #  # ]:          0 :         bool bNeuRotate=bRotateAllowed && !bNeuContortion && !bNeuMoveOnly && eNeuMode==SDRCROOK_ROTATE;
         [ #  # ][ #  # ]
    3047                 :          0 :         long nSA=0;
    3048                 :            : 
    3049         [ #  # ]:          0 :         if (nSA==0)
    3050         [ #  # ]:          0 :             aPnt=GetSnapPos(aPnt);
    3051                 :            : 
    3052                 :          0 :         Point aNeuCenter(aMarkCenter.X(),aStart.Y());
    3053                 :            : 
    3054         [ #  # ]:          0 :         if (bVertical)
    3055                 :            :         {
    3056                 :          0 :             aNeuCenter.X()=aStart.X();
    3057                 :          0 :             aNeuCenter.Y()=aMarkCenter.Y();
    3058                 :            :         }
    3059                 :            : 
    3060         [ #  # ]:          0 :         if (!getSdrDragView().IsCrookAtCenter())
    3061                 :            :         {
    3062   [ #  #  #  #  :          0 :             switch (GetDragHdlKind())
             #  #  #  #  
                      # ]
    3063                 :            :             {
    3064                 :          0 :                 case HDL_UPLFT: aNeuCenter.X()=aMarkRect.Right();  bLft=true; break;
    3065                 :          0 :                 case HDL_UPPER: aNeuCenter.Y()=aMarkRect.Bottom(); bUpr=true; break;
    3066                 :          0 :                 case HDL_UPRGT: aNeuCenter.X()=aMarkRect.Left();   bRgt=true; break;
    3067                 :          0 :                 case HDL_LEFT : aNeuCenter.X()=aMarkRect.Right();  bLft=true; break;
    3068                 :          0 :                 case HDL_RIGHT: aNeuCenter.X()=aMarkRect.Left();   bRgt=true; break;
    3069                 :          0 :                 case HDL_LWLFT: aNeuCenter.X()=aMarkRect.Right();  bLft=true; break;
    3070                 :          0 :                 case HDL_LOWER: aNeuCenter.Y()=aMarkRect.Top();    bLwr=true; break;
    3071                 :          0 :                 case HDL_LWRGT: aNeuCenter.X()=aMarkRect.Left();   bRgt=true; break;
    3072                 :          0 :                 default: bAtCenter=true;
    3073                 :            :             }
    3074                 :            :         }
    3075                 :            :         else
    3076                 :          0 :             bAtCenter=true;
    3077                 :            : 
    3078         [ #  # ]:          0 :         Fraction aNeuFact(1,1);
    3079                 :          0 :         long dx1=aPnt.X()-aNeuCenter.X();
    3080                 :          0 :         long dy1=aPnt.Y()-aNeuCenter.Y();
    3081         [ #  # ]:          0 :         bValid=bVertical ? dx1!=0 : dy1!=0;
    3082                 :            : 
    3083         [ #  # ]:          0 :         if (bValid)
    3084                 :            :         {
    3085         [ #  # ]:          0 :             if (bVertical)
    3086                 :          0 :                 bValid=Abs(dx1)*100>Abs(dy1);
    3087                 :            :             else
    3088                 :          0 :                 bValid=Abs(dy1)*100>Abs(dx1);
    3089                 :            :         }
    3090                 :            : 
    3091                 :          0 :         long nNeuRad=0;
    3092                 :          0 :         nWink=0;
    3093                 :            : 
    3094         [ #  # ]:          0 :         if (bValid)
    3095                 :            :         {
    3096                 :          0 :             double a=0; // slope of the radius
    3097                 :          0 :             long nPntWink=0;
    3098                 :            : 
    3099         [ #  # ]:          0 :             if (bVertical)
    3100                 :            :             {
    3101                 :          0 :                 a=((double)dy1)/((double)dx1); // slope of the radius
    3102                 :          0 :                 nNeuRad=((long)(dy1*a)+dx1) /2;
    3103                 :          0 :                 aNeuCenter.X()+=nNeuRad;
    3104         [ #  # ]:          0 :                 nPntWink=GetAngle(aPnt-aNeuCenter);
    3105                 :            :             }
    3106                 :            :             else
    3107                 :            :             {
    3108                 :          0 :                 a=((double)dx1)/((double)dy1); // slope of the radius
    3109                 :          0 :                 nNeuRad=((long)(dx1*a)+dy1) /2;
    3110                 :          0 :                 aNeuCenter.Y()+=nNeuRad;
    3111         [ #  # ]:          0 :                 nPntWink=GetAngle(aPnt-aNeuCenter)-9000;
    3112                 :            :             }
    3113                 :            : 
    3114         [ #  # ]:          0 :             if (!bAtCenter)
    3115                 :            :             {
    3116         [ #  # ]:          0 :                 if (nNeuRad<0)
    3117                 :            :                 {
    3118         [ #  # ]:          0 :                     if (bRgt) nPntWink+=18000;
    3119         [ #  # ]:          0 :                     if (bLft) nPntWink=18000-nPntWink;
    3120         [ #  # ]:          0 :                     if (bLwr) nPntWink=-nPntWink;
    3121                 :            :                 }
    3122                 :            :                 else
    3123                 :            :                 {
    3124         [ #  # ]:          0 :                     if (bRgt) nPntWink=-nPntWink;
    3125         [ #  # ]:          0 :                     if (bUpr) nPntWink=18000-nPntWink;
    3126         [ #  # ]:          0 :                     if (bLwr) nPntWink+=18000;
    3127                 :            :                 }
    3128                 :            : 
    3129         [ #  # ]:          0 :                 nPntWink=NormAngle360(nPntWink);
    3130                 :            :             }
    3131                 :            :             else
    3132                 :            :             {
    3133         [ #  # ]:          0 :                 if (nNeuRad<0) nPntWink+=18000;
    3134         [ #  # ]:          0 :                 if (bVertical) nPntWink=18000-nPntWink;
    3135         [ #  # ]:          0 :                 nPntWink=NormAngle180(nPntWink);
    3136                 :          0 :                 nPntWink=Abs(nPntWink);
    3137                 :            :             }
    3138                 :            : 
    3139                 :          0 :             double nUmfang=2*Abs(nNeuRad)*nPi;
    3140                 :            : 
    3141         [ #  # ]:          0 :             if (bResize)
    3142                 :            :             {
    3143         [ #  # ]:          0 :                 if (nSA!=0)
    3144                 :            :                 { // angle snapping
    3145                 :          0 :                     long nWink0=nPntWink;
    3146                 :          0 :                     nPntWink+=nSA/2;
    3147                 :          0 :                     nPntWink/=nSA;
    3148                 :          0 :                     nPntWink*=nSA;
    3149         [ #  # ]:          0 :                     BigInt a2(nNeuRad);
    3150 [ #  # ][ #  # ]:          0 :                     a2*=BigInt(nWink);
    3151 [ #  # ][ #  # ]:          0 :                     a2/=BigInt(nWink0);
    3152         [ #  # ]:          0 :                     nNeuRad=long(a2);
    3153                 :            : 
    3154         [ #  # ]:          0 :                     if (bVertical)
    3155                 :          0 :                         aNeuCenter.X()=aStart.X()+nNeuRad;
    3156                 :            :                     else
    3157                 :          0 :                         aNeuCenter.Y()=aStart.Y()+nNeuRad;
    3158                 :            :                 }
    3159                 :            : 
    3160         [ #  # ]:          0 :                 long nMul=(long)(nUmfang*NormAngle360(nPntWink)/36000);
    3161                 :            : 
    3162         [ #  # ]:          0 :                 if (bAtCenter)
    3163                 :          0 :                     nMul*=2;
    3164                 :            : 
    3165 [ #  # ][ #  # ]:          0 :                 aNeuFact=Fraction(nMul,nMarkSize);
    3166                 :          0 :                 nWink=nPntWink;
    3167                 :            :             }
    3168                 :            :             else
    3169                 :            :             {
    3170                 :          0 :                 nWink=(long)((nMarkSize*360/nUmfang)*100)/2;
    3171                 :            : 
    3172         [ #  # ]:          0 :                 if (nWink==0)
    3173                 :          0 :                     bValid=false;
    3174                 :            : 
    3175 [ #  # ][ #  # ]:          0 :                 if (bValid && nSA!=0)
    3176                 :            :                 { // angle snapping
    3177                 :          0 :                     long nWink0=nWink;
    3178                 :          0 :                     nWink+=nSA/2;
    3179                 :          0 :                     nWink/=nSA;
    3180                 :          0 :                     nWink*=nSA;
    3181         [ #  # ]:          0 :                     BigInt a2(nNeuRad);
    3182 [ #  # ][ #  # ]:          0 :                     a2*=BigInt(nWink);
    3183 [ #  # ][ #  # ]:          0 :                     a2/=BigInt(nWink0);
    3184         [ #  # ]:          0 :                     nNeuRad=long(a2);
    3185                 :            : 
    3186         [ #  # ]:          0 :                     if (bVertical)
    3187                 :          0 :                         aNeuCenter.X()=aStart.X()+nNeuRad;
    3188                 :            :                     else
    3189                 :          0 :                         aNeuCenter.Y()=aStart.Y()+nNeuRad;
    3190                 :            :                 }
    3191                 :            :             }
    3192                 :            :         }
    3193                 :            : 
    3194 [ #  # ][ #  # ]:          0 :         if (nWink==0 || nNeuRad==0)
    3195                 :          0 :             bValid=false;
    3196                 :            : 
    3197         [ #  # ]:          0 :         if (!bValid)
    3198                 :          0 :             nNeuRad=0;
    3199                 :            : 
    3200 [ #  # ][ #  # ]:          0 :         if (!bValid && bResize)
    3201                 :            :         {
    3202         [ #  # ]:          0 :             long nMul=bVertical ? dy1 : dx1;
    3203                 :            : 
    3204 [ #  # ][ #  # ]:          0 :             if (bLft || bUpr)
    3205                 :          0 :                 nMul=-nMul;
    3206                 :            : 
    3207                 :          0 :             long nDiv=nMarkSize;
    3208                 :            : 
    3209         [ #  # ]:          0 :             if (bAtCenter)
    3210                 :            :             {
    3211                 :          0 :                 nMul*=2;
    3212                 :          0 :                 nMul=Abs(nMul);
    3213                 :            :             }
    3214                 :            : 
    3215 [ #  # ][ #  # ]:          0 :             aNeuFact=Fraction(nMul,nDiv);
    3216                 :            :         }
    3217                 :            : 
    3218 [ #  # ][ #  # ]:          0 :         if (aNeuCenter!=aCenter || bNeuContortion!=bContortion || aNeuFact!=aFact ||
                 [ #  # ]
           [ #  #  #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
    3219                 :          0 :             bNeuMoveOnly != getMoveOnly() || bNeuRotate!=bRotate || eNeuMode!=eMode)
    3220                 :            :         {
    3221         [ #  # ]:          0 :             Hide();
    3222                 :          0 :             setMoveOnly(bNeuMoveOnly);
    3223                 :          0 :             bRotate=bNeuRotate;
    3224                 :          0 :             eMode=eNeuMode;
    3225                 :          0 :             bContortion=bNeuContortion;
    3226                 :          0 :             aCenter=aNeuCenter;
    3227         [ #  # ]:          0 :             aFact=aNeuFact;
    3228                 :          0 :             aRad=Point(nNeuRad,nNeuRad);
    3229 [ #  # ][ #  # ]:          0 :             bResize=aFact!=Fraction(1,1) && aFact.GetDenominator()!=0 && aFact.IsValid();
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    3230         [ #  # ]:          0 :             DragStat().NextMove(aPnt);
    3231         [ #  # ]:          0 :             Show();
    3232                 :            :         }
    3233                 :            :     }
    3234                 :          0 : }
    3235                 :            : 
    3236                 :          0 : void SdrDragCrook::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
    3237                 :            : {
    3238         [ #  # ]:          0 :     const bool bDoResize(aFact!=Fraction(1,1));
    3239 [ #  # ][ #  # ]:          0 :     const bool bDoCrook(aCenter!=aMarkCenter && aRad.X()!=0 && aRad.Y()!=0);
                 [ #  # ]
    3240                 :            : 
    3241 [ #  # ][ #  # ]:          0 :     if (bDoCrook || bDoResize)
    3242                 :            :     {
    3243         [ #  # ]:          0 :         if (bDoResize)
    3244                 :            :         {
    3245         [ #  # ]:          0 :             Fraction aFact1(1,1);
    3246                 :            : 
    3247         [ #  # ]:          0 :             if (bContortion)
    3248                 :            :             {
    3249         [ #  # ]:          0 :                 if (bVertical)
    3250                 :            :                 {
    3251         [ #  # ]:          0 :                     rTarget.Resize(aCenter,aFact1,aFact);
    3252                 :            :                 }
    3253                 :            :                 else
    3254                 :            :                 {
    3255         [ #  # ]:          0 :                     rTarget.Resize(aCenter,aFact,aFact1);
    3256                 :            :                 }
    3257                 :            :             }
    3258                 :            :             else
    3259                 :            :             {
    3260 [ #  # ][ #  # ]:          0 :                 Point aCtr0(rTarget.GetSnapRect().Center());
    3261                 :          0 :                 Point aCtr1(aCtr0);
    3262                 :            : 
    3263         [ #  # ]:          0 :                 if (bVertical)
    3264                 :            :                 {
    3265 [ #  # ][ #  # ]:          0 :                     ResizePoint(aCtr1,aCenter,aFact1,aFact);
                 [ #  # ]
    3266                 :            :                 }
    3267                 :            :                 else
    3268                 :            :                 {
    3269 [ #  # ][ #  # ]:          0 :                     ResizePoint(aCtr1,aCenter,aFact,aFact1);
                 [ #  # ]
    3270                 :            :                 }
    3271                 :            : 
    3272                 :          0 :                 Size aSiz(aCtr1.X()-aCtr0.X(),aCtr1.Y()-aCtr0.Y());
    3273                 :            : 
    3274         [ #  # ]:          0 :                 rTarget.Move(aSiz);
    3275                 :            :             }
    3276                 :            :         }
    3277                 :            : 
    3278         [ #  # ]:          0 :         if (bDoCrook)
    3279                 :            :         {
    3280         [ #  # ]:          0 :             const Rectangle aLocalMarkRect(getSdrDragView().GetMarkedObjRect());
    3281 [ #  # ][ #  # ]:          0 :             const bool bLocalRotate(!bContortion && eMode == SDRCROOK_ROTATE && getSdrDragView().IsRotateAllowed(false));
         [ #  # ][ #  # ]
    3282                 :            : 
    3283         [ #  # ]:          0 :             getSdrDragView().ImpCrookObj(&rTarget,aCenter,aRad,eMode,bVertical,!bContortion,bLocalRotate,aLocalMarkRect);
    3284                 :            :         }
    3285                 :            :     }
    3286                 :          0 : }
    3287                 :            : 
    3288                 :          0 : void SdrDragCrook::applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget)
    3289                 :            : {
    3290                 :            :     // use helper derived from old stuff
    3291                 :          0 :     _MovAllPoints(rTarget);
    3292                 :          0 : }
    3293                 :            : 
    3294                 :          0 : bool SdrDragCrook::EndSdrDrag(bool bCopy)
    3295                 :            : {
    3296                 :          0 :     Hide();
    3297                 :            : 
    3298 [ #  # ][ #  # ]:          0 :     if (bResize && aFact==Fraction(1,1))
         [ #  # ][ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
    3299                 :          0 :         bResize=false;
    3300                 :            : 
    3301                 :          0 :     const bool bUndo = getSdrDragView().IsUndoEnabled();
    3302                 :            : 
    3303 [ #  # ][ #  # ]:          0 :     bool bDoCrook=aCenter!=aMarkCenter && aRad.X()!=0 && aRad.Y()!=0;
                 [ #  # ]
    3304                 :            : 
    3305 [ #  # ][ #  # ]:          0 :     if (bDoCrook || bResize)
    3306                 :            :     {
    3307 [ #  # ][ #  # ]:          0 :         if (bResize && bUndo)
    3308                 :            :         {
    3309         [ #  # ]:          0 :             XubString aStr;
    3310 [ #  # ][ #  # ]:          0 :             ImpTakeDescriptionStr(!bContortion?STR_EditCrook:STR_EditCrookContortion,aStr);
    3311                 :            : 
    3312         [ #  # ]:          0 :             if (bCopy)
    3313 [ #  # ][ #  # ]:          0 :                 aStr+=ImpGetResStr(STR_EditWithCopy);
                 [ #  # ]
    3314                 :            : 
    3315 [ #  # ][ #  # ]:          0 :             getSdrDragView().BegUndo(aStr);
    3316                 :            :         }
    3317                 :            : 
    3318         [ #  # ]:          0 :         if (bResize)
    3319                 :            :         {
    3320         [ #  # ]:          0 :             Fraction aFact1(1,1);
    3321                 :            : 
    3322         [ #  # ]:          0 :             if (bContortion)
    3323                 :            :             {
    3324         [ #  # ]:          0 :                 if (bVertical)
    3325         [ #  # ]:          0 :                     getSdrDragView().ResizeMarkedObj(aCenter,aFact1,aFact,bCopy);
    3326                 :            :                 else
    3327         [ #  # ]:          0 :                     getSdrDragView().ResizeMarkedObj(aCenter,aFact,aFact1,bCopy);
    3328                 :            :             }
    3329                 :            :             else
    3330                 :            :             {
    3331         [ #  # ]:          0 :                 if (bCopy)
    3332         [ #  # ]:          0 :                     getSdrDragView().CopyMarkedObj();
    3333                 :            : 
    3334                 :          0 :                 sal_uLong nMarkAnz=getSdrDragView().GetMarkedObjectList().GetMarkCount();
    3335                 :            : 
    3336         [ #  # ]:          0 :                 for (sal_uLong nm=0; nm<nMarkAnz; nm++)
    3337                 :            :                 {
    3338         [ #  # ]:          0 :                     SdrMark* pM=getSdrDragView().GetMarkedObjectList().GetMark(nm);
    3339         [ #  # ]:          0 :                     SdrObject* pO=pM->GetMarkedSdrObj();
    3340 [ #  # ][ #  # ]:          0 :                     Point aCtr0(pO->GetSnapRect().Center());
    3341                 :          0 :                     Point aCtr1(aCtr0);
    3342                 :            : 
    3343         [ #  # ]:          0 :                     if (bVertical)
    3344 [ #  # ][ #  # ]:          0 :                         ResizePoint(aCtr1,aCenter,aFact1,aFact);
                 [ #  # ]
    3345                 :            :                     else
    3346 [ #  # ][ #  # ]:          0 :                         ResizePoint(aCtr1,aCenter,aFact,aFact1);
                 [ #  # ]
    3347                 :            : 
    3348                 :          0 :                     Size aSiz(aCtr1.X()-aCtr0.X(),aCtr1.Y()-aCtr0.Y());
    3349         [ #  # ]:          0 :                     if( bUndo )
    3350 [ #  # ][ #  # ]:          0 :                         AddUndo(getSdrDragView().GetModel()->GetSdrUndoFactory().CreateUndoMoveObject(*pO,aSiz));
                 [ #  # ]
    3351         [ #  # ]:          0 :                     pO->Move(aSiz);
    3352                 :            :                 }
    3353                 :            :             }
    3354                 :            : 
    3355                 :          0 :             bCopy=false;
    3356                 :            :         }
    3357                 :            : 
    3358         [ #  # ]:          0 :         if (bDoCrook)
    3359                 :            :         {
    3360                 :          0 :             getSdrDragView().CrookMarkedObj(aCenter,aRad,eMode,bVertical,!bContortion,bCopy);
    3361                 :          0 :             getSdrDragView().SetLastCrookCenter(aCenter);
    3362                 :            :         }
    3363                 :            : 
    3364 [ #  # ][ #  # ]:          0 :         if (bResize && bUndo)
    3365                 :          0 :             getSdrDragView().EndUndo();
    3366                 :            : 
    3367                 :          0 :         return true;
    3368                 :            :     }
    3369                 :            : 
    3370                 :          0 :     return false;
    3371                 :            : }
    3372                 :            : 
    3373                 :          0 : Pointer SdrDragCrook::GetSdrDragPointer() const
    3374                 :            : {
    3375                 :          0 :     return Pointer(POINTER_CROOK);
    3376                 :            : }
    3377                 :            : 
    3378                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    3379                 :            : 
    3380 [ #  # ][ #  # ]:          0 : TYPEINIT1(SdrDragDistort,SdrDragMethod);
    3381                 :            : 
    3382                 :          0 : SdrDragDistort::SdrDragDistort(SdrDragView& rNewView)
    3383                 :            : :   SdrDragMethod(rNewView),
    3384                 :            :     nPolyPt(0),
    3385                 :            :     bContortionAllowed(false),
    3386                 :            :     bNoContortionAllowed(false),
    3387 [ #  # ][ #  # ]:          0 :     bContortion(false)
    3388                 :            : {
    3389                 :          0 : }
    3390                 :            : 
    3391                 :          0 : void SdrDragDistort::TakeSdrDragComment(XubString& rStr) const
    3392                 :            : {
    3393         [ #  # ]:          0 :     ImpTakeDescriptionStr(STR_DragMethDistort, rStr);
    3394                 :            : 
    3395                 :          0 :     rtl::OUString aStr;
    3396                 :            : 
    3397         [ #  # ]:          0 :     rStr.AppendAscii(" (x=");
    3398 [ #  # ][ #  # ]:          0 :     getSdrDragView().GetModel()->TakeMetricStr(DragStat().GetDX(), aStr);
    3399 [ #  # ][ #  # ]:          0 :     rStr.Append(aStr);
                 [ #  # ]
    3400         [ #  # ]:          0 :     rStr.AppendAscii(" y=");
    3401 [ #  # ][ #  # ]:          0 :     getSdrDragView().GetModel()->TakeMetricStr(DragStat().GetDY(), aStr);
    3402 [ #  # ][ #  # ]:          0 :     rStr.Append(aStr);
                 [ #  # ]
    3403         [ #  # ]:          0 :     rStr += sal_Unicode(')');
    3404                 :            : 
    3405         [ #  # ]:          0 :     if(getSdrDragView().IsDragWithCopy())
    3406 [ #  # ][ #  # ]:          0 :         rStr += ImpGetResStr(STR_EditWithCopy);
                 [ #  # ]
    3407                 :          0 : }
    3408                 :            : 
    3409                 :          0 : void SdrDragDistort::createSdrDragEntries()
    3410                 :            : {
    3411                 :            :     // Add extended frame raster first, so it will be behind objects
    3412         [ #  # ]:          0 :     if(getSdrDragView().GetSdrPageView())
    3413                 :            :     {
    3414 [ #  # ][ #  # ]:          0 :         const basegfx::B2DPolyPolygon aDragRaster(impCreateDragRaster(*getSdrDragView().GetSdrPageView(), GetMarkedRect()));
    3415                 :            : 
    3416 [ #  # ][ #  # ]:          0 :         if(aDragRaster.count())
    3417                 :            :         {
    3418 [ #  # ][ #  # ]:          0 :             addSdrDragEntry(new SdrDragEntryPolyPolygon(aDragRaster));
                 [ #  # ]
    3419         [ #  # ]:          0 :         }
    3420                 :            :     }
    3421                 :            : 
    3422                 :            :     // call parent
    3423                 :          0 :     SdrDragMethod::createSdrDragEntries();
    3424                 :          0 : }
    3425                 :            : 
    3426                 :          0 : bool SdrDragDistort::BeginSdrDrag()
    3427                 :            : {
    3428                 :          0 :     bContortionAllowed=getSdrDragView().IsDistortAllowed(false);
    3429                 :          0 :     bNoContortionAllowed=getSdrDragView().IsDistortAllowed(true);
    3430                 :            : 
    3431 [ #  # ][ #  # ]:          0 :     if (bContortionAllowed || bNoContortionAllowed)
    3432                 :            :     {
    3433                 :          0 :         SdrHdlKind eKind=GetDragHdlKind();
    3434                 :          0 :         nPolyPt=0xFFFF;
    3435                 :            : 
    3436         [ #  # ]:          0 :         if (eKind==HDL_UPLFT) nPolyPt=0;
    3437         [ #  # ]:          0 :         if (eKind==HDL_UPRGT) nPolyPt=1;
    3438         [ #  # ]:          0 :         if (eKind==HDL_LWRGT) nPolyPt=2;
    3439         [ #  # ]:          0 :         if (eKind==HDL_LWLFT) nPolyPt=3;
    3440         [ #  # ]:          0 :         if (nPolyPt>3) return false;
    3441                 :            : 
    3442                 :          0 :         aMarkRect=GetMarkedRect();
    3443         [ #  # ]:          0 :         aDistortedRect=XPolygon(aMarkRect);
    3444                 :          0 :         Show();
    3445                 :          0 :         return true;
    3446                 :            :     }
    3447                 :            :     else
    3448                 :            :     {
    3449                 :          0 :         return false;
    3450                 :            :     }
    3451                 :            : }
    3452                 :            : 
    3453                 :          0 : void SdrDragDistort::_MovAllPoints(basegfx::B2DPolyPolygon& rTarget)
    3454                 :            : {
    3455         [ #  # ]:          0 :     if (bContortion)
    3456                 :            :     {
    3457                 :          0 :         SdrPageView* pPV = getSdrDragView().GetSdrPageView();
    3458                 :            : 
    3459         [ #  # ]:          0 :         if(pPV)
    3460                 :            :         {
    3461         [ #  # ]:          0 :             if (pPV->HasMarkedObjPageView())
    3462                 :            :             {
    3463         [ #  # ]:          0 :                 basegfx::B2DPolyPolygon aDragPolygon(rTarget);
    3464         [ #  # ]:          0 :                 const basegfx::B2DRange aOriginalRange(aMarkRect.Left(), aMarkRect.Top(), aMarkRect.Right(), aMarkRect.Bottom());
    3465 [ #  # ][ #  # ]:          0 :                 const basegfx::B2DPoint aTopLeft(aDistortedRect[0].X(), aDistortedRect[0].Y());
    3466 [ #  # ][ #  # ]:          0 :                 const basegfx::B2DPoint aTopRight(aDistortedRect[1].X(), aDistortedRect[1].Y());
    3467 [ #  # ][ #  # ]:          0 :                 const basegfx::B2DPoint aBottomLeft(aDistortedRect[3].X(), aDistortedRect[3].Y());
    3468 [ #  # ][ #  # ]:          0 :                 const basegfx::B2DPoint aBottomRight(aDistortedRect[2].X(), aDistortedRect[2].Y());
    3469                 :            : 
    3470 [ #  # ][ #  # ]:          0 :                 aDragPolygon = basegfx::tools::distort(aDragPolygon, aOriginalRange, aTopLeft, aTopRight, aBottomLeft, aBottomRight);
                 [ #  # ]
    3471 [ #  # ][ #  # ]:          0 :                 rTarget = aDragPolygon;
    3472                 :            :             }
    3473                 :            :         }
    3474                 :            :     }
    3475                 :          0 : }
    3476                 :            : 
    3477                 :          0 : void SdrDragDistort::MoveSdrDrag(const Point& rPnt)
    3478                 :            : {
    3479         [ #  # ]:          0 :     if (DragStat().CheckMinMoved(rPnt))
    3480                 :            :     {
    3481         [ #  # ]:          0 :         Point aPnt(GetSnapPos(rPnt));
    3482                 :            : 
    3483         [ #  # ]:          0 :         if (getSdrDragView().IsOrtho())
    3484 [ #  # ][ #  # ]:          0 :             OrthoDistance8(DragStat().GetStart(),aPnt,getSdrDragView().IsBigOrtho());
    3485                 :            : 
    3486 [ #  # ][ #  # ]:          0 :         bool bNeuContortion=(bContortionAllowed && !getSdrDragView().IsCrookNoContortion()) || !bNoContortionAllowed;
                 [ #  # ]
    3487                 :            : 
    3488 [ #  # ][ #  # ]:          0 :         if (bNeuContortion!=bContortion || aDistortedRect[nPolyPt]!=aPnt)
         [ #  # ][ #  # ]
    3489                 :            :         {
    3490         [ #  # ]:          0 :             Hide();
    3491         [ #  # ]:          0 :             aDistortedRect[nPolyPt]=aPnt;
    3492                 :          0 :             bContortion=bNeuContortion;
    3493         [ #  # ]:          0 :             DragStat().NextMove(aPnt);
    3494         [ #  # ]:          0 :             Show();
    3495                 :            :         }
    3496                 :            :     }
    3497                 :          0 : }
    3498                 :            : 
    3499                 :          0 : bool SdrDragDistort::EndSdrDrag(bool bCopy)
    3500                 :            : {
    3501                 :          0 :     Hide();
    3502 [ #  # ][ #  # ]:          0 :     bool bDoDistort=DragStat().GetDX()!=0 || DragStat().GetDY()!=0;
    3503                 :            : 
    3504         [ #  # ]:          0 :     if (bDoDistort)
    3505                 :            :     {
    3506                 :          0 :         getSdrDragView().DistortMarkedObj(aMarkRect,aDistortedRect,!bContortion,bCopy);
    3507                 :          0 :         return true;
    3508                 :            :     }
    3509                 :            : 
    3510                 :          0 :     return false;
    3511                 :            : }
    3512                 :            : 
    3513                 :          0 : Pointer SdrDragDistort::GetSdrDragPointer() const
    3514                 :            : {
    3515                 :          0 :     return Pointer(POINTER_REFHAND);
    3516                 :            : }
    3517                 :            : 
    3518                 :          0 : void SdrDragDistort::applyCurrentTransformationToSdrObject(SdrObject& rTarget)
    3519                 :            : {
    3520 [ #  # ][ #  # ]:          0 :     const bool bDoDistort(DragStat().GetDX()!=0 || DragStat().GetDY()!=0);
    3521                 :            : 
    3522         [ #  # ]:          0 :     if (bDoDistort)
    3523                 :            :     {
    3524                 :          0 :         getSdrDragView().ImpDistortObj(&rTarget, aMarkRect, aDistortedRect, !bContortion);
    3525                 :            :     }
    3526                 :          0 : }
    3527                 :            : 
    3528                 :          0 : void SdrDragDistort::applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget)
    3529                 :            : {
    3530                 :            :     // use helper derived from old stuff
    3531                 :          0 :     _MovAllPoints(rTarget);
    3532                 :          0 : }
    3533                 :            : 
    3534                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    3535                 :            : 
    3536 [ #  # ][ #  # ]:          0 : TYPEINIT1(SdrDragCrop,SdrDragResize);
    3537                 :            : 
    3538                 :          0 : SdrDragCrop::SdrDragCrop(SdrDragView& rNewView)
    3539                 :          0 : :   SdrDragResize(rNewView)
    3540                 :            : {
    3541                 :            :     // switch off solid dragging for crop; it just makes no sense since showing
    3542                 :            :     // a 50% transparent object above the original will not be visible
    3543                 :          0 :     setSolidDraggingActive(false);
    3544                 :          0 : }
    3545                 :            : 
    3546                 :          0 : void SdrDragCrop::TakeSdrDragComment(XubString& rStr) const
    3547                 :            : {
    3548         [ #  # ]:          0 :     ImpTakeDescriptionStr(STR_DragMethCrop, rStr);
    3549                 :            : 
    3550                 :          0 :     rtl::OUString aStr;
    3551                 :            : 
    3552         [ #  # ]:          0 :     rStr.AppendAscii(" (x=");
    3553 [ #  # ][ #  # ]:          0 :     getSdrDragView().GetModel()->TakeMetricStr(DragStat().GetDX(), aStr);
    3554 [ #  # ][ #  # ]:          0 :     rStr.Append(aStr);
                 [ #  # ]
    3555         [ #  # ]:          0 :     rStr.AppendAscii(" y=");
    3556 [ #  # ][ #  # ]:          0 :     getSdrDragView().GetModel()->TakeMetricStr(DragStat().GetDY(), aStr);
    3557 [ #  # ][ #  # ]:          0 :     rStr.Append(aStr);
                 [ #  # ]
    3558         [ #  # ]:          0 :     rStr += sal_Unicode(')');
    3559                 :            : 
    3560         [ #  # ]:          0 :     if(getSdrDragView().IsDragWithCopy())
    3561 [ #  # ][ #  # ]:          0 :         rStr += ImpGetResStr(STR_EditWithCopy);
                 [ #  # ]
    3562                 :          0 : }
    3563                 :            : 
    3564                 :          0 : bool SdrDragCrop::EndSdrDrag(bool bCopy)
    3565                 :            : {
    3566         [ #  # ]:          0 :     Hide();
    3567                 :            : 
    3568 [ #  # ][ #  # ]:          0 :     if( DragStat().GetDX()==0 && DragStat().GetDY()==0 )
         [ #  # ][ #  # ]
                 [ #  # ]
    3569                 :          0 :         return false;
    3570                 :            : 
    3571                 :          0 :     const SdrMarkList& rMarkList = getSdrDragView().GetMarkedObjectList();
    3572                 :            : 
    3573         [ #  # ]:          0 :     if( rMarkList.GetMarkCount() != 1 )
    3574                 :          0 :         return false;
    3575                 :            : 
    3576 [ #  # ][ #  # ]:          0 :     SdrGrafObj* pObj = dynamic_cast<SdrGrafObj*>( rMarkList.GetMark( 0 )->GetMarkedSdrObj() );
                 [ #  # ]
    3577                 :            : 
    3578 [ #  # ][ #  # ]:          0 :     if( !pObj || (pObj->GetGraphicType() == GRAPHIC_NONE) || (pObj->GetGraphicType() == GRAPHIC_DEFAULT) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    3579                 :          0 :         return false;
    3580                 :            : 
    3581         [ #  # ]:          0 :     const GraphicObject& rGraphicObject = pObj->GetGraphicObject();
    3582         [ #  # ]:          0 :     const MapMode aMapMode100thmm(MAP_100TH_MM);
    3583                 :          0 :     Size aGraphicSize(rGraphicObject.GetPrefSize());
    3584                 :            : 
    3585         [ #  # ]:          0 :     if( MAP_PIXEL == rGraphicObject.GetPrefMapMode().GetMapUnit() )
    3586 [ #  # ][ #  # ]:          0 :         aGraphicSize = Application::GetDefaultDevice()->PixelToLogic( aGraphicSize, aMapMode100thmm );
    3587                 :            :     else
    3588 [ #  # ][ #  # ]:          0 :         aGraphicSize = Application::GetDefaultDevice()->LogicToLogic( aGraphicSize, rGraphicObject.GetPrefMapMode(), aMapMode100thmm);
    3589                 :            : 
    3590 [ #  # ][ #  # ]:          0 :     if( aGraphicSize.nA == 0 || aGraphicSize.nB == 0 )
    3591                 :          0 :         return false;
    3592                 :            : 
    3593         [ #  # ]:          0 :     const SdrGrafCropItem& rOldCrop = (const SdrGrafCropItem&)pObj->GetMergedItem(SDRATTR_GRAFCROP);
    3594                 :            : 
    3595         [ #  # ]:          0 :     const bool bUndo = getSdrDragView().IsUndoEnabled();
    3596                 :            : 
    3597         [ #  # ]:          0 :     if( bUndo )
    3598                 :            :     {
    3599         [ #  # ]:          0 :         String aUndoStr;
    3600         [ #  # ]:          0 :         ImpTakeDescriptionStr(STR_DragMethCrop, aUndoStr);
    3601                 :            : 
    3602         [ #  # ]:          0 :         getSdrDragView().BegUndo( aUndoStr );
    3603 [ #  # ][ #  # ]:          0 :         getSdrDragView().AddUndo( getSdrDragView().GetModel()->GetSdrUndoFactory().CreateUndoGeoObject( *pObj ) );
         [ #  # ][ #  # ]
    3604                 :            :     }
    3605                 :            : 
    3606         [ #  # ]:          0 :     Rectangle aOldRect( pObj->GetLogicRect() );
    3607         [ #  # ]:          0 :     getSdrDragView().ResizeMarkedObj(DragStat().Ref1(),aXFact,aYFact,bCopy);
    3608         [ #  # ]:          0 :     Rectangle aNewRect( pObj->GetLogicRect() );
    3609                 :            : 
    3610         [ #  # ]:          0 :     double fScaleX = ( aGraphicSize.Width() - rOldCrop.GetLeft() - rOldCrop.GetRight() ) / (double)aOldRect.GetWidth();
    3611         [ #  # ]:          0 :     double fScaleY = ( aGraphicSize.Height() - rOldCrop.GetTop() - rOldCrop.GetBottom() ) / (double)aOldRect.GetHeight();
    3612                 :            : 
    3613                 :          0 :     sal_Int32 nDiffLeft = aNewRect.nLeft - aOldRect.nLeft;
    3614                 :          0 :     sal_Int32 nDiffTop = aNewRect.nTop - aOldRect.nTop;
    3615                 :          0 :     sal_Int32 nDiffRight = aNewRect.nRight - aOldRect.nRight;
    3616                 :          0 :     sal_Int32 nDiffBottom = aNewRect.nBottom - aOldRect.nBottom;
    3617                 :            : 
    3618                 :          0 :     sal_Int32 nLeftCrop = static_cast<sal_Int32>( rOldCrop.GetLeft() + nDiffLeft * fScaleX );
    3619                 :          0 :     sal_Int32 nTopCrop = static_cast<sal_Int32>( rOldCrop.GetTop() + nDiffTop * fScaleY );
    3620                 :          0 :     sal_Int32 nRightCrop = static_cast<sal_Int32>( rOldCrop.GetRight() - nDiffRight * fScaleX );
    3621                 :          0 :     sal_Int32 nBottomCrop = static_cast<sal_Int32>( rOldCrop.GetBottom() - nDiffBottom * fScaleY );
    3622                 :            : 
    3623                 :          0 :     SfxItemPool& rPool = getSdrDragView().GetModel()->GetItemPool();
    3624         [ #  # ]:          0 :     SfxItemSet aSet( rPool, SDRATTR_GRAFCROP, SDRATTR_GRAFCROP );
    3625 [ #  # ][ #  # ]:          0 :     aSet.Put( SdrGrafCropItem( nLeftCrop, nTopCrop, nRightCrop, nBottomCrop ) );
                 [ #  # ]
    3626         [ #  # ]:          0 :     getSdrDragView().SetAttributes( aSet, false );
    3627                 :            : 
    3628         [ #  # ]:          0 :     if( bUndo )
    3629         [ #  # ]:          0 :         getSdrDragView().EndUndo();
    3630                 :            : 
    3631 [ #  # ][ #  # ]:          0 :     return true;
    3632                 :            : }
    3633                 :            : 
    3634                 :          0 : Pointer SdrDragCrop::GetSdrDragPointer() const
    3635                 :            : {
    3636                 :          0 :     return Pointer(POINTER_CROP);
    3637                 :            : }
    3638                 :            : 
    3639                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10