LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sc/source/ui/drawfunc - fusel.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 6 252 2.4 %
Date: 2013-07-09 Functions: 5 12 41.7 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10