LCOV - code coverage report
Current view: top level - svx/source/svdraw - svdmrkv.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 444 1074 41.3 %
Date: 2012-08-25 Functions: 39 71 54.9 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 374 1554 24.1 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <svx/svdmrkv.hxx>
      31                 :            : #include <svx/svdetc.hxx>
      32                 :            : #include <svx/svdoedge.hxx>
      33                 :            : #include "svx/svdglob.hxx"
      34                 :            : #include "svx/svditext.hxx"
      35                 :            : #include <svx/svdview.hxx>
      36                 :            : #include <svx/svdpagv.hxx>
      37                 :            : #include <svx/svdpage.hxx>
      38                 :            : #include "svddrgm1.hxx"
      39                 :            : 
      40                 :            : #ifdef DBG_UTIL
      41                 :            : #include <svdibrow.hxx>
      42                 :            : #endif
      43                 :            : 
      44                 :            : #include <svx/svdoole2.hxx>
      45                 :            : #include <svx/xgrad.hxx>
      46                 :            : #include <svx/xflgrit.hxx>
      47                 :            : #include "gradtrns.hxx"
      48                 :            : #include <svx/xflftrit.hxx>
      49                 :            : #include <svx/dialmgr.hxx>
      50                 :            : #include "svx/svdstr.hrc"
      51                 :            : #include <svx/svdundo.hxx>
      52                 :            : #include <svx/svdopath.hxx>
      53                 :            : #include <svx/scene3d.hxx>
      54                 :            : #include <svx/svdovirt.hxx>
      55                 :            : #include <svx/sdr/overlay/overlayrollingrectangle.hxx>
      56                 :            : #include <svx/sdr/overlay/overlaymanager.hxx>
      57                 :            : #include <svx/sdrpaintwindow.hxx>
      58                 :            : #include <svx/sdrpagewindow.hxx>
      59                 :            : #include <svx/sdrhittesthelper.hxx>
      60                 :            : 
      61                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
      62                 :            : // Migrate Marking of Objects, Points and GluePoints
      63                 :            : 
      64                 :            : class ImplMarkingOverlay
      65                 :            : {
      66                 :            :     // The OverlayObjects
      67                 :            :     ::sdr::overlay::OverlayObjectList               maObjects;
      68                 :            : 
      69                 :            :     // The remembered second position in logical coordinates
      70                 :            :     basegfx::B2DPoint                               maSecondPosition;
      71                 :            : 
      72                 :            :     // bitfield
      73                 :            :     // A flag to remember if the action is for unmarking.
      74                 :            :     unsigned                                        mbUnmarking : 1;
      75                 :            : 
      76                 :            : public:
      77                 :            :     ImplMarkingOverlay(const SdrPaintView& rView, const basegfx::B2DPoint& rStartPos, sal_Bool bUnmarking = sal_False);
      78                 :            :     ~ImplMarkingOverlay();
      79                 :            : 
      80                 :            :     void SetSecondPosition(const basegfx::B2DPoint& rNewPosition);
      81                 :          0 :     sal_Bool IsUnmarking() const { return mbUnmarking; }
      82                 :            : };
      83                 :            : 
      84                 :          0 : ImplMarkingOverlay::ImplMarkingOverlay(const SdrPaintView& rView, const basegfx::B2DPoint& rStartPos, sal_Bool bUnmarking)
      85                 :            : :   maSecondPosition(rStartPos),
      86                 :          0 :     mbUnmarking(bUnmarking)
      87                 :            : {
      88         [ #  # ]:          0 :     for(sal_uInt32 a(0L); a < rView.PaintWindowCount(); a++)
      89                 :            :     {
      90         [ #  # ]:          0 :         SdrPaintWindow* pCandidate = rView.GetPaintWindow(a);
      91         [ #  # ]:          0 :         rtl::Reference< ::sdr::overlay::OverlayManager > xTargetOverlay = pCandidate->GetOverlayManager();
      92                 :            : 
      93         [ #  # ]:          0 :         if (xTargetOverlay.is())
      94                 :            :         {
      95                 :            :             ::sdr::overlay::OverlayRollingRectangleStriped* pNew = new ::sdr::overlay::OverlayRollingRectangleStriped(
      96 [ #  # ][ #  # ]:          0 :                 rStartPos, rStartPos, false);
      97         [ #  # ]:          0 :             xTargetOverlay->add(*pNew);
      98         [ #  # ]:          0 :             maObjects.append(*pNew);
      99                 :            :         }
     100         [ #  # ]:          0 :     }
     101                 :          0 : }
     102                 :            : 
     103                 :          0 : ImplMarkingOverlay::~ImplMarkingOverlay()
     104                 :            : {
     105                 :            :     // The OverlayObjects are cleared using the destructor of OverlayObjectList.
     106                 :            :     // That destructor calls clear() at the list which removes all objects from the
     107                 :            :     // OverlayManager and deletes them.
     108                 :          0 : }
     109                 :            : 
     110                 :          0 : void ImplMarkingOverlay::SetSecondPosition(const basegfx::B2DPoint& rNewPosition)
     111                 :            : {
     112         [ #  # ]:          0 :     if(rNewPosition != maSecondPosition)
     113                 :            :     {
     114                 :            :         // apply to OverlayObjects
     115         [ #  # ]:          0 :         for(sal_uInt32 a(0L); a < maObjects.count(); a++)
     116                 :            :         {
     117                 :          0 :             ::sdr::overlay::OverlayRollingRectangleStriped& rCandidate = (::sdr::overlay::OverlayRollingRectangleStriped&)maObjects.getOverlayObject(a);
     118                 :          0 :             rCandidate.setSecondPosition(rNewPosition);
     119                 :            :         }
     120                 :            : 
     121                 :            :         // remember new position
     122                 :          0 :         maSecondPosition = rNewPosition;
     123                 :            :     }
     124                 :          0 : }
     125                 :            : 
     126                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     127                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     128                 :            : // MarkView
     129                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     130                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     131                 :            : 
     132                 :       4699 : void SdrMarkView::ImpClearVars()
     133                 :            : {
     134                 :       4699 :     eDragMode=SDRDRAG_MOVE;
     135                 :       4699 :     bRefHdlShownOnly=sal_False;
     136                 :       4699 :     eEditMode=SDREDITMODE_EDIT;
     137                 :       4699 :     eEditMode0=SDREDITMODE_EDIT;
     138                 :       4699 :     bDesignMode=sal_False;
     139                 :       4699 :     pMarkedObj=NULL;
     140                 :       4699 :     pMarkedPV=NULL;
     141                 :       4699 :     bForceFrameHandles=sal_False;
     142                 :       4699 :     bPlusHdlAlways=sal_False;
     143                 :       4699 :     nFrameHandlesLimit=50;
     144                 :       4699 :     bInsPolyPoint=sal_False;
     145                 :       4699 :     mnInsPointNum = 0L;
     146                 :       4699 :     bMarkedObjRectDirty=sal_False;
     147                 :       4699 :     bMarkedPointsRectsDirty=sal_False;
     148                 :       4699 :     mbMarkHandlesHidden = false;
     149                 :       4699 :     bMrkPntDirty=sal_False;
     150                 :       4699 :     bMarkHdlWhenTextEdit=sal_False;
     151                 :       4699 :     bMarkableObjCountDirty=sal_False; // not yet implemented
     152                 :       4699 :     nMarkableObjCount=0;          // not yet implemented
     153                 :            : 
     154                 :            :     // Migrate selections
     155                 :       4699 :     BrkMarkObj();
     156                 :       4699 :     BrkMarkPoints();
     157                 :       4699 :     BrkMarkGluePoints();
     158                 :       4699 : }
     159                 :            : 
     160                 :       4699 : SdrMarkView::SdrMarkView(SdrModel* pModel1, OutputDevice* pOut)
     161                 :            : :   SdrSnapView(pModel1,pOut),
     162                 :            :     mpMarkObjOverlay(0L),
     163                 :            :     mpMarkPointsOverlay(0L),
     164                 :            :     mpMarkGluePointsOverlay(0L),
     165                 :            :     aHdl(this),
     166 [ +  - ][ +  - ]:       4699 :     mpSdrViewSelection(new sdr::ViewSelection())
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     167                 :            : {
     168         [ +  - ]:       4699 :     ImpClearVars();
     169         [ +  - ]:       4699 :     StartListening(*pModel1);
     170                 :       4699 : }
     171                 :            : 
     172         [ +  - ]:       4508 : SdrMarkView::~SdrMarkView()
     173                 :            : {
     174                 :            :     // Migrate selections
     175         [ +  - ]:       4508 :     BrkMarkObj();
     176         [ +  - ]:       4508 :     BrkMarkPoints();
     177         [ +  - ]:       4508 :     BrkMarkGluePoints();
     178 [ +  - ][ +  - ]:       4508 :     delete mpSdrViewSelection;
     179         [ -  + ]:       4508 : }
     180                 :            : 
     181                 :     304910 : void SdrMarkView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
     182                 :            : {
     183 [ +  - ][ +  + ]:     304910 :     SdrHint* pSdrHint=PTR_CAST(SdrHint,&rHint);
     184         [ +  + ]:     304910 :     if (pSdrHint!=NULL)
     185                 :            :     {
     186                 :     140889 :         SdrHintKind eKind=pSdrHint->GetKind();
     187                 :            : 
     188 [ +  + ][ +  + ]:     140889 :         if (eKind==HINT_OBJCHG || eKind==HINT_OBJINSERTED || eKind==HINT_OBJREMOVED)
                 [ +  + ]
     189                 :            :         {
     190                 :     133031 :             bMarkedObjRectDirty=sal_True;
     191                 :     133031 :             bMarkedPointsRectsDirty=sal_True;
     192                 :            :         }
     193                 :            :     }
     194                 :     304910 :     SdrSnapView::Notify(rBC,rHint);
     195                 :     304910 : }
     196                 :            : 
     197                 :       4384 : void SdrMarkView::ModelHasChanged()
     198                 :            : {
     199                 :       4384 :     SdrPaintView::ModelHasChanged();
     200                 :       4384 :     GetMarkedObjectListWriteAccess().SetNameDirty();
     201                 :       4384 :     bMarkedObjRectDirty=sal_True;
     202                 :       4384 :     bMarkedPointsRectsDirty=sal_True;
     203                 :            :     // Example: Obj is selected and maMarkedObjectList is sorted.
     204                 :            :     // In another View 2, the ObjOrder is changed (e. g. MovToTop())
     205                 :            :     // Then we need to re-sort MarkList.
     206                 :       4384 :     GetMarkedObjectListWriteAccess().SetUnsorted();
     207                 :       4384 :     SortMarkedObjects();
     208                 :       4384 :     bMrkPntDirty=sal_True;
     209                 :       4384 :     UndirtyMrkPnt();
     210                 :       4384 :     SdrView* pV=(SdrView*)this;
     211 [ +  - ][ +  - ]:       4384 :     if (pV!=NULL && !pV->IsDragObj() && !pV->IsInsObjPoint()) {
         [ +  - ][ +  - ]
     212                 :       4384 :         AdjustMarkHdl();
     213                 :            :     }
     214                 :       4384 : }
     215                 :            : 
     216                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     217                 :            : 
     218                 :       2168 : sal_Bool SdrMarkView::IsAction() const
     219                 :            : {
     220 [ +  - ][ +  - ]:       2168 :     return SdrSnapView::IsAction() || IsMarkObj() || IsMarkPoints() || IsMarkGluePoints();
         [ +  - ][ -  + ]
     221                 :            : }
     222                 :            : 
     223                 :          0 : void SdrMarkView::MovAction(const Point& rPnt)
     224                 :            : {
     225                 :          0 :     SdrSnapView::MovAction(rPnt);
     226                 :            : 
     227         [ #  # ]:          0 :     if(IsMarkObj())
     228                 :            :     {
     229                 :          0 :         MovMarkObj(rPnt);
     230                 :            :     }
     231         [ #  # ]:          0 :     else if(IsMarkPoints())
     232                 :            :     {
     233                 :          0 :         MovMarkPoints(rPnt);
     234                 :            :     }
     235         [ #  # ]:          0 :     else if(IsMarkGluePoints())
     236                 :            :     {
     237                 :          0 :         MovMarkGluePoints(rPnt);
     238                 :            :     }
     239                 :          0 : }
     240                 :            : 
     241                 :          0 : void SdrMarkView::EndAction()
     242                 :            : {
     243         [ #  # ]:          0 :     if(IsMarkObj())
     244                 :            :     {
     245                 :          0 :         EndMarkObj();
     246                 :            :     }
     247         [ #  # ]:          0 :     else if(IsMarkPoints())
     248                 :            :     {
     249                 :          0 :         EndMarkPoints();
     250                 :            :     }
     251         [ #  # ]:          0 :     else if(IsMarkGluePoints())
     252                 :            :     {
     253                 :          0 :         EndMarkGluePoints();
     254                 :            :     }
     255                 :            : 
     256                 :          0 :     SdrSnapView::EndAction();
     257                 :          0 : }
     258                 :            : 
     259                 :          0 : void SdrMarkView::BckAction()
     260                 :            : {
     261                 :          0 :     SdrSnapView::BckAction();
     262                 :          0 :     BrkMarkObj();
     263                 :          0 :     BrkMarkPoints();
     264                 :          0 :     BrkMarkGluePoints();
     265                 :          0 : }
     266                 :            : 
     267                 :       4877 : void SdrMarkView::BrkAction()
     268                 :            : {
     269                 :       4877 :     SdrSnapView::BrkAction();
     270                 :       4877 :     BrkMarkObj();
     271                 :       4877 :     BrkMarkPoints();
     272                 :       4877 :     BrkMarkGluePoints();
     273                 :       4877 : }
     274                 :            : 
     275                 :          0 : void SdrMarkView::TakeActionRect(Rectangle& rRect) const
     276                 :            : {
     277 [ #  # ][ #  # ]:          0 :     if(IsMarkObj() || IsMarkPoints() || IsMarkGluePoints())
         [ #  # ][ #  # ]
     278                 :            :     {
     279                 :          0 :         rRect = Rectangle(aDragStat.GetStart(), aDragStat.GetNow());
     280                 :            :     }
     281                 :            :     else
     282                 :            :     {
     283                 :          0 :         SdrSnapView::TakeActionRect(rRect);
     284                 :            :     }
     285                 :          0 : }
     286                 :            : 
     287                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     288                 :            : 
     289                 :          0 : void SdrMarkView::ClearPageView()
     290                 :            : {
     291                 :          0 :     UnmarkAllObj();
     292                 :          0 :     SdrSnapView::ClearPageView();
     293                 :          0 : }
     294                 :            : 
     295                 :       3232 : void SdrMarkView::HideSdrPage()
     296                 :            : {
     297                 :       3232 :     bool bMrkChg(false);
     298                 :            : 
     299                 :       3232 :     SdrPageView* pPageView = GetSdrPageView();
     300         [ +  + ]:       3232 :     if (pPageView)
     301                 :            :     {
     302                 :            :         // break all creation actions when hiding page (#75081#)
     303                 :       2954 :         BrkAction();
     304                 :            : 
     305                 :            :         // Discard all selections on this page
     306                 :       2954 :         bMrkChg = GetMarkedObjectListWriteAccess().DeletePageView(*pPageView);
     307                 :            :     }
     308                 :            : 
     309                 :       3232 :     SdrSnapView::HideSdrPage();
     310                 :            : 
     311         [ +  + ]:       3232 :     if(bMrkChg)
     312                 :            :     {
     313                 :         42 :         MarkListHasChanged();
     314                 :         42 :         AdjustMarkHdl();
     315                 :            :     }
     316                 :       3232 : }
     317                 :            : 
     318                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     319                 :            : 
     320                 :          0 : sal_Bool SdrMarkView::BegMarkObj(const Point& rPnt, sal_Bool bUnmark)
     321                 :            : {
     322         [ #  # ]:          0 :     BrkAction();
     323                 :            : 
     324                 :            :     DBG_ASSERT(0L == mpMarkObjOverlay, "SdrMarkView::BegMarkObj: There exists a mpMarkObjOverlay (!)");
     325                 :          0 :     basegfx::B2DPoint aStartPos(rPnt.X(), rPnt.Y());
     326 [ #  # ][ #  # ]:          0 :     mpMarkObjOverlay = new ImplMarkingOverlay(*this, aStartPos, bUnmark);
     327                 :            : 
     328         [ #  # ]:          0 :     aDragStat.Reset(rPnt);
     329         [ #  # ]:          0 :     aDragStat.NextPoint();
     330                 :          0 :     aDragStat.SetMinMove(nMinMovLog);
     331                 :            : 
     332                 :          0 :     return sal_True;
     333                 :            : }
     334                 :            : 
     335                 :          0 : void SdrMarkView::MovMarkObj(const Point& rPnt)
     336                 :            : {
     337 [ #  # ][ #  # ]:          0 :     if(IsMarkObj() && aDragStat.CheckMinMoved(rPnt))
                 [ #  # ]
     338                 :            :     {
     339         [ #  # ]:          0 :         aDragStat.NextMove(rPnt);
     340                 :            :         DBG_ASSERT(mpMarkObjOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
     341                 :          0 :         basegfx::B2DPoint aNewPos(rPnt.X(), rPnt.Y());
     342         [ #  # ]:          0 :         mpMarkObjOverlay->SetSecondPosition(aNewPos);
     343                 :            :     }
     344                 :          0 : }
     345                 :            : 
     346                 :          0 : sal_Bool SdrMarkView::EndMarkObj()
     347                 :            : {
     348                 :          0 :     sal_Bool bRetval(sal_False);
     349                 :            : 
     350         [ #  # ]:          0 :     if(IsMarkObj())
     351                 :            :     {
     352         [ #  # ]:          0 :         if(aDragStat.IsMinMoved())
     353                 :            :         {
     354 [ #  # ][ #  # ]:          0 :             Rectangle aRect(aDragStat.GetStart(), aDragStat.GetNow());
                 [ #  # ]
     355         [ #  # ]:          0 :             aRect.Justify();
     356         [ #  # ]:          0 :             MarkObj(aRect, mpMarkObjOverlay->IsUnmarking());
     357                 :          0 :             bRetval = sal_True;
     358                 :            :         }
     359                 :            : 
     360                 :            :         // cleanup
     361                 :          0 :         BrkMarkObj();
     362                 :            :     }
     363                 :            : 
     364                 :          0 :     return bRetval;
     365                 :            : }
     366                 :            : 
     367                 :      14084 : void SdrMarkView::BrkMarkObj()
     368                 :            : {
     369         [ -  + ]:      14084 :     if(IsMarkObj())
     370                 :            :     {
     371                 :            :         DBG_ASSERT(mpMarkObjOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
     372         [ #  # ]:          0 :         delete mpMarkObjOverlay;
     373                 :          0 :         mpMarkObjOverlay = 0L;
     374                 :            :     }
     375                 :      14084 : }
     376                 :            : 
     377                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     378                 :            : 
     379                 :          0 : sal_Bool SdrMarkView::BegMarkPoints(const Point& rPnt, sal_Bool bUnmark)
     380                 :            : {
     381         [ #  # ]:          0 :     if(HasMarkablePoints())
     382                 :            :     {
     383         [ #  # ]:          0 :         BrkAction();
     384                 :            : 
     385                 :            :         DBG_ASSERT(0L == mpMarkPointsOverlay, "SdrMarkView::BegMarkObj: There exists a mpMarkPointsOverlay (!)");
     386                 :          0 :         basegfx::B2DPoint aStartPos(rPnt.X(), rPnt.Y());
     387 [ #  # ][ #  # ]:          0 :         mpMarkPointsOverlay = new ImplMarkingOverlay(*this, aStartPos, bUnmark);
     388                 :            : 
     389         [ #  # ]:          0 :         aDragStat.Reset(rPnt);
     390         [ #  # ]:          0 :         aDragStat.NextPoint();
     391                 :          0 :         aDragStat.SetMinMove(nMinMovLog);
     392                 :            : 
     393                 :          0 :         return sal_True;
     394                 :            :     }
     395                 :            : 
     396                 :          0 :     return sal_False;
     397                 :            : }
     398                 :            : 
     399                 :          0 : void SdrMarkView::MovMarkPoints(const Point& rPnt)
     400                 :            : {
     401 [ #  # ][ #  # ]:          0 :     if(IsMarkPoints() && aDragStat.CheckMinMoved(rPnt))
                 [ #  # ]
     402                 :            :     {
     403         [ #  # ]:          0 :         aDragStat.NextMove(rPnt);
     404                 :            : 
     405                 :            :         DBG_ASSERT(mpMarkPointsOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
     406                 :          0 :         basegfx::B2DPoint aNewPos(rPnt.X(), rPnt.Y());
     407         [ #  # ]:          0 :         mpMarkPointsOverlay->SetSecondPosition(aNewPos);
     408                 :            :     }
     409                 :          0 : }
     410                 :            : 
     411                 :          0 : sal_Bool SdrMarkView::EndMarkPoints()
     412                 :            : {
     413                 :          0 :     sal_Bool bRetval(sal_False);
     414                 :            : 
     415         [ #  # ]:          0 :     if(IsMarkPoints())
     416                 :            :     {
     417         [ #  # ]:          0 :         if(aDragStat.IsMinMoved())
     418                 :            :         {
     419 [ #  # ][ #  # ]:          0 :             Rectangle aRect(aDragStat.GetStart(), aDragStat.GetNow());
                 [ #  # ]
     420         [ #  # ]:          0 :             aRect.Justify();
     421         [ #  # ]:          0 :             MarkPoints(aRect, mpMarkPointsOverlay->IsUnmarking());
     422                 :            : 
     423                 :          0 :             bRetval = sal_True;
     424                 :            :         }
     425                 :            : 
     426                 :            :         // cleanup
     427                 :          0 :         BrkMarkPoints();
     428                 :            :     }
     429                 :            : 
     430                 :          0 :     return bRetval;
     431                 :            : }
     432                 :            : 
     433                 :      14084 : void SdrMarkView::BrkMarkPoints()
     434                 :            : {
     435         [ -  + ]:      14084 :     if(IsMarkPoints())
     436                 :            :     {
     437                 :            :         DBG_ASSERT(mpMarkPointsOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
     438         [ #  # ]:          0 :         delete mpMarkPointsOverlay;
     439                 :          0 :         mpMarkPointsOverlay = 0L;
     440                 :            :     }
     441                 :      14084 : }
     442                 :            : 
     443                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     444                 :            : 
     445                 :          0 : sal_Bool SdrMarkView::BegMarkGluePoints(const Point& rPnt, sal_Bool bUnmark)
     446                 :            : {
     447         [ #  # ]:          0 :     if(HasMarkableGluePoints())
     448                 :            :     {
     449         [ #  # ]:          0 :         BrkAction();
     450                 :            : 
     451                 :            :         DBG_ASSERT(0L == mpMarkGluePointsOverlay, "SdrMarkView::BegMarkObj: There exists a mpMarkGluePointsOverlay (!)");
     452                 :          0 :         basegfx::B2DPoint aStartPos(rPnt.X(), rPnt.Y());
     453 [ #  # ][ #  # ]:          0 :         mpMarkGluePointsOverlay = new ImplMarkingOverlay(*this, aStartPos, bUnmark);
     454                 :            : 
     455         [ #  # ]:          0 :         aDragStat.Reset(rPnt);
     456         [ #  # ]:          0 :         aDragStat.NextPoint();
     457                 :          0 :         aDragStat.SetMinMove(nMinMovLog);
     458                 :            : 
     459                 :          0 :         return sal_True;
     460                 :            :     }
     461                 :            : 
     462                 :          0 :     return sal_False;
     463                 :            : }
     464                 :            : 
     465                 :          0 : void SdrMarkView::MovMarkGluePoints(const Point& rPnt)
     466                 :            : {
     467 [ #  # ][ #  # ]:          0 :     if(IsMarkGluePoints() && aDragStat.CheckMinMoved(rPnt))
                 [ #  # ]
     468                 :            :     {
     469         [ #  # ]:          0 :         aDragStat.NextMove(rPnt);
     470                 :            : 
     471                 :            :         DBG_ASSERT(mpMarkGluePointsOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
     472                 :          0 :         basegfx::B2DPoint aNewPos(rPnt.X(), rPnt.Y());
     473         [ #  # ]:          0 :         mpMarkGluePointsOverlay->SetSecondPosition(aNewPos);
     474                 :            :     }
     475                 :          0 : }
     476                 :            : 
     477                 :          0 : sal_Bool SdrMarkView::EndMarkGluePoints()
     478                 :            : {
     479                 :          0 :     sal_Bool bRetval(sal_False);
     480                 :            : 
     481         [ #  # ]:          0 :     if(IsMarkGluePoints())
     482                 :            :     {
     483         [ #  # ]:          0 :         if(aDragStat.IsMinMoved())
     484                 :            :         {
     485 [ #  # ][ #  # ]:          0 :             Rectangle aRect(aDragStat.GetStart(),aDragStat.GetNow());
                 [ #  # ]
     486         [ #  # ]:          0 :             aRect.Justify();
     487         [ #  # ]:          0 :             MarkGluePoints(&aRect, mpMarkGluePointsOverlay->IsUnmarking());
     488                 :            : 
     489                 :          0 :             bRetval = sal_True;
     490                 :            :         }
     491                 :            : 
     492                 :            :         // cleanup
     493                 :          0 :         BrkMarkGluePoints();
     494                 :            :     }
     495                 :            : 
     496                 :          0 :     return bRetval;
     497                 :            : }
     498                 :            : 
     499                 :      14084 : void SdrMarkView::BrkMarkGluePoints()
     500                 :            : {
     501         [ -  + ]:      14084 :     if(IsMarkGluePoints())
     502                 :            :     {
     503                 :            :         DBG_ASSERT(mpMarkGluePointsOverlay, "SdrSnapView::MovSetPageOrg: no ImplPageOriginOverlay (!)");
     504         [ #  # ]:          0 :         delete mpMarkGluePointsOverlay;
     505                 :          0 :         mpMarkGluePointsOverlay = 0L;
     506                 :            :     }
     507                 :      14084 : }
     508                 :            : 
     509                 :       3022 : void SdrMarkView::hideMarkHandles()
     510                 :            : {
     511         [ +  - ]:       3022 :     if(!mbMarkHandlesHidden)
     512                 :            :     {
     513                 :       3022 :         mbMarkHandlesHidden = true;
     514                 :       3022 :         AdjustMarkHdl();
     515                 :            :     }
     516                 :       3022 : }
     517                 :            : 
     518                 :       5052 : void SdrMarkView::showMarkHandles()
     519                 :            : {
     520         [ +  + ]:       5052 :     if(mbMarkHandlesHidden)
     521                 :            :     {
     522                 :       3001 :         mbMarkHandlesHidden = false;
     523                 :       3001 :         AdjustMarkHdl();
     524                 :            :     }
     525                 :       5052 : }
     526                 :            : 
     527                 :      24769 : sal_Bool SdrMarkView::ImpIsFrameHandles() const
     528                 :            : {
     529                 :      24769 :     sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
     530 [ +  + ][ +  - ]:      24769 :     sal_Bool bFrmHdl=nMarkAnz>nFrameHandlesLimit || bForceFrameHandles;
     531                 :      24769 :     sal_Bool bStdDrag=eDragMode==SDRDRAG_MOVE;
     532 [ +  + ][ +  - ]:      24769 :     if (nMarkAnz==1 && bStdDrag && bFrmHdl)
                 [ +  + ]
     533                 :            :     {
     534                 :       1501 :         const SdrObject* pObj=GetMarkedObjectByIndex(0);
     535         [ +  - ]:       1501 :         if (pObj->GetObjInventor()==SdrInventor)
     536                 :            :         {
     537                 :       1501 :             sal_uInt16 nIdent=pObj->GetObjIdentifier();
     538 [ +  - ][ +  - ]:       1501 :             if (nIdent==OBJ_LINE || nIdent==OBJ_EDGE || nIdent==OBJ_CAPTION || nIdent==OBJ_MEASURE || nIdent==OBJ_CUSTOMSHAPE || nIdent==OBJ_TABLE )
         [ +  - ][ +  - ]
         [ -  + ][ +  - ]
     539                 :            :             {
     540                 :          0 :                 bFrmHdl=sal_False;
     541                 :            :             }
     542                 :            :         }
     543                 :            :     }
     544 [ -  + ][ #  # ]:      24769 :     if (!bStdDrag && !bFrmHdl) {
     545                 :            :         // all other drag modes only with FrameHandles
     546                 :          0 :         bFrmHdl=sal_True;
     547         [ #  # ]:          0 :         if (eDragMode==SDRDRAG_ROTATE) {
     548                 :            :             // when rotating, use ObjOwn drag, if there's at least 1 PolyObj
     549 [ #  # ][ #  # ]:          0 :             for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz && bFrmHdl; nMarkNum++) {
                 [ #  # ]
     550                 :          0 :                 const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
     551                 :          0 :                 const SdrObject* pObj=pM->GetMarkedSdrObj();
     552                 :          0 :                 bFrmHdl=!pObj->IsPolyObj();
     553                 :            :             }
     554                 :            :         }
     555                 :            :     }
     556         [ +  + ]:      24769 :     if (!bFrmHdl) {
     557                 :            :         // FrameHandles, if at least 1 Obj can't do SpecialDrag
     558 [ +  + ][ +  - ]:       5784 :         for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz && !bFrmHdl; nMarkNum++) {
                 [ +  + ]
     559                 :        250 :             const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
     560                 :        250 :             const SdrObject* pObj=pM->GetMarkedSdrObj();
     561                 :        250 :             bFrmHdl=!pObj->hasSpecialDrag();
     562                 :            :         }
     563                 :            :     }
     564                 :      24769 :     return bFrmHdl;
     565                 :            : }
     566                 :            : 
     567                 :      20058 : void SdrMarkView::SetMarkHandles()
     568                 :            : {
     569                 :            :     // remember old focus handle values to search for it again
     570                 :      20058 :     const SdrHdl* pSaveOldFocusHdl = aHdl.GetFocusHdl();
     571                 :      20058 :     sal_Bool bSaveOldFocus(sal_False);
     572                 :      20058 :     sal_uInt32 nSavePolyNum(0L), nSavePointNum(0L);
     573                 :      20058 :     SdrHdlKind eSaveKind(HDL_MOVE);
     574                 :      20058 :     SdrObject* pSaveObj = NULL;
     575                 :            : 
     576 [ -  + ][ -  +  :      20058 :     if(pSaveOldFocusHdl
          #  #  #  #  #  
                #  #  # ]
     577                 :          0 :         && pSaveOldFocusHdl->GetObj()
     578                 :          0 :         && pSaveOldFocusHdl->GetObj()->ISA(SdrPathObj)
     579                 :          0 :         && (pSaveOldFocusHdl->GetKind() == HDL_POLY || pSaveOldFocusHdl->GetKind() == HDL_BWGT))
     580                 :            :     {
     581                 :          0 :         bSaveOldFocus = sal_True;
     582                 :          0 :         nSavePolyNum = pSaveOldFocusHdl->GetPolyNum();
     583                 :          0 :         nSavePointNum = pSaveOldFocusHdl->GetPointNum();
     584                 :          0 :         pSaveObj = pSaveOldFocusHdl->GetObj();
     585                 :          0 :         eSaveKind = pSaveOldFocusHdl->GetKind();
     586                 :            :     }
     587                 :            : 
     588                 :            :     // delete/clear all handles. This will always be done, even with areMarkHandlesHidden()
     589                 :      20058 :     aHdl.Clear();
     590                 :      20058 :     aHdl.SetRotateShear(eDragMode==SDRDRAG_ROTATE);
     591                 :      20058 :     aHdl.SetDistortShear(eDragMode==SDRDRAG_SHEAR);
     592                 :      20058 :     pMarkedObj=NULL;
     593                 :      20058 :     pMarkedPV=NULL;
     594                 :            : 
     595                 :            :     // are handles enabled at all? Create only then
     596         [ +  + ]:      20058 :     if(!areMarkHandlesHidden())
     597                 :            :     {
     598                 :      16994 :         sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
     599                 :      16994 :         sal_Bool bStdDrag=eDragMode==SDRDRAG_MOVE;
     600                 :      16994 :         sal_Bool bSingleTextObjMark=sal_False;
     601                 :            : 
     602         [ +  + ]:      16994 :         if (nMarkAnz==1)
     603                 :            :         {
     604                 :        814 :             pMarkedObj=GetMarkedObjectByIndex(0);
     605                 :            :             bSingleTextObjMark =
     606                 :            :                 pMarkedObj &&
     607                 :        814 :                 pMarkedObj->ISA(SdrTextObj) &&
     608         [ -  + ]:       1628 :                 static_cast<SdrTextObj*>(pMarkedObj)->IsTextFrame();
           [ +  -  +  + ]
     609                 :            :         }
     610                 :            : 
     611                 :      16994 :         sal_Bool bFrmHdl=ImpIsFrameHandles();
     612                 :            : 
     613         [ +  + ]:      16994 :         if (nMarkAnz>0)
     614                 :            :         {
     615                 :        873 :             pMarkedPV=GetSdrPageViewOfMarkedByIndex(0);
     616                 :            : 
     617 [ +  + ][ -  + ]:       1853 :             for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz && (pMarkedPV!=NULL || !bFrmHdl); nMarkNum++)
         [ #  # ][ +  + ]
     618                 :            :             {
     619                 :        980 :                 const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
     620                 :            : 
     621         [ -  + ]:        980 :                 if (pMarkedPV!=pM->GetPageView())
     622                 :            :                 {
     623                 :          0 :                     pMarkedPV=NULL;
     624                 :            :                 }
     625                 :            :             }
     626                 :            :         }
     627                 :            : 
     628         [ +  + ]:      16994 :         if (bFrmHdl)
     629                 :            :         {
     630         [ +  - ]:      13604 :             Rectangle aRect(GetMarkedObjRect());
     631                 :            : 
     632                 :            :             // #i33755#
     633                 :            :             const sal_Bool bHideHandlesWhenInTextEdit(
     634         [ +  - ]:      13604 :                 ((SdrView*)this)->IsTextEdit()
     635                 :            :                 && pMarkedObj
     636 [ #  # ][ #  # ]:          0 :                 && pMarkedObj->ISA(SdrTextObj)
     637 [ -  + ][ #  # ]:      13604 :                 && ((SdrTextObj*)pMarkedObj)->IsInEditMode());
         [ #  # ][ #  # ]
     638                 :            : 
     639 [ +  - ][ +  + ]:      13604 :             if(!aRect.IsEmpty() && !bHideHandlesWhenInTextEdit)
         [ +  - ][ +  + ]
     640                 :            :             { // otherwise nothing is found
     641         [ -  + ]:        775 :                 if( bSingleTextObjMark )
     642                 :            :                 {
     643                 :          0 :                     const sal_uIntPtr nSiz0=aHdl.GetHdlCount();
     644         [ #  # ]:          0 :                     pMarkedObj->AddToHdlList(aHdl);
     645                 :          0 :                     const sal_uIntPtr nSiz1=aHdl.GetHdlCount();
     646         [ #  # ]:          0 :                     for (sal_uIntPtr i=nSiz0; i<nSiz1; i++)
     647                 :            :                     {
     648         [ #  # ]:          0 :                         SdrHdl* pHdl=aHdl.GetHdl(i);
     649         [ #  # ]:          0 :                         pHdl->SetObj(pMarkedObj);
     650                 :          0 :                         pHdl->SetPageView(pMarkedPV);
     651                 :          0 :                         pHdl->SetObjHdlNum(sal_uInt16(i-nSiz0));
     652                 :            :                     }
     653                 :            :                 }
     654         [ -  + ]:        775 :                 else if( eDragMode==SDRDRAG_CROP )
     655                 :            :                 {
     656 [ #  # ][ #  # ]:          0 :                     aHdl.AddHdl(new SdrCropHdl(aRect.TopLeft()     ,HDL_UPLFT));
                 [ #  # ]
     657 [ #  # ][ #  # ]:          0 :                     aHdl.AddHdl(new SdrCropHdl(aRect.TopCenter()   ,HDL_UPPER));
         [ #  # ][ #  # ]
     658 [ #  # ][ #  # ]:          0 :                     aHdl.AddHdl(new SdrCropHdl(aRect.TopRight()    ,HDL_UPRGT));
         [ #  # ][ #  # ]
     659 [ #  # ][ #  # ]:          0 :                     aHdl.AddHdl(new SdrCropHdl(aRect.LeftCenter()  ,HDL_LEFT ));
         [ #  # ][ #  # ]
     660 [ #  # ][ #  # ]:          0 :                     aHdl.AddHdl(new SdrCropHdl(aRect.RightCenter() ,HDL_RIGHT));
         [ #  # ][ #  # ]
     661 [ #  # ][ #  # ]:          0 :                     aHdl.AddHdl(new SdrCropHdl(aRect.BottomLeft()  ,HDL_LWLFT));
         [ #  # ][ #  # ]
     662 [ #  # ][ #  # ]:          0 :                     aHdl.AddHdl(new SdrCropHdl(aRect.BottomCenter(),HDL_LOWER));
         [ #  # ][ #  # ]
     663 [ #  # ][ #  # ]:          0 :                     aHdl.AddHdl(new SdrCropHdl(aRect.BottomRight() ,HDL_LWRGT));
         [ #  # ][ #  # ]
     664                 :            :                 }
     665                 :            :                 else
     666                 :            :                 {
     667                 :        775 :                     sal_Bool bWdt0=aRect.Left()==aRect.Right();
     668                 :        775 :                     sal_Bool bHgt0=aRect.Top()==aRect.Bottom();
     669 [ #  # ][ -  + ]:        775 :                     if (bWdt0 && bHgt0)
     670                 :            :                     {
     671 [ #  # ][ #  # ]:          0 :                         aHdl.AddHdl(new SdrHdl(aRect.TopLeft(),HDL_UPLFT));
                 [ #  # ]
     672                 :            :                     }
     673 [ -  + ][ #  # ]:        775 :                     else if (!bStdDrag && (bWdt0 || bHgt0))
                 [ #  # ]
     674                 :            :                     {
     675 [ #  # ][ #  # ]:          0 :                         aHdl.AddHdl(new SdrHdl(aRect.TopLeft()    ,HDL_UPLFT));
                 [ #  # ]
     676 [ #  # ][ #  # ]:          0 :                         aHdl.AddHdl(new SdrHdl(aRect.BottomRight(),HDL_LWRGT));
         [ #  # ][ #  # ]
     677                 :            :                     }
     678                 :            :                     else
     679                 :            :                     {
     680 [ +  - ][ +  - ]:        775 :                         if (!bWdt0 && !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.TopLeft()     ,HDL_UPLFT));
         [ +  - ][ +  - ]
                 [ +  - ]
     681 [ +  - ][ +  - ]:        775 :                         if (          !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.TopCenter()   ,HDL_UPPER));
         [ +  - ][ +  - ]
                 [ +  - ]
     682 [ +  - ][ +  - ]:        775 :                         if (!bWdt0 && !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.TopRight()    ,HDL_UPRGT));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     683 [ +  - ][ +  - ]:        775 :                         if (!bWdt0          ) aHdl.AddHdl(new SdrHdl(aRect.LeftCenter()  ,HDL_LEFT ));
         [ +  - ][ +  - ]
                 [ +  - ]
     684 [ +  - ][ +  - ]:        775 :                         if (!bWdt0          ) aHdl.AddHdl(new SdrHdl(aRect.RightCenter() ,HDL_RIGHT));
         [ +  - ][ +  - ]
                 [ +  - ]
     685 [ +  - ][ +  - ]:        775 :                         if (!bWdt0 && !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.BottomLeft()  ,HDL_LWLFT));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     686 [ +  - ][ +  - ]:        775 :                         if (          !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.BottomCenter(),HDL_LOWER));
         [ +  - ][ +  - ]
                 [ +  - ]
     687 [ +  - ][ +  - ]:      13604 :                         if (!bWdt0 && !bHgt0) aHdl.AddHdl(new SdrHdl(aRect.BottomRight() ,HDL_LWRGT));
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
     688                 :            :                     }
     689                 :            :                 }
     690                 :            :             }
     691                 :            :         }
     692                 :            :         else
     693                 :            :         {
     694         [ +  + ]:       3579 :             for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++)
     695                 :            :             {
     696                 :        189 :                 const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
     697                 :        189 :                 SdrObject* pObj=pM->GetMarkedSdrObj();
     698                 :        189 :                 SdrPageView* pPV=pM->GetPageView();
     699                 :        189 :                 const sal_uIntPtr nSiz0=aHdl.GetHdlCount();
     700                 :        189 :                 pObj->AddToHdlList(aHdl);
     701                 :        189 :                 const sal_uIntPtr nSiz1=aHdl.GetHdlCount();
     702                 :        189 :                 bool bPoly=pObj->IsPolyObj();
     703                 :        189 :                 const SdrUShortCont* pMrkPnts=pM->GetMarkedPoints();
     704         [ +  + ]:       1592 :                 for (sal_uIntPtr i=nSiz0; i<nSiz1; i++)
     705                 :            :                 {
     706                 :       1403 :                     SdrHdl* pHdl=aHdl.GetHdl(i);
     707                 :       1403 :                     pHdl->SetObj(pObj);
     708                 :       1403 :                     pHdl->SetPageView(pPV);
     709                 :       1403 :                     pHdl->SetObjHdlNum(sal_uInt16(i-nSiz0));
     710         [ +  + ]:       1403 :                     if (bPoly)
     711                 :            :                     {
     712                 :            :                         sal_Bool bSelected=pMrkPnts!=NULL
     713 [ -  + ][ #  # ]:       1022 :                                   && pMrkPnts->find( sal_uInt16(i-nSiz0) ) != pMrkPnts->end();
         [ #  # ][ #  # ]
         [ -  + ][ -  + ]
         [ -  + ][ #  #  
             #  #  #  # ]
     714                 :       1022 :                         pHdl->SetSelected(bSelected);
     715 [ -  + ][ +  - ]:       1022 :                         if (bPlusHdlAlways || bSelected)
     716                 :            :                         {
     717                 :          0 :                             sal_uInt32 nPlusAnz=pObj->GetPlusHdlCount(*pHdl);
     718         [ #  # ]:          0 :                             for (sal_uInt32 nPlusNum=0; nPlusNum<nPlusAnz; nPlusNum++)
     719                 :            :                             {
     720                 :          0 :                                 SdrHdl* pPlusHdl=pObj->GetPlusHdl(*pHdl,nPlusNum);
     721         [ #  # ]:          0 :                                 if (pPlusHdl!=NULL)
     722                 :            :                                 {
     723                 :          0 :                                     pPlusHdl->SetObj(pObj);
     724                 :          0 :                                     pPlusHdl->SetPageView(pPV);
     725                 :          0 :                                     pPlusHdl->SetPlusHdl(sal_True);
     726                 :          0 :                                     aHdl.AddHdl(pPlusHdl);
     727                 :            :                                 }
     728                 :            :                             }
     729                 :            :                         }
     730                 :            :                     }
     731                 :            :                 }
     732                 :            :             } // for nMarkNum
     733                 :            :         } // if bFrmHdl else
     734                 :            : 
     735                 :            :         // GluePoint handles
     736         [ +  + ]:      17974 :         for (sal_uIntPtr nMarkNum=0; nMarkNum<nMarkAnz; nMarkNum++)
     737                 :            :         {
     738                 :        980 :             const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
     739                 :        980 :             SdrObject* pObj=pM->GetMarkedSdrObj();
     740                 :        980 :             SdrPageView* pPV=pM->GetPageView();
     741                 :        980 :             const SdrUShortCont* pMrkGlue=pM->GetMarkedGluePoints();
     742         [ -  + ]:        980 :             if (pMrkGlue!=NULL)
     743                 :            :             {
     744                 :          0 :                 const SdrGluePointList* pGPL=pObj->GetGluePointList();
     745         [ #  # ]:          0 :                 if (pGPL!=NULL)
     746                 :            :                 {
     747 [ #  # ][ #  # ]:          0 :                     for(SdrUShortCont::const_iterator it = pMrkGlue->begin(); it != pMrkGlue->end(); ++it)
                 [ #  # ]
     748                 :            :                     {
     749         [ #  # ]:          0 :                         sal_uInt16 nId=*it;
     750                 :            :                         //nNum changed to nNumGP because already used in for loop
     751         [ #  # ]:          0 :                         sal_uInt16 nNumGP=pGPL->FindGluePoint(nId);
     752         [ #  # ]:          0 :                         if (nNumGP!=SDRGLUEPOINT_NOTFOUND)
     753                 :            :                         {
     754         [ #  # ]:          0 :                             const SdrGluePoint& rGP=(*pGPL)[nNumGP];
     755         [ #  # ]:          0 :                             Point aPos(rGP.GetAbsolutePos(*pObj));
     756 [ #  # ][ #  # ]:          0 :                             SdrHdl* pGlueHdl=new SdrHdl(aPos,HDL_GLUE);
     757         [ #  # ]:          0 :                             pGlueHdl->SetObj(pObj);
     758                 :          0 :                             pGlueHdl->SetPageView(pPV);
     759                 :          0 :                             pGlueHdl->SetObjHdlNum(nId);
     760         [ #  # ]:          0 :                             aHdl.AddHdl(pGlueHdl);
     761                 :            :                         }
     762                 :            :                     }
     763                 :            :                 }
     764                 :            :             }
     765                 :            :         }
     766                 :            : 
     767                 :            :         // rotation point/axis of reflection
     768                 :      16994 :         AddDragModeHdl(eDragMode);
     769                 :            : 
     770                 :            :         // sort handles
     771                 :      16994 :         aHdl.Sort();
     772                 :            : 
     773                 :            :         // add custom handles (used by other apps, e.g. AnchorPos)
     774                 :      16994 :         AddCustomHdl();
     775                 :            : 
     776                 :            :         // try to restore focus handle index from remembered values
     777         [ -  + ]:      16994 :         if(bSaveOldFocus)
     778                 :            :         {
     779         [ #  # ]:          0 :             for(sal_uInt32 a(0); a < aHdl.GetHdlCount(); a++)
     780                 :            :             {
     781                 :          0 :                 SdrHdl* pCandidate = aHdl.GetHdl(a);
     782                 :            : 
     783 [ #  # ][ #  #  :          0 :                 if(pCandidate->GetObj()
          #  #  #  #  #  
                #  #  # ]
     784                 :          0 :                     && pCandidate->GetObj() == pSaveObj
     785                 :          0 :                     && pCandidate->GetKind() == eSaveKind
     786                 :          0 :                     && pCandidate->GetPolyNum() == nSavePolyNum
     787                 :          0 :                     && pCandidate->GetPointNum() == nSavePointNum)
     788                 :            :                 {
     789                 :          0 :                     aHdl.SetFocusHdl(pCandidate);
     790                 :          0 :                     break;
     791                 :            :                 }
     792                 :            :             }
     793                 :            :         }
     794                 :            :     }
     795                 :      20058 : }
     796                 :            : 
     797                 :       4938 : void SdrMarkView::AddCustomHdl()
     798                 :            : {
     799                 :            :     // add custom handles (used by other apps, e.g. AnchorPos)
     800                 :       4938 : }
     801                 :            : 
     802                 :       1356 : void SdrMarkView::SetDragMode(SdrDragMode eMode)
     803                 :            : {
     804                 :       1356 :     SdrDragMode eMode0=eDragMode;
     805                 :       1356 :     eDragMode=eMode;
     806         [ -  + ]:       1356 :     if (eDragMode==SDRDRAG_RESIZE) eDragMode=SDRDRAG_MOVE;
     807         [ -  + ]:       1356 :     if (eDragMode!=eMode0) {
     808                 :          0 :         ForceRefToMarked();
     809                 :          0 :         SetMarkHandles();
     810                 :            :         {
     811         [ #  # ]:          0 :             if (AreObjectsMarked()) MarkListHasChanged();
     812                 :            :         }
     813                 :            :     }
     814                 :       1356 : }
     815                 :            : 
     816                 :      16994 : void SdrMarkView::AddDragModeHdl(SdrDragMode eMode)
     817                 :            : {
     818   [ -  -  -  -  :      16994 :     switch(eMode)
                   -  + ]
     819                 :            :     {
     820                 :            :         case SDRDRAG_ROTATE:
     821                 :            :         {
     822                 :            :             // add rotation center
     823         [ #  # ]:          0 :             SdrHdl* pHdl = new SdrHdl(aRef1, HDL_REF1);
     824                 :            : 
     825                 :          0 :             aHdl.AddHdl(pHdl);
     826                 :            : 
     827                 :          0 :             break;
     828                 :            :         }
     829                 :            :         case SDRDRAG_MIRROR:
     830                 :            :         {
     831                 :            :             // add axis of reflection
     832         [ #  # ]:          0 :             SdrHdl* pHdl3 = new SdrHdl(aRef2, HDL_REF2);
     833         [ #  # ]:          0 :             SdrHdl* pHdl2 = new SdrHdl(aRef1, HDL_REF1);
     834         [ #  # ]:          0 :             SdrHdl* pHdl1 = new SdrHdlLine(*pHdl2, *pHdl3, HDL_MIRX);
     835                 :            : 
     836                 :          0 :             pHdl1->SetObjHdlNum(1); // for sorting
     837                 :          0 :             pHdl2->SetObjHdlNum(2); // for sorting
     838                 :          0 :             pHdl3->SetObjHdlNum(3); // for sorting
     839                 :            : 
     840                 :          0 :             aHdl.AddHdl(pHdl1); // line comes first, so it is the last in HitTest
     841                 :          0 :             aHdl.AddHdl(pHdl2);
     842                 :          0 :             aHdl.AddHdl(pHdl3);
     843                 :            : 
     844                 :          0 :             break;
     845                 :            :         }
     846                 :            :         case SDRDRAG_TRANSPARENCE:
     847                 :            :         {
     848                 :            :             // add interactive transparency handle
     849                 :          0 :             sal_uIntPtr nMarkAnz = GetMarkedObjectCount();
     850         [ #  # ]:          0 :             if(nMarkAnz == 1)
     851                 :            :             {
     852         [ #  # ]:          0 :                 SdrObject* pObj = GetMarkedObjectByIndex(0);
     853                 :          0 :                 SdrModel* pModel = GetModel();
     854         [ #  # ]:          0 :                 const SfxItemSet& rSet = pObj->GetMergedItemSet();
     855                 :            : 
     856 [ #  # ][ #  # ]:          0 :                 if(SFX_ITEM_SET != rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, sal_False))
     857                 :            :                 {
     858                 :            :                     // add this item, it's not yet there
     859                 :            :                     XFillFloatTransparenceItem aNewItem(
     860 [ #  # ][ #  # ]:          0 :                         (const XFillFloatTransparenceItem&)rSet.Get(XATTR_FILLFLOATTRANSPARENCE));
     861         [ #  # ]:          0 :                     XGradient aGrad = aNewItem.GetGradientValue();
     862                 :            : 
     863                 :          0 :                     aNewItem.SetEnabled(sal_True);
     864                 :          0 :                     aGrad.SetStartIntens(100);
     865                 :          0 :                     aGrad.SetEndIntens(100);
     866                 :          0 :                     aNewItem.SetGradientValue(aGrad);
     867                 :            : 
     868                 :            :                     // add undo to allow user to take back this step
     869 [ #  # ][ #  # ]:          0 :                     if( pModel->IsUndoEnabled() )
     870                 :            :                     {
     871 [ #  # ][ #  # ]:          0 :                         pModel->BegUndo(SVX_RESSTR(SIP_XA_FILLTRANSPARENCE));
         [ #  # ][ #  # ]
                 [ #  # ]
     872 [ #  # ][ #  # ]:          0 :                         pModel->AddUndo(pModel->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
                 [ #  # ]
     873         [ #  # ]:          0 :                         pModel->EndUndo();
     874                 :            :                     }
     875                 :            : 
     876         [ #  # ]:          0 :                     SfxItemSet aNewSet(pModel->GetItemPool());
     877         [ #  # ]:          0 :                     aNewSet.Put(aNewItem);
     878 [ #  # ][ #  # ]:          0 :                     pObj->SetMergedItemSetAndBroadcast(aNewSet);
                 [ #  # ]
     879                 :            :                 }
     880                 :            : 
     881                 :            :                 // set values and transform to vector set
     882                 :          0 :                 GradTransformer aGradTransformer;
     883                 :          0 :                 GradTransVector aGradTransVector;
     884         [ #  # ]:          0 :                 GradTransGradient aGradTransGradient;
     885                 :            : 
     886 [ #  # ][ #  # ]:          0 :                 aGradTransGradient.aGradient = ((XFillFloatTransparenceItem&)rSet.Get(XATTR_FILLFLOATTRANSPARENCE)).GetGradientValue();
     887         [ #  # ]:          0 :                 aGradTransformer.GradToVec(aGradTransGradient, aGradTransVector, pObj);
     888                 :            : 
     889                 :            :                 // build handles
     890                 :          0 :                 const Point aTmpPos1(basegfx::fround(aGradTransVector.maPositionA.getX()), basegfx::fround(aGradTransVector.maPositionA.getY()));
     891                 :          0 :                 const Point aTmpPos2(basegfx::fround(aGradTransVector.maPositionB.getX()), basegfx::fround(aGradTransVector.maPositionB.getY()));
     892 [ #  # ][ #  # ]:          0 :                 SdrHdlColor* pColHdl1 = new SdrHdlColor(aTmpPos1, aGradTransVector.aCol1, SDR_HANDLE_COLOR_SIZE_NORMAL, sal_True);
     893 [ #  # ][ #  # ]:          0 :                 SdrHdlColor* pColHdl2 = new SdrHdlColor(aTmpPos2, aGradTransVector.aCol2, SDR_HANDLE_COLOR_SIZE_NORMAL, sal_True);
     894 [ #  # ][ #  # ]:          0 :                 SdrHdlGradient* pGradHdl = new SdrHdlGradient(aTmpPos1, aTmpPos2, sal_False);
     895                 :            :                 DBG_ASSERT(pColHdl1 && pColHdl2 && pGradHdl, "Could not get all necessary handles!");
     896                 :            : 
     897                 :            :                 // link them
     898                 :          0 :                 pGradHdl->SetColorHandles(pColHdl1, pColHdl2);
     899         [ #  # ]:          0 :                 pGradHdl->SetObj(pObj);
     900         [ #  # ]:          0 :                 pColHdl1->SetColorChangeHdl(LINK(pGradHdl, SdrHdlGradient, ColorChangeHdl));
     901         [ #  # ]:          0 :                 pColHdl2->SetColorChangeHdl(LINK(pGradHdl, SdrHdlGradient, ColorChangeHdl));
     902                 :            : 
     903                 :            :                 // insert them
     904         [ #  # ]:          0 :                 aHdl.AddHdl(pColHdl1);
     905         [ #  # ]:          0 :                 aHdl.AddHdl(pColHdl2);
     906         [ #  # ]:          0 :                 aHdl.AddHdl(pGradHdl);
     907                 :            :             }
     908                 :          0 :             break;
     909                 :            :         }
     910                 :            :         case SDRDRAG_GRADIENT:
     911                 :            :         {
     912                 :            :             // add interactive gradient handle
     913                 :          0 :             sal_uIntPtr nMarkAnz = GetMarkedObjectCount();
     914         [ #  # ]:          0 :             if(nMarkAnz == 1)
     915                 :            :             {
     916                 :          0 :                 SdrObject* pObj = GetMarkedObjectByIndex(0);
     917                 :          0 :                 const SfxItemSet& rSet = pObj->GetMergedItemSet();
     918                 :          0 :                 XFillStyle eFillStyle = ((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue();
     919                 :            : 
     920         [ #  # ]:          0 :                 if(eFillStyle == XFILL_GRADIENT)
     921                 :            :                 {
     922                 :            :                     // set values and transform to vector set
     923                 :          0 :                     GradTransformer aGradTransformer;
     924                 :          0 :                     GradTransVector aGradTransVector;
     925         [ #  # ]:          0 :                     GradTransGradient aGradTransGradient;
     926                 :          0 :                     Size aHdlSize(15, 15);
     927                 :            : 
     928 [ #  # ][ #  # ]:          0 :                     aGradTransGradient.aGradient = ((XFillGradientItem&)rSet.Get(XATTR_FILLGRADIENT)).GetGradientValue();
     929         [ #  # ]:          0 :                     aGradTransformer.GradToVec(aGradTransGradient, aGradTransVector, pObj);
     930                 :            : 
     931                 :            :                     // build handles
     932                 :          0 :                     const Point aTmpPos1(basegfx::fround(aGradTransVector.maPositionA.getX()), basegfx::fround(aGradTransVector.maPositionA.getY()));
     933                 :          0 :                     const Point aTmpPos2(basegfx::fround(aGradTransVector.maPositionB.getX()), basegfx::fround(aGradTransVector.maPositionB.getY()));
     934 [ #  # ][ #  # ]:          0 :                     SdrHdlColor* pColHdl1 = new SdrHdlColor(aTmpPos1, aGradTransVector.aCol1, aHdlSize, sal_False);
     935 [ #  # ][ #  # ]:          0 :                     SdrHdlColor* pColHdl2 = new SdrHdlColor(aTmpPos2, aGradTransVector.aCol2, aHdlSize, sal_False);
     936 [ #  # ][ #  # ]:          0 :                     SdrHdlGradient* pGradHdl = new SdrHdlGradient(aTmpPos1, aTmpPos2, sal_True);
     937                 :            :                     DBG_ASSERT(pColHdl1 && pColHdl2 && pGradHdl, "Could not get all necessary handles!");
     938                 :            : 
     939                 :            :                     // link them
     940                 :          0 :                     pGradHdl->SetColorHandles(pColHdl1, pColHdl2);
     941         [ #  # ]:          0 :                     pGradHdl->SetObj(pObj);
     942         [ #  # ]:          0 :                     pColHdl1->SetColorChangeHdl(LINK(pGradHdl, SdrHdlGradient, ColorChangeHdl));
     943         [ #  # ]:          0 :                     pColHdl2->SetColorChangeHdl(LINK(pGradHdl, SdrHdlGradient, ColorChangeHdl));
     944                 :            : 
     945                 :            :                     // insert them
     946         [ #  # ]:          0 :                     aHdl.AddHdl(pColHdl1);
     947         [ #  # ]:          0 :                     aHdl.AddHdl(pColHdl2);
     948         [ #  # ]:          0 :                     aHdl.AddHdl(pGradHdl);
     949                 :            :                 }
     950                 :            :             }
     951                 :          0 :             break;
     952                 :            :         }
     953                 :            :         case SDRDRAG_CROP:
     954                 :            :         {
     955                 :            :             // TODO
     956                 :          0 :             break;
     957                 :            :         }
     958                 :      16994 :         default: break;
     959                 :            :     }
     960                 :      16994 : }
     961                 :            : 
     962                 :            : /** handle mouse over effects for handles */
     963                 :          0 : sal_Bool SdrMarkView::MouseMove(const MouseEvent& rMEvt, Window* pWin)
     964                 :            : {
     965         [ #  # ]:          0 :     if(aHdl.GetHdlCount())
     966                 :            :     {
     967                 :          0 :         SdrHdl* pMouseOverHdl = 0;
     968 [ #  # ][ #  # ]:          0 :         if( !rMEvt.IsLeaveWindow() && pWin )
                 [ #  # ]
     969                 :            :         {
     970         [ #  # ]:          0 :             Point aMDPos( pWin->PixelToLogic( rMEvt.GetPosPixel() ) );
     971         [ #  # ]:          0 :             pMouseOverHdl = PickHandle(aMDPos);
     972                 :            :         }
     973                 :            : 
     974                 :            :         // notify last mouse over handle that he lost the mouse
     975                 :          0 :         const sal_uIntPtr nHdlCount = aHdl.GetHdlCount();
     976                 :            : 
     977         [ #  # ]:          0 :         for(sal_uIntPtr nHdl = 0; nHdl < nHdlCount; nHdl++ )
     978                 :            :         {
     979                 :          0 :             SdrHdl* pCurrentHdl = GetHdl(nHdl);
     980         [ #  # ]:          0 :             if( pCurrentHdl->mbMouseOver )
     981                 :            :             {
     982         [ #  # ]:          0 :                 if( pCurrentHdl != pMouseOverHdl )
     983                 :            :                 {
     984                 :          0 :                     pCurrentHdl->mbMouseOver = false;
     985                 :          0 :                     pCurrentHdl->onMouseLeave();
     986                 :            :                 }
     987                 :          0 :                 break;
     988                 :            :             }
     989                 :            :         }
     990                 :            : 
     991                 :            :         // notify current mouse over handle
     992         [ #  # ]:          0 :         if( pMouseOverHdl )
     993                 :            :         {
     994                 :          0 :             pMouseOverHdl->mbMouseOver = true;
     995                 :          0 :             pMouseOverHdl->onMouseEnter(rMEvt);
     996                 :            :         }
     997                 :            :     }
     998                 :          0 :     return SdrSnapView::MouseMove(rMEvt, pWin);
     999                 :            : }
    1000                 :            : 
    1001                 :          0 : void SdrMarkView::ForceRefToMarked()
    1002                 :            : {
    1003   [ #  #  #  # ]:          0 :     switch(eDragMode)
    1004                 :            :     {
    1005                 :            :         case SDRDRAG_ROTATE:
    1006                 :            :         {
    1007         [ #  # ]:          0 :             Rectangle aR(GetMarkedObjRect());
    1008         [ #  # ]:          0 :             aRef1 = aR.Center();
    1009                 :            : 
    1010                 :            :             break;
    1011                 :            :         }
    1012                 :            : 
    1013                 :            :         case SDRDRAG_MIRROR:
    1014                 :            :         {
    1015                 :            :             // first calculate the length of the axis of reflection
    1016                 :          0 :             long nOutMin=0;
    1017                 :          0 :             long nOutMax=0;
    1018                 :          0 :             long nMinLen=0;
    1019                 :          0 :             long nObjDst=0;
    1020                 :          0 :             long nOutHgt=0;
    1021         [ #  # ]:          0 :             OutputDevice* pOut=GetFirstOutputDevice();
    1022         [ #  # ]:          0 :             if (pOut!=NULL) {
    1023                 :            :                 // minimum length: 50 pixels
    1024         [ #  # ]:          0 :                 nMinLen=pOut->PixelToLogic(Size(0,50)).Height();
    1025                 :            :                 // 20 pixels distance to the Obj for the reference point
    1026         [ #  # ]:          0 :                 nObjDst=pOut->PixelToLogic(Size(0,20)).Height();
    1027                 :            :                 // MinY/MaxY
    1028                 :            :                 // margin = minimum length = 10 pixels
    1029         [ #  # ]:          0 :                 long nDst=pOut->PixelToLogic(Size(0,10)).Height();
    1030                 :          0 :                 nOutMin=-pOut->GetMapMode().GetOrigin().Y();
    1031         [ #  # ]:          0 :                 nOutMax=pOut->GetOutputSize().Height()-1+nOutMin;
    1032                 :          0 :                 nOutMin+=nDst;
    1033                 :          0 :                 nOutMax-=nDst;
    1034                 :            :                 // absolute minimum length, however, is 10 pixels
    1035         [ #  # ]:          0 :                 if (nOutMax-nOutMin<nDst) {
    1036                 :          0 :                     nOutMin+=nOutMax+1;
    1037                 :          0 :                     nOutMin/=2;
    1038                 :          0 :                     nOutMin-=(nDst+1)/2;
    1039                 :          0 :                     nOutMax=nOutMin+nDst;
    1040                 :            :                 }
    1041                 :          0 :                 nOutHgt=nOutMax-nOutMin;
    1042                 :            :                 // otherwise minimum length = 1/4 OutHgt
    1043                 :          0 :                 long nTemp=nOutHgt/4;
    1044         [ #  # ]:          0 :                 if (nTemp>nMinLen) nMinLen=nTemp;
    1045                 :            :             }
    1046                 :            : 
    1047         [ #  # ]:          0 :             Rectangle aR(GetMarkedObjBoundRect());
    1048         [ #  # ]:          0 :             Point aCenter(aR.Center());
    1049         [ #  # ]:          0 :             long nMarkHgt=aR.GetHeight()-1;
    1050                 :          0 :             long nHgt=nMarkHgt+nObjDst*2;       // 20 pixels overlapping above and below
    1051         [ #  # ]:          0 :             if (nHgt<nMinLen) nHgt=nMinLen;     // minimum length 50 pixels or 1/4 OutHgt, respectively
    1052                 :            : 
    1053                 :          0 :             long nY1=aCenter.Y()-(nHgt+1)/2;
    1054                 :          0 :             long nY2=nY1+nHgt;
    1055                 :            : 
    1056 [ #  # ][ #  # ]:          0 :             if (pOut!=NULL && nMinLen>nOutHgt) nMinLen=nOutHgt; // TODO: maybe shorten this a little
    1057                 :            : 
    1058         [ #  # ]:          0 :             if (pOut!=NULL) { // now move completely into the visible area
    1059         [ #  # ]:          0 :                 if (nY1<nOutMin) {
    1060                 :          0 :                     nY1=nOutMin;
    1061         [ #  # ]:          0 :                     if (nY2<nY1+nMinLen) nY2=nY1+nMinLen;
    1062                 :            :                 }
    1063         [ #  # ]:          0 :                 if (nY2>nOutMax) {
    1064                 :          0 :                     nY2=nOutMax;
    1065         [ #  # ]:          0 :                     if (nY1>nY2-nMinLen) nY1=nY2-nMinLen;
    1066                 :            :                 }
    1067                 :            :             }
    1068                 :            : 
    1069                 :          0 :             aRef1.X()=aCenter.X();
    1070                 :          0 :             aRef1.Y()=nY1;
    1071                 :          0 :             aRef2.X()=aCenter.X();
    1072                 :          0 :             aRef2.Y()=nY2;
    1073                 :            : 
    1074                 :            :             break;
    1075                 :            :         }
    1076                 :            : 
    1077                 :            :         case SDRDRAG_TRANSPARENCE:
    1078                 :            :         case SDRDRAG_GRADIENT:
    1079                 :            :         case SDRDRAG_CROP:
    1080                 :            :         {
    1081         [ #  # ]:          0 :             Rectangle aRect(GetMarkedObjBoundRect());
    1082                 :          0 :             aRef1 = aRect.TopLeft();
    1083         [ #  # ]:          0 :             aRef2 = aRect.BottomRight();
    1084                 :            :             break;
    1085                 :            :         }
    1086                 :          0 :         default: break;
    1087                 :            :     }
    1088                 :          0 : }
    1089                 :            : 
    1090                 :          0 : void SdrMarkView::SetRef1(const Point& rPt)
    1091                 :            : {
    1092 [ #  # ][ #  # ]:          0 :     if(eDragMode == SDRDRAG_ROTATE || eDragMode == SDRDRAG_MIRROR)
    1093                 :            :     {
    1094                 :          0 :         aRef1 = rPt;
    1095                 :          0 :         SdrHdl* pH = aHdl.GetHdl(HDL_REF1);
    1096         [ #  # ]:          0 :         if(pH)
    1097                 :          0 :             pH->SetPos(rPt);
    1098                 :            :     }
    1099                 :          0 : }
    1100                 :            : 
    1101                 :          0 : void SdrMarkView::SetRef2(const Point& rPt)
    1102                 :            : {
    1103         [ #  # ]:          0 :     if(eDragMode == SDRDRAG_MIRROR)
    1104                 :            :     {
    1105                 :          0 :         aRef2 = rPt;
    1106                 :          0 :         SdrHdl* pH = aHdl.GetHdl(HDL_REF2);
    1107         [ #  # ]:          0 :         if(pH)
    1108                 :          0 :             pH->SetPos(rPt);
    1109                 :            :     }
    1110                 :          0 : }
    1111                 :            : 
    1112                 :      29327 : void SdrMarkView::CheckMarked()
    1113                 :            : {
    1114         [ +  + ]:      30328 :     for (sal_uIntPtr nm=GetMarkedObjectCount(); nm>0;) {
    1115                 :       1001 :         nm--;
    1116                 :       1001 :         SdrMark* pM=GetSdrMarkByIndex(nm);
    1117                 :       1001 :         SdrObject* pObj=pM->GetMarkedSdrObj();
    1118                 :       1001 :         SdrPageView* pPV=pM->GetPageView();
    1119                 :       1001 :         SdrLayerID nLay=pObj->GetLayer();
    1120                 :       1001 :         sal_Bool bRaus=!pObj->IsInserted(); // Obj deleted?
    1121         [ +  - ]:       1001 :         if (!pObj->Is3DObj()) {
    1122 [ +  - ][ -  + ]:       1001 :             bRaus=bRaus || pObj->GetPage()!=pPV->GetPage();   // Obj suddenly in different Page or Group
    1123                 :            :         }
    1124                 :       1001 :         bRaus=bRaus || pPV->GetLockedLayers().IsSet(nLay) ||  // Layer locked?
    1125   [ +  -  +  - ]:       2002 :                        !pPV->GetVisibleLayers().IsSet(nLay);  // Layer invisible?
                 [ -  + ]
    1126                 :            : 
    1127         [ +  - ]:       1001 :         if( !bRaus )
    1128                 :       1001 :             bRaus = !pObj->IsVisible(); // invisible objects can not be selected
    1129                 :            : 
    1130         [ +  - ]:       1001 :         if (!bRaus) {
    1131                 :            :             // Grouped objects can now be selected.
    1132                 :            :             // After EnterGroup the higher-level objects,
    1133                 :            :             // have to be deselected, though.
    1134                 :       1001 :             const SdrObjList* pOOL=pObj->GetObjList();
    1135                 :       1001 :             const SdrObjList* pVOL=pPV->GetObjList();
    1136 [ +  - ][ +  + ]:       1750 :             while (pOOL!=NULL && pOOL!=pVOL) {
                 [ +  + ]
    1137                 :        749 :                 pOOL=pOOL->GetUpList();
    1138                 :            :             }
    1139                 :       1001 :             bRaus=pOOL!=pVOL;
    1140                 :            :         }
    1141                 :            : 
    1142         [ -  + ]:       1001 :         if (bRaus)
    1143                 :            :         {
    1144                 :          0 :             GetMarkedObjectListWriteAccess().DeleteMark(nm);
    1145                 :            :         }
    1146                 :            :         else
    1147                 :            :         {
    1148         [ +  - ]:       1001 :             if (!IsGluePointEditMode()) { // selected glue points only in GlueEditMode
    1149                 :       1001 :                 SdrUShortCont* pPts=pM->GetMarkedGluePoints();
    1150         [ -  + ]:       1001 :                 if (pPts!=NULL) {
    1151                 :          0 :                     pPts->clear();
    1152                 :            :                 }
    1153                 :            :             }
    1154                 :            :         }
    1155                 :            :     }
    1156                 :            : 
    1157                 :            :     // at least reset the remembered BoundRect to prevent handle
    1158                 :            :     // generation if bForceFrameHandles is TRUE.
    1159                 :      29327 :     bMarkedObjRectDirty = sal_True;
    1160                 :      29327 : }
    1161                 :            : 
    1162                 :      20058 : void SdrMarkView::SetMarkRects()
    1163                 :            : {
    1164                 :      20058 :     SdrPageView* pPV = GetSdrPageView();
    1165                 :            : 
    1166         [ +  + ]:      20058 :     if(pPV)
    1167                 :            :     {
    1168                 :      15020 :         pPV->SetHasMarkedObj(GetSnapRectFromMarkedObjects(pPV, pPV->MarkSnap()));
    1169                 :      15020 :         GetBoundRectFromMarkedObjects(pPV, pPV->MarkBound());
    1170                 :            :     }
    1171                 :      20058 : }
    1172                 :            : 
    1173                 :       3948 : void SdrMarkView::SetFrameHandles(sal_Bool bOn)
    1174                 :            : {
    1175         [ +  + ]:       3948 :     if (bOn!=bForceFrameHandles) {
    1176                 :       2031 :         sal_Bool bOld=ImpIsFrameHandles();
    1177                 :       2031 :         bForceFrameHandles=bOn;
    1178                 :       2031 :         sal_Bool bNew=ImpIsFrameHandles();
    1179         [ +  - ]:       2031 :         if (bNew!=bOld) {
    1180                 :       2031 :             AdjustMarkHdl();
    1181                 :       2031 :             MarkListHasChanged();
    1182                 :            :         }
    1183                 :            :     }
    1184                 :       3948 : }
    1185                 :            : 
    1186                 :        405 : void SdrMarkView::SetEditMode(SdrViewEditMode eMode)
    1187                 :            : {
    1188         [ -  + ]:        405 :     if (eMode!=eEditMode) {
    1189                 :          0 :         sal_Bool bGlue0=eEditMode==SDREDITMODE_GLUEPOINTEDIT;
    1190                 :          0 :         sal_Bool bEdge0=((SdrCreateView*)this)->IsEdgeTool();
    1191                 :          0 :         eEditMode0=eEditMode;
    1192                 :          0 :         eEditMode=eMode;
    1193                 :          0 :         sal_Bool bGlue1=eEditMode==SDREDITMODE_GLUEPOINTEDIT;
    1194                 :          0 :         sal_Bool bEdge1=((SdrCreateView*)this)->IsEdgeTool();
    1195                 :            :         // avoid flickering when switching between GlueEdit and EdgeTool
    1196 [ #  # ][ #  # ]:          0 :         if (bGlue1 && !bGlue0) ImpSetGlueVisible2(bGlue1);
    1197         [ #  # ]:          0 :         if (bEdge1!=bEdge0) ImpSetGlueVisible3(bEdge1);
    1198 [ #  # ][ #  # ]:          0 :         if (!bGlue1 && bGlue0) ImpSetGlueVisible2(bGlue1);
    1199 [ #  # ][ #  # ]:          0 :         if (bGlue0 && !bGlue1) UnmarkAllGluePoints();
    1200                 :            :     }
    1201                 :        405 : }
    1202                 :            : 
    1203                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    1204                 :            : 
    1205                 :       1028 : sal_Bool SdrMarkView::IsObjMarkable(SdrObject* pObj, SdrPageView* pPV) const
    1206                 :            : {
    1207         [ +  - ]:       1028 :     if (pObj)
    1208                 :            :     {
    1209         [ +  - ]:       1798 :         if (pObj->IsMarkProtect() ||
           [ +  +  -  + ]
                 [ -  + ]
    1210                 :        770 :             (!bDesignMode && pObj->IsUnoObj()))
    1211                 :            :         {
    1212                 :            :             // object not selectable or
    1213                 :            :             // SdrUnoObj not in DesignMode
    1214                 :          0 :             return sal_False;
    1215                 :            :         }
    1216                 :            :     }
    1217         [ +  - ]:       1028 :     return pPV!=NULL ? pPV->IsObjMarkable(pObj) : sal_True;
    1218                 :            : }
    1219                 :            : 
    1220                 :          0 : sal_Bool SdrMarkView::IsMarkedObjHit(const Point& rPnt, short nTol) const
    1221                 :            : {
    1222                 :          0 :     sal_Bool bRet=sal_False;
    1223         [ #  # ]:          0 :     nTol=ImpGetHitTolLogic(nTol,NULL);
    1224                 :          0 :     Point aPt(rPnt);
    1225 [ #  # ][ #  # ]:          0 :     for (sal_uIntPtr nm=0; nm<GetMarkedObjectCount() && !bRet; nm++) {
                 [ #  # ]
    1226         [ #  # ]:          0 :         SdrMark* pM=GetSdrMarkByIndex(nm);
    1227 [ #  # ][ #  # ]:          0 :         bRet = 0 != CheckSingleSdrObjectHit(aPt,sal_uInt16(nTol),pM->GetMarkedSdrObj(),pM->GetPageView(),0,0);
    1228                 :            :     }
    1229                 :          0 :     return bRet;
    1230                 :            : }
    1231                 :            : 
    1232                 :       1179 : SdrHdl* SdrMarkView::PickHandle(const Point& rPnt, sal_uIntPtr nOptions, SdrHdl* pHdl0) const
    1233                 :            : {
    1234         [ +  + ]:       1179 :     if (bSomeObjChgdFlag) { // recalculate handles, if necessary
    1235         [ +  - ]:        281 :         FlushComeBackTimer();
    1236                 :            :     }
    1237                 :       1179 :     sal_Bool bBack=(nOptions & SDRSEARCH_BACKWARD) !=0;
    1238                 :       1179 :     sal_Bool bNext=(nOptions & SDRSEARCH_NEXT) !=0;
    1239                 :       1179 :     Point aPt(rPnt);
    1240         [ +  - ]:       1179 :     return aHdl.IsHdlListHit(aPt,bBack,bNext,pHdl0);
    1241                 :            : }
    1242                 :            : 
    1243                 :          0 : sal_Bool SdrMarkView::MarkObj(const Point& rPnt, short nTol, sal_Bool bToggle, sal_Bool bDeep)
    1244                 :            : {
    1245                 :            :     SdrObject* pObj;
    1246                 :            :     SdrPageView* pPV;
    1247         [ #  # ]:          0 :     nTol=ImpGetHitTolLogic(nTol,NULL);
    1248                 :          0 :     sal_uIntPtr nOptions=SDRSEARCH_PICKMARKABLE;
    1249         [ #  # ]:          0 :     if (bDeep) nOptions=nOptions|SDRSEARCH_DEEP;
    1250         [ #  # ]:          0 :     sal_Bool bRet=PickObj(rPnt,(sal_uInt16)nTol,pObj,pPV,nOptions);
    1251         [ #  # ]:          0 :     if (bRet) {
    1252 [ #  # ][ #  # ]:          0 :         sal_Bool bUnmark=bToggle && IsObjMarked(pObj);
                 [ #  # ]
    1253         [ #  # ]:          0 :         MarkObj(pObj,pPV,bUnmark);
    1254                 :            :     }
    1255                 :          0 :     return bRet;
    1256                 :            : }
    1257                 :            : 
    1258                 :          0 : sal_Bool SdrMarkView::MarkNextObj(sal_Bool bPrev)
    1259                 :            : {
    1260                 :          0 :     SdrPageView* pPageView = GetSdrPageView();
    1261                 :            : 
    1262         [ #  # ]:          0 :     if(!pPageView)
    1263                 :            :     {
    1264                 :          0 :         return sal_False;
    1265                 :            :     }
    1266                 :            : 
    1267                 :          0 :     SortMarkedObjects();
    1268                 :          0 :     sal_uIntPtr  nMarkAnz=GetMarkedObjectCount();
    1269                 :          0 :     sal_uIntPtr  nChgMarkNum = ULONG_MAX; // number of the MarkEntry we want to replace
    1270         [ #  # ]:          0 :     sal_uIntPtr  nSearchObjNum = bPrev ? 0 : ULONG_MAX;
    1271         [ #  # ]:          0 :     if (nMarkAnz!=0) {
    1272         [ #  # ]:          0 :         nChgMarkNum=bPrev ? 0 : sal_uIntPtr(nMarkAnz-1);
    1273                 :          0 :         SdrMark* pM=GetSdrMarkByIndex(nChgMarkNum);
    1274                 :            :         OSL_ASSERT(pM!=NULL);
    1275         [ #  # ]:          0 :         if (pM->GetMarkedSdrObj() != NULL)
    1276                 :          0 :             nSearchObjNum = pM->GetMarkedSdrObj()->GetNavigationPosition();
    1277                 :            :     }
    1278                 :            : 
    1279                 :          0 :     SdrObject* pMarkObj=NULL;
    1280                 :          0 :     SdrObjList* pSearchObjList=pPageView->GetObjList();
    1281                 :          0 :     sal_uIntPtr nObjAnz=pSearchObjList->GetObjCount();
    1282         [ #  # ]:          0 :     if (nObjAnz!=0) {
    1283         [ #  # ]:          0 :         if (nSearchObjNum>nObjAnz) nSearchObjNum=nObjAnz;
    1284 [ #  # ][ #  # ]:          0 :         while (pMarkObj==NULL && ((!bPrev && nSearchObjNum>0) || (bPrev && nSearchObjNum<nObjAnz)))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1285                 :            :         {
    1286         [ #  # ]:          0 :             if (!bPrev)
    1287                 :          0 :                 nSearchObjNum--;
    1288                 :          0 :             SdrObject* pSearchObj = pSearchObjList->GetObjectForNavigationPosition(nSearchObjNum);
    1289         [ #  # ]:          0 :             if (IsObjMarkable(pSearchObj,pPageView))
    1290                 :            :             {
    1291         [ #  # ]:          0 :                 if (TryToFindMarkedObject(pSearchObj)==CONTAINER_ENTRY_NOTFOUND)
    1292                 :            :                 {
    1293                 :          0 :                     pMarkObj=pSearchObj;
    1294                 :            :                 }
    1295                 :            :             }
    1296         [ #  # ]:          0 :             if (bPrev) nSearchObjNum++;
    1297                 :            :         }
    1298                 :            :     }
    1299                 :            : 
    1300         [ #  # ]:          0 :     if(!pMarkObj)
    1301                 :            :     {
    1302                 :          0 :         return sal_False;
    1303                 :            :     }
    1304                 :            : 
    1305         [ #  # ]:          0 :     if (nChgMarkNum!=ULONG_MAX)
    1306                 :            :     {
    1307                 :          0 :         GetMarkedObjectListWriteAccess().DeleteMark(nChgMarkNum);
    1308                 :            :     }
    1309                 :          0 :     MarkObj(pMarkObj,pPageView); // also calls MarkListHasChanged(), AdjustMarkHdl()
    1310                 :          0 :     return sal_True;
    1311                 :            : }
    1312                 :            : 
    1313                 :          0 : sal_Bool SdrMarkView::MarkNextObj(const Point& rPnt, short nTol, sal_Bool bPrev)
    1314                 :            : {
    1315         [ #  # ]:          0 :     SortMarkedObjects();
    1316         [ #  # ]:          0 :     nTol=ImpGetHitTolLogic(nTol,NULL);
    1317                 :          0 :     Point aPt(rPnt);
    1318                 :          0 :     SdrMark* pTopMarkHit=NULL;
    1319                 :          0 :     SdrMark* pBtmMarkHit=NULL;
    1320                 :          0 :     sal_uIntPtr nTopMarkHit=0;
    1321                 :          0 :     sal_uIntPtr nBtmMarkHit=0;
    1322                 :            :     // find topmost of the selected objects that is hit by rPnt
    1323                 :          0 :     sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
    1324                 :          0 :     sal_uIntPtr nm=0;
    1325 [ #  # ][ #  # ]:          0 :     for (nm=nMarkAnz; nm>0 && pTopMarkHit==NULL;) {
                 [ #  # ]
    1326                 :          0 :         nm--;
    1327         [ #  # ]:          0 :         SdrMark* pM=GetSdrMarkByIndex(nm);
    1328 [ #  # ][ #  # ]:          0 :         if(CheckSingleSdrObjectHit(aPt,sal_uInt16(nTol),pM->GetMarkedSdrObj(),pM->GetPageView(),0,0))
                 [ #  # ]
    1329                 :            :         {
    1330                 :          0 :             pTopMarkHit=pM;
    1331                 :          0 :             nTopMarkHit=nm;
    1332                 :            :         }
    1333                 :            :     }
    1334                 :            :     // nothing found, in this case, just select an object
    1335 [ #  # ][ #  # ]:          0 :     if (pTopMarkHit==NULL) return MarkObj(rPnt,sal_uInt16(nTol),sal_False);
    1336                 :            : 
    1337         [ #  # ]:          0 :     SdrObject* pTopObjHit=pTopMarkHit->GetMarkedSdrObj();
    1338         [ #  # ]:          0 :     SdrObjList* pObjList=pTopObjHit->GetObjList();
    1339                 :          0 :     SdrPageView* pPV=pTopMarkHit->GetPageView();
    1340                 :            :     // find lowermost of the selected objects that is hit by rPnt
    1341                 :            :     // and is placed on the same PageView as pTopMarkHit
    1342 [ #  # ][ #  # ]:          0 :     for (nm=0; nm<nMarkAnz && pBtmMarkHit==NULL; nm++) {
                 [ #  # ]
    1343         [ #  # ]:          0 :         SdrMark* pM=GetSdrMarkByIndex(nm);
    1344                 :          0 :         SdrPageView* pPV2=pM->GetPageView();
    1345 [ #  # ][ #  # ]:          0 :         if (pPV2==pPV && CheckSingleSdrObjectHit(aPt,sal_uInt16(nTol),pM->GetMarkedSdrObj(),pPV2,0,0))
         [ #  # ][ #  # ]
                 [ #  # ]
    1346                 :            :         {
    1347                 :          0 :             pBtmMarkHit=pM;
    1348                 :          0 :             nBtmMarkHit=nm;
    1349                 :            :         }
    1350                 :            :     }
    1351         [ #  # ]:          0 :     if (pBtmMarkHit==NULL) { pBtmMarkHit=pTopMarkHit; nBtmMarkHit=nTopMarkHit; }
    1352         [ #  # ]:          0 :     SdrObject* pBtmObjHit=pBtmMarkHit->GetMarkedSdrObj();
    1353         [ #  # ]:          0 :     sal_uIntPtr nObjAnz=pObjList->GetObjCount();
    1354                 :            : 
    1355                 :            :     sal_uInt32 nSearchBeg;
    1356                 :          0 :     E3dScene* pScene = NULL;
    1357         [ #  # ]:          0 :     SdrObject* pObjHit = (bPrev) ? pBtmObjHit : pTopObjHit;
    1358 [ #  # ][ #  # ]:          0 :     sal_Bool bRemap = pObjHit->ISA(E3dCompoundObject)
    1359                 :            :         ? ((E3dCompoundObject*)pObjHit)->IsAOrdNumRemapCandidate(pScene)
    1360 [ #  # ][ #  # ]:          0 :         : sal_False;
    1361                 :            : 
    1362         [ #  # ]:          0 :     if(bPrev)
    1363                 :            :     {
    1364         [ #  # ]:          0 :         sal_uInt32 nOrdNumBtm(pBtmObjHit->GetOrdNum());
    1365                 :            : 
    1366         [ #  # ]:          0 :         if(bRemap)
    1367                 :            :         {
    1368         [ #  # ]:          0 :             nOrdNumBtm = pScene->RemapOrdNum(nOrdNumBtm);
    1369                 :            :         }
    1370                 :            : 
    1371                 :          0 :         nSearchBeg = nOrdNumBtm + 1;
    1372                 :            :     }
    1373                 :            :     else
    1374                 :            :     {
    1375         [ #  # ]:          0 :         sal_uInt32 nOrdNumTop(pTopObjHit->GetOrdNum());
    1376                 :            : 
    1377         [ #  # ]:          0 :         if(bRemap)
    1378                 :            :         {
    1379         [ #  # ]:          0 :             nOrdNumTop = pScene->RemapOrdNum(nOrdNumTop);
    1380                 :            :         }
    1381                 :            : 
    1382                 :          0 :         nSearchBeg = nOrdNumTop;
    1383                 :            :     }
    1384                 :            : 
    1385                 :          0 :     sal_uIntPtr no=nSearchBeg;
    1386                 :          0 :     SdrObject* pFndObj=NULL;
    1387 [ #  # ][ #  # ]:          0 :     while (pFndObj==NULL && ((!bPrev && no>0) || (bPrev && no<nObjAnz))) {
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1388         [ #  # ]:          0 :         if (!bPrev) no--;
    1389                 :            :         SdrObject* pObj;
    1390                 :            : 
    1391         [ #  # ]:          0 :         if(bRemap)
    1392                 :            :         {
    1393 [ #  # ][ #  # ]:          0 :             pObj = pObjList->GetObj(pScene->RemapOrdNum(no));
    1394                 :            :         }
    1395                 :            :         else
    1396                 :            :         {
    1397         [ #  # ]:          0 :             pObj = pObjList->GetObj(no);
    1398                 :            :         }
    1399                 :            : 
    1400 [ #  # ][ #  # ]:          0 :         if (CheckSingleSdrObjectHit(aPt,sal_uInt16(nTol),pObj,pPV,SDRSEARCH_TESTMARKABLE,0))
    1401                 :            :         {
    1402 [ #  # ][ #  # ]:          0 :             if (TryToFindMarkedObject(pObj)==CONTAINER_ENTRY_NOTFOUND) {
    1403                 :          0 :                 pFndObj=pObj;
    1404                 :            :             } else {
    1405                 :            :                 // TODO: for performance reasons set on to Top or Btm, if necessary
    1406                 :            :             }
    1407                 :            :         }
    1408         [ #  # ]:          0 :         if (bPrev) no++;
    1409                 :            :     }
    1410         [ #  # ]:          0 :     if (pFndObj!=NULL)
    1411                 :            :     {
    1412 [ #  # ][ #  # ]:          0 :         GetMarkedObjectListWriteAccess().DeleteMark(bPrev?nBtmMarkHit:nTopMarkHit);
    1413 [ #  # ][ #  # ]:          0 :         GetMarkedObjectListWriteAccess().InsertEntry(SdrMark(pFndObj,pPV));
                 [ #  # ]
    1414         [ #  # ]:          0 :         MarkListHasChanged();
    1415         [ #  # ]:          0 :         AdjustMarkHdl();
    1416                 :            :     }
    1417                 :          0 :     return pFndObj!=NULL;
    1418                 :            : }
    1419                 :            : 
    1420                 :          0 : sal_Bool SdrMarkView::MarkObj(const Rectangle& rRect, sal_Bool bUnmark)
    1421                 :            : {
    1422                 :          0 :     sal_Bool bFnd=sal_False;
    1423                 :          0 :     Rectangle aR(rRect);
    1424                 :            :     SdrObject* pObj;
    1425                 :            :     SdrObjList* pObjList;
    1426         [ #  # ]:          0 :     BrkAction();
    1427                 :          0 :     SdrPageView* pPV = GetSdrPageView();
    1428                 :            : 
    1429         [ #  # ]:          0 :     if(pPV)
    1430                 :            :     {
    1431                 :          0 :         pObjList=pPV->GetObjList();
    1432                 :          0 :         Rectangle aFrm1(aR);
    1433         [ #  # ]:          0 :         sal_uIntPtr nObjAnz=pObjList->GetObjCount();
    1434         [ #  # ]:          0 :         for (sal_uIntPtr nO=0; nO<nObjAnz; nO++) {
    1435         [ #  # ]:          0 :             pObj=pObjList->GetObj(nO);
    1436         [ #  # ]:          0 :             Rectangle aRect(pObj->GetCurrentBoundRect());
    1437 [ #  # ][ #  # ]:          0 :             if (aFrm1.IsInside(aRect)) {
    1438         [ #  # ]:          0 :                 if (!bUnmark) {
    1439 [ #  # ][ #  # ]:          0 :                     if (IsObjMarkable(pObj,pPV))
    1440                 :            :                     {
    1441 [ #  # ][ #  # ]:          0 :                         GetMarkedObjectListWriteAccess().InsertEntry(SdrMark(pObj,pPV));
                 [ #  # ]
    1442                 :          0 :                         bFnd=sal_True;
    1443                 :            :                     }
    1444                 :            :                 } else {
    1445         [ #  # ]:          0 :                     sal_uIntPtr nPos=TryToFindMarkedObject(pObj);
    1446         [ #  # ]:          0 :                     if (nPos!=CONTAINER_ENTRY_NOTFOUND)
    1447                 :            :                     {
    1448         [ #  # ]:          0 :                         GetMarkedObjectListWriteAccess().DeleteMark(nPos);
    1449                 :          0 :                         bFnd=sal_True;
    1450                 :            :                     }
    1451                 :            :                 }
    1452                 :            :             }
    1453                 :            :         }
    1454                 :            :     }
    1455         [ #  # ]:          0 :     if (bFnd) {
    1456         [ #  # ]:          0 :         SortMarkedObjects();
    1457         [ #  # ]:          0 :         MarkListHasChanged();
    1458         [ #  # ]:          0 :         AdjustMarkHdl();
    1459                 :            :     }
    1460                 :          0 :     return bFnd;
    1461                 :            : }
    1462                 :            : 
    1463                 :       1011 : void SdrMarkView::MarkObj(SdrObject* pObj, SdrPageView* pPV, sal_Bool bUnmark, sal_Bool bImpNoSetMarkHdl)
    1464                 :            : {
    1465 [ +  - ][ +  - ]:       1011 :     if (pObj!=NULL && pPV!=NULL && IsObjMarkable(pObj, pPV)) {
         [ +  - ][ +  - ]
    1466                 :       1011 :         BrkAction();
    1467         [ +  + ]:       1011 :         if (!bUnmark)
    1468                 :            :         {
    1469         [ +  - ]:       1009 :             GetMarkedObjectListWriteAccess().InsertEntry(SdrMark(pObj,pPV));
    1470                 :            :         }
    1471                 :            :         else
    1472                 :            :         {
    1473                 :          2 :             sal_uIntPtr nPos=TryToFindMarkedObject(pObj);
    1474         [ -  + ]:          2 :             if (nPos!=CONTAINER_ENTRY_NOTFOUND)
    1475                 :            :             {
    1476                 :          0 :                 GetMarkedObjectListWriteAccess().DeleteMark(nPos);
    1477                 :            :             }
    1478                 :            :         }
    1479         [ +  + ]:       1011 :         if (!bImpNoSetMarkHdl) {
    1480                 :        863 :             MarkListHasChanged();
    1481                 :        863 :             AdjustMarkHdl();
    1482                 :            :         }
    1483                 :            :     }
    1484                 :       1011 : }
    1485                 :            : 
    1486                 :          8 : sal_Bool SdrMarkView::IsObjMarked(SdrObject* pObj) const
    1487                 :            : {
    1488                 :            :     // Hack: Because FindObject() is not const,
    1489                 :            :     // I have to cast myself to non-const.
    1490                 :          8 :     sal_uIntPtr nPos=((SdrMarkView*)this)->TryToFindMarkedObject(pObj);
    1491                 :          8 :     return nPos!=CONTAINER_ENTRY_NOTFOUND;
    1492                 :            : }
    1493                 :            : 
    1494                 :       2366 : sal_uInt16 SdrMarkView::GetMarkHdlSizePixel() const
    1495                 :            : {
    1496                 :       2366 :     return aHdl.GetHdlSize()*2+1;
    1497                 :            : }
    1498                 :            : 
    1499                 :       1939 : void SdrMarkView::SetMarkHdlSizePixel(sal_uInt16 nSiz)
    1500                 :            : {
    1501         [ -  + ]:       1939 :     if (nSiz<3) nSiz=3;
    1502                 :       1939 :     nSiz/=2;
    1503         [ +  + ]:       1939 :     if (nSiz!=aHdl.GetHdlSize()) {
    1504                 :       1696 :         aHdl.SetHdlSize(nSiz);
    1505                 :            :     }
    1506                 :       1939 : }
    1507                 :            : 
    1508                 :            : #define SDRSEARCH_IMPISMASTER 0x80000000 /* MasterPage is being searched right now */
    1509                 :       1588 : SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObject* pObj, SdrPageView* pPV, sal_uIntPtr nOptions, const SetOfByte* pMVisLay) const
    1510                 :            : {
    1511 [ +  + ][ +  - ]:       1588 :     if(((nOptions & SDRSEARCH_IMPISMASTER) && pObj->IsNotVisibleAsMaster()) || (!pObj->IsVisible()))
         [ +  + ][ +  - ]
         [ -  + ][ +  + ]
    1512                 :            :     {
    1513                 :        372 :         return NULL;
    1514                 :            :     }
    1515                 :            : 
    1516                 :       1216 :     const bool bCheckIfMarkable(nOptions & SDRSEARCH_TESTMARKABLE);
    1517                 :       1216 :     const bool bDeep(nOptions & SDRSEARCH_DEEP);
    1518 [ +  - ][ +  - ]:       1216 :     const bool bOLE(pObj->ISA(SdrOle2Obj));
    1519 [ +  - ][ +  - ]:       1216 :     const bool bTXT(pObj->ISA(SdrTextObj) && ((SdrTextObj*)pObj)->IsTextFrame());
         [ +  + ][ +  + ]
    1520                 :       1216 :     SdrObject* pRet=NULL;
    1521         [ +  - ]:       1216 :     Rectangle aRect(pObj->GetCurrentBoundRect());
    1522                 :       1216 :     sal_uInt16 nTol2(nTol);
    1523                 :            : 
    1524                 :            :     // double tolerance for OLE, text frames and objects in
    1525                 :            :     // active text edit
    1526 [ +  - ][ +  + ]:       1216 :     if(bOLE || bTXT || pObj==((SdrObjEditView*)this)->GetTextEditObject())
         [ +  - ][ -  + ]
                 [ +  + ]
    1527                 :            :     {
    1528                 :        921 :         nTol2*=2;
    1529                 :            :     }
    1530                 :            : 
    1531                 :       1216 :     aRect.Left  ()-=nTol2; // add 1 tolerance for all objects
    1532                 :       1216 :     aRect.Top   ()-=nTol2;
    1533                 :       1216 :     aRect.Right ()+=nTol2;
    1534                 :       1216 :     aRect.Bottom()+=nTol2;
    1535                 :            : 
    1536 [ +  + ][ +  - ]:       1216 :     if (aRect.IsInside(rPnt))
    1537                 :            :     {
    1538 [ +  - ][ +  - ]:         17 :         if ((!bCheckIfMarkable || IsObjMarkable(pObj,pPV)))
         [ +  + ][ +  + ]
    1539                 :            :         {
    1540         [ +  - ]:          2 :             SdrObjList* pOL=pObj->GetSubList();
    1541                 :            : 
    1542 [ -  + ][ #  # ]:          2 :             if (pOL!=NULL && pOL->GetObjCount()!=0)
         [ #  # ][ -  + ]
    1543                 :            :             {
    1544                 :            :                 SdrObject* pTmpObj;
    1545                 :            :                 // adjustment hit point for virtual objects
    1546                 :          0 :                 Point aPnt( rPnt );
    1547                 :            : 
    1548 [ #  # ][ #  # ]:          0 :                 if ( pObj->ISA(SdrVirtObj) )
                 [ #  # ]
    1549                 :            :                 {
    1550         [ #  # ]:          0 :                     Point aOffset = static_cast<SdrVirtObj*>(pObj)->GetOffset();
    1551                 :          0 :                     aPnt.Move( -aOffset.X(), -aOffset.Y() );
    1552                 :            :                 }
    1553                 :            : 
    1554         [ #  # ]:          0 :                 pRet=CheckSingleSdrObjectHit(aPnt,nTol,pOL,pPV,nOptions,pMVisLay,pTmpObj);
    1555                 :            :             }
    1556                 :            :             else
    1557                 :            :             {
    1558 [ -  + ][ #  # ]:          2 :                 if(!pMVisLay || pMVisLay->IsSet(pObj->GetLayer()))
         [ #  # ][ +  - ]
    1559                 :            :                 {
    1560         [ +  - ]:          2 :                     pRet = SdrObjectPrimitiveHit(*pObj, rPnt, nTol2, *pPV, &pPV->GetVisibleLayers(), false);
    1561                 :            :                 }
    1562                 :            :             }
    1563                 :            :         }
    1564                 :            :     }
    1565                 :            : 
    1566 [ +  + ][ +  + ]:       1216 :     if (!bDeep && pRet!=NULL)
    1567                 :            :     {
    1568                 :          2 :         pRet=pObj;
    1569                 :            :     }
    1570                 :            : 
    1571                 :       1588 :     return pRet;
    1572                 :            : }
    1573                 :            : 
    1574                 :       1993 : SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nTol, SdrObjList* pOL, SdrPageView* pPV, sal_uIntPtr nOptions, const SetOfByte* pMVisLay, SdrObject*& rpRootObj) const
    1575                 :            : {
    1576                 :       1993 :     sal_Bool bBack=(nOptions & SDRSEARCH_BACKWARD)!=0;
    1577                 :       1993 :     SdrObject* pRet=NULL;
    1578                 :       1993 :     rpRootObj=NULL;
    1579         [ +  - ]:       1993 :     if (pOL!=NULL)
    1580                 :            :     {
    1581 [ -  + ][ #  # ]:       1993 :         sal_Bool bRemap(pOL->GetOwnerObj() && pOL->GetOwnerObj()->ISA(E3dScene));
    1582         [ -  + ]:       1993 :         E3dScene* pRemapScene = (bRemap ? (E3dScene*)pOL->GetOwnerObj() : 0L);
    1583                 :            : 
    1584                 :       1993 :         sal_uIntPtr nObjAnz=pOL->GetObjCount();
    1585         [ +  - ]:       1993 :         sal_uIntPtr nObjNum=bBack ? 0 : nObjAnz;
    1586 [ +  + ][ -  + ]:       3581 :         while (pRet==NULL && (bBack ? nObjNum<nObjAnz : nObjNum>0)) {
         [ #  # ][ +  + ]
                 [ +  + ]
    1587         [ +  - ]:       1588 :             if (!bBack) nObjNum--;
    1588                 :            :             SdrObject* pObj;
    1589                 :            : 
    1590         [ -  + ]:       1588 :             if(bRemap)
    1591                 :            :             {
    1592                 :          0 :                 pObj = pOL->GetObj(pRemapScene->RemapOrdNum(nObjNum));
    1593                 :            :             }
    1594                 :            :             else
    1595                 :            :             {
    1596                 :       1588 :                 pObj = pOL->GetObj(nObjNum);
    1597                 :            :             }
    1598                 :            : 
    1599                 :       1588 :             pRet=CheckSingleSdrObjectHit(rPnt,nTol,pObj,pPV,nOptions,pMVisLay);
    1600         [ +  + ]:       1588 :             if (pRet!=NULL) rpRootObj=pObj;
    1601         [ -  + ]:       1588 :             if (bBack) nObjNum++;
    1602                 :            :         }
    1603                 :            :     }
    1604                 :       1993 :     return pRet;
    1605                 :            : }
    1606                 :            : 
    1607                 :        778 : sal_Bool SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uIntPtr nOptions) const
    1608                 :            : {
    1609                 :        778 :     return PickObj(rPnt,nTol,rpObj,rpPV,nOptions,NULL,NULL,NULL);
    1610                 :            : }
    1611                 :            : 
    1612                 :       1588 : sal_Bool SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uIntPtr nOptions, SdrObject** ppRootObj, sal_uIntPtr* pnMarkNum, sal_uInt16* pnPassNum) const
    1613                 :            : { // TODO: lacks a Pass2,Pass3
    1614         [ +  - ]:       1588 :     SortMarkedObjects();
    1615         [ +  + ]:       1588 :     if (ppRootObj!=NULL) *ppRootObj=NULL;
    1616         [ -  + ]:       1588 :     if (pnMarkNum!=NULL) *pnMarkNum=CONTAINER_ENTRY_NOTFOUND;
    1617         [ +  + ]:       1588 :     if (pnPassNum!=NULL) *pnPassNum=0;
    1618                 :       1588 :     rpObj=NULL;
    1619                 :       1588 :     rpPV=NULL;
    1620                 :       1588 :     sal_Bool bWholePage=(nOptions & SDRSEARCH_WHOLEPAGE) !=0;
    1621                 :       1588 :     sal_Bool bMarked=(nOptions & SDRSEARCH_MARKED) !=0;
    1622 [ +  + ][ +  + ]:       1588 :     sal_Bool bMasters=!bMarked && (nOptions & SDRSEARCH_ALSOONMASTER) !=0;
    1623                 :       1588 :     sal_Bool bBack=(nOptions & SDRSEARCH_BACKWARD) !=0;
    1624                 :            : #if OSL_DEBUG_LEVEL > 0
    1625                 :            :     sal_Bool bNext=(nOptions & SDRSEARCH_NEXT) !=0; (void)bNext; // n.i.
    1626                 :            :     sal_Bool bBoundCheckOn2ndPass=(nOptions & SDRSEARCH_PASS2BOUND) !=0; (void)bBoundCheckOn2ndPass;// n.i.
    1627                 :            :     sal_Bool bCheckNearestOn3rdPass=(nOptions & SDRSEARCH_PASS3NEAREST) !=0; (void)bCheckNearestOn3rdPass;// n.i.
    1628                 :            : #endif
    1629 [ -  + ][ #  # ]:       1588 :     if (nTol<0) nTol=ImpGetHitTolLogic(nTol,NULL);
    1630                 :       1588 :     Point aPt(rPnt);
    1631                 :       1588 :     SdrObject* pObj=NULL;
    1632                 :       1588 :     SdrObject* pHitObj=NULL;
    1633                 :       1588 :     SdrPageView* pPV=NULL;
    1634 [ +  - ][ +  - ]:       1588 :     if (!bBack && ((SdrObjEditView*)this)->IsTextEditFrameHit(rPnt)) {
         [ -  + ][ -  + ]
    1635         [ #  # ]:          0 :         pObj=((SdrObjEditView*)this)->GetTextEditObject();
    1636                 :          0 :         pHitObj=pObj;
    1637         [ #  # ]:          0 :         pPV=((SdrObjEditView*)this)->GetTextEditPageView();
    1638                 :            :     }
    1639         [ +  + ]:       1588 :     if (bMarked) {
    1640                 :        405 :         sal_uIntPtr nMrkAnz=GetMarkedObjectCount();
    1641         [ +  - ]:        405 :         sal_uIntPtr nMrkNum=bBack ? 0 : nMrkAnz;
    1642 [ +  - ][ -  + ]:        405 :         while (pHitObj==NULL && (bBack ? nMrkNum<nMrkAnz : nMrkNum>0)) {
         [ #  # ][ -  + ]
                 [ -  + ]
    1643         [ #  # ]:          0 :             if (!bBack) nMrkNum--;
    1644         [ #  # ]:          0 :             SdrMark* pM=GetSdrMarkByIndex(nMrkNum);
    1645         [ #  # ]:          0 :             pObj=pM->GetMarkedSdrObj();
    1646                 :          0 :             pPV=pM->GetPageView();
    1647         [ #  # ]:          0 :             pHitObj=CheckSingleSdrObjectHit(aPt,nTol,pObj,pPV,nOptions,NULL);
    1648         [ #  # ]:          0 :             if (bBack) nMrkNum++;
    1649                 :            :         }
    1650                 :            :     }
    1651                 :            :     else
    1652                 :            :     {
    1653                 :       1183 :         pPV = GetSdrPageView();
    1654                 :            : 
    1655         [ +  - ]:       1183 :         if(pPV)
    1656                 :            :         {
    1657                 :       1183 :             SdrPage* pPage=pPV->GetPage();
    1658                 :       1183 :             sal_uInt16 nPgAnz=1;
    1659                 :            : 
    1660 [ +  + ][ +  + ]:       1183 :             if(bMasters && pPage->TRG_HasMasterPage())
                 [ +  + ]
    1661                 :            :             {
    1662                 :        810 :                 nPgAnz++;
    1663                 :            :             }
    1664                 :            : 
    1665 [ +  + ][ -  + ]:       1183 :             sal_Bool bExtraPassForWholePage=bWholePage && pPage!=pPV->GetObjList();
    1666         [ -  + ]:       1183 :             if (bExtraPassForWholePage) nPgAnz++; // First search in AktObjList, then on the entire page
    1667         [ +  - ]:       1183 :             sal_uInt16 nPgNum=bBack ? 0 : nPgAnz;
    1668 [ +  + ][ -  + ]:       3176 :             while (pHitObj==NULL && (bBack ? nPgNum<nPgAnz : nPgNum>0)) {
         [ #  # ][ +  + ]
                 [ +  + ]
    1669                 :       1993 :                 sal_uIntPtr nTmpOptions=nOptions;
    1670         [ +  - ]:       1993 :                 if (!bBack) nPgNum--;
    1671                 :       1993 :                 const SetOfByte* pMVisLay=NULL;
    1672                 :       1993 :                 SdrObjList* pObjList=NULL;
    1673         [ +  + ]:       1993 :                 if (pnPassNum!=NULL) *pnPassNum&=~(SDRSEARCHPASS_MASTERPAGE|SDRSEARCHPASS_INACTIVELIST);
    1674 [ +  + ][ -  + ]:       1993 :                 if (nPgNum>=nPgAnz-1 || (bExtraPassForWholePage && nPgNum>=nPgAnz-2))
                 [ #  # ]
    1675                 :            :                 {
    1676                 :       1183 :                     pObjList=pPV->GetObjList();
    1677 [ #  # ][ -  + ]:       1183 :                     if (bExtraPassForWholePage && nPgNum==nPgAnz-2) {
    1678                 :          0 :                         pObjList=pPage;
    1679         [ #  # ]:          0 :                         if (pnPassNum!=NULL) *pnPassNum|=SDRSEARCHPASS_INACTIVELIST;
    1680                 :            :                     }
    1681                 :            :                 }
    1682                 :            :                 else
    1683                 :            :                 {
    1684                 :            :                     // otherwise MasterPage
    1685         [ +  - ]:        810 :                     SdrPage& rMasterPage = pPage->TRG_GetMasterPage();
    1686         [ +  - ]:        810 :                     pMVisLay = &pPage->TRG_GetMasterPageVisibleLayers();
    1687                 :        810 :                     pObjList = &rMasterPage;
    1688                 :            : 
    1689         [ +  + ]:        810 :                     if (pnPassNum!=NULL) *pnPassNum|=SDRSEARCHPASS_MASTERPAGE;
    1690                 :        810 :                     nTmpOptions=nTmpOptions | SDRSEARCH_IMPISMASTER;
    1691                 :            :                 }
    1692         [ +  - ]:       1993 :                 pHitObj=CheckSingleSdrObjectHit(aPt,nTol,pObjList,pPV,nTmpOptions,pMVisLay,pObj);
    1693         [ -  + ]:       1993 :                 if (bBack) nPgNum++;
    1694                 :            :             }
    1695                 :            :         }
    1696                 :            :     }
    1697         [ +  + ]:       1588 :     if (pHitObj!=NULL) {
    1698         [ -  + ]:          2 :         if (ppRootObj!=NULL) *ppRootObj=pObj;
    1699         [ -  + ]:          2 :         if ((nOptions & SDRSEARCH_DEEP) !=0) pObj=pHitObj;
    1700         [ -  + ]:          2 :         if ((nOptions & SDRSEARCH_TESTTEXTEDIT) !=0) {
    1701 [ #  # ][ #  # ]:          0 :             if (!pObj->HasTextEdit() || pPV->GetLockedLayers().IsSet(pObj->GetLayer())) {
         [ #  # ][ #  # ]
                 [ #  # ]
    1702                 :          0 :                 pObj=NULL;
    1703                 :            :             }
    1704                 :            :         }
    1705 [ +  - ][ -  + ]:          2 :         if (pObj!=NULL && (nOptions & SDRSEARCH_TESTMACRO) !=0) {
    1706         [ #  # ]:          0 :             SdrObjMacroHitRec aHitRec;
    1707                 :          0 :             aHitRec.aPos=aPt;
    1708                 :          0 :             aHitRec.aDownPos=aPt;
    1709                 :          0 :             aHitRec.nTol=nTol;
    1710                 :          0 :             aHitRec.pVisiLayer=&pPV->GetVisibleLayers();
    1711                 :          0 :             aHitRec.pPageView=pPV;
    1712 [ #  # ][ #  # ]:          0 :             if (!pObj->HasMacro() || !pObj->IsMacroHit(aHitRec)) pObj=NULL;
         [ #  # ][ #  # ]
                 [ #  # ]
    1713                 :            :         }
    1714 [ +  - ][ -  + ]:          2 :         if (pObj!=NULL && (nOptions & SDRSEARCH_WITHTEXT) !=0 && pObj->GetOutlinerParaObject()==NULL) pObj=NULL;
         [ #  # ][ #  # ]
                 [ -  + ]
    1715 [ +  - ][ -  + ]:          2 :         if (pObj!=NULL && (nOptions & SDRSEARCH_TESTTEXTAREA) !=0)
    1716                 :            :         {
    1717 [ #  # ][ #  # ]:          0 :             if(!SdrObjectPrimitiveHit(*pObj, aPt, 0, *pPV, 0, true))
    1718                 :            :             {
    1719                 :          0 :                 pObj = 0;
    1720                 :            :             }
    1721                 :            :         }
    1722         [ +  - ]:          2 :         if (pObj!=NULL) {
    1723                 :          2 :             rpObj=pObj;
    1724                 :          2 :             rpPV=pPV;
    1725         [ -  + ]:          2 :             if (pnPassNum!=NULL) *pnPassNum|=SDRSEARCHPASS_DIRECT;
    1726                 :            :         }
    1727                 :            :     }
    1728                 :       1588 :     return rpObj!=NULL;
    1729                 :            : }
    1730                 :            : 
    1731                 :          0 : sal_Bool SdrMarkView::PickMarkedObj(const Point& rPnt, SdrObject*& rpObj, SdrPageView*& rpPV, sal_uIntPtr* pnMarkNum, sal_uIntPtr nOptions) const
    1732                 :            : {
    1733         [ #  # ]:          0 :     SortMarkedObjects();
    1734                 :          0 :     sal_Bool bBoundCheckOn2ndPass=(nOptions & SDRSEARCH_PASS2BOUND) !=0;
    1735                 :          0 :     sal_Bool bCheckNearestOn3rdPass=(nOptions & SDRSEARCH_PASS3NEAREST) !=0;
    1736                 :          0 :     rpObj=NULL;
    1737                 :          0 :     rpPV=NULL;
    1738         [ #  # ]:          0 :     if (pnMarkNum!=NULL) *pnMarkNum=CONTAINER_ENTRY_NOTFOUND;
    1739                 :          0 :     Point aPt(rPnt);
    1740                 :          0 :     sal_uInt16 nTol=(sal_uInt16)nHitTolLog;
    1741                 :          0 :     sal_Bool bFnd=sal_False;
    1742                 :          0 :     sal_uIntPtr nMarkAnz=GetMarkedObjectCount();
    1743                 :            :     sal_uIntPtr nMarkNum;
    1744 [ #  # ][ #  # ]:          0 :     for (nMarkNum=nMarkAnz; nMarkNum>0 && !bFnd;) {
                 [ #  # ]
    1745                 :          0 :         nMarkNum--;
    1746         [ #  # ]:          0 :         SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
    1747                 :          0 :         SdrPageView* pPV=pM->GetPageView();
    1748         [ #  # ]:          0 :         SdrObject* pObj=pM->GetMarkedSdrObj();
    1749         [ #  # ]:          0 :         bFnd = 0 != CheckSingleSdrObjectHit(aPt,nTol,pObj,pPV,SDRSEARCH_TESTMARKABLE,0);
    1750         [ #  # ]:          0 :         if (bFnd) {
    1751                 :          0 :             rpObj=pObj;
    1752                 :          0 :             rpPV=pPV;
    1753         [ #  # ]:          0 :             if (pnMarkNum!=NULL) *pnMarkNum=nMarkNum;
    1754                 :            :         }
    1755                 :            :     }
    1756 [ #  # ][ #  # ]:          0 :     if ((bBoundCheckOn2ndPass || bCheckNearestOn3rdPass) && !bFnd) {
                 [ #  # ]
    1757                 :          0 :         SdrObject* pBestObj=NULL;
    1758                 :          0 :         SdrPageView* pBestPV=NULL;
    1759                 :          0 :         sal_uIntPtr nBestMarkNum=0;
    1760                 :          0 :         sal_uIntPtr nBestDist=ULONG_MAX;
    1761 [ #  # ][ #  # ]:          0 :         for (nMarkNum=nMarkAnz; nMarkNum>0 && !bFnd;) {
                 [ #  # ]
    1762                 :          0 :             nMarkNum--;
    1763         [ #  # ]:          0 :             SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
    1764                 :          0 :             SdrPageView* pPV=pM->GetPageView();
    1765         [ #  # ]:          0 :             SdrObject* pObj=pM->GetMarkedSdrObj();
    1766         [ #  # ]:          0 :             Rectangle aRect(pObj->GetCurrentBoundRect());
    1767                 :          0 :             aRect.Left  ()-=nTol;
    1768                 :          0 :             aRect.Top   ()-=nTol;
    1769                 :          0 :             aRect.Right ()+=nTol;
    1770                 :          0 :             aRect.Bottom()+=nTol;
    1771 [ #  # ][ #  # ]:          0 :             if (aRect.IsInside(aPt)) {
    1772                 :          0 :                 bFnd=sal_True;
    1773                 :          0 :                 rpObj=pObj;
    1774                 :          0 :                 rpPV=pPV;
    1775         [ #  # ]:          0 :                 if (pnMarkNum!=NULL) *pnMarkNum=nMarkNum;
    1776         [ #  # ]:          0 :             } else if (bCheckNearestOn3rdPass) {
    1777                 :          0 :                 sal_uIntPtr nDist=0;
    1778         [ #  # ]:          0 :                 if (aPt.X()<aRect.Left())   nDist+=aRect.Left()-aPt.X();
    1779         [ #  # ]:          0 :                 if (aPt.X()>aRect.Right())  nDist+=aPt.X()-aRect.Right();
    1780         [ #  # ]:          0 :                 if (aPt.Y()<aRect.Top())    nDist+=aRect.Top()-aPt.Y();
    1781         [ #  # ]:          0 :                 if (aPt.Y()>aRect.Bottom()) nDist+=aPt.Y()-aRect.Bottom();
    1782         [ #  # ]:          0 :                 if (nDist<nBestDist) {
    1783                 :          0 :                     pBestObj=pObj;
    1784                 :          0 :                     pBestPV=pPV;
    1785                 :          0 :                     nBestMarkNum=nMarkNum;
    1786                 :            :                 }
    1787                 :            :             }
    1788                 :            :         }
    1789 [ #  # ][ #  # ]:          0 :         if (bCheckNearestOn3rdPass && !bFnd) {
    1790                 :          0 :             rpObj=pBestObj;
    1791                 :          0 :             rpPV=pBestPV;
    1792         [ #  # ]:          0 :             if (pnMarkNum!=NULL) *pnMarkNum=nBestMarkNum;
    1793                 :          0 :             bFnd=pBestObj!=NULL;
    1794                 :            :         }
    1795                 :            :     }
    1796                 :          0 :     return bFnd;
    1797                 :            : }
    1798                 :            : 
    1799                 :       2337 : void SdrMarkView::UnmarkAllObj(SdrPageView* pPV)
    1800                 :            : {
    1801         [ +  + ]:       2337 :     if (GetMarkedObjectCount()!=0) {
    1802                 :        782 :         BrkAction();
    1803         [ +  + ]:        782 :         if (pPV!=NULL)
    1804                 :            :         {
    1805                 :         12 :             GetMarkedObjectListWriteAccess().DeletePageView(*pPV);
    1806                 :            :         }
    1807                 :            :         else
    1808                 :            :         {
    1809                 :        770 :             GetMarkedObjectListWriteAccess().Clear();
    1810                 :            :         }
    1811                 :        782 :         pMarkedObj=NULL;
    1812                 :        782 :         pMarkedPV=NULL;
    1813                 :        782 :         MarkListHasChanged();
    1814                 :        782 :         AdjustMarkHdl();
    1815                 :            :     }
    1816                 :       2337 : }
    1817                 :            : 
    1818                 :          0 : void SdrMarkView::MarkAllObj(SdrPageView* _pPV)
    1819                 :            : {
    1820                 :          0 :     BrkAction();
    1821                 :            : 
    1822         [ #  # ]:          0 :     if(!_pPV)
    1823                 :            :     {
    1824                 :          0 :         _pPV = GetSdrPageView();
    1825                 :            :     }
    1826                 :            : 
    1827                 :            :     // #i69171# _pPV may still be NULL if there is no SDrPageView (!), e.g. when inserting
    1828                 :            :     // other files
    1829         [ #  # ]:          0 :     if(_pPV)
    1830                 :            :     {
    1831                 :          0 :         const bool bMarkChg(GetMarkedObjectListWriteAccess().InsertPageView(*_pPV));
    1832                 :            : 
    1833         [ #  # ]:          0 :         if(bMarkChg)
    1834                 :            :         {
    1835                 :          0 :             MarkListHasChanged();
    1836                 :            :         }
    1837                 :            :     }
    1838                 :            : 
    1839         [ #  # ]:          0 :     if(GetMarkedObjectCount())
    1840                 :            :     {
    1841                 :          0 :         AdjustMarkHdl();
    1842                 :            :     }
    1843                 :          0 : }
    1844                 :            : 
    1845                 :      20058 : void SdrMarkView::AdjustMarkHdl()
    1846                 :            : {
    1847                 :      20058 :     CheckMarked();
    1848                 :      20058 :     SetMarkRects();
    1849                 :      20058 :     SetMarkHandles();
    1850                 :      20058 : }
    1851                 :            : 
    1852                 :         21 : Rectangle SdrMarkView::GetMarkedObjBoundRect() const
    1853                 :            : {
    1854                 :         21 :     Rectangle aRect;
    1855         [ +  + ]:         42 :     for (sal_uIntPtr nm=0; nm<GetMarkedObjectCount(); nm++) {
    1856         [ +  - ]:         21 :         SdrMark* pM=GetSdrMarkByIndex(nm);
    1857         [ +  - ]:         21 :         SdrObject* pO=pM->GetMarkedSdrObj();
    1858         [ +  - ]:         21 :         Rectangle aR1(pO->GetCurrentBoundRect());
    1859 [ +  - ][ +  - ]:         21 :         if (aRect.IsEmpty()) aRect=aR1;
    1860         [ #  # ]:          0 :         else aRect.Union(aR1);
    1861                 :            :     }
    1862                 :         21 :     return aRect;
    1863                 :            : }
    1864                 :            : 
    1865                 :      13679 : const Rectangle& SdrMarkView::GetMarkedObjRect() const
    1866                 :            : {
    1867         [ +  + ]:      13679 :     if (bMarkedObjRectDirty) {
    1868                 :      13608 :         ((SdrMarkView*)this)->bMarkedObjRectDirty=sal_False;
    1869         [ +  - ]:      13608 :         Rectangle aRect;
    1870         [ +  + ]:      14401 :         for (sal_uIntPtr nm=0; nm<GetMarkedObjectCount(); nm++) {
    1871         [ +  - ]:        793 :             SdrMark* pM=GetSdrMarkByIndex(nm);
    1872         [ +  - ]:        793 :             SdrObject* pO=pM->GetMarkedSdrObj();
    1873         [ +  - ]:        793 :             Rectangle aR1(pO->GetSnapRect());
    1874 [ +  - ][ +  + ]:        793 :             if (aRect.IsEmpty()) aRect=aR1;
    1875         [ +  - ]:         16 :             else aRect.Union(aR1);
    1876                 :            :         }
    1877                 :      13608 :         ((SdrMarkView*)this)->aMarkedObjRect=aRect;
    1878                 :            :     }
    1879                 :      13679 :     return aMarkedObjRect;
    1880                 :            : }
    1881                 :            : 
    1882                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    1883                 :            : 
    1884                 :          1 : void SdrMarkView::ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, XubString& rStr, sal_uInt16 nVal, sal_uInt16 nOpt) const
    1885                 :            : {
    1886         [ +  - ]:          1 :     rStr = ImpGetResStr(nStrCacheID);
    1887                 :          1 :     xub_StrLen nPos = rStr.SearchAscii("%1");
    1888                 :            : 
    1889         [ +  - ]:          1 :     if(nPos != STRING_NOTFOUND)
    1890                 :            :     {
    1891                 :          1 :         rStr.Erase(nPos, 2);
    1892                 :            : 
    1893         [ -  + ]:          1 :         if(nOpt == IMPSDR_POINTSDESCRIPTION)
    1894                 :            :         {
    1895         [ #  # ]:          0 :             rStr.Insert(GetDescriptionOfMarkedPoints(), nPos);
    1896                 :            :         }
    1897         [ -  + ]:          1 :         else if(nOpt == IMPSDR_GLUEPOINTSDESCRIPTION)
    1898                 :            :         {
    1899         [ #  # ]:          0 :             rStr.Insert(GetDescriptionOfMarkedGluePoints(), nPos);
    1900                 :            :         }
    1901                 :            :         else
    1902                 :            :         {
    1903         [ +  - ]:          1 :             rStr.Insert(GetDescriptionOfMarkedObjects(), nPos);
    1904                 :            :         }
    1905                 :            :     }
    1906                 :            : 
    1907                 :          1 :     nPos = rStr.SearchAscii("%2");
    1908                 :            : 
    1909         [ -  + ]:          1 :     if(nPos != STRING_NOTFOUND)
    1910                 :            :     {
    1911                 :          0 :         rStr.Erase(nPos, 2);
    1912         [ #  # ]:          0 :         rStr.Insert(UniString::CreateFromInt32(nVal), nPos);
    1913                 :            :     }
    1914                 :          1 : }
    1915                 :            : 
    1916                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    1917                 :            : 
    1918                 :          0 : sal_Bool SdrMarkView::EnterMarkedGroup()
    1919                 :            : {
    1920                 :          0 :     sal_Bool bRet=sal_False;
    1921                 :            :     // We enter only the first group found (in only one PageView), because
    1922                 :            :     // PageView::EnterGroup calls an AdjustMarkHdl.
    1923                 :            :     // TODO: I'll have to prevent that via a flag.
    1924                 :          0 :     SdrPageView* pPV = GetSdrPageView();
    1925                 :            : 
    1926         [ #  # ]:          0 :     if(pPV)
    1927                 :            :     {
    1928                 :          0 :         sal_Bool bEnter=sal_False;
    1929 [ #  # ][ #  # ]:          0 :         for (sal_uInt32 nm(GetMarkedObjectCount()); nm > 0 && !bEnter;)
                 [ #  # ]
    1930                 :            :         {
    1931                 :          0 :             nm--;
    1932                 :          0 :             SdrMark* pM=GetSdrMarkByIndex(nm);
    1933         [ #  # ]:          0 :             if (pM->GetPageView()==pPV) {
    1934                 :          0 :                 SdrObject* pObj=pM->GetMarkedSdrObj();
    1935         [ #  # ]:          0 :                 if (pObj->IsGroupObject()) {
    1936         [ #  # ]:          0 :                     if (pPV->EnterGroup(pObj)) {
    1937                 :          0 :                         bRet=sal_True;
    1938                 :          0 :                         bEnter=sal_True;
    1939                 :            :                     }
    1940                 :            :                 }
    1941                 :            :             }
    1942                 :            :         }
    1943                 :            :     }
    1944                 :          0 :     return bRet;
    1945                 :            : }
    1946                 :            : 
    1947                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    1948                 :            : 
    1949                 :       3748 : void SdrMarkView::MarkListHasChanged()
    1950                 :            : {
    1951                 :       3748 :     GetMarkedObjectListWriteAccess().SetNameDirty();
    1952                 :       3748 :     SetEdgesOfMarkedNodesDirty();
    1953                 :            : 
    1954                 :       3748 :     bMarkedObjRectDirty=sal_True;
    1955                 :       3748 :     bMarkedPointsRectsDirty=sal_True;
    1956                 :            : #ifdef DBG_UTIL
    1957                 :            :     if (pItemBrowser!=NULL) pItemBrowser->SetDirty();
    1958                 :            : #endif
    1959                 :       3748 :     sal_Bool bOneEdgeMarked=sal_False;
    1960         [ +  + ]:       3748 :     if (GetMarkedObjectCount()==1) {
    1961                 :        823 :         const SdrObject* pObj=GetMarkedObjectByIndex(0);
    1962         [ +  - ]:        823 :         if (pObj->GetObjInventor()==SdrInventor) {
    1963                 :        823 :             sal_uInt16 nIdent=pObj->GetObjIdentifier();
    1964                 :        823 :             bOneEdgeMarked=nIdent==OBJ_EDGE;
    1965                 :            :         }
    1966                 :            :     }
    1967                 :       3748 :     ImpSetGlueVisible4(bOneEdgeMarked);
    1968                 :       3748 : }
    1969                 :            : 
    1970                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
    1971                 :            : 
    1972                 :          0 : void SdrMarkView::SetMoveOutside(sal_Bool bOn)
    1973                 :            : {
    1974                 :          0 :     aHdl.SetMoveOutside(bOn);
    1975                 :          0 : }
    1976                 :            : 
    1977                 :       5510 : void SdrMarkView::SetDesignMode( sal_Bool _bOn )
    1978                 :            : {
    1979         [ +  + ]:       5510 :     if ( bDesignMode != _bOn )
    1980                 :            :     {
    1981                 :       4490 :         bDesignMode = _bOn;
    1982                 :       4490 :         SdrPageView* pPageView = GetSdrPageView();
    1983         [ +  + ]:       4490 :         if ( pPageView )
    1984                 :          4 :             pPageView->SetDesignMode( _bOn );
    1985                 :            :     }
    1986                 :       5510 : }
    1987                 :            : 
    1988                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10