LCOV - code coverage report
Current view: top level - sc/source/ui/drawfunc - fusel.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 5 241 2.1 %
Date: 2012-08-25 Functions: 3 10 30.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 514 0.2 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <com/sun/star/embed/EmbedStates.hpp>
      30                 :            : 
      31                 :            : #include <editeng/eeitem.hxx>
      32                 :            : #include <editeng/flditem.hxx>
      33                 :            : #include <svx/svdoole2.hxx>
      34                 :            : #include <svx/svdotext.hxx>
      35                 :            : #include <sfx2/dispatch.hxx>
      36                 :            : #include <svtools/imapobj.hxx>
      37                 :            : #include <svx/svdouno.hxx>
      38                 :            : #include <svx/svdomedia.hxx>
      39                 :            : #include <svx/svdpagv.hxx>
      40                 :            : #include <editeng/outlobj.hxx>
      41                 :            : #include <svx/svdocapt.hxx>
      42                 :            : #include <sfx2/app.hxx>
      43                 :            : 
      44                 :            : #include "fusel.hxx"
      45                 :            : #include "sc.hrc"
      46                 :            : #include "fudraw.hxx"
      47                 :            : #include "futext.hxx"
      48                 :            : #include "drawview.hxx"
      49                 :            : #include "tabvwsh.hxx"
      50                 :            : #include "drawpage.hxx"
      51                 :            : #include "globstr.hrc"
      52                 :            : #include "drwlayer.hxx"
      53                 :            : #include "userdat.hxx"
      54                 :            : #include "scmod.hxx"
      55                 :            : #include "client.hxx"
      56                 :            : #include "charthelper.hxx"
      57                 :            : #include "docuno.hxx"
      58                 :            : #include "docsh.hxx"
      59                 :            : 
      60                 :            : // -----------------------------------------------------------------------
      61                 :            : 
      62                 :            : //  Maximal erlaubte Mausbewegung um noch Drag&Drop zu starten
      63                 :            : //! fusel,fuconstr,futext - zusammenfassen!
      64                 :            : #define SC_MAXDRAGMOVE  3
      65                 :            : 
      66                 :            : // -----------------------------------------------------------------------
      67                 :            : 
      68                 :            : #ifdef _MSC_VER
      69                 :            : #pragma optimize ( "", off )
      70                 :            : #endif
      71                 :            : 
      72                 :            : using namespace com::sun::star;
      73                 :            : 
      74                 :            : /*************************************************************************
      75                 :            : |*
      76                 :            : |* Konstruktor
      77                 :            : |*
      78                 :            : \************************************************************************/
      79                 :            : 
      80                 :        229 : FuSelection::FuSelection(ScTabViewShell* pViewSh, Window* pWin, ScDrawView* pViewP,
      81                 :            :                SdrModel* pDoc, SfxRequest& rReq ) :
      82                 :            :     FuDraw(pViewSh, pWin, pViewP, pDoc, rReq),
      83                 :        229 :     bVCAction(false)
      84                 :            : {
      85                 :        229 : }
      86                 :            : 
      87                 :            : /*************************************************************************
      88                 :            : |*
      89                 :            : |* Destruktor
      90                 :            : |*
      91                 :            : \************************************************************************/
      92                 :            : 
      93                 :        225 : FuSelection::~FuSelection()
      94                 :            : {
      95         [ -  + ]:        450 : }
      96                 :            : 
      97                 :          0 : sal_uInt8 FuSelection::Command(const CommandEvent& rCEvt)
      98                 :            : {
      99                 :            :     //  special code for non-VCL OS2/UNX removed
     100                 :            : 
     101                 :          0 :     return FuDraw::Command( rCEvt );
     102                 :            : }
     103                 :            : 
     104                 :            : /*************************************************************************
     105                 :            : |*
     106                 :            : |* MouseButtonDown-event
     107                 :            : |*
     108                 :            : \************************************************************************/
     109                 :            : 
     110                 :          0 : sal_Bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
     111                 :            : {
     112                 :            :     // remember button state for creation of own MouseEvents
     113                 :          0 :     SetMouseButtonCode(rMEvt.GetButtons());
     114                 :          0 :     const bool bSelectionOnly = rMEvt.IsRight();
     115         [ #  # ]:          0 :     if ( pView->IsAction() )
     116                 :            :     {
     117         [ #  # ]:          0 :         if ( bSelectionOnly )
     118                 :          0 :             pView->BckAction();
     119                 :          0 :         return sal_True;
     120                 :            :     }
     121                 :            : 
     122                 :          0 :     bVCAction = false;
     123                 :          0 :     bIsInDragMode = false;      //  irgendwo muss es ja zurueckgesetzt werden (#50033#)
     124                 :            : 
     125                 :          0 :     sal_Bool bReturn = FuDraw::MouseButtonDown(rMEvt);
     126                 :            : 
     127                 :          0 :     aMDPos = pWindow->PixelToLogic( rMEvt.GetPosPixel() );
     128                 :            : 
     129         [ #  # ]:          0 :     if ( rMEvt.IsLeft() )
     130                 :            :     {
     131         [ #  # ]:          0 :         SdrHdl* pHdl = pView->PickHandle(aMDPos);
     132                 :            :         SdrObject* pObj;
     133                 :            :         SdrPageView* pPV;
     134                 :            : 
     135 [ #  # ][ #  # ]:          0 :         if ( pHdl!=NULL || pView->IsMarkedHit(aMDPos) )
         [ #  # ][ #  # ]
     136                 :            :         {
     137                 :            :             // Determine if this is the tail of a SdrCaptionObj i.e.
     138                 :            :             // we need to disable the drag option on the tail of a note
     139                 :            :             // object. Also, disable the ability to use the circular
     140                 :            :             // drag of a note object.
     141                 :          0 :             bool bDrag = false;
     142                 :          0 :             const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
     143         [ #  # ]:          0 :             if( rMarkList.GetMarkCount() == 1 )
     144                 :            :             {
     145 [ #  # ][ #  # ]:          0 :                 SdrObject* pMarkedObj = rMarkList.GetMark( 0 )->GetMarkedSdrObj();
     146 [ #  # ][ #  # ]:          0 :                 if( ScDrawLayer::IsNoteCaption( pMarkedObj ) )
     147                 :            :                 {
     148                 :            :                     // move using the valid caption handles for note text box.
     149 [ #  # ][ #  # ]:          0 :                     if(pHdl && (pHdl->GetKind() != HDL_POLY && pHdl->GetKind() != HDL_CIRC))
         [ #  # ][ #  # ]
     150                 :          0 :                         bDrag = true;
     151                 :            :                     // move the complete note box.
     152         [ #  # ]:          0 :                     else if(!pHdl)
     153                 :          0 :                         bDrag = true;
     154                 :            :                 }
     155                 :            :                 else
     156                 :          0 :                     bDrag = true;   // different object
     157                 :            :             }
     158                 :            :             else
     159                 :          0 :                 bDrag = true;       // several objects
     160                 :            : 
     161         [ #  # ]:          0 :             if ( bDrag )
     162                 :            :             {
     163         [ #  # ]:          0 :                 aDragTimer.Start();
     164         [ #  # ]:          0 :                 pView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl);
     165                 :          0 :                 bReturn = sal_True;
     166                 :            :             }
     167                 :            :         }
     168                 :            :         else
     169                 :            :         {
     170                 :          0 :             sal_Bool bAlt = rMEvt.IsMod2();
     171 [ #  # ][ #  # ]:          0 :             if ( !bAlt && pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_PICKMACRO) )
         [ #  # ][ #  # ]
     172                 :            :             {
     173         [ #  # ]:          0 :                 pView->BegMacroObj(aMDPos, pObj, pPV, pWindow);
     174                 :          0 :                 bReturn = sal_True;
     175                 :            :             }
     176                 :            :             else
     177                 :            :             {
     178 [ #  # ][ #  # ]:          0 :                 String sURL, sTarget;
     179 [ #  # ][ #  # ]:          0 :                 if ( !bAlt && pView->PickObj(aMDPos, pView->getHitTolLog(), pObj, pPV, SDRSEARCH_ALSOONMASTER))
         [ #  # ][ #  # ]
     180                 :            :                 {
     181                 :            :                    // Support for imported Excel docs
     182                 :            :                    // Excel is of course not consistent and allows
     183                 :            :                    // a hyperlink to be assigned for an object group
     184                 :            :                    // and even though the hyperlink is exported in the Escher layer
     185                 :            :                    // its never used, when dealing with a group object the link
     186                 :            :                    // associated with the clicked object is used only
     187                 :            : 
     188                 :            :                    // additionally you can also select a macro in Excel for a grouped
     189                 :            :                    // objects and this *usually* results in the macro being set
     190                 :            :                    // for the elements in the group and no macro is exported
     191                 :            :                    // for the group itself ( this however is not always true )
     192                 :            :                    // if a macro and hlink are defined favour the hlink
     193                 :            :                    // If a group object has no hyperlink use the hyperlink of the
     194                 :            :                    // object clicked
     195                 :            : 
     196 [ #  # ][ #  # ]:          0 :                    if ( pObj->IsGroupObject() )
     197                 :            :                    {
     198         [ #  # ]:          0 :                        ScMacroInfo* pTmpInfo = ScDrawLayer::GetMacroInfo( pObj );
     199 [ #  # ][ #  # ]:          0 :                        if ( !pTmpInfo || pTmpInfo->GetMacro().isEmpty() )
                 [ #  # ]
     200                 :            :                        {
     201                 :          0 :                            SdrObject* pHit = NULL;
     202 [ #  # ][ #  # ]:          0 :                            if ( pView->PickObj(aMDPos, pView->getHitTolLog(), pHit, pPV, SDRSEARCH_DEEP ) )
     203                 :          0 :                                pObj = pHit;
     204                 :            :                        }
     205                 :            :                    }
     206                 :            : 
     207         [ #  # ]:          0 :                    ScMacroInfo* pInfo = ScDrawLayer::GetMacroInfo( pObj, true );
     208                 :            :                    // For interoperability favour links over macros if both are defined
     209         [ #  # ]:          0 :                    if ( !pInfo->GetHlink().isEmpty() )
     210                 :            :                    {
     211                 :            :                        OSL_TRACE("** Got URL");
     212         [ #  # ]:          0 :                        sURL = pInfo->GetHlink();
     213                 :            :                    }
     214         [ #  # ]:          0 :                    else if ( !pInfo->GetMacro().isEmpty() )
     215                 :            :                    {
     216         [ #  # ]:          0 :                        SfxObjectShell* pObjSh = SfxObjectShell::Current();
     217 [ #  # ][ #  # ]:          0 :                        if ( pObjSh && SfxApplication::IsXScriptURL( pInfo->GetMacro() ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
     218                 :            :                        {
     219 [ #  # ][ #  # ]:          0 :                            uno::Reference< beans::XPropertySet > xProps( pObj->getUnoShape(), uno::UNO_QUERY );
     220                 :          0 :                            uno::Any aCaller;
     221         [ #  # ]:          0 :                            if ( xProps.is() )
     222                 :            :                            {
     223                 :            :                                try
     224                 :            :                                {
     225 [ #  # ][ #  # ]:          0 :                                    aCaller = xProps->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name")) );
         [ #  # ][ #  # ]
     226                 :            :                                }
     227         [ #  # ]:          0 :                                catch( uno::Exception& ) {}
     228                 :            :                            }
     229                 :          0 :                            uno::Any aRet;
     230         [ #  # ]:          0 :                            uno::Sequence< sal_Int16 > aOutArgsIndex;
     231         [ #  # ]:          0 :                            uno::Sequence< uno::Any > aOutArgs;
     232                 :            :                            uno::Sequence< uno::Any >* pInArgs =
     233         [ #  # ]:          0 :                                new uno::Sequence< uno::Any >(0);
     234                 :          0 :                            pObjSh->CallXScript( pInfo->GetMacro(),
     235 [ #  # ][ #  # ]:          0 :                                *pInArgs, aRet, aOutArgsIndex, aOutArgs, true, &aCaller );
                 [ #  # ]
     236         [ #  # ]:          0 :                            pViewShell->FakeButtonUp( pViewShell->GetViewData()->GetActivePart() );
     237 [ #  # ][ #  # ]:          0 :                            return sal_True;        // kein CaptureMouse etc.
     238                 :            :                        }
     239                 :            :                    }
     240                 :            :                 }
     241                 :            : 
     242                 :            :                 //  URL / ImageMap
     243                 :            : 
     244         [ #  # ]:          0 :                 SdrViewEvent aVEvt;
     245 [ #  # ][ #  # ]:          0 :                 if ( !bAlt &&
         [ #  # ][ #  # ]
     246         [ #  # ]:          0 :                     pView->PickAnything( rMEvt, SDRMOUSEBUTTONDOWN, aVEvt ) != SDRHIT_NONE &&
     247                 :            :                     aVEvt.pObj != NULL )
     248                 :            :                 {
     249 [ #  # ][ #  # ]:          0 :                     if ( ScDrawLayer::GetIMapInfo( aVEvt.pObj ) )       // ImageMap
     250                 :            :                     {
     251                 :            :                         const IMapObject* pIMapObj =
     252         [ #  # ]:          0 :                                 ScDrawLayer::GetHitIMapObject( aVEvt.pObj, aMDPos, *pWindow );
     253 [ #  # ][ #  # ]:          0 :                         if ( pIMapObj && pIMapObj->GetURL().Len() )
                 [ #  # ]
     254                 :            :                         {
     255         [ #  # ]:          0 :                             sURL = pIMapObj->GetURL();
     256         [ #  # ]:          0 :                             sTarget = pIMapObj->GetTarget();
     257                 :            :                         }
     258                 :            :                     }
     259 [ #  # ][ #  # ]:          0 :                     if ( aVEvt.eEvent == SDREVENT_EXECUTEURL && aVEvt.pURLField )   // URL
     260                 :            :                     {
     261         [ #  # ]:          0 :                         sURL = aVEvt.pURLField->GetURL();
     262         [ #  # ]:          0 :                         sTarget = aVEvt.pURLField->GetTargetFrame();
     263                 :            :                     }
     264                 :            :                 }
     265                 :            : 
     266                 :            :                 // open hyperlink, if found at object or in object's text
     267         [ #  # ]:          0 :                 if ( sURL.Len() > 0 )
     268                 :            :                 {
     269         [ #  # ]:          0 :                     ScGlobal::OpenURL( sURL, sTarget );
     270         [ #  # ]:          0 :                     pViewShell->FakeButtonUp( pViewShell->GetViewData()->GetActivePart() );
     271                 :          0 :                     return sal_True;        // kein CaptureMouse etc.
     272                 :            :                 }
     273                 :            : 
     274                 :            :                 //  Is another object being edited in this view?
     275                 :            :                 //  (Editing is ended in MarkListHasChanged - test before UnmarkAll)
     276         [ #  # ]:          0 :                 SfxInPlaceClient* pClient = pViewShell->GetIPClient();
     277 [ #  # ][ #  # ]:          0 :                 sal_Bool bWasOleActive = ( pClient && pClient->IsObjectInPlaceActive() );
                 [ #  # ]
     278                 :            : 
     279                 :            :                 //  Markieren
     280                 :            : 
     281                 :            :                 // do not allow multiselection with note caption
     282         [ #  # ]:          0 :                 bool bCaptionClicked = IsNoteCaptionClicked( aMDPos );
     283 [ #  # ][ #  # ]:          0 :                 if ( !rMEvt.IsShift() || bCaptionClicked || IsNoteCaptionMarked() )
         [ #  # ][ #  # ]
                 [ #  # ]
     284         [ #  # ]:          0 :                     pView->UnmarkAll();
     285                 :            : 
     286                 :            :                 /*  Unlock internal layer, if a note caption is clicked. The
     287                 :            :                     layer will be relocked in ScDrawView::MarkListHasChanged(). */
     288         [ #  # ]:          0 :                 if( bCaptionClicked )
     289         [ #  # ]:          0 :                     pView->UnlockInternalLayer();
     290                 :            : 
     291                 :            :                 // try to select the clicked object
     292 [ #  # ][ #  # ]:          0 :                 if ( pView->MarkObj( aMDPos, -2, false, rMEvt.IsMod1() ) )
     293                 :            :                 {
     294                 :            :                     //*********************************************************
     295                 :            :                     //Objekt verschieben
     296                 :            :                     //********************************************************
     297 [ #  # ][ #  # ]:          0 :                     if (pView->IsMarkedHit(aMDPos))
     298                 :            :                     {
     299                 :            :                         //  Don't start drag timer if inplace editing of an OLE object
     300                 :            :                         //  was just ended with this mouse click - the view will be moved
     301                 :            :                         //  (different tool bars) and the object that was clicked on would
     302                 :            :                         //  be moved unintentionally.
     303         [ #  # ]:          0 :                         if ( !bWasOleActive )
     304         [ #  # ]:          0 :                             aDragTimer.Start();
     305                 :            : 
     306         [ #  # ]:          0 :                         pHdl=pView->PickHandle(aMDPos);
     307         [ #  # ]:          0 :                         pView->BegDragObj(aMDPos, (OutputDevice*) NULL, pHdl);
     308                 :          0 :                         bReturn = sal_True;
     309                 :            :                     }
     310                 :            :                     else                                    // Objekt am Rand getroffen
     311         [ #  # ]:          0 :                         if (pViewShell->IsDrawSelMode())
     312                 :          0 :                             bReturn = sal_True;
     313                 :            :                 }
     314                 :            :                 else
     315                 :            :                 {
     316                 :            :                     //      nichts getroffen
     317                 :            : 
     318         [ #  # ]:          0 :                     if (pViewShell->IsDrawSelMode())
     319                 :            :                     {
     320                 :            :                         //*********************************************************
     321                 :            :                         //Objekt selektieren
     322                 :            :                         //********************************************************
     323         [ #  # ]:          0 :                         pView->BegMarkObj(aMDPos);
     324                 :          0 :                         bReturn = sal_True;
     325                 :            :                     }
     326 [ #  # ][ #  # ]:          0 :                 }
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     327                 :            :             }
     328                 :            :         }
     329                 :            : 
     330                 :            :     }
     331                 :            : 
     332         [ #  # ]:          0 :     if (!bIsInDragMode)
     333                 :            :     {
     334         [ #  # ]:          0 :         if (!bVCAction)                 // VC rufen selber CaptureMouse
     335                 :          0 :             pWindow->CaptureMouse();
     336                 :          0 :         ForcePointer(&rMEvt);
     337                 :            :     }
     338                 :            : 
     339                 :          0 :     return bReturn;
     340                 :            : }
     341                 :            : 
     342                 :            : /*************************************************************************
     343                 :            : |*
     344                 :            : |* MouseMove-event
     345                 :            : |*
     346                 :            : \************************************************************************/
     347                 :            : 
     348                 :          0 : sal_Bool FuSelection::MouseMove(const MouseEvent& rMEvt)
     349                 :            : {
     350                 :          0 :     sal_Bool bReturn = FuDraw::MouseMove(rMEvt);
     351                 :            : 
     352         [ #  # ]:          0 :     if (aDragTimer.IsActive() )
     353                 :            :     {
     354         [ #  # ]:          0 :         Point aOldPixel = pWindow->LogicToPixel( aMDPos );
     355                 :          0 :         Point aNewPixel = rMEvt.GetPosPixel();
     356         [ #  # ]:          0 :         if ( Abs( aOldPixel.X() - aNewPixel.X() ) > SC_MAXDRAGMOVE ||
           [ #  #  #  # ]
     357                 :          0 :              Abs( aOldPixel.Y() - aNewPixel.Y() ) > SC_MAXDRAGMOVE )
     358         [ #  # ]:          0 :             aDragTimer.Stop();
     359                 :            :     }
     360                 :            : 
     361         [ #  # ]:          0 :     if ( pView->IsAction() )
     362                 :            :     {
     363                 :          0 :         Point aPix(rMEvt.GetPosPixel());
     364         [ #  # ]:          0 :         Point aPnt(pWindow->PixelToLogic(aPix));
     365                 :            : 
     366         [ #  # ]:          0 :         ForceScroll(aPix);
     367         [ #  # ]:          0 :         pView->MovAction(aPnt);
     368                 :          0 :         bReturn = sal_True;
     369                 :            :     }
     370                 :            : 
     371                 :            :     // Ein VCControl ist aktiv
     372                 :            :     // Event an den Manager weiterleiten
     373         [ #  # ]:          0 :     if( bVCAction )
     374                 :            :     {
     375                 :          0 :         bReturn = true;
     376                 :            :     }
     377                 :            : 
     378                 :          0 :     ForcePointer(&rMEvt);
     379                 :            : 
     380                 :          0 :     return (bReturn);
     381                 :            : }
     382                 :            : 
     383                 :            : /*************************************************************************
     384                 :            : |*
     385                 :            : |* MouseButtonUp-event
     386                 :            : |*
     387                 :            : \************************************************************************/
     388                 :            : 
     389                 :          0 : sal_Bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt)
     390                 :            : {
     391                 :            :     // remember button state for creation of own MouseEvents
     392                 :          0 :     SetMouseButtonCode(rMEvt.GetButtons());
     393                 :            : 
     394         [ #  # ]:          0 :     sal_Bool bReturn = FuDraw::MouseButtonUp(rMEvt);
     395 [ #  # ][ #  # ]:          0 :     sal_Bool bOle = pViewShell->GetViewFrame()->GetFrame().IsInPlace();
     396                 :            : 
     397         [ #  # ]:          0 :     if (aDragTimer.IsActive() )
     398                 :            :     {
     399         [ #  # ]:          0 :         aDragTimer.Stop();
     400                 :            :     }
     401                 :            : 
     402         [ #  # ]:          0 :     Point aPnt( pWindow->PixelToLogic( rMEvt.GetPosPixel() ) );
     403                 :            : 
     404                 :          0 :     bool bCopy = false;
     405         [ #  # ]:          0 :     ScViewData* pViewData = ( pViewShell ? pViewShell->GetViewData() : NULL );
     406 [ #  # ][ #  # ]:          0 :     ScDocument* pDocument = ( pViewData ? pViewData->GetDocument() : NULL );
     407         [ #  # ]:          0 :     SdrPageView* pPageView = ( pView ? pView->GetSdrPageView() : NULL );
     408         [ #  # ]:          0 :     SdrPage* pPage = ( pPageView ? pPageView->GetPage() : NULL );
     409         [ #  # ]:          0 :     ::std::vector< ::rtl::OUString > aExcludedChartNames;
     410         [ #  # ]:          0 :     ScRangeListVector aProtectedChartRangesVector;
     411                 :            : 
     412         [ #  # ]:          0 :     if ( rMEvt.IsLeft() )
     413                 :            :     {
     414         [ #  # ]:          0 :         if ( pView->IsDragObj() )
     415                 :            :         {
     416                 :            :             /******************************************************************
     417                 :            :             * Objekt wurde verschoben
     418                 :            :             ******************************************************************/
     419         [ #  # ]:          0 :             if ( rMEvt.IsMod1() )
     420                 :            :             {
     421         [ #  # ]:          0 :                 if ( pPage )
     422                 :            :                 {
     423         [ #  # ]:          0 :                     ScChartHelper::GetChartNames( aExcludedChartNames, pPage );
     424                 :            :                 }
     425 [ #  # ][ #  # ]:          0 :                 if ( pView && pDocument )
     426                 :            :                 {
     427                 :          0 :                     const SdrMarkList& rSdrMarkList = pView->GetMarkedObjectList();
     428                 :          0 :                     sal_uLong nMarkCount = rSdrMarkList.GetMarkCount();
     429         [ #  # ]:          0 :                     for ( sal_uLong i = 0; i < nMarkCount; ++i )
     430                 :            :                     {
     431         [ #  # ]:          0 :                         SdrMark* pMark = rSdrMarkList.GetMark( i );
     432 [ #  # ][ #  # ]:          0 :                         SdrObject* pObj = ( pMark ? pMark->GetMarkedSdrObj() : NULL );
     433         [ #  # ]:          0 :                         if ( pObj )
     434                 :            :                         {
     435         [ #  # ]:          0 :                             ScChartHelper::AddRangesIfProtectedChart( aProtectedChartRangesVector, pDocument, pObj );
     436                 :            :                         }
     437                 :            :                     }
     438                 :            :                 }
     439                 :          0 :                 bCopy = true;
     440                 :            :             }
     441                 :            : 
     442         [ #  # ]:          0 :             pView->EndDragObj( rMEvt.IsMod1() );
     443         [ #  # ]:          0 :             pView->ForceMarkedToAnotherPage();
     444                 :            : 
     445                 :          0 :             const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
     446         [ #  # ]:          0 :             if (rMarkList.GetMarkCount() == 1)
     447                 :            :             {
     448         [ #  # ]:          0 :                   SdrMark* pMark = rMarkList.GetMark(0);
     449         [ #  # ]:          0 :                   SdrObject* pObj = pMark->GetMarkedSdrObj();
     450                 :          0 :                   FuPoor* pPoor = pViewShell->GetViewData()->GetView()->GetDrawFuncPtr();
     451                 :          0 :                   FuText* pText = static_cast<FuText*>(pPoor);
     452         [ #  # ]:          0 :                 pText->StopDragMode(pObj );
     453                 :            :             }
     454                 :          0 :             bReturn = sal_True;
     455                 :            :         }
     456 [ #  # ][ #  # ]:          0 :         else if (pView->IsAction() )
     457                 :            :         {
     458                 :            :             // unlock internal layer to include note captions
     459         [ #  # ]:          0 :             pView->UnlockInternalLayer();
     460         [ #  # ]:          0 :             pView->EndAction();
     461         [ #  # ]:          0 :             if ( pView->AreObjectsMarked() )
     462                 :            :             {
     463                 :          0 :                 bReturn = sal_True;
     464                 :            : 
     465                 :            :                 /*  if multi-selection contains a note caption object, remove
     466                 :            :                     all other objects from selection. */
     467                 :          0 :                 const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
     468                 :          0 :                 sal_uLong nCount = rMarkList.GetMarkCount();
     469         [ #  # ]:          0 :                 if( nCount > 1 )
     470                 :            :                 {
     471                 :          0 :                     bool bFound = false;
     472 [ #  # ][ #  # ]:          0 :                     for( sal_uLong nIdx = 0; !bFound && (nIdx < nCount); ++nIdx )
                 [ #  # ]
     473                 :            :                     {
     474 [ #  # ][ #  # ]:          0 :                         SdrObject* pObj = rMarkList.GetMark( nIdx )->GetMarkedSdrObj();
     475         [ #  # ]:          0 :                         bFound = ScDrawLayer::IsNoteCaption( pObj );
     476         [ #  # ]:          0 :                         if( bFound )
     477                 :            :                         {
     478         [ #  # ]:          0 :                             pView->UnMarkAll();
     479         [ #  # ]:          0 :                             pView->MarkObj( pObj, pView->GetSdrPageView() );
     480                 :            :                         }
     481                 :            :                     }
     482                 :            :                 }
     483                 :            :             }
     484                 :            :         }
     485                 :            :     }
     486                 :            : 
     487                 :            :     /**************************************************************************
     488                 :            :     * Ggf. OLE-Objekt beruecksichtigen
     489                 :            :     **************************************************************************/
     490         [ #  # ]:          0 :     SfxInPlaceClient* pIPClient = pViewShell->GetIPClient();
     491                 :            : 
     492         [ #  # ]:          0 :     if (pIPClient)
     493                 :            :     {
     494         [ #  # ]:          0 :         ScModule* pScMod = SC_MOD();
     495 [ #  # ][ #  # ]:          0 :         bool bUnoRefDialog = pScMod->IsRefDialogOpen() && pScMod->GetCurRefDlgId() == WID_SIMPLE_REF;
                 [ #  # ]
     496                 :            : 
     497 [ #  # ][ #  # ]:          0 :         if ( pIPClient->IsObjectInPlaceActive() && !bUnoRefDialog )
         [ #  # ][ #  # ]
     498         [ #  # ]:          0 :             pIPClient->DeactivateObject();
     499                 :            :     }
     500                 :            : 
     501                 :          0 :     sal_uInt16 nClicks = rMEvt.GetClicks();
     502 [ #  # ][ #  # ]:          0 :     if ( nClicks == 2 && rMEvt.IsLeft() )
                 [ #  # ]
     503                 :            :     {
     504         [ #  # ]:          0 :         if ( pView->AreObjectsMarked() )
     505                 :            :         {
     506                 :          0 :             const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
     507         [ #  # ]:          0 :             if (rMarkList.GetMarkCount() == 1)
     508                 :            :             {
     509         [ #  # ]:          0 :                 SdrMark* pMark = rMarkList.GetMark(0);
     510         [ #  # ]:          0 :                 SdrObject* pObj = pMark->GetMarkedSdrObj();
     511                 :            : 
     512                 :            :                 //  aktivieren nur, wenn die Maus auch (noch) ueber dem
     513                 :            :                 //  selektierten Objekt steht
     514                 :            : 
     515         [ #  # ]:          0 :                 SdrViewEvent aVEvt;
     516         [ #  # ]:          0 :                 SdrHitKind eHit = pView->PickAnything( rMEvt, SDRMOUSEBUTTONDOWN, aVEvt );
     517 [ #  # ][ #  # ]:          0 :                 if ( eHit != SDRHIT_NONE && aVEvt.pObj == pObj )
     518                 :            :                 {
     519         [ #  # ]:          0 :                     sal_uInt16 nSdrObjKind = pObj->GetObjIdentifier();
     520                 :            : 
     521                 :            :                     //
     522                 :            :                     //  OLE: aktivieren
     523                 :            :                     //
     524                 :            : 
     525         [ #  # ]:          0 :                     if (nSdrObjKind == OBJ_OLE2)
     526                 :            :                     {
     527         [ #  # ]:          0 :                         if (!bOle)
     528                 :            :                         {
     529 [ #  # ][ #  # ]:          0 :                             if (((SdrOle2Obj*) pObj)->GetObjRef().is())
     530                 :            :                             {
     531         [ #  # ]:          0 :                                 pViewShell->ActivateObject( (SdrOle2Obj*) pObj, 0 );
     532                 :            :                             }
     533                 :            :                         }
     534                 :            :                     }
     535                 :            : 
     536                 :            :                     //
     537                 :            :                     //  Edit text
     538                 :            :                     //  not in UNO controls
     539                 :            :                     //  #i32352# not in media objects
     540                 :            :                     //
     541 [ #  # ][ #  # ]:          0 :                     else if ( pObj->ISA(SdrTextObj) && !pObj->ISA(SdrUnoObj) && !pObj->ISA(SdrMediaObj) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     542                 :            :                     {
     543         [ #  # ]:          0 :                         OutlinerParaObject* pOPO = pObj->GetOutlinerParaObject();
     544 [ #  # ][ #  # ]:          0 :                         sal_Bool bVertical = ( pOPO && pOPO->IsVertical() );
                 [ #  # ]
     545         [ #  # ]:          0 :                         sal_uInt16 nTextSlotId = bVertical ? SID_DRAW_TEXT_VERTICAL : SID_DRAW_TEXT;
     546                 :            : 
     547         [ #  # ]:          0 :                         pViewShell->GetViewData()->GetDispatcher().
     548         [ #  # ]:          0 :                             Execute(nTextSlotId, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD);
     549                 :            : 
     550                 :            :                         // jetzt den erzeugten FuText holen und in den EditModus setzen
     551                 :          0 :                         FuPoor* pPoor = pViewShell->GetViewData()->GetView()->GetDrawFuncPtr();
     552 [ #  # ][ #  # ]:          0 :                         if ( pPoor && pPoor->GetSlotID() == nTextSlotId )    // hat keine RTTI
                 [ #  # ]
     553                 :            :                         {
     554                 :          0 :                             FuText* pText = (FuText*)pPoor;
     555                 :          0 :                             Point aMousePixel = rMEvt.GetPosPixel();
     556         [ #  # ]:          0 :                             pText->SetInEditMode( pObj, &aMousePixel );
     557                 :            :                         }
     558                 :          0 :                         bReturn = sal_True;
     559                 :            :                     }
     560         [ #  # ]:          0 :                 }
     561                 :            :             }
     562                 :            :         }
     563 [ #  # ][ #  # ]:          0 :         else if ( TestDetective( pView->GetSdrPageView(), aPnt ) )
     564                 :          0 :             bReturn = sal_True;
     565                 :            :     }
     566                 :            : 
     567                 :            :     // Ein VCControl ist aktiv
     568                 :            :     // Event an den Manager weiterleiten
     569         [ #  # ]:          0 :     if( bVCAction )
     570                 :            :     {
     571                 :          0 :         bVCAction = false;
     572                 :          0 :         bReturn = true;
     573                 :            :     }
     574                 :            : 
     575         [ #  # ]:          0 :     ForcePointer(&rMEvt);
     576                 :            : 
     577         [ #  # ]:          0 :     pWindow->ReleaseMouse();
     578                 :            : 
     579                 :            :     //  Command-Handler fuer Kontext-Menue kommt erst nach MouseButtonUp,
     580                 :            :     //  darum hier die harte IsLeft-Abfrage
     581 [ #  # ][ #  # ]:          0 :     if ( !bReturn && rMEvt.IsLeft() )
                 [ #  # ]
     582         [ #  # ]:          0 :         if (pViewShell->IsDrawSelMode())
     583         [ #  # ]:          0 :             pViewShell->GetViewData()->GetDispatcher().
     584         [ #  # ]:          0 :                 Execute(SID_OBJECT_SELECT, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
     585                 :            : 
     586 [ #  # ][ #  # ]:          0 :     if ( bCopy && pViewData && pDocument && pPage )
         [ #  # ][ #  # ]
     587                 :            :     {
     588                 :          0 :         ScDocShell* pDocShell = pViewData->GetDocShell();
     589 [ #  # ][ #  # ]:          0 :         ScModelObj* pModelObj = ( pDocShell ? ScModelObj::getImplementation( pDocShell->GetModel() ) : NULL );
         [ #  # ][ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
     590         [ #  # ]:          0 :         if ( pModelObj )
     591                 :            :         {
     592                 :          0 :             SCTAB nTab = pViewData->GetTabNo();
     593                 :            :             ScChartHelper::CreateProtectedChartListenersAndNotify( pDocument, pPage, pModelObj, nTab,
     594         [ #  # ]:          0 :                 aProtectedChartRangesVector, aExcludedChartNames );
     595                 :            :         }
     596                 :            :     }
     597                 :            : 
     598                 :          0 :     return (bReturn);
     599                 :            : }
     600                 :            : 
     601                 :            : /*************************************************************************
     602                 :            : |*
     603                 :            : |* Tastaturereignisse bearbeiten
     604                 :            : |*
     605                 :            : |* Wird ein KeyEvent bearbeitet, so ist der Return-Wert sal_True, andernfalls
     606                 :            : |* FALSE.
     607                 :            : |*
     608                 :            : \************************************************************************/
     609                 :            : 
     610                 :          0 : sal_Bool FuSelection::KeyInput(const KeyEvent& rKEvt)
     611                 :            : {
     612                 :          0 :     sal_Bool bReturn = false;
     613                 :            : 
     614         [ #  # ]:          0 :     if (!bReturn)
     615                 :            :     {
     616                 :          0 :         bReturn = FuDraw::KeyInput(rKEvt);
     617                 :            :     }
     618                 :            : 
     619                 :          0 :     return(bReturn);
     620                 :            : }
     621                 :            : 
     622                 :            : 
     623                 :            : /*************************************************************************
     624                 :            : |*
     625                 :            : |* Function aktivieren
     626                 :            : |*
     627                 :            : \************************************************************************/
     628                 :            : 
     629                 :          0 : void FuSelection::Activate()
     630                 :            : {
     631                 :          0 :     FuDraw::Activate();
     632                 :          0 : }
     633                 :            : 
     634                 :            : /*************************************************************************
     635                 :            : |*
     636                 :            : |* Function deaktivieren
     637                 :            : |*
     638                 :            : \************************************************************************/
     639                 :            : 
     640                 :          0 : void FuSelection::Deactivate()
     641                 :            : {
     642                 :            :     /**************************************************************************
     643                 :            :     * Hide Cursor
     644                 :            :     **************************************************************************/
     645                 :          0 :     FuDraw::Deactivate();
     646                 :          0 : }
     647                 :            : 
     648                 :            : 
     649                 :            : #ifdef _MSC_VER
     650                 :            : #pragma optimize ( "", on )
     651                 :            : #endif
     652                 :            : 
     653                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10